palmier 1.1.8 → 1.1.10
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/dist/agents/agent-instructions.md +6 -0
- package/dist/agents/shared-prompt.d.ts +1 -0
- package/dist/agents/shared-prompt.js +1 -0
- package/dist/commands/init.js +2 -2
- package/dist/commands/run.d.ts +1 -0
- package/dist/commands/run.js +36 -10
- package/dist/commands/serve.js +2 -2
- package/dist/pwa/assets/{index-BuSLgLCl.js → index-DO60N3KY.js} +33 -33
- package/dist/pwa/assets/index-DvUi9Jhi.css +1 -0
- package/dist/pwa/assets/{web-BIv7BTtP.js → web-BQcwgjLy.js} +1 -1
- package/dist/pwa/assets/{web-B4ZYORQP.js → web-DjwtZB4p.js} +1 -1
- package/dist/pwa/assets/{web-DtlUNQHI.js → web-dCWmWPLg.js} +1 -1
- package/dist/pwa/index.html +2 -2
- package/dist/rpc-handler.js +49 -9
- package/dist/task.d.ts +11 -1
- package/dist/task.js +17 -0
- package/dist/types.d.ts +5 -0
- package/package.json +1 -1
- package/dist/pwa/assets/index-UIYx_N7v.css +0 -1
|
@@ -14,7 +14,7 @@ var aS=Object.defineProperty;var lS=(e,t,r)=>t in e?aS(e,t,{enumerable:!0,config
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var e0;function cS(){if(e0)return Je;e0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function v(z){return z===null||typeof z!="object"?null:(z=x&&z[x]||z["@@iterator"],typeof z=="function"?z:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},
|
|
17
|
+
*/var e0;function cS(){if(e0)return Je;e0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function v(z){return z===null||typeof z!="object"?null:(z=x&&z[x]||z["@@iterator"],typeof z=="function"?z:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,R={};function M(z,W,T){this.props=z,this.context=W,this.refs=R,this.updater=T||S}M.prototype.isReactComponent={},M.prototype.setState=function(z,W){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,W,"setState")},M.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function P(){}P.prototype=M.prototype;function I(z,W,T){this.props=z,this.context=W,this.refs=R,this.updater=T||S}var ue=I.prototype=new P;ue.constructor=I,j(ue,M.prototype),ue.isPureReactComponent=!0;var q=Array.isArray;function N(){}var ee={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function B(z,W,T){var ve=T.ref;return{$$typeof:e,type:z,key:W,ref:ve!==void 0?ve:null,props:T}}function L(z,W){return B(z.type,W,z.props)}function J(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function $(z){var W={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(T){return W[T]})}var he=/\/+/g;function le(z,W){return typeof z=="object"&&z!==null&&z.key!=null?$(""+z.key):W.toString(36)}function te(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(N,N):(z.status="pending",z.then(function(W){z.status==="pending"&&(z.status="fulfilled",z.value=W)},function(W){z.status==="pending"&&(z.status="rejected",z.reason=W)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function V(z,W,T,ve,je){var Ne=typeof z;(Ne==="undefined"||Ne==="boolean")&&(z=null);var ce=!1;if(z===null)ce=!0;else switch(Ne){case"bigint":case"string":case"number":ce=!0;break;case"object":switch(z.$$typeof){case e:case t:ce=!0;break;case b:return ce=z._init,V(ce(z._payload),W,T,ve,je)}}if(ce)return je=je(z),ce=ve===""?"."+le(z,0):ve,q(je)?(T="",ce!=null&&(T=ce.replace(he,"$&/")+"/"),V(je,W,T,"",function(Qe){return Qe})):je!=null&&(J(je)&&(je=L(je,T+(je.key==null||z&&z.key===je.key?"":(""+je.key).replace(he,"$&/")+"/")+ce)),W.push(je)),1;ce=0;var Ae=ve===""?".":ve+":";if(q(z))for(var ke=0;ke<z.length;ke++)ve=z[ke],Ne=Ae+le(ve,ke),ce+=V(ve,W,T,Ne,je);else if(ke=v(z),typeof ke=="function")for(z=ke.call(z),ke=0;!(ve=z.next()).done;)ve=ve.value,Ne=Ae+le(ve,ke++),ce+=V(ve,W,T,Ne,je);else if(Ne==="object"){if(typeof z.then=="function")return V(te(z),W,T,ve,je);throw W=String(z),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return ce}function Q(z,W,T){if(z==null)return z;var ve=[],je=0;return V(z,ve,"","",function(Ne){return W.call(T,Ne,je++)}),ve}function X(z){if(z._status===-1){var W=z._result;W=W(),W.then(function(T){(z._status===0||z._status===-1)&&(z._status=1,z._result=T)},function(T){(z._status===0||z._status===-1)&&(z._status=2,z._result=T)}),z._status===-1&&(z._status=0,z._result=W)}if(z._status===1)return z._result.default;throw z._result}var xe=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},A={map:Q,forEach:function(z,W,T){Q(z,function(){W.apply(this,arguments)},T)},count:function(z){var W=0;return Q(z,function(){W++}),W},toArray:function(z){return Q(z,function(W){return W})||[]},only:function(z){if(!J(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Je.Activity=g,Je.Children=A,Je.Component=M,Je.Fragment=r,Je.Profiler=l,Je.PureComponent=I,Je.StrictMode=s,Je.Suspense=d,Je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ee,Je.__COMPILER_RUNTIME={__proto__:null,c:function(z){return ee.H.useMemoCache(z)}},Je.cache=function(z){return function(){return z.apply(null,arguments)}},Je.cacheSignal=function(){return null},Je.cloneElement=function(z,W,T){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var ve=j({},z.props),je=z.key;if(W!=null)for(Ne in W.key!==void 0&&(je=""+W.key),W)!G.call(W,Ne)||Ne==="key"||Ne==="__self"||Ne==="__source"||Ne==="ref"&&W.ref===void 0||(ve[Ne]=W[Ne]);var Ne=arguments.length-2;if(Ne===1)ve.children=T;else if(1<Ne){for(var ce=Array(Ne),Ae=0;Ae<Ne;Ae++)ce[Ae]=arguments[Ae+2];ve.children=ce}return B(z.type,je,ve)},Je.createContext=function(z){return z={$$typeof:c,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:o,_context:z},z},Je.createElement=function(z,W,T){var ve,je={},Ne=null;if(W!=null)for(ve in W.key!==void 0&&(Ne=""+W.key),W)G.call(W,ve)&&ve!=="key"&&ve!=="__self"&&ve!=="__source"&&(je[ve]=W[ve]);var ce=arguments.length-2;if(ce===1)je.children=T;else if(1<ce){for(var Ae=Array(ce),ke=0;ke<ce;ke++)Ae[ke]=arguments[ke+2];je.children=Ae}if(z&&z.defaultProps)for(ve in ce=z.defaultProps,ce)je[ve]===void 0&&(je[ve]=ce[ve]);return B(z,Ne,je)},Je.createRef=function(){return{current:null}},Je.forwardRef=function(z){return{$$typeof:f,render:z}},Je.isValidElement=J,Je.lazy=function(z){return{$$typeof:b,_payload:{_status:-1,_result:z},_init:X}},Je.memo=function(z,W){return{$$typeof:m,type:z,compare:W===void 0?null:W}},Je.startTransition=function(z){var W=ee.T,T={};ee.T=T;try{var ve=z(),je=ee.S;je!==null&&je(T,ve),typeof ve=="object"&&ve!==null&&typeof ve.then=="function"&&ve.then(N,xe)}catch(Ne){xe(Ne)}finally{W!==null&&T.types!==null&&(W.types=T.types),ee.T=W}},Je.unstable_useCacheRefresh=function(){return ee.H.useCacheRefresh()},Je.use=function(z){return ee.H.use(z)},Je.useActionState=function(z,W,T){return ee.H.useActionState(z,W,T)},Je.useCallback=function(z,W){return ee.H.useCallback(z,W)},Je.useContext=function(z){return ee.H.useContext(z)},Je.useDebugValue=function(){},Je.useDeferredValue=function(z,W){return ee.H.useDeferredValue(z,W)},Je.useEffect=function(z,W){return ee.H.useEffect(z,W)},Je.useEffectEvent=function(z){return ee.H.useEffectEvent(z)},Je.useId=function(){return ee.H.useId()},Je.useImperativeHandle=function(z,W,T){return ee.H.useImperativeHandle(z,W,T)},Je.useInsertionEffect=function(z,W){return ee.H.useInsertionEffect(z,W)},Je.useLayoutEffect=function(z,W){return ee.H.useLayoutEffect(z,W)},Je.useMemo=function(z,W){return ee.H.useMemo(z,W)},Je.useOptimistic=function(z,W){return ee.H.useOptimistic(z,W)},Je.useReducer=function(z,W,T){return ee.H.useReducer(z,W,T)},Je.useRef=function(z){return ee.H.useRef(z)},Je.useState=function(z){return ee.H.useState(z)},Je.useSyncExternalStore=function(z,W,T){return ee.H.useSyncExternalStore(z,W,T)},Je.useTransition=function(){return ee.H.useTransition()},Je.version="19.2.4",Je}var t0;function Nd(){return t0||(t0=1,dh.exports=cS()),dh.exports}var E=Nd(),mh={exports:{}},xl={},ph={exports:{}},gh={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ var aS=Object.defineProperty;var lS=(e,t,r)=>t in e?aS(e,t,{enumerable:!0,config
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var n0;function fS(){return n0||(n0=1,(function(e){function t(V,Q){var X=V.length;V.push(Q);e:for(;0<X;){var xe=X-1>>>1,
|
|
25
|
+
*/var n0;function fS(){return n0||(n0=1,(function(e){function t(V,Q){var X=V.length;V.push(Q);e:for(;0<X;){var xe=X-1>>>1,A=V[xe];if(0<l(A,Q))V[xe]=Q,V[X]=A,X=xe;else break e}}function r(V){return V.length===0?null:V[0]}function s(V){if(V.length===0)return null;var Q=V[0],X=V.pop();if(X!==Q){V[0]=X;e:for(var xe=0,A=V.length,z=A>>>1;xe<z;){var W=2*(xe+1)-1,T=V[W],ve=W+1,je=V[ve];if(0>l(T,X))ve<A&&0>l(je,T)?(V[xe]=je,V[ve]=X,xe=ve):(V[xe]=T,V[W]=X,xe=W);else if(ve<A&&0>l(je,X))V[xe]=je,V[ve]=X,xe=ve;else break e}}return Q}function l(V,Q){var X=V.sortIndex-Q.sortIndex;return X!==0?X:V.id-Q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var d=[],m=[],b=1,g=null,x=3,v=!1,S=!1,j=!1,R=!1,M=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function ue(V){for(var Q=r(m);Q!==null;){if(Q.callback===null)s(m);else if(Q.startTime<=V)s(m),Q.sortIndex=Q.expirationTime,t(d,Q);else break;Q=r(m)}}function q(V){if(j=!1,ue(V),!S)if(r(d)!==null)S=!0,N||(N=!0,$());else{var Q=r(m);Q!==null&&te(q,Q.startTime-V)}}var N=!1,ee=-1,G=5,B=-1;function L(){return R?!0:!(e.unstable_now()-B<G)}function J(){if(R=!1,N){var V=e.unstable_now();B=V;var Q=!0;try{e:{S=!1,j&&(j=!1,P(ee),ee=-1),v=!0;var X=x;try{t:{for(ue(V),g=r(d);g!==null&&!(g.expirationTime>V&&L());){var xe=g.callback;if(typeof xe=="function"){g.callback=null,x=g.priorityLevel;var A=xe(g.expirationTime<=V);if(V=e.unstable_now(),typeof A=="function"){g.callback=A,ue(V),Q=!0;break t}g===r(d)&&s(d),ue(V)}else s(d);g=r(d)}if(g!==null)Q=!0;else{var z=r(m);z!==null&&te(q,z.startTime-V),Q=!1}}break e}finally{g=null,x=X,v=!1}Q=void 0}}finally{Q?$():N=!1}}}var $;if(typeof I=="function")$=function(){I(J)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,le=he.port2;he.port1.onmessage=J,$=function(){le.postMessage(null)}}else $=function(){M(J,0)};function te(V,Q){ee=M(function(){V(e.unstable_now())},Q)}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(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(V){switch(x){case 1:case 2:case 3:var Q=3;break;default:Q=x}var X=x;x=Q;try{return V()}finally{x=X}},e.unstable_requestPaint=function(){R=!0},e.unstable_runWithPriority=function(V,Q){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var X=x;x=V;try{return Q()}finally{x=X}},e.unstable_scheduleCallback=function(V,Q,X){var xe=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?xe+X:xe):X=xe,V){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=X+A,V={id:b++,callback:Q,priorityLevel:V,startTime:X,expirationTime:A,sortIndex:-1},X>xe?(V.sortIndex=X,t(m,V),r(d)===null&&V===r(m)&&(j?(P(ee),ee=-1):j=!0,te(q,X-xe))):(V.sortIndex=A,t(d,V),S||v||(S=!0,N||(N=!0,$()))),V},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(V){var Q=x;return function(){var X=x;x=Q;try{return V.apply(this,arguments)}finally{x=X}}}})(gh)),gh}var r0;function hS(){return r0||(r0=1,ph.exports=fS()),ph.exports}var yh={exports:{}},Tn={};/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.js
|
|
28
28
|
*
|
|
@@ -30,7 +30,7 @@ var aS=Object.defineProperty;var lS=(e,t,r)=>t in e?aS(e,t,{enumerable:!0,config
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var i0;function dS(){if(i0)return
|
|
33
|
+
*/var i0;function dS(){if(i0)return Tn;i0=1;var e=Nd();function t(d){var m="https://react.dev/errors/"+d;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)m+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+d+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},l=Symbol.for("react.portal");function o(d,m,b){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:d,containerInfo:m,implementation:b}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(d,m){if(d==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Tn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Tn.createPortal=function(d,m){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return o(d,m,null,b)},Tn.flushSync=function(d){var m=c.T,b=s.p;try{if(c.T=null,s.p=2,d)return d()}finally{c.T=m,s.p=b,s.d.f()}},Tn.preconnect=function(d,m){typeof d=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,s.d.C(d,m))},Tn.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},Tn.preinit=function(d,m){if(typeof d=="string"&&m&&typeof m.as=="string"){var b=m.as,g=f(b,m.crossOrigin),x=typeof m.integrity=="string"?m.integrity:void 0,v=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;b==="style"?s.d.S(d,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:v}):b==="script"&&s.d.X(d,{crossOrigin:g,integrity:x,fetchPriority:v,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Tn.preinitModule=function(d,m){if(typeof d=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var b=f(m.as,m.crossOrigin);s.d.M(d,{crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&s.d.M(d)},Tn.preload=function(d,m){if(typeof d=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var b=m.as,g=f(b,m.crossOrigin);s.d.L(d,b,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Tn.preloadModule=function(d,m){if(typeof d=="string")if(m){var b=f(m.as,m.crossOrigin);s.d.m(d,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else s.d.m(d)},Tn.requestFormReset=function(d){s.d.r(d)},Tn.unstable_batchedUpdates=function(d,m){return d(m)},Tn.useFormState=function(d,m,b){return c.H.useFormState(d,m,b)},Tn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Tn.version="19.2.4",Tn}var s0;function Yb(){if(s0)return yh.exports;s0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),yh.exports=dS(),yh.exports}/**
|
|
34
34
|
* @license React
|
|
35
35
|
* react-dom-client.production.js
|
|
36
36
|
*
|
|
@@ -38,15 +38,15 @@ var aS=Object.defineProperty;var lS=(e,t,r)=>t in e?aS(e,t,{enumerable:!0,config
|
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the MIT license found in the
|
|
40
40
|
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var a0;function mS(){if(a0)return xl;a0=1;var e=hS(),t=Nd(),r=Yb();function s(n){var i="https://react.dev/errors/"+n;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)i+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+n+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function o(n){var i=n,a=n;if(n.alternate)for(;i.return;)i=i.return;else{n=i;do i=n,(i.flags&4098)!==0&&(a=i.return),n=i.return;while(n)}return i.tag===3?a:null}function c(n){if(n.tag===13){var i=n.memoizedState;if(i===null&&(n=n.alternate,n!==null&&(i=n.memoizedState)),i!==null)return i.dehydrated}return null}function f(n){if(n.tag===31){var i=n.memoizedState;if(i===null&&(n=n.alternate,n!==null&&(i=n.memoizedState)),i!==null)return i.dehydrated}return null}function d(n){if(o(n)!==n)throw Error(s(188))}function m(n){var i=n.alternate;if(!i){if(i=o(n),i===null)throw Error(s(188));return i!==n?null:n}for(var a=n,u=i;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(u=h.return,u!==null){a=u;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return d(h),n;if(p===u)return d(h),i;p=p.sibling}throw Error(s(188))}if(a.return!==u.return)a=h,u=p;else{for(var w=!1,_=h.child;_;){if(_===a){w=!0,a=h,u=p;break}if(_===u){w=!0,u=h,a=p;break}_=_.sibling}if(!w){for(_=p.child;_;){if(_===a){w=!0,a=p,u=h;break}if(_===u){w=!0,u=p,a=h;break}_=_.sibling}if(!w)throw Error(s(189))}}if(a.alternate!==u)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?n:i}function b(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n;for(n=n.child;n!==null;){if(i=b(n),i!==null)return i;n=n.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),
|
|
41
|
+
*/var a0;function mS(){if(a0)return xl;a0=1;var e=hS(),t=Nd(),r=Yb();function s(n){var i="https://react.dev/errors/"+n;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)i+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+n+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function o(n){var i=n,a=n;if(n.alternate)for(;i.return;)i=i.return;else{n=i;do i=n,(i.flags&4098)!==0&&(a=i.return),n=i.return;while(n)}return i.tag===3?a:null}function c(n){if(n.tag===13){var i=n.memoizedState;if(i===null&&(n=n.alternate,n!==null&&(i=n.memoizedState)),i!==null)return i.dehydrated}return null}function f(n){if(n.tag===31){var i=n.memoizedState;if(i===null&&(n=n.alternate,n!==null&&(i=n.memoizedState)),i!==null)return i.dehydrated}return null}function d(n){if(o(n)!==n)throw Error(s(188))}function m(n){var i=n.alternate;if(!i){if(i=o(n),i===null)throw Error(s(188));return i!==n?null:n}for(var a=n,u=i;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(u=h.return,u!==null){a=u;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return d(h),n;if(p===u)return d(h),i;p=p.sibling}throw Error(s(188))}if(a.return!==u.return)a=h,u=p;else{for(var w=!1,_=h.child;_;){if(_===a){w=!0,a=h,u=p;break}if(_===u){w=!0,u=h,a=p;break}_=_.sibling}if(!w){for(_=p.child;_;){if(_===a){w=!0,a=p,u=h;break}if(_===u){w=!0,u=p,a=h;break}_=_.sibling}if(!w)throw Error(s(189))}}if(a.alternate!==u)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?n:i}function b(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n;for(n=n.child;n!==null;){if(i=b(n),i!==null)return i;n=n.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),I=Symbol.for("react.context"),ue=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),J=Symbol.iterator;function $(n){return n===null||typeof n!="object"?null:(n=J&&n[J]||n["@@iterator"],typeof n=="function"?n:null)}var he=Symbol.for("react.client.reference");function le(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===he?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case j:return"Fragment";case M:return"Profiler";case R:return"StrictMode";case q:return"Suspense";case N:return"SuspenseList";case B:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case S:return"Portal";case I:return n.displayName||"Context";case P:return(n._context.displayName||"Context")+".Consumer";case ue:var i=n.render;return n=n.displayName,n||(n=i.displayName||i.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case ee:return i=n.displayName||null,i!==null?i:le(n.type)||"Memo";case G:i=n._payload,n=n._init;try{return le(n(i))}catch{}}return null}var te=Array.isArray,V=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},xe=[],A=-1;function z(n){return{current:n}}function W(n){0>A||(n.current=xe[A],xe[A]=null,A--)}function T(n,i){A++,xe[A]=n.current,n.current=i}var ve=z(null),je=z(null),Ne=z(null),ce=z(null);function Ae(n,i){switch(T(Ne,i),T(je,n),T(ve,null),i.nodeType){case 9:case 11:n=(n=i.documentElement)&&(n=n.namespaceURI)?wy(n):0;break;default:if(n=i.tagName,i=i.namespaceURI)i=wy(i),n=Sy(i,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}W(ve),T(ve,n)}function ke(){W(ve),W(je),W(Ne)}function Qe(n){n.memoizedState!==null&&T(ce,n);var i=ve.current,a=Sy(i,n.type);i!==a&&(T(je,n),T(ve,a))}function Lt(n){je.current===n&&(W(ve),W(je)),ce.current===n&&(W(ce),ml._currentValue=X)}var dn,tn;function Ft(n){if(dn===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);dn=i&&i[1]||"",tn=-1<a.stack.indexOf(`
|
|
42
42
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+
|
|
44
|
-
`),
|
|
45
|
-
`);for(h=u=0;u<H.length&&!H[u].includes("DetermineComponentFrameRoot");)u++;for(;h<
|
|
46
|
-
`+H[u].replace(" at new "," at ");return n.displayName&&
|
|
43
|
+
`+dn+n+tn}var $t=!1;function an(n,i){if(!n||$t)return"";$t=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(i){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(oe){var ie=oe}Reflect.construct(n,[],ye)}else{try{ye.call()}catch(oe){ie=oe}n.call(ye.prototype)}}else{try{throw Error()}catch(oe){ie=oe}(ye=n())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(oe){if(oe&&ie&&typeof oe.stack=="string")return[oe.stack,ie.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=u.DetermineComponentFrameRoot(),w=p[0],_=p[1];if(w&&_){var H=w.split(`
|
|
44
|
+
`),re=_.split(`
|
|
45
|
+
`);for(h=u=0;u<H.length&&!H[u].includes("DetermineComponentFrameRoot");)u++;for(;h<re.length&&!re[h].includes("DetermineComponentFrameRoot");)h++;if(u===H.length||h===re.length)for(u=H.length-1,h=re.length-1;1<=u&&0<=h&&H[u]!==re[h];)h--;for(;1<=u&&0<=h;u--,h--)if(H[u]!==re[h]){if(u!==1||h!==1)do if(u--,h--,0>h||H[u]!==re[h]){var fe=`
|
|
46
|
+
`+H[u].replace(" at new "," at ");return n.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",n.displayName)),fe}while(1<=u&&0<=h);break}}}finally{$t=!1,Error.prepareStackTrace=a}return(a=n?n.displayName||n.name:"")?Ft(a):""}function bn(n,i){switch(n.tag){case 26:case 27:case 5:return Ft(n.type);case 16:return Ft("Lazy");case 13:return n.child!==i&&i!==null?Ft("Suspense Fallback"):Ft("Suspense");case 19:return Ft("SuspenseList");case 0:case 15:return an(n.type,!1);case 11:return an(n.type.render,!1);case 1:return an(n.type,!0);case 31:return Ft("Activity");default:return""}}function Be(n){try{var i="",a=null;do i+=bn(n,a),a=n,n=n.return;while(n);return i}catch(u){return`
|
|
47
47
|
Error generating stack: `+u.message+`
|
|
48
|
-
`+u.stack}}var dt=Object.prototype.hasOwnProperty,Ke=e.unstable_scheduleCallback,wt=e.unstable_cancelCallback,Ut=e.unstable_shouldYield,En=e.unstable_requestPaint,gt=e.unstable_now,Cn=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,ke=e.unstable_UserBlockingPriority,Re=e.unstable_NormalPriority,Ge=e.unstable_LowPriority,rt=e.unstable_IdlePriority,un=e.log,yn=e.unstable_setDisableYieldValue,Jt=null,yt=null;function Xt(n){if(typeof un=="function"&&yn(n),yt&&typeof yt.setStrictMode=="function")try{yt.setStrictMode(Jt,n)}catch{}}var Qe=Math.clz32?Math.clz32:Me,ve=Math.log,Fe=Math.LN2;function Me(n){return n>>>=0,n===0?32:31-(ve(n)/Fe|0)|0}var _t=256,Zt=262144,Mn=4194304;function Xn(n){var i=n&42;if(i!==0)return i;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Jr(n,i,a){var u=n.pendingLanes;if(u===0)return 0;var h=0,p=n.suspendedLanes,w=n.pingedLanes;n=n.warmLanes;var _=u&134217727;return _!==0?(u=_&~p,u!==0?h=Xn(u):(w&=_,w!==0?h=Xn(w):a||(a=_&~n,a!==0&&(h=Xn(a))))):(_=u&~p,_!==0?h=Xn(_):w!==0?h=Xn(w):a||(a=u&~n,a!==0&&(h=Xn(a)))),h===0?0:i!==0&&i!==h&&(i&p)===0&&(p=h&-h,a=i&-i,p>=a||p===32&&(a&4194048)!==0)?i:h}function Er(n,i){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&i)===0}function ts(n,i){switch(n){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 de(){var n=Mn;return Mn<<=1,(Mn&62914560)===0&&(Mn=4194304),n}function Ee(n){for(var i=[],a=0;31>a;a++)i.push(n);return i}function Be(n,i){n.pendingLanes|=i,i!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Ye(n,i,a,u,h,p){var w=n.pendingLanes;n.pendingLanes=a,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=a,n.entangledLanes&=a,n.errorRecoveryDisabledLanes&=a,n.shellSuspendCounter=0;var _=n.entanglements,H=n.expirationTimes,ie=n.hiddenUpdates;for(a=w&~a;0<a;){var ce=31-Qe(a),ye=1<<ce;_[ce]=0,H[ce]=-1;var se=ie[ce];if(se!==null)for(ie[ce]=null,ce=0;ce<se.length;ce++){var ue=se[ce];ue!==null&&(ue.lane&=-536870913)}a&=~ye}u!==0&&He(n,u,0),p!==0&&h===0&&n.tag!==0&&(n.suspendedLanes|=p&~(w&~i))}function He(n,i,a){n.pendingLanes|=i,n.suspendedLanes&=~i;var u=31-Qe(i);n.entangledLanes|=i,n.entanglements[u]=n.entanglements[u]|1073741824|a&261930}function ot(n,i){var a=n.entangledLanes|=i;for(n=n.entanglements;a;){var u=31-Qe(a),h=1<<u;h&i|n[u]&i&&(n[u]|=i),a&=~h}}function Xe(n,i){var a=i&-i;return a=(a&42)!==0?1:Pe(a),(a&(n.suspendedLanes|i))!==0?0:a}function Pe(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function et(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Wt(){var n=Q.p;return n!==0?n:(n=window.event,n===void 0?32:Vy(n.type))}function Kt(n,i){var a=Q.p;try{return Q.p=n,i()}finally{Q.p=a}}var Rt=Math.random().toString(36).slice(2),ut="__reactFiber$"+Rt,Pt="__reactProps$"+Rt,An="__reactContainer$"+Rt,Ur="__reactEvents$"+Rt,wi="__reactListeners$"+Rt,Lt="__reactHandles$"+Rt,ns="__reactResources$"+Rt,pn="__reactMarker$"+Rt;function Cs(n){delete n[ut],delete n[Pt],delete n[Ur],delete n[wi],delete n[Lt]}function k(n){var i=n[ut];if(i)return i;for(var a=n.parentNode;a;){if(i=a[An]||a[ut]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(n=Ny(n);n!==null;){if(a=n[ut])return a;n=Ny(n)}return i}n=a,a=n.parentNode}return null}function R(n){if(n=n[ut]||n[An]){var i=n.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return n}return null}function T(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n.stateNode;throw Error(s(33))}function U(n){var i=n[ns];return i||(i=n[ns]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function $(n){n[pn]=!0}var Z=new Set,ge={};function be(n,i){ae(n,i),ae(n+"Capture",i)}function ae(n,i){for(ge[n]=i,n=0;n<i.length;n++)Z.add(i[n])}var pe=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]*$"),Le={},it={};function Bt(n){return dt.call(it,n)?!0:dt.call(Le,n)?!1:pe.test(n)?it[n]=!0:(Le[n]=!0,!1)}function jn(n,i,a){if(Bt(i))if(a===null)n.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":n.removeAttribute(i);return;case"boolean":var u=i.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){n.removeAttribute(i);return}}n.setAttribute(i,""+a)}}function Cr(n,i,a){if(a===null)n.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttribute(i,""+a)}}function Xr(n,i,a,u){if(u===null)n.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttributeNS(i,a,""+u)}}function fr(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function dm(n){var i=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function W1(n,i,a){var u=Object.getOwnPropertyDescriptor(n.constructor.prototype,i);if(!n.hasOwnProperty(i)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var h=u.get,p=u.set;return Object.defineProperty(n,i,{configurable:!0,get:function(){return h.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(n,i,{enumerable:u.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){n._valueTracker=null,delete n[i]}}}}function ic(n){if(!n._valueTracker){var i=dm(n)?"checked":"value";n._valueTracker=W1(n,i,""+n[i])}}function mm(n){if(!n)return!1;var i=n._valueTracker;if(!i)return!0;var a=i.getValue(),u="";return n&&(u=dm(n)?n.checked?"true":"false":n.value),n=u,n!==a?(i.setValue(n),!0):!1}function Wl(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var ev=/[\n"\\]/g;function hr(n){return n.replace(ev,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function sc(n,i,a,u,h,p,w,_){n.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?n.type=w:n.removeAttribute("type"),i!=null?w==="number"?(i===0&&n.value===""||n.value!=i)&&(n.value=""+fr(i)):n.value!==""+fr(i)&&(n.value=""+fr(i)):w!=="submit"&&w!=="reset"||n.removeAttribute("value"),i!=null?ac(n,w,fr(i)):a!=null?ac(n,w,fr(a)):u!=null&&n.removeAttribute("value"),h==null&&p!=null&&(n.defaultChecked=!!p),h!=null&&(n.checked=h&&typeof h!="function"&&typeof h!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?n.name=""+fr(_):n.removeAttribute("name")}function pm(n,i,a,u,h,p,w,_){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(n.type=p),i!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){ic(n);return}a=a!=null?""+fr(a):"",i=i!=null?""+fr(i):a,_||i===n.value||(n.value=i),n.defaultValue=i}u=u??h,u=typeof u!="function"&&typeof u!="symbol"&&!!u,n.checked=_?n.checked:!!u,n.defaultChecked=!!u,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.name=w),ic(n)}function ac(n,i,a){i==="number"&&Wl(n.ownerDocument)===n||n.defaultValue===""+a||(n.defaultValue=""+a)}function As(n,i,a,u){if(n=n.options,i){i={};for(var h=0;h<a.length;h++)i["$"+a[h]]=!0;for(a=0;a<n.length;a++)h=i.hasOwnProperty("$"+n[a].value),n[a].selected!==h&&(n[a].selected=h),h&&u&&(n[a].defaultSelected=!0)}else{for(a=""+fr(a),i=null,h=0;h<n.length;h++){if(n[h].value===a){n[h].selected=!0,u&&(n[h].defaultSelected=!0);return}i!==null||n[h].disabled||(i=n[h])}i!==null&&(i.selected=!0)}}function gm(n,i,a){if(i!=null&&(i=""+fr(i),i!==n.value&&(n.value=i),a==null)){n.defaultValue!==i&&(n.defaultValue=i);return}n.defaultValue=a!=null?""+fr(a):""}function ym(n,i,a,u){if(i==null){if(u!=null){if(a!=null)throw Error(s(92));if(ne(u)){if(1<u.length)throw Error(s(93));u=u[0]}a=u}a==null&&(a=""),i=a}a=fr(i),n.defaultValue=a,u=n.textContent,u===a&&u!==""&&u!==null&&(n.value=u),ic(n)}function js(n,i){if(i){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=i;return}}n.textContent=i}var tv=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 bm(n,i,a){var u=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?u?n.setProperty(i,""):i==="float"?n.cssFloat="":n[i]="":u?n.setProperty(i,a):typeof a!="number"||a===0||tv.has(i)?i==="float"?n.cssFloat=a:n[i]=(""+a).trim():n[i]=a+"px"}function xm(n,i,a){if(i!=null&&typeof i!="object")throw Error(s(62));if(n=n.style,a!=null){for(var u in a)!a.hasOwnProperty(u)||i!=null&&i.hasOwnProperty(u)||(u.indexOf("--")===0?n.setProperty(u,""):u==="float"?n.cssFloat="":n[u]="");for(var h in i)u=i[h],i.hasOwnProperty(h)&&a[h]!==u&&bm(n,h,u)}else for(var p in i)i.hasOwnProperty(p)&&bm(n,p,i[p])}function lc(n){if(n.indexOf("-")===-1)return!1;switch(n){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 nv=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"]]),rv=/^[\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 eo(n){return rv.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Kr(){}var oc=null;function uc(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Ns=null,Ts=null;function vm(n){var i=R(n);if(i&&(n=i.stateNode)){var a=n[Pt]||null;e:switch(n=i.stateNode,i.type){case"input":if(sc(n,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),i=a.name,a.type==="radio"&&i!=null){for(a=n;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+hr(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var u=a[i];if(u!==n&&u.form===n.form){var h=u[Pt]||null;if(!h)throw Error(s(90));sc(u,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<a.length;i++)u=a[i],u.form===n.form&&mm(u)}break e;case"textarea":gm(n,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&As(n,!!a.multiple,i,!1)}}}var cc=!1;function wm(n,i,a){if(cc)return n(i,a);cc=!0;try{var u=n(i);return u}finally{if(cc=!1,(Ns!==null||Ts!==null)&&(Io(),Ns&&(i=Ns,n=Ts,Ts=Ns=null,vm(i),n)))for(i=0;i<n.length;i++)vm(n[i])}}function Oa(n,i){var a=n.stateNode;if(a===null)return null;var u=a[Pt]||null;if(u===null)return null;a=u[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;break e;default:n=!1}if(n)return null;if(a&&typeof a!="function")throw Error(s(231,i,typeof a));return a}var Qr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fc=!1;if(Qr)try{var Ra={};Object.defineProperty(Ra,"passive",{get:function(){fc=!0}}),window.addEventListener("test",Ra,Ra),window.removeEventListener("test",Ra,Ra)}catch{fc=!1}var Si=null,hc=null,to=null;function Sm(){if(to)return to;var n,i=hc,a=i.length,u,h="value"in Si?Si.value:Si.textContent,p=h.length;for(n=0;n<a&&i[n]===h[n];n++);var w=a-n;for(u=1;u<=w&&i[a-u]===h[p-u];u++);return to=h.slice(n,1<u?1-u:void 0)}function no(n){var i=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&i===13&&(n=13)):n=i,n===10&&(n=13),32<=n||n===13?n:0}function ro(){return!0}function _m(){return!1}function Hn(n){function i(a,u,h,p,w){this._reactName=a,this._targetInst=h,this.type=u,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var _ in n)n.hasOwnProperty(_)&&(a=n[_],this[_]=a?a(p):p[_]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?ro:_m,this.isPropagationStopped=_m,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=ro)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ro)},persist:function(){},isPersistent:ro}),i}var rs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},io=Hn(rs),Ma=g({},rs,{view:0,detail:0}),iv=Hn(Ma),dc,mc,Da,so=g({},Ma,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gc,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Da&&(Da&&n.type==="mousemove"?(dc=n.screenX-Da.screenX,mc=n.screenY-Da.screenY):mc=dc=0,Da=n),dc)},movementY:function(n){return"movementY"in n?n.movementY:mc}}),km=Hn(so),sv=g({},so,{dataTransfer:0}),av=Hn(sv),lv=g({},Ma,{relatedTarget:0}),pc=Hn(lv),ov=g({},rs,{animationName:0,elapsedTime:0,pseudoElement:0}),uv=Hn(ov),cv=g({},rs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),fv=Hn(cv),hv=g({},rs,{data:0}),Em=Hn(hv),dv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mv={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"},pv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gv(n){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(n):(n=pv[n])?!!i[n]:!1}function gc(){return gv}var yv=g({},Ma,{key:function(n){if(n.key){var i=dv[n.key]||n.key;if(i!=="Unidentified")return i}return n.type==="keypress"?(n=no(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?mv[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gc,charCode:function(n){return n.type==="keypress"?no(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?no(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),bv=Hn(yv),xv=g({},so,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cm=Hn(xv),vv=g({},Ma,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gc}),wv=Hn(vv),Sv=g({},rs,{propertyName:0,elapsedTime:0,pseudoElement:0}),_v=Hn(Sv),kv=g({},so,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Ev=Hn(kv),Cv=g({},rs,{newState:0,oldState:0}),Av=Hn(Cv),jv=[9,13,27,32],yc=Qr&&"CompositionEvent"in window,La=null;Qr&&"documentMode"in document&&(La=document.documentMode);var Nv=Qr&&"TextEvent"in window&&!La,Am=Qr&&(!yc||La&&8<La&&11>=La),jm=" ",Nm=!1;function Tm(n,i){switch(n){case"keyup":return jv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Om(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Os=!1;function Tv(n,i){switch(n){case"compositionend":return Om(i);case"keypress":return i.which!==32?null:(Nm=!0,jm);case"textInput":return n=i.data,n===jm&&Nm?null:n;default:return null}}function Ov(n,i){if(Os)return n==="compositionend"||!yc&&Tm(n,i)?(n=Sm(),to=hc=Si=null,Os=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Am&&i.locale!=="ko"?null:i.data;default:return null}}var Rv={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 Rm(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i==="input"?!!Rv[n.type]:i==="textarea"}function Mm(n,i,a,u){Ns?Ts?Ts.push(u):Ts=[u]:Ns=u,i=Xo(i,"onChange"),0<i.length&&(a=new io("onChange","change",null,a,u),n.push({event:a,listeners:i}))}var za=null,Ua=null;function Mv(n){py(n,0)}function ao(n){var i=T(n);if(mm(i))return n}function Dm(n,i){if(n==="change")return i}var Lm=!1;if(Qr){var bc;if(Qr){var xc="oninput"in document;if(!xc){var zm=document.createElement("div");zm.setAttribute("oninput","return;"),xc=typeof zm.oninput=="function"}bc=xc}else bc=!1;Lm=bc&&(!document.documentMode||9<document.documentMode)}function Um(){za&&(za.detachEvent("onpropertychange",Pm),Ua=za=null)}function Pm(n){if(n.propertyName==="value"&&ao(Ua)){var i=[];Mm(i,Ua,n,uc(n)),wm(Mv,i)}}function Dv(n,i,a){n==="focusin"?(Um(),za=i,Ua=a,za.attachEvent("onpropertychange",Pm)):n==="focusout"&&Um()}function Lv(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ao(Ua)}function zv(n,i){if(n==="click")return ao(i)}function Uv(n,i){if(n==="input"||n==="change")return ao(i)}function Pv(n,i){return n===i&&(n!==0||1/n===1/i)||n!==n&&i!==i}var Kn=typeof Object.is=="function"?Object.is:Pv;function Pa(n,i){if(Kn(n,i))return!0;if(typeof n!="object"||n===null||typeof i!="object"||i===null)return!1;var a=Object.keys(n),u=Object.keys(i);if(a.length!==u.length)return!1;for(u=0;u<a.length;u++){var h=a[u];if(!dt.call(i,h)||!Kn(n[h],i[h]))return!1}return!0}function Bm(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Hm(n,i){var a=Bm(n);n=0;for(var u;a;){if(a.nodeType===3){if(u=n+a.textContent.length,n<=i&&u>=i)return{node:a,offset:i-n};n=u}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Bm(a)}}function qm(n,i){return n&&i?n===i?!0:n&&n.nodeType===3?!1:i&&i.nodeType===3?qm(n,i.parentNode):"contains"in n?n.contains(i):n.compareDocumentPosition?!!(n.compareDocumentPosition(i)&16):!1:!1}function Im(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var i=Wl(n.document);i instanceof n.HTMLIFrameElement;){try{var a=typeof i.contentWindow.location.href=="string"}catch{a=!1}if(a)n=i.contentWindow;else break;i=Wl(n.document)}return i}function vc(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i&&(i==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||i==="textarea"||n.contentEditable==="true")}var Bv=Qr&&"documentMode"in document&&11>=document.documentMode,Rs=null,wc=null,Ba=null,Sc=!1;function Fm(n,i,a){var u=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Sc||Rs==null||Rs!==Wl(u)||(u=Rs,"selectionStart"in u&&vc(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Ba&&Pa(Ba,u)||(Ba=u,u=Xo(wc,"onSelect"),0<u.length&&(i=new io("onSelect","select",null,i,a),n.push({event:i,listeners:u}),i.target=Rs)))}function is(n,i){var a={};return a[n.toLowerCase()]=i.toLowerCase(),a["Webkit"+n]="webkit"+i,a["Moz"+n]="moz"+i,a}var Ms={animationend:is("Animation","AnimationEnd"),animationiteration:is("Animation","AnimationIteration"),animationstart:is("Animation","AnimationStart"),transitionrun:is("Transition","TransitionRun"),transitionstart:is("Transition","TransitionStart"),transitioncancel:is("Transition","TransitionCancel"),transitionend:is("Transition","TransitionEnd")},_c={},$m={};Qr&&($m=document.createElement("div").style,"AnimationEvent"in window||(delete Ms.animationend.animation,delete Ms.animationiteration.animation,delete Ms.animationstart.animation),"TransitionEvent"in window||delete Ms.transitionend.transition);function ss(n){if(_c[n])return _c[n];if(!Ms[n])return n;var i=Ms[n],a;for(a in i)if(i.hasOwnProperty(a)&&a in $m)return _c[n]=i[a];return n}var Vm=ss("animationend"),Ym=ss("animationiteration"),Gm=ss("animationstart"),Hv=ss("transitionrun"),qv=ss("transitionstart"),Iv=ss("transitioncancel"),Jm=ss("transitionend"),Xm=new Map,kc="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(" ");kc.push("scrollEnd");function Ar(n,i){Xm.set(n,i),be(i,[n])}var lo=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},dr=[],Ds=0,Ec=0;function oo(){for(var n=Ds,i=Ec=Ds=0;i<n;){var a=dr[i];dr[i++]=null;var u=dr[i];dr[i++]=null;var h=dr[i];dr[i++]=null;var p=dr[i];if(dr[i++]=null,u!==null&&h!==null){var w=u.pending;w===null?h.next=h:(h.next=w.next,w.next=h),u.pending=h}p!==0&&Km(a,h,p)}}function uo(n,i,a,u){dr[Ds++]=n,dr[Ds++]=i,dr[Ds++]=a,dr[Ds++]=u,Ec|=u,n.lanes|=u,n=n.alternate,n!==null&&(n.lanes|=u)}function Cc(n,i,a,u){return uo(n,i,a,u),co(n)}function as(n,i){return uo(n,null,null,i),co(n)}function Km(n,i,a){n.lanes|=a;var u=n.alternate;u!==null&&(u.lanes|=a);for(var h=!1,p=n.return;p!==null;)p.childLanes|=a,u=p.alternate,u!==null&&(u.childLanes|=a),p.tag===22&&(n=p.stateNode,n===null||n._visibility&1||(h=!0)),n=p,p=p.return;return n.tag===3?(p=n.stateNode,h&&i!==null&&(h=31-Qe(a),n=p.hiddenUpdates,u=n[h],u===null?n[h]=[i]:u.push(i),i.lane=a|536870912),p):null}function co(n){if(50<ll)throw ll=0,zf=null,Error(s(185));for(var i=n.return;i!==null;)n=i,i=n.return;return n.tag===3?n.stateNode:null}var Ls={};function Fv(n,i,a,u){this.tag=n,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qn(n,i,a,u){return new Fv(n,i,a,u)}function Ac(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Zr(n,i){var a=n.alternate;return a===null?(a=Qn(n.tag,i,n.key,n.mode),a.elementType=n.elementType,a.type=n.type,a.stateNode=n.stateNode,a.alternate=n,n.alternate=a):(a.pendingProps=i,a.type=n.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=n.flags&65011712,a.childLanes=n.childLanes,a.lanes=n.lanes,a.child=n.child,a.memoizedProps=n.memoizedProps,a.memoizedState=n.memoizedState,a.updateQueue=n.updateQueue,i=n.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},a.sibling=n.sibling,a.index=n.index,a.ref=n.ref,a.refCleanup=n.refCleanup,a}function Qm(n,i){n.flags&=65011714;var a=n.alternate;return a===null?(n.childLanes=0,n.lanes=i,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=a.childLanes,n.lanes=a.lanes,n.child=a.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=a.memoizedProps,n.memoizedState=a.memoizedState,n.updateQueue=a.updateQueue,n.type=a.type,i=a.dependencies,n.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),n}function fo(n,i,a,u,h,p){var w=0;if(u=n,typeof n=="function")Ac(n)&&(w=1);else if(typeof n=="string")w=Jw(n,a,we.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case B:return n=Qn(31,a,i,h),n.elementType=B,n.lanes=p,n;case A:return ls(a.children,h,p,i);case O:w=8,h|=24;break;case M:return n=Qn(12,a,i,h|2),n.elementType=M,n.lanes=p,n;case q:return n=Qn(13,a,i,h),n.elementType=q,n.lanes=p,n;case L:return n=Qn(19,a,i,h),n.elementType=L,n.lanes=p,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:w=10;break e;case P:w=9;break e;case te:w=11;break e;case ee:w=14;break e;case J:w=16,u=null;break e}w=29,a=Error(s(130,n===null?"null":typeof n,"")),u=null}return i=Qn(w,a,i,h),i.elementType=n,i.type=u,i.lanes=p,i}function ls(n,i,a,u){return n=Qn(7,n,u,i),n.lanes=a,n}function jc(n,i,a){return n=Qn(6,n,null,i),n.lanes=a,n}function Zm(n){var i=Qn(18,null,null,0);return i.stateNode=n,i}function Nc(n,i,a){return i=Qn(4,n.children!==null?n.children:[],n.key,i),i.lanes=a,i.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},i}var Wm=new WeakMap;function mr(n,i){if(typeof n=="object"&&n!==null){var a=Wm.get(n);return a!==void 0?a:(i={value:n,source:i,stack:Ie(i)},Wm.set(n,i),i)}return{value:n,source:i,stack:Ie(i)}}var zs=[],Us=0,ho=null,Ha=0,pr=[],gr=0,_i=null,Pr=1,Br="";function Wr(n,i){zs[Us++]=Ha,zs[Us++]=ho,ho=n,Ha=i}function ep(n,i,a){pr[gr++]=Pr,pr[gr++]=Br,pr[gr++]=_i,_i=n;var u=Pr;n=Br;var h=32-Qe(u)-1;u&=~(1<<h),a+=1;var p=32-Qe(i)+h;if(30<p){var w=h-h%5;p=(u&(1<<w)-1).toString(32),u>>=w,h-=w,Pr=1<<32-Qe(i)+h|a<<h|u,Br=p+n}else Pr=1<<p|a<<h|u,Br=n}function Tc(n){n.return!==null&&(Wr(n,1),ep(n,1,0))}function Oc(n){for(;n===ho;)ho=zs[--Us],zs[Us]=null,Ha=zs[--Us],zs[Us]=null;for(;n===_i;)_i=pr[--gr],pr[gr]=null,Br=pr[--gr],pr[gr]=null,Pr=pr[--gr],pr[gr]=null}function tp(n,i){pr[gr++]=Pr,pr[gr++]=Br,pr[gr++]=_i,Pr=i.id,Br=i.overflow,_i=n}var wn=null,Ht=null,ht=!1,ki=null,yr=!1,Rc=Error(s(519));function Ei(n){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw qa(mr(i,n)),Rc}function np(n){var i=n.stateNode,a=n.type,u=n.memoizedProps;switch(i[ut]=n,i[Pt]=u,a){case"dialog":at("cancel",i),at("close",i);break;case"iframe":case"object":case"embed":at("load",i);break;case"video":case"audio":for(a=0;a<ul.length;a++)at(ul[a],i);break;case"source":at("error",i);break;case"img":case"image":case"link":at("error",i),at("load",i);break;case"details":at("toggle",i);break;case"input":at("invalid",i),pm(i,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":at("invalid",i);break;case"textarea":at("invalid",i),ym(i,u.value,u.defaultValue,u.children)}a=u.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||u.suppressHydrationWarning===!0||xy(i.textContent,a)?(u.popover!=null&&(at("beforetoggle",i),at("toggle",i)),u.onScroll!=null&&at("scroll",i),u.onScrollEnd!=null&&at("scrollend",i),u.onClick!=null&&(i.onclick=Kr),i=!0):i=!1,i||Ei(n,!0)}function rp(n){for(wn=n.return;wn;)switch(wn.tag){case 5:case 31:case 13:yr=!1;return;case 27:case 3:yr=!0;return;default:wn=wn.return}}function Ps(n){if(n!==wn)return!1;if(!ht)return rp(n),ht=!0,!1;var i=n.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=n.type,a=!(a!=="form"&&a!=="button")||Qf(n.type,n.memoizedProps)),a=!a),a&&Ht&&Ei(n),rp(n),i===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Ht=jy(n)}else if(i===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Ht=jy(n)}else i===27?(i=Ht,Bi(n.type)?(n=nh,nh=null,Ht=n):Ht=i):Ht=wn?xr(n.stateNode.nextSibling):null;return!0}function os(){Ht=wn=null,ht=!1}function Mc(){var n=ki;return n!==null&&($n===null?$n=n:$n.push.apply($n,n),ki=null),n}function qa(n){ki===null?ki=[n]:ki.push(n)}var Dc=z(null),us=null,ei=null;function Ci(n,i,a){N(Dc,i._currentValue),i._currentValue=a}function ti(n){n._currentValue=Dc.current,W(Dc)}function Lc(n,i,a){for(;n!==null;){var u=n.alternate;if((n.childLanes&i)!==i?(n.childLanes|=i,u!==null&&(u.childLanes|=i)):u!==null&&(u.childLanes&i)!==i&&(u.childLanes|=i),n===a)break;n=n.return}}function zc(n,i,a,u){var h=n.child;for(h!==null&&(h.return=n);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var _=p;p=h;for(var H=0;H<i.length;H++)if(_.context===i[H]){p.lanes|=a,_=p.alternate,_!==null&&(_.lanes|=a),Lc(p.return,a,n),u||(w=null);break e}p=_.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(s(341));w.lanes|=a,p=w.alternate,p!==null&&(p.lanes|=a),Lc(w,a,n),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===n){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Bs(n,i,a,u){n=null;for(var h=i,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var w=h.alternate;if(w===null)throw Error(s(387));if(w=w.memoizedProps,w!==null){var _=h.type;Kn(h.pendingProps.value,w.value)||(n!==null?n.push(_):n=[_])}}else if(h===he.current){if(w=h.alternate,w===null)throw Error(s(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(n!==null?n.push(ml):n=[ml])}h=h.return}n!==null&&zc(i,n,a,u),i.flags|=262144}function mo(n){for(n=n.firstContext;n!==null;){if(!Kn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function cs(n){us=n,ei=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Sn(n){return ip(us,n)}function po(n,i){return us===null&&cs(n),ip(n,i)}function ip(n,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},ei===null){if(n===null)throw Error(s(308));ei=i,n.dependencies={lanes:0,firstContext:i},n.flags|=524288}else ei=ei.next=i;return a}var $v=typeof AbortController<"u"?AbortController:function(){var n=[],i=this.signal={aborted:!1,addEventListener:function(a,u){n.push(u)}};this.abort=function(){i.aborted=!0,n.forEach(function(a){return a()})}},Vv=e.unstable_scheduleCallback,Yv=e.unstable_NormalPriority,cn={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uc(){return{controller:new $v,data:new Map,refCount:0}}function Ia(n){n.refCount--,n.refCount===0&&Vv(Yv,function(){n.controller.abort()})}var Fa=null,Pc=0,Hs=0,qs=null;function Gv(n,i){if(Fa===null){var a=Fa=[];Pc=0,Hs=If(),qs={status:"pending",value:void 0,then:function(u){a.push(u)}}}return Pc++,i.then(sp,sp),i}function sp(){if(--Pc===0&&Fa!==null){qs!==null&&(qs.status="fulfilled");var n=Fa;Fa=null,Hs=0,qs=null;for(var i=0;i<n.length;i++)(0,n[i])()}}function Jv(n,i){var a=[],u={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return n.then(function(){u.status="fulfilled",u.value=i;for(var h=0;h<a.length;h++)(0,a[h])(i)},function(h){for(u.status="rejected",u.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),u}var ap=V.S;V.S=function(n,i){Fg=gt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Gv(n,i),ap!==null&&ap(n,i)};var fs=z(null);function Bc(){var n=fs.current;return n!==null?n:Mt.pooledCache}function go(n,i){i===null?N(fs,fs.current):N(fs,i.pool)}function lp(){var n=Bc();return n===null?null:{parent:cn._currentValue,pool:n}}var Is=Error(s(460)),Hc=Error(s(474)),yo=Error(s(542)),bo={then:function(){}};function op(n){return n=n.status,n==="fulfilled"||n==="rejected"}function up(n,i,a){switch(a=n[a],a===void 0?n.push(i):a!==i&&(i.then(Kr,Kr),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,fp(n),n;default:if(typeof i.status=="string")i.then(Kr,Kr);else{if(n=Mt,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=i,n.status="pending",n.then(function(u){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=u}},function(u){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=u}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,fp(n),n}throw ds=i,Is}}function hs(n){try{var i=n._init;return i(n._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ds=a,Is):a}}var ds=null;function cp(){if(ds===null)throw Error(s(459));var n=ds;return ds=null,n}function fp(n){if(n===Is||n===yo)throw Error(s(483))}var Fs=null,$a=0;function xo(n){var i=$a;return $a+=1,Fs===null&&(Fs=[]),up(Fs,n,i)}function Va(n,i){i=i.props.ref,n.ref=i!==void 0?i:null}function vo(n,i){throw i.$$typeof===x?Error(s(525)):(n=Object.prototype.toString.call(i),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":n)))}function hp(n){function i(K,Y){if(n){var re=K.deletions;re===null?(K.deletions=[Y],K.flags|=16):re.push(Y)}}function a(K,Y){if(!n)return null;for(;Y!==null;)i(K,Y),Y=Y.sibling;return null}function u(K){for(var Y=new Map;K!==null;)K.key!==null?Y.set(K.key,K):Y.set(K.index,K),K=K.sibling;return Y}function h(K,Y){return K=Zr(K,Y),K.index=0,K.sibling=null,K}function p(K,Y,re){return K.index=re,n?(re=K.alternate,re!==null?(re=re.index,re<Y?(K.flags|=67108866,Y):re):(K.flags|=67108866,Y)):(K.flags|=1048576,Y)}function w(K){return n&&K.alternate===null&&(K.flags|=67108866),K}function _(K,Y,re,me){return Y===null||Y.tag!==6?(Y=jc(re,K.mode,me),Y.return=K,Y):(Y=h(Y,re),Y.return=K,Y)}function H(K,Y,re,me){var qe=re.type;return qe===A?ce(K,Y,re.props.children,me,re.key):Y!==null&&(Y.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===J&&hs(qe)===Y.type)?(Y=h(Y,re.props),Va(Y,re),Y.return=K,Y):(Y=fo(re.type,re.key,re.props,null,K.mode,me),Va(Y,re),Y.return=K,Y)}function ie(K,Y,re,me){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==re.containerInfo||Y.stateNode.implementation!==re.implementation?(Y=Nc(re,K.mode,me),Y.return=K,Y):(Y=h(Y,re.children||[]),Y.return=K,Y)}function ce(K,Y,re,me,qe){return Y===null||Y.tag!==7?(Y=ls(re,K.mode,me,qe),Y.return=K,Y):(Y=h(Y,re),Y.return=K,Y)}function ye(K,Y,re){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=jc(""+Y,K.mode,re),Y.return=K,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case v:return re=fo(Y.type,Y.key,Y.props,null,K.mode,re),Va(re,Y),re.return=K,re;case S:return Y=Nc(Y,K.mode,re),Y.return=K,Y;case J:return Y=hs(Y),ye(K,Y,re)}if(ne(Y)||F(Y))return Y=ls(Y,K.mode,re,null),Y.return=K,Y;if(typeof Y.then=="function")return ye(K,xo(Y),re);if(Y.$$typeof===I)return ye(K,po(K,Y),re);vo(K,Y)}return null}function se(K,Y,re,me){var qe=Y!==null?Y.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return qe!==null?null:_(K,Y,""+re,me);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case v:return re.key===qe?H(K,Y,re,me):null;case S:return re.key===qe?ie(K,Y,re,me):null;case J:return re=hs(re),se(K,Y,re,me)}if(ne(re)||F(re))return qe!==null?null:ce(K,Y,re,me,null);if(typeof re.then=="function")return se(K,Y,xo(re),me);if(re.$$typeof===I)return se(K,Y,po(K,re),me);vo(K,re)}return null}function ue(K,Y,re,me,qe){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return K=K.get(re)||null,_(Y,K,""+me,qe);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case v:return K=K.get(me.key===null?re:me.key)||null,H(Y,K,me,qe);case S:return K=K.get(me.key===null?re:me.key)||null,ie(Y,K,me,qe);case J:return me=hs(me),ue(K,Y,re,me,qe)}if(ne(me)||F(me))return K=K.get(re)||null,ce(Y,K,me,qe,null);if(typeof me.then=="function")return ue(K,Y,re,xo(me),qe);if(me.$$typeof===I)return ue(K,Y,re,po(Y,me),qe);vo(Y,me)}return null}function ze(K,Y,re,me){for(var qe=null,bt=null,Ue=Y,tt=Y=0,ft=null;Ue!==null&&tt<re.length;tt++){Ue.index>tt?(ft=Ue,Ue=null):ft=Ue.sibling;var xt=se(K,Ue,re[tt],me);if(xt===null){Ue===null&&(Ue=ft);break}n&&Ue&&xt.alternate===null&&i(K,Ue),Y=p(xt,Y,tt),bt===null?qe=xt:bt.sibling=xt,bt=xt,Ue=ft}if(tt===re.length)return a(K,Ue),ht&&Wr(K,tt),qe;if(Ue===null){for(;tt<re.length;tt++)Ue=ye(K,re[tt],me),Ue!==null&&(Y=p(Ue,Y,tt),bt===null?qe=Ue:bt.sibling=Ue,bt=Ue);return ht&&Wr(K,tt),qe}for(Ue=u(Ue);tt<re.length;tt++)ft=ue(Ue,K,tt,re[tt],me),ft!==null&&(n&&ft.alternate!==null&&Ue.delete(ft.key===null?tt:ft.key),Y=p(ft,Y,tt),bt===null?qe=ft:bt.sibling=ft,bt=ft);return n&&Ue.forEach(function($i){return i(K,$i)}),ht&&Wr(K,tt),qe}function Ve(K,Y,re,me){if(re==null)throw Error(s(151));for(var qe=null,bt=null,Ue=Y,tt=Y=0,ft=null,xt=re.next();Ue!==null&&!xt.done;tt++,xt=re.next()){Ue.index>tt?(ft=Ue,Ue=null):ft=Ue.sibling;var $i=se(K,Ue,xt.value,me);if($i===null){Ue===null&&(Ue=ft);break}n&&Ue&&$i.alternate===null&&i(K,Ue),Y=p($i,Y,tt),bt===null?qe=$i:bt.sibling=$i,bt=$i,Ue=ft}if(xt.done)return a(K,Ue),ht&&Wr(K,tt),qe;if(Ue===null){for(;!xt.done;tt++,xt=re.next())xt=ye(K,xt.value,me),xt!==null&&(Y=p(xt,Y,tt),bt===null?qe=xt:bt.sibling=xt,bt=xt);return ht&&Wr(K,tt),qe}for(Ue=u(Ue);!xt.done;tt++,xt=re.next())xt=ue(Ue,K,tt,xt.value,me),xt!==null&&(n&&xt.alternate!==null&&Ue.delete(xt.key===null?tt:xt.key),Y=p(xt,Y,tt),bt===null?qe=xt:bt.sibling=xt,bt=xt);return n&&Ue.forEach(function(sS){return i(K,sS)}),ht&&Wr(K,tt),qe}function jt(K,Y,re,me){if(typeof re=="object"&&re!==null&&re.type===A&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case v:e:{for(var qe=re.key;Y!==null;){if(Y.key===qe){if(qe=re.type,qe===A){if(Y.tag===7){a(K,Y.sibling),me=h(Y,re.props.children),me.return=K,K=me;break e}}else if(Y.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===J&&hs(qe)===Y.type){a(K,Y.sibling),me=h(Y,re.props),Va(me,re),me.return=K,K=me;break e}a(K,Y);break}else i(K,Y);Y=Y.sibling}re.type===A?(me=ls(re.props.children,K.mode,me,re.key),me.return=K,K=me):(me=fo(re.type,re.key,re.props,null,K.mode,me),Va(me,re),me.return=K,K=me)}return w(K);case S:e:{for(qe=re.key;Y!==null;){if(Y.key===qe)if(Y.tag===4&&Y.stateNode.containerInfo===re.containerInfo&&Y.stateNode.implementation===re.implementation){a(K,Y.sibling),me=h(Y,re.children||[]),me.return=K,K=me;break e}else{a(K,Y);break}else i(K,Y);Y=Y.sibling}me=Nc(re,K.mode,me),me.return=K,K=me}return w(K);case J:return re=hs(re),jt(K,Y,re,me)}if(ne(re))return ze(K,Y,re,me);if(F(re)){if(qe=F(re),typeof qe!="function")throw Error(s(150));return re=qe.call(re),Ve(K,Y,re,me)}if(typeof re.then=="function")return jt(K,Y,xo(re),me);if(re.$$typeof===I)return jt(K,Y,po(K,re),me);vo(K,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,Y!==null&&Y.tag===6?(a(K,Y.sibling),me=h(Y,re),me.return=K,K=me):(a(K,Y),me=jc(re,K.mode,me),me.return=K,K=me),w(K)):a(K,Y)}return function(K,Y,re,me){try{$a=0;var qe=jt(K,Y,re,me);return Fs=null,qe}catch(Ue){if(Ue===Is||Ue===yo)throw Ue;var bt=Qn(29,Ue,null,K.mode);return bt.lanes=me,bt.return=K,bt}finally{}}}var ms=hp(!0),dp=hp(!1),Ai=!1;function qc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ic(n,i){n=n.updateQueue,i.updateQueue===n&&(i.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function ji(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Ni(n,i,a){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(vt&2)!==0){var h=u.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),u.pending=i,i=co(n),Km(n,null,a),i}return uo(n,u,i,a),co(n)}function Ya(n,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var u=i.lanes;u&=n.pendingLanes,a|=u,i.lanes=a,ot(n,a)}}function Fc(n,i){var a=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,a===u)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?h=p=i:p=p.next=i}else h=p=i;a={baseState:u.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:u.shared,callbacks:u.callbacks},n.updateQueue=a;return}n=a.lastBaseUpdate,n===null?a.firstBaseUpdate=i:n.next=i,a.lastBaseUpdate=i}var $c=!1;function Ga(){if($c){var n=qs;if(n!==null)throw n}}function Ja(n,i,a,u){$c=!1;var h=n.updateQueue;Ai=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,_=h.shared.pending;if(_!==null){h.shared.pending=null;var H=_,ie=H.next;H.next=null,w===null?p=ie:w.next=ie,w=H;var ce=n.alternate;ce!==null&&(ce=ce.updateQueue,_=ce.lastBaseUpdate,_!==w&&(_===null?ce.firstBaseUpdate=ie:_.next=ie,ce.lastBaseUpdate=H))}if(p!==null){var ye=h.baseState;w=0,ce=ie=H=null,_=p;do{var se=_.lane&-536870913,ue=se!==_.lane;if(ue?(ct&se)===se:(u&se)===se){se!==0&&se===Hs&&($c=!0),ce!==null&&(ce=ce.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var ze=n,Ve=_;se=i;var jt=a;switch(Ve.tag){case 1:if(ze=Ve.payload,typeof ze=="function"){ye=ze.call(jt,ye,se);break e}ye=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=Ve.payload,se=typeof ze=="function"?ze.call(jt,ye,se):ze,se==null)break e;ye=g({},ye,se);break e;case 2:Ai=!0}}se=_.callback,se!==null&&(n.flags|=64,ue&&(n.flags|=8192),ue=h.callbacks,ue===null?h.callbacks=[se]:ue.push(se))}else ue={lane:se,tag:_.tag,payload:_.payload,callback:_.callback,next:null},ce===null?(ie=ce=ue,H=ye):ce=ce.next=ue,w|=se;if(_=_.next,_===null){if(_=h.shared.pending,_===null)break;ue=_,_=ue.next,ue.next=null,h.lastBaseUpdate=ue,h.shared.pending=null}}while(!0);ce===null&&(H=ye),h.baseState=H,h.firstBaseUpdate=ie,h.lastBaseUpdate=ce,p===null&&(h.shared.lanes=0),Di|=w,n.lanes=w,n.memoizedState=ye}}function mp(n,i){if(typeof n!="function")throw Error(s(191,n));n.call(i)}function pp(n,i){var a=n.callbacks;if(a!==null)for(n.callbacks=null,n=0;n<a.length;n++)mp(a[n],i)}var $s=z(null),wo=z(0);function gp(n,i){n=ci,N(wo,n),N($s,i),ci=n|i.baseLanes}function Vc(){N(wo,ci),N($s,$s.current)}function Yc(){ci=wo.current,W($s),W(wo)}var Zn=z(null),br=null;function Ti(n){var i=n.alternate;N(rn,rn.current&1),N(Zn,n),br===null&&(i===null||$s.current!==null||i.memoizedState!==null)&&(br=n)}function Gc(n){N(rn,rn.current),N(Zn,n),br===null&&(br=n)}function yp(n){n.tag===22?(N(rn,rn.current),N(Zn,n),br===null&&(br=n)):Oi()}function Oi(){N(rn,rn.current),N(Zn,Zn.current)}function Wn(n){W(Zn),br===n&&(br=null),W(rn)}var rn=z(0);function So(n){for(var i=n;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||eh(a)||th(a)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var ni=0,Ze=null,Ct=null,fn=null,_o=!1,Vs=!1,ps=!1,ko=0,Xa=0,Ys=null,Xv=0;function en(){throw Error(s(321))}function Jc(n,i){if(i===null)return!1;for(var a=0;a<i.length&&a<n.length;a++)if(!Kn(n[a],i[a]))return!1;return!0}function Xc(n,i,a,u,h,p){return ni=p,Ze=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,V.H=n===null||n.memoizedState===null?eg:ff,ps=!1,p=a(u,h),ps=!1,Vs&&(p=xp(i,a,u,h)),bp(n),p}function bp(n){V.H=Za;var i=Ct!==null&&Ct.next!==null;if(ni=0,fn=Ct=Ze=null,_o=!1,Xa=0,Ys=null,i)throw Error(s(300));n===null||hn||(n=n.dependencies,n!==null&&mo(n)&&(hn=!0))}function xp(n,i,a,u){Ze=n;var h=0;do{if(Vs&&(Ys=null),Xa=0,Vs=!1,25<=h)throw Error(s(301));if(h+=1,fn=Ct=null,n.updateQueue!=null){var p=n.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}V.H=tg,p=i(a,u)}while(Vs);return p}function Kv(){var n=V.H,i=n.useState()[0];return i=typeof i.then=="function"?Ka(i):i,n=n.useState()[0],(Ct!==null?Ct.memoizedState:null)!==n&&(Ze.flags|=1024),i}function Kc(){var n=ko!==0;return ko=0,n}function Qc(n,i,a){i.updateQueue=n.updateQueue,i.flags&=-2053,n.lanes&=~a}function Zc(n){if(_o){for(n=n.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}_o=!1}ni=0,fn=Ct=Ze=null,Vs=!1,Xa=ko=0,Ys=null}function Dn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fn===null?Ze.memoizedState=fn=n:fn=fn.next=n,fn}function sn(){if(Ct===null){var n=Ze.alternate;n=n!==null?n.memoizedState:null}else n=Ct.next;var i=fn===null?Ze.memoizedState:fn.next;if(i!==null)fn=i,Ct=n;else{if(n===null)throw Ze.alternate===null?Error(s(467)):Error(s(310));Ct=n,n={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},fn===null?Ze.memoizedState=fn=n:fn=fn.next=n}return fn}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ka(n){var i=Xa;return Xa+=1,Ys===null&&(Ys=[]),n=up(Ys,n,i),i=Ze,(fn===null?i.memoizedState:fn.next)===null&&(i=i.alternate,V.H=i===null||i.memoizedState===null?eg:ff),n}function Co(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ka(n);if(n.$$typeof===I)return Sn(n)}throw Error(s(438,String(n)))}function Wc(n){var i=null,a=Ze.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var u=Ze.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(i={data:u.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=Eo(),Ze.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(n),u=0;u<n;u++)a[u]=D;return i.index++,a}function ri(n,i){return typeof i=="function"?i(n):i}function Ao(n){var i=sn();return ef(i,Ct,n)}function ef(n,i,a){var u=n.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=a;var h=n.baseQueue,p=u.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}i.baseQueue=h=p,u.pending=null}if(p=n.baseState,h===null)n.memoizedState=p;else{i=h.next;var _=w=null,H=null,ie=i,ce=!1;do{var ye=ie.lane&-536870913;if(ye!==ie.lane?(ct&ye)===ye:(ni&ye)===ye){var se=ie.revertLane;if(se===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),ye===Hs&&(ce=!0);else if((ni&se)===se){ie=ie.next,se===Hs&&(ce=!0);continue}else ye={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},H===null?(_=H=ye,w=p):H=H.next=ye,Ze.lanes|=se,Di|=se;ye=ie.action,ps&&a(p,ye),p=ie.hasEagerState?ie.eagerState:a(p,ye)}else se={lane:ye,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},H===null?(_=H=se,w=p):H=H.next=se,Ze.lanes|=ye,Di|=ye;ie=ie.next}while(ie!==null&&ie!==i);if(H===null?w=p:H.next=_,!Kn(p,n.memoizedState)&&(hn=!0,ce&&(a=qs,a!==null)))throw a;n.memoizedState=p,n.baseState=w,n.baseQueue=H,u.lastRenderedState=p}return h===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function tf(n){var i=sn(),a=i.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=n;var u=a.dispatch,h=a.pending,p=i.memoizedState;if(h!==null){a.pending=null;var w=h=h.next;do p=n(p,w.action),w=w.next;while(w!==h);Kn(p,i.memoizedState)||(hn=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,u]}function vp(n,i,a){var u=Ze,h=sn(),p=ht;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var w=!Kn((Ct||h).memoizedState,a);if(w&&(h.memoizedState=a,hn=!0),h=h.queue,sf(_p.bind(null,u,h,n),[n]),h.getSnapshot!==i||w||fn!==null&&fn.memoizedState.tag&1){if(u.flags|=2048,Gs(9,{destroy:void 0},Sp.bind(null,u,h,a,i),null),Mt===null)throw Error(s(349));p||(ni&127)!==0||wp(u,i,a)}return a}function wp(n,i,a){n.flags|=16384,n={getSnapshot:i,value:a},i=Ze.updateQueue,i===null?(i=Eo(),Ze.updateQueue=i,i.stores=[n]):(a=i.stores,a===null?i.stores=[n]:a.push(n))}function Sp(n,i,a,u){i.value=a,i.getSnapshot=u,kp(i)&&Ep(n)}function _p(n,i,a){return a(function(){kp(i)&&Ep(n)})}function kp(n){var i=n.getSnapshot;n=n.value;try{var a=i();return!Kn(n,a)}catch{return!0}}function Ep(n){var i=as(n,2);i!==null&&Vn(i,n,2)}function nf(n){var i=Dn();if(typeof n=="function"){var a=n;if(n=a(),ps){Xt(!0);try{a()}finally{Xt(!1)}}}return i.memoizedState=i.baseState=n,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ri,lastRenderedState:n},i}function Cp(n,i,a,u){return n.baseState=a,ef(n,Ct,typeof u=="function"?u:ri)}function Qv(n,i,a,u,h){if(To(n))throw Error(s(485));if(n=i.action,n!==null){var p={payload:h,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};V.T!==null?a(!0):p.isTransition=!1,u(p),a=i.pending,a===null?(p.next=i.pending=p,Ap(i,p)):(p.next=a.next,i.pending=a.next=p)}}function Ap(n,i){var a=i.action,u=i.payload,h=n.state;if(i.isTransition){var p=V.T,w={};V.T=w;try{var _=a(h,u),H=V.S;H!==null&&H(w,_),jp(n,i,_)}catch(ie){rf(n,i,ie)}finally{p!==null&&w.types!==null&&(p.types=w.types),V.T=p}}else try{p=a(h,u),jp(n,i,p)}catch(ie){rf(n,i,ie)}}function jp(n,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(u){Np(n,i,u)},function(u){return rf(n,i,u)}):Np(n,i,a)}function Np(n,i,a){i.status="fulfilled",i.value=a,Tp(i),n.state=a,i=n.pending,i!==null&&(a=i.next,a===i?n.pending=null:(a=a.next,i.next=a,Ap(n,a)))}function rf(n,i,a){var u=n.pending;if(n.pending=null,u!==null){u=u.next;do i.status="rejected",i.reason=a,Tp(i),i=i.next;while(i!==u)}n.action=null}function Tp(n){n=n.listeners;for(var i=0;i<n.length;i++)(0,n[i])()}function Op(n,i){return i}function Rp(n,i){if(ht){var a=Mt.formState;if(a!==null){e:{var u=Ze;if(ht){if(Ht){t:{for(var h=Ht,p=yr;h.nodeType!==8;){if(!p){h=null;break t}if(h=xr(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Ht=xr(h.nextSibling),u=h.data==="F!";break e}}Ei(u)}u=!1}u&&(i=a[0])}}return a=Dn(),a.memoizedState=a.baseState=i,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Op,lastRenderedState:i},a.queue=u,a=Qp.bind(null,Ze,u),u.dispatch=a,u=nf(!1),p=cf.bind(null,Ze,!1,u.queue),u=Dn(),h={state:i,dispatch:null,action:n,pending:null},u.queue=h,a=Qv.bind(null,Ze,h,p,a),h.dispatch=a,u.memoizedState=n,[i,a,!1]}function Mp(n){var i=sn();return Dp(i,Ct,n)}function Dp(n,i,a){if(i=ef(n,i,Op)[0],n=Ao(ri)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var u=Ka(i)}catch(w){throw w===Is?yo:w}else u=i;i=sn();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(Ze.flags|=2048,Gs(9,{destroy:void 0},Zv.bind(null,h,a),null)),[u,p,n]}function Zv(n,i){n.action=i}function Lp(n){var i=sn(),a=Ct;if(a!==null)return Dp(i,a,n);sn(),i=i.memoizedState,a=sn();var u=a.queue.dispatch;return a.memoizedState=n,[i,u,!1]}function Gs(n,i,a,u){return n={tag:n,create:a,deps:u,inst:i,next:null},i=Ze.updateQueue,i===null&&(i=Eo(),Ze.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=n.next=n:(u=a.next,a.next=n,n.next=u,i.lastEffect=n),n}function zp(){return sn().memoizedState}function jo(n,i,a,u){var h=Dn();Ze.flags|=n,h.memoizedState=Gs(1|i,{destroy:void 0},a,u===void 0?null:u)}function No(n,i,a,u){var h=sn();u=u===void 0?null:u;var p=h.memoizedState.inst;Ct!==null&&u!==null&&Jc(u,Ct.memoizedState.deps)?h.memoizedState=Gs(i,p,a,u):(Ze.flags|=n,h.memoizedState=Gs(1|i,p,a,u))}function Up(n,i){jo(8390656,8,n,i)}function sf(n,i){No(2048,8,n,i)}function Wv(n){Ze.flags|=4;var i=Ze.updateQueue;if(i===null)i=Eo(),Ze.updateQueue=i,i.events=[n];else{var a=i.events;a===null?i.events=[n]:a.push(n)}}function Pp(n){var i=sn().memoizedState;return Wv({ref:i,nextImpl:n}),function(){if((vt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function Bp(n,i){return No(4,2,n,i)}function Hp(n,i){return No(4,4,n,i)}function qp(n,i){if(typeof i=="function"){n=n();var a=i(n);return function(){typeof a=="function"?a():i(null)}}if(i!=null)return n=n(),i.current=n,function(){i.current=null}}function Ip(n,i,a){a=a!=null?a.concat([n]):null,No(4,4,qp.bind(null,i,n),a)}function af(){}function Fp(n,i){var a=sn();i=i===void 0?null:i;var u=a.memoizedState;return i!==null&&Jc(i,u[1])?u[0]:(a.memoizedState=[n,i],n)}function $p(n,i){var a=sn();i=i===void 0?null:i;var u=a.memoizedState;if(i!==null&&Jc(i,u[1]))return u[0];if(u=n(),ps){Xt(!0);try{n()}finally{Xt(!1)}}return a.memoizedState=[u,i],u}function lf(n,i,a){return a===void 0||(ni&1073741824)!==0&&(ct&261930)===0?n.memoizedState=i:(n.memoizedState=a,n=Vg(),Ze.lanes|=n,Di|=n,a)}function Vp(n,i,a,u){return Kn(a,i)?a:$s.current!==null?(n=lf(n,a,u),Kn(n,i)||(hn=!0),n):(ni&42)===0||(ni&1073741824)!==0&&(ct&261930)===0?(hn=!0,n.memoizedState=a):(n=Vg(),Ze.lanes|=n,Di|=n,i)}function Yp(n,i,a,u,h){var p=Q.p;Q.p=p!==0&&8>p?p:8;var w=V.T,_={};V.T=_,cf(n,!1,i,a);try{var H=h(),ie=V.S;if(ie!==null&&ie(_,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ce=Jv(H,u);Qa(n,i,ce,nr(n))}else Qa(n,i,u,nr(n))}catch(ye){Qa(n,i,{then:function(){},status:"rejected",reason:ye},nr())}finally{Q.p=p,w!==null&&_.types!==null&&(w.types=_.types),V.T=w}}function ew(){}function of(n,i,a,u){if(n.tag!==5)throw Error(s(476));var h=Gp(n).queue;Yp(n,h,i,X,a===null?ew:function(){return Jp(n),a(u)})}function Gp(n){var i=n.memoizedState;if(i!==null)return i;i={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ri,lastRenderedState:X},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ri,lastRenderedState:a},next:null},n.memoizedState=i,n=n.alternate,n!==null&&(n.memoizedState=i),i}function Jp(n){var i=Gp(n);i.next===null&&(i=n.alternate.memoizedState),Qa(n,i.next.queue,{},nr())}function uf(){return Sn(ml)}function Xp(){return sn().memoizedState}function Kp(){return sn().memoizedState}function tw(n){for(var i=n.return;i!==null;){switch(i.tag){case 24:case 3:var a=nr();n=ji(a);var u=Ni(i,n,a);u!==null&&(Vn(u,i,a),Ya(u,i,a)),i={cache:Uc()},n.payload=i;return}i=i.return}}function nw(n,i,a){var u=nr();a={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},To(n)?Zp(i,a):(a=Cc(n,i,a,u),a!==null&&(Vn(a,n,u),Wp(a,i,u)))}function Qp(n,i,a){var u=nr();Qa(n,i,a,u)}function Qa(n,i,a,u){var h={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(To(n))Zp(i,h);else{var p=n.alternate;if(n.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var w=i.lastRenderedState,_=p(w,a);if(h.hasEagerState=!0,h.eagerState=_,Kn(_,w))return uo(n,i,h,0),Mt===null&&oo(),!1}catch{}finally{}if(a=Cc(n,i,h,u),a!==null)return Vn(a,n,u),Wp(a,i,u),!0}return!1}function cf(n,i,a,u){if(u={lane:2,revertLane:If(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},To(n)){if(i)throw Error(s(479))}else i=Cc(n,a,u,2),i!==null&&Vn(i,n,2)}function To(n){var i=n.alternate;return n===Ze||i!==null&&i===Ze}function Zp(n,i){Vs=_o=!0;var a=n.pending;a===null?i.next=i:(i.next=a.next,a.next=i),n.pending=i}function Wp(n,i,a){if((a&4194048)!==0){var u=i.lanes;u&=n.pendingLanes,a|=u,i.lanes=a,ot(n,a)}}var Za={readContext:Sn,use:Co,useCallback:en,useContext:en,useEffect:en,useImperativeHandle:en,useLayoutEffect:en,useInsertionEffect:en,useMemo:en,useReducer:en,useRef:en,useState:en,useDebugValue:en,useDeferredValue:en,useTransition:en,useSyncExternalStore:en,useId:en,useHostTransitionStatus:en,useFormState:en,useActionState:en,useOptimistic:en,useMemoCache:en,useCacheRefresh:en};Za.useEffectEvent=en;var eg={readContext:Sn,use:Co,useCallback:function(n,i){return Dn().memoizedState=[n,i===void 0?null:i],n},useContext:Sn,useEffect:Up,useImperativeHandle:function(n,i,a){a=a!=null?a.concat([n]):null,jo(4194308,4,qp.bind(null,i,n),a)},useLayoutEffect:function(n,i){return jo(4194308,4,n,i)},useInsertionEffect:function(n,i){jo(4,2,n,i)},useMemo:function(n,i){var a=Dn();i=i===void 0?null:i;var u=n();if(ps){Xt(!0);try{n()}finally{Xt(!1)}}return a.memoizedState=[u,i],u},useReducer:function(n,i,a){var u=Dn();if(a!==void 0){var h=a(i);if(ps){Xt(!0);try{a(i)}finally{Xt(!1)}}}else h=i;return u.memoizedState=u.baseState=h,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:h},u.queue=n,n=n.dispatch=nw.bind(null,Ze,n),[u.memoizedState,n]},useRef:function(n){var i=Dn();return n={current:n},i.memoizedState=n},useState:function(n){n=nf(n);var i=n.queue,a=Qp.bind(null,Ze,i);return i.dispatch=a,[n.memoizedState,a]},useDebugValue:af,useDeferredValue:function(n,i){var a=Dn();return lf(a,n,i)},useTransition:function(){var n=nf(!1);return n=Yp.bind(null,Ze,n.queue,!0,!1),Dn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,i,a){var u=Ze,h=Dn();if(ht){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),Mt===null)throw Error(s(349));(ct&127)!==0||wp(u,i,a)}h.memoizedState=a;var p={value:a,getSnapshot:i};return h.queue=p,Up(_p.bind(null,u,p,n),[n]),u.flags|=2048,Gs(9,{destroy:void 0},Sp.bind(null,u,p,a,i),null),a},useId:function(){var n=Dn(),i=Mt.identifierPrefix;if(ht){var a=Br,u=Pr;a=(u&~(1<<32-Qe(u)-1)).toString(32)+a,i="_"+i+"R_"+a,a=ko++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Xv++,i="_"+i+"r_"+a.toString(32)+"_";return n.memoizedState=i},useHostTransitionStatus:uf,useFormState:Rp,useActionState:Rp,useOptimistic:function(n){var i=Dn();i.memoizedState=i.baseState=n;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=cf.bind(null,Ze,!0,a),a.dispatch=i,[n,i]},useMemoCache:Wc,useCacheRefresh:function(){return Dn().memoizedState=tw.bind(null,Ze)},useEffectEvent:function(n){var i=Dn(),a={impl:n};return i.memoizedState=a,function(){if((vt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},ff={readContext:Sn,use:Co,useCallback:Fp,useContext:Sn,useEffect:sf,useImperativeHandle:Ip,useInsertionEffect:Bp,useLayoutEffect:Hp,useMemo:$p,useReducer:Ao,useRef:zp,useState:function(){return Ao(ri)},useDebugValue:af,useDeferredValue:function(n,i){var a=sn();return Vp(a,Ct.memoizedState,n,i)},useTransition:function(){var n=Ao(ri)[0],i=sn().memoizedState;return[typeof n=="boolean"?n:Ka(n),i]},useSyncExternalStore:vp,useId:Xp,useHostTransitionStatus:uf,useFormState:Mp,useActionState:Mp,useOptimistic:function(n,i){var a=sn();return Cp(a,Ct,n,i)},useMemoCache:Wc,useCacheRefresh:Kp};ff.useEffectEvent=Pp;var tg={readContext:Sn,use:Co,useCallback:Fp,useContext:Sn,useEffect:sf,useImperativeHandle:Ip,useInsertionEffect:Bp,useLayoutEffect:Hp,useMemo:$p,useReducer:tf,useRef:zp,useState:function(){return tf(ri)},useDebugValue:af,useDeferredValue:function(n,i){var a=sn();return Ct===null?lf(a,n,i):Vp(a,Ct.memoizedState,n,i)},useTransition:function(){var n=tf(ri)[0],i=sn().memoizedState;return[typeof n=="boolean"?n:Ka(n),i]},useSyncExternalStore:vp,useId:Xp,useHostTransitionStatus:uf,useFormState:Lp,useActionState:Lp,useOptimistic:function(n,i){var a=sn();return Ct!==null?Cp(a,Ct,n,i):(a.baseState=n,[n,a.queue.dispatch])},useMemoCache:Wc,useCacheRefresh:Kp};tg.useEffectEvent=Pp;function hf(n,i,a,u){i=n.memoizedState,a=a(u,i),a=a==null?i:g({},i,a),n.memoizedState=a,n.lanes===0&&(n.updateQueue.baseState=a)}var df={enqueueSetState:function(n,i,a){n=n._reactInternals;var u=nr(),h=ji(u);h.payload=i,a!=null&&(h.callback=a),i=Ni(n,h,u),i!==null&&(Vn(i,n,u),Ya(i,n,u))},enqueueReplaceState:function(n,i,a){n=n._reactInternals;var u=nr(),h=ji(u);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=Ni(n,h,u),i!==null&&(Vn(i,n,u),Ya(i,n,u))},enqueueForceUpdate:function(n,i){n=n._reactInternals;var a=nr(),u=ji(a);u.tag=2,i!=null&&(u.callback=i),i=Ni(n,u,a),i!==null&&(Vn(i,n,a),Ya(i,n,a))}};function ng(n,i,a,u,h,p,w){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,p,w):i.prototype&&i.prototype.isPureReactComponent?!Pa(a,u)||!Pa(h,p):!0}function rg(n,i,a,u){n=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,u),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,u),i.state!==n&&df.enqueueReplaceState(i,i.state,null)}function gs(n,i){var a=i;if("ref"in i){a={};for(var u in i)u!=="ref"&&(a[u]=i[u])}if(n=n.defaultProps){a===i&&(a=g({},a));for(var h in n)a[h]===void 0&&(a[h]=n[h])}return a}function ig(n){lo(n)}function sg(n){console.error(n)}function ag(n){lo(n)}function Oo(n,i){try{var a=n.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(u){setTimeout(function(){throw u})}}function lg(n,i,a){try{var u=n.onCaughtError;u(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function mf(n,i,a){return a=ji(a),a.tag=3,a.payload={element:null},a.callback=function(){Oo(n,i)},a}function og(n){return n=ji(n),n.tag=3,n}function ug(n,i,a,u){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=u.value;n.payload=function(){return h(p)},n.callback=function(){lg(i,a,u)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(n.callback=function(){lg(i,a,u),typeof h!="function"&&(Li===null?Li=new Set([this]):Li.add(this));var _=u.stack;this.componentDidCatch(u.value,{componentStack:_!==null?_:""})})}function rw(n,i,a,u,h){if(a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(i=a.alternate,i!==null&&Bs(i,a,h,!0),a=Zn.current,a!==null){switch(a.tag){case 31:case 13:return br===null?Fo():a.alternate===null&&tn===0&&(tn=3),a.flags&=-257,a.flags|=65536,a.lanes=h,u===bo?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([u]):i.add(u),Bf(n,u,h)),!1;case 22:return a.flags|=65536,u===bo?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([u])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([u]):a.add(u)),Bf(n,u,h)),!1}throw Error(s(435,a.tag))}return Bf(n,u,h),Fo(),!1}if(ht)return i=Zn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,u!==Rc&&(n=Error(s(422),{cause:u}),qa(mr(n,a)))):(u!==Rc&&(i=Error(s(423),{cause:u}),qa(mr(i,a))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,u=mr(u,a),h=mf(n.stateNode,u,h),Fc(n,h),tn!==4&&(tn=2)),!1;var p=Error(s(520),{cause:u});if(p=mr(p,a),al===null?al=[p]:al.push(p),tn!==4&&(tn=2),i===null)return!0;u=mr(u,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,n=h&-h,a.lanes|=n,n=mf(a.stateNode,u,n),Fc(a,n),!1;case 1:if(i=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Li===null||!Li.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=og(h),ug(h,n,a,u),Fc(a,h),!1}a=a.return}while(a!==null);return!1}var pf=Error(s(461)),hn=!1;function _n(n,i,a,u){i.child=n===null?dp(i,null,a,u):ms(i,n.child,a,u)}function cg(n,i,a,u,h){a=a.render;var p=i.ref;if("ref"in u){var w={};for(var _ in u)_!=="ref"&&(w[_]=u[_])}else w=u;return cs(i),u=Xc(n,i,a,w,p,h),_=Kc(),n!==null&&!hn?(Qc(n,i,h),ii(n,i,h)):(ht&&_&&Tc(i),i.flags|=1,_n(n,i,u,h),i.child)}function fg(n,i,a,u,h){if(n===null){var p=a.type;return typeof p=="function"&&!Ac(p)&&p.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=p,hg(n,i,p,u,h)):(n=fo(a.type,null,u,i,i.mode,h),n.ref=i.ref,n.return=i,i.child=n)}if(p=n.child,!_f(n,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:Pa,a(w,u)&&n.ref===i.ref)return ii(n,i,h)}return i.flags|=1,n=Zr(p,u),n.ref=i.ref,n.return=i,i.child=n}function hg(n,i,a,u,h){if(n!==null){var p=n.memoizedProps;if(Pa(p,u)&&n.ref===i.ref)if(hn=!1,i.pendingProps=u=p,_f(n,h))(n.flags&131072)!==0&&(hn=!0);else return i.lanes=n.lanes,ii(n,i,h)}return gf(n,i,a,u,h)}function dg(n,i,a,u){var h=u.children,p=n!==null?n.memoizedState:null;if(n===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((i.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,n!==null){for(u=i.child=n.child,h=0;u!==null;)h=h|u.lanes|u.childLanes,u=u.sibling;u=h&~p}else u=0,i.child=null;return mg(n,i,p,a,u)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},n!==null&&go(i,p!==null?p.cachePool:null),p!==null?gp(i,p):Vc(),yp(i);else return u=i.lanes=536870912,mg(n,i,p!==null?p.baseLanes|a:a,a,u)}else p!==null?(go(i,p.cachePool),gp(i,p),Oi(),i.memoizedState=null):(n!==null&&go(i,null),Vc(),Oi());return _n(n,i,h,a),i.child}function Wa(n,i){return n!==null&&n.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function mg(n,i,a,u,h){var p=Bc();return p=p===null?null:{parent:cn._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},n!==null&&go(i,null),Vc(),yp(i),n!==null&&Bs(n,i,u,!0),i.childLanes=h,null}function Ro(n,i){return i=Do({mode:i.mode,children:i.children},n.mode),i.ref=n.ref,n.child=i,i.return=n,i}function pg(n,i,a){return ms(i,n.child,null,a),n=Ro(i,i.pendingProps),n.flags|=2,Wn(i),i.memoizedState=null,n}function iw(n,i,a){var u=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,n===null){if(ht){if(u.mode==="hidden")return n=Ro(i,u),i.lanes=536870912,Wa(null,n);if(Gc(i),(n=Ht)?(n=Ay(n,yr),n=n!==null&&n.data==="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:_i!==null?{id:Pr,overflow:Br}:null,retryLane:536870912,hydrationErrors:null},a=Zm(n),a.return=i,i.child=a,wn=i,Ht=null)):n=null,n===null)throw Ei(i);return i.lanes=536870912,null}return Ro(i,u)}var p=n.memoizedState;if(p!==null){var w=p.dehydrated;if(Gc(i),h)if(i.flags&256)i.flags&=-257,i=pg(n,i,a);else if(i.memoizedState!==null)i.child=n.child,i.flags|=128,i=null;else throw Error(s(558));else if(hn||Bs(n,i,a,!1),h=(a&n.childLanes)!==0,hn||h){if(u=Mt,u!==null&&(w=Xe(u,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,as(n,w),Vn(u,n,w),pf;Fo(),i=pg(n,i,a)}else n=p.treeContext,Ht=xr(w.nextSibling),wn=i,ht=!0,ki=null,yr=!1,n!==null&&tp(i,n),i=Ro(i,u),i.flags|=4096;return i}return n=Zr(n.child,{mode:u.mode,children:u.children}),n.ref=i.ref,i.child=n,n.return=i,n}function Mo(n,i){var a=i.ref;if(a===null)n!==null&&n.ref!==null&&(i.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(n===null||n.ref!==a)&&(i.flags|=4194816)}}function gf(n,i,a,u,h){return cs(i),a=Xc(n,i,a,u,void 0,h),u=Kc(),n!==null&&!hn?(Qc(n,i,h),ii(n,i,h)):(ht&&u&&Tc(i),i.flags|=1,_n(n,i,a,h),i.child)}function gg(n,i,a,u,h,p){return cs(i),i.updateQueue=null,a=xp(i,u,a,h),bp(n),u=Kc(),n!==null&&!hn?(Qc(n,i,p),ii(n,i,p)):(ht&&u&&Tc(i),i.flags|=1,_n(n,i,a,p),i.child)}function yg(n,i,a,u,h){if(cs(i),i.stateNode===null){var p=Ls,w=a.contextType;typeof w=="object"&&w!==null&&(p=Sn(w)),p=new a(u,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=df,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=u,p.state=i.memoizedState,p.refs={},qc(i),w=a.contextType,p.context=typeof w=="object"&&w!==null?Sn(w):Ls,p.state=i.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(hf(i,a,w,u),p.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&df.enqueueReplaceState(p,p.state,null),Ja(i,u,p,h),Ga(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),u=!0}else if(n===null){p=i.stateNode;var _=i.memoizedProps,H=gs(a,_);p.props=H;var ie=p.context,ce=a.contextType;w=Ls,typeof ce=="object"&&ce!==null&&(w=Sn(ce));var ye=a.getDerivedStateFromProps;ce=typeof ye=="function"||typeof p.getSnapshotBeforeUpdate=="function",_=i.pendingProps!==_,ce||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(_||ie!==w)&&rg(i,p,u,w),Ai=!1;var se=i.memoizedState;p.state=se,Ja(i,u,p,h),Ga(),ie=i.memoizedState,_||se!==ie||Ai?(typeof ye=="function"&&(hf(i,a,ye,u),ie=i.memoizedState),(H=Ai||ng(i,a,H,u,se,ie,w))?(ce||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(i.flags|=4194308)):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=u,i.memoizedState=ie),p.props=u,p.state=ie,p.context=w,u=H):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),u=!1)}else{p=i.stateNode,Ic(n,i),w=i.memoizedProps,ce=gs(a,w),p.props=ce,ye=i.pendingProps,se=p.context,ie=a.contextType,H=Ls,typeof ie=="object"&&ie!==null&&(H=Sn(ie)),_=a.getDerivedStateFromProps,(ie=typeof _=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ye||se!==H)&&rg(i,p,u,H),Ai=!1,se=i.memoizedState,p.state=se,Ja(i,u,p,h),Ga();var ue=i.memoizedState;w!==ye||se!==ue||Ai||n!==null&&n.dependencies!==null&&mo(n.dependencies)?(typeof _=="function"&&(hf(i,a,_,u),ue=i.memoizedState),(ce=Ai||ng(i,a,ce,u,se,ue,H)||n!==null&&n.dependencies!==null&&mo(n.dependencies))?(ie||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(u,ue,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(u,ue,H)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===n.memoizedProps&&se===n.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===n.memoizedProps&&se===n.memoizedState||(i.flags|=1024),i.memoizedProps=u,i.memoizedState=ue),p.props=u,p.state=ue,p.context=H,u=ce):(typeof p.componentDidUpdate!="function"||w===n.memoizedProps&&se===n.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===n.memoizedProps&&se===n.memoizedState||(i.flags|=1024),u=!1)}return p=u,Mo(n,i),u=(i.flags&128)!==0,p||u?(p=i.stateNode,a=u&&typeof a.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,n!==null&&u?(i.child=ms(i,n.child,null,h),i.child=ms(i,null,a,h)):_n(n,i,a,h),i.memoizedState=p.state,n=i.child):n=ii(n,i,h),n}function bg(n,i,a,u){return os(),i.flags|=256,_n(n,i,a,u),i.child}var yf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bf(n){return{baseLanes:n,cachePool:lp()}}function xf(n,i,a){return n=n!==null?n.childLanes&~a:0,i&&(n|=tr),n}function xg(n,i,a){var u=i.pendingProps,h=!1,p=(i.flags&128)!==0,w;if((w=p)||(w=n!==null&&n.memoizedState===null?!1:(rn.current&2)!==0),w&&(h=!0,i.flags&=-129),w=(i.flags&32)!==0,i.flags&=-33,n===null){if(ht){if(h?Ti(i):Oi(),(n=Ht)?(n=Ay(n,yr),n=n!==null&&n.data!=="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:_i!==null?{id:Pr,overflow:Br}:null,retryLane:536870912,hydrationErrors:null},a=Zm(n),a.return=i,i.child=a,wn=i,Ht=null)):n=null,n===null)throw Ei(i);return th(n)?i.lanes=32:i.lanes=536870912,null}var _=u.children;return u=u.fallback,h?(Oi(),h=i.mode,_=Do({mode:"hidden",children:_},h),u=ls(u,h,a,null),_.return=i,u.return=i,_.sibling=u,i.child=_,u=i.child,u.memoizedState=bf(a),u.childLanes=xf(n,w,a),i.memoizedState=yf,Wa(null,u)):(Ti(i),vf(i,_))}var H=n.memoizedState;if(H!==null&&(_=H.dehydrated,_!==null)){if(p)i.flags&256?(Ti(i),i.flags&=-257,i=wf(n,i,a)):i.memoizedState!==null?(Oi(),i.child=n.child,i.flags|=128,i=null):(Oi(),_=u.fallback,h=i.mode,u=Do({mode:"visible",children:u.children},h),_=ls(_,h,a,null),_.flags|=2,u.return=i,_.return=i,u.sibling=_,i.child=u,ms(i,n.child,null,a),u=i.child,u.memoizedState=bf(a),u.childLanes=xf(n,w,a),i.memoizedState=yf,i=Wa(null,u));else if(Ti(i),th(_)){if(w=_.nextSibling&&_.nextSibling.dataset,w)var ie=w.dgst;w=ie,u=Error(s(419)),u.stack="",u.digest=w,qa({value:u,source:null,stack:null}),i=wf(n,i,a)}else if(hn||Bs(n,i,a,!1),w=(a&n.childLanes)!==0,hn||w){if(w=Mt,w!==null&&(u=Xe(w,a),u!==0&&u!==H.retryLane))throw H.retryLane=u,as(n,u),Vn(w,n,u),pf;eh(_)||Fo(),i=wf(n,i,a)}else eh(_)?(i.flags|=192,i.child=n.child,i=null):(n=H.treeContext,Ht=xr(_.nextSibling),wn=i,ht=!0,ki=null,yr=!1,n!==null&&tp(i,n),i=vf(i,u.children),i.flags|=4096);return i}return h?(Oi(),_=u.fallback,h=i.mode,H=n.child,ie=H.sibling,u=Zr(H,{mode:"hidden",children:u.children}),u.subtreeFlags=H.subtreeFlags&65011712,ie!==null?_=Zr(ie,_):(_=ls(_,h,a,null),_.flags|=2),_.return=i,u.return=i,u.sibling=_,i.child=u,Wa(null,u),u=i.child,_=n.child.memoizedState,_===null?_=bf(a):(h=_.cachePool,h!==null?(H=cn._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=lp(),_={baseLanes:_.baseLanes|a,cachePool:h}),u.memoizedState=_,u.childLanes=xf(n,w,a),i.memoizedState=yf,Wa(n.child,u)):(Ti(i),a=n.child,n=a.sibling,a=Zr(a,{mode:"visible",children:u.children}),a.return=i,a.sibling=null,n!==null&&(w=i.deletions,w===null?(i.deletions=[n],i.flags|=16):w.push(n)),i.child=a,i.memoizedState=null,a)}function vf(n,i){return i=Do({mode:"visible",children:i},n.mode),i.return=n,n.child=i}function Do(n,i){return n=Qn(22,n,null,i),n.lanes=0,n}function wf(n,i,a){return ms(i,n.child,null,a),n=vf(i,i.pendingProps.children),n.flags|=2,i.memoizedState=null,n}function vg(n,i,a){n.lanes|=i;var u=n.alternate;u!==null&&(u.lanes|=i),Lc(n.return,i,a)}function Sf(n,i,a,u,h,p){var w=n.memoizedState;w===null?n.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:u,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=i,w.rendering=null,w.renderingStartTime=0,w.last=u,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function wg(n,i,a){var u=i.pendingProps,h=u.revealOrder,p=u.tail;u=u.children;var w=rn.current,_=(w&2)!==0;if(_?(w=w&1|2,i.flags|=128):w&=1,N(rn,w),_n(n,i,u,a),u=ht?Ha:0,!_&&n!==null&&(n.flags&128)!==0)e:for(n=i.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&vg(n,a,i);else if(n.tag===19)vg(n,a,i);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===i)break e;for(;n.sibling===null;){if(n.return===null||n.return===i)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(h){case"forwards":for(a=i.child,h=null;a!==null;)n=a.alternate,n!==null&&So(n)===null&&(h=a),a=a.sibling;a=h,a===null?(h=i.child,i.child=null):(h=a.sibling,a.sibling=null),Sf(i,!1,h,a,p,u);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=i.child,i.child=null;h!==null;){if(n=h.alternate,n!==null&&So(n)===null){i.child=h;break}n=h.sibling,h.sibling=a,a=h,h=n}Sf(i,!0,a,null,p,u);break;case"together":Sf(i,!1,null,null,void 0,u);break;default:i.memoizedState=null}return i.child}function ii(n,i,a){if(n!==null&&(i.dependencies=n.dependencies),Di|=i.lanes,(a&i.childLanes)===0)if(n!==null){if(Bs(n,i,a,!1),(a&i.childLanes)===0)return null}else return null;if(n!==null&&i.child!==n.child)throw Error(s(153));if(i.child!==null){for(n=i.child,a=Zr(n,n.pendingProps),i.child=a,a.return=i;n.sibling!==null;)n=n.sibling,a=a.sibling=Zr(n,n.pendingProps),a.return=i;a.sibling=null}return i.child}function _f(n,i){return(n.lanes&i)!==0?!0:(n=n.dependencies,!!(n!==null&&mo(n)))}function sw(n,i,a){switch(i.tag){case 3:Ae(i,i.stateNode.containerInfo),Ci(i,cn,n.memoizedState.cache),os();break;case 27:case 5:We(i);break;case 4:Ae(i,i.stateNode.containerInfo);break;case 10:Ci(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Gc(i),null;break;case 13:var u=i.memoizedState;if(u!==null)return u.dehydrated!==null?(Ti(i),i.flags|=128,null):(a&i.child.childLanes)!==0?xg(n,i,a):(Ti(i),n=ii(n,i,a),n!==null?n.sibling:null);Ti(i);break;case 19:var h=(n.flags&128)!==0;if(u=(a&i.childLanes)!==0,u||(Bs(n,i,a,!1),u=(a&i.childLanes)!==0),h){if(u)return wg(n,i,a);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),N(rn,rn.current),u)break;return null;case 22:return i.lanes=0,dg(n,i,a,i.pendingProps);case 24:Ci(i,cn,n.memoizedState.cache)}return ii(n,i,a)}function Sg(n,i,a){if(n!==null)if(n.memoizedProps!==i.pendingProps)hn=!0;else{if(!_f(n,a)&&(i.flags&128)===0)return hn=!1,sw(n,i,a);hn=(n.flags&131072)!==0}else hn=!1,ht&&(i.flags&1048576)!==0&&ep(i,Ha,i.index);switch(i.lanes=0,i.tag){case 16:e:{var u=i.pendingProps;if(n=hs(i.elementType),i.type=n,typeof n=="function")Ac(n)?(u=gs(n,u),i.tag=1,i=yg(null,i,n,u,a)):(i.tag=0,i=gf(null,i,n,u,a));else{if(n!=null){var h=n.$$typeof;if(h===te){i.tag=11,i=cg(null,i,n,u,a);break e}else if(h===ee){i.tag=14,i=fg(null,i,n,u,a);break e}}throw i=oe(n)||n,Error(s(306,i,""))}}return i;case 0:return gf(n,i,i.type,i.pendingProps,a);case 1:return u=i.type,h=gs(u,i.pendingProps),yg(n,i,u,h,a);case 3:e:{if(Ae(i,i.stateNode.containerInfo),n===null)throw Error(s(387));u=i.pendingProps;var p=i.memoizedState;h=p.element,Ic(n,i),Ja(i,u,null,a);var w=i.memoizedState;if(u=w.cache,Ci(i,cn,u),u!==p.cache&&zc(i,[cn],a,!0),Ga(),u=w.element,p.isDehydrated)if(p={element:u,isDehydrated:!1,cache:w.cache},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){i=bg(n,i,u,a);break e}else if(u!==h){h=mr(Error(s(424)),i),qa(h),i=bg(n,i,u,a);break e}else{switch(n=i.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(Ht=xr(n.firstChild),wn=i,ht=!0,ki=null,yr=!0,a=dp(i,null,u,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(os(),u===h){i=ii(n,i,a);break e}_n(n,i,u,a)}i=i.child}return i;case 26:return Mo(n,i),n===null?(a=My(i.type,null,i.pendingProps,null))?i.memoizedState=a:ht||(a=i.type,n=i.pendingProps,u=Ko(je.current).createElement(a),u[ut]=i,u[Pt]=n,kn(u,a,n),$(u),i.stateNode=u):i.memoizedState=My(i.type,n.memoizedProps,i.pendingProps,n.memoizedState),null;case 27:return We(i),n===null&&ht&&(u=i.stateNode=Ty(i.type,i.pendingProps,je.current),wn=i,yr=!0,h=Ht,Bi(i.type)?(nh=h,Ht=xr(u.firstChild)):Ht=h),_n(n,i,i.pendingProps.children,a),Mo(n,i),n===null&&(i.flags|=4194304),i.child;case 5:return n===null&&ht&&((h=u=Ht)&&(u=Lw(u,i.type,i.pendingProps,yr),u!==null?(i.stateNode=u,wn=i,Ht=xr(u.firstChild),yr=!1,h=!0):h=!1),h||Ei(i)),We(i),h=i.type,p=i.pendingProps,w=n!==null?n.memoizedProps:null,u=p.children,Qf(h,p)?u=null:w!==null&&Qf(h,w)&&(i.flags|=32),i.memoizedState!==null&&(h=Xc(n,i,Kv,null,null,a),ml._currentValue=h),Mo(n,i),_n(n,i,u,a),i.child;case 6:return n===null&&ht&&((n=a=Ht)&&(a=zw(a,i.pendingProps,yr),a!==null?(i.stateNode=a,wn=i,Ht=null,n=!0):n=!1),n||Ei(i)),null;case 13:return xg(n,i,a);case 4:return Ae(i,i.stateNode.containerInfo),u=i.pendingProps,n===null?i.child=ms(i,null,u,a):_n(n,i,u,a),i.child;case 11:return cg(n,i,i.type,i.pendingProps,a);case 7:return _n(n,i,i.pendingProps,a),i.child;case 8:return _n(n,i,i.pendingProps.children,a),i.child;case 12:return _n(n,i,i.pendingProps.children,a),i.child;case 10:return u=i.pendingProps,Ci(i,i.type,u.value),_n(n,i,u.children,a),i.child;case 9:return h=i.type._context,u=i.pendingProps.children,cs(i),h=Sn(h),u=u(h),i.flags|=1,_n(n,i,u,a),i.child;case 14:return fg(n,i,i.type,i.pendingProps,a);case 15:return hg(n,i,i.type,i.pendingProps,a);case 19:return wg(n,i,a);case 31:return iw(n,i,a);case 22:return dg(n,i,a,i.pendingProps);case 24:return cs(i),u=Sn(cn),n===null?(h=Bc(),h===null&&(h=Mt,p=Uc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),i.memoizedState={parent:u,cache:h},qc(i),Ci(i,cn,h)):((n.lanes&a)!==0&&(Ic(n,i),Ja(i,null,null,a),Ga()),h=n.memoizedState,p=i.memoizedState,h.parent!==u?(h={parent:u,cache:u},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),Ci(i,cn,u)):(u=p.cache,Ci(i,cn,u),u!==h.cache&&zc(i,[cn],a,!0))),_n(n,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function si(n){n.flags|=4}function kf(n,i,a,u,h){if((i=(n.mode&32)!==0)&&(i=!1),i){if(n.flags|=16777216,(h&335544128)===h)if(n.stateNode.complete)n.flags|=8192;else if(Xg())n.flags|=8192;else throw ds=bo,Hc}else n.flags&=-16777217}function _g(n,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Py(i))if(Xg())n.flags|=8192;else throw ds=bo,Hc}function Lo(n,i){i!==null&&(n.flags|=4),n.flags&16384&&(i=n.tag!==22?de():536870912,n.lanes|=i,Qs|=i)}function el(n,i){if(!ht)switch(n.tailMode){case"hidden":i=n.tail;for(var a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?n.tail=null:a.sibling=null;break;case"collapsed":a=n.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?i||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function qt(n){var i=n.alternate!==null&&n.alternate.child===n.child,a=0,u=0;if(i)for(var h=n.child;h!==null;)a|=h.lanes|h.childLanes,u|=h.subtreeFlags&65011712,u|=h.flags&65011712,h.return=n,h=h.sibling;else for(h=n.child;h!==null;)a|=h.lanes|h.childLanes,u|=h.subtreeFlags,u|=h.flags,h.return=n,h=h.sibling;return n.subtreeFlags|=u,n.childLanes=a,i}function aw(n,i,a){var u=i.pendingProps;switch(Oc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qt(i),null;case 1:return qt(i),null;case 3:return a=i.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),ti(cn),Se(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(n===null||n.child===null)&&(Ps(i)?si(i):n===null||n.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Mc())),qt(i),null;case 26:var h=i.type,p=i.memoizedState;return n===null?(si(i),p!==null?(qt(i),_g(i,p)):(qt(i),kf(i,h,null,u,a))):p?p!==n.memoizedState?(si(i),qt(i),_g(i,p)):(qt(i),i.flags&=-16777217):(n=n.memoizedProps,n!==u&&si(i),qt(i),kf(i,h,n,u,a)),null;case 27:if(It(i),a=je.current,h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==u&&si(i);else{if(!u){if(i.stateNode===null)throw Error(s(166));return qt(i),null}n=we.current,Ps(i)?np(i):(n=Ty(h,u,a),i.stateNode=n,si(i))}return qt(i),null;case 5:if(It(i),h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==u&&si(i);else{if(!u){if(i.stateNode===null)throw Error(s(166));return qt(i),null}if(p=we.current,Ps(i))np(i);else{var w=Ko(je.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof u.is=="string"?w.createElement("select",{is:u.is}):w.createElement("select"),u.multiple?p.multiple=!0:u.size&&(p.size=u.size);break;default:p=typeof u.is=="string"?w.createElement(h,{is:u.is}):w.createElement(h)}}p[ut]=i,p[Pt]=u;e:for(w=i.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===i)break e;for(;w.sibling===null;){if(w.return===null||w.return===i)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}i.stateNode=p;e:switch(kn(p,h,u),h){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&si(i)}}return qt(i),kf(i,i.type,n===null?null:n.memoizedProps,i.pendingProps,a),null;case 6:if(n&&i.stateNode!=null)n.memoizedProps!==u&&si(i);else{if(typeof u!="string"&&i.stateNode===null)throw Error(s(166));if(n=je.current,Ps(i)){if(n=i.stateNode,a=i.memoizedProps,u=null,h=wn,h!==null)switch(h.tag){case 27:case 5:u=h.memoizedProps}n[ut]=i,n=!!(n.nodeValue===a||u!==null&&u.suppressHydrationWarning===!0||xy(n.nodeValue,a)),n||Ei(i,!0)}else n=Ko(n).createTextNode(u),n[ut]=i,i.stateNode=n}return qt(i),null;case 31:if(a=i.memoizedState,n===null||n.memoizedState!==null){if(u=Ps(i),a!==null){if(n===null){if(!u)throw Error(s(318));if(n=i.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[ut]=i}else os(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;qt(i),n=!1}else a=Mc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),n=!0;if(!n)return i.flags&256?(Wn(i),i):(Wn(i),null);if((i.flags&128)!==0)throw Error(s(558))}return qt(i),null;case 13:if(u=i.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=Ps(i),u!==null&&u.dehydrated!==null){if(n===null){if(!h)throw Error(s(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(s(317));h[ut]=i}else os(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;qt(i),h=!1}else h=Mc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Wn(i),i):(Wn(i),null)}return Wn(i),(i.flags&128)!==0?(i.lanes=a,i):(a=u!==null,n=n!==null&&n.memoizedState!==null,a&&(u=i.child,h=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(h=u.alternate.memoizedState.cachePool.pool),p=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),p!==h&&(u.flags|=2048)),a!==n&&a&&(i.child.flags|=8192),Lo(i,i.updateQueue),qt(i),null);case 4:return Se(),n===null&&Yf(i.stateNode.containerInfo),qt(i),null;case 10:return ti(i.type),qt(i),null;case 19:if(W(rn),u=i.memoizedState,u===null)return qt(i),null;if(h=(i.flags&128)!==0,p=u.rendering,p===null)if(h)el(u,!1);else{if(tn!==0||n!==null&&(n.flags&128)!==0)for(n=i.child;n!==null;){if(p=So(n),p!==null){for(i.flags|=128,el(u,!1),n=p.updateQueue,i.updateQueue=n,Lo(i,n),i.subtreeFlags=0,n=a,a=i.child;a!==null;)Qm(a,n),a=a.sibling;return N(rn,rn.current&1|2),ht&&Wr(i,u.treeForkCount),i.child}n=n.sibling}u.tail!==null&>()>Ho&&(i.flags|=128,h=!0,el(u,!1),i.lanes=4194304)}else{if(!h)if(n=So(p),n!==null){if(i.flags|=128,h=!0,n=n.updateQueue,i.updateQueue=n,Lo(i,n),el(u,!0),u.tail===null&&u.tailMode==="hidden"&&!p.alternate&&!ht)return qt(i),null}else 2*gt()-u.renderingStartTime>Ho&&a!==536870912&&(i.flags|=128,h=!0,el(u,!1),i.lanes=4194304);u.isBackwards?(p.sibling=i.child,i.child=p):(n=u.last,n!==null?n.sibling=p:i.child=p,u.last=p)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=gt(),n.sibling=null,a=rn.current,N(rn,h?a&1|2:a&1),ht&&Wr(i,u.treeForkCount),n):(qt(i),null);case 22:case 23:return Wn(i),Yc(),u=i.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(i.flags|=8192):u&&(i.flags|=8192),u?(a&536870912)!==0&&(i.flags&128)===0&&(qt(i),i.subtreeFlags&6&&(i.flags|=8192)):qt(i),a=i.updateQueue,a!==null&&Lo(i,a.retryQueue),a=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),u=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),u!==a&&(i.flags|=2048),n!==null&&W(fs),null;case 24:return a=null,n!==null&&(a=n.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),ti(cn),qt(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function lw(n,i){switch(Oc(i),i.tag){case 1:return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 3:return ti(cn),Se(),n=i.flags,(n&65536)!==0&&(n&128)===0?(i.flags=n&-65537|128,i):null;case 26:case 27:case 5:return It(i),null;case 31:if(i.memoizedState!==null){if(Wn(i),i.alternate===null)throw Error(s(340));os()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 13:if(Wn(i),n=i.memoizedState,n!==null&&n.dehydrated!==null){if(i.alternate===null)throw Error(s(340));os()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 19:return W(rn),null;case 4:return Se(),null;case 10:return ti(i.type),null;case 22:case 23:return Wn(i),Yc(),n!==null&&W(fs),n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 24:return ti(cn),null;case 25:return null;default:return null}}function kg(n,i){switch(Oc(i),i.tag){case 3:ti(cn),Se();break;case 26:case 27:case 5:It(i);break;case 4:Se();break;case 31:i.memoizedState!==null&&Wn(i);break;case 13:Wn(i);break;case 19:W(rn);break;case 10:ti(i.type);break;case 22:case 23:Wn(i),Yc(),n!==null&&W(fs);break;case 24:ti(cn)}}function tl(n,i){try{var a=i.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var h=u.next;a=h;do{if((a.tag&n)===n){u=void 0;var p=a.create,w=a.inst;u=p(),w.destroy=u}a=a.next}while(a!==h)}}catch(_){Et(i,i.return,_)}}function Ri(n,i,a){try{var u=i.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var p=h.next;u=p;do{if((u.tag&n)===n){var w=u.inst,_=w.destroy;if(_!==void 0){w.destroy=void 0,h=i;var H=a,ie=_;try{ie()}catch(ce){Et(h,H,ce)}}}u=u.next}while(u!==p)}}catch(ce){Et(i,i.return,ce)}}function Eg(n){var i=n.updateQueue;if(i!==null){var a=n.stateNode;try{pp(i,a)}catch(u){Et(n,n.return,u)}}}function Cg(n,i,a){a.props=gs(n.type,n.memoizedProps),a.state=n.memoizedState;try{a.componentWillUnmount()}catch(u){Et(n,i,u)}}function nl(n,i){try{var a=n.ref;if(a!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:u=n.stateNode;break;default:u=n.stateNode}typeof a=="function"?n.refCleanup=a(u):a.current=u}}catch(h){Et(n,i,h)}}function Hr(n,i){var a=n.ref,u=n.refCleanup;if(a!==null)if(typeof u=="function")try{u()}catch(h){Et(n,i,h)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){Et(n,i,h)}else a.current=null}function Ag(n){var i=n.type,a=n.memoizedProps,u=n.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":a.autoFocus&&u.focus();break e;case"img":a.src?u.src=a.src:a.srcSet&&(u.srcset=a.srcSet)}}catch(h){Et(n,n.return,h)}}function Ef(n,i,a){try{var u=n.stateNode;Nw(u,n.type,a,i),u[Pt]=i}catch(h){Et(n,n.return,h)}}function jg(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Bi(n.type)||n.tag===4}function Cf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||jg(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Bi(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Af(n,i,a){var u=n.tag;if(u===5||u===6)n=n.stateNode,i?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(n,i):(i=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,i.appendChild(n),a=a._reactRootContainer,a!=null||i.onclick!==null||(i.onclick=Kr));else if(u!==4&&(u===27&&Bi(n.type)&&(a=n.stateNode,i=null),n=n.child,n!==null))for(Af(n,i,a),n=n.sibling;n!==null;)Af(n,i,a),n=n.sibling}function zo(n,i,a){var u=n.tag;if(u===5||u===6)n=n.stateNode,i?a.insertBefore(n,i):a.appendChild(n);else if(u!==4&&(u===27&&Bi(n.type)&&(a=n.stateNode),n=n.child,n!==null))for(zo(n,i,a),n=n.sibling;n!==null;)zo(n,i,a),n=n.sibling}function Ng(n){var i=n.stateNode,a=n.memoizedProps;try{for(var u=n.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);kn(i,u,a),i[ut]=n,i[Pt]=a}catch(p){Et(n,n.return,p)}}var ai=!1,dn=!1,jf=!1,Tg=typeof WeakSet=="function"?WeakSet:Set,bn=null;function ow(n,i){if(n=n.containerInfo,Xf=ru,n=Im(n),vc(n)){if("selectionStart"in n)var a={start:n.selectionStart,end:n.selectionEnd};else e:{a=(a=n.ownerDocument)&&a.defaultView||window;var u=a.getSelection&&a.getSelection();if(u&&u.rangeCount!==0){a=u.anchorNode;var h=u.anchorOffset,p=u.focusNode;u=u.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,_=-1,H=-1,ie=0,ce=0,ye=n,se=null;t:for(;;){for(var ue;ye!==a||h!==0&&ye.nodeType!==3||(_=w+h),ye!==p||u!==0&&ye.nodeType!==3||(H=w+u),ye.nodeType===3&&(w+=ye.nodeValue.length),(ue=ye.firstChild)!==null;)se=ye,ye=ue;for(;;){if(ye===n)break t;if(se===a&&++ie===h&&(_=w),se===p&&++ce===u&&(H=w),(ue=ye.nextSibling)!==null)break;ye=se,se=ye.parentNode}ye=ue}a=_===-1||H===-1?null:{start:_,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Kf={focusedElem:n,selectionRange:a},ru=!1,bn=i;bn!==null;)if(i=bn,n=i.child,(i.subtreeFlags&1028)!==0&&n!==null)n.return=i,bn=n;else for(;bn!==null;){switch(i=bn,p=i.alternate,n=i.flags,i.tag){case 0:if((n&4)!==0&&(n=i.updateQueue,n=n!==null?n.events:null,n!==null))for(a=0;a<n.length;a++)h=n[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&p!==null){n=void 0,a=i,h=p.memoizedProps,p=p.memoizedState,u=a.stateNode;try{var ze=gs(a.type,h);n=u.getSnapshotBeforeUpdate(ze,p),u.__reactInternalSnapshotBeforeUpdate=n}catch(Ve){Et(a,a.return,Ve)}}break;case 3:if((n&1024)!==0){if(n=i.stateNode.containerInfo,a=n.nodeType,a===9)Wf(n);else if(a===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Wf(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(s(163))}if(n=i.sibling,n!==null){n.return=i.return,bn=n;break}bn=i.return}}function Og(n,i,a){var u=a.flags;switch(a.tag){case 0:case 11:case 15:oi(n,a),u&4&&tl(5,a);break;case 1:if(oi(n,a),u&4)if(n=a.stateNode,i===null)try{n.componentDidMount()}catch(w){Et(a,a.return,w)}else{var h=gs(a.type,i.memoizedProps);i=i.memoizedState;try{n.componentDidUpdate(h,i,n.__reactInternalSnapshotBeforeUpdate)}catch(w){Et(a,a.return,w)}}u&64&&Eg(a),u&512&&nl(a,a.return);break;case 3:if(oi(n,a),u&64&&(n=a.updateQueue,n!==null)){if(i=null,a.child!==null)switch(a.child.tag){case 27:case 5:i=a.child.stateNode;break;case 1:i=a.child.stateNode}try{pp(n,i)}catch(w){Et(a,a.return,w)}}break;case 27:i===null&&u&4&&Ng(a);case 26:case 5:oi(n,a),i===null&&u&4&&Ag(a),u&512&&nl(a,a.return);break;case 12:oi(n,a);break;case 31:oi(n,a),u&4&&Dg(n,a);break;case 13:oi(n,a),u&4&&Lg(n,a),u&64&&(n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(a=yw.bind(null,a),Uw(n,a))));break;case 22:if(u=a.memoizedState!==null||ai,!u){i=i!==null&&i.memoizedState!==null||dn,h=ai;var p=dn;ai=u,(dn=i)&&!p?ui(n,a,(a.subtreeFlags&8772)!==0):oi(n,a),ai=h,dn=p}break;case 30:break;default:oi(n,a)}}function Rg(n){var i=n.alternate;i!==null&&(n.alternate=null,Rg(i)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(i=n.stateNode,i!==null&&Cs(i)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Ft=null,qn=!1;function li(n,i,a){for(a=a.child;a!==null;)Mg(n,i,a),a=a.sibling}function Mg(n,i,a){if(yt&&typeof yt.onCommitFiberUnmount=="function")try{yt.onCommitFiberUnmount(Jt,a)}catch{}switch(a.tag){case 26:dn||Hr(a,i),li(n,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:dn||Hr(a,i);var u=Ft,h=qn;Bi(a.type)&&(Ft=a.stateNode,qn=!1),li(n,i,a),fl(a.stateNode),Ft=u,qn=h;break;case 5:dn||Hr(a,i);case 6:if(u=Ft,h=qn,Ft=null,li(n,i,a),Ft=u,qn=h,Ft!==null)if(qn)try{(Ft.nodeType===9?Ft.body:Ft.nodeName==="HTML"?Ft.ownerDocument.body:Ft).removeChild(a.stateNode)}catch(p){Et(a,i,p)}else try{Ft.removeChild(a.stateNode)}catch(p){Et(a,i,p)}break;case 18:Ft!==null&&(qn?(n=Ft,Ey(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,a.stateNode),sa(n)):Ey(Ft,a.stateNode));break;case 4:u=Ft,h=qn,Ft=a.stateNode.containerInfo,qn=!0,li(n,i,a),Ft=u,qn=h;break;case 0:case 11:case 14:case 15:Ri(2,a,i),dn||Ri(4,a,i),li(n,i,a);break;case 1:dn||(Hr(a,i),u=a.stateNode,typeof u.componentWillUnmount=="function"&&Cg(a,i,u)),li(n,i,a);break;case 21:li(n,i,a);break;case 22:dn=(u=dn)||a.memoizedState!==null,li(n,i,a),dn=u;break;default:li(n,i,a)}}function Dg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{sa(n)}catch(a){Et(i,i.return,a)}}}function Lg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{sa(n)}catch(a){Et(i,i.return,a)}}function uw(n){switch(n.tag){case 31:case 13:case 19:var i=n.stateNode;return i===null&&(i=n.stateNode=new Tg),i;case 22:return n=n.stateNode,i=n._retryCache,i===null&&(i=n._retryCache=new Tg),i;default:throw Error(s(435,n.tag))}}function Uo(n,i){var a=uw(n);i.forEach(function(u){if(!a.has(u)){a.add(u);var h=bw.bind(null,n,u);u.then(h,h)}})}function In(n,i){var a=i.deletions;if(a!==null)for(var u=0;u<a.length;u++){var h=a[u],p=n,w=i,_=w;e:for(;_!==null;){switch(_.tag){case 27:if(Bi(_.type)){Ft=_.stateNode,qn=!1;break e}break;case 5:Ft=_.stateNode,qn=!1;break e;case 3:case 4:Ft=_.stateNode.containerInfo,qn=!0;break e}_=_.return}if(Ft===null)throw Error(s(160));Mg(p,w,h),Ft=null,qn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)zg(i,n),i=i.sibling}var jr=null;function zg(n,i){var a=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:In(i,n),Fn(n),u&4&&(Ri(3,n,n.return),tl(3,n),Ri(5,n,n.return));break;case 1:In(i,n),Fn(n),u&512&&(dn||a===null||Hr(a,a.return)),u&64&&ai&&(n=n.updateQueue,n!==null&&(u=n.callbacks,u!==null&&(a=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=a===null?u:a.concat(u))));break;case 26:var h=jr;if(In(i,n),Fn(n),u&512&&(dn||a===null||Hr(a,a.return)),u&4){var p=a!==null?a.memoizedState:null;if(u=n.memoizedState,a===null)if(u===null)if(n.stateNode===null){e:{u=n.type,a=n.memoizedProps,h=h.ownerDocument||h;t:switch(u){case"title":p=h.getElementsByTagName("title")[0],(!p||p[pn]||p[ut]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(u),h.head.insertBefore(p,h.querySelector("head > title"))),kn(p,u,a),p[ut]=n,$(p),u=p;break e;case"link":var w=zy("link","href",h).get(u+(a.href||""));if(w){for(var _=0;_<w.length;_++)if(p=w[_],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(_,1);break t}}p=h.createElement(u),kn(p,u,a),h.head.appendChild(p);break;case"meta":if(w=zy("meta","content",h).get(u+(a.content||""))){for(_=0;_<w.length;_++)if(p=w[_],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(_,1);break t}}p=h.createElement(u),kn(p,u,a),h.head.appendChild(p);break;default:throw Error(s(468,u))}p[ut]=n,$(p),u=p}n.stateNode=u}else Uy(h,n.type,n.stateNode);else n.stateNode=Ly(h,u,n.memoizedProps);else p!==u?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,u===null?Uy(h,n.type,n.stateNode):Ly(h,u,n.memoizedProps)):u===null&&n.stateNode!==null&&Ef(n,n.memoizedProps,a.memoizedProps)}break;case 27:In(i,n),Fn(n),u&512&&(dn||a===null||Hr(a,a.return)),a!==null&&u&4&&Ef(n,n.memoizedProps,a.memoizedProps);break;case 5:if(In(i,n),Fn(n),u&512&&(dn||a===null||Hr(a,a.return)),n.flags&32){h=n.stateNode;try{js(h,"")}catch(ze){Et(n,n.return,ze)}}u&4&&n.stateNode!=null&&(h=n.memoizedProps,Ef(n,h,a!==null?a.memoizedProps:h)),u&1024&&(jf=!0);break;case 6:if(In(i,n),Fn(n),u&4){if(n.stateNode===null)throw Error(s(162));u=n.memoizedProps,a=n.stateNode;try{a.nodeValue=u}catch(ze){Et(n,n.return,ze)}}break;case 3:if(Wo=null,h=jr,jr=Qo(i.containerInfo),In(i,n),jr=h,Fn(n),u&4&&a!==null&&a.memoizedState.isDehydrated)try{sa(i.containerInfo)}catch(ze){Et(n,n.return,ze)}jf&&(jf=!1,Ug(n));break;case 4:u=jr,jr=Qo(n.stateNode.containerInfo),In(i,n),Fn(n),jr=u;break;case 12:In(i,n),Fn(n);break;case 31:In(i,n),Fn(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 13:In(i,n),Fn(n),n.child.flags&8192&&n.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Bo=gt()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 22:h=n.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,ie=ai,ce=dn;if(ai=ie||h,dn=ce||H,In(i,n),dn=ce,ai=ie,Fn(n),u&8192)e:for(i=n.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||H||ai||dn||ys(n)),a=null,i=n;;){if(i.tag===5||i.tag===26){if(a===null){H=a=i;try{if(p=H.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{_=H.stateNode;var ye=H.memoizedProps.style,se=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;_.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(ze){Et(H,H.return,ze)}}}else if(i.tag===6){if(a===null){H=i;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(ze){Et(H,H.return,ze)}}}else if(i.tag===18){if(a===null){H=i;try{var ue=H.stateNode;h?Cy(ue,!0):Cy(H.stateNode,!1)}catch(ze){Et(H,H.return,ze)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===n)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break e;for(;i.sibling===null;){if(i.return===null||i.return===n)break e;a===i&&(a=null),i=i.return}a===i&&(a=null),i.sibling.return=i.return,i=i.sibling}u&4&&(u=n.updateQueue,u!==null&&(a=u.retryQueue,a!==null&&(u.retryQueue=null,Uo(n,a))));break;case 19:In(i,n),Fn(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 30:break;case 21:break;default:In(i,n),Fn(n)}}function Fn(n){var i=n.flags;if(i&2){try{for(var a,u=n.return;u!==null;){if(jg(u)){a=u;break}u=u.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var h=a.stateNode,p=Cf(n);zo(n,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(js(w,""),a.flags&=-33);var _=Cf(n);zo(n,_,w);break;case 3:case 4:var H=a.stateNode.containerInfo,ie=Cf(n);Af(n,ie,H);break;default:throw Error(s(161))}}catch(ce){Et(n,n.return,ce)}n.flags&=-3}i&4096&&(n.flags&=-4097)}function Ug(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var i=n;Ug(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),n=n.sibling}}function oi(n,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Og(n,i.alternate,i),i=i.sibling}function ys(n){for(n=n.child;n!==null;){var i=n;switch(i.tag){case 0:case 11:case 14:case 15:Ri(4,i,i.return),ys(i);break;case 1:Hr(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&Cg(i,i.return,a),ys(i);break;case 27:fl(i.stateNode);case 26:case 5:Hr(i,i.return),ys(i);break;case 22:i.memoizedState===null&&ys(i);break;case 30:ys(i);break;default:ys(i)}n=n.sibling}}function ui(n,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var u=i.alternate,h=n,p=i,w=p.flags;switch(p.tag){case 0:case 11:case 15:ui(h,p,a),tl(4,p);break;case 1:if(ui(h,p,a),u=p,h=u.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ie){Et(u,u.return,ie)}if(u=p,h=u.updateQueue,h!==null){var _=u.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)mp(H[h],_)}catch(ie){Et(u,u.return,ie)}}a&&w&64&&Eg(p),nl(p,p.return);break;case 27:Ng(p);case 26:case 5:ui(h,p,a),a&&u===null&&w&4&&Ag(p),nl(p,p.return);break;case 12:ui(h,p,a);break;case 31:ui(h,p,a),a&&w&4&&Dg(h,p);break;case 13:ui(h,p,a),a&&w&4&&Lg(h,p);break;case 22:p.memoizedState===null&&ui(h,p,a),nl(p,p.return);break;case 30:break;default:ui(h,p,a)}i=i.sibling}}function Nf(n,i){var a=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),n=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(n=i.memoizedState.cachePool.pool),n!==a&&(n!=null&&n.refCount++,a!=null&&Ia(a))}function Tf(n,i){n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Ia(n))}function Nr(n,i,a,u){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Pg(n,i,a,u),i=i.sibling}function Pg(n,i,a,u){var h=i.flags;switch(i.tag){case 0:case 11:case 15:Nr(n,i,a,u),h&2048&&tl(9,i);break;case 1:Nr(n,i,a,u);break;case 3:Nr(n,i,a,u),h&2048&&(n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Ia(n)));break;case 12:if(h&2048){Nr(n,i,a,u),n=i.stateNode;try{var p=i.memoizedProps,w=p.id,_=p.onPostCommit;typeof _=="function"&&_(w,i.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(H){Et(i,i.return,H)}}else Nr(n,i,a,u);break;case 31:Nr(n,i,a,u);break;case 13:Nr(n,i,a,u);break;case 23:break;case 22:p=i.stateNode,w=i.alternate,i.memoizedState!==null?p._visibility&2?Nr(n,i,a,u):rl(n,i):p._visibility&2?Nr(n,i,a,u):(p._visibility|=2,Js(n,i,a,u,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Nf(w,i);break;case 24:Nr(n,i,a,u),h&2048&&Tf(i.alternate,i);break;default:Nr(n,i,a,u)}}function Js(n,i,a,u,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=n,w=i,_=a,H=u,ie=w.flags;switch(w.tag){case 0:case 11:case 15:Js(p,w,_,H,h),tl(8,w);break;case 23:break;case 22:var ce=w.stateNode;w.memoizedState!==null?ce._visibility&2?Js(p,w,_,H,h):rl(p,w):(ce._visibility|=2,Js(p,w,_,H,h)),h&&ie&2048&&Nf(w.alternate,w);break;case 24:Js(p,w,_,H,h),h&&ie&2048&&Tf(w.alternate,w);break;default:Js(p,w,_,H,h)}i=i.sibling}}function rl(n,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=n,u=i,h=u.flags;switch(u.tag){case 22:rl(a,u),h&2048&&Nf(u.alternate,u);break;case 24:rl(a,u),h&2048&&Tf(u.alternate,u);break;default:rl(a,u)}i=i.sibling}}var il=8192;function Xs(n,i,a){if(n.subtreeFlags&il)for(n=n.child;n!==null;)Bg(n,i,a),n=n.sibling}function Bg(n,i,a){switch(n.tag){case 26:Xs(n,i,a),n.flags&il&&n.memoizedState!==null&&Xw(a,jr,n.memoizedState,n.memoizedProps);break;case 5:Xs(n,i,a);break;case 3:case 4:var u=jr;jr=Qo(n.stateNode.containerInfo),Xs(n,i,a),jr=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=il,il=16777216,Xs(n,i,a),il=u):Xs(n,i,a));break;default:Xs(n,i,a)}}function Hg(n){var i=n.alternate;if(i!==null&&(n=i.child,n!==null)){i.child=null;do i=n.sibling,n.sibling=null,n=i;while(n!==null)}}function sl(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var u=i[a];bn=u,Ig(u,n)}Hg(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)qg(n),n=n.sibling}function qg(n){switch(n.tag){case 0:case 11:case 15:sl(n),n.flags&2048&&Ri(9,n,n.return);break;case 3:sl(n);break;case 12:sl(n);break;case 22:var i=n.stateNode;n.memoizedState!==null&&i._visibility&2&&(n.return===null||n.return.tag!==13)?(i._visibility&=-3,Po(n)):sl(n);break;default:sl(n)}}function Po(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var u=i[a];bn=u,Ig(u,n)}Hg(n)}for(n=n.child;n!==null;){switch(i=n,i.tag){case 0:case 11:case 15:Ri(8,i,i.return),Po(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,Po(i));break;default:Po(i)}n=n.sibling}}function Ig(n,i){for(;bn!==null;){var a=bn;switch(a.tag){case 0:case 11:case 15:Ri(8,a,i);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var u=a.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Ia(a.memoizedState.cache)}if(u=a.child,u!==null)u.return=a,bn=u;else e:for(a=n;bn!==null;){u=bn;var h=u.sibling,p=u.return;if(Rg(u),u===a){bn=null;break e}if(h!==null){h.return=p,bn=h;break e}bn=p}}}var cw={getCacheForType:function(n){var i=Sn(cn),a=i.data.get(n);return a===void 0&&(a=n(),i.data.set(n,a)),a},cacheSignal:function(){return Sn(cn).controller.signal}},fw=typeof WeakMap=="function"?WeakMap:Map,vt=0,Mt=null,st=null,ct=0,kt=0,er=null,Mi=!1,Ks=!1,Of=!1,ci=0,tn=0,Di=0,bs=0,Rf=0,tr=0,Qs=0,al=null,$n=null,Mf=!1,Bo=0,Fg=0,Ho=1/0,qo=null,Li=null,gn=0,zi=null,Zs=null,fi=0,Df=0,Lf=null,$g=null,ll=0,zf=null;function nr(){return(vt&2)!==0&&ct!==0?ct&-ct:V.T!==null?If():Wt()}function Vg(){if(tr===0)if((ct&536870912)===0||ht){var n=Zt;Zt<<=1,(Zt&3932160)===0&&(Zt=262144),tr=n}else tr=536870912;return n=Zn.current,n!==null&&(n.flags|=32),tr}function Vn(n,i,a){(n===Mt&&(kt===2||kt===9)||n.cancelPendingCommit!==null)&&(Ws(n,0),Ui(n,ct,tr,!1)),Be(n,a),((vt&2)===0||n!==Mt)&&(n===Mt&&((vt&2)===0&&(bs|=a),tn===4&&Ui(n,ct,tr,!1)),qr(n))}function Yg(n,i,a){if((vt&6)!==0)throw Error(s(327));var u=!a&&(i&127)===0&&(i&n.expiredLanes)===0||Er(n,i),h=u?mw(n,i):Pf(n,i,!0),p=u;do{if(h===0){Ks&&!u&&Ui(n,i,0,!1);break}else{if(a=n.current.alternate,p&&!hw(a)){h=Pf(n,i,!1),p=!1;continue}if(h===2){if(p=i,n.errorRecoveryDisabledLanes&p)var w=0;else w=n.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){i=w;e:{var _=n;h=al;var H=_.current.memoizedState.isDehydrated;if(H&&(Ws(_,w).flags|=256),w=Pf(_,w,!1),w!==2){if(Of&&!H){_.errorRecoveryDisabledLanes|=p,bs|=p,h=4;break e}p=$n,$n=h,p!==null&&($n===null?$n=p:$n.push.apply($n,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){Ws(n,0),Ui(n,i,0,!0);break}e:{switch(u=n,p=h,p){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:Ui(u,i,tr,!Mi);break e;case 2:$n=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=Bo+300-gt(),10<h)){if(Ui(u,i,tr,!Mi),Jr(u,0,!0)!==0)break e;fi=i,u.timeoutHandle=_y(Gg.bind(null,u,a,$n,qo,Mf,i,tr,bs,Qs,Mi,p,"Throttled",-0,0),h);break e}Gg(u,a,$n,qo,Mf,i,tr,bs,Qs,Mi,p,null,-0,0)}}break}while(!0);qr(n)}function Gg(n,i,a,u,h,p,w,_,H,ie,ce,ye,se,ue){if(n.timeoutHandle=-1,ye=i.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Kr},Bg(i,p,ye);var ze=(p&62914560)===p?Bo-gt():(p&4194048)===p?Fg-gt():0;if(ze=Kw(ye,ze),ze!==null){fi=p,n.cancelPendingCommit=ze(ty.bind(null,n,i,p,a,u,h,w,_,H,ce,ye,null,se,ue)),Ui(n,p,w,!ie);return}}ty(n,i,p,a,u,h,w,_,H)}function hw(n){for(var i=n;;){var a=i.tag;if((a===0||a===11||a===15)&&i.flags&16384&&(a=i.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var u=0;u<a.length;u++){var h=a[u],p=h.getSnapshot;h=h.value;try{if(!Kn(p(),h))return!1}catch{return!1}}if(a=i.child,i.subtreeFlags&16384&&a!==null)a.return=i,i=a;else{if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ui(n,i,a,u){i&=~Rf,i&=~bs,n.suspendedLanes|=i,n.pingedLanes&=~i,u&&(n.warmLanes|=i),u=n.expirationTimes;for(var h=i;0<h;){var p=31-Qe(h),w=1<<p;u[p]=-1,h&=~w}a!==0&&He(n,a,i)}function Io(){return(vt&6)===0?(ol(0),!1):!0}function Uf(){if(st!==null){if(kt===0)var n=st.return;else n=st,ei=us=null,Zc(n),Fs=null,$a=0,n=st;for(;n!==null;)kg(n.alternate,n),n=n.return;st=null}}function Ws(n,i){var a=n.timeoutHandle;a!==-1&&(n.timeoutHandle=-1,Rw(a)),a=n.cancelPendingCommit,a!==null&&(n.cancelPendingCommit=null,a()),fi=0,Uf(),Mt=n,st=a=Zr(n.current,null),ct=i,kt=0,er=null,Mi=!1,Ks=Er(n,i),Of=!1,Qs=tr=Rf=bs=Di=tn=0,$n=al=null,Mf=!1,(i&8)!==0&&(i|=i&32);var u=n.entangledLanes;if(u!==0)for(n=n.entanglements,u&=i;0<u;){var h=31-Qe(u),p=1<<h;i|=n[h],u&=~p}return ci=i,oo(),a}function Jg(n,i){Ze=null,V.H=Za,i===Is||i===yo?(i=cp(),kt=3):i===Hc?(i=cp(),kt=4):kt=i===pf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,er=i,st===null&&(tn=1,Oo(n,mr(i,n.current)))}function Xg(){var n=Zn.current;return n===null?!0:(ct&4194048)===ct?br===null:(ct&62914560)===ct||(ct&536870912)!==0?n===br:!1}function Kg(){var n=V.H;return V.H=Za,n===null?Za:n}function Qg(){var n=V.A;return V.A=cw,n}function Fo(){tn=4,Mi||(ct&4194048)!==ct&&Zn.current!==null||(Ks=!0),(Di&134217727)===0&&(bs&134217727)===0||Mt===null||Ui(Mt,ct,tr,!1)}function Pf(n,i,a){var u=vt;vt|=2;var h=Kg(),p=Qg();(Mt!==n||ct!==i)&&(qo=null,Ws(n,i)),i=!1;var w=tn;e:do try{if(kt!==0&&st!==null){var _=st,H=er;switch(kt){case 8:Uf(),w=6;break e;case 3:case 2:case 9:case 6:Zn.current===null&&(i=!0);var ie=kt;if(kt=0,er=null,ea(n,_,H,ie),a&&Ks){w=0;break e}break;default:ie=kt,kt=0,er=null,ea(n,_,H,ie)}}dw(),w=tn;break}catch(ce){Jg(n,ce)}while(!0);return i&&n.shellSuspendCounter++,ei=us=null,vt=u,V.H=h,V.A=p,st===null&&(Mt=null,ct=0,oo()),w}function dw(){for(;st!==null;)Zg(st)}function mw(n,i){var a=vt;vt|=2;var u=Kg(),h=Qg();Mt!==n||ct!==i?(qo=null,Ho=gt()+500,Ws(n,i)):Ks=Er(n,i);e:do try{if(kt!==0&&st!==null){i=st;var p=er;t:switch(kt){case 1:kt=0,er=null,ea(n,i,p,1);break;case 2:case 9:if(op(p)){kt=0,er=null,Wg(i);break}i=function(){kt!==2&&kt!==9||Mt!==n||(kt=7),qr(n)},p.then(i,i);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:op(p)?(kt=0,er=null,Wg(i)):(kt=0,er=null,ea(n,i,p,7));break;case 5:var w=null;switch(st.tag){case 26:w=st.memoizedState;case 5:case 27:var _=st;if(w?Py(w):_.stateNode.complete){kt=0,er=null;var H=_.sibling;if(H!==null)st=H;else{var ie=_.return;ie!==null?(st=ie,$o(ie)):st=null}break t}}kt=0,er=null,ea(n,i,p,5);break;case 6:kt=0,er=null,ea(n,i,p,6);break;case 8:Uf(),tn=6;break e;default:throw Error(s(462))}}pw();break}catch(ce){Jg(n,ce)}while(!0);return ei=us=null,V.H=u,V.A=h,vt=a,st!==null?0:(Mt=null,ct=0,oo(),tn)}function pw(){for(;st!==null&&!Ut();)Zg(st)}function Zg(n){var i=Sg(n.alternate,n,ci);n.memoizedProps=n.pendingProps,i===null?$o(n):st=i}function Wg(n){var i=n,a=i.alternate;switch(i.tag){case 15:case 0:i=gg(a,i,i.pendingProps,i.type,void 0,ct);break;case 11:i=gg(a,i,i.pendingProps,i.type.render,i.ref,ct);break;case 5:Zc(i);default:kg(a,i),i=st=Qm(i,ci),i=Sg(a,i,ci)}n.memoizedProps=n.pendingProps,i===null?$o(n):st=i}function ea(n,i,a,u){ei=us=null,Zc(i),Fs=null,$a=0;var h=i.return;try{if(rw(n,h,i,a,ct)){tn=1,Oo(n,mr(a,n.current)),st=null;return}}catch(p){if(h!==null)throw st=h,p;tn=1,Oo(n,mr(a,n.current)),st=null;return}i.flags&32768?(ht||u===1?n=!0:Ks||(ct&536870912)!==0?n=!1:(Mi=n=!0,(u===2||u===9||u===3||u===6)&&(u=Zn.current,u!==null&&u.tag===13&&(u.flags|=16384))),ey(i,n)):$o(i)}function $o(n){var i=n;do{if((i.flags&32768)!==0){ey(i,Mi);return}n=i.return;var a=aw(i.alternate,i,ci);if(a!==null){st=a;return}if(i=i.sibling,i!==null){st=i;return}st=i=n}while(i!==null);tn===0&&(tn=5)}function ey(n,i){do{var a=lw(n.alternate,n);if(a!==null){a.flags&=32767,st=a;return}if(a=n.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(n=n.sibling,n!==null)){st=n;return}st=n=a}while(n!==null);tn=6,st=null}function ty(n,i,a,u,h,p,w,_,H){n.cancelPendingCommit=null;do Vo();while(gn!==0);if((vt&6)!==0)throw Error(s(327));if(i!==null){if(i===n.current)throw Error(s(177));if(p=i.lanes|i.childLanes,p|=Ec,Ye(n,a,p,w,_,H),n===Mt&&(st=Mt=null,ct=0),Zs=i,zi=n,fi=a,Df=p,Lf=h,$g=u,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,xw(Re,function(){return ay(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||u){u=V.T,V.T=null,h=Q.p,Q.p=2,w=vt,vt|=4;try{ow(n,i,a)}finally{vt=w,Q.p=h,V.T=u}}gn=1,ny(),ry(),iy()}}function ny(){if(gn===1){gn=0;var n=zi,i=Zs,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=V.T,V.T=null;var u=Q.p;Q.p=2;var h=vt;vt|=4;try{zg(i,n);var p=Kf,w=Im(n.containerInfo),_=p.focusedElem,H=p.selectionRange;if(w!==_&&_&&_.ownerDocument&&qm(_.ownerDocument.documentElement,_)){if(H!==null&&vc(_)){var ie=H.start,ce=H.end;if(ce===void 0&&(ce=ie),"selectionStart"in _)_.selectionStart=ie,_.selectionEnd=Math.min(ce,_.value.length);else{var ye=_.ownerDocument||document,se=ye&&ye.defaultView||window;if(se.getSelection){var ue=se.getSelection(),ze=_.textContent.length,Ve=Math.min(H.start,ze),jt=H.end===void 0?Ve:Math.min(H.end,ze);!ue.extend&&Ve>jt&&(w=jt,jt=Ve,Ve=w);var K=Hm(_,Ve),Y=Hm(_,jt);if(K&&Y&&(ue.rangeCount!==1||ue.anchorNode!==K.node||ue.anchorOffset!==K.offset||ue.focusNode!==Y.node||ue.focusOffset!==Y.offset)){var re=ye.createRange();re.setStart(K.node,K.offset),ue.removeAllRanges(),Ve>jt?(ue.addRange(re),ue.extend(Y.node,Y.offset)):(re.setEnd(Y.node,Y.offset),ue.addRange(re))}}}}for(ye=[],ue=_;ue=ue.parentNode;)ue.nodeType===1&&ye.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<ye.length;_++){var me=ye[_];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}ru=!!Xf,Kf=Xf=null}finally{vt=h,Q.p=u,V.T=a}}n.current=i,gn=2}}function ry(){if(gn===2){gn=0;var n=zi,i=Zs,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=V.T,V.T=null;var u=Q.p;Q.p=2;var h=vt;vt|=4;try{Og(n,i.alternate,i)}finally{vt=h,Q.p=u,V.T=a}}gn=3}}function iy(){if(gn===4||gn===3){gn=0,En();var n=zi,i=Zs,a=fi,u=$g;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?gn=5:(gn=0,Zs=zi=null,sy(n,n.pendingLanes));var h=n.pendingLanes;if(h===0&&(Li=null),et(a),i=i.stateNode,yt&&typeof yt.onCommitFiberRoot=="function")try{yt.onCommitFiberRoot(Jt,i,void 0,(i.current.flags&128)===128)}catch{}if(u!==null){i=V.T,h=Q.p,Q.p=2,V.T=null;try{for(var p=n.onRecoverableError,w=0;w<u.length;w++){var _=u[w];p(_.value,{componentStack:_.stack})}}finally{V.T=i,Q.p=h}}(fi&3)!==0&&Vo(),qr(n),h=n.pendingLanes,(a&261930)!==0&&(h&42)!==0?n===zf?ll++:(ll=0,zf=n):ll=0,ol(0)}}function sy(n,i){(n.pooledCacheLanes&=i)===0&&(i=n.pooledCache,i!=null&&(n.pooledCache=null,Ia(i)))}function Vo(){return ny(),ry(),iy(),ay()}function ay(){if(gn!==5)return!1;var n=zi,i=Df;Df=0;var a=et(fi),u=V.T,h=Q.p;try{Q.p=32>a?32:a,V.T=null,a=Lf,Lf=null;var p=zi,w=fi;if(gn=0,Zs=zi=null,fi=0,(vt&6)!==0)throw Error(s(331));var _=vt;if(vt|=4,qg(p.current),Pg(p,p.current,w,a),vt=_,ol(0,!1),yt&&typeof yt.onPostCommitFiberRoot=="function")try{yt.onPostCommitFiberRoot(Jt,p)}catch{}return!0}finally{Q.p=h,V.T=u,sy(n,i)}}function ly(n,i,a){i=mr(a,i),i=mf(n.stateNode,i,2),n=Ni(n,i,2),n!==null&&(Be(n,2),qr(n))}function Et(n,i,a){if(n.tag===3)ly(n,n,a);else for(;i!==null;){if(i.tag===3){ly(i,n,a);break}else if(i.tag===1){var u=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Li===null||!Li.has(u))){n=mr(a,n),a=og(2),u=Ni(i,a,2),u!==null&&(ug(a,u,i,n),Be(u,2),qr(u));break}}i=i.return}}function Bf(n,i,a){var u=n.pingCache;if(u===null){u=n.pingCache=new fw;var h=new Set;u.set(i,h)}else h=u.get(i),h===void 0&&(h=new Set,u.set(i,h));h.has(a)||(Of=!0,h.add(a),n=gw.bind(null,n,i,a),i.then(n,n))}function gw(n,i,a){var u=n.pingCache;u!==null&&u.delete(i),n.pingedLanes|=n.suspendedLanes&a,n.warmLanes&=~a,Mt===n&&(ct&a)===a&&(tn===4||tn===3&&(ct&62914560)===ct&&300>gt()-Bo?(vt&2)===0&&Ws(n,0):Rf|=a,Qs===ct&&(Qs=0)),qr(n)}function oy(n,i){i===0&&(i=de()),n=as(n,i),n!==null&&(Be(n,i),qr(n))}function yw(n){var i=n.memoizedState,a=0;i!==null&&(a=i.retryLane),oy(n,a)}function bw(n,i){var a=0;switch(n.tag){case 31:case 13:var u=n.stateNode,h=n.memoizedState;h!==null&&(a=h.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(i),oy(n,a)}function xw(n,i){return Ke(n,i)}var Yo=null,ta=null,Hf=!1,Go=!1,qf=!1,Pi=0;function qr(n){n!==ta&&n.next===null&&(ta===null?Yo=ta=n:ta=ta.next=n),Go=!0,Hf||(Hf=!0,ww())}function ol(n,i){if(!qf&&Go){qf=!0;do for(var a=!1,u=Yo;u!==null;){if(n!==0){var h=u.pendingLanes;if(h===0)var p=0;else{var w=u.suspendedLanes,_=u.pingedLanes;p=(1<<31-Qe(42|n)+1)-1,p&=h&~(w&~_),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,hy(u,p))}else p=ct,p=Jr(u,u===Mt?p:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(p&3)===0||Er(u,p)||(a=!0,hy(u,p));u=u.next}while(a);qf=!1}}function vw(){uy()}function uy(){Go=Hf=!1;var n=0;Pi!==0&&Ow()&&(n=Pi);for(var i=gt(),a=null,u=Yo;u!==null;){var h=u.next,p=cy(u,i);p===0?(u.next=null,a===null?Yo=h:a.next=h,h===null&&(ta=a)):(a=u,(n!==0||(p&3)!==0)&&(Go=!0)),u=h}gn!==0&&gn!==5||ol(n),Pi!==0&&(Pi=0)}function cy(n,i){for(var a=n.suspendedLanes,u=n.pingedLanes,h=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var w=31-Qe(p),_=1<<w,H=h[w];H===-1?((_&a)===0||(_&u)!==0)&&(h[w]=ts(_,i)):H<=i&&(n.expiredLanes|=_),p&=~_}if(i=Mt,a=ct,a=Jr(n,n===i?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,a===0||n===i&&(kt===2||kt===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&wt(u),n.callbackNode=null,n.callbackPriority=0;if((a&3)===0||Er(n,a)){if(i=a&-a,i===n.callbackPriority)return i;switch(u!==null&&wt(u),et(a)){case 2:case 8:a=ke;break;case 32:a=Re;break;case 268435456:a=rt;break;default:a=Re}return u=fy.bind(null,n),a=Ke(a,u),n.callbackPriority=i,n.callbackNode=a,i}return u!==null&&u!==null&&wt(u),n.callbackPriority=2,n.callbackNode=null,2}function fy(n,i){if(gn!==0&&gn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var a=n.callbackNode;if(Vo()&&n.callbackNode!==a)return null;var u=ct;return u=Jr(n,n===Mt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(Yg(n,u,i),cy(n,gt()),n.callbackNode!=null&&n.callbackNode===a?fy.bind(null,n):null)}function hy(n,i){if(Vo())return null;Yg(n,i,!0)}function ww(){Mw(function(){(vt&6)!==0?Ke(le,vw):uy()})}function If(){if(Pi===0){var n=Hs;n===0&&(n=_t,_t<<=1,(_t&261888)===0&&(_t=256)),Pi=n}return Pi}function dy(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:eo(""+n)}function my(n,i){var a=i.ownerDocument.createElement("input");return a.name=i.name,a.value=i.value,n.id&&a.setAttribute("form",n.id),i.parentNode.insertBefore(a,i),n=new FormData(n),a.parentNode.removeChild(a),n}function Sw(n,i,a,u,h){if(i==="submit"&&a&&a.stateNode===h){var p=dy((h[Pt]||null).action),w=u.submitter;w&&(i=(i=w[Pt]||null)?dy(i.formAction):w.getAttribute("formAction"),i!==null&&(p=i,w=null));var _=new io("action","action",null,u,h);n.push({event:_,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Pi!==0){var H=w?my(h,w):new FormData(h);of(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(_.preventDefault(),H=w?my(h,w):new FormData(h),of(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var Ff=0;Ff<kc.length;Ff++){var $f=kc[Ff],_w=$f.toLowerCase(),kw=$f[0].toUpperCase()+$f.slice(1);Ar(_w,"on"+kw)}Ar(Vm,"onAnimationEnd"),Ar(Ym,"onAnimationIteration"),Ar(Gm,"onAnimationStart"),Ar("dblclick","onDoubleClick"),Ar("focusin","onFocus"),Ar("focusout","onBlur"),Ar(Hv,"onTransitionRun"),Ar(qv,"onTransitionStart"),Ar(Iv,"onTransitionCancel"),Ar(Jm,"onTransitionEnd"),ae("onMouseEnter",["mouseout","mouseover"]),ae("onMouseLeave",["mouseout","mouseover"]),ae("onPointerEnter",["pointerout","pointerover"]),ae("onPointerLeave",["pointerout","pointerover"]),be("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),be("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),be("onBeforeInput",["compositionend","keypress","textInput","paste"]),be("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ul="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(" "),Ew=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ul));function py(n,i){i=(i&4)!==0;for(var a=0;a<n.length;a++){var u=n[a],h=u.event;u=u.listeners;e:{var p=void 0;if(i)for(var w=u.length-1;0<=w;w--){var _=u[w],H=_.instance,ie=_.currentTarget;if(_=_.listener,H!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=ie;try{p(h)}catch(ce){lo(ce)}h.currentTarget=null,p=H}else for(w=0;w<u.length;w++){if(_=u[w],H=_.instance,ie=_.currentTarget,_=_.listener,H!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=ie;try{p(h)}catch(ce){lo(ce)}h.currentTarget=null,p=H}}}}function at(n,i){var a=i[Ur];a===void 0&&(a=i[Ur]=new Set);var u=n+"__bubble";a.has(u)||(gy(i,n,2,!1),a.add(u))}function Vf(n,i,a){var u=0;i&&(u|=4),gy(a,n,u,i)}var Jo="_reactListening"+Math.random().toString(36).slice(2);function Yf(n){if(!n[Jo]){n[Jo]=!0,Z.forEach(function(a){a!=="selectionchange"&&(Ew.has(a)||Vf(a,!1,n),Vf(a,!0,n))});var i=n.nodeType===9?n:n.ownerDocument;i===null||i[Jo]||(i[Jo]=!0,Vf("selectionchange",!1,i))}}function gy(n,i,a,u){switch(Vy(i)){case 2:var h=Ww;break;case 8:h=eS;break;default:h=lh}a=h.bind(null,i,a,n),h=void 0,!fc||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),u?h!==void 0?n.addEventListener(i,a,{capture:!0,passive:h}):n.addEventListener(i,a,!0):h!==void 0?n.addEventListener(i,a,{passive:h}):n.addEventListener(i,a,!1)}function Gf(n,i,a,u,h){var p=u;if((i&1)===0&&(i&2)===0&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var _=u.stateNode.containerInfo;if(_===h)break;if(w===4)for(w=u.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;_!==null;){if(w=k(_),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){u=p=w;continue e}_=_.parentNode}}u=u.return}wm(function(){var ie=p,ce=uc(a),ye=[];e:{var se=Xm.get(n);if(se!==void 0){var ue=io,ze=n;switch(n){case"keypress":if(no(a)===0)break e;case"keydown":case"keyup":ue=bv;break;case"focusin":ze="focus",ue=pc;break;case"focusout":ze="blur",ue=pc;break;case"beforeblur":case"afterblur":ue=pc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=km;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=av;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=wv;break;case Vm:case Ym:case Gm:ue=uv;break;case Jm:ue=_v;break;case"scroll":case"scrollend":ue=iv;break;case"wheel":ue=Ev;break;case"copy":case"cut":case"paste":ue=fv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=Cm;break;case"toggle":case"beforetoggle":ue=Av}var Ve=(i&4)!==0,jt=!Ve&&(n==="scroll"||n==="scrollend"),K=Ve?se!==null?se+"Capture":null:se;Ve=[];for(var Y=ie,re;Y!==null;){var me=Y;if(re=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||re===null||K===null||(me=Oa(Y,K),me!=null&&Ve.push(cl(Y,me,re))),jt)break;Y=Y.return}0<Ve.length&&(se=new ue(se,ze,null,a,ce),ye.push({event:se,listeners:Ve}))}}if((i&7)===0){e:{if(se=n==="mouseover"||n==="pointerover",ue=n==="mouseout"||n==="pointerout",se&&a!==oc&&(ze=a.relatedTarget||a.fromElement)&&(k(ze)||ze[An]))break e;if((ue||se)&&(se=ce.window===ce?ce:(se=ce.ownerDocument)?se.defaultView||se.parentWindow:window,ue?(ze=a.relatedTarget||a.toElement,ue=ie,ze=ze?k(ze):null,ze!==null&&(jt=o(ze),Ve=ze.tag,ze!==jt||Ve!==5&&Ve!==27&&Ve!==6)&&(ze=null)):(ue=null,ze=ie),ue!==ze)){if(Ve=km,me="onMouseLeave",K="onMouseEnter",Y="mouse",(n==="pointerout"||n==="pointerover")&&(Ve=Cm,me="onPointerLeave",K="onPointerEnter",Y="pointer"),jt=ue==null?se:T(ue),re=ze==null?se:T(ze),se=new Ve(me,Y+"leave",ue,a,ce),se.target=jt,se.relatedTarget=re,me=null,k(ce)===ie&&(Ve=new Ve(K,Y+"enter",ze,a,ce),Ve.target=re,Ve.relatedTarget=jt,me=Ve),jt=me,ue&&ze)t:{for(Ve=Cw,K=ue,Y=ze,re=0,me=K;me;me=Ve(me))re++;me=0;for(var qe=Y;qe;qe=Ve(qe))me++;for(;0<re-me;)K=Ve(K),re--;for(;0<me-re;)Y=Ve(Y),me--;for(;re--;){if(K===Y||Y!==null&&K===Y.alternate){Ve=K;break t}K=Ve(K),Y=Ve(Y)}Ve=null}else Ve=null;ue!==null&&yy(ye,se,ue,Ve,!1),ze!==null&&jt!==null&&yy(ye,jt,ze,Ve,!0)}}e:{if(se=ie?T(ie):window,ue=se.nodeName&&se.nodeName.toLowerCase(),ue==="select"||ue==="input"&&se.type==="file")var bt=Dm;else if(Rm(se))if(Lm)bt=Uv;else{bt=Lv;var Ue=Dv}else ue=se.nodeName,!ue||ue.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ie&&lc(ie.elementType)&&(bt=Dm):bt=zv;if(bt&&(bt=bt(n,ie))){Mm(ye,bt,a,ce);break e}Ue&&Ue(n,se,ie),n==="focusout"&&ie&&se.type==="number"&&ie.memoizedProps.value!=null&&ac(se,"number",se.value)}switch(Ue=ie?T(ie):window,n){case"focusin":(Rm(Ue)||Ue.contentEditable==="true")&&(Rs=Ue,wc=ie,Ba=null);break;case"focusout":Ba=wc=Rs=null;break;case"mousedown":Sc=!0;break;case"contextmenu":case"mouseup":case"dragend":Sc=!1,Fm(ye,a,ce);break;case"selectionchange":if(Bv)break;case"keydown":case"keyup":Fm(ye,a,ce)}var tt;if(yc)e:{switch(n){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else Os?Tm(n,a)&&(ft="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(ft="onCompositionStart");ft&&(Am&&a.locale!=="ko"&&(Os||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&Os&&(tt=Sm()):(Si=ce,hc="value"in Si?Si.value:Si.textContent,Os=!0)),Ue=Xo(ie,ft),0<Ue.length&&(ft=new Em(ft,n,null,a,ce),ye.push({event:ft,listeners:Ue}),tt?ft.data=tt:(tt=Om(a),tt!==null&&(ft.data=tt)))),(tt=Nv?Tv(n,a):Ov(n,a))&&(ft=Xo(ie,"onBeforeInput"),0<ft.length&&(Ue=new Em("onBeforeInput","beforeinput",null,a,ce),ye.push({event:Ue,listeners:ft}),Ue.data=tt)),Sw(ye,n,ie,a,ce)}py(ye,i)})}function cl(n,i,a){return{instance:n,listener:i,currentTarget:a}}function Xo(n,i){for(var a=i+"Capture",u=[];n!==null;){var h=n,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=Oa(n,a),h!=null&&u.unshift(cl(n,h,p)),h=Oa(n,i),h!=null&&u.push(cl(n,h,p))),n.tag===3)return u;n=n.return}return[]}function Cw(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function yy(n,i,a,u,h){for(var p=i._reactName,w=[];a!==null&&a!==u;){var _=a,H=_.alternate,ie=_.stateNode;if(_=_.tag,H!==null&&H===u)break;_!==5&&_!==26&&_!==27||ie===null||(H=ie,h?(ie=Oa(a,p),ie!=null&&w.unshift(cl(a,ie,H))):h||(ie=Oa(a,p),ie!=null&&w.push(cl(a,ie,H)))),a=a.return}w.length!==0&&n.push({event:i,listeners:w})}var Aw=/\r\n?/g,jw=/\u0000|\uFFFD/g;function by(n){return(typeof n=="string"?n:""+n).replace(Aw,`
|
|
49
|
-
`).replace(jw,"")}function xy(n,i){return i=by(i),by(n)===i}function At(n,i,a,u,h,p){switch(a){case"children":typeof u=="string"?i==="body"||i==="textarea"&&u===""||js(n,u):(typeof u=="number"||typeof u=="bigint")&&i!=="body"&&js(n,""+u);break;case"className":Cr(n,"class",u);break;case"tabIndex":Cr(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Cr(n,a,u);break;case"style":xm(n,u,p);break;case"data":if(i!=="object"){Cr(n,"data",u);break}case"src":case"href":if(u===""&&(i!=="a"||a!=="href")){n.removeAttribute(a);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(a);break}u=eo(""+u),n.setAttribute(a,u);break;case"action":case"formAction":if(typeof u=="function"){n.setAttribute(a,"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 p=="function"&&(a==="formAction"?(i!=="input"&&At(n,i,"name",h.name,h,null),At(n,i,"formEncType",h.formEncType,h,null),At(n,i,"formMethod",h.formMethod,h,null),At(n,i,"formTarget",h.formTarget,h,null)):(At(n,i,"encType",h.encType,h,null),At(n,i,"method",h.method,h,null),At(n,i,"target",h.target,h,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(a);break}u=eo(""+u),n.setAttribute(a,u);break;case"onClick":u!=null&&(n.onclick=Kr);break;case"onScroll":u!=null&&at("scroll",n);break;case"onScrollEnd":u!=null&&at("scrollend",n);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(a=u.__html,a!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"multiple":n.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":n.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){n.removeAttribute("xlink:href");break}a=eo(""+u),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(a,""+u):n.removeAttribute(a);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":u&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(a,""):n.removeAttribute(a);break;case"capture":case"download":u===!0?n.setAttribute(a,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(a,u):n.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?n.setAttribute(a,u):n.removeAttribute(a);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?n.removeAttribute(a):n.setAttribute(a,u);break;case"popover":at("beforetoggle",n),at("toggle",n),jn(n,"popover",u);break;case"xlinkActuate":Xr(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Xr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Xr(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Xr(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Xr(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Xr(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Xr(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Xr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Xr(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":jn(n,"is",u);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=nv.get(a)||a,jn(n,a,u))}}function Jf(n,i,a,u,h,p){switch(a){case"style":xm(n,u,p);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(a=u.__html,a!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"children":typeof u=="string"?js(n,u):(typeof u=="number"||typeof u=="bigint")&&js(n,""+u);break;case"onScroll":u!=null&&at("scroll",n);break;case"onScrollEnd":u!=null&&at("scrollend",n);break;case"onClick":u!=null&&(n.onclick=Kr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ge.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),i=a.slice(2,h?a.length-7:void 0),p=n[Pt]||null,p=p!=null?p[a]:null,typeof p=="function"&&n.removeEventListener(i,p,h),typeof u=="function")){typeof p!="function"&&p!==null&&(a in n?n[a]=null:n.hasAttribute(a)&&n.removeAttribute(a)),n.addEventListener(i,u,h);break e}a in n?n[a]=u:u===!0?n.setAttribute(a,""):jn(n,a,u)}}}function kn(n,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",n),at("load",n);var u=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":u=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:At(n,i,p,w,a,null)}}h&&At(n,i,"srcSet",a.srcSet,a,null),u&&At(n,i,"src",a.src,a,null);return;case"input":at("invalid",n);var _=p=w=h=null,H=null,ie=null;for(u in a)if(a.hasOwnProperty(u)){var ce=a[u];if(ce!=null)switch(u){case"name":h=ce;break;case"type":w=ce;break;case"checked":H=ce;break;case"defaultChecked":ie=ce;break;case"value":p=ce;break;case"defaultValue":_=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,i));break;default:At(n,i,u,ce,a,null)}}pm(n,p,_,H,ie,w,h,!1);return;case"select":at("invalid",n),u=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(_=a[h],_!=null))switch(h){case"value":p=_;break;case"defaultValue":w=_;break;case"multiple":u=_;default:At(n,i,h,_,a,null)}i=p,a=w,n.multiple=!!u,i!=null?As(n,!!u,i,!1):a!=null&&As(n,!!u,a,!0);return;case"textarea":at("invalid",n),p=h=u=null;for(w in a)if(a.hasOwnProperty(w)&&(_=a[w],_!=null))switch(w){case"value":u=_;break;case"defaultValue":h=_;break;case"children":p=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(s(91));break;default:At(n,i,w,_,a,null)}ym(n,u,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(u=a[H],u!=null))switch(H){case"selected":n.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:At(n,i,H,u,a,null)}return;case"dialog":at("beforetoggle",n),at("toggle",n),at("cancel",n),at("close",n);break;case"iframe":case"object":at("load",n);break;case"video":case"audio":for(u=0;u<ul.length;u++)at(ul[u],n);break;case"image":at("error",n),at("load",n);break;case"details":at("toggle",n);break;case"embed":case"source":case"link":at("error",n),at("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ie in a)if(a.hasOwnProperty(ie)&&(u=a[ie],u!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:At(n,i,ie,u,a,null)}return;default:if(lc(i)){for(ce in a)a.hasOwnProperty(ce)&&(u=a[ce],u!==void 0&&Jf(n,i,ce,u,a,void 0));return}}for(_ in a)a.hasOwnProperty(_)&&(u=a[_],u!=null&&At(n,i,_,u,a,null))}function Nw(n,i,a,u){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,w=null,_=null,H=null,ie=null,ce=null;for(ue in a){var ye=a[ue];if(a.hasOwnProperty(ue)&&ye!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":H=ye;default:u.hasOwnProperty(ue)||At(n,i,ue,null,u,ye)}}for(var se in u){var ue=u[se];if(ye=a[se],u.hasOwnProperty(se)&&(ue!=null||ye!=null))switch(se){case"type":p=ue;break;case"name":h=ue;break;case"checked":ie=ue;break;case"defaultChecked":ce=ue;break;case"value":w=ue;break;case"defaultValue":_=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,i));break;default:ue!==ye&&At(n,i,se,ue,u,ye)}}sc(n,w,_,H,ie,ce,p,h);return;case"select":ue=w=_=se=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":ue=H;default:u.hasOwnProperty(p)||At(n,i,p,null,u,H)}for(h in u)if(p=u[h],H=a[h],u.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":se=p;break;case"defaultValue":_=p;break;case"multiple":w=p;default:p!==H&&At(n,i,h,p,u,H)}i=_,a=w,u=ue,se!=null?As(n,!!a,se,!1):!!u!=!!a&&(i!=null?As(n,!!a,i,!0):As(n,!!a,a?[]:"",!1));return;case"textarea":ue=se=null;for(_ in a)if(h=a[_],a.hasOwnProperty(_)&&h!=null&&!u.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:At(n,i,_,null,u,h)}for(w in u)if(h=u[w],p=a[w],u.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":se=h;break;case"defaultValue":ue=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&At(n,i,w,h,u,p)}gm(n,se,ue);return;case"option":for(var ze in a)if(se=a[ze],a.hasOwnProperty(ze)&&se!=null&&!u.hasOwnProperty(ze))switch(ze){case"selected":n.selected=!1;break;default:At(n,i,ze,null,u,se)}for(H in u)if(se=u[H],ue=a[H],u.hasOwnProperty(H)&&se!==ue&&(se!=null||ue!=null))switch(H){case"selected":n.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:At(n,i,H,se,u,ue)}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 Ve in a)se=a[Ve],a.hasOwnProperty(Ve)&&se!=null&&!u.hasOwnProperty(Ve)&&At(n,i,Ve,null,u,se);for(ie in u)if(se=u[ie],ue=a[ie],u.hasOwnProperty(ie)&&se!==ue&&(se!=null||ue!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(s(137,i));break;default:At(n,i,ie,se,u,ue)}return;default:if(lc(i)){for(var jt in a)se=a[jt],a.hasOwnProperty(jt)&&se!==void 0&&!u.hasOwnProperty(jt)&&Jf(n,i,jt,void 0,u,se);for(ce in u)se=u[ce],ue=a[ce],!u.hasOwnProperty(ce)||se===ue||se===void 0&&ue===void 0||Jf(n,i,ce,se,u,ue);return}}for(var K in a)se=a[K],a.hasOwnProperty(K)&&se!=null&&!u.hasOwnProperty(K)&&At(n,i,K,null,u,se);for(ye in u)se=u[ye],ue=a[ye],!u.hasOwnProperty(ye)||se===ue||se==null&&ue==null||At(n,i,ye,se,u,ue)}function vy(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Tw(){if(typeof performance.getEntriesByType=="function"){for(var n=0,i=0,a=performance.getEntriesByType("resource"),u=0;u<a.length;u++){var h=a[u],p=h.transferSize,w=h.initiatorType,_=h.duration;if(p&&_&&vy(w)){for(w=0,_=h.responseEnd,u+=1;u<a.length;u++){var H=a[u],ie=H.startTime;if(ie>_)break;var ce=H.transferSize,ye=H.initiatorType;ce&&vy(ye)&&(H=H.responseEnd,w+=ce*(H<_?1:(_-ie)/(H-ie)))}if(--u,i+=8*(p+w)/(h.duration/1e3),n++,10<n)break}}if(0<n)return i/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Xf=null,Kf=null;function Ko(n){return n.nodeType===9?n:n.ownerDocument}function wy(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Sy(n,i){if(n===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&i==="foreignObject"?0:n}function Qf(n,i){return n==="textarea"||n==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Zf=null;function Ow(){var n=window.event;return n&&n.type==="popstate"?n===Zf?!1:(Zf=n,!0):(Zf=null,!1)}var _y=typeof setTimeout=="function"?setTimeout:void 0,Rw=typeof clearTimeout=="function"?clearTimeout:void 0,ky=typeof Promise=="function"?Promise:void 0,Mw=typeof queueMicrotask=="function"?queueMicrotask:typeof ky<"u"?function(n){return ky.resolve(null).then(n).catch(Dw)}:_y;function Dw(n){setTimeout(function(){throw n})}function Bi(n){return n==="head"}function Ey(n,i){var a=i,u=0;do{var h=a.nextSibling;if(n.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(u===0){n.removeChild(h),sa(i);return}u--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")u++;else if(a==="html")fl(n.ownerDocument.documentElement);else if(a==="head"){a=n.ownerDocument.head,fl(a);for(var p=a.firstChild;p;){var w=p.nextSibling,_=p.nodeName;p[pn]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&fl(n.ownerDocument.body);a=h}while(a);sa(i)}function Cy(n,i){var a=n;n=0;do{var u=a.nextSibling;if(a.nodeType===1?i?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(i?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),u&&u.nodeType===8)if(a=u.data,a==="/$"){if(n===0)break;n--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||n++;a=u}while(a)}function Wf(n){var i=n.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var a=i;switch(i=i.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Wf(a),Cs(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}n.removeChild(a)}}function Lw(n,i,a,u){for(;n.nodeType===1;){var h=a;if(n.nodeName.toLowerCase()!==i.toLowerCase()){if(!u&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(u){if(!n[pn])switch(i){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(p=n.getAttribute("rel"),p==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(p!==h.rel||n.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||n.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||n.getAttribute("title")!==(h.title==null?null:h.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(p=n.getAttribute("src"),(p!==(h.src==null?null:h.src)||n.getAttribute("type")!==(h.type==null?null:h.type)||n.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(i==="input"&&n.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&n.getAttribute("name")===p)return n}else return n;if(n=xr(n.nextSibling),n===null)break}return null}function zw(n,i,a){if(i==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=xr(n.nextSibling),n===null))return null;return n}function Ay(n,i){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=xr(n.nextSibling),n===null))return null;return n}function eh(n){return n.data==="$?"||n.data==="$~"}function th(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Uw(n,i){var a=n.ownerDocument;if(n.data==="$~")n._reactRetry=i;else if(n.data!=="$?"||a.readyState!=="loading")i();else{var u=function(){i(),a.removeEventListener("DOMContentLoaded",u)};a.addEventListener("DOMContentLoaded",u),n._reactRetry=u}}function xr(n){for(;n!=null;n=n.nextSibling){var i=n.nodeType;if(i===1||i===3)break;if(i===8){if(i=n.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return n}var nh=null;function jy(n){n=n.nextSibling;for(var i=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"||a==="/&"){if(i===0)return xr(n.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}n=n.nextSibling}return null}function Ny(n){n=n.previousSibling;for(var i=0;n;){if(n.nodeType===8){var a=n.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(i===0)return n;i--}else a!=="/$"&&a!=="/&"||i++}n=n.previousSibling}return null}function Ty(n,i,a){switch(i=Ko(a),n){case"html":if(n=i.documentElement,!n)throw Error(s(452));return n;case"head":if(n=i.head,!n)throw Error(s(453));return n;case"body":if(n=i.body,!n)throw Error(s(454));return n;default:throw Error(s(451))}}function fl(n){for(var i=n.attributes;i.length;)n.removeAttributeNode(i[0]);Cs(n)}var vr=new Map,Oy=new Set;function Qo(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var hi=Q.d;Q.d={f:Pw,r:Bw,D:Hw,C:qw,L:Iw,m:Fw,X:Vw,S:$w,M:Yw};function Pw(){var n=hi.f(),i=Io();return n||i}function Bw(n){var i=R(n);i!==null&&i.tag===5&&i.type==="form"?Jp(i):hi.r(n)}var na=typeof document>"u"?null:document;function Ry(n,i,a){var u=na;if(u&&typeof i=="string"&&i){var h=hr(i);h='link[rel="'+n+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Oy.has(h)||(Oy.add(h),n={rel:n,crossOrigin:a,href:i},u.querySelector(h)===null&&(i=u.createElement("link"),kn(i,"link",n),$(i),u.head.appendChild(i)))}}function Hw(n){hi.D(n),Ry("dns-prefetch",n,null)}function qw(n,i){hi.C(n,i),Ry("preconnect",n,i)}function Iw(n,i,a){hi.L(n,i,a);var u=na;if(u&&n&&i){var h='link[rel="preload"][as="'+hr(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+hr(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+hr(a.imageSizes)+'"]')):h+='[href="'+hr(n)+'"]';var p=h;switch(i){case"style":p=ra(n);break;case"script":p=ia(n)}vr.has(p)||(n=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:n,as:i},a),vr.set(p,n),u.querySelector(h)!==null||i==="style"&&u.querySelector(hl(p))||i==="script"&&u.querySelector(dl(p))||(i=u.createElement("link"),kn(i,"link",n),$(i),u.head.appendChild(i)))}}function Fw(n,i){hi.m(n,i);var a=na;if(a&&n){var u=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+hr(u)+'"][href="'+hr(n)+'"]',p=h;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ia(n)}if(!vr.has(p)&&(n=g({rel:"modulepreload",href:n},i),vr.set(p,n),a.querySelector(h)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(dl(p)))return}u=a.createElement("link"),kn(u,"link",n),$(u),a.head.appendChild(u)}}}function $w(n,i,a){hi.S(n,i,a);var u=na;if(u&&n){var h=U(u).hoistableStyles,p=ra(n);i=i||"default";var w=h.get(p);if(!w){var _={loading:0,preload:null};if(w=u.querySelector(hl(p)))_.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":i},a),(a=vr.get(p))&&rh(n,a);var H=w=u.createElement("link");$(H),kn(H,"link",n),H._p=new Promise(function(ie,ce){H.onload=ie,H.onerror=ce}),H.addEventListener("load",function(){_.loading|=1}),H.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Zo(w,i,u)}w={type:"stylesheet",instance:w,count:1,state:_},h.set(p,w)}}}function Vw(n,i){hi.X(n,i);var a=na;if(a&&n){var u=U(a).hoistableScripts,h=ia(n),p=u.get(h);p||(p=a.querySelector(dl(h)),p||(n=g({src:n,async:!0},i),(i=vr.get(h))&&ih(n,i),p=a.createElement("script"),$(p),kn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(h,p))}}function Yw(n,i){hi.M(n,i);var a=na;if(a&&n){var u=U(a).hoistableScripts,h=ia(n),p=u.get(h);p||(p=a.querySelector(dl(h)),p||(n=g({src:n,async:!0,type:"module"},i),(i=vr.get(h))&&ih(n,i),p=a.createElement("script"),$(p),kn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(h,p))}}function My(n,i,a,u){var h=(h=je.current)?Qo(h):null;if(!h)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(i=ra(a.href),a=U(h).hoistableStyles,u=a.get(i),u||(u={type:"style",instance:null,count:0,state:null},a.set(i,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){n=ra(a.href);var p=U(h).hoistableStyles,w=p.get(n);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,w),(p=h.querySelector(hl(n)))&&!p._p&&(w.instance=p,w.state.loading=5),vr.has(n)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},vr.set(n,a),p||Gw(h,n,a,w.state))),i&&u===null)throw Error(s(528,""));return w}if(i&&u!==null)throw Error(s(529,""));return null;case"script":return i=a.async,a=a.src,typeof a=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=ia(a),a=U(h).hoistableScripts,u=a.get(i),u||(u={type:"script",instance:null,count:0,state:null},a.set(i,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function ra(n){return'href="'+hr(n)+'"'}function hl(n){return'link[rel="stylesheet"]['+n+"]"}function Dy(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function Gw(n,i,a,u){n.querySelector('link[rel="preload"][as="style"]['+i+"]")?u.loading=1:(i=n.createElement("link"),u.preload=i,i.addEventListener("load",function(){return u.loading|=1}),i.addEventListener("error",function(){return u.loading|=2}),kn(i,"link",a),$(i),n.head.appendChild(i))}function ia(n){return'[src="'+hr(n)+'"]'}function dl(n){return"script[async]"+n}function Ly(n,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var u=n.querySelector('style[data-href~="'+hr(a.href)+'"]');if(u)return i.instance=u,$(u),u;var h=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),$(u),kn(u,"style",h),Zo(u,a.precedence,n),i.instance=u;case"stylesheet":h=ra(a.href);var p=n.querySelector(hl(h));if(p)return i.state.loading|=4,i.instance=p,$(p),p;u=Dy(a),(h=vr.get(h))&&rh(u,h),p=(n.ownerDocument||n).createElement("link"),$(p);var w=p;return w._p=new Promise(function(_,H){w.onload=_,w.onerror=H}),kn(p,"link",u),i.state.loading|=4,Zo(p,a.precedence,n),i.instance=p;case"script":return p=ia(a.src),(h=n.querySelector(dl(p)))?(i.instance=h,$(h),h):(u=a,(h=vr.get(p))&&(u=g({},a),ih(u,h)),n=n.ownerDocument||n,h=n.createElement("script"),$(h),kn(h,"link",u),n.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(u=i.instance,i.state.loading|=4,Zo(u,a.precedence,n));return i.instance}function Zo(n,i,a){for(var u=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=u.length?u[u.length-1]:null,p=h,w=0;w<u.length;w++){var _=u[w];if(_.dataset.precedence===i)p=_;else if(p!==h)break}p?p.parentNode.insertBefore(n,p.nextSibling):(i=a.nodeType===9?a.head:a,i.insertBefore(n,i.firstChild))}function rh(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.title==null&&(n.title=i.title)}function ih(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.integrity==null&&(n.integrity=i.integrity)}var Wo=null;function zy(n,i,a){if(Wo===null){var u=new Map,h=Wo=new Map;h.set(a,u)}else h=Wo,u=h.get(a),u||(u=new Map,h.set(a,u));if(u.has(n))return u;for(u.set(n,null),a=a.getElementsByTagName(n),h=0;h<a.length;h++){var p=a[h];if(!(p[pn]||p[ut]||n==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(i)||"";w=n+w;var _=u.get(w);_?_.push(p):u.set(w,[p])}}return u}function Uy(n,i,a){n=n.ownerDocument||n,n.head.insertBefore(a,i==="title"?n.querySelector("head > title"):null)}function Jw(n,i,a){if(a===1||i.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return n=i.disabled,typeof i.precedence=="string"&&n==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Py(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function Xw(n,i,a,u){if(a.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=ra(u.href),p=i.querySelector(hl(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(n.count++,n=eu.bind(n),i.then(n,n)),a.state.loading|=4,a.instance=p,$(p);return}p=i.ownerDocument||i,u=Dy(u),(h=vr.get(h))&&rh(u,h),p=p.createElement("link"),$(p);var w=p;w._p=new Promise(function(_,H){w.onload=_,w.onerror=H}),kn(p,"link",u),a.instance=p}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(a,i),(i=a.state.preload)&&(a.state.loading&3)===0&&(n.count++,a=eu.bind(n),i.addEventListener("load",a),i.addEventListener("error",a))}}var sh=0;function Kw(n,i){return n.stylesheets&&n.count===0&&nu(n,n.stylesheets),0<n.count||0<n.imgCount?function(a){var u=setTimeout(function(){if(n.stylesheets&&nu(n,n.stylesheets),n.unsuspend){var p=n.unsuspend;n.unsuspend=null,p()}},6e4+i);0<n.imgBytes&&sh===0&&(sh=62500*Tw());var h=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&nu(n,n.stylesheets),n.unsuspend)){var p=n.unsuspend;n.unsuspend=null,p()}},(n.imgBytes>sh?50:800)+i);return n.unsuspend=a,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(h)}}:null}function eu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var tu=null;function nu(n,i){n.stylesheets=null,n.unsuspend!==null&&(n.count++,tu=new Map,i.forEach(Qw,n),tu=null,eu.call(n))}function Qw(n,i){if(!(i.state.loading&4)){var a=tu.get(n);if(a)var u=a.get(null);else{a=new Map,tu.set(n,a);for(var h=n.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var w=h[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),u=w)}u&&a.set(null,u)}h=i.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||u,p===u&&a.set(null,h),a.set(w,h),this.count++,u=eu.bind(this),h.addEventListener("load",u),h.addEventListener("error",u),p?p.parentNode.insertBefore(h,p.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(h,n.firstChild)),i.state.loading|=4}}var ml={$$typeof:I,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function Zw(n,i,a,u,h,p,w,_,H){this.tag=1,this.containerInfo=n,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=Ee(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ee(0),this.hiddenUpdates=Ee(null),this.identifierPrefix=u,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function By(n,i,a,u,h,p,w,_,H,ie,ce,ye){return n=new Zw(n,i,a,w,H,ie,ce,ye,_),i=1,p===!0&&(i|=24),p=Qn(3,null,null,i),n.current=p,p.stateNode=n,i=Uc(),i.refCount++,n.pooledCache=i,i.refCount++,p.memoizedState={element:u,isDehydrated:a,cache:i},qc(p),n}function Hy(n){return n?(n=Ls,n):Ls}function qy(n,i,a,u,h,p){h=Hy(h),u.context===null?u.context=h:u.pendingContext=h,u=ji(i),u.payload={element:a},p=p===void 0?null:p,p!==null&&(u.callback=p),a=Ni(n,u,i),a!==null&&(Vn(a,n,i),Ya(a,n,i))}function Iy(n,i){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<i?a:i}}function ah(n,i){Iy(n,i),(n=n.alternate)&&Iy(n,i)}function Fy(n){if(n.tag===13||n.tag===31){var i=as(n,67108864);i!==null&&Vn(i,n,67108864),ah(n,67108864)}}function $y(n){if(n.tag===13||n.tag===31){var i=nr();i=Pe(i);var a=as(n,i);a!==null&&Vn(a,n,i),ah(n,i)}}var ru=!0;function Ww(n,i,a,u){var h=V.T;V.T=null;var p=Q.p;try{Q.p=2,lh(n,i,a,u)}finally{Q.p=p,V.T=h}}function eS(n,i,a,u){var h=V.T;V.T=null;var p=Q.p;try{Q.p=8,lh(n,i,a,u)}finally{Q.p=p,V.T=h}}function lh(n,i,a,u){if(ru){var h=oh(u);if(h===null)Gf(n,i,u,iu,a),Yy(n,u);else if(nS(h,n,i,a,u))u.stopPropagation();else if(Yy(n,u),i&4&&-1<tS.indexOf(n)){for(;h!==null;){var p=R(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=Xn(p.pendingLanes);if(w!==0){var _=p;for(_.pendingLanes|=2,_.entangledLanes|=2;w;){var H=1<<31-Qe(w);_.entanglements[1]|=H,w&=~H}qr(p),(vt&6)===0&&(Ho=gt()+500,ol(0))}}break;case 31:case 13:_=as(p,2),_!==null&&Vn(_,p,2),Io(),ah(p,2)}if(p=oh(u),p===null&&Gf(n,i,u,iu,a),p===h)break;h=p}h!==null&&u.stopPropagation()}else Gf(n,i,u,null,a)}}function oh(n){return n=uc(n),uh(n)}var iu=null;function uh(n){if(iu=null,n=k(n),n!==null){var i=o(n);if(i===null)n=null;else{var a=i.tag;if(a===13){if(n=c(i),n!==null)return n;n=null}else if(a===31){if(n=f(i),n!==null)return n;n=null}else if(a===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;n=null}else i!==n&&(n=null)}}return iu=n,null}function Vy(n){switch(n){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(Cn()){case le:return 2;case ke:return 8;case Re:case Ge:return 32;case rt:return 268435456;default:return 32}default:return 32}}var ch=!1,Hi=null,qi=null,Ii=null,pl=new Map,gl=new Map,Fi=[],tS="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 Yy(n,i){switch(n){case"focusin":case"focusout":Hi=null;break;case"dragenter":case"dragleave":qi=null;break;case"mouseover":case"mouseout":Ii=null;break;case"pointerover":case"pointerout":pl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":gl.delete(i.pointerId)}}function yl(n,i,a,u,h,p){return n===null||n.nativeEvent!==p?(n={blockedOn:i,domEventName:a,eventSystemFlags:u,nativeEvent:p,targetContainers:[h]},i!==null&&(i=R(i),i!==null&&Fy(i)),n):(n.eventSystemFlags|=u,i=n.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),n)}function nS(n,i,a,u,h){switch(i){case"focusin":return Hi=yl(Hi,n,i,a,u,h),!0;case"dragenter":return qi=yl(qi,n,i,a,u,h),!0;case"mouseover":return Ii=yl(Ii,n,i,a,u,h),!0;case"pointerover":var p=h.pointerId;return pl.set(p,yl(pl.get(p)||null,n,i,a,u,h)),!0;case"gotpointercapture":return p=h.pointerId,gl.set(p,yl(gl.get(p)||null,n,i,a,u,h)),!0}return!1}function Gy(n){var i=k(n.target);if(i!==null){var a=o(i);if(a!==null){if(i=a.tag,i===13){if(i=c(a),i!==null){n.blockedOn=i,Kt(n.priority,function(){$y(a)});return}}else if(i===31){if(i=f(a),i!==null){n.blockedOn=i,Kt(n.priority,function(){$y(a)});return}}else if(i===3&&a.stateNode.current.memoizedState.isDehydrated){n.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}n.blockedOn=null}function su(n){if(n.blockedOn!==null)return!1;for(var i=n.targetContainers;0<i.length;){var a=oh(n.nativeEvent);if(a===null){a=n.nativeEvent;var u=new a.constructor(a.type,a);oc=u,a.target.dispatchEvent(u),oc=null}else return i=R(a),i!==null&&Fy(i),n.blockedOn=a,!1;i.shift()}return!0}function Jy(n,i,a){su(n)&&a.delete(i)}function rS(){ch=!1,Hi!==null&&su(Hi)&&(Hi=null),qi!==null&&su(qi)&&(qi=null),Ii!==null&&su(Ii)&&(Ii=null),pl.forEach(Jy),gl.forEach(Jy)}function au(n,i){n.blockedOn===i&&(n.blockedOn=null,ch||(ch=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,rS)))}var lu=null;function Xy(n){lu!==n&&(lu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){lu===n&&(lu=null);for(var i=0;i<n.length;i+=3){var a=n[i],u=n[i+1],h=n[i+2];if(typeof u!="function"){if(uh(u||a)===null)continue;break}var p=R(a);p!==null&&(n.splice(i,3),i-=3,of(p,{pending:!0,data:h,method:a.method,action:u},u,h))}}))}function sa(n){function i(H){return au(H,n)}Hi!==null&&au(Hi,n),qi!==null&&au(qi,n),Ii!==null&&au(Ii,n),pl.forEach(i),gl.forEach(i);for(var a=0;a<Fi.length;a++){var u=Fi[a];u.blockedOn===n&&(u.blockedOn=null)}for(;0<Fi.length&&(a=Fi[0],a.blockedOn===null);)Gy(a),a.blockedOn===null&&Fi.shift();if(a=(n.ownerDocument||n).$$reactFormReplay,a!=null)for(u=0;u<a.length;u+=3){var h=a[u],p=a[u+1],w=h[Pt]||null;if(typeof p=="function")w||Xy(a);else if(w){var _=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[Pt]||null)_=w.formAction;else if(uh(h)!==null)continue}else _=w.action;typeof _=="function"?a[u+1]=_:(a.splice(u,3),u-=3),Xy(a)}}}function Ky(){function n(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return h=w})},focusReset:"manual",scroll:"manual"})}function i(){h!==null&&(h(),h=null),u||setTimeout(a,20)}function a(){if(!u&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,h=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){u=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function fh(n){this._internalRoot=n}ou.prototype.render=fh.prototype.render=function(n){var i=this._internalRoot;if(i===null)throw Error(s(409));var a=i.current,u=nr();qy(a,u,n,i,null,null)},ou.prototype.unmount=fh.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var i=n.containerInfo;qy(n.current,2,null,n,null,null),Io(),i[An]=null}};function ou(n){this._internalRoot=n}ou.prototype.unstable_scheduleHydration=function(n){if(n){var i=Wt();n={blockedOn:null,target:n,priority:i};for(var a=0;a<Fi.length&&i!==0&&i<Fi[a].priority;a++);Fi.splice(a,0,n),a===0&&Gy(n)}};var Qy=t.version;if(Qy!=="19.2.4")throw Error(s(527,Qy,"19.2.4"));Q.findDOMNode=function(n){var i=n._reactInternals;if(i===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=m(i),n=n!==null?b(n):null,n=n===null?null:n.stateNode,n};var iS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uu.isDisabled&&uu.supportsFiber)try{Jt=uu.inject(iS),yt=uu}catch{}}return xl.createRoot=function(n,i){if(!l(n))throw Error(s(299));var a=!1,u="",h=ig,p=sg,w=ag;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),i=By(n,1,!1,null,null,a,u,null,h,p,w,Ky),n[An]=i.current,Yf(n),new fh(i)},xl.hydrateRoot=function(n,i,a){if(!l(n))throw Error(s(299));var u=!1,h="",p=ig,w=sg,_=ag,H=null;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(_=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),i=By(n,1,!0,i,a??null,u,h,H,p,w,_,Ky),i.context=Hy(null),a=i.current,u=nr(),u=Pe(u),h=ji(u),h.callback=null,Ni(a,h,u),a=u,i.current.lanes=a,Be(i,a),qr(i),n[An]=i.current,Yf(n),new ou(i)},xl.version="19.2.4",xl}var l0;function pS(){if(l0)return mh.exports;l0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),mh.exports=mS(),mh.exports}var gS=pS();/**
|
|
48
|
+
`+u.stack}}var nt=Object.prototype.hasOwnProperty,st=e.unstable_scheduleCallback,Ot=e.unstable_cancelCallback,_t=e.unstable_shouldYield,mn=e.unstable_requestPaint,at=e.unstable_now,Cr=e.unstable_getCurrentPriorityLevel,ae=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,Me=e.unstable_NormalPriority,Ge=e.unstable_LowPriority,rt=e.unstable_IdlePriority,zt=e.log,Sn=e.unstable_setDisableYieldValue,Kt=null,yt=null;function Vt(n){if(typeof zt=="function"&&Sn(n),yt&&typeof yt.setStrictMode=="function")try{yt.setStrictMode(Kt,n)}catch{}}var Ze=Math.clz32?Math.clz32:Kn,An=Math.log,pn=Math.LN2;function Kn(n){return n>>>=0,n===0?32:31-(An(n)/pn|0)|0}var we=256,Ye=262144,Re=4194304;function bt(n){var i=n&42;if(i!==0)return i;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function ln(n,i,a){var u=n.pendingLanes;if(u===0)return 0;var h=0,p=n.suspendedLanes,w=n.pingedLanes;n=n.warmLanes;var _=u&134217727;return _!==0?(u=_&~p,u!==0?h=bt(u):(w&=_,w!==0?h=bt(w):a||(a=_&~n,a!==0&&(h=bt(a))))):(_=u&~p,_!==0?h=bt(_):w!==0?h=bt(w):a||(a=u&~n,a!==0&&(h=bt(a)))),h===0?0:i!==0&&i!==h&&(i&p)===0&&(p=h&-h,a=i&-i,p>=a||p===32&&(a&4194048)!==0)?i:h}function Hn(n,i){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&i)===0}function ts(n,i){switch(n){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 de(){var n=Re;return Re<<=1,(Re&62914560)===0&&(Re=4194304),n}function Ee(n){for(var i=[],a=0;31>a;a++)i.push(n);return i}function He(n,i){n.pendingLanes|=i,i!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Ve(n,i,a,u,h,p){var w=n.pendingLanes;n.pendingLanes=a,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=a,n.entangledLanes&=a,n.errorRecoveryDisabledLanes&=a,n.shellSuspendCounter=0;var _=n.entanglements,H=n.expirationTimes,re=n.hiddenUpdates;for(a=w&~a;0<a;){var fe=31-Ze(a),ye=1<<fe;_[fe]=0,H[fe]=-1;var ie=re[fe];if(ie!==null)for(re[fe]=null,fe=0;fe<ie.length;fe++){var oe=ie[fe];oe!==null&&(oe.lane&=-536870913)}a&=~ye}u!==0&&qe(n,u,0),p!==0&&h===0&&n.tag!==0&&(n.suspendedLanes|=p&~(w&~i))}function qe(n,i,a){n.pendingLanes|=i,n.suspendedLanes&=~i;var u=31-Ze(i);n.entangledLanes|=i,n.entanglements[u]=n.entanglements[u]|1073741824|a&261930}function ct(n,i){var a=n.entangledLanes|=i;for(n=n.entanglements;a;){var u=31-Ze(a),h=1<<u;h&i|n[u]&i&&(n[u]|=i),a&=~h}}function Xe(n,i){var a=i&-i;return a=(a&42)!==0?1:Pe(a),(a&(n.suspendedLanes|i))!==0?0:a}function Pe(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function We(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Zt(){var n=Q.p;return n!==0?n:(n=window.event,n===void 0?32:Vy(n.type))}function Qt(n,i){var a=Q.p;try{return Q.p=n,i()}finally{Q.p=a}}var Rt=Math.random().toString(36).slice(2),ft="__reactFiber$"+Rt,Bt="__reactProps$"+Rt,jn="__reactContainer$"+Rt,Pr="__reactEvents$"+Rt,wi="__reactListeners$"+Rt,Ut="__reactHandles$"+Rt,ns="__reactResources$"+Rt,gn="__reactMarker$"+Rt;function Cs(n){delete n[ft],delete n[Bt],delete n[Pr],delete n[wi],delete n[Ut]}function k(n){var i=n[ft];if(i)return i;for(var a=n.parentNode;a;){if(i=a[jn]||a[ft]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(n=Ny(n);n!==null;){if(a=n[ft])return a;n=Ny(n)}return i}n=a,a=n.parentNode}return null}function D(n){if(n=n[ft]||n[jn]){var i=n.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return n}return null}function O(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n.stateNode;throw Error(s(33))}function U(n){var i=n[ns];return i||(i=n[ns]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function F(n){n[gn]=!0}var Z=new Set,ge={};function be(n,i){se(n,i),se(n+"Capture",i)}function se(n,i){for(ge[n]=i,n=0;n<i.length;n++)Z.add(i[n])}var pe=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]*$"),Le={},it={};function Ht(n){return nt.call(it,n)?!0:nt.call(Le,n)?!1:pe.test(n)?it[n]=!0:(Le[n]=!0,!1)}function Nn(n,i,a){if(Ht(i))if(a===null)n.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":n.removeAttribute(i);return;case"boolean":var u=i.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){n.removeAttribute(i);return}}n.setAttribute(i,""+a)}}function Ar(n,i,a){if(a===null)n.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttribute(i,""+a)}}function Xr(n,i,a,u){if(u===null)n.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttributeNS(i,a,""+u)}}function hr(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function dm(n){var i=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function W1(n,i,a){var u=Object.getOwnPropertyDescriptor(n.constructor.prototype,i);if(!n.hasOwnProperty(i)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var h=u.get,p=u.set;return Object.defineProperty(n,i,{configurable:!0,get:function(){return h.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(n,i,{enumerable:u.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){n._valueTracker=null,delete n[i]}}}}function ic(n){if(!n._valueTracker){var i=dm(n)?"checked":"value";n._valueTracker=W1(n,i,""+n[i])}}function mm(n){if(!n)return!1;var i=n._valueTracker;if(!i)return!0;var a=i.getValue(),u="";return n&&(u=dm(n)?n.checked?"true":"false":n.value),n=u,n!==a?(i.setValue(n),!0):!1}function Wl(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var ev=/[\n"\\]/g;function dr(n){return n.replace(ev,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function sc(n,i,a,u,h,p,w,_){n.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?n.type=w:n.removeAttribute("type"),i!=null?w==="number"?(i===0&&n.value===""||n.value!=i)&&(n.value=""+hr(i)):n.value!==""+hr(i)&&(n.value=""+hr(i)):w!=="submit"&&w!=="reset"||n.removeAttribute("value"),i!=null?ac(n,w,hr(i)):a!=null?ac(n,w,hr(a)):u!=null&&n.removeAttribute("value"),h==null&&p!=null&&(n.defaultChecked=!!p),h!=null&&(n.checked=h&&typeof h!="function"&&typeof h!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?n.name=""+hr(_):n.removeAttribute("name")}function pm(n,i,a,u,h,p,w,_){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(n.type=p),i!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){ic(n);return}a=a!=null?""+hr(a):"",i=i!=null?""+hr(i):a,_||i===n.value||(n.value=i),n.defaultValue=i}u=u??h,u=typeof u!="function"&&typeof u!="symbol"&&!!u,n.checked=_?n.checked:!!u,n.defaultChecked=!!u,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.name=w),ic(n)}function ac(n,i,a){i==="number"&&Wl(n.ownerDocument)===n||n.defaultValue===""+a||(n.defaultValue=""+a)}function As(n,i,a,u){if(n=n.options,i){i={};for(var h=0;h<a.length;h++)i["$"+a[h]]=!0;for(a=0;a<n.length;a++)h=i.hasOwnProperty("$"+n[a].value),n[a].selected!==h&&(n[a].selected=h),h&&u&&(n[a].defaultSelected=!0)}else{for(a=""+hr(a),i=null,h=0;h<n.length;h++){if(n[h].value===a){n[h].selected=!0,u&&(n[h].defaultSelected=!0);return}i!==null||n[h].disabled||(i=n[h])}i!==null&&(i.selected=!0)}}function gm(n,i,a){if(i!=null&&(i=""+hr(i),i!==n.value&&(n.value=i),a==null)){n.defaultValue!==i&&(n.defaultValue=i);return}n.defaultValue=a!=null?""+hr(a):""}function ym(n,i,a,u){if(i==null){if(u!=null){if(a!=null)throw Error(s(92));if(te(u)){if(1<u.length)throw Error(s(93));u=u[0]}a=u}a==null&&(a=""),i=a}a=hr(i),n.defaultValue=a,u=n.textContent,u===a&&u!==""&&u!==null&&(n.value=u),ic(n)}function js(n,i){if(i){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=i;return}}n.textContent=i}var tv=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 bm(n,i,a){var u=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?u?n.setProperty(i,""):i==="float"?n.cssFloat="":n[i]="":u?n.setProperty(i,a):typeof a!="number"||a===0||tv.has(i)?i==="float"?n.cssFloat=a:n[i]=(""+a).trim():n[i]=a+"px"}function xm(n,i,a){if(i!=null&&typeof i!="object")throw Error(s(62));if(n=n.style,a!=null){for(var u in a)!a.hasOwnProperty(u)||i!=null&&i.hasOwnProperty(u)||(u.indexOf("--")===0?n.setProperty(u,""):u==="float"?n.cssFloat="":n[u]="");for(var h in i)u=i[h],i.hasOwnProperty(h)&&a[h]!==u&&bm(n,h,u)}else for(var p in i)i.hasOwnProperty(p)&&bm(n,p,i[p])}function lc(n){if(n.indexOf("-")===-1)return!1;switch(n){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 nv=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"]]),rv=/^[\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 eo(n){return rv.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Kr(){}var oc=null;function uc(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Ns=null,Ts=null;function vm(n){var i=D(n);if(i&&(n=i.stateNode)){var a=n[Bt]||null;e:switch(n=i.stateNode,i.type){case"input":if(sc(n,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),i=a.name,a.type==="radio"&&i!=null){for(a=n;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+dr(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var u=a[i];if(u!==n&&u.form===n.form){var h=u[Bt]||null;if(!h)throw Error(s(90));sc(u,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<a.length;i++)u=a[i],u.form===n.form&&mm(u)}break e;case"textarea":gm(n,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&As(n,!!a.multiple,i,!1)}}}var cc=!1;function wm(n,i,a){if(cc)return n(i,a);cc=!0;try{var u=n(i);return u}finally{if(cc=!1,(Ns!==null||Ts!==null)&&(Io(),Ns&&(i=Ns,n=Ts,Ts=Ns=null,vm(i),n)))for(i=0;i<n.length;i++)vm(n[i])}}function Oa(n,i){var a=n.stateNode;if(a===null)return null;var u=a[Bt]||null;if(u===null)return null;a=u[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;break e;default:n=!1}if(n)return null;if(a&&typeof a!="function")throw Error(s(231,i,typeof a));return a}var Qr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fc=!1;if(Qr)try{var Ra={};Object.defineProperty(Ra,"passive",{get:function(){fc=!0}}),window.addEventListener("test",Ra,Ra),window.removeEventListener("test",Ra,Ra)}catch{fc=!1}var Si=null,hc=null,to=null;function Sm(){if(to)return to;var n,i=hc,a=i.length,u,h="value"in Si?Si.value:Si.textContent,p=h.length;for(n=0;n<a&&i[n]===h[n];n++);var w=a-n;for(u=1;u<=w&&i[a-u]===h[p-u];u++);return to=h.slice(n,1<u?1-u:void 0)}function no(n){var i=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&i===13&&(n=13)):n=i,n===10&&(n=13),32<=n||n===13?n:0}function ro(){return!0}function _m(){return!1}function qn(n){function i(a,u,h,p,w){this._reactName=a,this._targetInst=h,this.type=u,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var _ in n)n.hasOwnProperty(_)&&(a=n[_],this[_]=a?a(p):p[_]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?ro:_m,this.isPropagationStopped=_m,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=ro)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ro)},persist:function(){},isPersistent:ro}),i}var rs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},io=qn(rs),Ma=g({},rs,{view:0,detail:0}),iv=qn(Ma),dc,mc,Da,so=g({},Ma,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gc,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Da&&(Da&&n.type==="mousemove"?(dc=n.screenX-Da.screenX,mc=n.screenY-Da.screenY):mc=dc=0,Da=n),dc)},movementY:function(n){return"movementY"in n?n.movementY:mc}}),km=qn(so),sv=g({},so,{dataTransfer:0}),av=qn(sv),lv=g({},Ma,{relatedTarget:0}),pc=qn(lv),ov=g({},rs,{animationName:0,elapsedTime:0,pseudoElement:0}),uv=qn(ov),cv=g({},rs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),fv=qn(cv),hv=g({},rs,{data:0}),Em=qn(hv),dv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mv={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"},pv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gv(n){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(n):(n=pv[n])?!!i[n]:!1}function gc(){return gv}var yv=g({},Ma,{key:function(n){if(n.key){var i=dv[n.key]||n.key;if(i!=="Unidentified")return i}return n.type==="keypress"?(n=no(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?mv[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gc,charCode:function(n){return n.type==="keypress"?no(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?no(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),bv=qn(yv),xv=g({},so,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cm=qn(xv),vv=g({},Ma,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gc}),wv=qn(vv),Sv=g({},rs,{propertyName:0,elapsedTime:0,pseudoElement:0}),_v=qn(Sv),kv=g({},so,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Ev=qn(kv),Cv=g({},rs,{newState:0,oldState:0}),Av=qn(Cv),jv=[9,13,27,32],yc=Qr&&"CompositionEvent"in window,La=null;Qr&&"documentMode"in document&&(La=document.documentMode);var Nv=Qr&&"TextEvent"in window&&!La,Am=Qr&&(!yc||La&&8<La&&11>=La),jm=" ",Nm=!1;function Tm(n,i){switch(n){case"keyup":return jv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Om(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Os=!1;function Tv(n,i){switch(n){case"compositionend":return Om(i);case"keypress":return i.which!==32?null:(Nm=!0,jm);case"textInput":return n=i.data,n===jm&&Nm?null:n;default:return null}}function Ov(n,i){if(Os)return n==="compositionend"||!yc&&Tm(n,i)?(n=Sm(),to=hc=Si=null,Os=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Am&&i.locale!=="ko"?null:i.data;default:return null}}var Rv={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 Rm(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i==="input"?!!Rv[n.type]:i==="textarea"}function Mm(n,i,a,u){Ns?Ts?Ts.push(u):Ts=[u]:Ns=u,i=Xo(i,"onChange"),0<i.length&&(a=new io("onChange","change",null,a,u),n.push({event:a,listeners:i}))}var za=null,Ua=null;function Mv(n){py(n,0)}function ao(n){var i=O(n);if(mm(i))return n}function Dm(n,i){if(n==="change")return i}var Lm=!1;if(Qr){var bc;if(Qr){var xc="oninput"in document;if(!xc){var zm=document.createElement("div");zm.setAttribute("oninput","return;"),xc=typeof zm.oninput=="function"}bc=xc}else bc=!1;Lm=bc&&(!document.documentMode||9<document.documentMode)}function Um(){za&&(za.detachEvent("onpropertychange",Pm),Ua=za=null)}function Pm(n){if(n.propertyName==="value"&&ao(Ua)){var i=[];Mm(i,Ua,n,uc(n)),wm(Mv,i)}}function Dv(n,i,a){n==="focusin"?(Um(),za=i,Ua=a,za.attachEvent("onpropertychange",Pm)):n==="focusout"&&Um()}function Lv(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ao(Ua)}function zv(n,i){if(n==="click")return ao(i)}function Uv(n,i){if(n==="input"||n==="change")return ao(i)}function Pv(n,i){return n===i&&(n!==0||1/n===1/i)||n!==n&&i!==i}var Qn=typeof Object.is=="function"?Object.is:Pv;function Pa(n,i){if(Qn(n,i))return!0;if(typeof n!="object"||n===null||typeof i!="object"||i===null)return!1;var a=Object.keys(n),u=Object.keys(i);if(a.length!==u.length)return!1;for(u=0;u<a.length;u++){var h=a[u];if(!nt.call(i,h)||!Qn(n[h],i[h]))return!1}return!0}function Bm(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Hm(n,i){var a=Bm(n);n=0;for(var u;a;){if(a.nodeType===3){if(u=n+a.textContent.length,n<=i&&u>=i)return{node:a,offset:i-n};n=u}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Bm(a)}}function qm(n,i){return n&&i?n===i?!0:n&&n.nodeType===3?!1:i&&i.nodeType===3?qm(n,i.parentNode):"contains"in n?n.contains(i):n.compareDocumentPosition?!!(n.compareDocumentPosition(i)&16):!1:!1}function Im(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var i=Wl(n.document);i instanceof n.HTMLIFrameElement;){try{var a=typeof i.contentWindow.location.href=="string"}catch{a=!1}if(a)n=i.contentWindow;else break;i=Wl(n.document)}return i}function vc(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i&&(i==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||i==="textarea"||n.contentEditable==="true")}var Bv=Qr&&"documentMode"in document&&11>=document.documentMode,Rs=null,wc=null,Ba=null,Sc=!1;function Fm(n,i,a){var u=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Sc||Rs==null||Rs!==Wl(u)||(u=Rs,"selectionStart"in u&&vc(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Ba&&Pa(Ba,u)||(Ba=u,u=Xo(wc,"onSelect"),0<u.length&&(i=new io("onSelect","select",null,i,a),n.push({event:i,listeners:u}),i.target=Rs)))}function is(n,i){var a={};return a[n.toLowerCase()]=i.toLowerCase(),a["Webkit"+n]="webkit"+i,a["Moz"+n]="moz"+i,a}var Ms={animationend:is("Animation","AnimationEnd"),animationiteration:is("Animation","AnimationIteration"),animationstart:is("Animation","AnimationStart"),transitionrun:is("Transition","TransitionRun"),transitionstart:is("Transition","TransitionStart"),transitioncancel:is("Transition","TransitionCancel"),transitionend:is("Transition","TransitionEnd")},_c={},$m={};Qr&&($m=document.createElement("div").style,"AnimationEvent"in window||(delete Ms.animationend.animation,delete Ms.animationiteration.animation,delete Ms.animationstart.animation),"TransitionEvent"in window||delete Ms.transitionend.transition);function ss(n){if(_c[n])return _c[n];if(!Ms[n])return n;var i=Ms[n],a;for(a in i)if(i.hasOwnProperty(a)&&a in $m)return _c[n]=i[a];return n}var Vm=ss("animationend"),Ym=ss("animationiteration"),Gm=ss("animationstart"),Hv=ss("transitionrun"),qv=ss("transitionstart"),Iv=ss("transitioncancel"),Jm=ss("transitionend"),Xm=new Map,kc="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(" ");kc.push("scrollEnd");function jr(n,i){Xm.set(n,i),be(i,[n])}var lo=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},mr=[],Ds=0,Ec=0;function oo(){for(var n=Ds,i=Ec=Ds=0;i<n;){var a=mr[i];mr[i++]=null;var u=mr[i];mr[i++]=null;var h=mr[i];mr[i++]=null;var p=mr[i];if(mr[i++]=null,u!==null&&h!==null){var w=u.pending;w===null?h.next=h:(h.next=w.next,w.next=h),u.pending=h}p!==0&&Km(a,h,p)}}function uo(n,i,a,u){mr[Ds++]=n,mr[Ds++]=i,mr[Ds++]=a,mr[Ds++]=u,Ec|=u,n.lanes|=u,n=n.alternate,n!==null&&(n.lanes|=u)}function Cc(n,i,a,u){return uo(n,i,a,u),co(n)}function as(n,i){return uo(n,null,null,i),co(n)}function Km(n,i,a){n.lanes|=a;var u=n.alternate;u!==null&&(u.lanes|=a);for(var h=!1,p=n.return;p!==null;)p.childLanes|=a,u=p.alternate,u!==null&&(u.childLanes|=a),p.tag===22&&(n=p.stateNode,n===null||n._visibility&1||(h=!0)),n=p,p=p.return;return n.tag===3?(p=n.stateNode,h&&i!==null&&(h=31-Ze(a),n=p.hiddenUpdates,u=n[h],u===null?n[h]=[i]:u.push(i),i.lane=a|536870912),p):null}function co(n){if(50<ll)throw ll=0,zf=null,Error(s(185));for(var i=n.return;i!==null;)n=i,i=n.return;return n.tag===3?n.stateNode:null}var Ls={};function Fv(n,i,a,u){this.tag=n,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zn(n,i,a,u){return new Fv(n,i,a,u)}function Ac(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Zr(n,i){var a=n.alternate;return a===null?(a=Zn(n.tag,i,n.key,n.mode),a.elementType=n.elementType,a.type=n.type,a.stateNode=n.stateNode,a.alternate=n,n.alternate=a):(a.pendingProps=i,a.type=n.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=n.flags&65011712,a.childLanes=n.childLanes,a.lanes=n.lanes,a.child=n.child,a.memoizedProps=n.memoizedProps,a.memoizedState=n.memoizedState,a.updateQueue=n.updateQueue,i=n.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},a.sibling=n.sibling,a.index=n.index,a.ref=n.ref,a.refCleanup=n.refCleanup,a}function Qm(n,i){n.flags&=65011714;var a=n.alternate;return a===null?(n.childLanes=0,n.lanes=i,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=a.childLanes,n.lanes=a.lanes,n.child=a.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=a.memoizedProps,n.memoizedState=a.memoizedState,n.updateQueue=a.updateQueue,n.type=a.type,i=a.dependencies,n.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),n}function fo(n,i,a,u,h,p){var w=0;if(u=n,typeof n=="function")Ac(n)&&(w=1);else if(typeof n=="string")w=Jw(n,a,ve.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case B:return n=Zn(31,a,i,h),n.elementType=B,n.lanes=p,n;case j:return ls(a.children,h,p,i);case R:w=8,h|=24;break;case M:return n=Zn(12,a,i,h|2),n.elementType=M,n.lanes=p,n;case q:return n=Zn(13,a,i,h),n.elementType=q,n.lanes=p,n;case N:return n=Zn(19,a,i,h),n.elementType=N,n.lanes=p,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:w=10;break e;case P:w=9;break e;case ue:w=11;break e;case ee:w=14;break e;case G:w=16,u=null;break e}w=29,a=Error(s(130,n===null?"null":typeof n,"")),u=null}return i=Zn(w,a,i,h),i.elementType=n,i.type=u,i.lanes=p,i}function ls(n,i,a,u){return n=Zn(7,n,u,i),n.lanes=a,n}function jc(n,i,a){return n=Zn(6,n,null,i),n.lanes=a,n}function Zm(n){var i=Zn(18,null,null,0);return i.stateNode=n,i}function Nc(n,i,a){return i=Zn(4,n.children!==null?n.children:[],n.key,i),i.lanes=a,i.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},i}var Wm=new WeakMap;function pr(n,i){if(typeof n=="object"&&n!==null){var a=Wm.get(n);return a!==void 0?a:(i={value:n,source:i,stack:Be(i)},Wm.set(n,i),i)}return{value:n,source:i,stack:Be(i)}}var zs=[],Us=0,ho=null,Ha=0,gr=[],yr=0,_i=null,Br=1,Hr="";function Wr(n,i){zs[Us++]=Ha,zs[Us++]=ho,ho=n,Ha=i}function ep(n,i,a){gr[yr++]=Br,gr[yr++]=Hr,gr[yr++]=_i,_i=n;var u=Br;n=Hr;var h=32-Ze(u)-1;u&=~(1<<h),a+=1;var p=32-Ze(i)+h;if(30<p){var w=h-h%5;p=(u&(1<<w)-1).toString(32),u>>=w,h-=w,Br=1<<32-Ze(i)+h|a<<h|u,Hr=p+n}else Br=1<<p|a<<h|u,Hr=n}function Tc(n){n.return!==null&&(Wr(n,1),ep(n,1,0))}function Oc(n){for(;n===ho;)ho=zs[--Us],zs[Us]=null,Ha=zs[--Us],zs[Us]=null;for(;n===_i;)_i=gr[--yr],gr[yr]=null,Hr=gr[--yr],gr[yr]=null,Br=gr[--yr],gr[yr]=null}function tp(n,i){gr[yr++]=Br,gr[yr++]=Hr,gr[yr++]=_i,Br=i.id,Hr=i.overflow,_i=n}var _n=null,qt=null,mt=!1,ki=null,br=!1,Rc=Error(s(519));function Ei(n){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw qa(pr(i,n)),Rc}function np(n){var i=n.stateNode,a=n.type,u=n.memoizedProps;switch(i[ft]=n,i[Bt]=u,a){case"dialog":ot("cancel",i),ot("close",i);break;case"iframe":case"object":case"embed":ot("load",i);break;case"video":case"audio":for(a=0;a<ul.length;a++)ot(ul[a],i);break;case"source":ot("error",i);break;case"img":case"image":case"link":ot("error",i),ot("load",i);break;case"details":ot("toggle",i);break;case"input":ot("invalid",i),pm(i,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":ot("invalid",i);break;case"textarea":ot("invalid",i),ym(i,u.value,u.defaultValue,u.children)}a=u.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||u.suppressHydrationWarning===!0||xy(i.textContent,a)?(u.popover!=null&&(ot("beforetoggle",i),ot("toggle",i)),u.onScroll!=null&&ot("scroll",i),u.onScrollEnd!=null&&ot("scrollend",i),u.onClick!=null&&(i.onclick=Kr),i=!0):i=!1,i||Ei(n,!0)}function rp(n){for(_n=n.return;_n;)switch(_n.tag){case 5:case 31:case 13:br=!1;return;case 27:case 3:br=!0;return;default:_n=_n.return}}function Ps(n){if(n!==_n)return!1;if(!mt)return rp(n),mt=!0,!1;var i=n.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=n.type,a=!(a!=="form"&&a!=="button")||Qf(n.type,n.memoizedProps)),a=!a),a&&qt&&Ei(n),rp(n),i===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));qt=jy(n)}else if(i===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));qt=jy(n)}else i===27?(i=qt,Bi(n.type)?(n=nh,nh=null,qt=n):qt=i):qt=_n?vr(n.stateNode.nextSibling):null;return!0}function os(){qt=_n=null,mt=!1}function Mc(){var n=ki;return n!==null&&(Vn===null?Vn=n:Vn.push.apply(Vn,n),ki=null),n}function qa(n){ki===null?ki=[n]:ki.push(n)}var Dc=z(null),us=null,ei=null;function Ci(n,i,a){T(Dc,i._currentValue),i._currentValue=a}function ti(n){n._currentValue=Dc.current,W(Dc)}function Lc(n,i,a){for(;n!==null;){var u=n.alternate;if((n.childLanes&i)!==i?(n.childLanes|=i,u!==null&&(u.childLanes|=i)):u!==null&&(u.childLanes&i)!==i&&(u.childLanes|=i),n===a)break;n=n.return}}function zc(n,i,a,u){var h=n.child;for(h!==null&&(h.return=n);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var _=p;p=h;for(var H=0;H<i.length;H++)if(_.context===i[H]){p.lanes|=a,_=p.alternate,_!==null&&(_.lanes|=a),Lc(p.return,a,n),u||(w=null);break e}p=_.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(s(341));w.lanes|=a,p=w.alternate,p!==null&&(p.lanes|=a),Lc(w,a,n),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===n){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Bs(n,i,a,u){n=null;for(var h=i,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var w=h.alternate;if(w===null)throw Error(s(387));if(w=w.memoizedProps,w!==null){var _=h.type;Qn(h.pendingProps.value,w.value)||(n!==null?n.push(_):n=[_])}}else if(h===ce.current){if(w=h.alternate,w===null)throw Error(s(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(n!==null?n.push(ml):n=[ml])}h=h.return}n!==null&&zc(i,n,a,u),i.flags|=262144}function mo(n){for(n=n.firstContext;n!==null;){if(!Qn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function cs(n){us=n,ei=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function kn(n){return ip(us,n)}function po(n,i){return us===null&&cs(n),ip(n,i)}function ip(n,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},ei===null){if(n===null)throw Error(s(308));ei=i,n.dependencies={lanes:0,firstContext:i},n.flags|=524288}else ei=ei.next=i;return a}var $v=typeof AbortController<"u"?AbortController:function(){var n=[],i=this.signal={aborted:!1,addEventListener:function(a,u){n.push(u)}};this.abort=function(){i.aborted=!0,n.forEach(function(a){return a()})}},Vv=e.unstable_scheduleCallback,Yv=e.unstable_NormalPriority,on={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uc(){return{controller:new $v,data:new Map,refCount:0}}function Ia(n){n.refCount--,n.refCount===0&&Vv(Yv,function(){n.controller.abort()})}var Fa=null,Pc=0,Hs=0,qs=null;function Gv(n,i){if(Fa===null){var a=Fa=[];Pc=0,Hs=If(),qs={status:"pending",value:void 0,then:function(u){a.push(u)}}}return Pc++,i.then(sp,sp),i}function sp(){if(--Pc===0&&Fa!==null){qs!==null&&(qs.status="fulfilled");var n=Fa;Fa=null,Hs=0,qs=null;for(var i=0;i<n.length;i++)(0,n[i])()}}function Jv(n,i){var a=[],u={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return n.then(function(){u.status="fulfilled",u.value=i;for(var h=0;h<a.length;h++)(0,a[h])(i)},function(h){for(u.status="rejected",u.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),u}var ap=V.S;V.S=function(n,i){Fg=at(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Gv(n,i),ap!==null&&ap(n,i)};var fs=z(null);function Bc(){var n=fs.current;return n!==null?n:Mt.pooledCache}function go(n,i){i===null?T(fs,fs.current):T(fs,i.pool)}function lp(){var n=Bc();return n===null?null:{parent:on._currentValue,pool:n}}var Is=Error(s(460)),Hc=Error(s(474)),yo=Error(s(542)),bo={then:function(){}};function op(n){return n=n.status,n==="fulfilled"||n==="rejected"}function up(n,i,a){switch(a=n[a],a===void 0?n.push(i):a!==i&&(i.then(Kr,Kr),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,fp(n),n;default:if(typeof i.status=="string")i.then(Kr,Kr);else{if(n=Mt,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=i,n.status="pending",n.then(function(u){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=u}},function(u){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=u}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,fp(n),n}throw ds=i,Is}}function hs(n){try{var i=n._init;return i(n._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ds=a,Is):a}}var ds=null;function cp(){if(ds===null)throw Error(s(459));var n=ds;return ds=null,n}function fp(n){if(n===Is||n===yo)throw Error(s(483))}var Fs=null,$a=0;function xo(n){var i=$a;return $a+=1,Fs===null&&(Fs=[]),up(Fs,n,i)}function Va(n,i){i=i.props.ref,n.ref=i!==void 0?i:null}function vo(n,i){throw i.$$typeof===x?Error(s(525)):(n=Object.prototype.toString.call(i),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":n)))}function hp(n){function i(K,Y){if(n){var ne=K.deletions;ne===null?(K.deletions=[Y],K.flags|=16):ne.push(Y)}}function a(K,Y){if(!n)return null;for(;Y!==null;)i(K,Y),Y=Y.sibling;return null}function u(K){for(var Y=new Map;K!==null;)K.key!==null?Y.set(K.key,K):Y.set(K.index,K),K=K.sibling;return Y}function h(K,Y){return K=Zr(K,Y),K.index=0,K.sibling=null,K}function p(K,Y,ne){return K.index=ne,n?(ne=K.alternate,ne!==null?(ne=ne.index,ne<Y?(K.flags|=67108866,Y):ne):(K.flags|=67108866,Y)):(K.flags|=1048576,Y)}function w(K){return n&&K.alternate===null&&(K.flags|=67108866),K}function _(K,Y,ne,me){return Y===null||Y.tag!==6?(Y=jc(ne,K.mode,me),Y.return=K,Y):(Y=h(Y,ne),Y.return=K,Y)}function H(K,Y,ne,me){var Ie=ne.type;return Ie===j?fe(K,Y,ne.props.children,me,ne.key):Y!==null&&(Y.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===G&&hs(Ie)===Y.type)?(Y=h(Y,ne.props),Va(Y,ne),Y.return=K,Y):(Y=fo(ne.type,ne.key,ne.props,null,K.mode,me),Va(Y,ne),Y.return=K,Y)}function re(K,Y,ne,me){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==ne.containerInfo||Y.stateNode.implementation!==ne.implementation?(Y=Nc(ne,K.mode,me),Y.return=K,Y):(Y=h(Y,ne.children||[]),Y.return=K,Y)}function fe(K,Y,ne,me,Ie){return Y===null||Y.tag!==7?(Y=ls(ne,K.mode,me,Ie),Y.return=K,Y):(Y=h(Y,ne),Y.return=K,Y)}function ye(K,Y,ne){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=jc(""+Y,K.mode,ne),Y.return=K,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case v:return ne=fo(Y.type,Y.key,Y.props,null,K.mode,ne),Va(ne,Y),ne.return=K,ne;case S:return Y=Nc(Y,K.mode,ne),Y.return=K,Y;case G:return Y=hs(Y),ye(K,Y,ne)}if(te(Y)||$(Y))return Y=ls(Y,K.mode,ne,null),Y.return=K,Y;if(typeof Y.then=="function")return ye(K,xo(Y),ne);if(Y.$$typeof===I)return ye(K,po(K,Y),ne);vo(K,Y)}return null}function ie(K,Y,ne,me){var Ie=Y!==null?Y.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Ie!==null?null:_(K,Y,""+ne,me);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case v:return ne.key===Ie?H(K,Y,ne,me):null;case S:return ne.key===Ie?re(K,Y,ne,me):null;case G:return ne=hs(ne),ie(K,Y,ne,me)}if(te(ne)||$(ne))return Ie!==null?null:fe(K,Y,ne,me,null);if(typeof ne.then=="function")return ie(K,Y,xo(ne),me);if(ne.$$typeof===I)return ie(K,Y,po(K,ne),me);vo(K,ne)}return null}function oe(K,Y,ne,me,Ie){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return K=K.get(ne)||null,_(Y,K,""+me,Ie);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case v:return K=K.get(me.key===null?ne:me.key)||null,H(Y,K,me,Ie);case S:return K=K.get(me.key===null?ne:me.key)||null,re(Y,K,me,Ie);case G:return me=hs(me),oe(K,Y,ne,me,Ie)}if(te(me)||$(me))return K=K.get(ne)||null,fe(Y,K,me,Ie,null);if(typeof me.then=="function")return oe(K,Y,ne,xo(me),Ie);if(me.$$typeof===I)return oe(K,Y,ne,po(Y,me),Ie);vo(Y,me)}return null}function ze(K,Y,ne,me){for(var Ie=null,xt=null,Ue=Y,et=Y=0,dt=null;Ue!==null&&et<ne.length;et++){Ue.index>et?(dt=Ue,Ue=null):dt=Ue.sibling;var vt=ie(K,Ue,ne[et],me);if(vt===null){Ue===null&&(Ue=dt);break}n&&Ue&&vt.alternate===null&&i(K,Ue),Y=p(vt,Y,et),xt===null?Ie=vt:xt.sibling=vt,xt=vt,Ue=dt}if(et===ne.length)return a(K,Ue),mt&&Wr(K,et),Ie;if(Ue===null){for(;et<ne.length;et++)Ue=ye(K,ne[et],me),Ue!==null&&(Y=p(Ue,Y,et),xt===null?Ie=Ue:xt.sibling=Ue,xt=Ue);return mt&&Wr(K,et),Ie}for(Ue=u(Ue);et<ne.length;et++)dt=oe(Ue,K,et,ne[et],me),dt!==null&&(n&&dt.alternate!==null&&Ue.delete(dt.key===null?et:dt.key),Y=p(dt,Y,et),xt===null?Ie=dt:xt.sibling=dt,xt=dt);return n&&Ue.forEach(function($i){return i(K,$i)}),mt&&Wr(K,et),Ie}function $e(K,Y,ne,me){if(ne==null)throw Error(s(151));for(var Ie=null,xt=null,Ue=Y,et=Y=0,dt=null,vt=ne.next();Ue!==null&&!vt.done;et++,vt=ne.next()){Ue.index>et?(dt=Ue,Ue=null):dt=Ue.sibling;var $i=ie(K,Ue,vt.value,me);if($i===null){Ue===null&&(Ue=dt);break}n&&Ue&&$i.alternate===null&&i(K,Ue),Y=p($i,Y,et),xt===null?Ie=$i:xt.sibling=$i,xt=$i,Ue=dt}if(vt.done)return a(K,Ue),mt&&Wr(K,et),Ie;if(Ue===null){for(;!vt.done;et++,vt=ne.next())vt=ye(K,vt.value,me),vt!==null&&(Y=p(vt,Y,et),xt===null?Ie=vt:xt.sibling=vt,xt=vt);return mt&&Wr(K,et),Ie}for(Ue=u(Ue);!vt.done;et++,vt=ne.next())vt=oe(Ue,K,et,vt.value,me),vt!==null&&(n&&vt.alternate!==null&&Ue.delete(vt.key===null?et:vt.key),Y=p(vt,Y,et),xt===null?Ie=vt:xt.sibling=vt,xt=vt);return n&&Ue.forEach(function(sS){return i(K,sS)}),mt&&Wr(K,et),Ie}function jt(K,Y,ne,me){if(typeof ne=="object"&&ne!==null&&ne.type===j&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case v:e:{for(var Ie=ne.key;Y!==null;){if(Y.key===Ie){if(Ie=ne.type,Ie===j){if(Y.tag===7){a(K,Y.sibling),me=h(Y,ne.props.children),me.return=K,K=me;break e}}else if(Y.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===G&&hs(Ie)===Y.type){a(K,Y.sibling),me=h(Y,ne.props),Va(me,ne),me.return=K,K=me;break e}a(K,Y);break}else i(K,Y);Y=Y.sibling}ne.type===j?(me=ls(ne.props.children,K.mode,me,ne.key),me.return=K,K=me):(me=fo(ne.type,ne.key,ne.props,null,K.mode,me),Va(me,ne),me.return=K,K=me)}return w(K);case S:e:{for(Ie=ne.key;Y!==null;){if(Y.key===Ie)if(Y.tag===4&&Y.stateNode.containerInfo===ne.containerInfo&&Y.stateNode.implementation===ne.implementation){a(K,Y.sibling),me=h(Y,ne.children||[]),me.return=K,K=me;break e}else{a(K,Y);break}else i(K,Y);Y=Y.sibling}me=Nc(ne,K.mode,me),me.return=K,K=me}return w(K);case G:return ne=hs(ne),jt(K,Y,ne,me)}if(te(ne))return ze(K,Y,ne,me);if($(ne)){if(Ie=$(ne),typeof Ie!="function")throw Error(s(150));return ne=Ie.call(ne),$e(K,Y,ne,me)}if(typeof ne.then=="function")return jt(K,Y,xo(ne),me);if(ne.$$typeof===I)return jt(K,Y,po(K,ne),me);vo(K,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,Y!==null&&Y.tag===6?(a(K,Y.sibling),me=h(Y,ne),me.return=K,K=me):(a(K,Y),me=jc(ne,K.mode,me),me.return=K,K=me),w(K)):a(K,Y)}return function(K,Y,ne,me){try{$a=0;var Ie=jt(K,Y,ne,me);return Fs=null,Ie}catch(Ue){if(Ue===Is||Ue===yo)throw Ue;var xt=Zn(29,Ue,null,K.mode);return xt.lanes=me,xt.return=K,xt}finally{}}}var ms=hp(!0),dp=hp(!1),Ai=!1;function qc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ic(n,i){n=n.updateQueue,i.updateQueue===n&&(i.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function ji(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Ni(n,i,a){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(wt&2)!==0){var h=u.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),u.pending=i,i=co(n),Km(n,null,a),i}return uo(n,u,i,a),co(n)}function Ya(n,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var u=i.lanes;u&=n.pendingLanes,a|=u,i.lanes=a,ct(n,a)}}function Fc(n,i){var a=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,a===u)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?h=p=i:p=p.next=i}else h=p=i;a={baseState:u.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:u.shared,callbacks:u.callbacks},n.updateQueue=a;return}n=a.lastBaseUpdate,n===null?a.firstBaseUpdate=i:n.next=i,a.lastBaseUpdate=i}var $c=!1;function Ga(){if($c){var n=qs;if(n!==null)throw n}}function Ja(n,i,a,u){$c=!1;var h=n.updateQueue;Ai=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,_=h.shared.pending;if(_!==null){h.shared.pending=null;var H=_,re=H.next;H.next=null,w===null?p=re:w.next=re,w=H;var fe=n.alternate;fe!==null&&(fe=fe.updateQueue,_=fe.lastBaseUpdate,_!==w&&(_===null?fe.firstBaseUpdate=re:_.next=re,fe.lastBaseUpdate=H))}if(p!==null){var ye=h.baseState;w=0,fe=re=H=null,_=p;do{var ie=_.lane&-536870913,oe=ie!==_.lane;if(oe?(ht&ie)===ie:(u&ie)===ie){ie!==0&&ie===Hs&&($c=!0),fe!==null&&(fe=fe.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var ze=n,$e=_;ie=i;var jt=a;switch($e.tag){case 1:if(ze=$e.payload,typeof ze=="function"){ye=ze.call(jt,ye,ie);break e}ye=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=$e.payload,ie=typeof ze=="function"?ze.call(jt,ye,ie):ze,ie==null)break e;ye=g({},ye,ie);break e;case 2:Ai=!0}}ie=_.callback,ie!==null&&(n.flags|=64,oe&&(n.flags|=8192),oe=h.callbacks,oe===null?h.callbacks=[ie]:oe.push(ie))}else oe={lane:ie,tag:_.tag,payload:_.payload,callback:_.callback,next:null},fe===null?(re=fe=oe,H=ye):fe=fe.next=oe,w|=ie;if(_=_.next,_===null){if(_=h.shared.pending,_===null)break;oe=_,_=oe.next,oe.next=null,h.lastBaseUpdate=oe,h.shared.pending=null}}while(!0);fe===null&&(H=ye),h.baseState=H,h.firstBaseUpdate=re,h.lastBaseUpdate=fe,p===null&&(h.shared.lanes=0),Di|=w,n.lanes=w,n.memoizedState=ye}}function mp(n,i){if(typeof n!="function")throw Error(s(191,n));n.call(i)}function pp(n,i){var a=n.callbacks;if(a!==null)for(n.callbacks=null,n=0;n<a.length;n++)mp(a[n],i)}var $s=z(null),wo=z(0);function gp(n,i){n=ci,T(wo,n),T($s,i),ci=n|i.baseLanes}function Vc(){T(wo,ci),T($s,$s.current)}function Yc(){ci=wo.current,W($s),W(wo)}var Wn=z(null),xr=null;function Ti(n){var i=n.alternate;T(nn,nn.current&1),T(Wn,n),xr===null&&(i===null||$s.current!==null||i.memoizedState!==null)&&(xr=n)}function Gc(n){T(nn,nn.current),T(Wn,n),xr===null&&(xr=n)}function yp(n){n.tag===22?(T(nn,nn.current),T(Wn,n),xr===null&&(xr=n)):Oi()}function Oi(){T(nn,nn.current),T(Wn,Wn.current)}function er(n){W(Wn),xr===n&&(xr=null),W(nn)}var nn=z(0);function So(n){for(var i=n;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||eh(a)||th(a)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var ni=0,Ke=null,Ct=null,un=null,_o=!1,Vs=!1,ps=!1,ko=0,Xa=0,Ys=null,Xv=0;function Wt(){throw Error(s(321))}function Jc(n,i){if(i===null)return!1;for(var a=0;a<i.length&&a<n.length;a++)if(!Qn(n[a],i[a]))return!1;return!0}function Xc(n,i,a,u,h,p){return ni=p,Ke=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,V.H=n===null||n.memoizedState===null?eg:ff,ps=!1,p=a(u,h),ps=!1,Vs&&(p=xp(i,a,u,h)),bp(n),p}function bp(n){V.H=Za;var i=Ct!==null&&Ct.next!==null;if(ni=0,un=Ct=Ke=null,_o=!1,Xa=0,Ys=null,i)throw Error(s(300));n===null||cn||(n=n.dependencies,n!==null&&mo(n)&&(cn=!0))}function xp(n,i,a,u){Ke=n;var h=0;do{if(Vs&&(Ys=null),Xa=0,Vs=!1,25<=h)throw Error(s(301));if(h+=1,un=Ct=null,n.updateQueue!=null){var p=n.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}V.H=tg,p=i(a,u)}while(Vs);return p}function Kv(){var n=V.H,i=n.useState()[0];return i=typeof i.then=="function"?Ka(i):i,n=n.useState()[0],(Ct!==null?Ct.memoizedState:null)!==n&&(Ke.flags|=1024),i}function Kc(){var n=ko!==0;return ko=0,n}function Qc(n,i,a){i.updateQueue=n.updateQueue,i.flags&=-2053,n.lanes&=~a}function Zc(n){if(_o){for(n=n.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}_o=!1}ni=0,un=Ct=Ke=null,Vs=!1,Xa=ko=0,Ys=null}function Dn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return un===null?Ke.memoizedState=un=n:un=un.next=n,un}function rn(){if(Ct===null){var n=Ke.alternate;n=n!==null?n.memoizedState:null}else n=Ct.next;var i=un===null?Ke.memoizedState:un.next;if(i!==null)un=i,Ct=n;else{if(n===null)throw Ke.alternate===null?Error(s(467)):Error(s(310));Ct=n,n={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},un===null?Ke.memoizedState=un=n:un=un.next=n}return un}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ka(n){var i=Xa;return Xa+=1,Ys===null&&(Ys=[]),n=up(Ys,n,i),i=Ke,(un===null?i.memoizedState:un.next)===null&&(i=i.alternate,V.H=i===null||i.memoizedState===null?eg:ff),n}function Co(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ka(n);if(n.$$typeof===I)return kn(n)}throw Error(s(438,String(n)))}function Wc(n){var i=null,a=Ke.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var u=Ke.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(i={data:u.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=Eo(),Ke.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(n),u=0;u<n;u++)a[u]=L;return i.index++,a}function ri(n,i){return typeof i=="function"?i(n):i}function Ao(n){var i=rn();return ef(i,Ct,n)}function ef(n,i,a){var u=n.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=a;var h=n.baseQueue,p=u.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}i.baseQueue=h=p,u.pending=null}if(p=n.baseState,h===null)n.memoizedState=p;else{i=h.next;var _=w=null,H=null,re=i,fe=!1;do{var ye=re.lane&-536870913;if(ye!==re.lane?(ht&ye)===ye:(ni&ye)===ye){var ie=re.revertLane;if(ie===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),ye===Hs&&(fe=!0);else if((ni&ie)===ie){re=re.next,ie===Hs&&(fe=!0);continue}else ye={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},H===null?(_=H=ye,w=p):H=H.next=ye,Ke.lanes|=ie,Di|=ie;ye=re.action,ps&&a(p,ye),p=re.hasEagerState?re.eagerState:a(p,ye)}else ie={lane:ye,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},H===null?(_=H=ie,w=p):H=H.next=ie,Ke.lanes|=ye,Di|=ye;re=re.next}while(re!==null&&re!==i);if(H===null?w=p:H.next=_,!Qn(p,n.memoizedState)&&(cn=!0,fe&&(a=qs,a!==null)))throw a;n.memoizedState=p,n.baseState=w,n.baseQueue=H,u.lastRenderedState=p}return h===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function tf(n){var i=rn(),a=i.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=n;var u=a.dispatch,h=a.pending,p=i.memoizedState;if(h!==null){a.pending=null;var w=h=h.next;do p=n(p,w.action),w=w.next;while(w!==h);Qn(p,i.memoizedState)||(cn=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,u]}function vp(n,i,a){var u=Ke,h=rn(),p=mt;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var w=!Qn((Ct||h).memoizedState,a);if(w&&(h.memoizedState=a,cn=!0),h=h.queue,sf(_p.bind(null,u,h,n),[n]),h.getSnapshot!==i||w||un!==null&&un.memoizedState.tag&1){if(u.flags|=2048,Gs(9,{destroy:void 0},Sp.bind(null,u,h,a,i),null),Mt===null)throw Error(s(349));p||(ni&127)!==0||wp(u,i,a)}return a}function wp(n,i,a){n.flags|=16384,n={getSnapshot:i,value:a},i=Ke.updateQueue,i===null?(i=Eo(),Ke.updateQueue=i,i.stores=[n]):(a=i.stores,a===null?i.stores=[n]:a.push(n))}function Sp(n,i,a,u){i.value=a,i.getSnapshot=u,kp(i)&&Ep(n)}function _p(n,i,a){return a(function(){kp(i)&&Ep(n)})}function kp(n){var i=n.getSnapshot;n=n.value;try{var a=i();return!Qn(n,a)}catch{return!0}}function Ep(n){var i=as(n,2);i!==null&&Yn(i,n,2)}function nf(n){var i=Dn();if(typeof n=="function"){var a=n;if(n=a(),ps){Vt(!0);try{a()}finally{Vt(!1)}}}return i.memoizedState=i.baseState=n,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ri,lastRenderedState:n},i}function Cp(n,i,a,u){return n.baseState=a,ef(n,Ct,typeof u=="function"?u:ri)}function Qv(n,i,a,u,h){if(To(n))throw Error(s(485));if(n=i.action,n!==null){var p={payload:h,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};V.T!==null?a(!0):p.isTransition=!1,u(p),a=i.pending,a===null?(p.next=i.pending=p,Ap(i,p)):(p.next=a.next,i.pending=a.next=p)}}function Ap(n,i){var a=i.action,u=i.payload,h=n.state;if(i.isTransition){var p=V.T,w={};V.T=w;try{var _=a(h,u),H=V.S;H!==null&&H(w,_),jp(n,i,_)}catch(re){rf(n,i,re)}finally{p!==null&&w.types!==null&&(p.types=w.types),V.T=p}}else try{p=a(h,u),jp(n,i,p)}catch(re){rf(n,i,re)}}function jp(n,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(u){Np(n,i,u)},function(u){return rf(n,i,u)}):Np(n,i,a)}function Np(n,i,a){i.status="fulfilled",i.value=a,Tp(i),n.state=a,i=n.pending,i!==null&&(a=i.next,a===i?n.pending=null:(a=a.next,i.next=a,Ap(n,a)))}function rf(n,i,a){var u=n.pending;if(n.pending=null,u!==null){u=u.next;do i.status="rejected",i.reason=a,Tp(i),i=i.next;while(i!==u)}n.action=null}function Tp(n){n=n.listeners;for(var i=0;i<n.length;i++)(0,n[i])()}function Op(n,i){return i}function Rp(n,i){if(mt){var a=Mt.formState;if(a!==null){e:{var u=Ke;if(mt){if(qt){t:{for(var h=qt,p=br;h.nodeType!==8;){if(!p){h=null;break t}if(h=vr(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){qt=vr(h.nextSibling),u=h.data==="F!";break e}}Ei(u)}u=!1}u&&(i=a[0])}}return a=Dn(),a.memoizedState=a.baseState=i,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Op,lastRenderedState:i},a.queue=u,a=Qp.bind(null,Ke,u),u.dispatch=a,u=nf(!1),p=cf.bind(null,Ke,!1,u.queue),u=Dn(),h={state:i,dispatch:null,action:n,pending:null},u.queue=h,a=Qv.bind(null,Ke,h,p,a),h.dispatch=a,u.memoizedState=n,[i,a,!1]}function Mp(n){var i=rn();return Dp(i,Ct,n)}function Dp(n,i,a){if(i=ef(n,i,Op)[0],n=Ao(ri)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var u=Ka(i)}catch(w){throw w===Is?yo:w}else u=i;i=rn();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(Ke.flags|=2048,Gs(9,{destroy:void 0},Zv.bind(null,h,a),null)),[u,p,n]}function Zv(n,i){n.action=i}function Lp(n){var i=rn(),a=Ct;if(a!==null)return Dp(i,a,n);rn(),i=i.memoizedState,a=rn();var u=a.queue.dispatch;return a.memoizedState=n,[i,u,!1]}function Gs(n,i,a,u){return n={tag:n,create:a,deps:u,inst:i,next:null},i=Ke.updateQueue,i===null&&(i=Eo(),Ke.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=n.next=n:(u=a.next,a.next=n,n.next=u,i.lastEffect=n),n}function zp(){return rn().memoizedState}function jo(n,i,a,u){var h=Dn();Ke.flags|=n,h.memoizedState=Gs(1|i,{destroy:void 0},a,u===void 0?null:u)}function No(n,i,a,u){var h=rn();u=u===void 0?null:u;var p=h.memoizedState.inst;Ct!==null&&u!==null&&Jc(u,Ct.memoizedState.deps)?h.memoizedState=Gs(i,p,a,u):(Ke.flags|=n,h.memoizedState=Gs(1|i,p,a,u))}function Up(n,i){jo(8390656,8,n,i)}function sf(n,i){No(2048,8,n,i)}function Wv(n){Ke.flags|=4;var i=Ke.updateQueue;if(i===null)i=Eo(),Ke.updateQueue=i,i.events=[n];else{var a=i.events;a===null?i.events=[n]:a.push(n)}}function Pp(n){var i=rn().memoizedState;return Wv({ref:i,nextImpl:n}),function(){if((wt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function Bp(n,i){return No(4,2,n,i)}function Hp(n,i){return No(4,4,n,i)}function qp(n,i){if(typeof i=="function"){n=n();var a=i(n);return function(){typeof a=="function"?a():i(null)}}if(i!=null)return n=n(),i.current=n,function(){i.current=null}}function Ip(n,i,a){a=a!=null?a.concat([n]):null,No(4,4,qp.bind(null,i,n),a)}function af(){}function Fp(n,i){var a=rn();i=i===void 0?null:i;var u=a.memoizedState;return i!==null&&Jc(i,u[1])?u[0]:(a.memoizedState=[n,i],n)}function $p(n,i){var a=rn();i=i===void 0?null:i;var u=a.memoizedState;if(i!==null&&Jc(i,u[1]))return u[0];if(u=n(),ps){Vt(!0);try{n()}finally{Vt(!1)}}return a.memoizedState=[u,i],u}function lf(n,i,a){return a===void 0||(ni&1073741824)!==0&&(ht&261930)===0?n.memoizedState=i:(n.memoizedState=a,n=Vg(),Ke.lanes|=n,Di|=n,a)}function Vp(n,i,a,u){return Qn(a,i)?a:$s.current!==null?(n=lf(n,a,u),Qn(n,i)||(cn=!0),n):(ni&42)===0||(ni&1073741824)!==0&&(ht&261930)===0?(cn=!0,n.memoizedState=a):(n=Vg(),Ke.lanes|=n,Di|=n,i)}function Yp(n,i,a,u,h){var p=Q.p;Q.p=p!==0&&8>p?p:8;var w=V.T,_={};V.T=_,cf(n,!1,i,a);try{var H=h(),re=V.S;if(re!==null&&re(_,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var fe=Jv(H,u);Qa(n,i,fe,rr(n))}else Qa(n,i,u,rr(n))}catch(ye){Qa(n,i,{then:function(){},status:"rejected",reason:ye},rr())}finally{Q.p=p,w!==null&&_.types!==null&&(w.types=_.types),V.T=w}}function ew(){}function of(n,i,a,u){if(n.tag!==5)throw Error(s(476));var h=Gp(n).queue;Yp(n,h,i,X,a===null?ew:function(){return Jp(n),a(u)})}function Gp(n){var i=n.memoizedState;if(i!==null)return i;i={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ri,lastRenderedState:X},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ri,lastRenderedState:a},next:null},n.memoizedState=i,n=n.alternate,n!==null&&(n.memoizedState=i),i}function Jp(n){var i=Gp(n);i.next===null&&(i=n.alternate.memoizedState),Qa(n,i.next.queue,{},rr())}function uf(){return kn(ml)}function Xp(){return rn().memoizedState}function Kp(){return rn().memoizedState}function tw(n){for(var i=n.return;i!==null;){switch(i.tag){case 24:case 3:var a=rr();n=ji(a);var u=Ni(i,n,a);u!==null&&(Yn(u,i,a),Ya(u,i,a)),i={cache:Uc()},n.payload=i;return}i=i.return}}function nw(n,i,a){var u=rr();a={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},To(n)?Zp(i,a):(a=Cc(n,i,a,u),a!==null&&(Yn(a,n,u),Wp(a,i,u)))}function Qp(n,i,a){var u=rr();Qa(n,i,a,u)}function Qa(n,i,a,u){var h={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(To(n))Zp(i,h);else{var p=n.alternate;if(n.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var w=i.lastRenderedState,_=p(w,a);if(h.hasEagerState=!0,h.eagerState=_,Qn(_,w))return uo(n,i,h,0),Mt===null&&oo(),!1}catch{}finally{}if(a=Cc(n,i,h,u),a!==null)return Yn(a,n,u),Wp(a,i,u),!0}return!1}function cf(n,i,a,u){if(u={lane:2,revertLane:If(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},To(n)){if(i)throw Error(s(479))}else i=Cc(n,a,u,2),i!==null&&Yn(i,n,2)}function To(n){var i=n.alternate;return n===Ke||i!==null&&i===Ke}function Zp(n,i){Vs=_o=!0;var a=n.pending;a===null?i.next=i:(i.next=a.next,a.next=i),n.pending=i}function Wp(n,i,a){if((a&4194048)!==0){var u=i.lanes;u&=n.pendingLanes,a|=u,i.lanes=a,ct(n,a)}}var Za={readContext:kn,use:Co,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useLayoutEffect:Wt,useInsertionEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useSyncExternalStore:Wt,useId:Wt,useHostTransitionStatus:Wt,useFormState:Wt,useActionState:Wt,useOptimistic:Wt,useMemoCache:Wt,useCacheRefresh:Wt};Za.useEffectEvent=Wt;var eg={readContext:kn,use:Co,useCallback:function(n,i){return Dn().memoizedState=[n,i===void 0?null:i],n},useContext:kn,useEffect:Up,useImperativeHandle:function(n,i,a){a=a!=null?a.concat([n]):null,jo(4194308,4,qp.bind(null,i,n),a)},useLayoutEffect:function(n,i){return jo(4194308,4,n,i)},useInsertionEffect:function(n,i){jo(4,2,n,i)},useMemo:function(n,i){var a=Dn();i=i===void 0?null:i;var u=n();if(ps){Vt(!0);try{n()}finally{Vt(!1)}}return a.memoizedState=[u,i],u},useReducer:function(n,i,a){var u=Dn();if(a!==void 0){var h=a(i);if(ps){Vt(!0);try{a(i)}finally{Vt(!1)}}}else h=i;return u.memoizedState=u.baseState=h,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:h},u.queue=n,n=n.dispatch=nw.bind(null,Ke,n),[u.memoizedState,n]},useRef:function(n){var i=Dn();return n={current:n},i.memoizedState=n},useState:function(n){n=nf(n);var i=n.queue,a=Qp.bind(null,Ke,i);return i.dispatch=a,[n.memoizedState,a]},useDebugValue:af,useDeferredValue:function(n,i){var a=Dn();return lf(a,n,i)},useTransition:function(){var n=nf(!1);return n=Yp.bind(null,Ke,n.queue,!0,!1),Dn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,i,a){var u=Ke,h=Dn();if(mt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),Mt===null)throw Error(s(349));(ht&127)!==0||wp(u,i,a)}h.memoizedState=a;var p={value:a,getSnapshot:i};return h.queue=p,Up(_p.bind(null,u,p,n),[n]),u.flags|=2048,Gs(9,{destroy:void 0},Sp.bind(null,u,p,a,i),null),a},useId:function(){var n=Dn(),i=Mt.identifierPrefix;if(mt){var a=Hr,u=Br;a=(u&~(1<<32-Ze(u)-1)).toString(32)+a,i="_"+i+"R_"+a,a=ko++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Xv++,i="_"+i+"r_"+a.toString(32)+"_";return n.memoizedState=i},useHostTransitionStatus:uf,useFormState:Rp,useActionState:Rp,useOptimistic:function(n){var i=Dn();i.memoizedState=i.baseState=n;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=cf.bind(null,Ke,!0,a),a.dispatch=i,[n,i]},useMemoCache:Wc,useCacheRefresh:function(){return Dn().memoizedState=tw.bind(null,Ke)},useEffectEvent:function(n){var i=Dn(),a={impl:n};return i.memoizedState=a,function(){if((wt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},ff={readContext:kn,use:Co,useCallback:Fp,useContext:kn,useEffect:sf,useImperativeHandle:Ip,useInsertionEffect:Bp,useLayoutEffect:Hp,useMemo:$p,useReducer:Ao,useRef:zp,useState:function(){return Ao(ri)},useDebugValue:af,useDeferredValue:function(n,i){var a=rn();return Vp(a,Ct.memoizedState,n,i)},useTransition:function(){var n=Ao(ri)[0],i=rn().memoizedState;return[typeof n=="boolean"?n:Ka(n),i]},useSyncExternalStore:vp,useId:Xp,useHostTransitionStatus:uf,useFormState:Mp,useActionState:Mp,useOptimistic:function(n,i){var a=rn();return Cp(a,Ct,n,i)},useMemoCache:Wc,useCacheRefresh:Kp};ff.useEffectEvent=Pp;var tg={readContext:kn,use:Co,useCallback:Fp,useContext:kn,useEffect:sf,useImperativeHandle:Ip,useInsertionEffect:Bp,useLayoutEffect:Hp,useMemo:$p,useReducer:tf,useRef:zp,useState:function(){return tf(ri)},useDebugValue:af,useDeferredValue:function(n,i){var a=rn();return Ct===null?lf(a,n,i):Vp(a,Ct.memoizedState,n,i)},useTransition:function(){var n=tf(ri)[0],i=rn().memoizedState;return[typeof n=="boolean"?n:Ka(n),i]},useSyncExternalStore:vp,useId:Xp,useHostTransitionStatus:uf,useFormState:Lp,useActionState:Lp,useOptimistic:function(n,i){var a=rn();return Ct!==null?Cp(a,Ct,n,i):(a.baseState=n,[n,a.queue.dispatch])},useMemoCache:Wc,useCacheRefresh:Kp};tg.useEffectEvent=Pp;function hf(n,i,a,u){i=n.memoizedState,a=a(u,i),a=a==null?i:g({},i,a),n.memoizedState=a,n.lanes===0&&(n.updateQueue.baseState=a)}var df={enqueueSetState:function(n,i,a){n=n._reactInternals;var u=rr(),h=ji(u);h.payload=i,a!=null&&(h.callback=a),i=Ni(n,h,u),i!==null&&(Yn(i,n,u),Ya(i,n,u))},enqueueReplaceState:function(n,i,a){n=n._reactInternals;var u=rr(),h=ji(u);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=Ni(n,h,u),i!==null&&(Yn(i,n,u),Ya(i,n,u))},enqueueForceUpdate:function(n,i){n=n._reactInternals;var a=rr(),u=ji(a);u.tag=2,i!=null&&(u.callback=i),i=Ni(n,u,a),i!==null&&(Yn(i,n,a),Ya(i,n,a))}};function ng(n,i,a,u,h,p,w){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,p,w):i.prototype&&i.prototype.isPureReactComponent?!Pa(a,u)||!Pa(h,p):!0}function rg(n,i,a,u){n=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,u),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,u),i.state!==n&&df.enqueueReplaceState(i,i.state,null)}function gs(n,i){var a=i;if("ref"in i){a={};for(var u in i)u!=="ref"&&(a[u]=i[u])}if(n=n.defaultProps){a===i&&(a=g({},a));for(var h in n)a[h]===void 0&&(a[h]=n[h])}return a}function ig(n){lo(n)}function sg(n){console.error(n)}function ag(n){lo(n)}function Oo(n,i){try{var a=n.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(u){setTimeout(function(){throw u})}}function lg(n,i,a){try{var u=n.onCaughtError;u(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function mf(n,i,a){return a=ji(a),a.tag=3,a.payload={element:null},a.callback=function(){Oo(n,i)},a}function og(n){return n=ji(n),n.tag=3,n}function ug(n,i,a,u){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=u.value;n.payload=function(){return h(p)},n.callback=function(){lg(i,a,u)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(n.callback=function(){lg(i,a,u),typeof h!="function"&&(Li===null?Li=new Set([this]):Li.add(this));var _=u.stack;this.componentDidCatch(u.value,{componentStack:_!==null?_:""})})}function rw(n,i,a,u,h){if(a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(i=a.alternate,i!==null&&Bs(i,a,h,!0),a=Wn.current,a!==null){switch(a.tag){case 31:case 13:return xr===null?Fo():a.alternate===null&&en===0&&(en=3),a.flags&=-257,a.flags|=65536,a.lanes=h,u===bo?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([u]):i.add(u),Bf(n,u,h)),!1;case 22:return a.flags|=65536,u===bo?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([u])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([u]):a.add(u)),Bf(n,u,h)),!1}throw Error(s(435,a.tag))}return Bf(n,u,h),Fo(),!1}if(mt)return i=Wn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,u!==Rc&&(n=Error(s(422),{cause:u}),qa(pr(n,a)))):(u!==Rc&&(i=Error(s(423),{cause:u}),qa(pr(i,a))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,u=pr(u,a),h=mf(n.stateNode,u,h),Fc(n,h),en!==4&&(en=2)),!1;var p=Error(s(520),{cause:u});if(p=pr(p,a),al===null?al=[p]:al.push(p),en!==4&&(en=2),i===null)return!0;u=pr(u,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,n=h&-h,a.lanes|=n,n=mf(a.stateNode,u,n),Fc(a,n),!1;case 1:if(i=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Li===null||!Li.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=og(h),ug(h,n,a,u),Fc(a,h),!1}a=a.return}while(a!==null);return!1}var pf=Error(s(461)),cn=!1;function En(n,i,a,u){i.child=n===null?dp(i,null,a,u):ms(i,n.child,a,u)}function cg(n,i,a,u,h){a=a.render;var p=i.ref;if("ref"in u){var w={};for(var _ in u)_!=="ref"&&(w[_]=u[_])}else w=u;return cs(i),u=Xc(n,i,a,w,p,h),_=Kc(),n!==null&&!cn?(Qc(n,i,h),ii(n,i,h)):(mt&&_&&Tc(i),i.flags|=1,En(n,i,u,h),i.child)}function fg(n,i,a,u,h){if(n===null){var p=a.type;return typeof p=="function"&&!Ac(p)&&p.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=p,hg(n,i,p,u,h)):(n=fo(a.type,null,u,i,i.mode,h),n.ref=i.ref,n.return=i,i.child=n)}if(p=n.child,!_f(n,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:Pa,a(w,u)&&n.ref===i.ref)return ii(n,i,h)}return i.flags|=1,n=Zr(p,u),n.ref=i.ref,n.return=i,i.child=n}function hg(n,i,a,u,h){if(n!==null){var p=n.memoizedProps;if(Pa(p,u)&&n.ref===i.ref)if(cn=!1,i.pendingProps=u=p,_f(n,h))(n.flags&131072)!==0&&(cn=!0);else return i.lanes=n.lanes,ii(n,i,h)}return gf(n,i,a,u,h)}function dg(n,i,a,u){var h=u.children,p=n!==null?n.memoizedState:null;if(n===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((i.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,n!==null){for(u=i.child=n.child,h=0;u!==null;)h=h|u.lanes|u.childLanes,u=u.sibling;u=h&~p}else u=0,i.child=null;return mg(n,i,p,a,u)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},n!==null&&go(i,p!==null?p.cachePool:null),p!==null?gp(i,p):Vc(),yp(i);else return u=i.lanes=536870912,mg(n,i,p!==null?p.baseLanes|a:a,a,u)}else p!==null?(go(i,p.cachePool),gp(i,p),Oi(),i.memoizedState=null):(n!==null&&go(i,null),Vc(),Oi());return En(n,i,h,a),i.child}function Wa(n,i){return n!==null&&n.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function mg(n,i,a,u,h){var p=Bc();return p=p===null?null:{parent:on._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},n!==null&&go(i,null),Vc(),yp(i),n!==null&&Bs(n,i,u,!0),i.childLanes=h,null}function Ro(n,i){return i=Do({mode:i.mode,children:i.children},n.mode),i.ref=n.ref,n.child=i,i.return=n,i}function pg(n,i,a){return ms(i,n.child,null,a),n=Ro(i,i.pendingProps),n.flags|=2,er(i),i.memoizedState=null,n}function iw(n,i,a){var u=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,n===null){if(mt){if(u.mode==="hidden")return n=Ro(i,u),i.lanes=536870912,Wa(null,n);if(Gc(i),(n=qt)?(n=Ay(n,br),n=n!==null&&n.data==="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:_i!==null?{id:Br,overflow:Hr}:null,retryLane:536870912,hydrationErrors:null},a=Zm(n),a.return=i,i.child=a,_n=i,qt=null)):n=null,n===null)throw Ei(i);return i.lanes=536870912,null}return Ro(i,u)}var p=n.memoizedState;if(p!==null){var w=p.dehydrated;if(Gc(i),h)if(i.flags&256)i.flags&=-257,i=pg(n,i,a);else if(i.memoizedState!==null)i.child=n.child,i.flags|=128,i=null;else throw Error(s(558));else if(cn||Bs(n,i,a,!1),h=(a&n.childLanes)!==0,cn||h){if(u=Mt,u!==null&&(w=Xe(u,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,as(n,w),Yn(u,n,w),pf;Fo(),i=pg(n,i,a)}else n=p.treeContext,qt=vr(w.nextSibling),_n=i,mt=!0,ki=null,br=!1,n!==null&&tp(i,n),i=Ro(i,u),i.flags|=4096;return i}return n=Zr(n.child,{mode:u.mode,children:u.children}),n.ref=i.ref,i.child=n,n.return=i,n}function Mo(n,i){var a=i.ref;if(a===null)n!==null&&n.ref!==null&&(i.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(n===null||n.ref!==a)&&(i.flags|=4194816)}}function gf(n,i,a,u,h){return cs(i),a=Xc(n,i,a,u,void 0,h),u=Kc(),n!==null&&!cn?(Qc(n,i,h),ii(n,i,h)):(mt&&u&&Tc(i),i.flags|=1,En(n,i,a,h),i.child)}function gg(n,i,a,u,h,p){return cs(i),i.updateQueue=null,a=xp(i,u,a,h),bp(n),u=Kc(),n!==null&&!cn?(Qc(n,i,p),ii(n,i,p)):(mt&&u&&Tc(i),i.flags|=1,En(n,i,a,p),i.child)}function yg(n,i,a,u,h){if(cs(i),i.stateNode===null){var p=Ls,w=a.contextType;typeof w=="object"&&w!==null&&(p=kn(w)),p=new a(u,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=df,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=u,p.state=i.memoizedState,p.refs={},qc(i),w=a.contextType,p.context=typeof w=="object"&&w!==null?kn(w):Ls,p.state=i.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(hf(i,a,w,u),p.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&df.enqueueReplaceState(p,p.state,null),Ja(i,u,p,h),Ga(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),u=!0}else if(n===null){p=i.stateNode;var _=i.memoizedProps,H=gs(a,_);p.props=H;var re=p.context,fe=a.contextType;w=Ls,typeof fe=="object"&&fe!==null&&(w=kn(fe));var ye=a.getDerivedStateFromProps;fe=typeof ye=="function"||typeof p.getSnapshotBeforeUpdate=="function",_=i.pendingProps!==_,fe||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(_||re!==w)&&rg(i,p,u,w),Ai=!1;var ie=i.memoizedState;p.state=ie,Ja(i,u,p,h),Ga(),re=i.memoizedState,_||ie!==re||Ai?(typeof ye=="function"&&(hf(i,a,ye,u),re=i.memoizedState),(H=Ai||ng(i,a,H,u,ie,re,w))?(fe||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(i.flags|=4194308)):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=u,i.memoizedState=re),p.props=u,p.state=re,p.context=w,u=H):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),u=!1)}else{p=i.stateNode,Ic(n,i),w=i.memoizedProps,fe=gs(a,w),p.props=fe,ye=i.pendingProps,ie=p.context,re=a.contextType,H=Ls,typeof re=="object"&&re!==null&&(H=kn(re)),_=a.getDerivedStateFromProps,(re=typeof _=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ye||ie!==H)&&rg(i,p,u,H),Ai=!1,ie=i.memoizedState,p.state=ie,Ja(i,u,p,h),Ga();var oe=i.memoizedState;w!==ye||ie!==oe||Ai||n!==null&&n.dependencies!==null&&mo(n.dependencies)?(typeof _=="function"&&(hf(i,a,_,u),oe=i.memoizedState),(fe=Ai||ng(i,a,fe,u,ie,oe,H)||n!==null&&n.dependencies!==null&&mo(n.dependencies))?(re||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(u,oe,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(u,oe,H)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===n.memoizedProps&&ie===n.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===n.memoizedProps&&ie===n.memoizedState||(i.flags|=1024),i.memoizedProps=u,i.memoizedState=oe),p.props=u,p.state=oe,p.context=H,u=fe):(typeof p.componentDidUpdate!="function"||w===n.memoizedProps&&ie===n.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===n.memoizedProps&&ie===n.memoizedState||(i.flags|=1024),u=!1)}return p=u,Mo(n,i),u=(i.flags&128)!==0,p||u?(p=i.stateNode,a=u&&typeof a.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,n!==null&&u?(i.child=ms(i,n.child,null,h),i.child=ms(i,null,a,h)):En(n,i,a,h),i.memoizedState=p.state,n=i.child):n=ii(n,i,h),n}function bg(n,i,a,u){return os(),i.flags|=256,En(n,i,a,u),i.child}var yf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bf(n){return{baseLanes:n,cachePool:lp()}}function xf(n,i,a){return n=n!==null?n.childLanes&~a:0,i&&(n|=nr),n}function xg(n,i,a){var u=i.pendingProps,h=!1,p=(i.flags&128)!==0,w;if((w=p)||(w=n!==null&&n.memoizedState===null?!1:(nn.current&2)!==0),w&&(h=!0,i.flags&=-129),w=(i.flags&32)!==0,i.flags&=-33,n===null){if(mt){if(h?Ti(i):Oi(),(n=qt)?(n=Ay(n,br),n=n!==null&&n.data!=="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:_i!==null?{id:Br,overflow:Hr}:null,retryLane:536870912,hydrationErrors:null},a=Zm(n),a.return=i,i.child=a,_n=i,qt=null)):n=null,n===null)throw Ei(i);return th(n)?i.lanes=32:i.lanes=536870912,null}var _=u.children;return u=u.fallback,h?(Oi(),h=i.mode,_=Do({mode:"hidden",children:_},h),u=ls(u,h,a,null),_.return=i,u.return=i,_.sibling=u,i.child=_,u=i.child,u.memoizedState=bf(a),u.childLanes=xf(n,w,a),i.memoizedState=yf,Wa(null,u)):(Ti(i),vf(i,_))}var H=n.memoizedState;if(H!==null&&(_=H.dehydrated,_!==null)){if(p)i.flags&256?(Ti(i),i.flags&=-257,i=wf(n,i,a)):i.memoizedState!==null?(Oi(),i.child=n.child,i.flags|=128,i=null):(Oi(),_=u.fallback,h=i.mode,u=Do({mode:"visible",children:u.children},h),_=ls(_,h,a,null),_.flags|=2,u.return=i,_.return=i,u.sibling=_,i.child=u,ms(i,n.child,null,a),u=i.child,u.memoizedState=bf(a),u.childLanes=xf(n,w,a),i.memoizedState=yf,i=Wa(null,u));else if(Ti(i),th(_)){if(w=_.nextSibling&&_.nextSibling.dataset,w)var re=w.dgst;w=re,u=Error(s(419)),u.stack="",u.digest=w,qa({value:u,source:null,stack:null}),i=wf(n,i,a)}else if(cn||Bs(n,i,a,!1),w=(a&n.childLanes)!==0,cn||w){if(w=Mt,w!==null&&(u=Xe(w,a),u!==0&&u!==H.retryLane))throw H.retryLane=u,as(n,u),Yn(w,n,u),pf;eh(_)||Fo(),i=wf(n,i,a)}else eh(_)?(i.flags|=192,i.child=n.child,i=null):(n=H.treeContext,qt=vr(_.nextSibling),_n=i,mt=!0,ki=null,br=!1,n!==null&&tp(i,n),i=vf(i,u.children),i.flags|=4096);return i}return h?(Oi(),_=u.fallback,h=i.mode,H=n.child,re=H.sibling,u=Zr(H,{mode:"hidden",children:u.children}),u.subtreeFlags=H.subtreeFlags&65011712,re!==null?_=Zr(re,_):(_=ls(_,h,a,null),_.flags|=2),_.return=i,u.return=i,u.sibling=_,i.child=u,Wa(null,u),u=i.child,_=n.child.memoizedState,_===null?_=bf(a):(h=_.cachePool,h!==null?(H=on._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=lp(),_={baseLanes:_.baseLanes|a,cachePool:h}),u.memoizedState=_,u.childLanes=xf(n,w,a),i.memoizedState=yf,Wa(n.child,u)):(Ti(i),a=n.child,n=a.sibling,a=Zr(a,{mode:"visible",children:u.children}),a.return=i,a.sibling=null,n!==null&&(w=i.deletions,w===null?(i.deletions=[n],i.flags|=16):w.push(n)),i.child=a,i.memoizedState=null,a)}function vf(n,i){return i=Do({mode:"visible",children:i},n.mode),i.return=n,n.child=i}function Do(n,i){return n=Zn(22,n,null,i),n.lanes=0,n}function wf(n,i,a){return ms(i,n.child,null,a),n=vf(i,i.pendingProps.children),n.flags|=2,i.memoizedState=null,n}function vg(n,i,a){n.lanes|=i;var u=n.alternate;u!==null&&(u.lanes|=i),Lc(n.return,i,a)}function Sf(n,i,a,u,h,p){var w=n.memoizedState;w===null?n.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:u,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=i,w.rendering=null,w.renderingStartTime=0,w.last=u,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function wg(n,i,a){var u=i.pendingProps,h=u.revealOrder,p=u.tail;u=u.children;var w=nn.current,_=(w&2)!==0;if(_?(w=w&1|2,i.flags|=128):w&=1,T(nn,w),En(n,i,u,a),u=mt?Ha:0,!_&&n!==null&&(n.flags&128)!==0)e:for(n=i.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&vg(n,a,i);else if(n.tag===19)vg(n,a,i);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===i)break e;for(;n.sibling===null;){if(n.return===null||n.return===i)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(h){case"forwards":for(a=i.child,h=null;a!==null;)n=a.alternate,n!==null&&So(n)===null&&(h=a),a=a.sibling;a=h,a===null?(h=i.child,i.child=null):(h=a.sibling,a.sibling=null),Sf(i,!1,h,a,p,u);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=i.child,i.child=null;h!==null;){if(n=h.alternate,n!==null&&So(n)===null){i.child=h;break}n=h.sibling,h.sibling=a,a=h,h=n}Sf(i,!0,a,null,p,u);break;case"together":Sf(i,!1,null,null,void 0,u);break;default:i.memoizedState=null}return i.child}function ii(n,i,a){if(n!==null&&(i.dependencies=n.dependencies),Di|=i.lanes,(a&i.childLanes)===0)if(n!==null){if(Bs(n,i,a,!1),(a&i.childLanes)===0)return null}else return null;if(n!==null&&i.child!==n.child)throw Error(s(153));if(i.child!==null){for(n=i.child,a=Zr(n,n.pendingProps),i.child=a,a.return=i;n.sibling!==null;)n=n.sibling,a=a.sibling=Zr(n,n.pendingProps),a.return=i;a.sibling=null}return i.child}function _f(n,i){return(n.lanes&i)!==0?!0:(n=n.dependencies,!!(n!==null&&mo(n)))}function sw(n,i,a){switch(i.tag){case 3:Ae(i,i.stateNode.containerInfo),Ci(i,on,n.memoizedState.cache),os();break;case 27:case 5:Qe(i);break;case 4:Ae(i,i.stateNode.containerInfo);break;case 10:Ci(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Gc(i),null;break;case 13:var u=i.memoizedState;if(u!==null)return u.dehydrated!==null?(Ti(i),i.flags|=128,null):(a&i.child.childLanes)!==0?xg(n,i,a):(Ti(i),n=ii(n,i,a),n!==null?n.sibling:null);Ti(i);break;case 19:var h=(n.flags&128)!==0;if(u=(a&i.childLanes)!==0,u||(Bs(n,i,a,!1),u=(a&i.childLanes)!==0),h){if(u)return wg(n,i,a);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),T(nn,nn.current),u)break;return null;case 22:return i.lanes=0,dg(n,i,a,i.pendingProps);case 24:Ci(i,on,n.memoizedState.cache)}return ii(n,i,a)}function Sg(n,i,a){if(n!==null)if(n.memoizedProps!==i.pendingProps)cn=!0;else{if(!_f(n,a)&&(i.flags&128)===0)return cn=!1,sw(n,i,a);cn=(n.flags&131072)!==0}else cn=!1,mt&&(i.flags&1048576)!==0&&ep(i,Ha,i.index);switch(i.lanes=0,i.tag){case 16:e:{var u=i.pendingProps;if(n=hs(i.elementType),i.type=n,typeof n=="function")Ac(n)?(u=gs(n,u),i.tag=1,i=yg(null,i,n,u,a)):(i.tag=0,i=gf(null,i,n,u,a));else{if(n!=null){var h=n.$$typeof;if(h===ue){i.tag=11,i=cg(null,i,n,u,a);break e}else if(h===ee){i.tag=14,i=fg(null,i,n,u,a);break e}}throw i=le(n)||n,Error(s(306,i,""))}}return i;case 0:return gf(n,i,i.type,i.pendingProps,a);case 1:return u=i.type,h=gs(u,i.pendingProps),yg(n,i,u,h,a);case 3:e:{if(Ae(i,i.stateNode.containerInfo),n===null)throw Error(s(387));u=i.pendingProps;var p=i.memoizedState;h=p.element,Ic(n,i),Ja(i,u,null,a);var w=i.memoizedState;if(u=w.cache,Ci(i,on,u),u!==p.cache&&zc(i,[on],a,!0),Ga(),u=w.element,p.isDehydrated)if(p={element:u,isDehydrated:!1,cache:w.cache},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){i=bg(n,i,u,a);break e}else if(u!==h){h=pr(Error(s(424)),i),qa(h),i=bg(n,i,u,a);break e}else{switch(n=i.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(qt=vr(n.firstChild),_n=i,mt=!0,ki=null,br=!0,a=dp(i,null,u,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(os(),u===h){i=ii(n,i,a);break e}En(n,i,u,a)}i=i.child}return i;case 26:return Mo(n,i),n===null?(a=My(i.type,null,i.pendingProps,null))?i.memoizedState=a:mt||(a=i.type,n=i.pendingProps,u=Ko(Ne.current).createElement(a),u[ft]=i,u[Bt]=n,Cn(u,a,n),F(u),i.stateNode=u):i.memoizedState=My(i.type,n.memoizedProps,i.pendingProps,n.memoizedState),null;case 27:return Qe(i),n===null&&mt&&(u=i.stateNode=Ty(i.type,i.pendingProps,Ne.current),_n=i,br=!0,h=qt,Bi(i.type)?(nh=h,qt=vr(u.firstChild)):qt=h),En(n,i,i.pendingProps.children,a),Mo(n,i),n===null&&(i.flags|=4194304),i.child;case 5:return n===null&&mt&&((h=u=qt)&&(u=Lw(u,i.type,i.pendingProps,br),u!==null?(i.stateNode=u,_n=i,qt=vr(u.firstChild),br=!1,h=!0):h=!1),h||Ei(i)),Qe(i),h=i.type,p=i.pendingProps,w=n!==null?n.memoizedProps:null,u=p.children,Qf(h,p)?u=null:w!==null&&Qf(h,w)&&(i.flags|=32),i.memoizedState!==null&&(h=Xc(n,i,Kv,null,null,a),ml._currentValue=h),Mo(n,i),En(n,i,u,a),i.child;case 6:return n===null&&mt&&((n=a=qt)&&(a=zw(a,i.pendingProps,br),a!==null?(i.stateNode=a,_n=i,qt=null,n=!0):n=!1),n||Ei(i)),null;case 13:return xg(n,i,a);case 4:return Ae(i,i.stateNode.containerInfo),u=i.pendingProps,n===null?i.child=ms(i,null,u,a):En(n,i,u,a),i.child;case 11:return cg(n,i,i.type,i.pendingProps,a);case 7:return En(n,i,i.pendingProps,a),i.child;case 8:return En(n,i,i.pendingProps.children,a),i.child;case 12:return En(n,i,i.pendingProps.children,a),i.child;case 10:return u=i.pendingProps,Ci(i,i.type,u.value),En(n,i,u.children,a),i.child;case 9:return h=i.type._context,u=i.pendingProps.children,cs(i),h=kn(h),u=u(h),i.flags|=1,En(n,i,u,a),i.child;case 14:return fg(n,i,i.type,i.pendingProps,a);case 15:return hg(n,i,i.type,i.pendingProps,a);case 19:return wg(n,i,a);case 31:return iw(n,i,a);case 22:return dg(n,i,a,i.pendingProps);case 24:return cs(i),u=kn(on),n===null?(h=Bc(),h===null&&(h=Mt,p=Uc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),i.memoizedState={parent:u,cache:h},qc(i),Ci(i,on,h)):((n.lanes&a)!==0&&(Ic(n,i),Ja(i,null,null,a),Ga()),h=n.memoizedState,p=i.memoizedState,h.parent!==u?(h={parent:u,cache:u},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),Ci(i,on,u)):(u=p.cache,Ci(i,on,u),u!==h.cache&&zc(i,[on],a,!0))),En(n,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function si(n){n.flags|=4}function kf(n,i,a,u,h){if((i=(n.mode&32)!==0)&&(i=!1),i){if(n.flags|=16777216,(h&335544128)===h)if(n.stateNode.complete)n.flags|=8192;else if(Xg())n.flags|=8192;else throw ds=bo,Hc}else n.flags&=-16777217}function _g(n,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Py(i))if(Xg())n.flags|=8192;else throw ds=bo,Hc}function Lo(n,i){i!==null&&(n.flags|=4),n.flags&16384&&(i=n.tag!==22?de():536870912,n.lanes|=i,Qs|=i)}function el(n,i){if(!mt)switch(n.tailMode){case"hidden":i=n.tail;for(var a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?n.tail=null:a.sibling=null;break;case"collapsed":a=n.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?i||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function It(n){var i=n.alternate!==null&&n.alternate.child===n.child,a=0,u=0;if(i)for(var h=n.child;h!==null;)a|=h.lanes|h.childLanes,u|=h.subtreeFlags&65011712,u|=h.flags&65011712,h.return=n,h=h.sibling;else for(h=n.child;h!==null;)a|=h.lanes|h.childLanes,u|=h.subtreeFlags,u|=h.flags,h.return=n,h=h.sibling;return n.subtreeFlags|=u,n.childLanes=a,i}function aw(n,i,a){var u=i.pendingProps;switch(Oc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return It(i),null;case 1:return It(i),null;case 3:return a=i.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),ti(on),ke(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(n===null||n.child===null)&&(Ps(i)?si(i):n===null||n.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Mc())),It(i),null;case 26:var h=i.type,p=i.memoizedState;return n===null?(si(i),p!==null?(It(i),_g(i,p)):(It(i),kf(i,h,null,u,a))):p?p!==n.memoizedState?(si(i),It(i),_g(i,p)):(It(i),i.flags&=-16777217):(n=n.memoizedProps,n!==u&&si(i),It(i),kf(i,h,n,u,a)),null;case 27:if(Lt(i),a=Ne.current,h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==u&&si(i);else{if(!u){if(i.stateNode===null)throw Error(s(166));return It(i),null}n=ve.current,Ps(i)?np(i):(n=Ty(h,u,a),i.stateNode=n,si(i))}return It(i),null;case 5:if(Lt(i),h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==u&&si(i);else{if(!u){if(i.stateNode===null)throw Error(s(166));return It(i),null}if(p=ve.current,Ps(i))np(i);else{var w=Ko(Ne.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof u.is=="string"?w.createElement("select",{is:u.is}):w.createElement("select"),u.multiple?p.multiple=!0:u.size&&(p.size=u.size);break;default:p=typeof u.is=="string"?w.createElement(h,{is:u.is}):w.createElement(h)}}p[ft]=i,p[Bt]=u;e:for(w=i.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===i)break e;for(;w.sibling===null;){if(w.return===null||w.return===i)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}i.stateNode=p;e:switch(Cn(p,h,u),h){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&si(i)}}return It(i),kf(i,i.type,n===null?null:n.memoizedProps,i.pendingProps,a),null;case 6:if(n&&i.stateNode!=null)n.memoizedProps!==u&&si(i);else{if(typeof u!="string"&&i.stateNode===null)throw Error(s(166));if(n=Ne.current,Ps(i)){if(n=i.stateNode,a=i.memoizedProps,u=null,h=_n,h!==null)switch(h.tag){case 27:case 5:u=h.memoizedProps}n[ft]=i,n=!!(n.nodeValue===a||u!==null&&u.suppressHydrationWarning===!0||xy(n.nodeValue,a)),n||Ei(i,!0)}else n=Ko(n).createTextNode(u),n[ft]=i,i.stateNode=n}return It(i),null;case 31:if(a=i.memoizedState,n===null||n.memoizedState!==null){if(u=Ps(i),a!==null){if(n===null){if(!u)throw Error(s(318));if(n=i.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[ft]=i}else os(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;It(i),n=!1}else a=Mc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),n=!0;if(!n)return i.flags&256?(er(i),i):(er(i),null);if((i.flags&128)!==0)throw Error(s(558))}return It(i),null;case 13:if(u=i.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=Ps(i),u!==null&&u.dehydrated!==null){if(n===null){if(!h)throw Error(s(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(s(317));h[ft]=i}else os(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;It(i),h=!1}else h=Mc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(er(i),i):(er(i),null)}return er(i),(i.flags&128)!==0?(i.lanes=a,i):(a=u!==null,n=n!==null&&n.memoizedState!==null,a&&(u=i.child,h=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(h=u.alternate.memoizedState.cachePool.pool),p=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),p!==h&&(u.flags|=2048)),a!==n&&a&&(i.child.flags|=8192),Lo(i,i.updateQueue),It(i),null);case 4:return ke(),n===null&&Yf(i.stateNode.containerInfo),It(i),null;case 10:return ti(i.type),It(i),null;case 19:if(W(nn),u=i.memoizedState,u===null)return It(i),null;if(h=(i.flags&128)!==0,p=u.rendering,p===null)if(h)el(u,!1);else{if(en!==0||n!==null&&(n.flags&128)!==0)for(n=i.child;n!==null;){if(p=So(n),p!==null){for(i.flags|=128,el(u,!1),n=p.updateQueue,i.updateQueue=n,Lo(i,n),i.subtreeFlags=0,n=a,a=i.child;a!==null;)Qm(a,n),a=a.sibling;return T(nn,nn.current&1|2),mt&&Wr(i,u.treeForkCount),i.child}n=n.sibling}u.tail!==null&&at()>Ho&&(i.flags|=128,h=!0,el(u,!1),i.lanes=4194304)}else{if(!h)if(n=So(p),n!==null){if(i.flags|=128,h=!0,n=n.updateQueue,i.updateQueue=n,Lo(i,n),el(u,!0),u.tail===null&&u.tailMode==="hidden"&&!p.alternate&&!mt)return It(i),null}else 2*at()-u.renderingStartTime>Ho&&a!==536870912&&(i.flags|=128,h=!0,el(u,!1),i.lanes=4194304);u.isBackwards?(p.sibling=i.child,i.child=p):(n=u.last,n!==null?n.sibling=p:i.child=p,u.last=p)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=at(),n.sibling=null,a=nn.current,T(nn,h?a&1|2:a&1),mt&&Wr(i,u.treeForkCount),n):(It(i),null);case 22:case 23:return er(i),Yc(),u=i.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(i.flags|=8192):u&&(i.flags|=8192),u?(a&536870912)!==0&&(i.flags&128)===0&&(It(i),i.subtreeFlags&6&&(i.flags|=8192)):It(i),a=i.updateQueue,a!==null&&Lo(i,a.retryQueue),a=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),u=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),u!==a&&(i.flags|=2048),n!==null&&W(fs),null;case 24:return a=null,n!==null&&(a=n.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),ti(on),It(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function lw(n,i){switch(Oc(i),i.tag){case 1:return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 3:return ti(on),ke(),n=i.flags,(n&65536)!==0&&(n&128)===0?(i.flags=n&-65537|128,i):null;case 26:case 27:case 5:return Lt(i),null;case 31:if(i.memoizedState!==null){if(er(i),i.alternate===null)throw Error(s(340));os()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 13:if(er(i),n=i.memoizedState,n!==null&&n.dehydrated!==null){if(i.alternate===null)throw Error(s(340));os()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 19:return W(nn),null;case 4:return ke(),null;case 10:return ti(i.type),null;case 22:case 23:return er(i),Yc(),n!==null&&W(fs),n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 24:return ti(on),null;case 25:return null;default:return null}}function kg(n,i){switch(Oc(i),i.tag){case 3:ti(on),ke();break;case 26:case 27:case 5:Lt(i);break;case 4:ke();break;case 31:i.memoizedState!==null&&er(i);break;case 13:er(i);break;case 19:W(nn);break;case 10:ti(i.type);break;case 22:case 23:er(i),Yc(),n!==null&&W(fs);break;case 24:ti(on)}}function tl(n,i){try{var a=i.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var h=u.next;a=h;do{if((a.tag&n)===n){u=void 0;var p=a.create,w=a.inst;u=p(),w.destroy=u}a=a.next}while(a!==h)}}catch(_){Et(i,i.return,_)}}function Ri(n,i,a){try{var u=i.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var p=h.next;u=p;do{if((u.tag&n)===n){var w=u.inst,_=w.destroy;if(_!==void 0){w.destroy=void 0,h=i;var H=a,re=_;try{re()}catch(fe){Et(h,H,fe)}}}u=u.next}while(u!==p)}}catch(fe){Et(i,i.return,fe)}}function Eg(n){var i=n.updateQueue;if(i!==null){var a=n.stateNode;try{pp(i,a)}catch(u){Et(n,n.return,u)}}}function Cg(n,i,a){a.props=gs(n.type,n.memoizedProps),a.state=n.memoizedState;try{a.componentWillUnmount()}catch(u){Et(n,i,u)}}function nl(n,i){try{var a=n.ref;if(a!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:u=n.stateNode;break;default:u=n.stateNode}typeof a=="function"?n.refCleanup=a(u):a.current=u}}catch(h){Et(n,i,h)}}function qr(n,i){var a=n.ref,u=n.refCleanup;if(a!==null)if(typeof u=="function")try{u()}catch(h){Et(n,i,h)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){Et(n,i,h)}else a.current=null}function Ag(n){var i=n.type,a=n.memoizedProps,u=n.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":a.autoFocus&&u.focus();break e;case"img":a.src?u.src=a.src:a.srcSet&&(u.srcset=a.srcSet)}}catch(h){Et(n,n.return,h)}}function Ef(n,i,a){try{var u=n.stateNode;Nw(u,n.type,a,i),u[Bt]=i}catch(h){Et(n,n.return,h)}}function jg(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Bi(n.type)||n.tag===4}function Cf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||jg(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Bi(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Af(n,i,a){var u=n.tag;if(u===5||u===6)n=n.stateNode,i?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(n,i):(i=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,i.appendChild(n),a=a._reactRootContainer,a!=null||i.onclick!==null||(i.onclick=Kr));else if(u!==4&&(u===27&&Bi(n.type)&&(a=n.stateNode,i=null),n=n.child,n!==null))for(Af(n,i,a),n=n.sibling;n!==null;)Af(n,i,a),n=n.sibling}function zo(n,i,a){var u=n.tag;if(u===5||u===6)n=n.stateNode,i?a.insertBefore(n,i):a.appendChild(n);else if(u!==4&&(u===27&&Bi(n.type)&&(a=n.stateNode),n=n.child,n!==null))for(zo(n,i,a),n=n.sibling;n!==null;)zo(n,i,a),n=n.sibling}function Ng(n){var i=n.stateNode,a=n.memoizedProps;try{for(var u=n.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);Cn(i,u,a),i[ft]=n,i[Bt]=a}catch(p){Et(n,n.return,p)}}var ai=!1,fn=!1,jf=!1,Tg=typeof WeakSet=="function"?WeakSet:Set,xn=null;function ow(n,i){if(n=n.containerInfo,Xf=ru,n=Im(n),vc(n)){if("selectionStart"in n)var a={start:n.selectionStart,end:n.selectionEnd};else e:{a=(a=n.ownerDocument)&&a.defaultView||window;var u=a.getSelection&&a.getSelection();if(u&&u.rangeCount!==0){a=u.anchorNode;var h=u.anchorOffset,p=u.focusNode;u=u.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,_=-1,H=-1,re=0,fe=0,ye=n,ie=null;t:for(;;){for(var oe;ye!==a||h!==0&&ye.nodeType!==3||(_=w+h),ye!==p||u!==0&&ye.nodeType!==3||(H=w+u),ye.nodeType===3&&(w+=ye.nodeValue.length),(oe=ye.firstChild)!==null;)ie=ye,ye=oe;for(;;){if(ye===n)break t;if(ie===a&&++re===h&&(_=w),ie===p&&++fe===u&&(H=w),(oe=ye.nextSibling)!==null)break;ye=ie,ie=ye.parentNode}ye=oe}a=_===-1||H===-1?null:{start:_,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Kf={focusedElem:n,selectionRange:a},ru=!1,xn=i;xn!==null;)if(i=xn,n=i.child,(i.subtreeFlags&1028)!==0&&n!==null)n.return=i,xn=n;else for(;xn!==null;){switch(i=xn,p=i.alternate,n=i.flags,i.tag){case 0:if((n&4)!==0&&(n=i.updateQueue,n=n!==null?n.events:null,n!==null))for(a=0;a<n.length;a++)h=n[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&p!==null){n=void 0,a=i,h=p.memoizedProps,p=p.memoizedState,u=a.stateNode;try{var ze=gs(a.type,h);n=u.getSnapshotBeforeUpdate(ze,p),u.__reactInternalSnapshotBeforeUpdate=n}catch($e){Et(a,a.return,$e)}}break;case 3:if((n&1024)!==0){if(n=i.stateNode.containerInfo,a=n.nodeType,a===9)Wf(n);else if(a===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Wf(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(s(163))}if(n=i.sibling,n!==null){n.return=i.return,xn=n;break}xn=i.return}}function Og(n,i,a){var u=a.flags;switch(a.tag){case 0:case 11:case 15:oi(n,a),u&4&&tl(5,a);break;case 1:if(oi(n,a),u&4)if(n=a.stateNode,i===null)try{n.componentDidMount()}catch(w){Et(a,a.return,w)}else{var h=gs(a.type,i.memoizedProps);i=i.memoizedState;try{n.componentDidUpdate(h,i,n.__reactInternalSnapshotBeforeUpdate)}catch(w){Et(a,a.return,w)}}u&64&&Eg(a),u&512&&nl(a,a.return);break;case 3:if(oi(n,a),u&64&&(n=a.updateQueue,n!==null)){if(i=null,a.child!==null)switch(a.child.tag){case 27:case 5:i=a.child.stateNode;break;case 1:i=a.child.stateNode}try{pp(n,i)}catch(w){Et(a,a.return,w)}}break;case 27:i===null&&u&4&&Ng(a);case 26:case 5:oi(n,a),i===null&&u&4&&Ag(a),u&512&&nl(a,a.return);break;case 12:oi(n,a);break;case 31:oi(n,a),u&4&&Dg(n,a);break;case 13:oi(n,a),u&4&&Lg(n,a),u&64&&(n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(a=yw.bind(null,a),Uw(n,a))));break;case 22:if(u=a.memoizedState!==null||ai,!u){i=i!==null&&i.memoizedState!==null||fn,h=ai;var p=fn;ai=u,(fn=i)&&!p?ui(n,a,(a.subtreeFlags&8772)!==0):oi(n,a),ai=h,fn=p}break;case 30:break;default:oi(n,a)}}function Rg(n){var i=n.alternate;i!==null&&(n.alternate=null,Rg(i)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(i=n.stateNode,i!==null&&Cs(i)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Yt=null,In=!1;function li(n,i,a){for(a=a.child;a!==null;)Mg(n,i,a),a=a.sibling}function Mg(n,i,a){if(yt&&typeof yt.onCommitFiberUnmount=="function")try{yt.onCommitFiberUnmount(Kt,a)}catch{}switch(a.tag){case 26:fn||qr(a,i),li(n,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:fn||qr(a,i);var u=Yt,h=In;Bi(a.type)&&(Yt=a.stateNode,In=!1),li(n,i,a),fl(a.stateNode),Yt=u,In=h;break;case 5:fn||qr(a,i);case 6:if(u=Yt,h=In,Yt=null,li(n,i,a),Yt=u,In=h,Yt!==null)if(In)try{(Yt.nodeType===9?Yt.body:Yt.nodeName==="HTML"?Yt.ownerDocument.body:Yt).removeChild(a.stateNode)}catch(p){Et(a,i,p)}else try{Yt.removeChild(a.stateNode)}catch(p){Et(a,i,p)}break;case 18:Yt!==null&&(In?(n=Yt,Ey(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,a.stateNode),sa(n)):Ey(Yt,a.stateNode));break;case 4:u=Yt,h=In,Yt=a.stateNode.containerInfo,In=!0,li(n,i,a),Yt=u,In=h;break;case 0:case 11:case 14:case 15:Ri(2,a,i),fn||Ri(4,a,i),li(n,i,a);break;case 1:fn||(qr(a,i),u=a.stateNode,typeof u.componentWillUnmount=="function"&&Cg(a,i,u)),li(n,i,a);break;case 21:li(n,i,a);break;case 22:fn=(u=fn)||a.memoizedState!==null,li(n,i,a),fn=u;break;default:li(n,i,a)}}function Dg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{sa(n)}catch(a){Et(i,i.return,a)}}}function Lg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{sa(n)}catch(a){Et(i,i.return,a)}}function uw(n){switch(n.tag){case 31:case 13:case 19:var i=n.stateNode;return i===null&&(i=n.stateNode=new Tg),i;case 22:return n=n.stateNode,i=n._retryCache,i===null&&(i=n._retryCache=new Tg),i;default:throw Error(s(435,n.tag))}}function Uo(n,i){var a=uw(n);i.forEach(function(u){if(!a.has(u)){a.add(u);var h=bw.bind(null,n,u);u.then(h,h)}})}function Fn(n,i){var a=i.deletions;if(a!==null)for(var u=0;u<a.length;u++){var h=a[u],p=n,w=i,_=w;e:for(;_!==null;){switch(_.tag){case 27:if(Bi(_.type)){Yt=_.stateNode,In=!1;break e}break;case 5:Yt=_.stateNode,In=!1;break e;case 3:case 4:Yt=_.stateNode.containerInfo,In=!0;break e}_=_.return}if(Yt===null)throw Error(s(160));Mg(p,w,h),Yt=null,In=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)zg(i,n),i=i.sibling}var Nr=null;function zg(n,i){var a=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Fn(i,n),$n(n),u&4&&(Ri(3,n,n.return),tl(3,n),Ri(5,n,n.return));break;case 1:Fn(i,n),$n(n),u&512&&(fn||a===null||qr(a,a.return)),u&64&&ai&&(n=n.updateQueue,n!==null&&(u=n.callbacks,u!==null&&(a=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=a===null?u:a.concat(u))));break;case 26:var h=Nr;if(Fn(i,n),$n(n),u&512&&(fn||a===null||qr(a,a.return)),u&4){var p=a!==null?a.memoizedState:null;if(u=n.memoizedState,a===null)if(u===null)if(n.stateNode===null){e:{u=n.type,a=n.memoizedProps,h=h.ownerDocument||h;t:switch(u){case"title":p=h.getElementsByTagName("title")[0],(!p||p[gn]||p[ft]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(u),h.head.insertBefore(p,h.querySelector("head > title"))),Cn(p,u,a),p[ft]=n,F(p),u=p;break e;case"link":var w=zy("link","href",h).get(u+(a.href||""));if(w){for(var _=0;_<w.length;_++)if(p=w[_],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(_,1);break t}}p=h.createElement(u),Cn(p,u,a),h.head.appendChild(p);break;case"meta":if(w=zy("meta","content",h).get(u+(a.content||""))){for(_=0;_<w.length;_++)if(p=w[_],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(_,1);break t}}p=h.createElement(u),Cn(p,u,a),h.head.appendChild(p);break;default:throw Error(s(468,u))}p[ft]=n,F(p),u=p}n.stateNode=u}else Uy(h,n.type,n.stateNode);else n.stateNode=Ly(h,u,n.memoizedProps);else p!==u?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,u===null?Uy(h,n.type,n.stateNode):Ly(h,u,n.memoizedProps)):u===null&&n.stateNode!==null&&Ef(n,n.memoizedProps,a.memoizedProps)}break;case 27:Fn(i,n),$n(n),u&512&&(fn||a===null||qr(a,a.return)),a!==null&&u&4&&Ef(n,n.memoizedProps,a.memoizedProps);break;case 5:if(Fn(i,n),$n(n),u&512&&(fn||a===null||qr(a,a.return)),n.flags&32){h=n.stateNode;try{js(h,"")}catch(ze){Et(n,n.return,ze)}}u&4&&n.stateNode!=null&&(h=n.memoizedProps,Ef(n,h,a!==null?a.memoizedProps:h)),u&1024&&(jf=!0);break;case 6:if(Fn(i,n),$n(n),u&4){if(n.stateNode===null)throw Error(s(162));u=n.memoizedProps,a=n.stateNode;try{a.nodeValue=u}catch(ze){Et(n,n.return,ze)}}break;case 3:if(Wo=null,h=Nr,Nr=Qo(i.containerInfo),Fn(i,n),Nr=h,$n(n),u&4&&a!==null&&a.memoizedState.isDehydrated)try{sa(i.containerInfo)}catch(ze){Et(n,n.return,ze)}jf&&(jf=!1,Ug(n));break;case 4:u=Nr,Nr=Qo(n.stateNode.containerInfo),Fn(i,n),$n(n),Nr=u;break;case 12:Fn(i,n),$n(n);break;case 31:Fn(i,n),$n(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 13:Fn(i,n),$n(n),n.child.flags&8192&&n.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Bo=at()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 22:h=n.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,re=ai,fe=fn;if(ai=re||h,fn=fe||H,Fn(i,n),fn=fe,ai=re,$n(n),u&8192)e:for(i=n.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||H||ai||fn||ys(n)),a=null,i=n;;){if(i.tag===5||i.tag===26){if(a===null){H=a=i;try{if(p=H.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{_=H.stateNode;var ye=H.memoizedProps.style,ie=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;_.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(ze){Et(H,H.return,ze)}}}else if(i.tag===6){if(a===null){H=i;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(ze){Et(H,H.return,ze)}}}else if(i.tag===18){if(a===null){H=i;try{var oe=H.stateNode;h?Cy(oe,!0):Cy(H.stateNode,!1)}catch(ze){Et(H,H.return,ze)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===n)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break e;for(;i.sibling===null;){if(i.return===null||i.return===n)break e;a===i&&(a=null),i=i.return}a===i&&(a=null),i.sibling.return=i.return,i=i.sibling}u&4&&(u=n.updateQueue,u!==null&&(a=u.retryQueue,a!==null&&(u.retryQueue=null,Uo(n,a))));break;case 19:Fn(i,n),$n(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 30:break;case 21:break;default:Fn(i,n),$n(n)}}function $n(n){var i=n.flags;if(i&2){try{for(var a,u=n.return;u!==null;){if(jg(u)){a=u;break}u=u.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var h=a.stateNode,p=Cf(n);zo(n,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(js(w,""),a.flags&=-33);var _=Cf(n);zo(n,_,w);break;case 3:case 4:var H=a.stateNode.containerInfo,re=Cf(n);Af(n,re,H);break;default:throw Error(s(161))}}catch(fe){Et(n,n.return,fe)}n.flags&=-3}i&4096&&(n.flags&=-4097)}function Ug(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var i=n;Ug(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),n=n.sibling}}function oi(n,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Og(n,i.alternate,i),i=i.sibling}function ys(n){for(n=n.child;n!==null;){var i=n;switch(i.tag){case 0:case 11:case 14:case 15:Ri(4,i,i.return),ys(i);break;case 1:qr(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&Cg(i,i.return,a),ys(i);break;case 27:fl(i.stateNode);case 26:case 5:qr(i,i.return),ys(i);break;case 22:i.memoizedState===null&&ys(i);break;case 30:ys(i);break;default:ys(i)}n=n.sibling}}function ui(n,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var u=i.alternate,h=n,p=i,w=p.flags;switch(p.tag){case 0:case 11:case 15:ui(h,p,a),tl(4,p);break;case 1:if(ui(h,p,a),u=p,h=u.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(re){Et(u,u.return,re)}if(u=p,h=u.updateQueue,h!==null){var _=u.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)mp(H[h],_)}catch(re){Et(u,u.return,re)}}a&&w&64&&Eg(p),nl(p,p.return);break;case 27:Ng(p);case 26:case 5:ui(h,p,a),a&&u===null&&w&4&&Ag(p),nl(p,p.return);break;case 12:ui(h,p,a);break;case 31:ui(h,p,a),a&&w&4&&Dg(h,p);break;case 13:ui(h,p,a),a&&w&4&&Lg(h,p);break;case 22:p.memoizedState===null&&ui(h,p,a),nl(p,p.return);break;case 30:break;default:ui(h,p,a)}i=i.sibling}}function Nf(n,i){var a=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),n=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(n=i.memoizedState.cachePool.pool),n!==a&&(n!=null&&n.refCount++,a!=null&&Ia(a))}function Tf(n,i){n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Ia(n))}function Tr(n,i,a,u){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Pg(n,i,a,u),i=i.sibling}function Pg(n,i,a,u){var h=i.flags;switch(i.tag){case 0:case 11:case 15:Tr(n,i,a,u),h&2048&&tl(9,i);break;case 1:Tr(n,i,a,u);break;case 3:Tr(n,i,a,u),h&2048&&(n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Ia(n)));break;case 12:if(h&2048){Tr(n,i,a,u),n=i.stateNode;try{var p=i.memoizedProps,w=p.id,_=p.onPostCommit;typeof _=="function"&&_(w,i.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(H){Et(i,i.return,H)}}else Tr(n,i,a,u);break;case 31:Tr(n,i,a,u);break;case 13:Tr(n,i,a,u);break;case 23:break;case 22:p=i.stateNode,w=i.alternate,i.memoizedState!==null?p._visibility&2?Tr(n,i,a,u):rl(n,i):p._visibility&2?Tr(n,i,a,u):(p._visibility|=2,Js(n,i,a,u,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Nf(w,i);break;case 24:Tr(n,i,a,u),h&2048&&Tf(i.alternate,i);break;default:Tr(n,i,a,u)}}function Js(n,i,a,u,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=n,w=i,_=a,H=u,re=w.flags;switch(w.tag){case 0:case 11:case 15:Js(p,w,_,H,h),tl(8,w);break;case 23:break;case 22:var fe=w.stateNode;w.memoizedState!==null?fe._visibility&2?Js(p,w,_,H,h):rl(p,w):(fe._visibility|=2,Js(p,w,_,H,h)),h&&re&2048&&Nf(w.alternate,w);break;case 24:Js(p,w,_,H,h),h&&re&2048&&Tf(w.alternate,w);break;default:Js(p,w,_,H,h)}i=i.sibling}}function rl(n,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=n,u=i,h=u.flags;switch(u.tag){case 22:rl(a,u),h&2048&&Nf(u.alternate,u);break;case 24:rl(a,u),h&2048&&Tf(u.alternate,u);break;default:rl(a,u)}i=i.sibling}}var il=8192;function Xs(n,i,a){if(n.subtreeFlags&il)for(n=n.child;n!==null;)Bg(n,i,a),n=n.sibling}function Bg(n,i,a){switch(n.tag){case 26:Xs(n,i,a),n.flags&il&&n.memoizedState!==null&&Xw(a,Nr,n.memoizedState,n.memoizedProps);break;case 5:Xs(n,i,a);break;case 3:case 4:var u=Nr;Nr=Qo(n.stateNode.containerInfo),Xs(n,i,a),Nr=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=il,il=16777216,Xs(n,i,a),il=u):Xs(n,i,a));break;default:Xs(n,i,a)}}function Hg(n){var i=n.alternate;if(i!==null&&(n=i.child,n!==null)){i.child=null;do i=n.sibling,n.sibling=null,n=i;while(n!==null)}}function sl(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var u=i[a];xn=u,Ig(u,n)}Hg(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)qg(n),n=n.sibling}function qg(n){switch(n.tag){case 0:case 11:case 15:sl(n),n.flags&2048&&Ri(9,n,n.return);break;case 3:sl(n);break;case 12:sl(n);break;case 22:var i=n.stateNode;n.memoizedState!==null&&i._visibility&2&&(n.return===null||n.return.tag!==13)?(i._visibility&=-3,Po(n)):sl(n);break;default:sl(n)}}function Po(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var u=i[a];xn=u,Ig(u,n)}Hg(n)}for(n=n.child;n!==null;){switch(i=n,i.tag){case 0:case 11:case 15:Ri(8,i,i.return),Po(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,Po(i));break;default:Po(i)}n=n.sibling}}function Ig(n,i){for(;xn!==null;){var a=xn;switch(a.tag){case 0:case 11:case 15:Ri(8,a,i);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var u=a.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Ia(a.memoizedState.cache)}if(u=a.child,u!==null)u.return=a,xn=u;else e:for(a=n;xn!==null;){u=xn;var h=u.sibling,p=u.return;if(Rg(u),u===a){xn=null;break e}if(h!==null){h.return=p,xn=h;break e}xn=p}}}var cw={getCacheForType:function(n){var i=kn(on),a=i.data.get(n);return a===void 0&&(a=n(),i.data.set(n,a)),a},cacheSignal:function(){return kn(on).controller.signal}},fw=typeof WeakMap=="function"?WeakMap:Map,wt=0,Mt=null,lt=null,ht=0,kt=0,tr=null,Mi=!1,Ks=!1,Of=!1,ci=0,en=0,Di=0,bs=0,Rf=0,nr=0,Qs=0,al=null,Vn=null,Mf=!1,Bo=0,Fg=0,Ho=1/0,qo=null,Li=null,yn=0,zi=null,Zs=null,fi=0,Df=0,Lf=null,$g=null,ll=0,zf=null;function rr(){return(wt&2)!==0&&ht!==0?ht&-ht:V.T!==null?If():Zt()}function Vg(){if(nr===0)if((ht&536870912)===0||mt){var n=Ye;Ye<<=1,(Ye&3932160)===0&&(Ye=262144),nr=n}else nr=536870912;return n=Wn.current,n!==null&&(n.flags|=32),nr}function Yn(n,i,a){(n===Mt&&(kt===2||kt===9)||n.cancelPendingCommit!==null)&&(Ws(n,0),Ui(n,ht,nr,!1)),He(n,a),((wt&2)===0||n!==Mt)&&(n===Mt&&((wt&2)===0&&(bs|=a),en===4&&Ui(n,ht,nr,!1)),Ir(n))}function Yg(n,i,a){if((wt&6)!==0)throw Error(s(327));var u=!a&&(i&127)===0&&(i&n.expiredLanes)===0||Hn(n,i),h=u?mw(n,i):Pf(n,i,!0),p=u;do{if(h===0){Ks&&!u&&Ui(n,i,0,!1);break}else{if(a=n.current.alternate,p&&!hw(a)){h=Pf(n,i,!1),p=!1;continue}if(h===2){if(p=i,n.errorRecoveryDisabledLanes&p)var w=0;else w=n.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){i=w;e:{var _=n;h=al;var H=_.current.memoizedState.isDehydrated;if(H&&(Ws(_,w).flags|=256),w=Pf(_,w,!1),w!==2){if(Of&&!H){_.errorRecoveryDisabledLanes|=p,bs|=p,h=4;break e}p=Vn,Vn=h,p!==null&&(Vn===null?Vn=p:Vn.push.apply(Vn,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){Ws(n,0),Ui(n,i,0,!0);break}e:{switch(u=n,p=h,p){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:Ui(u,i,nr,!Mi);break e;case 2:Vn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=Bo+300-at(),10<h)){if(Ui(u,i,nr,!Mi),ln(u,0,!0)!==0)break e;fi=i,u.timeoutHandle=_y(Gg.bind(null,u,a,Vn,qo,Mf,i,nr,bs,Qs,Mi,p,"Throttled",-0,0),h);break e}Gg(u,a,Vn,qo,Mf,i,nr,bs,Qs,Mi,p,null,-0,0)}}break}while(!0);Ir(n)}function Gg(n,i,a,u,h,p,w,_,H,re,fe,ye,ie,oe){if(n.timeoutHandle=-1,ye=i.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Kr},Bg(i,p,ye);var ze=(p&62914560)===p?Bo-at():(p&4194048)===p?Fg-at():0;if(ze=Kw(ye,ze),ze!==null){fi=p,n.cancelPendingCommit=ze(ty.bind(null,n,i,p,a,u,h,w,_,H,fe,ye,null,ie,oe)),Ui(n,p,w,!re);return}}ty(n,i,p,a,u,h,w,_,H)}function hw(n){for(var i=n;;){var a=i.tag;if((a===0||a===11||a===15)&&i.flags&16384&&(a=i.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var u=0;u<a.length;u++){var h=a[u],p=h.getSnapshot;h=h.value;try{if(!Qn(p(),h))return!1}catch{return!1}}if(a=i.child,i.subtreeFlags&16384&&a!==null)a.return=i,i=a;else{if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ui(n,i,a,u){i&=~Rf,i&=~bs,n.suspendedLanes|=i,n.pingedLanes&=~i,u&&(n.warmLanes|=i),u=n.expirationTimes;for(var h=i;0<h;){var p=31-Ze(h),w=1<<p;u[p]=-1,h&=~w}a!==0&&qe(n,a,i)}function Io(){return(wt&6)===0?(ol(0),!1):!0}function Uf(){if(lt!==null){if(kt===0)var n=lt.return;else n=lt,ei=us=null,Zc(n),Fs=null,$a=0,n=lt;for(;n!==null;)kg(n.alternate,n),n=n.return;lt=null}}function Ws(n,i){var a=n.timeoutHandle;a!==-1&&(n.timeoutHandle=-1,Rw(a)),a=n.cancelPendingCommit,a!==null&&(n.cancelPendingCommit=null,a()),fi=0,Uf(),Mt=n,lt=a=Zr(n.current,null),ht=i,kt=0,tr=null,Mi=!1,Ks=Hn(n,i),Of=!1,Qs=nr=Rf=bs=Di=en=0,Vn=al=null,Mf=!1,(i&8)!==0&&(i|=i&32);var u=n.entangledLanes;if(u!==0)for(n=n.entanglements,u&=i;0<u;){var h=31-Ze(u),p=1<<h;i|=n[h],u&=~p}return ci=i,oo(),a}function Jg(n,i){Ke=null,V.H=Za,i===Is||i===yo?(i=cp(),kt=3):i===Hc?(i=cp(),kt=4):kt=i===pf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,tr=i,lt===null&&(en=1,Oo(n,pr(i,n.current)))}function Xg(){var n=Wn.current;return n===null?!0:(ht&4194048)===ht?xr===null:(ht&62914560)===ht||(ht&536870912)!==0?n===xr:!1}function Kg(){var n=V.H;return V.H=Za,n===null?Za:n}function Qg(){var n=V.A;return V.A=cw,n}function Fo(){en=4,Mi||(ht&4194048)!==ht&&Wn.current!==null||(Ks=!0),(Di&134217727)===0&&(bs&134217727)===0||Mt===null||Ui(Mt,ht,nr,!1)}function Pf(n,i,a){var u=wt;wt|=2;var h=Kg(),p=Qg();(Mt!==n||ht!==i)&&(qo=null,Ws(n,i)),i=!1;var w=en;e:do try{if(kt!==0&<!==null){var _=lt,H=tr;switch(kt){case 8:Uf(),w=6;break e;case 3:case 2:case 9:case 6:Wn.current===null&&(i=!0);var re=kt;if(kt=0,tr=null,ea(n,_,H,re),a&&Ks){w=0;break e}break;default:re=kt,kt=0,tr=null,ea(n,_,H,re)}}dw(),w=en;break}catch(fe){Jg(n,fe)}while(!0);return i&&n.shellSuspendCounter++,ei=us=null,wt=u,V.H=h,V.A=p,lt===null&&(Mt=null,ht=0,oo()),w}function dw(){for(;lt!==null;)Zg(lt)}function mw(n,i){var a=wt;wt|=2;var u=Kg(),h=Qg();Mt!==n||ht!==i?(qo=null,Ho=at()+500,Ws(n,i)):Ks=Hn(n,i);e:do try{if(kt!==0&<!==null){i=lt;var p=tr;t:switch(kt){case 1:kt=0,tr=null,ea(n,i,p,1);break;case 2:case 9:if(op(p)){kt=0,tr=null,Wg(i);break}i=function(){kt!==2&&kt!==9||Mt!==n||(kt=7),Ir(n)},p.then(i,i);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:op(p)?(kt=0,tr=null,Wg(i)):(kt=0,tr=null,ea(n,i,p,7));break;case 5:var w=null;switch(lt.tag){case 26:w=lt.memoizedState;case 5:case 27:var _=lt;if(w?Py(w):_.stateNode.complete){kt=0,tr=null;var H=_.sibling;if(H!==null)lt=H;else{var re=_.return;re!==null?(lt=re,$o(re)):lt=null}break t}}kt=0,tr=null,ea(n,i,p,5);break;case 6:kt=0,tr=null,ea(n,i,p,6);break;case 8:Uf(),en=6;break e;default:throw Error(s(462))}}pw();break}catch(fe){Jg(n,fe)}while(!0);return ei=us=null,V.H=u,V.A=h,wt=a,lt!==null?0:(Mt=null,ht=0,oo(),en)}function pw(){for(;lt!==null&&!_t();)Zg(lt)}function Zg(n){var i=Sg(n.alternate,n,ci);n.memoizedProps=n.pendingProps,i===null?$o(n):lt=i}function Wg(n){var i=n,a=i.alternate;switch(i.tag){case 15:case 0:i=gg(a,i,i.pendingProps,i.type,void 0,ht);break;case 11:i=gg(a,i,i.pendingProps,i.type.render,i.ref,ht);break;case 5:Zc(i);default:kg(a,i),i=lt=Qm(i,ci),i=Sg(a,i,ci)}n.memoizedProps=n.pendingProps,i===null?$o(n):lt=i}function ea(n,i,a,u){ei=us=null,Zc(i),Fs=null,$a=0;var h=i.return;try{if(rw(n,h,i,a,ht)){en=1,Oo(n,pr(a,n.current)),lt=null;return}}catch(p){if(h!==null)throw lt=h,p;en=1,Oo(n,pr(a,n.current)),lt=null;return}i.flags&32768?(mt||u===1?n=!0:Ks||(ht&536870912)!==0?n=!1:(Mi=n=!0,(u===2||u===9||u===3||u===6)&&(u=Wn.current,u!==null&&u.tag===13&&(u.flags|=16384))),ey(i,n)):$o(i)}function $o(n){var i=n;do{if((i.flags&32768)!==0){ey(i,Mi);return}n=i.return;var a=aw(i.alternate,i,ci);if(a!==null){lt=a;return}if(i=i.sibling,i!==null){lt=i;return}lt=i=n}while(i!==null);en===0&&(en=5)}function ey(n,i){do{var a=lw(n.alternate,n);if(a!==null){a.flags&=32767,lt=a;return}if(a=n.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(n=n.sibling,n!==null)){lt=n;return}lt=n=a}while(n!==null);en=6,lt=null}function ty(n,i,a,u,h,p,w,_,H){n.cancelPendingCommit=null;do Vo();while(yn!==0);if((wt&6)!==0)throw Error(s(327));if(i!==null){if(i===n.current)throw Error(s(177));if(p=i.lanes|i.childLanes,p|=Ec,Ve(n,a,p,w,_,H),n===Mt&&(lt=Mt=null,ht=0),Zs=i,zi=n,fi=a,Df=p,Lf=h,$g=u,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,xw(Me,function(){return ay(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||u){u=V.T,V.T=null,h=Q.p,Q.p=2,w=wt,wt|=4;try{ow(n,i,a)}finally{wt=w,Q.p=h,V.T=u}}yn=1,ny(),ry(),iy()}}function ny(){if(yn===1){yn=0;var n=zi,i=Zs,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=V.T,V.T=null;var u=Q.p;Q.p=2;var h=wt;wt|=4;try{zg(i,n);var p=Kf,w=Im(n.containerInfo),_=p.focusedElem,H=p.selectionRange;if(w!==_&&_&&_.ownerDocument&&qm(_.ownerDocument.documentElement,_)){if(H!==null&&vc(_)){var re=H.start,fe=H.end;if(fe===void 0&&(fe=re),"selectionStart"in _)_.selectionStart=re,_.selectionEnd=Math.min(fe,_.value.length);else{var ye=_.ownerDocument||document,ie=ye&&ye.defaultView||window;if(ie.getSelection){var oe=ie.getSelection(),ze=_.textContent.length,$e=Math.min(H.start,ze),jt=H.end===void 0?$e:Math.min(H.end,ze);!oe.extend&&$e>jt&&(w=jt,jt=$e,$e=w);var K=Hm(_,$e),Y=Hm(_,jt);if(K&&Y&&(oe.rangeCount!==1||oe.anchorNode!==K.node||oe.anchorOffset!==K.offset||oe.focusNode!==Y.node||oe.focusOffset!==Y.offset)){var ne=ye.createRange();ne.setStart(K.node,K.offset),oe.removeAllRanges(),$e>jt?(oe.addRange(ne),oe.extend(Y.node,Y.offset)):(ne.setEnd(Y.node,Y.offset),oe.addRange(ne))}}}}for(ye=[],oe=_;oe=oe.parentNode;)oe.nodeType===1&&ye.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<ye.length;_++){var me=ye[_];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}ru=!!Xf,Kf=Xf=null}finally{wt=h,Q.p=u,V.T=a}}n.current=i,yn=2}}function ry(){if(yn===2){yn=0;var n=zi,i=Zs,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=V.T,V.T=null;var u=Q.p;Q.p=2;var h=wt;wt|=4;try{Og(n,i.alternate,i)}finally{wt=h,Q.p=u,V.T=a}}yn=3}}function iy(){if(yn===4||yn===3){yn=0,mn();var n=zi,i=Zs,a=fi,u=$g;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?yn=5:(yn=0,Zs=zi=null,sy(n,n.pendingLanes));var h=n.pendingLanes;if(h===0&&(Li=null),We(a),i=i.stateNode,yt&&typeof yt.onCommitFiberRoot=="function")try{yt.onCommitFiberRoot(Kt,i,void 0,(i.current.flags&128)===128)}catch{}if(u!==null){i=V.T,h=Q.p,Q.p=2,V.T=null;try{for(var p=n.onRecoverableError,w=0;w<u.length;w++){var _=u[w];p(_.value,{componentStack:_.stack})}}finally{V.T=i,Q.p=h}}(fi&3)!==0&&Vo(),Ir(n),h=n.pendingLanes,(a&261930)!==0&&(h&42)!==0?n===zf?ll++:(ll=0,zf=n):ll=0,ol(0)}}function sy(n,i){(n.pooledCacheLanes&=i)===0&&(i=n.pooledCache,i!=null&&(n.pooledCache=null,Ia(i)))}function Vo(){return ny(),ry(),iy(),ay()}function ay(){if(yn!==5)return!1;var n=zi,i=Df;Df=0;var a=We(fi),u=V.T,h=Q.p;try{Q.p=32>a?32:a,V.T=null,a=Lf,Lf=null;var p=zi,w=fi;if(yn=0,Zs=zi=null,fi=0,(wt&6)!==0)throw Error(s(331));var _=wt;if(wt|=4,qg(p.current),Pg(p,p.current,w,a),wt=_,ol(0,!1),yt&&typeof yt.onPostCommitFiberRoot=="function")try{yt.onPostCommitFiberRoot(Kt,p)}catch{}return!0}finally{Q.p=h,V.T=u,sy(n,i)}}function ly(n,i,a){i=pr(a,i),i=mf(n.stateNode,i,2),n=Ni(n,i,2),n!==null&&(He(n,2),Ir(n))}function Et(n,i,a){if(n.tag===3)ly(n,n,a);else for(;i!==null;){if(i.tag===3){ly(i,n,a);break}else if(i.tag===1){var u=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Li===null||!Li.has(u))){n=pr(a,n),a=og(2),u=Ni(i,a,2),u!==null&&(ug(a,u,i,n),He(u,2),Ir(u));break}}i=i.return}}function Bf(n,i,a){var u=n.pingCache;if(u===null){u=n.pingCache=new fw;var h=new Set;u.set(i,h)}else h=u.get(i),h===void 0&&(h=new Set,u.set(i,h));h.has(a)||(Of=!0,h.add(a),n=gw.bind(null,n,i,a),i.then(n,n))}function gw(n,i,a){var u=n.pingCache;u!==null&&u.delete(i),n.pingedLanes|=n.suspendedLanes&a,n.warmLanes&=~a,Mt===n&&(ht&a)===a&&(en===4||en===3&&(ht&62914560)===ht&&300>at()-Bo?(wt&2)===0&&Ws(n,0):Rf|=a,Qs===ht&&(Qs=0)),Ir(n)}function oy(n,i){i===0&&(i=de()),n=as(n,i),n!==null&&(He(n,i),Ir(n))}function yw(n){var i=n.memoizedState,a=0;i!==null&&(a=i.retryLane),oy(n,a)}function bw(n,i){var a=0;switch(n.tag){case 31:case 13:var u=n.stateNode,h=n.memoizedState;h!==null&&(a=h.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(i),oy(n,a)}function xw(n,i){return st(n,i)}var Yo=null,ta=null,Hf=!1,Go=!1,qf=!1,Pi=0;function Ir(n){n!==ta&&n.next===null&&(ta===null?Yo=ta=n:ta=ta.next=n),Go=!0,Hf||(Hf=!0,ww())}function ol(n,i){if(!qf&&Go){qf=!0;do for(var a=!1,u=Yo;u!==null;){if(n!==0){var h=u.pendingLanes;if(h===0)var p=0;else{var w=u.suspendedLanes,_=u.pingedLanes;p=(1<<31-Ze(42|n)+1)-1,p&=h&~(w&~_),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,hy(u,p))}else p=ht,p=ln(u,u===Mt?p:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(p&3)===0||Hn(u,p)||(a=!0,hy(u,p));u=u.next}while(a);qf=!1}}function vw(){uy()}function uy(){Go=Hf=!1;var n=0;Pi!==0&&Ow()&&(n=Pi);for(var i=at(),a=null,u=Yo;u!==null;){var h=u.next,p=cy(u,i);p===0?(u.next=null,a===null?Yo=h:a.next=h,h===null&&(ta=a)):(a=u,(n!==0||(p&3)!==0)&&(Go=!0)),u=h}yn!==0&&yn!==5||ol(n),Pi!==0&&(Pi=0)}function cy(n,i){for(var a=n.suspendedLanes,u=n.pingedLanes,h=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var w=31-Ze(p),_=1<<w,H=h[w];H===-1?((_&a)===0||(_&u)!==0)&&(h[w]=ts(_,i)):H<=i&&(n.expiredLanes|=_),p&=~_}if(i=Mt,a=ht,a=ln(n,n===i?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,a===0||n===i&&(kt===2||kt===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&Ot(u),n.callbackNode=null,n.callbackPriority=0;if((a&3)===0||Hn(n,a)){if(i=a&-a,i===n.callbackPriority)return i;switch(u!==null&&Ot(u),We(a)){case 2:case 8:a=_e;break;case 32:a=Me;break;case 268435456:a=rt;break;default:a=Me}return u=fy.bind(null,n),a=st(a,u),n.callbackPriority=i,n.callbackNode=a,i}return u!==null&&u!==null&&Ot(u),n.callbackPriority=2,n.callbackNode=null,2}function fy(n,i){if(yn!==0&&yn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var a=n.callbackNode;if(Vo()&&n.callbackNode!==a)return null;var u=ht;return u=ln(n,n===Mt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(Yg(n,u,i),cy(n,at()),n.callbackNode!=null&&n.callbackNode===a?fy.bind(null,n):null)}function hy(n,i){if(Vo())return null;Yg(n,i,!0)}function ww(){Mw(function(){(wt&6)!==0?st(ae,vw):uy()})}function If(){if(Pi===0){var n=Hs;n===0&&(n=we,we<<=1,(we&261888)===0&&(we=256)),Pi=n}return Pi}function dy(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:eo(""+n)}function my(n,i){var a=i.ownerDocument.createElement("input");return a.name=i.name,a.value=i.value,n.id&&a.setAttribute("form",n.id),i.parentNode.insertBefore(a,i),n=new FormData(n),a.parentNode.removeChild(a),n}function Sw(n,i,a,u,h){if(i==="submit"&&a&&a.stateNode===h){var p=dy((h[Bt]||null).action),w=u.submitter;w&&(i=(i=w[Bt]||null)?dy(i.formAction):w.getAttribute("formAction"),i!==null&&(p=i,w=null));var _=new io("action","action",null,u,h);n.push({event:_,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Pi!==0){var H=w?my(h,w):new FormData(h);of(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(_.preventDefault(),H=w?my(h,w):new FormData(h),of(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var Ff=0;Ff<kc.length;Ff++){var $f=kc[Ff],_w=$f.toLowerCase(),kw=$f[0].toUpperCase()+$f.slice(1);jr(_w,"on"+kw)}jr(Vm,"onAnimationEnd"),jr(Ym,"onAnimationIteration"),jr(Gm,"onAnimationStart"),jr("dblclick","onDoubleClick"),jr("focusin","onFocus"),jr("focusout","onBlur"),jr(Hv,"onTransitionRun"),jr(qv,"onTransitionStart"),jr(Iv,"onTransitionCancel"),jr(Jm,"onTransitionEnd"),se("onMouseEnter",["mouseout","mouseover"]),se("onMouseLeave",["mouseout","mouseover"]),se("onPointerEnter",["pointerout","pointerover"]),se("onPointerLeave",["pointerout","pointerover"]),be("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),be("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),be("onBeforeInput",["compositionend","keypress","textInput","paste"]),be("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ul="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(" "),Ew=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ul));function py(n,i){i=(i&4)!==0;for(var a=0;a<n.length;a++){var u=n[a],h=u.event;u=u.listeners;e:{var p=void 0;if(i)for(var w=u.length-1;0<=w;w--){var _=u[w],H=_.instance,re=_.currentTarget;if(_=_.listener,H!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=re;try{p(h)}catch(fe){lo(fe)}h.currentTarget=null,p=H}else for(w=0;w<u.length;w++){if(_=u[w],H=_.instance,re=_.currentTarget,_=_.listener,H!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=re;try{p(h)}catch(fe){lo(fe)}h.currentTarget=null,p=H}}}}function ot(n,i){var a=i[Pr];a===void 0&&(a=i[Pr]=new Set);var u=n+"__bubble";a.has(u)||(gy(i,n,2,!1),a.add(u))}function Vf(n,i,a){var u=0;i&&(u|=4),gy(a,n,u,i)}var Jo="_reactListening"+Math.random().toString(36).slice(2);function Yf(n){if(!n[Jo]){n[Jo]=!0,Z.forEach(function(a){a!=="selectionchange"&&(Ew.has(a)||Vf(a,!1,n),Vf(a,!0,n))});var i=n.nodeType===9?n:n.ownerDocument;i===null||i[Jo]||(i[Jo]=!0,Vf("selectionchange",!1,i))}}function gy(n,i,a,u){switch(Vy(i)){case 2:var h=Ww;break;case 8:h=eS;break;default:h=lh}a=h.bind(null,i,a,n),h=void 0,!fc||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),u?h!==void 0?n.addEventListener(i,a,{capture:!0,passive:h}):n.addEventListener(i,a,!0):h!==void 0?n.addEventListener(i,a,{passive:h}):n.addEventListener(i,a,!1)}function Gf(n,i,a,u,h){var p=u;if((i&1)===0&&(i&2)===0&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var _=u.stateNode.containerInfo;if(_===h)break;if(w===4)for(w=u.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;_!==null;){if(w=k(_),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){u=p=w;continue e}_=_.parentNode}}u=u.return}wm(function(){var re=p,fe=uc(a),ye=[];e:{var ie=Xm.get(n);if(ie!==void 0){var oe=io,ze=n;switch(n){case"keypress":if(no(a)===0)break e;case"keydown":case"keyup":oe=bv;break;case"focusin":ze="focus",oe=pc;break;case"focusout":ze="blur",oe=pc;break;case"beforeblur":case"afterblur":oe=pc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":oe=km;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=av;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=wv;break;case Vm:case Ym:case Gm:oe=uv;break;case Jm:oe=_v;break;case"scroll":case"scrollend":oe=iv;break;case"wheel":oe=Ev;break;case"copy":case"cut":case"paste":oe=fv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=Cm;break;case"toggle":case"beforetoggle":oe=Av}var $e=(i&4)!==0,jt=!$e&&(n==="scroll"||n==="scrollend"),K=$e?ie!==null?ie+"Capture":null:ie;$e=[];for(var Y=re,ne;Y!==null;){var me=Y;if(ne=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||ne===null||K===null||(me=Oa(Y,K),me!=null&&$e.push(cl(Y,me,ne))),jt)break;Y=Y.return}0<$e.length&&(ie=new oe(ie,ze,null,a,fe),ye.push({event:ie,listeners:$e}))}}if((i&7)===0){e:{if(ie=n==="mouseover"||n==="pointerover",oe=n==="mouseout"||n==="pointerout",ie&&a!==oc&&(ze=a.relatedTarget||a.fromElement)&&(k(ze)||ze[jn]))break e;if((oe||ie)&&(ie=fe.window===fe?fe:(ie=fe.ownerDocument)?ie.defaultView||ie.parentWindow:window,oe?(ze=a.relatedTarget||a.toElement,oe=re,ze=ze?k(ze):null,ze!==null&&(jt=o(ze),$e=ze.tag,ze!==jt||$e!==5&&$e!==27&&$e!==6)&&(ze=null)):(oe=null,ze=re),oe!==ze)){if($e=km,me="onMouseLeave",K="onMouseEnter",Y="mouse",(n==="pointerout"||n==="pointerover")&&($e=Cm,me="onPointerLeave",K="onPointerEnter",Y="pointer"),jt=oe==null?ie:O(oe),ne=ze==null?ie:O(ze),ie=new $e(me,Y+"leave",oe,a,fe),ie.target=jt,ie.relatedTarget=ne,me=null,k(fe)===re&&($e=new $e(K,Y+"enter",ze,a,fe),$e.target=ne,$e.relatedTarget=jt,me=$e),jt=me,oe&&ze)t:{for($e=Cw,K=oe,Y=ze,ne=0,me=K;me;me=$e(me))ne++;me=0;for(var Ie=Y;Ie;Ie=$e(Ie))me++;for(;0<ne-me;)K=$e(K),ne--;for(;0<me-ne;)Y=$e(Y),me--;for(;ne--;){if(K===Y||Y!==null&&K===Y.alternate){$e=K;break t}K=$e(K),Y=$e(Y)}$e=null}else $e=null;oe!==null&&yy(ye,ie,oe,$e,!1),ze!==null&&jt!==null&&yy(ye,jt,ze,$e,!0)}}e:{if(ie=re?O(re):window,oe=ie.nodeName&&ie.nodeName.toLowerCase(),oe==="select"||oe==="input"&&ie.type==="file")var xt=Dm;else if(Rm(ie))if(Lm)xt=Uv;else{xt=Lv;var Ue=Dv}else oe=ie.nodeName,!oe||oe.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?re&&lc(re.elementType)&&(xt=Dm):xt=zv;if(xt&&(xt=xt(n,re))){Mm(ye,xt,a,fe);break e}Ue&&Ue(n,ie,re),n==="focusout"&&re&&ie.type==="number"&&re.memoizedProps.value!=null&&ac(ie,"number",ie.value)}switch(Ue=re?O(re):window,n){case"focusin":(Rm(Ue)||Ue.contentEditable==="true")&&(Rs=Ue,wc=re,Ba=null);break;case"focusout":Ba=wc=Rs=null;break;case"mousedown":Sc=!0;break;case"contextmenu":case"mouseup":case"dragend":Sc=!1,Fm(ye,a,fe);break;case"selectionchange":if(Bv)break;case"keydown":case"keyup":Fm(ye,a,fe)}var et;if(yc)e:{switch(n){case"compositionstart":var dt="onCompositionStart";break e;case"compositionend":dt="onCompositionEnd";break e;case"compositionupdate":dt="onCompositionUpdate";break e}dt=void 0}else Os?Tm(n,a)&&(dt="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(dt="onCompositionStart");dt&&(Am&&a.locale!=="ko"&&(Os||dt!=="onCompositionStart"?dt==="onCompositionEnd"&&Os&&(et=Sm()):(Si=fe,hc="value"in Si?Si.value:Si.textContent,Os=!0)),Ue=Xo(re,dt),0<Ue.length&&(dt=new Em(dt,n,null,a,fe),ye.push({event:dt,listeners:Ue}),et?dt.data=et:(et=Om(a),et!==null&&(dt.data=et)))),(et=Nv?Tv(n,a):Ov(n,a))&&(dt=Xo(re,"onBeforeInput"),0<dt.length&&(Ue=new Em("onBeforeInput","beforeinput",null,a,fe),ye.push({event:Ue,listeners:dt}),Ue.data=et)),Sw(ye,n,re,a,fe)}py(ye,i)})}function cl(n,i,a){return{instance:n,listener:i,currentTarget:a}}function Xo(n,i){for(var a=i+"Capture",u=[];n!==null;){var h=n,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=Oa(n,a),h!=null&&u.unshift(cl(n,h,p)),h=Oa(n,i),h!=null&&u.push(cl(n,h,p))),n.tag===3)return u;n=n.return}return[]}function Cw(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function yy(n,i,a,u,h){for(var p=i._reactName,w=[];a!==null&&a!==u;){var _=a,H=_.alternate,re=_.stateNode;if(_=_.tag,H!==null&&H===u)break;_!==5&&_!==26&&_!==27||re===null||(H=re,h?(re=Oa(a,p),re!=null&&w.unshift(cl(a,re,H))):h||(re=Oa(a,p),re!=null&&w.push(cl(a,re,H)))),a=a.return}w.length!==0&&n.push({event:i,listeners:w})}var Aw=/\r\n?/g,jw=/\u0000|\uFFFD/g;function by(n){return(typeof n=="string"?n:""+n).replace(Aw,`
|
|
49
|
+
`).replace(jw,"")}function xy(n,i){return i=by(i),by(n)===i}function At(n,i,a,u,h,p){switch(a){case"children":typeof u=="string"?i==="body"||i==="textarea"&&u===""||js(n,u):(typeof u=="number"||typeof u=="bigint")&&i!=="body"&&js(n,""+u);break;case"className":Ar(n,"class",u);break;case"tabIndex":Ar(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Ar(n,a,u);break;case"style":xm(n,u,p);break;case"data":if(i!=="object"){Ar(n,"data",u);break}case"src":case"href":if(u===""&&(i!=="a"||a!=="href")){n.removeAttribute(a);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(a);break}u=eo(""+u),n.setAttribute(a,u);break;case"action":case"formAction":if(typeof u=="function"){n.setAttribute(a,"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 p=="function"&&(a==="formAction"?(i!=="input"&&At(n,i,"name",h.name,h,null),At(n,i,"formEncType",h.formEncType,h,null),At(n,i,"formMethod",h.formMethod,h,null),At(n,i,"formTarget",h.formTarget,h,null)):(At(n,i,"encType",h.encType,h,null),At(n,i,"method",h.method,h,null),At(n,i,"target",h.target,h,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(a);break}u=eo(""+u),n.setAttribute(a,u);break;case"onClick":u!=null&&(n.onclick=Kr);break;case"onScroll":u!=null&&ot("scroll",n);break;case"onScrollEnd":u!=null&&ot("scrollend",n);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(a=u.__html,a!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"multiple":n.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":n.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){n.removeAttribute("xlink:href");break}a=eo(""+u),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(a,""+u):n.removeAttribute(a);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":u&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(a,""):n.removeAttribute(a);break;case"capture":case"download":u===!0?n.setAttribute(a,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(a,u):n.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?n.setAttribute(a,u):n.removeAttribute(a);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?n.removeAttribute(a):n.setAttribute(a,u);break;case"popover":ot("beforetoggle",n),ot("toggle",n),Nn(n,"popover",u);break;case"xlinkActuate":Xr(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Xr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Xr(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Xr(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Xr(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Xr(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Xr(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Xr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Xr(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Nn(n,"is",u);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=nv.get(a)||a,Nn(n,a,u))}}function Jf(n,i,a,u,h,p){switch(a){case"style":xm(n,u,p);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(a=u.__html,a!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"children":typeof u=="string"?js(n,u):(typeof u=="number"||typeof u=="bigint")&&js(n,""+u);break;case"onScroll":u!=null&&ot("scroll",n);break;case"onScrollEnd":u!=null&&ot("scrollend",n);break;case"onClick":u!=null&&(n.onclick=Kr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ge.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),i=a.slice(2,h?a.length-7:void 0),p=n[Bt]||null,p=p!=null?p[a]:null,typeof p=="function"&&n.removeEventListener(i,p,h),typeof u=="function")){typeof p!="function"&&p!==null&&(a in n?n[a]=null:n.hasAttribute(a)&&n.removeAttribute(a)),n.addEventListener(i,u,h);break e}a in n?n[a]=u:u===!0?n.setAttribute(a,""):Nn(n,a,u)}}}function Cn(n,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ot("error",n),ot("load",n);var u=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":u=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:At(n,i,p,w,a,null)}}h&&At(n,i,"srcSet",a.srcSet,a,null),u&&At(n,i,"src",a.src,a,null);return;case"input":ot("invalid",n);var _=p=w=h=null,H=null,re=null;for(u in a)if(a.hasOwnProperty(u)){var fe=a[u];if(fe!=null)switch(u){case"name":h=fe;break;case"type":w=fe;break;case"checked":H=fe;break;case"defaultChecked":re=fe;break;case"value":p=fe;break;case"defaultValue":_=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(s(137,i));break;default:At(n,i,u,fe,a,null)}}pm(n,p,_,H,re,w,h,!1);return;case"select":ot("invalid",n),u=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(_=a[h],_!=null))switch(h){case"value":p=_;break;case"defaultValue":w=_;break;case"multiple":u=_;default:At(n,i,h,_,a,null)}i=p,a=w,n.multiple=!!u,i!=null?As(n,!!u,i,!1):a!=null&&As(n,!!u,a,!0);return;case"textarea":ot("invalid",n),p=h=u=null;for(w in a)if(a.hasOwnProperty(w)&&(_=a[w],_!=null))switch(w){case"value":u=_;break;case"defaultValue":h=_;break;case"children":p=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(s(91));break;default:At(n,i,w,_,a,null)}ym(n,u,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(u=a[H],u!=null))switch(H){case"selected":n.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:At(n,i,H,u,a,null)}return;case"dialog":ot("beforetoggle",n),ot("toggle",n),ot("cancel",n),ot("close",n);break;case"iframe":case"object":ot("load",n);break;case"video":case"audio":for(u=0;u<ul.length;u++)ot(ul[u],n);break;case"image":ot("error",n),ot("load",n);break;case"details":ot("toggle",n);break;case"embed":case"source":case"link":ot("error",n),ot("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(re in a)if(a.hasOwnProperty(re)&&(u=a[re],u!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:At(n,i,re,u,a,null)}return;default:if(lc(i)){for(fe in a)a.hasOwnProperty(fe)&&(u=a[fe],u!==void 0&&Jf(n,i,fe,u,a,void 0));return}}for(_ in a)a.hasOwnProperty(_)&&(u=a[_],u!=null&&At(n,i,_,u,a,null))}function Nw(n,i,a,u){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,w=null,_=null,H=null,re=null,fe=null;for(oe in a){var ye=a[oe];if(a.hasOwnProperty(oe)&&ye!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":H=ye;default:u.hasOwnProperty(oe)||At(n,i,oe,null,u,ye)}}for(var ie in u){var oe=u[ie];if(ye=a[ie],u.hasOwnProperty(ie)&&(oe!=null||ye!=null))switch(ie){case"type":p=oe;break;case"name":h=oe;break;case"checked":re=oe;break;case"defaultChecked":fe=oe;break;case"value":w=oe;break;case"defaultValue":_=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(s(137,i));break;default:oe!==ye&&At(n,i,ie,oe,u,ye)}}sc(n,w,_,H,re,fe,p,h);return;case"select":oe=w=_=ie=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":oe=H;default:u.hasOwnProperty(p)||At(n,i,p,null,u,H)}for(h in u)if(p=u[h],H=a[h],u.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":ie=p;break;case"defaultValue":_=p;break;case"multiple":w=p;default:p!==H&&At(n,i,h,p,u,H)}i=_,a=w,u=oe,ie!=null?As(n,!!a,ie,!1):!!u!=!!a&&(i!=null?As(n,!!a,i,!0):As(n,!!a,a?[]:"",!1));return;case"textarea":oe=ie=null;for(_ in a)if(h=a[_],a.hasOwnProperty(_)&&h!=null&&!u.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:At(n,i,_,null,u,h)}for(w in u)if(h=u[w],p=a[w],u.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":ie=h;break;case"defaultValue":oe=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&At(n,i,w,h,u,p)}gm(n,ie,oe);return;case"option":for(var ze in a)if(ie=a[ze],a.hasOwnProperty(ze)&&ie!=null&&!u.hasOwnProperty(ze))switch(ze){case"selected":n.selected=!1;break;default:At(n,i,ze,null,u,ie)}for(H in u)if(ie=u[H],oe=a[H],u.hasOwnProperty(H)&&ie!==oe&&(ie!=null||oe!=null))switch(H){case"selected":n.selected=ie&&typeof ie!="function"&&typeof ie!="symbol";break;default:At(n,i,H,ie,u,oe)}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 $e in a)ie=a[$e],a.hasOwnProperty($e)&&ie!=null&&!u.hasOwnProperty($e)&&At(n,i,$e,null,u,ie);for(re in u)if(ie=u[re],oe=a[re],u.hasOwnProperty(re)&&ie!==oe&&(ie!=null||oe!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,i));break;default:At(n,i,re,ie,u,oe)}return;default:if(lc(i)){for(var jt in a)ie=a[jt],a.hasOwnProperty(jt)&&ie!==void 0&&!u.hasOwnProperty(jt)&&Jf(n,i,jt,void 0,u,ie);for(fe in u)ie=u[fe],oe=a[fe],!u.hasOwnProperty(fe)||ie===oe||ie===void 0&&oe===void 0||Jf(n,i,fe,ie,u,oe);return}}for(var K in a)ie=a[K],a.hasOwnProperty(K)&&ie!=null&&!u.hasOwnProperty(K)&&At(n,i,K,null,u,ie);for(ye in u)ie=u[ye],oe=a[ye],!u.hasOwnProperty(ye)||ie===oe||ie==null&&oe==null||At(n,i,ye,ie,u,oe)}function vy(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Tw(){if(typeof performance.getEntriesByType=="function"){for(var n=0,i=0,a=performance.getEntriesByType("resource"),u=0;u<a.length;u++){var h=a[u],p=h.transferSize,w=h.initiatorType,_=h.duration;if(p&&_&&vy(w)){for(w=0,_=h.responseEnd,u+=1;u<a.length;u++){var H=a[u],re=H.startTime;if(re>_)break;var fe=H.transferSize,ye=H.initiatorType;fe&&vy(ye)&&(H=H.responseEnd,w+=fe*(H<_?1:(_-re)/(H-re)))}if(--u,i+=8*(p+w)/(h.duration/1e3),n++,10<n)break}}if(0<n)return i/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Xf=null,Kf=null;function Ko(n){return n.nodeType===9?n:n.ownerDocument}function wy(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Sy(n,i){if(n===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&i==="foreignObject"?0:n}function Qf(n,i){return n==="textarea"||n==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Zf=null;function Ow(){var n=window.event;return n&&n.type==="popstate"?n===Zf?!1:(Zf=n,!0):(Zf=null,!1)}var _y=typeof setTimeout=="function"?setTimeout:void 0,Rw=typeof clearTimeout=="function"?clearTimeout:void 0,ky=typeof Promise=="function"?Promise:void 0,Mw=typeof queueMicrotask=="function"?queueMicrotask:typeof ky<"u"?function(n){return ky.resolve(null).then(n).catch(Dw)}:_y;function Dw(n){setTimeout(function(){throw n})}function Bi(n){return n==="head"}function Ey(n,i){var a=i,u=0;do{var h=a.nextSibling;if(n.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(u===0){n.removeChild(h),sa(i);return}u--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")u++;else if(a==="html")fl(n.ownerDocument.documentElement);else if(a==="head"){a=n.ownerDocument.head,fl(a);for(var p=a.firstChild;p;){var w=p.nextSibling,_=p.nodeName;p[gn]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&fl(n.ownerDocument.body);a=h}while(a);sa(i)}function Cy(n,i){var a=n;n=0;do{var u=a.nextSibling;if(a.nodeType===1?i?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(i?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),u&&u.nodeType===8)if(a=u.data,a==="/$"){if(n===0)break;n--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||n++;a=u}while(a)}function Wf(n){var i=n.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var a=i;switch(i=i.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Wf(a),Cs(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}n.removeChild(a)}}function Lw(n,i,a,u){for(;n.nodeType===1;){var h=a;if(n.nodeName.toLowerCase()!==i.toLowerCase()){if(!u&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(u){if(!n[gn])switch(i){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(p=n.getAttribute("rel"),p==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(p!==h.rel||n.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||n.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||n.getAttribute("title")!==(h.title==null?null:h.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(p=n.getAttribute("src"),(p!==(h.src==null?null:h.src)||n.getAttribute("type")!==(h.type==null?null:h.type)||n.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(i==="input"&&n.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&n.getAttribute("name")===p)return n}else return n;if(n=vr(n.nextSibling),n===null)break}return null}function zw(n,i,a){if(i==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=vr(n.nextSibling),n===null))return null;return n}function Ay(n,i){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=vr(n.nextSibling),n===null))return null;return n}function eh(n){return n.data==="$?"||n.data==="$~"}function th(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Uw(n,i){var a=n.ownerDocument;if(n.data==="$~")n._reactRetry=i;else if(n.data!=="$?"||a.readyState!=="loading")i();else{var u=function(){i(),a.removeEventListener("DOMContentLoaded",u)};a.addEventListener("DOMContentLoaded",u),n._reactRetry=u}}function vr(n){for(;n!=null;n=n.nextSibling){var i=n.nodeType;if(i===1||i===3)break;if(i===8){if(i=n.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return n}var nh=null;function jy(n){n=n.nextSibling;for(var i=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"||a==="/&"){if(i===0)return vr(n.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}n=n.nextSibling}return null}function Ny(n){n=n.previousSibling;for(var i=0;n;){if(n.nodeType===8){var a=n.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(i===0)return n;i--}else a!=="/$"&&a!=="/&"||i++}n=n.previousSibling}return null}function Ty(n,i,a){switch(i=Ko(a),n){case"html":if(n=i.documentElement,!n)throw Error(s(452));return n;case"head":if(n=i.head,!n)throw Error(s(453));return n;case"body":if(n=i.body,!n)throw Error(s(454));return n;default:throw Error(s(451))}}function fl(n){for(var i=n.attributes;i.length;)n.removeAttributeNode(i[0]);Cs(n)}var wr=new Map,Oy=new Set;function Qo(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var hi=Q.d;Q.d={f:Pw,r:Bw,D:Hw,C:qw,L:Iw,m:Fw,X:Vw,S:$w,M:Yw};function Pw(){var n=hi.f(),i=Io();return n||i}function Bw(n){var i=D(n);i!==null&&i.tag===5&&i.type==="form"?Jp(i):hi.r(n)}var na=typeof document>"u"?null:document;function Ry(n,i,a){var u=na;if(u&&typeof i=="string"&&i){var h=dr(i);h='link[rel="'+n+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Oy.has(h)||(Oy.add(h),n={rel:n,crossOrigin:a,href:i},u.querySelector(h)===null&&(i=u.createElement("link"),Cn(i,"link",n),F(i),u.head.appendChild(i)))}}function Hw(n){hi.D(n),Ry("dns-prefetch",n,null)}function qw(n,i){hi.C(n,i),Ry("preconnect",n,i)}function Iw(n,i,a){hi.L(n,i,a);var u=na;if(u&&n&&i){var h='link[rel="preload"][as="'+dr(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+dr(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+dr(a.imageSizes)+'"]')):h+='[href="'+dr(n)+'"]';var p=h;switch(i){case"style":p=ra(n);break;case"script":p=ia(n)}wr.has(p)||(n=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:n,as:i},a),wr.set(p,n),u.querySelector(h)!==null||i==="style"&&u.querySelector(hl(p))||i==="script"&&u.querySelector(dl(p))||(i=u.createElement("link"),Cn(i,"link",n),F(i),u.head.appendChild(i)))}}function Fw(n,i){hi.m(n,i);var a=na;if(a&&n){var u=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+dr(u)+'"][href="'+dr(n)+'"]',p=h;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ia(n)}if(!wr.has(p)&&(n=g({rel:"modulepreload",href:n},i),wr.set(p,n),a.querySelector(h)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(dl(p)))return}u=a.createElement("link"),Cn(u,"link",n),F(u),a.head.appendChild(u)}}}function $w(n,i,a){hi.S(n,i,a);var u=na;if(u&&n){var h=U(u).hoistableStyles,p=ra(n);i=i||"default";var w=h.get(p);if(!w){var _={loading:0,preload:null};if(w=u.querySelector(hl(p)))_.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":i},a),(a=wr.get(p))&&rh(n,a);var H=w=u.createElement("link");F(H),Cn(H,"link",n),H._p=new Promise(function(re,fe){H.onload=re,H.onerror=fe}),H.addEventListener("load",function(){_.loading|=1}),H.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Zo(w,i,u)}w={type:"stylesheet",instance:w,count:1,state:_},h.set(p,w)}}}function Vw(n,i){hi.X(n,i);var a=na;if(a&&n){var u=U(a).hoistableScripts,h=ia(n),p=u.get(h);p||(p=a.querySelector(dl(h)),p||(n=g({src:n,async:!0},i),(i=wr.get(h))&&ih(n,i),p=a.createElement("script"),F(p),Cn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(h,p))}}function Yw(n,i){hi.M(n,i);var a=na;if(a&&n){var u=U(a).hoistableScripts,h=ia(n),p=u.get(h);p||(p=a.querySelector(dl(h)),p||(n=g({src:n,async:!0,type:"module"},i),(i=wr.get(h))&&ih(n,i),p=a.createElement("script"),F(p),Cn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(h,p))}}function My(n,i,a,u){var h=(h=Ne.current)?Qo(h):null;if(!h)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(i=ra(a.href),a=U(h).hoistableStyles,u=a.get(i),u||(u={type:"style",instance:null,count:0,state:null},a.set(i,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){n=ra(a.href);var p=U(h).hoistableStyles,w=p.get(n);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,w),(p=h.querySelector(hl(n)))&&!p._p&&(w.instance=p,w.state.loading=5),wr.has(n)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},wr.set(n,a),p||Gw(h,n,a,w.state))),i&&u===null)throw Error(s(528,""));return w}if(i&&u!==null)throw Error(s(529,""));return null;case"script":return i=a.async,a=a.src,typeof a=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=ia(a),a=U(h).hoistableScripts,u=a.get(i),u||(u={type:"script",instance:null,count:0,state:null},a.set(i,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function ra(n){return'href="'+dr(n)+'"'}function hl(n){return'link[rel="stylesheet"]['+n+"]"}function Dy(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function Gw(n,i,a,u){n.querySelector('link[rel="preload"][as="style"]['+i+"]")?u.loading=1:(i=n.createElement("link"),u.preload=i,i.addEventListener("load",function(){return u.loading|=1}),i.addEventListener("error",function(){return u.loading|=2}),Cn(i,"link",a),F(i),n.head.appendChild(i))}function ia(n){return'[src="'+dr(n)+'"]'}function dl(n){return"script[async]"+n}function Ly(n,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var u=n.querySelector('style[data-href~="'+dr(a.href)+'"]');if(u)return i.instance=u,F(u),u;var h=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),F(u),Cn(u,"style",h),Zo(u,a.precedence,n),i.instance=u;case"stylesheet":h=ra(a.href);var p=n.querySelector(hl(h));if(p)return i.state.loading|=4,i.instance=p,F(p),p;u=Dy(a),(h=wr.get(h))&&rh(u,h),p=(n.ownerDocument||n).createElement("link"),F(p);var w=p;return w._p=new Promise(function(_,H){w.onload=_,w.onerror=H}),Cn(p,"link",u),i.state.loading|=4,Zo(p,a.precedence,n),i.instance=p;case"script":return p=ia(a.src),(h=n.querySelector(dl(p)))?(i.instance=h,F(h),h):(u=a,(h=wr.get(p))&&(u=g({},a),ih(u,h)),n=n.ownerDocument||n,h=n.createElement("script"),F(h),Cn(h,"link",u),n.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(u=i.instance,i.state.loading|=4,Zo(u,a.precedence,n));return i.instance}function Zo(n,i,a){for(var u=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=u.length?u[u.length-1]:null,p=h,w=0;w<u.length;w++){var _=u[w];if(_.dataset.precedence===i)p=_;else if(p!==h)break}p?p.parentNode.insertBefore(n,p.nextSibling):(i=a.nodeType===9?a.head:a,i.insertBefore(n,i.firstChild))}function rh(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.title==null&&(n.title=i.title)}function ih(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.integrity==null&&(n.integrity=i.integrity)}var Wo=null;function zy(n,i,a){if(Wo===null){var u=new Map,h=Wo=new Map;h.set(a,u)}else h=Wo,u=h.get(a),u||(u=new Map,h.set(a,u));if(u.has(n))return u;for(u.set(n,null),a=a.getElementsByTagName(n),h=0;h<a.length;h++){var p=a[h];if(!(p[gn]||p[ft]||n==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(i)||"";w=n+w;var _=u.get(w);_?_.push(p):u.set(w,[p])}}return u}function Uy(n,i,a){n=n.ownerDocument||n,n.head.insertBefore(a,i==="title"?n.querySelector("head > title"):null)}function Jw(n,i,a){if(a===1||i.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return n=i.disabled,typeof i.precedence=="string"&&n==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Py(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function Xw(n,i,a,u){if(a.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=ra(u.href),p=i.querySelector(hl(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(n.count++,n=eu.bind(n),i.then(n,n)),a.state.loading|=4,a.instance=p,F(p);return}p=i.ownerDocument||i,u=Dy(u),(h=wr.get(h))&&rh(u,h),p=p.createElement("link"),F(p);var w=p;w._p=new Promise(function(_,H){w.onload=_,w.onerror=H}),Cn(p,"link",u),a.instance=p}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(a,i),(i=a.state.preload)&&(a.state.loading&3)===0&&(n.count++,a=eu.bind(n),i.addEventListener("load",a),i.addEventListener("error",a))}}var sh=0;function Kw(n,i){return n.stylesheets&&n.count===0&&nu(n,n.stylesheets),0<n.count||0<n.imgCount?function(a){var u=setTimeout(function(){if(n.stylesheets&&nu(n,n.stylesheets),n.unsuspend){var p=n.unsuspend;n.unsuspend=null,p()}},6e4+i);0<n.imgBytes&&sh===0&&(sh=62500*Tw());var h=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&nu(n,n.stylesheets),n.unsuspend)){var p=n.unsuspend;n.unsuspend=null,p()}},(n.imgBytes>sh?50:800)+i);return n.unsuspend=a,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(h)}}:null}function eu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var tu=null;function nu(n,i){n.stylesheets=null,n.unsuspend!==null&&(n.count++,tu=new Map,i.forEach(Qw,n),tu=null,eu.call(n))}function Qw(n,i){if(!(i.state.loading&4)){var a=tu.get(n);if(a)var u=a.get(null);else{a=new Map,tu.set(n,a);for(var h=n.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var w=h[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),u=w)}u&&a.set(null,u)}h=i.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||u,p===u&&a.set(null,h),a.set(w,h),this.count++,u=eu.bind(this),h.addEventListener("load",u),h.addEventListener("error",u),p?p.parentNode.insertBefore(h,p.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(h,n.firstChild)),i.state.loading|=4}}var ml={$$typeof:I,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function Zw(n,i,a,u,h,p,w,_,H){this.tag=1,this.containerInfo=n,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=Ee(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ee(0),this.hiddenUpdates=Ee(null),this.identifierPrefix=u,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function By(n,i,a,u,h,p,w,_,H,re,fe,ye){return n=new Zw(n,i,a,w,H,re,fe,ye,_),i=1,p===!0&&(i|=24),p=Zn(3,null,null,i),n.current=p,p.stateNode=n,i=Uc(),i.refCount++,n.pooledCache=i,i.refCount++,p.memoizedState={element:u,isDehydrated:a,cache:i},qc(p),n}function Hy(n){return n?(n=Ls,n):Ls}function qy(n,i,a,u,h,p){h=Hy(h),u.context===null?u.context=h:u.pendingContext=h,u=ji(i),u.payload={element:a},p=p===void 0?null:p,p!==null&&(u.callback=p),a=Ni(n,u,i),a!==null&&(Yn(a,n,i),Ya(a,n,i))}function Iy(n,i){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<i?a:i}}function ah(n,i){Iy(n,i),(n=n.alternate)&&Iy(n,i)}function Fy(n){if(n.tag===13||n.tag===31){var i=as(n,67108864);i!==null&&Yn(i,n,67108864),ah(n,67108864)}}function $y(n){if(n.tag===13||n.tag===31){var i=rr();i=Pe(i);var a=as(n,i);a!==null&&Yn(a,n,i),ah(n,i)}}var ru=!0;function Ww(n,i,a,u){var h=V.T;V.T=null;var p=Q.p;try{Q.p=2,lh(n,i,a,u)}finally{Q.p=p,V.T=h}}function eS(n,i,a,u){var h=V.T;V.T=null;var p=Q.p;try{Q.p=8,lh(n,i,a,u)}finally{Q.p=p,V.T=h}}function lh(n,i,a,u){if(ru){var h=oh(u);if(h===null)Gf(n,i,u,iu,a),Yy(n,u);else if(nS(h,n,i,a,u))u.stopPropagation();else if(Yy(n,u),i&4&&-1<tS.indexOf(n)){for(;h!==null;){var p=D(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=bt(p.pendingLanes);if(w!==0){var _=p;for(_.pendingLanes|=2,_.entangledLanes|=2;w;){var H=1<<31-Ze(w);_.entanglements[1]|=H,w&=~H}Ir(p),(wt&6)===0&&(Ho=at()+500,ol(0))}}break;case 31:case 13:_=as(p,2),_!==null&&Yn(_,p,2),Io(),ah(p,2)}if(p=oh(u),p===null&&Gf(n,i,u,iu,a),p===h)break;h=p}h!==null&&u.stopPropagation()}else Gf(n,i,u,null,a)}}function oh(n){return n=uc(n),uh(n)}var iu=null;function uh(n){if(iu=null,n=k(n),n!==null){var i=o(n);if(i===null)n=null;else{var a=i.tag;if(a===13){if(n=c(i),n!==null)return n;n=null}else if(a===31){if(n=f(i),n!==null)return n;n=null}else if(a===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;n=null}else i!==n&&(n=null)}}return iu=n,null}function Vy(n){switch(n){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(Cr()){case ae:return 2;case _e:return 8;case Me:case Ge:return 32;case rt:return 268435456;default:return 32}default:return 32}}var ch=!1,Hi=null,qi=null,Ii=null,pl=new Map,gl=new Map,Fi=[],tS="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 Yy(n,i){switch(n){case"focusin":case"focusout":Hi=null;break;case"dragenter":case"dragleave":qi=null;break;case"mouseover":case"mouseout":Ii=null;break;case"pointerover":case"pointerout":pl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":gl.delete(i.pointerId)}}function yl(n,i,a,u,h,p){return n===null||n.nativeEvent!==p?(n={blockedOn:i,domEventName:a,eventSystemFlags:u,nativeEvent:p,targetContainers:[h]},i!==null&&(i=D(i),i!==null&&Fy(i)),n):(n.eventSystemFlags|=u,i=n.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),n)}function nS(n,i,a,u,h){switch(i){case"focusin":return Hi=yl(Hi,n,i,a,u,h),!0;case"dragenter":return qi=yl(qi,n,i,a,u,h),!0;case"mouseover":return Ii=yl(Ii,n,i,a,u,h),!0;case"pointerover":var p=h.pointerId;return pl.set(p,yl(pl.get(p)||null,n,i,a,u,h)),!0;case"gotpointercapture":return p=h.pointerId,gl.set(p,yl(gl.get(p)||null,n,i,a,u,h)),!0}return!1}function Gy(n){var i=k(n.target);if(i!==null){var a=o(i);if(a!==null){if(i=a.tag,i===13){if(i=c(a),i!==null){n.blockedOn=i,Qt(n.priority,function(){$y(a)});return}}else if(i===31){if(i=f(a),i!==null){n.blockedOn=i,Qt(n.priority,function(){$y(a)});return}}else if(i===3&&a.stateNode.current.memoizedState.isDehydrated){n.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}n.blockedOn=null}function su(n){if(n.blockedOn!==null)return!1;for(var i=n.targetContainers;0<i.length;){var a=oh(n.nativeEvent);if(a===null){a=n.nativeEvent;var u=new a.constructor(a.type,a);oc=u,a.target.dispatchEvent(u),oc=null}else return i=D(a),i!==null&&Fy(i),n.blockedOn=a,!1;i.shift()}return!0}function Jy(n,i,a){su(n)&&a.delete(i)}function rS(){ch=!1,Hi!==null&&su(Hi)&&(Hi=null),qi!==null&&su(qi)&&(qi=null),Ii!==null&&su(Ii)&&(Ii=null),pl.forEach(Jy),gl.forEach(Jy)}function au(n,i){n.blockedOn===i&&(n.blockedOn=null,ch||(ch=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,rS)))}var lu=null;function Xy(n){lu!==n&&(lu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){lu===n&&(lu=null);for(var i=0;i<n.length;i+=3){var a=n[i],u=n[i+1],h=n[i+2];if(typeof u!="function"){if(uh(u||a)===null)continue;break}var p=D(a);p!==null&&(n.splice(i,3),i-=3,of(p,{pending:!0,data:h,method:a.method,action:u},u,h))}}))}function sa(n){function i(H){return au(H,n)}Hi!==null&&au(Hi,n),qi!==null&&au(qi,n),Ii!==null&&au(Ii,n),pl.forEach(i),gl.forEach(i);for(var a=0;a<Fi.length;a++){var u=Fi[a];u.blockedOn===n&&(u.blockedOn=null)}for(;0<Fi.length&&(a=Fi[0],a.blockedOn===null);)Gy(a),a.blockedOn===null&&Fi.shift();if(a=(n.ownerDocument||n).$$reactFormReplay,a!=null)for(u=0;u<a.length;u+=3){var h=a[u],p=a[u+1],w=h[Bt]||null;if(typeof p=="function")w||Xy(a);else if(w){var _=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[Bt]||null)_=w.formAction;else if(uh(h)!==null)continue}else _=w.action;typeof _=="function"?a[u+1]=_:(a.splice(u,3),u-=3),Xy(a)}}}function Ky(){function n(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return h=w})},focusReset:"manual",scroll:"manual"})}function i(){h!==null&&(h(),h=null),u||setTimeout(a,20)}function a(){if(!u&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,h=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){u=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function fh(n){this._internalRoot=n}ou.prototype.render=fh.prototype.render=function(n){var i=this._internalRoot;if(i===null)throw Error(s(409));var a=i.current,u=rr();qy(a,u,n,i,null,null)},ou.prototype.unmount=fh.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var i=n.containerInfo;qy(n.current,2,null,n,null,null),Io(),i[jn]=null}};function ou(n){this._internalRoot=n}ou.prototype.unstable_scheduleHydration=function(n){if(n){var i=Zt();n={blockedOn:null,target:n,priority:i};for(var a=0;a<Fi.length&&i!==0&&i<Fi[a].priority;a++);Fi.splice(a,0,n),a===0&&Gy(n)}};var Qy=t.version;if(Qy!=="19.2.4")throw Error(s(527,Qy,"19.2.4"));Q.findDOMNode=function(n){var i=n._reactInternals;if(i===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=m(i),n=n!==null?b(n):null,n=n===null?null:n.stateNode,n};var iS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uu.isDisabled&&uu.supportsFiber)try{Kt=uu.inject(iS),yt=uu}catch{}}return xl.createRoot=function(n,i){if(!l(n))throw Error(s(299));var a=!1,u="",h=ig,p=sg,w=ag;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),i=By(n,1,!1,null,null,a,u,null,h,p,w,Ky),n[jn]=i.current,Yf(n),new fh(i)},xl.hydrateRoot=function(n,i,a){if(!l(n))throw Error(s(299));var u=!1,h="",p=ig,w=sg,_=ag,H=null;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(_=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),i=By(n,1,!0,i,a??null,u,h,H,p,w,_,Ky),i.context=Hy(null),a=i.current,u=rr(),u=Pe(u),h=ji(u),h.callback=null,Ni(a,h,u),a=u,i.current.lanes=a,He(i,a),Ir(i),n[jn]=i.current,Yf(n),new ou(i)},xl.version="19.2.4",xl}var l0;function pS(){if(l0)return mh.exports;l0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),mh.exports=mS(),mh.exports}var gS=pS();/**
|
|
50
50
|
* react-router v7.13.1
|
|
51
51
|
*
|
|
52
52
|
* Copyright (c) Remix Software Inc.
|
|
@@ -55,22 +55,22 @@ Error generating stack: `+u.message+`
|
|
|
55
55
|
* LICENSE.md file in the root directory of this source tree.
|
|
56
56
|
*
|
|
57
57
|
* @license MIT
|
|
58
|
-
*/var o0="popstate";function u0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function yS(e={}){function t(s,l){var m;let o=(m=l.state)==null?void 0:m.masked,{pathname:c,search:f,hash:d}=o||s.location;return Wh("",{pathname:c,search:f,hash:d},l.state&&l.state.usr||null,l.state&&l.state.key||"default",o?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,l){return typeof l=="string"?l:Pl(l)}return xS(t,r,null,e)}function Yt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Lr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function bS(){return Math.random().toString(36).substring(2,10)}function c0(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Wh(e,t,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ea(t):t,state:r,key:t&&t.key||s||bS(),unstable_mask:l}}function Pl({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Ea(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function xS(e,t,r,s={}){let{window:l=document.defaultView,v5Compat:o=!1}=s,c=l.history,f="POP",d=null,m=b();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function b(){return(c.state||{idx:null}).idx}function g(){f="POP";let O=b(),M=O==null?null:O-m;m=O,d&&d({action:f,location:A.location,delta:M})}function x(O,M){f="PUSH";let P=u0(O)?O:Wh(A.location,O,M);m=b()+1;let I=c0(P,m),te=A.createHref(P.unstable_mask||P);try{c.pushState(I,"",te)}catch(q){if(q instanceof DOMException&&q.name==="DataCloneError")throw q;l.location.assign(te)}o&&d&&d({action:f,location:A.location,delta:1})}function v(O,M){f="REPLACE";let P=u0(O)?O:Wh(A.location,O,M);m=b();let I=c0(P,m),te=A.createHref(P.unstable_mask||P);c.replaceState(I,"",te),o&&d&&d({action:f,location:A.location,delta:0})}function S(O){return vS(O)}let A={get action(){return f},get location(){return e(l,c)},listen(O){if(d)throw new Error("A history only accepts one active listener");return l.addEventListener(o0,g),d=O,()=>{l.removeEventListener(o0,g),d=null}},createHref(O){return t(l,O)},createURL:S,encodeLocation(O){let M=S(O);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:x,replace:v,go(O){return c.go(O)}};return A}function vS(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Yt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Pl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function Gb(e,t,r="/"){return wS(e,t,r,!1)}function wS(e,t,r,s){let l=typeof t=="string"?Ea(t):t,o=yi(l.pathname||"/",r);if(o==null)return null;let c=Jb(e);SS(c);let f=null;for(let d=0;f==null&&d<c.length;++d){let m=MS(o);f=OS(c[d],m,s)}return f}function Jb(e,t=[],r=[],s="",l=!1){let o=(c,f,d=l,m)=>{let b={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(s)&&d)return;Yt(b.relativePath.startsWith(s),`Absolute route path "${b.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(s.length)}let g=Vr([s,b.relativePath]),x=r.concat(b);c.children&&c.children.length>0&&(Yt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Jb(c.children,t,x,g,d)),!(c.path==null&&!c.index)&&t.push({path:g,score:NS(g,c.index),routesMeta:x})};return e.forEach((c,f)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))o(c,f);else for(let m of Xb(c.path))o(c,f,!0,m)}),t}function Xb(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,l=r.endsWith("?"),o=r.replace(/\?$/,"");if(s.length===0)return l?[o,""]:[o];let c=Xb(s.join("/")),f=[];return f.push(...c.map(d=>d===""?o:[o,d].join("/"))),l&&f.push(...c),f.map(d=>e.startsWith("/")&&d===""?"/":d)}function SS(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:TS(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var _S=/^:[\w-]+$/,kS=3,ES=2,CS=1,AS=10,jS=-2,f0=e=>e==="*";function NS(e,t){let r=e.split("/"),s=r.length;return r.some(f0)&&(s+=jS),t&&(s+=ES),r.filter(l=>!f0(l)).reduce((l,o)=>l+(_S.test(o)?kS:o===""?CS:AS),s)}function TS(e,t){return e.length===t.length&&e.slice(0,-1).every((s,l)=>s===t[l])?e[e.length-1]-t[t.length-1]:0}function OS(e,t,r=!1){let{routesMeta:s}=e,l={},o="/",c=[];for(let f=0;f<s.length;++f){let d=s[f],m=f===s.length-1,b=o==="/"?t:t.slice(o.length)||"/",g=ju({path:d.relativePath,caseSensitive:d.caseSensitive,end:m},b),x=d.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=ju({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},b)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:Vr([o,g.pathname]),pathnameBase:US(Vr([o,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(o=Vr([o,g.pathnameBase]))}return c}function ju(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=RS(e.path,e.caseSensitive,e.end),l=t.match(r);if(!l)return null;let o=l[0],c=o.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:s.reduce((m,{paramName:b,isOptional:g},x)=>{if(b==="*"){let S=f[x]||"";c=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const v=f[x];return g&&!v?m[b]=void 0:m[b]=(v||"").replace(/%2F/g,"/"),m},{}),pathname:o,pathnameBase:c,pattern:e}}function RS(e,t=!1,r=!0){Lr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,d,m,b)=>{if(s.push({paramName:f,isOptional:d!=null}),d){let g=b.charAt(m+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),s]}function MS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Lr(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function yi(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}var DS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function LS(e,t="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?Ea(e):e,o;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?o=h0(r.substring(1),"/"):o=h0(r,t)):o=t,{pathname:o,search:PS(s),hash:BS(l)}}function h0(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?r.length>1&&r.pop():l!=="."&&r.push(l)}),r.length>1?r.join("/"):"/"}function bh(e,t,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function zS(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Td(e){let t=zS(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function $u(e,t,r,s=!1){let l;typeof e=="string"?l=Ea(e):(l={...e},Yt(!l.pathname||!l.pathname.includes("?"),bh("?","pathname","search",l)),Yt(!l.pathname||!l.pathname.includes("#"),bh("#","pathname","hash",l)),Yt(!l.search||!l.search.includes("#"),bh("#","search","hash",l)));let o=e===""||l.pathname==="",c=o?"/":l.pathname,f;if(c==null)f=r;else{let g=t.length-1;if(!s&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;l.pathname=x.join("/")}f=g>=0?t[g]:"/"}let d=LS(l,f),m=c&&c!=="/"&&c.endsWith("/"),b=(o||c===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(m||b)&&(d.pathname+="/"),d}var Vr=e=>e.join("/").replace(/\/\/+/g,"/"),US=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),PS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,BS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,HS=class{constructor(e,t,r,s=!1){this.status=e,this.statusText=t||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function qS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function IS(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Kb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Qb(e,t){let r=e;if(typeof r!="string"||!DS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,l=!1;if(Kb)try{let o=new URL(window.location.href),c=r.startsWith("//")?new URL(o.protocol+r):new URL(r),f=yi(c.pathname,t);c.origin===o.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{Lr(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:l,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Zb=["POST","PUT","PATCH","DELETE"];new Set(Zb);var FS=["GET",...Zb];new Set(FS);var Ca=E.createContext(null);Ca.displayName="DataRouter";var Vu=E.createContext(null);Vu.displayName="DataRouterState";var $S=E.createContext(!1),Wb=E.createContext({isTransitioning:!1});Wb.displayName="ViewTransition";var VS=E.createContext(new Map);VS.displayName="Fetchers";var YS=E.createContext(null);YS.displayName="Await";var cr=E.createContext(null);cr.displayName="Navigation";var Yl=E.createContext(null);Yl.displayName="Location";var zr=E.createContext({outlet:null,matches:[],isDataRoute:!1});zr.displayName="Route";var Od=E.createContext(null);Od.displayName="RouteError";var ex="REACT_ROUTER_ERROR",GS="REDIRECT",JS="ROUTE_ERROR_RESPONSE";function XS(e){if(e.startsWith(`${ex}:${GS}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function KS(e){if(e.startsWith(`${ex}:${JS}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new HS(t.status,t.statusText,t.data)}catch{}}function QS(e,{relative:t}={}){Yt(Aa(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=E.useContext(cr),{hash:l,pathname:o,search:c}=Gl(e,{relative:t}),f=o;return r!=="/"&&(f=o==="/"?r:Vr([r,o])),s.createHref({pathname:f,search:c,hash:l})}function Aa(){return E.useContext(Yl)!=null}function kr(){return Yt(Aa(),"useLocation() may be used only in the context of a <Router> component."),E.useContext(Yl).location}var tx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nx(e){E.useContext(cr).static||E.useLayoutEffect(e)}function Yr(){let{isDataRoute:e}=E.useContext(zr);return e?c_():ZS()}function ZS(){Yt(Aa(),"useNavigate() may be used only in the context of a <Router> component.");let e=E.useContext(Ca),{basename:t,navigator:r}=E.useContext(cr),{matches:s}=E.useContext(zr),{pathname:l}=kr(),o=JSON.stringify(Td(s)),c=E.useRef(!1);return nx(()=>{c.current=!0}),E.useCallback((d,m={})=>{if(Lr(c.current,tx),!c.current)return;if(typeof d=="number"){r.go(d);return}let b=$u(d,JSON.parse(o),l,m.relative==="path");e==null&&t!=="/"&&(b.pathname=b.pathname==="/"?t:Vr([t,b.pathname])),(m.replace?r.replace:r.push)(b,m.state,m)},[t,r,o,l,e])}E.createContext(null);function Yu(){let{matches:e}=E.useContext(zr),t=e[e.length-1];return t?t.params:{}}function Gl(e,{relative:t}={}){let{matches:r}=E.useContext(zr),{pathname:s}=kr(),l=JSON.stringify(Td(r));return E.useMemo(()=>$u(e,JSON.parse(l),s,t==="path"),[e,l,s,t])}function WS(e,t){return rx(e,t)}function rx(e,t,r){var O;Yt(Aa(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=E.useContext(cr),{matches:l}=E.useContext(zr),o=l[l.length-1],c=o?o.params:{},f=o?o.pathname:"/",d=o?o.pathnameBase:"/",m=o&&o.route;{let M=m&&m.path||"";sx(f,!m||M.endsWith("*")||M.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${M}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
58
|
+
*/var o0="popstate";function u0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function yS(e={}){function t(s,l){var m;let o=(m=l.state)==null?void 0:m.masked,{pathname:c,search:f,hash:d}=o||s.location;return Wh("",{pathname:c,search:f,hash:d},l.state&&l.state.usr||null,l.state&&l.state.key||"default",o?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,l){return typeof l=="string"?l:Pl(l)}return xS(t,r,null,e)}function Xt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function zr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function bS(){return Math.random().toString(36).substring(2,10)}function c0(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Wh(e,t,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ea(t):t,state:r,key:t&&t.key||s||bS(),unstable_mask:l}}function Pl({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Ea(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function xS(e,t,r,s={}){let{window:l=document.defaultView,v5Compat:o=!1}=s,c=l.history,f="POP",d=null,m=b();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function b(){return(c.state||{idx:null}).idx}function g(){f="POP";let R=b(),M=R==null?null:R-m;m=R,d&&d({action:f,location:j.location,delta:M})}function x(R,M){f="PUSH";let P=u0(R)?R:Wh(j.location,R,M);m=b()+1;let I=c0(P,m),ue=j.createHref(P.unstable_mask||P);try{c.pushState(I,"",ue)}catch(q){if(q instanceof DOMException&&q.name==="DataCloneError")throw q;l.location.assign(ue)}o&&d&&d({action:f,location:j.location,delta:1})}function v(R,M){f="REPLACE";let P=u0(R)?R:Wh(j.location,R,M);m=b();let I=c0(P,m),ue=j.createHref(P.unstable_mask||P);c.replaceState(I,"",ue),o&&d&&d({action:f,location:j.location,delta:0})}function S(R){return vS(R)}let j={get action(){return f},get location(){return e(l,c)},listen(R){if(d)throw new Error("A history only accepts one active listener");return l.addEventListener(o0,g),d=R,()=>{l.removeEventListener(o0,g),d=null}},createHref(R){return t(l,R)},createURL:S,encodeLocation(R){let M=S(R);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:x,replace:v,go(R){return c.go(R)}};return j}function vS(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Xt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Pl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function Gb(e,t,r="/"){return wS(e,t,r,!1)}function wS(e,t,r,s){let l=typeof t=="string"?Ea(t):t,o=yi(l.pathname||"/",r);if(o==null)return null;let c=Jb(e);SS(c);let f=null;for(let d=0;f==null&&d<c.length;++d){let m=MS(o);f=OS(c[d],m,s)}return f}function Jb(e,t=[],r=[],s="",l=!1){let o=(c,f,d=l,m)=>{let b={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(s)&&d)return;Xt(b.relativePath.startsWith(s),`Absolute route path "${b.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(s.length)}let g=Yr([s,b.relativePath]),x=r.concat(b);c.children&&c.children.length>0&&(Xt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Jb(c.children,t,x,g,d)),!(c.path==null&&!c.index)&&t.push({path:g,score:NS(g,c.index),routesMeta:x})};return e.forEach((c,f)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))o(c,f);else for(let m of Xb(c.path))o(c,f,!0,m)}),t}function Xb(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,l=r.endsWith("?"),o=r.replace(/\?$/,"");if(s.length===0)return l?[o,""]:[o];let c=Xb(s.join("/")),f=[];return f.push(...c.map(d=>d===""?o:[o,d].join("/"))),l&&f.push(...c),f.map(d=>e.startsWith("/")&&d===""?"/":d)}function SS(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:TS(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var _S=/^:[\w-]+$/,kS=3,ES=2,CS=1,AS=10,jS=-2,f0=e=>e==="*";function NS(e,t){let r=e.split("/"),s=r.length;return r.some(f0)&&(s+=jS),t&&(s+=ES),r.filter(l=>!f0(l)).reduce((l,o)=>l+(_S.test(o)?kS:o===""?CS:AS),s)}function TS(e,t){return e.length===t.length&&e.slice(0,-1).every((s,l)=>s===t[l])?e[e.length-1]-t[t.length-1]:0}function OS(e,t,r=!1){let{routesMeta:s}=e,l={},o="/",c=[];for(let f=0;f<s.length;++f){let d=s[f],m=f===s.length-1,b=o==="/"?t:t.slice(o.length)||"/",g=ju({path:d.relativePath,caseSensitive:d.caseSensitive,end:m},b),x=d.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=ju({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},b)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:Yr([o,g.pathname]),pathnameBase:US(Yr([o,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(o=Yr([o,g.pathnameBase]))}return c}function ju(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=RS(e.path,e.caseSensitive,e.end),l=t.match(r);if(!l)return null;let o=l[0],c=o.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:s.reduce((m,{paramName:b,isOptional:g},x)=>{if(b==="*"){let S=f[x]||"";c=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const v=f[x];return g&&!v?m[b]=void 0:m[b]=(v||"").replace(/%2F/g,"/"),m},{}),pathname:o,pathnameBase:c,pattern:e}}function RS(e,t=!1,r=!0){zr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,d,m,b)=>{if(s.push({paramName:f,isOptional:d!=null}),d){let g=b.charAt(m+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),s]}function MS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return zr(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function yi(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}var DS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function LS(e,t="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?Ea(e):e,o;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?o=h0(r.substring(1),"/"):o=h0(r,t)):o=t,{pathname:o,search:PS(s),hash:BS(l)}}function h0(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?r.length>1&&r.pop():l!=="."&&r.push(l)}),r.length>1?r.join("/"):"/"}function bh(e,t,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function zS(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Td(e){let t=zS(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function $u(e,t,r,s=!1){let l;typeof e=="string"?l=Ea(e):(l={...e},Xt(!l.pathname||!l.pathname.includes("?"),bh("?","pathname","search",l)),Xt(!l.pathname||!l.pathname.includes("#"),bh("#","pathname","hash",l)),Xt(!l.search||!l.search.includes("#"),bh("#","search","hash",l)));let o=e===""||l.pathname==="",c=o?"/":l.pathname,f;if(c==null)f=r;else{let g=t.length-1;if(!s&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;l.pathname=x.join("/")}f=g>=0?t[g]:"/"}let d=LS(l,f),m=c&&c!=="/"&&c.endsWith("/"),b=(o||c===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(m||b)&&(d.pathname+="/"),d}var Yr=e=>e.join("/").replace(/\/\/+/g,"/"),US=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),PS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,BS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,HS=class{constructor(e,t,r,s=!1){this.status=e,this.statusText=t||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function qS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function IS(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Kb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Qb(e,t){let r=e;if(typeof r!="string"||!DS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,l=!1;if(Kb)try{let o=new URL(window.location.href),c=r.startsWith("//")?new URL(o.protocol+r):new URL(r),f=yi(c.pathname,t);c.origin===o.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{zr(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:l,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Zb=["POST","PUT","PATCH","DELETE"];new Set(Zb);var FS=["GET",...Zb];new Set(FS);var Ca=E.createContext(null);Ca.displayName="DataRouter";var Vu=E.createContext(null);Vu.displayName="DataRouterState";var $S=E.createContext(!1),Wb=E.createContext({isTransitioning:!1});Wb.displayName="ViewTransition";var VS=E.createContext(new Map);VS.displayName="Fetchers";var YS=E.createContext(null);YS.displayName="Await";var fr=E.createContext(null);fr.displayName="Navigation";var Yl=E.createContext(null);Yl.displayName="Location";var Ur=E.createContext({outlet:null,matches:[],isDataRoute:!1});Ur.displayName="Route";var Od=E.createContext(null);Od.displayName="RouteError";var ex="REACT_ROUTER_ERROR",GS="REDIRECT",JS="ROUTE_ERROR_RESPONSE";function XS(e){if(e.startsWith(`${ex}:${GS}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function KS(e){if(e.startsWith(`${ex}:${JS}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new HS(t.status,t.statusText,t.data)}catch{}}function QS(e,{relative:t}={}){Xt(Aa(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=E.useContext(fr),{hash:l,pathname:o,search:c}=Gl(e,{relative:t}),f=o;return r!=="/"&&(f=o==="/"?r:Yr([r,o])),s.createHref({pathname:f,search:c,hash:l})}function Aa(){return E.useContext(Yl)!=null}function Er(){return Xt(Aa(),"useLocation() may be used only in the context of a <Router> component."),E.useContext(Yl).location}var tx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nx(e){E.useContext(fr).static||E.useLayoutEffect(e)}function Gr(){let{isDataRoute:e}=E.useContext(Ur);return e?c_():ZS()}function ZS(){Xt(Aa(),"useNavigate() may be used only in the context of a <Router> component.");let e=E.useContext(Ca),{basename:t,navigator:r}=E.useContext(fr),{matches:s}=E.useContext(Ur),{pathname:l}=Er(),o=JSON.stringify(Td(s)),c=E.useRef(!1);return nx(()=>{c.current=!0}),E.useCallback((d,m={})=>{if(zr(c.current,tx),!c.current)return;if(typeof d=="number"){r.go(d);return}let b=$u(d,JSON.parse(o),l,m.relative==="path");e==null&&t!=="/"&&(b.pathname=b.pathname==="/"?t:Yr([t,b.pathname])),(m.replace?r.replace:r.push)(b,m.state,m)},[t,r,o,l,e])}E.createContext(null);function Yu(){let{matches:e}=E.useContext(Ur),t=e[e.length-1];return t?t.params:{}}function Gl(e,{relative:t}={}){let{matches:r}=E.useContext(Ur),{pathname:s}=Er(),l=JSON.stringify(Td(r));return E.useMemo(()=>$u(e,JSON.parse(l),s,t==="path"),[e,l,s,t])}function WS(e,t){return rx(e,t)}function rx(e,t,r){var R;Xt(Aa(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=E.useContext(fr),{matches:l}=E.useContext(Ur),o=l[l.length-1],c=o?o.params:{},f=o?o.pathname:"/",d=o?o.pathnameBase:"/",m=o&&o.route;{let M=m&&m.path||"";sx(f,!m||M.endsWith("*")||M.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${M}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
59
|
|
|
60
|
-
Please change the parent <Route path="${M}"> to <Route path="${M==="/"?"*":`${M}/*`}">.`)}let b=kr(),g;if(t){let M=typeof t=="string"?Ea(t):t;Yt(d==="/"||((O=M.pathname)==null?void 0:O.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${M.pathname}" was given in the \`location\` prop.`),g=M}else g=b;let x=g.pathname||"/",v=x;if(d!=="/"){let M=d.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(M.length).join("/")}let S=Gb(e,{pathname:v});Lr(m||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Lr(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let A=i_(S&&S.map(M=>Object.assign({},M,{params:Object.assign({},c,M.params),pathname:Vr([d,s.encodeLocation?s.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?d:Vr([d,s.encodeLocation?s.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),l,r);return t&&A?E.createElement(Yl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},A):A}function e_(){let e=u_(),t=qS(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:s},o={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=E.createElement(E.Fragment,null,E.createElement("p",null,"💿 Hey developer 👋"),E.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",E.createElement("code",{style:o},"ErrorBoundary")," or"," ",E.createElement("code",{style:o},"errorElement")," prop on your route.")),E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},t),r?E.createElement("pre",{style:l},r):null,c)}var t_=E.createElement(e_,null),ix=class extends E.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=KS(e.digest);r&&(e=r)}let t=e!==void 0?E.createElement(zr.Provider,{value:this.props.routeContext},E.createElement(Od.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?E.createElement(n_,{error:e},t):t}};ix.contextType=$S;var xh=new WeakMap;function n_({children:e,error:t}){let{basename:r}=E.useContext(cr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=XS(t.digest);if(s){let l=xh.get(t);if(l)throw l;let o=Qb(s.location,r);if(Kb&&!xh.get(t))if(o.isExternal||s.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:s.replace}));throw xh.set(t,c),c}return E.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function r_({routeContext:e,match:t,children:r}){let s=E.useContext(Ca);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),E.createElement(zr.Provider,{value:e},r)}function i_(e,t=[],r){let s=r==null?void 0:r.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let l=e,o=s==null?void 0:s.errors;if(o!=null){let b=l.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);Yt(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),l=l.slice(0,Math.min(l.length,b+1))}let c=!1,f=-1;if(r&&s){c=s.renderFallback;for(let b=0;b<l.length;b++){let g=l[b];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=b),g.route.id){let{loaderData:x,errors:v}=s,S=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!v||v[g.route.id]===void 0);if(g.route.lazy||S){r.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let d=r==null?void 0:r.onError,m=s&&d?(b,g)=>{var x,v;d(b,{location:s.location,params:((v=(x=s.matches)==null?void 0:x[0])==null?void 0:v.params)??{},unstable_pattern:IS(s.matches),errorInfo:g})}:void 0;return l.reduceRight((b,g,x)=>{let v,S=!1,A=null,O=null;s&&(v=o&&g.route.id?o[g.route.id]:void 0,A=g.route.errorElement||t_,c&&(f<0&&x===0?(sx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,O=null):f===x&&(S=!0,O=g.route.hydrateFallbackElement||null)));let M=t.concat(l.slice(0,x+1)),P=()=>{let I;return v?I=A:S?I=O:g.route.Component?I=E.createElement(g.route.Component,null):g.route.element?I=g.route.element:I=b,E.createElement(r_,{match:g,routeContext:{outlet:b,matches:M,isDataRoute:s!=null},children:I})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?E.createElement(ix,{location:s.location,revalidation:s.revalidation,component:A,error:v,children:P(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:m}):P()},null)}function Rd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function s_(e){let t=E.useContext(Ca);return Yt(t,Rd(e)),t}function a_(e){let t=E.useContext(Vu);return Yt(t,Rd(e)),t}function l_(e){let t=E.useContext(zr);return Yt(t,Rd(e)),t}function Md(e){let t=l_(e),r=t.matches[t.matches.length-1];return Yt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function o_(){return Md("useRouteId")}function u_(){var s;let e=E.useContext(Od),t=a_("useRouteError"),r=Md("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function c_(){let{router:e}=s_("useNavigate"),t=Md("useNavigate"),r=E.useRef(!1);return nx(()=>{r.current=!0}),E.useCallback(async(l,o={})=>{Lr(r.current,tx),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var d0={};function sx(e,t,r){!t&&!d0[e]&&(d0[e]=!0,Lr(!1,r))}E.memo(f_);function f_({routes:e,future:t,state:r,isStatic:s,onError:l}){return rx(e,void 0,{state:r,isStatic:s,onError:l})}function Bl({to:e,replace:t,state:r,relative:s}){Yt(Aa(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=E.useContext(cr);Lr(!l,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=E.useContext(zr),{pathname:c}=kr(),f=Yr(),d=$u(e,Td(o),c,s==="path"),m=JSON.stringify(d);return E.useEffect(()=>{f(JSON.parse(m),{replace:t,state:r,relative:s})},[f,m,s,t,r]),null}function Or(e){Yt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function h_({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:l,static:o=!1,unstable_useTransitions:c}){Yt(!Aa(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),d=E.useMemo(()=>({basename:f,navigator:l,static:o,unstable_useTransitions:c,future:{}}),[f,l,o,c]);typeof r=="string"&&(r=Ea(r));let{pathname:m="/",search:b="",hash:g="",state:x=null,key:v="default",unstable_mask:S}=r,A=E.useMemo(()=>{let O=yi(m,f);return O==null?null:{location:{pathname:O,search:b,hash:g,state:x,key:v,unstable_mask:S},navigationType:s}},[f,m,b,g,x,v,s,S]);return Lr(A!=null,`<Router basename="${f}"> is not able to match the URL "${m}${b}${g}" because it does not start with the basename, so the <Router> won't render anything.`),A==null?null:E.createElement(cr.Provider,{value:d},E.createElement(Yl.Provider,{children:t,value:A}))}function ax({children:e,location:t}){return WS(ed(e),t)}function ed(e,t=[]){let r=[];return E.Children.forEach(e,(s,l)=>{if(!E.isValidElement(s))return;let o=[...t,l];if(s.type===E.Fragment){r.push.apply(r,ed(s.props.children,o));return}Yt(s.type===Or,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Yt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||o.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=ed(s.props.children,o)),r.push(c)}),r}var Su="get",_u="application/x-www-form-urlencoded";function Gu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function d_(e){return Gu(e)&&e.tagName.toLowerCase()==="button"}function m_(e){return Gu(e)&&e.tagName.toLowerCase()==="form"}function p_(e){return Gu(e)&&e.tagName.toLowerCase()==="input"}function g_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function y_(e,t){return e.button===0&&(!t||t==="_self")&&!g_(e)}var cu=null;function b_(){if(cu===null)try{new FormData(document.createElement("form"),0),cu=!1}catch{cu=!0}return cu}var x_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vh(e){return e!=null&&!x_.has(e)?(Lr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_u}"`),null):e}function v_(e,t){let r,s,l,o,c;if(m_(e)){let f=e.getAttribute("action");s=f?yi(f,t):null,r=e.getAttribute("method")||Su,l=vh(e.getAttribute("enctype"))||_u,o=new FormData(e)}else if(d_(e)||p_(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=e.getAttribute("formaction")||f.getAttribute("action");if(s=d?yi(d,t):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||Su,l=vh(e.getAttribute("formenctype"))||vh(f.getAttribute("enctype"))||_u,o=new FormData(f,e),!b_()){let{name:m,type:b,value:g}=e;if(b==="image"){let x=m?`${m}.`:"";o.append(`${x}x`,"0"),o.append(`${x}y`,"0")}else m&&o.append(m,g)}}else{if(Gu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Su,s=null,l=_u,c=e}return o&&l==="text/plain"&&(c=o,o=void 0),{action:s,method:r.toLowerCase(),encType:l,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Dd(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function w_(e,t,r,s){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${s}`:l.pathname=`${l.pathname}.${s}`:l.pathname==="/"?l.pathname=`_root.${s}`:t&&yi(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function S_(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function __(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function k_(e,t,r){let s=await Promise.all(e.map(async l=>{let o=t.routes[l.route.id];if(o){let c=await S_(o,r);return c.links?c.links():[]}return[]}));return j_(s.flat(1).filter(__).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function m0(e,t,r,s,l,o){let c=(d,m)=>r[m]?d.route.id!==r[m].route.id:!0,f=(d,m)=>{var b;return r[m].pathname!==d.pathname||((b=r[m].route.path)==null?void 0:b.endsWith("*"))&&r[m].params["*"]!==d.params["*"]};return o==="assets"?t.filter((d,m)=>c(d,m)||f(d,m)):o==="data"?t.filter((d,m)=>{var g;let b=s.routes[d.route.id];if(!b||!b.hasLoader)return!1;if(c(d,m)||f(d,m))return!0;if(d.route.shouldRevalidate){let x=d.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function E_(e,t,{includeHydrateFallback:r}={}){return C_(e.map(s=>{let l=t.routes[s.route.id];if(!l)return[];let o=[l.module];return l.clientActionModule&&(o=o.concat(l.clientActionModule)),l.clientLoaderModule&&(o=o.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(o=o.concat(l.hydrateFallbackModule)),l.imports&&(o=o.concat(l.imports)),o}).flat(1))}function C_(e){return[...new Set(e)]}function A_(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function j_(e,t){let r=new Set;return new Set(t),e.reduce((s,l)=>{let o=JSON.stringify(A_(l));return r.has(o)||(r.add(o),s.push({key:o,link:l})),s},[])}function lx(){let e=E.useContext(Ca);return Dd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function N_(){let e=E.useContext(Vu);return Dd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ld=E.createContext(void 0);Ld.displayName="FrameworkContext";function ox(){let e=E.useContext(Ld);return Dd(e,"You must render this element inside a <HydratedRouter> element"),e}function T_(e,t){let r=E.useContext(Ld),[s,l]=E.useState(!1),[o,c]=E.useState(!1),{onFocus:f,onBlur:d,onMouseEnter:m,onMouseLeave:b,onTouchStart:g}=t,x=E.useRef(null);E.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let A=M=>{M.forEach(P=>{c(P.isIntersecting)})},O=new IntersectionObserver(A,{threshold:.5});return x.current&&O.observe(x.current),()=>{O.disconnect()}}},[e]),E.useEffect(()=>{if(s){let A=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(A)}}},[s]);let v=()=>{l(!0)},S=()=>{l(!1),c(!1)};return r?e!=="intent"?[o,x,{}]:[o,x,{onFocus:vl(f,v),onBlur:vl(d,S),onMouseEnter:vl(m,v),onMouseLeave:vl(b,S),onTouchStart:vl(g,v)}]:[!1,x,{}]}function vl(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function O_({page:e,...t}){let{router:r}=lx(),s=E.useMemo(()=>Gb(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?E.createElement(M_,{page:e,matches:s,...t}):null}function R_(e){let{manifest:t,routeModules:r}=ox(),[s,l]=E.useState([]);return E.useEffect(()=>{let o=!1;return k_(e,t,r).then(c=>{o||l(c)}),()=>{o=!0}},[e,t,r]),s}function M_({page:e,matches:t,...r}){let s=kr(),{future:l,manifest:o,routeModules:c}=ox(),{basename:f}=lx(),{loaderData:d,matches:m}=N_(),b=E.useMemo(()=>m0(e,t,m,o,s,"data"),[e,t,m,o,s]),g=E.useMemo(()=>m0(e,t,m,o,s,"assets"),[e,t,m,o,s]),x=E.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let A=new Set,O=!1;if(t.forEach(P=>{var te;let I=o.routes[P.route.id];!I||!I.hasLoader||(!b.some(q=>q.route.id===P.route.id)&&P.route.id in d&&((te=c[P.route.id])!=null&&te.shouldRevalidate)||I.hasClientLoader?O=!0:A.add(P.route.id))}),A.size===0)return[];let M=w_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return O&&A.size>0&&M.searchParams.set("_routes",t.filter(P=>A.has(P.route.id)).map(P=>P.route.id).join(",")),[M.pathname+M.search]},[f,l.unstable_trailingSlashAwareDataRequests,d,s,o,b,t,e,c]),v=E.useMemo(()=>E_(g,o),[g,o]),S=R_(g);return E.createElement(E.Fragment,null,x.map(A=>E.createElement("link",{key:A,rel:"prefetch",as:"fetch",href:A,...r})),v.map(A=>E.createElement("link",{key:A,rel:"modulepreload",href:A,...r})),S.map(({key:A,link:O})=>E.createElement("link",{key:A,nonce:r.nonce,...O,crossOrigin:O.crossOrigin??r.crossOrigin})))}function D_(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var L_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{L_&&(window.__reactRouterVersion="7.13.1")}catch{}function z_({basename:e,children:t,unstable_useTransitions:r,window:s}){let l=E.useRef();l.current==null&&(l.current=yS({window:s,v5Compat:!0}));let o=l.current,[c,f]=E.useState({action:o.action,location:o.location}),d=E.useCallback(m=>{r===!1?f(m):E.startTransition(()=>f(m))},[r]);return E.useLayoutEffect(()=>o.listen(d),[o,d]),E.createElement(h_,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:r})}var ux=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,cx=E.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:l,reloadDocument:o,replace:c,unstable_mask:f,state:d,target:m,to:b,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:v,...S},A){let{basename:O,navigator:M,unstable_useTransitions:P}=E.useContext(cr),I=typeof b=="string"&&ux.test(b),te=Qb(b,O);b=te.to;let q=QS(b,{relative:l}),L=kr(),ee=null;if(f){let ne=$u(f,[],L.unstable_mask?L.unstable_mask.pathname:"/",!0);O!=="/"&&(ne.pathname=ne.pathname==="/"?O:Vr([O,ne.pathname])),ee=M.createHref(ne)}let[J,B,D]=T_(s,S),G=H_(b,{replace:c,unstable_mask:f,state:d,target:m,preventScrollReset:g,relative:l,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:P});function F(ne){t&&t(ne),ne.defaultPrevented||G(ne)}let fe=!(te.isExternal||o),oe=E.createElement("a",{...S,...D,href:(fe?ee:void 0)||te.absoluteURL||q,onClick:fe?F:t,ref:D_(A,B),target:m,"data-discover":!I&&r==="render"?"true":void 0});return J&&!I?E.createElement(E.Fragment,null,oe,E.createElement(O_,{page:q})):oe});cx.displayName="Link";var U_=E.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:l=!1,style:o,to:c,viewTransition:f,children:d,...m},b){let g=Gl(c,{relative:m.relative}),x=kr(),v=E.useContext(Vu),{navigator:S,basename:A}=E.useContext(cr),O=v!=null&&V_(g)&&f===!0,M=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,P=x.pathname,I=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(P=P.toLowerCase(),I=I?I.toLowerCase():null,M=M.toLowerCase()),I&&A&&(I=yi(I,A)||I);const te=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let q=P===M||!l&&P.startsWith(M)&&P.charAt(te)==="/",L=I!=null&&(I===M||!l&&I.startsWith(M)&&I.charAt(M.length)==="/"),ee={isActive:q,isPending:L,isTransitioning:O},J=q?t:void 0,B;typeof s=="function"?B=s(ee):B=[s,q?"active":null,L?"pending":null,O?"transitioning":null].filter(Boolean).join(" ");let D=typeof o=="function"?o(ee):o;return E.createElement(cx,{...m,"aria-current":J,className:B,ref:b,style:D,to:c,viewTransition:f},typeof d=="function"?d(ee):d)});U_.displayName="NavLink";var P_=E.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:l,state:o,method:c=Su,action:f,onSubmit:d,relative:m,preventScrollReset:b,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},S)=>{let{unstable_useTransitions:A}=E.useContext(cr),O=F_(),M=$_(f,{relative:m}),P=c.toLowerCase()==="get"?"get":"post",I=typeof f=="string"&&ux.test(f),te=q=>{if(d&&d(q),q.defaultPrevented)return;q.preventDefault();let L=q.nativeEvent.submitter,ee=(L==null?void 0:L.getAttribute("formmethod"))||c,J=()=>O(L||q.currentTarget,{fetcherKey:t,method:ee,navigate:r,replace:l,state:o,relative:m,preventScrollReset:b,viewTransition:g,unstable_defaultShouldRevalidate:x});A&&r!==!1?E.startTransition(()=>J()):J()};return E.createElement("form",{ref:S,method:P,action:M,onSubmit:s?d:te,...v,"data-discover":!I&&e==="render"?"true":void 0})});P_.displayName="Form";function B_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fx(e){let t=E.useContext(Ca);return Yt(t,B_(e)),t}function H_(e,{target:t,replace:r,unstable_mask:s,state:l,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d,unstable_useTransitions:m}={}){let b=Yr(),g=kr(),x=Gl(e,{relative:c});return E.useCallback(v=>{if(y_(v,t)){v.preventDefault();let S=r!==void 0?r:Pl(g)===Pl(x),A=()=>b(e,{replace:S,unstable_mask:s,state:l,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d});m?E.startTransition(()=>A()):A()}},[g,b,x,r,s,l,t,e,o,c,f,d,m])}var q_=0,I_=()=>`__${String(++q_)}__`;function F_(){let{router:e}=fx("useSubmit"),{basename:t}=E.useContext(cr),r=o_(),s=e.fetch,l=e.navigate;return E.useCallback(async(o,c={})=>{let{action:f,method:d,encType:m,formData:b,body:g}=v_(o,t);if(c.navigate===!1){let x=c.fetcherKey||I_();await s(x,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:g,formMethod:c.method||d,formEncType:c.encType||m,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:g,formMethod:c.method||d,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,l,t,r])}function $_(e,{relative:t}={}){let{basename:r}=E.useContext(cr),s=E.useContext(zr);Yt(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),o={...Gl(e||".",{relative:t})},c=kr();if(e==null){o.search=c.search;let f=new URLSearchParams(o.search),d=f.getAll("index");if(d.some(b=>b==="")){f.delete("index"),d.filter(g=>g).forEach(g=>f.append("index",g));let b=f.toString();o.search=b?`?${b}`:""}}return(!e||e===".")&&l.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:Vr([r,o.pathname])),Pl(o)}function V_(e,{relative:t}={}){let r=E.useContext(Wb);Yt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=fx("useViewTransitionState"),l=Gl(e,{relative:t});if(!r.isTransitioning)return!1;let o=yi(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=yi(r.nextLocation.pathname,s)||r.nextLocation.pathname;return ju(l.pathname,c)!=null||ju(l.pathname,o)!=null}var pi=Yb();const hx=E.createContext(null),dx="palmier_paired_hosts",p0="palmier_last_host";function Y_(){try{const e=localStorage.getItem(dx);if(e)return JSON.parse(e)}catch{}return[]}function G_(e){localStorage.setItem(dx,JSON.stringify(e))}const g0="local",J_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function X_({children:e}){const[t,r]=E.useState(()=>{const x=Y_();return J_&&!x.some(v=>v.hostId===g0)&&x.push({hostId:g0,clientToken:"",directUrl:window.location.origin}),x}),[s,l]=E.useState(()=>{try{return localStorage.getItem(p0)}catch{return null}});E.useEffect(()=>{G_(t)},[t]);const o=E.useCallback(x=>{l(v=>v===x?v:x);try{localStorage.setItem(p0,x)}catch{}},[]),c=E.useCallback(x=>{r(v=>[...v.filter(A=>A.hostId!==x.hostId),x])},[]),f=E.useCallback(x=>{r(v=>v.filter(S=>S.hostId!==x))},[]),d=E.useCallback((x,v)=>{r(S=>S.map(A=>A.hostId===x?{...A,name:v}:A))},[]),m=E.useCallback((x,v)=>{r(S=>S.map(A=>A.hostId!==x||A.lanUrl===v?A:{...A,lanUrl:v}))},[]),b=E.useCallback((x,v)=>{r(S=>S.map(A=>A.hostId!==x||A.lastAgent===v?A:{...A,lastAgent:v}))},[]),g=E.useCallback((x,v)=>{r(S=>S.map(A=>A.hostId!==x||A.timezone===v?A:{...A,timezone:v}))},[]);return y.jsx(hx.Provider,{value:{pairedHosts:t,lastHostId:s,addPairedHost:c,removePairedHost:f,renamePairedHost:d,setHostLanUrl:m,setHostLastAgent:b,setHostTimezone:g,setLastHostId:o},children:e})}function Zi(){const e=E.useContext(hx);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const ur=new Uint8Array(0),Wi=new TextEncoder,ar=new TextDecoder;function K_(...e){let t=0;for(let l=0;l<e.length;l++)t+=e[l].length;const r=new Uint8Array(t);let s=0;for(let l=0;l<e.length;l++)r.set(e[l],s),s+=e[l].length;return r}function Tl(...e){const t=[];for(let r=0;r<e.length;r++)t.push(Wi.encode(e[r]));return t.length===0?ur:t.length===1?t[0]:K_(...t)}function y0(e){return!e||e.length===0?"":ar.decode(e)}const b0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",x0=36,Q_=0xcfd41b9100000,v0=33,Z_=333,w0=22;function W_(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*255)}function e2(e){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(e):W_(e)}class t2{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(w0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*Q_),this.inc=Math.floor(Math.random()*(Z_-v0)+v0)}setPre(){const t=new Uint8Array(12);e2(t);for(let r=0;r<12;r++){const s=t[r]%36;this.buf[r]=b0.charCodeAt(s)}}fillSeq(){let t=this.seq;for(let r=w0-1;r>=12;r--)this.buf[r]=b0.charCodeAt(t%x0),t=Math.floor(t/x0)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Ki=new t2;var di;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(di||(di={}));var da;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(da||(da={}));var Ce;(function(e){e.ApiError="BAD API",e.BadAuthentication="BAD_AUTHENTICATION",e.BadCreds="BAD_CREDS",e.BadHeader="BAD_HEADER",e.BadJson="BAD_JSON",e.BadPayload="BAD_PAYLOAD",e.BadSubject="BAD_SUBJECT",e.Cancelled="CANCELLED",e.ConnectionClosed="CONNECTION_CLOSED",e.ConnectionDraining="CONNECTION_DRAINING",e.ConnectionRefused="CONNECTION_REFUSED",e.ConnectionTimeout="CONNECTION_TIMEOUT",e.Disconnect="DISCONNECT",e.InvalidOption="INVALID_OPTION",e.InvalidPayload="INVALID_PAYLOAD",e.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",e.NoResponders="503",e.NotFunction="NOT_FUNC",e.RequestError="REQUEST_ERROR",e.ServerOptionNotAvailable="SERVER_OPT_NA",e.SubClosed="SUB_CLOSED",e.SubDraining="SUB_DRAINING",e.Timeout="TIMEOUT",e.Tls="TLS",e.Unknown="UNKNOWN_ERROR",e.WssRequired="WSS_REQUIRED",e.JetStreamInvalidAck="JESTREAM_INVALID_ACK",e.JetStream404NoMessages="404",e.JetStream408RequestTimeout="408",e.JetStream409MaxAckPendingExceeded="409",e.JetStream409="409",e.JetStreamNotEnabled="503",e.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",e.AuthorizationViolation="AUTHORIZATION_VIOLATION",e.AuthenticationExpired="AUTHENTICATION_EXPIRED",e.ProtocolError="NATS_PROTOCOL_ERR",e.PermissionsViolation="PERMISSIONS_VIOLATION",e.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",e.AccountExpired="ACCOUNT_EXPIRED"})(Ce||(Ce={}));function n2(e){return typeof e.code=="string"}class mx{constructor(){C(this,"messages");this.messages=new Map,this.messages.set(Ce.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(Ce.BadJson,"Bad JSON"),this.messages.set(Ce.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return r2.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const r2=new mx;class De extends Error{constructor(r,s,l){super(r);C(this,"name");C(this,"message");C(this,"code");C(this,"permissionContext");C(this,"chainedError");C(this,"api_error");this.name="NatsError",this.message=r,this.code=s,this.chainedError=l}static errorForCode(r,s){const l=mx.getMessage(r);return new De(l,r,s)}isAuthError(){return this.code===Ce.AuthenticationExpired||this.code===Ce.AuthorizationViolation||this.code===Ce.AccountExpired}isAuthTimeout(){return this.code===Ce.AuthenticationTimeout}isPermissionError(){return this.code===Ce.PermissionsViolation}isProtocolError(){return this.code===Ce.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var ir;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(ir||(ir={}));var Rr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(Rr||(Rr={}));var Ol;(function(e){e.STATS="io.nats.micro.v1.stats_response",e.INFO="io.nats.micro.v1.info_response",e.PING="io.nats.micro.v1.ping_response"})(Ol||(Ol={}));const Nu="Nats-Service-Error",Tu="Nats-Service-Error-Code";class Ou extends Error{constructor(r,s){super(s);C(this,"code");this.code=r}static isServiceError(r){return Ou.toServiceError(r)!==null}static toServiceError(r){var l,o;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(Tu))||"";if(s!==""){const c=parseInt(s)||400,f=((o=r==null?void 0:r.headers)==null?void 0:o.get(Nu))||"";return new Ou(c,f.length?f:s)}return null}}function gi(e=""){if(e=e||"_INBOX",typeof e!="string")throw new Error("prefix must be a string");return e.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${e}'`)}),`${e}.${Ki.next()}`}const td="127.0.0.1";var Gi;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Gi||(Gi={}));function Ju(e,...t){for(let r=0;r<t.length;r++){const s=t[r];Object.keys(s).forEach(function(l){e[l]=s[l]})}return e}function fu(e){return ar.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function va(e,t=!0){const r=t?De.errorForCode(Ce.Timeout):null;let s,l;const o=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?De.errorForCode(Ce.Timeout):r)},e)});return Object.assign(o,s)}function ja(e=0){let t;const r=new Promise(s=>{const l=setTimeout(()=>{s()},e);t={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,t)}function Vt(){let e={};const t=new Promise((r,s)=>{e={resolve:r,reject:s}});return Object.assign(t,e)}function px(e){for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e}function i2(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function zd(e=[0,250,250,500,500,3e3,5e3]){Array.isArray(e)||(e=[0,250,250,500,500,3e3,5e3]);const t=e.length-1;return{backoff(r){return i2(r>t?e[t]:e[r])}}}function $t(e){return e*1e6}function Ud(e){return Math.floor(e/1e6)}function S0(e){let s=!0;const l=new Array(e.length);for(let o=0;o<e.length;o++){let c=e.charCodeAt(o);if(c===58||c<33||c>126)throw new De(`'${e[o]}' is not a valid character for a header key`,Ce.BadHeader);s&&97<=c&&c<=122?c-=32:!s&&65<=c&&c<=90&&(c+=32),l[o]=c,s=c==45}return String.fromCharCode(...l)}function bi(e=0,t=""){if(e===0&&t!==""||e>0&&t==="")throw new Error("setting status requires both code and description");return new Ji(e,t)}const wh="NATS/1.0";class Ji{constructor(t=0,r=""){C(this,"_code");C(this,"headers");C(this,"_description");this._code=t,this._description=r,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[r,s]of this.headers){const l=t.values(r);if(s.length!==l.length)return!1;const o=[...s].sort(),c=[...l].sort();for(let f=0;f<o.length;f++)if(o[f]!==c[f])return!1}return!0}return!1}static decode(t){const r=new Ji,l=ar.decode(t).split(`\r
|
|
60
|
+
Please change the parent <Route path="${M}"> to <Route path="${M==="/"?"*":`${M}/*`}">.`)}let b=Er(),g;if(t){let M=typeof t=="string"?Ea(t):t;Xt(d==="/"||((R=M.pathname)==null?void 0:R.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${M.pathname}" was given in the \`location\` prop.`),g=M}else g=b;let x=g.pathname||"/",v=x;if(d!=="/"){let M=d.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(M.length).join("/")}let S=Gb(e,{pathname:v});zr(m||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),zr(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=i_(S&&S.map(M=>Object.assign({},M,{params:Object.assign({},c,M.params),pathname:Yr([d,s.encodeLocation?s.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?d:Yr([d,s.encodeLocation?s.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),l,r);return t&&j?E.createElement(Yl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function e_(){let e=u_(),t=qS(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:s},o={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=E.createElement(E.Fragment,null,E.createElement("p",null,"💿 Hey developer 👋"),E.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",E.createElement("code",{style:o},"ErrorBoundary")," or"," ",E.createElement("code",{style:o},"errorElement")," prop on your route.")),E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},t),r?E.createElement("pre",{style:l},r):null,c)}var t_=E.createElement(e_,null),ix=class extends E.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=KS(e.digest);r&&(e=r)}let t=e!==void 0?E.createElement(Ur.Provider,{value:this.props.routeContext},E.createElement(Od.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?E.createElement(n_,{error:e},t):t}};ix.contextType=$S;var xh=new WeakMap;function n_({children:e,error:t}){let{basename:r}=E.useContext(fr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=XS(t.digest);if(s){let l=xh.get(t);if(l)throw l;let o=Qb(s.location,r);if(Kb&&!xh.get(t))if(o.isExternal||s.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:s.replace}));throw xh.set(t,c),c}return E.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function r_({routeContext:e,match:t,children:r}){let s=E.useContext(Ca);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),E.createElement(Ur.Provider,{value:e},r)}function i_(e,t=[],r){let s=r==null?void 0:r.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let l=e,o=s==null?void 0:s.errors;if(o!=null){let b=l.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);Xt(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),l=l.slice(0,Math.min(l.length,b+1))}let c=!1,f=-1;if(r&&s){c=s.renderFallback;for(let b=0;b<l.length;b++){let g=l[b];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=b),g.route.id){let{loaderData:x,errors:v}=s,S=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!v||v[g.route.id]===void 0);if(g.route.lazy||S){r.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let d=r==null?void 0:r.onError,m=s&&d?(b,g)=>{var x,v;d(b,{location:s.location,params:((v=(x=s.matches)==null?void 0:x[0])==null?void 0:v.params)??{},unstable_pattern:IS(s.matches),errorInfo:g})}:void 0;return l.reduceRight((b,g,x)=>{let v,S=!1,j=null,R=null;s&&(v=o&&g.route.id?o[g.route.id]:void 0,j=g.route.errorElement||t_,c&&(f<0&&x===0?(sx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,R=null):f===x&&(S=!0,R=g.route.hydrateFallbackElement||null)));let M=t.concat(l.slice(0,x+1)),P=()=>{let I;return v?I=j:S?I=R:g.route.Component?I=E.createElement(g.route.Component,null):g.route.element?I=g.route.element:I=b,E.createElement(r_,{match:g,routeContext:{outlet:b,matches:M,isDataRoute:s!=null},children:I})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?E.createElement(ix,{location:s.location,revalidation:s.revalidation,component:j,error:v,children:P(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:m}):P()},null)}function Rd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function s_(e){let t=E.useContext(Ca);return Xt(t,Rd(e)),t}function a_(e){let t=E.useContext(Vu);return Xt(t,Rd(e)),t}function l_(e){let t=E.useContext(Ur);return Xt(t,Rd(e)),t}function Md(e){let t=l_(e),r=t.matches[t.matches.length-1];return Xt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function o_(){return Md("useRouteId")}function u_(){var s;let e=E.useContext(Od),t=a_("useRouteError"),r=Md("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function c_(){let{router:e}=s_("useNavigate"),t=Md("useNavigate"),r=E.useRef(!1);return nx(()=>{r.current=!0}),E.useCallback(async(l,o={})=>{zr(r.current,tx),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var d0={};function sx(e,t,r){!t&&!d0[e]&&(d0[e]=!0,zr(!1,r))}E.memo(f_);function f_({routes:e,future:t,state:r,isStatic:s,onError:l}){return rx(e,void 0,{state:r,isStatic:s,onError:l})}function Bl({to:e,replace:t,state:r,relative:s}){Xt(Aa(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=E.useContext(fr);zr(!l,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=E.useContext(Ur),{pathname:c}=Er(),f=Gr(),d=$u(e,Td(o),c,s==="path"),m=JSON.stringify(d);return E.useEffect(()=>{f(JSON.parse(m),{replace:t,state:r,relative:s})},[f,m,s,t,r]),null}function Rr(e){Xt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function h_({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:l,static:o=!1,unstable_useTransitions:c}){Xt(!Aa(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),d=E.useMemo(()=>({basename:f,navigator:l,static:o,unstable_useTransitions:c,future:{}}),[f,l,o,c]);typeof r=="string"&&(r=Ea(r));let{pathname:m="/",search:b="",hash:g="",state:x=null,key:v="default",unstable_mask:S}=r,j=E.useMemo(()=>{let R=yi(m,f);return R==null?null:{location:{pathname:R,search:b,hash:g,state:x,key:v,unstable_mask:S},navigationType:s}},[f,m,b,g,x,v,s,S]);return zr(j!=null,`<Router basename="${f}"> is not able to match the URL "${m}${b}${g}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:E.createElement(fr.Provider,{value:d},E.createElement(Yl.Provider,{children:t,value:j}))}function ax({children:e,location:t}){return WS(ed(e),t)}function ed(e,t=[]){let r=[];return E.Children.forEach(e,(s,l)=>{if(!E.isValidElement(s))return;let o=[...t,l];if(s.type===E.Fragment){r.push.apply(r,ed(s.props.children,o));return}Xt(s.type===Rr,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Xt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||o.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=ed(s.props.children,o)),r.push(c)}),r}var Su="get",_u="application/x-www-form-urlencoded";function Gu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function d_(e){return Gu(e)&&e.tagName.toLowerCase()==="button"}function m_(e){return Gu(e)&&e.tagName.toLowerCase()==="form"}function p_(e){return Gu(e)&&e.tagName.toLowerCase()==="input"}function g_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function y_(e,t){return e.button===0&&(!t||t==="_self")&&!g_(e)}var cu=null;function b_(){if(cu===null)try{new FormData(document.createElement("form"),0),cu=!1}catch{cu=!0}return cu}var x_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vh(e){return e!=null&&!x_.has(e)?(zr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_u}"`),null):e}function v_(e,t){let r,s,l,o,c;if(m_(e)){let f=e.getAttribute("action");s=f?yi(f,t):null,r=e.getAttribute("method")||Su,l=vh(e.getAttribute("enctype"))||_u,o=new FormData(e)}else if(d_(e)||p_(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=e.getAttribute("formaction")||f.getAttribute("action");if(s=d?yi(d,t):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||Su,l=vh(e.getAttribute("formenctype"))||vh(f.getAttribute("enctype"))||_u,o=new FormData(f,e),!b_()){let{name:m,type:b,value:g}=e;if(b==="image"){let x=m?`${m}.`:"";o.append(`${x}x`,"0"),o.append(`${x}y`,"0")}else m&&o.append(m,g)}}else{if(Gu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Su,s=null,l=_u,c=e}return o&&l==="text/plain"&&(c=o,o=void 0),{action:s,method:r.toLowerCase(),encType:l,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Dd(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function w_(e,t,r,s){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${s}`:l.pathname=`${l.pathname}.${s}`:l.pathname==="/"?l.pathname=`_root.${s}`:t&&yi(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function S_(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function __(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function k_(e,t,r){let s=await Promise.all(e.map(async l=>{let o=t.routes[l.route.id];if(o){let c=await S_(o,r);return c.links?c.links():[]}return[]}));return j_(s.flat(1).filter(__).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function m0(e,t,r,s,l,o){let c=(d,m)=>r[m]?d.route.id!==r[m].route.id:!0,f=(d,m)=>{var b;return r[m].pathname!==d.pathname||((b=r[m].route.path)==null?void 0:b.endsWith("*"))&&r[m].params["*"]!==d.params["*"]};return o==="assets"?t.filter((d,m)=>c(d,m)||f(d,m)):o==="data"?t.filter((d,m)=>{var g;let b=s.routes[d.route.id];if(!b||!b.hasLoader)return!1;if(c(d,m)||f(d,m))return!0;if(d.route.shouldRevalidate){let x=d.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function E_(e,t,{includeHydrateFallback:r}={}){return C_(e.map(s=>{let l=t.routes[s.route.id];if(!l)return[];let o=[l.module];return l.clientActionModule&&(o=o.concat(l.clientActionModule)),l.clientLoaderModule&&(o=o.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(o=o.concat(l.hydrateFallbackModule)),l.imports&&(o=o.concat(l.imports)),o}).flat(1))}function C_(e){return[...new Set(e)]}function A_(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function j_(e,t){let r=new Set;return new Set(t),e.reduce((s,l)=>{let o=JSON.stringify(A_(l));return r.has(o)||(r.add(o),s.push({key:o,link:l})),s},[])}function lx(){let e=E.useContext(Ca);return Dd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function N_(){let e=E.useContext(Vu);return Dd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ld=E.createContext(void 0);Ld.displayName="FrameworkContext";function ox(){let e=E.useContext(Ld);return Dd(e,"You must render this element inside a <HydratedRouter> element"),e}function T_(e,t){let r=E.useContext(Ld),[s,l]=E.useState(!1),[o,c]=E.useState(!1),{onFocus:f,onBlur:d,onMouseEnter:m,onMouseLeave:b,onTouchStart:g}=t,x=E.useRef(null);E.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=M=>{M.forEach(P=>{c(P.isIntersecting)})},R=new IntersectionObserver(j,{threshold:.5});return x.current&&R.observe(x.current),()=>{R.disconnect()}}},[e]),E.useEffect(()=>{if(s){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[s]);let v=()=>{l(!0)},S=()=>{l(!1),c(!1)};return r?e!=="intent"?[o,x,{}]:[o,x,{onFocus:vl(f,v),onBlur:vl(d,S),onMouseEnter:vl(m,v),onMouseLeave:vl(b,S),onTouchStart:vl(g,v)}]:[!1,x,{}]}function vl(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function O_({page:e,...t}){let{router:r}=lx(),s=E.useMemo(()=>Gb(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?E.createElement(M_,{page:e,matches:s,...t}):null}function R_(e){let{manifest:t,routeModules:r}=ox(),[s,l]=E.useState([]);return E.useEffect(()=>{let o=!1;return k_(e,t,r).then(c=>{o||l(c)}),()=>{o=!0}},[e,t,r]),s}function M_({page:e,matches:t,...r}){let s=Er(),{future:l,manifest:o,routeModules:c}=ox(),{basename:f}=lx(),{loaderData:d,matches:m}=N_(),b=E.useMemo(()=>m0(e,t,m,o,s,"data"),[e,t,m,o,s]),g=E.useMemo(()=>m0(e,t,m,o,s,"assets"),[e,t,m,o,s]),x=E.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let j=new Set,R=!1;if(t.forEach(P=>{var ue;let I=o.routes[P.route.id];!I||!I.hasLoader||(!b.some(q=>q.route.id===P.route.id)&&P.route.id in d&&((ue=c[P.route.id])!=null&&ue.shouldRevalidate)||I.hasClientLoader?R=!0:j.add(P.route.id))}),j.size===0)return[];let M=w_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return R&&j.size>0&&M.searchParams.set("_routes",t.filter(P=>j.has(P.route.id)).map(P=>P.route.id).join(",")),[M.pathname+M.search]},[f,l.unstable_trailingSlashAwareDataRequests,d,s,o,b,t,e,c]),v=E.useMemo(()=>E_(g,o),[g,o]),S=R_(g);return E.createElement(E.Fragment,null,x.map(j=>E.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...r})),v.map(j=>E.createElement("link",{key:j,rel:"modulepreload",href:j,...r})),S.map(({key:j,link:R})=>E.createElement("link",{key:j,nonce:r.nonce,...R,crossOrigin:R.crossOrigin??r.crossOrigin})))}function D_(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var L_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{L_&&(window.__reactRouterVersion="7.13.1")}catch{}function z_({basename:e,children:t,unstable_useTransitions:r,window:s}){let l=E.useRef();l.current==null&&(l.current=yS({window:s,v5Compat:!0}));let o=l.current,[c,f]=E.useState({action:o.action,location:o.location}),d=E.useCallback(m=>{r===!1?f(m):E.startTransition(()=>f(m))},[r]);return E.useLayoutEffect(()=>o.listen(d),[o,d]),E.createElement(h_,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:r})}var ux=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,cx=E.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:l,reloadDocument:o,replace:c,unstable_mask:f,state:d,target:m,to:b,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:v,...S},j){let{basename:R,navigator:M,unstable_useTransitions:P}=E.useContext(fr),I=typeof b=="string"&&ux.test(b),ue=Qb(b,R);b=ue.to;let q=QS(b,{relative:l}),N=Er(),ee=null;if(f){let te=$u(f,[],N.unstable_mask?N.unstable_mask.pathname:"/",!0);R!=="/"&&(te.pathname=te.pathname==="/"?R:Yr([R,te.pathname])),ee=M.createHref(te)}let[G,B,L]=T_(s,S),J=H_(b,{replace:c,unstable_mask:f,state:d,target:m,preventScrollReset:g,relative:l,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:P});function $(te){t&&t(te),te.defaultPrevented||J(te)}let he=!(ue.isExternal||o),le=E.createElement("a",{...S,...L,href:(he?ee:void 0)||ue.absoluteURL||q,onClick:he?$:t,ref:D_(j,B),target:m,"data-discover":!I&&r==="render"?"true":void 0});return G&&!I?E.createElement(E.Fragment,null,le,E.createElement(O_,{page:q})):le});cx.displayName="Link";var U_=E.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:l=!1,style:o,to:c,viewTransition:f,children:d,...m},b){let g=Gl(c,{relative:m.relative}),x=Er(),v=E.useContext(Vu),{navigator:S,basename:j}=E.useContext(fr),R=v!=null&&V_(g)&&f===!0,M=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,P=x.pathname,I=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(P=P.toLowerCase(),I=I?I.toLowerCase():null,M=M.toLowerCase()),I&&j&&(I=yi(I,j)||I);const ue=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let q=P===M||!l&&P.startsWith(M)&&P.charAt(ue)==="/",N=I!=null&&(I===M||!l&&I.startsWith(M)&&I.charAt(M.length)==="/"),ee={isActive:q,isPending:N,isTransitioning:R},G=q?t:void 0,B;typeof s=="function"?B=s(ee):B=[s,q?"active":null,N?"pending":null,R?"transitioning":null].filter(Boolean).join(" ");let L=typeof o=="function"?o(ee):o;return E.createElement(cx,{...m,"aria-current":G,className:B,ref:b,style:L,to:c,viewTransition:f},typeof d=="function"?d(ee):d)});U_.displayName="NavLink";var P_=E.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:l,state:o,method:c=Su,action:f,onSubmit:d,relative:m,preventScrollReset:b,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},S)=>{let{unstable_useTransitions:j}=E.useContext(fr),R=F_(),M=$_(f,{relative:m}),P=c.toLowerCase()==="get"?"get":"post",I=typeof f=="string"&&ux.test(f),ue=q=>{if(d&&d(q),q.defaultPrevented)return;q.preventDefault();let N=q.nativeEvent.submitter,ee=(N==null?void 0:N.getAttribute("formmethod"))||c,G=()=>R(N||q.currentTarget,{fetcherKey:t,method:ee,navigate:r,replace:l,state:o,relative:m,preventScrollReset:b,viewTransition:g,unstable_defaultShouldRevalidate:x});j&&r!==!1?E.startTransition(()=>G()):G()};return E.createElement("form",{ref:S,method:P,action:M,onSubmit:s?d:ue,...v,"data-discover":!I&&e==="render"?"true":void 0})});P_.displayName="Form";function B_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fx(e){let t=E.useContext(Ca);return Xt(t,B_(e)),t}function H_(e,{target:t,replace:r,unstable_mask:s,state:l,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d,unstable_useTransitions:m}={}){let b=Gr(),g=Er(),x=Gl(e,{relative:c});return E.useCallback(v=>{if(y_(v,t)){v.preventDefault();let S=r!==void 0?r:Pl(g)===Pl(x),j=()=>b(e,{replace:S,unstable_mask:s,state:l,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d});m?E.startTransition(()=>j()):j()}},[g,b,x,r,s,l,t,e,o,c,f,d,m])}var q_=0,I_=()=>`__${String(++q_)}__`;function F_(){let{router:e}=fx("useSubmit"),{basename:t}=E.useContext(fr),r=o_(),s=e.fetch,l=e.navigate;return E.useCallback(async(o,c={})=>{let{action:f,method:d,encType:m,formData:b,body:g}=v_(o,t);if(c.navigate===!1){let x=c.fetcherKey||I_();await s(x,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:g,formMethod:c.method||d,formEncType:c.encType||m,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:g,formMethod:c.method||d,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,l,t,r])}function $_(e,{relative:t}={}){let{basename:r}=E.useContext(fr),s=E.useContext(Ur);Xt(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),o={...Gl(e||".",{relative:t})},c=Er();if(e==null){o.search=c.search;let f=new URLSearchParams(o.search),d=f.getAll("index");if(d.some(b=>b==="")){f.delete("index"),d.filter(g=>g).forEach(g=>f.append("index",g));let b=f.toString();o.search=b?`?${b}`:""}}return(!e||e===".")&&l.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:Yr([r,o.pathname])),Pl(o)}function V_(e,{relative:t}={}){let r=E.useContext(Wb);Xt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=fx("useViewTransitionState"),l=Gl(e,{relative:t});if(!r.isTransitioning)return!1;let o=yi(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=yi(r.nextLocation.pathname,s)||r.nextLocation.pathname;return ju(l.pathname,c)!=null||ju(l.pathname,o)!=null}var pi=Yb();const hx=E.createContext(null),dx="palmier_paired_hosts",p0="palmier_last_host";function Y_(){try{const e=localStorage.getItem(dx);if(e)return JSON.parse(e)}catch{}return[]}function G_(e){localStorage.setItem(dx,JSON.stringify(e))}const g0="local",J_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function X_({children:e}){const[t,r]=E.useState(()=>{const x=Y_();return J_&&!x.some(v=>v.hostId===g0)&&x.push({hostId:g0,clientToken:"",directUrl:window.location.origin}),x}),[s,l]=E.useState(()=>{try{return localStorage.getItem(p0)}catch{return null}});E.useEffect(()=>{G_(t)},[t]);const o=E.useCallback(x=>{l(v=>v===x?v:x);try{localStorage.setItem(p0,x)}catch{}},[]),c=E.useCallback(x=>{r(v=>[...v.filter(j=>j.hostId!==x.hostId),x])},[]),f=E.useCallback(x=>{r(v=>v.filter(S=>S.hostId!==x))},[]),d=E.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId===x?{...j,name:v}:j))},[]),m=E.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId!==x||j.lanUrl===v?j:{...j,lanUrl:v}))},[]),b=E.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId!==x||j.lastAgent===v?j:{...j,lastAgent:v}))},[]),g=E.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId!==x||j.timezone===v?j:{...j,timezone:v}))},[]);return y.jsx(hx.Provider,{value:{pairedHosts:t,lastHostId:s,addPairedHost:c,removePairedHost:f,renamePairedHost:d,setHostLanUrl:m,setHostLastAgent:b,setHostTimezone:g,setLastHostId:o},children:e})}function Zi(){const e=E.useContext(hx);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const cr=new Uint8Array(0),Wi=new TextEncoder,lr=new TextDecoder;function K_(...e){let t=0;for(let l=0;l<e.length;l++)t+=e[l].length;const r=new Uint8Array(t);let s=0;for(let l=0;l<e.length;l++)r.set(e[l],s),s+=e[l].length;return r}function Tl(...e){const t=[];for(let r=0;r<e.length;r++)t.push(Wi.encode(e[r]));return t.length===0?cr:t.length===1?t[0]:K_(...t)}function y0(e){return!e||e.length===0?"":lr.decode(e)}const b0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",x0=36,Q_=0xcfd41b9100000,v0=33,Z_=333,w0=22;function W_(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*255)}function e2(e){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(e):W_(e)}class t2{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(w0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*Q_),this.inc=Math.floor(Math.random()*(Z_-v0)+v0)}setPre(){const t=new Uint8Array(12);e2(t);for(let r=0;r<12;r++){const s=t[r]%36;this.buf[r]=b0.charCodeAt(s)}}fillSeq(){let t=this.seq;for(let r=w0-1;r>=12;r--)this.buf[r]=b0.charCodeAt(t%x0),t=Math.floor(t/x0)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Ki=new t2;var di;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(di||(di={}));var da;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(da||(da={}));var Ce;(function(e){e.ApiError="BAD API",e.BadAuthentication="BAD_AUTHENTICATION",e.BadCreds="BAD_CREDS",e.BadHeader="BAD_HEADER",e.BadJson="BAD_JSON",e.BadPayload="BAD_PAYLOAD",e.BadSubject="BAD_SUBJECT",e.Cancelled="CANCELLED",e.ConnectionClosed="CONNECTION_CLOSED",e.ConnectionDraining="CONNECTION_DRAINING",e.ConnectionRefused="CONNECTION_REFUSED",e.ConnectionTimeout="CONNECTION_TIMEOUT",e.Disconnect="DISCONNECT",e.InvalidOption="INVALID_OPTION",e.InvalidPayload="INVALID_PAYLOAD",e.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",e.NoResponders="503",e.NotFunction="NOT_FUNC",e.RequestError="REQUEST_ERROR",e.ServerOptionNotAvailable="SERVER_OPT_NA",e.SubClosed="SUB_CLOSED",e.SubDraining="SUB_DRAINING",e.Timeout="TIMEOUT",e.Tls="TLS",e.Unknown="UNKNOWN_ERROR",e.WssRequired="WSS_REQUIRED",e.JetStreamInvalidAck="JESTREAM_INVALID_ACK",e.JetStream404NoMessages="404",e.JetStream408RequestTimeout="408",e.JetStream409MaxAckPendingExceeded="409",e.JetStream409="409",e.JetStreamNotEnabled="503",e.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",e.AuthorizationViolation="AUTHORIZATION_VIOLATION",e.AuthenticationExpired="AUTHENTICATION_EXPIRED",e.ProtocolError="NATS_PROTOCOL_ERR",e.PermissionsViolation="PERMISSIONS_VIOLATION",e.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",e.AccountExpired="ACCOUNT_EXPIRED"})(Ce||(Ce={}));function n2(e){return typeof e.code=="string"}class mx{constructor(){C(this,"messages");this.messages=new Map,this.messages.set(Ce.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(Ce.BadJson,"Bad JSON"),this.messages.set(Ce.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return r2.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const r2=new mx;class De extends Error{constructor(r,s,l){super(r);C(this,"name");C(this,"message");C(this,"code");C(this,"permissionContext");C(this,"chainedError");C(this,"api_error");this.name="NatsError",this.message=r,this.code=s,this.chainedError=l}static errorForCode(r,s){const l=mx.getMessage(r);return new De(l,r,s)}isAuthError(){return this.code===Ce.AuthenticationExpired||this.code===Ce.AuthorizationViolation||this.code===Ce.AccountExpired}isAuthTimeout(){return this.code===Ce.AuthenticationTimeout}isPermissionError(){return this.code===Ce.PermissionsViolation}isProtocolError(){return this.code===Ce.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var sr;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(sr||(sr={}));var Mr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(Mr||(Mr={}));var Ol;(function(e){e.STATS="io.nats.micro.v1.stats_response",e.INFO="io.nats.micro.v1.info_response",e.PING="io.nats.micro.v1.ping_response"})(Ol||(Ol={}));const Nu="Nats-Service-Error",Tu="Nats-Service-Error-Code";class Ou extends Error{constructor(r,s){super(s);C(this,"code");this.code=r}static isServiceError(r){return Ou.toServiceError(r)!==null}static toServiceError(r){var l,o;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(Tu))||"";if(s!==""){const c=parseInt(s)||400,f=((o=r==null?void 0:r.headers)==null?void 0:o.get(Nu))||"";return new Ou(c,f.length?f:s)}return null}}function gi(e=""){if(e=e||"_INBOX",typeof e!="string")throw new Error("prefix must be a string");return e.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${e}'`)}),`${e}.${Ki.next()}`}const td="127.0.0.1";var Gi;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Gi||(Gi={}));function Ju(e,...t){for(let r=0;r<t.length;r++){const s=t[r];Object.keys(s).forEach(function(l){e[l]=s[l]})}return e}function fu(e){return lr.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function va(e,t=!0){const r=t?De.errorForCode(Ce.Timeout):null;let s,l;const o=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?De.errorForCode(Ce.Timeout):r)},e)});return Object.assign(o,s)}function ja(e=0){let t;const r=new Promise(s=>{const l=setTimeout(()=>{s()},e);t={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,t)}function Jt(){let e={};const t=new Promise((r,s)=>{e={resolve:r,reject:s}});return Object.assign(t,e)}function px(e){for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e}function i2(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function zd(e=[0,250,250,500,500,3e3,5e3]){Array.isArray(e)||(e=[0,250,250,500,500,3e3,5e3]);const t=e.length-1;return{backoff(r){return i2(r>t?e[t]:e[r])}}}function Gt(e){return e*1e6}function Ud(e){return Math.floor(e/1e6)}function S0(e){let s=!0;const l=new Array(e.length);for(let o=0;o<e.length;o++){let c=e.charCodeAt(o);if(c===58||c<33||c>126)throw new De(`'${e[o]}' is not a valid character for a header key`,Ce.BadHeader);s&&97<=c&&c<=122?c-=32:!s&&65<=c&&c<=90&&(c+=32),l[o]=c,s=c==45}return String.fromCharCode(...l)}function bi(e=0,t=""){if(e===0&&t!==""||e>0&&t==="")throw new Error("setting status requires both code and description");return new Ji(e,t)}const wh="NATS/1.0";class Ji{constructor(t=0,r=""){C(this,"_code");C(this,"headers");C(this,"_description");this._code=t,this._description=r,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[r,s]of this.headers){const l=t.values(r);if(s.length!==l.length)return!1;const o=[...s].sort(),c=[...l].sort();for(let f=0;f<o.length;f++)if(o[f]!==c[f])return!1}return!0}return!1}static decode(t){const r=new Ji,l=lr.decode(t).split(`\r
|
|
61
61
|
`),o=l[0];if(o!==wh){let c=o.replace(wh,"").trim();if(c.length>0){r._code=parseInt(c,10),isNaN(r._code)&&(r._code=0);const f=r._code.toString();c=c.replace(f,""),r._description=c.trim()}}return l.length>=1&&l.slice(1).map(c=>{if(c){const f=c.indexOf(":");if(f>-1){const d=c.slice(0,f),m=c.slice(f+1).trim();r.append(d,m)}}}),r}toString(){if(this.headers.size===0&&this._code===0)return"";let t=wh;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[r,s]of this.headers)for(let l=0;l<s.length;l++)t=`${t}\r
|
|
62
62
|
${r}: ${s[l]}`;return`${t}\r
|
|
63
63
|
\r
|
|
64
|
-
`}encode(){return Wi.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new De("invalid header value - \\r and \\n are not allowed.",Ce.BadHeader);return t.trim()}keys(){const t=[];for(const r of this.headers.keys())t.push(r);return t}findKeys(t,r=
|
|
64
|
+
`}encode(){return Wi.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new De("invalid header value - \\r and \\n are not allowed.",Ce.BadHeader);return t.trim()}keys(){const t=[];for(const r of this.headers.keys())t.push(r);return t}findKeys(t,r=sr.Exact){const s=this.keys();switch(r){case sr.Exact:return s.filter(l=>l===t);case sr.CanonicalMIME:return t=S0(t),s.filter(l=>l===t);default:{const l=t.toLowerCase();return s.filter(o=>l===o.toLowerCase())}}}get(t,r=sr.Exact){const s=this.findKeys(t,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(t,r=sr.Exact){const s=this.findKeys(t,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(t,r=sr.Exact){return this.findKeys(t,r).length>0}set(t,r,s=sr.Exact){this.delete(t,s),this.append(t,r,s)}append(t,r,s=sr.Exact){const l=S0(t);s===sr.CanonicalMIME&&(t=l);const o=this.findKeys(t,s);t=o.length>0?o[0]:t;const c=Ji.validHeaderValue(r);let f=this.headers.get(t);f||(f=[],this.headers.set(t,f)),f.push(c)}values(t,r=sr.Exact){const s=[];return this.findKeys(t,r).forEach(o=>{const c=this.headers.get(o);c&&s.push(...c)}),s}delete(t,r=sr.Exact){this.findKeys(t,r).forEach(l=>{this.headers.delete(l)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(r=>{t[r]=this.values(r)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const r=new Ji;for(const s in t)r.headers.set(s,t[s]);return r}}function Ru(){return{encode(e){return Wi.encode(e)},decode(e){return lr.decode(e)}}}function Dr(e){return{encode(t){try{return t===void 0&&(t=null),Wi.encode(JSON.stringify(t))}catch(r){throw De.errorForCode(Ce.BadJson,r)}},decode(t){try{return JSON.parse(lr.decode(t),e)}catch(r){throw De.errorForCode(Ce.BadJson,r)}}}}function gx(e){var t;return e&&e.data.length===0&&((t=e.headers)==null?void 0:t.code)===503?De.errorForCode(Ce.NoResponders):null}class Pd{constructor(t,r,s){C(this,"_headers");C(this,"_msg");C(this,"_rdata");C(this,"_reply");C(this,"_subject");C(this,"publisher");this._msg=t,this._rdata=r,this.publisher=s}get subject(){return this._subject?this._subject:(this._subject=lr.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=lr.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=Ji.decode(t)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(t=cr,r){return this.reply?(this.publisher.publish(this.reply,t,r),!0):!1}size(){var l;const t=this._msg.subject.length,r=((l=this._msg.reply)==null?void 0:l.length)||0,s=this._msg.size===-1?0:this._msg.size;return t+r+s}json(t){return Dr(t).decode(this.data)}string(){return lr.decode(this.data)}requestInfo(){var r;const t=(r=this.headers)==null?void 0:r.get("Nats-Request-Info");return t?JSON.parse(t,function(s,l){return(s==="start"||s==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}C(Pd,"jc");function ma(e){return Xu("durable",e)}function Ln(e){return Xu("stream",e)}function Xu(e,t=""){if(t==="")throw Error(`${e} name required`);return[".","*",">","/","\\"," "," ",`
|
|
65
65
|
`,"\r"].forEach(s=>{if(t.indexOf(s)!==-1){switch(s){case`
|
|
66
|
-
`:s="\\n";break;case"\r":s="\\r";break;case" ":s="\\t";break}throw Error(`invalid ${e} name - ${e} name cannot contain '${s}'`)}}),""}function jl(e,t=""){if(t==="")throw Error(`${e} name required`);const r=s2(t);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function s2(e=""){if(e==="")throw Error("name required");const t=/^[-\w]+$/g;if(e.match(t)===null){for(const s of e.split(""))if(s.match(t)===null)return`cannot contain '${s}'`}return""}function nd(e){if(e.data.length>0)return!1;const t=e.headers;return t?t.code>=100&&t.code<200:!1}function rd(e){var t;return nd(e)&&((t=e.headers)==null?void 0:t.description)==="Idle Heartbeat"}function a2(e,t,r){const s=bi(e,t),l={hdr:1,sid:0,size:0},o=new Pd(l,ur,{});return o._headers=s,o._subject=r,o}function pa(e){if(e.data.length!==0)return null;const t=e.headers;return t?yx(t.code,t.description):null}var Sr;(function(e){e.MaxBatchExceeded="exceeded maxrequestbatch of",e.MaxExpiresExceeded="exceeded maxrequestexpires of",e.MaxBytesExceeded="exceeded maxrequestmaxbytes of",e.MaxMessageSizeExceeded="message size exceeds maxbytes",e.PushConsumer="consumer is push based",e.MaxWaitingExceeded="exceeded maxwaiting",e.IdleHeartbeatMissed="idle heartbeats missed",e.ConsumerDeleted="consumer deleted"})(Sr||(Sr={}));function l2(e){return e.code!==Ce.JetStream409?!1:[Sr.MaxBatchExceeded,Sr.MaxExpiresExceeded,Sr.MaxBytesExceeded,Sr.MaxMessageSizeExceeded,Sr.PushConsumer,Sr.IdleHeartbeatMissed,Sr.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function yx(e,t=""){if(e<300)return null;switch(t=t.toLowerCase(),e){case 404:return new De(t,Ce.JetStream404NoMessages);case 408:return new De(t,Ce.JetStream408RequestTimeout);case 409:{const r=t.startsWith(Sr.IdleHeartbeatMissed)?Ce.JetStreamIdleHeartBeat:Ce.JetStream409;return new De(t,r)}case 503:return De.errorForCode(Ce.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=Ce.Unknown),new De(t,`${e}`)}}class vn{constructor(){C(this,"inflight");C(this,"processed");C(this,"received");C(this,"noIterator");C(this,"iterClosed");C(this,"done");C(this,"signal");C(this,"yields");C(this,"filtered");C(this,"pendingFiltered");C(this,"ingestionFilterFn");C(this,"protocolFilterFn");C(this,"dispatchedFn");C(this,"ctx");C(this,"_data");C(this,"err");C(this,"time");C(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=Vt(),this.yields=[],this.iterClosed=Vt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:r,protocol:s}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};r&&(s&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new De("unsupported iterator",Ce.ApiError);if(this.yielding)throw new De("already yielding",Ce.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let r=0;r<t.length;r++){if(typeof t[r]=="function"){const l=t[r];try{l()}catch(o){throw o}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[r]):!0){this.processed++;const l=Date.now();yield t[r],this.time=Date.now()-l,this.dispatchedFn&&t[r]&&this.dispatchedFn(t[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=Vt())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Bd{constructor(t,r,s={maxOut:2}){C(this,"interval");C(this,"maxOut");C(this,"cancelAfter");C(this,"timer");C(this,"autoCancelTimer");C(this,"last");C(this,"missed");C(this,"count");C(this,"callback");this.interval=t,this.maxOut=(s==null?void 0:s.maxOut)||2,this.cancelAfter=(s==null?void 0:s.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(t,r=0,s=2){this.interval=t,this.maxOut=s,this.cancelAfter=r,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(t){console.log(t)}},this.interval)}}var id;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(id||(id={}));var Hl;(function(e){e.Old="old",e.New="new"})(Hl||(Hl={}));var sd;(function(e){e.File="file",e.Memory="memory"})(sd||(sd={}));var an;(function(e){e.All="all",e.Last="last",e.New="new",e.StartSequence="by_start_sequence",e.StartTime="by_start_time",e.LastPerSubject="last_per_subject"})(an||(an={}));var xn;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(xn||(xn={}));var wa;(function(e){e.Instant="instant",e.Original="original"})(wa||(wa={}));var Qi;(function(e){e.None="none",e.S2="s2"})(Qi||(Qi={}));var Mu;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Mu||(Mu={}));function o2(e,t={}){return Object.assign({name:e,deliver_policy:an.All,ack_policy:xn.Explicit,ack_wait:$t(30*1e3),replay_policy:wa.Instant},t)}var _0;(function(e){e.API="api_audit",e.StreamAction="stream_action",e.ConsumerAction="consumer_action",e.SnapshotCreate="snapshot_create",e.SnapshotComplete="snapshot_complete",e.RestoreCreate="restore_create",e.RestoreComplete="restore_complete",e.MaxDeliver="max_deliver",e.Terminated="terminated",e.Ack="consumer_ack",e.StreamLeaderElected="stream_leader_elected",e.StreamQuorumLost="stream_quorum_lost",e.ConsumerLeaderElected="consumer_leader_elected",e.ConsumerQuorumLost="consumer_quorum_lost"})(_0||(_0={}));var Bn;(function(e){e.StreamSourceHdr="Nats-Stream-Source",e.LastConsumerSeqHdr="Nats-Last-Consumer",e.LastStreamSeqHdr="Nats-Last-Stream",e.ConsumerStalledHdr="Nats-Consumer-Stalled",e.MessageSizeHdr="Nats-Msg-Size",e.RollupHdr="Nats-Rollup",e.RollupValueSubject="sub",e.RollupValueAll="all",e.PendingMessagesHdr="Nats-Pending-Messages",e.PendingBytesHdr="Nats-Pending-Bytes"})(Bn||(Bn={}));var Tr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(Tr||(Tr={}));var fa;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(fa||(fa={}));var k0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(k0||(k0={}));const sr="KV_";class u2{constructor(t){C(this,"config");C(this,"ordered");C(this,"mack");C(this,"stream");C(this,"callbackFn");C(this,"max");C(this,"qname");C(this,"isBind");C(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=o2("",t||{})}getOpts(){var r;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((r=t.config.filter_subjects)==null||r.forEach(s=>{this.filterSubject(s)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?xn.None:t.config.ack_policy,t.isBind=t.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:t.config.filter_subject=this.filters[0];break;default:t.config.filter_subjects=this.filters}return t}description(t){return this.config.description=t,this}deliverTo(t){return this.config.deliver_subject=t,this}durable(t){return ma(t),this.config.durable_name=t,this}startSequence(t){if(t<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=an.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=an.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=an.All,this}deliverLastPerSubject(){return this.config.deliver_policy=an.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=an.Last,this}deliverNew(){return this.config.deliver_policy=an.New,this}startAtTimeDelta(t){return this.startTime(new Date(Date.now()-t)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=xn.None,this}ackAll(){return this.config.ack_policy=xn.All,this}ackExplicit(){return this.config.ack_policy=xn.Explicit,this}ackWait(t){return this.config.ack_wait=$t(t),this}maxDeliver(t){return this.config.max_deliver=t,this}filterSubject(t){return this.filters=this.filters||[],this.filters.push(t),this}replayInstantly(){return this.config.replay_policy=wa.Instant,this}replayOriginal(){return this.config.replay_policy=wa.Original,this}sample(t){if(t=Math.trunc(t),t<0||t>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${t}%`,this}limit(t){return this.config.rate_limit_bps=t,this}maxWaiting(t){return this.config.max_waiting=t,this}maxAckPending(t){return this.config.max_ack_pending=t,this}idleHeartbeat(t){return this.config.idle_heartbeat=$t(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,r){return this.stream=t,this.config.durable_name=r,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=$t(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=$t(t),this}memory(){return this.config.mem_storage=!0,this}numReplicas(t){return this.config.num_replicas=t,this}consumerName(t){return this.config.name=t,this}}function Xi(e){return new u2(e)}function E0(e){return typeof e.getOpts=="function"}class c2{static encode(t){if(typeof t=="string")return btoa(t);const r=Array.from(t);return btoa(String.fromCharCode(...r))}static decode(t,r=!1){const s=atob(t);return r?Uint8Array.from(s,l=>l.charCodeAt(0)):s}}class ga{static encode(t){return ga.toB64URLEncoding(c2.encode(t))}static decode(t,r=!1){return ga.decode(ga.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Sa{constructor(){C(this,"buffers");C(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let r=0;for(let o=0;o<t.length;o++)r+=t[o].length;const s=new Uint8Array(r);let l=0;for(let o=0;o<t.length;o++)s.set(t[o],l),l+=t[o].length;return s}static fromAscii(t){return t||(t=""),Wi.encode(t)}static toAscii(t){return ar.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let r=0;for(let s=0;s<this.buffers.length;s++)t.set(this.buffers[s],r),r+=this.buffers[s].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const r=this.buffers.pop();if(r){const s=this.byteLength;(t===void 0||t>s)&&(t=s);const l=r.subarray(0,t);return s>t&&this.buffers.push(r.subarray(t)),this.byteLength=s-t,l}}return new Uint8Array(0)}fill(t,...r){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let s=0;s<r.length;s++)r[s]&&r[s].length&&(this.buffers.push(r[s]),this.byteLength+=r[s].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function f2(e,t){return t.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(s){if(s!=="default"&&!(s in e)){var l=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,l.get?l:{enumerable:!0,get:function(){return r[s]}})}})}),Object.freeze(e)}var h2=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},wl=h2.performance||{};wl.now||wl.mozNow||wl.msNow||wl.oNow||wl.webkitNow;var C0={versions:{}},d2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function m2(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),t}var Sh,Ku={exports:{}},A0={},j0=m2(f2({__proto__:null,default:A0},[A0]));Sh=Ku,(function(){var e="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var s=!t&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&C0.versions&&C0.versions.node;l?r=d2:s&&(r=self);var o=!r.JS_SHA256_NO_COMMON_JS&&Sh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),d=[-2147483648,8388608,32768,128],m=[24,16,8,0],b=[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],g=["hex","array","digest","arrayBuffer"],x=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(q){return Object.prototype.toString.call(q)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(q){return typeof q=="object"&&q.buffer&&q.buffer.constructor===ArrayBuffer});var v=function(q,L){return function(ee){return new P(L,!0).update(ee)[q]()}},S=function(q){var L=v("hex",q);l&&(L=A(L,q)),L.create=function(){return new P(q)},L.update=function(B){return L.create().update(B)};for(var ee=0;ee<g.length;++ee){var J=g[ee];L[J]=v(J,q)}return L},A=function(q,L){var ee,J=j0,B=j0.Buffer,D=L?"sha224":"sha256";return ee=B.from&&!r.JS_SHA256_NO_BUFFER_FROM?B.from:function(G){return new B(G)},function(G){if(typeof G=="string")return J.createHash(D).update(G,"utf8").digest("hex");if(G==null)throw new Error(e);return G.constructor===ArrayBuffer&&(G=new Uint8Array(G)),Array.isArray(G)||ArrayBuffer.isView(G)||G.constructor===B?J.createHash(D).update(ee(G)).digest("hex"):q(G)}},O=function(q,L){return function(ee,J){return new I(ee,L,!0).update(J)[q]()}},M=function(q){var L=O("hex",q);L.create=function(B){return new I(B,q)},L.update=function(B,D){return L.create(B).update(D)};for(var ee=0;ee<g.length;++ee){var J=g[ee];L[J]=O(J,q)}return L};function P(q,L){L?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],q?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=q}function I(q,L,ee){var J,B=typeof q;if(B==="string"){var D,G=[],F=q.length,fe=0;for(J=0;J<F;++J)(D=q.charCodeAt(J))<128?G[fe++]=D:D<2048?(G[fe++]=192|D>>>6,G[fe++]=128|63&D):D<55296||D>=57344?(G[fe++]=224|D>>>12,G[fe++]=128|D>>>6&63,G[fe++]=128|63&D):(D=65536+((1023&D)<<10|1023&q.charCodeAt(++J)),G[fe++]=240|D>>>18,G[fe++]=128|D>>>12&63,G[fe++]=128|D>>>6&63,G[fe++]=128|63&D);q=G}else{if(B!=="object")throw new Error(e);if(q===null)throw new Error(e);if(c&&q.constructor===ArrayBuffer)q=new Uint8Array(q);else if(!(Array.isArray(q)||c&&ArrayBuffer.isView(q)))throw new Error(e)}q.length>64&&(q=new P(L,!0).update(q).array());var oe=[],ne=[];for(J=0;J<64;++J){var V=q[J]||0;oe[J]=92^V,ne[J]=54^V}P.call(this,L,ee),this.update(ne),this.oKeyPad=oe,this.inner=!0,this.sharedMemory=ee}P.prototype.update=function(q){if(!this.finalized){var L,ee=typeof q;if(ee!=="string"){if(ee!=="object")throw new Error(e);if(q===null)throw new Error(e);if(c&&q.constructor===ArrayBuffer)q=new Uint8Array(q);else if(!(Array.isArray(q)||c&&ArrayBuffer.isView(q)))throw new Error(e);L=!0}for(var J,B,D=0,G=q.length,F=this.blocks;D<G;){if(this.hashed&&(this.hashed=!1,F[0]=this.block,this.block=F[16]=F[1]=F[2]=F[3]=F[4]=F[5]=F[6]=F[7]=F[8]=F[9]=F[10]=F[11]=F[12]=F[13]=F[14]=F[15]=0),L)for(B=this.start;D<G&&B<64;++D)F[B>>>2]|=q[D]<<m[3&B++];else for(B=this.start;D<G&&B<64;++D)(J=q.charCodeAt(D))<128?F[B>>>2]|=J<<m[3&B++]:J<2048?(F[B>>>2]|=(192|J>>>6)<<m[3&B++],F[B>>>2]|=(128|63&J)<<m[3&B++]):J<55296||J>=57344?(F[B>>>2]|=(224|J>>>12)<<m[3&B++],F[B>>>2]|=(128|J>>>6&63)<<m[3&B++],F[B>>>2]|=(128|63&J)<<m[3&B++]):(J=65536+((1023&J)<<10|1023&q.charCodeAt(++D)),F[B>>>2]|=(240|J>>>18)<<m[3&B++],F[B>>>2]|=(128|J>>>12&63)<<m[3&B++],F[B>>>2]|=(128|J>>>6&63)<<m[3&B++],F[B>>>2]|=(128|63&J)<<m[3&B++]);this.lastByteIndex=B,this.bytes+=B-this.start,B>=64?(this.block=F[16],this.start=B-64,this.hash(),this.hashed=!0):this.start=B}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},P.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var q=this.blocks,L=this.lastByteIndex;q[16]=this.block,q[L>>>2]|=d[3&L],this.block=q[16],L>=56&&(this.hashed||this.hash(),q[0]=this.block,q[16]=q[1]=q[2]=q[3]=q[4]=q[5]=q[6]=q[7]=q[8]=q[9]=q[10]=q[11]=q[12]=q[13]=q[14]=q[15]=0),q[14]=this.hBytes<<3|this.bytes>>>29,q[15]=this.bytes<<3,this.hash()}},P.prototype.hash=function(){var q,L,ee,J,B,D,G,F,fe,oe=this.h0,ne=this.h1,V=this.h2,Q=this.h3,X=this.h4,xe=this.h5,j=this.h6,z=this.h7,W=this.blocks;for(q=16;q<64;++q)L=((B=W[q-15])>>>7|B<<25)^(B>>>18|B<<14)^B>>>3,ee=((B=W[q-2])>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,W[q]=W[q-16]+L+W[q-7]+ee|0;for(fe=ne&V,q=0;q<64;q+=4)this.first?(this.is224?(D=300032,z=(B=W[0]-1413257819)-150054599|0,Q=B+24177077|0):(D=704751109,z=(B=W[0]-210244248)-1521486534|0,Q=B+143694565|0),this.first=!1):(L=(oe>>>2|oe<<30)^(oe>>>13|oe<<19)^(oe>>>22|oe<<10),J=(D=oe&ne)^oe&V^fe,z=Q+(B=z+(ee=(X>>>6|X<<26)^(X>>>11|X<<21)^(X>>>25|X<<7))+(X&xe^~X&j)+b[q]+W[q])|0,Q=B+(L+J)|0),L=(Q>>>2|Q<<30)^(Q>>>13|Q<<19)^(Q>>>22|Q<<10),J=(G=Q&oe)^Q&ne^D,j=V+(B=j+(ee=(z>>>6|z<<26)^(z>>>11|z<<21)^(z>>>25|z<<7))+(z&X^~z&xe)+b[q+1]+W[q+1])|0,L=((V=B+(L+J)|0)>>>2|V<<30)^(V>>>13|V<<19)^(V>>>22|V<<10),J=(F=V&Q)^V&oe^G,xe=ne+(B=xe+(ee=(j>>>6|j<<26)^(j>>>11|j<<21)^(j>>>25|j<<7))+(j&z^~j&X)+b[q+2]+W[q+2])|0,L=((ne=B+(L+J)|0)>>>2|ne<<30)^(ne>>>13|ne<<19)^(ne>>>22|ne<<10),J=(fe=ne&V)^ne&Q^F,X=oe+(B=X+(ee=(xe>>>6|xe<<26)^(xe>>>11|xe<<21)^(xe>>>25|xe<<7))+(xe&j^~xe&z)+b[q+3]+W[q+3])|0,oe=B+(L+J)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+oe|0,this.h1=this.h1+ne|0,this.h2=this.h2+V|0,this.h3=this.h3+Q|0,this.h4=this.h4+X|0,this.h5=this.h5+xe|0,this.h6=this.h6+j|0,this.h7=this.h7+z|0},P.prototype.hex=function(){this.finalize();var q=this.h0,L=this.h1,ee=this.h2,J=this.h3,B=this.h4,D=this.h5,G=this.h6,F=this.h7,fe=f[q>>>28&15]+f[q>>>24&15]+f[q>>>20&15]+f[q>>>16&15]+f[q>>>12&15]+f[q>>>8&15]+f[q>>>4&15]+f[15&q]+f[L>>>28&15]+f[L>>>24&15]+f[L>>>20&15]+f[L>>>16&15]+f[L>>>12&15]+f[L>>>8&15]+f[L>>>4&15]+f[15&L]+f[ee>>>28&15]+f[ee>>>24&15]+f[ee>>>20&15]+f[ee>>>16&15]+f[ee>>>12&15]+f[ee>>>8&15]+f[ee>>>4&15]+f[15&ee]+f[J>>>28&15]+f[J>>>24&15]+f[J>>>20&15]+f[J>>>16&15]+f[J>>>12&15]+f[J>>>8&15]+f[J>>>4&15]+f[15&J]+f[B>>>28&15]+f[B>>>24&15]+f[B>>>20&15]+f[B>>>16&15]+f[B>>>12&15]+f[B>>>8&15]+f[B>>>4&15]+f[15&B]+f[D>>>28&15]+f[D>>>24&15]+f[D>>>20&15]+f[D>>>16&15]+f[D>>>12&15]+f[D>>>8&15]+f[D>>>4&15]+f[15&D]+f[G>>>28&15]+f[G>>>24&15]+f[G>>>20&15]+f[G>>>16&15]+f[G>>>12&15]+f[G>>>8&15]+f[G>>>4&15]+f[15&G];return this.is224||(fe+=f[F>>>28&15]+f[F>>>24&15]+f[F>>>20&15]+f[F>>>16&15]+f[F>>>12&15]+f[F>>>8&15]+f[F>>>4&15]+f[15&F]),fe},P.prototype.toString=P.prototype.hex,P.prototype.digest=function(){this.finalize();var q=this.h0,L=this.h1,ee=this.h2,J=this.h3,B=this.h4,D=this.h5,G=this.h6,F=this.h7,fe=[q>>>24&255,q>>>16&255,q>>>8&255,255&q,L>>>24&255,L>>>16&255,L>>>8&255,255&L,ee>>>24&255,ee>>>16&255,ee>>>8&255,255&ee,J>>>24&255,J>>>16&255,J>>>8&255,255&J,B>>>24&255,B>>>16&255,B>>>8&255,255&B,D>>>24&255,D>>>16&255,D>>>8&255,255&D,G>>>24&255,G>>>16&255,G>>>8&255,255&G];return this.is224||fe.push(F>>>24&255,F>>>16&255,F>>>8&255,255&F),fe},P.prototype.array=P.prototype.digest,P.prototype.arrayBuffer=function(){this.finalize();var q=new ArrayBuffer(this.is224?28:32),L=new DataView(q);return L.setUint32(0,this.h0),L.setUint32(4,this.h1),L.setUint32(8,this.h2),L.setUint32(12,this.h3),L.setUint32(16,this.h4),L.setUint32(20,this.h5),L.setUint32(24,this.h6),this.is224||L.setUint32(28,this.h7),q},I.prototype=new P,I.prototype.finalize=function(){if(P.prototype.finalize.call(this),this.inner){this.inner=!1;var q=this.array();P.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(q),P.prototype.finalize.call(this)}};var te=S();te.sha256=te,te.sha224=S(!0),te.sha256.hmac=M(),te.sha224.hmac=M(!0),o?Sh.exports=te:(r.sha256=te.sha256,r.sha224=te.sha224)})();Ku.exports;Ku.exports.sha224;var N0=Ku.exports.sha256;function ad(e){return v2(e)}function p2(e){if(!/^[0-9A-Fa-f]+$/.test(e))return!1;const r=/^[0-9A-F]+$/.test(e),s=/^[0-9a-f]+$/.test(e);return r||s?e.length%2===0:!1}function g2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function y2(e){return p2(e)?"hex":g2(e)?"b64":""}function b2(e){if(e.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r/2]=parseInt(e.substring(r,r+2),16);return t}function x2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const t=atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0))}function v2(e){switch(y2(e)){case"hex":return b2(e);case"b64":return x2(e)}return null}function w2(e,t){const r=typeof e=="string"?ad(e):e,s=typeof t=="string"?ad(t):t;if(r===null||s===null||r.length!==s.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==s[l])return!1;return!0}class bx{constructor(t,r,s=!0){C(this,"token");C(this,"received");C(this,"ctx");C(this,"requestSubject");C(this,"mux");this.mux=t,this.requestSubject=r,this.received=0,this.token=Ki.next(),s&&(this.ctx=new Error)}}class S2 extends bx{constructor(r,s,l={maxWait:1e3}){super(r,s);C(this,"callback");C(this,"done");C(this,"timer");C(this,"max");C(this,"opts");if(this.opts=l,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1,this.done=Vt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(r){r&&this.callback(r,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(r,s){r?(this.ctx&&(r.stack+=`
|
|
66
|
+
`:s="\\n";break;case"\r":s="\\r";break;case" ":s="\\t";break}throw Error(`invalid ${e} name - ${e} name cannot contain '${s}'`)}}),""}function jl(e,t=""){if(t==="")throw Error(`${e} name required`);const r=s2(t);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function s2(e=""){if(e==="")throw Error("name required");const t=/^[-\w]+$/g;if(e.match(t)===null){for(const s of e.split(""))if(s.match(t)===null)return`cannot contain '${s}'`}return""}function nd(e){if(e.data.length>0)return!1;const t=e.headers;return t?t.code>=100&&t.code<200:!1}function rd(e){var t;return nd(e)&&((t=e.headers)==null?void 0:t.description)==="Idle Heartbeat"}function a2(e,t,r){const s=bi(e,t),l={hdr:1,sid:0,size:0},o=new Pd(l,cr,{});return o._headers=s,o._subject=r,o}function pa(e){if(e.data.length!==0)return null;const t=e.headers;return t?yx(t.code,t.description):null}var _r;(function(e){e.MaxBatchExceeded="exceeded maxrequestbatch of",e.MaxExpiresExceeded="exceeded maxrequestexpires of",e.MaxBytesExceeded="exceeded maxrequestmaxbytes of",e.MaxMessageSizeExceeded="message size exceeds maxbytes",e.PushConsumer="consumer is push based",e.MaxWaitingExceeded="exceeded maxwaiting",e.IdleHeartbeatMissed="idle heartbeats missed",e.ConsumerDeleted="consumer deleted"})(_r||(_r={}));function l2(e){return e.code!==Ce.JetStream409?!1:[_r.MaxBatchExceeded,_r.MaxExpiresExceeded,_r.MaxBytesExceeded,_r.MaxMessageSizeExceeded,_r.PushConsumer,_r.IdleHeartbeatMissed,_r.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function yx(e,t=""){if(e<300)return null;switch(t=t.toLowerCase(),e){case 404:return new De(t,Ce.JetStream404NoMessages);case 408:return new De(t,Ce.JetStream408RequestTimeout);case 409:{const r=t.startsWith(_r.IdleHeartbeatMissed)?Ce.JetStreamIdleHeartBeat:Ce.JetStream409;return new De(t,r)}case 503:return De.errorForCode(Ce.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=Ce.Unknown),new De(t,`${e}`)}}class wn{constructor(){C(this,"inflight");C(this,"processed");C(this,"received");C(this,"noIterator");C(this,"iterClosed");C(this,"done");C(this,"signal");C(this,"yields");C(this,"filtered");C(this,"pendingFiltered");C(this,"ingestionFilterFn");C(this,"protocolFilterFn");C(this,"dispatchedFn");C(this,"ctx");C(this,"_data");C(this,"err");C(this,"time");C(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=Jt(),this.yields=[],this.iterClosed=Jt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:r,protocol:s}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};r&&(s&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new De("unsupported iterator",Ce.ApiError);if(this.yielding)throw new De("already yielding",Ce.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let r=0;r<t.length;r++){if(typeof t[r]=="function"){const l=t[r];try{l()}catch(o){throw o}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[r]):!0){this.processed++;const l=Date.now();yield t[r],this.time=Date.now()-l,this.dispatchedFn&&t[r]&&this.dispatchedFn(t[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=Jt())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Bd{constructor(t,r,s={maxOut:2}){C(this,"interval");C(this,"maxOut");C(this,"cancelAfter");C(this,"timer");C(this,"autoCancelTimer");C(this,"last");C(this,"missed");C(this,"count");C(this,"callback");this.interval=t,this.maxOut=(s==null?void 0:s.maxOut)||2,this.cancelAfter=(s==null?void 0:s.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(t,r=0,s=2){this.interval=t,this.maxOut=s,this.cancelAfter=r,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(t){console.log(t)}},this.interval)}}var id;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(id||(id={}));var Hl;(function(e){e.Old="old",e.New="new"})(Hl||(Hl={}));var sd;(function(e){e.File="file",e.Memory="memory"})(sd||(sd={}));var sn;(function(e){e.All="all",e.Last="last",e.New="new",e.StartSequence="by_start_sequence",e.StartTime="by_start_time",e.LastPerSubject="last_per_subject"})(sn||(sn={}));var vn;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(vn||(vn={}));var wa;(function(e){e.Instant="instant",e.Original="original"})(wa||(wa={}));var Qi;(function(e){e.None="none",e.S2="s2"})(Qi||(Qi={}));var Mu;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Mu||(Mu={}));function o2(e,t={}){return Object.assign({name:e,deliver_policy:sn.All,ack_policy:vn.Explicit,ack_wait:Gt(30*1e3),replay_policy:wa.Instant},t)}var _0;(function(e){e.API="api_audit",e.StreamAction="stream_action",e.ConsumerAction="consumer_action",e.SnapshotCreate="snapshot_create",e.SnapshotComplete="snapshot_complete",e.RestoreCreate="restore_create",e.RestoreComplete="restore_complete",e.MaxDeliver="max_deliver",e.Terminated="terminated",e.Ack="consumer_ack",e.StreamLeaderElected="stream_leader_elected",e.StreamQuorumLost="stream_quorum_lost",e.ConsumerLeaderElected="consumer_leader_elected",e.ConsumerQuorumLost="consumer_quorum_lost"})(_0||(_0={}));var Bn;(function(e){e.StreamSourceHdr="Nats-Stream-Source",e.LastConsumerSeqHdr="Nats-Last-Consumer",e.LastStreamSeqHdr="Nats-Last-Stream",e.ConsumerStalledHdr="Nats-Consumer-Stalled",e.MessageSizeHdr="Nats-Msg-Size",e.RollupHdr="Nats-Rollup",e.RollupValueSubject="sub",e.RollupValueAll="all",e.PendingMessagesHdr="Nats-Pending-Messages",e.PendingBytesHdr="Nats-Pending-Bytes"})(Bn||(Bn={}));var Or;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(Or||(Or={}));var fa;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(fa||(fa={}));var k0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(k0||(k0={}));const ar="KV_";class u2{constructor(t){C(this,"config");C(this,"ordered");C(this,"mack");C(this,"stream");C(this,"callbackFn");C(this,"max");C(this,"qname");C(this,"isBind");C(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=o2("",t||{})}getOpts(){var r;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((r=t.config.filter_subjects)==null||r.forEach(s=>{this.filterSubject(s)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?vn.None:t.config.ack_policy,t.isBind=t.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:t.config.filter_subject=this.filters[0];break;default:t.config.filter_subjects=this.filters}return t}description(t){return this.config.description=t,this}deliverTo(t){return this.config.deliver_subject=t,this}durable(t){return ma(t),this.config.durable_name=t,this}startSequence(t){if(t<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=sn.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=sn.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=sn.All,this}deliverLastPerSubject(){return this.config.deliver_policy=sn.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=sn.Last,this}deliverNew(){return this.config.deliver_policy=sn.New,this}startAtTimeDelta(t){return this.startTime(new Date(Date.now()-t)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=vn.None,this}ackAll(){return this.config.ack_policy=vn.All,this}ackExplicit(){return this.config.ack_policy=vn.Explicit,this}ackWait(t){return this.config.ack_wait=Gt(t),this}maxDeliver(t){return this.config.max_deliver=t,this}filterSubject(t){return this.filters=this.filters||[],this.filters.push(t),this}replayInstantly(){return this.config.replay_policy=wa.Instant,this}replayOriginal(){return this.config.replay_policy=wa.Original,this}sample(t){if(t=Math.trunc(t),t<0||t>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${t}%`,this}limit(t){return this.config.rate_limit_bps=t,this}maxWaiting(t){return this.config.max_waiting=t,this}maxAckPending(t){return this.config.max_ack_pending=t,this}idleHeartbeat(t){return this.config.idle_heartbeat=Gt(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,r){return this.stream=t,this.config.durable_name=r,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=Gt(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=Gt(t),this}memory(){return this.config.mem_storage=!0,this}numReplicas(t){return this.config.num_replicas=t,this}consumerName(t){return this.config.name=t,this}}function Xi(e){return new u2(e)}function E0(e){return typeof e.getOpts=="function"}class c2{static encode(t){if(typeof t=="string")return btoa(t);const r=Array.from(t);return btoa(String.fromCharCode(...r))}static decode(t,r=!1){const s=atob(t);return r?Uint8Array.from(s,l=>l.charCodeAt(0)):s}}class ga{static encode(t){return ga.toB64URLEncoding(c2.encode(t))}static decode(t,r=!1){return ga.decode(ga.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Sa{constructor(){C(this,"buffers");C(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let r=0;for(let o=0;o<t.length;o++)r+=t[o].length;const s=new Uint8Array(r);let l=0;for(let o=0;o<t.length;o++)s.set(t[o],l),l+=t[o].length;return s}static fromAscii(t){return t||(t=""),Wi.encode(t)}static toAscii(t){return lr.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let r=0;for(let s=0;s<this.buffers.length;s++)t.set(this.buffers[s],r),r+=this.buffers[s].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const r=this.buffers.pop();if(r){const s=this.byteLength;(t===void 0||t>s)&&(t=s);const l=r.subarray(0,t);return s>t&&this.buffers.push(r.subarray(t)),this.byteLength=s-t,l}}return new Uint8Array(0)}fill(t,...r){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let s=0;s<r.length;s++)r[s]&&r[s].length&&(this.buffers.push(r[s]),this.byteLength+=r[s].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function f2(e,t){return t.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(s){if(s!=="default"&&!(s in e)){var l=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,l.get?l:{enumerable:!0,get:function(){return r[s]}})}})}),Object.freeze(e)}var h2=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},wl=h2.performance||{};wl.now||wl.mozNow||wl.msNow||wl.oNow||wl.webkitNow;var C0={versions:{}},d2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function m2(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),t}var Sh,Ku={exports:{}},A0={},j0=m2(f2({__proto__:null,default:A0},[A0]));Sh=Ku,(function(){var e="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var s=!t&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&C0.versions&&C0.versions.node;l?r=d2:s&&(r=self);var o=!r.JS_SHA256_NO_COMMON_JS&&Sh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),d=[-2147483648,8388608,32768,128],m=[24,16,8,0],b=[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],g=["hex","array","digest","arrayBuffer"],x=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(q){return Object.prototype.toString.call(q)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(q){return typeof q=="object"&&q.buffer&&q.buffer.constructor===ArrayBuffer});var v=function(q,N){return function(ee){return new P(N,!0).update(ee)[q]()}},S=function(q){var N=v("hex",q);l&&(N=j(N,q)),N.create=function(){return new P(q)},N.update=function(B){return N.create().update(B)};for(var ee=0;ee<g.length;++ee){var G=g[ee];N[G]=v(G,q)}return N},j=function(q,N){var ee,G=j0,B=j0.Buffer,L=N?"sha224":"sha256";return ee=B.from&&!r.JS_SHA256_NO_BUFFER_FROM?B.from:function(J){return new B(J)},function(J){if(typeof J=="string")return G.createHash(L).update(J,"utf8").digest("hex");if(J==null)throw new Error(e);return J.constructor===ArrayBuffer&&(J=new Uint8Array(J)),Array.isArray(J)||ArrayBuffer.isView(J)||J.constructor===B?G.createHash(L).update(ee(J)).digest("hex"):q(J)}},R=function(q,N){return function(ee,G){return new I(ee,N,!0).update(G)[q]()}},M=function(q){var N=R("hex",q);N.create=function(B){return new I(B,q)},N.update=function(B,L){return N.create(B).update(L)};for(var ee=0;ee<g.length;++ee){var G=g[ee];N[G]=R(G,q)}return N};function P(q,N){N?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],q?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=q}function I(q,N,ee){var G,B=typeof q;if(B==="string"){var L,J=[],$=q.length,he=0;for(G=0;G<$;++G)(L=q.charCodeAt(G))<128?J[he++]=L:L<2048?(J[he++]=192|L>>>6,J[he++]=128|63&L):L<55296||L>=57344?(J[he++]=224|L>>>12,J[he++]=128|L>>>6&63,J[he++]=128|63&L):(L=65536+((1023&L)<<10|1023&q.charCodeAt(++G)),J[he++]=240|L>>>18,J[he++]=128|L>>>12&63,J[he++]=128|L>>>6&63,J[he++]=128|63&L);q=J}else{if(B!=="object")throw new Error(e);if(q===null)throw new Error(e);if(c&&q.constructor===ArrayBuffer)q=new Uint8Array(q);else if(!(Array.isArray(q)||c&&ArrayBuffer.isView(q)))throw new Error(e)}q.length>64&&(q=new P(N,!0).update(q).array());var le=[],te=[];for(G=0;G<64;++G){var V=q[G]||0;le[G]=92^V,te[G]=54^V}P.call(this,N,ee),this.update(te),this.oKeyPad=le,this.inner=!0,this.sharedMemory=ee}P.prototype.update=function(q){if(!this.finalized){var N,ee=typeof q;if(ee!=="string"){if(ee!=="object")throw new Error(e);if(q===null)throw new Error(e);if(c&&q.constructor===ArrayBuffer)q=new Uint8Array(q);else if(!(Array.isArray(q)||c&&ArrayBuffer.isView(q)))throw new Error(e);N=!0}for(var G,B,L=0,J=q.length,$=this.blocks;L<J;){if(this.hashed&&(this.hashed=!1,$[0]=this.block,this.block=$[16]=$[1]=$[2]=$[3]=$[4]=$[5]=$[6]=$[7]=$[8]=$[9]=$[10]=$[11]=$[12]=$[13]=$[14]=$[15]=0),N)for(B=this.start;L<J&&B<64;++L)$[B>>>2]|=q[L]<<m[3&B++];else for(B=this.start;L<J&&B<64;++L)(G=q.charCodeAt(L))<128?$[B>>>2]|=G<<m[3&B++]:G<2048?($[B>>>2]|=(192|G>>>6)<<m[3&B++],$[B>>>2]|=(128|63&G)<<m[3&B++]):G<55296||G>=57344?($[B>>>2]|=(224|G>>>12)<<m[3&B++],$[B>>>2]|=(128|G>>>6&63)<<m[3&B++],$[B>>>2]|=(128|63&G)<<m[3&B++]):(G=65536+((1023&G)<<10|1023&q.charCodeAt(++L)),$[B>>>2]|=(240|G>>>18)<<m[3&B++],$[B>>>2]|=(128|G>>>12&63)<<m[3&B++],$[B>>>2]|=(128|G>>>6&63)<<m[3&B++],$[B>>>2]|=(128|63&G)<<m[3&B++]);this.lastByteIndex=B,this.bytes+=B-this.start,B>=64?(this.block=$[16],this.start=B-64,this.hash(),this.hashed=!0):this.start=B}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},P.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var q=this.blocks,N=this.lastByteIndex;q[16]=this.block,q[N>>>2]|=d[3&N],this.block=q[16],N>=56&&(this.hashed||this.hash(),q[0]=this.block,q[16]=q[1]=q[2]=q[3]=q[4]=q[5]=q[6]=q[7]=q[8]=q[9]=q[10]=q[11]=q[12]=q[13]=q[14]=q[15]=0),q[14]=this.hBytes<<3|this.bytes>>>29,q[15]=this.bytes<<3,this.hash()}},P.prototype.hash=function(){var q,N,ee,G,B,L,J,$,he,le=this.h0,te=this.h1,V=this.h2,Q=this.h3,X=this.h4,xe=this.h5,A=this.h6,z=this.h7,W=this.blocks;for(q=16;q<64;++q)N=((B=W[q-15])>>>7|B<<25)^(B>>>18|B<<14)^B>>>3,ee=((B=W[q-2])>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,W[q]=W[q-16]+N+W[q-7]+ee|0;for(he=te&V,q=0;q<64;q+=4)this.first?(this.is224?(L=300032,z=(B=W[0]-1413257819)-150054599|0,Q=B+24177077|0):(L=704751109,z=(B=W[0]-210244248)-1521486534|0,Q=B+143694565|0),this.first=!1):(N=(le>>>2|le<<30)^(le>>>13|le<<19)^(le>>>22|le<<10),G=(L=le&te)^le&V^he,z=Q+(B=z+(ee=(X>>>6|X<<26)^(X>>>11|X<<21)^(X>>>25|X<<7))+(X&xe^~X&A)+b[q]+W[q])|0,Q=B+(N+G)|0),N=(Q>>>2|Q<<30)^(Q>>>13|Q<<19)^(Q>>>22|Q<<10),G=(J=Q&le)^Q&te^L,A=V+(B=A+(ee=(z>>>6|z<<26)^(z>>>11|z<<21)^(z>>>25|z<<7))+(z&X^~z&xe)+b[q+1]+W[q+1])|0,N=((V=B+(N+G)|0)>>>2|V<<30)^(V>>>13|V<<19)^(V>>>22|V<<10),G=($=V&Q)^V&le^J,xe=te+(B=xe+(ee=(A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7))+(A&z^~A&X)+b[q+2]+W[q+2])|0,N=((te=B+(N+G)|0)>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),G=(he=te&V)^te&Q^$,X=le+(B=X+(ee=(xe>>>6|xe<<26)^(xe>>>11|xe<<21)^(xe>>>25|xe<<7))+(xe&A^~xe&z)+b[q+3]+W[q+3])|0,le=B+(N+G)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+le|0,this.h1=this.h1+te|0,this.h2=this.h2+V|0,this.h3=this.h3+Q|0,this.h4=this.h4+X|0,this.h5=this.h5+xe|0,this.h6=this.h6+A|0,this.h7=this.h7+z|0},P.prototype.hex=function(){this.finalize();var q=this.h0,N=this.h1,ee=this.h2,G=this.h3,B=this.h4,L=this.h5,J=this.h6,$=this.h7,he=f[q>>>28&15]+f[q>>>24&15]+f[q>>>20&15]+f[q>>>16&15]+f[q>>>12&15]+f[q>>>8&15]+f[q>>>4&15]+f[15&q]+f[N>>>28&15]+f[N>>>24&15]+f[N>>>20&15]+f[N>>>16&15]+f[N>>>12&15]+f[N>>>8&15]+f[N>>>4&15]+f[15&N]+f[ee>>>28&15]+f[ee>>>24&15]+f[ee>>>20&15]+f[ee>>>16&15]+f[ee>>>12&15]+f[ee>>>8&15]+f[ee>>>4&15]+f[15&ee]+f[G>>>28&15]+f[G>>>24&15]+f[G>>>20&15]+f[G>>>16&15]+f[G>>>12&15]+f[G>>>8&15]+f[G>>>4&15]+f[15&G]+f[B>>>28&15]+f[B>>>24&15]+f[B>>>20&15]+f[B>>>16&15]+f[B>>>12&15]+f[B>>>8&15]+f[B>>>4&15]+f[15&B]+f[L>>>28&15]+f[L>>>24&15]+f[L>>>20&15]+f[L>>>16&15]+f[L>>>12&15]+f[L>>>8&15]+f[L>>>4&15]+f[15&L]+f[J>>>28&15]+f[J>>>24&15]+f[J>>>20&15]+f[J>>>16&15]+f[J>>>12&15]+f[J>>>8&15]+f[J>>>4&15]+f[15&J];return this.is224||(he+=f[$>>>28&15]+f[$>>>24&15]+f[$>>>20&15]+f[$>>>16&15]+f[$>>>12&15]+f[$>>>8&15]+f[$>>>4&15]+f[15&$]),he},P.prototype.toString=P.prototype.hex,P.prototype.digest=function(){this.finalize();var q=this.h0,N=this.h1,ee=this.h2,G=this.h3,B=this.h4,L=this.h5,J=this.h6,$=this.h7,he=[q>>>24&255,q>>>16&255,q>>>8&255,255&q,N>>>24&255,N>>>16&255,N>>>8&255,255&N,ee>>>24&255,ee>>>16&255,ee>>>8&255,255&ee,G>>>24&255,G>>>16&255,G>>>8&255,255&G,B>>>24&255,B>>>16&255,B>>>8&255,255&B,L>>>24&255,L>>>16&255,L>>>8&255,255&L,J>>>24&255,J>>>16&255,J>>>8&255,255&J];return this.is224||he.push($>>>24&255,$>>>16&255,$>>>8&255,255&$),he},P.prototype.array=P.prototype.digest,P.prototype.arrayBuffer=function(){this.finalize();var q=new ArrayBuffer(this.is224?28:32),N=new DataView(q);return N.setUint32(0,this.h0),N.setUint32(4,this.h1),N.setUint32(8,this.h2),N.setUint32(12,this.h3),N.setUint32(16,this.h4),N.setUint32(20,this.h5),N.setUint32(24,this.h6),this.is224||N.setUint32(28,this.h7),q},I.prototype=new P,I.prototype.finalize=function(){if(P.prototype.finalize.call(this),this.inner){this.inner=!1;var q=this.array();P.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(q),P.prototype.finalize.call(this)}};var ue=S();ue.sha256=ue,ue.sha224=S(!0),ue.sha256.hmac=M(),ue.sha224.hmac=M(!0),o?Sh.exports=ue:(r.sha256=ue.sha256,r.sha224=ue.sha224)})();Ku.exports;Ku.exports.sha224;var N0=Ku.exports.sha256;function ad(e){return v2(e)}function p2(e){if(!/^[0-9A-Fa-f]+$/.test(e))return!1;const r=/^[0-9A-F]+$/.test(e),s=/^[0-9a-f]+$/.test(e);return r||s?e.length%2===0:!1}function g2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function y2(e){return p2(e)?"hex":g2(e)?"b64":""}function b2(e){if(e.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r/2]=parseInt(e.substring(r,r+2),16);return t}function x2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const t=atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0))}function v2(e){switch(y2(e)){case"hex":return b2(e);case"b64":return x2(e)}return null}function w2(e,t){const r=typeof e=="string"?ad(e):e,s=typeof t=="string"?ad(t):t;if(r===null||s===null||r.length!==s.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==s[l])return!1;return!0}class bx{constructor(t,r,s=!0){C(this,"token");C(this,"received");C(this,"ctx");C(this,"requestSubject");C(this,"mux");this.mux=t,this.requestSubject=r,this.received=0,this.token=Ki.next(),s&&(this.ctx=new Error)}}class S2 extends bx{constructor(r,s,l={maxWait:1e3}){super(r,s);C(this,"callback");C(this,"done");C(this,"timer");C(this,"max");C(this,"opts");if(this.opts=l,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1,this.done=Jt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(r){r&&this.callback(r,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(r,s){r?(this.ctx&&(r.stack+=`
|
|
67
67
|
|
|
68
|
-
${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===
|
|
68
|
+
${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===Mr.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Mr.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Mr.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class xx extends bx{constructor(r,s,l={timeout:1e3},o=!0){super(r,s,o);C(this,"deferred");C(this,"timer");this.deferred=Jt(),this.timer=va(l.timeout,o)}resolver(r,s){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
|
|
69
69
|
|
|
70
|
-
${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(s),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||De.errorForCode(Ce.Cancelled))}}const _2="$JS.API";function k2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Ju({apiPrefix:_2,timeout:5e3},e)}class Jl{constructor(t,r){C(this,"nc");C(this,"opts");C(this,"prefix");C(this,"timeout");C(this,"jc");this.nc=t,this.opts=k2(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=
|
|
71
|
-
`,Lu=Sa.fromAscii(ku),N2=new Uint8Array(Lu)[0],T2=new Uint8Array(Lu)[1];function O2(e){for(let t=0;t<e.length;t++){const r=t+1;if(e.byteLength>r&&e[t]===N2&&e[r]===T2)return r+1}return 0}function R2(e){const t=O2(e);if(t>0){const s=new Uint8Array(e).slice(0,t);return ar.decode(s)}return""}const M2=4,wx=48,D2=65,L2=97;function z2(e,t,r,s){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((c,f)=>{l[f]=c}),l[12]=e,l[13]=t,l[14]=r,l[15]=s,l}function ud(e){return U2(e)!==void 0}function U2(e){for(let t=0;t<e.length;t++)switch(e[t]){case".":return Sx(e);case":":return P2(e)}}function Sx(e){const t=new Uint8Array(4);for(let r=0;r<4;r++){if(e.length===0)return;if(r>0){if(e[0]!==".")return;e=e.substring(1)}const{n:s,c:l,ok:o}=B2(e);if(!o||s>255)return;e=e.substring(l),t[r]=s}return z2(t[0],t[1],t[2],t[3])}function P2(e){const t=new Uint8Array(16);let r=-1;if(e.length>=2&&e[0]===":"&&e[1]===":"&&(r=0,e=e.substring(2),e.length===0))return t;let s=0;for(;s<16;){const{n:l,c:o,ok:c}=H2(e);if(!c||l>65535)return;if(o<e.length&&e[o]==="."){if(r<0&&s!=12||s+4>16)return;const f=Sx(e);if(f===void 0)return;t[s]=f[12],t[s+1]=f[13],t[s+2]=f[14],t[s+3]=f[15],e="",s+=M2;break}if(t[s]=l>>8,t[s+1]=l,s+=2,e=e.substring(o),e.length===0)break;if(e[0]!==":"||e.length==1)return;if(e=e.substring(1),e[0]===":"){if(r>=0)return;if(r=s,e=e.substring(1),e.length===0)break}}if(e.length===0){if(s<16){if(r<0)return;const l=16-s;for(let o=s-1;o>=r;o--)t[o+l]=t[o];for(let o=r+l-1;o>=r;o--)t[o]=0}else if(r>=0)return;return t}}function B2(e){let t=0,r=0;for(t=0;t<e.length&&48<=e.charCodeAt(t)&&e.charCodeAt(t)<=57;t++)if(r=r*10+(e.charCodeAt(t)-wx),r>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:r,c:t,ok:!0}}function H2(e){let t=0,r=0;for(r=0;r<e.length;r++){if(48<=e.charCodeAt(r)&&e.charCodeAt(r)<=57)t*=16,t+=e.charCodeAt(r)-wx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)t*=16,t+=e.charCodeAt(r)-L2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)t*=16,t+=e.charCodeAt(r)-D2+10;else break;if(t>=16777215)return{n:0,c:r,ok:!1}}return r===0?{n:0,c:r,ok:!1}:{n:t,c:r,ok:!0}}function q2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function cd(e){return!q2(e)}function I2(e){const t="::FFFF:",r=e.toUpperCase().indexOf(t);if(r!==-1&&e.indexOf(".")!==-1){let s=e.substring(r+t.length);return s=s.replace("[",""),s.replace("]","")}return e}function F2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=I2(e),cd(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const t=cd(e)?e.match(/(]:)(\d+)/):e.match(/(:)(\d+)/),r=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,s=r===80?"https":"http",l=new URL(`${s}://${e}`);l.port=`${r}`;let o=l.hostname;return o.charAt(0)==="["&&(o=o.substring(1,o.length-1)),{listen:l.host,hostname:o,port:r}}class Rl{constructor(t,r=!1){C(this,"src");C(this,"listen");C(this,"hostname");C(this,"port");C(this,"didConnect");C(this,"reconnects");C(this,"lastConnect");C(this,"gossiped");C(this,"tlsName");C(this,"resolves");this.src=t,this.tlsName="";const s=F2(t);this.listen=s.listen,this.hostname=s.hostname,this.port=s.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=r}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const r=[];if(ud(this.hostname))return[this];{const s=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${s.join(",")}`);for(const l of s){const o=this.port===80?"https":"http",c=new URL(`${o}://${cd(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new Rl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return t.randomize&&px(r),this.resolves=r,r}}class $2{constructor(t=[],r={}){C(this,"firstSelect");C(this,"servers");C(this,"currentServer");C(this,"tlsName");C(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const s=_h();t&&(t.forEach(l=>{l=s?s(l):l,this.servers.push(new Rl(l))}),this.randomize&&(this.servers=px(this.servers))),this.servers.length===0&&this.addServer(`${td}:${vx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();ud(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,r=!1){const s=_h();t=s?s(t):t;const l=new Rl(t,r);ud(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const r=this.servers.indexOf(t);this.servers.splice(r,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(t,r){const s=[];let l=[];const o=_h(),c=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(d=>{d=o?o(d,r):d;const m=new Rl(d,!0);c.set(d,m)});const f=[];return this.servers.forEach((d,m)=>{const b=d.listen;d.gossiped&&this.currentServer.listen!==b&&c.get(b)===void 0&&f.push(m),c.delete(b)}),f.reverse(),f.forEach(d=>{const m=this.servers.splice(d,1);l=l.concat(m[0].listen)}),c.forEach((d,m)=>{this.servers.push(d),s.push(m)}),{added:s,deleted:l}}}class V2{constructor(){C(this,"baseInbox");C(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${gi(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const r=t.subject||"";return r.indexOf(this.baseInbox)===0?r.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,r){if(r&&r.permissionContext){if(t)return this.all().forEach(l=>{l.resolver(r,{})}),!0;const s=r.permissionContext;if(s.operation==="publish"){const l=this.all().find(o=>o.requestSubject===s.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(t,r)=>{const s=this.getToken(r);if(s){const l=this.get(s);l&&(t===null&&r.headers&&(t=gx(r)),l.resolver(t,r))}}}close(){const t=De.errorForCode(Ce.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class Y2{constructor(t,r,s){C(this,"ph");C(this,"interval");C(this,"maxOut");C(this,"timer");C(this,"pendings");this.ph=t,this.interval=r,this.maxOut=s,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:da.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=Vt();this.ph.flush(t).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(t),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(t=>(t.resolve(),!1))}}class G2 extends Error{constructor(t){super(t),this.name="AssertionError"}}function J2(e,t="Assertion failed."){if(!e)throw new G2(t)}const T0=32*1024,kh=2**32-2;function hu(e,t,r=0){const s=t.byteLength-r;return e.byteLength>s&&(e=e.subarray(0,s)),t.set(e,r),e.byteLength}class Eh{constructor(t){C(this,"_buf");C(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const r=this._buf.byteLength;return t<=this.capacity-r?(this._reslice(r+t),r):-1}_reslice(t){J2(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const r=hu(this._buf.subarray(this._off),t);return this._off+=r,r}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(Wi.encode(t))}write(t){const r=this._grow(t.byteLength);return hu(t,this._buf,r)}_grow(t){const r=this.length;r===0&&this._off!==0&&this.reset();const s=this._tryGrowByReslice(t);if(s>=0)return s;const l=this.capacity;if(t<=Math.floor(l/2)-r)hu(this._buf.subarray(this._off),this._buf);else{if(l+t>kh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const o=new Uint8Array(Math.min(2*l+t,kh));hu(this._buf.subarray(this._off),o),this._buf=o}}return this._off=0,this._reslice(Math.min(r+t,kh)),r}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const r=this._grow(t);this._reslice(r)}readFrom(t){let r=0;const s=new Uint8Array(T0);for(;;){const l=this.capacity-this.length<T0,o=l?s:new Uint8Array(this._buf.buffer,this.length),c=t.read(o);if(c===null)return r;l?this.write(o.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var zn;(function(e){e[e.OK=0]="OK",e[e.ERR=1]="ERR",e[e.MSG=2]="MSG",e[e.INFO=3]="INFO",e[e.PING=4]="PING",e[e.PONG=5]="PONG"})(zn||(zn={}));function O0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const X2=48;class R0{constructor(t){C(this,"dispatcher");C(this,"state");C(this,"as");C(this,"drop");C(this,"hdr");C(this,"ma");C(this,"argBuf");C(this,"msgBuf");this.dispatcher=t,this.state=Ne.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let r;for(r=0;r<t.length;r++){const s=t[r];switch(this.state){case Ne.OP_START:switch(s){case Te.M:case Te.m:this.state=Ne.OP_M,this.hdr=-1,this.ma=O0();break;case Te.H:case Te.h:this.state=Ne.OP_H,this.hdr=0,this.ma=O0();break;case Te.P:case Te.p:this.state=Ne.OP_P;break;case Te.PLUS:this.state=Ne.OP_PLUS;break;case Te.MINUS:this.state=Ne.OP_MINUS;break;case Te.I:case Te.i:this.state=Ne.OP_I;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_H:switch(s){case Te.M:case Te.m:this.state=Ne.OP_M;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_M:switch(s){case Te.S:case Te.s:this.state=Ne.OP_MS;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MS:switch(s){case Te.G:case Te.g:this.state=Ne.OP_MSG;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MSG:switch(s){case Te.SPACE:case Te.TAB:this.state=Ne.OP_MSG_SPC;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MSG_SPC:switch(s){case Te.SPACE:case Te.TAB:continue;default:this.state=Ne.MSG_ARG,this.as=r}break;case Ne.MSG_ARG:switch(s){case Te.CR:this.drop=1;break;case Te.NL:{const l=this.argBuf?this.argBuf.bytes():t.subarray(this.as,r-this.drop);this.processMsgArgs(l),this.drop=0,this.as=r+1,this.state=Ne.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case Ne.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:zn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ne.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const o=t.length-r;o<l&&(l=o),l>0?(this.msgBuf.write(t.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(s)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:zn.MSG,msg:this.ma,data:t.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ne.MSG_END);break;case Ne.MSG_END:switch(s){case Te.NL:this.drop=0,this.as=r+1,this.state=Ne.OP_START;break;default:continue}break;case Ne.OP_PLUS:switch(s){case Te.O:case Te.o:this.state=Ne.OP_PLUS_O;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PLUS_O:switch(s){case Te.K:case Te.k:this.state=Ne.OP_PLUS_OK;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PLUS_OK:switch(s){case Te.NL:this.dispatcher.push({kind:zn.OK}),this.drop=0,this.state=Ne.OP_START;break}break;case Ne.OP_MINUS:switch(s){case Te.E:case Te.e:this.state=Ne.OP_MINUS_E;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MINUS_E:switch(s){case Te.R:case Te.r:this.state=Ne.OP_MINUS_ER;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MINUS_ER:switch(s){case Te.R:case Te.r:this.state=Ne.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MINUS_ERR:switch(s){case Te.SPACE:case Te.TAB:this.state=Ne.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MINUS_ERR_SPC:switch(s){case Te.SPACE:case Te.TAB:continue;default:this.state=Ne.MINUS_ERR_ARG,this.as=r}break;case Ne.MINUS_ERR_ARG:switch(s){case Te.CR:this.drop=1;break;case Te.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:zn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=Ne.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case Ne.OP_P:switch(s){case Te.I:case Te.i:this.state=Ne.OP_PI;break;case Te.O:case Te.o:this.state=Ne.OP_PO;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PO:switch(s){case Te.N:case Te.n:this.state=Ne.OP_PON;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PON:switch(s){case Te.G:case Te.g:this.state=Ne.OP_PONG;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PONG:switch(s){case Te.NL:this.dispatcher.push({kind:zn.PONG}),this.drop=0,this.state=Ne.OP_START;break}break;case Ne.OP_PI:switch(s){case Te.N:case Te.n:this.state=Ne.OP_PIN;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PIN:switch(s){case Te.G:case Te.g:this.state=Ne.OP_PING;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PING:switch(s){case Te.NL:this.dispatcher.push({kind:zn.PING}),this.drop=0,this.state=Ne.OP_START;break}break;case Ne.OP_I:switch(s){case Te.N:case Te.n:this.state=Ne.OP_IN;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_IN:switch(s){case Te.F:case Te.f:this.state=Ne.OP_INF;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_INF:switch(s){case Te.O:case Te.o:this.state=Ne.OP_INFO;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_INFO:switch(s){case Te.SPACE:case Te.TAB:this.state=Ne.OP_INFO_SPC;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_INFO_SPC:switch(s){case Te.SPACE:case Te.TAB:continue;default:this.state=Ne.INFO_ARG,this.as=r}break;case Ne.INFO_ARG:switch(s){case Te.CR:this.drop=1;break;case Te.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:zn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=Ne.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(t.subarray(r))}}(this.state===Ne.MSG_ARG||this.state===Ne.MINUS_ERR_ARG||this.state===Ne.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Eh(t.subarray(this.as,r-this.drop))),this.state===Ne.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Eh(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,s=new Uint8Array(t+r);s.set(this.ma.subject),this.ma.reply&&s.set(this.ma.reply,t),this.argBuf=new Eh(s),this.ma.subject=s.subarray(0,t),this.ma.reply&&(this.ma.reply=s.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case Te.SPACE:case Te.TAB:case Te.CR:case Te.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[3]);break;default:throw this.fail(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${ar.decode(t)}`)}processHeaderMsgArgs(t){const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case Te.SPACE:case Te.TAB:case Te.CR:case Te.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[4]);break;default:throw this.fail(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let r=0;for(let s=0;s<t.length;s++){if(t[s]<48||t[s]>57)return-1;r=r*10+(t[s]-X2)}return r}}var Ne;(function(e){e[e.OP_START=0]="OP_START",e[e.OP_PLUS=1]="OP_PLUS",e[e.OP_PLUS_O=2]="OP_PLUS_O",e[e.OP_PLUS_OK=3]="OP_PLUS_OK",e[e.OP_MINUS=4]="OP_MINUS",e[e.OP_MINUS_E=5]="OP_MINUS_E",e[e.OP_MINUS_ER=6]="OP_MINUS_ER",e[e.OP_MINUS_ERR=7]="OP_MINUS_ERR",e[e.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",e[e.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",e[e.OP_M=10]="OP_M",e[e.OP_MS=11]="OP_MS",e[e.OP_MSG=12]="OP_MSG",e[e.OP_MSG_SPC=13]="OP_MSG_SPC",e[e.MSG_ARG=14]="MSG_ARG",e[e.MSG_PAYLOAD=15]="MSG_PAYLOAD",e[e.MSG_END=16]="MSG_END",e[e.OP_H=17]="OP_H",e[e.OP_P=18]="OP_P",e[e.OP_PI=19]="OP_PI",e[e.OP_PIN=20]="OP_PIN",e[e.OP_PING=21]="OP_PING",e[e.OP_PO=22]="OP_PO",e[e.OP_PON=23]="OP_PON",e[e.OP_PONG=24]="OP_PONG",e[e.OP_I=25]="OP_I",e[e.OP_IN=26]="OP_IN",e[e.OP_INF=27]="OP_INF",e[e.OP_INFO=28]="OP_INFO",e[e.OP_INFO_SPC=29]="OP_INFO_SPC",e[e.INFO_ARG=30]="INFO_ARG"})(Ne||(Ne={}));var Te;(function(e){e[e.CR=13]="CR",e[e.E=69]="E",e[e.e=101]="e",e[e.F=70]="F",e[e.f=102]="f",e[e.G=71]="G",e[e.g=103]="g",e[e.H=72]="H",e[e.h=104]="h",e[e.I=73]="I",e[e.i=105]="i",e[e.K=75]="K",e[e.k=107]="k",e[e.M=77]="M",e[e.m=109]="m",e[e.MINUS=45]="MINUS",e[e.N=78]="N",e[e.n=110]="n",e[e.NL=10]="NL",e[e.O=79]="O",e[e.o=111]="o",e[e.P=80]="P",e[e.p=112]="p",e[e.PLUS=43]="PLUS",e[e.R=82]="R",e[e.r=114]="r",e[e.S=83]="S",e[e.s=115]="s",e[e.SPACE=32]="SPACE",e[e.TAB=9]="TAB"})(Te||(Te={}));(function(e){var t=function(k,R){this.hi=k|0,this.lo=R|0},r=function(k){var R,T=new Float64Array(16);if(k)for(R=0;R<k.length;R++)T[R]=k[R];return T},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var c=r(),f=r([1]),d=r([56129,1]),m=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),b=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function S(k,R){return k<<R|k>>>32-R}function A(k,R){var T=k[R+3]&255;return T=T<<8|k[R+2]&255,T=T<<8|k[R+1]&255,T<<8|k[R+0]&255}function O(k,R){var T=k[R]<<24|k[R+1]<<16|k[R+2]<<8|k[R+3],U=k[R+4]<<24|k[R+5]<<16|k[R+6]<<8|k[R+7];return new t(T,U)}function M(k,R,T){var U;for(U=0;U<4;U++)k[R+U]=T&255,T>>>=8}function P(k,R,T){k[R]=T.hi>>24&255,k[R+1]=T.hi>>16&255,k[R+2]=T.hi>>8&255,k[R+3]=T.hi&255,k[R+4]=T.lo>>24&255,k[R+5]=T.lo>>16&255,k[R+6]=T.lo>>8&255,k[R+7]=T.lo&255}function I(k,R,T,U,$){var Z,ge=0;for(Z=0;Z<$;Z++)ge|=k[R+Z]^T[U+Z];return(1&ge-1>>>8)-1}function te(k,R,T,U){return I(k,R,T,U,16)}function q(k,R,T,U){return I(k,R,T,U,32)}function L(k,R,T,U,$){var Z=new Uint32Array(16),ge=new Uint32Array(16),be=new Uint32Array(16),ae=new Uint32Array(4),pe,Le,it;for(pe=0;pe<4;pe++)ge[5*pe]=A(U,4*pe),ge[1+pe]=A(T,4*pe),ge[6+pe]=A(R,4*pe),ge[11+pe]=A(T,16+4*pe);for(pe=0;pe<16;pe++)be[pe]=ge[pe];for(pe=0;pe<20;pe++){for(Le=0;Le<4;Le++){for(it=0;it<4;it++)ae[it]=ge[(5*Le+4*it)%16];for(ae[1]^=S(ae[0]+ae[3]|0,7),ae[2]^=S(ae[1]+ae[0]|0,9),ae[3]^=S(ae[2]+ae[1]|0,13),ae[0]^=S(ae[3]+ae[2]|0,18),it=0;it<4;it++)Z[4*Le+(Le+it)%4]=ae[it]}for(it=0;it<16;it++)ge[it]=Z[it]}if($){for(pe=0;pe<16;pe++)ge[pe]=ge[pe]+be[pe]|0;for(pe=0;pe<4;pe++)ge[5*pe]=ge[5*pe]-A(U,4*pe)|0,ge[6+pe]=ge[6+pe]-A(R,4*pe)|0;for(pe=0;pe<4;pe++)M(k,4*pe,ge[5*pe]),M(k,16+4*pe,ge[6+pe])}else for(pe=0;pe<16;pe++)M(k,4*pe,ge[pe]+be[pe]|0)}function ee(k,R,T,U){return L(k,R,T,U,!1),0}function J(k,R,T,U){return L(k,R,T,U,!0),0}var B=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function D(k,R,T,U,$,Z,ge){var be=new Uint8Array(16),ae=new Uint8Array(64),pe,Le;if(!$)return 0;for(Le=0;Le<16;Le++)be[Le]=0;for(Le=0;Le<8;Le++)be[Le]=Z[Le];for(;$>=64;){for(ee(ae,be,ge,B),Le=0;Le<64;Le++)k[R+Le]=(T?T[U+Le]:0)^ae[Le];for(pe=1,Le=8;Le<16;Le++)pe=pe+(be[Le]&255)|0,be[Le]=pe&255,pe>>>=8;$-=64,R+=64,T&&(U+=64)}if($>0)for(ee(ae,be,ge,B),Le=0;Le<$;Le++)k[R+Le]=(T?T[U+Le]:0)^ae[Le];return 0}function G(k,R,T,U,$){return D(k,R,null,0,T,U,$)}function F(k,R,T,U,$){var Z=new Uint8Array(32);return J(Z,U,$,B),G(k,R,T,U.subarray(16),Z)}function fe(k,R,T,U,$,Z,ge){var be=new Uint8Array(32);return J(be,Z,ge,B),D(k,R,T,U,$,Z.subarray(16),be)}function oe(k,R){var T,U=0;for(T=0;T<17;T++)U=U+(k[T]+R[T]|0)|0,k[T]=U&255,U>>>=8}var ne=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function V(k,R,T,U,$,Z){var ge,be,ae,pe,Le=new Uint32Array(17),it=new Uint32Array(17),Bt=new Uint32Array(17),jn=new Uint32Array(17),Cr=new Uint32Array(17);for(ae=0;ae<17;ae++)it[ae]=Bt[ae]=0;for(ae=0;ae<16;ae++)it[ae]=Z[ae];for(it[3]&=15,it[4]&=252,it[7]&=15,it[8]&=252,it[11]&=15,it[12]&=252,it[15]&=15;$>0;){for(ae=0;ae<17;ae++)jn[ae]=0;for(ae=0;ae<16&&ae<$;++ae)jn[ae]=T[U+ae];for(jn[ae]=1,U+=ae,$-=ae,oe(Bt,jn),be=0;be<17;be++)for(Le[be]=0,ae=0;ae<17;ae++)Le[be]=Le[be]+Bt[ae]*(ae<=be?it[be-ae]:320*it[be+17-ae]|0)|0|0;for(be=0;be<17;be++)Bt[be]=Le[be];for(pe=0,ae=0;ae<16;ae++)pe=pe+Bt[ae]|0,Bt[ae]=pe&255,pe>>>=8;for(pe=pe+Bt[16]|0,Bt[16]=pe&3,pe=5*(pe>>>2)|0,ae=0;ae<16;ae++)pe=pe+Bt[ae]|0,Bt[ae]=pe&255,pe>>>=8;pe=pe+Bt[16]|0,Bt[16]=pe}for(ae=0;ae<17;ae++)Cr[ae]=Bt[ae];for(oe(Bt,ne),ge=-(Bt[16]>>>7)|0,ae=0;ae<17;ae++)Bt[ae]^=ge&(Cr[ae]^Bt[ae]);for(ae=0;ae<16;ae++)jn[ae]=Z[ae+16];for(jn[16]=0,oe(Bt,jn),ae=0;ae<16;ae++)k[R+ae]=Bt[ae];return 0}function Q(k,R,T,U,$,Z){var ge=new Uint8Array(16);return V(ge,0,T,U,$,Z),te(k,R,ge,0)}function X(k,R,T,U,$){var Z;if(T<32)return-1;for(fe(k,0,R,0,T,U,$),V(k,16,k,32,T-32,k),Z=0;Z<16;Z++)k[Z]=0;return 0}function xe(k,R,T,U,$){var Z,ge=new Uint8Array(32);if(T<32||(F(ge,0,32,U,$),Q(R,16,R,32,T-32,ge)!==0))return-1;for(fe(k,0,R,0,T,U,$),Z=0;Z<32;Z++)k[Z]=0;return 0}function j(k,R){var T;for(T=0;T<16;T++)k[T]=R[T]|0}function z(k){var R,T;for(T=0;T<16;T++)k[T]+=65536,R=Math.floor(k[T]/65536),k[(T+1)*(T<15?1:0)]+=R-1+37*(R-1)*(T===15?1:0),k[T]-=R*65536}function W(k,R,T){for(var U,$=~(T-1),Z=0;Z<16;Z++)U=$&(k[Z]^R[Z]),k[Z]^=U,R[Z]^=U}function N(k,R){var T,U,$,Z=r(),ge=r();for(T=0;T<16;T++)ge[T]=R[T];for(z(ge),z(ge),z(ge),U=0;U<2;U++){for(Z[0]=ge[0]-65517,T=1;T<15;T++)Z[T]=ge[T]-65535-(Z[T-1]>>16&1),Z[T-1]&=65535;Z[15]=ge[15]-32767-(Z[14]>>16&1),$=Z[15]>>16&1,Z[14]&=65535,W(ge,Z,1-$)}for(T=0;T<16;T++)k[2*T]=ge[T]&255,k[2*T+1]=ge[T]>>8}function we(k,R){var T=new Uint8Array(32),U=new Uint8Array(32);return N(T,k),N(U,R),q(T,0,U,0)}function Oe(k){var R=new Uint8Array(32);return N(R,k),R[0]&1}function je(k,R){var T;for(T=0;T<16;T++)k[T]=R[2*T]+(R[2*T+1]<<8);k[15]&=32767}function he(k,R,T){var U;for(U=0;U<16;U++)k[U]=R[U]+T[U]|0}function Ae(k,R,T){var U;for(U=0;U<16;U++)k[U]=R[U]-T[U]|0}function Se(k,R,T){var U,$,Z=new Float64Array(31);for(U=0;U<31;U++)Z[U]=0;for(U=0;U<16;U++)for($=0;$<16;$++)Z[U+$]+=R[U]*T[$];for(U=0;U<15;U++)Z[U]+=38*Z[U+16];for(U=0;U<16;U++)k[U]=Z[U];z(k),z(k)}function We(k,R){Se(k,R,R)}function It(k,R){var T=r(),U;for(U=0;U<16;U++)T[U]=R[U];for(U=253;U>=0;U--)We(T,T),U!==2&&U!==4&&Se(T,T,R);for(U=0;U<16;U++)k[U]=T[U]}function ln(k,R){var T=r(),U;for(U=0;U<16;U++)T[U]=R[U];for(U=250;U>=0;U--)We(T,T),U!==1&&Se(T,T,R);for(U=0;U<16;U++)k[U]=T[U]}function nn(k,R,T){var U=new Uint8Array(32),$=new Float64Array(80),Z,ge,be=r(),ae=r(),pe=r(),Le=r(),it=r(),Bt=r();for(ge=0;ge<31;ge++)U[ge]=R[ge];for(U[31]=R[31]&127|64,U[0]&=248,je($,T),ge=0;ge<16;ge++)ae[ge]=$[ge],Le[ge]=be[ge]=pe[ge]=0;for(be[0]=Le[0]=1,ge=254;ge>=0;--ge)Z=U[ge>>>3]>>>(ge&7)&1,W(be,ae,Z),W(pe,Le,Z),he(it,be,pe),Ae(be,be,pe),he(pe,ae,Le),Ae(ae,ae,Le),We(Le,it),We(Bt,be),Se(be,pe,be),Se(pe,ae,it),he(it,be,pe),Ae(be,be,pe),We(ae,be),Ae(pe,Le,Bt),Se(be,pe,d),he(be,be,Le),Se(pe,pe,be),Se(be,Le,Bt),Se(Le,ae,$),We(ae,it),W(be,ae,Z),W(pe,Le,Z);for(ge=0;ge<16;ge++)$[ge+16]=be[ge],$[ge+32]=pe[ge],$[ge+48]=ae[ge],$[ge+64]=Le[ge];var jn=$.subarray(32),Cr=$.subarray(16);return It(jn,jn),Se(Cr,Cr,jn),N(k,Cr),0}function Gt(k,R){return nn(k,R,o)}function on(k,R){return s(R,32),Gt(k,R)}function Ot(k,R,T){var U=new Uint8Array(32);return nn(U,T,R),J(k,l,U,B)}var Qt=X,Ie=xe;function dt(k,R,T,U,$,Z){var ge=new Uint8Array(32);return Ot(ge,$,Z),Qt(k,R,T,U,ge)}function Ke(k,R,T,U,$,Z){var ge=new Uint8Array(32);return Ot(ge,$,Z),Ie(k,R,T,U,ge)}function wt(){var k=0,R=0,T=0,U=0,$=65535,Z,ge,be;for(be=0;be<arguments.length;be++)Z=arguments[be].lo,ge=arguments[be].hi,k+=Z&$,R+=Z>>>16,T+=ge&$,U+=ge>>>16;return R+=k>>>16,T+=R>>>16,U+=T>>>16,new t(T&$|U<<16,k&$|R<<16)}function Ut(k,R){return new t(k.hi>>>R,k.lo>>>R|k.hi<<32-R)}function En(){var k=0,R=0,T;for(T=0;T<arguments.length;T++)k^=arguments[T].lo,R^=arguments[T].hi;return new t(R,k)}function gt(k,R){var T,U,$=32-R;return R<32?(T=k.hi>>>R|k.lo<<$,U=k.lo>>>R|k.hi<<$):R<64&&(T=k.lo>>>R|k.hi<<$,U=k.hi>>>R|k.lo<<$),new t(T,U)}function Cn(k,R,T){var U=k.hi&R.hi^~k.hi&T.hi,$=k.lo&R.lo^~k.lo&T.lo;return new t(U,$)}function le(k,R,T){var U=k.hi&R.hi^k.hi&T.hi^R.hi&T.hi,$=k.lo&R.lo^k.lo&T.lo^R.lo&T.lo;return new t(U,$)}function ke(k){return En(gt(k,28),gt(k,34),gt(k,39))}function Re(k){return En(gt(k,14),gt(k,18),gt(k,41))}function Ge(k){return En(gt(k,1),gt(k,8),Ut(k,7))}function rt(k){return En(gt(k,19),gt(k,61),Ut(k,6))}var un=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function yn(k,R,T){var U=[],$=[],Z=[],ge=[],be,ae,pe;for(ae=0;ae<8;ae++)U[ae]=Z[ae]=O(k,8*ae);for(var Le=0;T>=128;){for(ae=0;ae<16;ae++)ge[ae]=O(R,8*ae+Le);for(ae=0;ae<80;ae++){for(pe=0;pe<8;pe++)$[pe]=Z[pe];for(be=wt(Z[7],Re(Z[4]),Cn(Z[4],Z[5],Z[6]),un[ae],ge[ae%16]),$[7]=wt(be,ke(Z[0]),le(Z[0],Z[1],Z[2])),$[3]=wt($[3],be),pe=0;pe<8;pe++)Z[(pe+1)%8]=$[pe];if(ae%16===15)for(pe=0;pe<16;pe++)ge[pe]=wt(ge[pe],ge[(pe+9)%16],Ge(ge[(pe+1)%16]),rt(ge[(pe+14)%16]))}for(ae=0;ae<8;ae++)Z[ae]=wt(Z[ae],U[ae]),U[ae]=Z[ae];Le+=128,T-=128}for(ae=0;ae<8;ae++)P(k,8*ae,U[ae]);return T}var Jt=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function yt(k,R,T){var U=new Uint8Array(64),$=new Uint8Array(256),Z,ge=T;for(Z=0;Z<64;Z++)U[Z]=Jt[Z];for(yn(U,R,T),T%=128,Z=0;Z<256;Z++)$[Z]=0;for(Z=0;Z<T;Z++)$[Z]=R[ge-T+Z];for($[T]=128,T=256-128*(T<112?1:0),$[T-9]=0,P($,T-8,new t(ge/536870912|0,ge<<3)),yn(U,$,T),Z=0;Z<64;Z++)k[Z]=U[Z];return 0}function Xt(k,R){var T=r(),U=r(),$=r(),Z=r(),ge=r(),be=r(),ae=r(),pe=r(),Le=r();Ae(T,k[1],k[0]),Ae(Le,R[1],R[0]),Se(T,T,Le),he(U,k[0],k[1]),he(Le,R[0],R[1]),Se(U,U,Le),Se($,k[3],R[3]),Se($,$,b),Se(Z,k[2],R[2]),he(Z,Z,Z),Ae(ge,U,T),Ae(be,Z,$),he(ae,Z,$),he(pe,U,T),Se(k[0],ge,be),Se(k[1],pe,ae),Se(k[2],ae,be),Se(k[3],ge,pe)}function Qe(k,R,T){var U;for(U=0;U<4;U++)W(k[U],R[U],T)}function ve(k,R){var T=r(),U=r(),$=r();It($,R[2]),Se(T,R[0],$),Se(U,R[1],$),N(k,U),k[31]^=Oe(T)<<7}function Fe(k,R,T){var U,$;for(j(k[0],c),j(k[1],f),j(k[2],f),j(k[3],c),$=255;$>=0;--$)U=T[$/8|0]>>($&7)&1,Qe(k,R,U),Xt(R,k),Xt(k,k),Qe(k,R,U)}function Me(k,R){var T=[r(),r(),r(),r()];j(T[0],g),j(T[1],x),j(T[2],f),Se(T[3],g,x),Fe(k,T,R)}function _t(k,R,T){var U=new Uint8Array(64),$=[r(),r(),r(),r()],Z;for(T||s(R,32),yt(U,R,32),U[0]&=248,U[31]&=127,U[31]|=64,Me($,U),ve(k,$),Z=0;Z<32;Z++)R[Z+32]=k[Z];return 0}var Zt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Mn(k,R){var T,U,$,Z;for(U=63;U>=32;--U){for(T=0,$=U-32,Z=U-12;$<Z;++$)R[$]+=T-16*R[U]*Zt[$-(U-32)],T=Math.floor((R[$]+128)/256),R[$]-=T*256;R[$]+=T,R[U]=0}for(T=0,$=0;$<32;$++)R[$]+=T-(R[31]>>4)*Zt[$],T=R[$]>>8,R[$]&=255;for($=0;$<32;$++)R[$]-=T*Zt[$];for(U=0;U<32;U++)R[U+1]+=R[U]>>8,k[U]=R[U]&255}function Xn(k){var R=new Float64Array(64),T;for(T=0;T<64;T++)R[T]=k[T];for(T=0;T<64;T++)k[T]=0;Mn(k,R)}function Jr(k,R,T,U){var $=new Uint8Array(64),Z=new Uint8Array(64),ge=new Uint8Array(64),be,ae,pe=new Float64Array(64),Le=[r(),r(),r(),r()];yt($,U,32),$[0]&=248,$[31]&=127,$[31]|=64;var it=T+64;for(be=0;be<T;be++)k[64+be]=R[be];for(be=0;be<32;be++)k[32+be]=$[32+be];for(yt(ge,k.subarray(32),T+32),Xn(ge),Me(Le,ge),ve(k,Le),be=32;be<64;be++)k[be]=U[be];for(yt(Z,k,T+64),Xn(Z),be=0;be<64;be++)pe[be]=0;for(be=0;be<32;be++)pe[be]=ge[be];for(be=0;be<32;be++)for(ae=0;ae<32;ae++)pe[be+ae]+=Z[be]*$[ae];return Mn(k.subarray(32),pe),it}function Er(k,R){var T=r(),U=r(),$=r(),Z=r(),ge=r(),be=r(),ae=r();return j(k[2],f),je(k[1],R),We($,k[1]),Se(Z,$,m),Ae($,$,k[2]),he(Z,k[2],Z),We(ge,Z),We(be,ge),Se(ae,be,ge),Se(T,ae,$),Se(T,T,Z),ln(T,T),Se(T,T,$),Se(T,T,Z),Se(T,T,Z),Se(k[0],T,Z),We(U,k[0]),Se(U,U,Z),we(U,$)&&Se(k[0],k[0],v),We(U,k[0]),Se(U,U,Z),we(U,$)?-1:(Oe(k[0])===R[31]>>7&&Ae(k[0],c,k[0]),Se(k[3],k[0],k[1]),0)}function ts(k,R,T,U){var $,Z=new Uint8Array(32),ge=new Uint8Array(64),be=[r(),r(),r(),r()],ae=[r(),r(),r(),r()];if(T<64||Er(ae,U))return-1;for($=0;$<T;$++)k[$]=R[$];for($=0;$<32;$++)k[$+32]=U[$];if(yt(ge,k,T),Xn(ge),Fe(be,ae,ge),Me(ae,R.subarray(32)),Xt(be,ae),ve(Z,be),T-=64,q(R,0,Z,0)){for($=0;$<T;$++)k[$]=0;return-1}for($=0;$<T;$++)k[$]=R[$+64];return T}var de=32,Ee=24,Be=32,Ye=16,He=32,ot=32,Xe=32,Pe=32,et=32,Wt=Ee,Kt=Be,Rt=Ye,ut=64,Pt=32,An=64,Ur=32,wi=64;e.lowlevel={crypto_core_hsalsa20:J,crypto_stream_xor:fe,crypto_stream:F,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:G,crypto_onetimeauth:V,crypto_onetimeauth_verify:Q,crypto_verify_16:te,crypto_verify_32:q,crypto_secretbox:X,crypto_secretbox_open:xe,crypto_scalarmult:nn,crypto_scalarmult_base:Gt,crypto_box_beforenm:Ot,crypto_box_afternm:Qt,crypto_box:dt,crypto_box_open:Ke,crypto_box_keypair:on,crypto_hash:yt,crypto_sign:Jr,crypto_sign_keypair:_t,crypto_sign_open:ts,crypto_secretbox_KEYBYTES:de,crypto_secretbox_NONCEBYTES:Ee,crypto_secretbox_ZEROBYTES:Be,crypto_secretbox_BOXZEROBYTES:Ye,crypto_scalarmult_BYTES:He,crypto_scalarmult_SCALARBYTES:ot,crypto_box_PUBLICKEYBYTES:Xe,crypto_box_SECRETKEYBYTES:Pe,crypto_box_BEFORENMBYTES:et,crypto_box_NONCEBYTES:Wt,crypto_box_ZEROBYTES:Kt,crypto_box_BOXZEROBYTES:Rt,crypto_sign_BYTES:ut,crypto_sign_PUBLICKEYBYTES:Pt,crypto_sign_SECRETKEYBYTES:An,crypto_sign_SEEDBYTES:Ur,crypto_hash_BYTES:wi,gf:r,D:m,L:Zt,pack25519:N,unpack25519:je,M:Se,A:he,S:We,Z:Ae,pow2523:ln,add:Xt,set25519:j,modL:Mn,scalarmult:Fe,scalarbase:Me};function Lt(k,R){if(k.length!==de)throw new Error("bad key size");if(R.length!==Ee)throw new Error("bad nonce size")}function ns(k,R){if(k.length!==Xe)throw new Error("bad public key size");if(R.length!==Pe)throw new Error("bad secret key size")}function pn(){for(var k=0;k<arguments.length;k++)if(!(arguments[k]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Cs(k){for(var R=0;R<k.length;R++)k[R]=0}e.randomBytes=function(k){var R=new Uint8Array(k);return s(R,k),R},e.secretbox=function(k,R,T){pn(k,R,T),Lt(T,R);for(var U=new Uint8Array(Be+k.length),$=new Uint8Array(U.length),Z=0;Z<k.length;Z++)U[Z+Be]=k[Z];return X($,U,U.length,R,T),$.subarray(Ye)},e.secretbox.open=function(k,R,T){pn(k,R,T),Lt(T,R);for(var U=new Uint8Array(Ye+k.length),$=new Uint8Array(U.length),Z=0;Z<k.length;Z++)U[Z+Ye]=k[Z];return U.length<32||xe($,U,U.length,R,T)!==0?null:$.subarray(Be)},e.secretbox.keyLength=de,e.secretbox.nonceLength=Ee,e.secretbox.overheadLength=Ye,e.scalarMult=function(k,R){if(pn(k,R),k.length!==ot)throw new Error("bad n size");if(R.length!==He)throw new Error("bad p size");var T=new Uint8Array(He);return nn(T,k,R),T},e.scalarMult.base=function(k){if(pn(k),k.length!==ot)throw new Error("bad n size");var R=new Uint8Array(He);return Gt(R,k),R},e.scalarMult.scalarLength=ot,e.scalarMult.groupElementLength=He,e.box=function(k,R,T,U){var $=e.box.before(T,U);return e.secretbox(k,R,$)},e.box.before=function(k,R){pn(k,R),ns(k,R);var T=new Uint8Array(et);return Ot(T,k,R),T},e.box.after=e.secretbox,e.box.open=function(k,R,T,U){var $=e.box.before(T,U);return e.secretbox.open(k,R,$)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var k=new Uint8Array(Xe),R=new Uint8Array(Pe);return on(k,R),{publicKey:k,secretKey:R}},e.box.keyPair.fromSecretKey=function(k){if(pn(k),k.length!==Pe)throw new Error("bad secret key size");var R=new Uint8Array(Xe);return Gt(R,k),{publicKey:R,secretKey:new Uint8Array(k)}},e.box.publicKeyLength=Xe,e.box.secretKeyLength=Pe,e.box.sharedKeyLength=et,e.box.nonceLength=Wt,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(k,R){if(pn(k,R),R.length!==An)throw new Error("bad secret key size");var T=new Uint8Array(ut+k.length);return Jr(T,k,k.length,R),T},e.sign.open=function(k,R){if(pn(k,R),R.length!==Pt)throw new Error("bad public key size");var T=new Uint8Array(k.length),U=ts(T,k,k.length,R);if(U<0)return null;for(var $=new Uint8Array(U),Z=0;Z<$.length;Z++)$[Z]=T[Z];return $},e.sign.detached=function(k,R){for(var T=e.sign(k,R),U=new Uint8Array(ut),$=0;$<U.length;$++)U[$]=T[$];return U},e.sign.detached.verify=function(k,R,T){if(pn(k,R,T),R.length!==ut)throw new Error("bad signature size");if(T.length!==Pt)throw new Error("bad public key size");var U=new Uint8Array(ut+k.length),$=new Uint8Array(ut+k.length),Z;for(Z=0;Z<ut;Z++)U[Z]=R[Z];for(Z=0;Z<k.length;Z++)U[Z+ut]=k[Z];return ts($,U,U.length,T)>=0},e.sign.keyPair=function(){var k=new Uint8Array(Pt),R=new Uint8Array(An);return _t(k,R),{publicKey:k,secretKey:R}},e.sign.keyPair.fromSecretKey=function(k){if(pn(k),k.length!==An)throw new Error("bad secret key size");for(var R=new Uint8Array(Pt),T=0;T<R.length;T++)R[T]=k[32+T];return{publicKey:R,secretKey:new Uint8Array(k)}},e.sign.keyPair.fromSeed=function(k){if(pn(k),k.length!==Ur)throw new Error("bad seed size");for(var R=new Uint8Array(Pt),T=new Uint8Array(An),U=0;U<32;U++)T[U]=k[U];return _t(R,T,!0),{publicKey:R,secretKey:T}},e.sign.publicKeyLength=Pt,e.sign.secretKeyLength=An,e.sign.seedLength=Ur,e.sign.signatureLength=ut,e.hash=function(k){pn(k);var R=new Uint8Array(wi);return yt(R,k,k.length),R},e.hash.hashLength=wi,e.verify=function(k,R){return pn(k,R),k.length===0||R.length===0||k.length!==R.length?!1:I(k,0,R,0,k.length)===0},e.setPRNG=function(k){s=k},(function(){var k=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(k&&k.getRandomValues){var R=65536;e.setPRNG(function(T,U){var $,Z=new Uint8Array(U);for($=0;$<U;$+=R)k.getRandomValues(Z.subarray($,$+Math.min(U-$,R)));for($=0;$<U;$++)T[$]=Z[$];Cs(Z)})}else typeof require<"u"&&(k=require("crypto"),k&&k.randomBytes&&e.setPRNG(function(T,U){var $,Z=k.randomBytes(U);for($=0;$<U;$++)T[$]=Z[$];Cs(Z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const du=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,K2={fromSeed:du.sign.keyPair.fromSeed,sign:du.sign.detached,verify:du.sign.detached.verify,randomBytes:du.randomBytes};let _x;function Q2(e){_x=e}function Yi(){return _x}const Z2=new Uint16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);class zu{static checksum(t){let r=0;for(let s=0;s<t.byteLength;s++){let l=t[s];r=r<<8&65535^Z2[(r>>8^l)&255]}return r}static validate(t,r){return zu.checksum(t)==r}}const Ch="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class M0{static encode(t){let r=0,s=0,l=new Uint8Array(t),o=new Uint8Array(t.byteLength*2),c=0;for(let f=0;f<l.byteLength;f++)for(s=s<<8|l[f],r+=8;r>=5;){let d=s>>>r-5&31;o[c++]=Ch.charAt(d).charCodeAt(0),r-=5}if(r>0){let f=s<<5-r&31;o[c++]=Ch.charAt(f).charCodeAt(0)}return o.slice(0,c)}static decode(t){let r=0,s=0,l=0,o=new Uint8Array(t),c=new Uint8Array(o.byteLength*5/8|0);for(let f=0;f<o.byteLength;f++){let d=String.fromCharCode(o[f]),m=Ch.indexOf(d);if(m===-1)throw new Error("Illegal Base32 character: "+o[f]);s=s<<5|m,r+=5,r>=8&&(c[l++]=s>>>r-8&255,r-=8)}return c.slice(0,l)}}class Tt extends Error{constructor(r,s){super(r);C(this,"name");C(this,"code");C(this,"chainedError");this.name="NKeysError",this.code=r,this.chainedError=s}}function W2(){return Qu(Nt.Operator)}function ek(){return Qu(Nt.Account)}function tk(){return Qu(Nt.User)}var St;(function(e){e.InvalidPrefixByte="nkeys: invalid prefix byte",e.InvalidKey="nkeys: invalid key",e.InvalidPublicKey="nkeys: invalid public key",e.InvalidSeedLen="nkeys: invalid seed length",e.InvalidSeed="nkeys: invalid seed",e.InvalidEncoding="nkeys: invalid encoded key",e.InvalidSignature="nkeys: signature verification failed",e.CannotSign="nkeys: cannot sign, no private key available",e.PublicKeyOnly="nkeys: no seed or private key available",e.InvalidChecksum="nkeys: invalid checksum",e.SerializationError="nkeys: serialization error",e.ApiError="nkeys: api error",e.ClearedPair="nkeys: pair is cleared"})(St||(St={}));var Nt;(function(e){e[e.Seed=144]="Seed",e[e.Private=120]="Private",e[e.Operator=112]="Operator",e[e.Server=104]="Server",e[e.Cluster=16]="Cluster",e[e.Account=0]="Account",e[e.User=160]="User"})(Nt||(Nt={}));class ha{static isValidPublicPrefix(t){return t==Nt.Server||t==Nt.Operator||t==Nt.Cluster||t==Nt.Account||t==Nt.User}static startsWithValidPrefix(t){let r=t[0];return r=="S"||r=="P"||r=="O"||r=="N"||r=="C"||r=="A"||r=="U"}static isValidPrefix(t){return this.parsePrefix(t)!=-1}static parsePrefix(t){switch(t){case Nt.Seed:return Nt.Seed;case Nt.Private:return Nt.Private;case Nt.Operator:return Nt.Operator;case Nt.Server:return Nt.Server;case Nt.Cluster:return Nt.Cluster;case Nt.Account:return Nt.Account;case Nt.User:return Nt.User;default:return-1}}}class Un{static encode(t,r){if(!r||!(r instanceof Uint8Array))throw new Tt(St.SerializationError);if(!ha.isValidPrefix(t))throw new Tt(St.InvalidPrefixByte);return Un._encode(!1,t,r)}static encodeSeed(t,r){if(!r)throw new Tt(St.ApiError);if(!ha.isValidPublicPrefix(t))throw new Tt(St.InvalidPrefixByte);if(r.byteLength!==32)throw new Tt(St.InvalidSeedLen);return Un._encode(!0,t,r)}static decode(t,r){if(!ha.isValidPrefix(t))throw new Tt(St.InvalidPrefixByte);const s=Un._decode(r);if(s[0]!==t)throw new Tt(St.InvalidPrefixByte);return s.slice(1)}static decodeSeed(t){const r=Un._decode(t),s=Un._decodePrefix(r);if(s[0]!=Nt.Seed)throw new Tt(St.InvalidSeed);if(!ha.isValidPublicPrefix(s[1]))throw new Tt(St.InvalidPrefixByte);return{buf:r.slice(2),prefix:s[1]}}static _encode(t,r,s){const l=t?2:1,o=s.byteLength,c=l+o+2,f=l+o,d=new Uint8Array(c);if(t){const g=Un._encodePrefix(Nt.Seed,r);d.set(g)}else d[0]=r;d.set(s,l);const m=zu.checksum(d.slice(0,f));return new DataView(d.buffer).setUint16(f,m,!0),M0.encode(d)}static _decode(t){if(t.byteLength<4)throw new Tt(St.InvalidEncoding);let r;try{r=M0.decode(t)}catch(f){throw new Tt(St.InvalidEncoding,f)}const s=r.byteLength-2,o=new DataView(r.buffer).getUint16(s,!0),c=r.slice(0,s);if(!zu.validate(c,o))throw new Tt(St.InvalidChecksum);return c}static _encodePrefix(t,r){const s=t|r>>5,l=(r&31)<<3;return new Uint8Array([s,l])}static _decodePrefix(t){const r=t[0]&248,s=(t[0]&7)<<5|(t[1]&248)>>3;return new Uint8Array([r,s])}}class kx{constructor(t){C(this,"seed");this.seed=t}getRawSeed(){if(!this.seed)throw new Tt(St.ClearedPair);return Un.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Tt(St.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Tt(St.ClearedPair);const t=Un.decodeSeed(this.seed),r=Yi().fromSeed(this.getRawSeed()),s=Un.encode(t.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new Tt(St.ClearedPair);const t=Yi().fromSeed(this.getRawSeed());return Un.encode(Nt.Private,t.secretKey)}sign(t){if(!this.seed)throw new Tt(St.ClearedPair);const r=Yi().fromSeed(this.getRawSeed());return Yi().sign(t,r.secretKey)}verify(t,r){if(!this.seed)throw new Tt(St.ClearedPair);const s=Yi().fromSeed(this.getRawSeed());return Yi().verify(t,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Qu(e){const t=Yi().randomBytes(32);let r=Un.encodeSeed(e,new Uint8Array(t));return new kx(r)}class nk{constructor(t){C(this,"publicKey");this.publicKey=t}getPublicKey(){if(!this.publicKey)throw new Tt(St.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Tt(St.PublicKeyOnly):new Tt(St.ClearedPair)}getSeed(){throw this.publicKey?new Tt(St.PublicKeyOnly):new Tt(St.ClearedPair)}sign(t){throw this.publicKey?new Tt(St.CannotSign):new Tt(St.ClearedPair)}verify(t,r){if(!this.publicKey)throw new Tt(St.ClearedPair);let s=Un._decode(this.publicKey);return Yi().verify(t,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function rk(e){const t=new TextEncoder().encode(e),r=Un._decode(t),s=ha.parsePrefix(r[0]);if(ha.isValidPublicPrefix(s))return new nk(t);throw new Tt(St.InvalidPublicKey)}function ik(e){return Un.decodeSeed(e),new kx(e)}function sk(e){return btoa(String.fromCharCode(...e))}function ak(e){const t=atob(e),r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}Q2(K2);const D0={createAccount:ek,createOperator:W2,createPair:Qu,createUser:tk,fromPublic:rk,fromSeed:ik,NKeysError:Tt,NKeysErrorCode:St,Prefix:Nt,decode:ak,encode:sk};function lk(e){return t=>{let r={};return e.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function ok(){return()=>{}}function uk(e,t){return()=>{const r=typeof e=="function"?e():e,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function ck(e){return()=>({auth_token:typeof e=="function"?e():e})}function fk(e){return t=>{const r=typeof e=="function"?e():e,s=r?D0.fromSeed(r):void 0,l=s?s.getPublicKey():"",o=Wi.encode(t||""),c=s!==void 0&&t?s.sign(o):void 0,f=c?D0.encode(c):"";return{nkey:l,sig:f}}}function Ex(e,t){return r=>{const s=typeof e=="function"?e():e,l=fk(t),{nkey:o,sig:c}=l(r);return{jwt:s,nkey:o,sig:c}}}const Cx=120*1e3,hk=2,Ax=2*1e3;function dk(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Cx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Ax,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function mk(e){const t=[];return typeof e.authenticator=="function"&&t.push(e.authenticator),Array.isArray(e.authenticator)&&t.push(...e.authenticator),e.token&&t.push(ck(e.token)),e.user&&t.push(uk(e.user,e.pass)),t.length===0?ok():lk(t)}function pk(e){const t=`${td}:${vx()}`;if(e=e||{servers:[t]},e.servers=e.servers||[],typeof e.servers=="string"&&(e.servers=[e.servers]),e.servers.length>0&&e.port)throw new De("port and servers options are mutually exclusive",Ce.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${td}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[t]);const r=Ju(dk(),e);if(r.authenticator=mk(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new De(`${s} option should be a function`,Ce.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let s=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return s&&(s++,s=Math.floor(Math.random()*s)),r.reconnectTimeWait+s}),r.inboxPrefix)try{gi(r.inboxPrefix)}catch(s){throw new De(s.message,Ce.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof od()=="function"),r.resolve&&typeof od()!="function")throw new De("'resolve' is not supported on this client",Ce.InvalidOption);return r}function gk(e,t){const{proto:r,tls_required:s,tls_available:l}=e;if((r===void 0||r<1)&&t.noEcho)throw new De("noEcho",Ce.ServerOptionNotAvailable);const o=s||l||!1;if(t.tls&&!o)throw new De("tls",Ce.ServerOptionNotAvailable)}const yk=1024*32,bk=/^INFO\s+([^\r\n]+)\r\n/i,xk=Tl(`PONG\r
|
|
70
|
+
${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(s),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||De.errorForCode(Ce.Cancelled))}}const _2="$JS.API";function k2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Ju({apiPrefix:_2,timeout:5e3},e)}class Jl{constructor(t,r){C(this,"nc");C(this,"opts");C(this,"prefix");C(this,"timeout");C(this,"jc");this.nc=t,this.opts=k2(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Dr()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,r=null,s){s=s||{},s.timeout=this.timeout;let l=cr;r&&(l=this.jc.encode(r));let{retries:o}=s;o=o||1,o=o===-1?Number.MAX_SAFE_INTEGER:o;const c=zd();for(let f=0;f<o;f++)try{const d=await this.nc.request(t,l,s);return this.parseJsResponse(d)}catch(d){const m=d;if((m.code==="503"||m.code===Ce.Timeout)&&f+1<o)await ja(c.backoff(f));else throw d}}async findStream(t){const r={subject:t},l=await this._request(`${this.prefix}.STREAM.NAMES`,r);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(t){const r=this.jc.decode(t.data),s=r;if(s.error){const l=yx(s.error.code,s.error.description);if(l!==null)throw l.api_error=s.error,l}return r}}class Nl{constructor(t,r,s,l){C(this,"err");C(this,"offset");C(this,"pageInfo");C(this,"subject");C(this,"jsm");C(this,"filter");C(this,"payload");if(!t)throw new Error("subject is required");this.subject=t,this.jsm=s,this.offset=0,this.pageInfo={},this.filter=r,this.payload=l||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const t={offset:this.offset};this.payload&&Object.assign(t,this.payload);try{const r=await this.jsm._request(this.subject,t,{timeout:this.jsm.timeout});this.pageInfo=r;const s=this.countResponse(r);return s===0?[]:(this.offset+=s,this.filter(r))}catch(r){throw this.err=r,r}}countResponse(t){var r,s,l;switch(t==null?void 0:t.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((r=t.streams)==null?void 0:r.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((s=t.consumers)==null?void 0:s.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((l=t.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const r of t)yield r;t=await this.next()}}}function ws(e=""){const t=e.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${e}' is not a semver value`)}function ld(e,t){return e.major<t.major?-1:e.major>t.major?1:e.minor<t.minor?-1:e.minor>t.minor?1:e.micro<t.micro?-1:e.micro>t.micro?1:0}var gt;(function(e){e.JS_KV="js_kv",e.JS_OBJECTSTORE="js_objectstore",e.JS_PULL_MAX_BYTES="js_pull_max_bytes",e.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",e.JS_ALLOW_DIRECT="js_allow_direct",e.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",e.JS_SIMPLIFICATION="js_simplification",e.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",e.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",e.JS_STREAM_FIRST_SEQ="js_stream_first_seq",e.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",e.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",e.JS_STREAM_COMPRESSION="js_stream_compression",e.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",e.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(gt||(gt={}));class E2{constructor(t){C(this,"server");C(this,"features");C(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=ws(t)),this.server=t,this.set(gt.JS_KV,"2.6.2"),this.set(gt.JS_OBJECTSTORE,"2.6.3"),this.set(gt.JS_PULL_MAX_BYTES,"2.8.3"),this.set(gt.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(gt.JS_ALLOW_DIRECT,"2.9.0"),this.set(gt.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(gt.JS_SIMPLIFICATION,"2.9.4"),this.set(gt.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(gt.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(gt.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(gt.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(gt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(gt.JS_STREAM_COMPRESSION,"2.10.0"),this.set(gt.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(gt.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(r=>{this.features.delete(r)})}set(t,r){this.features.set(t,{min:r,ok:ld(this.server,ws(r))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var r;return((r=this.get(t))==null?void 0:r.ok)||!1}require(t){return typeof t=="string"&&(t=ws(t)),ld(this.server,t)>=0}}class Du extends Jl{constructor(t,r){super(t,r)}async add(t,r,s=Mu.Create){if(Ln(t),r.deliver_group&&r.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(r.deliver_group&&r.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=r,l.stream_name=t,l.action=s,l.config.durable_name&&ma(l.config.durable_name);const o=this.nc;let{min:c,ok:f}=o.features.get(gt.JS_NEW_CONSUMER_CREATE_API);const d=r.name===""?void 0:r.name;if(d&&!f)throw new Error(`consumer 'name' requires server ${c}`);if(d)try{Xu("name",d)}catch(x){const v=x.message,S=v.indexOf("cannot contain");throw S!==-1?new Error(`consumer 'name' ${v.substring(S)}`):x}let m,b="";if(Array.isArray(r.filter_subjects)){const{min:x,ok:v}=o.features.get(gt.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);f=!1}if(r.metadata){const{min:x,ok:v}=o.features.get(gt.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(f&&(b=r.name??r.durable_name??""),b!==""){let x=r.filter_subject??void 0;x===">"&&(x=void 0),m=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${b}.${x}`:`${this.prefix}.CONSUMER.CREATE.${t}.${b}`}else m=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(m,l)}async update(t,r,s){const l=await this.info(t,r),o=s;return this.add(t,Object.assign(l.config,o),Mu.Update)}async info(t,r){return Ln(t),ma(r),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${r}`)}async delete(t,r){return Ln(t),ma(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${r}`)).success}list(t){Ln(t);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${t}`;return new Nl(s,r,this)}pause(t,r,s){const l=`${this.prefix}.CONSUMER.PAUSE.${t}.${r}`,o={pause_until:s.toISOString()};return this._request(l,o)}resume(t,r){return this.pause(t,r,new Date(0))}}function aa(e,t,r=!1){if(r===!0&&!e)throw De.errorForCode(Ce.ApiError,new Error(`${t} is not a function`));if(e&&typeof e!="function")throw De.errorForCode(Ce.ApiError,new Error(`${t} is not a function`))}class C2 extends wn{constructor(r,s,l){super();C(this,"sub");C(this,"adapter");C(this,"subIterDone");aa(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&aa(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(aa(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(aa(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(aa(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&aa(l.cleanupFn,"cleanupFn");let o=(b,g)=>{this.callback(b,g)};if(l.callback){const b=l.callback;o=(g,x)=>{const[v,S]=this.adapter(g,x);if(v){b(v,null);return}const{ingest:j}=this.ingestionFilterFn?this.ingestionFilterFn(S,this):{ingest:!0};j&&(!this.protocolFilterFn||this.protocolFilterFn(S))&&(b(v,S),this.dispatchedFn&&S&&this.dispatchedFn(S))}}const{max:c,queue:f,timeout:d}=l,m={queue:f,timeout:d,callback:o};c&&c>0&&(m.max=c),this.sub=r.subscribe(s,m),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=Jt(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async b=>{await b.closed,this.stop()})(this.sub).then().catch()}unsubscribe(r){this.sub.unsubscribe(r)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(r,s){this.sub.cancelTimeout();const[l,o]=this.adapter(r,s);l&&this.stop(l),o&&this.push(o)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let or;function A2(e){or=e}function vx(){return or!==void 0&&or.defaultPort!==void 0?or.defaultPort:4222}function _h(){return or!==void 0&&or.urlParseFn?or.urlParseFn:void 0}function j2(){if(!or||typeof or.factory!="function")throw new Error("transport fn is not set");return or.factory()}function od(){return or!==void 0&&or.dnsResolveFn?or.dnsResolveFn:void 0}const ku=`\r
|
|
71
|
+
`,Lu=Sa.fromAscii(ku),N2=new Uint8Array(Lu)[0],T2=new Uint8Array(Lu)[1];function O2(e){for(let t=0;t<e.length;t++){const r=t+1;if(e.byteLength>r&&e[t]===N2&&e[r]===T2)return r+1}return 0}function R2(e){const t=O2(e);if(t>0){const s=new Uint8Array(e).slice(0,t);return lr.decode(s)}return""}const M2=4,wx=48,D2=65,L2=97;function z2(e,t,r,s){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((c,f)=>{l[f]=c}),l[12]=e,l[13]=t,l[14]=r,l[15]=s,l}function ud(e){return U2(e)!==void 0}function U2(e){for(let t=0;t<e.length;t++)switch(e[t]){case".":return Sx(e);case":":return P2(e)}}function Sx(e){const t=new Uint8Array(4);for(let r=0;r<4;r++){if(e.length===0)return;if(r>0){if(e[0]!==".")return;e=e.substring(1)}const{n:s,c:l,ok:o}=B2(e);if(!o||s>255)return;e=e.substring(l),t[r]=s}return z2(t[0],t[1],t[2],t[3])}function P2(e){const t=new Uint8Array(16);let r=-1;if(e.length>=2&&e[0]===":"&&e[1]===":"&&(r=0,e=e.substring(2),e.length===0))return t;let s=0;for(;s<16;){const{n:l,c:o,ok:c}=H2(e);if(!c||l>65535)return;if(o<e.length&&e[o]==="."){if(r<0&&s!=12||s+4>16)return;const f=Sx(e);if(f===void 0)return;t[s]=f[12],t[s+1]=f[13],t[s+2]=f[14],t[s+3]=f[15],e="",s+=M2;break}if(t[s]=l>>8,t[s+1]=l,s+=2,e=e.substring(o),e.length===0)break;if(e[0]!==":"||e.length==1)return;if(e=e.substring(1),e[0]===":"){if(r>=0)return;if(r=s,e=e.substring(1),e.length===0)break}}if(e.length===0){if(s<16){if(r<0)return;const l=16-s;for(let o=s-1;o>=r;o--)t[o+l]=t[o];for(let o=r+l-1;o>=r;o--)t[o]=0}else if(r>=0)return;return t}}function B2(e){let t=0,r=0;for(t=0;t<e.length&&48<=e.charCodeAt(t)&&e.charCodeAt(t)<=57;t++)if(r=r*10+(e.charCodeAt(t)-wx),r>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:r,c:t,ok:!0}}function H2(e){let t=0,r=0;for(r=0;r<e.length;r++){if(48<=e.charCodeAt(r)&&e.charCodeAt(r)<=57)t*=16,t+=e.charCodeAt(r)-wx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)t*=16,t+=e.charCodeAt(r)-L2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)t*=16,t+=e.charCodeAt(r)-D2+10;else break;if(t>=16777215)return{n:0,c:r,ok:!1}}return r===0?{n:0,c:r,ok:!1}:{n:t,c:r,ok:!0}}function q2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function cd(e){return!q2(e)}function I2(e){const t="::FFFF:",r=e.toUpperCase().indexOf(t);if(r!==-1&&e.indexOf(".")!==-1){let s=e.substring(r+t.length);return s=s.replace("[",""),s.replace("]","")}return e}function F2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=I2(e),cd(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const t=cd(e)?e.match(/(]:)(\d+)/):e.match(/(:)(\d+)/),r=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,s=r===80?"https":"http",l=new URL(`${s}://${e}`);l.port=`${r}`;let o=l.hostname;return o.charAt(0)==="["&&(o=o.substring(1,o.length-1)),{listen:l.host,hostname:o,port:r}}class Rl{constructor(t,r=!1){C(this,"src");C(this,"listen");C(this,"hostname");C(this,"port");C(this,"didConnect");C(this,"reconnects");C(this,"lastConnect");C(this,"gossiped");C(this,"tlsName");C(this,"resolves");this.src=t,this.tlsName="";const s=F2(t);this.listen=s.listen,this.hostname=s.hostname,this.port=s.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=r}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const r=[];if(ud(this.hostname))return[this];{const s=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${s.join(",")}`);for(const l of s){const o=this.port===80?"https":"http",c=new URL(`${o}://${cd(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new Rl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return t.randomize&&px(r),this.resolves=r,r}}class $2{constructor(t=[],r={}){C(this,"firstSelect");C(this,"servers");C(this,"currentServer");C(this,"tlsName");C(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const s=_h();t&&(t.forEach(l=>{l=s?s(l):l,this.servers.push(new Rl(l))}),this.randomize&&(this.servers=px(this.servers))),this.servers.length===0&&this.addServer(`${td}:${vx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();ud(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,r=!1){const s=_h();t=s?s(t):t;const l=new Rl(t,r);ud(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const r=this.servers.indexOf(t);this.servers.splice(r,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(t,r){const s=[];let l=[];const o=_h(),c=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(d=>{d=o?o(d,r):d;const m=new Rl(d,!0);c.set(d,m)});const f=[];return this.servers.forEach((d,m)=>{const b=d.listen;d.gossiped&&this.currentServer.listen!==b&&c.get(b)===void 0&&f.push(m),c.delete(b)}),f.reverse(),f.forEach(d=>{const m=this.servers.splice(d,1);l=l.concat(m[0].listen)}),c.forEach((d,m)=>{this.servers.push(d),s.push(m)}),{added:s,deleted:l}}}class V2{constructor(){C(this,"baseInbox");C(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${gi(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const r=t.subject||"";return r.indexOf(this.baseInbox)===0?r.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,r){if(r&&r.permissionContext){if(t)return this.all().forEach(l=>{l.resolver(r,{})}),!0;const s=r.permissionContext;if(s.operation==="publish"){const l=this.all().find(o=>o.requestSubject===s.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(t,r)=>{const s=this.getToken(r);if(s){const l=this.get(s);l&&(t===null&&r.headers&&(t=gx(r)),l.resolver(t,r))}}}close(){const t=De.errorForCode(Ce.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class Y2{constructor(t,r,s){C(this,"ph");C(this,"interval");C(this,"maxOut");C(this,"timer");C(this,"pendings");this.ph=t,this.interval=r,this.maxOut=s,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:da.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=Jt();this.ph.flush(t).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(t),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(t=>(t.resolve(),!1))}}class G2 extends Error{constructor(t){super(t),this.name="AssertionError"}}function J2(e,t="Assertion failed."){if(!e)throw new G2(t)}const T0=32*1024,kh=2**32-2;function hu(e,t,r=0){const s=t.byteLength-r;return e.byteLength>s&&(e=e.subarray(0,s)),t.set(e,r),e.byteLength}class Eh{constructor(t){C(this,"_buf");C(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const r=this._buf.byteLength;return t<=this.capacity-r?(this._reslice(r+t),r):-1}_reslice(t){J2(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const r=hu(this._buf.subarray(this._off),t);return this._off+=r,r}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(Wi.encode(t))}write(t){const r=this._grow(t.byteLength);return hu(t,this._buf,r)}_grow(t){const r=this.length;r===0&&this._off!==0&&this.reset();const s=this._tryGrowByReslice(t);if(s>=0)return s;const l=this.capacity;if(t<=Math.floor(l/2)-r)hu(this._buf.subarray(this._off),this._buf);else{if(l+t>kh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const o=new Uint8Array(Math.min(2*l+t,kh));hu(this._buf.subarray(this._off),o),this._buf=o}}return this._off=0,this._reslice(Math.min(r+t,kh)),r}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const r=this._grow(t);this._reslice(r)}readFrom(t){let r=0;const s=new Uint8Array(T0);for(;;){const l=this.capacity-this.length<T0,o=l?s:new Uint8Array(this._buf.buffer,this.length),c=t.read(o);if(c===null)return r;l?this.write(o.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var zn;(function(e){e[e.OK=0]="OK",e[e.ERR=1]="ERR",e[e.MSG=2]="MSG",e[e.INFO=3]="INFO",e[e.PING=4]="PING",e[e.PONG=5]="PONG"})(zn||(zn={}));function O0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const X2=48;class R0{constructor(t){C(this,"dispatcher");C(this,"state");C(this,"as");C(this,"drop");C(this,"hdr");C(this,"ma");C(this,"argBuf");C(this,"msgBuf");this.dispatcher=t,this.state=Te.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let r;for(r=0;r<t.length;r++){const s=t[r];switch(this.state){case Te.OP_START:switch(s){case Oe.M:case Oe.m:this.state=Te.OP_M,this.hdr=-1,this.ma=O0();break;case Oe.H:case Oe.h:this.state=Te.OP_H,this.hdr=0,this.ma=O0();break;case Oe.P:case Oe.p:this.state=Te.OP_P;break;case Oe.PLUS:this.state=Te.OP_PLUS;break;case Oe.MINUS:this.state=Te.OP_MINUS;break;case Oe.I:case Oe.i:this.state=Te.OP_I;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_H:switch(s){case Oe.M:case Oe.m:this.state=Te.OP_M;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_M:switch(s){case Oe.S:case Oe.s:this.state=Te.OP_MS;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MS:switch(s){case Oe.G:case Oe.g:this.state=Te.OP_MSG;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MSG:switch(s){case Oe.SPACE:case Oe.TAB:this.state=Te.OP_MSG_SPC;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MSG_SPC:switch(s){case Oe.SPACE:case Oe.TAB:continue;default:this.state=Te.MSG_ARG,this.as=r}break;case Te.MSG_ARG:switch(s){case Oe.CR:this.drop=1;break;case Oe.NL:{const l=this.argBuf?this.argBuf.bytes():t.subarray(this.as,r-this.drop);this.processMsgArgs(l),this.drop=0,this.as=r+1,this.state=Te.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case Te.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:zn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Te.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const o=t.length-r;o<l&&(l=o),l>0?(this.msgBuf.write(t.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(s)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:zn.MSG,msg:this.ma,data:t.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Te.MSG_END);break;case Te.MSG_END:switch(s){case Oe.NL:this.drop=0,this.as=r+1,this.state=Te.OP_START;break;default:continue}break;case Te.OP_PLUS:switch(s){case Oe.O:case Oe.o:this.state=Te.OP_PLUS_O;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PLUS_O:switch(s){case Oe.K:case Oe.k:this.state=Te.OP_PLUS_OK;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PLUS_OK:switch(s){case Oe.NL:this.dispatcher.push({kind:zn.OK}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_MINUS:switch(s){case Oe.E:case Oe.e:this.state=Te.OP_MINUS_E;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_E:switch(s){case Oe.R:case Oe.r:this.state=Te.OP_MINUS_ER;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_ER:switch(s){case Oe.R:case Oe.r:this.state=Te.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_ERR:switch(s){case Oe.SPACE:case Oe.TAB:this.state=Te.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_ERR_SPC:switch(s){case Oe.SPACE:case Oe.TAB:continue;default:this.state=Te.MINUS_ERR_ARG,this.as=r}break;case Te.MINUS_ERR_ARG:switch(s){case Oe.CR:this.drop=1;break;case Oe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:zn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=Te.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case Te.OP_P:switch(s){case Oe.I:case Oe.i:this.state=Te.OP_PI;break;case Oe.O:case Oe.o:this.state=Te.OP_PO;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PO:switch(s){case Oe.N:case Oe.n:this.state=Te.OP_PON;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PON:switch(s){case Oe.G:case Oe.g:this.state=Te.OP_PONG;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PONG:switch(s){case Oe.NL:this.dispatcher.push({kind:zn.PONG}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_PI:switch(s){case Oe.N:case Oe.n:this.state=Te.OP_PIN;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PIN:switch(s){case Oe.G:case Oe.g:this.state=Te.OP_PING;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PING:switch(s){case Oe.NL:this.dispatcher.push({kind:zn.PING}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_I:switch(s){case Oe.N:case Oe.n:this.state=Te.OP_IN;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_IN:switch(s){case Oe.F:case Oe.f:this.state=Te.OP_INF;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_INF:switch(s){case Oe.O:case Oe.o:this.state=Te.OP_INFO;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_INFO:switch(s){case Oe.SPACE:case Oe.TAB:this.state=Te.OP_INFO_SPC;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_INFO_SPC:switch(s){case Oe.SPACE:case Oe.TAB:continue;default:this.state=Te.INFO_ARG,this.as=r}break;case Te.INFO_ARG:switch(s){case Oe.CR:this.drop=1;break;case Oe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:zn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=Te.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(t.subarray(r))}}(this.state===Te.MSG_ARG||this.state===Te.MINUS_ERR_ARG||this.state===Te.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Eh(t.subarray(this.as,r-this.drop))),this.state===Te.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Eh(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,s=new Uint8Array(t+r);s.set(this.ma.subject),this.ma.reply&&s.set(this.ma.reply,t),this.argBuf=new Eh(s),this.ma.subject=s.subarray(0,t),this.ma.reply&&(this.ma.reply=s.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case Oe.SPACE:case Oe.TAB:case Oe.CR:case Oe.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[3]);break;default:throw this.fail(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${lr.decode(t)}`)}processHeaderMsgArgs(t){const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case Oe.SPACE:case Oe.TAB:case Oe.CR:case Oe.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[4]);break;default:throw this.fail(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let r=0;for(let s=0;s<t.length;s++){if(t[s]<48||t[s]>57)return-1;r=r*10+(t[s]-X2)}return r}}var Te;(function(e){e[e.OP_START=0]="OP_START",e[e.OP_PLUS=1]="OP_PLUS",e[e.OP_PLUS_O=2]="OP_PLUS_O",e[e.OP_PLUS_OK=3]="OP_PLUS_OK",e[e.OP_MINUS=4]="OP_MINUS",e[e.OP_MINUS_E=5]="OP_MINUS_E",e[e.OP_MINUS_ER=6]="OP_MINUS_ER",e[e.OP_MINUS_ERR=7]="OP_MINUS_ERR",e[e.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",e[e.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",e[e.OP_M=10]="OP_M",e[e.OP_MS=11]="OP_MS",e[e.OP_MSG=12]="OP_MSG",e[e.OP_MSG_SPC=13]="OP_MSG_SPC",e[e.MSG_ARG=14]="MSG_ARG",e[e.MSG_PAYLOAD=15]="MSG_PAYLOAD",e[e.MSG_END=16]="MSG_END",e[e.OP_H=17]="OP_H",e[e.OP_P=18]="OP_P",e[e.OP_PI=19]="OP_PI",e[e.OP_PIN=20]="OP_PIN",e[e.OP_PING=21]="OP_PING",e[e.OP_PO=22]="OP_PO",e[e.OP_PON=23]="OP_PON",e[e.OP_PONG=24]="OP_PONG",e[e.OP_I=25]="OP_I",e[e.OP_IN=26]="OP_IN",e[e.OP_INF=27]="OP_INF",e[e.OP_INFO=28]="OP_INFO",e[e.OP_INFO_SPC=29]="OP_INFO_SPC",e[e.INFO_ARG=30]="INFO_ARG"})(Te||(Te={}));var Oe;(function(e){e[e.CR=13]="CR",e[e.E=69]="E",e[e.e=101]="e",e[e.F=70]="F",e[e.f=102]="f",e[e.G=71]="G",e[e.g=103]="g",e[e.H=72]="H",e[e.h=104]="h",e[e.I=73]="I",e[e.i=105]="i",e[e.K=75]="K",e[e.k=107]="k",e[e.M=77]="M",e[e.m=109]="m",e[e.MINUS=45]="MINUS",e[e.N=78]="N",e[e.n=110]="n",e[e.NL=10]="NL",e[e.O=79]="O",e[e.o=111]="o",e[e.P=80]="P",e[e.p=112]="p",e[e.PLUS=43]="PLUS",e[e.R=82]="R",e[e.r=114]="r",e[e.S=83]="S",e[e.s=115]="s",e[e.SPACE=32]="SPACE",e[e.TAB=9]="TAB"})(Oe||(Oe={}));(function(e){var t=function(k,D){this.hi=k|0,this.lo=D|0},r=function(k){var D,O=new Float64Array(16);if(k)for(D=0;D<k.length;D++)O[D]=k[D];return O},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var c=r(),f=r([1]),d=r([56129,1]),m=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),b=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function S(k,D){return k<<D|k>>>32-D}function j(k,D){var O=k[D+3]&255;return O=O<<8|k[D+2]&255,O=O<<8|k[D+1]&255,O<<8|k[D+0]&255}function R(k,D){var O=k[D]<<24|k[D+1]<<16|k[D+2]<<8|k[D+3],U=k[D+4]<<24|k[D+5]<<16|k[D+6]<<8|k[D+7];return new t(O,U)}function M(k,D,O){var U;for(U=0;U<4;U++)k[D+U]=O&255,O>>>=8}function P(k,D,O){k[D]=O.hi>>24&255,k[D+1]=O.hi>>16&255,k[D+2]=O.hi>>8&255,k[D+3]=O.hi&255,k[D+4]=O.lo>>24&255,k[D+5]=O.lo>>16&255,k[D+6]=O.lo>>8&255,k[D+7]=O.lo&255}function I(k,D,O,U,F){var Z,ge=0;for(Z=0;Z<F;Z++)ge|=k[D+Z]^O[U+Z];return(1&ge-1>>>8)-1}function ue(k,D,O,U){return I(k,D,O,U,16)}function q(k,D,O,U){return I(k,D,O,U,32)}function N(k,D,O,U,F){var Z=new Uint32Array(16),ge=new Uint32Array(16),be=new Uint32Array(16),se=new Uint32Array(4),pe,Le,it;for(pe=0;pe<4;pe++)ge[5*pe]=j(U,4*pe),ge[1+pe]=j(O,4*pe),ge[6+pe]=j(D,4*pe),ge[11+pe]=j(O,16+4*pe);for(pe=0;pe<16;pe++)be[pe]=ge[pe];for(pe=0;pe<20;pe++){for(Le=0;Le<4;Le++){for(it=0;it<4;it++)se[it]=ge[(5*Le+4*it)%16];for(se[1]^=S(se[0]+se[3]|0,7),se[2]^=S(se[1]+se[0]|0,9),se[3]^=S(se[2]+se[1]|0,13),se[0]^=S(se[3]+se[2]|0,18),it=0;it<4;it++)Z[4*Le+(Le+it)%4]=se[it]}for(it=0;it<16;it++)ge[it]=Z[it]}if(F){for(pe=0;pe<16;pe++)ge[pe]=ge[pe]+be[pe]|0;for(pe=0;pe<4;pe++)ge[5*pe]=ge[5*pe]-j(U,4*pe)|0,ge[6+pe]=ge[6+pe]-j(D,4*pe)|0;for(pe=0;pe<4;pe++)M(k,4*pe,ge[5*pe]),M(k,16+4*pe,ge[6+pe])}else for(pe=0;pe<16;pe++)M(k,4*pe,ge[pe]+be[pe]|0)}function ee(k,D,O,U){return N(k,D,O,U,!1),0}function G(k,D,O,U){return N(k,D,O,U,!0),0}var B=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function L(k,D,O,U,F,Z,ge){var be=new Uint8Array(16),se=new Uint8Array(64),pe,Le;if(!F)return 0;for(Le=0;Le<16;Le++)be[Le]=0;for(Le=0;Le<8;Le++)be[Le]=Z[Le];for(;F>=64;){for(ee(se,be,ge,B),Le=0;Le<64;Le++)k[D+Le]=(O?O[U+Le]:0)^se[Le];for(pe=1,Le=8;Le<16;Le++)pe=pe+(be[Le]&255)|0,be[Le]=pe&255,pe>>>=8;F-=64,D+=64,O&&(U+=64)}if(F>0)for(ee(se,be,ge,B),Le=0;Le<F;Le++)k[D+Le]=(O?O[U+Le]:0)^se[Le];return 0}function J(k,D,O,U,F){return L(k,D,null,0,O,U,F)}function $(k,D,O,U,F){var Z=new Uint8Array(32);return G(Z,U,F,B),J(k,D,O,U.subarray(16),Z)}function he(k,D,O,U,F,Z,ge){var be=new Uint8Array(32);return G(be,Z,ge,B),L(k,D,O,U,F,Z.subarray(16),be)}function le(k,D){var O,U=0;for(O=0;O<17;O++)U=U+(k[O]+D[O]|0)|0,k[O]=U&255,U>>>=8}var te=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function V(k,D,O,U,F,Z){var ge,be,se,pe,Le=new Uint32Array(17),it=new Uint32Array(17),Ht=new Uint32Array(17),Nn=new Uint32Array(17),Ar=new Uint32Array(17);for(se=0;se<17;se++)it[se]=Ht[se]=0;for(se=0;se<16;se++)it[se]=Z[se];for(it[3]&=15,it[4]&=252,it[7]&=15,it[8]&=252,it[11]&=15,it[12]&=252,it[15]&=15;F>0;){for(se=0;se<17;se++)Nn[se]=0;for(se=0;se<16&&se<F;++se)Nn[se]=O[U+se];for(Nn[se]=1,U+=se,F-=se,le(Ht,Nn),be=0;be<17;be++)for(Le[be]=0,se=0;se<17;se++)Le[be]=Le[be]+Ht[se]*(se<=be?it[be-se]:320*it[be+17-se]|0)|0|0;for(be=0;be<17;be++)Ht[be]=Le[be];for(pe=0,se=0;se<16;se++)pe=pe+Ht[se]|0,Ht[se]=pe&255,pe>>>=8;for(pe=pe+Ht[16]|0,Ht[16]=pe&3,pe=5*(pe>>>2)|0,se=0;se<16;se++)pe=pe+Ht[se]|0,Ht[se]=pe&255,pe>>>=8;pe=pe+Ht[16]|0,Ht[16]=pe}for(se=0;se<17;se++)Ar[se]=Ht[se];for(le(Ht,te),ge=-(Ht[16]>>>7)|0,se=0;se<17;se++)Ht[se]^=ge&(Ar[se]^Ht[se]);for(se=0;se<16;se++)Nn[se]=Z[se+16];for(Nn[16]=0,le(Ht,Nn),se=0;se<16;se++)k[D+se]=Ht[se];return 0}function Q(k,D,O,U,F,Z){var ge=new Uint8Array(16);return V(ge,0,O,U,F,Z),ue(k,D,ge,0)}function X(k,D,O,U,F){var Z;if(O<32)return-1;for(he(k,0,D,0,O,U,F),V(k,16,k,32,O-32,k),Z=0;Z<16;Z++)k[Z]=0;return 0}function xe(k,D,O,U,F){var Z,ge=new Uint8Array(32);if(O<32||($(ge,0,32,U,F),Q(D,16,D,32,O-32,ge)!==0))return-1;for(he(k,0,D,0,O,U,F),Z=0;Z<32;Z++)k[Z]=0;return 0}function A(k,D){var O;for(O=0;O<16;O++)k[O]=D[O]|0}function z(k){var D,O;for(O=0;O<16;O++)k[O]+=65536,D=Math.floor(k[O]/65536),k[(O+1)*(O<15?1:0)]+=D-1+37*(D-1)*(O===15?1:0),k[O]-=D*65536}function W(k,D,O){for(var U,F=~(O-1),Z=0;Z<16;Z++)U=F&(k[Z]^D[Z]),k[Z]^=U,D[Z]^=U}function T(k,D){var O,U,F,Z=r(),ge=r();for(O=0;O<16;O++)ge[O]=D[O];for(z(ge),z(ge),z(ge),U=0;U<2;U++){for(Z[0]=ge[0]-65517,O=1;O<15;O++)Z[O]=ge[O]-65535-(Z[O-1]>>16&1),Z[O-1]&=65535;Z[15]=ge[15]-32767-(Z[14]>>16&1),F=Z[15]>>16&1,Z[14]&=65535,W(ge,Z,1-F)}for(O=0;O<16;O++)k[2*O]=ge[O]&255,k[2*O+1]=ge[O]>>8}function ve(k,D){var O=new Uint8Array(32),U=new Uint8Array(32);return T(O,k),T(U,D),q(O,0,U,0)}function je(k){var D=new Uint8Array(32);return T(D,k),D[0]&1}function Ne(k,D){var O;for(O=0;O<16;O++)k[O]=D[2*O]+(D[2*O+1]<<8);k[15]&=32767}function ce(k,D,O){var U;for(U=0;U<16;U++)k[U]=D[U]+O[U]|0}function Ae(k,D,O){var U;for(U=0;U<16;U++)k[U]=D[U]-O[U]|0}function ke(k,D,O){var U,F,Z=new Float64Array(31);for(U=0;U<31;U++)Z[U]=0;for(U=0;U<16;U++)for(F=0;F<16;F++)Z[U+F]+=D[U]*O[F];for(U=0;U<15;U++)Z[U]+=38*Z[U+16];for(U=0;U<16;U++)k[U]=Z[U];z(k),z(k)}function Qe(k,D){ke(k,D,D)}function Lt(k,D){var O=r(),U;for(U=0;U<16;U++)O[U]=D[U];for(U=253;U>=0;U--)Qe(O,O),U!==2&&U!==4&&ke(O,O,D);for(U=0;U<16;U++)k[U]=O[U]}function dn(k,D){var O=r(),U;for(U=0;U<16;U++)O[U]=D[U];for(U=250;U>=0;U--)Qe(O,O),U!==1&&ke(O,O,D);for(U=0;U<16;U++)k[U]=O[U]}function tn(k,D,O){var U=new Uint8Array(32),F=new Float64Array(80),Z,ge,be=r(),se=r(),pe=r(),Le=r(),it=r(),Ht=r();for(ge=0;ge<31;ge++)U[ge]=D[ge];for(U[31]=D[31]&127|64,U[0]&=248,Ne(F,O),ge=0;ge<16;ge++)se[ge]=F[ge],Le[ge]=be[ge]=pe[ge]=0;for(be[0]=Le[0]=1,ge=254;ge>=0;--ge)Z=U[ge>>>3]>>>(ge&7)&1,W(be,se,Z),W(pe,Le,Z),ce(it,be,pe),Ae(be,be,pe),ce(pe,se,Le),Ae(se,se,Le),Qe(Le,it),Qe(Ht,be),ke(be,pe,be),ke(pe,se,it),ce(it,be,pe),Ae(be,be,pe),Qe(se,be),Ae(pe,Le,Ht),ke(be,pe,d),ce(be,be,Le),ke(pe,pe,be),ke(be,Le,Ht),ke(Le,se,F),Qe(se,it),W(be,se,Z),W(pe,Le,Z);for(ge=0;ge<16;ge++)F[ge+16]=be[ge],F[ge+32]=pe[ge],F[ge+48]=se[ge],F[ge+64]=Le[ge];var Nn=F.subarray(32),Ar=F.subarray(16);return Lt(Nn,Nn),ke(Ar,Ar,Nn),T(k,Ar),0}function Ft(k,D){return tn(k,D,o)}function $t(k,D){return s(D,32),Ft(k,D)}function an(k,D,O){var U=new Uint8Array(32);return tn(U,O,D),G(k,l,U,B)}var bn=X,Be=xe;function nt(k,D,O,U,F,Z){var ge=new Uint8Array(32);return an(ge,F,Z),bn(k,D,O,U,ge)}function st(k,D,O,U,F,Z){var ge=new Uint8Array(32);return an(ge,F,Z),Be(k,D,O,U,ge)}function Ot(){var k=0,D=0,O=0,U=0,F=65535,Z,ge,be;for(be=0;be<arguments.length;be++)Z=arguments[be].lo,ge=arguments[be].hi,k+=Z&F,D+=Z>>>16,O+=ge&F,U+=ge>>>16;return D+=k>>>16,O+=D>>>16,U+=O>>>16,new t(O&F|U<<16,k&F|D<<16)}function _t(k,D){return new t(k.hi>>>D,k.lo>>>D|k.hi<<32-D)}function mn(){var k=0,D=0,O;for(O=0;O<arguments.length;O++)k^=arguments[O].lo,D^=arguments[O].hi;return new t(D,k)}function at(k,D){var O,U,F=32-D;return D<32?(O=k.hi>>>D|k.lo<<F,U=k.lo>>>D|k.hi<<F):D<64&&(O=k.lo>>>D|k.hi<<F,U=k.hi>>>D|k.lo<<F),new t(O,U)}function Cr(k,D,O){var U=k.hi&D.hi^~k.hi&O.hi,F=k.lo&D.lo^~k.lo&O.lo;return new t(U,F)}function ae(k,D,O){var U=k.hi&D.hi^k.hi&O.hi^D.hi&O.hi,F=k.lo&D.lo^k.lo&O.lo^D.lo&O.lo;return new t(U,F)}function _e(k){return mn(at(k,28),at(k,34),at(k,39))}function Me(k){return mn(at(k,14),at(k,18),at(k,41))}function Ge(k){return mn(at(k,1),at(k,8),_t(k,7))}function rt(k){return mn(at(k,19),at(k,61),_t(k,6))}var zt=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function Sn(k,D,O){var U=[],F=[],Z=[],ge=[],be,se,pe;for(se=0;se<8;se++)U[se]=Z[se]=R(k,8*se);for(var Le=0;O>=128;){for(se=0;se<16;se++)ge[se]=R(D,8*se+Le);for(se=0;se<80;se++){for(pe=0;pe<8;pe++)F[pe]=Z[pe];for(be=Ot(Z[7],Me(Z[4]),Cr(Z[4],Z[5],Z[6]),zt[se],ge[se%16]),F[7]=Ot(be,_e(Z[0]),ae(Z[0],Z[1],Z[2])),F[3]=Ot(F[3],be),pe=0;pe<8;pe++)Z[(pe+1)%8]=F[pe];if(se%16===15)for(pe=0;pe<16;pe++)ge[pe]=Ot(ge[pe],ge[(pe+9)%16],Ge(ge[(pe+1)%16]),rt(ge[(pe+14)%16]))}for(se=0;se<8;se++)Z[se]=Ot(Z[se],U[se]),U[se]=Z[se];Le+=128,O-=128}for(se=0;se<8;se++)P(k,8*se,U[se]);return O}var Kt=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function yt(k,D,O){var U=new Uint8Array(64),F=new Uint8Array(256),Z,ge=O;for(Z=0;Z<64;Z++)U[Z]=Kt[Z];for(Sn(U,D,O),O%=128,Z=0;Z<256;Z++)F[Z]=0;for(Z=0;Z<O;Z++)F[Z]=D[ge-O+Z];for(F[O]=128,O=256-128*(O<112?1:0),F[O-9]=0,P(F,O-8,new t(ge/536870912|0,ge<<3)),Sn(U,F,O),Z=0;Z<64;Z++)k[Z]=U[Z];return 0}function Vt(k,D){var O=r(),U=r(),F=r(),Z=r(),ge=r(),be=r(),se=r(),pe=r(),Le=r();Ae(O,k[1],k[0]),Ae(Le,D[1],D[0]),ke(O,O,Le),ce(U,k[0],k[1]),ce(Le,D[0],D[1]),ke(U,U,Le),ke(F,k[3],D[3]),ke(F,F,b),ke(Z,k[2],D[2]),ce(Z,Z,Z),Ae(ge,U,O),Ae(be,Z,F),ce(se,Z,F),ce(pe,U,O),ke(k[0],ge,be),ke(k[1],pe,se),ke(k[2],se,be),ke(k[3],ge,pe)}function Ze(k,D,O){var U;for(U=0;U<4;U++)W(k[U],D[U],O)}function An(k,D){var O=r(),U=r(),F=r();Lt(F,D[2]),ke(O,D[0],F),ke(U,D[1],F),T(k,U),k[31]^=je(O)<<7}function pn(k,D,O){var U,F;for(A(k[0],c),A(k[1],f),A(k[2],f),A(k[3],c),F=255;F>=0;--F)U=O[F/8|0]>>(F&7)&1,Ze(k,D,U),Vt(D,k),Vt(k,k),Ze(k,D,U)}function Kn(k,D){var O=[r(),r(),r(),r()];A(O[0],g),A(O[1],x),A(O[2],f),ke(O[3],g,x),pn(k,O,D)}function we(k,D,O){var U=new Uint8Array(64),F=[r(),r(),r(),r()],Z;for(O||s(D,32),yt(U,D,32),U[0]&=248,U[31]&=127,U[31]|=64,Kn(F,U),An(k,F),Z=0;Z<32;Z++)D[Z+32]=k[Z];return 0}var Ye=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Re(k,D){var O,U,F,Z;for(U=63;U>=32;--U){for(O=0,F=U-32,Z=U-12;F<Z;++F)D[F]+=O-16*D[U]*Ye[F-(U-32)],O=Math.floor((D[F]+128)/256),D[F]-=O*256;D[F]+=O,D[U]=0}for(O=0,F=0;F<32;F++)D[F]+=O-(D[31]>>4)*Ye[F],O=D[F]>>8,D[F]&=255;for(F=0;F<32;F++)D[F]-=O*Ye[F];for(U=0;U<32;U++)D[U+1]+=D[U]>>8,k[U]=D[U]&255}function bt(k){var D=new Float64Array(64),O;for(O=0;O<64;O++)D[O]=k[O];for(O=0;O<64;O++)k[O]=0;Re(k,D)}function ln(k,D,O,U){var F=new Uint8Array(64),Z=new Uint8Array(64),ge=new Uint8Array(64),be,se,pe=new Float64Array(64),Le=[r(),r(),r(),r()];yt(F,U,32),F[0]&=248,F[31]&=127,F[31]|=64;var it=O+64;for(be=0;be<O;be++)k[64+be]=D[be];for(be=0;be<32;be++)k[32+be]=F[32+be];for(yt(ge,k.subarray(32),O+32),bt(ge),Kn(Le,ge),An(k,Le),be=32;be<64;be++)k[be]=U[be];for(yt(Z,k,O+64),bt(Z),be=0;be<64;be++)pe[be]=0;for(be=0;be<32;be++)pe[be]=ge[be];for(be=0;be<32;be++)for(se=0;se<32;se++)pe[be+se]+=Z[be]*F[se];return Re(k.subarray(32),pe),it}function Hn(k,D){var O=r(),U=r(),F=r(),Z=r(),ge=r(),be=r(),se=r();return A(k[2],f),Ne(k[1],D),Qe(F,k[1]),ke(Z,F,m),Ae(F,F,k[2]),ce(Z,k[2],Z),Qe(ge,Z),Qe(be,ge),ke(se,be,ge),ke(O,se,F),ke(O,O,Z),dn(O,O),ke(O,O,F),ke(O,O,Z),ke(O,O,Z),ke(k[0],O,Z),Qe(U,k[0]),ke(U,U,Z),ve(U,F)&&ke(k[0],k[0],v),Qe(U,k[0]),ke(U,U,Z),ve(U,F)?-1:(je(k[0])===D[31]>>7&&Ae(k[0],c,k[0]),ke(k[3],k[0],k[1]),0)}function ts(k,D,O,U){var F,Z=new Uint8Array(32),ge=new Uint8Array(64),be=[r(),r(),r(),r()],se=[r(),r(),r(),r()];if(O<64||Hn(se,U))return-1;for(F=0;F<O;F++)k[F]=D[F];for(F=0;F<32;F++)k[F+32]=U[F];if(yt(ge,k,O),bt(ge),pn(be,se,ge),Kn(se,D.subarray(32)),Vt(be,se),An(Z,be),O-=64,q(D,0,Z,0)){for(F=0;F<O;F++)k[F]=0;return-1}for(F=0;F<O;F++)k[F]=D[F+64];return O}var de=32,Ee=24,He=32,Ve=16,qe=32,ct=32,Xe=32,Pe=32,We=32,Zt=Ee,Qt=He,Rt=Ve,ft=64,Bt=32,jn=64,Pr=32,wi=64;e.lowlevel={crypto_core_hsalsa20:G,crypto_stream_xor:he,crypto_stream:$,crypto_stream_salsa20_xor:L,crypto_stream_salsa20:J,crypto_onetimeauth:V,crypto_onetimeauth_verify:Q,crypto_verify_16:ue,crypto_verify_32:q,crypto_secretbox:X,crypto_secretbox_open:xe,crypto_scalarmult:tn,crypto_scalarmult_base:Ft,crypto_box_beforenm:an,crypto_box_afternm:bn,crypto_box:nt,crypto_box_open:st,crypto_box_keypair:$t,crypto_hash:yt,crypto_sign:ln,crypto_sign_keypair:we,crypto_sign_open:ts,crypto_secretbox_KEYBYTES:de,crypto_secretbox_NONCEBYTES:Ee,crypto_secretbox_ZEROBYTES:He,crypto_secretbox_BOXZEROBYTES:Ve,crypto_scalarmult_BYTES:qe,crypto_scalarmult_SCALARBYTES:ct,crypto_box_PUBLICKEYBYTES:Xe,crypto_box_SECRETKEYBYTES:Pe,crypto_box_BEFORENMBYTES:We,crypto_box_NONCEBYTES:Zt,crypto_box_ZEROBYTES:Qt,crypto_box_BOXZEROBYTES:Rt,crypto_sign_BYTES:ft,crypto_sign_PUBLICKEYBYTES:Bt,crypto_sign_SECRETKEYBYTES:jn,crypto_sign_SEEDBYTES:Pr,crypto_hash_BYTES:wi,gf:r,D:m,L:Ye,pack25519:T,unpack25519:Ne,M:ke,A:ce,S:Qe,Z:Ae,pow2523:dn,add:Vt,set25519:A,modL:Re,scalarmult:pn,scalarbase:Kn};function Ut(k,D){if(k.length!==de)throw new Error("bad key size");if(D.length!==Ee)throw new Error("bad nonce size")}function ns(k,D){if(k.length!==Xe)throw new Error("bad public key size");if(D.length!==Pe)throw new Error("bad secret key size")}function gn(){for(var k=0;k<arguments.length;k++)if(!(arguments[k]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Cs(k){for(var D=0;D<k.length;D++)k[D]=0}e.randomBytes=function(k){var D=new Uint8Array(k);return s(D,k),D},e.secretbox=function(k,D,O){gn(k,D,O),Ut(O,D);for(var U=new Uint8Array(He+k.length),F=new Uint8Array(U.length),Z=0;Z<k.length;Z++)U[Z+He]=k[Z];return X(F,U,U.length,D,O),F.subarray(Ve)},e.secretbox.open=function(k,D,O){gn(k,D,O),Ut(O,D);for(var U=new Uint8Array(Ve+k.length),F=new Uint8Array(U.length),Z=0;Z<k.length;Z++)U[Z+Ve]=k[Z];return U.length<32||xe(F,U,U.length,D,O)!==0?null:F.subarray(He)},e.secretbox.keyLength=de,e.secretbox.nonceLength=Ee,e.secretbox.overheadLength=Ve,e.scalarMult=function(k,D){if(gn(k,D),k.length!==ct)throw new Error("bad n size");if(D.length!==qe)throw new Error("bad p size");var O=new Uint8Array(qe);return tn(O,k,D),O},e.scalarMult.base=function(k){if(gn(k),k.length!==ct)throw new Error("bad n size");var D=new Uint8Array(qe);return Ft(D,k),D},e.scalarMult.scalarLength=ct,e.scalarMult.groupElementLength=qe,e.box=function(k,D,O,U){var F=e.box.before(O,U);return e.secretbox(k,D,F)},e.box.before=function(k,D){gn(k,D),ns(k,D);var O=new Uint8Array(We);return an(O,k,D),O},e.box.after=e.secretbox,e.box.open=function(k,D,O,U){var F=e.box.before(O,U);return e.secretbox.open(k,D,F)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var k=new Uint8Array(Xe),D=new Uint8Array(Pe);return $t(k,D),{publicKey:k,secretKey:D}},e.box.keyPair.fromSecretKey=function(k){if(gn(k),k.length!==Pe)throw new Error("bad secret key size");var D=new Uint8Array(Xe);return Ft(D,k),{publicKey:D,secretKey:new Uint8Array(k)}},e.box.publicKeyLength=Xe,e.box.secretKeyLength=Pe,e.box.sharedKeyLength=We,e.box.nonceLength=Zt,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(k,D){if(gn(k,D),D.length!==jn)throw new Error("bad secret key size");var O=new Uint8Array(ft+k.length);return ln(O,k,k.length,D),O},e.sign.open=function(k,D){if(gn(k,D),D.length!==Bt)throw new Error("bad public key size");var O=new Uint8Array(k.length),U=ts(O,k,k.length,D);if(U<0)return null;for(var F=new Uint8Array(U),Z=0;Z<F.length;Z++)F[Z]=O[Z];return F},e.sign.detached=function(k,D){for(var O=e.sign(k,D),U=new Uint8Array(ft),F=0;F<U.length;F++)U[F]=O[F];return U},e.sign.detached.verify=function(k,D,O){if(gn(k,D,O),D.length!==ft)throw new Error("bad signature size");if(O.length!==Bt)throw new Error("bad public key size");var U=new Uint8Array(ft+k.length),F=new Uint8Array(ft+k.length),Z;for(Z=0;Z<ft;Z++)U[Z]=D[Z];for(Z=0;Z<k.length;Z++)U[Z+ft]=k[Z];return ts(F,U,U.length,O)>=0},e.sign.keyPair=function(){var k=new Uint8Array(Bt),D=new Uint8Array(jn);return we(k,D),{publicKey:k,secretKey:D}},e.sign.keyPair.fromSecretKey=function(k){if(gn(k),k.length!==jn)throw new Error("bad secret key size");for(var D=new Uint8Array(Bt),O=0;O<D.length;O++)D[O]=k[32+O];return{publicKey:D,secretKey:new Uint8Array(k)}},e.sign.keyPair.fromSeed=function(k){if(gn(k),k.length!==Pr)throw new Error("bad seed size");for(var D=new Uint8Array(Bt),O=new Uint8Array(jn),U=0;U<32;U++)O[U]=k[U];return we(D,O,!0),{publicKey:D,secretKey:O}},e.sign.publicKeyLength=Bt,e.sign.secretKeyLength=jn,e.sign.seedLength=Pr,e.sign.signatureLength=ft,e.hash=function(k){gn(k);var D=new Uint8Array(wi);return yt(D,k,k.length),D},e.hash.hashLength=wi,e.verify=function(k,D){return gn(k,D),k.length===0||D.length===0||k.length!==D.length?!1:I(k,0,D,0,k.length)===0},e.setPRNG=function(k){s=k},(function(){var k=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(k&&k.getRandomValues){var D=65536;e.setPRNG(function(O,U){var F,Z=new Uint8Array(U);for(F=0;F<U;F+=D)k.getRandomValues(Z.subarray(F,F+Math.min(U-F,D)));for(F=0;F<U;F++)O[F]=Z[F];Cs(Z)})}else typeof require<"u"&&(k=require("crypto"),k&&k.randomBytes&&e.setPRNG(function(O,U){var F,Z=k.randomBytes(U);for(F=0;F<U;F++)O[F]=Z[F];Cs(Z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const du=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,K2={fromSeed:du.sign.keyPair.fromSeed,sign:du.sign.detached,verify:du.sign.detached.verify,randomBytes:du.randomBytes};let _x;function Q2(e){_x=e}function Yi(){return _x}const Z2=new Uint16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);class zu{static checksum(t){let r=0;for(let s=0;s<t.byteLength;s++){let l=t[s];r=r<<8&65535^Z2[(r>>8^l)&255]}return r}static validate(t,r){return zu.checksum(t)==r}}const Ch="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class M0{static encode(t){let r=0,s=0,l=new Uint8Array(t),o=new Uint8Array(t.byteLength*2),c=0;for(let f=0;f<l.byteLength;f++)for(s=s<<8|l[f],r+=8;r>=5;){let d=s>>>r-5&31;o[c++]=Ch.charAt(d).charCodeAt(0),r-=5}if(r>0){let f=s<<5-r&31;o[c++]=Ch.charAt(f).charCodeAt(0)}return o.slice(0,c)}static decode(t){let r=0,s=0,l=0,o=new Uint8Array(t),c=new Uint8Array(o.byteLength*5/8|0);for(let f=0;f<o.byteLength;f++){let d=String.fromCharCode(o[f]),m=Ch.indexOf(d);if(m===-1)throw new Error("Illegal Base32 character: "+o[f]);s=s<<5|m,r+=5,r>=8&&(c[l++]=s>>>r-8&255,r-=8)}return c.slice(0,l)}}class Tt extends Error{constructor(r,s){super(r);C(this,"name");C(this,"code");C(this,"chainedError");this.name="NKeysError",this.code=r,this.chainedError=s}}function W2(){return Qu(Nt.Operator)}function ek(){return Qu(Nt.Account)}function tk(){return Qu(Nt.User)}var St;(function(e){e.InvalidPrefixByte="nkeys: invalid prefix byte",e.InvalidKey="nkeys: invalid key",e.InvalidPublicKey="nkeys: invalid public key",e.InvalidSeedLen="nkeys: invalid seed length",e.InvalidSeed="nkeys: invalid seed",e.InvalidEncoding="nkeys: invalid encoded key",e.InvalidSignature="nkeys: signature verification failed",e.CannotSign="nkeys: cannot sign, no private key available",e.PublicKeyOnly="nkeys: no seed or private key available",e.InvalidChecksum="nkeys: invalid checksum",e.SerializationError="nkeys: serialization error",e.ApiError="nkeys: api error",e.ClearedPair="nkeys: pair is cleared"})(St||(St={}));var Nt;(function(e){e[e.Seed=144]="Seed",e[e.Private=120]="Private",e[e.Operator=112]="Operator",e[e.Server=104]="Server",e[e.Cluster=16]="Cluster",e[e.Account=0]="Account",e[e.User=160]="User"})(Nt||(Nt={}));class ha{static isValidPublicPrefix(t){return t==Nt.Server||t==Nt.Operator||t==Nt.Cluster||t==Nt.Account||t==Nt.User}static startsWithValidPrefix(t){let r=t[0];return r=="S"||r=="P"||r=="O"||r=="N"||r=="C"||r=="A"||r=="U"}static isValidPrefix(t){return this.parsePrefix(t)!=-1}static parsePrefix(t){switch(t){case Nt.Seed:return Nt.Seed;case Nt.Private:return Nt.Private;case Nt.Operator:return Nt.Operator;case Nt.Server:return Nt.Server;case Nt.Cluster:return Nt.Cluster;case Nt.Account:return Nt.Account;case Nt.User:return Nt.User;default:return-1}}}class Un{static encode(t,r){if(!r||!(r instanceof Uint8Array))throw new Tt(St.SerializationError);if(!ha.isValidPrefix(t))throw new Tt(St.InvalidPrefixByte);return Un._encode(!1,t,r)}static encodeSeed(t,r){if(!r)throw new Tt(St.ApiError);if(!ha.isValidPublicPrefix(t))throw new Tt(St.InvalidPrefixByte);if(r.byteLength!==32)throw new Tt(St.InvalidSeedLen);return Un._encode(!0,t,r)}static decode(t,r){if(!ha.isValidPrefix(t))throw new Tt(St.InvalidPrefixByte);const s=Un._decode(r);if(s[0]!==t)throw new Tt(St.InvalidPrefixByte);return s.slice(1)}static decodeSeed(t){const r=Un._decode(t),s=Un._decodePrefix(r);if(s[0]!=Nt.Seed)throw new Tt(St.InvalidSeed);if(!ha.isValidPublicPrefix(s[1]))throw new Tt(St.InvalidPrefixByte);return{buf:r.slice(2),prefix:s[1]}}static _encode(t,r,s){const l=t?2:1,o=s.byteLength,c=l+o+2,f=l+o,d=new Uint8Array(c);if(t){const g=Un._encodePrefix(Nt.Seed,r);d.set(g)}else d[0]=r;d.set(s,l);const m=zu.checksum(d.slice(0,f));return new DataView(d.buffer).setUint16(f,m,!0),M0.encode(d)}static _decode(t){if(t.byteLength<4)throw new Tt(St.InvalidEncoding);let r;try{r=M0.decode(t)}catch(f){throw new Tt(St.InvalidEncoding,f)}const s=r.byteLength-2,o=new DataView(r.buffer).getUint16(s,!0),c=r.slice(0,s);if(!zu.validate(c,o))throw new Tt(St.InvalidChecksum);return c}static _encodePrefix(t,r){const s=t|r>>5,l=(r&31)<<3;return new Uint8Array([s,l])}static _decodePrefix(t){const r=t[0]&248,s=(t[0]&7)<<5|(t[1]&248)>>3;return new Uint8Array([r,s])}}class kx{constructor(t){C(this,"seed");this.seed=t}getRawSeed(){if(!this.seed)throw new Tt(St.ClearedPair);return Un.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Tt(St.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Tt(St.ClearedPair);const t=Un.decodeSeed(this.seed),r=Yi().fromSeed(this.getRawSeed()),s=Un.encode(t.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new Tt(St.ClearedPair);const t=Yi().fromSeed(this.getRawSeed());return Un.encode(Nt.Private,t.secretKey)}sign(t){if(!this.seed)throw new Tt(St.ClearedPair);const r=Yi().fromSeed(this.getRawSeed());return Yi().sign(t,r.secretKey)}verify(t,r){if(!this.seed)throw new Tt(St.ClearedPair);const s=Yi().fromSeed(this.getRawSeed());return Yi().verify(t,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Qu(e){const t=Yi().randomBytes(32);let r=Un.encodeSeed(e,new Uint8Array(t));return new kx(r)}class nk{constructor(t){C(this,"publicKey");this.publicKey=t}getPublicKey(){if(!this.publicKey)throw new Tt(St.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Tt(St.PublicKeyOnly):new Tt(St.ClearedPair)}getSeed(){throw this.publicKey?new Tt(St.PublicKeyOnly):new Tt(St.ClearedPair)}sign(t){throw this.publicKey?new Tt(St.CannotSign):new Tt(St.ClearedPair)}verify(t,r){if(!this.publicKey)throw new Tt(St.ClearedPair);let s=Un._decode(this.publicKey);return Yi().verify(t,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function rk(e){const t=new TextEncoder().encode(e),r=Un._decode(t),s=ha.parsePrefix(r[0]);if(ha.isValidPublicPrefix(s))return new nk(t);throw new Tt(St.InvalidPublicKey)}function ik(e){return Un.decodeSeed(e),new kx(e)}function sk(e){return btoa(String.fromCharCode(...e))}function ak(e){const t=atob(e),r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}Q2(K2);const D0={createAccount:ek,createOperator:W2,createPair:Qu,createUser:tk,fromPublic:rk,fromSeed:ik,NKeysError:Tt,NKeysErrorCode:St,Prefix:Nt,decode:ak,encode:sk};function lk(e){return t=>{let r={};return e.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function ok(){return()=>{}}function uk(e,t){return()=>{const r=typeof e=="function"?e():e,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function ck(e){return()=>({auth_token:typeof e=="function"?e():e})}function fk(e){return t=>{const r=typeof e=="function"?e():e,s=r?D0.fromSeed(r):void 0,l=s?s.getPublicKey():"",o=Wi.encode(t||""),c=s!==void 0&&t?s.sign(o):void 0,f=c?D0.encode(c):"";return{nkey:l,sig:f}}}function Ex(e,t){return r=>{const s=typeof e=="function"?e():e,l=fk(t),{nkey:o,sig:c}=l(r);return{jwt:s,nkey:o,sig:c}}}const Cx=120*1e3,hk=2,Ax=2*1e3;function dk(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Cx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Ax,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function mk(e){const t=[];return typeof e.authenticator=="function"&&t.push(e.authenticator),Array.isArray(e.authenticator)&&t.push(...e.authenticator),e.token&&t.push(ck(e.token)),e.user&&t.push(uk(e.user,e.pass)),t.length===0?ok():lk(t)}function pk(e){const t=`${td}:${vx()}`;if(e=e||{servers:[t]},e.servers=e.servers||[],typeof e.servers=="string"&&(e.servers=[e.servers]),e.servers.length>0&&e.port)throw new De("port and servers options are mutually exclusive",Ce.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${td}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[t]);const r=Ju(dk(),e);if(r.authenticator=mk(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new De(`${s} option should be a function`,Ce.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let s=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return s&&(s++,s=Math.floor(Math.random()*s)),r.reconnectTimeWait+s}),r.inboxPrefix)try{gi(r.inboxPrefix)}catch(s){throw new De(s.message,Ce.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof od()=="function"),r.resolve&&typeof od()!="function")throw new De("'resolve' is not supported on this client",Ce.InvalidOption);return r}function gk(e,t){const{proto:r,tls_required:s,tls_available:l}=e;if((r===void 0||r<1)&&t.noEcho)throw new De("noEcho",Ce.ServerOptionNotAvailable);const o=s||l||!1;if(t.tls&&!o)throw new De("tls",Ce.ServerOptionNotAvailable)}const yk=1024*32,bk=/^INFO\s+([^\r\n]+)\r\n/i,xk=Tl(`PONG\r
|
|
72
72
|
`),L0=Tl(`PING\r
|
|
73
|
-
`);class vk{constructor(t,r,s){C(this,"echo");C(this,"no_responders");C(this,"protocol");C(this,"verbose");C(this,"pedantic");C(this,"jwt");C(this,"nkey");C(this,"sig");C(this,"user");C(this,"pass");C(this,"auth_token");C(this,"tls_required");C(this,"name");C(this,"lang");C(this,"version");C(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=r.noEcho?!1:void 0,this.verbose=r.verbose,this.pedantic=r.pedantic,this.tls_required=r.tls?!0:void 0,this.name=r.name;const l=(r&&typeof r.authenticator=="function"?r.authenticator(s):{})||{};Ju(this,l)}}class jx extends vn{constructor(r,s,l={}){var c;super();C(this,"sid");C(this,"queue");C(this,"draining");C(this,"max");C(this,"subject");C(this,"drained");C(this,"protocol");C(this,"timer");C(this,"info");C(this,"cleanupFn");C(this,"closed");C(this,"requestSubject");Ju(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Vt();const o=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=va(l.timeout,o),this.timer.then(()=>{this.timer=void 0}).catch(f=>{this.stop(f),this.noIterator&&this.callback(f,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const s=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),o=r.protocolFilterFn?r.protocolFilterFn:()=>!0,c=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(f,d)=>{const{ingest:m}=l(d);m&&o(d)&&(s(f,d),c(d))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,s){this.cancelTimeout(),r?this.stop(r):this.push(s)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(De.errorForCode(Ce.ConnectionClosed)):this.isClosed()?Promise.reject(De.errorForCode(Ce.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Vt()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class wk{constructor(){C(this,"mux");C(this,"subs");C(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const r=t.permissionContext,s=this.all();let l;if(r.operation==="subscription"&&(l=s.find(o=>o.subject===r.subject&&o.queue===r.queue)),r.operation==="publish"&&(l=s.find(o=>o.requestSubject===r.subject)),l)return l.callback(t,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class Uu{constructor(t,r){C(this,"connected");C(this,"connectedOnce");C(this,"infoReceived");C(this,"info");C(this,"muxSubscriptions");C(this,"options");C(this,"outbound");C(this,"pongs");C(this,"subscriptions");C(this,"transport");C(this,"noMorePublishing");C(this,"connectError");C(this,"publisher");C(this,"_closed");C(this,"closed");C(this,"listeners");C(this,"heartbeats");C(this,"parser");C(this,"outMsgs");C(this,"inMsgs");C(this,"outBytes");C(this,"inBytes");C(this,"pendingLimit");C(this,"lastError");C(this,"abortReconnect");C(this,"whyClosed");C(this,"servers");C(this,"server");C(this,"features");C(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=yk,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new wk,this.muxSubscriptions=new V2,this.outbound=new Sa,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new E2({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new $2(s,{randomize:!t.noRandomize}),this.closed=Vt(),this.parser=new R0(this),this.heartbeats=new Y2(this,this.options.pingInterval||Cx,this.options.maxPingOut||hk)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const r=De.errorForCode(Ce.Disconnect);r.stack="",t.forEach(s=>{s.reject(r)}),this.parser=new R0(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(r=>{r.push(t)})}status(){const t=new vn;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=Vt();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=j2(),this.transport.closed().then(async r=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:da.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:da.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:di.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:di.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===Ce.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(t)}async dial(t){const r=this.prepare();let s;try{s=va(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,s]),(async()=>{try{for await(const o of this.transport)this.parser.parse(o)}catch(o){console.log("reader closed",o)}})().then()}catch(l){r.reject(l)}try{await Promise.race([s,r]),s&&s.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw s&&s.cancel(),await this.transport.close(l),l}}async _doDial(t){const{resolve:r}=this.options,s=await t.resolve({fn:od(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const o of s)try{l=null,this.dispatchStatus({type:da.Reconnecting,data:o.toString()}),await this.dial(o);return}catch(c){l=c}throw l}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let t;for(;;){this._closed&&this.servers.clear();const r=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Ax;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:De.errorForCode(Ce.ConnectionRefused));const o=Date.now();if(l.lastConnect===0||l.lastConnect+r<=o){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(c){if(t=c,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const f=this.options.maxReconnectAttempts||0;f!==-1&&l.reconnects>=f&&this.servers.removeCurrentServer()}}else s=Math.min(s,l.lastConnect+r-o),await ja(s)}}static async connect(t,r){const s=new Uu(t,r);return await s.dialLoop(),s}static toError(t){const r=t?t.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new De(t,Ce.PermissionsViolation),l=t.match(/(Publish|Subscription) to "(\S+)"/);if(l){s.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const o=t.match(/using queue "(\S+)"/);o&&(s.permissionContext.queue=o[1])}return s}else return r.indexOf("authorization violation")!==-1?new De(t,Ce.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new De(t,Ce.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new De(t,Ce.AccountExpired):r.indexOf("authentication timeout")!==-1?new De(t,Ce.AuthenticationTimeout):new De(t,Ce.ProtocolError)}processMsg(t,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const s=this.subscriptions.get(t.sid);s&&(s.received+=1,s.callback&&s.callback(null,new Pd(t,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(t){const r=y0(t),s=Uu.toError(r),l={type:di.Error,data:s.code};if(s.isPermissionError()){let o=!1;if(s.permissionContext){l.permissionContext=s.permissionContext;const c=this.subscriptions.getMux();o=(c==null?void 0:c.subject)===s.permissionContext.subject}this.subscriptions.handleError(s),this.muxSubscriptions.handleError(o,s),o&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(s)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(xk)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const r=JSON.parse(y0(t));this.info=r;const s=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(ws(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:o,lang:c}=this.transport;try{const f=new vk({version:o,lang:c},this.options,r.nonce);r.headers&&(f.headers=!0,f.no_responders=!0);const d=JSON.stringify(f);this.transport.send(Tl(`CONNECT ${d}${ku}`)),this.transport.send(L0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:di.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:di.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case zn.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case zn.OK:break;case zn.ERR:this.processError(t.data);break;case zn.PING:this.processPing();break;case zn.PONG:this.processPong();break;case zn.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=Tl(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=ur,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Wi.encode(r);else throw De.errorForCode(Ce.BadPayload);let o=l.length;s=s||{},s.reply=s.reply||"";let c=ur,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new De("headers",Ce.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,o=l.length+f}if(this.info&&o>this.info.max_payload)throw De.errorForCode(Ce.MaxPayloadExceeded);this.outBytes+=o,this.outMsgs++;let d;s.headers?(s.reply?d=`HPUB ${t} ${s.reply} ${f} ${o}\r
|
|
73
|
+
`);class vk{constructor(t,r,s){C(this,"echo");C(this,"no_responders");C(this,"protocol");C(this,"verbose");C(this,"pedantic");C(this,"jwt");C(this,"nkey");C(this,"sig");C(this,"user");C(this,"pass");C(this,"auth_token");C(this,"tls_required");C(this,"name");C(this,"lang");C(this,"version");C(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=r.noEcho?!1:void 0,this.verbose=r.verbose,this.pedantic=r.pedantic,this.tls_required=r.tls?!0:void 0,this.name=r.name;const l=(r&&typeof r.authenticator=="function"?r.authenticator(s):{})||{};Ju(this,l)}}class jx extends wn{constructor(r,s,l={}){var c;super();C(this,"sid");C(this,"queue");C(this,"draining");C(this,"max");C(this,"subject");C(this,"drained");C(this,"protocol");C(this,"timer");C(this,"info");C(this,"cleanupFn");C(this,"closed");C(this,"requestSubject");Ju(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Jt();const o=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=va(l.timeout,o),this.timer.then(()=>{this.timer=void 0}).catch(f=>{this.stop(f),this.noIterator&&this.callback(f,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const s=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),o=r.protocolFilterFn?r.protocolFilterFn:()=>!0,c=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(f,d)=>{const{ingest:m}=l(d);m&&o(d)&&(s(f,d),c(d))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,s){this.cancelTimeout(),r?this.stop(r):this.push(s)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(De.errorForCode(Ce.ConnectionClosed)):this.isClosed()?Promise.reject(De.errorForCode(Ce.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Jt()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class wk{constructor(){C(this,"mux");C(this,"subs");C(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const r=t.permissionContext,s=this.all();let l;if(r.operation==="subscription"&&(l=s.find(o=>o.subject===r.subject&&o.queue===r.queue)),r.operation==="publish"&&(l=s.find(o=>o.requestSubject===r.subject)),l)return l.callback(t,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class Uu{constructor(t,r){C(this,"connected");C(this,"connectedOnce");C(this,"infoReceived");C(this,"info");C(this,"muxSubscriptions");C(this,"options");C(this,"outbound");C(this,"pongs");C(this,"subscriptions");C(this,"transport");C(this,"noMorePublishing");C(this,"connectError");C(this,"publisher");C(this,"_closed");C(this,"closed");C(this,"listeners");C(this,"heartbeats");C(this,"parser");C(this,"outMsgs");C(this,"inMsgs");C(this,"outBytes");C(this,"inBytes");C(this,"pendingLimit");C(this,"lastError");C(this,"abortReconnect");C(this,"whyClosed");C(this,"servers");C(this,"server");C(this,"features");C(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=yk,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new wk,this.muxSubscriptions=new V2,this.outbound=new Sa,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new E2({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new $2(s,{randomize:!t.noRandomize}),this.closed=Jt(),this.parser=new R0(this),this.heartbeats=new Y2(this,this.options.pingInterval||Cx,this.options.maxPingOut||hk)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const r=De.errorForCode(Ce.Disconnect);r.stack="",t.forEach(s=>{s.reject(r)}),this.parser=new R0(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(r=>{r.push(t)})}status(){const t=new wn;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=Jt();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=j2(),this.transport.closed().then(async r=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:da.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:da.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:di.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:di.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===Ce.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(t)}async dial(t){const r=this.prepare();let s;try{s=va(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,s]),(async()=>{try{for await(const o of this.transport)this.parser.parse(o)}catch(o){console.log("reader closed",o)}})().then()}catch(l){r.reject(l)}try{await Promise.race([s,r]),s&&s.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw s&&s.cancel(),await this.transport.close(l),l}}async _doDial(t){const{resolve:r}=this.options,s=await t.resolve({fn:od(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const o of s)try{l=null,this.dispatchStatus({type:da.Reconnecting,data:o.toString()}),await this.dial(o);return}catch(c){l=c}throw l}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let t;for(;;){this._closed&&this.servers.clear();const r=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Ax;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:De.errorForCode(Ce.ConnectionRefused));const o=Date.now();if(l.lastConnect===0||l.lastConnect+r<=o){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(c){if(t=c,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const f=this.options.maxReconnectAttempts||0;f!==-1&&l.reconnects>=f&&this.servers.removeCurrentServer()}}else s=Math.min(s,l.lastConnect+r-o),await ja(s)}}static async connect(t,r){const s=new Uu(t,r);return await s.dialLoop(),s}static toError(t){const r=t?t.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new De(t,Ce.PermissionsViolation),l=t.match(/(Publish|Subscription) to "(\S+)"/);if(l){s.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const o=t.match(/using queue "(\S+)"/);o&&(s.permissionContext.queue=o[1])}return s}else return r.indexOf("authorization violation")!==-1?new De(t,Ce.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new De(t,Ce.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new De(t,Ce.AccountExpired):r.indexOf("authentication timeout")!==-1?new De(t,Ce.AuthenticationTimeout):new De(t,Ce.ProtocolError)}processMsg(t,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const s=this.subscriptions.get(t.sid);s&&(s.received+=1,s.callback&&s.callback(null,new Pd(t,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(t){const r=y0(t),s=Uu.toError(r),l={type:di.Error,data:s.code};if(s.isPermissionError()){let o=!1;if(s.permissionContext){l.permissionContext=s.permissionContext;const c=this.subscriptions.getMux();o=(c==null?void 0:c.subject)===s.permissionContext.subject}this.subscriptions.handleError(s),this.muxSubscriptions.handleError(o,s),o&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(s)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(xk)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const r=JSON.parse(y0(t));this.info=r;const s=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(ws(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:o,lang:c}=this.transport;try{const f=new vk({version:o,lang:c},this.options,r.nonce);r.headers&&(f.headers=!0,f.no_responders=!0);const d=JSON.stringify(f);this.transport.send(Tl(`CONNECT ${d}${ku}`)),this.transport.send(L0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:di.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:di.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case zn.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case zn.OK:break;case zn.ERR:this.processError(t.data);break;case zn.PING:this.processPing();break;case zn.PONG:this.processPong();break;case zn.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=Tl(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=cr,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Wi.encode(r);else throw De.errorForCode(Ce.BadPayload);let o=l.length;s=s||{},s.reply=s.reply||"";let c=cr,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new De("headers",Ce.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,o=l.length+f}if(this.info&&o>this.info.max_payload)throw De.errorForCode(Ce.MaxPayloadExceeded);this.outBytes+=o,this.outMsgs++;let d;s.headers?(s.reply?d=`HPUB ${t} ${s.reply} ${f} ${o}\r
|
|
74
74
|
`:d=`HPUB ${t} ${f} ${o}\r
|
|
75
75
|
`,this.sendCommand(d,c,l,Lu)):(s.reply?d=`PUB ${t} ${s.reply} ${o}\r
|
|
76
76
|
`:d=`PUB ${t} ${o}\r
|
|
@@ -78,33 +78,33 @@ ${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(s),this.cance
|
|
|
78
78
|
`):this.sendCommand(`SUB ${t.subject} ${t.sid}\r
|
|
79
79
|
`)}_subunsub(t){return this._sub(t),t.max&&this.unsubscribe(t,t.max),t}unsubscribe(t,r){this.unsub(t,r),(t.max===void 0||t.received>=t.max)&&this.subscriptions.cancel(t)}unsub(t,r){!t||this.isClosed()||(r?this.sendCommand(`UNSUB ${t.sid} ${r}\r
|
|
80
80
|
`):this.sendCommand(`UNSUB ${t.sid}\r
|
|
81
|
-
`),t.max=r)}resub(t,r){!t||this.isClosed()||(this.unsub(t),t.subject=r,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=Vt()),this.pongs.push(t),this.outbound.fill(L0),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(r=>{const s=r;s.queue?t.push(`SUB ${s.subject} ${s.queue} ${s.sid}${ku}`):t.push(`SUB ${s.subject} ${s.sid}${ku}`)}),t.length&&this.transport.send(Tl(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(r=>{r.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),r=[];return t.forEach(s=>{r.push(s.drain())}),Promise.all(r).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const r=this.muxSubscriptions.init(this.options.inboxPrefix),s=new jx(this,`${r}*`);s.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(s),this.subscribe(s)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const Sk="$SRV";class z0{constructor(t){C(this,"msg");this.msg=t}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(t,r){return this.msg.respond(t,r)}respondError(t,r,s,l){var o,c;return l=l||{},l.headers=l.headers||bi(),(o=l.headers)==null||o.set(Tu,`${t}`),(c=l.headers)==null||c.set(Nu,r),this.msg.respond(s,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class ql{constructor(t,r="",s=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&kk("service group",r);let l="";if(t instanceof Xl)this.srv=t,l="";else if(t instanceof ql){const o=t;this.srv=o.srv,s===""&&o.queue!==""&&(s=o.queue),l=o.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=s}calcSubject(t,r=""){return r===""?t:t!==""?`${t}.${r}`:r}addEndpoint(t="",r){r=r||{subject:t};const s=typeof r=="function"?{handler:r,subject:t}:r;jl("endpoint",t);let{subject:l,handler:o,metadata:c,queue:f}=s;l=l||t,f=f||this.queue,_k("endpoint subject",l),l=this.calcSubject(this.subject,l);const d={name:t,subject:l,queue:f,handler:o,metadata:c};return this.srv._addEndpoint(d)}addGroup(t="",r=""){return new ql(this,t,r)}}function _k(e,t){if(t==="")throw new Error(`${e} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${t}'`);const r=t.split(".");r.forEach((s,l)=>{if(s===">"&&l!==r.length-1)throw new Error(`${e} cannot have internal '>': '${t}'`)})}function kk(e,t){if(t.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${t}'`);t.split(".").forEach(s=>{if(s===">")throw new Error(`${e} name cannot contain internal '>': '${t}'`)})}class Xl{constructor(t,r={name:"",version:""}){C(this,"nc");C(this,"_id");C(this,"config");C(this,"handlers");C(this,"internal");C(this,"_stopped");C(this,"_done");C(this,"started");this.nc=t,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),jl("name",this.config.name),jl("queue",this.config.queue),ws(this.config.version),this._id=Ki.next(),this.internal=[],this._done=Vt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(s=>{this.close(s).catch()})}static controlSubject(t,r="",s="",l){const o=l??Sk;return r===""&&s===""?`${o}.${t}`:(jl("control subject name",r),s!==""?(jl("control subject id",s),`${o}.${t}.${r}.${s}`):`${o}.${t}.${r}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(t){const r=bi();if(t instanceof Ou){const s=t;r.set(Nu,s.message),r.set(Tu,`${s.code}`)}else r.set(Nu,t.message),r.set(Tu,"500");return r}setupHandler(t,r=!1){const s=r?"":t.queue?t.queue:this.config.queue,{name:l,subject:o,handler:c}=t,f=t;f.internal=r,r&&this.internal.push(f),f.stats=new Ek(l,o,s),f.queue=s;const d=c?(m,b)=>{if(m){this.close(m);return}const g=Date.now();try{c(m,new z0(b))}catch(x){f.stats.countError(x),b==null||b.respond(ur,{headers:this.errorToHeader(x)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(o,{callback:d,queue:s}),f.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(m=>{if(!this._stopped){const b=new Error(`required subscription ${t.subject} errored: ${m.message}`);b.stack=m.stack,this.close(b).catch()}}),f}info(){return{type:Ol.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:r,metadata:s,name:l,queue:o}=t;return{subject:r,metadata:s,name:l,queue_group:o}})}async stats(){const t=[];for(const r of this.handlers){if(typeof this.config.statsHandler=="function")try{r.stats.data=await this.config.statsHandler(r)}catch(s){r.stats.countError(s)}t.push(r.stats.stats(r.qi))}return{type:Ol.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,r){const s=`${t}`.toUpperCase();this._doAddInternalHandler(`${s}-all`,t,r),this._doAddInternalHandler(`${s}-kind`,t,r,this.name),this._doAddInternalHandler(`${s}`,t,r,this.name,this.id)}_doAddInternalHandler(t,r,s,l="",o=""){const c={};c.name=t,c.subject=Xl.controlSubject(r,l,o),c.handler=s,this.setupHandler(c,!0)}start(){const t=Mr(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(d=>(f==null||f.respond(t.encode(d)),Promise.resolve())),s=(c,f)=>c?(this.close(c),Promise.reject(c)):(f==null||f.respond(t.encode(this.info())),Promise.resolve()),l=t.encode(this.ping()),o=(c,f)=>c?(this.close(c).then().catch(),Promise.reject(c)):(f.respond(l),Promise.resolve());return this.addInternalHandler(Gi.PING,o),this.addInternalHandler(Gi.STATS,r),this.addInternalHandler(Gi.INFO,s),this.handlers.forEach(c=>{const{subject:f}=c;typeof f=="string"&&c.handler!==null&&this.setupHandler(c)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let r=[];return this.nc.isClosed()||(r=this.handlers.concat(this.internal).map(s=>s.sub.drain())),Promise.allSettled(r).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:Ol.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,r){return new ql(this,t,r)}addEndpoint(t,r){return new ql(this).addEndpoint(t,r)}_addEndpoint(t){const r=new vn;r.noIterator=typeof t.handler=="function",r.noIterator||(t.handler=(l,o)=>{l?this.stop(l).catch():r.push(new z0(o))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(t,!1);return s.qi=r,this.handlers.push(s),r}}class Ek{constructor(t,r,s=""){C(this,"name");C(this,"subject");C(this,"average_processing_time");C(this,"num_requests");C(this,"processing_time");C(this,"num_errors");C(this,"last_error");C(this,"data");C(this,"metadata");C(this,"queue");this.name=t,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=s}reset(t){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const r=t;r&&(r.time=0,r.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=$t(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:o,processing_time:c,last_error:f,data:d,queue:m}=this;return{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:o,processing_time:c,last_error:f,data:d,queue_group:m}}stats(t){const r=t;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=$t(r.time),this.num_requests=r.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class Ck{constructor(t,r={strategy:Rr.JitterTimer,maxWait:2e3},s){C(this,"nc");C(this,"prefix");C(this,"opts");this.nc=t,this.prefix=s,this.opts=r}ping(t="",r=""){return this.q(Gi.PING,t,r)}stats(t="",r=""){return this.q(Gi.STATS,t,r)}info(t="",r=""){return this.q(Gi.INFO,t,r)}async q(t,r="",s=""){const l=new vn,o=Mr(),c=Xl.controlSubject(t,r,s,this.prefix),f=await this.nc.requestMany(c,ur,this.opts);return(async()=>{for await(const d of f)try{const m=o.decode(d.data);l.push(m)}catch(m){l.push(()=>{l.stop(m)})}l.push(()=>{l.stop()})})().catch(d=>{l.stop(d)}),l}}function Nx(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function Ak(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Nx(),storage:sd.File}}const Pu="KV-Operation",U0="$KV",jk=/^[-/=.\w]+$/,Nk=/^[-/=.>*\w]+$/,Tk=/^[-\w]+$/;function Ok(e){if(e.startsWith(".")||e.endsWith(".")||!jk.test(e))throw new Error(`invalid key: ${e}`)}function Rk(e){if(e.startsWith(".")||e.endsWith(".")||!Nk.test(e))throw new Error(`invalid key: ${e}`)}function Mk(e){if(e.startsWith(".")||e.endsWith("."))throw new Error(`invalid key: ${e}`);const t=e.split(".");let r=!1;for(let s=0;s<t.length;s++)switch(t[s]){case"*":r=!0;break;case">":if(s!==t.length-1)throw new Error(`invalid key: ${e}`);r=!0;break}return r}function Eu(e){if(!Tk.test(e))throw new Error(`invalid bucket name: ${e}`)}var Fr;(function(e){e.MsgIdHdr="Nats-Msg-Id",e.ExpectedStreamHdr="Nats-Expected-Stream",e.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",e.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",e.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Fr||(Fr={}));class Il{constructor(t,r,s){C(this,"js");C(this,"jsm");C(this,"stream");C(this,"bucket");C(this,"direct");C(this,"codec");C(this,"prefix");C(this,"editPrefix");C(this,"useJsPrefix");C(this,"_prefixLen");C(this,"validateKey",Ok);C(this,"validateSearchKey",Rk);C(this,"hasWildcards",Mk);Eu(t),this.js=r,this.jsm=s,this.bucket=t,this.prefix=U0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,r,s={}){Eu(r);const l=await t.jetstreamManager(),o=new Il(r,t,l);return await o.init(s),o}static async bind(t,r,s={}){const l=await t.jetstreamManager(),o={config:{allow_direct:s.allow_direct}};Eu(r);const c=new Il(r,t,l);return o.config.name=s.streamName??c.bucketName(),Object.assign(c,o),c.stream=o.config.name,c.codec=s.codec||Nx(),c.direct=o.config.allow_direct??!1,c.initializePrefixes(o),c}async init(t={}){const r=Object.assign(Ak(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=id.Limits,s.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(s.max_bytes=r.max_bytes),s.max_msg_size=r.maxValueSize,s.storage=r.storage;const l=t.placementCluster??"";if(l&&(t.placement={},t.placement.cluster=l,t.placement.tags=[]),t.placement&&(s.placement=t.placement),t.republish&&(s.republish=t.republish),t.description&&(s.description=t.description),t.mirror){const g=Object.assign({},t.mirror);g.name.startsWith(sr)||(g.name=`${sr}${g.name}`),s.mirror=g,s.mirror_direct=!0}else if(t.sources){const g=t.sources.map(x=>{const v=Object.assign({},x),S=v.name.startsWith(sr)?v.name.substring(sr.length):v.name;return v.name.startsWith(sr)||(v.name=`${sr}${v.name}`),!x.external&&S!==this.bucket&&(v.subject_transforms=[{src:`$KV.${S}.>`,dest:`$KV.${this.bucket}.>`}]),v});s.sources=g,s.subjects=[this.subjectForBucket()]}else s.subjects=[this.subjectForBucket()];t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?Qi.S2:Qi.None);const o=this.js.nc,c=o.getServerVersion(),f=c?ld(c,ws("2.7.2"))>=0:!1;s.discard=f?Hl.New:Hl.Old;const{ok:d,min:m}=o.features.get(pt.JS_ALLOW_DIRECT);if(!d&&t.allow_direct===!0){const g=c?`${c.major}.${c.minor}.${c.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${g} - requires ${m}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:d,s.allow_direct=t.allow_direct,this.direct=s.allow_direct,s.num_replicas=r.replicas,r.ttl&&(s.max_age=$t(r.ttl)),s.allow_rollup_hdrs=!0;let b;try{b=await this.jsm.streams.info(s.name),!b.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(g){if(g.message==="stream not found")b=await this.jsm.streams.add(s);else throw g}this.initializePrefixes(b)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=t.config;if(r){let s=r.name;if(s.startsWith(sr)&&(s=s.substring(sr.length)),r.external&&r.external.api!==""){const l=r.name.substring(sr.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${sr}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,r=!1){const s=[];return r?(this.useJsPrefix&&s.push(this.js.apiPrefix),this.editPrefix!==""?s.push(this.editPrefix):s.push(this.prefix)):this.prefix&&s.push(this.prefix),s.push(t),s.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${U0}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.encode(s));break}return r.join(".")}decodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.decode(s));break}return r.join(".")}close(){return Promise.resolve()}dataLen(t,r){const s=r&&r.get(Bn.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new Jk(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new Xk(this.bucket,r,t)}async create(t,r){var o;let s;try{const c=await this.put(t,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(s=c,((o=c==null?void 0:c.api_error)==null?void 0:o.err_code)!==10071)return Promise.reject(c)}let l=0;try{const c=await this.get(t);return(c==null?void 0:c.operation)==="DEL"||(c==null?void 0:c.operation)==="PURGE"?(l=c!==null?c.revision:0,this.update(t,r,l)):Promise.reject(s)}catch(c){return Promise.reject(c)}}update(t,r,s){if(s<=0)throw new Error("version must be greater than 0");return this.put(t,r,{previousSeq:s})}async put(t,r,s={}){var c,f;const l=this.encodeKey(t);this.validateKey(l);const o={};if(s.previousSeq!==void 0){const d=bi();o.headers=d,d.set(Fr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,o)).seq}catch(d){const m=d;return m.isJetStreamError()?(m.message=(c=m.api_error)==null?void 0:c.description,m.code=`${(f=m.api_error)==null?void 0:f.code}`,Promise.reject(m)):Promise.reject(d)}}async get(t,r){const s=this.encodeKey(t);this.validateKey(s);let l={last_by_subj:this.subjectForKey(s)};r&&r.revision>0&&(l={seq:r.revision});let o;try{this.direct?o=await this.jsm.direct.getMessage(this.bucketName(),l):o=await this.jsm.streams.getMessage(this.bucketName(),l);const c=this.smToEntry(o);return c.key!==s?null:c}catch(c){if(c.code===Ce.JetStream404NoMessages)return null;throw c}}purge(t,r){return this._deleteOrPurge(t,"PURGE",r)}delete(t,r){return this._deleteOrPurge(t,"DEL",r)}async purgeDeletes(t=1800*1e3){const r=Vt(),s=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const d of l)(d.operation==="DEL"||d.operation==="PURGE")&&s.push(d)})().then(),await r,l.stop();const o=Date.now()-t,c=s.map(d=>{const m=this.subjectForKey(d.key);return d.created.getTime()>=o?this.jsm.streams.purge(this.stream,{filter:m,keep:1}):this.jsm.streams.purge(this.stream,{filter:m,keep:0})}),f=await Promise.all(c);return f.unshift({success:!0,purged:0}),f.reduce((d,m)=>(d.purged+=m.purged,d))}async _deleteOrPurge(t,r,s){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,r,s);const l=await this.keys(t),o=[];for await(const c of l)o.push(this._doDeleteOrPurge(c,r)),o.length===100&&(await Promise.all(o),o.length=0);o.length>0&&await Promise.all(o)}async _doDeleteOrPurge(t,r,s){const l=this.encodeKey(t);this.validateKey(l);const o=bi();o.set(Pu,r),r==="PURGE"&&o.set(Bn.RollupHdr,Bn.RollupValueSubject),s!=null&&s.previousSeq&&o.set(Fr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),ur,{headers:o})}_buildCC(t,r,s={}){let o=(Array.isArray(t)?t:[t]).map(d=>{const m=this.encodeKey(d);return this.validateSearchKey(d),this.fullKeyName(m)}),c=an.LastPerSubject;r===Tr.AllHistory&&(c=an.All),r===Tr.UpdatesOnly&&(c=an.New);let f;return o.length===1&&(f=o[0],o=void 0),Object.assign({deliver_policy:c,ack_policy:xn.None,filter_subjects:o,filter_subject:f,flow_control:!0,idle_heartbeat:$t(5*1e3)},s)}remove(t){return this.purge(t)}async history(t={}){const r=t.key??">",s=new vn,l={};l.headers_only=t.headers_only||!1;let o;o=()=>{s.stop()};let c=0;const f=this._buildCC(r,Tr.AllHistory,l),d=f.filter_subject,m=Xi(f);m.bindStream(this.stream),m.orderedConsumer(),m.callback((g,x)=>{if(g){s.stop(g);return}if(x){const v=this.jmToEntry(x);s.push(v),s.received++,(o&&c>0&&s.received>=c||x.info.pending===0)&&(s.push(o),o=void 0)}});const b=await this.js.subscribe(d,m);if(o){const{info:{last:g}}=b,x=g.num_pending+g.delivered.consumer_seq;if(x===0||s.received>=x)try{o()}catch(v){s.stop(v)}finally{o=void 0}else c=x}return s._data=b,s.iterClosed.then(()=>{b.unsubscribe()}),b.closed.then(()=>{s.stop()}).catch(g=>{s.stop(g)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(pt.JS_NEW_CONSUMER_CREATE_API);return s}async watch(t={}){const r=t.key??">",s=new vn,l={};l.headers_only=t.headers_only||!1;let o=Tr.LastValue;t.include===Tr.AllHistory?o=Tr.AllHistory:t.include===Tr.UpdatesOnly&&(o=Tr.UpdatesOnly);const c=t.ignoreDeletes===!0;let f=t.initializedFn,d=0;const m=this._buildCC(r,o,l),b=m.filter_subject,g=Xi(m);this.canSetWatcherName()&&g.consumerName(Ki.next()),g.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&g.startSequence(t.resumeFromRevision),g.orderedConsumer(),g.callback((v,S)=>{if(v){s.stop(v);return}if(S){const A=this.jmToEntry(S);if(c&&A.operation==="DEL")return;s.push(A),s.received++,f&&(d>0&&s.received>=d||S.info.pending===0)&&(s.push(f),f=void 0)}});const x=await this.js.subscribe(b,g);if(f){const{info:{last:v}}=x,S=v.num_pending+v.delivered.consumer_seq;if(S===0||s.received>=S)try{f()}catch(A){s.stop(A)}finally{f=void 0}else d=S}return s._data=x,s.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{s.stop()}).catch(v=>{s.stop(v)}),s}async keys(t=">"){const r=new vn,s=this._buildCC(t,Tr.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,o=Xi(s);o.bindStream(this.stream),o.orderedConsumer();const c=await this.js.subscribe(l,o);return(async()=>{var d;for await(const m of c){const b=(d=m.headers)==null?void 0:d.get(Pu);if(b!=="DEL"&&b!=="PURGE"){const g=this.decodeKey(m.subject.substring(this.prefixLen));r.push(g)}m.info.pending===0&&c.unsubscribe()}})().then(()=>{r.stop()}).catch(d=>{r.stop(d)}),c.info.last.num_pending===0&&c.unsubscribe(),r}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var o;const r=((o=this.js.nc.info)==null?void 0:o.cluster)??"",s=this.bucketName(),l=await this.jsm.streams.info(s);return new Tx(l,r)}}class Tx{constructor(t,r=""){C(this,"si");C(this,"cluster");this.si=t,this.cluster=r}get bucket(){return this.si.config.name.startsWith(sr)?this.si.config.name.substring(sr.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Ud(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var t;return((t=this.si.config.placement)==null?void 0:t.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Qi.None:!1}}const Hd="OBJ_",P0="SHA-256=";function Dk(e){return Eu(e),`${Hd}${e}`}function Lk(e){return e.startsWith(Hd)?e.substring(4):e}class fd{constructor(t){C(this,"si");C(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return Lk(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Qi.None:!1}}function mu(e){if(e===void 0)return;const{domain:t}=e;if(t===void 0)return e;const r=Object.assign({},e);if(delete r.domain,t==="")return r;if(r.external)throw new Error("domain and external are both set");return r.external={api:`$JS.${t}.API`},r}var wr;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(wr||(wr={}));var $r;(function(e){e.HeartbeatsMissed="heartbeats_missed",e.ConsumerNotFound="consumer_not_found",e.StreamNotFound="stream_not_found",e.ConsumerDeleted="consumer_deleted",e.OrderedConsumerRecreated="ordered_consumer_recreated",e.NoResponders="no_responders"})($r||($r={}));var ya;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(ya||(ya={}));const B0=Uint8Array.of(43,65,67,75),zk=Uint8Array.of(45,78,65,75),Sl=Uint8Array.of(43,87,80,73),Uk=Uint8Array.of(43,78,88,84),Pk=Uint8Array.of(43,84,69,82,77),Bk=Uint8Array.of(32);function Fl(e,t=5e3){return new nE(e,t)}class Ah extends vn{constructor(r,s,l=!1){super();C(this,"consumer");C(this,"opts");C(this,"sub");C(this,"monitor");C(this,"pending");C(this,"inbox");C(this,"refilling");C(this,"pong");C(this,"callback");C(this,"timeout");C(this,"cleanupHandler");C(this,"listeners");C(this,"statusIterator");C(this,"forOrderedConsumer");C(this,"resetHandler");C(this,"abortOnMissingResource");C(this,"bind");C(this,"inBackOff");this.consumer=r;const o=s;this.opts=this.parseOptions(s,l),this.callback=o.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=gi(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=o.abort_on_missing_resource===!0,this.bind=o.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:s,idle_heartbeat:l,threshold_bytes:o,threshold_messages:c}=this.opts;this.closed().then(d=>{if(this.cleanupHandler)try{this.cleanupHandler(d)}catch{}});const{sub:f}=this;f&&f.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(d,m)=>{var g,x,v,S;if(d){this.stop(d);return}if((g=this.monitor)==null||g.work(),m.subject===this.inbox){if(rd(m))return;const A=(x=m.headers)==null?void 0:x.code,O=((S=(v=m.headers)==null?void 0:v.description)==null?void 0:S.toLowerCase())||"unknown",{msgsLeft:M,bytesLeft:P}=this.parseDiscard(m.headers);if(M>0||P>0)this.pending.msgs-=M,this.pending.bytes-=P,this.pending.requests--,this.notify(ya.Discard,{msgsLeft:M,bytesLeft:P});else if(A===400){this.stop(new De(O,`${A}`));return}else if(A===409&&O==="consumer deleted"){if(this.notify($r.ConsumerDeleted,`${A} ${O}`),!this.refilling||this.abortOnMissingResource){const I=new De(O,`${A}`);this.stop(I);return}}else if(A===503){if(this.notify($r.NoResponders,`${A} No Responders`),!this.refilling||this.abortOnMissingResource){const I=new De("no responders",`${A}`);this.stop(I);return}}else this.notify(ya.DebugEvent,`${A} ${O}`)}else this._push(Fl(m,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=m.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=c||s&&this.pending.bytes<=o){const A=this.pullOptions();this.pull(A)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Bd(l,d=>(this.notify($r.HeartbeatsMissed,d),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var m;const d=this.consumer.api.nc.status();this.statusIterator=d;for await(const b of d)switch(b.type){case di.Disconnect:(m=this.monitor)==null||m.cancel();break;case di.Reconnect:this.resetPending().then(g=>{var x;g&&((x=this.monitor)==null||x.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const s=typeof r=="function"?r:null;try{s?s():this.callback(r)}catch(l){this.stop(l)}}}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let r=0,s=0;const l=zd([this.opts.expires]);let o=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,r=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(c){if(c.message==="stream not found"){if(s++,this.notify($r.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify($r.ConsumerNotFound,r),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(c),!1;if(this.forOrderedConsumer)return!1}else r=0,s=0;this.inBackOff=!0;const f=l.backoff(o),d=ja(f);await Promise.race([d,this.consumer.api.nc.closed()]),d.cancel(),o++}}}pull(r){this.pending.bytes+=r.max_bytes??0,this.pending.msgs+=r.batch??0,this.pending.requests++;const s=this.consumer.api.nc;this._push(()=>{s.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(r),{reply:this.inbox}),this.notify(ya.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=$t(this.opts.idle_heartbeat),o=$t(this.opts.expires);return{batch:r,max_bytes:s,idle_heartbeat:l,expires:o}}parseDiscard(r){const s={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(Bn.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const o=r==null?void 0:r.get(Bn.PendingBytesHdr);return o&&(s.bytesLeft=parseInt(o)),s}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,s;(r=this.monitor)==null||r.cancel(),this.monitor=null,(s=this.timeout)==null||s.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var s,l;this.done||((s=this.sub)==null||s.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(o=>{o.stop()})}))}parseOptions(r,s=!1){const l=r||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,s){const o=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||o;const c=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||c}return l}status(){const r=new vn;return this.listeners.push(r),Promise.resolve(r)}}class Hk extends vn{constructor(){super();C(this,"src");C(this,"listeners");this.listeners=[]}setSource(r){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=r,this.src.setCleanupHandler(s=>{this.stop(s||void 0)}),(async()=>{const s=await this.src.status();for await(const l of s)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}stop(r){var s;this.done||((s=this.src)==null||s.stop(r),super.stop(r),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const r=new vn;return this.listeners.push(r),Promise.resolve(r)}}class hd{constructor(t,r){C(this,"api");C(this,"_info");C(this,"stream");C(this,"name");this.api=t,this._info=r,this.stream=r.stream_name,this.name=r.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new Ah(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const r=new Ah(this,t,!1),s=Math.round(r.opts.expires*1.05),l=va(s);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(t={expires:3e4}){const r=Vt(),s=t;s.max_messages=1;const l=new Ah(this,s,!1),o=Math.round(l.opts.expires*1.05);o>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===$r.HeartbeatsMissed&&f.data>=2){r.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const f of l){r.resolve(f);break}})().catch(()=>{});const c=va(o);return l.closed().then(f=>{f?r.reject(f):r.resolve(null)}).catch(f=>{r.reject(f)}).finally(()=>{c.cancel()}),c.catch(f=>{r.resolve(null),l.close().catch()}),l.trackTimeout(c),r}delete(){const{stream_name:t,name:r}=this._info;return this.api.delete(t,r)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:r,name:s}=this._info;return this.api.info(r,s).then(l=>(this._info=l,this._info))}}class qk{constructor(t,r,s={}){C(this,"api");C(this,"consumerOpts");C(this,"consumer");C(this,"opts");C(this,"cursor");C(this,"stream");C(this,"namePrefix");C(this,"serial");C(this,"currentConsumer");C(this,"userCallback");C(this,"iter");C(this,"type");C(this,"startSeq");C(this,"maxInitialReset");this.api=t,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ki.next(),typeof s.name_prefix=="string"&&(Xu("name_prefix",s.name_prefix),this.namePrefix=s.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=wr.Unset,this.consumerOpts=s,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const r=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const s={name:r,deliver_policy:an.StartSequence,opt_start_seq:t,ack_policy:xn.None,inactive_threshold:$t(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(s.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(s.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(s.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(s.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(s.deliver_policy=this.consumerOpts.deliver_policy||an.StartSequence,(this.consumerOpts.deliver_policy===an.LastPerSubject||this.consumerOpts.deliver_policy===an.New||this.consumerOpts.deliver_policy===an.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===an.LastPerSubject&&typeof s.filter_subjects>"u"&&typeof s.filter_subject>"u"&&(s.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete s.opt_start_seq,s.deliver_policy=an.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=$t(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var c,f,d,m,b;Ki.next();const r=this.serial===0;(c=this.consumer)==null||c.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const s=this.getConsumerOpts(t);s.max_deliver=1,s.mem_storage=!0;const l=zd([((f=this.opts)==null?void 0:f.expires)||3e4]);let o;for(let g=0;;g++)try{o=await this.api.add(this.stream,s),(d=this.iter)==null||d.notify($r.OrderedConsumerRecreated,o.name);break}catch(x){if(x.message==="stream not found"&&((m=this.iter)==null||m.notify($r.StreamNotFound,g),this.type===wr.Fetch||this.opts.abort_on_missing_resource===!0))return(b=this.iter)==null||b.stop(x),Promise.reject(x);if(r&&g>=this.maxInitialReset)throw x;await ja(l.backoff(g+1))}return o}internalHandler(t){return r=>{var l;if(this.serial!==t)return;const s=r.info.deliverySequence;if(s!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=s,this.cursor.stream_seq=r.info.streamSequence,this.userCallback?this.userCallback(r):(l=this.iter)==null||l.push(r)}}async reset(t={max_messages:100,expires:3e4},r){var d,m;r=r||{};const s=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===wr.Fetch&&l){(d=this.iter)==null||d.src.stop(),await((m=this.iter)==null?void 0:m.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||s)&&(this.iter=new Hk),this.consumer=new hd(this.api,this.currentConsumer);const o=t;o.callback=this.internalHandler(this.serial);let c=null;this.type===wr.Fetch&&s?c=await this.consumer.fetch(t):this.type===wr.Consume&&(c=await this.consumer.consume(t));const f=c;f.forOrderedConsumer=!0,f.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(f)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify(ya.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===wr.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===wr.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=wr.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var l;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===wr.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=wr.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const r=t;if(r.bind)return Promise.reject(new Error("bind is not supported"));r.max_messages=1;const s=Vt();return r.callback=o=>{this.userCallback=null,s.resolve(o)},(await this.fetch(r)).iterClosed.then(o=>{o&&s.reject(o),s.resolve(null)}).catch(o=>{s.reject(o)}),s}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class dd{constructor(t){C(this,"api");C(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(pt.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new hd(this.api,t)}async get(t,r={}){return typeof r=="object"?this.ordered(t,r):(await this.checkVersion(),this.api.info(t,r).then(s=>s.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new hd(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(t,r){await this.checkVersion();const s=this.api;return new qd(s.nc,s.opts).info(t).then(o=>Promise.resolve(new qk(this.api,t,r))).catch(o=>Promise.reject(o))}}class Zu{constructor(t,r){C(this,"api");C(this,"_info");this.api=t,this._info=r}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new Zu(this.api,t)}else return this}info(t=!1,r){return t?Promise.resolve(this._info):this.api.info(this.name,r).then(s=>(this._info=s,this._info))}getConsumerFromInfo(t){return new dd(new Du(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new dd(new Du(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,r){return this.api.deleteMessage(this.name,t,r)}}class qd extends Jl{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.metadata){const{min:l,ok:o}=r.features.get(pt.JS_STREAM_CONSUMER_METADATA);if(!o)throw new Error(`stream 'metadata' requires server ${l}`)}if(t.first_seq){const{min:l,ok:o}=r.features.get(pt.JS_STREAM_FIRST_SEQ);if(!o)throw new Error(`stream 'first_seq' requires server ${l}`)}if(t.subject_transform){const{min:l,ok:o}=r.features.get(pt.JS_STREAM_SUBJECT_TRANSFORM);if(!o)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(t.compression){const{min:l,ok:o}=r.features.get(pt.JS_STREAM_COMPRESSION);if(!o)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:o}=r.features.get(pt.JS_DEFAULT_CONSUMER_LIMITS);if(!o)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function s(l,o){var f;if((((f=o==null?void 0:o.subject_transforms)==null?void 0:f.length)||0)>0){const{min:d,ok:m}=r.features.get(pt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!m)throw new Error(`${l} 'subject_transforms' requires server ${d}`)}}t.sources&&t.sources.forEach(l=>{s("stream sources",l)}),t.mirror&&s("stream mirror",t.mirror)}async add(t={}){var l;this.checkStreamConfigVersions(t),Ln(t.name),t.mirror=mu(t.mirror),t.sources=(l=t.sources)==null?void 0:l.map(mu);const s=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(s),s}async delete(t){return Ln(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,r={}){var f;if(typeof t=="object"){const d=t;t=d.name,r=d,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(r),Ln(t);const s=await this.info(t),l=Object.assign(s.config,r);l.mirror=mu(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(mu);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,l);return this._fixInfo(c),c}async info(t,r){Ln(t);const s=`${this.prefix}.STREAM.INFO.${t}`;let o=await this._request(s,r),{total:c,limit:f}=o,d=o.state.subjects?Object.getOwnPropertyNames(o.state.subjects).length:1;if(c&&c>d){const m=[o],b=r||{};let g=0;for(;c>d;){g++,b.offset=f*g;const v=await this._request(s,b);c=v.total,m.push(v);const S=Object.getOwnPropertyNames(v.state.subjects).length;if(d+=S,S<f)break}let x={};for(let v=0;v<m.length;v++)o=m[v],o.state.subjects&&(x=Object.assign(x,o.state.subjects));o.offset=0,o.total=0,o.limit=0,o.state.subjects=x}return this._fixInfo(o),o}list(t=""){const r=t!=null&&t.length?{subject:t}:{},s=o=>{const c=o;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new Nl(l,s,this,r)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,r){if(r){const{keep:l,seq:o}=r;if(typeof l=="number"&&typeof o=="number")throw new Error("can specify one of keep or seq")}return Ln(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){Ln(t);const l={seq:r};return s||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,l)).success}async getMessage(t,r){Ln(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,r);return new Ox(l)}find(t){return this.findStream(t)}listKvs(){const t=s=>{var d;const o=s.streams.filter(m=>m.config.name.startsWith(sr));o.forEach(m=>{this._fixInfo(m)});let c="";return o.length&&(c=((d=this.nc.info)==null?void 0:d.cluster)??""),o.map(m=>new Tx(m,c))},r=`${this.prefix}.STREAM.LIST`;return new Nl(r,t,this)}listObjectStores(){const t=s=>{const o=s.streams.filter(f=>f.config.name.startsWith(Hd));return o.forEach(f=>{this._fixInfo(f)}),o.map(f=>new fd(f))},r=`${this.prefix}.STREAM.LIST`;return new Nl(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=o=>o.streams,l=`${this.prefix}.STREAM.NAMES`;return new Nl(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new Zu(this,r))}}class Ik extends Jl{constructor(t,r){super(t,r)}async getMessage(t,r){Ln(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const o=s?this.jc.encode(s):ur,c=this.opts.apiPrefix||"$JS.API",f=l?`${c}.DIRECT.GET.${t}.${l}`:`${c}.DIRECT.GET.${t}`,d=await this.nc.request(f,o,{timeout:this.timeout}),m=pa(d);if(m)return Promise.reject(m);const b=new md(d);return Promise.resolve(b)}async getBatch(t,r){Ln(t);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(r.multi_last)||r.multi_last.length===0)return Promise.reject("multi_last is required");const o=JSON.stringify(r,(d,m)=>d==="up_to_time"&&m instanceof Date?m.toISOString():m),c=new vn,f=await this.nc.requestMany(l,o,{strategy:Rr.SentinelMsg});return(async()=>{var g,x,v;let d=!1,m=!1,b;for await(const S of f){if(!d){d=!0;const A=((g=S.headers)==null?void 0:g.code)||0;if(A!==0&&A<200||A>299){b=(x=S.headers)==null?void 0:x.description.toLowerCase();break}if(((v=S.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){m=!0;break}}if(S.data.length===0)break;c.push(new md(S))}c.push(()=>{if(m)throw new Error("batch direct get not supported by the server");if(b)throw new Error(`bad request: ${b}`);c.stop()})})(),Promise.resolve(c)}}class md{constructor(t){C(this,"data");C(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(fa.Subject)}get seq(){const t=this.header.last(fa.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(fa.TimeStamp)}get stream(){return this.header.last(fa.Stream)}json(t){return Mr(t).decode(this.data)}string(){return ar.decode(this.data)}}C(md,"jc");class Fk extends Jl{constructor(r,s){super(r,s);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new qd(r,s),this.consumers=new Du(r,s),this.direct=new Ik(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new vn;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(s,l)=>{if(s)throw s;try{const o=this.parseJsResponse(l),c=o.type.split("."),f=c[c.length-1];r.push({kind:f,data:o})}catch(o){r.stop(o)}}}),r}}class Ox{constructor(t){C(this,"_header");C(this,"smr");this.smr=t}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):ur}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=Ji.decode(t)}else this._header=bi();return this._header}_parse(t){const r=atob(t),s=r.length,l=new Uint8Array(s);for(let o=0;o<s;o++)l[o]=r.charCodeAt(o);return l}json(t){return Mr(t).decode(this.data)}string(){return ar.decode(this.data)}}C(Ox,"jc");class $k{constructor(t){C(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new Zu(this.api,r))}}class jh{constructor(t){C(this,"info");C(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Ji.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var t,r;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((r=this.info.options)==null?void 0:r.link)!==null}}function H0(e){const t={name:e.name,description:e.description??"",options:e.options,metadata:e.metadata};if(e.headers){const r=e.headers;t.headers=r.toRecord()}return t}function Vk(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Ml{constructor(t,r,s){C(this,"jsm");C(this,"js");C(this,"stream");C(this,"name");this.name=t,this.jsm=r,this.js=s}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const r=await this.rawInfo(t);return r?new jh(r):null}async list(){const t=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const s of r){if(s===null)break;t.push(s)}return Promise.resolve(t)}async rawInfo(t){const{name:r,error:s}=this._checkNotEmpty(t);if(s)return Promise.reject(s);const l=this._metaSubject(r);try{const o=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=Mr().decode(o.data);return f.revision=o.seq,f}catch(o){return o.code==="404"?null:Promise.reject(o)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(r){return r.code==="404"?null:Promise.reject(r)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new fd(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new fd(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var te;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout:o,previousRevision:c}=s,f=this.js.nc.info,d=(f==null?void 0:f.max_payload)||1024;t=t||{},t.options=t.options||{};let m=((te=t.options)==null?void 0:te.max_chunk_size)||128*1024;m=m>d?d:m,t.options.max_chunk_size=m;const b=await this.info(t.name),{name:g,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=Ki.next(),S=this._chunkSubject(v),A=this._metaSubject(g),O=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},H0(t)),M=Vt(),P=[],I=new Sa;try{const q=r?r.getReader():null,L=N0.create();for(;;){const{done:ee,value:J}=q?await q.read():{done:!0,value:void 0};if(ee){if(I.size()>0){const F=I.drain();L.update(F),O.chunks++,O.size+=F.length,P.push(this.js.publish(S,F,{timeout:o}))}await Promise.all(P),P.length=0,O.mtime=new Date().toISOString();const B=ga.encode(L.digest());O.digest=`${P0}${B}`,O.deleted=!1;const D=bi();typeof c=="number"&&D.set(Fr.ExpectedLastSubjectSequenceHdr,`${c}`),D.set(Bn.RollupHdr,Bn.RollupValueSubject);const G=await this.js.publish(A,Mr().encode(O),{headers:D,timeout:o});if(O.revision=G.seq,b)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${b.nuid}`})}catch{}M.resolve(new jh(O));break}if(J)for(I.fill(J);I.size()>m;){O.chunks++,O.size+=m;const B=I.drain(t.options.max_chunk_size);L.update(B),P.push(this.js.publish(S,B,{timeout:o}))}}}catch(q){await this.jsm.streams.purge(this.stream,{filter:S}),M.reject(q)}return M}putBlob(t,r,s){function l(o){return new ReadableStream({pull(c){c.enqueue(o),c.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(t,l(r),s)}put(t,r,s){var l;return(l=t==null?void 0:t.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,r,s)}async getBlob(t){async function r(o){const c=new Sa,f=o.getReader();for(;;){const{done:d,value:m}=await f.read();if(d)return c.drain();m&&m.length&&c.fill(m)}}const s=await this.get(t);if(s===null)return Promise.resolve(null);const l=await Promise.all([s.error,r(s.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(t){const r=await this.rawInfo(t);if(r===null||r.deleted)return Promise.resolve(null);if(r.options&&r.options.link){const g=r.options.link.name||"";if(g==="")throw new Error("link is a bucket");return(r.options.link.bucket!==this.name?await Ml.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(P0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=ad(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Vt(),o={info:new jh(r),error:l};if(r.size===0)return o.data=Vk(),l.resolve(null),Promise.resolve(o);let c;const f=Xi();f.orderedConsumer();const d=N0.create(),m=`$O.${this.name}.C.${r.nuid}`,b=await this.js.subscribe(m,f);return(async()=>{for await(const g of b)g.data.length>0&&(d.update(g.data),c.enqueue(g.data)),g.info.pending===0&&(w2(s,d.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),b.unsubscribe())})().then(()=>{l.resolve()}).catch(g=>{c.error(g),l.reject(g)}),o.data=new ReadableStream({start(g){c=g},cancel(){b.unsubscribe()}}),o}linkStore(t,r){if(!(r instanceof Ml))return Promise.reject("bucket required");const s=r,{name:l,error:o}=this._checkNotEmpty(t);if(o)return Promise.reject(o);const c={name:l,options:{link:{bucket:s.name}}};return this._put(c,null)}async link(t,r){const{name:s,error:l}=this._checkNotEmpty(t);if(l)return Promise.reject(l);if(r.deleted)return Promise.reject(new Error("src object is deleted"));if(r.isLink())return Promise.reject(new Error("src object is a link"));const o=await this.rawInfo(t);if(o!==null&&!o.deleted)return Promise.reject(new Error("an object already exists with that name"));const c={bucket:r.bucket,name:r.name},f={name:s,bucket:r.bucket,options:{link:c}};await this.js.publish(this._metaSubject(t),JSON.stringify(f));const d=await this.info(t);return Promise.resolve(d)}async delete(t){const r=await this.rawInfo(t);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const s=Mr(),l=bi();return l.set(Bn.RollupHdr,Bn.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),s.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(t,r={}){const s=await this.rawInfo(t);if(s===null)return Promise.reject(new Error("object not found"));if(s.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??s.name;const{name:l,error:o}=this._checkNotEmpty(r.name);if(o)return Promise.reject(o);if(t!==r.name){const d=await this.info(r.name);if(d&&!d.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const c=Object.assign({},s,H0(r)),f=await this.js.publish(this._metaSubject(c.name),JSON.stringify(c));return t!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(f)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let r=!1;const s=new vn,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(d){d.code==="404"?(s.push(null),r=!0):s.stop(d)}const o=Mr(),c=Xi();c.orderedConsumer(),t.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((d,m)=>{var b;if(d){s.stop(d);return}if(m!==null){const g=o.decode(m.data);g.deleted&&t.ignoreDeletes===!0||s.push(g),((b=m.info)==null?void 0:b.pending)===0&&!r&&(r=!0,s.push(null))}});const f=await this.js.subscribe(l,c);return s._data=f,s.iterClosed.then(()=>{f.unsubscribe()}),f.closed.then(()=>{s.stop()}).catch(d=>{s.stop(d)}),s}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${ga.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=Dk(this.name)}catch(l){return Promise.reject(l)}const r=(t==null?void 0:t.ttl)||0;delete t.ttl;const s=Object.assign({max_age:r},t);s.name=this.stream,s.num_replicas=t.replicas??1,s.allow_direct=!0,s.allow_rollup_hdrs=!0,s.discard=Hl.New,s.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(s.placement=t.placement),t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?Qi.S2:Qi.None);try{await this.jsm.streams.info(s.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(s)}}static async create(t,r,s={}){const l=await t.jetstreamManager(),o=new Ml(r,l,t);return await o.init(s),Promise.resolve(o)}}class Yk{constructor(t){C(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:o}=s.nc.features.get(pt.JS_KV);return l?r.bindOnly?Il.bind(this.js,t,r):Il.create(this.js,t,r):Promise.reject(new Error(`kv is only supported on servers ${o} or better`))}os(t,r={}){var c;if(typeof((c=crypto==null?void 0:crypto.subtle)==null?void 0:c.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const s=this.js,{ok:l,min:o}=s.nc.features.get(pt.JS_OBJECTSTORE);return l?Ml.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${o} or better`))}}class Id extends Jl{constructor(r,s){super(r,s);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new Du(r,s),this.streamAPI=new qd(r,s),this.consumers=new dd(this.consumerAPI),this.streams=new $k(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const s=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(s)}get apiPrefix(){return this.prefix}get views(){return new Yk(this)}async publish(r,s=ur,l){l=l||{},l.expect=l.expect||{};const o=(l==null?void 0:l.headers)||bi();l&&(l.msgID&&o.set(Fr.MsgIdHdr,l.msgID),l.expect.lastMsgID&&o.set(Fr.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&o.set(Fr.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&o.set(Fr.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&o.set(Fr.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=o);let{retries:d,retry_delay:m}=l;d=d||1,m=m||250;let b;for(let x=0;x<d;x++)try{b=await this.nc.request(r,s,f);break}catch(v){if(v.code==="503"&&x+1<d)await ja(m);else throw v}const g=this.parseJsResponse(b);if(g.stream==="")throw De.errorForCode(Ce.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){Ln(r),ma(s);let o=this.timeout;l>o&&(o=l),l=l<0?0:$t(l);const c={batch:1,no_wait:l===0,expires:l},f=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(c),{noMux:!0,timeout:o}),d=pa(f);if(d)throw d;return Fl(f,this.timeout)}fetch(r,s,l={}){Ln(r),ma(s);let o=null;const c=(l.max_bytes??0)>0;let f=0;const d=c?l.max_bytes:0;let m=null;const b={};if(b.batch=l.batch||1,d){const P=this.nc.features.get(pt.JS_PULL_MAX_BYTES);if(!P.ok)throw new Error(`max_bytes is only supported on servers ${P.min} or better`);b.max_bytes=d}b.no_wait=l.no_wait||!1,b.no_wait&&b.expires&&(b.expires=0);const g=l.expires||0;if(g&&(b.expires=$t(g)),g===0&&b.no_wait===!1)throw new Error("expires or no_wait is required");const x=l.idle_heartbeat||0;x&&(b.idle_heartbeat=$t(x),l.delay_heartbeat===!0&&(b.idle_heartbeat=$t(x*4)));const v=new vn,S=b.batch;let A=0;v.protocolFilterFn=(P,I=!1)=>rd(P.msg)?(m==null||m.work(),!1):!0,v.dispatchedFn=P=>{if(P){if(c&&(f+=P.data.length),A++,o&&P.info.pending===0)return;(v.getPending()===1&&P.info.pending===0||S===A||d>0&&f>=d)&&v.stop()}};const O=gi(this.nc.options.inboxPrefix),M=this.nc.subscribe(O,{max:l.batch,callback:(P,I)=>{P===null&&(P=pa(I)),P!==null?(o&&(o.cancel(),o=null),n2(P)?v.stop(Mx(P)===null?void 0:P):v.stop(P)):(m==null||m.work(),v.received++,v.push(Fl(I,this.timeout)))}});return g&&(o=va(g),o.catch(()=>{M.isClosed()||(M.drain().catch(()=>{}),o=null),m&&m.cancel()})),(async()=>{try{x&&(m=new Bd(x,P=>(v.push(()=>{v.err=new De(`${Sr.IdleHeartbeatMissed}: ${P}`,Ce.JetStreamIdleHeartBeat)}),!0)))}catch{}await M.closed,o!==null&&(o.cancel(),o=null),m&&m.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(b),{reply:O}),v}async pullSubscribe(r,s=Xi()){const l=await this._processOptions(r,s);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const o=l.config.ack_policy;if(o===xn.None||o===xn.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new Kk(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(d){throw f.unsubscribe(),d}return f}async subscribe(r,s=Xi()){const l=await this._processOptions(r,s);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const o=this._buildTypedSubscriptionOpts(l),c=new Rx(this,l.deliver,o);c.info=l;try{await this._maybeCreateConsumer(l)}catch(f){throw c.unsubscribe(),f}return c._maybeSetupHbMonitoring(),c}async _processOptions(r,s=Xi()){const l=E0(s)?s.getOpts():s;if(l.isBind=E0(s)?s.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==xn.NotSet&&l.config.ack_policy!==xn.None)throw new De("ordered consumer: ack_policy can only be set to 'none'",Ce.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new De("ordered consumer: durable_name cannot be set",Ce.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new De("ordered consumer: deliver_subject cannot be set",Ce.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new De("ordered consumer: max_deliver cannot be set",Ce.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new De("ordered consumer: deliver_group cannot be set",Ce.ApiError);l.config.deliver_subject=gi(this.nc.options.inboxPrefix),l.config.ack_policy=xn.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||$t(5e3),l.config.ack_wait=$t(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===xn.NotSet&&(l.config.ack_policy=xn.All),l.api=this,l.config=l.config||{},l.stream=l.stream?l.stream:await this.findStream(r),l.attached=!1,l.config.durable_name)try{const o=await this.consumerAPI.info(l.stream,l.config.durable_name);if(o){if(o.config.filter_subject&&o.config.filter_subject!==r)throw new Error("subject does not match consumer");const c=l.config.deliver_group??"";if(c===""&&o.push_bound===!0)throw new Error("duplicate subscription");const f=o.config.deliver_group??"";if(c!==f)throw f===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${f}'`);l.last=o,l.config=o.config,l.attached=!0,l.config.durable_name||(l.name=o.name)}}catch(o){if(o.code!=="404")throw o}return!l.attached&&l.config.filter_subject===void 0&&l.config.filter_subjects===void 0&&(l.config.filter_subject=r),l.deliver=l.config.deliver_subject||gi(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=Qk(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Id.ingestionFn(r.ordered),s.protocolFilterFn=(l,o=!1)=>{const c=l;return nd(c.msg)?(o||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==xn.None&&(s.dispatchedFn=eE),r.callbackFn&&(s.callback=r.callbackFn),s.max=r.max||0,s.queue=r.queue,s}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:an.All,ack_policy:xn.Explicit,ack_wait:$t(30*1e3),replay_policy:wa.Instant},r.config);const s=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(s.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=s.name,r.config=s.config,r.last=s}static ingestionFn(r){return(s,l)=>{var d;const o=l;if(!s)return{ingest:!1,protocol:!1};const c=s;if(pa(c.msg)||(d=o.monitor)==null||d.work(),rd(c.msg)){const m=r?o._checkHbOrderConsumer(c.msg):!0;return r||o.info.flow_control.heartbeat_count++,{ingest:m,protocol:!0}}else if(nd(c.msg))return o.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?o._checkOrderedConsumer(s):!0,protocol:!1}}}}class Fd{constructor(t){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=pk(t),this.listeners=[]}static connect(t={}){return new Promise((r,s)=>{const l=new Fd(t);Uu.connect(l.options,l).then(o=>{l.protocol=o,(async function(){for await(const c of o.status())l.listeners.forEach(f=>{f.push(c)})})(),r(l)}).catch(o=>{s(o)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,r,s){if(this.isClosed())throw De.errorForCode(Ce.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw De.errorForCode(Ce.ConnectionDraining);if(t=t||"",t.length===0)throw De.errorForCode(Ce.BadSubject)}publish(t,r,s){this._check(t,!1,!0),this.protocol.publish(t,r,s)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,r={}){this._check(t,!0,!1);const s=new jx(this.protocol,t,r);return this.protocol.subscribe(s),s}_resub(t,r,s){this._check(r,!0,!1);const l=t;l.max=s,s&&(l.max=s+l.received),this.protocol.resub(l,r)}requestMany(t,r=ur,s={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(d){return Promise.reject(d)}if(s.strategy=s.strategy||Rr.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new De("timeout",Ce.InvalidOption));const o=new vn;function c(d){o.push(()=>{o.stop(d)})}function f(d,m){d||m===null?c(d===null?void 0:d):o.push(m)}if(s.noMux){const d=l?new Error().stack:null;let m=typeof s.maxMessages=="number"&&s.maxMessages>0?s.maxMessages:-1;const b=this.subscribe(gi(this.options.inboxPrefix),{callback:(S,A)=>{var O,M;if(((O=A==null?void 0:A.data)==null?void 0:O.length)===0&&((M=A==null?void 0:A.headers)==null?void 0:M.status)===Ce.NoResponders&&(S=De.errorForCode(Ce.NoResponders)),S){d&&(S.stack+=`
|
|
81
|
+
`),t.max=r)}resub(t,r){!t||this.isClosed()||(this.unsub(t),t.subject=r,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=Jt()),this.pongs.push(t),this.outbound.fill(L0),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(r=>{const s=r;s.queue?t.push(`SUB ${s.subject} ${s.queue} ${s.sid}${ku}`):t.push(`SUB ${s.subject} ${s.sid}${ku}`)}),t.length&&this.transport.send(Tl(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(r=>{r.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),r=[];return t.forEach(s=>{r.push(s.drain())}),Promise.all(r).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const r=this.muxSubscriptions.init(this.options.inboxPrefix),s=new jx(this,`${r}*`);s.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(s),this.subscribe(s)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const Sk="$SRV";class z0{constructor(t){C(this,"msg");this.msg=t}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(t,r){return this.msg.respond(t,r)}respondError(t,r,s,l){var o,c;return l=l||{},l.headers=l.headers||bi(),(o=l.headers)==null||o.set(Tu,`${t}`),(c=l.headers)==null||c.set(Nu,r),this.msg.respond(s,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class ql{constructor(t,r="",s=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&kk("service group",r);let l="";if(t instanceof Xl)this.srv=t,l="";else if(t instanceof ql){const o=t;this.srv=o.srv,s===""&&o.queue!==""&&(s=o.queue),l=o.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=s}calcSubject(t,r=""){return r===""?t:t!==""?`${t}.${r}`:r}addEndpoint(t="",r){r=r||{subject:t};const s=typeof r=="function"?{handler:r,subject:t}:r;jl("endpoint",t);let{subject:l,handler:o,metadata:c,queue:f}=s;l=l||t,f=f||this.queue,_k("endpoint subject",l),l=this.calcSubject(this.subject,l);const d={name:t,subject:l,queue:f,handler:o,metadata:c};return this.srv._addEndpoint(d)}addGroup(t="",r=""){return new ql(this,t,r)}}function _k(e,t){if(t==="")throw new Error(`${e} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${t}'`);const r=t.split(".");r.forEach((s,l)=>{if(s===">"&&l!==r.length-1)throw new Error(`${e} cannot have internal '>': '${t}'`)})}function kk(e,t){if(t.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${t}'`);t.split(".").forEach(s=>{if(s===">")throw new Error(`${e} name cannot contain internal '>': '${t}'`)})}class Xl{constructor(t,r={name:"",version:""}){C(this,"nc");C(this,"_id");C(this,"config");C(this,"handlers");C(this,"internal");C(this,"_stopped");C(this,"_done");C(this,"started");this.nc=t,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),jl("name",this.config.name),jl("queue",this.config.queue),ws(this.config.version),this._id=Ki.next(),this.internal=[],this._done=Jt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(s=>{this.close(s).catch()})}static controlSubject(t,r="",s="",l){const o=l??Sk;return r===""&&s===""?`${o}.${t}`:(jl("control subject name",r),s!==""?(jl("control subject id",s),`${o}.${t}.${r}.${s}`):`${o}.${t}.${r}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(t){const r=bi();if(t instanceof Ou){const s=t;r.set(Nu,s.message),r.set(Tu,`${s.code}`)}else r.set(Nu,t.message),r.set(Tu,"500");return r}setupHandler(t,r=!1){const s=r?"":t.queue?t.queue:this.config.queue,{name:l,subject:o,handler:c}=t,f=t;f.internal=r,r&&this.internal.push(f),f.stats=new Ek(l,o,s),f.queue=s;const d=c?(m,b)=>{if(m){this.close(m);return}const g=Date.now();try{c(m,new z0(b))}catch(x){f.stats.countError(x),b==null||b.respond(cr,{headers:this.errorToHeader(x)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(o,{callback:d,queue:s}),f.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(m=>{if(!this._stopped){const b=new Error(`required subscription ${t.subject} errored: ${m.message}`);b.stack=m.stack,this.close(b).catch()}}),f}info(){return{type:Ol.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:r,metadata:s,name:l,queue:o}=t;return{subject:r,metadata:s,name:l,queue_group:o}})}async stats(){const t=[];for(const r of this.handlers){if(typeof this.config.statsHandler=="function")try{r.stats.data=await this.config.statsHandler(r)}catch(s){r.stats.countError(s)}t.push(r.stats.stats(r.qi))}return{type:Ol.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,r){const s=`${t}`.toUpperCase();this._doAddInternalHandler(`${s}-all`,t,r),this._doAddInternalHandler(`${s}-kind`,t,r,this.name),this._doAddInternalHandler(`${s}`,t,r,this.name,this.id)}_doAddInternalHandler(t,r,s,l="",o=""){const c={};c.name=t,c.subject=Xl.controlSubject(r,l,o),c.handler=s,this.setupHandler(c,!0)}start(){const t=Dr(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(d=>(f==null||f.respond(t.encode(d)),Promise.resolve())),s=(c,f)=>c?(this.close(c),Promise.reject(c)):(f==null||f.respond(t.encode(this.info())),Promise.resolve()),l=t.encode(this.ping()),o=(c,f)=>c?(this.close(c).then().catch(),Promise.reject(c)):(f.respond(l),Promise.resolve());return this.addInternalHandler(Gi.PING,o),this.addInternalHandler(Gi.STATS,r),this.addInternalHandler(Gi.INFO,s),this.handlers.forEach(c=>{const{subject:f}=c;typeof f=="string"&&c.handler!==null&&this.setupHandler(c)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let r=[];return this.nc.isClosed()||(r=this.handlers.concat(this.internal).map(s=>s.sub.drain())),Promise.allSettled(r).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:Ol.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,r){return new ql(this,t,r)}addEndpoint(t,r){return new ql(this).addEndpoint(t,r)}_addEndpoint(t){const r=new wn;r.noIterator=typeof t.handler=="function",r.noIterator||(t.handler=(l,o)=>{l?this.stop(l).catch():r.push(new z0(o))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(t,!1);return s.qi=r,this.handlers.push(s),r}}class Ek{constructor(t,r,s=""){C(this,"name");C(this,"subject");C(this,"average_processing_time");C(this,"num_requests");C(this,"processing_time");C(this,"num_errors");C(this,"last_error");C(this,"data");C(this,"metadata");C(this,"queue");this.name=t,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=s}reset(t){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const r=t;r&&(r.time=0,r.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=Gt(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:o,processing_time:c,last_error:f,data:d,queue:m}=this;return{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:o,processing_time:c,last_error:f,data:d,queue_group:m}}stats(t){const r=t;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=Gt(r.time),this.num_requests=r.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class Ck{constructor(t,r={strategy:Mr.JitterTimer,maxWait:2e3},s){C(this,"nc");C(this,"prefix");C(this,"opts");this.nc=t,this.prefix=s,this.opts=r}ping(t="",r=""){return this.q(Gi.PING,t,r)}stats(t="",r=""){return this.q(Gi.STATS,t,r)}info(t="",r=""){return this.q(Gi.INFO,t,r)}async q(t,r="",s=""){const l=new wn,o=Dr(),c=Xl.controlSubject(t,r,s,this.prefix),f=await this.nc.requestMany(c,cr,this.opts);return(async()=>{for await(const d of f)try{const m=o.decode(d.data);l.push(m)}catch(m){l.push(()=>{l.stop(m)})}l.push(()=>{l.stop()})})().catch(d=>{l.stop(d)}),l}}function Nx(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function Ak(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Nx(),storage:sd.File}}const Pu="KV-Operation",U0="$KV",jk=/^[-/=.\w]+$/,Nk=/^[-/=.>*\w]+$/,Tk=/^[-\w]+$/;function Ok(e){if(e.startsWith(".")||e.endsWith(".")||!jk.test(e))throw new Error(`invalid key: ${e}`)}function Rk(e){if(e.startsWith(".")||e.endsWith(".")||!Nk.test(e))throw new Error(`invalid key: ${e}`)}function Mk(e){if(e.startsWith(".")||e.endsWith("."))throw new Error(`invalid key: ${e}`);const t=e.split(".");let r=!1;for(let s=0;s<t.length;s++)switch(t[s]){case"*":r=!0;break;case">":if(s!==t.length-1)throw new Error(`invalid key: ${e}`);r=!0;break}return r}function Eu(e){if(!Tk.test(e))throw new Error(`invalid bucket name: ${e}`)}var $r;(function(e){e.MsgIdHdr="Nats-Msg-Id",e.ExpectedStreamHdr="Nats-Expected-Stream",e.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",e.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",e.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})($r||($r={}));class Il{constructor(t,r,s){C(this,"js");C(this,"jsm");C(this,"stream");C(this,"bucket");C(this,"direct");C(this,"codec");C(this,"prefix");C(this,"editPrefix");C(this,"useJsPrefix");C(this,"_prefixLen");C(this,"validateKey",Ok);C(this,"validateSearchKey",Rk);C(this,"hasWildcards",Mk);Eu(t),this.js=r,this.jsm=s,this.bucket=t,this.prefix=U0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,r,s={}){Eu(r);const l=await t.jetstreamManager(),o=new Il(r,t,l);return await o.init(s),o}static async bind(t,r,s={}){const l=await t.jetstreamManager(),o={config:{allow_direct:s.allow_direct}};Eu(r);const c=new Il(r,t,l);return o.config.name=s.streamName??c.bucketName(),Object.assign(c,o),c.stream=o.config.name,c.codec=s.codec||Nx(),c.direct=o.config.allow_direct??!1,c.initializePrefixes(o),c}async init(t={}){const r=Object.assign(Ak(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=id.Limits,s.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(s.max_bytes=r.max_bytes),s.max_msg_size=r.maxValueSize,s.storage=r.storage;const l=t.placementCluster??"";if(l&&(t.placement={},t.placement.cluster=l,t.placement.tags=[]),t.placement&&(s.placement=t.placement),t.republish&&(s.republish=t.republish),t.description&&(s.description=t.description),t.mirror){const g=Object.assign({},t.mirror);g.name.startsWith(ar)||(g.name=`${ar}${g.name}`),s.mirror=g,s.mirror_direct=!0}else if(t.sources){const g=t.sources.map(x=>{const v=Object.assign({},x),S=v.name.startsWith(ar)?v.name.substring(ar.length):v.name;return v.name.startsWith(ar)||(v.name=`${ar}${v.name}`),!x.external&&S!==this.bucket&&(v.subject_transforms=[{src:`$KV.${S}.>`,dest:`$KV.${this.bucket}.>`}]),v});s.sources=g,s.subjects=[this.subjectForBucket()]}else s.subjects=[this.subjectForBucket()];t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?Qi.S2:Qi.None);const o=this.js.nc,c=o.getServerVersion(),f=c?ld(c,ws("2.7.2"))>=0:!1;s.discard=f?Hl.New:Hl.Old;const{ok:d,min:m}=o.features.get(gt.JS_ALLOW_DIRECT);if(!d&&t.allow_direct===!0){const g=c?`${c.major}.${c.minor}.${c.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${g} - requires ${m}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:d,s.allow_direct=t.allow_direct,this.direct=s.allow_direct,s.num_replicas=r.replicas,r.ttl&&(s.max_age=Gt(r.ttl)),s.allow_rollup_hdrs=!0;let b;try{b=await this.jsm.streams.info(s.name),!b.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(g){if(g.message==="stream not found")b=await this.jsm.streams.add(s);else throw g}this.initializePrefixes(b)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=t.config;if(r){let s=r.name;if(s.startsWith(ar)&&(s=s.substring(ar.length)),r.external&&r.external.api!==""){const l=r.name.substring(ar.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${ar}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,r=!1){const s=[];return r?(this.useJsPrefix&&s.push(this.js.apiPrefix),this.editPrefix!==""?s.push(this.editPrefix):s.push(this.prefix)):this.prefix&&s.push(this.prefix),s.push(t),s.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${U0}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.encode(s));break}return r.join(".")}decodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.decode(s));break}return r.join(".")}close(){return Promise.resolve()}dataLen(t,r){const s=r&&r.get(Bn.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new Jk(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new Xk(this.bucket,r,t)}async create(t,r){var o;let s;try{const c=await this.put(t,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(s=c,((o=c==null?void 0:c.api_error)==null?void 0:o.err_code)!==10071)return Promise.reject(c)}let l=0;try{const c=await this.get(t);return(c==null?void 0:c.operation)==="DEL"||(c==null?void 0:c.operation)==="PURGE"?(l=c!==null?c.revision:0,this.update(t,r,l)):Promise.reject(s)}catch(c){return Promise.reject(c)}}update(t,r,s){if(s<=0)throw new Error("version must be greater than 0");return this.put(t,r,{previousSeq:s})}async put(t,r,s={}){var c,f;const l=this.encodeKey(t);this.validateKey(l);const o={};if(s.previousSeq!==void 0){const d=bi();o.headers=d,d.set($r.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,o)).seq}catch(d){const m=d;return m.isJetStreamError()?(m.message=(c=m.api_error)==null?void 0:c.description,m.code=`${(f=m.api_error)==null?void 0:f.code}`,Promise.reject(m)):Promise.reject(d)}}async get(t,r){const s=this.encodeKey(t);this.validateKey(s);let l={last_by_subj:this.subjectForKey(s)};r&&r.revision>0&&(l={seq:r.revision});let o;try{this.direct?o=await this.jsm.direct.getMessage(this.bucketName(),l):o=await this.jsm.streams.getMessage(this.bucketName(),l);const c=this.smToEntry(o);return c.key!==s?null:c}catch(c){if(c.code===Ce.JetStream404NoMessages)return null;throw c}}purge(t,r){return this._deleteOrPurge(t,"PURGE",r)}delete(t,r){return this._deleteOrPurge(t,"DEL",r)}async purgeDeletes(t=1800*1e3){const r=Jt(),s=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const d of l)(d.operation==="DEL"||d.operation==="PURGE")&&s.push(d)})().then(),await r,l.stop();const o=Date.now()-t,c=s.map(d=>{const m=this.subjectForKey(d.key);return d.created.getTime()>=o?this.jsm.streams.purge(this.stream,{filter:m,keep:1}):this.jsm.streams.purge(this.stream,{filter:m,keep:0})}),f=await Promise.all(c);return f.unshift({success:!0,purged:0}),f.reduce((d,m)=>(d.purged+=m.purged,d))}async _deleteOrPurge(t,r,s){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,r,s);const l=await this.keys(t),o=[];for await(const c of l)o.push(this._doDeleteOrPurge(c,r)),o.length===100&&(await Promise.all(o),o.length=0);o.length>0&&await Promise.all(o)}async _doDeleteOrPurge(t,r,s){const l=this.encodeKey(t);this.validateKey(l);const o=bi();o.set(Pu,r),r==="PURGE"&&o.set(Bn.RollupHdr,Bn.RollupValueSubject),s!=null&&s.previousSeq&&o.set($r.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),cr,{headers:o})}_buildCC(t,r,s={}){let o=(Array.isArray(t)?t:[t]).map(d=>{const m=this.encodeKey(d);return this.validateSearchKey(d),this.fullKeyName(m)}),c=sn.LastPerSubject;r===Or.AllHistory&&(c=sn.All),r===Or.UpdatesOnly&&(c=sn.New);let f;return o.length===1&&(f=o[0],o=void 0),Object.assign({deliver_policy:c,ack_policy:vn.None,filter_subjects:o,filter_subject:f,flow_control:!0,idle_heartbeat:Gt(5*1e3)},s)}remove(t){return this.purge(t)}async history(t={}){const r=t.key??">",s=new wn,l={};l.headers_only=t.headers_only||!1;let o;o=()=>{s.stop()};let c=0;const f=this._buildCC(r,Or.AllHistory,l),d=f.filter_subject,m=Xi(f);m.bindStream(this.stream),m.orderedConsumer(),m.callback((g,x)=>{if(g){s.stop(g);return}if(x){const v=this.jmToEntry(x);s.push(v),s.received++,(o&&c>0&&s.received>=c||x.info.pending===0)&&(s.push(o),o=void 0)}});const b=await this.js.subscribe(d,m);if(o){const{info:{last:g}}=b,x=g.num_pending+g.delivered.consumer_seq;if(x===0||s.received>=x)try{o()}catch(v){s.stop(v)}finally{o=void 0}else c=x}return s._data=b,s.iterClosed.then(()=>{b.unsubscribe()}),b.closed.then(()=>{s.stop()}).catch(g=>{s.stop(g)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(gt.JS_NEW_CONSUMER_CREATE_API);return s}async watch(t={}){const r=t.key??">",s=new wn,l={};l.headers_only=t.headers_only||!1;let o=Or.LastValue;t.include===Or.AllHistory?o=Or.AllHistory:t.include===Or.UpdatesOnly&&(o=Or.UpdatesOnly);const c=t.ignoreDeletes===!0;let f=t.initializedFn,d=0;const m=this._buildCC(r,o,l),b=m.filter_subject,g=Xi(m);this.canSetWatcherName()&&g.consumerName(Ki.next()),g.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&g.startSequence(t.resumeFromRevision),g.orderedConsumer(),g.callback((v,S)=>{if(v){s.stop(v);return}if(S){const j=this.jmToEntry(S);if(c&&j.operation==="DEL")return;s.push(j),s.received++,f&&(d>0&&s.received>=d||S.info.pending===0)&&(s.push(f),f=void 0)}});const x=await this.js.subscribe(b,g);if(f){const{info:{last:v}}=x,S=v.num_pending+v.delivered.consumer_seq;if(S===0||s.received>=S)try{f()}catch(j){s.stop(j)}finally{f=void 0}else d=S}return s._data=x,s.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{s.stop()}).catch(v=>{s.stop(v)}),s}async keys(t=">"){const r=new wn,s=this._buildCC(t,Or.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,o=Xi(s);o.bindStream(this.stream),o.orderedConsumer();const c=await this.js.subscribe(l,o);return(async()=>{var d;for await(const m of c){const b=(d=m.headers)==null?void 0:d.get(Pu);if(b!=="DEL"&&b!=="PURGE"){const g=this.decodeKey(m.subject.substring(this.prefixLen));r.push(g)}m.info.pending===0&&c.unsubscribe()}})().then(()=>{r.stop()}).catch(d=>{r.stop(d)}),c.info.last.num_pending===0&&c.unsubscribe(),r}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var o;const r=((o=this.js.nc.info)==null?void 0:o.cluster)??"",s=this.bucketName(),l=await this.jsm.streams.info(s);return new Tx(l,r)}}class Tx{constructor(t,r=""){C(this,"si");C(this,"cluster");this.si=t,this.cluster=r}get bucket(){return this.si.config.name.startsWith(ar)?this.si.config.name.substring(ar.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Ud(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var t;return((t=this.si.config.placement)==null?void 0:t.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Qi.None:!1}}const Hd="OBJ_",P0="SHA-256=";function Dk(e){return Eu(e),`${Hd}${e}`}function Lk(e){return e.startsWith(Hd)?e.substring(4):e}class fd{constructor(t){C(this,"si");C(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return Lk(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Qi.None:!1}}function mu(e){if(e===void 0)return;const{domain:t}=e;if(t===void 0)return e;const r=Object.assign({},e);if(delete r.domain,t==="")return r;if(r.external)throw new Error("domain and external are both set");return r.external={api:`$JS.${t}.API`},r}var Sr;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(Sr||(Sr={}));var Vr;(function(e){e.HeartbeatsMissed="heartbeats_missed",e.ConsumerNotFound="consumer_not_found",e.StreamNotFound="stream_not_found",e.ConsumerDeleted="consumer_deleted",e.OrderedConsumerRecreated="ordered_consumer_recreated",e.NoResponders="no_responders"})(Vr||(Vr={}));var ya;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(ya||(ya={}));const B0=Uint8Array.of(43,65,67,75),zk=Uint8Array.of(45,78,65,75),Sl=Uint8Array.of(43,87,80,73),Uk=Uint8Array.of(43,78,88,84),Pk=Uint8Array.of(43,84,69,82,77),Bk=Uint8Array.of(32);function Fl(e,t=5e3){return new nE(e,t)}class Ah extends wn{constructor(r,s,l=!1){super();C(this,"consumer");C(this,"opts");C(this,"sub");C(this,"monitor");C(this,"pending");C(this,"inbox");C(this,"refilling");C(this,"pong");C(this,"callback");C(this,"timeout");C(this,"cleanupHandler");C(this,"listeners");C(this,"statusIterator");C(this,"forOrderedConsumer");C(this,"resetHandler");C(this,"abortOnMissingResource");C(this,"bind");C(this,"inBackOff");this.consumer=r;const o=s;this.opts=this.parseOptions(s,l),this.callback=o.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=gi(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=o.abort_on_missing_resource===!0,this.bind=o.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:s,idle_heartbeat:l,threshold_bytes:o,threshold_messages:c}=this.opts;this.closed().then(d=>{if(this.cleanupHandler)try{this.cleanupHandler(d)}catch{}});const{sub:f}=this;f&&f.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(d,m)=>{var g,x,v,S;if(d){this.stop(d);return}if((g=this.monitor)==null||g.work(),m.subject===this.inbox){if(rd(m))return;const j=(x=m.headers)==null?void 0:x.code,R=((S=(v=m.headers)==null?void 0:v.description)==null?void 0:S.toLowerCase())||"unknown",{msgsLeft:M,bytesLeft:P}=this.parseDiscard(m.headers);if(M>0||P>0)this.pending.msgs-=M,this.pending.bytes-=P,this.pending.requests--,this.notify(ya.Discard,{msgsLeft:M,bytesLeft:P});else if(j===400){this.stop(new De(R,`${j}`));return}else if(j===409&&R==="consumer deleted"){if(this.notify(Vr.ConsumerDeleted,`${j} ${R}`),!this.refilling||this.abortOnMissingResource){const I=new De(R,`${j}`);this.stop(I);return}}else if(j===503){if(this.notify(Vr.NoResponders,`${j} No Responders`),!this.refilling||this.abortOnMissingResource){const I=new De("no responders",`${j}`);this.stop(I);return}}else this.notify(ya.DebugEvent,`${j} ${R}`)}else this._push(Fl(m,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=m.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=c||s&&this.pending.bytes<=o){const j=this.pullOptions();this.pull(j)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Bd(l,d=>(this.notify(Vr.HeartbeatsMissed,d),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var m;const d=this.consumer.api.nc.status();this.statusIterator=d;for await(const b of d)switch(b.type){case di.Disconnect:(m=this.monitor)==null||m.cancel();break;case di.Reconnect:this.resetPending().then(g=>{var x;g&&((x=this.monitor)==null||x.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const s=typeof r=="function"?r:null;try{s?s():this.callback(r)}catch(l){this.stop(l)}}}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let r=0,s=0;const l=zd([this.opts.expires]);let o=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,r=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(c){if(c.message==="stream not found"){if(s++,this.notify(Vr.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(Vr.ConsumerNotFound,r),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(c),!1;if(this.forOrderedConsumer)return!1}else r=0,s=0;this.inBackOff=!0;const f=l.backoff(o),d=ja(f);await Promise.race([d,this.consumer.api.nc.closed()]),d.cancel(),o++}}}pull(r){this.pending.bytes+=r.max_bytes??0,this.pending.msgs+=r.batch??0,this.pending.requests++;const s=this.consumer.api.nc;this._push(()=>{s.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(r),{reply:this.inbox}),this.notify(ya.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=Gt(this.opts.idle_heartbeat),o=Gt(this.opts.expires);return{batch:r,max_bytes:s,idle_heartbeat:l,expires:o}}parseDiscard(r){const s={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(Bn.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const o=r==null?void 0:r.get(Bn.PendingBytesHdr);return o&&(s.bytesLeft=parseInt(o)),s}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,s;(r=this.monitor)==null||r.cancel(),this.monitor=null,(s=this.timeout)==null||s.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var s,l;this.done||((s=this.sub)==null||s.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(o=>{o.stop()})}))}parseOptions(r,s=!1){const l=r||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,s){const o=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||o;const c=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||c}return l}status(){const r=new wn;return this.listeners.push(r),Promise.resolve(r)}}class Hk extends wn{constructor(){super();C(this,"src");C(this,"listeners");this.listeners=[]}setSource(r){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=r,this.src.setCleanupHandler(s=>{this.stop(s||void 0)}),(async()=>{const s=await this.src.status();for await(const l of s)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}stop(r){var s;this.done||((s=this.src)==null||s.stop(r),super.stop(r),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const r=new wn;return this.listeners.push(r),Promise.resolve(r)}}class hd{constructor(t,r){C(this,"api");C(this,"_info");C(this,"stream");C(this,"name");this.api=t,this._info=r,this.stream=r.stream_name,this.name=r.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new Ah(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const r=new Ah(this,t,!1),s=Math.round(r.opts.expires*1.05),l=va(s);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(t={expires:3e4}){const r=Jt(),s=t;s.max_messages=1;const l=new Ah(this,s,!1),o=Math.round(l.opts.expires*1.05);o>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===Vr.HeartbeatsMissed&&f.data>=2){r.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const f of l){r.resolve(f);break}})().catch(()=>{});const c=va(o);return l.closed().then(f=>{f?r.reject(f):r.resolve(null)}).catch(f=>{r.reject(f)}).finally(()=>{c.cancel()}),c.catch(f=>{r.resolve(null),l.close().catch()}),l.trackTimeout(c),r}delete(){const{stream_name:t,name:r}=this._info;return this.api.delete(t,r)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:r,name:s}=this._info;return this.api.info(r,s).then(l=>(this._info=l,this._info))}}class qk{constructor(t,r,s={}){C(this,"api");C(this,"consumerOpts");C(this,"consumer");C(this,"opts");C(this,"cursor");C(this,"stream");C(this,"namePrefix");C(this,"serial");C(this,"currentConsumer");C(this,"userCallback");C(this,"iter");C(this,"type");C(this,"startSeq");C(this,"maxInitialReset");this.api=t,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ki.next(),typeof s.name_prefix=="string"&&(Xu("name_prefix",s.name_prefix),this.namePrefix=s.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Sr.Unset,this.consumerOpts=s,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const r=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const s={name:r,deliver_policy:sn.StartSequence,opt_start_seq:t,ack_policy:vn.None,inactive_threshold:Gt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(s.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(s.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(s.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(s.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(s.deliver_policy=this.consumerOpts.deliver_policy||sn.StartSequence,(this.consumerOpts.deliver_policy===sn.LastPerSubject||this.consumerOpts.deliver_policy===sn.New||this.consumerOpts.deliver_policy===sn.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===sn.LastPerSubject&&typeof s.filter_subjects>"u"&&typeof s.filter_subject>"u"&&(s.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete s.opt_start_seq,s.deliver_policy=sn.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=Gt(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var c,f,d,m,b;Ki.next();const r=this.serial===0;(c=this.consumer)==null||c.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const s=this.getConsumerOpts(t);s.max_deliver=1,s.mem_storage=!0;const l=zd([((f=this.opts)==null?void 0:f.expires)||3e4]);let o;for(let g=0;;g++)try{o=await this.api.add(this.stream,s),(d=this.iter)==null||d.notify(Vr.OrderedConsumerRecreated,o.name);break}catch(x){if(x.message==="stream not found"&&((m=this.iter)==null||m.notify(Vr.StreamNotFound,g),this.type===Sr.Fetch||this.opts.abort_on_missing_resource===!0))return(b=this.iter)==null||b.stop(x),Promise.reject(x);if(r&&g>=this.maxInitialReset)throw x;await ja(l.backoff(g+1))}return o}internalHandler(t){return r=>{var l;if(this.serial!==t)return;const s=r.info.deliverySequence;if(s!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=s,this.cursor.stream_seq=r.info.streamSequence,this.userCallback?this.userCallback(r):(l=this.iter)==null||l.push(r)}}async reset(t={max_messages:100,expires:3e4},r){var d,m;r=r||{};const s=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===Sr.Fetch&&l){(d=this.iter)==null||d.src.stop(),await((m=this.iter)==null?void 0:m.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||s)&&(this.iter=new Hk),this.consumer=new hd(this.api,this.currentConsumer);const o=t;o.callback=this.internalHandler(this.serial);let c=null;this.type===Sr.Fetch&&s?c=await this.consumer.fetch(t):this.type===Sr.Consume&&(c=await this.consumer.consume(t));const f=c;f.forOrderedConsumer=!0,f.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(f)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify(ya.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Sr.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Sr.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=Sr.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var l;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Sr.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=Sr.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const r=t;if(r.bind)return Promise.reject(new Error("bind is not supported"));r.max_messages=1;const s=Jt();return r.callback=o=>{this.userCallback=null,s.resolve(o)},(await this.fetch(r)).iterClosed.then(o=>{o&&s.reject(o),s.resolve(null)}).catch(o=>{s.reject(o)}),s}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class dd{constructor(t){C(this,"api");C(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(gt.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new hd(this.api,t)}async get(t,r={}){return typeof r=="object"?this.ordered(t,r):(await this.checkVersion(),this.api.info(t,r).then(s=>s.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new hd(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(t,r){await this.checkVersion();const s=this.api;return new qd(s.nc,s.opts).info(t).then(o=>Promise.resolve(new qk(this.api,t,r))).catch(o=>Promise.reject(o))}}class Zu{constructor(t,r){C(this,"api");C(this,"_info");this.api=t,this._info=r}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new Zu(this.api,t)}else return this}info(t=!1,r){return t?Promise.resolve(this._info):this.api.info(this.name,r).then(s=>(this._info=s,this._info))}getConsumerFromInfo(t){return new dd(new Du(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new dd(new Du(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,r){return this.api.deleteMessage(this.name,t,r)}}class qd extends Jl{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.metadata){const{min:l,ok:o}=r.features.get(gt.JS_STREAM_CONSUMER_METADATA);if(!o)throw new Error(`stream 'metadata' requires server ${l}`)}if(t.first_seq){const{min:l,ok:o}=r.features.get(gt.JS_STREAM_FIRST_SEQ);if(!o)throw new Error(`stream 'first_seq' requires server ${l}`)}if(t.subject_transform){const{min:l,ok:o}=r.features.get(gt.JS_STREAM_SUBJECT_TRANSFORM);if(!o)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(t.compression){const{min:l,ok:o}=r.features.get(gt.JS_STREAM_COMPRESSION);if(!o)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:o}=r.features.get(gt.JS_DEFAULT_CONSUMER_LIMITS);if(!o)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function s(l,o){var f;if((((f=o==null?void 0:o.subject_transforms)==null?void 0:f.length)||0)>0){const{min:d,ok:m}=r.features.get(gt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!m)throw new Error(`${l} 'subject_transforms' requires server ${d}`)}}t.sources&&t.sources.forEach(l=>{s("stream sources",l)}),t.mirror&&s("stream mirror",t.mirror)}async add(t={}){var l;this.checkStreamConfigVersions(t),Ln(t.name),t.mirror=mu(t.mirror),t.sources=(l=t.sources)==null?void 0:l.map(mu);const s=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(s),s}async delete(t){return Ln(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,r={}){var f;if(typeof t=="object"){const d=t;t=d.name,r=d,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(r),Ln(t);const s=await this.info(t),l=Object.assign(s.config,r);l.mirror=mu(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(mu);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,l);return this._fixInfo(c),c}async info(t,r){Ln(t);const s=`${this.prefix}.STREAM.INFO.${t}`;let o=await this._request(s,r),{total:c,limit:f}=o,d=o.state.subjects?Object.getOwnPropertyNames(o.state.subjects).length:1;if(c&&c>d){const m=[o],b=r||{};let g=0;for(;c>d;){g++,b.offset=f*g;const v=await this._request(s,b);c=v.total,m.push(v);const S=Object.getOwnPropertyNames(v.state.subjects).length;if(d+=S,S<f)break}let x={};for(let v=0;v<m.length;v++)o=m[v],o.state.subjects&&(x=Object.assign(x,o.state.subjects));o.offset=0,o.total=0,o.limit=0,o.state.subjects=x}return this._fixInfo(o),o}list(t=""){const r=t!=null&&t.length?{subject:t}:{},s=o=>{const c=o;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new Nl(l,s,this,r)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,r){if(r){const{keep:l,seq:o}=r;if(typeof l=="number"&&typeof o=="number")throw new Error("can specify one of keep or seq")}return Ln(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){Ln(t);const l={seq:r};return s||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,l)).success}async getMessage(t,r){Ln(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,r);return new Ox(l)}find(t){return this.findStream(t)}listKvs(){const t=s=>{var d;const o=s.streams.filter(m=>m.config.name.startsWith(ar));o.forEach(m=>{this._fixInfo(m)});let c="";return o.length&&(c=((d=this.nc.info)==null?void 0:d.cluster)??""),o.map(m=>new Tx(m,c))},r=`${this.prefix}.STREAM.LIST`;return new Nl(r,t,this)}listObjectStores(){const t=s=>{const o=s.streams.filter(f=>f.config.name.startsWith(Hd));return o.forEach(f=>{this._fixInfo(f)}),o.map(f=>new fd(f))},r=`${this.prefix}.STREAM.LIST`;return new Nl(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=o=>o.streams,l=`${this.prefix}.STREAM.NAMES`;return new Nl(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new Zu(this,r))}}class Ik extends Jl{constructor(t,r){super(t,r)}async getMessage(t,r){Ln(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const o=s?this.jc.encode(s):cr,c=this.opts.apiPrefix||"$JS.API",f=l?`${c}.DIRECT.GET.${t}.${l}`:`${c}.DIRECT.GET.${t}`,d=await this.nc.request(f,o,{timeout:this.timeout}),m=pa(d);if(m)return Promise.reject(m);const b=new md(d);return Promise.resolve(b)}async getBatch(t,r){Ln(t);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(r.multi_last)||r.multi_last.length===0)return Promise.reject("multi_last is required");const o=JSON.stringify(r,(d,m)=>d==="up_to_time"&&m instanceof Date?m.toISOString():m),c=new wn,f=await this.nc.requestMany(l,o,{strategy:Mr.SentinelMsg});return(async()=>{var g,x,v;let d=!1,m=!1,b;for await(const S of f){if(!d){d=!0;const j=((g=S.headers)==null?void 0:g.code)||0;if(j!==0&&j<200||j>299){b=(x=S.headers)==null?void 0:x.description.toLowerCase();break}if(((v=S.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){m=!0;break}}if(S.data.length===0)break;c.push(new md(S))}c.push(()=>{if(m)throw new Error("batch direct get not supported by the server");if(b)throw new Error(`bad request: ${b}`);c.stop()})})(),Promise.resolve(c)}}class md{constructor(t){C(this,"data");C(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(fa.Subject)}get seq(){const t=this.header.last(fa.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(fa.TimeStamp)}get stream(){return this.header.last(fa.Stream)}json(t){return Dr(t).decode(this.data)}string(){return lr.decode(this.data)}}C(md,"jc");class Fk extends Jl{constructor(r,s){super(r,s);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new qd(r,s),this.consumers=new Du(r,s),this.direct=new Ik(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new wn;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(s,l)=>{if(s)throw s;try{const o=this.parseJsResponse(l),c=o.type.split("."),f=c[c.length-1];r.push({kind:f,data:o})}catch(o){r.stop(o)}}}),r}}class Ox{constructor(t){C(this,"_header");C(this,"smr");this.smr=t}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):cr}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=Ji.decode(t)}else this._header=bi();return this._header}_parse(t){const r=atob(t),s=r.length,l=new Uint8Array(s);for(let o=0;o<s;o++)l[o]=r.charCodeAt(o);return l}json(t){return Dr(t).decode(this.data)}string(){return lr.decode(this.data)}}C(Ox,"jc");class $k{constructor(t){C(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new Zu(this.api,r))}}class jh{constructor(t){C(this,"info");C(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Ji.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var t,r;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((r=this.info.options)==null?void 0:r.link)!==null}}function H0(e){const t={name:e.name,description:e.description??"",options:e.options,metadata:e.metadata};if(e.headers){const r=e.headers;t.headers=r.toRecord()}return t}function Vk(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Ml{constructor(t,r,s){C(this,"jsm");C(this,"js");C(this,"stream");C(this,"name");this.name=t,this.jsm=r,this.js=s}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const r=await this.rawInfo(t);return r?new jh(r):null}async list(){const t=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const s of r){if(s===null)break;t.push(s)}return Promise.resolve(t)}async rawInfo(t){const{name:r,error:s}=this._checkNotEmpty(t);if(s)return Promise.reject(s);const l=this._metaSubject(r);try{const o=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=Dr().decode(o.data);return f.revision=o.seq,f}catch(o){return o.code==="404"?null:Promise.reject(o)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(r){return r.code==="404"?null:Promise.reject(r)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new fd(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new fd(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var ue;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout:o,previousRevision:c}=s,f=this.js.nc.info,d=(f==null?void 0:f.max_payload)||1024;t=t||{},t.options=t.options||{};let m=((ue=t.options)==null?void 0:ue.max_chunk_size)||128*1024;m=m>d?d:m,t.options.max_chunk_size=m;const b=await this.info(t.name),{name:g,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=Ki.next(),S=this._chunkSubject(v),j=this._metaSubject(g),R=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},H0(t)),M=Jt(),P=[],I=new Sa;try{const q=r?r.getReader():null,N=N0.create();for(;;){const{done:ee,value:G}=q?await q.read():{done:!0,value:void 0};if(ee){if(I.size()>0){const $=I.drain();N.update($),R.chunks++,R.size+=$.length,P.push(this.js.publish(S,$,{timeout:o}))}await Promise.all(P),P.length=0,R.mtime=new Date().toISOString();const B=ga.encode(N.digest());R.digest=`${P0}${B}`,R.deleted=!1;const L=bi();typeof c=="number"&&L.set($r.ExpectedLastSubjectSequenceHdr,`${c}`),L.set(Bn.RollupHdr,Bn.RollupValueSubject);const J=await this.js.publish(j,Dr().encode(R),{headers:L,timeout:o});if(R.revision=J.seq,b)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${b.nuid}`})}catch{}M.resolve(new jh(R));break}if(G)for(I.fill(G);I.size()>m;){R.chunks++,R.size+=m;const B=I.drain(t.options.max_chunk_size);N.update(B),P.push(this.js.publish(S,B,{timeout:o}))}}}catch(q){await this.jsm.streams.purge(this.stream,{filter:S}),M.reject(q)}return M}putBlob(t,r,s){function l(o){return new ReadableStream({pull(c){c.enqueue(o),c.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(t,l(r),s)}put(t,r,s){var l;return(l=t==null?void 0:t.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,r,s)}async getBlob(t){async function r(o){const c=new Sa,f=o.getReader();for(;;){const{done:d,value:m}=await f.read();if(d)return c.drain();m&&m.length&&c.fill(m)}}const s=await this.get(t);if(s===null)return Promise.resolve(null);const l=await Promise.all([s.error,r(s.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(t){const r=await this.rawInfo(t);if(r===null||r.deleted)return Promise.resolve(null);if(r.options&&r.options.link){const g=r.options.link.name||"";if(g==="")throw new Error("link is a bucket");return(r.options.link.bucket!==this.name?await Ml.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(P0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=ad(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Jt(),o={info:new jh(r),error:l};if(r.size===0)return o.data=Vk(),l.resolve(null),Promise.resolve(o);let c;const f=Xi();f.orderedConsumer();const d=N0.create(),m=`$O.${this.name}.C.${r.nuid}`,b=await this.js.subscribe(m,f);return(async()=>{for await(const g of b)g.data.length>0&&(d.update(g.data),c.enqueue(g.data)),g.info.pending===0&&(w2(s,d.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),b.unsubscribe())})().then(()=>{l.resolve()}).catch(g=>{c.error(g),l.reject(g)}),o.data=new ReadableStream({start(g){c=g},cancel(){b.unsubscribe()}}),o}linkStore(t,r){if(!(r instanceof Ml))return Promise.reject("bucket required");const s=r,{name:l,error:o}=this._checkNotEmpty(t);if(o)return Promise.reject(o);const c={name:l,options:{link:{bucket:s.name}}};return this._put(c,null)}async link(t,r){const{name:s,error:l}=this._checkNotEmpty(t);if(l)return Promise.reject(l);if(r.deleted)return Promise.reject(new Error("src object is deleted"));if(r.isLink())return Promise.reject(new Error("src object is a link"));const o=await this.rawInfo(t);if(o!==null&&!o.deleted)return Promise.reject(new Error("an object already exists with that name"));const c={bucket:r.bucket,name:r.name},f={name:s,bucket:r.bucket,options:{link:c}};await this.js.publish(this._metaSubject(t),JSON.stringify(f));const d=await this.info(t);return Promise.resolve(d)}async delete(t){const r=await this.rawInfo(t);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const s=Dr(),l=bi();return l.set(Bn.RollupHdr,Bn.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),s.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(t,r={}){const s=await this.rawInfo(t);if(s===null)return Promise.reject(new Error("object not found"));if(s.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??s.name;const{name:l,error:o}=this._checkNotEmpty(r.name);if(o)return Promise.reject(o);if(t!==r.name){const d=await this.info(r.name);if(d&&!d.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const c=Object.assign({},s,H0(r)),f=await this.js.publish(this._metaSubject(c.name),JSON.stringify(c));return t!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(f)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let r=!1;const s=new wn,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(d){d.code==="404"?(s.push(null),r=!0):s.stop(d)}const o=Dr(),c=Xi();c.orderedConsumer(),t.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((d,m)=>{var b;if(d){s.stop(d);return}if(m!==null){const g=o.decode(m.data);g.deleted&&t.ignoreDeletes===!0||s.push(g),((b=m.info)==null?void 0:b.pending)===0&&!r&&(r=!0,s.push(null))}});const f=await this.js.subscribe(l,c);return s._data=f,s.iterClosed.then(()=>{f.unsubscribe()}),f.closed.then(()=>{s.stop()}).catch(d=>{s.stop(d)}),s}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${ga.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=Dk(this.name)}catch(l){return Promise.reject(l)}const r=(t==null?void 0:t.ttl)||0;delete t.ttl;const s=Object.assign({max_age:r},t);s.name=this.stream,s.num_replicas=t.replicas??1,s.allow_direct=!0,s.allow_rollup_hdrs=!0,s.discard=Hl.New,s.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(s.placement=t.placement),t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?Qi.S2:Qi.None);try{await this.jsm.streams.info(s.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(s)}}static async create(t,r,s={}){const l=await t.jetstreamManager(),o=new Ml(r,l,t);return await o.init(s),Promise.resolve(o)}}class Yk{constructor(t){C(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:o}=s.nc.features.get(gt.JS_KV);return l?r.bindOnly?Il.bind(this.js,t,r):Il.create(this.js,t,r):Promise.reject(new Error(`kv is only supported on servers ${o} or better`))}os(t,r={}){var c;if(typeof((c=crypto==null?void 0:crypto.subtle)==null?void 0:c.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const s=this.js,{ok:l,min:o}=s.nc.features.get(gt.JS_OBJECTSTORE);return l?Ml.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${o} or better`))}}class Id extends Jl{constructor(r,s){super(r,s);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new Du(r,s),this.streamAPI=new qd(r,s),this.consumers=new dd(this.consumerAPI),this.streams=new $k(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const s=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(s)}get apiPrefix(){return this.prefix}get views(){return new Yk(this)}async publish(r,s=cr,l){l=l||{},l.expect=l.expect||{};const o=(l==null?void 0:l.headers)||bi();l&&(l.msgID&&o.set($r.MsgIdHdr,l.msgID),l.expect.lastMsgID&&o.set($r.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&o.set($r.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&o.set($r.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&o.set($r.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=o);let{retries:d,retry_delay:m}=l;d=d||1,m=m||250;let b;for(let x=0;x<d;x++)try{b=await this.nc.request(r,s,f);break}catch(v){if(v.code==="503"&&x+1<d)await ja(m);else throw v}const g=this.parseJsResponse(b);if(g.stream==="")throw De.errorForCode(Ce.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){Ln(r),ma(s);let o=this.timeout;l>o&&(o=l),l=l<0?0:Gt(l);const c={batch:1,no_wait:l===0,expires:l},f=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(c),{noMux:!0,timeout:o}),d=pa(f);if(d)throw d;return Fl(f,this.timeout)}fetch(r,s,l={}){Ln(r),ma(s);let o=null;const c=(l.max_bytes??0)>0;let f=0;const d=c?l.max_bytes:0;let m=null;const b={};if(b.batch=l.batch||1,d){const P=this.nc.features.get(gt.JS_PULL_MAX_BYTES);if(!P.ok)throw new Error(`max_bytes is only supported on servers ${P.min} or better`);b.max_bytes=d}b.no_wait=l.no_wait||!1,b.no_wait&&b.expires&&(b.expires=0);const g=l.expires||0;if(g&&(b.expires=Gt(g)),g===0&&b.no_wait===!1)throw new Error("expires or no_wait is required");const x=l.idle_heartbeat||0;x&&(b.idle_heartbeat=Gt(x),l.delay_heartbeat===!0&&(b.idle_heartbeat=Gt(x*4)));const v=new wn,S=b.batch;let j=0;v.protocolFilterFn=(P,I=!1)=>rd(P.msg)?(m==null||m.work(),!1):!0,v.dispatchedFn=P=>{if(P){if(c&&(f+=P.data.length),j++,o&&P.info.pending===0)return;(v.getPending()===1&&P.info.pending===0||S===j||d>0&&f>=d)&&v.stop()}};const R=gi(this.nc.options.inboxPrefix),M=this.nc.subscribe(R,{max:l.batch,callback:(P,I)=>{P===null&&(P=pa(I)),P!==null?(o&&(o.cancel(),o=null),n2(P)?v.stop(Mx(P)===null?void 0:P):v.stop(P)):(m==null||m.work(),v.received++,v.push(Fl(I,this.timeout)))}});return g&&(o=va(g),o.catch(()=>{M.isClosed()||(M.drain().catch(()=>{}),o=null),m&&m.cancel()})),(async()=>{try{x&&(m=new Bd(x,P=>(v.push(()=>{v.err=new De(`${_r.IdleHeartbeatMissed}: ${P}`,Ce.JetStreamIdleHeartBeat)}),!0)))}catch{}await M.closed,o!==null&&(o.cancel(),o=null),m&&m.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(b),{reply:R}),v}async pullSubscribe(r,s=Xi()){const l=await this._processOptions(r,s);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const o=l.config.ack_policy;if(o===vn.None||o===vn.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new Kk(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(d){throw f.unsubscribe(),d}return f}async subscribe(r,s=Xi()){const l=await this._processOptions(r,s);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const o=this._buildTypedSubscriptionOpts(l),c=new Rx(this,l.deliver,o);c.info=l;try{await this._maybeCreateConsumer(l)}catch(f){throw c.unsubscribe(),f}return c._maybeSetupHbMonitoring(),c}async _processOptions(r,s=Xi()){const l=E0(s)?s.getOpts():s;if(l.isBind=E0(s)?s.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==vn.NotSet&&l.config.ack_policy!==vn.None)throw new De("ordered consumer: ack_policy can only be set to 'none'",Ce.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new De("ordered consumer: durable_name cannot be set",Ce.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new De("ordered consumer: deliver_subject cannot be set",Ce.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new De("ordered consumer: max_deliver cannot be set",Ce.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new De("ordered consumer: deliver_group cannot be set",Ce.ApiError);l.config.deliver_subject=gi(this.nc.options.inboxPrefix),l.config.ack_policy=vn.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||Gt(5e3),l.config.ack_wait=Gt(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===vn.NotSet&&(l.config.ack_policy=vn.All),l.api=this,l.config=l.config||{},l.stream=l.stream?l.stream:await this.findStream(r),l.attached=!1,l.config.durable_name)try{const o=await this.consumerAPI.info(l.stream,l.config.durable_name);if(o){if(o.config.filter_subject&&o.config.filter_subject!==r)throw new Error("subject does not match consumer");const c=l.config.deliver_group??"";if(c===""&&o.push_bound===!0)throw new Error("duplicate subscription");const f=o.config.deliver_group??"";if(c!==f)throw f===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${f}'`);l.last=o,l.config=o.config,l.attached=!0,l.config.durable_name||(l.name=o.name)}}catch(o){if(o.code!=="404")throw o}return!l.attached&&l.config.filter_subject===void 0&&l.config.filter_subjects===void 0&&(l.config.filter_subject=r),l.deliver=l.config.deliver_subject||gi(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=Qk(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Id.ingestionFn(r.ordered),s.protocolFilterFn=(l,o=!1)=>{const c=l;return nd(c.msg)?(o||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==vn.None&&(s.dispatchedFn=eE),r.callbackFn&&(s.callback=r.callbackFn),s.max=r.max||0,s.queue=r.queue,s}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:sn.All,ack_policy:vn.Explicit,ack_wait:Gt(30*1e3),replay_policy:wa.Instant},r.config);const s=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(s.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=s.name,r.config=s.config,r.last=s}static ingestionFn(r){return(s,l)=>{var d;const o=l;if(!s)return{ingest:!1,protocol:!1};const c=s;if(pa(c.msg)||(d=o.monitor)==null||d.work(),rd(c.msg)){const m=r?o._checkHbOrderConsumer(c.msg):!0;return r||o.info.flow_control.heartbeat_count++,{ingest:m,protocol:!0}}else if(nd(c.msg))return o.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?o._checkOrderedConsumer(s):!0,protocol:!1}}}}class Fd{constructor(t){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=pk(t),this.listeners=[]}static connect(t={}){return new Promise((r,s)=>{const l=new Fd(t);Uu.connect(l.options,l).then(o=>{l.protocol=o,(async function(){for await(const c of o.status())l.listeners.forEach(f=>{f.push(c)})})(),r(l)}).catch(o=>{s(o)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,r,s){if(this.isClosed())throw De.errorForCode(Ce.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw De.errorForCode(Ce.ConnectionDraining);if(t=t||"",t.length===0)throw De.errorForCode(Ce.BadSubject)}publish(t,r,s){this._check(t,!1,!0),this.protocol.publish(t,r,s)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,r={}){this._check(t,!0,!1);const s=new jx(this.protocol,t,r);return this.protocol.subscribe(s),s}_resub(t,r,s){this._check(r,!0,!1);const l=t;l.max=s,s&&(l.max=s+l.received),this.protocol.resub(l,r)}requestMany(t,r=cr,s={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(d){return Promise.reject(d)}if(s.strategy=s.strategy||Mr.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new De("timeout",Ce.InvalidOption));const o=new wn;function c(d){o.push(()=>{o.stop(d)})}function f(d,m){d||m===null?c(d===null?void 0:d):o.push(m)}if(s.noMux){const d=l?new Error().stack:null;let m=typeof s.maxMessages=="number"&&s.maxMessages>0?s.maxMessages:-1;const b=this.subscribe(gi(this.options.inboxPrefix),{callback:(S,j)=>{var R,M;if(((R=j==null?void 0:j.data)==null?void 0:R.length)===0&&((M=j==null?void 0:j.headers)==null?void 0:M.status)===Ce.NoResponders&&(S=De.errorForCode(Ce.NoResponders)),S){d&&(S.stack+=`
|
|
82
82
|
|
|
83
|
-
${d}`),g(S);return}f(null,
|
|
83
|
+
${d}`),g(S);return}f(null,j),s.strategy===Mr.Count&&(m--,m===0&&g()),s.strategy===Mr.JitterTimer&&(v(),x=setTimeout(()=>{g()},300)),s.strategy===Mr.SentinelMsg&&j&&j.data.length===0&&g()}});b.requestSubject=t,b.closed.then(()=>{c()}).catch(S=>{o.stop(S)});const g=S=>{S&&o.push(()=>{throw S}),v(),b.drain().then(()=>{c()}).catch(j=>{c()})};o.iterClosed.then(()=>{v(),b==null||b.unsubscribe()}).catch(S=>{v(),b==null||b.unsubscribe()});try{this.publish(t,r,{reply:b.getSubject()})}catch(S){g(S)}let x=setTimeout(()=>{g()},s.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const d=s;d.callback=f,o.iterClosed.then(()=>{m.cancel()}).catch(b=>{m.cancel(b)});const m=new S2(this.protocol.muxSubscriptions,t,d);this.protocol.request(m);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${m.token}`,headers:s.headers})}catch(b){m.cancel(b)}}return Promise.resolve(o)}request(t,r,s={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(o){return Promise.reject(o)}const l=!this.protocol.options.noAsyncTraces;if(s.timeout=s.timeout||1e3,s.timeout<1)return Promise.reject(new De("timeout",Ce.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new De("reply can only be used with noMux",Ce.InvalidOption));if(s.noMux){const o=s.reply?s.reply:gi(this.options.inboxPrefix),c=Jt(),f=l?new Error:null,d=this.subscribe(o,{max:1,timeout:s.timeout,callback:(m,b)=>{m?(f&&m.code!==Ce.Timeout&&(m.stack+=`
|
|
84
84
|
|
|
85
85
|
${f.stack}`),d.unsubscribe(),c.reject(m)):(m=gx(b),m?(f&&(m.stack+=`
|
|
86
86
|
|
|
87
|
-
${f.stack}`),c.reject(m)):c.resolve(b))}});return d.requestSubject=t,this.protocol.publish(t,r,{reply:o,headers:s.headers}),c}else{const o=new xx(this.protocol.muxSubscriptions,t,s,l);this.protocol.request(o);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${o.token}`,headers:s.headers})}catch(f){o.cancel(f)}const c=Promise.race([o.timer,o.deferred]);return c.catch(()=>{o.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(De.errorForCode(Ce.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(De.errorForCode(Ce.ConnectionClosed)):this.isDraining()?Promise.reject(De.errorForCode(Ce.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new vn;return t.iterClosed.then(()=>{const r=this.listeners.indexOf(t);this.listeners.splice(r,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((r,s)=>r==="time"?new Date(Date.parse(s)):s)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const r=new Fk(this,t);if(t.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===Ce.NoResponders&&(l.code=Ce.JetStreamNotEnabled),l}return r}jetstream(t={}){return new Id(this,t)}getServerVersion(){const t=this.info;return t?ws(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw De.errorForCode(Ce.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new Gk(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(De.errorForCode(Ce.ConnectionClosed)):this.isDraining()?Promise.reject(De.errorForCode(Ce.ConnectionDraining)):this.protocol.reconnect()}}class Gk{constructor(t){C(this,"nc");this.nc=t}add(t){try{return new Xl(this.nc,t).start()}catch(r){return Promise.reject(r)}}client(t,r){return new Ck(this.nc,t,r)}}class Jk{constructor(t,r,s){C(this,"bucket");C(this,"sm");C(this,"prefixLen");this.bucket=t,this.prefixLen=r,this.sm=s}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Pu)||"PUT"}get length(){const t=this.sm.header.get(Bn.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Xk{constructor(t,r,s){C(this,"bucket");C(this,"key");C(this,"sm");this.bucket=t,this.key=r,this.sm=s}get value(){return this.sm.data}get created(){return new Date(Ud(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(Pu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const t=((r=this.sm.headers)==null?void 0:r.get(Bn.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Rx extends C2{constructor(r,s,l){super(r.nc,s,l);C(this,"js");C(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const s=gi(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const o=this.info;o.config.name=Ki.next(),o.ordered_consumer_sequence.delivery_seq=0,o.flow_control.heartbeat_count=0,o.flow_control.fc_count=0,o.flow_control.consumer_restarts++,o.deliver=s,o.config.deliver_subject=s,o.config.deliver_policy=an.StartSequence,o.config.opt_start_seq=r;const c={};c.stream_name=this.info.stream,c.config=o.config;const f=`${o.api.prefix}.CONSUMER.CREATE.${o.stream}`;this.js._request(f,c,{retries:-1}).then(d=>{const m=d,b=this.sub.info;b.last=m,this.info.config=m.config,this.info.name=m.name}).catch(d=>{const m=new De(`unable to recreate ordered consumer ${o.stream} at seq ${r}`,Ce.RequestError,d);this.sub.callback(m,{})})}_maybeSetupHbMonitoring(){var s,l;const r=((l=(s=this.info)==null?void 0:s.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(Ud(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const o=this.sub,c=f=>{var b,g,x,v;const d=a2(409,`${Sr.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((b=this.info)==null?void 0:b.ordered))this.sub.callback(null,d);else{if(!this.js.nc.protocol.connected)return!1;const S=((x=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(S+1),(v=this.monitor)==null||v.restart(),!1}return!o.noIterator};this.monitor=new Bd(r,c,l)}_checkHbOrderConsumer(r){const s=r.headers.get(Bn.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(Bn.LastConsumerSeqHdr),10),o=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==o.delivery_seq&&this._resetOrderedConsumer(o.stream_seq+1),!1}_checkOrderedConsumer(r){const s=this.info.ordered_consumer_sequence,l=r.info.streamSequence,o=r.info.deliverySequence;return o!=s.delivery_seq+1?(this._resetOrderedConsumer(s.stream_seq+1),!1):(s.delivery_seq=o,s.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${s}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${s}`,o=await r.api._request(l);return r.last=o,o}}class Kk extends Rx{constructor(t,r,s){super(t,r,s)}pull(t={batch:1}){const{stream:r,config:s,name:l}=this.sub.info,o=s.durable_name??l,c={};if(c.batch=t.batch||1,c.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const m=this.js.nc.features.get(pt.JS_PULL_MAX_BYTES);if(!m.ok)throw new Error(`max_bytes is only supported on servers ${m.min} or better`);c.max_bytes=t.max_bytes}let f=0;t.expires&&t.expires>0&&(f=t.expires,c.expires=$t(f));let d=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(d=t.idle_heartbeat,c.idle_heartbeat=$t(d)),d&&f===0)throw new Error("idle_heartbeat requires expires");if(d>f)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),f&&d&&(this.monitor?this.monitor._change(d,f):this._setupHbMonitoring(d,f));const m=this.info.api,b=`${m.prefix}.CONSUMER.MSG.NEXT.${r}.${o}`,g=this.sub.subject;m.nc.publish(b,m.jc.encode(c),{reply:g})}}}function Qk(e,t){return e?Wk(t):Zk(t)}function Zk(e){return(t,r)=>t?[t,null]:(t=pa(r),t?[t,null]:[null,Fl(r,e)])}function Wk(e){return(t,r)=>{if(t)return[t,null];const s=pa(r);return s!==null?[Mx(s),null]:[null,Fl(r,e)]}}function Mx(e){if(e!==null)switch(e.code){case Ce.JetStream404NoMessages:case Ce.JetStream408RequestTimeout:return null;case Ce.JetStream409:return l2(e)?e:null;default:return e}return null}function eE(e){e&&e.ack()}function tE(e){const t=e.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const r={};return r.domain=t[2]==="_"?"":t[2],r.account_hash=t[3],r.stream=t[4],r.consumer=t[5],r.deliveryCount=parseInt(t[6],10),r.redeliveryCount=r.deliveryCount,r.redelivered=r.deliveryCount>1,r.streamSequence=parseInt(t[7],10),r.deliverySequence=parseInt(t[8],10),r.timestampNanos=parseInt(t[9],10),r.pending=parseInt(t[10],10),r}class nE{constructor(t,r){C(this,"msg");C(this,"di");C(this,"didAck");C(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=r}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=tE(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===Sl[0]&&t[1]===Sl[1]&&t[2]===Sl[2]&&t[3]===Sl[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=Vt();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const o=this.msg.publisher,c=!((s=o.options)!=null&&s.noAsyncTraces),f=new xx(o.muxSubscriptions,this.msg.reply,{timeout:t.timeout},c);o.request(f);try{o.publish(this.msg.reply,B0,{reply:`${o.muxSubscriptions.baseInbox}${f.token}`})}catch(d){f.cancel(d)}try{await Promise.race([f.timer,f.deferred]),r.resolve(!0)}catch(d){f.cancel(d),r.reject(d)}}else r.resolve(!1);return r}ack(){this.doAck(B0)}nak(t){let r=zk;t&&(r=Ru().encode(`-NAK ${JSON.stringify({delay:$t(t)})}`)),this.doAck(r)}working(){this.doAck(Sl)}next(t,r={batch:1}){const s={};s.batch=r.batch||1,s.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(s.expires=$t(r.expires));const l=Mr().encode(s),o=Sa.concat(Uk,Bk,l),c=t?{reply:t}:void 0;this.msg.respond(o,c)}term(t=""){let r=Pk;(t==null?void 0:t.length)>0&&(r=Ru().encode(`+TERM ${t}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const rE="1.30.3",iE="nats.ws";class sE{constructor(){C(this,"version");C(this,"lang");C(this,"closeError");C(this,"connected");C(this,"done");C(this,"socket");C(this,"options");C(this,"socketClosed");C(this,"encrypted");C(this,"peeked");C(this,"yields");C(this,"signal");C(this,"closedNotification");this.version=rE,this.lang=iE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Vt(),this.closedNotification=Vt()}async connect(t,r){const s=Vt();if(r.tls)return s.reject(new De("tls",Ce.InvalidOption)),s;this.options=r;const l=t.src;if(r.wsFactory){const{socket:o,encrypted:c}=await r.wsFactory(t.src,r);this.socket=o,this.encrypted=c}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=o=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(o.data)),this.peeked){this.signal.resolve();return}const c=Sa.concat(...this.yields),f=R2(c);if(f!==""){const d=bk.exec(f);if(!d){r.debug&&console.error("!!!",fu(c)),s.reject(new Error("unexpected response from server"));return}try{const m=JSON.parse(d[1]);gk(m,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(m){s.reject(m);return}}},this.socket.onclose=o=>{if(this.isDiscarded())return;this.socketClosed=!0;let c;this.done||(o.wasClean||(c=new Error(o.reason)),this._closed(c))},this.socket.onerror=o=>{if(this.isDiscarded())return;const c=o,f=new De(c.message,Ce.Unknown,new Error(c.error));s.reject(f)},s}disconnect(){this._closed(void 0,!0)}async _closed(t,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ja(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}r&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let r=0;r<t.length;r++)this.options.debug&&console.info(`> ${fu(t[r])}`),yield t[r];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=Vt())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${fu(t)}`);return}catch(r){this.options.debug&&console.error(`!!! ${fu(t)}: ${r}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function aE(e,t){/^(.*:\/\/)(.*)/.test(e)||(typeof t=="boolean"?e=`${t===!0?"https":"http"}://${e}`:e=`https://${e}`);let s=new URL(e);const l=s.protocol.toLowerCase();l==="ws:"&&(t=!1),l==="wss:"&&(t=!0),l!=="https:"&&l!=="http"&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2"),s=new URL(`http://${e}`));let o,c;const f=s.hostname,d=s.pathname,m=s.search||"";switch(l){case"http:":case"ws:":case"nats:":c=s.port||"80",o="ws:";break;case"https:":case"wss:":case"tls:":c=s.port||"443",o="wss:";break;default:c=s.port||t===!0?"443":"80",o=t===!0?"wss:":"ws:";break}return`${o}//${f}:${c}${d}${m}`}function Dx(e={}){return A2({defaultPort:443,urlParseFn:aE,factory:()=>new sE}),Fd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var _a;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(_a||(_a={}));class Nh extends Error{constructor(t,r,s){super(t),this.message=t,this.code=r,this.data=s}}const lE=e=>{var t,r;return e!=null&&e.androidBridge?"android":!((r=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},oE=e=>{const t=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>t!==null?t.name:lE(e),o=()=>l()!=="web",c=g=>{const x=m.get(g);return!!(x!=null&&x.platforms.has(l())||f(g))},f=g=>{var x;return(x=r.PluginHeaders)===null||x===void 0?void 0:x.find(v=>v.name===g)},d=g=>e.console.error(g),m=new Map,b=(g,x={})=>{const v=m.get(g);if(v)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),v.proxy;const S=l(),A=f(g);let O;const M=async()=>(!O&&S in x?O=typeof x[S]=="function"?O=await x[S]():O=x[S]:t!==null&&!O&&"web"in x&&(O=typeof x.web=="function"?O=await x.web():O=x.web),O),P=(J,B)=>{var D,G;if(A){const F=A==null?void 0:A.methods.find(fe=>B===fe.name);if(F)return F.rtype==="promise"?fe=>r.nativePromise(g,B.toString(),fe):(fe,oe)=>r.nativeCallback(g,B.toString(),fe,oe);if(J)return(D=J[B])===null||D===void 0?void 0:D.bind(J)}else{if(J)return(G=J[B])===null||G===void 0?void 0:G.bind(J);throw new Nh(`"${g}" plugin is not implemented on ${S}`,_a.Unimplemented)}},I=J=>{let B;const D=(...G)=>{const F=M().then(fe=>{const oe=P(fe,J);if(oe){const ne=oe(...G);return B=ne==null?void 0:ne.remove,ne}else throw new Nh(`"${g}.${J}()" is not implemented on ${S}`,_a.Unimplemented)});return J==="addListener"&&(F.remove=async()=>B()),F};return D.toString=()=>`${J.toString()}() { [capacitor code] }`,Object.defineProperty(D,"name",{value:J,writable:!1,configurable:!1}),D},te=I("addListener"),q=I("removeListener"),L=(J,B)=>{const D=te({eventName:J},B),G=async()=>{const fe=await D;q({eventName:J,callbackId:fe},B)},F=new Promise(fe=>D.then(()=>fe({remove:G})));return F.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await G()},F},ee=new Proxy({},{get(J,B){switch(B){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return A?L:te;case"removeListener":return q;default:return I(B)}}});return s[g]=ee,m.set(g,{name:g,proxy:ee,platforms:new Set([...Object.keys(x),...A?[S]:[]])}),ee};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=d,r.isNativePlatform=o,r.isPluginAvailable=c,r.registerPlugin=b,r.Exception=Nh,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},uE=e=>e.Capacitor=oE(e),Gn=uE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ks=Gn.registerPlugin;class $d{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,r){let s=!1;this.listeners[t]||(this.listeners[t]=[],s=!0),this.listeners[t].push(r);const o=this.windowListeners[t];o&&!o.registered&&this.addWindowListener(o),s&&this.sendRetainedArgumentsForEvent(t);const c=async()=>this.removeListener(t,r);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,r,s){const l=this.listeners[t];if(!l){if(s){let o=this.retainedEventArguments[t];o||(o=[]),o.push(r),this.retainedEventArguments[t]=o}return}l.forEach(o=>o(r))}hasListeners(t){var r;return!!(!((r=this.listeners[t])===null||r===void 0)&&r.length)}registerWindowListener(t,r){this.windowListeners[r]={registered:!1,windowEventName:t,pluginEventName:r,handler:s=>{this.notifyListeners(r,s)}}}unimplemented(t="not implemented"){return new Gn.Exception(t,_a.Unimplemented)}unavailable(t="not available"){return new Gn.Exception(t,_a.Unavailable)}async removeListener(t,r){const s=this.listeners[t];if(!s)return;const l=s.indexOf(r);this.listeners[t].splice(l,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const r=this.retainedEventArguments[t];r&&(delete this.retainedEventArguments[t],r.forEach(s=>{this.notifyListeners(t,s)}))}}const q0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),I0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class cE extends $d{async getCookies(){const t=document.cookie,r={};return t.split(";").forEach(s=>{if(s.length<=0)return;let[l,o]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=I0(l).trim(),o=I0(o).trim(),r[l]=o}),r}async setCookie(t){try{const r=q0(t.key),s=q0(t.value),l=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",o=(t.path||"/").replace("path=",""),c=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${r}=${s||""}${l}; path=${o}; ${c};`}catch(r){return Promise.reject(r)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const r of t)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}ks("CapacitorCookies",{web:()=>new cE});const fE=async e=>new Promise((t,r)=>{const s=new FileReader;s.onload=()=>{const l=s.result;t(l.indexOf(",")>=0?l.split(",")[1]:l)},s.onerror=l=>r(l),s.readAsDataURL(e)}),hE=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,o,c)=>(l[o]=e[t[c]],l),{})},dE=(e,t=!0)=>e?Object.entries(e).reduce((s,l)=>{const[o,c]=l;let f,d;return Array.isArray(c)?(d="",c.forEach(m=>{f=t?encodeURIComponent(m):m,d+=`${o}=${f}&`}),d.slice(0,-1)):(f=t?encodeURIComponent(c):c,d=`${o}=${f}`),`${s}&${d}`},"").substr(1):null,mE=(e,t={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},t),l=hE(e.headers)["content-type"]||"";if(typeof e.data=="string")r.body=e.data;else if(l.includes("application/x-www-form-urlencoded")){const o=new URLSearchParams;for(const[c,f]of Object.entries(e.data||{}))o.set(c,f);r.body=o.toString()}else if(l.includes("multipart/form-data")||e.data instanceof FormData){const o=new FormData;if(e.data instanceof FormData)e.data.forEach((f,d)=>{o.append(d,f)});else for(const f of Object.keys(e.data))o.append(f,e.data[f]);r.body=o;const c=new Headers(r.headers);c.delete("content-type"),r.headers=c}else(l.includes("application/json")||typeof e.data=="object")&&(r.body=JSON.stringify(e.data));return r};class pE extends $d{async request(t){const r=mE(t,t.webFetchExtra),s=dE(t.params,t.shouldEncodeUrlParams),l=s?`${t.url}?${s}`:t.url,o=await fetch(l,r),c=o.headers.get("content-type")||"";let{responseType:f="text"}=o.ok?t:{};c.includes("application/json")&&(f="json");let d,m;switch(f){case"arraybuffer":case"blob":m=await o.blob(),d=await fE(m);break;case"json":d=await o.json();break;case"document":case"text":default:d=await o.text()}const b={};return o.headers.forEach((g,x)=>{b[x]=g}),{data:d,headers:b,status:o.status,url:o.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}ks("CapacitorHttp",{web:()=>new pE});var F0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(F0||(F0={}));var $0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})($0||($0={}));class gE extends $d{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}ks("SystemBars",{web:()=>new gE});const yE="modulepreload",bE=function(e){return"/"+e},V0={},Vd=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let c=function(m){return Promise.all(m.map(b=>Promise.resolve(b).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),d=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=c(r.map(m=>{if(m=bE(m),m in V0)return;V0[m]=!0;const b=m.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const x=document.createElement("link");if(x.rel=b?"stylesheet":yE,b||(x.as="script"),x.crossOrigin="",x.href=m,d&&x.setAttribute("nonce",d),document.head.appendChild(x),b)return new Promise((v,S)=>{x.addEventListener("load",v),x.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${m}`)))})}))}function o(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return l.then(c=>{for(const f of c||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})},pd=ks("App",{web:()=>Vd(()=>import("./web-DtlUNQHI.js"),[]).then(e=>new e.AppWeb)}),xE=ks("Network",{web:()=>Vd(()=>import("./web-B4ZYORQP.js"),[]).then(e=>new e.NetworkWeb)}),Bu=Gn.isNativePlatform()?"https://app.palmier.me":"";async function Lx(e,t,r,s){const l=`${Bu}${t}`;console.log(`[API] ${e} ${l}`);const c=await fetch(l,{method:e,headers:{"Content-Type":"application/json"},body:r!=null?JSON.stringify(r):void 0});if(!c.ok){const f=await c.text();let d;try{const m=JSON.parse(f);d=m.error??m.message??f}catch{d=f}throw console.error(`[API] ${e} ${t} failed:`,c.status,d),new Error(d||`Request failed with status ${c.status}`)}return console.log(`[API] ${e} ${t} ->`,c.status),c.json()}function vE(e,t,r){return Lx("POST",e,t)}function wE(e,t){return Lx("GET",e,void 0)}const Y0=Gn.isNativePlatform(),zx=E.createContext(null),SE=2e3,Th=6e3,_E=1500,kE=6e4;function EE({children:e,activeHost:t}){const[r,s]=E.useState(null),[l,o]=E.useState(!1),c=E.useRef(null),[f,d]=E.useState(!1),[m,b]=E.useState(!1),[g,x]=E.useState(!1),[v,S]=E.useState(!1),A=E.useRef(Ru()),O=E.useRef(new Set),M=E.useRef(0),P=!!t.directUrl,I=Y0&&!P&&!!t.lanUrl&&v,te=m||g?"disconnected":P?f?"direct":"connecting":l?I?"lan":"nats":"connecting",q=te!=="connecting"&&te!=="disconnected";E.useEffect(()=>{if(!Y0||P||!t.lanUrl){S(!1);return}let J=!1;const B=t.lanUrl,D=t.hostId;async function G(){console.log("[HOST/LAN] probing",B);try{const ne=await fetch(`${B}/health`,{signal:AbortSignal.timeout(_E)});if(J)return;if(!ne.ok){console.log("[HOST/LAN] probe got non-ok:",ne.status),S(!1);return}const V=await ne.json(),Q=V.hostId===D;Q?console.log("[HOST/LAN] reachable"):console.log("[HOST/LAN] hostId mismatch — got:",V.hostId,"expected:",D),S(Q)}catch(ne){J||(console.log("[HOST/LAN] probe failed:",ne instanceof Error?ne.message:ne),S(!1))}}G();const F=window.setInterval(G,kE),fe=pd.addListener("appStateChange",ne=>{ne.isActive&&G()}),oe=xE.addListener("networkStatusChange",()=>G());return()=>{J=!0,clearInterval(F),fe.then(ne=>ne.remove()),oe.then(ne=>ne.remove())}},[t.hostId,t.lanUrl,P]),E.useEffect(()=>{if(P){c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),o(!1));return}let J=!1,B=1e3;const D=3e4;async function G(){for(;!J;)try{const F=await fetch(`${Bu}/api/nats-credentials/${t.hostId}`);if(J)return;if(F.status===401||F.status===403||F.status===404){console.error("[NATS] Host not found or rejected by relay:",F.status),x(!0);return}if(!F.ok)throw new Error(`credentials fetch ${F.status}`);const fe=await F.json();if(!fe.natsWsUrl){console.error("[NATS] Relay returned empty natsWsUrl — treating as terminal"),x(!0);return}if(J)return;console.log("[NATS] Connecting to",fe.natsWsUrl);const oe=await Dx({servers:fe.natsWsUrl,authenticator:Ex(fe.natsJwt,new TextEncoder().encode(fe.natsNkeySeed)),pingInterval:3e4,maxPingOut:2});if(J){oe.close().catch(()=>{});return}if(console.log("[NATS] Connected"),c.current=oe,s(oe),o(!0),B=1e3,await oe.closed(),J)return;console.log("[NATS] Connection closed, will reconnect"),c.current=null,s(null),o(!1)}catch(F){if(J)return;console.warn(`[NATS] Connect failed, retrying in ${B}ms:`,F),o(!1),await new Promise(fe=>setTimeout(fe,B)),B=Math.min(B*2,D)}}return G(),()=>{J=!0,c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),o(!1))}},[P,t]),E.useEffect(()=>{if(P)return;const J=pd.addListener("appStateChange",B=>{if(!B.isActive||!c.current)return;const D=c.current;Promise.race([D.flush(),new Promise((G,F)=>setTimeout(()=>F(new Error("ping timeout")),2e3))]).catch(()=>{console.log("[NATS] Resume probe failed — cycling conn"),D.close().catch(()=>{})})});return()=>{J.then(B=>B.remove())}},[P]),E.useEffect(()=>{if(!P){d(!1);return}const J=new AbortController;async function B(){var fe;const G=new AbortController,F=setTimeout(()=>G.abort(),SE);J.signal.addEventListener("abort",()=>G.abort());try{const oe=await fetch(`${t.directUrl}/events`,{headers:{Authorization:`Bearer ${t.clientToken}`},signal:G.signal});return clearTimeout(F),oe.ok?((fe=oe.body)==null?void 0:fe.getReader())??null:null}catch{return clearTimeout(F),null}}async function D(G){d(!0),console.log("[HOST] SSE connected to",t.directUrl),M.current=Date.now();function F(){setTimeout(()=>{J.signal.aborted||Date.now()-M.current<Th||(console.log("[HOST] Heartbeat timeout — no data for",Th/1e3,"s"),J.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},Th)}F();const fe=new TextDecoder;let oe="";try{for(;;){const{done:ne,value:V}=await G.read();if(ne)break;oe+=fe.decode(V,{stream:!0}),M.current=Date.now(),F();const Q=oe.split(`
|
|
88
|
-
`);oe=Q.pop()??"";for(const X of Q)if(X.startsWith("data: ")){const xe=X.slice(6);try{const j=JSON.parse(xe);if(j.task_id&&j.event_type){const z=`host-event.${t.hostId}.${j.task_id}`;for(const W of O.current)W({subject:z,data:A.current.encode(xe)})}}catch{}}}}catch{}}return(async()=>{const G=await B();G&&await D(G)})(),()=>{J.abort(),d(!1)}},[t,P]);const L=E.useCallback(async(J,B,D)=>{function G(oe){oe&&typeof oe=="object"&&oe.error==="Unauthorized"&&b(!0)}async function F(oe,ne){console.log(`[HOST/${ne}] → ${J}`,B??"");const V=await fetch(`${oe}/rpc/${J}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.clientToken}`},body:B!=null?JSON.stringify(B):void 0,signal:D!=null&&D.timeout?AbortSignal.timeout(D.timeout):void 0});if(V.status===401)throw b(!0),new Error("Unauthorized");const Q=await V.json();return G(Q),console.log(`[HOST/${ne}] ← ${J}`,Q),Q}async function fe(){if(!c.current)throw new Error("Not connected");const oe=`host.${t.hostId}.rpc.${J}`,ne={...B??{},clientToken:t.clientToken},V=A.current.encode(JSON.stringify(ne));console.log(`[HOST/NATS] → ${J}`,B??"");const Q=await c.current.request(oe,V,{timeout:(D==null?void 0:D.timeout)??1e4}),X=JSON.parse(A.current.decode(Q.data));return G(X),console.log(`[HOST/NATS] ← ${J}`,X),X}if(P)return F(t.directUrl,"HTTP");if(I&&t.lanUrl)try{return await F(t.lanUrl,"LAN")}catch(oe){if(oe instanceof Error&&oe.message==="Unauthorized")throw oe;console.log("[HOST/LAN] failed, falling back to NATS:",oe),S(!1)}return fe()},[t,P,I]),ee=E.useCallback((J,B)=>{if(P)return O.current.add(B),()=>{O.current.delete(B)};if(c.current){const D=c.current.subscribe(`host-event.${J}.>`);let G=!1;return(async()=>{try{for await(const F of D){if(G)break;B({subject:F.subject,data:F.data})}}catch{}})(),()=>{G=!0,D.unsubscribe()}}return()=>{}},[t,P]);return y.jsx(zx.Provider,{value:{connected:q,mode:te,nc:r,request:L,subscribeEvents:ee,activeHost:t,unauthorized:m},children:e})}function xi(){const e=E.useContext(zx);if(!e)throw new Error("useHostConnection must be used within HostConnectionProvider");return e}const Tn=Gn.isNativePlatform()?ks("Device"):null;function CE(e,t){const r=new Date(e),s=new Date,l={year:"numeric",month:"2-digit",day:"2-digit",timeZone:t};return r.toLocaleDateString(void 0,l)===s.toLocaleDateString(void 0,l)?new Intl.DateTimeFormat(void 0,{timeStyle:"short",timeZone:t}).format(r):new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short",timeZone:t}).format(r)}function Yd(){const{activeHost:e}=xi(),t=e.timezone;return E.useCallback(r=>CE(r,t),[t])}function AE(e){const t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(new Date),r=s=>{var l;return((l=t.find(o=>o.type===s))==null?void 0:l.value)??""};return{date:`${r("year")}-${r("month")}-${r("day")}`,time:`${r("hour")}:${r("minute")}`}}function jE(e){const t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(new Date),r=s=>{var l;return Number(((l=t.find(o=>o.type===s))==null?void 0:l.value)??"0")};return{year:r("year"),month:r("month"),day:r("day"),hour:r("hour")%24,minute:r("minute")}}function NE(e,t,r){return new Date(Date.UTC(e,t-1,r)).getUTCDay()}function TE(e,t){return new Date(Date.UTC(e,t,0)).getUTCDate()}function G0(e,t){const r=new Date(Date.UTC(e.year,e.month-1,e.day));return r.setUTCDate(r.getUTCDate()+t),{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:e.hour,minute:e.minute}}function Dl(e,t){return e.year!==t.year?e.year-t.year:e.month!==t.month?e.month-t.month:e.day!==t.day?e.day-t.day:e.hour!==t.hour?e.hour-t.hour:e.minute-t.minute}function OE(e,t){const r=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute);if(!t)return r;const s=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(new Date(r)),l=c=>{var f;return Number(((f=s.find(d=>d.type===c))==null?void 0:f.value)??"0")},o=Date.UTC(l("year"),l("month")-1,l("day"),l("hour")%24,l("minute"),l("second"));return r-(o-r)}function RE(e,t){const r=e.split(" ");if(r.length!==5)return null;const[s,l,o,,c]=r;if(l==="*"){const b=Number(s);if(Number.isNaN(b))return null;if(b>t.minute)return{...t,minute:b};const g=new Date(Date.UTC(t.year,t.month-1,t.day,t.hour+1,b));return{year:g.getUTCFullYear(),month:g.getUTCMonth()+1,day:g.getUTCDate(),hour:g.getUTCHours(),minute:g.getUTCMinutes()}}const f=Number(s),d=Number(l);if(Number.isNaN(f)||Number.isNaN(d))return null;if(c!=="*"){const b=Number(c);if(Number.isNaN(b))return null;for(let g=0;g<8;g++){const x=G0({...t,hour:d,minute:f},g);if(NE(x.year,x.month,x.day)===b&&Dl(x,t)>0)return x}return null}if(o!=="*"){const b=Number(o);if(Number.isNaN(b))return null;let g=t.year,x=t.month;for(let v=0;v<24;v++){if(b<=TE(g,x)){const S={year:g,month:x,day:b,hour:d,minute:f};if(Dl(S,t)>0)return S}x++,x>12&&(x=1,g++)}return null}const m={...t,hour:d,minute:f};return Dl(m,t)>0?m:G0(m,1)}function ME(e){const t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(e);return t?{year:Number(t[1]),month:Number(t[2]),day:Number(t[3]),hour:Number(t[4]),minute:Number(t[5])}:null}function DE(e,t,r){if(!e||!t||t.length===0||e==="on_new_notification"||e==="on_new_sms")return null;const s=jE(r),l=[];for(const o of t)if(e==="specific_times"){const c=ME(o);c&&Dl(c,s)>0&&l.push(c)}else{const c=RE(o,s);c&&l.push(c)}return l.length===0?null:(l.sort(Dl),OE(l[0],r))}const Ux={};function LE(e){for(const t of e)Ux[t.key]=t.label}function gd(e){return Ux[e]??e}const zE=()=>window.matchMedia("(max-width: 600px)").matches;function UE({task:e,lastEvent:t,onEdit:r,onDelete:s,onViewRun:l}){var V;const{request:o,activeHost:c}=xi(),f=Yd(),d=c.timezone,[m,b]=E.useState(!1),[g,x]=E.useState(!1),[v,S]=E.useState(!1),A=E.useRef(null),O=(t==null?void 0:t.running_state)==="started",M=(((V=e.schedule_values)==null?void 0:V.length)??0)>0,P=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",I=!!e.command,te=!!e.schedule_type&&(M||P)||I,L=!!e.schedule_enabled&&te?O?"var(--color-success)":(t==null?void 0:t.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";E.useEffect(()=>{if(!g)return;function Q(X){A.current&&!A.current.contains(X.target)&&x(!1)}return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[g]);function ee(){zE()?S(!0):x(Q=>!Q)}function J(){x(!1),S(!1)}async function B(){if(J(),!!confirm("Abort this task?")){b(!0);try{await o("task.abort",{id:e.id})}catch(Q){console.error("Abort failed:",Q)}finally{b(!1)}}}async function D(){J();try{const Q=await o("task.run",{id:e.id});l(e.id,Q.run_id)}catch(Q){console.error("Run failed:",Q)}}async function G(){if(J(),!!confirm("Delete this task? Results and reports will be kept."))try{await o("task.delete",{id:e.id}),s(e.id)}catch(Q){console.error("Delete failed:",Q)}}const F={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function fe(){if(I)return"On Command Output";if(e.schedule_type==="on_new_notification")return"On new notification";if(e.schedule_type==="on_new_sms")return"On new SMS";const Q=DE(e.schedule_type,e.schedule_values,d);return Q===null?"No upcoming runs":`Next: ${f(Q)}`}const oe=fe(),ne=y.jsxs(y.Fragment,{children:[y.jsxs("button",{onClick:()=>{J(),r(e)},children:[y.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),y.jsxs("button",{onClick:()=>{J(),l(e.id)},children:[y.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),O?y.jsxs("button",{className:"menu-item-danger",onClick:B,disabled:m,children:[y.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):y.jsxs(y.Fragment,{children:[y.jsxs("button",{onClick:D,children:[y.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),y.jsxs("button",{className:"menu-item-danger",onClick:G,children:[y.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"task-card",onClick:()=>l(e.id,O?"latest":void 0),children:[y.jsxs("div",{className:"task-card-header",children:[y.jsxs("div",{className:"task-card-title-row",children:[O?y.jsx("span",{className:"status-spinner",children:y.jsx("span",{})}):y.jsx("span",{className:"status-dot",style:{backgroundColor:L}}),y.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),y.jsx("div",{className:"task-card-actions",onClick:Q=>Q.stopPropagation(),children:y.jsxs("div",{className:"task-card-menu",ref:A,children:[y.jsx("button",{className:"task-card-menu-btn",onClick:ee,"aria-label":"Task actions",children:"⋮"}),g&&y.jsx("div",{className:"task-card-menu-dropdown",children:ne})]})})]}),y.jsxs("div",{className:"task-card-meta",children:[e.agent&&y.jsx("span",{className:"task-card-agent",children:gd(e.agent)}),t&&F[t.running_state]&&y.jsxs("span",{className:"task-card-last-event",children:[F[t.running_state]," ",f(t.time_stamp)]}),te&&y.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?oe:"Schedule disabled"})]})]}),v&&pi.createPortal(y.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>S(!1),children:y.jsxs("div",{className:"bottom-sheet",onClick:Q=>Q.stopPropagation(),children:[y.jsx("div",{className:"bottom-sheet-handle"}),y.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),y.jsx("div",{className:"bottom-sheet-actions",children:ne})]})}),document.body)]})}function PE({permissions:e}){return y.jsxs("div",{className:"permissions-dialog",children:[y.jsx("h2",{children:"Granted Permissions"}),y.jsx("div",{className:"permissions-dialog-scroll",children:e&&e.length>0?y.jsx("div",{className:"permissions-section",children:y.jsx("ul",{className:"permissions-list",children:e.map((t,r)=>y.jsxs("li",{className:"permission-item",children:[y.jsx("span",{className:"permission-tool",children:t.name}),y.jsx("span",{className:"permission-desc",children:t.description})]},r))})}):y.jsx("p",{className:"permissions-empty",children:"No permissions have been granted for this task."})}),y.jsx("div",{className:"permissions-dialog-actions",children:y.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const ua=[];function BE(){const e=ua.pop();e&&(e.pushed.current=!1,e.close())}let J0=!1;function HE(){J0||(J0=!0,window.addEventListener("popstate",BE))}function yd(e,t){const r=E.useRef(!1),s=E.useRef(t);s.current=t;const l=E.useCallback(()=>s.current(),[]),o=E.useRef({close:l,pushed:r});o.current.close=l,E.useEffect(()=>{if(e&&!r.current)HE(),history.pushState({modal:!0},""),ua.push(o.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=ua.indexOf(o.current);c!==-1&&ua.splice(c,1),history.back()}},[e,l]),E.useEffect(()=>{const c=o.current;return()=>{if(r.current){r.current=!1;const f=ua.indexOf(c);f!==-1&&ua.splice(f,1),history.back()}}},[])}const qE=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],IE=["specific_times","hourly","daily","weekly","monthly"];function pu(e){return IE.includes(e)}function FE(e){return e==="on_new_notification"||e==="on_new_sms"}function mi(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function $E(e){const t=e.split(" ");if(t.length!==5)return mi();const[r,s,l,,o]=t;if(s==="*")return mi("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return o!=="*"?{...mi("weekly"),time:c,dayOfWeek:o}:l!=="*"?{...mi("monthly"),time:c,dayOfMonth:l}:{...mi("daily"),time:c}}function Px(e,t){if(e==="specific_times"){const[r,s]=t.split("T");return{...mi("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return $E(t)}function VE(e){const[t,r]=e.time.split(":").map(Number);switch(e.schedule){case"hourly":return"0 * * * *";case"daily":return`${r} ${t} * * *`;case"weekly":return`${r} ${t} * * ${e.dayOfWeek}`;case"monthly":return`${r} ${t} ${e.dayOfMonth} * *`;default:return"0 * * * *"}}function YE(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:VE(e)}function Oh(e){return e==="specific_times"?"specific_times":e==="on_new_notification"?"on_new_notification":e==="on_new_sms"?"on_new_sms":"crons"}function Rh(e){var s;if(!e)return"daily";if(e.command)return"command";const t=e.schedule_type;if(t==="on_new_notification"||t==="on_new_sms")return t;if(t!=="crons"&&t!=="specific_times")return"ondemand";const r=(s=e.schedule_values)==null?void 0:s[0];return r?Px(t,r).schedule:"ondemand"}function GE({initial:e,agents:t,hostPlatform:r,isNotificationListener:s,onSaved:l,onCancel:o}){var Qe;const{request:c,activeHost:f}=xi(),{setHostLastAgent:d}=Zi(),m=()=>{var Me;const ve=f.lastAgent,Fe=t.map(_t=>_t.key);return ve&&Fe.includes(ve)?ve:((Me=t[0])==null?void 0:Me.key)??""},[b,g]=E.useState((e==null?void 0:e.user_prompt)??""),[x,v]=E.useState((e==null?void 0:e.agent)??m()),S=!!((Qe=e==null?void 0:e.permissions)!=null&&Qe.length)&&x===(e==null?void 0:e.agent),[A,O]=E.useState(!1),M=E.useCallback(()=>O(!1),[]);yd(A,M);const[P,I]=E.useState(null),[te,q]=E.useState(()=>Rh(e)),[L,ee]=E.useState(()=>{const ve=e==null?void 0:e.schedule_type,Fe=e==null?void 0:e.schedule_values;if(Fe&&(ve==="crons"||ve==="specific_times"))return Fe.map(_t=>Px(ve,_t));const Me=Rh(e);return pu(Me)?[mi(Me)]:[]}),[J,B]=E.useState((e==null?void 0:e.requires_confirmation)??!1),[D,G]=E.useState(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0),[F,fe]=E.useState((e==null?void 0:e.yolo_mode)??!1),[oe,ne]=E.useState((e==null?void 0:e.foreground_mode)??!1),[V,Q]=E.useState((e==null?void 0:e.command)??""),[X,xe]=E.useState(!1),j=(e==null?void 0:e.schedule_type)==="on_new_notification"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[z,W]=E.useState(j),[N,we]=E.useState([]),[Oe,je]=E.useState(!1),[he,Ae]=E.useState(!1),[Se,We]=E.useState(""),It=E.useCallback(()=>Ae(!1),[]);yd(he,It),E.useEffect(()=>{if(te!=="on_new_notification"||!s||!Gn.isNativePlatform()||!Tn)return;let ve=!1;return je(!0),Tn.getInstalledApps().then(({apps:Fe})=>{if(ve)return;const Me="com.palmier.app",_t=Fe.filter(Zt=>Zt.packageName!==Me).sort((Zt,Mn)=>(Zt.appName||Zt.packageName).localeCompare(Mn.appName||Mn.packageName));we(_t)}).catch(()=>{}).finally(()=>{ve||je(!1)}),()=>{ve=!0}},[te,s]);const ln=(e==null?void 0:e.schedule_type)==="on_new_sms"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[nn,Gt]=E.useState(ln),on=E.useRef(null),Ot=pu(te),Qt=te==="command",Ie=FE(te),dt=te==="specific_times"||te==="daily"||te==="weekly"||te==="monthly",Ke=t.find(ve=>ve.key===x),wt=!!(Ke!=null&&Ke.supportsYolo);E.useEffect(()=>{!wt&&F&&fe(!1)},[wt,F]);const Ut=!!e,En=Rh(e),gt=!Ut||b!==((e==null?void 0:e.user_prompt)??"")||x!==((e==null?void 0:e.agent)??"")||te!==En||J!==((e==null?void 0:e.requires_confirmation)??!1)||D!==(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0)||F!==((e==null?void 0:e.yolo_mode)??!1)||oe!==((e==null?void 0:e.foreground_mode)??!1)||Qt&&V!==((e==null?void 0:e.command)??"")||Ot&&(JSON.stringify(yn())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Oh(te)!==((e==null?void 0:e.schedule_type)??void 0))||Ie&&te!==(e==null?void 0:e.schedule_type)||te==="on_new_notification"&&z.trim()!==j.trim()||te==="on_new_sms"&&nn.trim()!==ln.trim(),Cn=AE(f.timezone),le=Ot&&L.some(ve=>ve.schedule==="specific_times"&&(!ve.onceDate||ve.onceDate<Cn.date||ve.onceDate===Cn.date&&(ve.onceTime??"")<=Cn.time)),ke=gt&&!!b.trim()&&!le&&(!Qt||!!V.trim())&&(!Ot||L.length>0);function Re(ve,Fe){ee(Me=>Me.map((_t,Zt)=>Zt===ve?{..._t,...Fe}:_t))}function Ge(ve){ee(Fe=>Fe.filter((Me,_t)=>_t!==ve))}function rt(){pu(te)&&ee(ve=>[...ve,ve.length>0?{...ve[ve.length-1]}:mi(te)])}function un(ve){q(ve),pu(ve)?ee([mi(ve)]):(ee([]),B(!1)),ve==="command"?setTimeout(()=>{var Fe;return(Fe=on.current)==null?void 0:Fe.focus()},0):Q(""),ve!=="on_new_notification"&&W(j),ve!=="on_new_sms"&&Gt(ln)}function yn(){return L.flatMap(ve=>{const Fe=YE(ve);return Fe?[Fe]:[]})}function Jt(){return F?confirm(`Yolo mode is enabled. The agent will auto-approve all tool calls — it can read, write, delete files, run arbitrary commands, and access the network without asking for permission.
|
|
87
|
+
${f.stack}`),c.reject(m)):c.resolve(b))}});return d.requestSubject=t,this.protocol.publish(t,r,{reply:o,headers:s.headers}),c}else{const o=new xx(this.protocol.muxSubscriptions,t,s,l);this.protocol.request(o);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${o.token}`,headers:s.headers})}catch(f){o.cancel(f)}const c=Promise.race([o.timer,o.deferred]);return c.catch(()=>{o.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(De.errorForCode(Ce.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(De.errorForCode(Ce.ConnectionClosed)):this.isDraining()?Promise.reject(De.errorForCode(Ce.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new wn;return t.iterClosed.then(()=>{const r=this.listeners.indexOf(t);this.listeners.splice(r,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((r,s)=>r==="time"?new Date(Date.parse(s)):s)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const r=new Fk(this,t);if(t.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===Ce.NoResponders&&(l.code=Ce.JetStreamNotEnabled),l}return r}jetstream(t={}){return new Id(this,t)}getServerVersion(){const t=this.info;return t?ws(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw De.errorForCode(Ce.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new Gk(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(De.errorForCode(Ce.ConnectionClosed)):this.isDraining()?Promise.reject(De.errorForCode(Ce.ConnectionDraining)):this.protocol.reconnect()}}class Gk{constructor(t){C(this,"nc");this.nc=t}add(t){try{return new Xl(this.nc,t).start()}catch(r){return Promise.reject(r)}}client(t,r){return new Ck(this.nc,t,r)}}class Jk{constructor(t,r,s){C(this,"bucket");C(this,"sm");C(this,"prefixLen");this.bucket=t,this.prefixLen=r,this.sm=s}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Pu)||"PUT"}get length(){const t=this.sm.header.get(Bn.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Xk{constructor(t,r,s){C(this,"bucket");C(this,"key");C(this,"sm");this.bucket=t,this.key=r,this.sm=s}get value(){return this.sm.data}get created(){return new Date(Ud(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(Pu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const t=((r=this.sm.headers)==null?void 0:r.get(Bn.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Rx extends C2{constructor(r,s,l){super(r.nc,s,l);C(this,"js");C(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const s=gi(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const o=this.info;o.config.name=Ki.next(),o.ordered_consumer_sequence.delivery_seq=0,o.flow_control.heartbeat_count=0,o.flow_control.fc_count=0,o.flow_control.consumer_restarts++,o.deliver=s,o.config.deliver_subject=s,o.config.deliver_policy=sn.StartSequence,o.config.opt_start_seq=r;const c={};c.stream_name=this.info.stream,c.config=o.config;const f=`${o.api.prefix}.CONSUMER.CREATE.${o.stream}`;this.js._request(f,c,{retries:-1}).then(d=>{const m=d,b=this.sub.info;b.last=m,this.info.config=m.config,this.info.name=m.name}).catch(d=>{const m=new De(`unable to recreate ordered consumer ${o.stream} at seq ${r}`,Ce.RequestError,d);this.sub.callback(m,{})})}_maybeSetupHbMonitoring(){var s,l;const r=((l=(s=this.info)==null?void 0:s.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(Ud(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const o=this.sub,c=f=>{var b,g,x,v;const d=a2(409,`${_r.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((b=this.info)==null?void 0:b.ordered))this.sub.callback(null,d);else{if(!this.js.nc.protocol.connected)return!1;const S=((x=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(S+1),(v=this.monitor)==null||v.restart(),!1}return!o.noIterator};this.monitor=new Bd(r,c,l)}_checkHbOrderConsumer(r){const s=r.headers.get(Bn.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(Bn.LastConsumerSeqHdr),10),o=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==o.delivery_seq&&this._resetOrderedConsumer(o.stream_seq+1),!1}_checkOrderedConsumer(r){const s=this.info.ordered_consumer_sequence,l=r.info.streamSequence,o=r.info.deliverySequence;return o!=s.delivery_seq+1?(this._resetOrderedConsumer(s.stream_seq+1),!1):(s.delivery_seq=o,s.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${s}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${s}`,o=await r.api._request(l);return r.last=o,o}}class Kk extends Rx{constructor(t,r,s){super(t,r,s)}pull(t={batch:1}){const{stream:r,config:s,name:l}=this.sub.info,o=s.durable_name??l,c={};if(c.batch=t.batch||1,c.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const m=this.js.nc.features.get(gt.JS_PULL_MAX_BYTES);if(!m.ok)throw new Error(`max_bytes is only supported on servers ${m.min} or better`);c.max_bytes=t.max_bytes}let f=0;t.expires&&t.expires>0&&(f=t.expires,c.expires=Gt(f));let d=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(d=t.idle_heartbeat,c.idle_heartbeat=Gt(d)),d&&f===0)throw new Error("idle_heartbeat requires expires");if(d>f)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),f&&d&&(this.monitor?this.monitor._change(d,f):this._setupHbMonitoring(d,f));const m=this.info.api,b=`${m.prefix}.CONSUMER.MSG.NEXT.${r}.${o}`,g=this.sub.subject;m.nc.publish(b,m.jc.encode(c),{reply:g})}}}function Qk(e,t){return e?Wk(t):Zk(t)}function Zk(e){return(t,r)=>t?[t,null]:(t=pa(r),t?[t,null]:[null,Fl(r,e)])}function Wk(e){return(t,r)=>{if(t)return[t,null];const s=pa(r);return s!==null?[Mx(s),null]:[null,Fl(r,e)]}}function Mx(e){if(e!==null)switch(e.code){case Ce.JetStream404NoMessages:case Ce.JetStream408RequestTimeout:return null;case Ce.JetStream409:return l2(e)?e:null;default:return e}return null}function eE(e){e&&e.ack()}function tE(e){const t=e.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const r={};return r.domain=t[2]==="_"?"":t[2],r.account_hash=t[3],r.stream=t[4],r.consumer=t[5],r.deliveryCount=parseInt(t[6],10),r.redeliveryCount=r.deliveryCount,r.redelivered=r.deliveryCount>1,r.streamSequence=parseInt(t[7],10),r.deliverySequence=parseInt(t[8],10),r.timestampNanos=parseInt(t[9],10),r.pending=parseInt(t[10],10),r}class nE{constructor(t,r){C(this,"msg");C(this,"di");C(this,"didAck");C(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=r}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=tE(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===Sl[0]&&t[1]===Sl[1]&&t[2]===Sl[2]&&t[3]===Sl[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=Jt();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const o=this.msg.publisher,c=!((s=o.options)!=null&&s.noAsyncTraces),f=new xx(o.muxSubscriptions,this.msg.reply,{timeout:t.timeout},c);o.request(f);try{o.publish(this.msg.reply,B0,{reply:`${o.muxSubscriptions.baseInbox}${f.token}`})}catch(d){f.cancel(d)}try{await Promise.race([f.timer,f.deferred]),r.resolve(!0)}catch(d){f.cancel(d),r.reject(d)}}else r.resolve(!1);return r}ack(){this.doAck(B0)}nak(t){let r=zk;t&&(r=Ru().encode(`-NAK ${JSON.stringify({delay:Gt(t)})}`)),this.doAck(r)}working(){this.doAck(Sl)}next(t,r={batch:1}){const s={};s.batch=r.batch||1,s.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(s.expires=Gt(r.expires));const l=Dr().encode(s),o=Sa.concat(Uk,Bk,l),c=t?{reply:t}:void 0;this.msg.respond(o,c)}term(t=""){let r=Pk;(t==null?void 0:t.length)>0&&(r=Ru().encode(`+TERM ${t}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const rE="1.30.3",iE="nats.ws";class sE{constructor(){C(this,"version");C(this,"lang");C(this,"closeError");C(this,"connected");C(this,"done");C(this,"socket");C(this,"options");C(this,"socketClosed");C(this,"encrypted");C(this,"peeked");C(this,"yields");C(this,"signal");C(this,"closedNotification");this.version=rE,this.lang=iE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Jt(),this.closedNotification=Jt()}async connect(t,r){const s=Jt();if(r.tls)return s.reject(new De("tls",Ce.InvalidOption)),s;this.options=r;const l=t.src;if(r.wsFactory){const{socket:o,encrypted:c}=await r.wsFactory(t.src,r);this.socket=o,this.encrypted=c}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=o=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(o.data)),this.peeked){this.signal.resolve();return}const c=Sa.concat(...this.yields),f=R2(c);if(f!==""){const d=bk.exec(f);if(!d){r.debug&&console.error("!!!",fu(c)),s.reject(new Error("unexpected response from server"));return}try{const m=JSON.parse(d[1]);gk(m,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(m){s.reject(m);return}}},this.socket.onclose=o=>{if(this.isDiscarded())return;this.socketClosed=!0;let c;this.done||(o.wasClean||(c=new Error(o.reason)),this._closed(c))},this.socket.onerror=o=>{if(this.isDiscarded())return;const c=o,f=new De(c.message,Ce.Unknown,new Error(c.error));s.reject(f)},s}disconnect(){this._closed(void 0,!0)}async _closed(t,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ja(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}r&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let r=0;r<t.length;r++)this.options.debug&&console.info(`> ${fu(t[r])}`),yield t[r];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=Jt())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${fu(t)}`);return}catch(r){this.options.debug&&console.error(`!!! ${fu(t)}: ${r}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function aE(e,t){/^(.*:\/\/)(.*)/.test(e)||(typeof t=="boolean"?e=`${t===!0?"https":"http"}://${e}`:e=`https://${e}`);let s=new URL(e);const l=s.protocol.toLowerCase();l==="ws:"&&(t=!1),l==="wss:"&&(t=!0),l!=="https:"&&l!=="http"&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2"),s=new URL(`http://${e}`));let o,c;const f=s.hostname,d=s.pathname,m=s.search||"";switch(l){case"http:":case"ws:":case"nats:":c=s.port||"80",o="ws:";break;case"https:":case"wss:":case"tls:":c=s.port||"443",o="wss:";break;default:c=s.port||t===!0?"443":"80",o=t===!0?"wss:":"ws:";break}return`${o}//${f}:${c}${d}${m}`}function Dx(e={}){return A2({defaultPort:443,urlParseFn:aE,factory:()=>new sE}),Fd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var _a;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(_a||(_a={}));class Nh extends Error{constructor(t,r,s){super(t),this.message=t,this.code=r,this.data=s}}const lE=e=>{var t,r;return e!=null&&e.androidBridge?"android":!((r=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},oE=e=>{const t=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>t!==null?t.name:lE(e),o=()=>l()!=="web",c=g=>{const x=m.get(g);return!!(x!=null&&x.platforms.has(l())||f(g))},f=g=>{var x;return(x=r.PluginHeaders)===null||x===void 0?void 0:x.find(v=>v.name===g)},d=g=>e.console.error(g),m=new Map,b=(g,x={})=>{const v=m.get(g);if(v)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),v.proxy;const S=l(),j=f(g);let R;const M=async()=>(!R&&S in x?R=typeof x[S]=="function"?R=await x[S]():R=x[S]:t!==null&&!R&&"web"in x&&(R=typeof x.web=="function"?R=await x.web():R=x.web),R),P=(G,B)=>{var L,J;if(j){const $=j==null?void 0:j.methods.find(he=>B===he.name);if($)return $.rtype==="promise"?he=>r.nativePromise(g,B.toString(),he):(he,le)=>r.nativeCallback(g,B.toString(),he,le);if(G)return(L=G[B])===null||L===void 0?void 0:L.bind(G)}else{if(G)return(J=G[B])===null||J===void 0?void 0:J.bind(G);throw new Nh(`"${g}" plugin is not implemented on ${S}`,_a.Unimplemented)}},I=G=>{let B;const L=(...J)=>{const $=M().then(he=>{const le=P(he,G);if(le){const te=le(...J);return B=te==null?void 0:te.remove,te}else throw new Nh(`"${g}.${G}()" is not implemented on ${S}`,_a.Unimplemented)});return G==="addListener"&&($.remove=async()=>B()),$};return L.toString=()=>`${G.toString()}() { [capacitor code] }`,Object.defineProperty(L,"name",{value:G,writable:!1,configurable:!1}),L},ue=I("addListener"),q=I("removeListener"),N=(G,B)=>{const L=ue({eventName:G},B),J=async()=>{const he=await L;q({eventName:G,callbackId:he},B)},$=new Promise(he=>L.then(()=>he({remove:J})));return $.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await J()},$},ee=new Proxy({},{get(G,B){switch(B){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return j?N:ue;case"removeListener":return q;default:return I(B)}}});return s[g]=ee,m.set(g,{name:g,proxy:ee,platforms:new Set([...Object.keys(x),...j?[S]:[]])}),ee};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=d,r.isNativePlatform=o,r.isPluginAvailable=c,r.registerPlugin=b,r.Exception=Nh,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},uE=e=>e.Capacitor=oE(e),Jn=uE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ks=Jn.registerPlugin;class $d{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,r){let s=!1;this.listeners[t]||(this.listeners[t]=[],s=!0),this.listeners[t].push(r);const o=this.windowListeners[t];o&&!o.registered&&this.addWindowListener(o),s&&this.sendRetainedArgumentsForEvent(t);const c=async()=>this.removeListener(t,r);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,r,s){const l=this.listeners[t];if(!l){if(s){let o=this.retainedEventArguments[t];o||(o=[]),o.push(r),this.retainedEventArguments[t]=o}return}l.forEach(o=>o(r))}hasListeners(t){var r;return!!(!((r=this.listeners[t])===null||r===void 0)&&r.length)}registerWindowListener(t,r){this.windowListeners[r]={registered:!1,windowEventName:t,pluginEventName:r,handler:s=>{this.notifyListeners(r,s)}}}unimplemented(t="not implemented"){return new Jn.Exception(t,_a.Unimplemented)}unavailable(t="not available"){return new Jn.Exception(t,_a.Unavailable)}async removeListener(t,r){const s=this.listeners[t];if(!s)return;const l=s.indexOf(r);this.listeners[t].splice(l,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const r=this.retainedEventArguments[t];r&&(delete this.retainedEventArguments[t],r.forEach(s=>{this.notifyListeners(t,s)}))}}const q0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),I0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class cE extends $d{async getCookies(){const t=document.cookie,r={};return t.split(";").forEach(s=>{if(s.length<=0)return;let[l,o]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=I0(l).trim(),o=I0(o).trim(),r[l]=o}),r}async setCookie(t){try{const r=q0(t.key),s=q0(t.value),l=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",o=(t.path||"/").replace("path=",""),c=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${r}=${s||""}${l}; path=${o}; ${c};`}catch(r){return Promise.reject(r)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const r of t)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}ks("CapacitorCookies",{web:()=>new cE});const fE=async e=>new Promise((t,r)=>{const s=new FileReader;s.onload=()=>{const l=s.result;t(l.indexOf(",")>=0?l.split(",")[1]:l)},s.onerror=l=>r(l),s.readAsDataURL(e)}),hE=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,o,c)=>(l[o]=e[t[c]],l),{})},dE=(e,t=!0)=>e?Object.entries(e).reduce((s,l)=>{const[o,c]=l;let f,d;return Array.isArray(c)?(d="",c.forEach(m=>{f=t?encodeURIComponent(m):m,d+=`${o}=${f}&`}),d.slice(0,-1)):(f=t?encodeURIComponent(c):c,d=`${o}=${f}`),`${s}&${d}`},"").substr(1):null,mE=(e,t={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},t),l=hE(e.headers)["content-type"]||"";if(typeof e.data=="string")r.body=e.data;else if(l.includes("application/x-www-form-urlencoded")){const o=new URLSearchParams;for(const[c,f]of Object.entries(e.data||{}))o.set(c,f);r.body=o.toString()}else if(l.includes("multipart/form-data")||e.data instanceof FormData){const o=new FormData;if(e.data instanceof FormData)e.data.forEach((f,d)=>{o.append(d,f)});else for(const f of Object.keys(e.data))o.append(f,e.data[f]);r.body=o;const c=new Headers(r.headers);c.delete("content-type"),r.headers=c}else(l.includes("application/json")||typeof e.data=="object")&&(r.body=JSON.stringify(e.data));return r};class pE extends $d{async request(t){const r=mE(t,t.webFetchExtra),s=dE(t.params,t.shouldEncodeUrlParams),l=s?`${t.url}?${s}`:t.url,o=await fetch(l,r),c=o.headers.get("content-type")||"";let{responseType:f="text"}=o.ok?t:{};c.includes("application/json")&&(f="json");let d,m;switch(f){case"arraybuffer":case"blob":m=await o.blob(),d=await fE(m);break;case"json":d=await o.json();break;case"document":case"text":default:d=await o.text()}const b={};return o.headers.forEach((g,x)=>{b[x]=g}),{data:d,headers:b,status:o.status,url:o.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}ks("CapacitorHttp",{web:()=>new pE});var F0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(F0||(F0={}));var $0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})($0||($0={}));class gE extends $d{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}ks("SystemBars",{web:()=>new gE});const yE="modulepreload",bE=function(e){return"/"+e},V0={},Vd=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let c=function(m){return Promise.all(m.map(b=>Promise.resolve(b).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),d=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=c(r.map(m=>{if(m=bE(m),m in V0)return;V0[m]=!0;const b=m.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const x=document.createElement("link");if(x.rel=b?"stylesheet":yE,b||(x.as="script"),x.crossOrigin="",x.href=m,d&&x.setAttribute("nonce",d),document.head.appendChild(x),b)return new Promise((v,S)=>{x.addEventListener("load",v),x.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${m}`)))})}))}function o(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return l.then(c=>{for(const f of c||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})},pd=ks("App",{web:()=>Vd(()=>import("./web-dCWmWPLg.js"),[]).then(e=>new e.AppWeb)}),xE=ks("Network",{web:()=>Vd(()=>import("./web-DjwtZB4p.js"),[]).then(e=>new e.NetworkWeb)}),Bu=Jn.isNativePlatform()?"https://app.palmier.me":"";async function Lx(e,t,r,s){const l=`${Bu}${t}`;console.log(`[API] ${e} ${l}`);const c=await fetch(l,{method:e,headers:{"Content-Type":"application/json"},body:r!=null?JSON.stringify(r):void 0});if(!c.ok){const f=await c.text();let d;try{const m=JSON.parse(f);d=m.error??m.message??f}catch{d=f}throw console.error(`[API] ${e} ${t} failed:`,c.status,d),new Error(d||`Request failed with status ${c.status}`)}return console.log(`[API] ${e} ${t} ->`,c.status),c.json()}function vE(e,t,r){return Lx("POST",e,t)}function wE(e,t){return Lx("GET",e,void 0)}const Y0=Jn.isNativePlatform(),zx=E.createContext(null),SE=2e3,Th=6e3,_E=1500,kE=6e4;function EE({children:e,activeHost:t}){const[r,s]=E.useState(null),[l,o]=E.useState(!1),c=E.useRef(null),[f,d]=E.useState(!1),[m,b]=E.useState(!1),[g,x]=E.useState(!1),[v,S]=E.useState(!1),j=E.useRef(Ru()),R=E.useRef(new Set),M=E.useRef(0),P=!!t.directUrl,I=Y0&&!P&&!!t.lanUrl&&v,ue=m||g?"disconnected":P?f?"direct":"connecting":l?I?"lan":"nats":"connecting",q=ue!=="connecting"&&ue!=="disconnected";E.useEffect(()=>{if(!Y0||P||!t.lanUrl){S(!1);return}let G=!1;const B=t.lanUrl,L=t.hostId;async function J(){console.log("[HOST/LAN] probing",B);try{const te=await fetch(`${B}/health`,{signal:AbortSignal.timeout(_E)});if(G)return;if(!te.ok){console.log("[HOST/LAN] probe got non-ok:",te.status),S(!1);return}const V=await te.json(),Q=V.hostId===L;Q?console.log("[HOST/LAN] reachable"):console.log("[HOST/LAN] hostId mismatch — got:",V.hostId,"expected:",L),S(Q)}catch(te){G||(console.log("[HOST/LAN] probe failed:",te instanceof Error?te.message:te),S(!1))}}J();const $=window.setInterval(J,kE),he=pd.addListener("appStateChange",te=>{te.isActive&&J()}),le=xE.addListener("networkStatusChange",()=>J());return()=>{G=!0,clearInterval($),he.then(te=>te.remove()),le.then(te=>te.remove())}},[t.hostId,t.lanUrl,P]),E.useEffect(()=>{if(P){c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),o(!1));return}let G=!1,B=1e3;const L=3e4;async function J(){for(;!G;)try{const $=await fetch(`${Bu}/api/nats-credentials/${t.hostId}`);if(G)return;if($.status===401||$.status===403||$.status===404){console.error("[NATS] Host not found or rejected by relay:",$.status),x(!0);return}if(!$.ok)throw new Error(`credentials fetch ${$.status}`);const he=await $.json();if(!he.natsWsUrl){console.error("[NATS] Relay returned empty natsWsUrl — treating as terminal"),x(!0);return}if(G)return;console.log("[NATS] Connecting to",he.natsWsUrl);const le=await Dx({servers:he.natsWsUrl,authenticator:Ex(he.natsJwt,new TextEncoder().encode(he.natsNkeySeed)),pingInterval:3e4,maxPingOut:2});if(G){le.close().catch(()=>{});return}if(console.log("[NATS] Connected"),c.current=le,s(le),o(!0),B=1e3,await le.closed(),G)return;console.log("[NATS] Connection closed, will reconnect"),c.current=null,s(null),o(!1)}catch($){if(G)return;console.warn(`[NATS] Connect failed, retrying in ${B}ms:`,$),o(!1),await new Promise(he=>setTimeout(he,B)),B=Math.min(B*2,L)}}return J(),()=>{G=!0,c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),o(!1))}},[P,t]),E.useEffect(()=>{if(P)return;const G=pd.addListener("appStateChange",B=>{if(!B.isActive||!c.current)return;const L=c.current;Promise.race([L.flush(),new Promise((J,$)=>setTimeout(()=>$(new Error("ping timeout")),2e3))]).catch(()=>{console.log("[NATS] Resume probe failed — cycling conn"),L.close().catch(()=>{})})});return()=>{G.then(B=>B.remove())}},[P]),E.useEffect(()=>{if(!P){d(!1);return}const G=new AbortController;async function B(){var he;const J=new AbortController,$=setTimeout(()=>J.abort(),SE);G.signal.addEventListener("abort",()=>J.abort());try{const le=await fetch(`${t.directUrl}/events`,{headers:{Authorization:`Bearer ${t.clientToken}`},signal:J.signal});return clearTimeout($),le.ok?((he=le.body)==null?void 0:he.getReader())??null:null}catch{return clearTimeout($),null}}async function L(J){d(!0),console.log("[HOST] SSE connected to",t.directUrl),M.current=Date.now();function $(){setTimeout(()=>{G.signal.aborted||Date.now()-M.current<Th||(console.log("[HOST] Heartbeat timeout — no data for",Th/1e3,"s"),G.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},Th)}$();const he=new TextDecoder;let le="";try{for(;;){const{done:te,value:V}=await J.read();if(te)break;le+=he.decode(V,{stream:!0}),M.current=Date.now(),$();const Q=le.split(`
|
|
88
|
+
`);le=Q.pop()??"";for(const X of Q)if(X.startsWith("data: ")){const xe=X.slice(6);try{const A=JSON.parse(xe);if(A.task_id&&A.event_type){const z=`host-event.${t.hostId}.${A.task_id}`;for(const W of R.current)W({subject:z,data:j.current.encode(xe)})}}catch{}}}}catch{}}return(async()=>{const J=await B();J&&await L(J)})(),()=>{G.abort(),d(!1)}},[t,P]);const N=E.useCallback(async(G,B,L)=>{function J(le){le&&typeof le=="object"&&le.error==="Unauthorized"&&b(!0)}async function $(le,te){console.log(`[HOST/${te}] → ${G}`,B??"");const V=await fetch(`${le}/rpc/${G}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.clientToken}`},body:B!=null?JSON.stringify(B):void 0,signal:L!=null&&L.timeout?AbortSignal.timeout(L.timeout):void 0});if(V.status===401)throw b(!0),new Error("Unauthorized");const Q=await V.json();return J(Q),console.log(`[HOST/${te}] ← ${G}`,Q),Q}async function he(){if(!c.current)throw new Error("Not connected");const le=`host.${t.hostId}.rpc.${G}`,te={...B??{},clientToken:t.clientToken},V=j.current.encode(JSON.stringify(te));console.log(`[HOST/NATS] → ${G}`,B??"");const Q=await c.current.request(le,V,{timeout:(L==null?void 0:L.timeout)??1e4}),X=JSON.parse(j.current.decode(Q.data));return J(X),console.log(`[HOST/NATS] ← ${G}`,X),X}if(P)return $(t.directUrl,"HTTP");if(I&&t.lanUrl)try{return await $(t.lanUrl,"LAN")}catch(le){if(le instanceof Error&&le.message==="Unauthorized")throw le;console.log("[HOST/LAN] failed, falling back to NATS:",le),S(!1)}return he()},[t,P,I]),ee=E.useCallback((G,B)=>{if(P)return R.current.add(B),()=>{R.current.delete(B)};if(c.current){const L=c.current.subscribe(`host-event.${G}.>`);let J=!1;return(async()=>{try{for await(const $ of L){if(J)break;B({subject:$.subject,data:$.data})}}catch{}})(),()=>{J=!0,L.unsubscribe()}}return()=>{}},[t,P]);return y.jsx(zx.Provider,{value:{connected:q,mode:ue,nc:r,request:N,subscribeEvents:ee,activeHost:t,unauthorized:m},children:e})}function xi(){const e=E.useContext(zx);if(!e)throw new Error("useHostConnection must be used within HostConnectionProvider");return e}const On=Jn.isNativePlatform()?ks("Device"):null;function CE(e,t){const r=new Date(e),s=new Date,l={year:"numeric",month:"2-digit",day:"2-digit",timeZone:t};return r.toLocaleDateString(void 0,l)===s.toLocaleDateString(void 0,l)?new Intl.DateTimeFormat(void 0,{timeStyle:"short",timeZone:t}).format(r):new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short",timeZone:t}).format(r)}function Yd(){const{activeHost:e}=xi(),t=e.timezone;return E.useCallback(r=>CE(r,t),[t])}function AE(e){const t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(new Date),r=s=>{var l;return((l=t.find(o=>o.type===s))==null?void 0:l.value)??""};return{date:`${r("year")}-${r("month")}-${r("day")}`,time:`${r("hour")}:${r("minute")}`}}function jE(e){const t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(new Date),r=s=>{var l;return Number(((l=t.find(o=>o.type===s))==null?void 0:l.value)??"0")};return{year:r("year"),month:r("month"),day:r("day"),hour:r("hour")%24,minute:r("minute")}}function NE(e,t,r){return new Date(Date.UTC(e,t-1,r)).getUTCDay()}function TE(e,t){return new Date(Date.UTC(e,t,0)).getUTCDate()}function G0(e,t){const r=new Date(Date.UTC(e.year,e.month-1,e.day));return r.setUTCDate(r.getUTCDate()+t),{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:e.hour,minute:e.minute}}function Dl(e,t){return e.year!==t.year?e.year-t.year:e.month!==t.month?e.month-t.month:e.day!==t.day?e.day-t.day:e.hour!==t.hour?e.hour-t.hour:e.minute-t.minute}function OE(e,t){const r=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute);if(!t)return r;const s=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(new Date(r)),l=c=>{var f;return Number(((f=s.find(d=>d.type===c))==null?void 0:f.value)??"0")},o=Date.UTC(l("year"),l("month")-1,l("day"),l("hour")%24,l("minute"),l("second"));return r-(o-r)}function RE(e,t){const r=e.split(" ");if(r.length!==5)return null;const[s,l,o,,c]=r;if(l==="*"){const b=Number(s);if(Number.isNaN(b))return null;if(b>t.minute)return{...t,minute:b};const g=new Date(Date.UTC(t.year,t.month-1,t.day,t.hour+1,b));return{year:g.getUTCFullYear(),month:g.getUTCMonth()+1,day:g.getUTCDate(),hour:g.getUTCHours(),minute:g.getUTCMinutes()}}const f=Number(s),d=Number(l);if(Number.isNaN(f)||Number.isNaN(d))return null;if(c!=="*"){const b=Number(c);if(Number.isNaN(b))return null;for(let g=0;g<8;g++){const x=G0({...t,hour:d,minute:f},g);if(NE(x.year,x.month,x.day)===b&&Dl(x,t)>0)return x}return null}if(o!=="*"){const b=Number(o);if(Number.isNaN(b))return null;let g=t.year,x=t.month;for(let v=0;v<24;v++){if(b<=TE(g,x)){const S={year:g,month:x,day:b,hour:d,minute:f};if(Dl(S,t)>0)return S}x++,x>12&&(x=1,g++)}return null}const m={...t,hour:d,minute:f};return Dl(m,t)>0?m:G0(m,1)}function ME(e){const t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(e);return t?{year:Number(t[1]),month:Number(t[2]),day:Number(t[3]),hour:Number(t[4]),minute:Number(t[5])}:null}function DE(e,t,r){if(!e||!t||t.length===0||e==="on_new_notification"||e==="on_new_sms")return null;const s=jE(r),l=[];for(const o of t)if(e==="specific_times"){const c=ME(o);c&&Dl(c,s)>0&&l.push(c)}else{const c=RE(o,s);c&&l.push(c)}return l.length===0?null:(l.sort(Dl),OE(l[0],r))}const Ux={};function LE(e){for(const t of e)Ux[t.key]=t.label}function gd(e){return Ux[e]??e}const zE=()=>window.matchMedia("(max-width: 600px)").matches;function UE({task:e,lastEvent:t,onEdit:r,onDelete:s,onViewRun:l}){var V;const{request:o,activeHost:c}=xi(),f=Yd(),d=c.timezone,[m,b]=E.useState(!1),[g,x]=E.useState(!1),[v,S]=E.useState(!1),j=E.useRef(null),R=(t==null?void 0:t.running_state)==="started",M=(((V=e.schedule_values)==null?void 0:V.length)??0)>0,P=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",I=!!e.command,ue=!!e.schedule_type&&(M||P)||I,N=!!e.schedule_enabled&&ue?R?"var(--color-success)":(t==null?void 0:t.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";E.useEffect(()=>{if(!g)return;function Q(X){j.current&&!j.current.contains(X.target)&&x(!1)}return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[g]);function ee(){zE()?S(!0):x(Q=>!Q)}function G(){x(!1),S(!1)}async function B(){if(G(),!!confirm("Abort this task?")){b(!0);try{await o("task.abort",{id:e.id})}catch(Q){console.error("Abort failed:",Q)}finally{b(!1)}}}async function L(){G();try{const Q=await o("task.run",{id:e.id});l(e.id,Q.run_id)}catch(Q){console.error("Run failed:",Q)}}async function J(){if(G(),!!confirm("Delete this task? Results and reports will be kept."))try{await o("task.delete",{id:e.id}),s(e.id)}catch(Q){console.error("Delete failed:",Q)}}const $={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function he(){if(I)return"On Command Output";if(e.schedule_type==="on_new_notification")return"On new notification";if(e.schedule_type==="on_new_sms")return"On new SMS";const Q=DE(e.schedule_type,e.schedule_values,d);return Q===null?"No upcoming runs":`Next: ${f(Q)}`}const le=he(),te=y.jsxs(y.Fragment,{children:[y.jsxs("button",{onClick:()=>{G(),r(e)},children:[y.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),y.jsxs("button",{onClick:()=>{G(),l(e.id)},children:[y.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),R?y.jsxs("button",{className:"menu-item-danger",onClick:B,disabled:m,children:[y.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):y.jsxs(y.Fragment,{children:[y.jsxs("button",{onClick:L,children:[y.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),y.jsxs("button",{className:"menu-item-danger",onClick:J,children:[y.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"task-card",onClick:()=>l(e.id,R?"latest":void 0),children:[y.jsxs("div",{className:"task-card-header",children:[y.jsxs("div",{className:"task-card-title-row",children:[R?y.jsx("span",{className:"status-spinner",children:y.jsx("span",{})}):y.jsx("span",{className:"status-dot",style:{backgroundColor:N}}),y.jsx("h3",{className:"task-card-name",children:e.custom_name||e.name||e.user_prompt})]}),y.jsx("div",{className:"task-card-actions",onClick:Q=>Q.stopPropagation(),children:y.jsxs("div",{className:"task-card-menu",ref:j,children:[y.jsx("button",{className:"task-card-menu-btn",onClick:ee,"aria-label":"Task actions",children:"⋮"}),g&&y.jsx("div",{className:"task-card-menu-dropdown",children:te})]})})]}),y.jsxs("div",{className:"task-card-meta",children:[e.agent&&y.jsx("span",{className:"task-card-agent",children:gd(e.agent)}),t&&$[t.running_state]&&y.jsxs("span",{className:"task-card-last-event",children:[$[t.running_state]," ",f(t.time_stamp)]}),ue&&y.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?le:"Schedule disabled"})]})]}),v&&pi.createPortal(y.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>S(!1),children:y.jsxs("div",{className:"bottom-sheet",onClick:Q=>Q.stopPropagation(),children:[y.jsx("div",{className:"bottom-sheet-handle"}),y.jsx("div",{className:"bottom-sheet-title",children:e.custom_name||e.name||e.user_prompt}),y.jsx("div",{className:"bottom-sheet-actions",children:te})]})}),document.body)]})}function PE({permissions:e}){return y.jsxs("div",{className:"permissions-dialog",children:[y.jsx("h2",{children:"Granted Permissions"}),y.jsx("div",{className:"permissions-dialog-scroll",children:e&&e.length>0?y.jsx("div",{className:"permissions-section",children:y.jsx("ul",{className:"permissions-list",children:e.map((t,r)=>y.jsxs("li",{className:"permission-item",children:[y.jsx("span",{className:"permission-tool",children:t.name}),y.jsx("span",{className:"permission-desc",children:t.description})]},r))})}):y.jsx("p",{className:"permissions-empty",children:"No permissions have been granted for this task."})}),y.jsx("div",{className:"permissions-dialog-actions",children:y.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const ua=[];function BE(){const e=ua.pop();e&&(e.pushed.current=!1,e.close())}let J0=!1;function HE(){J0||(J0=!0,window.addEventListener("popstate",BE))}function yd(e,t){const r=E.useRef(!1),s=E.useRef(t);s.current=t;const l=E.useCallback(()=>s.current(),[]),o=E.useRef({close:l,pushed:r});o.current.close=l,E.useEffect(()=>{if(e&&!r.current)HE(),history.pushState({modal:!0},""),ua.push(o.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=ua.indexOf(o.current);c!==-1&&ua.splice(c,1),history.back()}},[e,l]),E.useEffect(()=>{const c=o.current;return()=>{if(r.current){r.current=!1;const f=ua.indexOf(c);f!==-1&&ua.splice(f,1),history.back()}}},[])}const qE=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],IE=["specific_times","hourly","daily","weekly","monthly"];function pu(e){return IE.includes(e)}function FE(e){return e==="on_new_notification"||e==="on_new_sms"}function mi(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function $E(e){const t=e.split(" ");if(t.length!==5)return mi();const[r,s,l,,o]=t;if(s==="*")return mi("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return o!=="*"?{...mi("weekly"),time:c,dayOfWeek:o}:l!=="*"?{...mi("monthly"),time:c,dayOfMonth:l}:{...mi("daily"),time:c}}function Px(e,t){if(e==="specific_times"){const[r,s]=t.split("T");return{...mi("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return $E(t)}function VE(e){const[t,r]=e.time.split(":").map(Number);switch(e.schedule){case"hourly":return"0 * * * *";case"daily":return`${r} ${t} * * *`;case"weekly":return`${r} ${t} * * ${e.dayOfWeek}`;case"monthly":return`${r} ${t} ${e.dayOfMonth} * *`;default:return"0 * * * *"}}function YE(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:VE(e)}function Oh(e){return e==="specific_times"?"specific_times":e==="on_new_notification"?"on_new_notification":e==="on_new_sms"?"on_new_sms":"crons"}function Rh(e){var s;if(!e)return"daily";if(e.command)return"command";const t=e.schedule_type;if(t==="on_new_notification"||t==="on_new_sms")return t;if(t!=="crons"&&t!=="specific_times")return"ondemand";const r=(s=e.schedule_values)==null?void 0:s[0];return r?Px(t,r).schedule:"ondemand"}function GE({initial:e,agents:t,hostPlatform:r,isNotificationListener:s,onSaved:l,onCancel:o}){var Kn;const{request:c,activeHost:f}=xi(),{setHostLastAgent:d}=Zi(),m=()=>{var Re;const we=f.lastAgent,Ye=t.map(bt=>bt.key);return we&&Ye.includes(we)?we:((Re=t[0])==null?void 0:Re.key)??""},[b,g]=E.useState((e==null?void 0:e.custom_name)??""),[x,v]=E.useState((e==null?void 0:e.user_prompt)??""),[S,j]=E.useState((e==null?void 0:e.agent)??m()),R=!!((Kn=e==null?void 0:e.permissions)!=null&&Kn.length)&&S===(e==null?void 0:e.agent),[M,P]=E.useState(!1),I=E.useCallback(()=>P(!1),[]);yd(M,I);const[ue,q]=E.useState(null),[N,ee]=E.useState(()=>Rh(e)),[G,B]=E.useState(()=>{const we=e==null?void 0:e.schedule_type,Ye=e==null?void 0:e.schedule_values;if(Ye&&(we==="crons"||we==="specific_times"))return Ye.map(bt=>Px(we,bt));const Re=Rh(e);return pu(Re)?[mi(Re)]:[]}),[L,J]=E.useState((e==null?void 0:e.requires_confirmation)??!1),[$,he]=E.useState(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0),[le,te]=E.useState((e==null?void 0:e.yolo_mode)??!1),[V,Q]=E.useState((e==null?void 0:e.foreground_mode)??!1),[X,xe]=E.useState((e==null?void 0:e.command)??""),[A,z]=E.useState(!1),W=(e==null?void 0:e.schedule_type)==="on_new_notification"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[T,ve]=E.useState(W),[je,Ne]=E.useState([]),[ce,Ae]=E.useState(!1),[ke,Qe]=E.useState(!1),[Lt,dn]=E.useState(""),tn=E.useCallback(()=>Qe(!1),[]);yd(ke,tn),E.useEffect(()=>{if(N!=="on_new_notification"||!s||!Jn.isNativePlatform()||!On)return;let we=!1;return Ae(!0),On.getInstalledApps().then(({apps:Ye})=>{if(we)return;const Re="com.palmier.app",bt=Ye.filter(ln=>ln.packageName!==Re).sort((ln,Hn)=>(ln.appName||ln.packageName).localeCompare(Hn.appName||Hn.packageName));Ne(bt)}).catch(()=>{}).finally(()=>{we||Ae(!1)}),()=>{we=!0}},[N,s]);const Ft=(e==null?void 0:e.schedule_type)==="on_new_sms"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[$t,an]=E.useState(Ft),bn=E.useRef(null),Be=pu(N),nt=N==="command",st=FE(N),Ot=N==="specific_times"||N==="daily"||N==="weekly"||N==="monthly",_t=t.find(we=>we.key===S),mn=!!(_t!=null&&_t.supportsYolo);E.useEffect(()=>{!mn&&le&&te(!1)},[mn,le]);const at=!!e,Cr=Rh(e),ae=at&&b.trim()!==((e==null?void 0:e.custom_name)??""),_e=!at||ae||x!==((e==null?void 0:e.user_prompt)??"")||S!==((e==null?void 0:e.agent)??"")||N!==Cr||L!==((e==null?void 0:e.requires_confirmation)??!1)||$!==(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0)||le!==((e==null?void 0:e.yolo_mode)??!1)||V!==((e==null?void 0:e.foreground_mode)??!1)||nt&&X!==((e==null?void 0:e.command)??"")||Be&&(JSON.stringify(Vt())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Oh(N)!==((e==null?void 0:e.schedule_type)??void 0))||st&&N!==(e==null?void 0:e.schedule_type)||N==="on_new_notification"&&T.trim()!==W.trim()||N==="on_new_sms"&&$t.trim()!==Ft.trim(),Me=AE(f.timezone),Ge=Be&&G.some(we=>we.schedule==="specific_times"&&(!we.onceDate||we.onceDate<Me.date||we.onceDate===Me.date&&(we.onceTime??"")<=Me.time)),rt=_e&&!!x.trim()&&!Ge&&(!nt||!!X.trim())&&(!Be||G.length>0);function zt(we,Ye){B(Re=>Re.map((bt,ln)=>ln===we?{...bt,...Ye}:bt))}function Sn(we){B(Ye=>Ye.filter((Re,bt)=>bt!==we))}function Kt(){pu(N)&&B(we=>[...we,we.length>0?{...we[we.length-1]}:mi(N)])}function yt(we){ee(we),pu(we)?B([mi(we)]):(B([]),J(!1)),we==="command"?setTimeout(()=>{var Ye;return(Ye=bn.current)==null?void 0:Ye.focus()},0):xe(""),we!=="on_new_notification"&&ve(W),we!=="on_new_sms"&&an(Ft)}function Vt(){return G.flatMap(we=>{const Ye=YE(we);return Ye?[Ye]:[]})}function Ze(){return le?confirm(`Yolo mode is enabled. The agent will auto-approve all tool calls — it can read, write, delete files, run arbitrary commands, and access the network without asking for permission.
|
|
89
89
|
|
|
90
|
-
Are you sure you want to continue?`):!0}async function yt(){xe(!0),I(null);try{const ve=Ot?yn():te==="on_new_notification"&&z.trim()?[z.trim()]:te==="on_new_sms"&&nn.trim()?[nn.trim()]:[],Fe=Ot||Ie?Oh(te):null,Me={user_prompt:b,agent:x,schedule_type:Fe,schedule_values:ve.length>0?ve:null,schedule_enabled:te==="ondemand"?!0:D,requires_confirmation:Ot?J:!1,yolo_mode:F,foreground_mode:oe,command:Qt?V:""};Ut&&(Me.id=e.id);const Zt=await c(Ut?"task.update":"task.create",Me,{timeout:45e3});if(Zt.error){I(Zt.error);return}Ut||d(f.hostId,x),l(Zt)}catch(ve){I(ve instanceof Error?ve.message:String(ve))}finally{xe(!1)}}const Xt=Ut?"Save":(Ot||Ie||Qt)&&D?"Schedule":"Save";return y.jsxs("div",{className:"task-form-overlay",children:[y.jsx("div",{className:"task-form",children:A?y.jsx(PE,{permissions:e==null?void 0:e.permissions}):y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"task-form-header",children:y.jsx("h2",{children:e?"Edit Task":"New Task"})}),P&&y.jsx("div",{className:"form-error",children:P}),y.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:b,onChange:ve=>g(ve.target.value),placeholder:Qt?"If the input email contains an event, create a calendar entry for it.":"Research today's top AI news and write a summary.",rows:4,disabled:X}),y.jsxs("div",{className:"plan-actions",children:[t.length>0&&y.jsx("div",{className:"agent-picker-section-inline",children:t.length>1?y.jsx("select",{className:"form-select form-select-sm",value:x,onChange:ve=>v(ve.target.value),disabled:X,children:t.map(ve=>y.jsx("option",{value:ve.key,children:ve.label},ve.key))}):y.jsx("span",{className:"agent-picker-single",children:(Ke==null?void 0:Ke.label)??t[0].label})}),wt&&y.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[y.jsx("input",{type:"checkbox",checked:F,onChange:ve=>fe(ve.target.checked),disabled:X}),"Yolo"]}),wt&&F&&y.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),S&&y.jsx("div",{className:"granted-permissions-row",children:y.jsx("button",{className:"btn btn-link",onClick:()=>O(!0),children:"Granted Permissions"})})]}),y.jsx("div",{className:"toggles-group",children:y.jsxs("div",{className:"schedule-section",children:[y.jsxs("h3",{className:"schedule-section-title",children:["Schedule ",dt&&y.jsx("span",{className:"schedule-section-hint",children:"based on host time"})]}),y.jsxs("select",{className:"form-select",value:te,onChange:ve=>un(ve.target.value),disabled:X,children:[y.jsx("option",{value:"ondemand",children:"On User Demand"}),y.jsx("option",{value:"specific_times",children:"Specific Times"}),y.jsx("option",{value:"hourly",children:"Hourly"}),y.jsx("option",{value:"daily",children:"Daily"}),y.jsx("option",{value:"weekly",children:"Weekly"}),y.jsx("option",{value:"monthly",children:"Monthly"}),y.jsx("option",{value:"on_new_notification",children:"On New Notification"}),y.jsx("option",{value:"on_new_sms",children:"On New SMS"}),y.jsx("option",{value:"command",children:"On Command Output"})]}),Ie&&y.jsxs("div",{className:"schedule-reactive",children:[y.jsxs("p",{className:"command-help-text",children:[te==="on_new_notification"?"Runs each time a new push notification arrives on the paired Android device.":"Runs each time a new SMS arrives on the paired Android device."," ","The triggering payload is spliced into your task prompt — reference it as “the new ",te==="on_new_notification"?"notification":"SMS","”."]}),te==="on_new_notification"&&(()=>{const ve=N.find(Me=>Me.packageName===z),Fe=(ve==null?void 0:ve.appName)||z;return y.jsxs(y.Fragment,{children:[s?z.trim()?y.jsxs("div",{className:"app-filter-selected",children:[y.jsx("span",{className:"app-filter-selected-name",children:Fe}),(ve==null?void 0:ve.appName)&&y.jsx("span",{className:"app-filter-selected-pkg",children:ve.packageName}),y.jsx("button",{type:"button",className:"app-filter-selected-clear",onClick:()=>W(""),"aria-label":"Clear app filter",disabled:X,children:"✕"})]}):y.jsx("button",{type:"button",className:"btn btn-link app-filter-trigger",onClick:()=>{We(""),Ae(!0)},disabled:X,children:"Select app"}):y.jsx("input",{className:"form-input",type:"text",value:z,onChange:Me=>W(Me.target.value),placeholder:"App (optional), e.g. com.google.android.gm",disabled:X}),y.jsx("p",{className:"command-help-text app-filter-help",children:z.trim()?`Only notifications from ${Fe} will trigger this task.`:"Every notification from your device triggers this task."})]})})(),te==="on_new_sms"&&y.jsxs(y.Fragment,{children:[y.jsx("input",{className:"form-input",type:"text",value:nn,onChange:ve=>Gt(ve.target.value),placeholder:"From (optional), e.g. +1 555-1234)",disabled:X}),y.jsx("p",{className:"command-help-text app-filter-help",children:nn.trim()?`Only SMS from ${nn.trim()} will trigger this task. Formatting (spaces, dashes, parens) is ignored.`:"Every SMS that arrives on your device triggers this task."})]})]}),Qt&&y.jsxs("div",{className:"schedule-reactive",children:[y.jsx("p",{className:"command-help-text",children:"Runs a command and invokes the task for each line of output. Use “the input” in your task description to reference each line."}),y.jsx("input",{ref:on,className:"form-input form-input-mono",type:"text",value:V,onChange:ve=>Q(ve.target.value),placeholder:"gws gmail +watch --project my-project",disabled:X})]}),Ot&&te!=="hourly"&&y.jsxs(y.Fragment,{children:[L.map((ve,Fe)=>y.jsxs("div",{className:"trigger-row-card",children:[y.jsxs("div",{className:"trigger-row-content",children:[te==="daily"&&y.jsx("input",{className:"form-input",type:"time",value:ve.time,onChange:Me=>Re(Fe,{time:Me.target.value})}),te==="weekly"&&y.jsxs("div",{className:"trigger-row-top",children:[y.jsx("select",{className:"form-select",value:ve.dayOfWeek,onChange:Me=>Re(Fe,{dayOfWeek:Me.target.value}),children:qE.map((Me,_t)=>y.jsx("option",{value:String(_t),children:Me},_t))}),y.jsx("input",{className:"form-input",type:"time",value:ve.time,onChange:Me=>Re(Fe,{time:Me.target.value})})]}),te==="monthly"&&y.jsxs("div",{className:"trigger-row-top",children:[y.jsx("select",{className:"form-select",value:ve.dayOfMonth,onChange:Me=>Re(Fe,{dayOfMonth:Me.target.value}),children:Array.from({length:28},(Me,_t)=>_t+1).map(Me=>y.jsxs("option",{value:String(Me),children:["Day ",Me]},Me))}),y.jsx("input",{className:"form-input",type:"time",value:ve.time,onChange:Me=>Re(Fe,{time:Me.target.value})})]}),te==="specific_times"&&y.jsxs("div",{className:"trigger-row-top",children:[y.jsx("input",{className:"form-input",type:"date",value:ve.onceDate,min:Cn.date,onChange:Me=>Re(Fe,{onceDate:Me.target.value})}),y.jsx("input",{className:"form-input",type:"time",value:ve.onceTime,min:ve.onceDate===Cn.date?Cn.time:void 0,onChange:Me=>Re(Fe,{onceTime:Me.target.value})})]})]}),L.length>1&&y.jsx("button",{className:"trigger-remove-btn",onClick:()=>Ge(Fe),title:"Remove trigger",children:"×"})]},Fe)),y.jsx("button",{className:"trigger-add-btn",onClick:rt,children:"+ Add"})]}),r==="win32"&&y.jsxs("label",{className:"toggle-label",children:[y.jsx("input",{type:"checkbox",checked:oe,onChange:ve=>ne(ve.target.checked),disabled:X}),"Run in the foreground (host must login to Windows)"]}),Ot&&y.jsxs("label",{className:"toggle-label",children:[y.jsx("input",{type:"checkbox",checked:J,onChange:ve=>B(ve.target.checked),disabled:X}),"Confirm before each run"]}),te!=="ondemand"&&y.jsxs("label",{className:"toggle-label",children:[y.jsx("input",{type:"checkbox",checked:D,onChange:ve=>G(ve.target.checked),disabled:X}),"Enabled"]})]})}),!F&&Ke&&!Ke.supportsPermissions&&y.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",Ke.label,". The task may fail if required permissions are not pre-configured."]}),y.jsxs("div",{className:"form-actions",children:[y.jsxs("button",{className:"btn btn-primary",onClick:()=>Jt()&&yt(),disabled:!ke||X,children:[X&&y.jsx("span",{className:"btn-spinner"}),Xt]}),y.jsx("button",{className:"btn btn-secondary",onClick:()=>{gt&&b.trim()&&!confirm("You have unsaved changes. Discard?")||o()},style:{marginLeft:"auto"},children:"Cancel"})]})]})}),he&&(()=>{const ve=Se.trim().toLowerCase(),Fe=ve?N.filter(Me=>Me.packageName.toLowerCase().includes(ve)||Me.appName.toLowerCase().includes(ve)):N;return y.jsx("div",{className:"app-filter-overlay",onClick:It,children:y.jsxs("div",{className:"app-filter-dialog",onClick:Me=>Me.stopPropagation(),children:[y.jsxs("div",{className:"app-filter-header",children:[y.jsx("h2",{children:"Select app"}),y.jsx("button",{className:"app-filter-close",onClick:It,"aria-label":"Close",children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:y.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),y.jsx("input",{className:"form-input app-filter-search",type:"text",value:Se,onChange:Me=>We(Me.target.value),onKeyDown:Me=>{Me.key==="Enter"&&Se.trim()&&(W(Se.trim()),It())},placeholder:"Search or type a package name",autoFocus:!0}),y.jsxs("ul",{className:"app-filter-list",children:[Oe&&N.length===0?Array.from({length:6}).map((Me,_t)=>y.jsx("li",{className:"app-filter-row app-filter-skeleton",children:y.jsx("div",{className:"app-filter-skeleton-bar"})},`sk-${_t}`)):Fe.length===0&&!Se.trim()?y.jsx("li",{className:"app-filter-empty",children:"No apps"}):Fe.map(Me=>y.jsx("li",{className:"app-filter-row",onClick:()=>{W(Me.packageName),It()},children:y.jsxs("div",{className:"app-filter-row-labels",children:[y.jsx("div",{className:"app-filter-row-name",children:Me.appName||Me.packageName}),Me.appName&&y.jsx("div",{className:"app-filter-row-pkg",children:Me.packageName})]})},Me.packageName)),Se.trim()&&y.jsx("li",{className:"app-filter-row",onClick:()=>{W(Se.trim()),It()},children:y.jsx("div",{className:"app-filter-row-labels",children:y.jsx("div",{className:"app-filter-row-name",children:Se.trim()})})})]})]})})})()]})}function Bx({pullDistance:e,refreshing:t,threshold:r}){const s=e>0||t,l=e>=r;return y.jsx("div",{className:"pull-to-refresh",style:{transform:`translateY(${e}px)`,opacity:s?Math.min(1,e/30):0},"aria-hidden":!s,children:y.jsx("div",{className:"pull-to-refresh-badge",children:t?y.jsx("div",{className:"spinner"}):y.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s"},children:[y.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),y.jsx("polyline",{points:"19 12 12 19 5 12"})]})})})}function Hx({onRefresh:e,threshold:t=70,maxPull:r=110,enabled:s=!0}){const[l,o]=E.useState(0),[c,f]=E.useState(!1),d=E.useRef(null),m=E.useRef(!1),b=E.useRef(0),g=E.useRef(!1),x=E.useRef(e);return E.useEffect(()=>{x.current=e}),E.useEffect(()=>{if(!s)return;const v=O=>{if(g.current||window.scrollY>0){d.current=null;return}if(JE(O.target)){d.current=null;return}d.current=O.touches[0].clientY,m.current=!1,b.current=0},S=O=>{if(g.current||d.current==null)return;const M=O.touches[0].clientY-d.current;if(M<=0){m.current=!1,b.current=0,o(0);return}m.current=!0;const P=Math.min(r,M*.5);b.current=P,o(P),O.cancelable&&O.preventDefault()},A=()=>{if(!m.current){d.current=null,o(0);return}const O=b.current;d.current=null,m.current=!1,b.current=0,O>=t?(g.current=!0,f(!0),o(t),Promise.resolve(x.current()).catch(()=>{}).finally(()=>{g.current=!1,f(!1),o(0)})):o(0)};return window.addEventListener("touchstart",v,{passive:!0}),window.addEventListener("touchmove",S,{passive:!1}),window.addEventListener("touchend",A,{passive:!0}),window.addEventListener("touchcancel",A,{passive:!0}),()=>{window.removeEventListener("touchstart",v),window.removeEventListener("touchmove",S),window.removeEventListener("touchend",A),window.removeEventListener("touchcancel",A)}},[s,t,r]),{pullDistance:l,refreshing:c,threshold:t}}function JE(e){let t=e;for(;t&&t!==document.body&&t!==document.documentElement;){const r=window.getComputedStyle(t).overflowY;if((r==="auto"||r==="scroll")&&t.scrollHeight>t.clientHeight)return!0;t=t.parentElement}return!1}function XE(e){return JSON.stringify([e.user_prompt,e.agent??null,e.schedule_type??null,e.schedule_values??null,e.schedule_enabled,e.requires_confirmation,e.yolo_mode??!1,e.foreground_mode??!1,e.command??"",e.permissions??null])}function KE({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:o,isNotificationListener:c,onViewRun:f,hostInfoStatus:d}){const[m,b]=E.useState([]),[g,x]=E.useState(!1),[v,S]=E.useState(null),[A,O]=E.useState(new Map),[M,P]=E.useState(!1),[I,te]=E.useState(void 0),q=E.useCallback(()=>{P(!1),te(void 0)},[]),L=E.useCallback(async()=>{if(e){x(!0),S(null);try{const G=(await r("task.list")).tasks??[],F=new Map;for(const fe of G)fe.status&&F.set(fe.id,fe.status);O(F),b(G)}catch(D){const G=D instanceof Error?D.message:String(D);G==="Not connected"||G.includes("503")||G.toLowerCase().includes("no responders")?S(null):S(G),b([])}finally{x(!1)}}},[e,t,r]);E.useEffect(()=>{e?L():(b([]),x(!1))},[e,t,L]);const ee=Hx({onRefresh:L,enabled:e});E.useEffect(()=>!e||!t?void 0:s(t,async G=>{const F=G.subject.split(".");if(F.length<3)return;const fe=F.slice(2).join(".");let oe={};try{oe=JSON.parse(new TextDecoder().decode(G.data))}catch{return}const ne=oe.event_type;if(!(ne!=="running-state"&&ne!=="permission-resolved"))try{const V=await r("task.status",{id:fe},{timeout:5e3});if(V.error)return;O(Q=>{const X=new Map(Q);return X.set(fe,V),X})}catch{}}),[e,t,s,r]);function J(D){b(G=>{const F=G.findIndex(fe=>fe.id===D.id);if(F>=0){const fe=[...G];return fe[F]=D,fe}return[D,...G]}),P(!1),te(void 0)}function B(D){b(G=>G.filter(F=>F.id!==D)),O(G=>{const F=new Map(G);return F.delete(D),F})}return y.jsxs(y.Fragment,{children:[y.jsx(Bx,{pullDistance:ee.pullDistance,refreshing:ee.refreshing,threshold:ee.threshold}),v&&y.jsxs("div",{className:"form-error",children:[v,v.toLowerCase().includes("failed to fetch")&&y.jsxs(y.Fragment,{children:[" ",y.jsx("a",{href:"#",onClick:D=>{D.preventDefault(),window.location.reload()},children:"Reload"})]})]}),g&&!m.length&&d==="ready"?y.jsx("div",{className:"task-list",children:[0,1,2].map(D=>y.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[y.jsx("div",{className:"task-card-header",children:y.jsxs("div",{className:"task-card-title-row",children:[y.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),y.jsx("div",{className:"skeleton-line",style:{width:`${60+D*12}%`}})]})}),y.jsxs("div",{className:"task-card-meta",children:[y.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},D))}):m.length===0?d==="loading"?y.jsx("div",{className:"empty-state",children:y.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),y.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Try running ",y.jsx("code",{children:"palmier restart"})," on the host machine to restart the daemon."]})]}):y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"No tasks yet"}),y.jsx("p",{className:"empty-state-hint",children:"Tap the + button to create your first task."})]}):y.jsx("div",{className:"task-list",children:m.map(D=>y.jsx(UE,{task:D,lastEvent:A.get(D.id),onEdit:G=>{te(G),P(!0),r("task.get",{id:G.id}).then(F=>{F.error||te(F)}).catch(()=>{})},onDelete:B,onViewRun:f},D.id))}),y.jsx("button",{className:"fab",onClick:()=>{te(void 0),P(!0)},"aria-label":"New task",title:"New task",children:y.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),y.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),M&&y.jsx(GE,{initial:I,agents:l,hostPlatform:o,isNotificationListener:c,onSaved:J,onCancel:q},I?XE(I):"new")]})}let ba=null;function X0(e){ba&&(e.preventDefault(),e.returnValue="")}function Mh(e){const t=!!ba;ba=e;const r=!!ba;r&&!t?window.addEventListener("beforeunload",X0):!r&&t&&window.removeEventListener("beforeunload",X0)}function Ss(){return ba?window.confirm(ba):!0}function QE(){const e=Yr(),t=kr(),{hostId:r}=Yu(),s=t.pathname.endsWith("/tasks"),l=!s;function o(c){Ss()&&r&&e(`/hosts/${encodeURIComponent(r)}${c}`)}return y.jsxs(y.Fragment,{children:[y.jsxs("button",{className:`tab-btn ${l?"tab-btn-active":""}`,onClick:()=>o(""),children:[y.jsx("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:y.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),y.jsxs("button",{className:`tab-btn ${s?"tab-btn-active":""}`,onClick:()=>o("/tasks"),children:[y.jsxs("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),y.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}function qx(e){const[t,r]=E.useState(()=>window.matchMedia(e).matches);return E.useEffect(()=>{const s=window.matchMedia(e),l=o=>r(o.matches);return s.addEventListener("change",l),r(s.matches),()=>s.removeEventListener("change",l)},[e]),t}const Cu=Gn.isNativePlatform(),ZE=["Device","Data","Messaging"],WE=[{capability:"sms-read",label:"Read SMS",group:"Messaging"},{capability:"sms-send",label:"Send SMS",group:"Messaging"},{capability:"send-email",label:"Prompt Email to Send",group:"Messaging"},{capability:"notifications",label:"Notifications from Other Apps",group:"Data"},{capability:"contacts",label:"Manage Contacts",group:"Data"},{capability:"calendar",label:"Manage Calendar",group:"Data"},{capability:"location",label:"Get Location",group:"Device"},{capability:"dnd",label:"Set Ringer Mode",group:"Device"},{capability:"alarm",label:"Trigger Alarms",group:"Device"}];async function eC(){if(!Cu||!Tn)return new Set;try{const{capabilities:e}=await Tn.getCapabilityStatus();return new Set(e.filter(t=>t.enabled).map(t=>t.name))}catch{return new Set}}function Ix({onChange:e,confirmDisable:t=!1}){const[r,s]=E.useState(new Map),[l,o]=E.useState(null),[c,f]=E.useState(null),d=E.useCallback(async()=>{if(!(!Cu||!Tn))try{const{capabilities:S}=await Tn.getCapabilityStatus(),A=new Map;for(const O of S)A.set(O.name,O);s(A),e==null||e(new Set(S.filter(O=>O.enabled).map(O=>O.name)))}catch(S){console.error("Failed to read capability status:",S)}},[e]);E.useEffect(()=>{d()},[d]),E.useEffect(()=>{if(!Cu)return;const S=pd.addListener("resume",d);return()=>{S.then(A=>A.remove())}},[d]);async function m(S,A){if(Tn){o(S.capability);try{const O=await Tn.setCapabilityEnabled({capability:S.capability,enabled:A});!O.enabled&&O.reason==="no-email-client"&&alert("No email app is installed on this device. Install one (e.g. Gmail) before enabling Send Email."),await d()}catch(O){console.error(`Failed to toggle ${S.capability}:`,O)}finally{o(null)}}}function b(S){const A=r.get(S.capability);if(A){if(A.enabled&&t){f(S);return}m(S,!A.enabled)}}function g(){const S=c;S&&(f(null),m(S,!1))}if(!Cu)return null;const x=ZE.map(S=>({group:S,items:WE.filter(A=>{const O=r.get(A.capability);return A.group===S&&(O==null?void 0:O.supported)})})).filter(S=>S.items.length>0);if(x.length===0)return y.jsx("div",{className:"capability-toggles-loading",children:y.jsx("span",{className:"spinner"})});const v=c&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>f(null),children:y.jsxs("div",{className:"confirm-modal",onClick:S=>S.stopPropagation(),children:[y.jsxs("h2",{className:"confirm-modal-title",children:["Disable ",c.label,"?"]}),y.jsxs("p",{className:"confirm-modal-message",children:["All hosts linked to this device will no longer be able to use ",c.label,"."]}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),children:"Cancel"}),y.jsx("button",{className:"btn btn-danger",onClick:g,children:"Disable"})]})]})}),document.body);return y.jsxs(y.Fragment,{children:[x.map(({group:S,items:A},O)=>y.jsx("div",{className:O>0?"drawer-toggle-group drawer-toggle-group-divided":"drawer-toggle-group",children:A.map(M=>{const P=r.get(M.capability),I=!!(P!=null&&P.enabled);return y.jsxs("label",{className:"drawer-toggle",children:[y.jsx("span",{className:"drawer-toggle-label",children:M.label}),y.jsx("button",{className:`toggle-switch ${I?"toggle-switch-on":""}`,onClick:()=>b(M),disabled:l===M.capability,role:"switch","aria-checked":I,children:y.jsx("span",{className:"toggle-switch-thumb"})})]},M.capability)})},S)),v]})}function Dh(e){return e.replace(/^https:\/\//,"")}function tC({request:e,onClose:t}){const[r,s]=E.useState(null),[l,o]=E.useState(!1),[c,f]=E.useState(null),[d,m]=E.useState(!1);E.useEffect(()=>{let x=!1;return e("passwords.list").then(v=>{x||(v.passwords?s([...v.passwords].sort((S,A)=>S.origin===A.origin?S.username.localeCompare(A.username):S.origin.localeCompare(A.origin))):o(!0))}).catch(()=>{x||o(!0)}),()=>{x=!0}},[e]);async function b(){if(!c)return;const{origin:x,username:v}=c;m(!0);try{await e("passwords.delete",{origin:x,username:v}),s(S=>(S==null?void 0:S.filter(A=>!(A.origin===x&&A.username===v)))??S),f(null)}catch(S){console.error("Failed to delete password:",S)}finally{m(!1)}}const g=c&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>{d||f(null)},children:y.jsxs("div",{className:"confirm-modal",onClick:x=>x.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Remove password?"}),y.jsxs("p",{className:"confirm-modal-message",children:["The saved password for ",y.jsx("strong",{children:c.username})," on"," ",y.jsx("strong",{children:Dh(c.origin)})," will be removed from this host."]}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),disabled:d,children:"Cancel"}),y.jsx("button",{className:"btn btn-danger",onClick:b,disabled:d,children:d?"Removing…":"Remove"})]})]})}),document.body);return pi.createPortal(y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"confirm-modal-overlay",onClick:t,children:y.jsxs("div",{className:"confirm-modal passwords-dialog",onClick:x=>x.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Saved Passwords"}),y.jsx("div",{className:"passwords-dialog-scroll",children:l?y.jsx("p",{className:"passwords-empty",children:"Couldn't load saved passwords."}):r===null?y.jsx("p",{className:"passwords-empty",children:"Loading…"}):r.length===0?y.jsx("p",{className:"passwords-empty",children:"No saved passwords. Passwords are saved when you approve them during a task."}):y.jsx("ul",{className:"passwords-list",children:r.map(x=>y.jsxs("li",{className:"password-item",children:[y.jsxs("div",{className:"password-item-text",children:[y.jsx("span",{className:"password-item-origin",children:Dh(x.origin)}),y.jsx("span",{className:"password-item-username",children:x.username})]}),y.jsx("button",{className:"password-delete-btn",onClick:()=>f(x),"aria-label":`Remove password for ${x.username} on ${Dh(x.origin)}`,children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("path",{d:"M4 5.5V11C4 11.2761 4.22386 11.5 4.5 11.5H9.5C9.77614 11.5 10 11.2761 10 11V5.5M3 4H11M5.5 4V3C5.5 2.72386 5.72386 2.5 6 2.5H8C8.27614 2.5 8.5 2.72386 8.5 3V4M6.5 6.5V9.5M7.5 6.5V9.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},`${x.origin}
|
|
91
|
-
${x.username}`))})}),y.jsx("div",{className:"confirm-modal-actions",children:y.jsx("button",{className:"btn btn-primary",onClick:t,children:"Done"})})]})}),g]}),document.body)}const K0=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),nC=Gn.isNativePlatform();function Q0({daemonVersion:e,agents:t,playwrightCli:r,linkedClientToken:s,request:l,onEnabledCapabilitiesChange:o,onLinkedClientTokenChange:c}){var Qt;const{pairedHosts:f,removePairedHost:d,renamePairedHost:m}=Zi(),{activeHost:b}=xi(),g=Yr(),x=kr(),S=Yu().hostId??null,A=b.clientToken||null,O=!!A&&s===A,M=qx("(min-width: 768px)"),[P,I]=E.useState(!1),[te,q]=E.useState(()=>Date.now());E.useEffect(()=>{const Ie=()=>q(Date.now()),dt=6e4-Date.now()%6e4,Ke=setTimeout(()=>{Ie();const wt=setInterval(Ie,6e4);Ke._iv=wt},dt);return()=>{const wt=Ke._iv;wt&&clearInterval(wt),clearTimeout(Ke)}},[]);const L=b.timezone?new Date(te).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:b.timezone}):"";async function ee(){if(!(!Tn||!l||!A)){I(!0);try{const{token:Ie}=await Tn.getFcmToken();if(!Ie)return;await l("device.link",{fcmToken:Ie}),c==null||c(A)}catch(Ie){console.error("Failed to make this the linked device:",Ie)}finally{I(!1)}}}async function J(Ie){const dt=Ie===S;if(dt&&l)try{await l("clients.revoke_self")}catch{}d(Ie),xe(null),dt&&g("/",{replace:!0})}function B(Ie){const Ke=x.pathname.endsWith("/tasks")?"/tasks":"";g(`/hosts/${encodeURIComponent(Ie)}${Ke}`)}const[D,G]=E.useState(!1),[F,fe]=E.useState(!1),[oe,ne]=E.useState(null),[V,Q]=E.useState(""),[X,xe]=E.useState(null),[j,z]=E.useState(!1),[W,N]=E.useState(!1),we=E.useRef(null),Oe=E.useRef(null),je=E.useCallback(()=>{fe(!0)},[]);function he(){F&&(G(!1),fe(!1))}function Ae(){fe(!1),G(!0)}function Se(Ie,dt){ne(Ie),Q(dt)}function We(){oe&&V.trim()&&m(oe,V.trim()),ne(null),Q("")}function It(){ne(null),Q("")}E.useEffect(()=>{oe&&Oe.current&&(Oe.current.focus(),Oe.current.select())},[oe]),E.useEffect(()=>{if(!D||F)return;function Ie(dt){dt.key==="Escape"&&je()}return document.addEventListener("keydown",Ie),()=>{document.removeEventListener("keydown",Ie)}},[D,F,je]);const ln=y.jsxs(y.Fragment,{children:[!M&&y.jsx("button",{className:"drawer-close-btn",onClick:je,"aria-label":"Close menu",children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:y.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),!K0&&f.length>0&&y.jsxs("div",{className:"drawer-section",children:[y.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),y.jsx("div",{className:"host-picker-inline",children:y.jsx("div",{className:"host-picker-list",role:"listbox",children:f.map(Ie=>{const dt=Ie.hostId===S,Ke=oe===Ie.hostId,wt=Ie.name||Ie.hostId.slice(0,8);return y.jsx("div",{className:"host-picker-item-wrapper",children:y.jsxs("div",{className:`host-picker-item ${dt?"host-picker-item-active":""}`,onClick:()=>{if(!Ke&&!dt){if(!Ss())return;B(Ie.hostId),M||je()}},role:"option","aria-selected":dt,children:[Ke?y.jsx("input",{ref:Oe,className:"form-input host-picker-rename-input",type:"text",value:V,onChange:Ut=>Q(Ut.target.value),onKeyDown:Ut=>{Ut.key==="Enter"&&We(),Ut.key==="Escape"&&It()},onBlur:We,onClick:Ut=>Ut.stopPropagation()}):y.jsx("span",{className:"host-picker-item-name",children:wt}),y.jsxs("div",{className:"host-picker-item-actions",children:[dt&&!Ke&&y.jsx("button",{className:"host-picker-edit-btn",onClick:Ut=>{Ut.stopPropagation(),Se(Ie.hostId,wt)},"aria-label":"Rename host",children:y.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:y.jsx("path",{d:"M9.5 1.5L11.5 3.5M1.5 11.5L2 9L9 2L11 4L4 11L1.5 11.5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),!dt&&y.jsx("button",{className:"host-picker-delete-btn",onClick:Ut=>{Ut.stopPropagation(),xe(Ie.hostId)},"aria-label":`Unpair ${wt}`,children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("path",{d:"M4 5.5V11C4 11.2761 4.22386 11.5 4.5 11.5H9.5C9.77614 11.5 10 11.2761 10 11V5.5M3 4H11M5.5 4V3C5.5 2.72386 5.72386 2.5 6 2.5H8C8.27614 2.5 8.5 2.72386 8.5 3V4M6.5 6.5V9.5M7.5 6.5V9.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})},Ie.hostId)})})})]}),!K0&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-divider"}),y.jsx("div",{className:"drawer-section",children:y.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{Ss()&&(g("/pair"),M||je())},children:"Add New Host"})})]}),nC&&l&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-divider"}),y.jsxs("div",{className:"drawer-section",children:[y.jsx("h3",{className:"drawer-section-label",children:"Device Capabilities"}),O?y.jsx(Ix,{onChange:o,confirmDisable:!0}):y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"drawer-section-hint",children:"This device isn't the linked device for the host, so it can't provide capabilities (SMS, contacts, location, etc.)."}),y.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>{s&&s!==A?z(!0):ee()},disabled:P,children:P?"Linking…":"Link the host to this device"})]})]})]}),l&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-divider"}),y.jsxs("div",{className:"drawer-section",children:[y.jsx("h3",{className:"drawer-section-label",children:"Passwords"}),y.jsx("button",{className:"btn btn-link",onClick:()=>N(!0),children:"Manage saved passwords"})]})]}),y.jsxs("div",{className:"drawer-footer",children:[t&&t.length>0&&(()=>{const Ie=t.filter(Ke=>Ke.version),dt=t.filter(Ke=>!Ke.version);return y.jsxs("div",{className:"drawer-agents",children:[Ie.length>0&&y.jsxs("div",{className:"drawer-agents-section",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Agents"}),Ie.map(Ke=>y.jsxs("div",{className:"drawer-agents-row",children:[y.jsx("span",{children:Ke.label}),y.jsxs("span",{className:"drawer-agents-version",children:["v",Ke.version]})]},Ke.key))]}),dt.length>0&&y.jsxs("div",{className:"drawer-agents-section",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Version not managed by Palmier"}),dt.map(Ke=>y.jsx("div",{className:"drawer-agents-row",children:y.jsx("span",{children:Ke.label})},Ke.key))]})]})})(),r&&y.jsx("div",{className:"drawer-agents",children:y.jsxs("div",{className:"drawer-agents-section",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Browser Automation"}),y.jsxs("div",{className:"drawer-agents-row",children:[y.jsx("span",{children:r.label}),y.jsxs("span",{className:"drawer-agents-version",children:["v",r.version]})]})]})}),(b.timezone||e)&&y.jsxs("div",{className:"drawer-host-info",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Host"}),b.timezone&&y.jsxs("div",{className:"drawer-host-time",children:[L," · ",b.timezone]}),e&&y.jsxs("div",{className:"drawer-version",children:["Version: v",e]})]}),y.jsxs("div",{className:"drawer-legal",children:[y.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),y.jsx("span",{className:"drawer-legal-sep",children:"·"}),y.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),nn=!!X&&X===S&&O,Gt=X&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>xe(null),children:y.jsxs("div",{className:"confirm-modal",onClick:Ie=>Ie.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Remove host?"}),y.jsxs("p",{className:"confirm-modal-message",children:['"',((Qt=f.find(Ie=>Ie.hostId===X))==null?void 0:Qt.name)||X.slice(0,8),'" will be ',nn?"removed and unlinked":"removed",".",nn&&y.jsx(y.Fragment,{children:" This device is currently linked to the host — unlinking will revoke its access to all device capabilities (SMS, contacts, location, etc.) until another device is linked."})]}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>xe(null),children:"Cancel"}),y.jsx("button",{className:"btn btn-danger",onClick:()=>J(X),children:"Remove"})]})]})}),document.body),on=j&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>z(!1),children:y.jsxs("div",{className:"confirm-modal",onClick:Ie=>Ie.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),y.jsx("p",{className:"confirm-modal-message",children:"Another device is already linked to this host. Only one device can be linked to the host — switching will disable those capabilities on the currently linked device."}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>z(!1),children:"Cancel"}),y.jsx("button",{className:"btn btn-primary",onClick:()=>{z(!1),ee()},children:"Link"})]})]})}),document.body),Ot=W&&l&&y.jsx(tC,{request:l,onClose:()=>N(!1)});return M?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:we,children:ln}),Gt,on,Ot]}):y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"hamburger-btn",onClick:Ae,"aria-label":"Open menu",children:y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:y.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),D&&pi.createPortal(y.jsx("div",{className:`drawer-overlay ${F?"drawer-overlay-closing":""}`,onClick:je,onAnimationEnd:he,children:y.jsx("div",{className:`drawer-panel ${F?"drawer-panel-closing":""}`,ref:we,onClick:Ie=>Ie.stopPropagation(),children:ln})}),document.body),Gt,on,Ot]})}const rC=Gn.isNativePlatform(),Gd={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function iC(){return y.jsxs("svg",{...Gd,"aria-hidden":"true",children:[y.jsx("path",{d:"M3 11 L12 3 L21 11"}),y.jsx("path",{d:"M5 9.5 V21 H19 V9.5"})]})}function Z0(){return y.jsxs("svg",{...Gd,"aria-hidden":"true",children:[y.jsx("circle",{cx:"12",cy:"12",r:"10"}),y.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),y.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}function sC(){return y.jsxs("svg",{...Gd,"aria-hidden":"true",children:[y.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),y.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),y.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function aC(){const{mode:e}=xi(),[t,r]=E.useState(!1),s=E.useRef(null);if(E.useEffect(()=>{if(!t)return;function f(m){var b;(b=s.current)!=null&&b.contains(m.target)||r(!1)}document.addEventListener("pointerdown",f);const d=window.setTimeout(()=>r(!1),3e3);return()=>{document.removeEventListener("pointerdown",f),clearTimeout(d)}},[t]),e==="direct")return null;let l,o,c;switch(e){case"lan":l=y.jsx(iC,{}),o="Connected via LAN",c="lan";break;case"nats":l=y.jsx(Z0,{}),o=rC?"Connected via relay":"Connected",c="relay";break;case"disconnected":l=y.jsx(sC,{}),o="Disconnected",c="disconnected";break;case"connecting":default:l=y.jsx(Z0,{}),o="Connecting…",c="connecting";break}return y.jsxs("div",{ref:s,className:`conn-status conn-status--${c}`,children:[y.jsx("button",{type:"button",className:"conn-status-btn","aria-label":o,onClick:()=>r(f=>!f),children:l}),y.jsx("div",{className:`conn-status-popover ${t?"conn-status-popover--open":""}`,role:"tooltip",children:o})]})}function W0(e,t){var s;const r=e.map(l=>l.key);return t&&r.includes(t)?t:((s=e[0])==null?void 0:s.key)??""}function lC({agents:e,hostPlatform:t,onStarted:r}){const{request:s,activeHost:l}=xi(),{setHostLastAgent:o}=Zi(),[c,f]=E.useState(""),[d,m]=E.useState(()=>W0(e,l.lastAgent)),[b,g]=E.useState(!1),[x,v]=E.useState(!1),[S,A]=E.useState(null);E.useEffect(()=>{e.length&&(e.find(L=>L.key===d)||m(W0(e,l.lastAgent)))},[e,d,l.lastAgent]),E.useEffect(()=>{const L=c.trim().length>0;return Mh(L?"Your session draft will be lost. Continue?":null),()=>Mh(null)},[c]);const O=e.find(L=>L.key===d),M=!!(O!=null&&O.supportsYolo);E.useEffect(()=>{!M&&b&&g(!1)},[M,b]);const P=!!c.trim()&&!!d&&!x;function I(){return b?confirm(`Yolo mode is enabled. The agent will auto-approve all tool calls — it can read, write, delete files, run arbitrary commands, and access the network without asking for permission.
|
|
90
|
+
Are you sure you want to continue?`):!0}async function An(){z(!0),q(null);try{const we=Be?Vt():N==="on_new_notification"&&T.trim()?[T.trim()]:N==="on_new_sms"&&$t.trim()?[$t.trim()]:[],Ye=Be||st?Oh(N):null,Re={user_prompt:x,agent:S,schedule_type:Ye,schedule_values:we.length>0?we:null,schedule_enabled:N==="ondemand"?!0:$,requires_confirmation:Be?L:!1,yolo_mode:le,foreground_mode:V,command:nt?X:""};at&&(Re.id=e.id,ae&&(Re.custom_name=b.trim()));const ln=await c(at?"task.update":"task.create",Re,{timeout:45e3});if(ln.error){q(ln.error);return}at||d(f.hostId,S),l(ln)}catch(we){q(we instanceof Error?we.message:String(we))}finally{z(!1)}}const pn=at?"Save":(Be||st||nt)&&$?"Schedule":"Save";return y.jsxs("div",{className:"task-form-overlay",children:[y.jsx("div",{className:"task-form",children:M?y.jsx(PE,{permissions:e==null?void 0:e.permissions}):y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"task-form-header",children:y.jsx("h2",{children:e?"Edit Task":"New Task"})}),ue&&y.jsx("div",{className:"form-error",children:ue}),at&&y.jsxs("div",{children:[y.jsxs("label",{className:"form-label task-title-field",children:["Title",y.jsx("input",{className:"form-input",type:"text",value:b,onChange:we=>g(we.target.value),placeholder:e.name,maxLength:80,disabled:A})]}),y.jsx("p",{className:"command-help-text task-title-help",children:"Leave empty to use an auto-generated title."})]}),y.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:x,onChange:we=>v(we.target.value),placeholder:nt?"If the input email contains an event, create a calendar entry for it.":"Research today's top AI news and write a summary.",rows:4,disabled:A}),y.jsxs("div",{className:"plan-actions",children:[t.length>0&&y.jsx("div",{className:"agent-picker-section-inline",children:t.length>1?y.jsx("select",{className:"form-select form-select-sm",value:S,onChange:we=>j(we.target.value),disabled:A,children:t.map(we=>y.jsx("option",{value:we.key,children:we.label},we.key))}):y.jsx("span",{className:"agent-picker-single",children:(_t==null?void 0:_t.label)??t[0].label})}),mn&&y.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[y.jsx("input",{type:"checkbox",checked:le,onChange:we=>te(we.target.checked),disabled:A}),"Yolo"]}),mn&&le&&y.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),R&&y.jsx("div",{className:"granted-permissions-row",children:y.jsx("button",{className:"btn btn-link",onClick:()=>P(!0),children:"Granted Permissions"})})]}),y.jsx("div",{className:"toggles-group",children:y.jsxs("div",{className:"schedule-section",children:[y.jsxs("h3",{className:"schedule-section-title",children:["Schedule ",Ot&&y.jsx("span",{className:"schedule-section-hint",children:"based on host time"})]}),y.jsxs("select",{className:"form-select",value:N,onChange:we=>yt(we.target.value),disabled:A,children:[y.jsx("option",{value:"ondemand",children:"On User Demand"}),y.jsx("option",{value:"specific_times",children:"Specific Times"}),y.jsx("option",{value:"hourly",children:"Hourly"}),y.jsx("option",{value:"daily",children:"Daily"}),y.jsx("option",{value:"weekly",children:"Weekly"}),y.jsx("option",{value:"monthly",children:"Monthly"}),y.jsx("option",{value:"on_new_notification",children:"On New Notification"}),y.jsx("option",{value:"on_new_sms",children:"On New SMS"}),y.jsx("option",{value:"command",children:"On Command Output"})]}),st&&y.jsxs("div",{className:"schedule-reactive",children:[y.jsxs("p",{className:"command-help-text",children:[N==="on_new_notification"?"Runs each time a new push notification arrives on the paired Android device.":"Runs each time a new SMS arrives on the paired Android device."," ","The triggering payload is spliced into your task prompt — reference it as “the new ",N==="on_new_notification"?"notification":"SMS","”."]}),N==="on_new_notification"&&(()=>{const we=je.find(Re=>Re.packageName===T),Ye=(we==null?void 0:we.appName)||T;return y.jsxs(y.Fragment,{children:[s?T.trim()?y.jsxs("div",{className:"app-filter-selected",children:[y.jsx("span",{className:"app-filter-selected-name",children:Ye}),(we==null?void 0:we.appName)&&y.jsx("span",{className:"app-filter-selected-pkg",children:we.packageName}),y.jsx("button",{type:"button",className:"app-filter-selected-clear",onClick:()=>ve(""),"aria-label":"Clear app filter",disabled:A,children:"✕"})]}):y.jsx("button",{type:"button",className:"btn btn-link app-filter-trigger",onClick:()=>{dn(""),Qe(!0)},disabled:A,children:"Select app"}):y.jsx("input",{className:"form-input",type:"text",value:T,onChange:Re=>ve(Re.target.value),placeholder:"App (optional), e.g. com.google.android.gm",disabled:A}),y.jsx("p",{className:"command-help-text app-filter-help",children:T.trim()?`Only notifications from ${Ye} will trigger this task.`:"Every notification from your device triggers this task."})]})})(),N==="on_new_sms"&&y.jsxs(y.Fragment,{children:[y.jsx("input",{className:"form-input",type:"text",value:$t,onChange:we=>an(we.target.value),placeholder:"From (optional), e.g. +1 555-1234)",disabled:A}),y.jsx("p",{className:"command-help-text app-filter-help",children:$t.trim()?`Only SMS from ${$t.trim()} will trigger this task. Formatting (spaces, dashes, parens) is ignored.`:"Every SMS that arrives on your device triggers this task."})]})]}),nt&&y.jsxs("div",{className:"schedule-reactive",children:[y.jsx("p",{className:"command-help-text",children:"Runs a command and invokes the task for each line of output. Use “the input” in your task description to reference each line."}),y.jsx("input",{ref:bn,className:"form-input form-input-mono",type:"text",value:X,onChange:we=>xe(we.target.value),placeholder:"gws gmail +watch --project my-project",disabled:A})]}),Be&&N!=="hourly"&&y.jsxs(y.Fragment,{children:[G.map((we,Ye)=>y.jsxs("div",{className:"trigger-row-card",children:[y.jsxs("div",{className:"trigger-row-content",children:[N==="daily"&&y.jsx("input",{className:"form-input",type:"time",value:we.time,onChange:Re=>zt(Ye,{time:Re.target.value})}),N==="weekly"&&y.jsxs("div",{className:"trigger-row-top",children:[y.jsx("select",{className:"form-select",value:we.dayOfWeek,onChange:Re=>zt(Ye,{dayOfWeek:Re.target.value}),children:qE.map((Re,bt)=>y.jsx("option",{value:String(bt),children:Re},bt))}),y.jsx("input",{className:"form-input",type:"time",value:we.time,onChange:Re=>zt(Ye,{time:Re.target.value})})]}),N==="monthly"&&y.jsxs("div",{className:"trigger-row-top",children:[y.jsx("select",{className:"form-select",value:we.dayOfMonth,onChange:Re=>zt(Ye,{dayOfMonth:Re.target.value}),children:Array.from({length:28},(Re,bt)=>bt+1).map(Re=>y.jsxs("option",{value:String(Re),children:["Day ",Re]},Re))}),y.jsx("input",{className:"form-input",type:"time",value:we.time,onChange:Re=>zt(Ye,{time:Re.target.value})})]}),N==="specific_times"&&y.jsxs("div",{className:"trigger-row-top",children:[y.jsx("input",{className:"form-input",type:"date",value:we.onceDate,min:Me.date,onChange:Re=>zt(Ye,{onceDate:Re.target.value})}),y.jsx("input",{className:"form-input",type:"time",value:we.onceTime,min:we.onceDate===Me.date?Me.time:void 0,onChange:Re=>zt(Ye,{onceTime:Re.target.value})})]})]}),G.length>1&&y.jsx("button",{className:"trigger-remove-btn",onClick:()=>Sn(Ye),title:"Remove trigger",children:"×"})]},Ye)),y.jsx("button",{className:"trigger-add-btn",onClick:Kt,children:"+ Add"})]}),r==="win32"&&y.jsxs("label",{className:"toggle-label",children:[y.jsx("input",{type:"checkbox",checked:V,onChange:we=>Q(we.target.checked),disabled:A}),"Run in the foreground (host must login to Windows)"]}),Be&&y.jsxs("label",{className:"toggle-label",children:[y.jsx("input",{type:"checkbox",checked:L,onChange:we=>J(we.target.checked),disabled:A}),"Confirm before each run"]}),N!=="ondemand"&&y.jsxs("label",{className:"toggle-label",children:[y.jsx("input",{type:"checkbox",checked:$,onChange:we=>he(we.target.checked),disabled:A}),"Enabled"]})]})}),!le&&_t&&!_t.supportsPermissions&&y.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",_t.label,". The task may fail if required permissions are not pre-configured."]}),y.jsxs("div",{className:"form-actions",children:[y.jsxs("button",{className:"btn btn-primary",onClick:()=>Ze()&&An(),disabled:!rt||A,children:[A&&y.jsx("span",{className:"btn-spinner"}),pn]}),y.jsx("button",{className:"btn btn-secondary",onClick:()=>{_e&&x.trim()&&!confirm("You have unsaved changes. Discard?")||o()},style:{marginLeft:"auto"},children:"Cancel"})]})]})}),ke&&(()=>{const we=Lt.trim().toLowerCase(),Ye=we?je.filter(Re=>Re.packageName.toLowerCase().includes(we)||Re.appName.toLowerCase().includes(we)):je;return y.jsx("div",{className:"app-filter-overlay",onClick:tn,children:y.jsxs("div",{className:"app-filter-dialog",onClick:Re=>Re.stopPropagation(),children:[y.jsxs("div",{className:"app-filter-header",children:[y.jsx("h2",{children:"Select app"}),y.jsx("button",{className:"app-filter-close",onClick:tn,"aria-label":"Close",children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:y.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),y.jsx("input",{className:"form-input app-filter-search",type:"text",value:Lt,onChange:Re=>dn(Re.target.value),onKeyDown:Re=>{Re.key==="Enter"&&Lt.trim()&&(ve(Lt.trim()),tn())},placeholder:"Search or type a package name",autoFocus:!0}),y.jsxs("ul",{className:"app-filter-list",children:[ce&&je.length===0?Array.from({length:6}).map((Re,bt)=>y.jsx("li",{className:"app-filter-row app-filter-skeleton",children:y.jsx("div",{className:"app-filter-skeleton-bar"})},`sk-${bt}`)):Ye.length===0&&!Lt.trim()?y.jsx("li",{className:"app-filter-empty",children:"No apps"}):Ye.map(Re=>y.jsx("li",{className:"app-filter-row",onClick:()=>{ve(Re.packageName),tn()},children:y.jsxs("div",{className:"app-filter-row-labels",children:[y.jsx("div",{className:"app-filter-row-name",children:Re.appName||Re.packageName}),Re.appName&&y.jsx("div",{className:"app-filter-row-pkg",children:Re.packageName})]})},Re.packageName)),Lt.trim()&&y.jsx("li",{className:"app-filter-row",onClick:()=>{ve(Lt.trim()),tn()},children:y.jsx("div",{className:"app-filter-row-labels",children:y.jsx("div",{className:"app-filter-row-name",children:Lt.trim()})})})]})]})})})()]})}function Bx({pullDistance:e,refreshing:t,threshold:r}){const s=e>0||t,l=e>=r;return y.jsx("div",{className:"pull-to-refresh",style:{transform:`translateY(${e}px)`,opacity:s?Math.min(1,e/30):0},"aria-hidden":!s,children:y.jsx("div",{className:"pull-to-refresh-badge",children:t?y.jsx("div",{className:"spinner"}):y.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s"},children:[y.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),y.jsx("polyline",{points:"19 12 12 19 5 12"})]})})})}function Hx({onRefresh:e,threshold:t=70,maxPull:r=110,enabled:s=!0}){const[l,o]=E.useState(0),[c,f]=E.useState(!1),d=E.useRef(null),m=E.useRef(!1),b=E.useRef(0),g=E.useRef(!1),x=E.useRef(e);return E.useEffect(()=>{x.current=e}),E.useEffect(()=>{if(!s)return;const v=R=>{if(g.current||window.scrollY>0){d.current=null;return}if(JE(R.target)){d.current=null;return}d.current=R.touches[0].clientY,m.current=!1,b.current=0},S=R=>{if(g.current||d.current==null)return;const M=R.touches[0].clientY-d.current;if(M<=0){m.current=!1,b.current=0,o(0);return}m.current=!0;const P=Math.min(r,M*.5);b.current=P,o(P),R.cancelable&&R.preventDefault()},j=()=>{if(!m.current){d.current=null,o(0);return}const R=b.current;d.current=null,m.current=!1,b.current=0,R>=t?(g.current=!0,f(!0),o(t),Promise.resolve(x.current()).catch(()=>{}).finally(()=>{g.current=!1,f(!1),o(0)})):o(0)};return window.addEventListener("touchstart",v,{passive:!0}),window.addEventListener("touchmove",S,{passive:!1}),window.addEventListener("touchend",j,{passive:!0}),window.addEventListener("touchcancel",j,{passive:!0}),()=>{window.removeEventListener("touchstart",v),window.removeEventListener("touchmove",S),window.removeEventListener("touchend",j),window.removeEventListener("touchcancel",j)}},[s,t,r]),{pullDistance:l,refreshing:c,threshold:t}}function JE(e){let t=e;for(;t&&t!==document.body&&t!==document.documentElement;){const r=window.getComputedStyle(t).overflowY;if((r==="auto"||r==="scroll")&&t.scrollHeight>t.clientHeight)return!0;t=t.parentElement}return!1}function XE(e){return JSON.stringify([e.user_prompt,e.agent??null,e.schedule_type??null,e.schedule_values??null,e.schedule_enabled,e.requires_confirmation,e.yolo_mode??!1,e.foreground_mode??!1,e.command??"",e.permissions??null])}function KE({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:o,isNotificationListener:c,onViewRun:f,hostInfoStatus:d}){const[m,b]=E.useState([]),[g,x]=E.useState(!1),[v,S]=E.useState(null),[j,R]=E.useState(new Map),[M,P]=E.useState(!1),[I,ue]=E.useState(void 0),q=E.useCallback(()=>{P(!1),ue(void 0)},[]),N=E.useCallback(async()=>{if(e){x(!0),S(null);try{const J=(await r("task.list")).tasks??[],$=new Map;for(const he of J)he.status&&$.set(he.id,he.status);R($),b(J)}catch(L){const J=L instanceof Error?L.message:String(L);J==="Not connected"||J.includes("503")||J.toLowerCase().includes("no responders")?S(null):S(J),b([])}finally{x(!1)}}},[e,t,r]);E.useEffect(()=>{e?N():(b([]),x(!1))},[e,t,N]);const ee=Hx({onRefresh:N,enabled:e});E.useEffect(()=>!e||!t?void 0:s(t,async J=>{const $=J.subject.split(".");if($.length<3)return;const he=$.slice(2).join(".");let le={};try{le=JSON.parse(new TextDecoder().decode(J.data))}catch{return}const te=le.event_type;if(!(te!=="running-state"&&te!=="permission-resolved"))try{const V=await r("task.status",{id:he},{timeout:5e3});if(V.error)return;R(Q=>{const X=new Map(Q);return X.set(he,V),X})}catch{}}),[e,t,s,r]);function G(L){b(J=>{const $=J.findIndex(he=>he.id===L.id);if($>=0){const he=[...J];return he[$]=L,he}return[L,...J]}),P(!1),ue(void 0)}function B(L){b(J=>J.filter($=>$.id!==L)),R(J=>{const $=new Map(J);return $.delete(L),$})}return y.jsxs(y.Fragment,{children:[y.jsx(Bx,{pullDistance:ee.pullDistance,refreshing:ee.refreshing,threshold:ee.threshold}),v&&y.jsxs("div",{className:"form-error",children:[v,v.toLowerCase().includes("failed to fetch")&&y.jsxs(y.Fragment,{children:[" ",y.jsx("a",{href:"#",onClick:L=>{L.preventDefault(),window.location.reload()},children:"Reload"})]})]}),g&&!m.length&&d==="ready"?y.jsx("div",{className:"task-list",children:[0,1,2].map(L=>y.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[y.jsx("div",{className:"task-card-header",children:y.jsxs("div",{className:"task-card-title-row",children:[y.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),y.jsx("div",{className:"skeleton-line",style:{width:`${60+L*12}%`}})]})}),y.jsxs("div",{className:"task-card-meta",children:[y.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},L))}):m.length===0?d==="loading"?y.jsx("div",{className:"empty-state",children:y.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),y.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Try running ",y.jsx("code",{children:"palmier restart"})," on the host machine to restart the daemon."]})]}):y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"No tasks yet"}),y.jsx("p",{className:"empty-state-hint",children:"Tap the + button to create your first task."})]}):y.jsx("div",{className:"task-list",children:m.map(L=>y.jsx(UE,{task:L,lastEvent:j.get(L.id),onEdit:J=>{ue(J),P(!0),r("task.get",{id:J.id}).then($=>{$.error||ue($)}).catch(()=>{})},onDelete:B,onViewRun:f},L.id))}),y.jsx("button",{className:"fab",onClick:()=>{ue(void 0),P(!0)},"aria-label":"New task",title:"New task",children:y.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),y.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),M&&y.jsx(GE,{initial:I,agents:l,hostPlatform:o,isNotificationListener:c,onSaved:G,onCancel:q},I?XE(I):"new")]})}let ba=null;function X0(e){ba&&(e.preventDefault(),e.returnValue="")}function Mh(e){const t=!!ba;ba=e;const r=!!ba;r&&!t?window.addEventListener("beforeunload",X0):!r&&t&&window.removeEventListener("beforeunload",X0)}function Ss(){return ba?window.confirm(ba):!0}function QE(){const e=Gr(),t=Er(),{hostId:r}=Yu(),s=t.pathname.endsWith("/tasks"),l=!s;function o(c){Ss()&&r&&e(`/hosts/${encodeURIComponent(r)}${c}`)}return y.jsxs(y.Fragment,{children:[y.jsxs("button",{className:`tab-btn ${l?"tab-btn-active":""}`,onClick:()=>o(""),children:[y.jsx("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:y.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),y.jsxs("button",{className:`tab-btn ${s?"tab-btn-active":""}`,onClick:()=>o("/tasks"),children:[y.jsxs("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),y.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}function qx(e){const[t,r]=E.useState(()=>window.matchMedia(e).matches);return E.useEffect(()=>{const s=window.matchMedia(e),l=o=>r(o.matches);return s.addEventListener("change",l),r(s.matches),()=>s.removeEventListener("change",l)},[e]),t}const Cu=Jn.isNativePlatform(),ZE=["Device","Data","Messaging"],WE=[{capability:"sms-read",label:"Read SMS",group:"Messaging"},{capability:"sms-send",label:"Send SMS",group:"Messaging"},{capability:"send-email",label:"Prompt Email to Send",group:"Messaging"},{capability:"notifications",label:"Notifications from Other Apps",group:"Data"},{capability:"contacts",label:"Manage Contacts",group:"Data"},{capability:"calendar",label:"Manage Calendar",group:"Data"},{capability:"location",label:"Get Location",group:"Device"},{capability:"dnd",label:"Set Ringer Mode",group:"Device"},{capability:"alarm",label:"Trigger Alarms",group:"Device"}];async function eC(){if(!Cu||!On)return new Set;try{const{capabilities:e}=await On.getCapabilityStatus();return new Set(e.filter(t=>t.enabled).map(t=>t.name))}catch{return new Set}}function Ix({onChange:e,confirmDisable:t=!1}){const[r,s]=E.useState(new Map),[l,o]=E.useState(null),[c,f]=E.useState(null),d=E.useCallback(async()=>{if(!(!Cu||!On))try{const{capabilities:S}=await On.getCapabilityStatus(),j=new Map;for(const R of S)j.set(R.name,R);s(j),e==null||e(new Set(S.filter(R=>R.enabled).map(R=>R.name)))}catch(S){console.error("Failed to read capability status:",S)}},[e]);E.useEffect(()=>{d()},[d]),E.useEffect(()=>{if(!Cu)return;const S=pd.addListener("resume",d);return()=>{S.then(j=>j.remove())}},[d]);async function m(S,j){if(On){o(S.capability);try{const R=await On.setCapabilityEnabled({capability:S.capability,enabled:j});!R.enabled&&R.reason==="no-email-client"&&alert("No email app is installed on this device. Install one (e.g. Gmail) before enabling Send Email."),await d()}catch(R){console.error(`Failed to toggle ${S.capability}:`,R)}finally{o(null)}}}function b(S){const j=r.get(S.capability);if(j){if(j.enabled&&t){f(S);return}m(S,!j.enabled)}}function g(){const S=c;S&&(f(null),m(S,!1))}if(!Cu)return null;const x=ZE.map(S=>({group:S,items:WE.filter(j=>{const R=r.get(j.capability);return j.group===S&&(R==null?void 0:R.supported)})})).filter(S=>S.items.length>0);if(x.length===0)return y.jsx("div",{className:"capability-toggles-loading",children:y.jsx("span",{className:"spinner"})});const v=c&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>f(null),children:y.jsxs("div",{className:"confirm-modal",onClick:S=>S.stopPropagation(),children:[y.jsxs("h2",{className:"confirm-modal-title",children:["Disable ",c.label,"?"]}),y.jsxs("p",{className:"confirm-modal-message",children:["All hosts linked to this device will no longer be able to use ",c.label,"."]}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),children:"Cancel"}),y.jsx("button",{className:"btn btn-danger",onClick:g,children:"Disable"})]})]})}),document.body);return y.jsxs(y.Fragment,{children:[x.map(({group:S,items:j},R)=>y.jsx("div",{className:R>0?"drawer-toggle-group drawer-toggle-group-divided":"drawer-toggle-group",children:j.map(M=>{const P=r.get(M.capability),I=!!(P!=null&&P.enabled);return y.jsxs("label",{className:"drawer-toggle",children:[y.jsx("span",{className:"drawer-toggle-label",children:M.label}),y.jsx("button",{className:`toggle-switch ${I?"toggle-switch-on":""}`,onClick:()=>b(M),disabled:l===M.capability,role:"switch","aria-checked":I,children:y.jsx("span",{className:"toggle-switch-thumb"})})]},M.capability)})},S)),v]})}function Dh(e){return e.replace(/^https:\/\//,"")}function tC({request:e,onClose:t}){const[r,s]=E.useState(null),[l,o]=E.useState(!1),[c,f]=E.useState(null),[d,m]=E.useState(!1);E.useEffect(()=>{let x=!1;return e("passwords.list").then(v=>{x||(v.passwords?s([...v.passwords].sort((S,j)=>S.origin===j.origin?S.username.localeCompare(j.username):S.origin.localeCompare(j.origin))):o(!0))}).catch(()=>{x||o(!0)}),()=>{x=!0}},[e]);async function b(){if(!c)return;const{origin:x,username:v}=c;m(!0);try{await e("passwords.delete",{origin:x,username:v}),s(S=>(S==null?void 0:S.filter(j=>!(j.origin===x&&j.username===v)))??S),f(null)}catch(S){console.error("Failed to delete password:",S)}finally{m(!1)}}const g=c&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>{d||f(null)},children:y.jsxs("div",{className:"confirm-modal",onClick:x=>x.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Remove password?"}),y.jsxs("p",{className:"confirm-modal-message",children:["The saved password for ",y.jsx("strong",{children:c.username})," on"," ",y.jsx("strong",{children:Dh(c.origin)})," will be removed from this host."]}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),disabled:d,children:"Cancel"}),y.jsx("button",{className:"btn btn-danger",onClick:b,disabled:d,children:d?"Removing…":"Remove"})]})]})}),document.body);return pi.createPortal(y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"confirm-modal-overlay",onClick:t,children:y.jsxs("div",{className:"confirm-modal passwords-dialog",onClick:x=>x.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Saved Passwords"}),y.jsx("div",{className:"passwords-dialog-scroll",children:l?y.jsx("p",{className:"passwords-empty",children:"Couldn't load saved passwords."}):r===null?y.jsx("p",{className:"passwords-empty",children:"Loading…"}):r.length===0?y.jsx("p",{className:"passwords-empty",children:"No saved passwords. Passwords are saved when you approve them during a task."}):y.jsx("ul",{className:"passwords-list",children:r.map(x=>y.jsxs("li",{className:"password-item",children:[y.jsxs("div",{className:"password-item-text",children:[y.jsx("span",{className:"password-item-origin",children:Dh(x.origin)}),y.jsx("span",{className:"password-item-username",children:x.username})]}),y.jsx("button",{className:"password-delete-btn",onClick:()=>f(x),"aria-label":`Remove password for ${x.username} on ${Dh(x.origin)}`,children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("path",{d:"M4 5.5V11C4 11.2761 4.22386 11.5 4.5 11.5H9.5C9.77614 11.5 10 11.2761 10 11V5.5M3 4H11M5.5 4V3C5.5 2.72386 5.72386 2.5 6 2.5H8C8.27614 2.5 8.5 2.72386 8.5 3V4M6.5 6.5V9.5M7.5 6.5V9.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},`${x.origin}
|
|
91
|
+
${x.username}`))})}),y.jsx("div",{className:"confirm-modal-actions",children:y.jsx("button",{className:"btn btn-primary",onClick:t,children:"Done"})})]})}),g]}),document.body)}const K0=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),nC=Jn.isNativePlatform();function Q0({daemonVersion:e,agents:t,playwrightCli:r,linkedClientToken:s,request:l,onEnabledCapabilitiesChange:o,onLinkedClientTokenChange:c}){var bn;const{pairedHosts:f,removePairedHost:d,renamePairedHost:m}=Zi(),{activeHost:b}=xi(),g=Gr(),x=Er(),S=Yu().hostId??null,j=b.clientToken||null,R=!!j&&s===j,M=qx("(min-width: 768px)"),[P,I]=E.useState(!1),[ue,q]=E.useState(()=>Date.now());E.useEffect(()=>{const Be=()=>q(Date.now()),nt=6e4-Date.now()%6e4,st=setTimeout(()=>{Be();const Ot=setInterval(Be,6e4);st._iv=Ot},nt);return()=>{const Ot=st._iv;Ot&&clearInterval(Ot),clearTimeout(st)}},[]);const N=b.timezone?new Date(ue).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:b.timezone}):"";async function ee(){if(!(!On||!l||!j)){I(!0);try{const{token:Be}=await On.getFcmToken();if(!Be)return;await l("device.link",{fcmToken:Be}),c==null||c(j)}catch(Be){console.error("Failed to make this the linked device:",Be)}finally{I(!1)}}}async function G(Be){const nt=Be===S;if(nt&&l)try{await l("clients.revoke_self")}catch{}d(Be),xe(null),nt&&g("/",{replace:!0})}function B(Be){const st=x.pathname.endsWith("/tasks")?"/tasks":"";g(`/hosts/${encodeURIComponent(Be)}${st}`)}const[L,J]=E.useState(!1),[$,he]=E.useState(!1),[le,te]=E.useState(null),[V,Q]=E.useState(""),[X,xe]=E.useState(null),[A,z]=E.useState(!1),[W,T]=E.useState(!1),ve=E.useRef(null),je=E.useRef(null),Ne=E.useCallback(()=>{he(!0)},[]);function ce(){$&&(J(!1),he(!1))}function Ae(){he(!1),J(!0)}function ke(Be,nt){te(Be),Q(nt)}function Qe(){le&&V.trim()&&m(le,V.trim()),te(null),Q("")}function Lt(){te(null),Q("")}E.useEffect(()=>{le&&je.current&&(je.current.focus(),je.current.select())},[le]),E.useEffect(()=>{if(!L||$)return;function Be(nt){nt.key==="Escape"&&Ne()}return document.addEventListener("keydown",Be),()=>{document.removeEventListener("keydown",Be)}},[L,$,Ne]);const dn=y.jsxs(y.Fragment,{children:[!M&&y.jsx("button",{className:"drawer-close-btn",onClick:Ne,"aria-label":"Close menu",children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:y.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),!K0&&f.length>0&&y.jsxs("div",{className:"drawer-section",children:[y.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),y.jsx("div",{className:"host-picker-inline",children:y.jsx("div",{className:"host-picker-list",role:"listbox",children:f.map(Be=>{const nt=Be.hostId===S,st=le===Be.hostId,Ot=Be.name||Be.hostId.slice(0,8);return y.jsx("div",{className:"host-picker-item-wrapper",children:y.jsxs("div",{className:`host-picker-item ${nt?"host-picker-item-active":""}`,onClick:()=>{if(!st&&!nt){if(!Ss())return;B(Be.hostId),M||Ne()}},role:"option","aria-selected":nt,children:[st?y.jsx("input",{ref:je,className:"form-input host-picker-rename-input",type:"text",value:V,onChange:_t=>Q(_t.target.value),onKeyDown:_t=>{_t.key==="Enter"&&Qe(),_t.key==="Escape"&&Lt()},onBlur:Qe,onClick:_t=>_t.stopPropagation()}):y.jsx("span",{className:"host-picker-item-name",children:Ot}),y.jsxs("div",{className:"host-picker-item-actions",children:[nt&&!st&&y.jsx("button",{className:"host-picker-edit-btn",onClick:_t=>{_t.stopPropagation(),ke(Be.hostId,Ot)},"aria-label":"Rename host",children:y.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:y.jsx("path",{d:"M9.5 1.5L11.5 3.5M1.5 11.5L2 9L9 2L11 4L4 11L1.5 11.5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),!nt&&y.jsx("button",{className:"host-picker-delete-btn",onClick:_t=>{_t.stopPropagation(),xe(Be.hostId)},"aria-label":`Unpair ${Ot}`,children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("path",{d:"M4 5.5V11C4 11.2761 4.22386 11.5 4.5 11.5H9.5C9.77614 11.5 10 11.2761 10 11V5.5M3 4H11M5.5 4V3C5.5 2.72386 5.72386 2.5 6 2.5H8C8.27614 2.5 8.5 2.72386 8.5 3V4M6.5 6.5V9.5M7.5 6.5V9.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})},Be.hostId)})})})]}),!K0&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-divider"}),y.jsx("div",{className:"drawer-section",children:y.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{Ss()&&(g("/pair"),M||Ne())},children:"Add New Host"})})]}),nC&&l&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-divider"}),y.jsxs("div",{className:"drawer-section",children:[y.jsx("h3",{className:"drawer-section-label",children:"Device Capabilities"}),R?y.jsx(Ix,{onChange:o,confirmDisable:!0}):y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"drawer-section-hint",children:"This device isn't the linked device for the host, so it can't provide capabilities (SMS, contacts, location, etc.)."}),y.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>{s&&s!==j?z(!0):ee()},disabled:P,children:P?"Linking…":"Link the host to this device"})]})]})]}),l&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-divider"}),y.jsxs("div",{className:"drawer-section",children:[y.jsx("h3",{className:"drawer-section-label",children:"Passwords"}),y.jsx("button",{className:"btn btn-link",onClick:()=>T(!0),children:"Manage saved passwords"})]})]}),y.jsxs("div",{className:"drawer-footer",children:[t&&t.length>0&&(()=>{const Be=t.filter(st=>st.version),nt=t.filter(st=>!st.version);return y.jsxs("div",{className:"drawer-agents",children:[Be.length>0&&y.jsxs("div",{className:"drawer-agents-section",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Agents"}),Be.map(st=>y.jsxs("div",{className:"drawer-agents-row",children:[y.jsx("span",{children:st.label}),y.jsxs("span",{className:"drawer-agents-version",children:["v",st.version]})]},st.key))]}),nt.length>0&&y.jsxs("div",{className:"drawer-agents-section",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Version not managed by Palmier"}),nt.map(st=>y.jsx("div",{className:"drawer-agents-row",children:y.jsx("span",{children:st.label})},st.key))]})]})})(),r&&y.jsx("div",{className:"drawer-agents",children:y.jsxs("div",{className:"drawer-agents-section",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Browser Automation"}),y.jsxs("div",{className:"drawer-agents-row",children:[y.jsx("span",{children:r.label}),y.jsxs("span",{className:"drawer-agents-version",children:["v",r.version]})]})]})}),(b.timezone||e)&&y.jsxs("div",{className:"drawer-host-info",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Host"}),b.timezone&&y.jsxs("div",{className:"drawer-host-time",children:[N," · ",b.timezone]}),e&&y.jsxs("div",{className:"drawer-version",children:["Version: v",e]})]}),y.jsxs("div",{className:"drawer-legal",children:[y.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),y.jsx("span",{className:"drawer-legal-sep",children:"·"}),y.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),tn=!!X&&X===S&&R,Ft=X&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>xe(null),children:y.jsxs("div",{className:"confirm-modal",onClick:Be=>Be.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Remove host?"}),y.jsxs("p",{className:"confirm-modal-message",children:['"',((bn=f.find(Be=>Be.hostId===X))==null?void 0:bn.name)||X.slice(0,8),'" will be ',tn?"removed and unlinked":"removed",".",tn&&y.jsx(y.Fragment,{children:" This device is currently linked to the host — unlinking will revoke its access to all device capabilities (SMS, contacts, location, etc.) until another device is linked."})]}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>xe(null),children:"Cancel"}),y.jsx("button",{className:"btn btn-danger",onClick:()=>G(X),children:"Remove"})]})]})}),document.body),$t=A&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>z(!1),children:y.jsxs("div",{className:"confirm-modal",onClick:Be=>Be.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),y.jsx("p",{className:"confirm-modal-message",children:"Another device is already linked to this host. Only one device can be linked to the host — switching will disable those capabilities on the currently linked device."}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>z(!1),children:"Cancel"}),y.jsx("button",{className:"btn btn-primary",onClick:()=>{z(!1),ee()},children:"Link"})]})]})}),document.body),an=W&&l&&y.jsx(tC,{request:l,onClose:()=>T(!1)});return M?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:ve,children:dn}),Ft,$t,an]}):y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"hamburger-btn",onClick:Ae,"aria-label":"Open menu",children:y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:y.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),L&&pi.createPortal(y.jsx("div",{className:`drawer-overlay ${$?"drawer-overlay-closing":""}`,onClick:Ne,onAnimationEnd:ce,children:y.jsx("div",{className:`drawer-panel ${$?"drawer-panel-closing":""}`,ref:ve,onClick:Be=>Be.stopPropagation(),children:dn})}),document.body),Ft,$t,an]})}const rC=Jn.isNativePlatform(),Gd={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function iC(){return y.jsxs("svg",{...Gd,"aria-hidden":"true",children:[y.jsx("path",{d:"M3 11 L12 3 L21 11"}),y.jsx("path",{d:"M5 9.5 V21 H19 V9.5"})]})}function Z0(){return y.jsxs("svg",{...Gd,"aria-hidden":"true",children:[y.jsx("circle",{cx:"12",cy:"12",r:"10"}),y.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),y.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}function sC(){return y.jsxs("svg",{...Gd,"aria-hidden":"true",children:[y.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),y.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),y.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function aC(){const{mode:e}=xi(),[t,r]=E.useState(!1),s=E.useRef(null);if(E.useEffect(()=>{if(!t)return;function f(m){var b;(b=s.current)!=null&&b.contains(m.target)||r(!1)}document.addEventListener("pointerdown",f);const d=window.setTimeout(()=>r(!1),3e3);return()=>{document.removeEventListener("pointerdown",f),clearTimeout(d)}},[t]),e==="direct")return null;let l,o,c;switch(e){case"lan":l=y.jsx(iC,{}),o="Connected via LAN",c="lan";break;case"nats":l=y.jsx(Z0,{}),o=rC?"Connected via relay":"Connected",c="relay";break;case"disconnected":l=y.jsx(sC,{}),o="Disconnected",c="disconnected";break;case"connecting":default:l=y.jsx(Z0,{}),o="Connecting…",c="connecting";break}return y.jsxs("div",{ref:s,className:`conn-status conn-status--${c}`,children:[y.jsx("button",{type:"button",className:"conn-status-btn","aria-label":o,onClick:()=>r(f=>!f),children:l}),y.jsx("div",{className:`conn-status-popover ${t?"conn-status-popover--open":""}`,role:"tooltip",children:o})]})}function W0(e,t){var s;const r=e.map(l=>l.key);return t&&r.includes(t)?t:((s=e[0])==null?void 0:s.key)??""}function lC({agents:e,hostPlatform:t,onStarted:r}){const{request:s,activeHost:l}=xi(),{setHostLastAgent:o}=Zi(),[c,f]=E.useState(""),[d,m]=E.useState(()=>W0(e,l.lastAgent)),[b,g]=E.useState(!1),[x,v]=E.useState(!1),[S,j]=E.useState(null);E.useEffect(()=>{e.length&&(e.find(N=>N.key===d)||m(W0(e,l.lastAgent)))},[e,d,l.lastAgent]),E.useEffect(()=>{const N=c.trim().length>0;return Mh(N?"Your session draft will be lost. Continue?":null),()=>Mh(null)},[c]);const R=e.find(N=>N.key===d),M=!!(R!=null&&R.supportsYolo);E.useEffect(()=>{!M&&b&&g(!1)},[M,b]);const P=!!c.trim()&&!!d&&!x;function I(){return b?confirm(`Yolo mode is enabled. The agent will auto-approve all tool calls — it can read, write, delete files, run arbitrary commands, and access the network without asking for permission.
|
|
92
92
|
|
|
93
|
-
Are you sure you want to continue?`):!0}async function te(){if(!(!P||!I())){v(!0),A(null);try{const L=await s("task.run_oneoff",{user_prompt:c,agent:d,yolo_mode:b,...t==="win32"?{foreground_mode:!0}:{}});if(L.error){A(L.error);return}o(l.hostId,d),f(""),Mh(null),L.task_id&&r(L.task_id,L.run_id)}catch(L){A(L instanceof Error?L.message:String(L))}finally{v(!1)}}}function q(L){L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&(L.preventDefault(),te())}return y.jsxs("div",{className:"session-composer",children:[S&&y.jsx("div",{className:"form-error",children:S}),y.jsx("textarea",{className:"session-composer-textarea",value:c,onChange:L=>f(L.target.value),onKeyDown:q,placeholder:"What can I do for you?",rows:3,disabled:x}),y.jsxs("div",{className:"session-composer-controls",children:[e.length>0&&y.jsx("div",{className:"agent-picker-section-inline",children:e.length>1?y.jsx("select",{className:"form-select form-select-sm",value:d,onChange:L=>m(L.target.value),disabled:x,children:e.map(L=>y.jsx("option",{value:L.key,children:L.label},L.key))}):y.jsx("span",{className:"agent-picker-single",children:(O==null?void 0:O.label)??e[0].label})}),M&&y.jsxs("label",{className:"session-composer-yolo",children:[y.jsx("input",{type:"checkbox",checked:b,onChange:L=>g(L.target.checked),disabled:x}),"Yolo"]}),y.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:te,disabled:!P,"aria-label":"Run session",title:"Run session",children:x?y.jsx("span",{className:"btn-spinner"}):y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),y.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),M&&b&&y.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const xs=72,eb=6;function oC({id:e,revealedId:t,setRevealedId:r,onDelete:s,onClick:l,children:o,actionLabel:c="Delete",confirmMessage:f="Delete this item? This can't be undone.",disabled:d=!1}){const m=t===e,[b,g]=E.useState(0),[x,v]=E.useState(!1),S=E.useRef(0),A=E.useRef(0),O=E.useRef(null),M=E.useRef(0),P=E.useRef(!1),I=E.useRef(null);E.useEffect(()=>{m||g(0)},[m]),E.useEffect(()=>{if(!m)return;function B(D){var G;(G=I.current)!=null&&G.contains(D.target)||r(null)}return document.addEventListener("pointerdown",B),()=>document.removeEventListener("pointerdown",B)},[m,r]);function te(B){B.button!==void 0&&B.button!==0||(S.current=B.clientX,A.current=B.clientY,O.current=null,M.current=m?-xs:0,P.current=!1)}function q(B){if(d||B.pointerType==="mouse"&&B.buttons===0)return;const D=B.clientX-S.current,G=B.clientY-A.current;if(O.current===null){if(Math.abs(D)<eb&&Math.abs(G)<eb)return;if(O.current=Math.abs(D)>Math.abs(G)?"x":"y",O.current==="x")try{B.currentTarget.setPointerCapture(B.pointerId)}catch{}}if(O.current!=="x")return;P.current=!0,x||v(!0);let F=M.current+D;F>0&&(F=F/4),F<-xs&&(F=-xs+(F+xs)/4),g(F)}function L(){if(O.current!=="x"){v(!1);return}O.current=null,v(!1),b<=-36?(g(-xs),r(e)):(g(0),m&&r(null))}function ee(B){if(P.current){P.current=!1,B.stopPropagation(),B.preventDefault();return}m&&(B.stopPropagation(),B.preventDefault(),r(null))}const J=b!==0?b:m?-xs:0;return y.jsxs("div",{ref:I,className:"swipe-row",children:[!d&&y.jsxs("button",{type:"button",className:`swipe-row-action${J<0?"":" swipe-row-action--hidden"}`,style:{width:xs},onClick:B=>{B.stopPropagation(),window.confirm(f)&&s()},tabIndex:m?0:-1,"aria-hidden":!m,"aria-label":c,children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("polyline",{points:"3 6 5 6 21 6"}),y.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),y.jsx("path",{d:"M10 11v6M14 11v6"}),y.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]}),y.jsx("span",{className:"swipe-row-action-label",children:c})]}),y.jsx("div",{className:`swipe-row-content ${x?"swipe-row-content-dragging":""}`,style:{transform:`translateX(${J}px)`},onPointerDown:te,onPointerMove:q,onPointerUp:L,onPointerCancel:L,onClickCapture:ee,onClick:l,children:o})]})}function Fx({starred:e,onToggle:t,className:r}){return y.jsx("button",{type:"button",className:`star-button${e?" star-button--on":""}${r?` ${r}`:""}`,onClick:s=>{s.stopPropagation(),t()},"aria-pressed":e,"aria-label":e?"Unstar session":"Star session",title:e?"Unstar":"Star",children:y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})}const uC=10;function cC({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:o,filterTaskId:c,onClearFilter:f,hostInfoStatus:d}){const m=Yd(),[b,g]=E.useState([]),[x,v]=E.useState(0),[S,A]=E.useState(!1),[O,M]=E.useState(!1),[P,I]=E.useState(null),te=Yr();async function q(X){const xe=`${X.task_id}:${X.run_id}`;g(j=>j.filter(z=>`${z.task_id}:${z.run_id}`!==xe)),v(j=>Math.max(0,j-1)),I(null);try{await r("taskrun.delete",{task_id:X.task_id,run_id:X.run_id})}catch(j){console.error("Failed to delete run:",j),g(z=>[X,...z]),v(z=>z+1)}}async function L(X){const xe=`${X.task_id}:${X.run_id}`,j=!X.starred,z=W=>g(N=>N.map(we=>`${we.task_id}:${we.run_id}`===xe?{...we,starred:W}:we));z(j);try{const W=await r("taskrun.star",{task_id:X.task_id,run_id:X.run_id,starred:j});if(W.error)throw new Error(W.error)}catch(W){console.error("Failed to update star:",W),z(!j)}}const ee=E.useRef(null),J=E.useCallback(X=>{const xe={offset:X,limit:uC};return c&&(xe.task_id=c),xe},[c]),B=E.useCallback(async(X,xe)=>{if(e){xe?M(!0):A(!0);try{const j=await r("taskrun.list",J(X)),z=j.entries??[];v(j.total??0),g(xe?W=>{const N=new Set(W.map(Oe=>`${Oe.task_id}:${Oe.run_id}`)),we=z.filter(Oe=>!N.has(`${Oe.task_id}:${Oe.run_id}`));return[...W,...we]}:z)}catch(j){j instanceof Error&&j.message==="Not connected"||console.error("Failed to load runs:",j)}finally{A(!1),M(!1)}}},[e,r,J]);E.useEffect(()=>{e?(g([]),v(0),B(0,!1)):(g([]),v(0))},[e,t,B,c]);const D=Hx({onRefresh:()=>B(0,!1),enabled:e});E.useEffect(()=>!e||!t?void 0:s(t,async xe=>{try{const j=JSON.parse(new TextDecoder().decode(xe.data));if(j.event_type==="running-state"&&j.running_state&&["started","finished","failed","aborted"].includes(j.running_state)){const z=await r("taskrun.list",J(0)),W=z.entries??[];v(z.total??0),g(N=>{const we=new Map(W.map(Ae=>[`${Ae.task_id}:${Ae.run_id}`,Ae])),Oe=N.map(Ae=>{const Se=`${Ae.task_id}:${Ae.run_id}`;return we.get(Se)??Ae}),je=new Set(Oe.map(Ae=>`${Ae.task_id}:${Ae.run_id}`));return[...W.filter(Ae=>!je.has(`${Ae.task_id}:${Ae.run_id}`)),...Oe]})}}catch{}}),[e,t,s,r]),E.useEffect(()=>{const X=ee.current;if(!X)return;const xe=new IntersectionObserver(j=>{j[0].isIntersecting&&!O&&b.length<x&&B(b.length,!0)},{threshold:.1});return xe.observe(X),()=>xe.disconnect()},[b.length,x,O,B]);function G(X,xe){if(!X||!xe)return"";const j=Math.round((xe-X)/1e3);if(j<60)return`${j}s`;const z=Math.floor(j/60),W=j%60;return`${z}m ${W}s`}const F={started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function fe(X,xe){Ss()&&t&&te(`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(X)}/${encodeURIComponent(xe)}`)}const oe=!c&&d==="ready"&&y.jsx(lC,{agents:l,hostPlatform:o,onStarted:(X,xe)=>{if(!t)return;const j=`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(X)}`;te(xe?`${j}/${encodeURIComponent(xe)}`:j)}}),ne=y.jsx(Bx,{pullDistance:D.pullDistance,refreshing:D.refreshing,threshold:D.threshold}),V=c&&f&&y.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:y.jsxs("span",{className:"sessions-filter-chip",children:["Filtered by task",y.jsx("button",{onClick:f,"aria-label":"Clear filter",children:"×"})]})});function Q(X){if(X==="failed")return"var(--color-error)";if(X==="aborted")return"var(--color-warning, #d97706)"}return S&&b.length===0&&e&&d==="ready"?y.jsxs(y.Fragment,{children:[ne,oe,y.jsx("div",{className:"task-list",children:[0,1,2].map(X=>y.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[y.jsx("div",{className:"task-card-header",children:y.jsx("div",{className:"task-card-title-row",children:y.jsx("div",{className:"skeleton-line",style:{width:`${70+X*10}%`}})})}),y.jsx("div",{className:"task-card-meta",children:y.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},X))})]}):b.length===0?y.jsxs(y.Fragment,{children:[ne,oe,V,y.jsx("div",{className:"sessions-view",children:d==="loading"?y.jsx("div",{className:"empty-state",children:y.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),y.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Try running ",y.jsx("code",{children:"palmier restart"})," on the host machine to restart the daemon."]})]}):y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),y.jsx("p",{className:"empty-state-hint",children:c?"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger.":"Your sessions will appear here."})]})})]}):y.jsxs(y.Fragment,{children:[ne,oe,V,y.jsxs("div",{className:"task-list",children:[b.map((X,xe)=>{const j=`${X.task_id}:${X.run_id}`;return y.jsx(oC,{id:j,revealedId:P,setRevealedId:I,onDelete:()=>q(X),disabled:X.starred,confirmMessage:"Delete this session? Its run history will be removed from the host.",onClick:()=>!X.error&&fe(X.task_id,X.run_id),children:y.jsxs("div",{className:"sessions-card",children:[y.jsxs("div",{className:"sessions-card-body",children:[y.jsx("h3",{className:"sessions-card-name",children:X.task_name||X.task_id}),y.jsxs("div",{className:"sessions-card-meta",children:[X.running_state==="started"?y.jsx("span",{className:"status-spinner","aria-label":"Running",children:y.jsx("span",{})}):y.jsx("span",{style:{color:Q(X.running_state)},children:F[X.running_state??""]??X.running_state}),X.end_time&&y.jsx("span",{children:m(X.end_time)}),X.start_time&&X.end_time&&y.jsx("span",{style:{color:"var(--color-muted)"},children:G(X.start_time,X.end_time)}),X.error&&y.jsx("span",{style:{color:"var(--color-muted)"},children:X.error})]})]}),!X.error&&y.jsx(Fx,{starred:!!X.starred,onToggle:()=>L(X)}),y.jsx("span",{className:"sessions-card-chevron",children:"›"})]})},`${j}-${xe}`)}),y.jsx("div",{ref:ee,style:{height:1}}),O&&y.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:y.jsx("div",{className:"spinner"})})]})]})}function fC(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const hC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mC={};function tb(e,t){return(mC.jsx?dC:hC).test(e)}const pC=/[ \t\n\f\r]/g;function gC(e){return typeof e=="object"?e.type==="text"?nb(e.value):!1:nb(e)}function nb(e){return e.replace(pC,"")===""}class Kl{constructor(t,r,s){this.normal=r,this.property=t,s&&(this.space=s)}}Kl.prototype.normal={};Kl.prototype.property={};Kl.prototype.space=void 0;function $x(e,t){const r={},s={};for(const l of e)Object.assign(r,l.property),Object.assign(s,l.normal);return new Kl(r,s,t)}function bd(e){return e.toLowerCase()}class Jn{constructor(t,r){this.attribute=r,this.property=t}}Jn.prototype.attribute="";Jn.prototype.booleanish=!1;Jn.prototype.boolean=!1;Jn.prototype.commaOrSpaceSeparated=!1;Jn.prototype.commaSeparated=!1;Jn.prototype.defined=!1;Jn.prototype.mustUseProperty=!1;Jn.prototype.number=!1;Jn.prototype.overloadedBoolean=!1;Jn.prototype.property="";Jn.prototype.spaceSeparated=!1;Jn.prototype.space=void 0;let yC=0;const nt=Es(),mn=Es(),xd=Es(),_e=Es(),zt=Es(),xa=Es(),rr=Es();function Es(){return 2**++yC}const vd=Object.freeze(Object.defineProperty({__proto__:null,boolean:nt,booleanish:mn,commaOrSpaceSeparated:rr,commaSeparated:xa,number:_e,overloadedBoolean:xd,spaceSeparated:zt},Symbol.toStringTag,{value:"Module"})),Lh=Object.keys(vd);class Jd extends Jn{constructor(t,r,s,l){let o=-1;if(super(t,r),rb(this,"space",l),typeof s=="number")for(;++o<Lh.length;){const c=Lh[o];rb(this,Lh[o],(s&vd[c])===vd[c])}}}Jd.prototype.defined=!0;function rb(e,t,r){r&&(e[t]=r)}function Na(e){const t={},r={};for(const[s,l]of Object.entries(e.properties)){const o=new Jd(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,r[bd(s)]=s,r[bd(o.attribute)]=s}return new Kl(t,r,e.space)}const Vx=Na({properties:{ariaActiveDescendant:null,ariaAtomic:mn,ariaAutoComplete:null,ariaBusy:mn,ariaChecked:mn,ariaColCount:_e,ariaColIndex:_e,ariaColSpan:_e,ariaControls:zt,ariaCurrent:null,ariaDescribedBy:zt,ariaDetails:null,ariaDisabled:mn,ariaDropEffect:zt,ariaErrorMessage:null,ariaExpanded:mn,ariaFlowTo:zt,ariaGrabbed:mn,ariaHasPopup:null,ariaHidden:mn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zt,ariaLevel:_e,ariaLive:null,ariaModal:mn,ariaMultiLine:mn,ariaMultiSelectable:mn,ariaOrientation:null,ariaOwns:zt,ariaPlaceholder:null,ariaPosInSet:_e,ariaPressed:mn,ariaReadOnly:mn,ariaRelevant:null,ariaRequired:mn,ariaRoleDescription:zt,ariaRowCount:_e,ariaRowIndex:_e,ariaRowSpan:_e,ariaSelected:mn,ariaSetSize:_e,ariaSort:null,ariaValueMax:_e,ariaValueMin:_e,ariaValueNow:_e,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Yx(e,t){return t in e?e[t]:t}function Gx(e,t){return Yx(e,t.toLowerCase())}const bC=Na({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xa,acceptCharset:zt,accessKey:zt,action:null,allow:null,allowFullScreen:nt,allowPaymentRequest:nt,allowUserMedia:nt,alt:null,as:null,async:nt,autoCapitalize:null,autoComplete:zt,autoFocus:nt,autoPlay:nt,blocking:zt,capture:null,charSet:null,checked:nt,cite:null,className:zt,cols:_e,colSpan:null,content:null,contentEditable:mn,controls:nt,controlsList:zt,coords:_e|xa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:nt,defer:nt,dir:null,dirName:null,disabled:nt,download:xd,draggable:mn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:nt,formTarget:null,headers:zt,height:_e,hidden:xd,high:_e,href:null,hrefLang:null,htmlFor:zt,httpEquiv:zt,id:null,imageSizes:null,imageSrcSet:null,inert:nt,inputMode:null,integrity:null,is:null,isMap:nt,itemId:null,itemProp:zt,itemRef:zt,itemScope:nt,itemType:zt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:nt,low:_e,manifest:null,max:null,maxLength:_e,media:null,method:null,min:null,minLength:_e,multiple:nt,muted:nt,name:null,nonce:null,noModule:nt,noValidate:nt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:nt,optimum:_e,pattern:null,ping:zt,placeholder:null,playsInline:nt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:nt,referrerPolicy:null,rel:zt,required:nt,reversed:nt,rows:_e,rowSpan:_e,sandbox:zt,scope:null,scoped:nt,seamless:nt,selected:nt,shadowRootClonable:nt,shadowRootDelegatesFocus:nt,shadowRootMode:null,shape:null,size:_e,sizes:null,slot:null,span:_e,spellCheck:mn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:_e,step:null,style:null,tabIndex:_e,target:null,title:null,translate:null,type:null,typeMustMatch:nt,useMap:null,value:mn,width:_e,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zt,axis:null,background:null,bgColor:null,border:_e,borderColor:null,bottomMargin:_e,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:nt,declare:nt,event:null,face:null,frame:null,frameBorder:null,hSpace:_e,leftMargin:_e,link:null,longDesc:null,lowSrc:null,marginHeight:_e,marginWidth:_e,noResize:nt,noHref:nt,noShade:nt,noWrap:nt,object:null,profile:null,prompt:null,rev:null,rightMargin:_e,rules:null,scheme:null,scrolling:mn,standby:null,summary:null,text:null,topMargin:_e,valueType:null,version:null,vAlign:null,vLink:null,vSpace:_e,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:nt,disableRemotePlayback:nt,prefix:null,property:null,results:_e,security:null,unselectable:null},space:"html",transform:Gx}),xC=Na({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:rr,accentHeight:_e,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:_e,amplitude:_e,arabicForm:null,ascent:_e,attributeName:null,attributeType:null,azimuth:_e,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:_e,by:null,calcMode:null,capHeight:_e,className:zt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:_e,diffuseConstant:_e,direction:null,display:null,dur:null,divisor:_e,dominantBaseline:null,download:nt,dx:null,dy:null,edgeMode:null,editable:null,elevation:_e,enableBackground:null,end:null,event:null,exponent:_e,externalResourcesRequired:null,fill:null,fillOpacity:_e,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:xa,g2:xa,glyphName:xa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:_e,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:_e,horizOriginX:_e,horizOriginY:_e,id:null,ideographic:_e,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:_e,k:_e,k1:_e,k2:_e,k3:_e,k4:_e,kernelMatrix:rr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:_e,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:_e,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:_e,overlineThickness:_e,paintOrder:null,panose1:null,path:null,pathLength:_e,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:_e,pointsAtY:_e,pointsAtZ:_e,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:rr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:rr,rev:rr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:rr,requiredFeatures:rr,requiredFonts:rr,requiredFormats:rr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:_e,specularExponent:_e,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:_e,strikethroughThickness:_e,string:null,stroke:null,strokeDashArray:rr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:_e,strokeOpacity:_e,strokeWidth:null,style:null,surfaceScale:_e,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:rr,tabIndex:_e,tableValues:null,target:null,targetX:_e,targetY:_e,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:rr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:_e,underlineThickness:_e,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:_e,values:null,vAlphabetic:_e,vMathematical:_e,vectorEffect:null,vHanging:_e,vIdeographic:_e,version:null,vertAdvY:_e,vertOriginX:_e,vertOriginY:_e,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:_e,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Yx}),Jx=Na({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Xx=Na({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Gx}),Kx=Na({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),vC={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},wC=/[A-Z]/g,ib=/-[a-z]/g,SC=/^data[-\w.:]+$/i;function _C(e,t){const r=bd(t);let s=t,l=Jn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&SC.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(ib,EC);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!ib.test(o)){let c=o.replace(wC,kC);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=Jd}return new l(s,t)}function kC(e){return"-"+e.toLowerCase()}function EC(e){return e.charAt(1).toUpperCase()}const CC=$x([Vx,bC,Jx,Xx,Kx],"html"),Xd=$x([Vx,xC,Jx,Xx,Kx],"svg");function AC(e){return e.join(" ").trim()}var la={},zh,sb;function jC(){if(sb)return zh;sb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,d=`
|
|
94
|
-
`,m="/",b="*",g="",x="comment",v="declaration";function S(O,M){if(typeof O!="string")throw new TypeError("First argument must be a string");if(!O)return[];M=M||{};var P=1,I=1;function te(oe){var ne=oe.match(t);ne&&(P+=ne.length);var V=oe.lastIndexOf(d);I=~V?oe.length-V:I+oe.length}function q(){var oe={line:P,column:I};return function(ne){return ne.position=new L(oe),B(),ne}}function L(oe){this.start=oe,this.end={line:P,column:I},this.source=M.source}L.prototype.content=O;function ee(oe){var ne=new Error(M.source+":"+P+":"+I+": "+oe);if(ne.reason=oe,ne.filename=M.source,ne.line=P,ne.column=I,ne.source=O,!M.silent)throw ne}function J(oe){var ne=oe.exec(O);if(ne){var V=ne[0];return te(V),O=O.slice(V.length),ne}}function B(){J(r)}function D(oe){var ne;for(oe=oe||[];ne=G();)ne!==!1&&oe.push(ne);return oe}function G(){var oe=q();if(!(m!=O.charAt(0)||b!=O.charAt(1))){for(var ne=2;g!=O.charAt(ne)&&(b!=O.charAt(ne)||m!=O.charAt(ne+1));)++ne;if(ne+=2,g===O.charAt(ne-1))return ee("End of comment missing");var V=O.slice(2,ne-2);return I+=2,te(V),O=O.slice(ne),I+=2,oe({type:x,comment:V})}}function F(){var oe=q(),ne=J(s);if(ne){if(G(),!J(l))return ee("property missing ':'");var V=J(o),Q=oe({type:v,property:A(ne[0].replace(e,g)),value:V?A(V[0].replace(e,g)):g});return J(c),Q}}function fe(){var oe=[];D(oe);for(var ne;ne=F();)ne!==!1&&(oe.push(ne),D(oe));return oe}return B(),fe()}function A(O){return O?O.replace(f,g):g}return zh=S,zh}var ab;function NC(){if(ab)return la;ab=1;var e=la&&la.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(la,"__esModule",{value:!0}),la.default=r;const t=e(jC());function r(s,l){let o=null;if(!s||typeof s!="string")return o;const c=(0,t.default)(s),f=typeof l=="function";return c.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:b}=d;f?l(m,b,d):b&&(o=o||{},o[m]=b)}),o}return la}var _l={},lb;function TC(){if(lb)return _l;lb=1,Object.defineProperty(_l,"__esModule",{value:!0}),_l.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,o=function(m){return!m||r.test(m)||e.test(m)},c=function(m,b){return b.toUpperCase()},f=function(m,b){return"".concat(b,"-")},d=function(m,b){return b===void 0&&(b={}),o(m)?m:(m=m.toLowerCase(),b.reactCompat?m=m.replace(l,f):m=m.replace(s,f),m.replace(t,c))};return _l.camelCase=d,_l}var kl,ob;function OC(){if(ob)return kl;ob=1;var e=kl&&kl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(NC()),r=TC();function s(l,o){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(f,d){f&&d&&(c[(0,r.camelCase)(f,o)]=d)}),c}return s.default=s,kl=s,kl}var RC=OC();const MC=Vb(RC),Qx=Zx("end"),Kd=Zx("start");function Zx(e){return t;function t(r){const s=r&&r.position&&r.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function DC(e){const t=Kd(e),r=Qx(e);if(t&&r)return{start:t,end:r}}function Ll(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ub(e.position):"start"in e||"end"in e?ub(e):"line"in e||"column"in e?wd(e):""}function wd(e){return cb(e&&e.line)+":"+cb(e&&e.column)}function ub(e){return wd(e&&e.start)+"-"+wd(e&&e.end)}function cb(e){return e&&typeof e=="number"?e:1}class Rn extends Error{constructor(t,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let l="",o={},c=!1;if(r&&("line"in r&&"column"in r?o={place:r}:"start"in r&&"end"in r?o={place:r}:"type"in r?o={ancestors:[r],place:r.position}:o={...r}),typeof t=="string"?l=t:!o.cause&&t&&(c=!0,l=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?o.ruleId=s:(o.source=s.slice(0,d),o.ruleId=s.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=Ll(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Rn.prototype.file="";Rn.prototype.name="";Rn.prototype.reason="";Rn.prototype.message="";Rn.prototype.stack="";Rn.prototype.column=void 0;Rn.prototype.line=void 0;Rn.prototype.ancestors=void 0;Rn.prototype.cause=void 0;Rn.prototype.fatal=void 0;Rn.prototype.place=void 0;Rn.prototype.ruleId=void 0;Rn.prototype.source=void 0;const Qd={}.hasOwnProperty,LC=new Map,zC=/[A-Z]/g,UC=new Set(["table","tbody","thead","tfoot","tr"]),PC=new Set(["td","th"]),Wx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function BC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=GC(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=YC(r,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Xd:CC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=e1(l,e,void 0);return o&&typeof o!="string"?o:l.create(e,l.Fragment,{children:o||void 0},void 0)}function e1(e,t,r){if(t.type==="element")return HC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return qC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return FC(e,t,r);if(t.type==="mdxjsEsm")return IC(e,t);if(t.type==="root")return $C(e,t,r);if(t.type==="text")return VC(e,t)}function HC(e,t,r){const s=e.schema;let l=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Xd,e.schema=l),e.ancestors.push(t);const o=n1(e,t.tagName,!1),c=JC(e,t);let f=Wd(e,t);return UC.has(t.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!gC(d):!0})),t1(e,c,o,t),Zd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,r)}function qC(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}$l(e,t.position)}function IC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);$l(e,t.position)}function FC(e,t,r){const s=e.schema;let l=s;t.name==="svg"&&s.space==="html"&&(l=Xd,e.schema=l),e.ancestors.push(t);const o=t.name===null?e.Fragment:n1(e,t.name,!0),c=XC(e,t),f=Wd(e,t);return t1(e,c,o,t),Zd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,r)}function $C(e,t,r){const s={};return Zd(s,Wd(e,t)),e.create(t,e.Fragment,s,r)}function VC(e,t){return t.value}function t1(e,t,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=s)}function Zd(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function YC(e,t,r){return s;function s(l,o,c,f){const m=Array.isArray(c.children)?r:t;return f?m(o,c,f):m(o,c)}}function GC(e,t){return r;function r(s,l,o,c){const f=Array.isArray(o.children),d=Kd(s);return t(l,o,c,f,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function JC(e,t){const r={};let s,l;for(l in t.properties)if(l!=="children"&&Qd.call(t.properties,l)){const o=KC(e,l,t.properties[l]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&PC.has(t.tagName)?s=f:r[c]=f}}if(s){const o=r.style||(r.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function XC(e,t){const r={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const o=s.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else $l(e,t.position);else{const l=s.name;let o;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else $l(e,t.position);else o=s.value===null?!0:s.value;r[l]=o}return r}function Wd(e,t){const r=[];let s=-1;const l=e.passKeys?new Map:LC;for(;++s<t.children.length;){const o=t.children[s];let c;if(e.passKeys){const d=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(d){const m=l.get(d)||0;c=d+"-"+m,l.set(d,m+1)}}const f=e1(e,o,c);f!==void 0&&r.push(f)}return r}function KC(e,t,r){const s=_C(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?fC(r):AC(r)),s.property==="style"){let l=typeof r=="object"?r:QC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=ZC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?vC[s.property]||s.property:s.attribute,r]}}function QC(e,t){try{return MC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new Rn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Wx+"#cannot-parse-style-attribute",l}}function n1(e,t,r){let s;if(!r)s={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let o=-1,c;for(;++o<l.length;){const f=tb(l[o])?{type:"Identifier",name:l[o]}:{type:"Literal",value:l[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}s=c}else s=tb(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const l=s.value;return Qd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);$l(e)}function $l(e,t){const r=new Rn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Wx+"#cannot-handle-mdx-estrees-without-createevaluater",r}function ZC(e){const t={};let r;for(r in e)Qd.call(e,r)&&(t[WC(r)]=e[r]);return t}function WC(e){let t=e.replace(zC,eA);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function eA(e){return"-"+e.toLowerCase()}const Uh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},tA={};function em(e,t){const r=tA,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return r1(e,s,l)}function r1(e,t,r){if(nA(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return fb(e.children,t,r)}return Array.isArray(e)?fb(e,t,r):""}function fb(e,t,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=r1(e[l],t,r);return s.join("")}function nA(e){return!!(e&&typeof e=="object")}const hb=document.createElement("i");function tm(e){const t="&"+e+";";hb.innerHTML=t;const r=hb.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function or(e,t,r,s){const l=e.length;let o=0,c;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,r=r>0?r:0,s.length<1e4)c=Array.from(s),c.unshift(t,r),e.splice(...c);else for(r&&e.splice(t,r);o<s.length;)c=s.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function _r(e,t){return e.length>0?(or(e,e.length,0,t),e):t}const db={}.hasOwnProperty;function i1(e){const t={};let r=-1;for(;++r<e.length;)rA(t,e[r]);return t}function rA(e,t){let r;for(r in t){const l=(db.call(e,r)?e[r]:void 0)||(e[r]={}),o=t[r];let c;if(o)for(c in o){db.call(l,c)||(l[c]=[]);const f=o[c];iA(l[c],Array.isArray(f)?f:f?[f]:[])}}}function iA(e,t){let r=-1;const s=[];for(;++r<t.length;)(t[r].add==="after"?e:s).push(t[r]);or(e,0,0,s)}function s1(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Dr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Pn=es(/[A-Za-z]/),On=es(/[\dA-Za-z]/),sA=es(/[#-'*+\--9=?A-Z^-~]/);function Hu(e){return e!==null&&(e<32||e===127)}const Sd=es(/\d/),aA=es(/[\dA-Fa-f]/),lA=es(/[!-/:-@[-`{-~]/);function $e(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function lt(e){return e===-2||e===-1||e===32}const Wu=es(new RegExp("\\p{P}|\\p{S}","u")),_s=es(/\s/);function es(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Ta(e){const t=[];let r=-1,s=0,l=0;for(;++r<e.length;){const o=e.charCodeAt(r);let c="";if(o===37&&On(e.charCodeAt(r+1))&&On(e.charCodeAt(r+2)))l=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(r+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),l=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(s,r),encodeURIComponent(c)),s=r+l+1,c=""),l&&(r+=l,l=0)}return t.join("")+e.slice(s)}function mt(e,t,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(d){return lt(d)?(e.enter(r),f(d)):t(d)}function f(d){return lt(d)&&o++<l?(e.consume(d),f):(e.exit(r),t(d))}}const oA={tokenize:uA};function uA(e){const t=e.attempt(this.parser.constructs.contentInitial,s,l);let r;return t;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),mt(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),o(f)}function o(f){const d=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=d),r=d,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return $e(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const cA={tokenize:fA},mb={tokenize:hA};function fA(e){const t=this,r=[];let s=0,l,o,c;return f;function f(I){if(s<r.length){const te=r[s];return t.containerState=te[1],e.attempt(te[0].continuation,d,m)(I)}return m(I)}function d(I){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&P();const te=t.events.length;let q=te,L;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){L=t.events[q][1].end;break}M(s);let ee=te;for(;ee<t.events.length;)t.events[ee][1].end={...L},ee++;return or(t.events,q+1,0,t.events.slice(te)),t.events.length=ee,m(I)}return f(I)}function m(I){if(s===r.length){if(!l)return x(I);if(l.currentConstruct&&l.currentConstruct.concrete)return S(I);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(mb,b,g)(I)}function b(I){return l&&P(),M(s),x(I)}function g(I){return t.parser.lazy[t.now().line]=s!==r.length,c=t.now().offset,S(I)}function x(I){return t.containerState={},e.attempt(mb,v,S)(I)}function v(I){return s++,r.push([t.currentConstruct,t.containerState]),x(I)}function S(I){if(I===null){l&&P(),M(0),e.consume(I);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:o}),A(I)}function A(I){if(I===null){O(e.exit("chunkFlow"),!0),M(0),e.consume(I);return}return $e(I)?(e.consume(I),O(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(I),A)}function O(I,te){const q=t.sliceStream(I);if(te&&q.push(null),I.previous=o,o&&(o.next=I),o=I,l.defineSkip(I.start),l.write(q),t.parser.lazy[I.start.line]){let L=l.events.length;for(;L--;)if(l.events[L][1].start.offset<c&&(!l.events[L][1].end||l.events[L][1].end.offset>c))return;const ee=t.events.length;let J=ee,B,D;for(;J--;)if(t.events[J][0]==="exit"&&t.events[J][1].type==="chunkFlow"){if(B){D=t.events[J][1].end;break}B=!0}for(M(s),L=ee;L<t.events.length;)t.events[L][1].end={...D},L++;or(t.events,J+1,0,t.events.slice(ee)),t.events.length=L}}function M(I){let te=r.length;for(;te-- >I;){const q=r[te];t.containerState=q[1],q[0].exit.call(t,e)}r.length=I}function P(){l.write([null]),o=void 0,l=void 0,t.containerState._closeFlow=void 0}}function hA(e,t,r){return mt(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ka(e){if(e===null||Dt(e)||_s(e))return 1;if(Wu(e))return 2}function ec(e,t,r){const s=[];let l=-1;for(;++l<e.length;){const o=e[l].resolveAll;o&&!s.includes(o)&&(t=o(t,r),s.push(o))}return t}const _d={name:"attention",resolveAll:dA,tokenize:mA};function dA(e,t){let r=-1,s,l,o,c,f,d,m,b;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(s=r;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[s][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[s][1].end},x={...e[r][1].start};pb(g,-d),pb(x,d),c={type:d>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},f={type:d>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:x},o={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},l={type:d>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[r][1].start={...f.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=_r(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=_r(m,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",o,t]]),m=_r(m,ec(t.parser.constructs.insideSpan.null,e.slice(s+1,r),t)),m=_r(m,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[r][1].end.offset-e[r][1].start.offset?(b=2,m=_r(m,[["enter",e[r][1],t],["exit",e[r][1],t]])):b=0,or(e,s-1,r-s+3,m),r=s+m.length-b-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function mA(e,t){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=ka(s);let o;return c;function c(d){return o=d,e.enter("attentionSequence"),f(d)}function f(d){if(d===o)return e.consume(d),f;const m=e.exit("attentionSequence"),b=ka(d),g=!b||b===2&&l||r.includes(d),x=!l||l===2&&b||r.includes(s);return m._open=!!(o===42?g:g&&(l||!x)),m._close=!!(o===42?x:x&&(b||!g)),t(d)}}function pb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const pA={name:"autolink",tokenize:gA};function gA(e,t,r){let s=0;return l;function l(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(v){return Pn(v)?(e.consume(v),c):v===64?r(v):m(v)}function c(v){return v===43||v===45||v===46||On(v)?(s=1,f(v)):m(v)}function f(v){return v===58?(e.consume(v),s=0,d):(v===43||v===45||v===46||On(v))&&s++<32?(e.consume(v),f):(s=0,m(v))}function d(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||Hu(v)?r(v):(e.consume(v),d)}function m(v){return v===64?(e.consume(v),b):sA(v)?(e.consume(v),m):r(v)}function b(v){return On(v)?g(v):r(v)}function g(v){return v===46?(e.consume(v),s=0,b):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):x(v)}function x(v){if((v===45||On(v))&&s++<63){const S=v===45?x:g;return e.consume(v),S}return r(v)}}const Ql={partial:!0,tokenize:yA};function yA(e,t,r){return s;function s(o){return lt(o)?mt(e,l,"linePrefix")(o):l(o)}function l(o){return o===null||$e(o)?t(o):r(o)}}const a1={continuation:{tokenize:xA},exit:vA,name:"blockQuote",tokenize:bA};function bA(e,t,r){const s=this;return l;function l(c){if(c===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return r(c)}function o(c){return lt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function xA(e,t,r){const s=this;return l;function l(c){return lt(c)?mt(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(a1,t,r)(c)}}function vA(e){e.exit("blockQuote")}const l1={name:"characterEscape",tokenize:wA};function wA(e,t,r){return s;function s(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),l}function l(o){return lA(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(o)}}const o1={name:"characterReference",tokenize:SA};function SA(e,t,r){const s=this;let l=0,o,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),d}function d(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),o=31,c=On,b(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=aA,b):(e.enter("characterReferenceValue"),o=7,c=Sd,b(g))}function b(g){if(g===59&&l){const x=e.exit("characterReferenceValue");return c===On&&!tm(s.sliceSerialize(x))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&l++<o?(e.consume(g),b):r(g)}}const gb={partial:!0,tokenize:kA},yb={concrete:!0,name:"codeFenced",tokenize:_A};function _A(e,t,r){const s=this,l={partial:!0,tokenize:q};let o=0,c=0,f;return d;function d(L){return m(L)}function m(L){const ee=s.events[s.events.length-1];return o=ee&&ee[1].type==="linePrefix"?ee[2].sliceSerialize(ee[1],!0).length:0,f=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),b(L)}function b(L){return L===f?(c++,e.consume(L),b):c<3?r(L):(e.exit("codeFencedFenceSequence"),lt(L)?mt(e,g,"whitespace")(L):g(L))}function g(L){return L===null||$e(L)?(e.exit("codeFencedFence"),s.interrupt?t(L):e.check(gb,A,te)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(L))}function x(L){return L===null||$e(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(L)):lt(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),mt(e,v,"whitespace")(L)):L===96&&L===f?r(L):(e.consume(L),x)}function v(L){return L===null||$e(L)?g(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(L))}function S(L){return L===null||$e(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(L)):L===96&&L===f?r(L):(e.consume(L),S)}function A(L){return e.attempt(l,te,O)(L)}function O(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),M}function M(L){return o>0&<(L)?mt(e,P,"linePrefix",o+1)(L):P(L)}function P(L){return L===null||$e(L)?e.check(gb,A,te)(L):(e.enter("codeFlowValue"),I(L))}function I(L){return L===null||$e(L)?(e.exit("codeFlowValue"),P(L)):(e.consume(L),I)}function te(L){return e.exit("codeFenced"),t(L)}function q(L,ee,J){let B=0;return D;function D(ne){return L.enter("lineEnding"),L.consume(ne),L.exit("lineEnding"),G}function G(ne){return L.enter("codeFencedFence"),lt(ne)?mt(L,F,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ne):F(ne)}function F(ne){return ne===f?(L.enter("codeFencedFenceSequence"),fe(ne)):J(ne)}function fe(ne){return ne===f?(B++,L.consume(ne),fe):B>=c?(L.exit("codeFencedFenceSequence"),lt(ne)?mt(L,oe,"whitespace")(ne):oe(ne)):J(ne)}function oe(ne){return ne===null||$e(ne)?(L.exit("codeFencedFence"),ee(ne)):J(ne)}}}function kA(e,t,r){const s=this;return l;function l(c){return c===null?r(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}const Ph={name:"codeIndented",tokenize:CA},EA={partial:!0,tokenize:AA};function CA(e,t,r){const s=this;return l;function l(m){return e.enter("codeIndented"),mt(e,o,"linePrefix",5)(m)}function o(m){const b=s.events[s.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?c(m):r(m)}function c(m){return m===null?d(m):$e(m)?e.attempt(EA,c,d)(m):(e.enter("codeFlowValue"),f(m))}function f(m){return m===null||$e(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),f)}function d(m){return e.exit("codeIndented"),t(m)}}function AA(e,t,r){const s=this;return l;function l(c){return s.parser.lazy[s.now().line]?r(c):$e(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):mt(e,o,"linePrefix",5)(c)}function o(c){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):$e(c)?l(c):r(c)}}const jA={name:"codeText",previous:TA,resolve:NA,tokenize:OA};function NA(e){let t=e.length-4,r=3,s,l;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=r;++s<t;)if(e[s][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(s=r-1,t++;++s<=t;)l===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(l=s):(s===t||e[s][1].type==="lineEnding")&&(e[l][1].type="codeTextData",s!==l+2&&(e[l][1].end=e[s-1][1].end,e.splice(l+2,s-l-2),t-=s-l-2,s=l+2),l=void 0);return e}function TA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function OA(e,t,r){let s=0,l,o;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),s++,f):(e.exit("codeTextSequence"),d(g))}function d(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),d):g===96?(o=e.enter("codeTextSequence"),l=0,b(g)):$e(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||$e(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),m)}function b(g){return g===96?(e.consume(g),l++,b):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",m(g))}}class RA{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const s=r??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,r,s){const l=r||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&El(this.left,s),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),El(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),El(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);El(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);El(this.left,r.reverse())}}}function El(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function u1(e){const t={};let r=-1,s,l,o,c,f,d,m;const b=new RA(e);for(;++r<b.length;){for(;r in t;)r=t[r];if(s=b.get(r),r&&s[1].type==="chunkFlow"&&b.get(r-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,o=0,o<d.length&&d[o][1].type==="lineEndingBlank"&&(o+=2),o<d.length&&d[o][1].type==="content"))for(;++o<d.length&&d[o][1].type!=="content";)d[o][1].type==="chunkText"&&(d[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,MA(b,r)),r=t[r],m=!0);else if(s[1]._container){for(o=r,l=void 0;o--;)if(c=b.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(b.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(s[1].end={...b.get(l)[1].start},f=b.slice(l,r),f.unshift(s),b.splice(l,r-l+1,f))}}return or(e,0,Number.POSITIVE_INFINITY,b.slice(0)),!m}function MA(e,t){const r=e.get(t)[1],s=e.get(t)[2];let l=t-1;const o=[];let c=r._tokenizer;c||(c=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,d=[],m={};let b,g,x=-1,v=r,S=0,A=0;const O=[A];for(;v;){for(;e.get(++l)[1]!==v;);o.push(l),v._tokenizer||(b=s.sliceStream(v),v.next||b.push(null),g&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(b),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=v,v=v.next}for(v=r;++x<f.length;)f[x][0]==="exit"&&f[x-1][0]==="enter"&&f[x][1].type===f[x-1][1].type&&f[x][1].start.line!==f[x][1].end.line&&(A=x+1,O.push(A),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(c.events=[],v?(v._tokenizer=void 0,v.previous=void 0):O.pop(),x=O.length;x--;){const M=f.slice(O[x],O[x+1]),P=o.pop();d.push([P,P+M.length-1]),e.splice(P,2,M)}for(d.reverse(),x=-1;++x<d.length;)m[S+d[x][0]]=S+d[x][1],S+=d[x][1]-d[x][0]-1;return m}const DA={resolve:zA,tokenize:UA},LA={partial:!0,tokenize:PA};function zA(e){return u1(e),e}function UA(e,t){let r;return s;function s(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?o(f):$e(f)?e.check(LA,c,o)(f):(e.consume(f),l)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,l}}function PA(e,t,r){const s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),mt(e,o,"linePrefix")}function o(c){if(c===null||$e(c))return r(c);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,r,t)(c)}}function c1(e,t,r,s,l,o,c,f,d){const m=d||Number.POSITIVE_INFINITY;let b=0;return g;function g(M){return M===60?(e.enter(s),e.enter(l),e.enter(o),e.consume(M),e.exit(o),x):M===null||M===32||M===41||Hu(M)?r(M):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),A(M))}function x(M){return M===62?(e.enter(o),e.consume(M),e.exit(o),e.exit(l),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(M))}function v(M){return M===62?(e.exit("chunkString"),e.exit(f),x(M)):M===null||M===60||$e(M)?r(M):(e.consume(M),M===92?S:v)}function S(M){return M===60||M===62||M===92?(e.consume(M),v):v(M)}function A(M){return!b&&(M===null||M===41||Dt(M))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(M)):b<m&&M===40?(e.consume(M),b++,A):M===41?(e.consume(M),b--,A):M===null||M===32||M===40||Hu(M)?r(M):(e.consume(M),M===92?O:A)}function O(M){return M===40||M===41||M===92?(e.consume(M),A):A(M)}}function f1(e,t,r,s,l,o){const c=this;let f=0,d;return m;function m(v){return e.enter(s),e.enter(l),e.consume(v),e.exit(l),e.enter(o),b}function b(v){return f>999||v===null||v===91||v===93&&!d||v===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(v):v===93?(e.exit(o),e.enter(l),e.consume(v),e.exit(l),e.exit(s),t):$e(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),b):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||$e(v)||f++>999?(e.exit("chunkString"),b(v)):(e.consume(v),d||(d=!lt(v)),v===92?x:g)}function x(v){return v===91||v===92||v===93?(e.consume(v),f++,g):g(v)}}function h1(e,t,r,s,l,o){let c;return f;function f(x){return x===34||x===39||x===40?(e.enter(s),e.enter(l),e.consume(x),e.exit(l),c=x===40?41:x,d):r(x)}function d(x){return x===c?(e.enter(l),e.consume(x),e.exit(l),e.exit(s),t):(e.enter(o),m(x))}function m(x){return x===c?(e.exit(o),d(c)):x===null?r(x):$e(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),mt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),b(x))}function b(x){return x===c||x===null||$e(x)?(e.exit("chunkString"),m(x)):(e.consume(x),x===92?g:b)}function g(x){return x===c||x===92?(e.consume(x),b):b(x)}}function zl(e,t){let r;return s;function s(l){return $e(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):lt(l)?mt(e,s,r?"linePrefix":"lineSuffix")(l):t(l)}}const BA={name:"definition",tokenize:qA},HA={partial:!0,tokenize:IA};function qA(e,t,r){const s=this;let l;return o;function o(v){return e.enter("definition"),c(v)}function c(v){return f1.call(s,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return l=Dr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),d):r(v)}function d(v){return Dt(v)?zl(e,m)(v):m(v)}function m(v){return c1(e,b,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function b(v){return e.attempt(HA,g,g)(v)}function g(v){return lt(v)?mt(e,x,"whitespace")(v):x(v)}function x(v){return v===null||$e(v)?(e.exit("definition"),s.parser.defined.push(l),t(v)):r(v)}}function IA(e,t,r){return s;function s(f){return Dt(f)?zl(e,l)(f):r(f)}function l(f){return h1(e,o,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return lt(f)?mt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||$e(f)?t(f):r(f)}}const FA={name:"hardBreakEscape",tokenize:$A};function $A(e,t,r){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),l}function l(o){return $e(o)?(e.exit("hardBreakEscape"),t(o)):r(o)}}const VA={name:"headingAtx",resolve:YA,tokenize:GA};function YA(e,t){let r=e.length-2,s=3,l,o;return e[s][1].type==="whitespace"&&(s+=2),r-2>s&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&e[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(l={type:"atxHeadingText",start:e[s][1].start,end:e[r][1].end},o={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},or(e,s,r-s+1,[["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t]])),e}function GA(e,t,r){let s=0;return l;function l(b){return e.enter("atxHeading"),o(b)}function o(b){return e.enter("atxHeadingSequence"),c(b)}function c(b){return b===35&&s++<6?(e.consume(b),c):b===null||Dt(b)?(e.exit("atxHeadingSequence"),f(b)):r(b)}function f(b){return b===35?(e.enter("atxHeadingSequence"),d(b)):b===null||$e(b)?(e.exit("atxHeading"),t(b)):lt(b)?mt(e,f,"whitespace")(b):(e.enter("atxHeadingText"),m(b))}function d(b){return b===35?(e.consume(b),d):(e.exit("atxHeadingSequence"),f(b))}function m(b){return b===null||b===35||Dt(b)?(e.exit("atxHeadingText"),f(b)):(e.consume(b),m)}}const JA=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],bb=["pre","script","style","textarea"],XA={concrete:!0,name:"htmlFlow",resolveTo:ZA,tokenize:WA},KA={partial:!0,tokenize:tj},QA={partial:!0,tokenize:ej};function ZA(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function WA(e,t,r){const s=this;let l,o,c,f,d;return m;function m(N){return b(N)}function b(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),g}function g(N){return N===33?(e.consume(N),x):N===47?(e.consume(N),o=!0,A):N===63?(e.consume(N),l=3,s.interrupt?t:j):Pn(N)?(e.consume(N),c=String.fromCharCode(N),O):r(N)}function x(N){return N===45?(e.consume(N),l=2,v):N===91?(e.consume(N),l=5,f=0,S):Pn(N)?(e.consume(N),l=4,s.interrupt?t:j):r(N)}function v(N){return N===45?(e.consume(N),s.interrupt?t:j):r(N)}function S(N){const we="CDATA[";return N===we.charCodeAt(f++)?(e.consume(N),f===we.length?s.interrupt?t:F:S):r(N)}function A(N){return Pn(N)?(e.consume(N),c=String.fromCharCode(N),O):r(N)}function O(N){if(N===null||N===47||N===62||Dt(N)){const we=N===47,Oe=c.toLowerCase();return!we&&!o&&bb.includes(Oe)?(l=1,s.interrupt?t(N):F(N)):JA.includes(c.toLowerCase())?(l=6,we?(e.consume(N),M):s.interrupt?t(N):F(N)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(N):o?P(N):I(N))}return N===45||On(N)?(e.consume(N),c+=String.fromCharCode(N),O):r(N)}function M(N){return N===62?(e.consume(N),s.interrupt?t:F):r(N)}function P(N){return lt(N)?(e.consume(N),P):D(N)}function I(N){return N===47?(e.consume(N),D):N===58||N===95||Pn(N)?(e.consume(N),te):lt(N)?(e.consume(N),I):D(N)}function te(N){return N===45||N===46||N===58||N===95||On(N)?(e.consume(N),te):q(N)}function q(N){return N===61?(e.consume(N),L):lt(N)?(e.consume(N),q):I(N)}function L(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),d=N,ee):lt(N)?(e.consume(N),L):J(N)}function ee(N){return N===d?(e.consume(N),d=null,B):N===null||$e(N)?r(N):(e.consume(N),ee)}function J(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||Dt(N)?q(N):(e.consume(N),J)}function B(N){return N===47||N===62||lt(N)?I(N):r(N)}function D(N){return N===62?(e.consume(N),G):r(N)}function G(N){return N===null||$e(N)?F(N):lt(N)?(e.consume(N),G):r(N)}function F(N){return N===45&&l===2?(e.consume(N),V):N===60&&l===1?(e.consume(N),Q):N===62&&l===4?(e.consume(N),z):N===63&&l===3?(e.consume(N),j):N===93&&l===5?(e.consume(N),xe):$e(N)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(KA,W,fe)(N)):N===null||$e(N)?(e.exit("htmlFlowData"),fe(N)):(e.consume(N),F)}function fe(N){return e.check(QA,oe,W)(N)}function oe(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),ne}function ne(N){return N===null||$e(N)?fe(N):(e.enter("htmlFlowData"),F(N))}function V(N){return N===45?(e.consume(N),j):F(N)}function Q(N){return N===47?(e.consume(N),c="",X):F(N)}function X(N){if(N===62){const we=c.toLowerCase();return bb.includes(we)?(e.consume(N),z):F(N)}return Pn(N)&&c.length<8?(e.consume(N),c+=String.fromCharCode(N),X):F(N)}function xe(N){return N===93?(e.consume(N),j):F(N)}function j(N){return N===62?(e.consume(N),z):N===45&&l===2?(e.consume(N),j):F(N)}function z(N){return N===null||$e(N)?(e.exit("htmlFlowData"),W(N)):(e.consume(N),z)}function W(N){return e.exit("htmlFlow"),t(N)}}function ej(e,t,r){const s=this;return l;function l(c){return $e(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):r(c)}function o(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}function tj(e,t,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Ql,t,r)}}const nj={name:"htmlText",tokenize:rj};function rj(e,t,r){const s=this;let l,o,c;return f;function f(j){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(j),d}function d(j){return j===33?(e.consume(j),m):j===47?(e.consume(j),q):j===63?(e.consume(j),I):Pn(j)?(e.consume(j),J):r(j)}function m(j){return j===45?(e.consume(j),b):j===91?(e.consume(j),o=0,S):Pn(j)?(e.consume(j),P):r(j)}function b(j){return j===45?(e.consume(j),v):r(j)}function g(j){return j===null?r(j):j===45?(e.consume(j),x):$e(j)?(c=g,Q(j)):(e.consume(j),g)}function x(j){return j===45?(e.consume(j),v):g(j)}function v(j){return j===62?V(j):j===45?x(j):g(j)}function S(j){const z="CDATA[";return j===z.charCodeAt(o++)?(e.consume(j),o===z.length?A:S):r(j)}function A(j){return j===null?r(j):j===93?(e.consume(j),O):$e(j)?(c=A,Q(j)):(e.consume(j),A)}function O(j){return j===93?(e.consume(j),M):A(j)}function M(j){return j===62?V(j):j===93?(e.consume(j),M):A(j)}function P(j){return j===null||j===62?V(j):$e(j)?(c=P,Q(j)):(e.consume(j),P)}function I(j){return j===null?r(j):j===63?(e.consume(j),te):$e(j)?(c=I,Q(j)):(e.consume(j),I)}function te(j){return j===62?V(j):I(j)}function q(j){return Pn(j)?(e.consume(j),L):r(j)}function L(j){return j===45||On(j)?(e.consume(j),L):ee(j)}function ee(j){return $e(j)?(c=ee,Q(j)):lt(j)?(e.consume(j),ee):V(j)}function J(j){return j===45||On(j)?(e.consume(j),J):j===47||j===62||Dt(j)?B(j):r(j)}function B(j){return j===47?(e.consume(j),V):j===58||j===95||Pn(j)?(e.consume(j),D):$e(j)?(c=B,Q(j)):lt(j)?(e.consume(j),B):V(j)}function D(j){return j===45||j===46||j===58||j===95||On(j)?(e.consume(j),D):G(j)}function G(j){return j===61?(e.consume(j),F):$e(j)?(c=G,Q(j)):lt(j)?(e.consume(j),G):B(j)}function F(j){return j===null||j===60||j===61||j===62||j===96?r(j):j===34||j===39?(e.consume(j),l=j,fe):$e(j)?(c=F,Q(j)):lt(j)?(e.consume(j),F):(e.consume(j),oe)}function fe(j){return j===l?(e.consume(j),l=void 0,ne):j===null?r(j):$e(j)?(c=fe,Q(j)):(e.consume(j),fe)}function oe(j){return j===null||j===34||j===39||j===60||j===61||j===96?r(j):j===47||j===62||Dt(j)?B(j):(e.consume(j),oe)}function ne(j){return j===47||j===62||Dt(j)?B(j):r(j)}function V(j){return j===62?(e.consume(j),e.exit("htmlTextData"),e.exit("htmlText"),t):r(j)}function Q(j){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),X}function X(j){return lt(j)?mt(e,xe,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):xe(j)}function xe(j){return e.enter("htmlTextData"),c(j)}}const nm={name:"labelEnd",resolveAll:lj,resolveTo:oj,tokenize:uj},ij={tokenize:cj},sj={tokenize:fj},aj={tokenize:hj};function lj(e){let t=-1;const r=[];for(;++t<e.length;){const s=e[t][1];if(r.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const l=s.type==="labelImage"?4:2;s.type="data",t+=l}}return e.length!==r.length&&or(e,0,e.length,r),e}function oj(e,t){let r=e.length,s=0,l,o,c,f;for(;r--;)if(l=e[r][1],o){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[r][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(c){if(e[r][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(o=r,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(c=r);const d={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},b={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",d,t],["enter",m,t]],f=_r(f,e.slice(o+1,o+s+3)),f=_r(f,[["enter",b,t]]),f=_r(f,ec(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),f=_r(f,[["exit",b,t],e[c-2],e[c-1],["exit",m,t]]),f=_r(f,e.slice(c+1)),f=_r(f,[["exit",d,t]]),or(e,o,e.length,f),e}function uj(e,t,r){const s=this;let l=s.events.length,o,c;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){o=s.events[l][1];break}return f;function f(x){return o?o._inactive?g(x):(c=s.parser.defined.includes(Dr(s.sliceSerialize({start:o.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),d):r(x)}function d(x){return x===40?e.attempt(ij,b,c?b:g)(x):x===91?e.attempt(sj,b,c?m:g)(x):c?b(x):g(x)}function m(x){return e.attempt(aj,b,g)(x)}function b(x){return t(x)}function g(x){return o._balanced=!0,r(x)}}function cj(e,t,r){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return Dt(g)?zl(e,o)(g):o(g)}function o(g){return g===41?b(g):c1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Dt(g)?zl(e,d)(g):b(g)}function f(g){return r(g)}function d(g){return g===34||g===39||g===40?h1(e,m,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):b(g)}function m(g){return Dt(g)?zl(e,b)(g):b(g)}function b(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):r(g)}}function fj(e,t,r){const s=this;return l;function l(f){return f1.call(s,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return s.parser.defined.includes(Dr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):r(f)}function c(f){return r(f)}}function hj(e,t,r){return s;function s(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),l}function l(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):r(o)}}const dj={name:"labelStartImage",resolveAll:nm.resolveAll,tokenize:mj};function mj(e,t,r){const s=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):r(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(f):t(f)}}const pj={name:"labelStartLink",resolveAll:nm.resolveAll,tokenize:gj};function gj(e,t,r){const s=this;return l;function l(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(c):t(c)}}const Bh={name:"lineEnding",tokenize:yj};function yj(e,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),mt(e,t,"linePrefix")}}const Au={name:"thematicBreak",tokenize:bj};function bj(e,t,r){let s=0,l;return o;function o(m){return e.enter("thematicBreak"),c(m)}function c(m){return l=m,f(m)}function f(m){return m===l?(e.enter("thematicBreakSequence"),d(m)):s>=3&&(m===null||$e(m))?(e.exit("thematicBreak"),t(m)):r(m)}function d(m){return m===l?(e.consume(m),s++,d):(e.exit("thematicBreakSequence"),lt(m)?mt(e,f,"whitespace")(m):f(m))}}const Yn={continuation:{tokenize:Sj},exit:kj,name:"list",tokenize:wj},xj={partial:!0,tokenize:Ej},vj={partial:!0,tokenize:_j};function wj(e,t,r){const s=this,l=s.events[s.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return f;function f(v){const S=s.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!s.containerState.marker||v===s.containerState.marker:Sd(v)){if(s.containerState.type||(s.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Au,r,m)(v):m(v);if(!s.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(v)}return r(v)}function d(v){return Sd(v)&&++c<10?(e.consume(v),d):(!s.interrupt||c<2)&&(s.containerState.marker?v===s.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),m(v)):r(v)}function m(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||v,e.check(Ql,s.interrupt?r:b,e.attempt(xj,x,g))}function b(v){return s.containerState.initialBlankLine=!0,o++,x(v)}function g(v){return lt(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),x):r(v)}function x(v){return s.containerState.size=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function Sj(e,t,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Ql,l,o);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,mt(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!lt(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(vj,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,mt(e,e.attempt(Yn,t,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function _j(e,t,r){const s=this;return mt(e,l,"listItemIndent",s.containerState.size+1);function l(o){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(o):r(o)}}function kj(e){e.exit(this.containerState.type)}function Ej(e,t,r){const s=this;return mt(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const c=s.events[s.events.length-1];return!lt(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):r(o)}}const xb={name:"setextUnderline",resolveTo:Cj,tokenize:Aj};function Cj(e,t){let r=e.length,s,l,o;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){s=r;break}e[r][1].type==="paragraph"&&(l=r)}else e[r][1].type==="content"&&e.splice(r,1),!o&&e[r][1].type==="definition"&&(o=r);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",o?(e.splice(l,0,["enter",c,t]),e.splice(o+1,0,["exit",e[s][1],t]),e[s][1].end={...e[o][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function Aj(e,t,r){const s=this;let l;return o;function o(m){let b=s.events.length,g;for(;b--;)if(s.events[b][1].type!=="lineEnding"&&s.events[b][1].type!=="linePrefix"&&s.events[b][1].type!=="content"){g=s.events[b][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),l=m,c(m)):r(m)}function c(m){return e.enter("setextHeadingLineSequence"),f(m)}function f(m){return m===l?(e.consume(m),f):(e.exit("setextHeadingLineSequence"),lt(m)?mt(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||$e(m)?(e.exit("setextHeadingLine"),t(m)):r(m)}}const jj={tokenize:Nj};function Nj(e){const t=this,r=e.attempt(Ql,s,e.attempt(this.parser.constructs.flowInitial,l,mt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(DA,l)),"linePrefix")));return r;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function l(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const Tj={resolveAll:m1()},Oj=d1("string"),Rj=d1("text");function d1(e){return{resolveAll:m1(e==="text"?Mj:void 0),tokenize:t};function t(r){const s=this,l=this.parser.constructs[e],o=r.attempt(l,c,f);return c;function c(b){return m(b)?o(b):f(b)}function f(b){if(b===null){r.consume(b);return}return r.enter("data"),r.consume(b),d}function d(b){return m(b)?(r.exit("data"),o(b)):(r.consume(b),d)}function m(b){if(b===null)return!0;const g=l[b];let x=-1;if(g)for(;++x<g.length;){const v=g[x];if(!v.previous||v.previous.call(s,s.previous))return!0}return!1}}}function m1(e){return t;function t(r,s){let l=-1,o;for(;++l<=r.length;)o===void 0?r[l]&&r[l][1].type==="data"&&(o=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==o+2&&(r[o][1].end=r[l-1][1].end,r.splice(o+2,l-o-2),l=o+2),o=void 0);return e?e(r,s):r}}function Mj(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const s=e[r-1][1],l=t.sliceStream(s);let o=l.length,c=-1,f=0,d;for(;o--;){const m=l[o];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(m===-2)d=!0,f++;else if(m!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(f=0),f){const m={type:r===e.length||d||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:s.start._bufferIndex+c,_index:s.start._index+o,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(r,0,["enter",m,t],["exit",m,t]),r+=2)}r++}return e}const Dj={42:Yn,43:Yn,45:Yn,48:Yn,49:Yn,50:Yn,51:Yn,52:Yn,53:Yn,54:Yn,55:Yn,56:Yn,57:Yn,62:a1},Lj={91:BA},zj={[-2]:Ph,[-1]:Ph,32:Ph},Uj={35:VA,42:Au,45:[xb,Au],60:XA,61:xb,95:Au,96:yb,126:yb},Pj={38:o1,92:l1},Bj={[-5]:Bh,[-4]:Bh,[-3]:Bh,33:dj,38:o1,42:_d,60:[pA,nj],91:pj,92:[FA,l1],93:nm,95:_d,96:jA},Hj={null:[_d,Tj]},qj={null:[42,95]},Ij={null:[]},Fj=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qj,contentInitial:Lj,disable:Ij,document:Dj,flow:Uj,flowInitial:zj,insideSpan:Hj,string:Pj,text:Bj},Symbol.toStringTag,{value:"Module"}));function $j(e,t,r){let s={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const l={},o=[];let c=[],f=[];const d={attempt:ee(q),check:ee(L),consume:P,enter:I,exit:te,interrupt:ee(L,{interrupt:!0})},m={code:null,containerState:{},defineSkip:A,events:[],now:S,parser:e,previous:null,sliceSerialize:x,sliceStream:v,write:g};let b=t.tokenize.call(m,d);return t.resolveAll&&o.push(t),m;function g(G){return c=_r(c,G),O(),c[c.length-1]!==null?[]:(J(t,0),m.events=ec(o,m.events,m),m.events)}function x(G,F){return Yj(v(G),F)}function v(G){return Vj(c,G)}function S(){const{_bufferIndex:G,_index:F,line:fe,column:oe,offset:ne}=s;return{_bufferIndex:G,_index:F,line:fe,column:oe,offset:ne}}function A(G){l[G.line]=G.column,D()}function O(){let G;for(;s._index<c.length;){const F=c[s._index];if(typeof F=="string")for(G=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===G&&s._bufferIndex<F.length;)M(F.charCodeAt(s._bufferIndex));else M(F)}}function M(G){b=b(G)}function P(G){$e(G)?(s.line++,s.column=1,s.offset+=G===-3?2:1,D()):G!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),m.previous=G}function I(G,F){const fe=F||{};return fe.type=G,fe.start=S(),m.events.push(["enter",fe,m]),f.push(fe),fe}function te(G){const F=f.pop();return F.end=S(),m.events.push(["exit",F,m]),F}function q(G,F){J(G,F.from)}function L(G,F){F.restore()}function ee(G,F){return fe;function fe(oe,ne,V){let Q,X,xe,j;return Array.isArray(oe)?W(oe):"tokenize"in oe?W([oe]):z(oe);function z(je){return he;function he(Ae){const Se=Ae!==null&&je[Ae],We=Ae!==null&&je.null,It=[...Array.isArray(Se)?Se:Se?[Se]:[],...Array.isArray(We)?We:We?[We]:[]];return W(It)(Ae)}}function W(je){return Q=je,X=0,je.length===0?V:N(je[X])}function N(je){return he;function he(Ae){return j=B(),xe=je,je.partial||(m.currentConstruct=je),je.name&&m.parser.constructs.disable.null.includes(je.name)?Oe():je.tokenize.call(F?Object.assign(Object.create(m),F):m,d,we,Oe)(Ae)}}function we(je){return G(xe,j),ne}function Oe(je){return j.restore(),++X<Q.length?N(Q[X]):V}}}function J(G,F){G.resolveAll&&!o.includes(G)&&o.push(G),G.resolve&&or(m.events,F,m.events.length-F,G.resolve(m.events.slice(F),m)),G.resolveTo&&(m.events=G.resolveTo(m.events,m))}function B(){const G=S(),F=m.previous,fe=m.currentConstruct,oe=m.events.length,ne=Array.from(f);return{from:oe,restore:V};function V(){s=G,m.previous=F,m.currentConstruct=fe,m.events.length=oe,f=ne,D()}}function D(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function Vj(e,t){const r=t.start._index,s=t.start._bufferIndex,l=t.end._index,o=t.end._bufferIndex;let c;if(r===l)c=[e[r].slice(s,o)];else{if(c=e.slice(r,l),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}o>0&&c.push(e[l].slice(0,o))}return c}function Yj(e,t){let r=-1;const s=[];let l;for(;++r<e.length;){const o=e[r];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
|
|
93
|
+
Are you sure you want to continue?`):!0}async function ue(){if(!(!P||!I())){v(!0),j(null);try{const N=await s("task.run_oneoff",{user_prompt:c,agent:d,yolo_mode:b,...t==="win32"?{foreground_mode:!0}:{}});if(N.error){j(N.error);return}o(l.hostId,d),f(""),Mh(null),N.task_id&&r(N.task_id,N.run_id)}catch(N){j(N instanceof Error?N.message:String(N))}finally{v(!1)}}}function q(N){N.key==="Enter"&&(N.metaKey||N.ctrlKey)&&(N.preventDefault(),ue())}return y.jsxs("div",{className:"session-composer",children:[S&&y.jsx("div",{className:"form-error",children:S}),y.jsx("textarea",{className:"session-composer-textarea",value:c,onChange:N=>f(N.target.value),onKeyDown:q,placeholder:"What can I do for you?",rows:3,disabled:x}),y.jsxs("div",{className:"session-composer-controls",children:[e.length>0&&y.jsx("div",{className:"agent-picker-section-inline",children:e.length>1?y.jsx("select",{className:"form-select form-select-sm",value:d,onChange:N=>m(N.target.value),disabled:x,children:e.map(N=>y.jsx("option",{value:N.key,children:N.label},N.key))}):y.jsx("span",{className:"agent-picker-single",children:(R==null?void 0:R.label)??e[0].label})}),M&&y.jsxs("label",{className:"session-composer-yolo",children:[y.jsx("input",{type:"checkbox",checked:b,onChange:N=>g(N.target.checked),disabled:x}),"Yolo"]}),y.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:ue,disabled:!P,"aria-label":"Run session",title:"Run session",children:x?y.jsx("span",{className:"btn-spinner"}):y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),y.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),M&&b&&y.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const xs=72,eb=6;function oC({id:e,revealedId:t,setRevealedId:r,onDelete:s,onClick:l,children:o,actionLabel:c="Delete",confirmMessage:f="Delete this item? This can't be undone.",disabled:d=!1}){const m=t===e,[b,g]=E.useState(0),[x,v]=E.useState(!1),S=E.useRef(0),j=E.useRef(0),R=E.useRef(null),M=E.useRef(0),P=E.useRef(!1),I=E.useRef(null);E.useEffect(()=>{m||g(0)},[m]),E.useEffect(()=>{if(!m)return;function B(L){var J;(J=I.current)!=null&&J.contains(L.target)||r(null)}return document.addEventListener("pointerdown",B),()=>document.removeEventListener("pointerdown",B)},[m,r]);function ue(B){B.button!==void 0&&B.button!==0||(S.current=B.clientX,j.current=B.clientY,R.current=null,M.current=m?-xs:0,P.current=!1)}function q(B){if(d||B.pointerType==="mouse"&&B.buttons===0)return;const L=B.clientX-S.current,J=B.clientY-j.current;if(R.current===null){if(Math.abs(L)<eb&&Math.abs(J)<eb)return;if(R.current=Math.abs(L)>Math.abs(J)?"x":"y",R.current==="x")try{B.currentTarget.setPointerCapture(B.pointerId)}catch{}}if(R.current!=="x")return;P.current=!0,x||v(!0);let $=M.current+L;$>0&&($=$/4),$<-xs&&($=-xs+($+xs)/4),g($)}function N(){if(R.current!=="x"){v(!1);return}R.current=null,v(!1),b<=-36?(g(-xs),r(e)):(g(0),m&&r(null))}function ee(B){if(P.current){P.current=!1,B.stopPropagation(),B.preventDefault();return}m&&(B.stopPropagation(),B.preventDefault(),r(null))}const G=b!==0?b:m?-xs:0;return y.jsxs("div",{ref:I,className:"swipe-row",children:[!d&&y.jsxs("button",{type:"button",className:`swipe-row-action${G<0?"":" swipe-row-action--hidden"}`,style:{width:xs},onClick:B=>{B.stopPropagation(),window.confirm(f)&&s()},tabIndex:m?0:-1,"aria-hidden":!m,"aria-label":c,children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("polyline",{points:"3 6 5 6 21 6"}),y.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),y.jsx("path",{d:"M10 11v6M14 11v6"}),y.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]}),y.jsx("span",{className:"swipe-row-action-label",children:c})]}),y.jsx("div",{className:`swipe-row-content ${x?"swipe-row-content-dragging":""}`,style:{transform:`translateX(${G}px)`},onPointerDown:ue,onPointerMove:q,onPointerUp:N,onPointerCancel:N,onClickCapture:ee,onClick:l,children:o})]})}function Fx({starred:e,onToggle:t,className:r}){return y.jsx("button",{type:"button",className:`star-button${e?" star-button--on":""}${r?` ${r}`:""}`,onClick:s=>{s.stopPropagation(),t()},"aria-pressed":e,"aria-label":e?"Unstar session":"Star session",title:e?"Unstar":"Star",children:y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})}const uC=10;function cC({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:o,filterTaskId:c,onClearFilter:f,hostInfoStatus:d}){const m=Yd(),[b,g]=E.useState([]),[x,v]=E.useState(0),[S,j]=E.useState(!1),[R,M]=E.useState(!1),[P,I]=E.useState(null),ue=Gr();async function q(X){const xe=`${X.task_id}:${X.run_id}`;g(A=>A.filter(z=>`${z.task_id}:${z.run_id}`!==xe)),v(A=>Math.max(0,A-1)),I(null);try{await r("taskrun.delete",{task_id:X.task_id,run_id:X.run_id})}catch(A){console.error("Failed to delete run:",A),g(z=>[X,...z]),v(z=>z+1)}}async function N(X){const xe=`${X.task_id}:${X.run_id}`,A=!X.starred,z=W=>g(T=>T.map(ve=>`${ve.task_id}:${ve.run_id}`===xe?{...ve,starred:W}:ve));z(A);try{const W=await r("taskrun.star",{task_id:X.task_id,run_id:X.run_id,starred:A});if(W.error)throw new Error(W.error)}catch(W){console.error("Failed to update star:",W),z(!A)}}const ee=E.useRef(null),G=E.useCallback(X=>{const xe={offset:X,limit:uC};return c&&(xe.task_id=c),xe},[c]),B=E.useCallback(async(X,xe)=>{if(e){xe?M(!0):j(!0);try{const A=await r("taskrun.list",G(X)),z=A.entries??[];v(A.total??0),g(xe?W=>{const T=new Set(W.map(je=>`${je.task_id}:${je.run_id}`)),ve=z.filter(je=>!T.has(`${je.task_id}:${je.run_id}`));return[...W,...ve]}:z)}catch(A){A instanceof Error&&A.message==="Not connected"||console.error("Failed to load runs:",A)}finally{j(!1),M(!1)}}},[e,r,G]);E.useEffect(()=>{e?(g([]),v(0),B(0,!1)):(g([]),v(0))},[e,t,B,c]);const L=Hx({onRefresh:()=>B(0,!1),enabled:e});E.useEffect(()=>!e||!t?void 0:s(t,async xe=>{try{const A=JSON.parse(new TextDecoder().decode(xe.data));if(A.event_type==="running-state"&&A.running_state&&["started","finished","failed","aborted"].includes(A.running_state)){const z=await r("taskrun.list",G(0)),W=z.entries??[];v(z.total??0),g(T=>{const ve=new Map(W.map(Ae=>[`${Ae.task_id}:${Ae.run_id}`,Ae])),je=T.map(Ae=>{const ke=`${Ae.task_id}:${Ae.run_id}`;return ve.get(ke)??Ae}),Ne=new Set(je.map(Ae=>`${Ae.task_id}:${Ae.run_id}`));return[...W.filter(Ae=>!Ne.has(`${Ae.task_id}:${Ae.run_id}`)),...je]})}}catch{}}),[e,t,s,r]),E.useEffect(()=>{const X=ee.current;if(!X)return;const xe=new IntersectionObserver(A=>{A[0].isIntersecting&&!R&&b.length<x&&B(b.length,!0)},{threshold:.1});return xe.observe(X),()=>xe.disconnect()},[b.length,x,R,B]);function J(X,xe){if(!X||!xe)return"";const A=Math.round((xe-X)/1e3);if(A<60)return`${A}s`;const z=Math.floor(A/60),W=A%60;return`${z}m ${W}s`}const $={started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function he(X,xe){Ss()&&t&&ue(`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(X)}/${encodeURIComponent(xe)}`)}const le=!c&&d==="ready"&&y.jsx(lC,{agents:l,hostPlatform:o,onStarted:(X,xe)=>{if(!t)return;const A=`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(X)}`;ue(xe?`${A}/${encodeURIComponent(xe)}`:A)}}),te=y.jsx(Bx,{pullDistance:L.pullDistance,refreshing:L.refreshing,threshold:L.threshold}),V=c&&f&&y.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:y.jsxs("span",{className:"sessions-filter-chip",children:["Filtered by task",y.jsx("button",{onClick:f,"aria-label":"Clear filter",children:"×"})]})});function Q(X){if(X==="failed")return"var(--color-error)";if(X==="aborted")return"var(--color-warning, #d97706)"}return S&&b.length===0&&e&&d==="ready"?y.jsxs(y.Fragment,{children:[te,le,y.jsx("div",{className:"task-list",children:[0,1,2].map(X=>y.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[y.jsx("div",{className:"task-card-header",children:y.jsx("div",{className:"task-card-title-row",children:y.jsx("div",{className:"skeleton-line",style:{width:`${70+X*10}%`}})})}),y.jsx("div",{className:"task-card-meta",children:y.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},X))})]}):b.length===0?y.jsxs(y.Fragment,{children:[te,le,V,y.jsx("div",{className:"sessions-view",children:d==="loading"?y.jsx("div",{className:"empty-state",children:y.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),y.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Try running ",y.jsx("code",{children:"palmier restart"})," on the host machine to restart the daemon."]})]}):y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),y.jsx("p",{className:"empty-state-hint",children:c?"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger.":"Your sessions will appear here."})]})})]}):y.jsxs(y.Fragment,{children:[te,le,V,y.jsxs("div",{className:"task-list",children:[b.map((X,xe)=>{const A=`${X.task_id}:${X.run_id}`;return y.jsx(oC,{id:A,revealedId:P,setRevealedId:I,onDelete:()=>q(X),disabled:X.starred,confirmMessage:"Delete this session? Its run history will be removed from the host.",onClick:()=>!X.error&&he(X.task_id,X.run_id),children:y.jsxs("div",{className:"sessions-card",children:[y.jsxs("div",{className:"sessions-card-body",children:[y.jsx("h3",{className:"sessions-card-name",children:X.task_name||X.task_id}),y.jsxs("div",{className:"sessions-card-meta",children:[X.running_state==="started"?y.jsx("span",{className:"status-spinner","aria-label":"Running",children:y.jsx("span",{})}):y.jsx("span",{style:{color:Q(X.running_state)},children:$[X.running_state??""]??X.running_state}),X.end_time&&y.jsx("span",{children:m(X.end_time)}),X.start_time&&X.end_time&&y.jsx("span",{style:{color:"var(--color-muted)"},children:J(X.start_time,X.end_time)}),X.error&&y.jsx("span",{style:{color:"var(--color-muted)"},children:X.error})]})]}),!X.error&&y.jsx(Fx,{starred:!!X.starred,onToggle:()=>N(X)}),y.jsx("span",{className:"sessions-card-chevron",children:"›"})]})},`${A}-${xe}`)}),y.jsx("div",{ref:ee,style:{height:1}}),R&&y.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:y.jsx("div",{className:"spinner"})})]})]})}function fC(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const hC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mC={};function tb(e,t){return(mC.jsx?dC:hC).test(e)}const pC=/[ \t\n\f\r]/g;function gC(e){return typeof e=="object"?e.type==="text"?nb(e.value):!1:nb(e)}function nb(e){return e.replace(pC,"")===""}class Kl{constructor(t,r,s){this.normal=r,this.property=t,s&&(this.space=s)}}Kl.prototype.normal={};Kl.prototype.property={};Kl.prototype.space=void 0;function $x(e,t){const r={},s={};for(const l of e)Object.assign(r,l.property),Object.assign(s,l.normal);return new Kl(r,s,t)}function bd(e){return e.toLowerCase()}class Xn{constructor(t,r){this.attribute=r,this.property=t}}Xn.prototype.attribute="";Xn.prototype.booleanish=!1;Xn.prototype.boolean=!1;Xn.prototype.commaOrSpaceSeparated=!1;Xn.prototype.commaSeparated=!1;Xn.prototype.defined=!1;Xn.prototype.mustUseProperty=!1;Xn.prototype.number=!1;Xn.prototype.overloadedBoolean=!1;Xn.prototype.property="";Xn.prototype.spaceSeparated=!1;Xn.prototype.space=void 0;let yC=0;const tt=Es(),hn=Es(),xd=Es(),Se=Es(),Pt=Es(),xa=Es(),ir=Es();function Es(){return 2**++yC}const vd=Object.freeze(Object.defineProperty({__proto__:null,boolean:tt,booleanish:hn,commaOrSpaceSeparated:ir,commaSeparated:xa,number:Se,overloadedBoolean:xd,spaceSeparated:Pt},Symbol.toStringTag,{value:"Module"})),Lh=Object.keys(vd);class Jd extends Xn{constructor(t,r,s,l){let o=-1;if(super(t,r),rb(this,"space",l),typeof s=="number")for(;++o<Lh.length;){const c=Lh[o];rb(this,Lh[o],(s&vd[c])===vd[c])}}}Jd.prototype.defined=!0;function rb(e,t,r){r&&(e[t]=r)}function Na(e){const t={},r={};for(const[s,l]of Object.entries(e.properties)){const o=new Jd(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,r[bd(s)]=s,r[bd(o.attribute)]=s}return new Kl(t,r,e.space)}const Vx=Na({properties:{ariaActiveDescendant:null,ariaAtomic:hn,ariaAutoComplete:null,ariaBusy:hn,ariaChecked:hn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Pt,ariaCurrent:null,ariaDescribedBy:Pt,ariaDetails:null,ariaDisabled:hn,ariaDropEffect:Pt,ariaErrorMessage:null,ariaExpanded:hn,ariaFlowTo:Pt,ariaGrabbed:hn,ariaHasPopup:null,ariaHidden:hn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Pt,ariaLevel:Se,ariaLive:null,ariaModal:hn,ariaMultiLine:hn,ariaMultiSelectable:hn,ariaOrientation:null,ariaOwns:Pt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:hn,ariaReadOnly:hn,ariaRelevant:null,ariaRequired:hn,ariaRoleDescription:Pt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:hn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Yx(e,t){return t in e?e[t]:t}function Gx(e,t){return Yx(e,t.toLowerCase())}const bC=Na({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xa,acceptCharset:Pt,accessKey:Pt,action:null,allow:null,allowFullScreen:tt,allowPaymentRequest:tt,allowUserMedia:tt,alt:null,as:null,async:tt,autoCapitalize:null,autoComplete:Pt,autoFocus:tt,autoPlay:tt,blocking:Pt,capture:null,charSet:null,checked:tt,cite:null,className:Pt,cols:Se,colSpan:null,content:null,contentEditable:hn,controls:tt,controlsList:Pt,coords:Se|xa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tt,defer:tt,dir:null,dirName:null,disabled:tt,download:xd,draggable:hn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tt,formTarget:null,headers:Pt,height:Se,hidden:xd,high:Se,href:null,hrefLang:null,htmlFor:Pt,httpEquiv:Pt,id:null,imageSizes:null,imageSrcSet:null,inert:tt,inputMode:null,integrity:null,is:null,isMap:tt,itemId:null,itemProp:Pt,itemRef:Pt,itemScope:tt,itemType:Pt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tt,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:tt,muted:tt,name:null,nonce:null,noModule:tt,noValidate:tt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:tt,optimum:Se,pattern:null,ping:Pt,placeholder:null,playsInline:tt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tt,referrerPolicy:null,rel:Pt,required:tt,reversed:tt,rows:Se,rowSpan:Se,sandbox:Pt,scope:null,scoped:tt,seamless:tt,selected:tt,shadowRootClonable:tt,shadowRootDelegatesFocus:tt,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:hn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:tt,useMap:null,value:hn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Pt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:tt,declare:tt,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:tt,noHref:tt,noShade:tt,noWrap:tt,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:hn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:tt,disableRemotePlayback:tt,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:Gx}),xC=Na({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ir,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:Pt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:tt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:xa,g2:xa,glyphName:xa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:ir,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Pt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ir,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ir,rev:ir,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ir,requiredFeatures:ir,requiredFonts:ir,requiredFormats:ir,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:ir,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ir,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ir,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Yx}),Jx=Na({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Xx=Na({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Gx}),Kx=Na({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),vC={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},wC=/[A-Z]/g,ib=/-[a-z]/g,SC=/^data[-\w.:]+$/i;function _C(e,t){const r=bd(t);let s=t,l=Xn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&SC.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(ib,EC);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!ib.test(o)){let c=o.replace(wC,kC);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=Jd}return new l(s,t)}function kC(e){return"-"+e.toLowerCase()}function EC(e){return e.charAt(1).toUpperCase()}const CC=$x([Vx,bC,Jx,Xx,Kx],"html"),Xd=$x([Vx,xC,Jx,Xx,Kx],"svg");function AC(e){return e.join(" ").trim()}var la={},zh,sb;function jC(){if(sb)return zh;sb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,d=`
|
|
94
|
+
`,m="/",b="*",g="",x="comment",v="declaration";function S(R,M){if(typeof R!="string")throw new TypeError("First argument must be a string");if(!R)return[];M=M||{};var P=1,I=1;function ue(le){var te=le.match(t);te&&(P+=te.length);var V=le.lastIndexOf(d);I=~V?le.length-V:I+le.length}function q(){var le={line:P,column:I};return function(te){return te.position=new N(le),B(),te}}function N(le){this.start=le,this.end={line:P,column:I},this.source=M.source}N.prototype.content=R;function ee(le){var te=new Error(M.source+":"+P+":"+I+": "+le);if(te.reason=le,te.filename=M.source,te.line=P,te.column=I,te.source=R,!M.silent)throw te}function G(le){var te=le.exec(R);if(te){var V=te[0];return ue(V),R=R.slice(V.length),te}}function B(){G(r)}function L(le){var te;for(le=le||[];te=J();)te!==!1&&le.push(te);return le}function J(){var le=q();if(!(m!=R.charAt(0)||b!=R.charAt(1))){for(var te=2;g!=R.charAt(te)&&(b!=R.charAt(te)||m!=R.charAt(te+1));)++te;if(te+=2,g===R.charAt(te-1))return ee("End of comment missing");var V=R.slice(2,te-2);return I+=2,ue(V),R=R.slice(te),I+=2,le({type:x,comment:V})}}function $(){var le=q(),te=G(s);if(te){if(J(),!G(l))return ee("property missing ':'");var V=G(o),Q=le({type:v,property:j(te[0].replace(e,g)),value:V?j(V[0].replace(e,g)):g});return G(c),Q}}function he(){var le=[];L(le);for(var te;te=$();)te!==!1&&(le.push(te),L(le));return le}return B(),he()}function j(R){return R?R.replace(f,g):g}return zh=S,zh}var ab;function NC(){if(ab)return la;ab=1;var e=la&&la.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(la,"__esModule",{value:!0}),la.default=r;const t=e(jC());function r(s,l){let o=null;if(!s||typeof s!="string")return o;const c=(0,t.default)(s),f=typeof l=="function";return c.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:b}=d;f?l(m,b,d):b&&(o=o||{},o[m]=b)}),o}return la}var _l={},lb;function TC(){if(lb)return _l;lb=1,Object.defineProperty(_l,"__esModule",{value:!0}),_l.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,o=function(m){return!m||r.test(m)||e.test(m)},c=function(m,b){return b.toUpperCase()},f=function(m,b){return"".concat(b,"-")},d=function(m,b){return b===void 0&&(b={}),o(m)?m:(m=m.toLowerCase(),b.reactCompat?m=m.replace(l,f):m=m.replace(s,f),m.replace(t,c))};return _l.camelCase=d,_l}var kl,ob;function OC(){if(ob)return kl;ob=1;var e=kl&&kl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(NC()),r=TC();function s(l,o){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(f,d){f&&d&&(c[(0,r.camelCase)(f,o)]=d)}),c}return s.default=s,kl=s,kl}var RC=OC();const MC=Vb(RC),Qx=Zx("end"),Kd=Zx("start");function Zx(e){return t;function t(r){const s=r&&r.position&&r.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function DC(e){const t=Kd(e),r=Qx(e);if(t&&r)return{start:t,end:r}}function Ll(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ub(e.position):"start"in e||"end"in e?ub(e):"line"in e||"column"in e?wd(e):""}function wd(e){return cb(e&&e.line)+":"+cb(e&&e.column)}function ub(e){return wd(e&&e.start)+"-"+wd(e&&e.end)}function cb(e){return e&&typeof e=="number"?e:1}class Mn extends Error{constructor(t,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let l="",o={},c=!1;if(r&&("line"in r&&"column"in r?o={place:r}:"start"in r&&"end"in r?o={place:r}:"type"in r?o={ancestors:[r],place:r.position}:o={...r}),typeof t=="string"?l=t:!o.cause&&t&&(c=!0,l=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?o.ruleId=s:(o.source=s.slice(0,d),o.ruleId=s.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=Ll(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Mn.prototype.file="";Mn.prototype.name="";Mn.prototype.reason="";Mn.prototype.message="";Mn.prototype.stack="";Mn.prototype.column=void 0;Mn.prototype.line=void 0;Mn.prototype.ancestors=void 0;Mn.prototype.cause=void 0;Mn.prototype.fatal=void 0;Mn.prototype.place=void 0;Mn.prototype.ruleId=void 0;Mn.prototype.source=void 0;const Qd={}.hasOwnProperty,LC=new Map,zC=/[A-Z]/g,UC=new Set(["table","tbody","thead","tfoot","tr"]),PC=new Set(["td","th"]),Wx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function BC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=GC(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=YC(r,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Xd:CC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=e1(l,e,void 0);return o&&typeof o!="string"?o:l.create(e,l.Fragment,{children:o||void 0},void 0)}function e1(e,t,r){if(t.type==="element")return HC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return qC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return FC(e,t,r);if(t.type==="mdxjsEsm")return IC(e,t);if(t.type==="root")return $C(e,t,r);if(t.type==="text")return VC(e,t)}function HC(e,t,r){const s=e.schema;let l=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Xd,e.schema=l),e.ancestors.push(t);const o=n1(e,t.tagName,!1),c=JC(e,t);let f=Wd(e,t);return UC.has(t.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!gC(d):!0})),t1(e,c,o,t),Zd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,r)}function qC(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}$l(e,t.position)}function IC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);$l(e,t.position)}function FC(e,t,r){const s=e.schema;let l=s;t.name==="svg"&&s.space==="html"&&(l=Xd,e.schema=l),e.ancestors.push(t);const o=t.name===null?e.Fragment:n1(e,t.name,!0),c=XC(e,t),f=Wd(e,t);return t1(e,c,o,t),Zd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,r)}function $C(e,t,r){const s={};return Zd(s,Wd(e,t)),e.create(t,e.Fragment,s,r)}function VC(e,t){return t.value}function t1(e,t,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=s)}function Zd(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function YC(e,t,r){return s;function s(l,o,c,f){const m=Array.isArray(c.children)?r:t;return f?m(o,c,f):m(o,c)}}function GC(e,t){return r;function r(s,l,o,c){const f=Array.isArray(o.children),d=Kd(s);return t(l,o,c,f,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function JC(e,t){const r={};let s,l;for(l in t.properties)if(l!=="children"&&Qd.call(t.properties,l)){const o=KC(e,l,t.properties[l]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&PC.has(t.tagName)?s=f:r[c]=f}}if(s){const o=r.style||(r.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function XC(e,t){const r={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const o=s.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else $l(e,t.position);else{const l=s.name;let o;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else $l(e,t.position);else o=s.value===null?!0:s.value;r[l]=o}return r}function Wd(e,t){const r=[];let s=-1;const l=e.passKeys?new Map:LC;for(;++s<t.children.length;){const o=t.children[s];let c;if(e.passKeys){const d=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(d){const m=l.get(d)||0;c=d+"-"+m,l.set(d,m+1)}}const f=e1(e,o,c);f!==void 0&&r.push(f)}return r}function KC(e,t,r){const s=_C(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?fC(r):AC(r)),s.property==="style"){let l=typeof r=="object"?r:QC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=ZC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?vC[s.property]||s.property:s.attribute,r]}}function QC(e,t){try{return MC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new Mn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Wx+"#cannot-parse-style-attribute",l}}function n1(e,t,r){let s;if(!r)s={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let o=-1,c;for(;++o<l.length;){const f=tb(l[o])?{type:"Identifier",name:l[o]}:{type:"Literal",value:l[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}s=c}else s=tb(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const l=s.value;return Qd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);$l(e)}function $l(e,t){const r=new Mn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Wx+"#cannot-handle-mdx-estrees-without-createevaluater",r}function ZC(e){const t={};let r;for(r in e)Qd.call(e,r)&&(t[WC(r)]=e[r]);return t}function WC(e){let t=e.replace(zC,eA);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function eA(e){return"-"+e.toLowerCase()}const Uh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},tA={};function em(e,t){const r=tA,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return r1(e,s,l)}function r1(e,t,r){if(nA(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return fb(e.children,t,r)}return Array.isArray(e)?fb(e,t,r):""}function fb(e,t,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=r1(e[l],t,r);return s.join("")}function nA(e){return!!(e&&typeof e=="object")}const hb=document.createElement("i");function tm(e){const t="&"+e+";";hb.innerHTML=t;const r=hb.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function ur(e,t,r,s){const l=e.length;let o=0,c;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,r=r>0?r:0,s.length<1e4)c=Array.from(s),c.unshift(t,r),e.splice(...c);else for(r&&e.splice(t,r);o<s.length;)c=s.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function kr(e,t){return e.length>0?(ur(e,e.length,0,t),e):t}const db={}.hasOwnProperty;function i1(e){const t={};let r=-1;for(;++r<e.length;)rA(t,e[r]);return t}function rA(e,t){let r;for(r in t){const l=(db.call(e,r)?e[r]:void 0)||(e[r]={}),o=t[r];let c;if(o)for(c in o){db.call(l,c)||(l[c]=[]);const f=o[c];iA(l[c],Array.isArray(f)?f:f?[f]:[])}}}function iA(e,t){let r=-1;const s=[];for(;++r<t.length;)(t[r].add==="after"?e:s).push(t[r]);ur(e,0,0,s)}function s1(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Lr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Pn=es(/[A-Za-z]/),Rn=es(/[\dA-Za-z]/),sA=es(/[#-'*+\--9=?A-Z^-~]/);function Hu(e){return e!==null&&(e<32||e===127)}const Sd=es(/\d/),aA=es(/[\dA-Fa-f]/),lA=es(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function ut(e){return e===-2||e===-1||e===32}const Wu=es(new RegExp("\\p{P}|\\p{S}","u")),_s=es(/\s/);function es(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Ta(e){const t=[];let r=-1,s=0,l=0;for(;++r<e.length;){const o=e.charCodeAt(r);let c="";if(o===37&&Rn(e.charCodeAt(r+1))&&Rn(e.charCodeAt(r+2)))l=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(r+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),l=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(s,r),encodeURIComponent(c)),s=r+l+1,c=""),l&&(r+=l,l=0)}return t.join("")+e.slice(s)}function pt(e,t,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(d){return ut(d)?(e.enter(r),f(d)):t(d)}function f(d){return ut(d)&&o++<l?(e.consume(d),f):(e.exit(r),t(d))}}const oA={tokenize:uA};function uA(e){const t=e.attempt(this.parser.constructs.contentInitial,s,l);let r;return t;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),pt(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),o(f)}function o(f){const d=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=d),r=d,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Fe(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const cA={tokenize:fA},mb={tokenize:hA};function fA(e){const t=this,r=[];let s=0,l,o,c;return f;function f(I){if(s<r.length){const ue=r[s];return t.containerState=ue[1],e.attempt(ue[0].continuation,d,m)(I)}return m(I)}function d(I){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&P();const ue=t.events.length;let q=ue,N;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){N=t.events[q][1].end;break}M(s);let ee=ue;for(;ee<t.events.length;)t.events[ee][1].end={...N},ee++;return ur(t.events,q+1,0,t.events.slice(ue)),t.events.length=ee,m(I)}return f(I)}function m(I){if(s===r.length){if(!l)return x(I);if(l.currentConstruct&&l.currentConstruct.concrete)return S(I);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(mb,b,g)(I)}function b(I){return l&&P(),M(s),x(I)}function g(I){return t.parser.lazy[t.now().line]=s!==r.length,c=t.now().offset,S(I)}function x(I){return t.containerState={},e.attempt(mb,v,S)(I)}function v(I){return s++,r.push([t.currentConstruct,t.containerState]),x(I)}function S(I){if(I===null){l&&P(),M(0),e.consume(I);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:o}),j(I)}function j(I){if(I===null){R(e.exit("chunkFlow"),!0),M(0),e.consume(I);return}return Fe(I)?(e.consume(I),R(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(I),j)}function R(I,ue){const q=t.sliceStream(I);if(ue&&q.push(null),I.previous=o,o&&(o.next=I),o=I,l.defineSkip(I.start),l.write(q),t.parser.lazy[I.start.line]){let N=l.events.length;for(;N--;)if(l.events[N][1].start.offset<c&&(!l.events[N][1].end||l.events[N][1].end.offset>c))return;const ee=t.events.length;let G=ee,B,L;for(;G--;)if(t.events[G][0]==="exit"&&t.events[G][1].type==="chunkFlow"){if(B){L=t.events[G][1].end;break}B=!0}for(M(s),N=ee;N<t.events.length;)t.events[N][1].end={...L},N++;ur(t.events,G+1,0,t.events.slice(ee)),t.events.length=N}}function M(I){let ue=r.length;for(;ue-- >I;){const q=r[ue];t.containerState=q[1],q[0].exit.call(t,e)}r.length=I}function P(){l.write([null]),o=void 0,l=void 0,t.containerState._closeFlow=void 0}}function hA(e,t,r){return pt(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ka(e){if(e===null||Dt(e)||_s(e))return 1;if(Wu(e))return 2}function ec(e,t,r){const s=[];let l=-1;for(;++l<e.length;){const o=e[l].resolveAll;o&&!s.includes(o)&&(t=o(t,r),s.push(o))}return t}const _d={name:"attention",resolveAll:dA,tokenize:mA};function dA(e,t){let r=-1,s,l,o,c,f,d,m,b;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(s=r;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[s][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[s][1].end},x={...e[r][1].start};pb(g,-d),pb(x,d),c={type:d>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},f={type:d>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:x},o={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},l={type:d>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[r][1].start={...f.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=kr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=kr(m,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",o,t]]),m=kr(m,ec(t.parser.constructs.insideSpan.null,e.slice(s+1,r),t)),m=kr(m,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[r][1].end.offset-e[r][1].start.offset?(b=2,m=kr(m,[["enter",e[r][1],t],["exit",e[r][1],t]])):b=0,ur(e,s-1,r-s+3,m),r=s+m.length-b-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function mA(e,t){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=ka(s);let o;return c;function c(d){return o=d,e.enter("attentionSequence"),f(d)}function f(d){if(d===o)return e.consume(d),f;const m=e.exit("attentionSequence"),b=ka(d),g=!b||b===2&&l||r.includes(d),x=!l||l===2&&b||r.includes(s);return m._open=!!(o===42?g:g&&(l||!x)),m._close=!!(o===42?x:x&&(b||!g)),t(d)}}function pb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const pA={name:"autolink",tokenize:gA};function gA(e,t,r){let s=0;return l;function l(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(v){return Pn(v)?(e.consume(v),c):v===64?r(v):m(v)}function c(v){return v===43||v===45||v===46||Rn(v)?(s=1,f(v)):m(v)}function f(v){return v===58?(e.consume(v),s=0,d):(v===43||v===45||v===46||Rn(v))&&s++<32?(e.consume(v),f):(s=0,m(v))}function d(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||Hu(v)?r(v):(e.consume(v),d)}function m(v){return v===64?(e.consume(v),b):sA(v)?(e.consume(v),m):r(v)}function b(v){return Rn(v)?g(v):r(v)}function g(v){return v===46?(e.consume(v),s=0,b):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):x(v)}function x(v){if((v===45||Rn(v))&&s++<63){const S=v===45?x:g;return e.consume(v),S}return r(v)}}const Ql={partial:!0,tokenize:yA};function yA(e,t,r){return s;function s(o){return ut(o)?pt(e,l,"linePrefix")(o):l(o)}function l(o){return o===null||Fe(o)?t(o):r(o)}}const a1={continuation:{tokenize:xA},exit:vA,name:"blockQuote",tokenize:bA};function bA(e,t,r){const s=this;return l;function l(c){if(c===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return r(c)}function o(c){return ut(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function xA(e,t,r){const s=this;return l;function l(c){return ut(c)?pt(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(a1,t,r)(c)}}function vA(e){e.exit("blockQuote")}const l1={name:"characterEscape",tokenize:wA};function wA(e,t,r){return s;function s(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),l}function l(o){return lA(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(o)}}const o1={name:"characterReference",tokenize:SA};function SA(e,t,r){const s=this;let l=0,o,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),d}function d(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),o=31,c=Rn,b(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=aA,b):(e.enter("characterReferenceValue"),o=7,c=Sd,b(g))}function b(g){if(g===59&&l){const x=e.exit("characterReferenceValue");return c===Rn&&!tm(s.sliceSerialize(x))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&l++<o?(e.consume(g),b):r(g)}}const gb={partial:!0,tokenize:kA},yb={concrete:!0,name:"codeFenced",tokenize:_A};function _A(e,t,r){const s=this,l={partial:!0,tokenize:q};let o=0,c=0,f;return d;function d(N){return m(N)}function m(N){const ee=s.events[s.events.length-1];return o=ee&&ee[1].type==="linePrefix"?ee[2].sliceSerialize(ee[1],!0).length:0,f=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),b(N)}function b(N){return N===f?(c++,e.consume(N),b):c<3?r(N):(e.exit("codeFencedFenceSequence"),ut(N)?pt(e,g,"whitespace")(N):g(N))}function g(N){return N===null||Fe(N)?(e.exit("codeFencedFence"),s.interrupt?t(N):e.check(gb,j,ue)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(N))}function x(N){return N===null||Fe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(N)):ut(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),pt(e,v,"whitespace")(N)):N===96&&N===f?r(N):(e.consume(N),x)}function v(N){return N===null||Fe(N)?g(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(N))}function S(N){return N===null||Fe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(N)):N===96&&N===f?r(N):(e.consume(N),S)}function j(N){return e.attempt(l,ue,R)(N)}function R(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),M}function M(N){return o>0&&ut(N)?pt(e,P,"linePrefix",o+1)(N):P(N)}function P(N){return N===null||Fe(N)?e.check(gb,j,ue)(N):(e.enter("codeFlowValue"),I(N))}function I(N){return N===null||Fe(N)?(e.exit("codeFlowValue"),P(N)):(e.consume(N),I)}function ue(N){return e.exit("codeFenced"),t(N)}function q(N,ee,G){let B=0;return L;function L(te){return N.enter("lineEnding"),N.consume(te),N.exit("lineEnding"),J}function J(te){return N.enter("codeFencedFence"),ut(te)?pt(N,$,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(te):$(te)}function $(te){return te===f?(N.enter("codeFencedFenceSequence"),he(te)):G(te)}function he(te){return te===f?(B++,N.consume(te),he):B>=c?(N.exit("codeFencedFenceSequence"),ut(te)?pt(N,le,"whitespace")(te):le(te)):G(te)}function le(te){return te===null||Fe(te)?(N.exit("codeFencedFence"),ee(te)):G(te)}}}function kA(e,t,r){const s=this;return l;function l(c){return c===null?r(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}const Ph={name:"codeIndented",tokenize:CA},EA={partial:!0,tokenize:AA};function CA(e,t,r){const s=this;return l;function l(m){return e.enter("codeIndented"),pt(e,o,"linePrefix",5)(m)}function o(m){const b=s.events[s.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?c(m):r(m)}function c(m){return m===null?d(m):Fe(m)?e.attempt(EA,c,d)(m):(e.enter("codeFlowValue"),f(m))}function f(m){return m===null||Fe(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),f)}function d(m){return e.exit("codeIndented"),t(m)}}function AA(e,t,r){const s=this;return l;function l(c){return s.parser.lazy[s.now().line]?r(c):Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):pt(e,o,"linePrefix",5)(c)}function o(c){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):Fe(c)?l(c):r(c)}}const jA={name:"codeText",previous:TA,resolve:NA,tokenize:OA};function NA(e){let t=e.length-4,r=3,s,l;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=r;++s<t;)if(e[s][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(s=r-1,t++;++s<=t;)l===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(l=s):(s===t||e[s][1].type==="lineEnding")&&(e[l][1].type="codeTextData",s!==l+2&&(e[l][1].end=e[s-1][1].end,e.splice(l+2,s-l-2),t-=s-l-2,s=l+2),l=void 0);return e}function TA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function OA(e,t,r){let s=0,l,o;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),s++,f):(e.exit("codeTextSequence"),d(g))}function d(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),d):g===96?(o=e.enter("codeTextSequence"),l=0,b(g)):Fe(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||Fe(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),m)}function b(g){return g===96?(e.consume(g),l++,b):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",m(g))}}class RA{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const s=r??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,r,s){const l=r||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&El(this.left,s),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),El(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),El(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);El(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);El(this.left,r.reverse())}}}function El(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function u1(e){const t={};let r=-1,s,l,o,c,f,d,m;const b=new RA(e);for(;++r<b.length;){for(;r in t;)r=t[r];if(s=b.get(r),r&&s[1].type==="chunkFlow"&&b.get(r-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,o=0,o<d.length&&d[o][1].type==="lineEndingBlank"&&(o+=2),o<d.length&&d[o][1].type==="content"))for(;++o<d.length&&d[o][1].type!=="content";)d[o][1].type==="chunkText"&&(d[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,MA(b,r)),r=t[r],m=!0);else if(s[1]._container){for(o=r,l=void 0;o--;)if(c=b.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(b.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(s[1].end={...b.get(l)[1].start},f=b.slice(l,r),f.unshift(s),b.splice(l,r-l+1,f))}}return ur(e,0,Number.POSITIVE_INFINITY,b.slice(0)),!m}function MA(e,t){const r=e.get(t)[1],s=e.get(t)[2];let l=t-1;const o=[];let c=r._tokenizer;c||(c=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,d=[],m={};let b,g,x=-1,v=r,S=0,j=0;const R=[j];for(;v;){for(;e.get(++l)[1]!==v;);o.push(l),v._tokenizer||(b=s.sliceStream(v),v.next||b.push(null),g&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(b),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=v,v=v.next}for(v=r;++x<f.length;)f[x][0]==="exit"&&f[x-1][0]==="enter"&&f[x][1].type===f[x-1][1].type&&f[x][1].start.line!==f[x][1].end.line&&(j=x+1,R.push(j),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(c.events=[],v?(v._tokenizer=void 0,v.previous=void 0):R.pop(),x=R.length;x--;){const M=f.slice(R[x],R[x+1]),P=o.pop();d.push([P,P+M.length-1]),e.splice(P,2,M)}for(d.reverse(),x=-1;++x<d.length;)m[S+d[x][0]]=S+d[x][1],S+=d[x][1]-d[x][0]-1;return m}const DA={resolve:zA,tokenize:UA},LA={partial:!0,tokenize:PA};function zA(e){return u1(e),e}function UA(e,t){let r;return s;function s(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?o(f):Fe(f)?e.check(LA,c,o)(f):(e.consume(f),l)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,l}}function PA(e,t,r){const s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),pt(e,o,"linePrefix")}function o(c){if(c===null||Fe(c))return r(c);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,r,t)(c)}}function c1(e,t,r,s,l,o,c,f,d){const m=d||Number.POSITIVE_INFINITY;let b=0;return g;function g(M){return M===60?(e.enter(s),e.enter(l),e.enter(o),e.consume(M),e.exit(o),x):M===null||M===32||M===41||Hu(M)?r(M):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(M))}function x(M){return M===62?(e.enter(o),e.consume(M),e.exit(o),e.exit(l),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(M))}function v(M){return M===62?(e.exit("chunkString"),e.exit(f),x(M)):M===null||M===60||Fe(M)?r(M):(e.consume(M),M===92?S:v)}function S(M){return M===60||M===62||M===92?(e.consume(M),v):v(M)}function j(M){return!b&&(M===null||M===41||Dt(M))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(M)):b<m&&M===40?(e.consume(M),b++,j):M===41?(e.consume(M),b--,j):M===null||M===32||M===40||Hu(M)?r(M):(e.consume(M),M===92?R:j)}function R(M){return M===40||M===41||M===92?(e.consume(M),j):j(M)}}function f1(e,t,r,s,l,o){const c=this;let f=0,d;return m;function m(v){return e.enter(s),e.enter(l),e.consume(v),e.exit(l),e.enter(o),b}function b(v){return f>999||v===null||v===91||v===93&&!d||v===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(v):v===93?(e.exit(o),e.enter(l),e.consume(v),e.exit(l),e.exit(s),t):Fe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),b):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Fe(v)||f++>999?(e.exit("chunkString"),b(v)):(e.consume(v),d||(d=!ut(v)),v===92?x:g)}function x(v){return v===91||v===92||v===93?(e.consume(v),f++,g):g(v)}}function h1(e,t,r,s,l,o){let c;return f;function f(x){return x===34||x===39||x===40?(e.enter(s),e.enter(l),e.consume(x),e.exit(l),c=x===40?41:x,d):r(x)}function d(x){return x===c?(e.enter(l),e.consume(x),e.exit(l),e.exit(s),t):(e.enter(o),m(x))}function m(x){return x===c?(e.exit(o),d(c)):x===null?r(x):Fe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),pt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),b(x))}function b(x){return x===c||x===null||Fe(x)?(e.exit("chunkString"),m(x)):(e.consume(x),x===92?g:b)}function g(x){return x===c||x===92?(e.consume(x),b):b(x)}}function zl(e,t){let r;return s;function s(l){return Fe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):ut(l)?pt(e,s,r?"linePrefix":"lineSuffix")(l):t(l)}}const BA={name:"definition",tokenize:qA},HA={partial:!0,tokenize:IA};function qA(e,t,r){const s=this;let l;return o;function o(v){return e.enter("definition"),c(v)}function c(v){return f1.call(s,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return l=Lr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),d):r(v)}function d(v){return Dt(v)?zl(e,m)(v):m(v)}function m(v){return c1(e,b,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function b(v){return e.attempt(HA,g,g)(v)}function g(v){return ut(v)?pt(e,x,"whitespace")(v):x(v)}function x(v){return v===null||Fe(v)?(e.exit("definition"),s.parser.defined.push(l),t(v)):r(v)}}function IA(e,t,r){return s;function s(f){return Dt(f)?zl(e,l)(f):r(f)}function l(f){return h1(e,o,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return ut(f)?pt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Fe(f)?t(f):r(f)}}const FA={name:"hardBreakEscape",tokenize:$A};function $A(e,t,r){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),l}function l(o){return Fe(o)?(e.exit("hardBreakEscape"),t(o)):r(o)}}const VA={name:"headingAtx",resolve:YA,tokenize:GA};function YA(e,t){let r=e.length-2,s=3,l,o;return e[s][1].type==="whitespace"&&(s+=2),r-2>s&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&e[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(l={type:"atxHeadingText",start:e[s][1].start,end:e[r][1].end},o={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},ur(e,s,r-s+1,[["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t]])),e}function GA(e,t,r){let s=0;return l;function l(b){return e.enter("atxHeading"),o(b)}function o(b){return e.enter("atxHeadingSequence"),c(b)}function c(b){return b===35&&s++<6?(e.consume(b),c):b===null||Dt(b)?(e.exit("atxHeadingSequence"),f(b)):r(b)}function f(b){return b===35?(e.enter("atxHeadingSequence"),d(b)):b===null||Fe(b)?(e.exit("atxHeading"),t(b)):ut(b)?pt(e,f,"whitespace")(b):(e.enter("atxHeadingText"),m(b))}function d(b){return b===35?(e.consume(b),d):(e.exit("atxHeadingSequence"),f(b))}function m(b){return b===null||b===35||Dt(b)?(e.exit("atxHeadingText"),f(b)):(e.consume(b),m)}}const JA=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],bb=["pre","script","style","textarea"],XA={concrete:!0,name:"htmlFlow",resolveTo:ZA,tokenize:WA},KA={partial:!0,tokenize:tj},QA={partial:!0,tokenize:ej};function ZA(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function WA(e,t,r){const s=this;let l,o,c,f,d;return m;function m(T){return b(T)}function b(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),g}function g(T){return T===33?(e.consume(T),x):T===47?(e.consume(T),o=!0,j):T===63?(e.consume(T),l=3,s.interrupt?t:A):Pn(T)?(e.consume(T),c=String.fromCharCode(T),R):r(T)}function x(T){return T===45?(e.consume(T),l=2,v):T===91?(e.consume(T),l=5,f=0,S):Pn(T)?(e.consume(T),l=4,s.interrupt?t:A):r(T)}function v(T){return T===45?(e.consume(T),s.interrupt?t:A):r(T)}function S(T){const ve="CDATA[";return T===ve.charCodeAt(f++)?(e.consume(T),f===ve.length?s.interrupt?t:$:S):r(T)}function j(T){return Pn(T)?(e.consume(T),c=String.fromCharCode(T),R):r(T)}function R(T){if(T===null||T===47||T===62||Dt(T)){const ve=T===47,je=c.toLowerCase();return!ve&&!o&&bb.includes(je)?(l=1,s.interrupt?t(T):$(T)):JA.includes(c.toLowerCase())?(l=6,ve?(e.consume(T),M):s.interrupt?t(T):$(T)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(T):o?P(T):I(T))}return T===45||Rn(T)?(e.consume(T),c+=String.fromCharCode(T),R):r(T)}function M(T){return T===62?(e.consume(T),s.interrupt?t:$):r(T)}function P(T){return ut(T)?(e.consume(T),P):L(T)}function I(T){return T===47?(e.consume(T),L):T===58||T===95||Pn(T)?(e.consume(T),ue):ut(T)?(e.consume(T),I):L(T)}function ue(T){return T===45||T===46||T===58||T===95||Rn(T)?(e.consume(T),ue):q(T)}function q(T){return T===61?(e.consume(T),N):ut(T)?(e.consume(T),q):I(T)}function N(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(e.consume(T),d=T,ee):ut(T)?(e.consume(T),N):G(T)}function ee(T){return T===d?(e.consume(T),d=null,B):T===null||Fe(T)?r(T):(e.consume(T),ee)}function G(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Dt(T)?q(T):(e.consume(T),G)}function B(T){return T===47||T===62||ut(T)?I(T):r(T)}function L(T){return T===62?(e.consume(T),J):r(T)}function J(T){return T===null||Fe(T)?$(T):ut(T)?(e.consume(T),J):r(T)}function $(T){return T===45&&l===2?(e.consume(T),V):T===60&&l===1?(e.consume(T),Q):T===62&&l===4?(e.consume(T),z):T===63&&l===3?(e.consume(T),A):T===93&&l===5?(e.consume(T),xe):Fe(T)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(KA,W,he)(T)):T===null||Fe(T)?(e.exit("htmlFlowData"),he(T)):(e.consume(T),$)}function he(T){return e.check(QA,le,W)(T)}function le(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),te}function te(T){return T===null||Fe(T)?he(T):(e.enter("htmlFlowData"),$(T))}function V(T){return T===45?(e.consume(T),A):$(T)}function Q(T){return T===47?(e.consume(T),c="",X):$(T)}function X(T){if(T===62){const ve=c.toLowerCase();return bb.includes(ve)?(e.consume(T),z):$(T)}return Pn(T)&&c.length<8?(e.consume(T),c+=String.fromCharCode(T),X):$(T)}function xe(T){return T===93?(e.consume(T),A):$(T)}function A(T){return T===62?(e.consume(T),z):T===45&&l===2?(e.consume(T),A):$(T)}function z(T){return T===null||Fe(T)?(e.exit("htmlFlowData"),W(T)):(e.consume(T),z)}function W(T){return e.exit("htmlFlow"),t(T)}}function ej(e,t,r){const s=this;return l;function l(c){return Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):r(c)}function o(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}function tj(e,t,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Ql,t,r)}}const nj={name:"htmlText",tokenize:rj};function rj(e,t,r){const s=this;let l,o,c;return f;function f(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),d}function d(A){return A===33?(e.consume(A),m):A===47?(e.consume(A),q):A===63?(e.consume(A),I):Pn(A)?(e.consume(A),G):r(A)}function m(A){return A===45?(e.consume(A),b):A===91?(e.consume(A),o=0,S):Pn(A)?(e.consume(A),P):r(A)}function b(A){return A===45?(e.consume(A),v):r(A)}function g(A){return A===null?r(A):A===45?(e.consume(A),x):Fe(A)?(c=g,Q(A)):(e.consume(A),g)}function x(A){return A===45?(e.consume(A),v):g(A)}function v(A){return A===62?V(A):A===45?x(A):g(A)}function S(A){const z="CDATA[";return A===z.charCodeAt(o++)?(e.consume(A),o===z.length?j:S):r(A)}function j(A){return A===null?r(A):A===93?(e.consume(A),R):Fe(A)?(c=j,Q(A)):(e.consume(A),j)}function R(A){return A===93?(e.consume(A),M):j(A)}function M(A){return A===62?V(A):A===93?(e.consume(A),M):j(A)}function P(A){return A===null||A===62?V(A):Fe(A)?(c=P,Q(A)):(e.consume(A),P)}function I(A){return A===null?r(A):A===63?(e.consume(A),ue):Fe(A)?(c=I,Q(A)):(e.consume(A),I)}function ue(A){return A===62?V(A):I(A)}function q(A){return Pn(A)?(e.consume(A),N):r(A)}function N(A){return A===45||Rn(A)?(e.consume(A),N):ee(A)}function ee(A){return Fe(A)?(c=ee,Q(A)):ut(A)?(e.consume(A),ee):V(A)}function G(A){return A===45||Rn(A)?(e.consume(A),G):A===47||A===62||Dt(A)?B(A):r(A)}function B(A){return A===47?(e.consume(A),V):A===58||A===95||Pn(A)?(e.consume(A),L):Fe(A)?(c=B,Q(A)):ut(A)?(e.consume(A),B):V(A)}function L(A){return A===45||A===46||A===58||A===95||Rn(A)?(e.consume(A),L):J(A)}function J(A){return A===61?(e.consume(A),$):Fe(A)?(c=J,Q(A)):ut(A)?(e.consume(A),J):B(A)}function $(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),l=A,he):Fe(A)?(c=$,Q(A)):ut(A)?(e.consume(A),$):(e.consume(A),le)}function he(A){return A===l?(e.consume(A),l=void 0,te):A===null?r(A):Fe(A)?(c=he,Q(A)):(e.consume(A),he)}function le(A){return A===null||A===34||A===39||A===60||A===61||A===96?r(A):A===47||A===62||Dt(A)?B(A):(e.consume(A),le)}function te(A){return A===47||A===62||Dt(A)?B(A):r(A)}function V(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):r(A)}function Q(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),X}function X(A){return ut(A)?pt(e,xe,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):xe(A)}function xe(A){return e.enter("htmlTextData"),c(A)}}const nm={name:"labelEnd",resolveAll:lj,resolveTo:oj,tokenize:uj},ij={tokenize:cj},sj={tokenize:fj},aj={tokenize:hj};function lj(e){let t=-1;const r=[];for(;++t<e.length;){const s=e[t][1];if(r.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const l=s.type==="labelImage"?4:2;s.type="data",t+=l}}return e.length!==r.length&&ur(e,0,e.length,r),e}function oj(e,t){let r=e.length,s=0,l,o,c,f;for(;r--;)if(l=e[r][1],o){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[r][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(c){if(e[r][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(o=r,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(c=r);const d={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},b={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",d,t],["enter",m,t]],f=kr(f,e.slice(o+1,o+s+3)),f=kr(f,[["enter",b,t]]),f=kr(f,ec(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),f=kr(f,[["exit",b,t],e[c-2],e[c-1],["exit",m,t]]),f=kr(f,e.slice(c+1)),f=kr(f,[["exit",d,t]]),ur(e,o,e.length,f),e}function uj(e,t,r){const s=this;let l=s.events.length,o,c;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){o=s.events[l][1];break}return f;function f(x){return o?o._inactive?g(x):(c=s.parser.defined.includes(Lr(s.sliceSerialize({start:o.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),d):r(x)}function d(x){return x===40?e.attempt(ij,b,c?b:g)(x):x===91?e.attempt(sj,b,c?m:g)(x):c?b(x):g(x)}function m(x){return e.attempt(aj,b,g)(x)}function b(x){return t(x)}function g(x){return o._balanced=!0,r(x)}}function cj(e,t,r){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return Dt(g)?zl(e,o)(g):o(g)}function o(g){return g===41?b(g):c1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Dt(g)?zl(e,d)(g):b(g)}function f(g){return r(g)}function d(g){return g===34||g===39||g===40?h1(e,m,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):b(g)}function m(g){return Dt(g)?zl(e,b)(g):b(g)}function b(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):r(g)}}function fj(e,t,r){const s=this;return l;function l(f){return f1.call(s,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return s.parser.defined.includes(Lr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):r(f)}function c(f){return r(f)}}function hj(e,t,r){return s;function s(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),l}function l(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):r(o)}}const dj={name:"labelStartImage",resolveAll:nm.resolveAll,tokenize:mj};function mj(e,t,r){const s=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):r(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(f):t(f)}}const pj={name:"labelStartLink",resolveAll:nm.resolveAll,tokenize:gj};function gj(e,t,r){const s=this;return l;function l(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(c):t(c)}}const Bh={name:"lineEnding",tokenize:yj};function yj(e,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),pt(e,t,"linePrefix")}}const Au={name:"thematicBreak",tokenize:bj};function bj(e,t,r){let s=0,l;return o;function o(m){return e.enter("thematicBreak"),c(m)}function c(m){return l=m,f(m)}function f(m){return m===l?(e.enter("thematicBreakSequence"),d(m)):s>=3&&(m===null||Fe(m))?(e.exit("thematicBreak"),t(m)):r(m)}function d(m){return m===l?(e.consume(m),s++,d):(e.exit("thematicBreakSequence"),ut(m)?pt(e,f,"whitespace")(m):f(m))}}const Gn={continuation:{tokenize:Sj},exit:kj,name:"list",tokenize:wj},xj={partial:!0,tokenize:Ej},vj={partial:!0,tokenize:_j};function wj(e,t,r){const s=this,l=s.events[s.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return f;function f(v){const S=s.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!s.containerState.marker||v===s.containerState.marker:Sd(v)){if(s.containerState.type||(s.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Au,r,m)(v):m(v);if(!s.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(v)}return r(v)}function d(v){return Sd(v)&&++c<10?(e.consume(v),d):(!s.interrupt||c<2)&&(s.containerState.marker?v===s.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),m(v)):r(v)}function m(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||v,e.check(Ql,s.interrupt?r:b,e.attempt(xj,x,g))}function b(v){return s.containerState.initialBlankLine=!0,o++,x(v)}function g(v){return ut(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),x):r(v)}function x(v){return s.containerState.size=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function Sj(e,t,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Ql,l,o);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,pt(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!ut(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(vj,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,pt(e,e.attempt(Gn,t,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function _j(e,t,r){const s=this;return pt(e,l,"listItemIndent",s.containerState.size+1);function l(o){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(o):r(o)}}function kj(e){e.exit(this.containerState.type)}function Ej(e,t,r){const s=this;return pt(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const c=s.events[s.events.length-1];return!ut(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):r(o)}}const xb={name:"setextUnderline",resolveTo:Cj,tokenize:Aj};function Cj(e,t){let r=e.length,s,l,o;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){s=r;break}e[r][1].type==="paragraph"&&(l=r)}else e[r][1].type==="content"&&e.splice(r,1),!o&&e[r][1].type==="definition"&&(o=r);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",o?(e.splice(l,0,["enter",c,t]),e.splice(o+1,0,["exit",e[s][1],t]),e[s][1].end={...e[o][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function Aj(e,t,r){const s=this;let l;return o;function o(m){let b=s.events.length,g;for(;b--;)if(s.events[b][1].type!=="lineEnding"&&s.events[b][1].type!=="linePrefix"&&s.events[b][1].type!=="content"){g=s.events[b][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),l=m,c(m)):r(m)}function c(m){return e.enter("setextHeadingLineSequence"),f(m)}function f(m){return m===l?(e.consume(m),f):(e.exit("setextHeadingLineSequence"),ut(m)?pt(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||Fe(m)?(e.exit("setextHeadingLine"),t(m)):r(m)}}const jj={tokenize:Nj};function Nj(e){const t=this,r=e.attempt(Ql,s,e.attempt(this.parser.constructs.flowInitial,l,pt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(DA,l)),"linePrefix")));return r;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function l(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const Tj={resolveAll:m1()},Oj=d1("string"),Rj=d1("text");function d1(e){return{resolveAll:m1(e==="text"?Mj:void 0),tokenize:t};function t(r){const s=this,l=this.parser.constructs[e],o=r.attempt(l,c,f);return c;function c(b){return m(b)?o(b):f(b)}function f(b){if(b===null){r.consume(b);return}return r.enter("data"),r.consume(b),d}function d(b){return m(b)?(r.exit("data"),o(b)):(r.consume(b),d)}function m(b){if(b===null)return!0;const g=l[b];let x=-1;if(g)for(;++x<g.length;){const v=g[x];if(!v.previous||v.previous.call(s,s.previous))return!0}return!1}}}function m1(e){return t;function t(r,s){let l=-1,o;for(;++l<=r.length;)o===void 0?r[l]&&r[l][1].type==="data"&&(o=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==o+2&&(r[o][1].end=r[l-1][1].end,r.splice(o+2,l-o-2),l=o+2),o=void 0);return e?e(r,s):r}}function Mj(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const s=e[r-1][1],l=t.sliceStream(s);let o=l.length,c=-1,f=0,d;for(;o--;){const m=l[o];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(m===-2)d=!0,f++;else if(m!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(f=0),f){const m={type:r===e.length||d||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:s.start._bufferIndex+c,_index:s.start._index+o,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(r,0,["enter",m,t],["exit",m,t]),r+=2)}r++}return e}const Dj={42:Gn,43:Gn,45:Gn,48:Gn,49:Gn,50:Gn,51:Gn,52:Gn,53:Gn,54:Gn,55:Gn,56:Gn,57:Gn,62:a1},Lj={91:BA},zj={[-2]:Ph,[-1]:Ph,32:Ph},Uj={35:VA,42:Au,45:[xb,Au],60:XA,61:xb,95:Au,96:yb,126:yb},Pj={38:o1,92:l1},Bj={[-5]:Bh,[-4]:Bh,[-3]:Bh,33:dj,38:o1,42:_d,60:[pA,nj],91:pj,92:[FA,l1],93:nm,95:_d,96:jA},Hj={null:[_d,Tj]},qj={null:[42,95]},Ij={null:[]},Fj=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qj,contentInitial:Lj,disable:Ij,document:Dj,flow:Uj,flowInitial:zj,insideSpan:Hj,string:Pj,text:Bj},Symbol.toStringTag,{value:"Module"}));function $j(e,t,r){let s={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const l={},o=[];let c=[],f=[];const d={attempt:ee(q),check:ee(N),consume:P,enter:I,exit:ue,interrupt:ee(N,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:S,parser:e,previous:null,sliceSerialize:x,sliceStream:v,write:g};let b=t.tokenize.call(m,d);return t.resolveAll&&o.push(t),m;function g(J){return c=kr(c,J),R(),c[c.length-1]!==null?[]:(G(t,0),m.events=ec(o,m.events,m),m.events)}function x(J,$){return Yj(v(J),$)}function v(J){return Vj(c,J)}function S(){const{_bufferIndex:J,_index:$,line:he,column:le,offset:te}=s;return{_bufferIndex:J,_index:$,line:he,column:le,offset:te}}function j(J){l[J.line]=J.column,L()}function R(){let J;for(;s._index<c.length;){const $=c[s._index];if(typeof $=="string")for(J=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===J&&s._bufferIndex<$.length;)M($.charCodeAt(s._bufferIndex));else M($)}}function M(J){b=b(J)}function P(J){Fe(J)?(s.line++,s.column=1,s.offset+=J===-3?2:1,L()):J!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),m.previous=J}function I(J,$){const he=$||{};return he.type=J,he.start=S(),m.events.push(["enter",he,m]),f.push(he),he}function ue(J){const $=f.pop();return $.end=S(),m.events.push(["exit",$,m]),$}function q(J,$){G(J,$.from)}function N(J,$){$.restore()}function ee(J,$){return he;function he(le,te,V){let Q,X,xe,A;return Array.isArray(le)?W(le):"tokenize"in le?W([le]):z(le);function z(Ne){return ce;function ce(Ae){const ke=Ae!==null&&Ne[Ae],Qe=Ae!==null&&Ne.null,Lt=[...Array.isArray(ke)?ke:ke?[ke]:[],...Array.isArray(Qe)?Qe:Qe?[Qe]:[]];return W(Lt)(Ae)}}function W(Ne){return Q=Ne,X=0,Ne.length===0?V:T(Ne[X])}function T(Ne){return ce;function ce(Ae){return A=B(),xe=Ne,Ne.partial||(m.currentConstruct=Ne),Ne.name&&m.parser.constructs.disable.null.includes(Ne.name)?je():Ne.tokenize.call($?Object.assign(Object.create(m),$):m,d,ve,je)(Ae)}}function ve(Ne){return J(xe,A),te}function je(Ne){return A.restore(),++X<Q.length?T(Q[X]):V}}}function G(J,$){J.resolveAll&&!o.includes(J)&&o.push(J),J.resolve&&ur(m.events,$,m.events.length-$,J.resolve(m.events.slice($),m)),J.resolveTo&&(m.events=J.resolveTo(m.events,m))}function B(){const J=S(),$=m.previous,he=m.currentConstruct,le=m.events.length,te=Array.from(f);return{from:le,restore:V};function V(){s=J,m.previous=$,m.currentConstruct=he,m.events.length=le,f=te,L()}}function L(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function Vj(e,t){const r=t.start._index,s=t.start._bufferIndex,l=t.end._index,o=t.end._bufferIndex;let c;if(r===l)c=[e[r].slice(s,o)];else{if(c=e.slice(r,l),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}o>0&&c.push(e[l].slice(0,o))}return c}function Yj(e,t){let r=-1;const s=[];let l;for(;++r<e.length;){const o=e[r];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
|
|
95
95
|
`;break}case-3:{c=`\r
|
|
96
|
-
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&l)continue;c=" ";break}default:c=String.fromCharCode(o)}l=o===-2,s.push(c)}return s.join("")}function Gj(e){const s={constructs:i1([Fj,...(e||{}).extensions||[]]),content:l(oA),defined:[],document:l(cA),flow:l(jj),lazy:{},string:l(Oj),text:l(Rj)};return s;function l(o){return c;function c(f){return $j(s,o,f)}}}function Jj(e){for(;!u1(e););return e}const vb=/[\0\t\n\r]/g;function Xj(){let e=1,t="",r=!0,s;return l;function l(o,c,f){const d=[];let m,b,g,x,v;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),g=0,t="",r&&(o.charCodeAt(0)===65279&&g++,r=void 0);g<o.length;){if(vb.lastIndex=g,m=vb.exec(o),x=m&&m.index!==void 0?m.index:o.length,v=o.charCodeAt(x),!m){t=o.slice(g);break}if(v===10&&g===x&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),g<x&&(d.push(o.slice(g,x)),e+=x-g),v){case 0:{d.push(65533),e++;break}case 9:{for(b=Math.ceil(e/4)*4,d.push(-2);e++<b;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}g=x+1}return f&&(s&&d.push(-5),t&&d.push(t),d.push(null)),d}}const Kj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Qj(e){return e.replace(Kj,Zj)}function Zj(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),o=l===120||l===88;return s1(r.slice(o?2:1),o?16:10)}return tm(r)||e}const p1={}.hasOwnProperty;function Wj(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),eN(r)(Jj(Gj(r).document().write(Xj()(e,t,!0))))}function eN(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(dt),autolinkProtocol:B,autolinkEmail:B,atxHeading:o(on),blockQuote:o(We),characterEscape:B,characterReference:B,codeFenced:o(It),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(It,c),codeText:o(ln,c),codeTextData:B,data:B,codeFlowValue:B,definition:o(nn),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(Gt),hardBreakEscape:o(Ot),hardBreakTrailing:o(Ot),htmlFlow:o(Qt,c),htmlFlowData:B,htmlText:o(Qt,c),htmlTextData:B,image:o(Ie),label:c,link:o(dt),listItem:o(wt),listItemValue:x,listOrdered:o(Ke,g),listUnordered:o(Ke),paragraph:o(Ut),reference:N,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(on),strong:o(En),thematicBreak:o(Cn)},exit:{atxHeading:d(),atxHeadingSequence:q,autolink:d(),autolinkEmail:Se,autolinkProtocol:Ae,blockQuote:d(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Oe,characterReferenceMarkerNumeric:Oe,characterReferenceValue:je,characterReference:he,codeFenced:d(O),codeFencedFence:A,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:D,codeIndented:d(M),codeText:d(ne),codeTextData:D,data:D,definition:d(),definitionDestinationString:te,definitionLabelString:P,definitionTitleString:I,emphasis:d(),hardBreakEscape:d(F),hardBreakTrailing:d(F),htmlFlow:d(fe),htmlFlowData:D,htmlText:d(oe),htmlTextData:D,image:d(Q),label:xe,labelText:X,lineEnding:G,link:d(V),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:we,resourceDestinationString:j,resourceTitleString:z,resource:W,setextHeading:d(J),setextHeadingLineSequence:ee,setextHeadingText:L,strong:d(),thematicBreak:d()}};g1(t,(e||{}).mdastExtensions||[]);const r={};return s;function s(le){let ke={type:"root",children:[]};const Re={stack:[ke],tokenStack:[],config:t,enter:f,exit:m,buffer:c,resume:b,data:r},Ge=[];let rt=-1;for(;++rt<le.length;)if(le[rt][1].type==="listOrdered"||le[rt][1].type==="listUnordered")if(le[rt][0]==="enter")Ge.push(rt);else{const un=Ge.pop();rt=l(le,un,rt)}for(rt=-1;++rt<le.length;){const un=t[le[rt][0]];p1.call(un,le[rt][1].type)&&un[le[rt][1].type].call(Object.assign({sliceSerialize:le[rt][2].sliceSerialize},Re),le[rt][1])}if(Re.tokenStack.length>0){const un=Re.tokenStack[Re.tokenStack.length-1];(un[1]||wb).call(Re,void 0,un[0])}for(ke.position={start:Vi(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:Vi(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},rt=-1;++rt<t.transforms.length;)ke=t.transforms[rt](ke)||ke;return ke}function l(le,ke,Re){let Ge=ke-1,rt=-1,un=!1,yn,Jt,yt,Xt;for(;++Ge<=Re;){const Qe=le[Ge];switch(Qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qe[0]==="enter"?rt++:rt--,Xt=void 0;break}case"lineEndingBlank":{Qe[0]==="enter"&&(yn&&!Xt&&!rt&&!yt&&(yt=Ge),Xt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Xt=void 0}if(!rt&&Qe[0]==="enter"&&Qe[1].type==="listItemPrefix"||rt===-1&&Qe[0]==="exit"&&(Qe[1].type==="listUnordered"||Qe[1].type==="listOrdered")){if(yn){let ve=Ge;for(Jt=void 0;ve--;){const Fe=le[ve];if(Fe[1].type==="lineEnding"||Fe[1].type==="lineEndingBlank"){if(Fe[0]==="exit")continue;Jt&&(le[Jt][1].type="lineEndingBlank",un=!0),Fe[1].type="lineEnding",Jt=ve}else if(!(Fe[1].type==="linePrefix"||Fe[1].type==="blockQuotePrefix"||Fe[1].type==="blockQuotePrefixWhitespace"||Fe[1].type==="blockQuoteMarker"||Fe[1].type==="listItemIndent"))break}yt&&(!Jt||yt<Jt)&&(yn._spread=!0),yn.end=Object.assign({},Jt?le[Jt][1].start:Qe[1].end),le.splice(Jt||Ge,0,["exit",yn,Qe[2]]),Ge++,Re++}if(Qe[1].type==="listItemPrefix"){const ve={type:"listItem",_spread:!1,start:Object.assign({},Qe[1].start),end:void 0};yn=ve,le.splice(Ge,0,["enter",ve,Qe[2]]),Ge++,Re++,yt=void 0,Xt=!0}}}return le[ke][1]._spread=un,Re}function o(le,ke){return Re;function Re(Ge){f.call(this,le(Ge),Ge),ke&&ke.call(this,Ge)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(le,ke,Re){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([ke,Re||void 0]),le.position={start:Vi(ke.start),end:void 0}}function d(le){return ke;function ke(Re){le&&le.call(this,Re),m.call(this,Re)}}function m(le,ke){const Re=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==le.type&&(ke?ke.call(this,le,Ge[0]):(Ge[1]||wb).call(this,le,Ge[0]));else throw new Error("Cannot close `"+le.type+"` ("+Ll({start:le.start,end:le.end})+"): it’s not open");Re.position.end=Vi(le.end)}function b(){return em(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(le){if(this.data.expectingFirstListItemValue){const ke=this.stack[this.stack.length-2];ke.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function v(){const le=this.resume(),ke=this.stack[this.stack.length-1];ke.lang=le}function S(){const le=this.resume(),ke=this.stack[this.stack.length-1];ke.meta=le}function A(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function O(){const le=this.resume(),ke=this.stack[this.stack.length-1];ke.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const le=this.resume(),ke=this.stack[this.stack.length-1];ke.value=le.replace(/(\r?\n|\r)$/g,"")}function P(le){const ke=this.resume(),Re=this.stack[this.stack.length-1];Re.label=ke,Re.identifier=Dr(this.sliceSerialize(le)).toLowerCase()}function I(){const le=this.resume(),ke=this.stack[this.stack.length-1];ke.title=le}function te(){const le=this.resume(),ke=this.stack[this.stack.length-1];ke.url=le}function q(le){const ke=this.stack[this.stack.length-1];if(!ke.depth){const Re=this.sliceSerialize(le).length;ke.depth=Re}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function ee(le){const ke=this.stack[this.stack.length-1];ke.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function J(){this.data.setextHeadingSlurpLineEnding=void 0}function B(le){const Re=this.stack[this.stack.length-1].children;let Ge=Re[Re.length-1];(!Ge||Ge.type!=="text")&&(Ge=gt(),Ge.position={start:Vi(le.start),end:void 0},Re.push(Ge)),this.stack.push(Ge)}function D(le){const ke=this.stack.pop();ke.value+=this.sliceSerialize(le),ke.position.end=Vi(le.end)}function G(le){const ke=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Re=ke.children[ke.children.length-1];Re.position.end=Vi(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ke.type)&&(B.call(this,le),D.call(this,le))}function F(){this.data.atHardBreak=!0}function fe(){const le=this.resume(),ke=this.stack[this.stack.length-1];ke.value=le}function oe(){const le=this.resume(),ke=this.stack[this.stack.length-1];ke.value=le}function ne(){const le=this.resume(),ke=this.stack[this.stack.length-1];ke.value=le}function V(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ke,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function Q(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ke,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function X(le){const ke=this.sliceSerialize(le),Re=this.stack[this.stack.length-2];Re.label=Qj(ke),Re.identifier=Dr(ke).toLowerCase()}function xe(){const le=this.stack[this.stack.length-1],ke=this.resume(),Re=this.stack[this.stack.length-1];if(this.data.inReference=!0,Re.type==="link"){const Ge=le.children;Re.children=Ge}else Re.alt=ke}function j(){const le=this.resume(),ke=this.stack[this.stack.length-1];ke.url=le}function z(){const le=this.resume(),ke=this.stack[this.stack.length-1];ke.title=le}function W(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function we(le){const ke=this.resume(),Re=this.stack[this.stack.length-1];Re.label=ke,Re.identifier=Dr(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function Oe(le){this.data.characterReferenceType=le.type}function je(le){const ke=this.sliceSerialize(le),Re=this.data.characterReferenceType;let Ge;Re?(Ge=s1(ke,Re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=tm(ke);const rt=this.stack[this.stack.length-1];rt.value+=Ge}function he(le){const ke=this.stack.pop();ke.position.end=Vi(le.end)}function Ae(le){D.call(this,le);const ke=this.stack[this.stack.length-1];ke.url=this.sliceSerialize(le)}function Se(le){D.call(this,le);const ke=this.stack[this.stack.length-1];ke.url="mailto:"+this.sliceSerialize(le)}function We(){return{type:"blockquote",children:[]}}function It(){return{type:"code",lang:null,meta:null,value:""}}function ln(){return{type:"inlineCode",value:""}}function nn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Gt(){return{type:"emphasis",children:[]}}function on(){return{type:"heading",depth:0,children:[]}}function Ot(){return{type:"break"}}function Qt(){return{type:"html",value:""}}function Ie(){return{type:"image",title:null,url:"",alt:null}}function dt(){return{type:"link",title:null,url:"",children:[]}}function Ke(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function wt(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function Ut(){return{type:"paragraph",children:[]}}function En(){return{type:"strong",children:[]}}function gt(){return{type:"text",value:""}}function Cn(){return{type:"thematicBreak"}}}function Vi(e){return{line:e.line,column:e.column,offset:e.offset}}function g1(e,t){let r=-1;for(;++r<t.length;){const s=t[r];Array.isArray(s)?g1(e,s):tN(e,s)}}function tN(e,t){let r;for(r in t)if(p1.call(t,r))switch(r){case"canContainEols":{const s=t[r];s&&e[r].push(...s);break}case"transforms":{const s=t[r];s&&e[r].push(...s);break}case"enter":case"exit":{const s=t[r];s&&Object.assign(e[r],s);break}}}function wb(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ll({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ll({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ll({start:t.start,end:t.end})+") is still open")}function nN(e){const t=this;t.parser=r;function r(s){return Wj(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function rN(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function iN(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
96
|
+
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&l)continue;c=" ";break}default:c=String.fromCharCode(o)}l=o===-2,s.push(c)}return s.join("")}function Gj(e){const s={constructs:i1([Fj,...(e||{}).extensions||[]]),content:l(oA),defined:[],document:l(cA),flow:l(jj),lazy:{},string:l(Oj),text:l(Rj)};return s;function l(o){return c;function c(f){return $j(s,o,f)}}}function Jj(e){for(;!u1(e););return e}const vb=/[\0\t\n\r]/g;function Xj(){let e=1,t="",r=!0,s;return l;function l(o,c,f){const d=[];let m,b,g,x,v;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),g=0,t="",r&&(o.charCodeAt(0)===65279&&g++,r=void 0);g<o.length;){if(vb.lastIndex=g,m=vb.exec(o),x=m&&m.index!==void 0?m.index:o.length,v=o.charCodeAt(x),!m){t=o.slice(g);break}if(v===10&&g===x&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),g<x&&(d.push(o.slice(g,x)),e+=x-g),v){case 0:{d.push(65533),e++;break}case 9:{for(b=Math.ceil(e/4)*4,d.push(-2);e++<b;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}g=x+1}return f&&(s&&d.push(-5),t&&d.push(t),d.push(null)),d}}const Kj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Qj(e){return e.replace(Kj,Zj)}function Zj(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),o=l===120||l===88;return s1(r.slice(o?2:1),o?16:10)}return tm(r)||e}const p1={}.hasOwnProperty;function Wj(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),eN(r)(Jj(Gj(r).document().write(Xj()(e,t,!0))))}function eN(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(nt),autolinkProtocol:B,autolinkEmail:B,atxHeading:o($t),blockQuote:o(Qe),characterEscape:B,characterReference:B,codeFenced:o(Lt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Lt,c),codeText:o(dn,c),codeTextData:B,data:B,codeFlowValue:B,definition:o(tn),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(Ft),hardBreakEscape:o(an),hardBreakTrailing:o(an),htmlFlow:o(bn,c),htmlFlowData:B,htmlText:o(bn,c),htmlTextData:B,image:o(Be),label:c,link:o(nt),listItem:o(Ot),listItemValue:x,listOrdered:o(st,g),listUnordered:o(st),paragraph:o(_t),reference:T,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o($t),strong:o(mn),thematicBreak:o(Cr)},exit:{atxHeading:d(),atxHeadingSequence:q,autolink:d(),autolinkEmail:ke,autolinkProtocol:Ae,blockQuote:d(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:je,characterReferenceMarkerNumeric:je,characterReferenceValue:Ne,characterReference:ce,codeFenced:d(R),codeFencedFence:j,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:L,codeIndented:d(M),codeText:d(te),codeTextData:L,data:L,definition:d(),definitionDestinationString:ue,definitionLabelString:P,definitionTitleString:I,emphasis:d(),hardBreakEscape:d($),hardBreakTrailing:d($),htmlFlow:d(he),htmlFlowData:L,htmlText:d(le),htmlTextData:L,image:d(Q),label:xe,labelText:X,lineEnding:J,link:d(V),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ve,resourceDestinationString:A,resourceTitleString:z,resource:W,setextHeading:d(G),setextHeadingLineSequence:ee,setextHeadingText:N,strong:d(),thematicBreak:d()}};g1(t,(e||{}).mdastExtensions||[]);const r={};return s;function s(ae){let _e={type:"root",children:[]};const Me={stack:[_e],tokenStack:[],config:t,enter:f,exit:m,buffer:c,resume:b,data:r},Ge=[];let rt=-1;for(;++rt<ae.length;)if(ae[rt][1].type==="listOrdered"||ae[rt][1].type==="listUnordered")if(ae[rt][0]==="enter")Ge.push(rt);else{const zt=Ge.pop();rt=l(ae,zt,rt)}for(rt=-1;++rt<ae.length;){const zt=t[ae[rt][0]];p1.call(zt,ae[rt][1].type)&&zt[ae[rt][1].type].call(Object.assign({sliceSerialize:ae[rt][2].sliceSerialize},Me),ae[rt][1])}if(Me.tokenStack.length>0){const zt=Me.tokenStack[Me.tokenStack.length-1];(zt[1]||wb).call(Me,void 0,zt[0])}for(_e.position={start:Vi(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:Vi(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},rt=-1;++rt<t.transforms.length;)_e=t.transforms[rt](_e)||_e;return _e}function l(ae,_e,Me){let Ge=_e-1,rt=-1,zt=!1,Sn,Kt,yt,Vt;for(;++Ge<=Me;){const Ze=ae[Ge];switch(Ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ze[0]==="enter"?rt++:rt--,Vt=void 0;break}case"lineEndingBlank":{Ze[0]==="enter"&&(Sn&&!Vt&&!rt&&!yt&&(yt=Ge),Vt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Vt=void 0}if(!rt&&Ze[0]==="enter"&&Ze[1].type==="listItemPrefix"||rt===-1&&Ze[0]==="exit"&&(Ze[1].type==="listUnordered"||Ze[1].type==="listOrdered")){if(Sn){let An=Ge;for(Kt=void 0;An--;){const pn=ae[An];if(pn[1].type==="lineEnding"||pn[1].type==="lineEndingBlank"){if(pn[0]==="exit")continue;Kt&&(ae[Kt][1].type="lineEndingBlank",zt=!0),pn[1].type="lineEnding",Kt=An}else if(!(pn[1].type==="linePrefix"||pn[1].type==="blockQuotePrefix"||pn[1].type==="blockQuotePrefixWhitespace"||pn[1].type==="blockQuoteMarker"||pn[1].type==="listItemIndent"))break}yt&&(!Kt||yt<Kt)&&(Sn._spread=!0),Sn.end=Object.assign({},Kt?ae[Kt][1].start:Ze[1].end),ae.splice(Kt||Ge,0,["exit",Sn,Ze[2]]),Ge++,Me++}if(Ze[1].type==="listItemPrefix"){const An={type:"listItem",_spread:!1,start:Object.assign({},Ze[1].start),end:void 0};Sn=An,ae.splice(Ge,0,["enter",An,Ze[2]]),Ge++,Me++,yt=void 0,Vt=!0}}}return ae[_e][1]._spread=zt,Me}function o(ae,_e){return Me;function Me(Ge){f.call(this,ae(Ge),Ge),_e&&_e.call(this,Ge)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ae,_e,Me){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([_e,Me||void 0]),ae.position={start:Vi(_e.start),end:void 0}}function d(ae){return _e;function _e(Me){ae&&ae.call(this,Me),m.call(this,Me)}}function m(ae,_e){const Me=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==ae.type&&(_e?_e.call(this,ae,Ge[0]):(Ge[1]||wb).call(this,ae,Ge[0]));else throw new Error("Cannot close `"+ae.type+"` ("+Ll({start:ae.start,end:ae.end})+"): it’s not open");Me.position.end=Vi(ae.end)}function b(){return em(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(ae){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=ae}function S(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=ae}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function R(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae.replace(/(\r?\n|\r)$/g,"")}function P(ae){const _e=this.resume(),Me=this.stack[this.stack.length-1];Me.label=_e,Me.identifier=Lr(this.sliceSerialize(ae)).toLowerCase()}function I(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ae}function ue(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ae}function q(ae){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Me=this.sliceSerialize(ae).length;_e.depth=Me}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function ee(ae){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}function B(ae){const Me=this.stack[this.stack.length-1].children;let Ge=Me[Me.length-1];(!Ge||Ge.type!=="text")&&(Ge=at(),Ge.position={start:Vi(ae.start),end:void 0},Me.push(Ge)),this.stack.push(Ge)}function L(ae){const _e=this.stack.pop();_e.value+=this.sliceSerialize(ae),_e.position.end=Vi(ae.end)}function J(ae){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Me=_e.children[_e.children.length-1];Me.position.end=Vi(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(_e.type)&&(B.call(this,ae),L.call(this,ae))}function $(){this.data.atHardBreak=!0}function he(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae}function le(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae}function te(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae}function V(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=_e,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function Q(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=_e,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function X(ae){const _e=this.sliceSerialize(ae),Me=this.stack[this.stack.length-2];Me.label=Qj(_e),Me.identifier=Lr(_e).toLowerCase()}function xe(){const ae=this.stack[this.stack.length-1],_e=this.resume(),Me=this.stack[this.stack.length-1];if(this.data.inReference=!0,Me.type==="link"){const Ge=ae.children;Me.children=Ge}else Me.alt=_e}function A(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ae}function z(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ae}function W(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function ve(ae){const _e=this.resume(),Me=this.stack[this.stack.length-1];Me.label=_e,Me.identifier=Lr(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function je(ae){this.data.characterReferenceType=ae.type}function Ne(ae){const _e=this.sliceSerialize(ae),Me=this.data.characterReferenceType;let Ge;Me?(Ge=s1(_e,Me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=tm(_e);const rt=this.stack[this.stack.length-1];rt.value+=Ge}function ce(ae){const _e=this.stack.pop();_e.position.end=Vi(ae.end)}function Ae(ae){L.call(this,ae);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(ae)}function ke(ae){L.call(this,ae);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(ae)}function Qe(){return{type:"blockquote",children:[]}}function Lt(){return{type:"code",lang:null,meta:null,value:""}}function dn(){return{type:"inlineCode",value:""}}function tn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ft(){return{type:"emphasis",children:[]}}function $t(){return{type:"heading",depth:0,children:[]}}function an(){return{type:"break"}}function bn(){return{type:"html",value:""}}function Be(){return{type:"image",title:null,url:"",alt:null}}function nt(){return{type:"link",title:null,url:"",children:[]}}function st(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function Ot(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function _t(){return{type:"paragraph",children:[]}}function mn(){return{type:"strong",children:[]}}function at(){return{type:"text",value:""}}function Cr(){return{type:"thematicBreak"}}}function Vi(e){return{line:e.line,column:e.column,offset:e.offset}}function g1(e,t){let r=-1;for(;++r<t.length;){const s=t[r];Array.isArray(s)?g1(e,s):tN(e,s)}}function tN(e,t){let r;for(r in t)if(p1.call(t,r))switch(r){case"canContainEols":{const s=t[r];s&&e[r].push(...s);break}case"transforms":{const s=t[r];s&&e[r].push(...s);break}case"enter":case"exit":{const s=t[r];s&&Object.assign(e[r],s);break}}}function wb(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ll({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ll({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ll({start:t.start,end:t.end})+") is still open")}function nN(e){const t=this;t.parser=r;function r(s){return Wj(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function rN(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function iN(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
97
97
|
`}]}function sN(e,t){const r=t.value?t.value+`
|
|
98
98
|
`:"",s={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(s.className=["language-"+l[0]]);let o={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function aN(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function lN(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function oN(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),l=Ta(s.toLowerCase()),o=e.footnoteOrder.indexOf(s);let c,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=o+1,f+=1,e.footnoteCounts.set(s,f);const d={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+l,id:r+"fnref-"+l+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,d);const m={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,m),e.applyData(t,m)}function uN(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function cN(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function y1(e,t){const r=t.referenceType;let s="]";if(r==="collapsed"?s+="[]":r==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const l=e.all(t),o=l[0];o&&o.type==="text"?o.value="["+o.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=s:l.push({type:"text",value:s}),l}function fN(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return y1(e,t);const l={src:Ta(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(l.title=s.title);const o={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,o),e.applyData(t,o)}function hN(e,t){const r={src:Ta(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,s),e.applyData(t,s)}function dN(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const s={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,s),e.applyData(t,s)}function mN(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return y1(e,t);const l={href:Ta(s.url||"")};s.title!==null&&s.title!==void 0&&(l.title=s.title);const o={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function pN(e,t){const r={href:Ta(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const s={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function gN(e,t,r){const s=e.all(t),l=r?yN(r):b1(t),o={},c=[];if(typeof t.checked=="boolean"){const b=s[0];let g;b&&b.type==="element"&&b.tagName==="p"?g=b:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const b=s[f];(l||f!==0||b.type!=="element"||b.tagName!=="p")&&c.push({type:"text",value:`
|
|
99
99
|
`}),b.type==="element"&&b.tagName==="p"&&!l?c.push(...b.children):c.push(b)}const d=s[s.length-1];d&&(l||d.type!=="element"||d.tagName!=="p")&&c.push({type:"text",value:`
|
|
100
|
-
`});const m={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,m),e.applyData(t,m)}function yN(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let s=-1;for(;!t&&++s<r.length;)t=b1(r[s])}return t}function b1(e){const t=e.spread;return t??e.children.length>1}function bN(e,t){const r={},s=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++l<s.length;){const c=s[l];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function xN(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function vN(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function wN(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function SN(e,t){const r=e.all(t),s=r.shift(),l=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),l.push(c)}if(r.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=Kd(t.children[1]),d=Qx(t.children[t.children.length-1]);f&&d&&(c.position={start:f,end:d}),l.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,o),e.applyData(t,o)}function _N(e,t,r){const s=r?r.children:void 0,o=(s?s.indexOf(t):1)===0?"th":"td",c=r&&r.type==="table"?r.align:void 0,f=c?c.length:t.children.length;let d=-1;const m=[];for(;++d<f;){const g=t.children[d],x={},v=c?c[d]:void 0;v&&(x.align=v);let S={type:"element",tagName:o,properties:x,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),m.push(S)}const b={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,b),e.applyData(t,b)}function kN(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const Sb=9,_b=32;function EN(e){const t=String(e),r=/\r?\n|\r/g;let s=r.exec(t),l=0;const o=[];for(;s;)o.push(kb(t.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=r.exec(t);return o.push(kb(t.slice(l),l>0,!1)),o.join("")}function kb(e,t,r){let s=0,l=e.length;if(t){let o=e.codePointAt(s);for(;o===Sb||o===_b;)s++,o=e.codePointAt(s)}if(r){let o=e.codePointAt(l-1);for(;o===Sb||o===_b;)l--,o=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function CN(e,t){const r={type:"text",value:EN(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function AN(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const jN={blockquote:rN,break:iN,code:sN,delete:aN,emphasis:lN,footnoteReference:oN,heading:uN,html:cN,imageReference:fN,image:hN,inlineCode:dN,linkReference:mN,link:pN,listItem:gN,list:bN,paragraph:xN,root:vN,strong:wN,table:SN,tableCell:kN,tableRow:_N,text:CN,thematicBreak:AN,toml:gu,yaml:gu,definition:gu,footnoteDefinition:gu};function gu(){}const x1=-1,tc=0,Ul=1,qu=2,rm=3,im=4,sm=5,am=6,v1=7,w1=8,Eb=typeof self=="object"?self:globalThis,NN=(e,t)=>{const r=(l,o)=>(e.set(o,l),l),s=l=>{if(e.has(l))return e.get(l);const[o,c]=t[l];switch(o){case tc:case x1:return r(c,l);case Ul:{const f=r([],l);for(const d of c)f.push(s(d));return f}case qu:{const f=r({},l);for(const[d,m]of c)f[s(d)]=s(m);return f}case rm:return r(new Date(c),l);case im:{const{source:f,flags:d}=c;return r(new RegExp(f,d),l)}case sm:{const f=r(new Map,l);for(const[d,m]of c)f.set(s(d),s(m));return f}case am:{const f=r(new Set,l);for(const d of c)f.add(s(d));return f}case v1:{const{name:f,message:d}=c;return r(new Eb[f](d),l)}case w1:return r(BigInt(c),l);case"BigInt":return r(Object(BigInt(c)),l);case"ArrayBuffer":return r(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return r(new DataView(f),c)}}return r(new Eb[o](c),l)};return s},Cb=e=>NN(new Map,e)(0),oa="",{toString:TN}={},{keys:ON}=Object,Cl=e=>{const t=typeof e;if(t!=="object"||!e)return[tc,t];const r=TN.call(e).slice(8,-1);switch(r){case"Array":return[Ul,oa];case"Object":return[qu,oa];case"Date":return[rm,oa];case"RegExp":return[im,oa];case"Map":return[sm,oa];case"Set":return[am,oa];case"DataView":return[Ul,r]}return r.includes("Array")?[Ul,r]:r.includes("Error")?[v1,r]:[qu,r]},yu=([e,t])=>e===tc&&(t==="function"||t==="symbol"),RN=(e,t,r,s)=>{const l=(c,f)=>{const d=s.push(c)-1;return r.set(f,d),d},o=c=>{if(r.has(c))return r.get(c);let[f,d]=Cl(c);switch(f){case tc:{let b=c;switch(d){case"bigint":f=w1,b=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);b=null;break;case"undefined":return l([x1],c)}return l([f,b],c)}case Ul:{if(d){let x=c;return d==="DataView"?x=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(c)),l([d,[...x]],c)}const b=[],g=l([f,b],c);for(const x of c)b.push(o(x));return g}case qu:{if(d)switch(d){case"BigInt":return l([d,c.toString()],c);case"Boolean":case"Number":case"String":return l([d,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const b=[],g=l([f,b],c);for(const x of ON(c))(e||!yu(Cl(c[x])))&&b.push([o(x),o(c[x])]);return g}case rm:return l([f,c.toISOString()],c);case im:{const{source:b,flags:g}=c;return l([f,{source:b,flags:g}],c)}case sm:{const b=[],g=l([f,b],c);for(const[x,v]of c)(e||!(yu(Cl(x))||yu(Cl(v))))&&b.push([o(x),o(v)]);return g}case am:{const b=[],g=l([f,b],c);for(const x of c)(e||!yu(Cl(x)))&&b.push(o(x));return g}}const{message:m}=c;return l([f,{name:d,message:m}],c)};return o},Ab=(e,{json:t,lossy:r}={})=>{const s=[];return RN(!(t||r),!!t,new Map,s)(e),s},Iu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Cb(Ab(e,t)):structuredClone(e):(e,t)=>Cb(Ab(e,t));function MN(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function DN(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function LN(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||MN,s=e.options.footnoteBackLabel||DN,l=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let d=-1;for(;++d<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[d]);if(!m)continue;const b=e.all(m),g=String(m.identifier).toUpperCase(),x=Ta(g.toLowerCase());let v=0;const S=[],
|
|
100
|
+
`});const m={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,m),e.applyData(t,m)}function yN(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let s=-1;for(;!t&&++s<r.length;)t=b1(r[s])}return t}function b1(e){const t=e.spread;return t??e.children.length>1}function bN(e,t){const r={},s=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++l<s.length;){const c=s[l];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function xN(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function vN(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function wN(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function SN(e,t){const r=e.all(t),s=r.shift(),l=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),l.push(c)}if(r.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=Kd(t.children[1]),d=Qx(t.children[t.children.length-1]);f&&d&&(c.position={start:f,end:d}),l.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,o),e.applyData(t,o)}function _N(e,t,r){const s=r?r.children:void 0,o=(s?s.indexOf(t):1)===0?"th":"td",c=r&&r.type==="table"?r.align:void 0,f=c?c.length:t.children.length;let d=-1;const m=[];for(;++d<f;){const g=t.children[d],x={},v=c?c[d]:void 0;v&&(x.align=v);let S={type:"element",tagName:o,properties:x,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),m.push(S)}const b={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,b),e.applyData(t,b)}function kN(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const Sb=9,_b=32;function EN(e){const t=String(e),r=/\r?\n|\r/g;let s=r.exec(t),l=0;const o=[];for(;s;)o.push(kb(t.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=r.exec(t);return o.push(kb(t.slice(l),l>0,!1)),o.join("")}function kb(e,t,r){let s=0,l=e.length;if(t){let o=e.codePointAt(s);for(;o===Sb||o===_b;)s++,o=e.codePointAt(s)}if(r){let o=e.codePointAt(l-1);for(;o===Sb||o===_b;)l--,o=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function CN(e,t){const r={type:"text",value:EN(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function AN(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const jN={blockquote:rN,break:iN,code:sN,delete:aN,emphasis:lN,footnoteReference:oN,heading:uN,html:cN,imageReference:fN,image:hN,inlineCode:dN,linkReference:mN,link:pN,listItem:gN,list:bN,paragraph:xN,root:vN,strong:wN,table:SN,tableCell:kN,tableRow:_N,text:CN,thematicBreak:AN,toml:gu,yaml:gu,definition:gu,footnoteDefinition:gu};function gu(){}const x1=-1,tc=0,Ul=1,qu=2,rm=3,im=4,sm=5,am=6,v1=7,w1=8,Eb=typeof self=="object"?self:globalThis,NN=(e,t)=>{const r=(l,o)=>(e.set(o,l),l),s=l=>{if(e.has(l))return e.get(l);const[o,c]=t[l];switch(o){case tc:case x1:return r(c,l);case Ul:{const f=r([],l);for(const d of c)f.push(s(d));return f}case qu:{const f=r({},l);for(const[d,m]of c)f[s(d)]=s(m);return f}case rm:return r(new Date(c),l);case im:{const{source:f,flags:d}=c;return r(new RegExp(f,d),l)}case sm:{const f=r(new Map,l);for(const[d,m]of c)f.set(s(d),s(m));return f}case am:{const f=r(new Set,l);for(const d of c)f.add(s(d));return f}case v1:{const{name:f,message:d}=c;return r(new Eb[f](d),l)}case w1:return r(BigInt(c),l);case"BigInt":return r(Object(BigInt(c)),l);case"ArrayBuffer":return r(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return r(new DataView(f),c)}}return r(new Eb[o](c),l)};return s},Cb=e=>NN(new Map,e)(0),oa="",{toString:TN}={},{keys:ON}=Object,Cl=e=>{const t=typeof e;if(t!=="object"||!e)return[tc,t];const r=TN.call(e).slice(8,-1);switch(r){case"Array":return[Ul,oa];case"Object":return[qu,oa];case"Date":return[rm,oa];case"RegExp":return[im,oa];case"Map":return[sm,oa];case"Set":return[am,oa];case"DataView":return[Ul,r]}return r.includes("Array")?[Ul,r]:r.includes("Error")?[v1,r]:[qu,r]},yu=([e,t])=>e===tc&&(t==="function"||t==="symbol"),RN=(e,t,r,s)=>{const l=(c,f)=>{const d=s.push(c)-1;return r.set(f,d),d},o=c=>{if(r.has(c))return r.get(c);let[f,d]=Cl(c);switch(f){case tc:{let b=c;switch(d){case"bigint":f=w1,b=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);b=null;break;case"undefined":return l([x1],c)}return l([f,b],c)}case Ul:{if(d){let x=c;return d==="DataView"?x=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(c)),l([d,[...x]],c)}const b=[],g=l([f,b],c);for(const x of c)b.push(o(x));return g}case qu:{if(d)switch(d){case"BigInt":return l([d,c.toString()],c);case"Boolean":case"Number":case"String":return l([d,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const b=[],g=l([f,b],c);for(const x of ON(c))(e||!yu(Cl(c[x])))&&b.push([o(x),o(c[x])]);return g}case rm:return l([f,c.toISOString()],c);case im:{const{source:b,flags:g}=c;return l([f,{source:b,flags:g}],c)}case sm:{const b=[],g=l([f,b],c);for(const[x,v]of c)(e||!(yu(Cl(x))||yu(Cl(v))))&&b.push([o(x),o(v)]);return g}case am:{const b=[],g=l([f,b],c);for(const x of c)(e||!yu(Cl(x)))&&b.push(o(x));return g}}const{message:m}=c;return l([f,{name:d,message:m}],c)};return o},Ab=(e,{json:t,lossy:r}={})=>{const s=[];return RN(!(t||r),!!t,new Map,s)(e),s},Iu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Cb(Ab(e,t)):structuredClone(e):(e,t)=>Cb(Ab(e,t));function MN(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function DN(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function LN(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||MN,s=e.options.footnoteBackLabel||DN,l=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let d=-1;for(;++d<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[d]);if(!m)continue;const b=e.all(m),g=String(m.identifier).toUpperCase(),x=Ta(g.toLowerCase());let v=0;const S=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++v<=j;){S.length>0&&S.push({type:"text",value:" "});let P=typeof r=="string"?r:r(d,v);typeof P=="string"&&(P={type:"text",value:P}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+x+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,v),className:["data-footnote-backref"]},children:Array.isArray(P)?P:[P]})}const R=b[b.length-1];if(R&&R.type==="element"&&R.tagName==="p"){const P=R.children[R.children.length-1];P&&P.type==="text"?P.value+=" ":R.children.push({type:"text",value:" "}),R.children.push(...S)}else b.push(...S);const M={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(b,!0)};e.patch(m,M),f.push(M)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Iu(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
101
101
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
102
|
-
`}]}}const nc=(function(e){if(e==null)return BN;if(typeof e=="function")return rc(e);if(typeof e=="object")return Array.isArray(e)?zN(e):UN(e);if(typeof e=="string")return PN(e);throw new Error("Expected function, string, or object as test")});function zN(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=nc(e[r]);return rc(s);function s(...l){let o=-1;for(;++o<t.length;)if(t[o].apply(this,l))return!0;return!1}}function UN(e){const t=e;return rc(r);function r(s){const l=s;let o;for(o in e)if(l[o]!==t[o])return!1;return!0}}function PN(e){return rc(t);function t(r){return r&&r.type===e}}function rc(e){return t;function t(r,s,l){return!!(HN(r)&&e.call(this,r,typeof s=="number"?s:void 0,l||void 0))}}function BN(){return!0}function HN(e){return e!==null&&typeof e=="object"&&"type"in e}const S1=[],qN=!0,kd=!1,IN="skip";function _1(e,t,r,s){let l;typeof t=="function"&&typeof r!="function"?(s=r,r=t):l=t;const o=nc(l),c=s?-1:1;f(e,void 0,[])();function f(d,m,b){const g=d&&typeof d=="object"?d:{};if(typeof g.type=="string"){const v=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(d.type+(v?"<"+v+">":""))+")"})}return x;function x(){let v=S1,S,
|
|
102
|
+
`}]}}const nc=(function(e){if(e==null)return BN;if(typeof e=="function")return rc(e);if(typeof e=="object")return Array.isArray(e)?zN(e):UN(e);if(typeof e=="string")return PN(e);throw new Error("Expected function, string, or object as test")});function zN(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=nc(e[r]);return rc(s);function s(...l){let o=-1;for(;++o<t.length;)if(t[o].apply(this,l))return!0;return!1}}function UN(e){const t=e;return rc(r);function r(s){const l=s;let o;for(o in e)if(l[o]!==t[o])return!1;return!0}}function PN(e){return rc(t);function t(r){return r&&r.type===e}}function rc(e){return t;function t(r,s,l){return!!(HN(r)&&e.call(this,r,typeof s=="number"?s:void 0,l||void 0))}}function BN(){return!0}function HN(e){return e!==null&&typeof e=="object"&&"type"in e}const S1=[],qN=!0,kd=!1,IN="skip";function _1(e,t,r,s){let l;typeof t=="function"&&typeof r!="function"?(s=r,r=t):l=t;const o=nc(l),c=s?-1:1;f(e,void 0,[])();function f(d,m,b){const g=d&&typeof d=="object"?d:{};if(typeof g.type=="string"){const v=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(d.type+(v?"<"+v+">":""))+")"})}return x;function x(){let v=S1,S,j,R;if((!t||o(d,m,b[b.length-1]||void 0))&&(v=FN(r(d,b)),v[0]===kd))return v;if("children"in d&&d.children){const M=d;if(M.children&&v[0]!==IN)for(j=(s?M.children.length:-1)+c,R=b.concat(M);j>-1&&j<M.children.length;){const P=M.children[j];if(S=f(P,j,R)(),S[0]===kd)return S;j=typeof S[1]=="number"?S[1]:j+c}}return v}}}function FN(e){return Array.isArray(e)?e:typeof e=="number"?[qN,e]:e==null?S1:[e]}function lm(e,t,r,s){let l,o,c;typeof t=="function"&&typeof r!="function"?(o=void 0,c=t,l=r):(o=t,c=r,l=s),_1(e,o,f,l);function f(d,m){const b=m[m.length-1],g=b?b.children.indexOf(d):void 0;return c(d,g,b)}}const Ed={}.hasOwnProperty,$N={};function VN(e,t){const r=t||$N,s=new Map,l=new Map,o=new Map,c={...jN,...r.handlers},f={all:m,applyData:GN,definitionById:s,footnoteById:l,footnoteCounts:o,footnoteOrder:[],handlers:c,one:d,options:r,patch:YN,wrap:XN};return lm(e,function(b){if(b.type==="definition"||b.type==="footnoteDefinition"){const g=b.type==="definition"?s:l,x=String(b.identifier).toUpperCase();g.has(x)||g.set(x,b)}}),f;function d(b,g){const x=b.type,v=f.handlers[x];if(Ed.call(f.handlers,x)&&v)return v(f,b,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in b){const{children:j,...R}=b,M=Iu(R);return M.children=f.all(b),M}return Iu(b)}return(f.options.unknownHandler||JN)(f,b,g)}function m(b){const g=[];if("children"in b){const x=b.children;let v=-1;for(;++v<x.length;){const S=f.one(x[v],b);if(S){if(v&&x[v-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=jb(S.value)),!Array.isArray(S)&&S.type==="element")){const j=S.children[0];j&&j.type==="text"&&(j.value=jb(j.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function YN(e,t){e.position&&(t.position=DC(e))}function GN(e,t){let r=t;if(e&&e.data){const s=e.data.hName,l=e.data.hChildren,o=e.data.hProperties;if(typeof s=="string")if(r.type==="element")r.tagName=s;else{const c="children"in r?r.children:[r];r={type:"element",tagName:s,properties:{},children:c}}r.type==="element"&&o&&Object.assign(r.properties,Iu(o)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function JN(e,t){const r=t.data||{},s="value"in t&&!(Ed.call(r,"hProperties")||Ed.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function XN(e,t){const r=[];let s=-1;for(t&&r.push({type:"text",value:`
|
|
103
103
|
`});++s<e.length;)s&&r.push({type:"text",value:`
|
|
104
104
|
`}),r.push(e[s]);return t&&e.length>0&&r.push({type:"text",value:`
|
|
105
105
|
`}),r}function jb(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Nb(e,t){const r=VN(e,t),s=r.one(e,void 0),l=LN(r),o=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&o.children.push({type:"text",value:`
|
|
106
|
-
`},l),o}function KN(e,t){return e&&"run"in e?async function(r,s){const l=Nb(r,{file:s,...t});await e.run(l,s)}:function(r,s){return Nb(r,{file:s,...e||t})}}function Tb(e){if(e)throw e}var Hh,Ob;function QN(){if(Ob)return Hh;Ob=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},o=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var b=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!b&&!g)return!1;var x;for(x in m);return typeof x>"u"||e.call(m,x)},c=function(m,b){r&&b.name==="__proto__"?r(m,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):m[b.name]=b.newValue},f=function(m,b){if(b==="__proto__")if(e.call(m,b)){if(s)return s(m,b).value}else return;return m[b]};return Hh=function d(){var m,b,g,x,v,S,A=arguments[0],O=1,M=arguments.length,P=!1;for(typeof A=="boolean"&&(P=A,A=arguments[1]||{},O=2),(A==null||typeof A!="object"&&typeof A!="function")&&(A={});O<M;++O)if(m=arguments[O],m!=null)for(b in m)g=f(A,b),x=f(m,b),A!==x&&(P&&x&&(o(x)||(v=l(x)))?(v?(v=!1,S=g&&l(g)?g:[]):S=g&&o(g)?g:{},c(A,{name:b,newValue:d(P,S,x)})):typeof x<"u"&&c(A,{name:b,newValue:x}));return A},Hh}var ZN=QN();const qh=Vb(ZN);function Cd(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function WN(){const e=[],t={run:r,use:s};return t;function r(...l){let o=-1;const c=l.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...l);function f(d,...m){const b=e[++o];let g=-1;if(d){c(d);return}for(;++g<l.length;)(m[g]===null||m[g]===void 0)&&(m[g]=l[g]);l=m,b?eT(b,f)(...m):c(null,...m)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),t}}function eT(e,t){let r;return s;function s(...c){const f=e.length>c.length;let d;f&&c.push(l);try{d=e.apply(this,c)}catch(m){const b=m;if(f&&r)throw b;return l(b)}f||(d&&d.then&&typeof d.then=="function"?d.then(o,l):d instanceof Error?l(d):o(d))}function l(c,...f){r||(r=!0,t(c,...f))}function o(c){l(null,c)}}const Ir={basename:tT,dirname:nT,extname:rT,join:iT,sep:"/"};function tT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Zl(e);let r=0,s=-1,l=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(o){r=l+1;break}}else s<0&&(o=!0,s=l+1);return s<0?"":e.slice(r,s)}if(t===e)return"";let c=-1,f=t.length-1;for(;l--;)if(e.codePointAt(l)===47){if(o){r=l+1;break}}else c<0&&(o=!0,c=l+1),f>-1&&(e.codePointAt(l)===t.codePointAt(f--)?f<0&&(s=l):(f=-1,s=c));return r===s?s=c:s<0&&(s=e.length),e.slice(r,s)}function nT(e){if(Zl(e),e.length===0)return".";let t=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){t=r;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function rT(e){Zl(e);let t=e.length,r=-1,s=0,l=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){s=t+1;break}continue}r<0&&(c=!0,r=t+1),f===46?l<0?l=t:o!==1&&(o=1):l>-1&&(o=-1)}return l<0||r<0||o===0||o===1&&l===r-1&&l===s+1?"":e.slice(l,r)}function iT(...e){let t=-1,r;for(;++t<e.length;)Zl(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":sT(r)}function sT(e){Zl(e);const t=e.codePointAt(0)===47;let r=aT(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function aT(e,t){let r="",s=0,l=-1,o=0,c=-1,f,d;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(l===c-1||o===1))if(l!==c-1&&o===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(d=r.lastIndexOf("/"),d!==r.length-1){d<0?(r="",s=0):(r=r.slice(0,d),s=r.length-1-r.lastIndexOf("/")),l=c,o=0;continue}}else if(r.length>0){r="",s=0,l=c,o=0;continue}}t&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+e.slice(l+1,c):r=e.slice(l+1,c),s=c-l-1;l=c,o=0}else f===46&&o>-1?o++:o=-1}return r}function Zl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const lT={cwd:oT};function oT(){return"/"}function Ad(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function uT(e){if(typeof e=="string")e=new URL(e);else if(!Ad(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return cT(e)}function cT(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const s=t.codePointAt(r+2);if(s===70||s===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(t)}const Ih=["history","path","basename","stem","extname","dirname"];class k1{constructor(t){let r;t?Ad(t)?r={path:t}:typeof t=="string"||fT(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":lT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Ih.length;){const o=Ih[s];o in r&&r[o]!==void 0&&r[o]!==null&&(this[o]=o==="history"?[...r[o]]:r[o])}let l;for(l in r)Ih.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?Ir.basename(this.path):void 0}set basename(t){$h(t,"basename"),Fh(t,"basename"),this.path=Ir.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ir.dirname(this.path):void 0}set dirname(t){Rb(this.basename,"dirname"),this.path=Ir.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ir.extname(this.path):void 0}set extname(t){if(Fh(t,"extname"),Rb(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ir.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ad(t)&&(t=uT(t)),$h(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ir.basename(this.path,this.extname):void 0}set stem(t){$h(t,"stem"),Fh(t,"stem"),this.path=Ir.join(this.dirname||"",t+(this.extname||""))}fail(t,r,s){const l=this.message(t,r,s);throw l.fatal=!0,l}info(t,r,s){const l=this.message(t,r,s);return l.fatal=void 0,l}message(t,r,s){const l=new Rn(t,r,s);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Fh(e,t){if(e&&e.includes(Ir.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ir.sep+"`")}function $h(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Rb(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function fT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const hT=(function(e){const s=this.constructor.prototype,l=s[e],o=function(){return l.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),dT={}.hasOwnProperty;class om extends hT{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=WN()}copy(){const t=new om;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];t.use(...s)}return t.data(qh(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Gh("data",this.frozen),this.namespace[t]=r,this):dT.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Gh("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const l=r.call(t,...s);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=bu(t),s=this.parser||this.Parser;return Vh("parse",s),s(String(r),r)}process(t,r){const s=this;return this.freeze(),Vh("process",this.parser||this.Parser),Yh("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(o,c){const f=bu(t),d=s.parse(f);s.run(d,f,function(b,g,x){if(b||!g||!x)return m(b);const v=g,S=s.stringify(v,x);gT(S)?x.value=S:x.result=S,m(b,x)});function m(b,g){b||!g?c(b):o?o(g):r(void 0,g)}}}processSync(t){let r=!1,s;return this.freeze(),Vh("processSync",this.parser||this.Parser),Yh("processSync",this.compiler||this.Compiler),this.process(t,l),Db("processSync","process",r),s;function l(o,c){r=!0,Tb(o),s=c}}run(t,r,s){Mb(t),this.freeze();const l=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?o(void 0,s):new Promise(o);function o(c,f){const d=bu(r);l.run(t,d,m);function m(b,g,x){const v=g||t;b?f(b):c?c(v):s(void 0,v,x)}}}runSync(t,r){let s=!1,l;return this.run(t,r,o),Db("runSync","run",s),l;function o(c,f){Tb(c),l=f,s=!0}}stringify(t,r){this.freeze();const s=bu(r),l=this.compiler||this.Compiler;return Yh("stringify",l),Mb(t),l(t,s)}use(t,...r){const s=this.attachers,l=this.namespace;if(Gh("use",this.frozen),t!=null)if(typeof t=="function")d(t,r);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(m){if(typeof m=="function")d(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[b,...g]=m;d(b,g)}else c(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function c(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(m.plugins),m.settings&&(l.settings=qh(!0,l.settings,m.settings))}function f(m){let b=-1;if(m!=null)if(Array.isArray(m))for(;++b<m.length;){const g=m[b];o(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function d(m,b){let g=-1,x=-1;for(;++g<s.length;)if(s[g][0]===m){x=g;break}if(x===-1)s.push([m,...b]);else if(b.length>0){let[v,...S]=b;const A=s[x][1];Cd(A)&&Cd(v)&&(v=qh(!0,A,v)),s[x]=[m,v,...S]}}}}const mT=new om().freeze();function Vh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Gh(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Mb(e){if(!Cd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Db(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function bu(e){return pT(e)?e:new k1(e)}function pT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function gT(e){return typeof e=="string"||yT(e)}function yT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const bT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Lb=[],zb={allowDangerousHtml:!0},xT=/^(https?|ircs?|mailto|xmpp)$/i,vT=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function wT(e){const t=ST(e),r=_T(e);return kT(t.runSync(t.parse(r),r),e)}function ST(e){const t=e.rehypePlugins||Lb,r=e.remarkPlugins||Lb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...zb}:zb;return mT().use(nN).use(r).use(KN,s).use(t)}function _T(e){const t=e.children||"",r=new k1;return typeof t=="string"&&(r.value=t),r}function kT(e,t){const r=t.allowedElements,s=t.allowElement,l=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,d=t.urlTransform||E1;for(const b of vT)Object.hasOwn(t,b.from)&&(""+b.from+(b.to?"use `"+b.to+"` instead":"remove it")+bT+b.id,void 0);return lm(e,m),BC(e,{Fragment:y.Fragment,components:l,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function m(b,g,x){if(b.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:b.value},g;if(b.type==="element"){let v;for(v in Uh)if(Object.hasOwn(Uh,v)&&Object.hasOwn(b.properties,v)){const S=b.properties[v],A=Uh[v];(A===null||A.includes(b.tagName))&&(b.properties[v]=d(String(S||""),v,b))}}if(b.type==="element"){let v=r?!r.includes(b.tagName):o?o.includes(b.tagName):!1;if(!v&&s&&typeof g=="number"&&(v=!s(b,g,x)),v&&x&&typeof g=="number")return f&&b.children?x.children.splice(g,1,...b.children):x.children.splice(g,1),g}}}function E1(e){const t=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||r!==-1&&t>r||s!==-1&&t>s||xT.test(e.slice(0,t))?e:""}const ET=/^[a-z][a-z0-9+.-]+:/i;function C1(e){const t=e==null?void 0:e.trim();if(!t||t.startsWith("#")||t.startsWith("//"))return null;if(/^file:/i.test(t))try{const s=decodeURIComponent(new URL(t).pathname);return/^\/[a-z]:/i.test(s)?s.slice(1):s}catch{return null}if(ET.test(t))return null;const r=t.replace(/[?#].*$/,"");try{return decodeURI(r)||null}catch{return r||null}}function CT(e){return C1(e)!==null?e:E1(e)}function AT(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:[\\/]/i.test(e)}function jT(e,t){return!t||AT(e)?e:t.replace(/[^/\\]*$/,"")+e}function NT(e){return e.split(/[/\\]/).filter(Boolean).pop()??e}function TT(e){const t=atob(e),r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}async function OT(e,t,r,s){const l=[];let o=0,c="application/octet-stream";for(;;){const f=await e("task.file",{id:t,run_id:r,path:s,offset:o});if(f.error)throw new Error(f.error.startsWith("Unknown method")?"Update Palmier on the host to open files.":f.error);const d=TT(f.data??"");if(l.push(d),o+=d.length,f.mime&&(c=f.mime),f.eof||d.length===0)break}return new Blob(l,{type:c})}const RT=["application/json","application/x-ndjson","application/xml","application/yaml"];function MT(e){return e==="text/markdown"?"markdown":e==="text/html"?"html":e.startsWith("image/")?"image":e.startsWith("text/")||RT.includes(e)?"text":"binary"}function DT(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Ub(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,l=r.indexOf(t);for(;l!==-1;)s++,l=r.indexOf(t,l+t.length);return s}function LT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function A1(e,t,r){const l=nc((r||{}).ignore||[]),o=zT(t);let c=-1;for(;++c<o.length;)_1(e,"text",f);function f(m,b){let g=-1,x;for(;++g<b.length;){const v=b[g],S=x?x.children:void 0;if(l(v,S?S.indexOf(v):void 0,x))return;x=v}if(x)return d(m,b)}function d(m,b){const g=b[b.length-1],x=o[c][0],v=o[c][1];let S=0;const O=g.children.indexOf(m);let M=!1,P=[];x.lastIndex=0;let I=x.exec(m.value);for(;I;){const te=I.index,q={index:I.index,input:I.input,stack:[...b,m]};let L=v(...I,q);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?x.lastIndex=te+1:(S!==te&&P.push({type:"text",value:m.value.slice(S,te)}),Array.isArray(L)?P.push(...L):L&&P.push(L),S=te+I[0].length,M=!0),!x.global)break;I=x.exec(m.value)}return M?(S<m.value.length&&P.push({type:"text",value:m.value.slice(S)}),g.children.splice(O,1,...P)):P=[m],O+P.length}}function zT(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<r.length;){const l=r[s];t.push([UT(l[0]),PT(l[1])])}return t}function UT(e){return typeof e=="string"?new RegExp(LT(e),"g"):e}function PT(e){return typeof e=="function"?e:function(){return e}}const Jh="phrasing",Xh=["autolink","link","image","label"];function BT(){return{transforms:[YT],enter:{literalAutolink:qT,literalAutolinkEmail:Kh,literalAutolinkHttp:Kh,literalAutolinkWww:Kh},exit:{literalAutolink:VT,literalAutolinkEmail:$T,literalAutolinkHttp:IT,literalAutolinkWww:FT}}}function HT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Jh,notInConstruct:Xh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Jh,notInConstruct:Xh},{character:":",before:"[ps]",after:"\\/",inConstruct:Jh,notInConstruct:Xh}]}}function qT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Kh(e){this.config.enter.autolinkProtocol.call(this,e)}function IT(e){this.config.exit.autolinkProtocol.call(this,e)}function FT(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function $T(e){this.config.exit.autolinkEmail.call(this,e)}function VT(e){this.exit(e)}function YT(e){A1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,GT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),JT]],{ignore:["link","linkReference"]})}function GT(e,t,r,s,l){let o="";if(!j1(l)||(/^w/i.test(t)&&(r=t+r,t="",o="http://"),!XT(r)))return!1;const c=KT(r+s);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function JT(e,t,r,s){return!j1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function XT(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function KT(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],s=r.indexOf(")");const l=Ub(e,"(");let o=Ub(e,")");for(;s!==-1&&l>o;)e+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),o++;return[e,r]}function j1(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||_s(r)||Wu(r))&&(!t||r!==47)}N1.peek=s3;function QT(){this.buffer()}function ZT(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function WT(){this.buffer()}function e3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function t3(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Dr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function n3(e){this.exit(e)}function r3(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Dr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function i3(e){this.exit(e)}function s3(){return"["}function N1(e,t,r,s){const l=r.createTracker(s);let o=l.move("[^");const c=r.enter("footnoteReference"),f=r.enter("reference");return o+=l.move(r.safe(r.associationId(e),{after:"]",before:o})),f(),c(),o+=l.move("]"),o}function a3(){return{enter:{gfmFootnoteCallString:QT,gfmFootnoteCall:ZT,gfmFootnoteDefinitionLabelString:WT,gfmFootnoteDefinition:e3},exit:{gfmFootnoteCallString:t3,gfmFootnoteCall:n3,gfmFootnoteDefinitionLabelString:r3,gfmFootnoteDefinition:i3}}}function l3(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:N1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,l,o,c){const f=o.createTracker(c);let d=f.move("[^");const m=o.enter("footnoteDefinition"),b=o.enter("label");return d+=f.move(o.safe(o.associationId(s),{before:d,after:"]"})),b(),d+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),d+=f.move((t?`
|
|
107
|
-
`:" ")+o.indentLines(o.containerFlow(s,f.current()),t?T1:o3))),m(),d}}function o3(e,t,r){return t===0?e:T1(e,t,r)}function T1(e,t,r){return(r?"":" ")+e}const u3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];O1.peek=m3;function c3(){return{canContainEols:["delete"],enter:{strikethrough:h3},exit:{strikethrough:d3}}}function f3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:u3}],handlers:{delete:O1}}}function h3(e){this.enter({type:"delete",children:[]},e)}function d3(e){this.exit(e)}function O1(e,t,r,s){const l=r.createTracker(s),o=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),o(),c}function m3(){return"~"}function p3(e){return e.length}function g3(e,t){const r=t||{},s=(r.align||[]).concat(),l=r.stringLength||p3,o=[],c=[],f=[],d=[];let m=0,b=-1;for(;++b<e.length;){const
|
|
106
|
+
`},l),o}function KN(e,t){return e&&"run"in e?async function(r,s){const l=Nb(r,{file:s,...t});await e.run(l,s)}:function(r,s){return Nb(r,{file:s,...e||t})}}function Tb(e){if(e)throw e}var Hh,Ob;function QN(){if(Ob)return Hh;Ob=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},o=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var b=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!b&&!g)return!1;var x;for(x in m);return typeof x>"u"||e.call(m,x)},c=function(m,b){r&&b.name==="__proto__"?r(m,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):m[b.name]=b.newValue},f=function(m,b){if(b==="__proto__")if(e.call(m,b)){if(s)return s(m,b).value}else return;return m[b]};return Hh=function d(){var m,b,g,x,v,S,j=arguments[0],R=1,M=arguments.length,P=!1;for(typeof j=="boolean"&&(P=j,j=arguments[1]||{},R=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});R<M;++R)if(m=arguments[R],m!=null)for(b in m)g=f(j,b),x=f(m,b),j!==x&&(P&&x&&(o(x)||(v=l(x)))?(v?(v=!1,S=g&&l(g)?g:[]):S=g&&o(g)?g:{},c(j,{name:b,newValue:d(P,S,x)})):typeof x<"u"&&c(j,{name:b,newValue:x}));return j},Hh}var ZN=QN();const qh=Vb(ZN);function Cd(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function WN(){const e=[],t={run:r,use:s};return t;function r(...l){let o=-1;const c=l.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...l);function f(d,...m){const b=e[++o];let g=-1;if(d){c(d);return}for(;++g<l.length;)(m[g]===null||m[g]===void 0)&&(m[g]=l[g]);l=m,b?eT(b,f)(...m):c(null,...m)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),t}}function eT(e,t){let r;return s;function s(...c){const f=e.length>c.length;let d;f&&c.push(l);try{d=e.apply(this,c)}catch(m){const b=m;if(f&&r)throw b;return l(b)}f||(d&&d.then&&typeof d.then=="function"?d.then(o,l):d instanceof Error?l(d):o(d))}function l(c,...f){r||(r=!0,t(c,...f))}function o(c){l(null,c)}}const Fr={basename:tT,dirname:nT,extname:rT,join:iT,sep:"/"};function tT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Zl(e);let r=0,s=-1,l=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(o){r=l+1;break}}else s<0&&(o=!0,s=l+1);return s<0?"":e.slice(r,s)}if(t===e)return"";let c=-1,f=t.length-1;for(;l--;)if(e.codePointAt(l)===47){if(o){r=l+1;break}}else c<0&&(o=!0,c=l+1),f>-1&&(e.codePointAt(l)===t.codePointAt(f--)?f<0&&(s=l):(f=-1,s=c));return r===s?s=c:s<0&&(s=e.length),e.slice(r,s)}function nT(e){if(Zl(e),e.length===0)return".";let t=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){t=r;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function rT(e){Zl(e);let t=e.length,r=-1,s=0,l=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){s=t+1;break}continue}r<0&&(c=!0,r=t+1),f===46?l<0?l=t:o!==1&&(o=1):l>-1&&(o=-1)}return l<0||r<0||o===0||o===1&&l===r-1&&l===s+1?"":e.slice(l,r)}function iT(...e){let t=-1,r;for(;++t<e.length;)Zl(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":sT(r)}function sT(e){Zl(e);const t=e.codePointAt(0)===47;let r=aT(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function aT(e,t){let r="",s=0,l=-1,o=0,c=-1,f,d;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(l===c-1||o===1))if(l!==c-1&&o===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(d=r.lastIndexOf("/"),d!==r.length-1){d<0?(r="",s=0):(r=r.slice(0,d),s=r.length-1-r.lastIndexOf("/")),l=c,o=0;continue}}else if(r.length>0){r="",s=0,l=c,o=0;continue}}t&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+e.slice(l+1,c):r=e.slice(l+1,c),s=c-l-1;l=c,o=0}else f===46&&o>-1?o++:o=-1}return r}function Zl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const lT={cwd:oT};function oT(){return"/"}function Ad(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function uT(e){if(typeof e=="string")e=new URL(e);else if(!Ad(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return cT(e)}function cT(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const s=t.codePointAt(r+2);if(s===70||s===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(t)}const Ih=["history","path","basename","stem","extname","dirname"];class k1{constructor(t){let r;t?Ad(t)?r={path:t}:typeof t=="string"||fT(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":lT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Ih.length;){const o=Ih[s];o in r&&r[o]!==void 0&&r[o]!==null&&(this[o]=o==="history"?[...r[o]]:r[o])}let l;for(l in r)Ih.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?Fr.basename(this.path):void 0}set basename(t){$h(t,"basename"),Fh(t,"basename"),this.path=Fr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Fr.dirname(this.path):void 0}set dirname(t){Rb(this.basename,"dirname"),this.path=Fr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Fr.extname(this.path):void 0}set extname(t){if(Fh(t,"extname"),Rb(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Fr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ad(t)&&(t=uT(t)),$h(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Fr.basename(this.path,this.extname):void 0}set stem(t){$h(t,"stem"),Fh(t,"stem"),this.path=Fr.join(this.dirname||"",t+(this.extname||""))}fail(t,r,s){const l=this.message(t,r,s);throw l.fatal=!0,l}info(t,r,s){const l=this.message(t,r,s);return l.fatal=void 0,l}message(t,r,s){const l=new Mn(t,r,s);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Fh(e,t){if(e&&e.includes(Fr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Fr.sep+"`")}function $h(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Rb(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function fT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const hT=(function(e){const s=this.constructor.prototype,l=s[e],o=function(){return l.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),dT={}.hasOwnProperty;class om extends hT{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=WN()}copy(){const t=new om;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];t.use(...s)}return t.data(qh(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Gh("data",this.frozen),this.namespace[t]=r,this):dT.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Gh("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const l=r.call(t,...s);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=bu(t),s=this.parser||this.Parser;return Vh("parse",s),s(String(r),r)}process(t,r){const s=this;return this.freeze(),Vh("process",this.parser||this.Parser),Yh("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(o,c){const f=bu(t),d=s.parse(f);s.run(d,f,function(b,g,x){if(b||!g||!x)return m(b);const v=g,S=s.stringify(v,x);gT(S)?x.value=S:x.result=S,m(b,x)});function m(b,g){b||!g?c(b):o?o(g):r(void 0,g)}}}processSync(t){let r=!1,s;return this.freeze(),Vh("processSync",this.parser||this.Parser),Yh("processSync",this.compiler||this.Compiler),this.process(t,l),Db("processSync","process",r),s;function l(o,c){r=!0,Tb(o),s=c}}run(t,r,s){Mb(t),this.freeze();const l=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?o(void 0,s):new Promise(o);function o(c,f){const d=bu(r);l.run(t,d,m);function m(b,g,x){const v=g||t;b?f(b):c?c(v):s(void 0,v,x)}}}runSync(t,r){let s=!1,l;return this.run(t,r,o),Db("runSync","run",s),l;function o(c,f){Tb(c),l=f,s=!0}}stringify(t,r){this.freeze();const s=bu(r),l=this.compiler||this.Compiler;return Yh("stringify",l),Mb(t),l(t,s)}use(t,...r){const s=this.attachers,l=this.namespace;if(Gh("use",this.frozen),t!=null)if(typeof t=="function")d(t,r);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(m){if(typeof m=="function")d(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[b,...g]=m;d(b,g)}else c(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function c(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(m.plugins),m.settings&&(l.settings=qh(!0,l.settings,m.settings))}function f(m){let b=-1;if(m!=null)if(Array.isArray(m))for(;++b<m.length;){const g=m[b];o(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function d(m,b){let g=-1,x=-1;for(;++g<s.length;)if(s[g][0]===m){x=g;break}if(x===-1)s.push([m,...b]);else if(b.length>0){let[v,...S]=b;const j=s[x][1];Cd(j)&&Cd(v)&&(v=qh(!0,j,v)),s[x]=[m,v,...S]}}}}const mT=new om().freeze();function Vh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Gh(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Mb(e){if(!Cd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Db(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function bu(e){return pT(e)?e:new k1(e)}function pT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function gT(e){return typeof e=="string"||yT(e)}function yT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const bT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Lb=[],zb={allowDangerousHtml:!0},xT=/^(https?|ircs?|mailto|xmpp)$/i,vT=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function wT(e){const t=ST(e),r=_T(e);return kT(t.runSync(t.parse(r),r),e)}function ST(e){const t=e.rehypePlugins||Lb,r=e.remarkPlugins||Lb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...zb}:zb;return mT().use(nN).use(r).use(KN,s).use(t)}function _T(e){const t=e.children||"",r=new k1;return typeof t=="string"&&(r.value=t),r}function kT(e,t){const r=t.allowedElements,s=t.allowElement,l=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,d=t.urlTransform||E1;for(const b of vT)Object.hasOwn(t,b.from)&&(""+b.from+(b.to?"use `"+b.to+"` instead":"remove it")+bT+b.id,void 0);return lm(e,m),BC(e,{Fragment:y.Fragment,components:l,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function m(b,g,x){if(b.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:b.value},g;if(b.type==="element"){let v;for(v in Uh)if(Object.hasOwn(Uh,v)&&Object.hasOwn(b.properties,v)){const S=b.properties[v],j=Uh[v];(j===null||j.includes(b.tagName))&&(b.properties[v]=d(String(S||""),v,b))}}if(b.type==="element"){let v=r?!r.includes(b.tagName):o?o.includes(b.tagName):!1;if(!v&&s&&typeof g=="number"&&(v=!s(b,g,x)),v&&x&&typeof g=="number")return f&&b.children?x.children.splice(g,1,...b.children):x.children.splice(g,1),g}}}function E1(e){const t=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||r!==-1&&t>r||s!==-1&&t>s||xT.test(e.slice(0,t))?e:""}const ET=/^[a-z][a-z0-9+.-]+:/i;function C1(e){const t=e==null?void 0:e.trim();if(!t||t.startsWith("#")||t.startsWith("//"))return null;if(/^file:/i.test(t))try{const s=decodeURIComponent(new URL(t).pathname);return/^\/[a-z]:/i.test(s)?s.slice(1):s}catch{return null}if(ET.test(t))return null;const r=t.replace(/[?#].*$/,"");try{return decodeURI(r)||null}catch{return r||null}}function CT(e){return C1(e)!==null?e:E1(e)}function AT(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:[\\/]/i.test(e)}function jT(e,t){return!t||AT(e)?e:t.replace(/[^/\\]*$/,"")+e}function NT(e){return e.split(/[/\\]/).filter(Boolean).pop()??e}function TT(e){const t=atob(e),r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}async function OT(e,t,r,s){const l=[];let o=0,c="application/octet-stream";for(;;){const f=await e("task.file",{id:t,run_id:r,path:s,offset:o});if(f.error)throw new Error(f.error.startsWith("Unknown method")?"Update Palmier on the host to open files.":f.error);const d=TT(f.data??"");if(l.push(d),o+=d.length,f.mime&&(c=f.mime),f.eof||d.length===0)break}return new Blob(l,{type:c})}const RT=["application/json","application/x-ndjson","application/xml","application/yaml"];function MT(e){return e==="text/markdown"?"markdown":e==="text/html"?"html":e.startsWith("image/")?"image":e.startsWith("text/")||RT.includes(e)?"text":"binary"}function DT(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Ub(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,l=r.indexOf(t);for(;l!==-1;)s++,l=r.indexOf(t,l+t.length);return s}function LT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function A1(e,t,r){const l=nc((r||{}).ignore||[]),o=zT(t);let c=-1;for(;++c<o.length;)_1(e,"text",f);function f(m,b){let g=-1,x;for(;++g<b.length;){const v=b[g],S=x?x.children:void 0;if(l(v,S?S.indexOf(v):void 0,x))return;x=v}if(x)return d(m,b)}function d(m,b){const g=b[b.length-1],x=o[c][0],v=o[c][1];let S=0;const R=g.children.indexOf(m);let M=!1,P=[];x.lastIndex=0;let I=x.exec(m.value);for(;I;){const ue=I.index,q={index:I.index,input:I.input,stack:[...b,m]};let N=v(...I,q);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?x.lastIndex=ue+1:(S!==ue&&P.push({type:"text",value:m.value.slice(S,ue)}),Array.isArray(N)?P.push(...N):N&&P.push(N),S=ue+I[0].length,M=!0),!x.global)break;I=x.exec(m.value)}return M?(S<m.value.length&&P.push({type:"text",value:m.value.slice(S)}),g.children.splice(R,1,...P)):P=[m],R+P.length}}function zT(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<r.length;){const l=r[s];t.push([UT(l[0]),PT(l[1])])}return t}function UT(e){return typeof e=="string"?new RegExp(LT(e),"g"):e}function PT(e){return typeof e=="function"?e:function(){return e}}const Jh="phrasing",Xh=["autolink","link","image","label"];function BT(){return{transforms:[YT],enter:{literalAutolink:qT,literalAutolinkEmail:Kh,literalAutolinkHttp:Kh,literalAutolinkWww:Kh},exit:{literalAutolink:VT,literalAutolinkEmail:$T,literalAutolinkHttp:IT,literalAutolinkWww:FT}}}function HT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Jh,notInConstruct:Xh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Jh,notInConstruct:Xh},{character:":",before:"[ps]",after:"\\/",inConstruct:Jh,notInConstruct:Xh}]}}function qT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Kh(e){this.config.enter.autolinkProtocol.call(this,e)}function IT(e){this.config.exit.autolinkProtocol.call(this,e)}function FT(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function $T(e){this.config.exit.autolinkEmail.call(this,e)}function VT(e){this.exit(e)}function YT(e){A1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,GT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),JT]],{ignore:["link","linkReference"]})}function GT(e,t,r,s,l){let o="";if(!j1(l)||(/^w/i.test(t)&&(r=t+r,t="",o="http://"),!XT(r)))return!1;const c=KT(r+s);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function JT(e,t,r,s){return!j1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function XT(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function KT(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],s=r.indexOf(")");const l=Ub(e,"(");let o=Ub(e,")");for(;s!==-1&&l>o;)e+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),o++;return[e,r]}function j1(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||_s(r)||Wu(r))&&(!t||r!==47)}N1.peek=s3;function QT(){this.buffer()}function ZT(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function WT(){this.buffer()}function e3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function t3(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Lr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function n3(e){this.exit(e)}function r3(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Lr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function i3(e){this.exit(e)}function s3(){return"["}function N1(e,t,r,s){const l=r.createTracker(s);let o=l.move("[^");const c=r.enter("footnoteReference"),f=r.enter("reference");return o+=l.move(r.safe(r.associationId(e),{after:"]",before:o})),f(),c(),o+=l.move("]"),o}function a3(){return{enter:{gfmFootnoteCallString:QT,gfmFootnoteCall:ZT,gfmFootnoteDefinitionLabelString:WT,gfmFootnoteDefinition:e3},exit:{gfmFootnoteCallString:t3,gfmFootnoteCall:n3,gfmFootnoteDefinitionLabelString:r3,gfmFootnoteDefinition:i3}}}function l3(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:N1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,l,o,c){const f=o.createTracker(c);let d=f.move("[^");const m=o.enter("footnoteDefinition"),b=o.enter("label");return d+=f.move(o.safe(o.associationId(s),{before:d,after:"]"})),b(),d+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),d+=f.move((t?`
|
|
107
|
+
`:" ")+o.indentLines(o.containerFlow(s,f.current()),t?T1:o3))),m(),d}}function o3(e,t,r){return t===0?e:T1(e,t,r)}function T1(e,t,r){return(r?"":" ")+e}const u3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];O1.peek=m3;function c3(){return{canContainEols:["delete"],enter:{strikethrough:h3},exit:{strikethrough:d3}}}function f3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:u3}],handlers:{delete:O1}}}function h3(e){this.enter({type:"delete",children:[]},e)}function d3(e){this.exit(e)}function O1(e,t,r,s){const l=r.createTracker(s),o=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),o(),c}function m3(){return"~"}function p3(e){return e.length}function g3(e,t){const r=t||{},s=(r.align||[]).concat(),l=r.stringLength||p3,o=[],c=[],f=[],d=[];let m=0,b=-1;for(;++b<e.length;){const j=[],R=[];let M=-1;for(e[b].length>m&&(m=e[b].length);++M<e[b].length;){const P=y3(e[b][M]);if(r.alignDelimiters!==!1){const I=l(P);R[M]=I,(d[M]===void 0||I>d[M])&&(d[M]=I)}j.push(P)}c[b]=j,f[b]=R}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<m;)o[g]=Pb(s[g]);else{const j=Pb(s);for(;++g<m;)o[g]=j}g=-1;const x=[],v=[];for(;++g<m;){const j=o[g];let R="",M="";j===99?(R=":",M=":"):j===108?R=":":j===114&&(M=":");let P=r.alignDelimiters===!1?1:Math.max(1,d[g]-R.length-M.length);const I=R+"-".repeat(P)+M;r.alignDelimiters!==!1&&(P=R.length+P+M.length,P>d[g]&&(d[g]=P),v[g]=P),x[g]=I}c.splice(1,0,x),f.splice(1,0,v),b=-1;const S=[];for(;++b<c.length;){const j=c[b],R=f[b];g=-1;const M=[];for(;++g<m;){const P=j[g]||"";let I="",ue="";if(r.alignDelimiters!==!1){const q=d[g]-(R[g]||0),N=o[g];N===114?I=" ".repeat(q):N===99?q%2?(I=" ".repeat(q/2+.5),ue=" ".repeat(q/2-.5)):(I=" ".repeat(q/2),ue=I):ue=" ".repeat(q)}r.delimiterStart!==!1&&!g&&M.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&P==="")&&(r.delimiterStart!==!1||g)&&M.push(" "),r.alignDelimiters!==!1&&M.push(I),M.push(P),r.alignDelimiters!==!1&&M.push(ue),r.padding!==!1&&M.push(" "),(r.delimiterEnd!==!1||g!==m-1)&&M.push("|")}S.push(r.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return S.join(`
|
|
108
108
|
`)}function y3(e){return e==null?"":String(e)}function Pb(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function b3(e,t,r,s){const l=r.enter("blockquote"),o=r.createTracker(s);o.move("> "),o.shift(2);const c=r.indentLines(r.containerFlow(e,o.current()),x3);return l(),c}function x3(e,t,r){return">"+(r?"":" ")+e}function v3(e,t){return Bb(e,t.inConstruct,!0)&&!Bb(e,t.notInConstruct,!1)}function Bb(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function Hb(e,t,r,s){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
|
|
109
109
|
`&&v3(r.stack,r.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
110
110
|
`}function w3(e,t){const r=String(e);let s=r.indexOf(t),l=s,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===l?++o>c&&(c=o):o=1,l=s+t.length,s=r.indexOf(t,l);return c}function S3(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function _3(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function k3(e,t,r,s){const l=_3(r),o=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(S3(e,r)){const g=r.enter("codeIndented"),x=r.indentLines(o,E3);return g(),x}const f=r.createTracker(s),d=l.repeat(Math.max(w3(o,l)+1,3)),m=r.enter("codeFenced");let b=f.move(d);if(e.lang){const g=r.enter(`codeFencedLang${c}`);b+=f.move(r.safe(e.lang,{before:b,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=r.enter(`codeFencedMeta${c}`);b+=f.move(" "),b+=f.move(r.safe(e.meta,{before:b,after:`
|
|
@@ -117,5 +117,5 @@ Are you sure you want to continue?`):!0}async function te(){if(!(!P||!I())){v(!0
|
|
|
117
117
|
`+(l===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
118
118
|
`))+1))}const c="#".repeat(l),f=r.enter("headingAtx"),d=r.enter("phrasing");o.move(c+" ");let m=r.containerPhrasing(e,{before:"# ",after:`
|
|
119
119
|
`,...o.current()});return/^[\t ]/.test(m)&&(m=Vl(m.charCodeAt(0))+m.slice(1)),m=m?c+" "+m:c,r.options.closeAtx&&(m+=" "+c),d(),f(),m}M1.peek=O3;function M1(e){return e.value||""}function O3(){return"<"}D1.peek=R3;function D1(e,t,r,s){const l=um(r),o=l==='"'?"Quote":"Apostrophe",c=r.enter("image");let f=r.enter("label");const d=r.createTracker(s);let m=d.move("![");return m+=d.move(r.safe(e.alt,{before:m,after:"]",...d.current()})),m+=d.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(r.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(f=r.enter("destinationRaw"),m+=d.move(r.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),f(),e.title&&(f=r.enter(`title${o}`),m+=d.move(" "+l),m+=d.move(r.safe(e.title,{before:m,after:l,...d.current()})),m+=d.move(l),f()),m+=d.move(")"),c(),m}function R3(){return"!"}L1.peek=M3;function L1(e,t,r,s){const l=e.referenceType,o=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(s);let d=f.move("![");const m=r.safe(e.alt,{before:d,after:"]",...f.current()});d+=f.move(m+"]["),c();const b=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return c(),r.stack=b,o(),l==="full"||!m||m!==g?d+=f.move(g+"]"):l==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function M3(){return"!"}z1.peek=D3;function z1(e,t,r){let s=e.value||"",l="`",o=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(s);)l+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++o<r.unsafe.length;){const c=r.unsafe[o],f=r.compilePattern(c);let d;if(c.atBreak)for(;d=f.exec(s);){let m=d.index;s.charCodeAt(m)===10&&s.charCodeAt(m-1)===13&&m--,s=s.slice(0,m)+" "+s.slice(d.index+1)}}return l+s+l}function D3(){return"`"}function U1(e,t){const r=em(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}P1.peek=L3;function P1(e,t,r,s){const l=um(r),o=l==='"'?"Quote":"Apostrophe",c=r.createTracker(s);let f,d;if(U1(e,r)){const b=r.stack;r.stack=[],f=r.enter("autolink");let g=c.move("<");return g+=c.move(r.containerPhrasing(e,{before:g,after:">",...c.current()})),g+=c.move(">"),f(),r.stack=b,g}f=r.enter("link"),d=r.enter("label");let m=c.move("[");return m+=c.move(r.containerPhrasing(e,{before:m,after:"](",...c.current()})),m+=c.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),m+=c.move("<"),m+=c.move(r.safe(e.url,{before:m,after:">",...c.current()})),m+=c.move(">")):(d=r.enter("destinationRaw"),m+=c.move(r.safe(e.url,{before:m,after:e.title?" ":")",...c.current()}))),d(),e.title&&(d=r.enter(`title${o}`),m+=c.move(" "+l),m+=c.move(r.safe(e.title,{before:m,after:l,...c.current()})),m+=c.move(l),d()),m+=c.move(")"),f(),m}function L3(e,t,r){return U1(e,r)?"<":"["}B1.peek=z3;function B1(e,t,r,s){const l=e.referenceType,o=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(s);let d=f.move("[");const m=r.containerPhrasing(e,{before:d,after:"]",...f.current()});d+=f.move(m+"]["),c();const b=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return c(),r.stack=b,o(),l==="full"||!m||m!==g?d+=f.move(g+"]"):l==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function z3(){return"["}function cm(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function U3(e){const t=cm(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function P3(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function H1(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function B3(e,t,r,s){const l=r.enter("list"),o=r.bulletCurrent;let c=e.ordered?P3(r):cm(r);const f=e.ordered?c==="."?")":".":U3(r);let d=t&&r.bulletLastUsed?c===r.bulletLastUsed:!1;if(!e.ordered){const b=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&b&&(!b.children||!b.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(d=!0),H1(r)===c&&b){let g=-1;for(;++g<e.children.length;){const x=e.children[g];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(c=f),r.bulletCurrent=c;const m=r.containerFlow(e,s);return r.bulletLastUsed=c,r.bulletCurrent=o,l(),m}function H3(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function q3(e,t,r,s){const l=H3(r);let o=r.bulletCurrent||cm(r);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(l==="tab"||l==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=r.createTracker(s);f.move(o+" ".repeat(c-o.length)),f.shift(c);const d=r.enter("listItem"),m=r.indentLines(r.containerFlow(e,f.current()),b);return d(),m;function b(g,x,v){return x?(v?"":" ".repeat(c))+g:(v?o:o+" ".repeat(c-o.length))+g}}function I3(e,t,r,s){const l=r.enter("paragraph"),o=r.enter("phrasing"),c=r.containerPhrasing(e,s);return o(),l(),c}const F3=nc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function $3(e,t,r,s){return(e.children.some(function(c){return F3(c)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function V3(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}q1.peek=Y3;function q1(e,t,r,s){const l=V3(r),o=r.enter("strong"),c=r.createTracker(s),f=c.move(l+l);let d=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const m=d.charCodeAt(0),b=Fu(s.before.charCodeAt(s.before.length-1),m,l);b.inside&&(d=Vl(m)+d.slice(1));const g=d.charCodeAt(d.length-1),x=Fu(s.after.charCodeAt(0),g,l);x.inside&&(d=d.slice(0,-1)+Vl(g));const v=c.move(l+l);return o(),r.attentionEncodeSurroundingInfo={after:x.outside,before:b.outside},f+d+v}function Y3(e,t,r){return r.options.strong||"*"}function G3(e,t,r,s){return r.safe(e.value,s)}function J3(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function X3(e,t,r){const s=(H1(r)+(r.options.ruleSpaces?" ":"")).repeat(J3(r));return r.options.ruleSpaces?s.slice(0,-1):s}const I1={blockquote:b3,break:Hb,code:k3,definition:C3,emphasis:R1,hardBreak:Hb,heading:T3,html:M1,image:D1,imageReference:L1,inlineCode:z1,link:P1,linkReference:B1,list:B3,listItem:q3,paragraph:I3,root:$3,strong:q1,text:G3,thematicBreak:X3};function K3(){return{enter:{table:Q3,tableData:qb,tableHeader:qb,tableRow:W3},exit:{codeText:eO,table:Z3,tableData:Qh,tableHeader:Qh,tableRow:Qh}}}function Q3(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function Z3(e){this.exit(e),this.data.inTable=void 0}function W3(e){this.enter({type:"tableRow",children:[]},e)}function Qh(e){this.exit(e)}function qb(e){this.enter({type:"tableCell",children:[]},e)}function eO(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,tO));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function tO(e,t){return t==="|"?t:e}function nO(e){const t=e||{},r=t.tableCellPadding,s=t.tablePipeAlign,l=t.stringLength,o=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
120
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:d,tableRow:f}};function c(v,S,
|
|
121
|
-
`))}function d(v,S,A,O){const M=A.enter("tableCell"),P=A.enter("phrasing"),I=A.containerPhrasing(v,{...O,before:o,after:o});return P(),M(),I}function m(v,S){return g3(v,{align:S,alignDelimiters:s,padding:r,stringLength:l})}function b(v,S,A){const O=v.children;let M=-1;const P=[],I=S.enter("table");for(;++M<O.length;)P[M]=g(O[M],S,A);return I(),P}function g(v,S,A){const O=v.children;let M=-1;const P=[],I=S.enter("tableRow");for(;++M<O.length;)P[M]=d(O[M],v,S,A);return I(),P}function x(v,S,A){let O=I1.inlineCode(v,S,A);return A.stack.includes("tableCell")&&(O=O.replace(/\|/g,"\\$&")),O}}function rO(){return{exit:{taskListCheckValueChecked:Ib,taskListCheckValueUnchecked:Ib,paragraph:sO}}}function iO(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:aO}}}function Ib(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function sO(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const s=r.children[0];if(s&&s.type==="text"){const l=t.children;let o=-1,c;for(;++o<l.length;){const f=l[o];if(f.type==="paragraph"){c=f;break}}c===r&&(s.value=s.value.slice(1),s.value.length===0?r.children.shift():r.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,r.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function aO(e,t,r,s){const l=e.children[0],o=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(s);o&&f.move(c);let d=I1.listItem(e,t,r,{...s,...f.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(b){return b+c}}function lO(){return[BT(),a3(),c3(),K3(),rO()]}function oO(e){return{extensions:[HT(),l3(e),f3(),nO(e),iO()]}}const uO={tokenize:pO,partial:!0},F1={tokenize:gO,partial:!0},$1={tokenize:yO,partial:!0},V1={tokenize:bO,partial:!0},cO={tokenize:xO,partial:!0},Y1={name:"wwwAutolink",tokenize:dO,previous:J1},G1={name:"protocolAutolink",tokenize:mO,previous:X1},vi={name:"emailAutolink",tokenize:hO,previous:K1},Gr={};function fO(){return{text:Gr}}let vs=48;for(;vs<123;)Gr[vs]=vi,vs++,vs===58?vs=65:vs===91&&(vs=97);Gr[43]=vi;Gr[45]=vi;Gr[46]=vi;Gr[95]=vi;Gr[72]=[vi,G1];Gr[104]=[vi,G1];Gr[87]=[vi,Y1];Gr[119]=[vi,Y1];function hO(e,t,r){const s=this;let l,o;return c;function c(g){return!jd(g)||!K1.call(s,s.previous)||fm(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return jd(g)?(e.consume(g),f):g===64?(e.consume(g),d):r(g)}function d(g){return g===46?e.check(cO,b,m)(g):g===45||g===95||On(g)?(o=!0,e.consume(g),d):b(g)}function m(g){return e.consume(g),l=!0,d}function b(g){return o&&l&&Pn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):r(g)}}function dO(e,t,r){const s=this;return l;function l(c){return c!==87&&c!==119||!J1.call(s,s.previous)||fm(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(uO,e.attempt(F1,e.attempt($1,o),r),r)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function mO(e,t,r){const s=this;let l="",o=!1;return c;function c(g){return(g===72||g===104)&&X1.call(s,s.previous)&&!fm(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(Pn(g)&&l.length<5)return l+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const x=l.toLowerCase();if(x==="http"||x==="https")return e.consume(g),d}return r(g)}function d(g){return g===47?(e.consume(g),o?m:(o=!0,d)):r(g)}function m(g){return g===null||Hu(g)||Dt(g)||_s(g)||Wu(g)?r(g):e.attempt(F1,e.attempt($1,b),r)(g)}function b(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function pO(e,t,r){let s=0;return l;function l(c){return(c===87||c===119)&&s<3?(s++,e.consume(c),l):c===46&&s===3?(e.consume(c),o):r(c)}function o(c){return c===null?r(c):t(c)}}function gO(e,t,r){let s,l,o;return c;function c(m){return m===46||m===95?e.check(V1,d,f)(m):m===null||Dt(m)||_s(m)||m!==45&&Wu(m)?d(m):(o=!0,e.consume(m),c)}function f(m){return m===95?s=!0:(l=s,s=void 0),e.consume(m),c}function d(m){return l||s||!o?r(m):t(m)}}function yO(e,t){let r=0,s=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&s<r?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(V1,t,o)(c):c===null||Dt(c)||_s(c)?t(c):(e.consume(c),l)}function o(c){return c===41&&s++,e.consume(c),l}}function bO(e,t,r){return s;function s(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),s):f===38?(e.consume(f),o):f===93?(e.consume(f),l):f===60||f===null||Dt(f)||_s(f)?t(f):r(f)}function l(f){return f===null||f===40||f===91||Dt(f)||_s(f)?t(f):s(f)}function o(f){return Pn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):Pn(f)?(e.consume(f),c):r(f)}}function xO(e,t,r){return s;function s(o){return e.consume(o),l}function l(o){return On(o)?r(o):t(o)}}function J1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Dt(e)}function X1(e){return!Pn(e)}function K1(e){return!(e===47||jd(e))}function jd(e){return e===43||e===45||e===46||e===95||On(e)}function fm(e){let t=e.length,r=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){r=!0;break}if(s._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const vO={tokenize:jO,partial:!0};function wO(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:EO,continuation:{tokenize:CO},exit:AO}},text:{91:{name:"gfmFootnoteCall",tokenize:kO},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:SO,resolveTo:_O}}}}function SO(e,t,r){const s=this;let l=s.events.length;const o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;l--;){const d=s.events[l][1];if(d.type==="labelImage"){c=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return f;function f(d){if(!c||!c._balanced)return r(d);const m=Dr(s.sliceSerialize({start:c.end,end:s.now()}));return m.codePointAt(0)!==94||!o.includes(m.slice(1))?r(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function _O(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[r+1],e[r+2],["enter",s,t],e[r+3],e[r+4],["enter",l,t],["exit",l,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(r,e.length-r+1,...f),e}function kO(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),d}function d(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(g){if(o>999||g===93&&!c||g===null||g===91||Dt(g))return r(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return l.includes(Dr(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(g)}return Dt(g)||(c=!0),o++,e.consume(g),g===92?b:m}function b(g){return g===91||g===92||g===93?(e.consume(g),o++,m):m(g)}}function EO(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o,c=0,f;return d;function d(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",b):r(S)}function b(S){if(c>999||S===93&&!f||S===null||S===91||Dt(S))return r(S);if(S===93){e.exit("chunkString");const A=e.exit("gfmFootnoteDefinitionLabelString");return o=Dr(s.sliceSerialize(A)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Dt(S)||(f=!0),c++,e.consume(S),S===92?g:b}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,b):b(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),l.includes(o)||l.push(o),mt(e,v,"gfmFootnoteDefinitionWhitespace")):r(S)}function v(S){return t(S)}}function CO(e,t,r){return e.check(Ql,t,e.attempt(vO,t,r))}function AO(e){e.exit("gfmFootnoteDefinition")}function jO(e,t,r){const s=this;return mt(e,l,"gfmFootnoteDefinitionIndent",5);function l(o){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):r(o)}}function NO(e){let r=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:o,resolveAll:l};return r==null&&(r=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function l(c,f){let d=-1;for(;++d<c.length;)if(c[d][0]==="enter"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._close){let m=d;for(;m--;)if(c[m][0]==="exit"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._open&&c[d][1].end.offset-c[d][1].start.offset===c[m][1].end.offset-c[m][1].start.offset){c[d][1].type="strikethroughSequence",c[m][1].type="strikethroughSequence";const b={type:"strikethrough",start:Object.assign({},c[m][1].start),end:Object.assign({},c[d][1].end)},g={type:"strikethroughText",start:Object.assign({},c[m][1].end),end:Object.assign({},c[d][1].start)},x=[["enter",b,f],["enter",c[m][1],f],["exit",c[m][1],f],["enter",g,f]],v=f.parser.constructs.insideSpan.null;v&&or(x,x.length,0,ec(v,c.slice(m+1,d),f)),or(x,x.length,0,[["exit",g,f],["enter",c[d][1],f],["exit",c[d][1],f],["exit",b,f]]),or(c,m-1,d-m+3,x),d=m+x.length-2;break}}for(d=-1;++d<c.length;)c[d][1].type==="strikethroughSequenceTemporary"&&(c[d][1].type="data");return c}function o(c,f,d){const m=this.previous,b=this.events;let g=0;return x;function x(S){return m===126&&b[b.length-1][1].type!=="characterEscape"?d(S):(c.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const A=ka(m);if(S===126)return g>1?d(S):(c.consume(S),g++,v);if(g<2&&!r)return d(S);const O=c.exit("strikethroughSequenceTemporary"),M=ka(S);return O._open=!M||M===2&&!!A,O._close=!A||A===2&&!!M,f(S)}}}class TO{constructor(){this.map=[]}add(t,r,s){OO(this,t,r,s)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let r=this.map.length;const s=[];for(;r>0;)r-=1,s.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];s.push(t.slice()),t.length=0;let l=s.pop();for(;l;){for(const o of l)t.push(o);l=s.pop()}this.map.length=0}}function OO(e,t,r,s){let l=0;if(!(r===0&&s.length===0)){for(;l<e.map.length;){if(e.map[l][0]===t){e.map[l][1]+=r,e.map[l][2].push(...s);return}l+=1}e.map.push([t,r,s])}}function RO(e,t){let r=!1;const s=[];for(;t<e.length;){const l=e[t];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=s.length-1;s[o]=s[o]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return s}function MO(){return{flow:{null:{name:"table",tokenize:DO,resolveAll:LO}}}}function DO(e,t,r){const s=this;let l=0,o=0,c;return f;function f(D){let G=s.events.length-1;for(;G>-1;){const oe=s.events[G][1].type;if(oe==="lineEnding"||oe==="linePrefix")G--;else break}const F=G>-1?s.events[G][1].type:null,fe=F==="tableHead"||F==="tableRow"?L:d;return fe===L&&s.parser.lazy[s.now().line]?r(D):fe(D)}function d(D){return e.enter("tableHead"),e.enter("tableRow"),m(D)}function m(D){return D===124||(c=!0,o+=1),b(D)}function b(D){return D===null?r(D):$e(D)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),v):r(D):lt(D)?mt(e,b,"whitespace")(D):(o+=1,c&&(c=!1,l+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),c=!0,b):(e.enter("data"),g(D)))}function g(D){return D===null||D===124||Dt(D)?(e.exit("data"),b(D)):(e.consume(D),D===92?x:g)}function x(D){return D===92||D===124?(e.consume(D),g):g(D)}function v(D){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(D):(e.enter("tableDelimiterRow"),c=!1,lt(D)?mt(e,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):S(D))}function S(D){return D===45||D===58?O(D):D===124?(c=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),A):q(D)}function A(D){return lt(D)?mt(e,O,"whitespace")(D):O(D)}function O(D){return D===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),M):D===45?(o+=1,M(D)):D===null||$e(D)?te(D):q(D)}function M(D){return D===45?(e.enter("tableDelimiterFiller"),P(D)):q(D)}function P(D){return D===45?(e.consume(D),P):D===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(D))}function I(D){return lt(D)?mt(e,te,"whitespace")(D):te(D)}function te(D){return D===124?S(D):D===null||$e(D)?!c||l!==o?q(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(D)):q(D)}function q(D){return r(D)}function L(D){return e.enter("tableRow"),ee(D)}function ee(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),ee):D===null||$e(D)?(e.exit("tableRow"),t(D)):lt(D)?mt(e,ee,"whitespace")(D):(e.enter("data"),J(D))}function J(D){return D===null||D===124||Dt(D)?(e.exit("data"),ee(D)):(e.consume(D),D===92?B:J)}function B(D){return D===92||D===124?(e.consume(D),J):J(D)}}function LO(e,t){let r=-1,s=!0,l=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,d=0,m,b,g;const x=new TO;for(;++r<e.length;){const v=e[r],S=v[1];v[0]==="enter"?S.type==="tableHead"?(f=!1,d!==0&&(Fb(x,t,d,m,b),b=void 0,d=0),m={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",m,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(s=!0,g=void 0,o=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,b={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",b,t]])),l=S.type==="tableDelimiterRow"?2:b?3:1):l&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],g=xu(x,t,o,l,void 0,g),o=[0,0,0,0]),c[2]=r)):S.type==="tableCellDivider"&&(s?s=!1:(o[1]!==0&&(c[0]=c[1],g=xu(x,t,o,l,void 0,g)),o=c,c=[o[1],r,0,0])):S.type==="tableHead"?(f=!0,d=r):S.type==="tableRow"||S.type==="tableDelimiterRow"?(d=r,o[1]!==0?(c[0]=c[1],g=xu(x,t,o,l,r,g)):c[1]!==0&&(g=xu(x,t,c,l,r,g)),l=0):l&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=r)}for(d!==0&&Fb(x,t,d,m,b),x.consume(t.events),r=-1;++r<t.events.length;){const v=t.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=RO(t.events,r))}return e}function xu(e,t,r,s,l,o){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(o.end=Object.assign({},ca(t.events,r[0])),e.add(r[0],0,[["exit",o,t]]));const d=ca(t.events,r[1]);if(o={type:c,start:Object.assign({},d),end:Object.assign({},d)},e.add(r[1],0,[["enter",o,t]]),r[2]!==0){const m=ca(t.events,r[2]),b=ca(t.events,r[3]),g={type:f,start:Object.assign({},m),end:Object.assign({},b)};if(e.add(r[2],0,[["enter",g,t]]),s!==2){const x=t.events[r[2]],v=t.events[r[3]];if(x[1].end=Object.assign({},v[1].end),x[1].type="chunkText",x[1].contentType="text",r[3]>r[2]+1){const S=r[2]+1,A=r[3]-r[2]-1;e.add(S,A,[])}}e.add(r[3]+1,0,[["exit",g,t]])}return l!==void 0&&(o.end=Object.assign({},ca(t.events,l)),e.add(l,0,[["exit",o,t]]),o=void 0),o}function Fb(e,t,r,s,l){const o=[],c=ca(t.events,r);l&&(l.end=Object.assign({},c),o.push(["exit",l,t])),s.end=Object.assign({},c),o.push(["exit",s,t]),e.add(r+1,0,o)}function ca(e,t){const r=e[t],s=r[0]==="enter"?"start":"end";return r[1][s]}const zO={name:"tasklistCheck",tokenize:PO};function UO(){return{text:{91:zO}}}function PO(e,t,r){const s=this;return l;function l(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),o)}function o(d){return Dt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),c):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),c):r(d)}function c(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(d)}function f(d){return $e(d)?t(d):lt(d)?e.check({tokenize:BO},t,r)(d):r(d)}}function BO(e,t,r){return mt(e,s,"whitespace");function s(l){return l===null?r(l):t(l)}}function HO(e){return i1([fO(),wO(),NO(e),MO(),UO()])}const qO={};function IO(e){const t=this,r=e||qO,s=t.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),o=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(HO(r)),o.push(lO()),c.push(oO(r))}function FO(e){A1(e,[/\r?\n|\r/g,$O])}function $O(){return{type:"break"}}function VO(){return function(e){FO(e)}}const hm=E.createContext(null);function Q1(e,t){const r=C1(t);return e&&r!==null?jT(r,e.baseFile):null}function YO({node:e,href:t,...r}){const s=E.useContext(hm),l=Q1(s,t);return!s||l===null?y.jsx("a",{...r,href:t,target:"_blank",rel:"noopener noreferrer"}):y.jsx("a",{...r,href:t,className:"md-file-link",onClick:o=>{o.preventDefault(),s.openFile(l)}})}function GO({node:e,src:t,alt:r,...s}){const l=E.useContext(hm),o=Q1(l,typeof t=="string"?t:void 0),[c,f]=E.useState(),[d,m]=E.useState(!1),b=l==null?void 0:l.loadFile;return E.useEffect(()=>{if(o===null||!b)return;let g=!1,x;return m(!1),b(o).then(v=>{g||(x=URL.createObjectURL(v),f(x))}).catch(()=>{g||m(!0)}),()=>{g=!0,x&&URL.revokeObjectURL(x)}},[o,b]),!l||o===null?y.jsx("img",{...s,src:t,alt:r}):d?y.jsx("span",{className:"md-image-missing",children:r||o}):c?y.jsx("img",{...s,src:c,alt:r,className:"md-file-image",onClick:()=>l.openFile(o)}):y.jsx("span",{className:"md-image-loading skeleton-line"})}const JO={a:YO,img:GO};function Z1({content:e,files:t,baseFile:r}){const s=E.useMemo(()=>({openFile:t.openFile,loadFile:t.loadFile,baseFile:r}),[t.openFile,t.loadFile,r]);return y.jsx(hm.Provider,{value:s,children:y.jsx(wT,{remarkPlugins:[IO,VO],urlTransform:CT,components:JO,children:e})})}function XO({filePath:e,files:t,onClose:r}){const[s,l]=E.useState(null),[o,c]=E.useState(null),{loadFile:f}=t;E.useEffect(()=>{let b=!1,g;return l(null),c(null),(async()=>{try{const x=await f(e),v=MT(x.type),S={kind:v,size:x.size};if(v==="markdown"||v==="text"||v==="html"?S.text=await x.text():(g=URL.createObjectURL(x),S.objectUrl=g),b){g&&URL.revokeObjectURL(g);return}l(S)}catch(x){b||c(x instanceof Error?x.message:"Failed to load file.")}})(),()=>{b=!0,g&&URL.revokeObjectURL(g)}},[e,f]);const d=NT(e);function m(){if(o)return y.jsx("p",{className:"file-viewer-message",children:o});if(!s)return y.jsxs("div",{className:"file-viewer-loading",children:[y.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem"}})]});switch(s.kind){case"markdown":return y.jsx(Z1,{content:s.text??"",files:t,baseFile:e});case"text":return y.jsx("pre",{className:"file-viewer-text",children:s.text});case"html":return y.jsx("iframe",{className:"file-viewer-frame",sandbox:"",srcDoc:s.text,title:d});case"image":return y.jsx("img",{src:s.objectUrl,alt:d,style:{maxWidth:"100%",height:"auto"}});case"binary":return Gn.isNativePlatform()?y.jsx("p",{className:"file-viewer-message",children:"Downloading this file type isn't supported in the app yet."}):y.jsxs("div",{className:"file-viewer-download",children:[y.jsxs("p",{className:"file-viewer-message",children:["This file can't be previewed (",DT(s.size),")."]}),y.jsx("a",{className:"btn btn-primary",href:s.objectUrl,download:d,children:"Download"})]})}}return y.jsx("div",{className:"report-dialog-overlay",onClick:r,children:y.jsxs("div",{className:"report-dialog",onClick:b=>b.stopPropagation(),children:[y.jsxs("div",{className:"report-dialog-header",children:[y.jsx("span",{className:"report-dialog-title",children:d}),y.jsx("button",{className:"report-dialog-close",onClick:r,"aria-label":"Close",children:y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),y.jsx("div",{className:`report-dialog-body${(s==null?void 0:s.kind)==="html"?" report-dialog-body--frame":""}`,children:m()})]})})}function KO({connected:e,hostId:t,request:r,subscribeEvents:s,taskId:l,runId:o}){const c=Yr(),f=Yd(),[d,m]=E.useState(!0),[b,g]=E.useState([]),[x,v]=E.useState(),[S,A]=E.useState(),[O,M]=E.useState(),[P,I]=E.useState(!1),te=x==="started",q=x==="followup",L=x==="started"||x==="followup",[ee,J]=E.useState(null);yd(ee!==null,()=>J(null));const[B,D]=E.useState(!1),[G,F]=E.useState(""),[fe,oe]=E.useState(!1),ne=E.useRef(null),V=E.useRef(null),Q=E.useRef(null),[X,xe]=E.useState(o==="latest"?void 0:o),j=o==="latest"&&X===null;E.useEffect(()=>{if(o!=="latest"){xe(o);return}e&&(xe(void 0),r("taskrun.list",{task_id:l,limit:1}).then(he=>{var Ae,Se;return xe(((Se=(Ae=he.entries)==null?void 0:Ae[0])==null?void 0:Se.run_id)??null)}).catch(()=>xe(null)))},[o,l,e,r]);async function z(){if(X)try{const he=await r("task.result",{id:l,run_id:X});if(he.error){console.error("No result:",he.error),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0});return}g(he.messages??[]),v(he.running_state),A(he.agent),M(he.agent_version),I(!!he.starred)}catch(he){console.error("Failed to load result:",he),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0})}finally{m(!1)}}async function W(){if(!X)return;const he=!P;I(he);try{const Ae=await r("taskrun.star",{task_id:l,run_id:X,starred:he});if(Ae.error)throw new Error(Ae.error)}catch(Ae){console.error("Failed to update star:",Ae),I(!he)}}const N=E.useCallback(he=>X?OT(r,l,X,he):Promise.reject(new Error("Run not loaded.")),[r,l,X]),we=E.useMemo(()=>({openFile:J,loadFile:N}),[N]);E.useEffect(()=>{!e||!X||(m(!0),z())},[e,l,X]),E.useEffect(()=>!e||!t||!X?void 0:s(t,async Ae=>{try{const Se=JSON.parse(new TextDecoder().decode(Ae.data));if(Se.event_type!=="running-state"&&Se.event_type!=="result-updated"||Ae.subject.split(".").pop()!==l||Se.event_type==="result-updated"&&Se.run_id&&Se.run_id!==X)return;z()}catch{}}),[e,t,l,X,s,r]),E.useEffect(()=>{ne.current&&(ne.current.scrollTop=ne.current.scrollHeight)},[b]),E.useEffect(()=>{d||j||!X||Q.current!==X&&(Q.current=X,requestAnimationFrame(()=>{ne.current&&(ne.current.scrollTop=ne.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"})}))},[d,j,X]);function Oe(he){if(he==="input")return"User Input";if(he==="permission")return"Permission";if(he==="confirmation")return"Confirmation"}function je(he){return he==="started"?"Task started":he==="finished"?"Task finished":he==="failed"?"Task failed":he==="error"?"Command failed":he==="aborted"?"Task aborted":he==="confirmation"?"Task confirmed":he==="stopped"?"Follow-up stopped":he??""}return y.jsxs("div",{className:"run-detail",children:[y.jsxs("div",{className:"run-detail-header",children:[y.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:y.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),!d&&!j&&y.jsx(Fx,{starred:P,onToggle:W})]}),j?y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"No runs yet"}),y.jsx("p",{className:"empty-state-hint",children:"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger."})]}):d?y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[y.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"chat-thread",ref:ne,children:[b.map((he,Ae)=>{const Se=L&&he.role==="assistant"&&!b.slice(Ae+1).some(We=>We.role==="assistant"||We.role==="user");return he.role==="status"?y.jsxs("div",{className:`chat-status${he.type==="error"?" chat-status--error":""}`,children:[y.jsxs("div",{children:[je(he.type),he.time>0&&y.jsx("span",{className:"chat-status-time",children:f(he.time)})]}),he.content&&y.jsx("pre",{className:"chat-status-detail",children:he.content})]},Ae):y.jsxs("div",{className:`chat-message chat-message--${he.role}${he.role==="assistant"&&he.stream==="stderr"?" chat-message--stderr":""}`,children:[he.role==="assistant"&&S&&y.jsxs("div",{className:"chat-message-agent",children:[gd(S),O&&y.jsxs("span",{className:"chat-message-agent-version",children:[" v",O]})]}),y.jsxs("div",{className:"chat-message-content",children:[y.jsx(Z1,{content:he.content,files:we}),Se&&y.jsxs("div",{className:"chat-typing-indicator",children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]})]}),he.attachments&&he.attachments.length>0&&y.jsx("div",{className:"chat-message-attachments",children:he.attachments.map(We=>y.jsx("button",{className:"chat-attachment-chip",onClick:()=>J(We),children:We},We))}),y.jsxs("div",{className:"chat-message-meta",children:[Oe(he.type)&&y.jsx("span",{className:"chat-message-type",children:Oe(he.type)}),he.time>0&&y.jsx("span",{children:f(he.time)})]})]},Ae)}),L&&(()=>{const he=b.filter(Ae=>Ae.role!=="status");return he.length===0||he[he.length-1].role!=="assistant"})()&&y.jsxs("div",{className:"chat-message chat-message--assistant",children:[S&&y.jsxs("div",{className:"chat-message-agent",children:[gd(S),O&&y.jsxs("span",{className:"chat-message-agent-version",children:[" v",O]})]}),y.jsxs("div",{className:"chat-typing-indicator",children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]})]})]}),te||q?y.jsx("div",{className:"chat-input-bar",children:y.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:B,"aria-label":"Abort task",onClick:async()=>{if(confirm("Abort this task?")){D(!0);try{await r("task.abort",{id:l})}catch(he){console.error("Abort failed:",he)}finally{D(!1)}}},children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):y.jsxs("form",{className:"chat-input-bar",onSubmit:async he=>{he.preventDefault();const Ae=G.trim();if(!(!Ae||fe)){oe(!0);try{await r("task.followup",{id:l,run_id:X,message:Ae}),F("")}catch(Se){console.error("Follow-up failed:",Se)}finally{oe(!1)}}},children:[y.jsx("input",{ref:V,className:"chat-input",type:"text",placeholder:"Follow-up message",value:G,onChange:he=>F(he.target.value),disabled:fe}),y.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!G.trim()||fe,children:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),y.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),y.jsxs("button",{className:"run-detail-back run-detail-back--footer",onClick:()=>c(-1),children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:y.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]})]}),ee&&y.jsx(XO,{filePath:ee,files:we,onClose:()=>J(null)})]})}function Zh({title:e,message:t,onUpdate:r,onDismiss:s}){return y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:e}),y.jsx("p",{className:"confirm-modal-message",children:t}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-primary",onClick:r,children:"Update Now"}),s&&y.jsx("button",{className:"btn btn-secondary",onClick:s,children:"Dismiss"})]})]})})}function QO(){const{activeHost:e}=xi(),t=E.useRef(null);E.useEffect(()=>{if(Gn.isNativePlatform()||e.directUrl||t.current===e.hostId)return;async function r(){var s;try{if(!("serviceWorker"in navigator)||!("PushManager"in window)){console.warn("[Push] Push notifications not supported");return}const l=await navigator.serviceWorker.ready;(s=l.active)==null||s.postMessage({type:"set-host-id",hostId:e.hostId});let o=await l.pushManager.getSubscription();if(!o){const{publicKey:f}=await wE("/api/push/vapid-key");if(!f){console.warn("[Push] No VAPID public key configured on server");return}if(await Notification.requestPermission()!=="granted"){console.log("[Push] Permission denied");return}o=await l.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:f})}const c=o.toJSON();await vE("/api/push/subscribe",{hostId:e.hostId,endpoint:c.endpoint,keys:{p256dh:c.keys.p256dh,auth:c.keys.auth}}),t.current=e.hostId}catch(l){console.error("[Push] Subscription failed:",l)}}r()},[e])}const ZO="0.9.9";function vu(e,t){if(e.includes("-"))return!1;const r=e.split(".").map(Number),s=t.split(".").map(Number);for(let l=0;l<3;l++){if((r[l]??0)<(s[l]??0))return!0;if((r[l]??0)>(s[l]??0))return!1}return!1}function wu(){const{removePairedHost:e,setHostLanUrl:t,setHostTimezone:r}=Zi(),{connected:s,request:l,subscribeEvents:o,unauthorized:c,activeHost:f}=xi(),d=f.hostId,m=f.clientToken||null,b=Yr(),g=kr(),x=Yu(),v=qx("(min-width: 768px)"),S=g.pathname.endsWith("/tasks"),A=x.runId?void 0:x.taskId,O=!!(x.taskId&&x.runId),[M,P]=E.useState(!1),[I,te]=E.useState(!1),[q,L]=E.useState(null),[ee,J]=E.useState(null),[B,D]=E.useState(null),[G,F]=E.useState(null),[fe,oe]=E.useState({}),[ne,V]=E.useState({}),[Q,X]=E.useState(null),[xe,j]=E.useState(null),[z,W]=E.useState(null),[N,we]=E.useState(null),[Oe,je]=E.useState(new Set),[he,Ae]=E.useState([]),[Se,We]=E.useState(),[It,ln]=E.useState("loading"),nn=!!m&&N===m,[Gt,on]=E.useState(new Map),[Ot,Qt]=E.useState(new Map),[Ie,dt]=E.useState(new Map),[Ke,wt]=E.useState(new Map),[Ut,En]=E.useState(new Map),[gt,Cn]=E.useState(new Map),[le,ke]=E.useState(new Map),[Re,Ge]=E.useState(new Map);QO(),E.useEffect(()=>{window.scrollTo(0,0)},[d]),E.useEffect(()=>{let de=!1;return eC().then(Ee=>{de||je(Ee)}),()=>{de=!0}},[]),E.useEffect(()=>{if(!s){ln("loading");return}ln("loading");let de=!1;return l("host.info",void 0,{timeout:15e3}).then(Ee=>{var et,Wt,Kt,Rt,ut,Pt,An,Ur,wi;if(de)return;Ae(Ee.agents??[]),X(Ee.playwright_cli??null),We(Ee.host_platform),we(Ee.linked_client_token??null),LE(Ee.agents??[]);const Be=Ee.version??null;J(Be),P(!!Be&&vu(Be,ZO)),t(d,Ee.lan_url??void 0),r(d,Ee.host_timezone);const Ye=new Map,He=new Map,ot=new Map,Xe=new Map,Pe=new Map;for(const Lt of Ee.pending_prompts??[])if(Lt.type==="confirmation")Ye.set(Lt.key,{description:((et=Lt.meta)==null?void 0:et.description)??"",sessionName:(Wt=Lt.meta)==null?void 0:Wt.session_name});else if(Lt.type==="choice")He.set(Lt.key,{question:((Kt=Lt.meta)==null?void 0:Kt.description)??"",options:Lt.params??[],sessionName:(Rt=Lt.meta)==null?void 0:Rt.session_name});else if(Lt.type==="permission")ot.set(Lt.key,{permissions:Lt.params??[],sessionName:(ut=Lt.meta)==null?void 0:ut.session_name});else if(Lt.type==="input"){const ns=Lt.params??((Pt=Lt.meta)==null?void 0:Pt.input_questions)??[];Xe.set(Lt.key,{questions:ns,description:(An=Lt.meta)==null?void 0:An.description,sessionName:(Ur=Lt.meta)==null?void 0:Ur.session_name,secret:(wi=Lt.meta)==null?void 0:wi.secret}),Pe.set(Lt.key,new Array(ns.length).fill(""))}on(Ye),Qt(He),dt(ot),wt(Xe),En(Pe),ln("ready")}).catch(()=>{de||ln("error")}),()=>{de=!0}},[s,d,l,t,r]),E.useEffect(()=>s?o(d,Ee=>{const Be=Ee.subject.split(".");if(Be.length<3)return;const Ye=Be.slice(2).join(".");let He={};try{He=JSON.parse(new TextDecoder().decode(Ee.data))}catch{return}const ot=He.event_type,Xe=He.session_id;if(ot==="input-request"&&Xe){const Pe=He.input_questions,et=He.session_name,Wt=He.description,Kt=He.secret;Pe!=null&&Pe.length&&(wt(Rt=>{if(Rt.has(Xe))return Rt;const ut=new Map(Rt);return ut.set(Xe,{questions:Pe,description:Wt,sessionName:et,secret:Kt}),ut}),En(Rt=>{if(Rt.has(Xe))return Rt;const ut=new Map(Rt);return ut.set(Xe,new Array(Pe.length).fill("")),ut}));return}if(ot==="input-resolved"&&Xe){wt(Pe=>{if(!Pe.has(Xe))return Pe;const et=new Map(Pe);return et.delete(Xe),et}),En(Pe=>{const et=new Map(Pe);return et.delete(Xe),et}),Cn(Pe=>{if(!Pe.has(Xe))return Pe;const et=new Map(Pe);return et.delete(Xe),et});return}if(ot==="confirm-request"&&Xe){const Pe=He.description,et=He.session_name;Pe&&on(Wt=>{if(Wt.has(Xe))return Wt;const Kt=new Map(Wt);return Kt.set(Xe,{description:Pe,sessionName:et}),Kt});return}if(ot==="confirm-resolved"&&Xe){on(Pe=>{if(!Pe.has(Xe))return Pe;const et=new Map(Pe);return et.delete(Xe),et});return}if(ot==="choice-request"&&Xe){const Pe=He.description,et=He.options,Wt=He.session_name;Pe&&(et!=null&&et.length)&&Qt(Kt=>{if(Kt.has(Xe))return Kt;const Rt=new Map(Kt);return Rt.set(Xe,{question:Pe,options:et,sessionName:Wt}),Rt});return}if(ot==="choice-resolved"&&Xe){Qt(Pe=>{if(!Pe.has(Xe))return Pe;const et=new Map(Pe);return et.delete(Xe),et});return}if(ot==="permission-request"){const Pe=He.required_permissions,et=He.session_name;Pe!=null&&Pe.length&&dt(Wt=>{if(Wt.has(Ye))return Wt;const Kt=new Map(Wt);return Kt.set(Ye,{permissions:Pe,sessionName:et}),Kt});return}if(ot==="permission-resolved"){dt(Pe=>{if(!Pe.has(Ye))return Pe;const et=new Map(Pe);return et.delete(Ye),et});return}}):void 0,[s,d,o]);async function rt(de,Ee,Be,Ye){if(!le.has(de)){ke(He=>new Map(He).set(de,Ee)),Ge(He=>{const ot=new Map(He);return ot.delete(de),ot});try{await l("task.user_input",{id:de,value:Be},{timeout:3e4}),Ye()}catch(He){console.error("[Dashboard] Failed to send user input:",He),Ge(ot=>new Map(ot).set(de,"Couldn't reach the host. Try again."))}finally{ke(He=>{const ot=new Map(He);return ot.delete(de),ot})}}}function un(de,Ee){rt(de,Ee,[Ee],()=>{on(Be=>{const Ye=new Map(Be);return Ye.delete(de),Ye})})}function yn(de,Ee){rt(de,Ee,[Ee],()=>{Qt(Be=>{const Ye=new Map(Be);return Ye.delete(de),Ye})})}function Jt(de,Ee){rt(de,Ee,[Ee],()=>{dt(Be=>{const Ye=new Map(Be);return Ye.delete(de),Ye})})}function yt(de,Ee,Be){rt(de,Ee,Be,()=>{wt(Ye=>{const He=new Map(Ye);return He.delete(de),He}),En(Ye=>{const He=new Map(Ye);return He.delete(de),He}),Cn(Ye=>{const He=new Map(Ye);return He.delete(de),He})})}function Xt(de,Ee){if(!Ss())return;const Be=`/hosts/${encodeURIComponent(d)}/runs/${encodeURIComponent(de)}`;b(Ee?`${Be}/${encodeURIComponent(Ee)}`:Be)}E.useEffect(()=>{if(!ee)return;let de=!1;return fetch("https://registry.npmjs.org/palmier/latest").then(Ee=>Ee.ok?Ee.json():null).then(Ee=>{!de&&(Ee!=null&&Ee.version)&&D(Ee.version)}).catch(()=>{}),()=>{de=!0}},[ee]),E.useEffect(()=>{let de=!1;for(const Ee of he)!Ee.version||!Ee.npmPackage||fetch(`https://registry.npmjs.org/${Ee.npmPackage}/latest`).then(Be=>Be.ok?Be.json():null).then(Be=>{de||!(Be!=null&&Be.version)||oe(Ye=>Ye[Ee.key]===Be.version?Ye:{...Ye,[Ee.key]:Be.version})}).catch(()=>{});return()=>{de=!0}},[he]);const Qe=he.find(de=>{if(!de.version)return!1;const Ee=fe[de.key];return!Ee||!vu(de.version,Ee)?!1:ne[de.key]!==Ee});function ve(de,Ee){V(Be=>({...Be,[de]:Ee}))}async function Fe(de){te("agent"),L(null);try{const Ee=await l("host.updateAgent",{key:de});if(Ee.error){L(Ee.error),te(!1);return}const Be=await l("host.info");Be.agents&&Ae(Be.agents)}catch(Ee){L(Ee instanceof Error?Ee.message:String(Ee))}finally{te(!1)}}E.useEffect(()=>{if(!(Q!=null&&Q.npmPackage))return;let de=!1;return fetch(`https://registry.npmjs.org/${Q.npmPackage}/latest`).then(Ee=>Ee.ok?Ee.json():null).then(Ee=>{!de&&(Ee!=null&&Ee.version)&&j(Ee.version)}).catch(()=>{}),()=>{de=!0}},[Q==null?void 0:Q.npmPackage,Q==null?void 0:Q.version]);const Me=Q&&xe&&vu(Q.version,xe)&&z!==xe?Q:null;function _t(de){W(de)}async function Zt(){te("playwright"),L(null);try{const de=await l("host.updatePlaywrightCli");if(de.error){L(de.error),te(!1);return}const Ee=await l("host.info");X(Ee.playwright_cli??null)}catch(de){L(de instanceof Error?de.message:String(de))}finally{te(!1)}}const Mn=!M&&!!ee&&!!B&&vu(ee,B)&&G!==B;function Xn(){B&&F(B)}async function Jr(){te("daemon"),L(null);try{const de=await l("host.update");if(de.error){L(de.error),te(!1);return}}catch{}setTimeout(()=>window.location.reload(),3e4)}const Er=Gt.size>0||Ot.size>0||Ie.size>0||Ke.size>0,ts=s&&!c;return y.jsxs("div",{className:"dashboard",children:[v&&y.jsx(Q0,{daemonVersion:ee,agents:he,playwrightCli:Q,linkedClientToken:N,request:l,onEnabledCapabilitiesChange:je,onLinkedClientTokenChange:we}),y.jsxs("div",{className:"dashboard-content",children:[y.jsxs("header",{className:"app-header",children:[y.jsxs("div",{className:"app-title-bar",children:[!v&&y.jsx(Q0,{daemonVersion:ee,agents:he,playwrightCli:Q,linkedClientToken:N,request:l,onEnabledCapabilitiesChange:je,onLinkedClientTokenChange:we}),y.jsx("h1",{className:"app-title",children:"Palmier"}),y.jsx(aC,{})]}),y.jsx("div",{className:"tab-bar",children:y.jsx(QE,{})})]}),y.jsx("main",{className:"dashboard-main",children:c?y.jsxs("div",{className:"revoked-state",children:[y.jsx("div",{className:"revoked-icon",children:y.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),y.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),y.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),y.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),y.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),y.jsx("div",{className:"revoked-command",children:y.jsx("code",{children:"palmier pair"})}),y.jsxs("div",{className:"revoked-actions",children:[y.jsx("button",{className:"btn btn-primary",onClick:()=>{Ss()&&b("/pair")},children:"Re-pair Device"}),y.jsx("button",{className:"btn btn-secondary",onClick:()=>{e(d),b("/",{replace:!0})},children:"Remove Host"})]})]}):ts?y.jsxs(y.Fragment,{children:[S&&!O&&y.jsx(KE,{connected:s,hostId:d,request:l,subscribeEvents:o,agents:he,hostPlatform:Se,isNotificationListener:nn&&Oe.has("notifications"),onViewRun:Xt,hostInfoStatus:It}),O?y.jsx(KO,{connected:s,hostId:d,request:l,subscribeEvents:o,taskId:x.taskId,runId:decodeURIComponent(x.runId)}):S?null:y.jsx(cC,{connected:s,hostId:d,request:l,subscribeEvents:o,agents:he,hostPlatform:Se,filterTaskId:A,onClearFilter:()=>{Ss()&&b(`/hosts/${encodeURIComponent(d)}`)},hostInfoStatus:It})]}):y.jsx("div",{className:"empty-state",children:y.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})})}),(M||Mn)&&!I&&!q&&!Er&&y.jsx(Zh,{title:M?"Update Required":"Update Available",message:M?`Your Palmier host${ee?` (v${ee})`:""} is too old for this version of the app. Please update to continue.`:`A new version of Palmier (v${B}) is available. You're running v${ee}.`,onUpdate:Jr,onDismiss:M?void 0:Xn}),!M&&!Mn&&Qe&&!I&&!q&&!Er&&y.jsx(Zh,{title:"Agent Update Available",message:`A new version of ${Qe.label} (v${fe[Qe.key]}) is available. You're running v${Qe.version}.`,onUpdate:()=>Fe(Qe.key),onDismiss:()=>ve(Qe.key,fe[Qe.key])}),!M&&!Mn&&!Qe&&Me&&xe&&!I&&!q&&!Er&&y.jsx(Zh,{title:"Browser Automation Update Available",message:`A new version of ${Me.label} (v${xe}) is available. You're running v${Me.version}.`,onUpdate:Zt,onDismiss:()=>_t(xe)}),I&&y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),y.jsx("p",{className:"confirm-modal-message",children:I==="daemon"?"Installing update and restarting daemon. Please wait...":"Installing update. Please wait..."})]})}),q&&y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),y.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:q}),y.jsx("div",{className:"confirm-modal-actions",children:y.jsx("button",{className:"btn btn-secondary",onClick:()=>{L(null)},children:"Retry"})})]})})]}),pi.createPortal(y.jsxs(y.Fragment,{children:[[...Gt.entries()].map(([de,{description:Ee,sessionName:Be}])=>y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),Be&&y.jsx("p",{className:"confirm-modal-subtitle",children:Be}),y.jsx("p",{className:"confirm-modal-message",children:Ee}),Re.has(de)&&y.jsx("p",{className:"form-error",children:Re.get(de)}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsxs("button",{className:"btn btn-primary",disabled:le.has(de),onClick:()=>un(de,"confirmed"),children:[le.get(de)==="confirmed"&&y.jsx("span",{className:"btn-spinner"}),"Confirm"]}),y.jsxs("button",{className:"btn btn-secondary",disabled:le.has(de),onClick:()=>un(de,"aborted"),children:[le.get(de)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort"]})]})]})},de)),[...Ot.entries()].map(([de,{question:Ee,options:Be,sessionName:Ye}])=>y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Question"}),Ye&&y.jsx("p",{className:"confirm-modal-subtitle",children:Ye}),y.jsx("p",{className:"confirm-modal-message",children:Ee}),Re.has(de)&&y.jsx("p",{className:"form-error",children:Re.get(de)}),y.jsx("div",{className:`confirm-modal-actions${Be.length===2&&Be.every(He=>He.length<=16)?"":" choice-options-stacked"}`,children:Be.map((He,ot)=>y.jsxs("button",{className:"btn btn-secondary",disabled:le.has(de),onClick:()=>yn(de,String(ot)),children:[le.get(de)===String(ot)&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),He]},ot))}),y.jsxs("button",{className:"permission-abort-link",disabled:le.has(de),onClick:()=>yn(de,"aborted"),children:[le.get(de)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort Task"]})]})},de)),[...Ie.entries()].map(([de,{permissions:Ee,sessionName:Be}])=>y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal permission-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),y.jsx("p",{className:"confirm-modal-message",children:y.jsx("strong",{children:Be||de})}),y.jsx("div",{className:"permission-list",children:Ee.map((Ye,He)=>y.jsxs("div",{className:"permission-item",children:[y.jsx("span",{className:"permission-name",children:Ye.name}),Ye.description&&y.jsx("span",{className:"permission-desc",children:Ye.description})]},He))}),Re.has(de)&&y.jsx("p",{className:"form-error",children:Re.get(de)}),y.jsxs("div",{className:"permission-actions",children:[y.jsxs("button",{className:"btn btn-primary",disabled:le.has(de),onClick:()=>Jt(de,"granted"),children:[le.get(de)==="granted"&&y.jsx("span",{className:"btn-spinner"}),"Allow Once"]}),y.jsxs("button",{className:"btn btn-secondary",disabled:le.has(de),onClick:()=>Jt(de,"granted_all"),children:[le.get(de)==="granted_all"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Allow Always"]})]}),y.jsxs("button",{className:"permission-abort-link",disabled:le.has(de),onClick:()=>Jt(de,"aborted"),children:[le.get(de)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Deny & Abort Task"]})]})},de)),[...Ke.entries()].map(([de,{questions:Ee,description:Be,sessionName:Ye,secret:He}])=>{const ot=Ut.get(de)??new Array(Ee.length).fill("");return y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal input-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:He?"Password Required":"Input Required"}),Ye&&y.jsx("p",{className:"confirm-modal-subtitle",children:Ye}),Be&&y.jsx("p",{className:"confirm-modal-message",children:Be}),y.jsx("div",{className:"input-list",children:Ee.map((Xe,Pe)=>y.jsxs("div",{className:"input-item",children:[y.jsx("label",{className:"input-label",children:Xe}),y.jsx("input",{type:He?"password":"text",autoComplete:He?"off":void 0,className:"input-field",value:ot[Pe]??"",onChange:et=>{En(Wt=>{const Kt=new Map(Wt),Rt=[...Kt.get(de)??[]];return Rt[Pe]=et.target.value,Kt.set(de,Rt),Kt})},disabled:le.has(de),autoFocus:Pe===0})]},Pe))}),He&&y.jsxs("label",{className:"toggle-label input-save-toggle",children:[y.jsx("input",{type:"checkbox",checked:gt.get(de)??!0,disabled:le.has(de),onChange:Xe=>Cn(Pe=>new Map(Pe).set(de,Xe.target.checked))}),"Save this password"]}),Re.has(de)&&y.jsx("p",{className:"form-error",children:Re.get(de)}),y.jsx("div",{className:"input-actions",children:y.jsxs("button",{className:"btn btn-primary",disabled:le.has(de)||ot.some(Xe=>!Xe.trim()),onClick:()=>{const Xe=He?[...ot,gt.get(de)??!0?"save":"nosave"]:ot;yt(de,"submit",Xe)},children:[le.get(de)==="submit"&&y.jsx("span",{className:"btn-spinner"}),"Submit"]})}),y.jsxs("button",{className:"permission-abort-link",disabled:le.has(de),onClick:()=>yt(de,"aborted",["aborted"]),children:[le.get(de)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort"]})]})},de)})]}),document.body)]})}const WO=ks("Preferences",{web:()=>Vd(()=>import("./web-BIv7BTtP.js"),[]).then(e=>new e.PreferencesWeb)}),Al=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),$b=Gn.isNativePlatform();function e4(){const[e,t]=E.useState(""),[r,s]=E.useState(!0),[l,o]=E.useState(!1),[c,f]=E.useState(null),{addPairedHost:d,pairedHosts:m}=Zi(),b=Yr();async function g(){const x=e.trim().toUpperCase();if(!x){f("Enter a pairing code.");return}o(!0),f(null);try{let v;if(Al){const O=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:x,label:navigator.userAgent})});if(!O.ok){const M=await O.json().catch(()=>({error:"Connection failed"}));throw new Error(M.error||`HTTP ${O.status}`)}v=await O.json()}else{const O=await fetch(`${Bu}/api/config`);if(!O.ok)throw new Error("Failed to fetch server config");const M=await O.json();if(!M.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const P=await Dx({servers:M.natsWsUrl,authenticator:Ex(M.natsJwt,new TextEncoder().encode(M.natsNkeySeed))}),I=Ru(),te=`pair.${x}`,q=await P.request(te,I.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});v=JSON.parse(I.decode(q.data)),await P.close()}const S={hostId:v.hostId,clientToken:v.clientToken,directUrl:Al?window.location.origin:void 0,...v.hostName?{name:v.hostName}:{}};if(d(S),Gn.isNativePlatform()&&Tn){await WO.set({key:"hostId",value:v.hostId});try{const{token:O}=await Tn.getFcmToken();await fetch(`${Bu}/api/fcm/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hostId:v.hostId,fcmToken:O})})}catch(O){console.warn("FCM token registration failed:",O)}}const A=`/hosts/${encodeURIComponent(v.hostId)}`;b($b&&r?`${A}/pair/setup`:A)}catch(v){const S=v instanceof Error?v.message:String(v);S.includes("timeout")||S.includes("TIMEOUT")||S.includes("503")||S.toLowerCase().includes("no responders")?f("Code not found or expired. Check the code and try again."):f(S)}finally{o(!1)}}return y.jsx("div",{className:"pair-page",children:y.jsxs("div",{className:"pair-card",children:[y.jsxs("div",{className:"pair-header",children:[y.jsx("h1",{className:"pair-title",children:Al?"Pair":"Pair with Host"}),y.jsx("p",{className:"pair-subtitle",children:Al?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!Al&&y.jsxs("div",{className:"pair-instructions",children:[y.jsxs("div",{className:"pair-instruction-block",children:[y.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),y.jsxs("ol",{className:"pair-steps",children:[y.jsxs("li",{children:["Install Palmier on your host machine.",y.jsx("span",{className:"pair-platform-label",children:"Linux / macOS:"}),y.jsx("code",{className:"pair-command",children:"curl -fsSL https://palmier.me/install.sh | bash"}),y.jsx("span",{className:"pair-platform-label",children:"Windows (PowerShell):"}),y.jsx("code",{className:"pair-command",children:"irm https://palmier.me/install.ps1 | iex"})]}),y.jsxs("li",{children:["Run the setup wizard:",y.jsx("code",{className:"pair-command",children:"palmier init"})]}),y.jsx("li",{children:"A pairing code will display automatically"})]})]}),y.jsx("div",{className:"pair-instruction-divider"}),y.jsxs("div",{className:"pair-instruction-block",children:[y.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),y.jsxs("ol",{className:"pair-steps",children:[y.jsxs("li",{children:["Run ",y.jsx("code",{children:"palmier pair"})," on the host machine"]}),y.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),y.jsxs("div",{className:"pair-form",children:[y.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",y.jsx("input",{id:"pair-code",type:"text",maxLength:6,value:e,onChange:x=>t(x.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:l})]}),$b&&y.jsxs("label",{className:"pair-checkbox",children:[y.jsx("input",{type:"checkbox",checked:r,onChange:x=>s(x.target.checked),disabled:l}),y.jsxs("span",{className:"pair-checkbox-text",children:[y.jsx("span",{className:"pair-checkbox-title",children:"Link the host to this device"}),y.jsx("span",{className:"pair-checkbox-hint",children:r?"The host will use this device for SMS, contacts, calendar, location, and alarms. Only one device can be linked to the host.":"This device won't provide SMS, contacts, calendar, location, or alarms to the host. You can link it later from the menu."})]})]}),c&&y.jsx("p",{className:"pair-error",children:c}),y.jsxs("button",{className:"btn btn-primary btn-full",onClick:g,disabled:l||!e.trim(),children:[l&&y.jsx("span",{className:"btn-spinner"}),l?"Pairing...":"Pair"]}),m.length>0&&y.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>b("/"),disabled:l,children:"Cancel"}),y.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",y.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",y.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function t4(){const e=Yr(),{connected:t,request:r,activeHost:s}=xi(),{setHostLanUrl:l,pairedHosts:o}=Zi(),c=o.length<=1,[f,d]=E.useState("loading"),[m,b]=E.useState(null),[g,x]=E.useState(null);function v(){e(`/hosts/${encodeURIComponent(s.hostId)}`,{replace:!0})}E.useEffect(()=>{if(!t||f!=="loading")return;let P=!1;return r("host.info").catch(()=>({})).then(I=>{if(P)return;l(s.hostId,I.lan_url??void 0);const te=I.linked_client_token??null;b(te);const q=!!te&&te!==s.clientToken;d(q?"confirming":"linking")}),()=>{P=!0}},[t,f,s,r,l]),E.useEffect(()=>{if(f!=="linking")return;let P=!1;return(async()=>{try{if(Tn){const{token:I}=await Tn.getFcmToken();if(!I)throw new Error("Could not read FCM token");await r("device.link",{fcmToken:I})}if(P)return;c?d("wizard"):v()}catch(I){if(P)return;x(I instanceof Error?I.message:String(I)),d("linkError")}})(),()=>{P=!0}},[f]);function S(){d("linking")}function A(){v()}function O(){x(null),d("linking")}const M=f==="confirming"&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:A,children:y.jsxs("div",{className:"confirm-modal",onClick:P=>P.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),y.jsx("p",{className:"confirm-modal-message",children:"Another device is already linked to this host. Only one device can be linked to the host — switching will disable those capabilities on the currently linked device."}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:A,children:"Cancel"}),y.jsx("button",{className:"btn btn-primary",onClick:S,children:"Link"})]})]})}),document.body);if(f==="loading"||f==="confirming"||f==="linking"||f==="linkError"){const P=c,I=f==="loading"||f==="confirming"||f==="linking";return y.jsxs("div",{className:"pair-setup",children:[y.jsxs("div",{className:"pair-setup-inner",children:[P&&y.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),y.jsxs("div",{className:"pair-setup-loading",children:[I&&y.jsx("span",{className:"spinner spinner-lg"}),f==="loading"&&y.jsx("span",{children:"Connecting to host…"}),f==="confirming"&&y.jsx("span",{children:"Awaiting confirmation…"}),f==="linking"&&y.jsx("span",{children:"Linking device…"}),f==="linkError"&&y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"pair-error",children:g}),y.jsx("button",{className:"btn btn-primary",onClick:O,children:"Retry"}),y.jsx("button",{className:"btn btn-secondary",onClick:v,children:"Skip linking"})]})]})]}),M]})}return y.jsx("div",{className:"pair-setup",children:y.jsxs("div",{className:"pair-setup-inner",children:[y.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),y.jsx("p",{className:"pair-setup-description",children:"Choose what the host can use this device for. You can change these later from the menu."}),y.jsx(Ix,{}),y.jsx("div",{className:"pair-setup-actions",children:y.jsx("button",{className:"btn btn-primary btn-full",onClick:v,children:"Finish"})})]})})}function n4(){const e=Yr();return E.useEffect(()=>{if(!Tn)return;const t=Tn.addListener("deepLink",({path:r})=>e(r));return()=>{t.then(r=>r.remove())}},[e]),null}function r4(){const{pairedHosts:e,lastHostId:t}=Zi();if(e.length===0)return y.jsx(Bl,{to:"/pair",replace:!0});const r=e.find(s=>s.hostId===t)??e[0];return y.jsx(Bl,{to:`/hosts/${encodeURIComponent(r.hostId)}`,replace:!0})}function i4(){const{hostId:e}=Yu(),{pairedHosts:t,setLastHostId:r}=Zi(),s=t.find(l=>l.hostId===e)??null;return E.useEffect(()=>{s&&r(s.hostId)},[s==null?void 0:s.hostId,r]),s?y.jsx(EE,{activeHost:s,children:y.jsxs(ax,{children:[y.jsx(Or,{index:!0,element:y.jsx(wu,{},e)}),y.jsx(Or,{path:"tasks",element:y.jsx(wu,{},e)}),y.jsx(Or,{path:"runs/:taskId",element:y.jsx(wu,{},e)}),y.jsx(Or,{path:"runs/:taskId/:runId",element:y.jsx(wu,{},e)}),y.jsx(Or,{path:"pair/setup",element:y.jsx(t4,{})}),y.jsx(Or,{path:"*",element:y.jsx(Bl,{to:".",replace:!0})})]})},`${s.hostId}|${s.clientToken}`):y.jsx(Bl,{to:"/",replace:!0})}function s4(){return y.jsxs(X_,{children:[y.jsx(n4,{}),y.jsxs(ax,{children:[y.jsx(Or,{path:"/",element:y.jsx(r4,{})}),y.jsx(Or,{path:"/pair",element:y.jsx(e4,{})}),y.jsx(Or,{path:"/hosts/:hostId/*",element:y.jsx(i4,{})}),y.jsx(Or,{path:"*",element:y.jsx(Bl,{to:"/",replace:!0})})]})]})}gS.createRoot(document.getElementById("root")).render(y.jsx(E.StrictMode,{children:y.jsx(z_,{children:y.jsx(s4,{})})}));export{$d as W};
|
|
120
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:d,tableRow:f}};function c(v,S,j,R){return m(b(v,j,R),v.align)}function f(v,S,j,R){const M=g(v,j,R),P=m([M]);return P.slice(0,P.indexOf(`
|
|
121
|
+
`))}function d(v,S,j,R){const M=j.enter("tableCell"),P=j.enter("phrasing"),I=j.containerPhrasing(v,{...R,before:o,after:o});return P(),M(),I}function m(v,S){return g3(v,{align:S,alignDelimiters:s,padding:r,stringLength:l})}function b(v,S,j){const R=v.children;let M=-1;const P=[],I=S.enter("table");for(;++M<R.length;)P[M]=g(R[M],S,j);return I(),P}function g(v,S,j){const R=v.children;let M=-1;const P=[],I=S.enter("tableRow");for(;++M<R.length;)P[M]=d(R[M],v,S,j);return I(),P}function x(v,S,j){let R=I1.inlineCode(v,S,j);return j.stack.includes("tableCell")&&(R=R.replace(/\|/g,"\\$&")),R}}function rO(){return{exit:{taskListCheckValueChecked:Ib,taskListCheckValueUnchecked:Ib,paragraph:sO}}}function iO(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:aO}}}function Ib(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function sO(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const s=r.children[0];if(s&&s.type==="text"){const l=t.children;let o=-1,c;for(;++o<l.length;){const f=l[o];if(f.type==="paragraph"){c=f;break}}c===r&&(s.value=s.value.slice(1),s.value.length===0?r.children.shift():r.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,r.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function aO(e,t,r,s){const l=e.children[0],o=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(s);o&&f.move(c);let d=I1.listItem(e,t,r,{...s,...f.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(b){return b+c}}function lO(){return[BT(),a3(),c3(),K3(),rO()]}function oO(e){return{extensions:[HT(),l3(e),f3(),nO(e),iO()]}}const uO={tokenize:pO,partial:!0},F1={tokenize:gO,partial:!0},$1={tokenize:yO,partial:!0},V1={tokenize:bO,partial:!0},cO={tokenize:xO,partial:!0},Y1={name:"wwwAutolink",tokenize:dO,previous:J1},G1={name:"protocolAutolink",tokenize:mO,previous:X1},vi={name:"emailAutolink",tokenize:hO,previous:K1},Jr={};function fO(){return{text:Jr}}let vs=48;for(;vs<123;)Jr[vs]=vi,vs++,vs===58?vs=65:vs===91&&(vs=97);Jr[43]=vi;Jr[45]=vi;Jr[46]=vi;Jr[95]=vi;Jr[72]=[vi,G1];Jr[104]=[vi,G1];Jr[87]=[vi,Y1];Jr[119]=[vi,Y1];function hO(e,t,r){const s=this;let l,o;return c;function c(g){return!jd(g)||!K1.call(s,s.previous)||fm(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return jd(g)?(e.consume(g),f):g===64?(e.consume(g),d):r(g)}function d(g){return g===46?e.check(cO,b,m)(g):g===45||g===95||Rn(g)?(o=!0,e.consume(g),d):b(g)}function m(g){return e.consume(g),l=!0,d}function b(g){return o&&l&&Pn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):r(g)}}function dO(e,t,r){const s=this;return l;function l(c){return c!==87&&c!==119||!J1.call(s,s.previous)||fm(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(uO,e.attempt(F1,e.attempt($1,o),r),r)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function mO(e,t,r){const s=this;let l="",o=!1;return c;function c(g){return(g===72||g===104)&&X1.call(s,s.previous)&&!fm(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(Pn(g)&&l.length<5)return l+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const x=l.toLowerCase();if(x==="http"||x==="https")return e.consume(g),d}return r(g)}function d(g){return g===47?(e.consume(g),o?m:(o=!0,d)):r(g)}function m(g){return g===null||Hu(g)||Dt(g)||_s(g)||Wu(g)?r(g):e.attempt(F1,e.attempt($1,b),r)(g)}function b(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function pO(e,t,r){let s=0;return l;function l(c){return(c===87||c===119)&&s<3?(s++,e.consume(c),l):c===46&&s===3?(e.consume(c),o):r(c)}function o(c){return c===null?r(c):t(c)}}function gO(e,t,r){let s,l,o;return c;function c(m){return m===46||m===95?e.check(V1,d,f)(m):m===null||Dt(m)||_s(m)||m!==45&&Wu(m)?d(m):(o=!0,e.consume(m),c)}function f(m){return m===95?s=!0:(l=s,s=void 0),e.consume(m),c}function d(m){return l||s||!o?r(m):t(m)}}function yO(e,t){let r=0,s=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&s<r?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(V1,t,o)(c):c===null||Dt(c)||_s(c)?t(c):(e.consume(c),l)}function o(c){return c===41&&s++,e.consume(c),l}}function bO(e,t,r){return s;function s(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),s):f===38?(e.consume(f),o):f===93?(e.consume(f),l):f===60||f===null||Dt(f)||_s(f)?t(f):r(f)}function l(f){return f===null||f===40||f===91||Dt(f)||_s(f)?t(f):s(f)}function o(f){return Pn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):Pn(f)?(e.consume(f),c):r(f)}}function xO(e,t,r){return s;function s(o){return e.consume(o),l}function l(o){return Rn(o)?r(o):t(o)}}function J1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Dt(e)}function X1(e){return!Pn(e)}function K1(e){return!(e===47||jd(e))}function jd(e){return e===43||e===45||e===46||e===95||Rn(e)}function fm(e){let t=e.length,r=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){r=!0;break}if(s._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const vO={tokenize:jO,partial:!0};function wO(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:EO,continuation:{tokenize:CO},exit:AO}},text:{91:{name:"gfmFootnoteCall",tokenize:kO},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:SO,resolveTo:_O}}}}function SO(e,t,r){const s=this;let l=s.events.length;const o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;l--;){const d=s.events[l][1];if(d.type==="labelImage"){c=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return f;function f(d){if(!c||!c._balanced)return r(d);const m=Lr(s.sliceSerialize({start:c.end,end:s.now()}));return m.codePointAt(0)!==94||!o.includes(m.slice(1))?r(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function _O(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[r+1],e[r+2],["enter",s,t],e[r+3],e[r+4],["enter",l,t],["exit",l,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(r,e.length-r+1,...f),e}function kO(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),d}function d(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(g){if(o>999||g===93&&!c||g===null||g===91||Dt(g))return r(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return l.includes(Lr(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(g)}return Dt(g)||(c=!0),o++,e.consume(g),g===92?b:m}function b(g){return g===91||g===92||g===93?(e.consume(g),o++,m):m(g)}}function EO(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o,c=0,f;return d;function d(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",b):r(S)}function b(S){if(c>999||S===93&&!f||S===null||S===91||Dt(S))return r(S);if(S===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=Lr(s.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Dt(S)||(f=!0),c++,e.consume(S),S===92?g:b}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,b):b(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),l.includes(o)||l.push(o),pt(e,v,"gfmFootnoteDefinitionWhitespace")):r(S)}function v(S){return t(S)}}function CO(e,t,r){return e.check(Ql,t,e.attempt(vO,t,r))}function AO(e){e.exit("gfmFootnoteDefinition")}function jO(e,t,r){const s=this;return pt(e,l,"gfmFootnoteDefinitionIndent",5);function l(o){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):r(o)}}function NO(e){let r=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:o,resolveAll:l};return r==null&&(r=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function l(c,f){let d=-1;for(;++d<c.length;)if(c[d][0]==="enter"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._close){let m=d;for(;m--;)if(c[m][0]==="exit"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._open&&c[d][1].end.offset-c[d][1].start.offset===c[m][1].end.offset-c[m][1].start.offset){c[d][1].type="strikethroughSequence",c[m][1].type="strikethroughSequence";const b={type:"strikethrough",start:Object.assign({},c[m][1].start),end:Object.assign({},c[d][1].end)},g={type:"strikethroughText",start:Object.assign({},c[m][1].end),end:Object.assign({},c[d][1].start)},x=[["enter",b,f],["enter",c[m][1],f],["exit",c[m][1],f],["enter",g,f]],v=f.parser.constructs.insideSpan.null;v&&ur(x,x.length,0,ec(v,c.slice(m+1,d),f)),ur(x,x.length,0,[["exit",g,f],["enter",c[d][1],f],["exit",c[d][1],f],["exit",b,f]]),ur(c,m-1,d-m+3,x),d=m+x.length-2;break}}for(d=-1;++d<c.length;)c[d][1].type==="strikethroughSequenceTemporary"&&(c[d][1].type="data");return c}function o(c,f,d){const m=this.previous,b=this.events;let g=0;return x;function x(S){return m===126&&b[b.length-1][1].type!=="characterEscape"?d(S):(c.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const j=ka(m);if(S===126)return g>1?d(S):(c.consume(S),g++,v);if(g<2&&!r)return d(S);const R=c.exit("strikethroughSequenceTemporary"),M=ka(S);return R._open=!M||M===2&&!!j,R._close=!j||j===2&&!!M,f(S)}}}class TO{constructor(){this.map=[]}add(t,r,s){OO(this,t,r,s)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let r=this.map.length;const s=[];for(;r>0;)r-=1,s.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];s.push(t.slice()),t.length=0;let l=s.pop();for(;l;){for(const o of l)t.push(o);l=s.pop()}this.map.length=0}}function OO(e,t,r,s){let l=0;if(!(r===0&&s.length===0)){for(;l<e.map.length;){if(e.map[l][0]===t){e.map[l][1]+=r,e.map[l][2].push(...s);return}l+=1}e.map.push([t,r,s])}}function RO(e,t){let r=!1;const s=[];for(;t<e.length;){const l=e[t];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=s.length-1;s[o]=s[o]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return s}function MO(){return{flow:{null:{name:"table",tokenize:DO,resolveAll:LO}}}}function DO(e,t,r){const s=this;let l=0,o=0,c;return f;function f(L){let J=s.events.length-1;for(;J>-1;){const le=s.events[J][1].type;if(le==="lineEnding"||le==="linePrefix")J--;else break}const $=J>-1?s.events[J][1].type:null,he=$==="tableHead"||$==="tableRow"?N:d;return he===N&&s.parser.lazy[s.now().line]?r(L):he(L)}function d(L){return e.enter("tableHead"),e.enter("tableRow"),m(L)}function m(L){return L===124||(c=!0,o+=1),b(L)}function b(L){return L===null?r(L):Fe(L)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),v):r(L):ut(L)?pt(e,b,"whitespace")(L):(o+=1,c&&(c=!1,l+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),c=!0,b):(e.enter("data"),g(L)))}function g(L){return L===null||L===124||Dt(L)?(e.exit("data"),b(L)):(e.consume(L),L===92?x:g)}function x(L){return L===92||L===124?(e.consume(L),g):g(L)}function v(L){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(L):(e.enter("tableDelimiterRow"),c=!1,ut(L)?pt(e,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):S(L))}function S(L){return L===45||L===58?R(L):L===124?(c=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),j):q(L)}function j(L){return ut(L)?pt(e,R,"whitespace")(L):R(L)}function R(L){return L===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),M):L===45?(o+=1,M(L)):L===null||Fe(L)?ue(L):q(L)}function M(L){return L===45?(e.enter("tableDelimiterFiller"),P(L)):q(L)}function P(L){return L===45?(e.consume(L),P):L===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(L))}function I(L){return ut(L)?pt(e,ue,"whitespace")(L):ue(L)}function ue(L){return L===124?S(L):L===null||Fe(L)?!c||l!==o?q(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):q(L)}function q(L){return r(L)}function N(L){return e.enter("tableRow"),ee(L)}function ee(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),ee):L===null||Fe(L)?(e.exit("tableRow"),t(L)):ut(L)?pt(e,ee,"whitespace")(L):(e.enter("data"),G(L))}function G(L){return L===null||L===124||Dt(L)?(e.exit("data"),ee(L)):(e.consume(L),L===92?B:G)}function B(L){return L===92||L===124?(e.consume(L),G):G(L)}}function LO(e,t){let r=-1,s=!0,l=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,d=0,m,b,g;const x=new TO;for(;++r<e.length;){const v=e[r],S=v[1];v[0]==="enter"?S.type==="tableHead"?(f=!1,d!==0&&(Fb(x,t,d,m,b),b=void 0,d=0),m={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",m,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(s=!0,g=void 0,o=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,b={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",b,t]])),l=S.type==="tableDelimiterRow"?2:b?3:1):l&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],g=xu(x,t,o,l,void 0,g),o=[0,0,0,0]),c[2]=r)):S.type==="tableCellDivider"&&(s?s=!1:(o[1]!==0&&(c[0]=c[1],g=xu(x,t,o,l,void 0,g)),o=c,c=[o[1],r,0,0])):S.type==="tableHead"?(f=!0,d=r):S.type==="tableRow"||S.type==="tableDelimiterRow"?(d=r,o[1]!==0?(c[0]=c[1],g=xu(x,t,o,l,r,g)):c[1]!==0&&(g=xu(x,t,c,l,r,g)),l=0):l&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=r)}for(d!==0&&Fb(x,t,d,m,b),x.consume(t.events),r=-1;++r<t.events.length;){const v=t.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=RO(t.events,r))}return e}function xu(e,t,r,s,l,o){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(o.end=Object.assign({},ca(t.events,r[0])),e.add(r[0],0,[["exit",o,t]]));const d=ca(t.events,r[1]);if(o={type:c,start:Object.assign({},d),end:Object.assign({},d)},e.add(r[1],0,[["enter",o,t]]),r[2]!==0){const m=ca(t.events,r[2]),b=ca(t.events,r[3]),g={type:f,start:Object.assign({},m),end:Object.assign({},b)};if(e.add(r[2],0,[["enter",g,t]]),s!==2){const x=t.events[r[2]],v=t.events[r[3]];if(x[1].end=Object.assign({},v[1].end),x[1].type="chunkText",x[1].contentType="text",r[3]>r[2]+1){const S=r[2]+1,j=r[3]-r[2]-1;e.add(S,j,[])}}e.add(r[3]+1,0,[["exit",g,t]])}return l!==void 0&&(o.end=Object.assign({},ca(t.events,l)),e.add(l,0,[["exit",o,t]]),o=void 0),o}function Fb(e,t,r,s,l){const o=[],c=ca(t.events,r);l&&(l.end=Object.assign({},c),o.push(["exit",l,t])),s.end=Object.assign({},c),o.push(["exit",s,t]),e.add(r+1,0,o)}function ca(e,t){const r=e[t],s=r[0]==="enter"?"start":"end";return r[1][s]}const zO={name:"tasklistCheck",tokenize:PO};function UO(){return{text:{91:zO}}}function PO(e,t,r){const s=this;return l;function l(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),o)}function o(d){return Dt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),c):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),c):r(d)}function c(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(d)}function f(d){return Fe(d)?t(d):ut(d)?e.check({tokenize:BO},t,r)(d):r(d)}}function BO(e,t,r){return pt(e,s,"whitespace");function s(l){return l===null?r(l):t(l)}}function HO(e){return i1([fO(),wO(),NO(e),MO(),UO()])}const qO={};function IO(e){const t=this,r=e||qO,s=t.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),o=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(HO(r)),o.push(lO()),c.push(oO(r))}function FO(e){A1(e,[/\r?\n|\r/g,$O])}function $O(){return{type:"break"}}function VO(){return function(e){FO(e)}}const hm=E.createContext(null);function Q1(e,t){const r=C1(t);return e&&r!==null?jT(r,e.baseFile):null}function YO({node:e,href:t,...r}){const s=E.useContext(hm),l=Q1(s,t);return!s||l===null?y.jsx("a",{...r,href:t,target:"_blank",rel:"noopener noreferrer"}):y.jsx("a",{...r,href:t,className:"md-file-link",onClick:o=>{o.preventDefault(),s.openFile(l)}})}function GO({node:e,src:t,alt:r,...s}){const l=E.useContext(hm),o=Q1(l,typeof t=="string"?t:void 0),[c,f]=E.useState(),[d,m]=E.useState(!1),b=l==null?void 0:l.loadFile;return E.useEffect(()=>{if(o===null||!b)return;let g=!1,x;return m(!1),b(o).then(v=>{g||(x=URL.createObjectURL(v),f(x))}).catch(()=>{g||m(!0)}),()=>{g=!0,x&&URL.revokeObjectURL(x)}},[o,b]),!l||o===null?y.jsx("img",{...s,src:t,alt:r}):d?y.jsx("span",{className:"md-image-missing",children:r||o}):c?y.jsx("img",{...s,src:c,alt:r,className:"md-file-image",onClick:()=>l.openFile(o)}):y.jsx("span",{className:"md-image-loading skeleton-line"})}const JO={a:YO,img:GO};function Z1({content:e,files:t,baseFile:r}){const s=E.useMemo(()=>({openFile:t.openFile,loadFile:t.loadFile,baseFile:r}),[t.openFile,t.loadFile,r]);return y.jsx(hm.Provider,{value:s,children:y.jsx(wT,{remarkPlugins:[IO,VO],urlTransform:CT,components:JO,children:e})})}function XO({filePath:e,files:t,onClose:r}){const[s,l]=E.useState(null),[o,c]=E.useState(null),{loadFile:f}=t;E.useEffect(()=>{let b=!1,g;return l(null),c(null),(async()=>{try{const x=await f(e),v=MT(x.type),S={kind:v,size:x.size};if(v==="markdown"||v==="text"||v==="html"?S.text=await x.text():(g=URL.createObjectURL(x),S.objectUrl=g),b){g&&URL.revokeObjectURL(g);return}l(S)}catch(x){b||c(x instanceof Error?x.message:"Failed to load file.")}})(),()=>{b=!0,g&&URL.revokeObjectURL(g)}},[e,f]);const d=NT(e);function m(){if(o)return y.jsx("p",{className:"file-viewer-message",children:o});if(!s)return y.jsxs("div",{className:"file-viewer-loading",children:[y.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem"}})]});switch(s.kind){case"markdown":return y.jsx(Z1,{content:s.text??"",files:t,baseFile:e});case"text":return y.jsx("pre",{className:"file-viewer-text",children:s.text});case"html":return y.jsx("iframe",{className:"file-viewer-frame",sandbox:"",srcDoc:s.text,title:d});case"image":return y.jsx("img",{src:s.objectUrl,alt:d,style:{maxWidth:"100%",height:"auto"}});case"binary":return Jn.isNativePlatform()?y.jsx("p",{className:"file-viewer-message",children:"Downloading this file type isn't supported in the app yet."}):y.jsxs("div",{className:"file-viewer-download",children:[y.jsxs("p",{className:"file-viewer-message",children:["This file can't be previewed (",DT(s.size),")."]}),y.jsx("a",{className:"btn btn-primary",href:s.objectUrl,download:d,children:"Download"})]})}}return y.jsx("div",{className:"report-dialog-overlay",onClick:r,children:y.jsxs("div",{className:"report-dialog",onClick:b=>b.stopPropagation(),children:[y.jsxs("div",{className:"report-dialog-header",children:[y.jsx("span",{className:"report-dialog-title",children:d}),y.jsx("button",{className:"report-dialog-close",onClick:r,"aria-label":"Close",children:y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),y.jsx("div",{className:`report-dialog-body${(s==null?void 0:s.kind)==="html"?" report-dialog-body--frame":""}`,children:m()})]})})}function KO({connected:e,hostId:t,request:r,subscribeEvents:s,taskId:l,runId:o}){const c=Gr(),f=Yd(),[d,m]=E.useState(!0),[b,g]=E.useState([]),[x,v]=E.useState(),[S,j]=E.useState(),[R,M]=E.useState(),[P,I]=E.useState(!1),ue=x==="started",q=x==="followup",N=x==="started"||x==="followup",[ee,G]=E.useState(null);yd(ee!==null,()=>G(null));const[B,L]=E.useState(!1),[J,$]=E.useState(""),[he,le]=E.useState(!1),te=E.useRef(null),V=E.useRef(null),Q=E.useRef(null),[X,xe]=E.useState(o==="latest"?void 0:o),A=o==="latest"&&X===null;E.useEffect(()=>{if(o!=="latest"){xe(o);return}e&&(xe(void 0),r("taskrun.list",{task_id:l,limit:1}).then(ce=>{var Ae,ke;return xe(((ke=(Ae=ce.entries)==null?void 0:Ae[0])==null?void 0:ke.run_id)??null)}).catch(()=>xe(null)))},[o,l,e,r]);async function z(){if(X)try{const ce=await r("task.result",{id:l,run_id:X});if(ce.error){console.error("No result:",ce.error),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0});return}g(ce.messages??[]),v(ce.running_state),j(ce.agent),M(ce.agent_version),I(!!ce.starred)}catch(ce){console.error("Failed to load result:",ce),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0})}finally{m(!1)}}async function W(){if(!X)return;const ce=!P;I(ce);try{const Ae=await r("taskrun.star",{task_id:l,run_id:X,starred:ce});if(Ae.error)throw new Error(Ae.error)}catch(Ae){console.error("Failed to update star:",Ae),I(!ce)}}const T=E.useCallback(ce=>X?OT(r,l,X,ce):Promise.reject(new Error("Run not loaded.")),[r,l,X]),ve=E.useMemo(()=>({openFile:G,loadFile:T}),[T]);E.useEffect(()=>{!e||!X||(m(!0),z())},[e,l,X]),E.useEffect(()=>!e||!t||!X?void 0:s(t,async Ae=>{try{const ke=JSON.parse(new TextDecoder().decode(Ae.data));if(ke.event_type!=="running-state"&&ke.event_type!=="result-updated"||Ae.subject.split(".").pop()!==l||ke.event_type==="result-updated"&&ke.run_id&&ke.run_id!==X)return;z()}catch{}}),[e,t,l,X,s,r]),E.useEffect(()=>{te.current&&(te.current.scrollTop=te.current.scrollHeight)},[b]),E.useEffect(()=>{d||A||!X||Q.current!==X&&(Q.current=X,requestAnimationFrame(()=>{te.current&&(te.current.scrollTop=te.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"})}))},[d,A,X]);function je(ce){if(ce==="input")return"User Input";if(ce==="permission")return"Permission";if(ce==="confirmation")return"Confirmation"}function Ne(ce){return ce==="started"?"Task started":ce==="finished"?"Task finished":ce==="failed"?"Task failed":ce==="error"?"Command failed":ce==="aborted"?"Task aborted":ce==="confirmation"?"Task confirmed":ce==="stopped"?"Follow-up stopped":ce??""}return y.jsxs("div",{className:"run-detail",children:[y.jsxs("div",{className:"run-detail-header",children:[y.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:y.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),!d&&!A&&y.jsx(Fx,{starred:P,onToggle:W})]}),A?y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"No runs yet"}),y.jsx("p",{className:"empty-state-hint",children:"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger."})]}):d?y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[y.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"chat-thread",ref:te,children:[b.map((ce,Ae)=>{const ke=N&&ce.role==="assistant"&&!b.slice(Ae+1).some(Qe=>Qe.role==="assistant"||Qe.role==="user");return ce.role==="status"?y.jsxs("div",{className:`chat-status${ce.type==="error"?" chat-status--error":""}`,children:[y.jsxs("div",{children:[Ne(ce.type),ce.time>0&&y.jsx("span",{className:"chat-status-time",children:f(ce.time)})]}),ce.content&&y.jsx("pre",{className:"chat-status-detail",children:ce.content})]},Ae):y.jsxs("div",{className:`chat-message chat-message--${ce.role}${ce.role==="assistant"&&ce.stream==="stderr"?" chat-message--stderr":""}`,children:[ce.role==="assistant"&&S&&y.jsxs("div",{className:"chat-message-agent",children:[gd(S),R&&y.jsxs("span",{className:"chat-message-agent-version",children:[" v",R]}),ce.model&&y.jsxs("span",{className:"chat-message-agent-model",children:[" · ",ce.model]})]}),y.jsxs("div",{className:"chat-message-content",children:[y.jsx(Z1,{content:ce.content,files:ve}),ke&&y.jsxs("div",{className:"chat-typing-indicator",children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]})]}),ce.attachments&&ce.attachments.length>0&&y.jsx("div",{className:"chat-message-attachments",children:ce.attachments.map(Qe=>y.jsx("button",{className:"chat-attachment-chip",onClick:()=>G(Qe),children:Qe},Qe))}),y.jsxs("div",{className:"chat-message-meta",children:[je(ce.type)&&y.jsx("span",{className:"chat-message-type",children:je(ce.type)}),ce.time>0&&y.jsx("span",{children:f(ce.time)})]})]},Ae)}),N&&(()=>{const ce=b.filter(Ae=>Ae.role!=="status");return ce.length===0||ce[ce.length-1].role!=="assistant"})()&&y.jsxs("div",{className:"chat-message chat-message--assistant",children:[S&&y.jsxs("div",{className:"chat-message-agent",children:[gd(S),R&&y.jsxs("span",{className:"chat-message-agent-version",children:[" v",R]})]}),y.jsxs("div",{className:"chat-typing-indicator",children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]})]})]}),ue||q?y.jsx("div",{className:"chat-input-bar",children:y.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:B,"aria-label":"Abort task",onClick:async()=>{if(confirm("Abort this task?")){L(!0);try{await r("task.abort",{id:l})}catch(ce){console.error("Abort failed:",ce)}finally{L(!1)}}},children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):y.jsxs("form",{className:"chat-input-bar",onSubmit:async ce=>{ce.preventDefault();const Ae=J.trim();if(!(!Ae||he)){le(!0);try{await r("task.followup",{id:l,run_id:X,message:Ae}),$("")}catch(ke){console.error("Follow-up failed:",ke)}finally{le(!1)}}},children:[y.jsx("input",{ref:V,className:"chat-input",type:"text",placeholder:"Follow-up message",value:J,onChange:ce=>$(ce.target.value),disabled:he}),y.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!J.trim()||he,children:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),y.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),y.jsxs("button",{className:"run-detail-back run-detail-back--footer",onClick:()=>c(-1),children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:y.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]})]}),ee&&y.jsx(XO,{filePath:ee,files:ve,onClose:()=>G(null)})]})}function Zh({title:e,message:t,onUpdate:r,onDismiss:s}){return y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:e}),y.jsx("p",{className:"confirm-modal-message",children:t}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-primary",onClick:r,children:"Update Now"}),s&&y.jsx("button",{className:"btn btn-secondary",onClick:s,children:"Dismiss"})]})]})})}function QO(){const{activeHost:e}=xi(),t=E.useRef(null);E.useEffect(()=>{if(Jn.isNativePlatform()||e.directUrl||t.current===e.hostId)return;async function r(){var s;try{if(!("serviceWorker"in navigator)||!("PushManager"in window)){console.warn("[Push] Push notifications not supported");return}const l=await navigator.serviceWorker.ready;(s=l.active)==null||s.postMessage({type:"set-host-id",hostId:e.hostId});let o=await l.pushManager.getSubscription();if(!o){const{publicKey:f}=await wE("/api/push/vapid-key");if(!f){console.warn("[Push] No VAPID public key configured on server");return}if(await Notification.requestPermission()!=="granted"){console.log("[Push] Permission denied");return}o=await l.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:f})}const c=o.toJSON();await vE("/api/push/subscribe",{hostId:e.hostId,endpoint:c.endpoint,keys:{p256dh:c.keys.p256dh,auth:c.keys.auth}}),t.current=e.hostId}catch(l){console.error("[Push] Subscription failed:",l)}}r()},[e])}const ZO="0.9.9";function vu(e,t){if(e.includes("-"))return!1;const r=e.split(".").map(Number),s=t.split(".").map(Number);for(let l=0;l<3;l++){if((r[l]??0)<(s[l]??0))return!0;if((r[l]??0)>(s[l]??0))return!1}return!1}function wu(){const{removePairedHost:e,setHostLanUrl:t,setHostTimezone:r}=Zi(),{connected:s,request:l,subscribeEvents:o,unauthorized:c,activeHost:f}=xi(),d=f.hostId,m=f.clientToken||null,b=Gr(),g=Er(),x=Yu(),v=qx("(min-width: 768px)"),S=g.pathname.endsWith("/tasks"),j=x.runId?void 0:x.taskId,R=!!(x.taskId&&x.runId),[M,P]=E.useState(!1),[I,ue]=E.useState(!1),[q,N]=E.useState(null),[ee,G]=E.useState(null),[B,L]=E.useState(null),[J,$]=E.useState(null),[he,le]=E.useState({}),[te,V]=E.useState({}),[Q,X]=E.useState(null),[xe,A]=E.useState(null),[z,W]=E.useState(null),[T,ve]=E.useState(null),[je,Ne]=E.useState(new Set),[ce,Ae]=E.useState([]),[ke,Qe]=E.useState(),[Lt,dn]=E.useState("loading"),tn=!!m&&T===m,[Ft,$t]=E.useState(new Map),[an,bn]=E.useState(new Map),[Be,nt]=E.useState(new Map),[st,Ot]=E.useState(new Map),[_t,mn]=E.useState(new Map),[at,Cr]=E.useState(new Map),[ae,_e]=E.useState(new Map),[Me,Ge]=E.useState(new Map);QO(),E.useEffect(()=>{window.scrollTo(0,0)},[d]),E.useEffect(()=>{let de=!1;return eC().then(Ee=>{de||Ne(Ee)}),()=>{de=!0}},[]),E.useEffect(()=>{if(!s){dn("loading");return}dn("loading");let de=!1;return l("host.info",void 0,{timeout:15e3}).then(Ee=>{var We,Zt,Qt,Rt,ft,Bt,jn,Pr,wi;if(de)return;Ae(Ee.agents??[]),X(Ee.playwright_cli??null),Qe(Ee.host_platform),ve(Ee.linked_client_token??null),LE(Ee.agents??[]);const He=Ee.version??null;G(He),P(!!He&&vu(He,ZO)),t(d,Ee.lan_url??void 0),r(d,Ee.host_timezone);const Ve=new Map,qe=new Map,ct=new Map,Xe=new Map,Pe=new Map;for(const Ut of Ee.pending_prompts??[])if(Ut.type==="confirmation")Ve.set(Ut.key,{description:((We=Ut.meta)==null?void 0:We.description)??"",sessionName:(Zt=Ut.meta)==null?void 0:Zt.session_name});else if(Ut.type==="choice")qe.set(Ut.key,{question:((Qt=Ut.meta)==null?void 0:Qt.description)??"",options:Ut.params??[],sessionName:(Rt=Ut.meta)==null?void 0:Rt.session_name});else if(Ut.type==="permission")ct.set(Ut.key,{permissions:Ut.params??[],sessionName:(ft=Ut.meta)==null?void 0:ft.session_name});else if(Ut.type==="input"){const ns=Ut.params??((Bt=Ut.meta)==null?void 0:Bt.input_questions)??[];Xe.set(Ut.key,{questions:ns,description:(jn=Ut.meta)==null?void 0:jn.description,sessionName:(Pr=Ut.meta)==null?void 0:Pr.session_name,secret:(wi=Ut.meta)==null?void 0:wi.secret}),Pe.set(Ut.key,new Array(ns.length).fill(""))}$t(Ve),bn(qe),nt(ct),Ot(Xe),mn(Pe),dn("ready")}).catch(()=>{de||dn("error")}),()=>{de=!0}},[s,d,l,t,r]),E.useEffect(()=>s?o(d,Ee=>{const He=Ee.subject.split(".");if(He.length<3)return;const Ve=He.slice(2).join(".");let qe={};try{qe=JSON.parse(new TextDecoder().decode(Ee.data))}catch{return}const ct=qe.event_type,Xe=qe.session_id;if(ct==="input-request"&&Xe){const Pe=qe.input_questions,We=qe.session_name,Zt=qe.description,Qt=qe.secret;Pe!=null&&Pe.length&&(Ot(Rt=>{if(Rt.has(Xe))return Rt;const ft=new Map(Rt);return ft.set(Xe,{questions:Pe,description:Zt,sessionName:We,secret:Qt}),ft}),mn(Rt=>{if(Rt.has(Xe))return Rt;const ft=new Map(Rt);return ft.set(Xe,new Array(Pe.length).fill("")),ft}));return}if(ct==="input-resolved"&&Xe){Ot(Pe=>{if(!Pe.has(Xe))return Pe;const We=new Map(Pe);return We.delete(Xe),We}),mn(Pe=>{const We=new Map(Pe);return We.delete(Xe),We}),Cr(Pe=>{if(!Pe.has(Xe))return Pe;const We=new Map(Pe);return We.delete(Xe),We});return}if(ct==="confirm-request"&&Xe){const Pe=qe.description,We=qe.session_name;Pe&&$t(Zt=>{if(Zt.has(Xe))return Zt;const Qt=new Map(Zt);return Qt.set(Xe,{description:Pe,sessionName:We}),Qt});return}if(ct==="confirm-resolved"&&Xe){$t(Pe=>{if(!Pe.has(Xe))return Pe;const We=new Map(Pe);return We.delete(Xe),We});return}if(ct==="choice-request"&&Xe){const Pe=qe.description,We=qe.options,Zt=qe.session_name;Pe&&(We!=null&&We.length)&&bn(Qt=>{if(Qt.has(Xe))return Qt;const Rt=new Map(Qt);return Rt.set(Xe,{question:Pe,options:We,sessionName:Zt}),Rt});return}if(ct==="choice-resolved"&&Xe){bn(Pe=>{if(!Pe.has(Xe))return Pe;const We=new Map(Pe);return We.delete(Xe),We});return}if(ct==="permission-request"){const Pe=qe.required_permissions,We=qe.session_name;Pe!=null&&Pe.length&&nt(Zt=>{if(Zt.has(Ve))return Zt;const Qt=new Map(Zt);return Qt.set(Ve,{permissions:Pe,sessionName:We}),Qt});return}if(ct==="permission-resolved"){nt(Pe=>{if(!Pe.has(Ve))return Pe;const We=new Map(Pe);return We.delete(Ve),We});return}}):void 0,[s,d,o]);async function rt(de,Ee,He,Ve){if(!ae.has(de)){_e(qe=>new Map(qe).set(de,Ee)),Ge(qe=>{const ct=new Map(qe);return ct.delete(de),ct});try{await l("task.user_input",{id:de,value:He},{timeout:3e4}),Ve()}catch(qe){console.error("[Dashboard] Failed to send user input:",qe),Ge(ct=>new Map(ct).set(de,"Couldn't reach the host. Try again."))}finally{_e(qe=>{const ct=new Map(qe);return ct.delete(de),ct})}}}function zt(de,Ee){rt(de,Ee,[Ee],()=>{$t(He=>{const Ve=new Map(He);return Ve.delete(de),Ve})})}function Sn(de,Ee){rt(de,Ee,[Ee],()=>{bn(He=>{const Ve=new Map(He);return Ve.delete(de),Ve})})}function Kt(de,Ee){rt(de,Ee,[Ee],()=>{nt(He=>{const Ve=new Map(He);return Ve.delete(de),Ve})})}function yt(de,Ee,He){rt(de,Ee,He,()=>{Ot(Ve=>{const qe=new Map(Ve);return qe.delete(de),qe}),mn(Ve=>{const qe=new Map(Ve);return qe.delete(de),qe}),Cr(Ve=>{const qe=new Map(Ve);return qe.delete(de),qe})})}function Vt(de,Ee){if(!Ss())return;const He=`/hosts/${encodeURIComponent(d)}/runs/${encodeURIComponent(de)}`;b(Ee?`${He}/${encodeURIComponent(Ee)}`:He)}E.useEffect(()=>{if(!ee)return;let de=!1;return fetch("https://registry.npmjs.org/palmier/latest").then(Ee=>Ee.ok?Ee.json():null).then(Ee=>{!de&&(Ee!=null&&Ee.version)&&L(Ee.version)}).catch(()=>{}),()=>{de=!0}},[ee]),E.useEffect(()=>{let de=!1;for(const Ee of ce)!Ee.version||!Ee.npmPackage||fetch(`https://registry.npmjs.org/${Ee.npmPackage}/latest`).then(He=>He.ok?He.json():null).then(He=>{de||!(He!=null&&He.version)||le(Ve=>Ve[Ee.key]===He.version?Ve:{...Ve,[Ee.key]:He.version})}).catch(()=>{});return()=>{de=!0}},[ce]);const Ze=ce.find(de=>{if(!de.version)return!1;const Ee=he[de.key];return!Ee||!vu(de.version,Ee)?!1:te[de.key]!==Ee});function An(de,Ee){V(He=>({...He,[de]:Ee}))}async function pn(de){ue("agent"),N(null);try{const Ee=await l("host.updateAgent",{key:de});if(Ee.error){N(Ee.error),ue(!1);return}const He=await l("host.info");He.agents&&Ae(He.agents)}catch(Ee){N(Ee instanceof Error?Ee.message:String(Ee))}finally{ue(!1)}}E.useEffect(()=>{if(!(Q!=null&&Q.npmPackage))return;let de=!1;return fetch(`https://registry.npmjs.org/${Q.npmPackage}/latest`).then(Ee=>Ee.ok?Ee.json():null).then(Ee=>{!de&&(Ee!=null&&Ee.version)&&A(Ee.version)}).catch(()=>{}),()=>{de=!0}},[Q==null?void 0:Q.npmPackage,Q==null?void 0:Q.version]);const Kn=Q&&xe&&vu(Q.version,xe)&&z!==xe?Q:null;function we(de){W(de)}async function Ye(){ue("playwright"),N(null);try{const de=await l("host.updatePlaywrightCli");if(de.error){N(de.error),ue(!1);return}const Ee=await l("host.info");X(Ee.playwright_cli??null)}catch(de){N(de instanceof Error?de.message:String(de))}finally{ue(!1)}}const Re=!M&&!!ee&&!!B&&vu(ee,B)&&J!==B;function bt(){B&&$(B)}async function ln(){ue("daemon"),N(null);try{const de=await l("host.update");if(de.error){N(de.error),ue(!1);return}}catch{}setTimeout(()=>window.location.reload(),3e4)}const Hn=Ft.size>0||an.size>0||Be.size>0||st.size>0,ts=s&&!c;return y.jsxs("div",{className:"dashboard",children:[v&&y.jsx(Q0,{daemonVersion:ee,agents:ce,playwrightCli:Q,linkedClientToken:T,request:l,onEnabledCapabilitiesChange:Ne,onLinkedClientTokenChange:ve}),y.jsxs("div",{className:"dashboard-content",children:[y.jsxs("header",{className:"app-header",children:[y.jsxs("div",{className:"app-title-bar",children:[!v&&y.jsx(Q0,{daemonVersion:ee,agents:ce,playwrightCli:Q,linkedClientToken:T,request:l,onEnabledCapabilitiesChange:Ne,onLinkedClientTokenChange:ve}),y.jsx("h1",{className:"app-title",children:"Palmier"}),y.jsx(aC,{})]}),y.jsx("div",{className:"tab-bar",children:y.jsx(QE,{})})]}),y.jsx("main",{className:"dashboard-main",children:c?y.jsxs("div",{className:"revoked-state",children:[y.jsx("div",{className:"revoked-icon",children:y.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),y.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),y.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),y.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),y.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),y.jsx("div",{className:"revoked-command",children:y.jsx("code",{children:"palmier pair"})}),y.jsxs("div",{className:"revoked-actions",children:[y.jsx("button",{className:"btn btn-primary",onClick:()=>{Ss()&&b("/pair")},children:"Re-pair Device"}),y.jsx("button",{className:"btn btn-secondary",onClick:()=>{e(d),b("/",{replace:!0})},children:"Remove Host"})]})]}):ts?y.jsxs(y.Fragment,{children:[S&&!R&&y.jsx(KE,{connected:s,hostId:d,request:l,subscribeEvents:o,agents:ce,hostPlatform:ke,isNotificationListener:tn&&je.has("notifications"),onViewRun:Vt,hostInfoStatus:Lt}),R?y.jsx(KO,{connected:s,hostId:d,request:l,subscribeEvents:o,taskId:x.taskId,runId:decodeURIComponent(x.runId)}):S?null:y.jsx(cC,{connected:s,hostId:d,request:l,subscribeEvents:o,agents:ce,hostPlatform:ke,filterTaskId:j,onClearFilter:()=>{Ss()&&b(`/hosts/${encodeURIComponent(d)}`)},hostInfoStatus:Lt})]}):y.jsx("div",{className:"empty-state",children:y.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})})}),(M||Re)&&!I&&!q&&!Hn&&y.jsx(Zh,{title:M?"Update Required":"Update Available",message:M?`Your Palmier host${ee?` (v${ee})`:""} is too old for this version of the app. Please update to continue.`:`A new version of Palmier (v${B}) is available. You're running v${ee}.`,onUpdate:ln,onDismiss:M?void 0:bt}),!M&&!Re&&Ze&&!I&&!q&&!Hn&&y.jsx(Zh,{title:"Agent Update Available",message:`A new version of ${Ze.label} (v${he[Ze.key]}) is available. You're running v${Ze.version}.`,onUpdate:()=>pn(Ze.key),onDismiss:()=>An(Ze.key,he[Ze.key])}),!M&&!Re&&!Ze&&Kn&&xe&&!I&&!q&&!Hn&&y.jsx(Zh,{title:"Browser Automation Update Available",message:`A new version of ${Kn.label} (v${xe}) is available. You're running v${Kn.version}.`,onUpdate:Ye,onDismiss:()=>we(xe)}),I&&y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),y.jsx("p",{className:"confirm-modal-message",children:I==="daemon"?"Installing update and restarting daemon. Please wait...":"Installing update. Please wait..."})]})}),q&&y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),y.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:q}),y.jsx("div",{className:"confirm-modal-actions",children:y.jsx("button",{className:"btn btn-secondary",onClick:()=>{N(null)},children:"Retry"})})]})})]}),pi.createPortal(y.jsxs(y.Fragment,{children:[[...Ft.entries()].map(([de,{description:Ee,sessionName:He}])=>y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),He&&y.jsx("p",{className:"confirm-modal-subtitle",children:He}),y.jsx("p",{className:"confirm-modal-message",children:Ee}),Me.has(de)&&y.jsx("p",{className:"form-error",children:Me.get(de)}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsxs("button",{className:"btn btn-primary",disabled:ae.has(de),onClick:()=>zt(de,"confirmed"),children:[ae.get(de)==="confirmed"&&y.jsx("span",{className:"btn-spinner"}),"Confirm"]}),y.jsxs("button",{className:"btn btn-secondary",disabled:ae.has(de),onClick:()=>zt(de,"aborted"),children:[ae.get(de)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort"]})]})]})},de)),[...an.entries()].map(([de,{question:Ee,options:He,sessionName:Ve}])=>y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Question"}),Ve&&y.jsx("p",{className:"confirm-modal-subtitle",children:Ve}),y.jsx("p",{className:"confirm-modal-message",children:Ee}),Me.has(de)&&y.jsx("p",{className:"form-error",children:Me.get(de)}),y.jsx("div",{className:`confirm-modal-actions${He.length===2&&He.every(qe=>qe.length<=16)?"":" choice-options-stacked"}`,children:He.map((qe,ct)=>y.jsxs("button",{className:"btn btn-secondary",disabled:ae.has(de),onClick:()=>Sn(de,String(ct)),children:[ae.get(de)===String(ct)&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),qe]},ct))}),y.jsxs("button",{className:"permission-abort-link",disabled:ae.has(de),onClick:()=>Sn(de,"aborted"),children:[ae.get(de)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort Task"]})]})},de)),[...Be.entries()].map(([de,{permissions:Ee,sessionName:He}])=>y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal permission-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),y.jsx("p",{className:"confirm-modal-message",children:y.jsx("strong",{children:He||de})}),y.jsx("div",{className:"permission-list",children:Ee.map((Ve,qe)=>y.jsxs("div",{className:"permission-item",children:[y.jsx("span",{className:"permission-name",children:Ve.name}),Ve.description&&y.jsx("span",{className:"permission-desc",children:Ve.description})]},qe))}),Me.has(de)&&y.jsx("p",{className:"form-error",children:Me.get(de)}),y.jsxs("div",{className:"permission-actions",children:[y.jsxs("button",{className:"btn btn-primary",disabled:ae.has(de),onClick:()=>Kt(de,"granted"),children:[ae.get(de)==="granted"&&y.jsx("span",{className:"btn-spinner"}),"Allow Once"]}),y.jsxs("button",{className:"btn btn-secondary",disabled:ae.has(de),onClick:()=>Kt(de,"granted_all"),children:[ae.get(de)==="granted_all"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Allow Always"]})]}),y.jsxs("button",{className:"permission-abort-link",disabled:ae.has(de),onClick:()=>Kt(de,"aborted"),children:[ae.get(de)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Deny & Abort Task"]})]})},de)),[...st.entries()].map(([de,{questions:Ee,description:He,sessionName:Ve,secret:qe}])=>{const ct=_t.get(de)??new Array(Ee.length).fill("");return y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal input-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:qe?"Password Required":"Input Required"}),Ve&&y.jsx("p",{className:"confirm-modal-subtitle",children:Ve}),He&&y.jsx("p",{className:"confirm-modal-message",children:He}),y.jsx("div",{className:"input-list",children:Ee.map((Xe,Pe)=>y.jsxs("div",{className:"input-item",children:[y.jsx("label",{className:"input-label",children:Xe}),y.jsx("input",{type:qe?"password":"text",autoComplete:qe?"off":void 0,className:"input-field",value:ct[Pe]??"",onChange:We=>{mn(Zt=>{const Qt=new Map(Zt),Rt=[...Qt.get(de)??[]];return Rt[Pe]=We.target.value,Qt.set(de,Rt),Qt})},disabled:ae.has(de),autoFocus:Pe===0})]},Pe))}),qe&&y.jsxs("label",{className:"toggle-label input-save-toggle",children:[y.jsx("input",{type:"checkbox",checked:at.get(de)??!0,disabled:ae.has(de),onChange:Xe=>Cr(Pe=>new Map(Pe).set(de,Xe.target.checked))}),"Save this password"]}),Me.has(de)&&y.jsx("p",{className:"form-error",children:Me.get(de)}),y.jsx("div",{className:"input-actions",children:y.jsxs("button",{className:"btn btn-primary",disabled:ae.has(de)||ct.some(Xe=>!Xe.trim()),onClick:()=>{const Xe=qe?[...ct,at.get(de)??!0?"save":"nosave"]:ct;yt(de,"submit",Xe)},children:[ae.get(de)==="submit"&&y.jsx("span",{className:"btn-spinner"}),"Submit"]})}),y.jsxs("button",{className:"permission-abort-link",disabled:ae.has(de),onClick:()=>yt(de,"aborted",["aborted"]),children:[ae.get(de)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort"]})]})},de)})]}),document.body)]})}const WO=ks("Preferences",{web:()=>Vd(()=>import("./web-BQcwgjLy.js"),[]).then(e=>new e.PreferencesWeb)}),Al=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),$b=Jn.isNativePlatform();function e4(){const[e,t]=E.useState(""),[r,s]=E.useState(!0),[l,o]=E.useState(!1),[c,f]=E.useState(null),{addPairedHost:d,pairedHosts:m}=Zi(),b=Gr();async function g(){const x=e.trim().toUpperCase();if(!x){f("Enter a pairing code.");return}o(!0),f(null);try{let v;if(Al){const R=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:x,label:navigator.userAgent})});if(!R.ok){const M=await R.json().catch(()=>({error:"Connection failed"}));throw new Error(M.error||`HTTP ${R.status}`)}v=await R.json()}else{const R=await fetch(`${Bu}/api/config`);if(!R.ok)throw new Error("Failed to fetch server config");const M=await R.json();if(!M.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const P=await Dx({servers:M.natsWsUrl,authenticator:Ex(M.natsJwt,new TextEncoder().encode(M.natsNkeySeed))}),I=Ru(),ue=`pair.${x}`,q=await P.request(ue,I.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});v=JSON.parse(I.decode(q.data)),await P.close()}const S={hostId:v.hostId,clientToken:v.clientToken,directUrl:Al?window.location.origin:void 0,...v.hostName?{name:v.hostName}:{}};if(d(S),Jn.isNativePlatform()&&On){await WO.set({key:"hostId",value:v.hostId});try{const{token:R}=await On.getFcmToken();await fetch(`${Bu}/api/fcm/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hostId:v.hostId,fcmToken:R})})}catch(R){console.warn("FCM token registration failed:",R)}}const j=`/hosts/${encodeURIComponent(v.hostId)}`;b($b&&r?`${j}/pair/setup`:j)}catch(v){const S=v instanceof Error?v.message:String(v);S.includes("timeout")||S.includes("TIMEOUT")||S.includes("503")||S.toLowerCase().includes("no responders")?f("Code not found or expired. Check the code and try again."):f(S)}finally{o(!1)}}return y.jsx("div",{className:"pair-page",children:y.jsxs("div",{className:"pair-card",children:[y.jsxs("div",{className:"pair-header",children:[y.jsx("h1",{className:"pair-title",children:Al?"Pair":"Pair with Host"}),y.jsx("p",{className:"pair-subtitle",children:Al?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!Al&&y.jsxs("div",{className:"pair-instructions",children:[y.jsxs("div",{className:"pair-instruction-block",children:[y.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),y.jsxs("ol",{className:"pair-steps",children:[y.jsxs("li",{children:["Install Palmier on your host machine.",y.jsx("span",{className:"pair-platform-label",children:"Linux / macOS:"}),y.jsx("code",{className:"pair-command",children:"curl -fsSL https://palmier.me/install.sh | bash"}),y.jsx("span",{className:"pair-platform-label",children:"Windows (PowerShell):"}),y.jsx("code",{className:"pair-command",children:"irm https://palmier.me/install.ps1 | iex"})]}),y.jsxs("li",{children:["Run the setup wizard:",y.jsx("code",{className:"pair-command",children:"palmier init"})]}),y.jsx("li",{children:"A pairing code will display automatically"})]})]}),y.jsx("div",{className:"pair-instruction-divider"}),y.jsxs("div",{className:"pair-instruction-block",children:[y.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),y.jsxs("ol",{className:"pair-steps",children:[y.jsxs("li",{children:["Run ",y.jsx("code",{children:"palmier pair"})," on the host machine"]}),y.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),y.jsxs("div",{className:"pair-form",children:[y.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",y.jsx("input",{id:"pair-code",type:"text",maxLength:6,value:e,onChange:x=>t(x.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:l})]}),$b&&y.jsxs("label",{className:"pair-checkbox",children:[y.jsx("input",{type:"checkbox",checked:r,onChange:x=>s(x.target.checked),disabled:l}),y.jsxs("span",{className:"pair-checkbox-text",children:[y.jsx("span",{className:"pair-checkbox-title",children:"Link the host to this device"}),y.jsx("span",{className:"pair-checkbox-hint",children:r?"The host will use this device for SMS, contacts, calendar, location, and alarms. Only one device can be linked to the host.":"This device won't provide SMS, contacts, calendar, location, or alarms to the host. You can link it later from the menu."})]})]}),c&&y.jsx("p",{className:"pair-error",children:c}),y.jsxs("button",{className:"btn btn-primary btn-full",onClick:g,disabled:l||!e.trim(),children:[l&&y.jsx("span",{className:"btn-spinner"}),l?"Pairing...":"Pair"]}),m.length>0&&y.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>b("/"),disabled:l,children:"Cancel"}),y.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",y.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",y.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function t4(){const e=Gr(),{connected:t,request:r,activeHost:s}=xi(),{setHostLanUrl:l,pairedHosts:o}=Zi(),c=o.length<=1,[f,d]=E.useState("loading"),[m,b]=E.useState(null),[g,x]=E.useState(null);function v(){e(`/hosts/${encodeURIComponent(s.hostId)}`,{replace:!0})}E.useEffect(()=>{if(!t||f!=="loading")return;let P=!1;return r("host.info").catch(()=>({})).then(I=>{if(P)return;l(s.hostId,I.lan_url??void 0);const ue=I.linked_client_token??null;b(ue);const q=!!ue&&ue!==s.clientToken;d(q?"confirming":"linking")}),()=>{P=!0}},[t,f,s,r,l]),E.useEffect(()=>{if(f!=="linking")return;let P=!1;return(async()=>{try{if(On){const{token:I}=await On.getFcmToken();if(!I)throw new Error("Could not read FCM token");await r("device.link",{fcmToken:I})}if(P)return;c?d("wizard"):v()}catch(I){if(P)return;x(I instanceof Error?I.message:String(I)),d("linkError")}})(),()=>{P=!0}},[f]);function S(){d("linking")}function j(){v()}function R(){x(null),d("linking")}const M=f==="confirming"&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:j,children:y.jsxs("div",{className:"confirm-modal",onClick:P=>P.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),y.jsx("p",{className:"confirm-modal-message",children:"Another device is already linked to this host. Only one device can be linked to the host — switching will disable those capabilities on the currently linked device."}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:j,children:"Cancel"}),y.jsx("button",{className:"btn btn-primary",onClick:S,children:"Link"})]})]})}),document.body);if(f==="loading"||f==="confirming"||f==="linking"||f==="linkError"){const P=c,I=f==="loading"||f==="confirming"||f==="linking";return y.jsxs("div",{className:"pair-setup",children:[y.jsxs("div",{className:"pair-setup-inner",children:[P&&y.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),y.jsxs("div",{className:"pair-setup-loading",children:[I&&y.jsx("span",{className:"spinner spinner-lg"}),f==="loading"&&y.jsx("span",{children:"Connecting to host…"}),f==="confirming"&&y.jsx("span",{children:"Awaiting confirmation…"}),f==="linking"&&y.jsx("span",{children:"Linking device…"}),f==="linkError"&&y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"pair-error",children:g}),y.jsx("button",{className:"btn btn-primary",onClick:R,children:"Retry"}),y.jsx("button",{className:"btn btn-secondary",onClick:v,children:"Skip linking"})]})]})]}),M]})}return y.jsx("div",{className:"pair-setup",children:y.jsxs("div",{className:"pair-setup-inner",children:[y.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),y.jsx("p",{className:"pair-setup-description",children:"Choose what the host can use this device for. You can change these later from the menu."}),y.jsx(Ix,{}),y.jsx("div",{className:"pair-setup-actions",children:y.jsx("button",{className:"btn btn-primary btn-full",onClick:v,children:"Finish"})})]})})}function n4(){const e=Gr();return E.useEffect(()=>{if(!On)return;const t=On.addListener("deepLink",({path:r})=>e(r));return()=>{t.then(r=>r.remove())}},[e]),null}function r4(){const{pairedHosts:e,lastHostId:t}=Zi();if(e.length===0)return y.jsx(Bl,{to:"/pair",replace:!0});const r=e.find(s=>s.hostId===t)??e[0];return y.jsx(Bl,{to:`/hosts/${encodeURIComponent(r.hostId)}`,replace:!0})}function i4(){const{hostId:e}=Yu(),{pairedHosts:t,setLastHostId:r}=Zi(),s=t.find(l=>l.hostId===e)??null;return E.useEffect(()=>{s&&r(s.hostId)},[s==null?void 0:s.hostId,r]),s?y.jsx(EE,{activeHost:s,children:y.jsxs(ax,{children:[y.jsx(Rr,{index:!0,element:y.jsx(wu,{},e)}),y.jsx(Rr,{path:"tasks",element:y.jsx(wu,{},e)}),y.jsx(Rr,{path:"runs/:taskId",element:y.jsx(wu,{},e)}),y.jsx(Rr,{path:"runs/:taskId/:runId",element:y.jsx(wu,{},e)}),y.jsx(Rr,{path:"pair/setup",element:y.jsx(t4,{})}),y.jsx(Rr,{path:"*",element:y.jsx(Bl,{to:".",replace:!0})})]})},`${s.hostId}|${s.clientToken}`):y.jsx(Bl,{to:"/",replace:!0})}function s4(){return y.jsxs(X_,{children:[y.jsx(n4,{}),y.jsxs(ax,{children:[y.jsx(Rr,{path:"/",element:y.jsx(r4,{})}),y.jsx(Rr,{path:"/pair",element:y.jsx(e4,{})}),y.jsx(Rr,{path:"/hosts/:hostId/*",element:y.jsx(i4,{})}),y.jsx(Rr,{path:"*",element:y.jsx(Bl,{to:"/",replace:!0})})]})]})}gS.createRoot(document.getElementById("root")).render(y.jsx(E.StrictMode,{children:y.jsx(z_,{children:y.jsx(s4,{})})}));export{$d as W};
|