palmier 0.9.36 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/commands/passwords.d.ts +3 -0
- package/dist/commands/passwords.js +25 -0
- package/dist/index.js +22 -0
- package/dist/mcp-tools.js +68 -1
- package/dist/password-store.d.ts +13 -0
- package/dist/password-store.js +96 -0
- package/dist/pending-requests.d.ts +2 -0
- package/dist/playwright-fill.d.ts +10 -0
- package/dist/playwright-fill.js +41 -0
- package/dist/pwa/assets/{index-B1wpqQXD.js → index-C4CD4xh2.js} +37 -37
- package/dist/pwa/assets/index-DfwUct4A.css +1 -0
- package/dist/pwa/assets/{web-BICLWfuY.js → web-CqKL3jGH.js} +1 -1
- package/dist/pwa/assets/{web-Ct4onsL_.js → web-DNTmjXM5.js} +1 -1
- package/dist/pwa/assets/{web-DZ51_ut2.js → web-ZugiRoEF.js} +1 -1
- package/dist/pwa/index.html +2 -2
- package/package.json +1 -1
- package/dist/pwa/assets/index-BJxu7oNc.css +0 -1
|
@@ -6,7 +6,7 @@ var nS=Object.defineProperty;var rS=(e,t,r)=>t in e?nS(e,t,{enumerable:!0,config
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Xy;function iS(){if(Xy)return pl;Xy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,l,u){var c=null;if(u!==void 0&&(c=""+u),l.key!==void 0&&(c=""+l.key),"key"in l){u={};for(var f in l)f!=="key"&&(u[f]=l[f])}else u=l;return l=u.ref,{$$typeof:e,type:s,key:c,ref:l!==void 0?l:null,props:u}}return pl.Fragment=t,pl.jsx=r,pl.jsxs=r,pl}var Ky;function sS(){return Ky||(Ky=1,fh.exports=iS()),fh.exports}var b=sS(),hh={exports:{}},
|
|
9
|
+
*/var Xy;function iS(){if(Xy)return pl;Xy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,l,u){var c=null;if(u!==void 0&&(c=""+u),l.key!==void 0&&(c=""+l.key),"key"in l){u={};for(var f in l)f!=="key"&&(u[f]=l[f])}else u=l;return l=u.ref,{$$typeof:e,type:s,key:c,ref:l!==void 0?l:null,props:u}}return pl.Fragment=t,pl.jsx=r,pl.jsxs=r,pl}var Ky;function sS(){return Ky||(Ky=1,fh.exports=iS()),fh.exports}var b=sS(),hh={exports:{}},Ge={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react.production.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ var nS=Object.defineProperty;var rS=(e,t,r)=>t in e?nS(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 Qy;function aS(){if(Qy)return
|
|
17
|
+
*/var Qy;function aS(){if(Qy)return Ge;Qy=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"),u=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"),y=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,O={};function M(z,W,_){this.props=z,this.context=W,this.refs=O,this.updater=_||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 B(){}B.prototype=M.prototype;function I(z,W,_){this.props=z,this.context=W,this.refs=O,this.updater=_||S}var ee=I.prototype=new B;ee.constructor=I,j(ee,M.prototype),ee.isPureReactComponent=!0;var P=Array.isArray;function D(){}var Z={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function $(z,W,_){var ye=_.ref;return{$$typeof:e,type:z,key:W,ref:ye!==void 0?ye:null,props:_}}function L(z,W){return $(z.type,W,z.props)}function J(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function G(z){var W={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(_){return W[_]})}var ce=/\/+/g;function ue(z,W){return typeof z=="object"&&z!==null&&z.key!=null?G(""+z.key):W.toString(36)}function re(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(D,D):(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 q(z,W,_,ye,je){var Se=typeof z;(Se==="undefined"||Se==="boolean")&&(z=null);var Me=!1;if(z===null)Me=!0;else switch(Se){case"bigint":case"string":case"number":Me=!0;break;case"object":switch(z.$$typeof){case e:case t:Me=!0;break;case y:return Me=z._init,q(Me(z._payload),W,_,ye,je)}}if(Me)return je=je(z),Me=ye===""?"."+ue(z,0):ye,P(je)?(_="",Me!=null&&(_=Me.replace(ce,"$&/")+"/"),q(je,W,_,"",function(ot){return ot})):je!=null&&(J(je)&&(je=L(je,_+(je.key==null||z&&z.key===je.key?"":(""+je.key).replace(ce,"$&/")+"/")+Me)),W.push(je)),1;Me=0;var Ve=ye===""?".":ye+":";if(P(z))for(var Ae=0;Ae<z.length;Ae++)ye=z[Ae],Se=Ve+ue(ye,Ae),Me+=q(ye,W,_,Se,je);else if(Ae=v(z),typeof Ae=="function")for(z=Ae.call(z),Ae=0;!(ye=z.next()).done;)ye=ye.value,Se=Ve+ue(ye,Ae++),Me+=q(ye,W,_,Se,je);else if(Se==="object"){if(typeof z.then=="function")return q(re(z),W,_,ye,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 Me}function Y(z,W,_){if(z==null)return z;var ye=[],je=0;return q(z,ye,"","",function(Se){return W.call(_,Se,je++)}),ye}function ae(z){if(z._status===-1){var W=z._result;W=W(),W.then(function(_){(z._status===0||z._status===-1)&&(z._status=1,z._result=_)},function(_){(z._status===0||z._status===-1)&&(z._status=2,z._result=_)}),z._status===-1&&(z._status=0,z._result=W)}if(z._status===1)return z._result.default;throw z._result}var ve=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)},N={map:Y,forEach:function(z,W,_){Y(z,function(){W.apply(this,arguments)},_)},count:function(z){var W=0;return Y(z,function(){W++}),W},toArray:function(z){return Y(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 Ge.Activity=g,Ge.Children=N,Ge.Component=M,Ge.Fragment=r,Ge.Profiler=l,Ge.PureComponent=I,Ge.StrictMode=s,Ge.Suspense=d,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Z,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(z){return Z.H.useMemoCache(z)}},Ge.cache=function(z){return function(){return z.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(z,W,_){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var ye=j({},z.props),je=z.key;if(W!=null)for(Se in W.key!==void 0&&(je=""+W.key),W)!F.call(W,Se)||Se==="key"||Se==="__self"||Se==="__source"||Se==="ref"&&W.ref===void 0||(ye[Se]=W[Se]);var Se=arguments.length-2;if(Se===1)ye.children=_;else if(1<Se){for(var Me=Array(Se),Ve=0;Ve<Se;Ve++)Me[Ve]=arguments[Ve+2];ye.children=Me}return $(z.type,je,ye)},Ge.createContext=function(z){return z={$$typeof:c,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:u,_context:z},z},Ge.createElement=function(z,W,_){var ye,je={},Se=null;if(W!=null)for(ye in W.key!==void 0&&(Se=""+W.key),W)F.call(W,ye)&&ye!=="key"&&ye!=="__self"&&ye!=="__source"&&(je[ye]=W[ye]);var Me=arguments.length-2;if(Me===1)je.children=_;else if(1<Me){for(var Ve=Array(Me),Ae=0;Ae<Me;Ae++)Ve[Ae]=arguments[Ae+2];je.children=Ve}if(z&&z.defaultProps)for(ye in Me=z.defaultProps,Me)je[ye]===void 0&&(je[ye]=Me[ye]);return $(z,Se,je)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(z){return{$$typeof:f,render:z}},Ge.isValidElement=J,Ge.lazy=function(z){return{$$typeof:y,_payload:{_status:-1,_result:z},_init:ae}},Ge.memo=function(z,W){return{$$typeof:m,type:z,compare:W===void 0?null:W}},Ge.startTransition=function(z){var W=Z.T,_={};Z.T=_;try{var ye=z(),je=Z.S;je!==null&&je(_,ye),typeof ye=="object"&&ye!==null&&typeof ye.then=="function"&&ye.then(D,ve)}catch(Se){ve(Se)}finally{W!==null&&_.types!==null&&(W.types=_.types),Z.T=W}},Ge.unstable_useCacheRefresh=function(){return Z.H.useCacheRefresh()},Ge.use=function(z){return Z.H.use(z)},Ge.useActionState=function(z,W,_){return Z.H.useActionState(z,W,_)},Ge.useCallback=function(z,W){return Z.H.useCallback(z,W)},Ge.useContext=function(z){return Z.H.useContext(z)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(z,W){return Z.H.useDeferredValue(z,W)},Ge.useEffect=function(z,W){return Z.H.useEffect(z,W)},Ge.useEffectEvent=function(z){return Z.H.useEffectEvent(z)},Ge.useId=function(){return Z.H.useId()},Ge.useImperativeHandle=function(z,W,_){return Z.H.useImperativeHandle(z,W,_)},Ge.useInsertionEffect=function(z,W){return Z.H.useInsertionEffect(z,W)},Ge.useLayoutEffect=function(z,W){return Z.H.useLayoutEffect(z,W)},Ge.useMemo=function(z,W){return Z.H.useMemo(z,W)},Ge.useOptimistic=function(z,W){return Z.H.useOptimistic(z,W)},Ge.useReducer=function(z,W,_){return Z.H.useReducer(z,W,_)},Ge.useRef=function(z){return Z.H.useRef(z)},Ge.useState=function(z){return Z.H.useState(z)},Ge.useSyncExternalStore=function(z,W,_){return Z.H.useSyncExternalStore(z,W,_)},Ge.useTransition=function(){return Z.H.useTransition()},Ge.version="19.2.4",Ge}var Zy;function Ad(){return Zy||(Zy=1,hh.exports=aS()),hh.exports}var A=Ad(),dh={exports:{}},gl={},mh={exports:{}},ph={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ var nS=Object.defineProperty;var rS=(e,t,r)=>t in e?nS(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 Wy;function lS(){return Wy||(Wy=1,(function(e){function t(q,Y){var ae=q.length;q.push(Y);e:for(;0<ae;){var ve=ae-1>>>1,N=q[ve];if(0<l(N,Y))q[ve]=Y,q[ae]=N,ae=ve;else break e}}function r(q){return q.length===0?null:q[0]}function s(q){if(q.length===0)return null;var Y=q[0],ae=q.pop();if(ae!==Y){q[0]=ae;e:for(var ve=0,N=q.length,z=N>>>1;ve<z;){var W=2*(ve+1)-1,_=q[W],ye=W+1,
|
|
25
|
+
*/var Wy;function lS(){return Wy||(Wy=1,(function(e){function t(q,Y){var ae=q.length;q.push(Y);e:for(;0<ae;){var ve=ae-1>>>1,N=q[ve];if(0<l(N,Y))q[ve]=Y,q[ae]=N,ae=ve;else break e}}function r(q){return q.length===0?null:q[0]}function s(q){if(q.length===0)return null;var Y=q[0],ae=q.pop();if(ae!==Y){q[0]=ae;e:for(var ve=0,N=q.length,z=N>>>1;ve<z;){var W=2*(ve+1)-1,_=q[W],ye=W+1,je=q[ye];if(0>l(_,ae))ye<N&&0>l(je,_)?(q[ve]=je,q[ye]=ae,ve=ye):(q[ve]=_,q[W]=ae,ve=W);else if(ye<N&&0>l(je,ae))q[ve]=je,q[ye]=ae,ve=ye;else break e}}return Y}function l(q,Y){var ae=q.sortIndex-Y.sortIndex;return ae!==0?ae:q.id-Y.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var d=[],m=[],y=1,g=null,x=3,v=!1,S=!1,j=!1,O=!1,M=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function ee(q){for(var Y=r(m);Y!==null;){if(Y.callback===null)s(m);else if(Y.startTime<=q)s(m),Y.sortIndex=Y.expirationTime,t(d,Y);else break;Y=r(m)}}function P(q){if(j=!1,ee(q),!S)if(r(d)!==null)S=!0,D||(D=!0,G());else{var Y=r(m);Y!==null&&re(P,Y.startTime-q)}}var D=!1,Z=-1,F=5,$=-1;function L(){return O?!0:!(e.unstable_now()-$<F)}function J(){if(O=!1,D){var q=e.unstable_now();$=q;var Y=!0;try{e:{S=!1,j&&(j=!1,B(Z),Z=-1),v=!0;var ae=x;try{t:{for(ee(q),g=r(d);g!==null&&!(g.expirationTime>q&&L());){var ve=g.callback;if(typeof ve=="function"){g.callback=null,x=g.priorityLevel;var N=ve(g.expirationTime<=q);if(q=e.unstable_now(),typeof N=="function"){g.callback=N,ee(q),Y=!0;break t}g===r(d)&&s(d),ee(q)}else s(d);g=r(d)}if(g!==null)Y=!0;else{var z=r(m);z!==null&&re(P,z.startTime-q),Y=!1}}break e}finally{g=null,x=ae,v=!1}Y=void 0}}finally{Y?G():D=!1}}}var G;if(typeof I=="function")G=function(){I(J)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,ue=ce.port2;ce.port1.onmessage=J,G=function(){ue.postMessage(null)}}else G=function(){M(J,0)};function re(q,Y){Z=M(function(){q(e.unstable_now())},Y)}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(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(q){switch(x){case 1:case 2:case 3:var Y=3;break;default:Y=x}var ae=x;x=Y;try{return q()}finally{x=ae}},e.unstable_requestPaint=function(){O=!0},e.unstable_runWithPriority=function(q,Y){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ae=x;x=q;try{return Y()}finally{x=ae}},e.unstable_scheduleCallback=function(q,Y,ae){var ve=e.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?ve+ae:ve):ae=ve,q){case 1:var N=-1;break;case 2:N=250;break;case 5:N=1073741823;break;case 4:N=1e4;break;default:N=5e3}return N=ae+N,q={id:y++,callback:Y,priorityLevel:q,startTime:ae,expirationTime:N,sortIndex:-1},ae>ve?(q.sortIndex=ae,t(m,q),r(d)===null&&q===r(m)&&(j?(B(Z),Z=-1):j=!0,re(P,ae-ve))):(q.sortIndex=N,t(d,q),S||v||(S=!0,D||(D=!0,G()))),q},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(q){var Y=x;return function(){var ae=x;x=Y;try{return q.apply(this,arguments)}finally{x=ae}}}})(ph)),ph}var e0;function oS(){return e0||(e0=1,mh.exports=lS()),mh.exports}var gh={exports:{}},bn={};/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.js
|
|
28
28
|
*
|
|
@@ -30,7 +30,7 @@ var nS=Object.defineProperty;var rS=(e,t,r)=>t in e?nS(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 t0;function uS(){if(t0)return
|
|
33
|
+
*/var t0;function uS(){if(t0)return bn;t0=1;var e=Ad();function t(d){var m="https://react.dev/errors/"+d;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}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 u(d,m,y){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:y}}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 bn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,bn.createPortal=function(d,m){var y=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 u(d,m,null,y)},bn.flushSync=function(d){var m=c.T,y=s.p;try{if(c.T=null,s.p=2,d)return d()}finally{c.T=m,s.p=y,s.d.f()}},bn.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))},bn.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},bn.preinit=function(d,m){if(typeof d=="string"&&m&&typeof m.as=="string"){var y=m.as,g=f(y,m.crossOrigin),x=typeof m.integrity=="string"?m.integrity:void 0,v=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?s.d.S(d,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:v}):y==="script"&&s.d.X(d,{crossOrigin:g,integrity:x,fetchPriority:v,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},bn.preinitModule=function(d,m){if(typeof d=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=f(m.as,m.crossOrigin);s.d.M(d,{crossOrigin:y,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)},bn.preload=function(d,m){if(typeof d=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,g=f(y,m.crossOrigin);s.d.L(d,y,{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})}},bn.preloadModule=function(d,m){if(typeof d=="string")if(m){var y=f(m.as,m.crossOrigin);s.d.m(d,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else s.d.m(d)},bn.requestFormReset=function(d){s.d.r(d)},bn.unstable_batchedUpdates=function(d,m){return d(m)},bn.useFormState=function(d,m,y){return c.H.useFormState(d,m,y)},bn.useFormStatus=function(){return c.H.useHostTransitionStatus()},bn.version="19.2.4",bn}var n0;function Gb(){if(n0)return gh.exports;n0=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(),gh.exports=uS(),gh.exports}/**
|
|
34
34
|
* @license React
|
|
35
35
|
* react-dom-client.production.js
|
|
36
36
|
*
|
|
@@ -38,15 +38,15 @@ var nS=Object.defineProperty;var rS=(e,t,r)=>t in e?nS(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 r0;function cS(){if(r0)return gl;r0=1;var e=oS(),t=Ad(),r=Gb();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 u(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(u(n)!==n)throw Error(s(188))}function m(n){var i=n.alternate;if(!i){if(i=u(n),i===null)throw Error(s(188));return i!==n?null:n}for(var a=n,o=i;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){a=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return d(h),n;if(p===o)return d(h),i;p=p.sibling}throw Error(s(188))}if(a.return!==o.return)a=h,o=p;else{for(var w=!1,k=h.child;k;){if(k===a){w=!0,a=h,o=p;break}if(k===o){w=!0,o=h,a=p;break}k=k.sibling}if(!w){for(k=p.child;k;){if(k===a){w=!0,a=p,o=h;break}if(k===o){w=!0,o=p,a=h;break}k=k.sibling}if(!w)throw Error(s(189))}}if(a.alternate!==o)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?n:i}function y(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n;for(n=n.child;n!==null;){if(i=y(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 r0;function cS(){if(r0)return gl;r0=1;var e=oS(),t=Ad(),r=Gb();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 u(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(u(n)!==n)throw Error(s(188))}function m(n){var i=n.alternate;if(!i){if(i=u(n),i===null)throw Error(s(188));return i!==n?null:n}for(var a=n,o=i;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){a=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return d(h),n;if(p===o)return d(h),i;p=p.sibling}throw Error(s(188))}if(a.return!==o.return)a=h,o=p;else{for(var w=!1,k=h.child;k;){if(k===a){w=!0,a=h,o=p;break}if(k===o){w=!0,o=h,a=p;break}k=k.sibling}if(!w){for(k=p.child;k;){if(k===a){w=!0,a=p,o=h;break}if(k===o){w=!0,o=p,a=h;break}k=k.sibling}if(!w)throw Error(s(189))}}if(a.alternate!==o)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?n:i}function y(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n;for(n=n.child;n!==null;){if(i=y(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"),O=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),I=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),J=Symbol.iterator;function G(n){return n===null||typeof n!="object"?null:(n=J&&n[J]||n["@@iterator"],typeof n=="function"?n:null)}var ce=Symbol.for("react.client.reference");function ue(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ce?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case j:return"Fragment";case M:return"Profiler";case O:return"StrictMode";case P:return"Suspense";case D:return"SuspenseList";case $:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case S:return"Portal";case I:return n.displayName||"Context";case B:return(n._context.displayName||"Context")+".Consumer";case ee:var i=n.render;return n=n.displayName,n||(n=i.displayName||i.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Z:return i=n.displayName||null,i!==null?i:ue(n.type)||"Memo";case F:i=n._payload,n=n._init;try{return ue(n(i))}catch{}}return null}var re=Array.isArray,q=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},ve=[],N=-1;function z(n){return{current:n}}function W(n){0>N||(n.current=ve[N],ve[N]=null,N--)}function _(n,i){N++,ve[N]=n.current,n.current=i}var ye=z(null),je=z(null),Se=z(null),Me=z(null);function Ve(n,i){switch(_(Se,i),_(je,n),_(ye,null),i.nodeType){case 9:case 11:n=(n=i.documentElement)&&(n=n.namespaceURI)?by(n):0;break;default:if(n=i.tagName,i=i.namespaceURI)i=by(i),n=xy(i,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}W(ye),_(ye,n)}function Ae(){W(ye),W(je),W(Se)}function ot(n){n.memoizedState!==null&&_(Me,n);var i=ye.current,a=xy(i,n.type);i!==a&&(_(je,n),_(ye,a))}function kt(n){je.current===n&&(W(ye),W(je)),Me.current===n&&(W(Me),fl._currentValue=ae)}var an,Lt;function Ie(n){if(an===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);an=i&&i[1]||"",Lt=-1<a.stack.indexOf(`
|
|
42
42
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+
|
|
43
|
+
`+an+n+Lt}var et=!1;function qe(n,i){if(!n||et)return"";et=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var ge=function(){throw Error()};if(Object.defineProperty(ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ge,[])}catch(le){var ie=le}Reflect.construct(n,[],ge)}else{try{ge.call()}catch(le){ie=le}n.call(ge.prototype)}}else{try{throw Error()}catch(le){ie=le}(ge=n())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(le){if(le&&ie&&typeof le.stack=="string")return[le.stack,ie.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),w=p[0],k=p[1];if(w&&k){var H=w.split(`
|
|
44
44
|
`),ne=k.split(`
|
|
45
|
-
`);for(h=o=0;o<H.length&&!H[o].includes("DetermineComponentFrameRoot");)o++;for(;h<ne.length&&!ne[h].includes("DetermineComponentFrameRoot");)h++;if(o===H.length||h===ne.length)for(o=H.length-1,h=ne.length-1;1<=o&&0<=h&&H[o]!==ne[h];)h--;for(;1<=o&&0<=h;o--,h--)if(H[o]!==ne[h]){if(o!==1||h!==1)do if(o--,h--,0>h||H[o]!==ne[h]){var
|
|
46
|
-
`+H[o].replace(" at new "," at ");return n.displayName&&
|
|
45
|
+
`);for(h=o=0;o<H.length&&!H[o].includes("DetermineComponentFrameRoot");)o++;for(;h<ne.length&&!ne[h].includes("DetermineComponentFrameRoot");)h++;if(o===H.length||h===ne.length)for(o=H.length-1,h=ne.length-1;1<=o&&0<=h&&H[o]!==ne[h];)h--;for(;1<=o&&0<=h;o--,h--)if(H[o]!==ne[h]){if(o!==1||h!==1)do if(o--,h--,0>h||H[o]!==ne[h]){var he=`
|
|
46
|
+
`+H[o].replace(" at new "," at ");return n.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",n.displayName)),he}while(1<=o&&0<=h);break}}}finally{et=!1,Error.prepareStackTrace=a}return(a=n?n.displayName||n.name:"")?Ie(a):""}function jt(n,i){switch(n.tag){case 26:case 27:case 5:return Ie(n.type);case 16:return Ie("Lazy");case 13:return n.child!==i&&i!==null?Ie("Suspense Fallback"):Ie("Suspense");case 19:return Ie("SuspenseList");case 0:case 15:return qe(n.type,!1);case 11:return qe(n.type.render,!1);case 1:return qe(n.type,!0);case 31:return Ie("Activity");default:return""}}function gt(n){try{var i="",a=null;do i+=jt(n,a),a=n,n=n.return;while(n);return i}catch(o){return`
|
|
47
47
|
Error generating stack: `+o.message+`
|
|
48
|
-
`+o.stack}}var Kn=Object.prototype.hasOwnProperty,Nt=e.unstable_scheduleCallback,tn=e.unstable_cancelCallback,wn=e.unstable_shouldYield,Rn=e.unstable_requestPaint,mt=e.unstable_now,Sn=e.unstable_getCurrentPriorityLevel,ce=e.unstable_ImmediatePriority,ke=e.unstable_UserBlockingPriority,be=e.unstable_NormalPriority,we=e.unstable_LowPriority,Ne=e.unstable_IdlePriority,Ge=e.log,Ze=e.unstable_setDisableYieldValue,ct=null,Ie=null;function qe(n){if(typeof Ge=="function"&&Ze(n),Ie&&typeof Ie.setStrictMode=="function")try{Ie.setStrictMode(ct,n)}catch{}}var Pe=Math.clz32?Math.clz32:Oe,de=Math.log,Me=Math.LN2;function Oe(n){return n>>>=0,n===0?32:31-(de(n)/Me|0)|0}var gt=256,it=262144,_n=4194304;function fr(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 $i(n,i,a){var o=n.pendingLanes;if(o===0)return 0;var h=0,p=n.suspendedLanes,w=n.pingedLanes;n=n.warmLanes;var k=o&134217727;return k!==0?(o=k&~p,o!==0?h=fr(o):(w&=k,w!==0?h=fr(w):a||(a=k&~n,a!==0&&(h=fr(a))))):(k=o&~p,k!==0?h=fr(k):w!==0?h=fr(w):a||(a=o&~n,a!==0&&(h=fr(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 Yi(n,i){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&i)===0}function Ea(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 xs(){var n=_n;return _n<<=1,(_n&62914560)===0&&(_n=4194304),n}function li(n){for(var i=[],a=0;31>a;a++)i.push(n);return i}function hr(n,i){n.pendingLanes|=i,i!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function oi(n,i,a,o,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 k=n.entanglements,H=n.expirationTimes,ne=n.hiddenUpdates;for(a=w&~a;0<a;){var fe=31-Pe(a),ge=1<<fe;k[fe]=0,H[fe]=-1;var ie=ne[fe];if(ie!==null)for(ne[fe]=null,fe=0;fe<ie.length;fe++){var le=ie[fe];le!==null&&(le.lane&=-536870913)}a&=~ge}o!==0&&ui(n,o,0),p!==0&&h===0&&n.tag!==0&&(n.suspendedLanes|=p&~(w&~i))}function ui(n,i,a){n.pendingLanes|=i,n.suspendedLanes&=~i;var o=31-Pe(i);n.entangledLanes|=i,n.entanglements[o]=n.entanglements[o]|1073741824|a&261930}function Vi(n,i){var a=n.entangledLanes|=i;for(n=n.entanglements;a;){var o=31-Pe(a),h=1<<o;h&i|n[o]&i&&(n[o]|=i),a&=~h}}function ci(n,i){var a=i&-i;return a=(a&42)!==0?1:Lr(a),(a&(n.suspendedLanes|i))!==0?0:a}function Lr(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 Gi(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Ca(){var n=Y.p;return n!==0?n:(n=window.event,n===void 0?32:Iy(n.type))}function Kl(n,i){var a=Y.p;try{return Y.p=n,i()}finally{Y.p=a}}var kr=Math.random().toString(36).slice(2),Ct="__reactFiber$"+kr,qt="__reactProps$"+kr,Mn="__reactContainer$"+kr,Ji="__reactEvents$"+kr,Aa="__reactListeners$"+kr,Ql="__reactHandles$"+kr,Zl="__reactResources$"+kr,Zt="__reactMarker$"+kr;function vs(n){delete n[Ct],delete n[qt],delete n[Ji],delete n[Aa],delete n[Ql]}function E(n){var i=n[Ct];if(i)return i;for(var a=n.parentNode;a;){if(i=a[Mn]||a[Ct]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(n=Cy(n);n!==null;){if(a=n[Ct])return a;n=Cy(n)}return i}n=a,a=n.parentNode}return null}function R(n){if(n=n[Ct]||n[Mn]){var i=n.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return n}return null}function j(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[Zl];return i||(i=n[Zl]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function V(n){n[Zt]=!0}var Q=new Set,pe={};function xe(n,i){se(n,i),se(n+"Capture",i)}function se(n,i){for(pe[n]=i,n=0;n<i.length;n++)Q.add(i[n])}var me=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={},We={};function Mt(n){return Kn.call(We,n)?!0:Kn.call(Le,n)?!1:me.test(n)?We[n]=!0:(Le[n]=!0,!1)}function cn(n,i,a){if(Mt(i))if(a===null)n.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":n.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){n.removeAttribute(i);return}}n.setAttribute(i,""+a)}}function dr(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 zr(n,i,a,o){if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttributeNS(i,a,""+o)}}function Qn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function cm(n){var i=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function X1(n,i,a){var o=Object.getOwnPropertyDescriptor(n.constructor.prototype,i);if(!n.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.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:o.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){n._valueTracker=null,delete n[i]}}}}function rc(n){if(!n._valueTracker){var i=cm(n)?"checked":"value";n._valueTracker=X1(n,i,""+n[i])}}function fm(n){if(!n)return!1;var i=n._valueTracker;if(!i)return!0;var a=i.getValue(),o="";return n&&(o=cm(n)?n.checked?"true":"false":n.value),n=o,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 K1=/[\n"\\]/g;function Zn(n){return n.replace(K1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function ic(n,i,a,o,h,p,w,k){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=""+Qn(i)):n.value!==""+Qn(i)&&(n.value=""+Qn(i)):w!=="submit"&&w!=="reset"||n.removeAttribute("value"),i!=null?sc(n,w,Qn(i)):a!=null?sc(n,w,Qn(a)):o!=null&&n.removeAttribute("value"),h==null&&p!=null&&(n.defaultChecked=!!p),h!=null&&(n.checked=h&&typeof h!="function"&&typeof h!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?n.name=""+Qn(k):n.removeAttribute("name")}function hm(n,i,a,o,h,p,w,k){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)){rc(n);return}a=a!=null?""+Qn(a):"",i=i!=null?""+Qn(i):a,k||i===n.value||(n.value=i),n.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,n.checked=k?n.checked:!!o,n.defaultChecked=!!o,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.name=w),rc(n)}function sc(n,i,a){i==="number"&&Wl(n.ownerDocument)===n||n.defaultValue===""+a||(n.defaultValue=""+a)}function ws(n,i,a,o){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&&o&&(n[a].defaultSelected=!0)}else{for(a=""+Qn(a),i=null,h=0;h<n.length;h++){if(n[h].value===a){n[h].selected=!0,o&&(n[h].defaultSelected=!0);return}i!==null||n[h].disabled||(i=n[h])}i!==null&&(i.selected=!0)}}function dm(n,i,a){if(i!=null&&(i=""+Qn(i),i!==n.value&&(n.value=i),a==null)){n.defaultValue!==i&&(n.defaultValue=i);return}n.defaultValue=a!=null?""+Qn(a):""}function mm(n,i,a,o){if(i==null){if(o!=null){if(a!=null)throw Error(s(92));if(re(o)){if(1<o.length)throw Error(s(93));o=o[0]}a=o}a==null&&(a=""),i=a}a=Qn(i),n.defaultValue=a,o=n.textContent,o===a&&o!==""&&o!==null&&(n.value=o),rc(n)}function Ss(n,i){if(i){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=i;return}}n.textContent=i}var Q1=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 pm(n,i,a){var o=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?n.setProperty(i,""):i==="float"?n.cssFloat="":n[i]="":o?n.setProperty(i,a):typeof a!="number"||a===0||Q1.has(i)?i==="float"?n.cssFloat=a:n[i]=(""+a).trim():n[i]=a+"px"}function gm(n,i,a){if(i!=null&&typeof i!="object")throw Error(s(62));if(n=n.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?n.setProperty(o,""):o==="float"?n.cssFloat="":n[o]="");for(var h in i)o=i[h],i.hasOwnProperty(h)&&a[h]!==o&&pm(n,h,o)}else for(var p in i)i.hasOwnProperty(p)&&pm(n,p,i[p])}function ac(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 Z1=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"]]),W1=/^[\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 W1.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Ur(){}var lc=null;function oc(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var _s=null,ks=null;function ym(n){var i=R(n);if(i&&(n=i.stateNode)){var a=n[qt]||null;e:switch(n=i.stateNode,i.type){case"input":if(ic(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="'+Zn(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var o=a[i];if(o!==n&&o.form===n.form){var h=o[qt]||null;if(!h)throw Error(s(90));ic(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<a.length;i++)o=a[i],o.form===n.form&&fm(o)}break e;case"textarea":dm(n,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&ws(n,!!a.multiple,i,!1)}}}var uc=!1;function bm(n,i,a){if(uc)return n(i,a);uc=!0;try{var o=n(i);return o}finally{if(uc=!1,(_s!==null||ks!==null)&&(Io(),_s&&(i=_s,n=ks,ks=_s=null,ym(i),n)))for(i=0;i<n.length;i++)ym(n[i])}}function Ta(n,i){var a=n.stateNode;if(a===null)return null;var o=a[qt]||null;if(o===null)return null;a=o[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":(o=!o.disabled)||(n=n.type,o=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!o;break e;default:n=!1}if(n)return null;if(a&&typeof a!="function")throw Error(s(231,i,typeof a));return a}var Br=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cc=!1;if(Br)try{var ja={};Object.defineProperty(ja,"passive",{get:function(){cc=!0}}),window.addEventListener("test",ja,ja),window.removeEventListener("test",ja,ja)}catch{cc=!1}var fi=null,fc=null,to=null;function xm(){if(to)return to;var n,i=fc,a=i.length,o,h="value"in fi?fi.value:fi.textContent,p=h.length;for(n=0;n<a&&i[n]===h[n];n++);var w=a-n;for(o=1;o<=w&&i[a-o]===h[p-o];o++);return to=h.slice(n,1<o?1-o: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 vm(){return!1}function kn(n){function i(a,o,h,p,w){this._reactName=a,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var k in n)n.hasOwnProperty(k)&&(a=n[k],this[k]=a?a(p):p[k]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?ro:vm,this.isPropagationStopped=vm,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 Xi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},io=kn(Xi),Na=g({},Xi,{view:0,detail:0}),ev=kn(Na),hc,dc,Oa,so=g({},Na,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pc,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!==Oa&&(Oa&&n.type==="mousemove"?(hc=n.screenX-Oa.screenX,dc=n.screenY-Oa.screenY):dc=hc=0,Oa=n),hc)},movementY:function(n){return"movementY"in n?n.movementY:dc}}),wm=kn(so),tv=g({},so,{dataTransfer:0}),nv=kn(tv),rv=g({},Na,{relatedTarget:0}),mc=kn(rv),iv=g({},Xi,{animationName:0,elapsedTime:0,pseudoElement:0}),sv=kn(iv),av=g({},Xi,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),lv=kn(av),ov=g({},Xi,{data:0}),Sm=kn(ov),uv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cv={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"},fv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hv(n){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(n):(n=fv[n])?!!i[n]:!1}function pc(){return hv}var dv=g({},Na,{key:function(n){if(n.key){var i=uv[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"?cv[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pc,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}}),mv=kn(dv),pv=g({},so,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_m=kn(pv),gv=g({},Na,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pc}),yv=kn(gv),bv=g({},Xi,{propertyName:0,elapsedTime:0,pseudoElement:0}),xv=kn(bv),vv=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}),wv=kn(vv),Sv=g({},Xi,{newState:0,oldState:0}),_v=kn(Sv),kv=[9,13,27,32],gc=Br&&"CompositionEvent"in window,Ra=null;Br&&"documentMode"in document&&(Ra=document.documentMode);var Ev=Br&&"TextEvent"in window&&!Ra,km=Br&&(!gc||Ra&&8<Ra&&11>=Ra),Em=" ",Cm=!1;function Am(n,i){switch(n){case"keyup":return kv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Tm(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Es=!1;function Cv(n,i){switch(n){case"compositionend":return Tm(i);case"keypress":return i.which!==32?null:(Cm=!0,Em);case"textInput":return n=i.data,n===Em&&Cm?null:n;default:return null}}function Av(n,i){if(Es)return n==="compositionend"||!gc&&Am(n,i)?(n=xm(),to=fc=fi=null,Es=!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 km&&i.locale!=="ko"?null:i.data;default:return null}}var Tv={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 jm(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i==="input"?!!Tv[n.type]:i==="textarea"}function Nm(n,i,a,o){_s?ks?ks.push(o):ks=[o]:_s=o,i=Xo(i,"onChange"),0<i.length&&(a=new io("onChange","change",null,a,o),n.push({event:a,listeners:i}))}var Ma=null,Da=null;function jv(n){hy(n,0)}function ao(n){var i=j(n);if(fm(i))return n}function Om(n,i){if(n==="change")return i}var Rm=!1;if(Br){var yc;if(Br){var bc="oninput"in document;if(!bc){var Mm=document.createElement("div");Mm.setAttribute("oninput","return;"),bc=typeof Mm.oninput=="function"}yc=bc}else yc=!1;Rm=yc&&(!document.documentMode||9<document.documentMode)}function Dm(){Ma&&(Ma.detachEvent("onpropertychange",Lm),Da=Ma=null)}function Lm(n){if(n.propertyName==="value"&&ao(Da)){var i=[];Nm(i,Da,n,oc(n)),bm(jv,i)}}function Nv(n,i,a){n==="focusin"?(Dm(),Ma=i,Da=a,Ma.attachEvent("onpropertychange",Lm)):n==="focusout"&&Dm()}function Ov(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ao(Da)}function Rv(n,i){if(n==="click")return ao(i)}function Mv(n,i){if(n==="input"||n==="change")return ao(i)}function Dv(n,i){return n===i&&(n!==0||1/n===1/i)||n!==n&&i!==i}var Dn=typeof Object.is=="function"?Object.is:Dv;function La(n,i){if(Dn(n,i))return!0;if(typeof n!="object"||n===null||typeof i!="object"||i===null)return!1;var a=Object.keys(n),o=Object.keys(i);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var h=a[o];if(!Kn.call(i,h)||!Dn(n[h],i[h]))return!1}return!0}function zm(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Um(n,i){var a=zm(n);n=0;for(var o;a;){if(a.nodeType===3){if(o=n+a.textContent.length,n<=i&&o>=i)return{node:a,offset:i-n};n=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=zm(a)}}function Bm(n,i){return n&&i?n===i?!0:n&&n.nodeType===3?!1:i&&i.nodeType===3?Bm(n,i.parentNode):"contains"in n?n.contains(i):n.compareDocumentPosition?!!(n.compareDocumentPosition(i)&16):!1:!1}function Pm(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 xc(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 Lv=Br&&"documentMode"in document&&11>=document.documentMode,Cs=null,vc=null,za=null,wc=!1;function Hm(n,i,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;wc||Cs==null||Cs!==Wl(o)||(o=Cs,"selectionStart"in o&&xc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),za&&La(za,o)||(za=o,o=Xo(vc,"onSelect"),0<o.length&&(i=new io("onSelect","select",null,i,a),n.push({event:i,listeners:o}),i.target=Cs)))}function Ki(n,i){var a={};return a[n.toLowerCase()]=i.toLowerCase(),a["Webkit"+n]="webkit"+i,a["Moz"+n]="moz"+i,a}var As={animationend:Ki("Animation","AnimationEnd"),animationiteration:Ki("Animation","AnimationIteration"),animationstart:Ki("Animation","AnimationStart"),transitionrun:Ki("Transition","TransitionRun"),transitionstart:Ki("Transition","TransitionStart"),transitioncancel:Ki("Transition","TransitionCancel"),transitionend:Ki("Transition","TransitionEnd")},Sc={},qm={};Br&&(qm=document.createElement("div").style,"AnimationEvent"in window||(delete As.animationend.animation,delete As.animationiteration.animation,delete As.animationstart.animation),"TransitionEvent"in window||delete As.transitionend.transition);function Qi(n){if(Sc[n])return Sc[n];if(!As[n])return n;var i=As[n],a;for(a in i)if(i.hasOwnProperty(a)&&a in qm)return Sc[n]=i[a];return n}var Im=Qi("animationend"),Fm=Qi("animationiteration"),$m=Qi("animationstart"),zv=Qi("transitionrun"),Uv=Qi("transitionstart"),Bv=Qi("transitioncancel"),Ym=Qi("transitionend"),Vm=new Map,_c="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(" ");_c.push("scrollEnd");function mr(n,i){Vm.set(n,i),xe(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)},Wn=[],Ts=0,kc=0;function oo(){for(var n=Ts,i=kc=Ts=0;i<n;){var a=Wn[i];Wn[i++]=null;var o=Wn[i];Wn[i++]=null;var h=Wn[i];Wn[i++]=null;var p=Wn[i];if(Wn[i++]=null,o!==null&&h!==null){var w=o.pending;w===null?h.next=h:(h.next=w.next,w.next=h),o.pending=h}p!==0&&Gm(a,h,p)}}function uo(n,i,a,o){Wn[Ts++]=n,Wn[Ts++]=i,Wn[Ts++]=a,Wn[Ts++]=o,kc|=o,n.lanes|=o,n=n.alternate,n!==null&&(n.lanes|=o)}function Ec(n,i,a,o){return uo(n,i,a,o),co(n)}function Zi(n,i){return uo(n,null,null,i),co(n)}function Gm(n,i,a){n.lanes|=a;var o=n.alternate;o!==null&&(o.lanes|=a);for(var h=!1,p=n.return;p!==null;)p.childLanes|=a,o=p.alternate,o!==null&&(o.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-Pe(a),n=p.hiddenUpdates,o=n[h],o===null?n[h]=[i]:o.push(i),i.lane=a|536870912),p):null}function co(n){if(50<il)throw il=0,Lf=null,Error(s(185));for(var i=n.return;i!==null;)n=i,i=n.return;return n.tag===3?n.stateNode:null}var js={};function Pv(n,i,a,o){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=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ln(n,i,a,o){return new Pv(n,i,a,o)}function Cc(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Pr(n,i){var a=n.alternate;return a===null?(a=Ln(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 Jm(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,o,h,p){var w=0;if(o=n,typeof n=="function")Cc(n)&&(w=1);else if(typeof n=="string")w=$w(n,a,ye.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case $:return n=Ln(31,a,i,h),n.elementType=$,n.lanes=p,n;case T:return Wi(a.children,h,p,i);case O:w=8,h|=24;break;case M:return n=Ln(12,a,i,h|2),n.elementType=M,n.lanes=p,n;case P:return n=Ln(13,a,i,h),n.elementType=P,n.lanes=p,n;case D:return n=Ln(19,a,i,h),n.elementType=D,n.lanes=p,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:w=10;break e;case B:w=9;break e;case ee:w=11;break e;case Z:w=14;break e;case F:w=16,o=null;break e}w=29,a=Error(s(130,n===null?"null":typeof n,"")),o=null}return i=Ln(w,a,i,h),i.elementType=n,i.type=o,i.lanes=p,i}function Wi(n,i,a,o){return n=Ln(7,n,o,i),n.lanes=a,n}function Ac(n,i,a){return n=Ln(6,n,null,i),n.lanes=a,n}function Xm(n){var i=Ln(18,null,null,0);return i.stateNode=n,i}function Tc(n,i,a){return i=Ln(4,n.children!==null?n.children:[],n.key,i),i.lanes=a,i.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},i}var Km=new WeakMap;function er(n,i){if(typeof n=="object"&&n!==null){var a=Km.get(n);return a!==void 0?a:(i={value:n,source:i,stack:Rt(i)},Km.set(n,i),i)}return{value:n,source:i,stack:Rt(i)}}var Ns=[],Os=0,ho=null,Ua=0,tr=[],nr=0,hi=null,Er=1,Cr="";function Hr(n,i){Ns[Os++]=Ua,Ns[Os++]=ho,ho=n,Ua=i}function Qm(n,i,a){tr[nr++]=Er,tr[nr++]=Cr,tr[nr++]=hi,hi=n;var o=Er;n=Cr;var h=32-Pe(o)-1;o&=~(1<<h),a+=1;var p=32-Pe(i)+h;if(30<p){var w=h-h%5;p=(o&(1<<w)-1).toString(32),o>>=w,h-=w,Er=1<<32-Pe(i)+h|a<<h|o,Cr=p+n}else Er=1<<p|a<<h|o,Cr=n}function jc(n){n.return!==null&&(Hr(n,1),Qm(n,1,0))}function Nc(n){for(;n===ho;)ho=Ns[--Os],Ns[Os]=null,Ua=Ns[--Os],Ns[Os]=null;for(;n===hi;)hi=tr[--nr],tr[nr]=null,Cr=tr[--nr],tr[nr]=null,Er=tr[--nr],tr[nr]=null}function Zm(n,i){tr[nr++]=Er,tr[nr++]=Cr,tr[nr++]=hi,Er=i.id,Cr=i.overflow,hi=n}var an=null,Dt=null,lt=!1,di=null,rr=!1,Oc=Error(s(519));function mi(n){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ba(er(i,n)),Oc}function Wm(n){var i=n.stateNode,a=n.type,o=n.memoizedProps;switch(i[Ct]=n,i[qt]=o,a){case"dialog":tt("cancel",i),tt("close",i);break;case"iframe":case"object":case"embed":tt("load",i);break;case"video":case"audio":for(a=0;a<al.length;a++)tt(al[a],i);break;case"source":tt("error",i);break;case"img":case"image":case"link":tt("error",i),tt("load",i);break;case"details":tt("toggle",i);break;case"input":tt("invalid",i),hm(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":tt("invalid",i);break;case"textarea":tt("invalid",i),mm(i,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||o.suppressHydrationWarning===!0||gy(i.textContent,a)?(o.popover!=null&&(tt("beforetoggle",i),tt("toggle",i)),o.onScroll!=null&&tt("scroll",i),o.onScrollEnd!=null&&tt("scrollend",i),o.onClick!=null&&(i.onclick=Ur),i=!0):i=!1,i||mi(n,!0)}function ep(n){for(an=n.return;an;)switch(an.tag){case 5:case 31:case 13:rr=!1;return;case 27:case 3:rr=!0;return;default:an=an.return}}function Rs(n){if(n!==an)return!1;if(!lt)return ep(n),lt=!0,!1;var i=n.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=n.type,a=!(a!=="form"&&a!=="button")||Kf(n.type,n.memoizedProps)),a=!a),a&&Dt&&mi(n),ep(n),i===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Dt=Ey(n)}else if(i===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Dt=Ey(n)}else i===27?(i=Dt,Ti(n.type)?(n=th,th=null,Dt=n):Dt=i):Dt=an?sr(n.stateNode.nextSibling):null;return!0}function es(){Dt=an=null,lt=!1}function Rc(){var n=di;return n!==null&&(Tn===null?Tn=n:Tn.push.apply(Tn,n),di=null),n}function Ba(n){di===null?di=[n]:di.push(n)}var Mc=z(null),ts=null,qr=null;function pi(n,i,a){_(Mc,i._currentValue),i._currentValue=a}function Ir(n){n._currentValue=Mc.current,W(Mc)}function Dc(n,i,a){for(;n!==null;){var o=n.alternate;if((n.childLanes&i)!==i?(n.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),n===a)break;n=n.return}}function Lc(n,i,a,o){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 k=p;p=h;for(var H=0;H<i.length;H++)if(k.context===i[H]){p.lanes|=a,k=p.alternate,k!==null&&(k.lanes|=a),Dc(p.return,a,n),o||(w=null);break e}p=k.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),Dc(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 Ms(n,i,a,o){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 k=h.type;Dn(h.pendingProps.value,w.value)||(n!==null?n.push(k):n=[k])}}else if(h===Re.current){if(w=h.alternate,w===null)throw Error(s(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(n!==null?n.push(fl):n=[fl])}h=h.return}n!==null&&Lc(i,n,a,o),i.flags|=262144}function mo(n){for(n=n.firstContext;n!==null;){if(!Dn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function ns(n){ts=n,qr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function ln(n){return tp(ts,n)}function po(n,i){return ts===null&&ns(n),tp(n,i)}function tp(n,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},qr===null){if(n===null)throw Error(s(308));qr=i,n.dependencies={lanes:0,firstContext:i},n.flags|=524288}else qr=qr.next=i;return a}var Hv=typeof AbortController<"u"?AbortController:function(){var n=[],i=this.signal={aborted:!1,addEventListener:function(a,o){n.push(o)}};this.abort=function(){i.aborted=!0,n.forEach(function(a){return a()})}},qv=e.unstable_scheduleCallback,Iv=e.unstable_NormalPriority,Gt={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function zc(){return{controller:new Hv,data:new Map,refCount:0}}function Pa(n){n.refCount--,n.refCount===0&&qv(Iv,function(){n.controller.abort()})}var Ha=null,Uc=0,Ds=0,Ls=null;function Fv(n,i){if(Ha===null){var a=Ha=[];Uc=0,Ds=qf(),Ls={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Uc++,i.then(np,np),i}function np(){if(--Uc===0&&Ha!==null){Ls!==null&&(Ls.status="fulfilled");var n=Ha;Ha=null,Ds=0,Ls=null;for(var i=0;i<n.length;i++)(0,n[i])()}}function $v(n,i){var a=[],o={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return n.then(function(){o.status="fulfilled",o.value=i;for(var h=0;h<a.length;h++)(0,a[h])(i)},function(h){for(o.status="rejected",o.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),o}var rp=q.S;q.S=function(n,i){Hg=mt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Fv(n,i),rp!==null&&rp(n,i)};var rs=z(null);function Bc(){var n=rs.current;return n!==null?n:At.pooledCache}function go(n,i){i===null?_(rs,rs.current):_(rs,i.pool)}function ip(){var n=Bc();return n===null?null:{parent:Gt._currentValue,pool:n}}var zs=Error(s(460)),Pc=Error(s(474)),yo=Error(s(542)),bo={then:function(){}};function sp(n){return n=n.status,n==="fulfilled"||n==="rejected"}function ap(n,i,a){switch(a=n[a],a===void 0?n.push(i):a!==i&&(i.then(Ur,Ur),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,op(n),n;default:if(typeof i.status=="string")i.then(Ur,Ur);else{if(n=At,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=i,n.status="pending",n.then(function(o){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=o}},function(o){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=o}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,op(n),n}throw ss=i,zs}}function is(n){try{var i=n._init;return i(n._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ss=a,zs):a}}var ss=null;function lp(){if(ss===null)throw Error(s(459));var n=ss;return ss=null,n}function op(n){if(n===zs||n===yo)throw Error(s(483))}var Us=null,qa=0;function xo(n){var i=qa;return qa+=1,Us===null&&(Us=[]),ap(Us,n,i)}function Ia(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 up(n){function i(K,X){if(n){var te=K.deletions;te===null?(K.deletions=[X],K.flags|=16):te.push(X)}}function a(K,X){if(!n)return null;for(;X!==null;)i(K,X),X=X.sibling;return null}function o(K){for(var X=new Map;K!==null;)K.key!==null?X.set(K.key,K):X.set(K.index,K),K=K.sibling;return X}function h(K,X){return K=Pr(K,X),K.index=0,K.sibling=null,K}function p(K,X,te){return K.index=te,n?(te=K.alternate,te!==null?(te=te.index,te<X?(K.flags|=67108866,X):te):(K.flags|=67108866,X)):(K.flags|=1048576,X)}function w(K){return n&&K.alternate===null&&(K.flags|=67108866),K}function k(K,X,te,he){return X===null||X.tag!==6?(X=Ac(te,K.mode,he),X.return=K,X):(X=h(X,te),X.return=K,X)}function H(K,X,te,he){var He=te.type;return He===T?fe(K,X,te.props.children,he,te.key):X!==null&&(X.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===F&&is(He)===X.type)?(X=h(X,te.props),Ia(X,te),X.return=K,X):(X=fo(te.type,te.key,te.props,null,K.mode,he),Ia(X,te),X.return=K,X)}function ne(K,X,te,he){return X===null||X.tag!==4||X.stateNode.containerInfo!==te.containerInfo||X.stateNode.implementation!==te.implementation?(X=Tc(te,K.mode,he),X.return=K,X):(X=h(X,te.children||[]),X.return=K,X)}function fe(K,X,te,he,He){return X===null||X.tag!==7?(X=Wi(te,K.mode,he,He),X.return=K,X):(X=h(X,te),X.return=K,X)}function ge(K,X,te){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=Ac(""+X,K.mode,te),X.return=K,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case v:return te=fo(X.type,X.key,X.props,null,K.mode,te),Ia(te,X),te.return=K,te;case S:return X=Tc(X,K.mode,te),X.return=K,X;case F:return X=is(X),ge(K,X,te)}if(re(X)||G(X))return X=Wi(X,K.mode,te,null),X.return=K,X;if(typeof X.then=="function")return ge(K,xo(X),te);if(X.$$typeof===I)return ge(K,po(K,X),te);vo(K,X)}return null}function ie(K,X,te,he){var He=X!==null?X.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return He!==null?null:k(K,X,""+te,he);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case v:return te.key===He?H(K,X,te,he):null;case S:return te.key===He?ne(K,X,te,he):null;case F:return te=is(te),ie(K,X,te,he)}if(re(te)||G(te))return He!==null?null:fe(K,X,te,he,null);if(typeof te.then=="function")return ie(K,X,xo(te),he);if(te.$$typeof===I)return ie(K,X,po(K,te),he);vo(K,te)}return null}function le(K,X,te,he,He){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return K=K.get(te)||null,k(X,K,""+he,He);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case v:return K=K.get(he.key===null?te:he.key)||null,H(X,K,he,He);case S:return K=K.get(he.key===null?te:he.key)||null,ne(X,K,he,He);case F:return he=is(he),le(K,X,te,he,He)}if(re(he)||G(he))return K=K.get(te)||null,fe(X,K,he,He,null);if(typeof he.then=="function")return le(K,X,te,xo(he),He);if(he.$$typeof===I)return le(K,X,te,po(X,he),He);vo(X,he)}return null}function ze(K,X,te,he){for(var He=null,ht=null,Ue=X,Ke=X=0,at=null;Ue!==null&&Ke<te.length;Ke++){Ue.index>Ke?(at=Ue,Ue=null):at=Ue.sibling;var dt=ie(K,Ue,te[Ke],he);if(dt===null){Ue===null&&(Ue=at);break}n&&Ue&&dt.alternate===null&&i(K,Ue),X=p(dt,X,Ke),ht===null?He=dt:ht.sibling=dt,ht=dt,Ue=at}if(Ke===te.length)return a(K,Ue),lt&&Hr(K,Ke),He;if(Ue===null){for(;Ke<te.length;Ke++)Ue=ge(K,te[Ke],he),Ue!==null&&(X=p(Ue,X,Ke),ht===null?He=Ue:ht.sibling=Ue,ht=Ue);return lt&&Hr(K,Ke),He}for(Ue=o(Ue);Ke<te.length;Ke++)at=le(Ue,K,Ke,te[Ke],he),at!==null&&(n&&at.alternate!==null&&Ue.delete(at.key===null?Ke:at.key),X=p(at,X,Ke),ht===null?He=at:ht.sibling=at,ht=at);return n&&Ue.forEach(function(Mi){return i(K,Mi)}),lt&&Hr(K,Ke),He}function $e(K,X,te,he){if(te==null)throw Error(s(151));for(var He=null,ht=null,Ue=X,Ke=X=0,at=null,dt=te.next();Ue!==null&&!dt.done;Ke++,dt=te.next()){Ue.index>Ke?(at=Ue,Ue=null):at=Ue.sibling;var Mi=ie(K,Ue,dt.value,he);if(Mi===null){Ue===null&&(Ue=at);break}n&&Ue&&Mi.alternate===null&&i(K,Ue),X=p(Mi,X,Ke),ht===null?He=Mi:ht.sibling=Mi,ht=Mi,Ue=at}if(dt.done)return a(K,Ue),lt&&Hr(K,Ke),He;if(Ue===null){for(;!dt.done;Ke++,dt=te.next())dt=ge(K,dt.value,he),dt!==null&&(X=p(dt,X,Ke),ht===null?He=dt:ht.sibling=dt,ht=dt);return lt&&Hr(K,Ke),He}for(Ue=o(Ue);!dt.done;Ke++,dt=te.next())dt=le(Ue,K,Ke,dt.value,he),dt!==null&&(n&&dt.alternate!==null&&Ue.delete(dt.key===null?Ke:dt.key),X=p(dt,X,Ke),ht===null?He=dt:ht.sibling=dt,ht=dt);return n&&Ue.forEach(function(tS){return i(K,tS)}),lt&&Hr(K,Ke),He}function St(K,X,te,he){if(typeof te=="object"&&te!==null&&te.type===T&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case v:e:{for(var He=te.key;X!==null;){if(X.key===He){if(He=te.type,He===T){if(X.tag===7){a(K,X.sibling),he=h(X,te.props.children),he.return=K,K=he;break e}}else if(X.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===F&&is(He)===X.type){a(K,X.sibling),he=h(X,te.props),Ia(he,te),he.return=K,K=he;break e}a(K,X);break}else i(K,X);X=X.sibling}te.type===T?(he=Wi(te.props.children,K.mode,he,te.key),he.return=K,K=he):(he=fo(te.type,te.key,te.props,null,K.mode,he),Ia(he,te),he.return=K,K=he)}return w(K);case S:e:{for(He=te.key;X!==null;){if(X.key===He)if(X.tag===4&&X.stateNode.containerInfo===te.containerInfo&&X.stateNode.implementation===te.implementation){a(K,X.sibling),he=h(X,te.children||[]),he.return=K,K=he;break e}else{a(K,X);break}else i(K,X);X=X.sibling}he=Tc(te,K.mode,he),he.return=K,K=he}return w(K);case F:return te=is(te),St(K,X,te,he)}if(re(te))return ze(K,X,te,he);if(G(te)){if(He=G(te),typeof He!="function")throw Error(s(150));return te=He.call(te),$e(K,X,te,he)}if(typeof te.then=="function")return St(K,X,xo(te),he);if(te.$$typeof===I)return St(K,X,po(K,te),he);vo(K,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,X!==null&&X.tag===6?(a(K,X.sibling),he=h(X,te),he.return=K,K=he):(a(K,X),he=Ac(te,K.mode,he),he.return=K,K=he),w(K)):a(K,X)}return function(K,X,te,he){try{qa=0;var He=St(K,X,te,he);return Us=null,He}catch(Ue){if(Ue===zs||Ue===yo)throw Ue;var ht=Ln(29,Ue,null,K.mode);return ht.lanes=he,ht.return=K,ht}finally{}}}var as=up(!0),cp=up(!1),gi=!1;function Hc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qc(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 yi(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function bi(n,i,a){var o=n.updateQueue;if(o===null)return null;if(o=o.shared,(pt&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=co(n),Gm(n,null,a),i}return uo(n,o,i,a),co(n)}function Fa(n,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var o=i.lanes;o&=n.pendingLanes,a|=o,i.lanes=a,Vi(n,a)}}function Ic(n,i){var a=n.updateQueue,o=n.alternate;if(o!==null&&(o=o.updateQueue,a===o)){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:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},n.updateQueue=a;return}n=a.lastBaseUpdate,n===null?a.firstBaseUpdate=i:n.next=i,a.lastBaseUpdate=i}var Fc=!1;function $a(){if(Fc){var n=Ls;if(n!==null)throw n}}function Ya(n,i,a,o){Fc=!1;var h=n.updateQueue;gi=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,k=h.shared.pending;if(k!==null){h.shared.pending=null;var H=k,ne=H.next;H.next=null,w===null?p=ne:w.next=ne,w=H;var fe=n.alternate;fe!==null&&(fe=fe.updateQueue,k=fe.lastBaseUpdate,k!==w&&(k===null?fe.firstBaseUpdate=ne:k.next=ne,fe.lastBaseUpdate=H))}if(p!==null){var ge=h.baseState;w=0,fe=ne=H=null,k=p;do{var ie=k.lane&-536870913,le=ie!==k.lane;if(le?(st&ie)===ie:(o&ie)===ie){ie!==0&&ie===Ds&&(Fc=!0),fe!==null&&(fe=fe.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var ze=n,$e=k;ie=i;var St=a;switch($e.tag){case 1:if(ze=$e.payload,typeof ze=="function"){ge=ze.call(St,ge,ie);break e}ge=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=$e.payload,ie=typeof ze=="function"?ze.call(St,ge,ie):ze,ie==null)break e;ge=g({},ge,ie);break e;case 2:gi=!0}}ie=k.callback,ie!==null&&(n.flags|=64,le&&(n.flags|=8192),le=h.callbacks,le===null?h.callbacks=[ie]:le.push(ie))}else le={lane:ie,tag:k.tag,payload:k.payload,callback:k.callback,next:null},fe===null?(ne=fe=le,H=ge):fe=fe.next=le,w|=ie;if(k=k.next,k===null){if(k=h.shared.pending,k===null)break;le=k,k=le.next,le.next=null,h.lastBaseUpdate=le,h.shared.pending=null}}while(!0);fe===null&&(H=ge),h.baseState=H,h.firstBaseUpdate=ne,h.lastBaseUpdate=fe,p===null&&(h.shared.lanes=0),_i|=w,n.lanes=w,n.memoizedState=ge}}function fp(n,i){if(typeof n!="function")throw Error(s(191,n));n.call(i)}function hp(n,i){var a=n.callbacks;if(a!==null)for(n.callbacks=null,n=0;n<a.length;n++)fp(a[n],i)}var Bs=z(null),wo=z(0);function dp(n,i){n=Qr,_(wo,n),_(Bs,i),Qr=n|i.baseLanes}function $c(){_(wo,Qr),_(Bs,Bs.current)}function Yc(){Qr=wo.current,W(Bs),W(wo)}var zn=z(null),ir=null;function xi(n){var i=n.alternate;_($t,$t.current&1),_(zn,n),ir===null&&(i===null||Bs.current!==null||i.memoizedState!==null)&&(ir=n)}function Vc(n){_($t,$t.current),_(zn,n),ir===null&&(ir=n)}function mp(n){n.tag===22?(_($t,$t.current),_(zn,n),ir===null&&(ir=n)):vi()}function vi(){_($t,$t.current),_(zn,zn.current)}function Un(n){W(zn),ir===n&&(ir=null),W($t)}var $t=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||Wf(a)||eh(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 Fr=0,Xe=null,vt=null,Jt=null,_o=!1,Ps=!1,ls=!1,ko=0,Va=0,Hs=null,Yv=0;function It(){throw Error(s(321))}function Gc(n,i){if(i===null)return!1;for(var a=0;a<i.length&&a<n.length;a++)if(!Dn(n[a],i[a]))return!1;return!0}function Jc(n,i,a,o,h,p){return Fr=p,Xe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,q.H=n===null||n.memoizedState===null?Qp:cf,ls=!1,p=a(o,h),ls=!1,Ps&&(p=gp(i,a,o,h)),pp(n),p}function pp(n){q.H=Xa;var i=vt!==null&&vt.next!==null;if(Fr=0,Jt=vt=Xe=null,_o=!1,Va=0,Hs=null,i)throw Error(s(300));n===null||Xt||(n=n.dependencies,n!==null&&mo(n)&&(Xt=!0))}function gp(n,i,a,o){Xe=n;var h=0;do{if(Ps&&(Hs=null),Va=0,Ps=!1,25<=h)throw Error(s(301));if(h+=1,Jt=vt=null,n.updateQueue!=null){var p=n.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}q.H=Zp,p=i(a,o)}while(Ps);return p}function Vv(){var n=q.H,i=n.useState()[0];return i=typeof i.then=="function"?Ga(i):i,n=n.useState()[0],(vt!==null?vt.memoizedState:null)!==n&&(Xe.flags|=1024),i}function Xc(){var n=ko!==0;return ko=0,n}function Kc(n,i,a){i.updateQueue=n.updateQueue,i.flags&=-2053,n.lanes&=~a}function Qc(n){if(_o){for(n=n.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}_o=!1}Fr=0,Jt=vt=Xe=null,Ps=!1,Va=ko=0,Hs=null}function pn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?Xe.memoizedState=Jt=n:Jt=Jt.next=n,Jt}function Yt(){if(vt===null){var n=Xe.alternate;n=n!==null?n.memoizedState:null}else n=vt.next;var i=Jt===null?Xe.memoizedState:Jt.next;if(i!==null)Jt=i,vt=n;else{if(n===null)throw Xe.alternate===null?Error(s(467)):Error(s(310));vt=n,n={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},Jt===null?Xe.memoizedState=Jt=n:Jt=Jt.next=n}return Jt}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ga(n){var i=Va;return Va+=1,Hs===null&&(Hs=[]),n=ap(Hs,n,i),i=Xe,(Jt===null?i.memoizedState:Jt.next)===null&&(i=i.alternate,q.H=i===null||i.memoizedState===null?Qp:cf),n}function Co(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ga(n);if(n.$$typeof===I)return ln(n)}throw Error(s(438,String(n)))}function Zc(n){var i=null,a=Xe.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var o=Xe.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=Eo(),Xe.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(n),o=0;o<n;o++)a[o]=L;return i.index++,a}function $r(n,i){return typeof i=="function"?i(n):i}function Ao(n){var i=Yt();return Wc(i,vt,n)}function Wc(n,i,a){var o=n.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=a;var h=n.baseQueue,p=o.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}i.baseQueue=h=p,o.pending=null}if(p=n.baseState,h===null)n.memoizedState=p;else{i=h.next;var k=w=null,H=null,ne=i,fe=!1;do{var ge=ne.lane&-536870913;if(ge!==ne.lane?(st&ge)===ge:(Fr&ge)===ge){var ie=ne.revertLane;if(ie===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),ge===Ds&&(fe=!0);else if((Fr&ie)===ie){ne=ne.next,ie===Ds&&(fe=!0);continue}else ge={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},H===null?(k=H=ge,w=p):H=H.next=ge,Xe.lanes|=ie,_i|=ie;ge=ne.action,ls&&a(p,ge),p=ne.hasEagerState?ne.eagerState:a(p,ge)}else ie={lane:ge,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},H===null?(k=H=ie,w=p):H=H.next=ie,Xe.lanes|=ge,_i|=ge;ne=ne.next}while(ne!==null&&ne!==i);if(H===null?w=p:H.next=k,!Dn(p,n.memoizedState)&&(Xt=!0,fe&&(a=Ls,a!==null)))throw a;n.memoizedState=p,n.baseState=w,n.baseQueue=H,o.lastRenderedState=p}return h===null&&(o.lanes=0),[n.memoizedState,o.dispatch]}function ef(n){var i=Yt(),a=i.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=n;var o=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);Dn(p,i.memoizedState)||(Xt=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,o]}function yp(n,i,a){var o=Xe,h=Yt(),p=lt;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var w=!Dn((vt||h).memoizedState,a);if(w&&(h.memoizedState=a,Xt=!0),h=h.queue,rf(vp.bind(null,o,h,n),[n]),h.getSnapshot!==i||w||Jt!==null&&Jt.memoizedState.tag&1){if(o.flags|=2048,qs(9,{destroy:void 0},xp.bind(null,o,h,a,i),null),At===null)throw Error(s(349));p||(Fr&127)!==0||bp(o,i,a)}return a}function bp(n,i,a){n.flags|=16384,n={getSnapshot:i,value:a},i=Xe.updateQueue,i===null?(i=Eo(),Xe.updateQueue=i,i.stores=[n]):(a=i.stores,a===null?i.stores=[n]:a.push(n))}function xp(n,i,a,o){i.value=a,i.getSnapshot=o,wp(i)&&Sp(n)}function vp(n,i,a){return a(function(){wp(i)&&Sp(n)})}function wp(n){var i=n.getSnapshot;n=n.value;try{var a=i();return!Dn(n,a)}catch{return!0}}function Sp(n){var i=Zi(n,2);i!==null&&jn(i,n,2)}function tf(n){var i=pn();if(typeof n=="function"){var a=n;if(n=a(),ls){qe(!0);try{a()}finally{qe(!1)}}}return i.memoizedState=i.baseState=n,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$r,lastRenderedState:n},i}function _p(n,i,a,o){return n.baseState=a,Wc(n,vt,typeof o=="function"?o:$r)}function Gv(n,i,a,o,h){if(No(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)}};q.T!==null?a(!0):p.isTransition=!1,o(p),a=i.pending,a===null?(p.next=i.pending=p,kp(i,p)):(p.next=a.next,i.pending=a.next=p)}}function kp(n,i){var a=i.action,o=i.payload,h=n.state;if(i.isTransition){var p=q.T,w={};q.T=w;try{var k=a(h,o),H=q.S;H!==null&&H(w,k),Ep(n,i,k)}catch(ne){nf(n,i,ne)}finally{p!==null&&w.types!==null&&(p.types=w.types),q.T=p}}else try{p=a(h,o),Ep(n,i,p)}catch(ne){nf(n,i,ne)}}function Ep(n,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){Cp(n,i,o)},function(o){return nf(n,i,o)}):Cp(n,i,a)}function Cp(n,i,a){i.status="fulfilled",i.value=a,Ap(i),n.state=a,i=n.pending,i!==null&&(a=i.next,a===i?n.pending=null:(a=a.next,i.next=a,kp(n,a)))}function nf(n,i,a){var o=n.pending;if(n.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=a,Ap(i),i=i.next;while(i!==o)}n.action=null}function Ap(n){n=n.listeners;for(var i=0;i<n.length;i++)(0,n[i])()}function Tp(n,i){return i}function jp(n,i){if(lt){var a=At.formState;if(a!==null){e:{var o=Xe;if(lt){if(Dt){t:{for(var h=Dt,p=rr;h.nodeType!==8;){if(!p){h=null;break t}if(h=sr(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Dt=sr(h.nextSibling),o=h.data==="F!";break e}}mi(o)}o=!1}o&&(i=a[0])}}return a=pn(),a.memoizedState=a.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Tp,lastRenderedState:i},a.queue=o,a=Jp.bind(null,Xe,o),o.dispatch=a,o=tf(!1),p=uf.bind(null,Xe,!1,o.queue),o=pn(),h={state:i,dispatch:null,action:n,pending:null},o.queue=h,a=Gv.bind(null,Xe,h,p,a),h.dispatch=a,o.memoizedState=n,[i,a,!1]}function Np(n){var i=Yt();return Op(i,vt,n)}function Op(n,i,a){if(i=Wc(n,i,Tp)[0],n=Ao($r)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Ga(i)}catch(w){throw w===zs?yo:w}else o=i;i=Yt();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(Xe.flags|=2048,qs(9,{destroy:void 0},Jv.bind(null,h,a),null)),[o,p,n]}function Jv(n,i){n.action=i}function Rp(n){var i=Yt(),a=vt;if(a!==null)return Op(i,a,n);Yt(),i=i.memoizedState,a=Yt();var o=a.queue.dispatch;return a.memoizedState=n,[i,o,!1]}function qs(n,i,a,o){return n={tag:n,create:a,deps:o,inst:i,next:null},i=Xe.updateQueue,i===null&&(i=Eo(),Xe.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=n.next=n:(o=a.next,a.next=n,n.next=o,i.lastEffect=n),n}function Mp(){return Yt().memoizedState}function To(n,i,a,o){var h=pn();Xe.flags|=n,h.memoizedState=qs(1|i,{destroy:void 0},a,o===void 0?null:o)}function jo(n,i,a,o){var h=Yt();o=o===void 0?null:o;var p=h.memoizedState.inst;vt!==null&&o!==null&&Gc(o,vt.memoizedState.deps)?h.memoizedState=qs(i,p,a,o):(Xe.flags|=n,h.memoizedState=qs(1|i,p,a,o))}function Dp(n,i){To(8390656,8,n,i)}function rf(n,i){jo(2048,8,n,i)}function Xv(n){Xe.flags|=4;var i=Xe.updateQueue;if(i===null)i=Eo(),Xe.updateQueue=i,i.events=[n];else{var a=i.events;a===null?i.events=[n]:a.push(n)}}function Lp(n){var i=Yt().memoizedState;return Xv({ref:i,nextImpl:n}),function(){if((pt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function zp(n,i){return jo(4,2,n,i)}function Up(n,i){return jo(4,4,n,i)}function Bp(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 Pp(n,i,a){a=a!=null?a.concat([n]):null,jo(4,4,Bp.bind(null,i,n),a)}function sf(){}function Hp(n,i){var a=Yt();i=i===void 0?null:i;var o=a.memoizedState;return i!==null&&Gc(i,o[1])?o[0]:(a.memoizedState=[n,i],n)}function qp(n,i){var a=Yt();i=i===void 0?null:i;var o=a.memoizedState;if(i!==null&&Gc(i,o[1]))return o[0];if(o=n(),ls){qe(!0);try{n()}finally{qe(!1)}}return a.memoizedState=[o,i],o}function af(n,i,a){return a===void 0||(Fr&1073741824)!==0&&(st&261930)===0?n.memoizedState=i:(n.memoizedState=a,n=Ig(),Xe.lanes|=n,_i|=n,a)}function Ip(n,i,a,o){return Dn(a,i)?a:Bs.current!==null?(n=af(n,a,o),Dn(n,i)||(Xt=!0),n):(Fr&42)===0||(Fr&1073741824)!==0&&(st&261930)===0?(Xt=!0,n.memoizedState=a):(n=Ig(),Xe.lanes|=n,_i|=n,i)}function Fp(n,i,a,o,h){var p=Y.p;Y.p=p!==0&&8>p?p:8;var w=q.T,k={};q.T=k,uf(n,!1,i,a);try{var H=h(),ne=q.S;if(ne!==null&&ne(k,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var fe=$v(H,o);Ja(n,i,fe,Hn(n))}else Ja(n,i,o,Hn(n))}catch(ge){Ja(n,i,{then:function(){},status:"rejected",reason:ge},Hn())}finally{Y.p=p,w!==null&&k.types!==null&&(w.types=k.types),q.T=w}}function Kv(){}function lf(n,i,a,o){if(n.tag!==5)throw Error(s(476));var h=$p(n).queue;Fp(n,h,i,ae,a===null?Kv:function(){return Yp(n),a(o)})}function $p(n){var i=n.memoizedState;if(i!==null)return i;i={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$r,lastRenderedState:ae},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$r,lastRenderedState:a},next:null},n.memoizedState=i,n=n.alternate,n!==null&&(n.memoizedState=i),i}function Yp(n){var i=$p(n);i.next===null&&(i=n.alternate.memoizedState),Ja(n,i.next.queue,{},Hn())}function of(){return ln(fl)}function Vp(){return Yt().memoizedState}function Gp(){return Yt().memoizedState}function Qv(n){for(var i=n.return;i!==null;){switch(i.tag){case 24:case 3:var a=Hn();n=yi(a);var o=bi(i,n,a);o!==null&&(jn(o,i,a),Fa(o,i,a)),i={cache:zc()},n.payload=i;return}i=i.return}}function Zv(n,i,a){var o=Hn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},No(n)?Xp(i,a):(a=Ec(n,i,a,o),a!==null&&(jn(a,n,o),Kp(a,i,o)))}function Jp(n,i,a){var o=Hn();Ja(n,i,a,o)}function Ja(n,i,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(No(n))Xp(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,k=p(w,a);if(h.hasEagerState=!0,h.eagerState=k,Dn(k,w))return uo(n,i,h,0),At===null&&oo(),!1}catch{}finally{}if(a=Ec(n,i,h,o),a!==null)return jn(a,n,o),Kp(a,i,o),!0}return!1}function uf(n,i,a,o){if(o={lane:2,revertLane:qf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},No(n)){if(i)throw Error(s(479))}else i=Ec(n,a,o,2),i!==null&&jn(i,n,2)}function No(n){var i=n.alternate;return n===Xe||i!==null&&i===Xe}function Xp(n,i){Ps=_o=!0;var a=n.pending;a===null?i.next=i:(i.next=a.next,a.next=i),n.pending=i}function Kp(n,i,a){if((a&4194048)!==0){var o=i.lanes;o&=n.pendingLanes,a|=o,i.lanes=a,Vi(n,a)}}var Xa={readContext:ln,use:Co,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useLayoutEffect:It,useInsertionEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useSyncExternalStore:It,useId:It,useHostTransitionStatus:It,useFormState:It,useActionState:It,useOptimistic:It,useMemoCache:It,useCacheRefresh:It};Xa.useEffectEvent=It;var Qp={readContext:ln,use:Co,useCallback:function(n,i){return pn().memoizedState=[n,i===void 0?null:i],n},useContext:ln,useEffect:Dp,useImperativeHandle:function(n,i,a){a=a!=null?a.concat([n]):null,To(4194308,4,Bp.bind(null,i,n),a)},useLayoutEffect:function(n,i){return To(4194308,4,n,i)},useInsertionEffect:function(n,i){To(4,2,n,i)},useMemo:function(n,i){var a=pn();i=i===void 0?null:i;var o=n();if(ls){qe(!0);try{n()}finally{qe(!1)}}return a.memoizedState=[o,i],o},useReducer:function(n,i,a){var o=pn();if(a!==void 0){var h=a(i);if(ls){qe(!0);try{a(i)}finally{qe(!1)}}}else h=i;return o.memoizedState=o.baseState=h,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:h},o.queue=n,n=n.dispatch=Zv.bind(null,Xe,n),[o.memoizedState,n]},useRef:function(n){var i=pn();return n={current:n},i.memoizedState=n},useState:function(n){n=tf(n);var i=n.queue,a=Jp.bind(null,Xe,i);return i.dispatch=a,[n.memoizedState,a]},useDebugValue:sf,useDeferredValue:function(n,i){var a=pn();return af(a,n,i)},useTransition:function(){var n=tf(!1);return n=Fp.bind(null,Xe,n.queue,!0,!1),pn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,i,a){var o=Xe,h=pn();if(lt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),At===null)throw Error(s(349));(st&127)!==0||bp(o,i,a)}h.memoizedState=a;var p={value:a,getSnapshot:i};return h.queue=p,Dp(vp.bind(null,o,p,n),[n]),o.flags|=2048,qs(9,{destroy:void 0},xp.bind(null,o,p,a,i),null),a},useId:function(){var n=pn(),i=At.identifierPrefix;if(lt){var a=Cr,o=Er;a=(o&~(1<<32-Pe(o)-1)).toString(32)+a,i="_"+i+"R_"+a,a=ko++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Yv++,i="_"+i+"r_"+a.toString(32)+"_";return n.memoizedState=i},useHostTransitionStatus:of,useFormState:jp,useActionState:jp,useOptimistic:function(n){var i=pn();i.memoizedState=i.baseState=n;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=uf.bind(null,Xe,!0,a),a.dispatch=i,[n,i]},useMemoCache:Zc,useCacheRefresh:function(){return pn().memoizedState=Qv.bind(null,Xe)},useEffectEvent:function(n){var i=pn(),a={impl:n};return i.memoizedState=a,function(){if((pt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},cf={readContext:ln,use:Co,useCallback:Hp,useContext:ln,useEffect:rf,useImperativeHandle:Pp,useInsertionEffect:zp,useLayoutEffect:Up,useMemo:qp,useReducer:Ao,useRef:Mp,useState:function(){return Ao($r)},useDebugValue:sf,useDeferredValue:function(n,i){var a=Yt();return Ip(a,vt.memoizedState,n,i)},useTransition:function(){var n=Ao($r)[0],i=Yt().memoizedState;return[typeof n=="boolean"?n:Ga(n),i]},useSyncExternalStore:yp,useId:Vp,useHostTransitionStatus:of,useFormState:Np,useActionState:Np,useOptimistic:function(n,i){var a=Yt();return _p(a,vt,n,i)},useMemoCache:Zc,useCacheRefresh:Gp};cf.useEffectEvent=Lp;var Zp={readContext:ln,use:Co,useCallback:Hp,useContext:ln,useEffect:rf,useImperativeHandle:Pp,useInsertionEffect:zp,useLayoutEffect:Up,useMemo:qp,useReducer:ef,useRef:Mp,useState:function(){return ef($r)},useDebugValue:sf,useDeferredValue:function(n,i){var a=Yt();return vt===null?af(a,n,i):Ip(a,vt.memoizedState,n,i)},useTransition:function(){var n=ef($r)[0],i=Yt().memoizedState;return[typeof n=="boolean"?n:Ga(n),i]},useSyncExternalStore:yp,useId:Vp,useHostTransitionStatus:of,useFormState:Rp,useActionState:Rp,useOptimistic:function(n,i){var a=Yt();return vt!==null?_p(a,vt,n,i):(a.baseState=n,[n,a.queue.dispatch])},useMemoCache:Zc,useCacheRefresh:Gp};Zp.useEffectEvent=Lp;function ff(n,i,a,o){i=n.memoizedState,a=a(o,i),a=a==null?i:g({},i,a),n.memoizedState=a,n.lanes===0&&(n.updateQueue.baseState=a)}var hf={enqueueSetState:function(n,i,a){n=n._reactInternals;var o=Hn(),h=yi(o);h.payload=i,a!=null&&(h.callback=a),i=bi(n,h,o),i!==null&&(jn(i,n,o),Fa(i,n,o))},enqueueReplaceState:function(n,i,a){n=n._reactInternals;var o=Hn(),h=yi(o);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=bi(n,h,o),i!==null&&(jn(i,n,o),Fa(i,n,o))},enqueueForceUpdate:function(n,i){n=n._reactInternals;var a=Hn(),o=yi(a);o.tag=2,i!=null&&(o.callback=i),i=bi(n,o,a),i!==null&&(jn(i,n,a),Fa(i,n,a))}};function Wp(n,i,a,o,h,p,w){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(o,p,w):i.prototype&&i.prototype.isPureReactComponent?!La(a,o)||!La(h,p):!0}function eg(n,i,a,o){n=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,o),i.state!==n&&hf.enqueueReplaceState(i,i.state,null)}function os(n,i){var a=i;if("ref"in i){a={};for(var o in i)o!=="ref"&&(a[o]=i[o])}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 tg(n){lo(n)}function ng(n){console.error(n)}function rg(n){lo(n)}function Oo(n,i){try{var a=n.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function ig(n,i,a){try{var o=n.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function df(n,i,a){return a=yi(a),a.tag=3,a.payload={element:null},a.callback=function(){Oo(n,i)},a}function sg(n){return n=yi(n),n.tag=3,n}function ag(n,i,a,o){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;n.payload=function(){return h(p)},n.callback=function(){ig(i,a,o)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(n.callback=function(){ig(i,a,o),typeof h!="function"&&(ki===null?ki=new Set([this]):ki.add(this));var k=o.stack;this.componentDidCatch(o.value,{componentStack:k!==null?k:""})})}function Wv(n,i,a,o,h){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=a.alternate,i!==null&&Ms(i,a,h,!0),a=zn.current,a!==null){switch(a.tag){case 31:case 13:return ir===null?Fo():a.alternate===null&&Ft===0&&(Ft=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===bo?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([o]):i.add(o),Bf(n,o,h)),!1;case 22:return a.flags|=65536,o===bo?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([o]):a.add(o)),Bf(n,o,h)),!1}throw Error(s(435,a.tag))}return Bf(n,o,h),Fo(),!1}if(lt)return i=zn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==Oc&&(n=Error(s(422),{cause:o}),Ba(er(n,a)))):(o!==Oc&&(i=Error(s(423),{cause:o}),Ba(er(i,a))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,o=er(o,a),h=df(n.stateNode,o,h),Ic(n,h),Ft!==4&&(Ft=2)),!1;var p=Error(s(520),{cause:o});if(p=er(p,a),rl===null?rl=[p]:rl.push(p),Ft!==4&&(Ft=2),i===null)return!0;o=er(o,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,n=h&-h,a.lanes|=n,n=df(a.stateNode,o,n),Ic(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"&&(ki===null||!ki.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=sg(h),ag(h,n,a,o),Ic(a,h),!1}a=a.return}while(a!==null);return!1}var mf=Error(s(461)),Xt=!1;function on(n,i,a,o){i.child=n===null?cp(i,null,a,o):as(i,n.child,a,o)}function lg(n,i,a,o,h){a=a.render;var p=i.ref;if("ref"in o){var w={};for(var k in o)k!=="ref"&&(w[k]=o[k])}else w=o;return ns(i),o=Jc(n,i,a,w,p,h),k=Xc(),n!==null&&!Xt?(Kc(n,i,h),Yr(n,i,h)):(lt&&k&&jc(i),i.flags|=1,on(n,i,o,h),i.child)}function og(n,i,a,o,h){if(n===null){var p=a.type;return typeof p=="function"&&!Cc(p)&&p.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=p,ug(n,i,p,o,h)):(n=fo(a.type,null,o,i,i.mode,h),n.ref=i.ref,n.return=i,i.child=n)}if(p=n.child,!Sf(n,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:La,a(w,o)&&n.ref===i.ref)return Yr(n,i,h)}return i.flags|=1,n=Pr(p,o),n.ref=i.ref,n.return=i,i.child=n}function ug(n,i,a,o,h){if(n!==null){var p=n.memoizedProps;if(La(p,o)&&n.ref===i.ref)if(Xt=!1,i.pendingProps=o=p,Sf(n,h))(n.flags&131072)!==0&&(Xt=!0);else return i.lanes=n.lanes,Yr(n,i,h)}return pf(n,i,a,o,h)}function cg(n,i,a,o){var h=o.children,p=n!==null?n.memoizedState:null;if(n===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((i.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,n!==null){for(o=i.child=n.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,i.child=null;return fg(n,i,p,a,o)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},n!==null&&go(i,p!==null?p.cachePool:null),p!==null?dp(i,p):$c(),mp(i);else return o=i.lanes=536870912,fg(n,i,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(go(i,p.cachePool),dp(i,p),vi(),i.memoizedState=null):(n!==null&&go(i,null),$c(),vi());return on(n,i,h,a),i.child}function Ka(n,i){return n!==null&&n.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function fg(n,i,a,o,h){var p=Bc();return p=p===null?null:{parent:Gt._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},n!==null&&go(i,null),$c(),mp(i),n!==null&&Ms(n,i,o,!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 hg(n,i,a){return as(i,n.child,null,a),n=Ro(i,i.pendingProps),n.flags|=2,Un(i),i.memoizedState=null,n}function ew(n,i,a){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,n===null){if(lt){if(o.mode==="hidden")return n=Ro(i,o),i.lanes=536870912,Ka(null,n);if(Vc(i),(n=Dt)?(n=ky(n,rr),n=n!==null&&n.data==="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:hi!==null?{id:Er,overflow:Cr}:null,retryLane:536870912,hydrationErrors:null},a=Xm(n),a.return=i,i.child=a,an=i,Dt=null)):n=null,n===null)throw mi(i);return i.lanes=536870912,null}return Ro(i,o)}var p=n.memoizedState;if(p!==null){var w=p.dehydrated;if(Vc(i),h)if(i.flags&256)i.flags&=-257,i=hg(n,i,a);else if(i.memoizedState!==null)i.child=n.child,i.flags|=128,i=null;else throw Error(s(558));else if(Xt||Ms(n,i,a,!1),h=(a&n.childLanes)!==0,Xt||h){if(o=At,o!==null&&(w=ci(o,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,Zi(n,w),jn(o,n,w),mf;Fo(),i=hg(n,i,a)}else n=p.treeContext,Dt=sr(w.nextSibling),an=i,lt=!0,di=null,rr=!1,n!==null&&Zm(i,n),i=Ro(i,o),i.flags|=4096;return i}return n=Pr(n.child,{mode:o.mode,children:o.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 pf(n,i,a,o,h){return ns(i),a=Jc(n,i,a,o,void 0,h),o=Xc(),n!==null&&!Xt?(Kc(n,i,h),Yr(n,i,h)):(lt&&o&&jc(i),i.flags|=1,on(n,i,a,h),i.child)}function dg(n,i,a,o,h,p){return ns(i),i.updateQueue=null,a=gp(i,o,a,h),pp(n),o=Xc(),n!==null&&!Xt?(Kc(n,i,p),Yr(n,i,p)):(lt&&o&&jc(i),i.flags|=1,on(n,i,a,p),i.child)}function mg(n,i,a,o,h){if(ns(i),i.stateNode===null){var p=js,w=a.contextType;typeof w=="object"&&w!==null&&(p=ln(w)),p=new a(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=hf,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},Hc(i),w=a.contextType,p.context=typeof w=="object"&&w!==null?ln(w):js,p.state=i.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(ff(i,a,w,o),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&&hf.enqueueReplaceState(p,p.state,null),Ya(i,o,p,h),$a(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(n===null){p=i.stateNode;var k=i.memoizedProps,H=os(a,k);p.props=H;var ne=p.context,fe=a.contextType;w=js,typeof fe=="object"&&fe!==null&&(w=ln(fe));var ge=a.getDerivedStateFromProps;fe=typeof ge=="function"||typeof p.getSnapshotBeforeUpdate=="function",k=i.pendingProps!==k,fe||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(k||ne!==w)&&eg(i,p,o,w),gi=!1;var ie=i.memoizedState;p.state=ie,Ya(i,o,p,h),$a(),ne=i.memoizedState,k||ie!==ne||gi?(typeof ge=="function"&&(ff(i,a,ge,o),ne=i.memoizedState),(H=gi||Wp(i,a,H,o,ie,ne,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=o,i.memoizedState=ne),p.props=o,p.state=ne,p.context=w,o=H):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,qc(n,i),w=i.memoizedProps,fe=os(a,w),p.props=fe,ge=i.pendingProps,ie=p.context,ne=a.contextType,H=js,typeof ne=="object"&&ne!==null&&(H=ln(ne)),k=a.getDerivedStateFromProps,(ne=typeof k=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ge||ie!==H)&&eg(i,p,o,H),gi=!1,ie=i.memoizedState,p.state=ie,Ya(i,o,p,h),$a();var le=i.memoizedState;w!==ge||ie!==le||gi||n!==null&&n.dependencies!==null&&mo(n.dependencies)?(typeof k=="function"&&(ff(i,a,k,o),le=i.memoizedState),(fe=gi||Wp(i,a,fe,o,ie,le,H)||n!==null&&n.dependencies!==null&&mo(n.dependencies))?(ne||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,le,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,le,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=o,i.memoizedState=le),p.props=o,p.state=le,p.context=H,o=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),o=!1)}return p=o,Mo(n,i),o=(i.flags&128)!==0,p||o?(p=i.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,n!==null&&o?(i.child=as(i,n.child,null,h),i.child=as(i,null,a,h)):on(n,i,a,h),i.memoizedState=p.state,n=i.child):n=Yr(n,i,h),n}function pg(n,i,a,o){return es(),i.flags|=256,on(n,i,a,o),i.child}var gf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yf(n){return{baseLanes:n,cachePool:ip()}}function bf(n,i,a){return n=n!==null?n.childLanes&~a:0,i&&(n|=Pn),n}function gg(n,i,a){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,w;if((w=p)||(w=n!==null&&n.memoizedState===null?!1:($t.current&2)!==0),w&&(h=!0,i.flags&=-129),w=(i.flags&32)!==0,i.flags&=-33,n===null){if(lt){if(h?xi(i):vi(),(n=Dt)?(n=ky(n,rr),n=n!==null&&n.data!=="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:hi!==null?{id:Er,overflow:Cr}:null,retryLane:536870912,hydrationErrors:null},a=Xm(n),a.return=i,i.child=a,an=i,Dt=null)):n=null,n===null)throw mi(i);return eh(n)?i.lanes=32:i.lanes=536870912,null}var k=o.children;return o=o.fallback,h?(vi(),h=i.mode,k=Do({mode:"hidden",children:k},h),o=Wi(o,h,a,null),k.return=i,o.return=i,k.sibling=o,i.child=k,o=i.child,o.memoizedState=yf(a),o.childLanes=bf(n,w,a),i.memoizedState=gf,Ka(null,o)):(xi(i),xf(i,k))}var H=n.memoizedState;if(H!==null&&(k=H.dehydrated,k!==null)){if(p)i.flags&256?(xi(i),i.flags&=-257,i=vf(n,i,a)):i.memoizedState!==null?(vi(),i.child=n.child,i.flags|=128,i=null):(vi(),k=o.fallback,h=i.mode,o=Do({mode:"visible",children:o.children},h),k=Wi(k,h,a,null),k.flags|=2,o.return=i,k.return=i,o.sibling=k,i.child=o,as(i,n.child,null,a),o=i.child,o.memoizedState=yf(a),o.childLanes=bf(n,w,a),i.memoizedState=gf,i=Ka(null,o));else if(xi(i),eh(k)){if(w=k.nextSibling&&k.nextSibling.dataset,w)var ne=w.dgst;w=ne,o=Error(s(419)),o.stack="",o.digest=w,Ba({value:o,source:null,stack:null}),i=vf(n,i,a)}else if(Xt||Ms(n,i,a,!1),w=(a&n.childLanes)!==0,Xt||w){if(w=At,w!==null&&(o=ci(w,a),o!==0&&o!==H.retryLane))throw H.retryLane=o,Zi(n,o),jn(w,n,o),mf;Wf(k)||Fo(),i=vf(n,i,a)}else Wf(k)?(i.flags|=192,i.child=n.child,i=null):(n=H.treeContext,Dt=sr(k.nextSibling),an=i,lt=!0,di=null,rr=!1,n!==null&&Zm(i,n),i=xf(i,o.children),i.flags|=4096);return i}return h?(vi(),k=o.fallback,h=i.mode,H=n.child,ne=H.sibling,o=Pr(H,{mode:"hidden",children:o.children}),o.subtreeFlags=H.subtreeFlags&65011712,ne!==null?k=Pr(ne,k):(k=Wi(k,h,a,null),k.flags|=2),k.return=i,o.return=i,o.sibling=k,i.child=o,Ka(null,o),o=i.child,k=n.child.memoizedState,k===null?k=yf(a):(h=k.cachePool,h!==null?(H=Gt._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=ip(),k={baseLanes:k.baseLanes|a,cachePool:h}),o.memoizedState=k,o.childLanes=bf(n,w,a),i.memoizedState=gf,Ka(n.child,o)):(xi(i),a=n.child,n=a.sibling,a=Pr(a,{mode:"visible",children:o.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 xf(n,i){return i=Do({mode:"visible",children:i},n.mode),i.return=n,n.child=i}function Do(n,i){return n=Ln(22,n,null,i),n.lanes=0,n}function vf(n,i,a){return as(i,n.child,null,a),n=xf(i,i.pendingProps.children),n.flags|=2,i.memoizedState=null,n}function yg(n,i,a){n.lanes|=i;var o=n.alternate;o!==null&&(o.lanes|=i),Dc(n.return,i,a)}function wf(n,i,a,o,h,p){var w=n.memoizedState;w===null?n.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=i,w.rendering=null,w.renderingStartTime=0,w.last=o,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function bg(n,i,a){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var w=$t.current,k=(w&2)!==0;if(k?(w=w&1|2,i.flags|=128):w&=1,_($t,w),on(n,i,o,a),o=lt?Ua:0,!k&&n!==null&&(n.flags&128)!==0)e:for(n=i.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&yg(n,a,i);else if(n.tag===19)yg(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),wf(i,!1,h,a,p,o);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}wf(i,!0,a,null,p,o);break;case"together":wf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Yr(n,i,a){if(n!==null&&(i.dependencies=n.dependencies),_i|=i.lanes,(a&i.childLanes)===0)if(n!==null){if(Ms(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=Pr(n,n.pendingProps),i.child=a,a.return=i;n.sibling!==null;)n=n.sibling,a=a.sibling=Pr(n,n.pendingProps),a.return=i;a.sibling=null}return i.child}function Sf(n,i){return(n.lanes&i)!==0?!0:(n=n.dependencies,!!(n!==null&&mo(n)))}function tw(n,i,a){switch(i.tag){case 3:Ye(i,i.stateNode.containerInfo),pi(i,Gt,n.memoizedState.cache),es();break;case 27:case 5:ot(i);break;case 4:Ye(i,i.stateNode.containerInfo);break;case 10:pi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Vc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(xi(i),i.flags|=128,null):(a&i.child.childLanes)!==0?gg(n,i,a):(xi(i),n=Yr(n,i,a),n!==null?n.sibling:null);xi(i);break;case 19:var h=(n.flags&128)!==0;if(o=(a&i.childLanes)!==0,o||(Ms(n,i,a,!1),o=(a&i.childLanes)!==0),h){if(o)return bg(n,i,a);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),_($t,$t.current),o)break;return null;case 22:return i.lanes=0,cg(n,i,a,i.pendingProps);case 24:pi(i,Gt,n.memoizedState.cache)}return Yr(n,i,a)}function xg(n,i,a){if(n!==null)if(n.memoizedProps!==i.pendingProps)Xt=!0;else{if(!Sf(n,a)&&(i.flags&128)===0)return Xt=!1,tw(n,i,a);Xt=(n.flags&131072)!==0}else Xt=!1,lt&&(i.flags&1048576)!==0&&Qm(i,Ua,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(n=is(i.elementType),i.type=n,typeof n=="function")Cc(n)?(o=os(n,o),i.tag=1,i=mg(null,i,n,o,a)):(i.tag=0,i=pf(null,i,n,o,a));else{if(n!=null){var h=n.$$typeof;if(h===ee){i.tag=11,i=lg(null,i,n,o,a);break e}else if(h===Z){i.tag=14,i=og(null,i,n,o,a);break e}}throw i=oe(n)||n,Error(s(306,i,""))}}return i;case 0:return pf(n,i,i.type,i.pendingProps,a);case 1:return o=i.type,h=os(o,i.pendingProps),mg(n,i,o,h,a);case 3:e:{if(Ye(i,i.stateNode.containerInfo),n===null)throw Error(s(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,qc(n,i),Ya(i,o,null,a);var w=i.memoizedState;if(o=w.cache,pi(i,Gt,o),o!==p.cache&&Lc(i,[Gt],a,!0),$a(),o=w.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:w.cache},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){i=pg(n,i,o,a);break e}else if(o!==h){h=er(Error(s(424)),i),Ba(h),i=pg(n,i,o,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(Dt=sr(n.firstChild),an=i,lt=!0,di=null,rr=!0,a=cp(i,null,o,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(es(),o===h){i=Yr(n,i,a);break e}on(n,i,o,a)}i=i.child}return i;case 26:return Mo(n,i),n===null?(a=Ny(i.type,null,i.pendingProps,null))?i.memoizedState=a:lt||(a=i.type,n=i.pendingProps,o=Ko(_e.current).createElement(a),o[Ct]=i,o[qt]=n,un(o,a,n),V(o),i.stateNode=o):i.memoizedState=Ny(i.type,n.memoizedProps,i.pendingProps,n.memoizedState),null;case 27:return ot(i),n===null&<&&(o=i.stateNode=Ay(i.type,i.pendingProps,_e.current),an=i,rr=!0,h=Dt,Ti(i.type)?(th=h,Dt=sr(o.firstChild)):Dt=h),on(n,i,i.pendingProps.children,a),Mo(n,i),n===null&&(i.flags|=4194304),i.child;case 5:return n===null&<&&((h=o=Dt)&&(o=Ow(o,i.type,i.pendingProps,rr),o!==null?(i.stateNode=o,an=i,Dt=sr(o.firstChild),rr=!1,h=!0):h=!1),h||mi(i)),ot(i),h=i.type,p=i.pendingProps,w=n!==null?n.memoizedProps:null,o=p.children,Kf(h,p)?o=null:w!==null&&Kf(h,w)&&(i.flags|=32),i.memoizedState!==null&&(h=Jc(n,i,Vv,null,null,a),fl._currentValue=h),Mo(n,i),on(n,i,o,a),i.child;case 6:return n===null&<&&((n=a=Dt)&&(a=Rw(a,i.pendingProps,rr),a!==null?(i.stateNode=a,an=i,Dt=null,n=!0):n=!1),n||mi(i)),null;case 13:return gg(n,i,a);case 4:return Ye(i,i.stateNode.containerInfo),o=i.pendingProps,n===null?i.child=as(i,null,o,a):on(n,i,o,a),i.child;case 11:return lg(n,i,i.type,i.pendingProps,a);case 7:return on(n,i,i.pendingProps,a),i.child;case 8:return on(n,i,i.pendingProps.children,a),i.child;case 12:return on(n,i,i.pendingProps.children,a),i.child;case 10:return o=i.pendingProps,pi(i,i.type,o.value),on(n,i,o.children,a),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,ns(i),h=ln(h),o=o(h),i.flags|=1,on(n,i,o,a),i.child;case 14:return og(n,i,i.type,i.pendingProps,a);case 15:return ug(n,i,i.type,i.pendingProps,a);case 19:return bg(n,i,a);case 31:return ew(n,i,a);case 22:return cg(n,i,a,i.pendingProps);case 24:return ns(i),o=ln(Gt),n===null?(h=Bc(),h===null&&(h=At,p=zc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),i.memoizedState={parent:o,cache:h},Hc(i),pi(i,Gt,h)):((n.lanes&a)!==0&&(qc(n,i),Ya(i,null,null,a),$a()),h=n.memoizedState,p=i.memoizedState,h.parent!==o?(h={parent:o,cache:o},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),pi(i,Gt,o)):(o=p.cache,pi(i,Gt,o),o!==h.cache&&Lc(i,[Gt],a,!0))),on(n,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function Vr(n){n.flags|=4}function _f(n,i,a,o,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(Vg())n.flags|=8192;else throw ss=bo,Pc}else n.flags&=-16777217}function vg(n,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Ly(i))if(Vg())n.flags|=8192;else throw ss=bo,Pc}function Lo(n,i){i!==null&&(n.flags|=4),n.flags&16384&&(i=n.tag!==22?xs():536870912,n.lanes|=i,Ys|=i)}function Qa(n,i){if(!lt)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 o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?i||n.tail===null?n.tail=null:n.tail.sibling=null:o.sibling=null}}function Lt(n){var i=n.alternate!==null&&n.alternate.child===n.child,a=0,o=0;if(i)for(var h=n.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=n,h=h.sibling;else for(h=n.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=n,h=h.sibling;return n.subtreeFlags|=o,n.childLanes=a,i}function nw(n,i,a){var o=i.pendingProps;switch(Nc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(i),null;case 1:return Lt(i),null;case 3:return a=i.stateNode,o=null,n!==null&&(o=n.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Ir(Gt),Ce(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(n===null||n.child===null)&&(Rs(i)?Vr(i):n===null||n.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Rc())),Lt(i),null;case 26:var h=i.type,p=i.memoizedState;return n===null?(Vr(i),p!==null?(Lt(i),vg(i,p)):(Lt(i),_f(i,h,null,o,a))):p?p!==n.memoizedState?(Vr(i),Lt(i),vg(i,p)):(Lt(i),i.flags&=-16777217):(n=n.memoizedProps,n!==o&&Vr(i),Lt(i),_f(i,h,n,o,a)),null;case 27:if(jt(i),a=_e.current,h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==o&&Vr(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Lt(i),null}n=ye.current,Rs(i)?Wm(i):(n=Ay(h,o,a),i.stateNode=n,Vr(i))}return Lt(i),null;case 5:if(jt(i),h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==o&&Vr(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Lt(i),null}if(p=ye.current,Rs(i))Wm(i);else{var w=Ko(_e.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 o.is=="string"?w.createElement("select",{is:o.is}):w.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?w.createElement(h,{is:o.is}):w.createElement(h)}}p[Ct]=i,p[qt]=o;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(un(p,h,o),h){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Vr(i)}}return Lt(i),_f(i,i.type,n===null?null:n.memoizedProps,i.pendingProps,a),null;case 6:if(n&&i.stateNode!=null)n.memoizedProps!==o&&Vr(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(s(166));if(n=_e.current,Rs(i)){if(n=i.stateNode,a=i.memoizedProps,o=null,h=an,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}n[Ct]=i,n=!!(n.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||gy(n.nodeValue,a)),n||mi(i,!0)}else n=Ko(n).createTextNode(o),n[Ct]=i,i.stateNode=n}return Lt(i),null;case 31:if(a=i.memoizedState,n===null||n.memoizedState!==null){if(o=Rs(i),a!==null){if(n===null){if(!o)throw Error(s(318));if(n=i.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[Ct]=i}else es(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Lt(i),n=!1}else a=Rc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),n=!0;if(!n)return i.flags&256?(Un(i),i):(Un(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Lt(i),null;case 13:if(o=i.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=Rs(i),o!==null&&o.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[Ct]=i}else es(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Lt(i),h=!1}else h=Rc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Un(i),i):(Un(i),null)}return Un(i),(i.flags&128)!==0?(i.lanes=a,i):(a=o!==null,n=n!==null&&n.memoizedState!==null,a&&(o=i.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),a!==n&&a&&(i.child.flags|=8192),Lo(i,i.updateQueue),Lt(i),null);case 4:return Ce(),n===null&&Yf(i.stateNode.containerInfo),Lt(i),null;case 10:return Ir(i.type),Lt(i),null;case 19:if(W($t),o=i.memoizedState,o===null)return Lt(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Qa(o,!1);else{if(Ft!==0||n!==null&&(n.flags&128)!==0)for(n=i.child;n!==null;){if(p=So(n),p!==null){for(i.flags|=128,Qa(o,!1),n=p.updateQueue,i.updateQueue=n,Lo(i,n),i.subtreeFlags=0,n=a,a=i.child;a!==null;)Jm(a,n),a=a.sibling;return _($t,$t.current&1|2),lt&&Hr(i,o.treeForkCount),i.child}n=n.sibling}o.tail!==null&&mt()>Ho&&(i.flags|=128,h=!0,Qa(o,!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),Qa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!lt)return Lt(i),null}else 2*mt()-o.renderingStartTime>Ho&&a!==536870912&&(i.flags|=128,h=!0,Qa(o,!1),i.lanes=4194304);o.isBackwards?(p.sibling=i.child,i.child=p):(n=o.last,n!==null?n.sibling=p:i.child=p,o.last=p)}return o.tail!==null?(n=o.tail,o.rendering=n,o.tail=n.sibling,o.renderingStartTime=mt(),n.sibling=null,a=$t.current,_($t,h?a&1|2:a&1),lt&&Hr(i,o.treeForkCount),n):(Lt(i),null);case 22:case 23:return Un(i),Yc(),o=i.memoizedState!==null,n!==null?n.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(a&536870912)!==0&&(i.flags&128)===0&&(Lt(i),i.subtreeFlags&6&&(i.flags|=8192)):Lt(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),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==a&&(i.flags|=2048),n!==null&&W(rs),null;case 24:return a=null,n!==null&&(a=n.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),Ir(Gt),Lt(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function rw(n,i){switch(Nc(i),i.tag){case 1:return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 3:return Ir(Gt),Ce(),n=i.flags,(n&65536)!==0&&(n&128)===0?(i.flags=n&-65537|128,i):null;case 26:case 27:case 5:return jt(i),null;case 31:if(i.memoizedState!==null){if(Un(i),i.alternate===null)throw Error(s(340));es()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 13:if(Un(i),n=i.memoizedState,n!==null&&n.dehydrated!==null){if(i.alternate===null)throw Error(s(340));es()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 19:return W($t),null;case 4:return Ce(),null;case 10:return Ir(i.type),null;case 22:case 23:return Un(i),Yc(),n!==null&&W(rs),n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 24:return Ir(Gt),null;case 25:return null;default:return null}}function wg(n,i){switch(Nc(i),i.tag){case 3:Ir(Gt),Ce();break;case 26:case 27:case 5:jt(i);break;case 4:Ce();break;case 31:i.memoizedState!==null&&Un(i);break;case 13:Un(i);break;case 19:W($t);break;case 10:Ir(i.type);break;case 22:case 23:Un(i),Yc(),n!==null&&W(rs);break;case 24:Ir(Gt)}}function Za(n,i){try{var a=i.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var h=o.next;a=h;do{if((a.tag&n)===n){o=void 0;var p=a.create,w=a.inst;o=p(),w.destroy=o}a=a.next}while(a!==h)}}catch(k){xt(i,i.return,k)}}function wi(n,i,a){try{var o=i.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&n)===n){var w=o.inst,k=w.destroy;if(k!==void 0){w.destroy=void 0,h=i;var H=a,ne=k;try{ne()}catch(fe){xt(h,H,fe)}}}o=o.next}while(o!==p)}}catch(fe){xt(i,i.return,fe)}}function Sg(n){var i=n.updateQueue;if(i!==null){var a=n.stateNode;try{hp(i,a)}catch(o){xt(n,n.return,o)}}}function _g(n,i,a){a.props=os(n.type,n.memoizedProps),a.state=n.memoizedState;try{a.componentWillUnmount()}catch(o){xt(n,i,o)}}function Wa(n,i){try{var a=n.ref;if(a!==null){switch(n.tag){case 26:case 27:case 5:var o=n.stateNode;break;case 30:o=n.stateNode;break;default:o=n.stateNode}typeof a=="function"?n.refCleanup=a(o):a.current=o}}catch(h){xt(n,i,h)}}function Ar(n,i){var a=n.ref,o=n.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){xt(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){xt(n,i,h)}else a.current=null}function kg(n){var i=n.type,a=n.memoizedProps,o=n.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(h){xt(n,n.return,h)}}function kf(n,i,a){try{var o=n.stateNode;Ew(o,n.type,a,i),o[qt]=i}catch(h){xt(n,n.return,h)}}function Eg(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Ti(n.type)||n.tag===4}function Ef(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Eg(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&&Ti(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 Cf(n,i,a){var o=n.tag;if(o===5||o===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=Ur));else if(o!==4&&(o===27&&Ti(n.type)&&(a=n.stateNode,i=null),n=n.child,n!==null))for(Cf(n,i,a),n=n.sibling;n!==null;)Cf(n,i,a),n=n.sibling}function zo(n,i,a){var o=n.tag;if(o===5||o===6)n=n.stateNode,i?a.insertBefore(n,i):a.appendChild(n);else if(o!==4&&(o===27&&Ti(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 Cg(n){var i=n.stateNode,a=n.memoizedProps;try{for(var o=n.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);un(i,o,a),i[Ct]=n,i[qt]=a}catch(p){xt(n,n.return,p)}}var Gr=!1,Kt=!1,Af=!1,Ag=typeof WeakSet=="function"?WeakSet:Set,nn=null;function iw(n,i){if(n=n.containerInfo,Jf=ru,n=Pm(n),xc(n)){if("selectionStart"in n)var a={start:n.selectionStart,end:n.selectionEnd};else e:{a=(a=n.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,k=-1,H=-1,ne=0,fe=0,ge=n,ie=null;t:for(;;){for(var le;ge!==a||h!==0&&ge.nodeType!==3||(k=w+h),ge!==p||o!==0&&ge.nodeType!==3||(H=w+o),ge.nodeType===3&&(w+=ge.nodeValue.length),(le=ge.firstChild)!==null;)ie=ge,ge=le;for(;;){if(ge===n)break t;if(ie===a&&++ne===h&&(k=w),ie===p&&++fe===o&&(H=w),(le=ge.nextSibling)!==null)break;ge=ie,ie=ge.parentNode}ge=le}a=k===-1||H===-1?null:{start:k,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Xf={focusedElem:n,selectionRange:a},ru=!1,nn=i;nn!==null;)if(i=nn,n=i.child,(i.subtreeFlags&1028)!==0&&n!==null)n.return=i,nn=n;else for(;nn!==null;){switch(i=nn,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,o=a.stateNode;try{var ze=os(a.type,h);n=o.getSnapshotBeforeUpdate(ze,p),o.__reactInternalSnapshotBeforeUpdate=n}catch($e){xt(a,a.return,$e)}}break;case 3:if((n&1024)!==0){if(n=i.stateNode.containerInfo,a=n.nodeType,a===9)Zf(n);else if(a===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Zf(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,nn=n;break}nn=i.return}}function Tg(n,i,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:Xr(n,a),o&4&&Za(5,a);break;case 1:if(Xr(n,a),o&4)if(n=a.stateNode,i===null)try{n.componentDidMount()}catch(w){xt(a,a.return,w)}else{var h=os(a.type,i.memoizedProps);i=i.memoizedState;try{n.componentDidUpdate(h,i,n.__reactInternalSnapshotBeforeUpdate)}catch(w){xt(a,a.return,w)}}o&64&&Sg(a),o&512&&Wa(a,a.return);break;case 3:if(Xr(n,a),o&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{hp(n,i)}catch(w){xt(a,a.return,w)}}break;case 27:i===null&&o&4&&Cg(a);case 26:case 5:Xr(n,a),i===null&&o&4&&kg(a),o&512&&Wa(a,a.return);break;case 12:Xr(n,a);break;case 31:Xr(n,a),o&4&&Og(n,a);break;case 13:Xr(n,a),o&4&&Rg(n,a),o&64&&(n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(a=dw.bind(null,a),Mw(n,a))));break;case 22:if(o=a.memoizedState!==null||Gr,!o){i=i!==null&&i.memoizedState!==null||Kt,h=Gr;var p=Kt;Gr=o,(Kt=i)&&!p?Kr(n,a,(a.subtreeFlags&8772)!==0):Xr(n,a),Gr=h,Kt=p}break;case 30:break;default:Xr(n,a)}}function jg(n){var i=n.alternate;i!==null&&(n.alternate=null,jg(i)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(i=n.stateNode,i!==null&&vs(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 zt=null,En=!1;function Jr(n,i,a){for(a=a.child;a!==null;)Ng(n,i,a),a=a.sibling}function Ng(n,i,a){if(Ie&&typeof Ie.onCommitFiberUnmount=="function")try{Ie.onCommitFiberUnmount(ct,a)}catch{}switch(a.tag){case 26:Kt||Ar(a,i),Jr(n,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Kt||Ar(a,i);var o=zt,h=En;Ti(a.type)&&(zt=a.stateNode,En=!1),Jr(n,i,a),ol(a.stateNode),zt=o,En=h;break;case 5:Kt||Ar(a,i);case 6:if(o=zt,h=En,zt=null,Jr(n,i,a),zt=o,En=h,zt!==null)if(En)try{(zt.nodeType===9?zt.body:zt.nodeName==="HTML"?zt.ownerDocument.body:zt).removeChild(a.stateNode)}catch(p){xt(a,i,p)}else try{zt.removeChild(a.stateNode)}catch(p){xt(a,i,p)}break;case 18:zt!==null&&(En?(n=zt,Sy(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,a.stateNode),Ws(n)):Sy(zt,a.stateNode));break;case 4:o=zt,h=En,zt=a.stateNode.containerInfo,En=!0,Jr(n,i,a),zt=o,En=h;break;case 0:case 11:case 14:case 15:wi(2,a,i),Kt||wi(4,a,i),Jr(n,i,a);break;case 1:Kt||(Ar(a,i),o=a.stateNode,typeof o.componentWillUnmount=="function"&&_g(a,i,o)),Jr(n,i,a);break;case 21:Jr(n,i,a);break;case 22:Kt=(o=Kt)||a.memoizedState!==null,Jr(n,i,a),Kt=o;break;default:Jr(n,i,a)}}function Og(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Ws(n)}catch(a){xt(i,i.return,a)}}}function Rg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Ws(n)}catch(a){xt(i,i.return,a)}}function sw(n){switch(n.tag){case 31:case 13:case 19:var i=n.stateNode;return i===null&&(i=n.stateNode=new Ag),i;case 22:return n=n.stateNode,i=n._retryCache,i===null&&(i=n._retryCache=new Ag),i;default:throw Error(s(435,n.tag))}}function Uo(n,i){var a=sw(n);i.forEach(function(o){if(!a.has(o)){a.add(o);var h=mw.bind(null,n,o);o.then(h,h)}})}function Cn(n,i){var a=i.deletions;if(a!==null)for(var o=0;o<a.length;o++){var h=a[o],p=n,w=i,k=w;e:for(;k!==null;){switch(k.tag){case 27:if(Ti(k.type)){zt=k.stateNode,En=!1;break e}break;case 5:zt=k.stateNode,En=!1;break e;case 3:case 4:zt=k.stateNode.containerInfo,En=!0;break e}k=k.return}if(zt===null)throw Error(s(160));Ng(p,w,h),zt=null,En=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Mg(i,n),i=i.sibling}var pr=null;function Mg(n,i){var a=n.alternate,o=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Cn(i,n),An(n),o&4&&(wi(3,n,n.return),Za(3,n),wi(5,n,n.return));break;case 1:Cn(i,n),An(n),o&512&&(Kt||a===null||Ar(a,a.return)),o&64&&Gr&&(n=n.updateQueue,n!==null&&(o=n.callbacks,o!==null&&(a=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var h=pr;if(Cn(i,n),An(n),o&512&&(Kt||a===null||Ar(a,a.return)),o&4){var p=a!==null?a.memoizedState:null;if(o=n.memoizedState,a===null)if(o===null)if(n.stateNode===null){e:{o=n.type,a=n.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[Zt]||p[Ct]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),un(p,o,a),p[Ct]=n,V(p),o=p;break e;case"link":var w=My("link","href",h).get(o+(a.href||""));if(w){for(var k=0;k<w.length;k++)if(p=w[k],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(k,1);break t}}p=h.createElement(o),un(p,o,a),h.head.appendChild(p);break;case"meta":if(w=My("meta","content",h).get(o+(a.content||""))){for(k=0;k<w.length;k++)if(p=w[k],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(k,1);break t}}p=h.createElement(o),un(p,o,a),h.head.appendChild(p);break;default:throw Error(s(468,o))}p[Ct]=n,V(p),o=p}n.stateNode=o}else Dy(h,n.type,n.stateNode);else n.stateNode=Ry(h,o,n.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?Dy(h,n.type,n.stateNode):Ry(h,o,n.memoizedProps)):o===null&&n.stateNode!==null&&kf(n,n.memoizedProps,a.memoizedProps)}break;case 27:Cn(i,n),An(n),o&512&&(Kt||a===null||Ar(a,a.return)),a!==null&&o&4&&kf(n,n.memoizedProps,a.memoizedProps);break;case 5:if(Cn(i,n),An(n),o&512&&(Kt||a===null||Ar(a,a.return)),n.flags&32){h=n.stateNode;try{Ss(h,"")}catch(ze){xt(n,n.return,ze)}}o&4&&n.stateNode!=null&&(h=n.memoizedProps,kf(n,h,a!==null?a.memoizedProps:h)),o&1024&&(Af=!0);break;case 6:if(Cn(i,n),An(n),o&4){if(n.stateNode===null)throw Error(s(162));o=n.memoizedProps,a=n.stateNode;try{a.nodeValue=o}catch(ze){xt(n,n.return,ze)}}break;case 3:if(Wo=null,h=pr,pr=Qo(i.containerInfo),Cn(i,n),pr=h,An(n),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Ws(i.containerInfo)}catch(ze){xt(n,n.return,ze)}Af&&(Af=!1,Dg(n));break;case 4:o=pr,pr=Qo(n.stateNode.containerInfo),Cn(i,n),An(n),pr=o;break;case 12:Cn(i,n),An(n);break;case 31:Cn(i,n),An(n),o&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,Uo(n,o)));break;case 13:Cn(i,n),An(n),n.child.flags&8192&&n.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Po=mt()),o&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,Uo(n,o)));break;case 22:h=n.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,ne=Gr,fe=Kt;if(Gr=ne||h,Kt=fe||H,Cn(i,n),Kt=fe,Gr=ne,An(n),o&8192)e:for(i=n.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||H||Gr||Kt||us(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{k=H.stateNode;var ge=H.memoizedProps.style,ie=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;k.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(ze){xt(H,H.return,ze)}}}else if(i.tag===6){if(a===null){H=i;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(ze){xt(H,H.return,ze)}}}else if(i.tag===18){if(a===null){H=i;try{var le=H.stateNode;h?_y(le,!0):_y(H.stateNode,!1)}catch(ze){xt(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}o&4&&(o=n.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,Uo(n,a))));break;case 19:Cn(i,n),An(n),o&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,Uo(n,o)));break;case 30:break;case 21:break;default:Cn(i,n),An(n)}}function An(n){var i=n.flags;if(i&2){try{for(var a,o=n.return;o!==null;){if(Eg(o)){a=o;break}o=o.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var h=a.stateNode,p=Ef(n);zo(n,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(Ss(w,""),a.flags&=-33);var k=Ef(n);zo(n,k,w);break;case 3:case 4:var H=a.stateNode.containerInfo,ne=Ef(n);Cf(n,ne,H);break;default:throw Error(s(161))}}catch(fe){xt(n,n.return,fe)}n.flags&=-3}i&4096&&(n.flags&=-4097)}function Dg(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var i=n;Dg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),n=n.sibling}}function Xr(n,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Tg(n,i.alternate,i),i=i.sibling}function us(n){for(n=n.child;n!==null;){var i=n;switch(i.tag){case 0:case 11:case 14:case 15:wi(4,i,i.return),us(i);break;case 1:Ar(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&_g(i,i.return,a),us(i);break;case 27:ol(i.stateNode);case 26:case 5:Ar(i,i.return),us(i);break;case 22:i.memoizedState===null&&us(i);break;case 30:us(i);break;default:us(i)}n=n.sibling}}function Kr(n,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,h=n,p=i,w=p.flags;switch(p.tag){case 0:case 11:case 15:Kr(h,p,a),Za(4,p);break;case 1:if(Kr(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ne){xt(o,o.return,ne)}if(o=p,h=o.updateQueue,h!==null){var k=o.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)fp(H[h],k)}catch(ne){xt(o,o.return,ne)}}a&&w&64&&Sg(p),Wa(p,p.return);break;case 27:Cg(p);case 26:case 5:Kr(h,p,a),a&&o===null&&w&4&&kg(p),Wa(p,p.return);break;case 12:Kr(h,p,a);break;case 31:Kr(h,p,a),a&&w&4&&Og(h,p);break;case 13:Kr(h,p,a),a&&w&4&&Rg(h,p);break;case 22:p.memoizedState===null&&Kr(h,p,a),Wa(p,p.return);break;case 30:break;default:Kr(h,p,a)}i=i.sibling}}function Tf(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&&Pa(a))}function jf(n,i){n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Pa(n))}function gr(n,i,a,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Lg(n,i,a,o),i=i.sibling}function Lg(n,i,a,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:gr(n,i,a,o),h&2048&&Za(9,i);break;case 1:gr(n,i,a,o);break;case 3:gr(n,i,a,o),h&2048&&(n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Pa(n)));break;case 12:if(h&2048){gr(n,i,a,o),n=i.stateNode;try{var p=i.memoizedProps,w=p.id,k=p.onPostCommit;typeof k=="function"&&k(w,i.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(H){xt(i,i.return,H)}}else gr(n,i,a,o);break;case 31:gr(n,i,a,o);break;case 13:gr(n,i,a,o);break;case 23:break;case 22:p=i.stateNode,w=i.alternate,i.memoizedState!==null?p._visibility&2?gr(n,i,a,o):el(n,i):p._visibility&2?gr(n,i,a,o):(p._visibility|=2,Is(n,i,a,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Tf(w,i);break;case 24:gr(n,i,a,o),h&2048&&jf(i.alternate,i);break;default:gr(n,i,a,o)}}function Is(n,i,a,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=n,w=i,k=a,H=o,ne=w.flags;switch(w.tag){case 0:case 11:case 15:Is(p,w,k,H,h),Za(8,w);break;case 23:break;case 22:var fe=w.stateNode;w.memoizedState!==null?fe._visibility&2?Is(p,w,k,H,h):el(p,w):(fe._visibility|=2,Is(p,w,k,H,h)),h&&ne&2048&&Tf(w.alternate,w);break;case 24:Is(p,w,k,H,h),h&&ne&2048&&jf(w.alternate,w);break;default:Is(p,w,k,H,h)}i=i.sibling}}function el(n,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=n,o=i,h=o.flags;switch(o.tag){case 22:el(a,o),h&2048&&Tf(o.alternate,o);break;case 24:el(a,o),h&2048&&jf(o.alternate,o);break;default:el(a,o)}i=i.sibling}}var tl=8192;function Fs(n,i,a){if(n.subtreeFlags&tl)for(n=n.child;n!==null;)zg(n,i,a),n=n.sibling}function zg(n,i,a){switch(n.tag){case 26:Fs(n,i,a),n.flags&tl&&n.memoizedState!==null&&Yw(a,pr,n.memoizedState,n.memoizedProps);break;case 5:Fs(n,i,a);break;case 3:case 4:var o=pr;pr=Qo(n.stateNode.containerInfo),Fs(n,i,a),pr=o;break;case 22:n.memoizedState===null&&(o=n.alternate,o!==null&&o.memoizedState!==null?(o=tl,tl=16777216,Fs(n,i,a),tl=o):Fs(n,i,a));break;default:Fs(n,i,a)}}function Ug(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 nl(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];nn=o,Pg(o,n)}Ug(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Bg(n),n=n.sibling}function Bg(n){switch(n.tag){case 0:case 11:case 15:nl(n),n.flags&2048&&wi(9,n,n.return);break;case 3:nl(n);break;case 12:nl(n);break;case 22:var i=n.stateNode;n.memoizedState!==null&&i._visibility&2&&(n.return===null||n.return.tag!==13)?(i._visibility&=-3,Bo(n)):nl(n);break;default:nl(n)}}function Bo(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];nn=o,Pg(o,n)}Ug(n)}for(n=n.child;n!==null;){switch(i=n,i.tag){case 0:case 11:case 15:wi(8,i,i.return),Bo(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,Bo(i));break;default:Bo(i)}n=n.sibling}}function Pg(n,i){for(;nn!==null;){var a=nn;switch(a.tag){case 0:case 11:case 15:wi(8,a,i);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Pa(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,nn=o;else e:for(a=n;nn!==null;){o=nn;var h=o.sibling,p=o.return;if(jg(o),o===a){nn=null;break e}if(h!==null){h.return=p,nn=h;break e}nn=p}}}var aw={getCacheForType:function(n){var i=ln(Gt),a=i.data.get(n);return a===void 0&&(a=n(),i.data.set(n,a)),a},cacheSignal:function(){return ln(Gt).controller.signal}},lw=typeof WeakMap=="function"?WeakMap:Map,pt=0,At=null,et=null,st=0,bt=0,Bn=null,Si=!1,$s=!1,Nf=!1,Qr=0,Ft=0,_i=0,cs=0,Of=0,Pn=0,Ys=0,rl=null,Tn=null,Rf=!1,Po=0,Hg=0,Ho=1/0,qo=null,ki=null,Wt=0,Ei=null,Vs=null,Zr=0,Mf=0,Df=null,qg=null,il=0,Lf=null;function Hn(){return(pt&2)!==0&&st!==0?st&-st:q.T!==null?qf():Ca()}function Ig(){if(Pn===0)if((st&536870912)===0||lt){var n=it;it<<=1,(it&3932160)===0&&(it=262144),Pn=n}else Pn=536870912;return n=zn.current,n!==null&&(n.flags|=32),Pn}function jn(n,i,a){(n===At&&(bt===2||bt===9)||n.cancelPendingCommit!==null)&&(Gs(n,0),Ci(n,st,Pn,!1)),hr(n,a),((pt&2)===0||n!==At)&&(n===At&&((pt&2)===0&&(cs|=a),Ft===4&&Ci(n,st,Pn,!1)),Tr(n))}function Fg(n,i,a){if((pt&6)!==0)throw Error(s(327));var o=!a&&(i&127)===0&&(i&n.expiredLanes)===0||Yi(n,i),h=o?cw(n,i):Uf(n,i,!0),p=o;do{if(h===0){$s&&!o&&Ci(n,i,0,!1);break}else{if(a=n.current.alternate,p&&!ow(a)){h=Uf(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 k=n;h=rl;var H=k.current.memoizedState.isDehydrated;if(H&&(Gs(k,w).flags|=256),w=Uf(k,w,!1),w!==2){if(Nf&&!H){k.errorRecoveryDisabledLanes|=p,cs|=p,h=4;break e}p=Tn,Tn=h,p!==null&&(Tn===null?Tn=p:Tn.push.apply(Tn,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){Gs(n,0),Ci(n,i,0,!0);break}e:{switch(o=n,p=h,p){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:Ci(o,i,Pn,!Si);break e;case 2:Tn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=Po+300-mt(),10<h)){if(Ci(o,i,Pn,!Si),$i(o,0,!0)!==0)break e;Zr=i,o.timeoutHandle=vy($g.bind(null,o,a,Tn,qo,Rf,i,Pn,cs,Ys,Si,p,"Throttled",-0,0),h);break e}$g(o,a,Tn,qo,Rf,i,Pn,cs,Ys,Si,p,null,-0,0)}}break}while(!0);Tr(n)}function $g(n,i,a,o,h,p,w,k,H,ne,fe,ge,ie,le){if(n.timeoutHandle=-1,ge=i.subtreeFlags,ge&8192||(ge&16785408)===16785408){ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ur},zg(i,p,ge);var ze=(p&62914560)===p?Po-mt():(p&4194048)===p?Hg-mt():0;if(ze=Vw(ge,ze),ze!==null){Zr=p,n.cancelPendingCommit=ze(Zg.bind(null,n,i,p,a,o,h,w,k,H,fe,ge,null,ie,le)),Ci(n,p,w,!ne);return}}Zg(n,i,p,a,o,h,w,k,H)}function ow(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 o=0;o<a.length;o++){var h=a[o],p=h.getSnapshot;h=h.value;try{if(!Dn(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 Ci(n,i,a,o){i&=~Of,i&=~cs,n.suspendedLanes|=i,n.pingedLanes&=~i,o&&(n.warmLanes|=i),o=n.expirationTimes;for(var h=i;0<h;){var p=31-Pe(h),w=1<<p;o[p]=-1,h&=~w}a!==0&&ui(n,a,i)}function Io(){return(pt&6)===0?(sl(0),!1):!0}function zf(){if(et!==null){if(bt===0)var n=et.return;else n=et,qr=ts=null,Qc(n),Us=null,qa=0,n=et;for(;n!==null;)wg(n.alternate,n),n=n.return;et=null}}function Gs(n,i){var a=n.timeoutHandle;a!==-1&&(n.timeoutHandle=-1,Tw(a)),a=n.cancelPendingCommit,a!==null&&(n.cancelPendingCommit=null,a()),Zr=0,zf(),At=n,et=a=Pr(n.current,null),st=i,bt=0,Bn=null,Si=!1,$s=Yi(n,i),Nf=!1,Ys=Pn=Of=cs=_i=Ft=0,Tn=rl=null,Rf=!1,(i&8)!==0&&(i|=i&32);var o=n.entangledLanes;if(o!==0)for(n=n.entanglements,o&=i;0<o;){var h=31-Pe(o),p=1<<h;i|=n[h],o&=~p}return Qr=i,oo(),a}function Yg(n,i){Xe=null,q.H=Xa,i===zs||i===yo?(i=lp(),bt=3):i===Pc?(i=lp(),bt=4):bt=i===mf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Bn=i,et===null&&(Ft=1,Oo(n,er(i,n.current)))}function Vg(){var n=zn.current;return n===null?!0:(st&4194048)===st?ir===null:(st&62914560)===st||(st&536870912)!==0?n===ir:!1}function Gg(){var n=q.H;return q.H=Xa,n===null?Xa:n}function Jg(){var n=q.A;return q.A=aw,n}function Fo(){Ft=4,Si||(st&4194048)!==st&&zn.current!==null||($s=!0),(_i&134217727)===0&&(cs&134217727)===0||At===null||Ci(At,st,Pn,!1)}function Uf(n,i,a){var o=pt;pt|=2;var h=Gg(),p=Jg();(At!==n||st!==i)&&(qo=null,Gs(n,i)),i=!1;var w=Ft;e:do try{if(bt!==0&&et!==null){var k=et,H=Bn;switch(bt){case 8:zf(),w=6;break e;case 3:case 2:case 9:case 6:zn.current===null&&(i=!0);var ne=bt;if(bt=0,Bn=null,Js(n,k,H,ne),a&&$s){w=0;break e}break;default:ne=bt,bt=0,Bn=null,Js(n,k,H,ne)}}uw(),w=Ft;break}catch(fe){Yg(n,fe)}while(!0);return i&&n.shellSuspendCounter++,qr=ts=null,pt=o,q.H=h,q.A=p,et===null&&(At=null,st=0,oo()),w}function uw(){for(;et!==null;)Xg(et)}function cw(n,i){var a=pt;pt|=2;var o=Gg(),h=Jg();At!==n||st!==i?(qo=null,Ho=mt()+500,Gs(n,i)):$s=Yi(n,i);e:do try{if(bt!==0&&et!==null){i=et;var p=Bn;t:switch(bt){case 1:bt=0,Bn=null,Js(n,i,p,1);break;case 2:case 9:if(sp(p)){bt=0,Bn=null,Kg(i);break}i=function(){bt!==2&&bt!==9||At!==n||(bt=7),Tr(n)},p.then(i,i);break e;case 3:bt=7;break e;case 4:bt=5;break e;case 7:sp(p)?(bt=0,Bn=null,Kg(i)):(bt=0,Bn=null,Js(n,i,p,7));break;case 5:var w=null;switch(et.tag){case 26:w=et.memoizedState;case 5:case 27:var k=et;if(w?Ly(w):k.stateNode.complete){bt=0,Bn=null;var H=k.sibling;if(H!==null)et=H;else{var ne=k.return;ne!==null?(et=ne,$o(ne)):et=null}break t}}bt=0,Bn=null,Js(n,i,p,5);break;case 6:bt=0,Bn=null,Js(n,i,p,6);break;case 8:zf(),Ft=6;break e;default:throw Error(s(462))}}fw();break}catch(fe){Yg(n,fe)}while(!0);return qr=ts=null,q.H=o,q.A=h,pt=a,et!==null?0:(At=null,st=0,oo(),Ft)}function fw(){for(;et!==null&&!wn();)Xg(et)}function Xg(n){var i=xg(n.alternate,n,Qr);n.memoizedProps=n.pendingProps,i===null?$o(n):et=i}function Kg(n){var i=n,a=i.alternate;switch(i.tag){case 15:case 0:i=dg(a,i,i.pendingProps,i.type,void 0,st);break;case 11:i=dg(a,i,i.pendingProps,i.type.render,i.ref,st);break;case 5:Qc(i);default:wg(a,i),i=et=Jm(i,Qr),i=xg(a,i,Qr)}n.memoizedProps=n.pendingProps,i===null?$o(n):et=i}function Js(n,i,a,o){qr=ts=null,Qc(i),Us=null,qa=0;var h=i.return;try{if(Wv(n,h,i,a,st)){Ft=1,Oo(n,er(a,n.current)),et=null;return}}catch(p){if(h!==null)throw et=h,p;Ft=1,Oo(n,er(a,n.current)),et=null;return}i.flags&32768?(lt||o===1?n=!0:$s||(st&536870912)!==0?n=!1:(Si=n=!0,(o===2||o===9||o===3||o===6)&&(o=zn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Qg(i,n)):$o(i)}function $o(n){var i=n;do{if((i.flags&32768)!==0){Qg(i,Si);return}n=i.return;var a=nw(i.alternate,i,Qr);if(a!==null){et=a;return}if(i=i.sibling,i!==null){et=i;return}et=i=n}while(i!==null);Ft===0&&(Ft=5)}function Qg(n,i){do{var a=rw(n.alternate,n);if(a!==null){a.flags&=32767,et=a;return}if(a=n.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(n=n.sibling,n!==null)){et=n;return}et=n=a}while(n!==null);Ft=6,et=null}function Zg(n,i,a,o,h,p,w,k,H){n.cancelPendingCommit=null;do Yo();while(Wt!==0);if((pt&6)!==0)throw Error(s(327));if(i!==null){if(i===n.current)throw Error(s(177));if(p=i.lanes|i.childLanes,p|=kc,oi(n,a,p,w,k,H),n===At&&(et=At=null,st=0),Vs=i,Ei=n,Zr=a,Mf=p,Df=h,qg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,pw(be,function(){return ry(),null})):(n.callbackNode=null,n.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=q.T,q.T=null,h=Y.p,Y.p=2,w=pt,pt|=4;try{iw(n,i,a)}finally{pt=w,Y.p=h,q.T=o}}Wt=1,Wg(),ey(),ty()}}function Wg(){if(Wt===1){Wt=0;var n=Ei,i=Vs,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=q.T,q.T=null;var o=Y.p;Y.p=2;var h=pt;pt|=4;try{Mg(i,n);var p=Xf,w=Pm(n.containerInfo),k=p.focusedElem,H=p.selectionRange;if(w!==k&&k&&k.ownerDocument&&Bm(k.ownerDocument.documentElement,k)){if(H!==null&&xc(k)){var ne=H.start,fe=H.end;if(fe===void 0&&(fe=ne),"selectionStart"in k)k.selectionStart=ne,k.selectionEnd=Math.min(fe,k.value.length);else{var ge=k.ownerDocument||document,ie=ge&&ge.defaultView||window;if(ie.getSelection){var le=ie.getSelection(),ze=k.textContent.length,$e=Math.min(H.start,ze),St=H.end===void 0?$e:Math.min(H.end,ze);!le.extend&&$e>St&&(w=St,St=$e,$e=w);var K=Um(k,$e),X=Um(k,St);if(K&&X&&(le.rangeCount!==1||le.anchorNode!==K.node||le.anchorOffset!==K.offset||le.focusNode!==X.node||le.focusOffset!==X.offset)){var te=ge.createRange();te.setStart(K.node,K.offset),le.removeAllRanges(),$e>St?(le.addRange(te),le.extend(X.node,X.offset)):(te.setEnd(X.node,X.offset),le.addRange(te))}}}}for(ge=[],le=k;le=le.parentNode;)le.nodeType===1&&ge.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<ge.length;k++){var he=ge[k];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}ru=!!Jf,Xf=Jf=null}finally{pt=h,Y.p=o,q.T=a}}n.current=i,Wt=2}}function ey(){if(Wt===2){Wt=0;var n=Ei,i=Vs,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=q.T,q.T=null;var o=Y.p;Y.p=2;var h=pt;pt|=4;try{Tg(n,i.alternate,i)}finally{pt=h,Y.p=o,q.T=a}}Wt=3}}function ty(){if(Wt===4||Wt===3){Wt=0,Rn();var n=Ei,i=Vs,a=Zr,o=qg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Wt=5:(Wt=0,Vs=Ei=null,ny(n,n.pendingLanes));var h=n.pendingLanes;if(h===0&&(ki=null),Gi(a),i=i.stateNode,Ie&&typeof Ie.onCommitFiberRoot=="function")try{Ie.onCommitFiberRoot(ct,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=q.T,h=Y.p,Y.p=2,q.T=null;try{for(var p=n.onRecoverableError,w=0;w<o.length;w++){var k=o[w];p(k.value,{componentStack:k.stack})}}finally{q.T=i,Y.p=h}}(Zr&3)!==0&&Yo(),Tr(n),h=n.pendingLanes,(a&261930)!==0&&(h&42)!==0?n===Lf?il++:(il=0,Lf=n):il=0,sl(0)}}function ny(n,i){(n.pooledCacheLanes&=i)===0&&(i=n.pooledCache,i!=null&&(n.pooledCache=null,Pa(i)))}function Yo(){return Wg(),ey(),ty(),ry()}function ry(){if(Wt!==5)return!1;var n=Ei,i=Mf;Mf=0;var a=Gi(Zr),o=q.T,h=Y.p;try{Y.p=32>a?32:a,q.T=null,a=Df,Df=null;var p=Ei,w=Zr;if(Wt=0,Vs=Ei=null,Zr=0,(pt&6)!==0)throw Error(s(331));var k=pt;if(pt|=4,Bg(p.current),Lg(p,p.current,w,a),pt=k,sl(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot=="function")try{Ie.onPostCommitFiberRoot(ct,p)}catch{}return!0}finally{Y.p=h,q.T=o,ny(n,i)}}function iy(n,i,a){i=er(a,i),i=df(n.stateNode,i,2),n=bi(n,i,2),n!==null&&(hr(n,2),Tr(n))}function xt(n,i,a){if(n.tag===3)iy(n,n,a);else for(;i!==null;){if(i.tag===3){iy(i,n,a);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(ki===null||!ki.has(o))){n=er(a,n),a=sg(2),o=bi(i,a,2),o!==null&&(ag(a,o,i,n),hr(o,2),Tr(o));break}}i=i.return}}function Bf(n,i,a){var o=n.pingCache;if(o===null){o=n.pingCache=new lw;var h=new Set;o.set(i,h)}else h=o.get(i),h===void 0&&(h=new Set,o.set(i,h));h.has(a)||(Nf=!0,h.add(a),n=hw.bind(null,n,i,a),i.then(n,n))}function hw(n,i,a){var o=n.pingCache;o!==null&&o.delete(i),n.pingedLanes|=n.suspendedLanes&a,n.warmLanes&=~a,At===n&&(st&a)===a&&(Ft===4||Ft===3&&(st&62914560)===st&&300>mt()-Po?(pt&2)===0&&Gs(n,0):Of|=a,Ys===st&&(Ys=0)),Tr(n)}function sy(n,i){i===0&&(i=xs()),n=Zi(n,i),n!==null&&(hr(n,i),Tr(n))}function dw(n){var i=n.memoizedState,a=0;i!==null&&(a=i.retryLane),sy(n,a)}function mw(n,i){var a=0;switch(n.tag){case 31:case 13:var o=n.stateNode,h=n.memoizedState;h!==null&&(a=h.retryLane);break;case 19:o=n.stateNode;break;case 22:o=n.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(i),sy(n,a)}function pw(n,i){return Nt(n,i)}var Vo=null,Xs=null,Pf=!1,Go=!1,Hf=!1,Ai=0;function Tr(n){n!==Xs&&n.next===null&&(Xs===null?Vo=Xs=n:Xs=Xs.next=n),Go=!0,Pf||(Pf=!0,yw())}function sl(n,i){if(!Hf&&Go){Hf=!0;do for(var a=!1,o=Vo;o!==null;){if(n!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var w=o.suspendedLanes,k=o.pingedLanes;p=(1<<31-Pe(42|n)+1)-1,p&=h&~(w&~k),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,uy(o,p))}else p=st,p=$i(o,o===At?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Yi(o,p)||(a=!0,uy(o,p));o=o.next}while(a);Hf=!1}}function gw(){ay()}function ay(){Go=Pf=!1;var n=0;Ai!==0&&Aw()&&(n=Ai);for(var i=mt(),a=null,o=Vo;o!==null;){var h=o.next,p=ly(o,i);p===0?(o.next=null,a===null?Vo=h:a.next=h,h===null&&(Xs=a)):(a=o,(n!==0||(p&3)!==0)&&(Go=!0)),o=h}Wt!==0&&Wt!==5||sl(n),Ai!==0&&(Ai=0)}function ly(n,i){for(var a=n.suspendedLanes,o=n.pingedLanes,h=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var w=31-Pe(p),k=1<<w,H=h[w];H===-1?((k&a)===0||(k&o)!==0)&&(h[w]=Ea(k,i)):H<=i&&(n.expiredLanes|=k),p&=~k}if(i=At,a=st,a=$i(n,n===i?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o=n.callbackNode,a===0||n===i&&(bt===2||bt===9)||n.cancelPendingCommit!==null)return o!==null&&o!==null&&tn(o),n.callbackNode=null,n.callbackPriority=0;if((a&3)===0||Yi(n,a)){if(i=a&-a,i===n.callbackPriority)return i;switch(o!==null&&tn(o),Gi(a)){case 2:case 8:a=ke;break;case 32:a=be;break;case 268435456:a=Ne;break;default:a=be}return o=oy.bind(null,n),a=Nt(a,o),n.callbackPriority=i,n.callbackNode=a,i}return o!==null&&o!==null&&tn(o),n.callbackPriority=2,n.callbackNode=null,2}function oy(n,i){if(Wt!==0&&Wt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var a=n.callbackNode;if(Yo()&&n.callbackNode!==a)return null;var o=st;return o=$i(n,n===At?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o===0?null:(Fg(n,o,i),ly(n,mt()),n.callbackNode!=null&&n.callbackNode===a?oy.bind(null,n):null)}function uy(n,i){if(Yo())return null;Fg(n,i,!0)}function yw(){jw(function(){(pt&6)!==0?Nt(ce,gw):ay()})}function qf(){if(Ai===0){var n=Ds;n===0&&(n=gt,gt<<=1,(gt&261888)===0&&(gt=256)),Ai=n}return Ai}function cy(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:eo(""+n)}function fy(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 bw(n,i,a,o,h){if(i==="submit"&&a&&a.stateNode===h){var p=cy((h[qt]||null).action),w=o.submitter;w&&(i=(i=w[qt]||null)?cy(i.formAction):w.getAttribute("formAction"),i!==null&&(p=i,w=null));var k=new io("action","action",null,o,h);n.push({event:k,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Ai!==0){var H=w?fy(h,w):new FormData(h);lf(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(k.preventDefault(),H=w?fy(h,w):new FormData(h),lf(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var If=0;If<_c.length;If++){var Ff=_c[If],xw=Ff.toLowerCase(),vw=Ff[0].toUpperCase()+Ff.slice(1);mr(xw,"on"+vw)}mr(Im,"onAnimationEnd"),mr(Fm,"onAnimationIteration"),mr($m,"onAnimationStart"),mr("dblclick","onDoubleClick"),mr("focusin","onFocus"),mr("focusout","onBlur"),mr(zv,"onTransitionRun"),mr(Uv,"onTransitionStart"),mr(Bv,"onTransitionCancel"),mr(Ym,"onTransitionEnd"),se("onMouseEnter",["mouseout","mouseover"]),se("onMouseLeave",["mouseout","mouseover"]),se("onPointerEnter",["pointerout","pointerover"]),se("onPointerLeave",["pointerout","pointerover"]),xe("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xe("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xe("onBeforeInput",["compositionend","keypress","textInput","paste"]),xe("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xe("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xe("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var al="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(" "),ww=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(al));function hy(n,i){i=(i&4)!==0;for(var a=0;a<n.length;a++){var o=n[a],h=o.event;o=o.listeners;e:{var p=void 0;if(i)for(var w=o.length-1;0<=w;w--){var k=o[w],H=k.instance,ne=k.currentTarget;if(k=k.listener,H!==p&&h.isPropagationStopped())break e;p=k,h.currentTarget=ne;try{p(h)}catch(fe){lo(fe)}h.currentTarget=null,p=H}else for(w=0;w<o.length;w++){if(k=o[w],H=k.instance,ne=k.currentTarget,k=k.listener,H!==p&&h.isPropagationStopped())break e;p=k,h.currentTarget=ne;try{p(h)}catch(fe){lo(fe)}h.currentTarget=null,p=H}}}}function tt(n,i){var a=i[Ji];a===void 0&&(a=i[Ji]=new Set);var o=n+"__bubble";a.has(o)||(dy(i,n,2,!1),a.add(o))}function $f(n,i,a){var o=0;i&&(o|=4),dy(a,n,o,i)}var Jo="_reactListening"+Math.random().toString(36).slice(2);function Yf(n){if(!n[Jo]){n[Jo]=!0,Q.forEach(function(a){a!=="selectionchange"&&(ww.has(a)||$f(a,!1,n),$f(a,!0,n))});var i=n.nodeType===9?n:n.ownerDocument;i===null||i[Jo]||(i[Jo]=!0,$f("selectionchange",!1,i))}}function dy(n,i,a,o){switch(Iy(i)){case 2:var h=Xw;break;case 8:h=Kw;break;default:h=ah}a=h.bind(null,i,a,n),h=void 0,!cc||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?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 Vf(n,i,a,o,h){var p=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var w=o.tag;if(w===3||w===4){var k=o.stateNode.containerInfo;if(k===h)break;if(w===4)for(w=o.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;k!==null;){if(w=E(k),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){o=p=w;continue e}k=k.parentNode}}o=o.return}bm(function(){var ne=p,fe=oc(a),ge=[];e:{var ie=Vm.get(n);if(ie!==void 0){var le=io,ze=n;switch(n){case"keypress":if(no(a)===0)break e;case"keydown":case"keyup":le=mv;break;case"focusin":ze="focus",le=mc;break;case"focusout":ze="blur",le=mc;break;case"beforeblur":case"afterblur":le=mc;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":le=wm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=nv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=yv;break;case Im:case Fm:case $m:le=sv;break;case Ym:le=xv;break;case"scroll":case"scrollend":le=ev;break;case"wheel":le=wv;break;case"copy":case"cut":case"paste":le=lv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=_m;break;case"toggle":case"beforetoggle":le=_v}var $e=(i&4)!==0,St=!$e&&(n==="scroll"||n==="scrollend"),K=$e?ie!==null?ie+"Capture":null:ie;$e=[];for(var X=ne,te;X!==null;){var he=X;if(te=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||te===null||K===null||(he=Ta(X,K),he!=null&&$e.push(ll(X,he,te))),St)break;X=X.return}0<$e.length&&(ie=new le(ie,ze,null,a,fe),ge.push({event:ie,listeners:$e}))}}if((i&7)===0){e:{if(ie=n==="mouseover"||n==="pointerover",le=n==="mouseout"||n==="pointerout",ie&&a!==lc&&(ze=a.relatedTarget||a.fromElement)&&(E(ze)||ze[Mn]))break e;if((le||ie)&&(ie=fe.window===fe?fe:(ie=fe.ownerDocument)?ie.defaultView||ie.parentWindow:window,le?(ze=a.relatedTarget||a.toElement,le=ne,ze=ze?E(ze):null,ze!==null&&(St=u(ze),$e=ze.tag,ze!==St||$e!==5&&$e!==27&&$e!==6)&&(ze=null)):(le=null,ze=ne),le!==ze)){if($e=wm,he="onMouseLeave",K="onMouseEnter",X="mouse",(n==="pointerout"||n==="pointerover")&&($e=_m,he="onPointerLeave",K="onPointerEnter",X="pointer"),St=le==null?ie:j(le),te=ze==null?ie:j(ze),ie=new $e(he,X+"leave",le,a,fe),ie.target=St,ie.relatedTarget=te,he=null,E(fe)===ne&&($e=new $e(K,X+"enter",ze,a,fe),$e.target=te,$e.relatedTarget=St,he=$e),St=he,le&&ze)t:{for($e=Sw,K=le,X=ze,te=0,he=K;he;he=$e(he))te++;he=0;for(var He=X;He;He=$e(He))he++;for(;0<te-he;)K=$e(K),te--;for(;0<he-te;)X=$e(X),he--;for(;te--;){if(K===X||X!==null&&K===X.alternate){$e=K;break t}K=$e(K),X=$e(X)}$e=null}else $e=null;le!==null&&my(ge,ie,le,$e,!1),ze!==null&&St!==null&&my(ge,St,ze,$e,!0)}}e:{if(ie=ne?j(ne):window,le=ie.nodeName&&ie.nodeName.toLowerCase(),le==="select"||le==="input"&&ie.type==="file")var ht=Om;else if(jm(ie))if(Rm)ht=Mv;else{ht=Ov;var Ue=Nv}else le=ie.nodeName,!le||le.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?ne&&ac(ne.elementType)&&(ht=Om):ht=Rv;if(ht&&(ht=ht(n,ne))){Nm(ge,ht,a,fe);break e}Ue&&Ue(n,ie,ne),n==="focusout"&&ne&&ie.type==="number"&&ne.memoizedProps.value!=null&&sc(ie,"number",ie.value)}switch(Ue=ne?j(ne):window,n){case"focusin":(jm(Ue)||Ue.contentEditable==="true")&&(Cs=Ue,vc=ne,za=null);break;case"focusout":za=vc=Cs=null;break;case"mousedown":wc=!0;break;case"contextmenu":case"mouseup":case"dragend":wc=!1,Hm(ge,a,fe);break;case"selectionchange":if(Lv)break;case"keydown":case"keyup":Hm(ge,a,fe)}var Ke;if(gc)e:{switch(n){case"compositionstart":var at="onCompositionStart";break e;case"compositionend":at="onCompositionEnd";break e;case"compositionupdate":at="onCompositionUpdate";break e}at=void 0}else Es?Am(n,a)&&(at="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(at="onCompositionStart");at&&(km&&a.locale!=="ko"&&(Es||at!=="onCompositionStart"?at==="onCompositionEnd"&&Es&&(Ke=xm()):(fi=fe,fc="value"in fi?fi.value:fi.textContent,Es=!0)),Ue=Xo(ne,at),0<Ue.length&&(at=new Sm(at,n,null,a,fe),ge.push({event:at,listeners:Ue}),Ke?at.data=Ke:(Ke=Tm(a),Ke!==null&&(at.data=Ke)))),(Ke=Ev?Cv(n,a):Av(n,a))&&(at=Xo(ne,"onBeforeInput"),0<at.length&&(Ue=new Sm("onBeforeInput","beforeinput",null,a,fe),ge.push({event:Ue,listeners:at}),Ue.data=Ke)),bw(ge,n,ne,a,fe)}hy(ge,i)})}function ll(n,i,a){return{instance:n,listener:i,currentTarget:a}}function Xo(n,i){for(var a=i+"Capture",o=[];n!==null;){var h=n,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=Ta(n,a),h!=null&&o.unshift(ll(n,h,p)),h=Ta(n,i),h!=null&&o.push(ll(n,h,p))),n.tag===3)return o;n=n.return}return[]}function Sw(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function my(n,i,a,o,h){for(var p=i._reactName,w=[];a!==null&&a!==o;){var k=a,H=k.alternate,ne=k.stateNode;if(k=k.tag,H!==null&&H===o)break;k!==5&&k!==26&&k!==27||ne===null||(H=ne,h?(ne=Ta(a,p),ne!=null&&w.unshift(ll(a,ne,H))):h||(ne=Ta(a,p),ne!=null&&w.push(ll(a,ne,H)))),a=a.return}w.length!==0&&n.push({event:i,listeners:w})}var _w=/\r\n?/g,kw=/\u0000|\uFFFD/g;function py(n){return(typeof n=="string"?n:""+n).replace(_w,`
|
|
49
|
-
`).replace(kw,"")}function gy(n,i){return i=py(i),py(n)===i}function wt(n,i,a,o,h,p){switch(a){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||Ss(n,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&Ss(n,""+o);break;case"className":dr(n,"class",o);break;case"tabIndex":dr(n,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":dr(n,a,o);break;case"style":gm(n,o,p);break;case"data":if(i!=="object"){dr(n,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||a!=="href")){n.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){n.removeAttribute(a);break}o=eo(""+o),n.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="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"&&wt(n,i,"name",h.name,h,null),wt(n,i,"formEncType",h.formEncType,h,null),wt(n,i,"formMethod",h.formMethod,h,null),wt(n,i,"formTarget",h.formTarget,h,null)):(wt(n,i,"encType",h.encType,h,null),wt(n,i,"method",h.method,h,null),wt(n,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){n.removeAttribute(a);break}o=eo(""+o),n.setAttribute(a,o);break;case"onClick":o!=null&&(n.onclick=Ur);break;case"onScroll":o!=null&&tt("scroll",n);break;case"onScrollEnd":o!=null&&tt("scrollend",n);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"multiple":n.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":n.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){n.removeAttribute("xlink:href");break}a=eo(""+o),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":o!=null&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(a,""+o):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":o&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(a,""):n.removeAttribute(a);break;case"capture":case"download":o===!0?n.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(a,o):n.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?n.setAttribute(a,o):n.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?n.removeAttribute(a):n.setAttribute(a,o);break;case"popover":tt("beforetoggle",n),tt("toggle",n),cn(n,"popover",o);break;case"xlinkActuate":zr(n,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":zr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":zr(n,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":zr(n,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":zr(n,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":zr(n,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":zr(n,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":zr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":zr(n,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":cn(n,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Z1.get(a)||a,cn(n,a,o))}}function Gf(n,i,a,o,h,p){switch(a){case"style":gm(n,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"children":typeof o=="string"?Ss(n,o):(typeof o=="number"||typeof o=="bigint")&&Ss(n,""+o);break;case"onScroll":o!=null&&tt("scroll",n);break;case"onScrollEnd":o!=null&&tt("scrollend",n);break;case"onClick":o!=null&&(n.onclick=Ur);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!pe.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[qt]||null,p=p!=null?p[a]:null,typeof p=="function"&&n.removeEventListener(i,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(a in n?n[a]=null:n.hasAttribute(a)&&n.removeAttribute(a)),n.addEventListener(i,o,h);break e}a in n?n[a]=o:o===!0?n.setAttribute(a,""):cn(n,a,o)}}}function un(n,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":tt("error",n),tt("load",n);var o=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:wt(n,i,p,w,a,null)}}h&&wt(n,i,"srcSet",a.srcSet,a,null),o&&wt(n,i,"src",a.src,a,null);return;case"input":tt("invalid",n);var k=p=w=h=null,H=null,ne=null;for(o in a)if(a.hasOwnProperty(o)){var fe=a[o];if(fe!=null)switch(o){case"name":h=fe;break;case"type":w=fe;break;case"checked":H=fe;break;case"defaultChecked":ne=fe;break;case"value":p=fe;break;case"defaultValue":k=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(s(137,i));break;default:wt(n,i,o,fe,a,null)}}hm(n,p,k,H,ne,w,h,!1);return;case"select":tt("invalid",n),o=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(k=a[h],k!=null))switch(h){case"value":p=k;break;case"defaultValue":w=k;break;case"multiple":o=k;default:wt(n,i,h,k,a,null)}i=p,a=w,n.multiple=!!o,i!=null?ws(n,!!o,i,!1):a!=null&&ws(n,!!o,a,!0);return;case"textarea":tt("invalid",n),p=h=o=null;for(w in a)if(a.hasOwnProperty(w)&&(k=a[w],k!=null))switch(w){case"value":o=k;break;case"defaultValue":h=k;break;case"children":p=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(s(91));break;default:wt(n,i,w,k,a,null)}mm(n,o,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"selected":n.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:wt(n,i,H,o,a,null)}return;case"dialog":tt("beforetoggle",n),tt("toggle",n),tt("cancel",n),tt("close",n);break;case"iframe":case"object":tt("load",n);break;case"video":case"audio":for(o=0;o<al.length;o++)tt(al[o],n);break;case"image":tt("error",n),tt("load",n);break;case"details":tt("toggle",n);break;case"embed":case"source":case"link":tt("error",n),tt("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(ne in a)if(a.hasOwnProperty(ne)&&(o=a[ne],o!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:wt(n,i,ne,o,a,null)}return;default:if(ac(i)){for(fe in a)a.hasOwnProperty(fe)&&(o=a[fe],o!==void 0&&Gf(n,i,fe,o,a,void 0));return}}for(k in a)a.hasOwnProperty(k)&&(o=a[k],o!=null&&wt(n,i,k,o,a,null))}function Ew(n,i,a,o){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,k=null,H=null,ne=null,fe=null;for(le in a){var ge=a[le];if(a.hasOwnProperty(le)&&ge!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":H=ge;default:o.hasOwnProperty(le)||wt(n,i,le,null,o,ge)}}for(var ie in o){var le=o[ie];if(ge=a[ie],o.hasOwnProperty(ie)&&(le!=null||ge!=null))switch(ie){case"type":p=le;break;case"name":h=le;break;case"checked":ne=le;break;case"defaultChecked":fe=le;break;case"value":w=le;break;case"defaultValue":k=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(s(137,i));break;default:le!==ge&&wt(n,i,ie,le,o,ge)}}ic(n,w,k,H,ne,fe,p,h);return;case"select":le=w=k=ie=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":le=H;default:o.hasOwnProperty(p)||wt(n,i,p,null,o,H)}for(h in o)if(p=o[h],H=a[h],o.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":ie=p;break;case"defaultValue":k=p;break;case"multiple":w=p;default:p!==H&&wt(n,i,h,p,o,H)}i=k,a=w,o=le,ie!=null?ws(n,!!a,ie,!1):!!o!=!!a&&(i!=null?ws(n,!!a,i,!0):ws(n,!!a,a?[]:"",!1));return;case"textarea":le=ie=null;for(k in a)if(h=a[k],a.hasOwnProperty(k)&&h!=null&&!o.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:wt(n,i,k,null,o,h)}for(w in o)if(h=o[w],p=a[w],o.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":ie=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&wt(n,i,w,h,o,p)}dm(n,ie,le);return;case"option":for(var ze in a)if(ie=a[ze],a.hasOwnProperty(ze)&&ie!=null&&!o.hasOwnProperty(ze))switch(ze){case"selected":n.selected=!1;break;default:wt(n,i,ze,null,o,ie)}for(H in o)if(ie=o[H],le=a[H],o.hasOwnProperty(H)&&ie!==le&&(ie!=null||le!=null))switch(H){case"selected":n.selected=ie&&typeof ie!="function"&&typeof ie!="symbol";break;default:wt(n,i,H,ie,o,le)}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&&!o.hasOwnProperty($e)&&wt(n,i,$e,null,o,ie);for(ne in o)if(ie=o[ne],le=a[ne],o.hasOwnProperty(ne)&&ie!==le&&(ie!=null||le!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,i));break;default:wt(n,i,ne,ie,o,le)}return;default:if(ac(i)){for(var St in a)ie=a[St],a.hasOwnProperty(St)&&ie!==void 0&&!o.hasOwnProperty(St)&&Gf(n,i,St,void 0,o,ie);for(fe in o)ie=o[fe],le=a[fe],!o.hasOwnProperty(fe)||ie===le||ie===void 0&&le===void 0||Gf(n,i,fe,ie,o,le);return}}for(var K in a)ie=a[K],a.hasOwnProperty(K)&&ie!=null&&!o.hasOwnProperty(K)&&wt(n,i,K,null,o,ie);for(ge in o)ie=o[ge],le=a[ge],!o.hasOwnProperty(ge)||ie===le||ie==null&&le==null||wt(n,i,ge,ie,o,le)}function yy(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Cw(){if(typeof performance.getEntriesByType=="function"){for(var n=0,i=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var h=a[o],p=h.transferSize,w=h.initiatorType,k=h.duration;if(p&&k&&yy(w)){for(w=0,k=h.responseEnd,o+=1;o<a.length;o++){var H=a[o],ne=H.startTime;if(ne>k)break;var fe=H.transferSize,ge=H.initiatorType;fe&&yy(ge)&&(H=H.responseEnd,w+=fe*(H<k?1:(k-ne)/(H-ne)))}if(--o,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 Jf=null,Xf=null;function Ko(n){return n.nodeType===9?n:n.ownerDocument}function by(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 xy(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 Kf(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 Qf=null;function Aw(){var n=window.event;return n&&n.type==="popstate"?n===Qf?!1:(Qf=n,!0):(Qf=null,!1)}var vy=typeof setTimeout=="function"?setTimeout:void 0,Tw=typeof clearTimeout=="function"?clearTimeout:void 0,wy=typeof Promise=="function"?Promise:void 0,jw=typeof queueMicrotask=="function"?queueMicrotask:typeof wy<"u"?function(n){return wy.resolve(null).then(n).catch(Nw)}:vy;function Nw(n){setTimeout(function(){throw n})}function Ti(n){return n==="head"}function Sy(n,i){var a=i,o=0;do{var h=a.nextSibling;if(n.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(o===0){n.removeChild(h),Ws(i);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")ol(n.ownerDocument.documentElement);else if(a==="head"){a=n.ownerDocument.head,ol(a);for(var p=a.firstChild;p;){var w=p.nextSibling,k=p.nodeName;p[Zt]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&ol(n.ownerDocument.body);a=h}while(a);Ws(i)}function _y(n,i){var a=n;n=0;do{var o=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||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(n===0)break;n--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||n++;a=o}while(a)}function Zf(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":Zf(a),vs(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}n.removeChild(a)}}function Ow(n,i,a,o){for(;n.nodeType===1;){var h=a;if(n.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(o){if(!n[Zt])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=sr(n.nextSibling),n===null)break}return null}function Rw(n,i,a){if(i==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=sr(n.nextSibling),n===null))return null;return n}function ky(n,i){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=sr(n.nextSibling),n===null))return null;return n}function Wf(n){return n.data==="$?"||n.data==="$~"}function eh(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Mw(n,i){var a=n.ownerDocument;if(n.data==="$~")n._reactRetry=i;else if(n.data!=="$?"||a.readyState!=="loading")i();else{var o=function(){i(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),n._reactRetry=o}}function sr(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 th=null;function Ey(n){n=n.nextSibling;for(var i=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"||a==="/&"){if(i===0)return sr(n.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}n=n.nextSibling}return null}function Cy(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 Ay(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 ol(n){for(var i=n.attributes;i.length;)n.removeAttributeNode(i[0]);vs(n)}var ar=new Map,Ty=new Set;function Qo(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Wr=Y.d;Y.d={f:Dw,r:Lw,D:zw,C:Uw,L:Bw,m:Pw,X:qw,S:Hw,M:Iw};function Dw(){var n=Wr.f(),i=Io();return n||i}function Lw(n){var i=R(n);i!==null&&i.tag===5&&i.type==="form"?Yp(i):Wr.r(n)}var Ks=typeof document>"u"?null:document;function jy(n,i,a){var o=Ks;if(o&&typeof i=="string"&&i){var h=Zn(i);h='link[rel="'+n+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Ty.has(h)||(Ty.add(h),n={rel:n,crossOrigin:a,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),un(i,"link",n),V(i),o.head.appendChild(i)))}}function zw(n){Wr.D(n),jy("dns-prefetch",n,null)}function Uw(n,i){Wr.C(n,i),jy("preconnect",n,i)}function Bw(n,i,a){Wr.L(n,i,a);var o=Ks;if(o&&n&&i){var h='link[rel="preload"][as="'+Zn(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Zn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Zn(a.imageSizes)+'"]')):h+='[href="'+Zn(n)+'"]';var p=h;switch(i){case"style":p=Qs(n);break;case"script":p=Zs(n)}ar.has(p)||(n=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:n,as:i},a),ar.set(p,n),o.querySelector(h)!==null||i==="style"&&o.querySelector(ul(p))||i==="script"&&o.querySelector(cl(p))||(i=o.createElement("link"),un(i,"link",n),V(i),o.head.appendChild(i)))}}function Pw(n,i){Wr.m(n,i);var a=Ks;if(a&&n){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Zn(o)+'"][href="'+Zn(n)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Zs(n)}if(!ar.has(p)&&(n=g({rel:"modulepreload",href:n},i),ar.set(p,n),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(cl(p)))return}o=a.createElement("link"),un(o,"link",n),V(o),a.head.appendChild(o)}}}function Hw(n,i,a){Wr.S(n,i,a);var o=Ks;if(o&&n){var h=U(o).hoistableStyles,p=Qs(n);i=i||"default";var w=h.get(p);if(!w){var k={loading:0,preload:null};if(w=o.querySelector(ul(p)))k.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":i},a),(a=ar.get(p))&&nh(n,a);var H=w=o.createElement("link");V(H),un(H,"link",n),H._p=new Promise(function(ne,fe){H.onload=ne,H.onerror=fe}),H.addEventListener("load",function(){k.loading|=1}),H.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Zo(w,i,o)}w={type:"stylesheet",instance:w,count:1,state:k},h.set(p,w)}}}function qw(n,i){Wr.X(n,i);var a=Ks;if(a&&n){var o=U(a).hoistableScripts,h=Zs(n),p=o.get(h);p||(p=a.querySelector(cl(h)),p||(n=g({src:n,async:!0},i),(i=ar.get(h))&&rh(n,i),p=a.createElement("script"),V(p),un(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Iw(n,i){Wr.M(n,i);var a=Ks;if(a&&n){var o=U(a).hoistableScripts,h=Zs(n),p=o.get(h);p||(p=a.querySelector(cl(h)),p||(n=g({src:n,async:!0,type:"module"},i),(i=ar.get(h))&&rh(n,i),p=a.createElement("script"),V(p),un(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Ny(n,i,a,o){var h=(h=_e.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=Qs(a.href),a=U(h).hoistableStyles,o=a.get(i),o||(o={type:"style",instance:null,count:0,state:null},a.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){n=Qs(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(ul(n)))&&!p._p&&(w.instance=p,w.state.loading=5),ar.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},ar.set(n,a),p||Fw(h,n,a,w.state))),i&&o===null)throw Error(s(528,""));return w}if(i&&o!==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=Zs(a),a=U(h).hoistableScripts,o=a.get(i),o||(o={type:"script",instance:null,count:0,state:null},a.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function Qs(n){return'href="'+Zn(n)+'"'}function ul(n){return'link[rel="stylesheet"]['+n+"]"}function Oy(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function Fw(n,i,a,o){n.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=n.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),un(i,"link",a),V(i),n.head.appendChild(i))}function Zs(n){return'[src="'+Zn(n)+'"]'}function cl(n){return"script[async]"+n}function Ry(n,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var o=n.querySelector('style[data-href~="'+Zn(a.href)+'"]');if(o)return i.instance=o,V(o),o;var h=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(n.ownerDocument||n).createElement("style"),V(o),un(o,"style",h),Zo(o,a.precedence,n),i.instance=o;case"stylesheet":h=Qs(a.href);var p=n.querySelector(ul(h));if(p)return i.state.loading|=4,i.instance=p,V(p),p;o=Oy(a),(h=ar.get(h))&&nh(o,h),p=(n.ownerDocument||n).createElement("link"),V(p);var w=p;return w._p=new Promise(function(k,H){w.onload=k,w.onerror=H}),un(p,"link",o),i.state.loading|=4,Zo(p,a.precedence,n),i.instance=p;case"script":return p=Zs(a.src),(h=n.querySelector(cl(p)))?(i.instance=h,V(h),h):(o=a,(h=ar.get(p))&&(o=g({},a),rh(o,h)),n=n.ownerDocument||n,h=n.createElement("script"),V(h),un(h,"link",o),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&&(o=i.instance,i.state.loading|=4,Zo(o,a.precedence,n));return i.instance}function Zo(n,i,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,w=0;w<o.length;w++){var k=o[w];if(k.dataset.precedence===i)p=k;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 nh(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.title==null&&(n.title=i.title)}function rh(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 My(n,i,a){if(Wo===null){var o=new Map,h=Wo=new Map;h.set(a,o)}else h=Wo,o=h.get(a),o||(o=new Map,h.set(a,o));if(o.has(n))return o;for(o.set(n,null),a=a.getElementsByTagName(n),h=0;h<a.length;h++){var p=a[h];if(!(p[Zt]||p[Ct]||n==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(i)||"";w=n+w;var k=o.get(w);k?k.push(p):o.set(w,[p])}}return o}function Dy(n,i,a){n=n.ownerDocument||n,n.head.insertBefore(a,i==="title"?n.querySelector("head > title"):null)}function $w(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 Ly(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function Yw(n,i,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=Qs(o.href),p=i.querySelector(ul(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,V(p);return}p=i.ownerDocument||i,o=Oy(o),(h=ar.get(h))&&nh(o,h),p=p.createElement("link"),V(p);var w=p;w._p=new Promise(function(k,H){w.onload=k,w.onerror=H}),un(p,"link",o),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 ih=0;function Vw(n,i){return n.stylesheets&&n.count===0&&nu(n,n.stylesheets),0<n.count||0<n.imgCount?function(a){var o=setTimeout(function(){if(n.stylesheets&&nu(n,n.stylesheets),n.unsuspend){var p=n.unsuspend;n.unsuspend=null,p()}},6e4+i);0<n.imgBytes&&ih===0&&(ih=62500*Cw());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>ih?50:800)+i);return n.unsuspend=a,function(){n.unsuspend=null,clearTimeout(o),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(Gw,n),tu=null,eu.call(n))}function Gw(n,i){if(!(i.state.loading&4)){var a=tu.get(n);if(a)var o=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),o=w)}o&&a.set(null,o)}h=i.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||o,p===o&&a.set(null,h),a.set(w,h),this.count++,o=eu.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),p?p.parentNode.insertBefore(h,p.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(h,n.firstChild)),i.state.loading|=4}}var fl={$$typeof:I,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function Jw(n,i,a,o,h,p,w,k,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=li(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=li(0),this.hiddenUpdates=li(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function zy(n,i,a,o,h,p,w,k,H,ne,fe,ge){return n=new Jw(n,i,a,w,H,ne,fe,ge,k),i=1,p===!0&&(i|=24),p=Ln(3,null,null,i),n.current=p,p.stateNode=n,i=zc(),i.refCount++,n.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:i},Hc(p),n}function Uy(n){return n?(n=js,n):js}function By(n,i,a,o,h,p){h=Uy(h),o.context===null?o.context=h:o.pendingContext=h,o=yi(i),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=bi(n,o,i),a!==null&&(jn(a,n,i),Fa(a,n,i))}function Py(n,i){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<i?a:i}}function sh(n,i){Py(n,i),(n=n.alternate)&&Py(n,i)}function Hy(n){if(n.tag===13||n.tag===31){var i=Zi(n,67108864);i!==null&&jn(i,n,67108864),sh(n,67108864)}}function qy(n){if(n.tag===13||n.tag===31){var i=Hn();i=Lr(i);var a=Zi(n,i);a!==null&&jn(a,n,i),sh(n,i)}}var ru=!0;function Xw(n,i,a,o){var h=q.T;q.T=null;var p=Y.p;try{Y.p=2,ah(n,i,a,o)}finally{Y.p=p,q.T=h}}function Kw(n,i,a,o){var h=q.T;q.T=null;var p=Y.p;try{Y.p=8,ah(n,i,a,o)}finally{Y.p=p,q.T=h}}function ah(n,i,a,o){if(ru){var h=lh(o);if(h===null)Vf(n,i,o,iu,a),Fy(n,o);else if(Zw(h,n,i,a,o))o.stopPropagation();else if(Fy(n,o),i&4&&-1<Qw.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=fr(p.pendingLanes);if(w!==0){var k=p;for(k.pendingLanes|=2,k.entangledLanes|=2;w;){var H=1<<31-Pe(w);k.entanglements[1]|=H,w&=~H}Tr(p),(pt&6)===0&&(Ho=mt()+500,sl(0))}}break;case 31:case 13:k=Zi(p,2),k!==null&&jn(k,p,2),Io(),sh(p,2)}if(p=lh(o),p===null&&Vf(n,i,o,iu,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else Vf(n,i,o,null,a)}}function lh(n){return n=oc(n),oh(n)}var iu=null;function oh(n){if(iu=null,n=E(n),n!==null){var i=u(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 Iy(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(Sn()){case ce:return 2;case ke:return 8;case be:case we:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var uh=!1,ji=null,Ni=null,Oi=null,hl=new Map,dl=new Map,Ri=[],Qw="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 Fy(n,i){switch(n){case"focusin":case"focusout":ji=null;break;case"dragenter":case"dragleave":Ni=null;break;case"mouseover":case"mouseout":Oi=null;break;case"pointerover":case"pointerout":hl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":dl.delete(i.pointerId)}}function ml(n,i,a,o,h,p){return n===null||n.nativeEvent!==p?(n={blockedOn:i,domEventName:a,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=R(i),i!==null&&Hy(i)),n):(n.eventSystemFlags|=o,i=n.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),n)}function Zw(n,i,a,o,h){switch(i){case"focusin":return ji=ml(ji,n,i,a,o,h),!0;case"dragenter":return Ni=ml(Ni,n,i,a,o,h),!0;case"mouseover":return Oi=ml(Oi,n,i,a,o,h),!0;case"pointerover":var p=h.pointerId;return hl.set(p,ml(hl.get(p)||null,n,i,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,dl.set(p,ml(dl.get(p)||null,n,i,a,o,h)),!0}return!1}function $y(n){var i=E(n.target);if(i!==null){var a=u(i);if(a!==null){if(i=a.tag,i===13){if(i=c(a),i!==null){n.blockedOn=i,Kl(n.priority,function(){qy(a)});return}}else if(i===31){if(i=f(a),i!==null){n.blockedOn=i,Kl(n.priority,function(){qy(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=lh(n.nativeEvent);if(a===null){a=n.nativeEvent;var o=new a.constructor(a.type,a);lc=o,a.target.dispatchEvent(o),lc=null}else return i=R(a),i!==null&&Hy(i),n.blockedOn=a,!1;i.shift()}return!0}function Yy(n,i,a){su(n)&&a.delete(i)}function Ww(){uh=!1,ji!==null&&su(ji)&&(ji=null),Ni!==null&&su(Ni)&&(Ni=null),Oi!==null&&su(Oi)&&(Oi=null),hl.forEach(Yy),dl.forEach(Yy)}function au(n,i){n.blockedOn===i&&(n.blockedOn=null,uh||(uh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Ww)))}var lu=null;function Vy(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],o=n[i+1],h=n[i+2];if(typeof o!="function"){if(oh(o||a)===null)continue;break}var p=R(a);p!==null&&(n.splice(i,3),i-=3,lf(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function Ws(n){function i(H){return au(H,n)}ji!==null&&au(ji,n),Ni!==null&&au(Ni,n),Oi!==null&&au(Oi,n),hl.forEach(i),dl.forEach(i);for(var a=0;a<Ri.length;a++){var o=Ri[a];o.blockedOn===n&&(o.blockedOn=null)}for(;0<Ri.length&&(a=Ri[0],a.blockedOn===null);)$y(a),a.blockedOn===null&&Ri.shift();if(a=(n.ownerDocument||n).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var h=a[o],p=a[o+1],w=h[qt]||null;if(typeof p=="function")w||Vy(a);else if(w){var k=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[qt]||null)k=w.formAction;else if(oh(h)!==null)continue}else k=w.action;typeof k=="function"?a[o+1]=k:(a.splice(o,3),o-=3),Vy(a)}}}function Gy(){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),o||setTimeout(a,20)}function a(){if(!o&&!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 o=!1,h=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function ch(n){this._internalRoot=n}ou.prototype.render=ch.prototype.render=function(n){var i=this._internalRoot;if(i===null)throw Error(s(409));var a=i.current,o=Hn();By(a,o,n,i,null,null)},ou.prototype.unmount=ch.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var i=n.containerInfo;By(n.current,2,null,n,null,null),Io(),i[Mn]=null}};function ou(n){this._internalRoot=n}ou.prototype.unstable_scheduleHydration=function(n){if(n){var i=Ca();n={blockedOn:null,target:n,priority:i};for(var a=0;a<Ri.length&&i!==0&&i<Ri[a].priority;a++);Ri.splice(a,0,n),a===0&&$y(n)}};var Jy=t.version;if(Jy!=="19.2.4")throw Error(s(527,Jy,"19.2.4"));Y.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?y(n):null,n=n===null?null:n.stateNode,n};var eS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uu.isDisabled&&uu.supportsFiber)try{ct=uu.inject(eS),Ie=uu}catch{}}return gl.createRoot=function(n,i){if(!l(n))throw Error(s(299));var a=!1,o="",h=tg,p=ng,w=rg;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),i=zy(n,1,!1,null,null,a,o,null,h,p,w,Gy),n[Mn]=i.current,Yf(n),new ch(i)},gl.hydrateRoot=function(n,i,a){if(!l(n))throw Error(s(299));var o=!1,h="",p=tg,w=ng,k=rg,H=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!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&&(k=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),i=zy(n,1,!0,i,a??null,o,h,H,p,w,k,Gy),i.context=Uy(null),a=i.current,o=Hn(),o=Lr(o),h=yi(o),h.callback=null,bi(a,h,o),a=o,i.current.lanes=a,hr(i,a),Tr(i),n[Mn]=i.current,Yf(n),new ou(i)},gl.version="19.2.4",gl}var i0;function fS(){if(i0)return dh.exports;i0=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(),dh.exports=cS(),dh.exports}var hS=fS();/**
|
|
48
|
+
`+o.stack}}var zn=Object.prototype.hasOwnProperty,qt=e.unstable_scheduleCallback,nn=e.unstable_cancelCallback,pn=e.unstable_shouldYield,Un=e.unstable_requestPaint,dt=e.unstable_now,Xt=e.unstable_getCurrentPriorityLevel,fe=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,Pe=e.unstable_NormalPriority,Je=e.unstable_LowPriority,it=e.unstable_IdlePriority,Kt=e.log,cn=e.unstable_setDisableYieldValue,xe=null,ke=null;function Be(n){if(typeof Kt=="function"&&cn(n),ke&&typeof ke.setStrictMode=="function")try{ke.setStrictMode(xe,n)}catch{}}var Oe=Math.clz32?Math.clz32:Ee,oe=Math.log,Re=Math.LN2;function Ee(n){return n>>>=0,n===0?32:31-(oe(n)/Re|0)|0}var Ue=256,Xe=262144,Tt=4194304;function Nt(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 Yt(n,i,a){var o=n.pendingLanes;if(o===0)return 0;var h=0,p=n.suspendedLanes,w=n.pingedLanes;n=n.warmLanes;var k=o&134217727;return k!==0?(o=k&~p,o!==0?h=Nt(o):(w&=k,w!==0?h=Nt(w):a||(a=k&~n,a!==0&&(h=Nt(a))))):(k=o&~p,k!==0?h=Nt(k):w!==0?h=Nt(w):a||(a=o&~n,a!==0&&(h=Nt(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 gn(n,i){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&i)===0}function fi(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 Ht(){var n=Tt;return Tt<<=1,(Tt&62914560)===0&&(Tt=4194304),n}function pr(n){for(var i=[],a=0;31>a;a++)i.push(n);return i}function gr(n,i){n.pendingLanes|=i,i!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function hi(n,i,a,o,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 k=n.entanglements,H=n.expirationTimes,ne=n.hiddenUpdates;for(a=w&~a;0<a;){var he=31-Oe(a),ge=1<<he;k[he]=0,H[he]=-1;var ie=ne[he];if(ie!==null)for(ne[he]=null,he=0;he<ie.length;he++){var le=ie[he];le!==null&&(le.lane&=-536870913)}a&=~ge}o!==0&&di(n,o,0),p!==0&&h===0&&n.tag!==0&&(n.suspendedLanes|=p&~(w&~i))}function di(n,i,a){n.pendingLanes|=i,n.suspendedLanes&=~i;var o=31-Oe(i);n.entangledLanes|=i,n.entanglements[o]=n.entanglements[o]|1073741824|a&261930}function Ji(n,i){var a=n.entangledLanes|=i;for(n=n.entanglements;a;){var o=31-Oe(a),h=1<<o;h&i|n[o]&i&&(n[o]|=i),a&=~h}}function mi(n,i){var a=i&-i;return a=(a&42)!==0?1:Pr(a),(a&(n.suspendedLanes|i))!==0?0:a}function Pr(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 Xi(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Ca(){var n=Y.p;return n!==0?n:(n=window.event,n===void 0?32:Iy(n.type))}function Kl(n,i){var a=Y.p;try{return Y.p=n,i()}finally{Y.p=a}}var jr=Math.random().toString(36).slice(2),Et="__reactFiber$"+jr,It="__reactProps$"+jr,Bn="__reactContainer$"+jr,Ki="__reactEvents$"+jr,Aa="__reactListeners$"+jr,Ql="__reactHandles$"+jr,Zl="__reactResources$"+jr,rn="__reactMarker$"+jr;function ws(n){delete n[Et],delete n[It],delete n[Ki],delete n[Aa],delete n[Ql]}function E(n){var i=n[Et];if(i)return i;for(var a=n.parentNode;a;){if(i=a[Bn]||a[Et]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(n=Cy(n);n!==null;){if(a=n[Et])return a;n=Cy(n)}return i}n=a,a=n.parentNode}return null}function R(n){if(n=n[Et]||n[Bn]){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[Zl];return i||(i=n[Zl]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function V(n){n[rn]=!0}var Q=new Set,pe={};function be(n,i){se(n,i),se(n+"Capture",i)}function se(n,i){for(pe[n]=i,n=0;n<i.length;n++)Q.add(i[n])}var me=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={},We={};function Rt(n){return zn.call(We,n)?!0:zn.call(Le,n)?!1:me.test(n)?We[n]=!0:(Le[n]=!0,!1)}function yn(n,i,a){if(Rt(i))if(a===null)n.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":n.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){n.removeAttribute(i);return}}n.setAttribute(i,""+a)}}function yr(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 Hr(n,i,a,o){if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttributeNS(i,a,""+o)}}function tr(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function cm(n){var i=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function X1(n,i,a){var o=Object.getOwnPropertyDescriptor(n.constructor.prototype,i);if(!n.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.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:o.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){n._valueTracker=null,delete n[i]}}}}function rc(n){if(!n._valueTracker){var i=cm(n)?"checked":"value";n._valueTracker=X1(n,i,""+n[i])}}function fm(n){if(!n)return!1;var i=n._valueTracker;if(!i)return!0;var a=i.getValue(),o="";return n&&(o=cm(n)?n.checked?"true":"false":n.value),n=o,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 K1=/[\n"\\]/g;function nr(n){return n.replace(K1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function ic(n,i,a,o,h,p,w,k){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=""+tr(i)):n.value!==""+tr(i)&&(n.value=""+tr(i)):w!=="submit"&&w!=="reset"||n.removeAttribute("value"),i!=null?sc(n,w,tr(i)):a!=null?sc(n,w,tr(a)):o!=null&&n.removeAttribute("value"),h==null&&p!=null&&(n.defaultChecked=!!p),h!=null&&(n.checked=h&&typeof h!="function"&&typeof h!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?n.name=""+tr(k):n.removeAttribute("name")}function hm(n,i,a,o,h,p,w,k){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)){rc(n);return}a=a!=null?""+tr(a):"",i=i!=null?""+tr(i):a,k||i===n.value||(n.value=i),n.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,n.checked=k?n.checked:!!o,n.defaultChecked=!!o,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.name=w),rc(n)}function sc(n,i,a){i==="number"&&Wl(n.ownerDocument)===n||n.defaultValue===""+a||(n.defaultValue=""+a)}function Ss(n,i,a,o){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&&o&&(n[a].defaultSelected=!0)}else{for(a=""+tr(a),i=null,h=0;h<n.length;h++){if(n[h].value===a){n[h].selected=!0,o&&(n[h].defaultSelected=!0);return}i!==null||n[h].disabled||(i=n[h])}i!==null&&(i.selected=!0)}}function dm(n,i,a){if(i!=null&&(i=""+tr(i),i!==n.value&&(n.value=i),a==null)){n.defaultValue!==i&&(n.defaultValue=i);return}n.defaultValue=a!=null?""+tr(a):""}function mm(n,i,a,o){if(i==null){if(o!=null){if(a!=null)throw Error(s(92));if(re(o)){if(1<o.length)throw Error(s(93));o=o[0]}a=o}a==null&&(a=""),i=a}a=tr(i),n.defaultValue=a,o=n.textContent,o===a&&o!==""&&o!==null&&(n.value=o),rc(n)}function _s(n,i){if(i){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=i;return}}n.textContent=i}var Q1=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 pm(n,i,a){var o=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?n.setProperty(i,""):i==="float"?n.cssFloat="":n[i]="":o?n.setProperty(i,a):typeof a!="number"||a===0||Q1.has(i)?i==="float"?n.cssFloat=a:n[i]=(""+a).trim():n[i]=a+"px"}function gm(n,i,a){if(i!=null&&typeof i!="object")throw Error(s(62));if(n=n.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?n.setProperty(o,""):o==="float"?n.cssFloat="":n[o]="");for(var h in i)o=i[h],i.hasOwnProperty(h)&&a[h]!==o&&pm(n,h,o)}else for(var p in i)i.hasOwnProperty(p)&&pm(n,p,i[p])}function ac(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 Z1=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"]]),W1=/^[\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 W1.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function qr(){}var lc=null;function oc(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var ks=null,Es=null;function ym(n){var i=R(n);if(i&&(n=i.stateNode)){var a=n[It]||null;e:switch(n=i.stateNode,i.type){case"input":if(ic(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="'+nr(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var o=a[i];if(o!==n&&o.form===n.form){var h=o[It]||null;if(!h)throw Error(s(90));ic(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<a.length;i++)o=a[i],o.form===n.form&&fm(o)}break e;case"textarea":dm(n,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&Ss(n,!!a.multiple,i,!1)}}}var uc=!1;function bm(n,i,a){if(uc)return n(i,a);uc=!0;try{var o=n(i);return o}finally{if(uc=!1,(ks!==null||Es!==null)&&(Io(),ks&&(i=ks,n=Es,Es=ks=null,ym(i),n)))for(i=0;i<n.length;i++)ym(n[i])}}function ja(n,i){var a=n.stateNode;if(a===null)return null;var o=a[It]||null;if(o===null)return null;a=o[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":(o=!o.disabled)||(n=n.type,o=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!o;break e;default:n=!1}if(n)return null;if(a&&typeof a!="function")throw Error(s(231,i,typeof a));return a}var Ir=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cc=!1;if(Ir)try{var Ta={};Object.defineProperty(Ta,"passive",{get:function(){cc=!0}}),window.addEventListener("test",Ta,Ta),window.removeEventListener("test",Ta,Ta)}catch{cc=!1}var pi=null,fc=null,to=null;function xm(){if(to)return to;var n,i=fc,a=i.length,o,h="value"in pi?pi.value:pi.textContent,p=h.length;for(n=0;n<a&&i[n]===h[n];n++);var w=a-n;for(o=1;o<=w&&i[a-o]===h[p-o];o++);return to=h.slice(n,1<o?1-o: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 vm(){return!1}function jn(n){function i(a,o,h,p,w){this._reactName=a,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var k in n)n.hasOwnProperty(k)&&(a=n[k],this[k]=a?a(p):p[k]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?ro:vm,this.isPropagationStopped=vm,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 Qi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},io=jn(Qi),Na=g({},Qi,{view:0,detail:0}),ev=jn(Na),hc,dc,Oa,so=g({},Na,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pc,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!==Oa&&(Oa&&n.type==="mousemove"?(hc=n.screenX-Oa.screenX,dc=n.screenY-Oa.screenY):dc=hc=0,Oa=n),hc)},movementY:function(n){return"movementY"in n?n.movementY:dc}}),wm=jn(so),tv=g({},so,{dataTransfer:0}),nv=jn(tv),rv=g({},Na,{relatedTarget:0}),mc=jn(rv),iv=g({},Qi,{animationName:0,elapsedTime:0,pseudoElement:0}),sv=jn(iv),av=g({},Qi,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),lv=jn(av),ov=g({},Qi,{data:0}),Sm=jn(ov),uv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cv={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"},fv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hv(n){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(n):(n=fv[n])?!!i[n]:!1}function pc(){return hv}var dv=g({},Na,{key:function(n){if(n.key){var i=uv[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"?cv[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pc,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}}),mv=jn(dv),pv=g({},so,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_m=jn(pv),gv=g({},Na,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pc}),yv=jn(gv),bv=g({},Qi,{propertyName:0,elapsedTime:0,pseudoElement:0}),xv=jn(bv),vv=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}),wv=jn(vv),Sv=g({},Qi,{newState:0,oldState:0}),_v=jn(Sv),kv=[9,13,27,32],gc=Ir&&"CompositionEvent"in window,Ra=null;Ir&&"documentMode"in document&&(Ra=document.documentMode);var Ev=Ir&&"TextEvent"in window&&!Ra,km=Ir&&(!gc||Ra&&8<Ra&&11>=Ra),Em=" ",Cm=!1;function Am(n,i){switch(n){case"keyup":return kv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jm(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Cs=!1;function Cv(n,i){switch(n){case"compositionend":return jm(i);case"keypress":return i.which!==32?null:(Cm=!0,Em);case"textInput":return n=i.data,n===Em&&Cm?null:n;default:return null}}function Av(n,i){if(Cs)return n==="compositionend"||!gc&&Am(n,i)?(n=xm(),to=fc=pi=null,Cs=!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 km&&i.locale!=="ko"?null:i.data;default:return null}}var jv={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 Tm(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i==="input"?!!jv[n.type]:i==="textarea"}function Nm(n,i,a,o){ks?Es?Es.push(o):Es=[o]:ks=o,i=Xo(i,"onChange"),0<i.length&&(a=new io("onChange","change",null,a,o),n.push({event:a,listeners:i}))}var Ma=null,Da=null;function Tv(n){hy(n,0)}function ao(n){var i=T(n);if(fm(i))return n}function Om(n,i){if(n==="change")return i}var Rm=!1;if(Ir){var yc;if(Ir){var bc="oninput"in document;if(!bc){var Mm=document.createElement("div");Mm.setAttribute("oninput","return;"),bc=typeof Mm.oninput=="function"}yc=bc}else yc=!1;Rm=yc&&(!document.documentMode||9<document.documentMode)}function Dm(){Ma&&(Ma.detachEvent("onpropertychange",Lm),Da=Ma=null)}function Lm(n){if(n.propertyName==="value"&&ao(Da)){var i=[];Nm(i,Da,n,oc(n)),bm(Tv,i)}}function Nv(n,i,a){n==="focusin"?(Dm(),Ma=i,Da=a,Ma.attachEvent("onpropertychange",Lm)):n==="focusout"&&Dm()}function Ov(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ao(Da)}function Rv(n,i){if(n==="click")return ao(i)}function Mv(n,i){if(n==="input"||n==="change")return ao(i)}function Dv(n,i){return n===i&&(n!==0||1/n===1/i)||n!==n&&i!==i}var Pn=typeof Object.is=="function"?Object.is:Dv;function La(n,i){if(Pn(n,i))return!0;if(typeof n!="object"||n===null||typeof i!="object"||i===null)return!1;var a=Object.keys(n),o=Object.keys(i);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var h=a[o];if(!zn.call(i,h)||!Pn(n[h],i[h]))return!1}return!0}function zm(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Um(n,i){var a=zm(n);n=0;for(var o;a;){if(a.nodeType===3){if(o=n+a.textContent.length,n<=i&&o>=i)return{node:a,offset:i-n};n=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=zm(a)}}function Bm(n,i){return n&&i?n===i?!0:n&&n.nodeType===3?!1:i&&i.nodeType===3?Bm(n,i.parentNode):"contains"in n?n.contains(i):n.compareDocumentPosition?!!(n.compareDocumentPosition(i)&16):!1:!1}function Pm(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 xc(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 Lv=Ir&&"documentMode"in document&&11>=document.documentMode,As=null,vc=null,za=null,wc=!1;function Hm(n,i,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;wc||As==null||As!==Wl(o)||(o=As,"selectionStart"in o&&xc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),za&&La(za,o)||(za=o,o=Xo(vc,"onSelect"),0<o.length&&(i=new io("onSelect","select",null,i,a),n.push({event:i,listeners:o}),i.target=As)))}function Zi(n,i){var a={};return a[n.toLowerCase()]=i.toLowerCase(),a["Webkit"+n]="webkit"+i,a["Moz"+n]="moz"+i,a}var js={animationend:Zi("Animation","AnimationEnd"),animationiteration:Zi("Animation","AnimationIteration"),animationstart:Zi("Animation","AnimationStart"),transitionrun:Zi("Transition","TransitionRun"),transitionstart:Zi("Transition","TransitionStart"),transitioncancel:Zi("Transition","TransitionCancel"),transitionend:Zi("Transition","TransitionEnd")},Sc={},qm={};Ir&&(qm=document.createElement("div").style,"AnimationEvent"in window||(delete js.animationend.animation,delete js.animationiteration.animation,delete js.animationstart.animation),"TransitionEvent"in window||delete js.transitionend.transition);function Wi(n){if(Sc[n])return Sc[n];if(!js[n])return n;var i=js[n],a;for(a in i)if(i.hasOwnProperty(a)&&a in qm)return Sc[n]=i[a];return n}var Im=Wi("animationend"),Fm=Wi("animationiteration"),$m=Wi("animationstart"),zv=Wi("transitionrun"),Uv=Wi("transitionstart"),Bv=Wi("transitioncancel"),Ym=Wi("transitionend"),Vm=new Map,_c="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(" ");_c.push("scrollEnd");function br(n,i){Vm.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)},rr=[],Ts=0,kc=0;function oo(){for(var n=Ts,i=kc=Ts=0;i<n;){var a=rr[i];rr[i++]=null;var o=rr[i];rr[i++]=null;var h=rr[i];rr[i++]=null;var p=rr[i];if(rr[i++]=null,o!==null&&h!==null){var w=o.pending;w===null?h.next=h:(h.next=w.next,w.next=h),o.pending=h}p!==0&&Gm(a,h,p)}}function uo(n,i,a,o){rr[Ts++]=n,rr[Ts++]=i,rr[Ts++]=a,rr[Ts++]=o,kc|=o,n.lanes|=o,n=n.alternate,n!==null&&(n.lanes|=o)}function Ec(n,i,a,o){return uo(n,i,a,o),co(n)}function es(n,i){return uo(n,null,null,i),co(n)}function Gm(n,i,a){n.lanes|=a;var o=n.alternate;o!==null&&(o.lanes|=a);for(var h=!1,p=n.return;p!==null;)p.childLanes|=a,o=p.alternate,o!==null&&(o.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-Oe(a),n=p.hiddenUpdates,o=n[h],o===null?n[h]=[i]:o.push(i),i.lane=a|536870912),p):null}function co(n){if(50<il)throw il=0,Lf=null,Error(s(185));for(var i=n.return;i!==null;)n=i,i=n.return;return n.tag===3?n.stateNode:null}var Ns={};function Pv(n,i,a,o){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=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Hn(n,i,a,o){return new Pv(n,i,a,o)}function Cc(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Fr(n,i){var a=n.alternate;return a===null?(a=Hn(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 Jm(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,o,h,p){var w=0;if(o=n,typeof n=="function")Cc(n)&&(w=1);else if(typeof n=="string")w=$w(n,a,ye.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case $:return n=Hn(31,a,i,h),n.elementType=$,n.lanes=p,n;case j:return ts(a.children,h,p,i);case O:w=8,h|=24;break;case M:return n=Hn(12,a,i,h|2),n.elementType=M,n.lanes=p,n;case P:return n=Hn(13,a,i,h),n.elementType=P,n.lanes=p,n;case D:return n=Hn(19,a,i,h),n.elementType=D,n.lanes=p,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:w=10;break e;case B:w=9;break e;case ee:w=11;break e;case Z:w=14;break e;case F:w=16,o=null;break e}w=29,a=Error(s(130,n===null?"null":typeof n,"")),o=null}return i=Hn(w,a,i,h),i.elementType=n,i.type=o,i.lanes=p,i}function ts(n,i,a,o){return n=Hn(7,n,o,i),n.lanes=a,n}function Ac(n,i,a){return n=Hn(6,n,null,i),n.lanes=a,n}function Xm(n){var i=Hn(18,null,null,0);return i.stateNode=n,i}function jc(n,i,a){return i=Hn(4,n.children!==null?n.children:[],n.key,i),i.lanes=a,i.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},i}var Km=new WeakMap;function ir(n,i){if(typeof n=="object"&&n!==null){var a=Km.get(n);return a!==void 0?a:(i={value:n,source:i,stack:gt(i)},Km.set(n,i),i)}return{value:n,source:i,stack:gt(i)}}var Os=[],Rs=0,ho=null,Ua=0,sr=[],ar=0,gi=null,Tr=1,Nr="";function $r(n,i){Os[Rs++]=Ua,Os[Rs++]=ho,ho=n,Ua=i}function Qm(n,i,a){sr[ar++]=Tr,sr[ar++]=Nr,sr[ar++]=gi,gi=n;var o=Tr;n=Nr;var h=32-Oe(o)-1;o&=~(1<<h),a+=1;var p=32-Oe(i)+h;if(30<p){var w=h-h%5;p=(o&(1<<w)-1).toString(32),o>>=w,h-=w,Tr=1<<32-Oe(i)+h|a<<h|o,Nr=p+n}else Tr=1<<p|a<<h|o,Nr=n}function Tc(n){n.return!==null&&($r(n,1),Qm(n,1,0))}function Nc(n){for(;n===ho;)ho=Os[--Rs],Os[Rs]=null,Ua=Os[--Rs],Os[Rs]=null;for(;n===gi;)gi=sr[--ar],sr[ar]=null,Nr=sr[--ar],sr[ar]=null,Tr=sr[--ar],sr[ar]=null}function Zm(n,i){sr[ar++]=Tr,sr[ar++]=Nr,sr[ar++]=gi,Tr=i.id,Nr=i.overflow,gi=n}var fn=null,Mt=null,lt=!1,yi=null,lr=!1,Oc=Error(s(519));function bi(n){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ba(ir(i,n)),Oc}function Wm(n){var i=n.stateNode,a=n.type,o=n.memoizedProps;switch(i[Et]=n,i[It]=o,a){case"dialog":nt("cancel",i),nt("close",i);break;case"iframe":case"object":case"embed":nt("load",i);break;case"video":case"audio":for(a=0;a<al.length;a++)nt(al[a],i);break;case"source":nt("error",i);break;case"img":case"image":case"link":nt("error",i),nt("load",i);break;case"details":nt("toggle",i);break;case"input":nt("invalid",i),hm(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":nt("invalid",i);break;case"textarea":nt("invalid",i),mm(i,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||o.suppressHydrationWarning===!0||gy(i.textContent,a)?(o.popover!=null&&(nt("beforetoggle",i),nt("toggle",i)),o.onScroll!=null&&nt("scroll",i),o.onScrollEnd!=null&&nt("scrollend",i),o.onClick!=null&&(i.onclick=qr),i=!0):i=!1,i||bi(n,!0)}function ep(n){for(fn=n.return;fn;)switch(fn.tag){case 5:case 31:case 13:lr=!1;return;case 27:case 3:lr=!0;return;default:fn=fn.return}}function Ms(n){if(n!==fn)return!1;if(!lt)return ep(n),lt=!0,!1;var i=n.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=n.type,a=!(a!=="form"&&a!=="button")||Kf(n.type,n.memoizedProps)),a=!a),a&&Mt&&bi(n),ep(n),i===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Mt=Ey(n)}else if(i===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Mt=Ey(n)}else i===27?(i=Mt,Ri(n.type)?(n=th,th=null,Mt=n):Mt=i):Mt=fn?ur(n.stateNode.nextSibling):null;return!0}function ns(){Mt=fn=null,lt=!1}function Rc(){var n=yi;return n!==null&&(Rn===null?Rn=n:Rn.push.apply(Rn,n),yi=null),n}function Ba(n){yi===null?yi=[n]:yi.push(n)}var Mc=z(null),rs=null,Yr=null;function xi(n,i,a){_(Mc,i._currentValue),i._currentValue=a}function Vr(n){n._currentValue=Mc.current,W(Mc)}function Dc(n,i,a){for(;n!==null;){var o=n.alternate;if((n.childLanes&i)!==i?(n.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),n===a)break;n=n.return}}function Lc(n,i,a,o){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 k=p;p=h;for(var H=0;H<i.length;H++)if(k.context===i[H]){p.lanes|=a,k=p.alternate,k!==null&&(k.lanes|=a),Dc(p.return,a,n),o||(w=null);break e}p=k.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),Dc(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 Ds(n,i,a,o){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 k=h.type;Pn(h.pendingProps.value,w.value)||(n!==null?n.push(k):n=[k])}}else if(h===Me.current){if(w=h.alternate,w===null)throw Error(s(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(n!==null?n.push(fl):n=[fl])}h=h.return}n!==null&&Lc(i,n,a,o),i.flags|=262144}function mo(n){for(n=n.firstContext;n!==null;){if(!Pn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function is(n){rs=n,Yr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function hn(n){return tp(rs,n)}function po(n,i){return rs===null&&is(n),tp(n,i)}function tp(n,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},Yr===null){if(n===null)throw Error(s(308));Yr=i,n.dependencies={lanes:0,firstContext:i},n.flags|=524288}else Yr=Yr.next=i;return a}var Hv=typeof AbortController<"u"?AbortController:function(){var n=[],i=this.signal={aborted:!1,addEventListener:function(a,o){n.push(o)}};this.abort=function(){i.aborted=!0,n.forEach(function(a){return a()})}},qv=e.unstable_scheduleCallback,Iv=e.unstable_NormalPriority,Qt={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function zc(){return{controller:new Hv,data:new Map,refCount:0}}function Pa(n){n.refCount--,n.refCount===0&&qv(Iv,function(){n.controller.abort()})}var Ha=null,Uc=0,Ls=0,zs=null;function Fv(n,i){if(Ha===null){var a=Ha=[];Uc=0,Ls=qf(),zs={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Uc++,i.then(np,np),i}function np(){if(--Uc===0&&Ha!==null){zs!==null&&(zs.status="fulfilled");var n=Ha;Ha=null,Ls=0,zs=null;for(var i=0;i<n.length;i++)(0,n[i])()}}function $v(n,i){var a=[],o={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return n.then(function(){o.status="fulfilled",o.value=i;for(var h=0;h<a.length;h++)(0,a[h])(i)},function(h){for(o.status="rejected",o.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),o}var rp=q.S;q.S=function(n,i){Hg=dt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Fv(n,i),rp!==null&&rp(n,i)};var ss=z(null);function Bc(){var n=ss.current;return n!==null?n:Ct.pooledCache}function go(n,i){i===null?_(ss,ss.current):_(ss,i.pool)}function ip(){var n=Bc();return n===null?null:{parent:Qt._currentValue,pool:n}}var Us=Error(s(460)),Pc=Error(s(474)),yo=Error(s(542)),bo={then:function(){}};function sp(n){return n=n.status,n==="fulfilled"||n==="rejected"}function ap(n,i,a){switch(a=n[a],a===void 0?n.push(i):a!==i&&(i.then(qr,qr),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,op(n),n;default:if(typeof i.status=="string")i.then(qr,qr);else{if(n=Ct,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=i,n.status="pending",n.then(function(o){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=o}},function(o){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=o}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,op(n),n}throw ls=i,Us}}function as(n){try{var i=n._init;return i(n._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ls=a,Us):a}}var ls=null;function lp(){if(ls===null)throw Error(s(459));var n=ls;return ls=null,n}function op(n){if(n===Us||n===yo)throw Error(s(483))}var Bs=null,qa=0;function xo(n){var i=qa;return qa+=1,Bs===null&&(Bs=[]),ap(Bs,n,i)}function Ia(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 up(n){function i(K,X){if(n){var te=K.deletions;te===null?(K.deletions=[X],K.flags|=16):te.push(X)}}function a(K,X){if(!n)return null;for(;X!==null;)i(K,X),X=X.sibling;return null}function o(K){for(var X=new Map;K!==null;)K.key!==null?X.set(K.key,K):X.set(K.index,K),K=K.sibling;return X}function h(K,X){return K=Fr(K,X),K.index=0,K.sibling=null,K}function p(K,X,te){return K.index=te,n?(te=K.alternate,te!==null?(te=te.index,te<X?(K.flags|=67108866,X):te):(K.flags|=67108866,X)):(K.flags|=1048576,X)}function w(K){return n&&K.alternate===null&&(K.flags|=67108866),K}function k(K,X,te,de){return X===null||X.tag!==6?(X=Ac(te,K.mode,de),X.return=K,X):(X=h(X,te),X.return=K,X)}function H(K,X,te,de){var Fe=te.type;return Fe===j?he(K,X,te.props.children,de,te.key):X!==null&&(X.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===F&&as(Fe)===X.type)?(X=h(X,te.props),Ia(X,te),X.return=K,X):(X=fo(te.type,te.key,te.props,null,K.mode,de),Ia(X,te),X.return=K,X)}function ne(K,X,te,de){return X===null||X.tag!==4||X.stateNode.containerInfo!==te.containerInfo||X.stateNode.implementation!==te.implementation?(X=jc(te,K.mode,de),X.return=K,X):(X=h(X,te.children||[]),X.return=K,X)}function he(K,X,te,de,Fe){return X===null||X.tag!==7?(X=ts(te,K.mode,de,Fe),X.return=K,X):(X=h(X,te),X.return=K,X)}function ge(K,X,te){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=Ac(""+X,K.mode,te),X.return=K,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case v:return te=fo(X.type,X.key,X.props,null,K.mode,te),Ia(te,X),te.return=K,te;case S:return X=jc(X,K.mode,te),X.return=K,X;case F:return X=as(X),ge(K,X,te)}if(re(X)||G(X))return X=ts(X,K.mode,te,null),X.return=K,X;if(typeof X.then=="function")return ge(K,xo(X),te);if(X.$$typeof===I)return ge(K,po(K,X),te);vo(K,X)}return null}function ie(K,X,te,de){var Fe=X!==null?X.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Fe!==null?null:k(K,X,""+te,de);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case v:return te.key===Fe?H(K,X,te,de):null;case S:return te.key===Fe?ne(K,X,te,de):null;case F:return te=as(te),ie(K,X,te,de)}if(re(te)||G(te))return Fe!==null?null:he(K,X,te,de,null);if(typeof te.then=="function")return ie(K,X,xo(te),de);if(te.$$typeof===I)return ie(K,X,po(K,te),de);vo(K,te)}return null}function le(K,X,te,de,Fe){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return K=K.get(te)||null,k(X,K,""+de,Fe);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case v:return K=K.get(de.key===null?te:de.key)||null,H(X,K,de,Fe);case S:return K=K.get(de.key===null?te:de.key)||null,ne(X,K,de,Fe);case F:return de=as(de),le(K,X,te,de,Fe)}if(re(de)||G(de))return K=K.get(te)||null,he(X,K,de,Fe,null);if(typeof de.then=="function")return le(K,X,te,xo(de),Fe);if(de.$$typeof===I)return le(K,X,te,po(X,de),Fe);vo(X,de)}return null}function ze(K,X,te,de){for(var Fe=null,ft=null,He=X,Qe=X=0,at=null;He!==null&&Qe<te.length;Qe++){He.index>Qe?(at=He,He=null):at=He.sibling;var ht=ie(K,He,te[Qe],de);if(ht===null){He===null&&(He=at);break}n&&He&&ht.alternate===null&&i(K,He),X=p(ht,X,Qe),ft===null?Fe=ht:ft.sibling=ht,ft=ht,He=at}if(Qe===te.length)return a(K,He),lt&&$r(K,Qe),Fe;if(He===null){for(;Qe<te.length;Qe++)He=ge(K,te[Qe],de),He!==null&&(X=p(He,X,Qe),ft===null?Fe=He:ft.sibling=He,ft=He);return lt&&$r(K,Qe),Fe}for(He=o(He);Qe<te.length;Qe++)at=le(He,K,Qe,te[Qe],de),at!==null&&(n&&at.alternate!==null&&He.delete(at.key===null?Qe:at.key),X=p(at,X,Qe),ft===null?Fe=at:ft.sibling=at,ft=at);return n&&He.forEach(function(Ui){return i(K,Ui)}),lt&&$r(K,Qe),Fe}function Ye(K,X,te,de){if(te==null)throw Error(s(151));for(var Fe=null,ft=null,He=X,Qe=X=0,at=null,ht=te.next();He!==null&&!ht.done;Qe++,ht=te.next()){He.index>Qe?(at=He,He=null):at=He.sibling;var Ui=ie(K,He,ht.value,de);if(Ui===null){He===null&&(He=at);break}n&&He&&Ui.alternate===null&&i(K,He),X=p(Ui,X,Qe),ft===null?Fe=Ui:ft.sibling=Ui,ft=Ui,He=at}if(ht.done)return a(K,He),lt&&$r(K,Qe),Fe;if(He===null){for(;!ht.done;Qe++,ht=te.next())ht=ge(K,ht.value,de),ht!==null&&(X=p(ht,X,Qe),ft===null?Fe=ht:ft.sibling=ht,ft=ht);return lt&&$r(K,Qe),Fe}for(He=o(He);!ht.done;Qe++,ht=te.next())ht=le(He,K,Qe,ht.value,de),ht!==null&&(n&&ht.alternate!==null&&He.delete(ht.key===null?Qe:ht.key),X=p(ht,X,Qe),ft===null?Fe=ht:ft.sibling=ht,ft=ht);return n&&He.forEach(function(tS){return i(K,tS)}),lt&&$r(K,Qe),Fe}function wt(K,X,te,de){if(typeof te=="object"&&te!==null&&te.type===j&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case v:e:{for(var Fe=te.key;X!==null;){if(X.key===Fe){if(Fe=te.type,Fe===j){if(X.tag===7){a(K,X.sibling),de=h(X,te.props.children),de.return=K,K=de;break e}}else if(X.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===F&&as(Fe)===X.type){a(K,X.sibling),de=h(X,te.props),Ia(de,te),de.return=K,K=de;break e}a(K,X);break}else i(K,X);X=X.sibling}te.type===j?(de=ts(te.props.children,K.mode,de,te.key),de.return=K,K=de):(de=fo(te.type,te.key,te.props,null,K.mode,de),Ia(de,te),de.return=K,K=de)}return w(K);case S:e:{for(Fe=te.key;X!==null;){if(X.key===Fe)if(X.tag===4&&X.stateNode.containerInfo===te.containerInfo&&X.stateNode.implementation===te.implementation){a(K,X.sibling),de=h(X,te.children||[]),de.return=K,K=de;break e}else{a(K,X);break}else i(K,X);X=X.sibling}de=jc(te,K.mode,de),de.return=K,K=de}return w(K);case F:return te=as(te),wt(K,X,te,de)}if(re(te))return ze(K,X,te,de);if(G(te)){if(Fe=G(te),typeof Fe!="function")throw Error(s(150));return te=Fe.call(te),Ye(K,X,te,de)}if(typeof te.then=="function")return wt(K,X,xo(te),de);if(te.$$typeof===I)return wt(K,X,po(K,te),de);vo(K,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,X!==null&&X.tag===6?(a(K,X.sibling),de=h(X,te),de.return=K,K=de):(a(K,X),de=Ac(te,K.mode,de),de.return=K,K=de),w(K)):a(K,X)}return function(K,X,te,de){try{qa=0;var Fe=wt(K,X,te,de);return Bs=null,Fe}catch(He){if(He===Us||He===yo)throw He;var ft=Hn(29,He,null,K.mode);return ft.lanes=de,ft.return=K,ft}finally{}}}var os=up(!0),cp=up(!1),vi=!1;function Hc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qc(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 wi(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Si(n,i,a){var o=n.updateQueue;if(o===null)return null;if(o=o.shared,(mt&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=co(n),Gm(n,null,a),i}return uo(n,o,i,a),co(n)}function Fa(n,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var o=i.lanes;o&=n.pendingLanes,a|=o,i.lanes=a,Ji(n,a)}}function Ic(n,i){var a=n.updateQueue,o=n.alternate;if(o!==null&&(o=o.updateQueue,a===o)){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:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},n.updateQueue=a;return}n=a.lastBaseUpdate,n===null?a.firstBaseUpdate=i:n.next=i,a.lastBaseUpdate=i}var Fc=!1;function $a(){if(Fc){var n=zs;if(n!==null)throw n}}function Ya(n,i,a,o){Fc=!1;var h=n.updateQueue;vi=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,k=h.shared.pending;if(k!==null){h.shared.pending=null;var H=k,ne=H.next;H.next=null,w===null?p=ne:w.next=ne,w=H;var he=n.alternate;he!==null&&(he=he.updateQueue,k=he.lastBaseUpdate,k!==w&&(k===null?he.firstBaseUpdate=ne:k.next=ne,he.lastBaseUpdate=H))}if(p!==null){var ge=h.baseState;w=0,he=ne=H=null,k=p;do{var ie=k.lane&-536870913,le=ie!==k.lane;if(le?(st&ie)===ie:(o&ie)===ie){ie!==0&&ie===Ls&&(Fc=!0),he!==null&&(he=he.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var ze=n,Ye=k;ie=i;var wt=a;switch(Ye.tag){case 1:if(ze=Ye.payload,typeof ze=="function"){ge=ze.call(wt,ge,ie);break e}ge=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=Ye.payload,ie=typeof ze=="function"?ze.call(wt,ge,ie):ze,ie==null)break e;ge=g({},ge,ie);break e;case 2:vi=!0}}ie=k.callback,ie!==null&&(n.flags|=64,le&&(n.flags|=8192),le=h.callbacks,le===null?h.callbacks=[ie]:le.push(ie))}else le={lane:ie,tag:k.tag,payload:k.payload,callback:k.callback,next:null},he===null?(ne=he=le,H=ge):he=he.next=le,w|=ie;if(k=k.next,k===null){if(k=h.shared.pending,k===null)break;le=k,k=le.next,le.next=null,h.lastBaseUpdate=le,h.shared.pending=null}}while(!0);he===null&&(H=ge),h.baseState=H,h.firstBaseUpdate=ne,h.lastBaseUpdate=he,p===null&&(h.shared.lanes=0),Ai|=w,n.lanes=w,n.memoizedState=ge}}function fp(n,i){if(typeof n!="function")throw Error(s(191,n));n.call(i)}function hp(n,i){var a=n.callbacks;if(a!==null)for(n.callbacks=null,n=0;n<a.length;n++)fp(a[n],i)}var Ps=z(null),wo=z(0);function dp(n,i){n=ti,_(wo,n),_(Ps,i),ti=n|i.baseLanes}function $c(){_(wo,ti),_(Ps,Ps.current)}function Yc(){ti=wo.current,W(Ps),W(wo)}var qn=z(null),or=null;function _i(n){var i=n.alternate;_(Vt,Vt.current&1),_(qn,n),or===null&&(i===null||Ps.current!==null||i.memoizedState!==null)&&(or=n)}function Vc(n){_(Vt,Vt.current),_(qn,n),or===null&&(or=n)}function mp(n){n.tag===22?(_(Vt,Vt.current),_(qn,n),or===null&&(or=n)):ki()}function ki(){_(Vt,Vt.current),_(qn,qn.current)}function In(n){W(qn),or===n&&(or=null),W(Vt)}var Vt=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||Wf(a)||eh(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 Gr=0,Ke=null,xt=null,Zt=null,_o=!1,Hs=!1,us=!1,ko=0,Va=0,qs=null,Yv=0;function Ft(){throw Error(s(321))}function Gc(n,i){if(i===null)return!1;for(var a=0;a<i.length&&a<n.length;a++)if(!Pn(n[a],i[a]))return!1;return!0}function Jc(n,i,a,o,h,p){return Gr=p,Ke=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,q.H=n===null||n.memoizedState===null?Qp:cf,us=!1,p=a(o,h),us=!1,Hs&&(p=gp(i,a,o,h)),pp(n),p}function pp(n){q.H=Xa;var i=xt!==null&&xt.next!==null;if(Gr=0,Zt=xt=Ke=null,_o=!1,Va=0,qs=null,i)throw Error(s(300));n===null||Wt||(n=n.dependencies,n!==null&&mo(n)&&(Wt=!0))}function gp(n,i,a,o){Ke=n;var h=0;do{if(Hs&&(qs=null),Va=0,Hs=!1,25<=h)throw Error(s(301));if(h+=1,Zt=xt=null,n.updateQueue!=null){var p=n.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}q.H=Zp,p=i(a,o)}while(Hs);return p}function Vv(){var n=q.H,i=n.useState()[0];return i=typeof i.then=="function"?Ga(i):i,n=n.useState()[0],(xt!==null?xt.memoizedState:null)!==n&&(Ke.flags|=1024),i}function Xc(){var n=ko!==0;return ko=0,n}function Kc(n,i,a){i.updateQueue=n.updateQueue,i.flags&=-2053,n.lanes&=~a}function Qc(n){if(_o){for(n=n.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}_o=!1}Gr=0,Zt=xt=Ke=null,Hs=!1,Va=ko=0,qs=null}function Sn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zt===null?Ke.memoizedState=Zt=n:Zt=Zt.next=n,Zt}function Gt(){if(xt===null){var n=Ke.alternate;n=n!==null?n.memoizedState:null}else n=xt.next;var i=Zt===null?Ke.memoizedState:Zt.next;if(i!==null)Zt=i,xt=n;else{if(n===null)throw Ke.alternate===null?Error(s(467)):Error(s(310));xt=n,n={memoizedState:xt.memoizedState,baseState:xt.baseState,baseQueue:xt.baseQueue,queue:xt.queue,next:null},Zt===null?Ke.memoizedState=Zt=n:Zt=Zt.next=n}return Zt}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ga(n){var i=Va;return Va+=1,qs===null&&(qs=[]),n=ap(qs,n,i),i=Ke,(Zt===null?i.memoizedState:Zt.next)===null&&(i=i.alternate,q.H=i===null||i.memoizedState===null?Qp:cf),n}function Co(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ga(n);if(n.$$typeof===I)return hn(n)}throw Error(s(438,String(n)))}function Zc(n){var i=null,a=Ke.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var o=Ke.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.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),o=0;o<n;o++)a[o]=L;return i.index++,a}function Jr(n,i){return typeof i=="function"?i(n):i}function Ao(n){var i=Gt();return Wc(i,xt,n)}function Wc(n,i,a){var o=n.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=a;var h=n.baseQueue,p=o.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}i.baseQueue=h=p,o.pending=null}if(p=n.baseState,h===null)n.memoizedState=p;else{i=h.next;var k=w=null,H=null,ne=i,he=!1;do{var ge=ne.lane&-536870913;if(ge!==ne.lane?(st&ge)===ge:(Gr&ge)===ge){var ie=ne.revertLane;if(ie===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),ge===Ls&&(he=!0);else if((Gr&ie)===ie){ne=ne.next,ie===Ls&&(he=!0);continue}else ge={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},H===null?(k=H=ge,w=p):H=H.next=ge,Ke.lanes|=ie,Ai|=ie;ge=ne.action,us&&a(p,ge),p=ne.hasEagerState?ne.eagerState:a(p,ge)}else ie={lane:ge,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},H===null?(k=H=ie,w=p):H=H.next=ie,Ke.lanes|=ge,Ai|=ge;ne=ne.next}while(ne!==null&&ne!==i);if(H===null?w=p:H.next=k,!Pn(p,n.memoizedState)&&(Wt=!0,he&&(a=zs,a!==null)))throw a;n.memoizedState=p,n.baseState=w,n.baseQueue=H,o.lastRenderedState=p}return h===null&&(o.lanes=0),[n.memoizedState,o.dispatch]}function ef(n){var i=Gt(),a=i.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=n;var o=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);Pn(p,i.memoizedState)||(Wt=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,o]}function yp(n,i,a){var o=Ke,h=Gt(),p=lt;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var w=!Pn((xt||h).memoizedState,a);if(w&&(h.memoizedState=a,Wt=!0),h=h.queue,rf(vp.bind(null,o,h,n),[n]),h.getSnapshot!==i||w||Zt!==null&&Zt.memoizedState.tag&1){if(o.flags|=2048,Is(9,{destroy:void 0},xp.bind(null,o,h,a,i),null),Ct===null)throw Error(s(349));p||(Gr&127)!==0||bp(o,i,a)}return a}function bp(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 xp(n,i,a,o){i.value=a,i.getSnapshot=o,wp(i)&&Sp(n)}function vp(n,i,a){return a(function(){wp(i)&&Sp(n)})}function wp(n){var i=n.getSnapshot;n=n.value;try{var a=i();return!Pn(n,a)}catch{return!0}}function Sp(n){var i=es(n,2);i!==null&&Mn(i,n,2)}function tf(n){var i=Sn();if(typeof n=="function"){var a=n;if(n=a(),us){Be(!0);try{a()}finally{Be(!1)}}}return i.memoizedState=i.baseState=n,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jr,lastRenderedState:n},i}function _p(n,i,a,o){return n.baseState=a,Wc(n,xt,typeof o=="function"?o:Jr)}function Gv(n,i,a,o,h){if(No(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)}};q.T!==null?a(!0):p.isTransition=!1,o(p),a=i.pending,a===null?(p.next=i.pending=p,kp(i,p)):(p.next=a.next,i.pending=a.next=p)}}function kp(n,i){var a=i.action,o=i.payload,h=n.state;if(i.isTransition){var p=q.T,w={};q.T=w;try{var k=a(h,o),H=q.S;H!==null&&H(w,k),Ep(n,i,k)}catch(ne){nf(n,i,ne)}finally{p!==null&&w.types!==null&&(p.types=w.types),q.T=p}}else try{p=a(h,o),Ep(n,i,p)}catch(ne){nf(n,i,ne)}}function Ep(n,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){Cp(n,i,o)},function(o){return nf(n,i,o)}):Cp(n,i,a)}function Cp(n,i,a){i.status="fulfilled",i.value=a,Ap(i),n.state=a,i=n.pending,i!==null&&(a=i.next,a===i?n.pending=null:(a=a.next,i.next=a,kp(n,a)))}function nf(n,i,a){var o=n.pending;if(n.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=a,Ap(i),i=i.next;while(i!==o)}n.action=null}function Ap(n){n=n.listeners;for(var i=0;i<n.length;i++)(0,n[i])()}function jp(n,i){return i}function Tp(n,i){if(lt){var a=Ct.formState;if(a!==null){e:{var o=Ke;if(lt){if(Mt){t:{for(var h=Mt,p=lr;h.nodeType!==8;){if(!p){h=null;break t}if(h=ur(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Mt=ur(h.nextSibling),o=h.data==="F!";break e}}bi(o)}o=!1}o&&(i=a[0])}}return a=Sn(),a.memoizedState=a.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jp,lastRenderedState:i},a.queue=o,a=Jp.bind(null,Ke,o),o.dispatch=a,o=tf(!1),p=uf.bind(null,Ke,!1,o.queue),o=Sn(),h={state:i,dispatch:null,action:n,pending:null},o.queue=h,a=Gv.bind(null,Ke,h,p,a),h.dispatch=a,o.memoizedState=n,[i,a,!1]}function Np(n){var i=Gt();return Op(i,xt,n)}function Op(n,i,a){if(i=Wc(n,i,jp)[0],n=Ao(Jr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Ga(i)}catch(w){throw w===Us?yo:w}else o=i;i=Gt();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(Ke.flags|=2048,Is(9,{destroy:void 0},Jv.bind(null,h,a),null)),[o,p,n]}function Jv(n,i){n.action=i}function Rp(n){var i=Gt(),a=xt;if(a!==null)return Op(i,a,n);Gt(),i=i.memoizedState,a=Gt();var o=a.queue.dispatch;return a.memoizedState=n,[i,o,!1]}function Is(n,i,a,o){return n={tag:n,create:a,deps:o,inst:i,next:null},i=Ke.updateQueue,i===null&&(i=Eo(),Ke.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=n.next=n:(o=a.next,a.next=n,n.next=o,i.lastEffect=n),n}function Mp(){return Gt().memoizedState}function jo(n,i,a,o){var h=Sn();Ke.flags|=n,h.memoizedState=Is(1|i,{destroy:void 0},a,o===void 0?null:o)}function To(n,i,a,o){var h=Gt();o=o===void 0?null:o;var p=h.memoizedState.inst;xt!==null&&o!==null&&Gc(o,xt.memoizedState.deps)?h.memoizedState=Is(i,p,a,o):(Ke.flags|=n,h.memoizedState=Is(1|i,p,a,o))}function Dp(n,i){jo(8390656,8,n,i)}function rf(n,i){To(2048,8,n,i)}function Xv(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 Lp(n){var i=Gt().memoizedState;return Xv({ref:i,nextImpl:n}),function(){if((mt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function zp(n,i){return To(4,2,n,i)}function Up(n,i){return To(4,4,n,i)}function Bp(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 Pp(n,i,a){a=a!=null?a.concat([n]):null,To(4,4,Bp.bind(null,i,n),a)}function sf(){}function Hp(n,i){var a=Gt();i=i===void 0?null:i;var o=a.memoizedState;return i!==null&&Gc(i,o[1])?o[0]:(a.memoizedState=[n,i],n)}function qp(n,i){var a=Gt();i=i===void 0?null:i;var o=a.memoizedState;if(i!==null&&Gc(i,o[1]))return o[0];if(o=n(),us){Be(!0);try{n()}finally{Be(!1)}}return a.memoizedState=[o,i],o}function af(n,i,a){return a===void 0||(Gr&1073741824)!==0&&(st&261930)===0?n.memoizedState=i:(n.memoizedState=a,n=Ig(),Ke.lanes|=n,Ai|=n,a)}function Ip(n,i,a,o){return Pn(a,i)?a:Ps.current!==null?(n=af(n,a,o),Pn(n,i)||(Wt=!0),n):(Gr&42)===0||(Gr&1073741824)!==0&&(st&261930)===0?(Wt=!0,n.memoizedState=a):(n=Ig(),Ke.lanes|=n,Ai|=n,i)}function Fp(n,i,a,o,h){var p=Y.p;Y.p=p!==0&&8>p?p:8;var w=q.T,k={};q.T=k,uf(n,!1,i,a);try{var H=h(),ne=q.S;if(ne!==null&&ne(k,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var he=$v(H,o);Ja(n,i,he,Yn(n))}else Ja(n,i,o,Yn(n))}catch(ge){Ja(n,i,{then:function(){},status:"rejected",reason:ge},Yn())}finally{Y.p=p,w!==null&&k.types!==null&&(w.types=k.types),q.T=w}}function Kv(){}function lf(n,i,a,o){if(n.tag!==5)throw Error(s(476));var h=$p(n).queue;Fp(n,h,i,ae,a===null?Kv:function(){return Yp(n),a(o)})}function $p(n){var i=n.memoizedState;if(i!==null)return i;i={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jr,lastRenderedState:ae},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jr,lastRenderedState:a},next:null},n.memoizedState=i,n=n.alternate,n!==null&&(n.memoizedState=i),i}function Yp(n){var i=$p(n);i.next===null&&(i=n.alternate.memoizedState),Ja(n,i.next.queue,{},Yn())}function of(){return hn(fl)}function Vp(){return Gt().memoizedState}function Gp(){return Gt().memoizedState}function Qv(n){for(var i=n.return;i!==null;){switch(i.tag){case 24:case 3:var a=Yn();n=wi(a);var o=Si(i,n,a);o!==null&&(Mn(o,i,a),Fa(o,i,a)),i={cache:zc()},n.payload=i;return}i=i.return}}function Zv(n,i,a){var o=Yn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},No(n)?Xp(i,a):(a=Ec(n,i,a,o),a!==null&&(Mn(a,n,o),Kp(a,i,o)))}function Jp(n,i,a){var o=Yn();Ja(n,i,a,o)}function Ja(n,i,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(No(n))Xp(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,k=p(w,a);if(h.hasEagerState=!0,h.eagerState=k,Pn(k,w))return uo(n,i,h,0),Ct===null&&oo(),!1}catch{}finally{}if(a=Ec(n,i,h,o),a!==null)return Mn(a,n,o),Kp(a,i,o),!0}return!1}function uf(n,i,a,o){if(o={lane:2,revertLane:qf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},No(n)){if(i)throw Error(s(479))}else i=Ec(n,a,o,2),i!==null&&Mn(i,n,2)}function No(n){var i=n.alternate;return n===Ke||i!==null&&i===Ke}function Xp(n,i){Hs=_o=!0;var a=n.pending;a===null?i.next=i:(i.next=a.next,a.next=i),n.pending=i}function Kp(n,i,a){if((a&4194048)!==0){var o=i.lanes;o&=n.pendingLanes,a|=o,i.lanes=a,Ji(n,a)}}var Xa={readContext:hn,use:Co,useCallback:Ft,useContext:Ft,useEffect:Ft,useImperativeHandle:Ft,useLayoutEffect:Ft,useInsertionEffect:Ft,useMemo:Ft,useReducer:Ft,useRef:Ft,useState:Ft,useDebugValue:Ft,useDeferredValue:Ft,useTransition:Ft,useSyncExternalStore:Ft,useId:Ft,useHostTransitionStatus:Ft,useFormState:Ft,useActionState:Ft,useOptimistic:Ft,useMemoCache:Ft,useCacheRefresh:Ft};Xa.useEffectEvent=Ft;var Qp={readContext:hn,use:Co,useCallback:function(n,i){return Sn().memoizedState=[n,i===void 0?null:i],n},useContext:hn,useEffect:Dp,useImperativeHandle:function(n,i,a){a=a!=null?a.concat([n]):null,jo(4194308,4,Bp.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=Sn();i=i===void 0?null:i;var o=n();if(us){Be(!0);try{n()}finally{Be(!1)}}return a.memoizedState=[o,i],o},useReducer:function(n,i,a){var o=Sn();if(a!==void 0){var h=a(i);if(us){Be(!0);try{a(i)}finally{Be(!1)}}}else h=i;return o.memoizedState=o.baseState=h,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:h},o.queue=n,n=n.dispatch=Zv.bind(null,Ke,n),[o.memoizedState,n]},useRef:function(n){var i=Sn();return n={current:n},i.memoizedState=n},useState:function(n){n=tf(n);var i=n.queue,a=Jp.bind(null,Ke,i);return i.dispatch=a,[n.memoizedState,a]},useDebugValue:sf,useDeferredValue:function(n,i){var a=Sn();return af(a,n,i)},useTransition:function(){var n=tf(!1);return n=Fp.bind(null,Ke,n.queue,!0,!1),Sn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,i,a){var o=Ke,h=Sn();if(lt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),Ct===null)throw Error(s(349));(st&127)!==0||bp(o,i,a)}h.memoizedState=a;var p={value:a,getSnapshot:i};return h.queue=p,Dp(vp.bind(null,o,p,n),[n]),o.flags|=2048,Is(9,{destroy:void 0},xp.bind(null,o,p,a,i),null),a},useId:function(){var n=Sn(),i=Ct.identifierPrefix;if(lt){var a=Nr,o=Tr;a=(o&~(1<<32-Oe(o)-1)).toString(32)+a,i="_"+i+"R_"+a,a=ko++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Yv++,i="_"+i+"r_"+a.toString(32)+"_";return n.memoizedState=i},useHostTransitionStatus:of,useFormState:Tp,useActionState:Tp,useOptimistic:function(n){var i=Sn();i.memoizedState=i.baseState=n;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=uf.bind(null,Ke,!0,a),a.dispatch=i,[n,i]},useMemoCache:Zc,useCacheRefresh:function(){return Sn().memoizedState=Qv.bind(null,Ke)},useEffectEvent:function(n){var i=Sn(),a={impl:n};return i.memoizedState=a,function(){if((mt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},cf={readContext:hn,use:Co,useCallback:Hp,useContext:hn,useEffect:rf,useImperativeHandle:Pp,useInsertionEffect:zp,useLayoutEffect:Up,useMemo:qp,useReducer:Ao,useRef:Mp,useState:function(){return Ao(Jr)},useDebugValue:sf,useDeferredValue:function(n,i){var a=Gt();return Ip(a,xt.memoizedState,n,i)},useTransition:function(){var n=Ao(Jr)[0],i=Gt().memoizedState;return[typeof n=="boolean"?n:Ga(n),i]},useSyncExternalStore:yp,useId:Vp,useHostTransitionStatus:of,useFormState:Np,useActionState:Np,useOptimistic:function(n,i){var a=Gt();return _p(a,xt,n,i)},useMemoCache:Zc,useCacheRefresh:Gp};cf.useEffectEvent=Lp;var Zp={readContext:hn,use:Co,useCallback:Hp,useContext:hn,useEffect:rf,useImperativeHandle:Pp,useInsertionEffect:zp,useLayoutEffect:Up,useMemo:qp,useReducer:ef,useRef:Mp,useState:function(){return ef(Jr)},useDebugValue:sf,useDeferredValue:function(n,i){var a=Gt();return xt===null?af(a,n,i):Ip(a,xt.memoizedState,n,i)},useTransition:function(){var n=ef(Jr)[0],i=Gt().memoizedState;return[typeof n=="boolean"?n:Ga(n),i]},useSyncExternalStore:yp,useId:Vp,useHostTransitionStatus:of,useFormState:Rp,useActionState:Rp,useOptimistic:function(n,i){var a=Gt();return xt!==null?_p(a,xt,n,i):(a.baseState=n,[n,a.queue.dispatch])},useMemoCache:Zc,useCacheRefresh:Gp};Zp.useEffectEvent=Lp;function ff(n,i,a,o){i=n.memoizedState,a=a(o,i),a=a==null?i:g({},i,a),n.memoizedState=a,n.lanes===0&&(n.updateQueue.baseState=a)}var hf={enqueueSetState:function(n,i,a){n=n._reactInternals;var o=Yn(),h=wi(o);h.payload=i,a!=null&&(h.callback=a),i=Si(n,h,o),i!==null&&(Mn(i,n,o),Fa(i,n,o))},enqueueReplaceState:function(n,i,a){n=n._reactInternals;var o=Yn(),h=wi(o);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=Si(n,h,o),i!==null&&(Mn(i,n,o),Fa(i,n,o))},enqueueForceUpdate:function(n,i){n=n._reactInternals;var a=Yn(),o=wi(a);o.tag=2,i!=null&&(o.callback=i),i=Si(n,o,a),i!==null&&(Mn(i,n,a),Fa(i,n,a))}};function Wp(n,i,a,o,h,p,w){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(o,p,w):i.prototype&&i.prototype.isPureReactComponent?!La(a,o)||!La(h,p):!0}function eg(n,i,a,o){n=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,o),i.state!==n&&hf.enqueueReplaceState(i,i.state,null)}function cs(n,i){var a=i;if("ref"in i){a={};for(var o in i)o!=="ref"&&(a[o]=i[o])}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 tg(n){lo(n)}function ng(n){console.error(n)}function rg(n){lo(n)}function Oo(n,i){try{var a=n.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function ig(n,i,a){try{var o=n.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function df(n,i,a){return a=wi(a),a.tag=3,a.payload={element:null},a.callback=function(){Oo(n,i)},a}function sg(n){return n=wi(n),n.tag=3,n}function ag(n,i,a,o){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;n.payload=function(){return h(p)},n.callback=function(){ig(i,a,o)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(n.callback=function(){ig(i,a,o),typeof h!="function"&&(ji===null?ji=new Set([this]):ji.add(this));var k=o.stack;this.componentDidCatch(o.value,{componentStack:k!==null?k:""})})}function Wv(n,i,a,o,h){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=a.alternate,i!==null&&Ds(i,a,h,!0),a=qn.current,a!==null){switch(a.tag){case 31:case 13:return or===null?Fo():a.alternate===null&&$t===0&&($t=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===bo?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([o]):i.add(o),Bf(n,o,h)),!1;case 22:return a.flags|=65536,o===bo?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([o]):a.add(o)),Bf(n,o,h)),!1}throw Error(s(435,a.tag))}return Bf(n,o,h),Fo(),!1}if(lt)return i=qn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==Oc&&(n=Error(s(422),{cause:o}),Ba(ir(n,a)))):(o!==Oc&&(i=Error(s(423),{cause:o}),Ba(ir(i,a))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,o=ir(o,a),h=df(n.stateNode,o,h),Ic(n,h),$t!==4&&($t=2)),!1;var p=Error(s(520),{cause:o});if(p=ir(p,a),rl===null?rl=[p]:rl.push(p),$t!==4&&($t=2),i===null)return!0;o=ir(o,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,n=h&-h,a.lanes|=n,n=df(a.stateNode,o,n),Ic(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"&&(ji===null||!ji.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=sg(h),ag(h,n,a,o),Ic(a,h),!1}a=a.return}while(a!==null);return!1}var mf=Error(s(461)),Wt=!1;function dn(n,i,a,o){i.child=n===null?cp(i,null,a,o):os(i,n.child,a,o)}function lg(n,i,a,o,h){a=a.render;var p=i.ref;if("ref"in o){var w={};for(var k in o)k!=="ref"&&(w[k]=o[k])}else w=o;return is(i),o=Jc(n,i,a,w,p,h),k=Xc(),n!==null&&!Wt?(Kc(n,i,h),Xr(n,i,h)):(lt&&k&&Tc(i),i.flags|=1,dn(n,i,o,h),i.child)}function og(n,i,a,o,h){if(n===null){var p=a.type;return typeof p=="function"&&!Cc(p)&&p.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=p,ug(n,i,p,o,h)):(n=fo(a.type,null,o,i,i.mode,h),n.ref=i.ref,n.return=i,i.child=n)}if(p=n.child,!Sf(n,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:La,a(w,o)&&n.ref===i.ref)return Xr(n,i,h)}return i.flags|=1,n=Fr(p,o),n.ref=i.ref,n.return=i,i.child=n}function ug(n,i,a,o,h){if(n!==null){var p=n.memoizedProps;if(La(p,o)&&n.ref===i.ref)if(Wt=!1,i.pendingProps=o=p,Sf(n,h))(n.flags&131072)!==0&&(Wt=!0);else return i.lanes=n.lanes,Xr(n,i,h)}return pf(n,i,a,o,h)}function cg(n,i,a,o){var h=o.children,p=n!==null?n.memoizedState:null;if(n===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((i.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,n!==null){for(o=i.child=n.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,i.child=null;return fg(n,i,p,a,o)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},n!==null&&go(i,p!==null?p.cachePool:null),p!==null?dp(i,p):$c(),mp(i);else return o=i.lanes=536870912,fg(n,i,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(go(i,p.cachePool),dp(i,p),ki(),i.memoizedState=null):(n!==null&&go(i,null),$c(),ki());return dn(n,i,h,a),i.child}function Ka(n,i){return n!==null&&n.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function fg(n,i,a,o,h){var p=Bc();return p=p===null?null:{parent:Qt._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},n!==null&&go(i,null),$c(),mp(i),n!==null&&Ds(n,i,o,!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 hg(n,i,a){return os(i,n.child,null,a),n=Ro(i,i.pendingProps),n.flags|=2,In(i),i.memoizedState=null,n}function ew(n,i,a){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,n===null){if(lt){if(o.mode==="hidden")return n=Ro(i,o),i.lanes=536870912,Ka(null,n);if(Vc(i),(n=Mt)?(n=ky(n,lr),n=n!==null&&n.data==="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:gi!==null?{id:Tr,overflow:Nr}:null,retryLane:536870912,hydrationErrors:null},a=Xm(n),a.return=i,i.child=a,fn=i,Mt=null)):n=null,n===null)throw bi(i);return i.lanes=536870912,null}return Ro(i,o)}var p=n.memoizedState;if(p!==null){var w=p.dehydrated;if(Vc(i),h)if(i.flags&256)i.flags&=-257,i=hg(n,i,a);else if(i.memoizedState!==null)i.child=n.child,i.flags|=128,i=null;else throw Error(s(558));else if(Wt||Ds(n,i,a,!1),h=(a&n.childLanes)!==0,Wt||h){if(o=Ct,o!==null&&(w=mi(o,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,es(n,w),Mn(o,n,w),mf;Fo(),i=hg(n,i,a)}else n=p.treeContext,Mt=ur(w.nextSibling),fn=i,lt=!0,yi=null,lr=!1,n!==null&&Zm(i,n),i=Ro(i,o),i.flags|=4096;return i}return n=Fr(n.child,{mode:o.mode,children:o.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 pf(n,i,a,o,h){return is(i),a=Jc(n,i,a,o,void 0,h),o=Xc(),n!==null&&!Wt?(Kc(n,i,h),Xr(n,i,h)):(lt&&o&&Tc(i),i.flags|=1,dn(n,i,a,h),i.child)}function dg(n,i,a,o,h,p){return is(i),i.updateQueue=null,a=gp(i,o,a,h),pp(n),o=Xc(),n!==null&&!Wt?(Kc(n,i,p),Xr(n,i,p)):(lt&&o&&Tc(i),i.flags|=1,dn(n,i,a,p),i.child)}function mg(n,i,a,o,h){if(is(i),i.stateNode===null){var p=Ns,w=a.contextType;typeof w=="object"&&w!==null&&(p=hn(w)),p=new a(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=hf,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},Hc(i),w=a.contextType,p.context=typeof w=="object"&&w!==null?hn(w):Ns,p.state=i.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(ff(i,a,w,o),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&&hf.enqueueReplaceState(p,p.state,null),Ya(i,o,p,h),$a(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(n===null){p=i.stateNode;var k=i.memoizedProps,H=cs(a,k);p.props=H;var ne=p.context,he=a.contextType;w=Ns,typeof he=="object"&&he!==null&&(w=hn(he));var ge=a.getDerivedStateFromProps;he=typeof ge=="function"||typeof p.getSnapshotBeforeUpdate=="function",k=i.pendingProps!==k,he||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(k||ne!==w)&&eg(i,p,o,w),vi=!1;var ie=i.memoizedState;p.state=ie,Ya(i,o,p,h),$a(),ne=i.memoizedState,k||ie!==ne||vi?(typeof ge=="function"&&(ff(i,a,ge,o),ne=i.memoizedState),(H=vi||Wp(i,a,H,o,ie,ne,w))?(he||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=o,i.memoizedState=ne),p.props=o,p.state=ne,p.context=w,o=H):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,qc(n,i),w=i.memoizedProps,he=cs(a,w),p.props=he,ge=i.pendingProps,ie=p.context,ne=a.contextType,H=Ns,typeof ne=="object"&&ne!==null&&(H=hn(ne)),k=a.getDerivedStateFromProps,(ne=typeof k=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ge||ie!==H)&&eg(i,p,o,H),vi=!1,ie=i.memoizedState,p.state=ie,Ya(i,o,p,h),$a();var le=i.memoizedState;w!==ge||ie!==le||vi||n!==null&&n.dependencies!==null&&mo(n.dependencies)?(typeof k=="function"&&(ff(i,a,k,o),le=i.memoizedState),(he=vi||Wp(i,a,he,o,ie,le,H)||n!==null&&n.dependencies!==null&&mo(n.dependencies))?(ne||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,le,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,le,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=o,i.memoizedState=le),p.props=o,p.state=le,p.context=H,o=he):(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),o=!1)}return p=o,Mo(n,i),o=(i.flags&128)!==0,p||o?(p=i.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,n!==null&&o?(i.child=os(i,n.child,null,h),i.child=os(i,null,a,h)):dn(n,i,a,h),i.memoizedState=p.state,n=i.child):n=Xr(n,i,h),n}function pg(n,i,a,o){return ns(),i.flags|=256,dn(n,i,a,o),i.child}var gf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yf(n){return{baseLanes:n,cachePool:ip()}}function bf(n,i,a){return n=n!==null?n.childLanes&~a:0,i&&(n|=$n),n}function gg(n,i,a){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,w;if((w=p)||(w=n!==null&&n.memoizedState===null?!1:(Vt.current&2)!==0),w&&(h=!0,i.flags&=-129),w=(i.flags&32)!==0,i.flags&=-33,n===null){if(lt){if(h?_i(i):ki(),(n=Mt)?(n=ky(n,lr),n=n!==null&&n.data!=="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:gi!==null?{id:Tr,overflow:Nr}:null,retryLane:536870912,hydrationErrors:null},a=Xm(n),a.return=i,i.child=a,fn=i,Mt=null)):n=null,n===null)throw bi(i);return eh(n)?i.lanes=32:i.lanes=536870912,null}var k=o.children;return o=o.fallback,h?(ki(),h=i.mode,k=Do({mode:"hidden",children:k},h),o=ts(o,h,a,null),k.return=i,o.return=i,k.sibling=o,i.child=k,o=i.child,o.memoizedState=yf(a),o.childLanes=bf(n,w,a),i.memoizedState=gf,Ka(null,o)):(_i(i),xf(i,k))}var H=n.memoizedState;if(H!==null&&(k=H.dehydrated,k!==null)){if(p)i.flags&256?(_i(i),i.flags&=-257,i=vf(n,i,a)):i.memoizedState!==null?(ki(),i.child=n.child,i.flags|=128,i=null):(ki(),k=o.fallback,h=i.mode,o=Do({mode:"visible",children:o.children},h),k=ts(k,h,a,null),k.flags|=2,o.return=i,k.return=i,o.sibling=k,i.child=o,os(i,n.child,null,a),o=i.child,o.memoizedState=yf(a),o.childLanes=bf(n,w,a),i.memoizedState=gf,i=Ka(null,o));else if(_i(i),eh(k)){if(w=k.nextSibling&&k.nextSibling.dataset,w)var ne=w.dgst;w=ne,o=Error(s(419)),o.stack="",o.digest=w,Ba({value:o,source:null,stack:null}),i=vf(n,i,a)}else if(Wt||Ds(n,i,a,!1),w=(a&n.childLanes)!==0,Wt||w){if(w=Ct,w!==null&&(o=mi(w,a),o!==0&&o!==H.retryLane))throw H.retryLane=o,es(n,o),Mn(w,n,o),mf;Wf(k)||Fo(),i=vf(n,i,a)}else Wf(k)?(i.flags|=192,i.child=n.child,i=null):(n=H.treeContext,Mt=ur(k.nextSibling),fn=i,lt=!0,yi=null,lr=!1,n!==null&&Zm(i,n),i=xf(i,o.children),i.flags|=4096);return i}return h?(ki(),k=o.fallback,h=i.mode,H=n.child,ne=H.sibling,o=Fr(H,{mode:"hidden",children:o.children}),o.subtreeFlags=H.subtreeFlags&65011712,ne!==null?k=Fr(ne,k):(k=ts(k,h,a,null),k.flags|=2),k.return=i,o.return=i,o.sibling=k,i.child=o,Ka(null,o),o=i.child,k=n.child.memoizedState,k===null?k=yf(a):(h=k.cachePool,h!==null?(H=Qt._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=ip(),k={baseLanes:k.baseLanes|a,cachePool:h}),o.memoizedState=k,o.childLanes=bf(n,w,a),i.memoizedState=gf,Ka(n.child,o)):(_i(i),a=n.child,n=a.sibling,a=Fr(a,{mode:"visible",children:o.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 xf(n,i){return i=Do({mode:"visible",children:i},n.mode),i.return=n,n.child=i}function Do(n,i){return n=Hn(22,n,null,i),n.lanes=0,n}function vf(n,i,a){return os(i,n.child,null,a),n=xf(i,i.pendingProps.children),n.flags|=2,i.memoizedState=null,n}function yg(n,i,a){n.lanes|=i;var o=n.alternate;o!==null&&(o.lanes|=i),Dc(n.return,i,a)}function wf(n,i,a,o,h,p){var w=n.memoizedState;w===null?n.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=i,w.rendering=null,w.renderingStartTime=0,w.last=o,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function bg(n,i,a){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var w=Vt.current,k=(w&2)!==0;if(k?(w=w&1|2,i.flags|=128):w&=1,_(Vt,w),dn(n,i,o,a),o=lt?Ua:0,!k&&n!==null&&(n.flags&128)!==0)e:for(n=i.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&yg(n,a,i);else if(n.tag===19)yg(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),wf(i,!1,h,a,p,o);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}wf(i,!0,a,null,p,o);break;case"together":wf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Xr(n,i,a){if(n!==null&&(i.dependencies=n.dependencies),Ai|=i.lanes,(a&i.childLanes)===0)if(n!==null){if(Ds(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=Fr(n,n.pendingProps),i.child=a,a.return=i;n.sibling!==null;)n=n.sibling,a=a.sibling=Fr(n,n.pendingProps),a.return=i;a.sibling=null}return i.child}function Sf(n,i){return(n.lanes&i)!==0?!0:(n=n.dependencies,!!(n!==null&&mo(n)))}function tw(n,i,a){switch(i.tag){case 3:Ve(i,i.stateNode.containerInfo),xi(i,Qt,n.memoizedState.cache),ns();break;case 27:case 5:ot(i);break;case 4:Ve(i,i.stateNode.containerInfo);break;case 10:xi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Vc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(_i(i),i.flags|=128,null):(a&i.child.childLanes)!==0?gg(n,i,a):(_i(i),n=Xr(n,i,a),n!==null?n.sibling:null);_i(i);break;case 19:var h=(n.flags&128)!==0;if(o=(a&i.childLanes)!==0,o||(Ds(n,i,a,!1),o=(a&i.childLanes)!==0),h){if(o)return bg(n,i,a);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),_(Vt,Vt.current),o)break;return null;case 22:return i.lanes=0,cg(n,i,a,i.pendingProps);case 24:xi(i,Qt,n.memoizedState.cache)}return Xr(n,i,a)}function xg(n,i,a){if(n!==null)if(n.memoizedProps!==i.pendingProps)Wt=!0;else{if(!Sf(n,a)&&(i.flags&128)===0)return Wt=!1,tw(n,i,a);Wt=(n.flags&131072)!==0}else Wt=!1,lt&&(i.flags&1048576)!==0&&Qm(i,Ua,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(n=as(i.elementType),i.type=n,typeof n=="function")Cc(n)?(o=cs(n,o),i.tag=1,i=mg(null,i,n,o,a)):(i.tag=0,i=pf(null,i,n,o,a));else{if(n!=null){var h=n.$$typeof;if(h===ee){i.tag=11,i=lg(null,i,n,o,a);break e}else if(h===Z){i.tag=14,i=og(null,i,n,o,a);break e}}throw i=ue(n)||n,Error(s(306,i,""))}}return i;case 0:return pf(n,i,i.type,i.pendingProps,a);case 1:return o=i.type,h=cs(o,i.pendingProps),mg(n,i,o,h,a);case 3:e:{if(Ve(i,i.stateNode.containerInfo),n===null)throw Error(s(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,qc(n,i),Ya(i,o,null,a);var w=i.memoizedState;if(o=w.cache,xi(i,Qt,o),o!==p.cache&&Lc(i,[Qt],a,!0),$a(),o=w.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:w.cache},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){i=pg(n,i,o,a);break e}else if(o!==h){h=ir(Error(s(424)),i),Ba(h),i=pg(n,i,o,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(Mt=ur(n.firstChild),fn=i,lt=!0,yi=null,lr=!0,a=cp(i,null,o,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ns(),o===h){i=Xr(n,i,a);break e}dn(n,i,o,a)}i=i.child}return i;case 26:return Mo(n,i),n===null?(a=Ny(i.type,null,i.pendingProps,null))?i.memoizedState=a:lt||(a=i.type,n=i.pendingProps,o=Ko(Se.current).createElement(a),o[Et]=i,o[It]=n,mn(o,a,n),V(o),i.stateNode=o):i.memoizedState=Ny(i.type,n.memoizedProps,i.pendingProps,n.memoizedState),null;case 27:return ot(i),n===null&<&&(o=i.stateNode=Ay(i.type,i.pendingProps,Se.current),fn=i,lr=!0,h=Mt,Ri(i.type)?(th=h,Mt=ur(o.firstChild)):Mt=h),dn(n,i,i.pendingProps.children,a),Mo(n,i),n===null&&(i.flags|=4194304),i.child;case 5:return n===null&<&&((h=o=Mt)&&(o=Ow(o,i.type,i.pendingProps,lr),o!==null?(i.stateNode=o,fn=i,Mt=ur(o.firstChild),lr=!1,h=!0):h=!1),h||bi(i)),ot(i),h=i.type,p=i.pendingProps,w=n!==null?n.memoizedProps:null,o=p.children,Kf(h,p)?o=null:w!==null&&Kf(h,w)&&(i.flags|=32),i.memoizedState!==null&&(h=Jc(n,i,Vv,null,null,a),fl._currentValue=h),Mo(n,i),dn(n,i,o,a),i.child;case 6:return n===null&<&&((n=a=Mt)&&(a=Rw(a,i.pendingProps,lr),a!==null?(i.stateNode=a,fn=i,Mt=null,n=!0):n=!1),n||bi(i)),null;case 13:return gg(n,i,a);case 4:return Ve(i,i.stateNode.containerInfo),o=i.pendingProps,n===null?i.child=os(i,null,o,a):dn(n,i,o,a),i.child;case 11:return lg(n,i,i.type,i.pendingProps,a);case 7:return dn(n,i,i.pendingProps,a),i.child;case 8:return dn(n,i,i.pendingProps.children,a),i.child;case 12:return dn(n,i,i.pendingProps.children,a),i.child;case 10:return o=i.pendingProps,xi(i,i.type,o.value),dn(n,i,o.children,a),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,is(i),h=hn(h),o=o(h),i.flags|=1,dn(n,i,o,a),i.child;case 14:return og(n,i,i.type,i.pendingProps,a);case 15:return ug(n,i,i.type,i.pendingProps,a);case 19:return bg(n,i,a);case 31:return ew(n,i,a);case 22:return cg(n,i,a,i.pendingProps);case 24:return is(i),o=hn(Qt),n===null?(h=Bc(),h===null&&(h=Ct,p=zc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),i.memoizedState={parent:o,cache:h},Hc(i),xi(i,Qt,h)):((n.lanes&a)!==0&&(qc(n,i),Ya(i,null,null,a),$a()),h=n.memoizedState,p=i.memoizedState,h.parent!==o?(h={parent:o,cache:o},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),xi(i,Qt,o)):(o=p.cache,xi(i,Qt,o),o!==h.cache&&Lc(i,[Qt],a,!0))),dn(n,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function Kr(n){n.flags|=4}function _f(n,i,a,o,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(Vg())n.flags|=8192;else throw ls=bo,Pc}else n.flags&=-16777217}function vg(n,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Ly(i))if(Vg())n.flags|=8192;else throw ls=bo,Pc}function Lo(n,i){i!==null&&(n.flags|=4),n.flags&16384&&(i=n.tag!==22?Ht():536870912,n.lanes|=i,Vs|=i)}function Qa(n,i){if(!lt)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 o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?i||n.tail===null?n.tail=null:n.tail.sibling=null:o.sibling=null}}function Dt(n){var i=n.alternate!==null&&n.alternate.child===n.child,a=0,o=0;if(i)for(var h=n.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=n,h=h.sibling;else for(h=n.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=n,h=h.sibling;return n.subtreeFlags|=o,n.childLanes=a,i}function nw(n,i,a){var o=i.pendingProps;switch(Nc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(i),null;case 1:return Dt(i),null;case 3:return a=i.stateNode,o=null,n!==null&&(o=n.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Vr(Qt),Ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(n===null||n.child===null)&&(Ms(i)?Kr(i):n===null||n.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Rc())),Dt(i),null;case 26:var h=i.type,p=i.memoizedState;return n===null?(Kr(i),p!==null?(Dt(i),vg(i,p)):(Dt(i),_f(i,h,null,o,a))):p?p!==n.memoizedState?(Kr(i),Dt(i),vg(i,p)):(Dt(i),i.flags&=-16777217):(n=n.memoizedProps,n!==o&&Kr(i),Dt(i),_f(i,h,n,o,a)),null;case 27:if(kt(i),a=Se.current,h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==o&&Kr(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Dt(i),null}n=ye.current,Ms(i)?Wm(i):(n=Ay(h,o,a),i.stateNode=n,Kr(i))}return Dt(i),null;case 5:if(kt(i),h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==o&&Kr(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Dt(i),null}if(p=ye.current,Ms(i))Wm(i);else{var w=Ko(Se.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 o.is=="string"?w.createElement("select",{is:o.is}):w.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?w.createElement(h,{is:o.is}):w.createElement(h)}}p[Et]=i,p[It]=o;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(mn(p,h,o),h){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Kr(i)}}return Dt(i),_f(i,i.type,n===null?null:n.memoizedProps,i.pendingProps,a),null;case 6:if(n&&i.stateNode!=null)n.memoizedProps!==o&&Kr(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(s(166));if(n=Se.current,Ms(i)){if(n=i.stateNode,a=i.memoizedProps,o=null,h=fn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}n[Et]=i,n=!!(n.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||gy(n.nodeValue,a)),n||bi(i,!0)}else n=Ko(n).createTextNode(o),n[Et]=i,i.stateNode=n}return Dt(i),null;case 31:if(a=i.memoizedState,n===null||n.memoizedState!==null){if(o=Ms(i),a!==null){if(n===null){if(!o)throw Error(s(318));if(n=i.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[Et]=i}else ns(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Dt(i),n=!1}else a=Rc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),n=!0;if(!n)return i.flags&256?(In(i),i):(In(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Dt(i),null;case 13:if(o=i.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=Ms(i),o!==null&&o.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[Et]=i}else ns(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Dt(i),h=!1}else h=Rc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(In(i),i):(In(i),null)}return In(i),(i.flags&128)!==0?(i.lanes=a,i):(a=o!==null,n=n!==null&&n.memoizedState!==null,a&&(o=i.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),a!==n&&a&&(i.child.flags|=8192),Lo(i,i.updateQueue),Dt(i),null);case 4:return Ae(),n===null&&Yf(i.stateNode.containerInfo),Dt(i),null;case 10:return Vr(i.type),Dt(i),null;case 19:if(W(Vt),o=i.memoizedState,o===null)return Dt(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Qa(o,!1);else{if($t!==0||n!==null&&(n.flags&128)!==0)for(n=i.child;n!==null;){if(p=So(n),p!==null){for(i.flags|=128,Qa(o,!1),n=p.updateQueue,i.updateQueue=n,Lo(i,n),i.subtreeFlags=0,n=a,a=i.child;a!==null;)Jm(a,n),a=a.sibling;return _(Vt,Vt.current&1|2),lt&&$r(i,o.treeForkCount),i.child}n=n.sibling}o.tail!==null&&dt()>Ho&&(i.flags|=128,h=!0,Qa(o,!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),Qa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!lt)return Dt(i),null}else 2*dt()-o.renderingStartTime>Ho&&a!==536870912&&(i.flags|=128,h=!0,Qa(o,!1),i.lanes=4194304);o.isBackwards?(p.sibling=i.child,i.child=p):(n=o.last,n!==null?n.sibling=p:i.child=p,o.last=p)}return o.tail!==null?(n=o.tail,o.rendering=n,o.tail=n.sibling,o.renderingStartTime=dt(),n.sibling=null,a=Vt.current,_(Vt,h?a&1|2:a&1),lt&&$r(i,o.treeForkCount),n):(Dt(i),null);case 22:case 23:return In(i),Yc(),o=i.memoizedState!==null,n!==null?n.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(a&536870912)!==0&&(i.flags&128)===0&&(Dt(i),i.subtreeFlags&6&&(i.flags|=8192)):Dt(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),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==a&&(i.flags|=2048),n!==null&&W(ss),null;case 24:return a=null,n!==null&&(a=n.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),Vr(Qt),Dt(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function rw(n,i){switch(Nc(i),i.tag){case 1:return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 3:return Vr(Qt),Ae(),n=i.flags,(n&65536)!==0&&(n&128)===0?(i.flags=n&-65537|128,i):null;case 26:case 27:case 5:return kt(i),null;case 31:if(i.memoizedState!==null){if(In(i),i.alternate===null)throw Error(s(340));ns()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 13:if(In(i),n=i.memoizedState,n!==null&&n.dehydrated!==null){if(i.alternate===null)throw Error(s(340));ns()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 19:return W(Vt),null;case 4:return Ae(),null;case 10:return Vr(i.type),null;case 22:case 23:return In(i),Yc(),n!==null&&W(ss),n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 24:return Vr(Qt),null;case 25:return null;default:return null}}function wg(n,i){switch(Nc(i),i.tag){case 3:Vr(Qt),Ae();break;case 26:case 27:case 5:kt(i);break;case 4:Ae();break;case 31:i.memoizedState!==null&&In(i);break;case 13:In(i);break;case 19:W(Vt);break;case 10:Vr(i.type);break;case 22:case 23:In(i),Yc(),n!==null&&W(ss);break;case 24:Vr(Qt)}}function Za(n,i){try{var a=i.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var h=o.next;a=h;do{if((a.tag&n)===n){o=void 0;var p=a.create,w=a.inst;o=p(),w.destroy=o}a=a.next}while(a!==h)}}catch(k){bt(i,i.return,k)}}function Ei(n,i,a){try{var o=i.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&n)===n){var w=o.inst,k=w.destroy;if(k!==void 0){w.destroy=void 0,h=i;var H=a,ne=k;try{ne()}catch(he){bt(h,H,he)}}}o=o.next}while(o!==p)}}catch(he){bt(i,i.return,he)}}function Sg(n){var i=n.updateQueue;if(i!==null){var a=n.stateNode;try{hp(i,a)}catch(o){bt(n,n.return,o)}}}function _g(n,i,a){a.props=cs(n.type,n.memoizedProps),a.state=n.memoizedState;try{a.componentWillUnmount()}catch(o){bt(n,i,o)}}function Wa(n,i){try{var a=n.ref;if(a!==null){switch(n.tag){case 26:case 27:case 5:var o=n.stateNode;break;case 30:o=n.stateNode;break;default:o=n.stateNode}typeof a=="function"?n.refCleanup=a(o):a.current=o}}catch(h){bt(n,i,h)}}function Or(n,i){var a=n.ref,o=n.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){bt(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){bt(n,i,h)}else a.current=null}function kg(n){var i=n.type,a=n.memoizedProps,o=n.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(h){bt(n,n.return,h)}}function kf(n,i,a){try{var o=n.stateNode;Ew(o,n.type,a,i),o[It]=i}catch(h){bt(n,n.return,h)}}function Eg(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Ri(n.type)||n.tag===4}function Ef(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Eg(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&&Ri(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 Cf(n,i,a){var o=n.tag;if(o===5||o===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=qr));else if(o!==4&&(o===27&&Ri(n.type)&&(a=n.stateNode,i=null),n=n.child,n!==null))for(Cf(n,i,a),n=n.sibling;n!==null;)Cf(n,i,a),n=n.sibling}function zo(n,i,a){var o=n.tag;if(o===5||o===6)n=n.stateNode,i?a.insertBefore(n,i):a.appendChild(n);else if(o!==4&&(o===27&&Ri(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 Cg(n){var i=n.stateNode,a=n.memoizedProps;try{for(var o=n.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);mn(i,o,a),i[Et]=n,i[It]=a}catch(p){bt(n,n.return,p)}}var Qr=!1,en=!1,Af=!1,Ag=typeof WeakSet=="function"?WeakSet:Set,ln=null;function iw(n,i){if(n=n.containerInfo,Jf=ru,n=Pm(n),xc(n)){if("selectionStart"in n)var a={start:n.selectionStart,end:n.selectionEnd};else e:{a=(a=n.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,k=-1,H=-1,ne=0,he=0,ge=n,ie=null;t:for(;;){for(var le;ge!==a||h!==0&&ge.nodeType!==3||(k=w+h),ge!==p||o!==0&&ge.nodeType!==3||(H=w+o),ge.nodeType===3&&(w+=ge.nodeValue.length),(le=ge.firstChild)!==null;)ie=ge,ge=le;for(;;){if(ge===n)break t;if(ie===a&&++ne===h&&(k=w),ie===p&&++he===o&&(H=w),(le=ge.nextSibling)!==null)break;ge=ie,ie=ge.parentNode}ge=le}a=k===-1||H===-1?null:{start:k,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Xf={focusedElem:n,selectionRange:a},ru=!1,ln=i;ln!==null;)if(i=ln,n=i.child,(i.subtreeFlags&1028)!==0&&n!==null)n.return=i,ln=n;else for(;ln!==null;){switch(i=ln,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,o=a.stateNode;try{var ze=cs(a.type,h);n=o.getSnapshotBeforeUpdate(ze,p),o.__reactInternalSnapshotBeforeUpdate=n}catch(Ye){bt(a,a.return,Ye)}}break;case 3:if((n&1024)!==0){if(n=i.stateNode.containerInfo,a=n.nodeType,a===9)Zf(n);else if(a===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Zf(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,ln=n;break}ln=i.return}}function jg(n,i,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:Wr(n,a),o&4&&Za(5,a);break;case 1:if(Wr(n,a),o&4)if(n=a.stateNode,i===null)try{n.componentDidMount()}catch(w){bt(a,a.return,w)}else{var h=cs(a.type,i.memoizedProps);i=i.memoizedState;try{n.componentDidUpdate(h,i,n.__reactInternalSnapshotBeforeUpdate)}catch(w){bt(a,a.return,w)}}o&64&&Sg(a),o&512&&Wa(a,a.return);break;case 3:if(Wr(n,a),o&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{hp(n,i)}catch(w){bt(a,a.return,w)}}break;case 27:i===null&&o&4&&Cg(a);case 26:case 5:Wr(n,a),i===null&&o&4&&kg(a),o&512&&Wa(a,a.return);break;case 12:Wr(n,a);break;case 31:Wr(n,a),o&4&&Og(n,a);break;case 13:Wr(n,a),o&4&&Rg(n,a),o&64&&(n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(a=dw.bind(null,a),Mw(n,a))));break;case 22:if(o=a.memoizedState!==null||Qr,!o){i=i!==null&&i.memoizedState!==null||en,h=Qr;var p=en;Qr=o,(en=i)&&!p?ei(n,a,(a.subtreeFlags&8772)!==0):Wr(n,a),Qr=h,en=p}break;case 30:break;default:Wr(n,a)}}function Tg(n){var i=n.alternate;i!==null&&(n.alternate=null,Tg(i)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(i=n.stateNode,i!==null&&ws(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 zt=null,Tn=!1;function Zr(n,i,a){for(a=a.child;a!==null;)Ng(n,i,a),a=a.sibling}function Ng(n,i,a){if(ke&&typeof ke.onCommitFiberUnmount=="function")try{ke.onCommitFiberUnmount(xe,a)}catch{}switch(a.tag){case 26:en||Or(a,i),Zr(n,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:en||Or(a,i);var o=zt,h=Tn;Ri(a.type)&&(zt=a.stateNode,Tn=!1),Zr(n,i,a),ol(a.stateNode),zt=o,Tn=h;break;case 5:en||Or(a,i);case 6:if(o=zt,h=Tn,zt=null,Zr(n,i,a),zt=o,Tn=h,zt!==null)if(Tn)try{(zt.nodeType===9?zt.body:zt.nodeName==="HTML"?zt.ownerDocument.body:zt).removeChild(a.stateNode)}catch(p){bt(a,i,p)}else try{zt.removeChild(a.stateNode)}catch(p){bt(a,i,p)}break;case 18:zt!==null&&(Tn?(n=zt,Sy(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,a.stateNode),ea(n)):Sy(zt,a.stateNode));break;case 4:o=zt,h=Tn,zt=a.stateNode.containerInfo,Tn=!0,Zr(n,i,a),zt=o,Tn=h;break;case 0:case 11:case 14:case 15:Ei(2,a,i),en||Ei(4,a,i),Zr(n,i,a);break;case 1:en||(Or(a,i),o=a.stateNode,typeof o.componentWillUnmount=="function"&&_g(a,i,o)),Zr(n,i,a);break;case 21:Zr(n,i,a);break;case 22:en=(o=en)||a.memoizedState!==null,Zr(n,i,a),en=o;break;default:Zr(n,i,a)}}function Og(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{ea(n)}catch(a){bt(i,i.return,a)}}}function Rg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{ea(n)}catch(a){bt(i,i.return,a)}}function sw(n){switch(n.tag){case 31:case 13:case 19:var i=n.stateNode;return i===null&&(i=n.stateNode=new Ag),i;case 22:return n=n.stateNode,i=n._retryCache,i===null&&(i=n._retryCache=new Ag),i;default:throw Error(s(435,n.tag))}}function Uo(n,i){var a=sw(n);i.forEach(function(o){if(!a.has(o)){a.add(o);var h=mw.bind(null,n,o);o.then(h,h)}})}function Nn(n,i){var a=i.deletions;if(a!==null)for(var o=0;o<a.length;o++){var h=a[o],p=n,w=i,k=w;e:for(;k!==null;){switch(k.tag){case 27:if(Ri(k.type)){zt=k.stateNode,Tn=!1;break e}break;case 5:zt=k.stateNode,Tn=!1;break e;case 3:case 4:zt=k.stateNode.containerInfo,Tn=!0;break e}k=k.return}if(zt===null)throw Error(s(160));Ng(p,w,h),zt=null,Tn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Mg(i,n),i=i.sibling}var xr=null;function Mg(n,i){var a=n.alternate,o=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Nn(i,n),On(n),o&4&&(Ei(3,n,n.return),Za(3,n),Ei(5,n,n.return));break;case 1:Nn(i,n),On(n),o&512&&(en||a===null||Or(a,a.return)),o&64&&Qr&&(n=n.updateQueue,n!==null&&(o=n.callbacks,o!==null&&(a=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var h=xr;if(Nn(i,n),On(n),o&512&&(en||a===null||Or(a,a.return)),o&4){var p=a!==null?a.memoizedState:null;if(o=n.memoizedState,a===null)if(o===null)if(n.stateNode===null){e:{o=n.type,a=n.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[rn]||p[Et]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),mn(p,o,a),p[Et]=n,V(p),o=p;break e;case"link":var w=My("link","href",h).get(o+(a.href||""));if(w){for(var k=0;k<w.length;k++)if(p=w[k],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(k,1);break t}}p=h.createElement(o),mn(p,o,a),h.head.appendChild(p);break;case"meta":if(w=My("meta","content",h).get(o+(a.content||""))){for(k=0;k<w.length;k++)if(p=w[k],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(k,1);break t}}p=h.createElement(o),mn(p,o,a),h.head.appendChild(p);break;default:throw Error(s(468,o))}p[Et]=n,V(p),o=p}n.stateNode=o}else Dy(h,n.type,n.stateNode);else n.stateNode=Ry(h,o,n.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?Dy(h,n.type,n.stateNode):Ry(h,o,n.memoizedProps)):o===null&&n.stateNode!==null&&kf(n,n.memoizedProps,a.memoizedProps)}break;case 27:Nn(i,n),On(n),o&512&&(en||a===null||Or(a,a.return)),a!==null&&o&4&&kf(n,n.memoizedProps,a.memoizedProps);break;case 5:if(Nn(i,n),On(n),o&512&&(en||a===null||Or(a,a.return)),n.flags&32){h=n.stateNode;try{_s(h,"")}catch(ze){bt(n,n.return,ze)}}o&4&&n.stateNode!=null&&(h=n.memoizedProps,kf(n,h,a!==null?a.memoizedProps:h)),o&1024&&(Af=!0);break;case 6:if(Nn(i,n),On(n),o&4){if(n.stateNode===null)throw Error(s(162));o=n.memoizedProps,a=n.stateNode;try{a.nodeValue=o}catch(ze){bt(n,n.return,ze)}}break;case 3:if(Wo=null,h=xr,xr=Qo(i.containerInfo),Nn(i,n),xr=h,On(n),o&4&&a!==null&&a.memoizedState.isDehydrated)try{ea(i.containerInfo)}catch(ze){bt(n,n.return,ze)}Af&&(Af=!1,Dg(n));break;case 4:o=xr,xr=Qo(n.stateNode.containerInfo),Nn(i,n),On(n),xr=o;break;case 12:Nn(i,n),On(n);break;case 31:Nn(i,n),On(n),o&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,Uo(n,o)));break;case 13:Nn(i,n),On(n),n.child.flags&8192&&n.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Po=dt()),o&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,Uo(n,o)));break;case 22:h=n.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,ne=Qr,he=en;if(Qr=ne||h,en=he||H,Nn(i,n),en=he,Qr=ne,On(n),o&8192)e:for(i=n.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||H||Qr||en||fs(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{k=H.stateNode;var ge=H.memoizedProps.style,ie=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;k.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(ze){bt(H,H.return,ze)}}}else if(i.tag===6){if(a===null){H=i;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(ze){bt(H,H.return,ze)}}}else if(i.tag===18){if(a===null){H=i;try{var le=H.stateNode;h?_y(le,!0):_y(H.stateNode,!1)}catch(ze){bt(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}o&4&&(o=n.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,Uo(n,a))));break;case 19:Nn(i,n),On(n),o&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,Uo(n,o)));break;case 30:break;case 21:break;default:Nn(i,n),On(n)}}function On(n){var i=n.flags;if(i&2){try{for(var a,o=n.return;o!==null;){if(Eg(o)){a=o;break}o=o.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var h=a.stateNode,p=Ef(n);zo(n,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(_s(w,""),a.flags&=-33);var k=Ef(n);zo(n,k,w);break;case 3:case 4:var H=a.stateNode.containerInfo,ne=Ef(n);Cf(n,ne,H);break;default:throw Error(s(161))}}catch(he){bt(n,n.return,he)}n.flags&=-3}i&4096&&(n.flags&=-4097)}function Dg(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var i=n;Dg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),n=n.sibling}}function Wr(n,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)jg(n,i.alternate,i),i=i.sibling}function fs(n){for(n=n.child;n!==null;){var i=n;switch(i.tag){case 0:case 11:case 14:case 15:Ei(4,i,i.return),fs(i);break;case 1:Or(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&_g(i,i.return,a),fs(i);break;case 27:ol(i.stateNode);case 26:case 5:Or(i,i.return),fs(i);break;case 22:i.memoizedState===null&&fs(i);break;case 30:fs(i);break;default:fs(i)}n=n.sibling}}function ei(n,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,h=n,p=i,w=p.flags;switch(p.tag){case 0:case 11:case 15:ei(h,p,a),Za(4,p);break;case 1:if(ei(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ne){bt(o,o.return,ne)}if(o=p,h=o.updateQueue,h!==null){var k=o.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)fp(H[h],k)}catch(ne){bt(o,o.return,ne)}}a&&w&64&&Sg(p),Wa(p,p.return);break;case 27:Cg(p);case 26:case 5:ei(h,p,a),a&&o===null&&w&4&&kg(p),Wa(p,p.return);break;case 12:ei(h,p,a);break;case 31:ei(h,p,a),a&&w&4&&Og(h,p);break;case 13:ei(h,p,a),a&&w&4&&Rg(h,p);break;case 22:p.memoizedState===null&&ei(h,p,a),Wa(p,p.return);break;case 30:break;default:ei(h,p,a)}i=i.sibling}}function jf(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&&Pa(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&&Pa(n))}function vr(n,i,a,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Lg(n,i,a,o),i=i.sibling}function Lg(n,i,a,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:vr(n,i,a,o),h&2048&&Za(9,i);break;case 1:vr(n,i,a,o);break;case 3:vr(n,i,a,o),h&2048&&(n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Pa(n)));break;case 12:if(h&2048){vr(n,i,a,o),n=i.stateNode;try{var p=i.memoizedProps,w=p.id,k=p.onPostCommit;typeof k=="function"&&k(w,i.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(H){bt(i,i.return,H)}}else vr(n,i,a,o);break;case 31:vr(n,i,a,o);break;case 13:vr(n,i,a,o);break;case 23:break;case 22:p=i.stateNode,w=i.alternate,i.memoizedState!==null?p._visibility&2?vr(n,i,a,o):el(n,i):p._visibility&2?vr(n,i,a,o):(p._visibility|=2,Fs(n,i,a,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&jf(w,i);break;case 24:vr(n,i,a,o),h&2048&&Tf(i.alternate,i);break;default:vr(n,i,a,o)}}function Fs(n,i,a,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=n,w=i,k=a,H=o,ne=w.flags;switch(w.tag){case 0:case 11:case 15:Fs(p,w,k,H,h),Za(8,w);break;case 23:break;case 22:var he=w.stateNode;w.memoizedState!==null?he._visibility&2?Fs(p,w,k,H,h):el(p,w):(he._visibility|=2,Fs(p,w,k,H,h)),h&&ne&2048&&jf(w.alternate,w);break;case 24:Fs(p,w,k,H,h),h&&ne&2048&&Tf(w.alternate,w);break;default:Fs(p,w,k,H,h)}i=i.sibling}}function el(n,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=n,o=i,h=o.flags;switch(o.tag){case 22:el(a,o),h&2048&&jf(o.alternate,o);break;case 24:el(a,o),h&2048&&Tf(o.alternate,o);break;default:el(a,o)}i=i.sibling}}var tl=8192;function $s(n,i,a){if(n.subtreeFlags&tl)for(n=n.child;n!==null;)zg(n,i,a),n=n.sibling}function zg(n,i,a){switch(n.tag){case 26:$s(n,i,a),n.flags&tl&&n.memoizedState!==null&&Yw(a,xr,n.memoizedState,n.memoizedProps);break;case 5:$s(n,i,a);break;case 3:case 4:var o=xr;xr=Qo(n.stateNode.containerInfo),$s(n,i,a),xr=o;break;case 22:n.memoizedState===null&&(o=n.alternate,o!==null&&o.memoizedState!==null?(o=tl,tl=16777216,$s(n,i,a),tl=o):$s(n,i,a));break;default:$s(n,i,a)}}function Ug(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 nl(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];ln=o,Pg(o,n)}Ug(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Bg(n),n=n.sibling}function Bg(n){switch(n.tag){case 0:case 11:case 15:nl(n),n.flags&2048&&Ei(9,n,n.return);break;case 3:nl(n);break;case 12:nl(n);break;case 22:var i=n.stateNode;n.memoizedState!==null&&i._visibility&2&&(n.return===null||n.return.tag!==13)?(i._visibility&=-3,Bo(n)):nl(n);break;default:nl(n)}}function Bo(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];ln=o,Pg(o,n)}Ug(n)}for(n=n.child;n!==null;){switch(i=n,i.tag){case 0:case 11:case 15:Ei(8,i,i.return),Bo(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,Bo(i));break;default:Bo(i)}n=n.sibling}}function Pg(n,i){for(;ln!==null;){var a=ln;switch(a.tag){case 0:case 11:case 15:Ei(8,a,i);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Pa(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,ln=o;else e:for(a=n;ln!==null;){o=ln;var h=o.sibling,p=o.return;if(Tg(o),o===a){ln=null;break e}if(h!==null){h.return=p,ln=h;break e}ln=p}}}var aw={getCacheForType:function(n){var i=hn(Qt),a=i.data.get(n);return a===void 0&&(a=n(),i.data.set(n,a)),a},cacheSignal:function(){return hn(Qt).controller.signal}},lw=typeof WeakMap=="function"?WeakMap:Map,mt=0,Ct=null,tt=null,st=0,yt=0,Fn=null,Ci=!1,Ys=!1,Nf=!1,ti=0,$t=0,Ai=0,hs=0,Of=0,$n=0,Vs=0,rl=null,Rn=null,Rf=!1,Po=0,Hg=0,Ho=1/0,qo=null,ji=null,sn=0,Ti=null,Gs=null,ni=0,Mf=0,Df=null,qg=null,il=0,Lf=null;function Yn(){return(mt&2)!==0&&st!==0?st&-st:q.T!==null?qf():Ca()}function Ig(){if($n===0)if((st&536870912)===0||lt){var n=Xe;Xe<<=1,(Xe&3932160)===0&&(Xe=262144),$n=n}else $n=536870912;return n=qn.current,n!==null&&(n.flags|=32),$n}function Mn(n,i,a){(n===Ct&&(yt===2||yt===9)||n.cancelPendingCommit!==null)&&(Js(n,0),Ni(n,st,$n,!1)),gr(n,a),((mt&2)===0||n!==Ct)&&(n===Ct&&((mt&2)===0&&(hs|=a),$t===4&&Ni(n,st,$n,!1)),Rr(n))}function Fg(n,i,a){if((mt&6)!==0)throw Error(s(327));var o=!a&&(i&127)===0&&(i&n.expiredLanes)===0||gn(n,i),h=o?cw(n,i):Uf(n,i,!0),p=o;do{if(h===0){Ys&&!o&&Ni(n,i,0,!1);break}else{if(a=n.current.alternate,p&&!ow(a)){h=Uf(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 k=n;h=rl;var H=k.current.memoizedState.isDehydrated;if(H&&(Js(k,w).flags|=256),w=Uf(k,w,!1),w!==2){if(Nf&&!H){k.errorRecoveryDisabledLanes|=p,hs|=p,h=4;break e}p=Rn,Rn=h,p!==null&&(Rn===null?Rn=p:Rn.push.apply(Rn,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){Js(n,0),Ni(n,i,0,!0);break}e:{switch(o=n,p=h,p){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:Ni(o,i,$n,!Ci);break e;case 2:Rn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=Po+300-dt(),10<h)){if(Ni(o,i,$n,!Ci),Yt(o,0,!0)!==0)break e;ni=i,o.timeoutHandle=vy($g.bind(null,o,a,Rn,qo,Rf,i,$n,hs,Vs,Ci,p,"Throttled",-0,0),h);break e}$g(o,a,Rn,qo,Rf,i,$n,hs,Vs,Ci,p,null,-0,0)}}break}while(!0);Rr(n)}function $g(n,i,a,o,h,p,w,k,H,ne,he,ge,ie,le){if(n.timeoutHandle=-1,ge=i.subtreeFlags,ge&8192||(ge&16785408)===16785408){ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qr},zg(i,p,ge);var ze=(p&62914560)===p?Po-dt():(p&4194048)===p?Hg-dt():0;if(ze=Vw(ge,ze),ze!==null){ni=p,n.cancelPendingCommit=ze(Zg.bind(null,n,i,p,a,o,h,w,k,H,he,ge,null,ie,le)),Ni(n,p,w,!ne);return}}Zg(n,i,p,a,o,h,w,k,H)}function ow(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 o=0;o<a.length;o++){var h=a[o],p=h.getSnapshot;h=h.value;try{if(!Pn(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 Ni(n,i,a,o){i&=~Of,i&=~hs,n.suspendedLanes|=i,n.pingedLanes&=~i,o&&(n.warmLanes|=i),o=n.expirationTimes;for(var h=i;0<h;){var p=31-Oe(h),w=1<<p;o[p]=-1,h&=~w}a!==0&&di(n,a,i)}function Io(){return(mt&6)===0?(sl(0),!1):!0}function zf(){if(tt!==null){if(yt===0)var n=tt.return;else n=tt,Yr=rs=null,Qc(n),Bs=null,qa=0,n=tt;for(;n!==null;)wg(n.alternate,n),n=n.return;tt=null}}function Js(n,i){var a=n.timeoutHandle;a!==-1&&(n.timeoutHandle=-1,jw(a)),a=n.cancelPendingCommit,a!==null&&(n.cancelPendingCommit=null,a()),ni=0,zf(),Ct=n,tt=a=Fr(n.current,null),st=i,yt=0,Fn=null,Ci=!1,Ys=gn(n,i),Nf=!1,Vs=$n=Of=hs=Ai=$t=0,Rn=rl=null,Rf=!1,(i&8)!==0&&(i|=i&32);var o=n.entangledLanes;if(o!==0)for(n=n.entanglements,o&=i;0<o;){var h=31-Oe(o),p=1<<h;i|=n[h],o&=~p}return ti=i,oo(),a}function Yg(n,i){Ke=null,q.H=Xa,i===Us||i===yo?(i=lp(),yt=3):i===Pc?(i=lp(),yt=4):yt=i===mf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Fn=i,tt===null&&($t=1,Oo(n,ir(i,n.current)))}function Vg(){var n=qn.current;return n===null?!0:(st&4194048)===st?or===null:(st&62914560)===st||(st&536870912)!==0?n===or:!1}function Gg(){var n=q.H;return q.H=Xa,n===null?Xa:n}function Jg(){var n=q.A;return q.A=aw,n}function Fo(){$t=4,Ci||(st&4194048)!==st&&qn.current!==null||(Ys=!0),(Ai&134217727)===0&&(hs&134217727)===0||Ct===null||Ni(Ct,st,$n,!1)}function Uf(n,i,a){var o=mt;mt|=2;var h=Gg(),p=Jg();(Ct!==n||st!==i)&&(qo=null,Js(n,i)),i=!1;var w=$t;e:do try{if(yt!==0&&tt!==null){var k=tt,H=Fn;switch(yt){case 8:zf(),w=6;break e;case 3:case 2:case 9:case 6:qn.current===null&&(i=!0);var ne=yt;if(yt=0,Fn=null,Xs(n,k,H,ne),a&&Ys){w=0;break e}break;default:ne=yt,yt=0,Fn=null,Xs(n,k,H,ne)}}uw(),w=$t;break}catch(he){Yg(n,he)}while(!0);return i&&n.shellSuspendCounter++,Yr=rs=null,mt=o,q.H=h,q.A=p,tt===null&&(Ct=null,st=0,oo()),w}function uw(){for(;tt!==null;)Xg(tt)}function cw(n,i){var a=mt;mt|=2;var o=Gg(),h=Jg();Ct!==n||st!==i?(qo=null,Ho=dt()+500,Js(n,i)):Ys=gn(n,i);e:do try{if(yt!==0&&tt!==null){i=tt;var p=Fn;t:switch(yt){case 1:yt=0,Fn=null,Xs(n,i,p,1);break;case 2:case 9:if(sp(p)){yt=0,Fn=null,Kg(i);break}i=function(){yt!==2&&yt!==9||Ct!==n||(yt=7),Rr(n)},p.then(i,i);break e;case 3:yt=7;break e;case 4:yt=5;break e;case 7:sp(p)?(yt=0,Fn=null,Kg(i)):(yt=0,Fn=null,Xs(n,i,p,7));break;case 5:var w=null;switch(tt.tag){case 26:w=tt.memoizedState;case 5:case 27:var k=tt;if(w?Ly(w):k.stateNode.complete){yt=0,Fn=null;var H=k.sibling;if(H!==null)tt=H;else{var ne=k.return;ne!==null?(tt=ne,$o(ne)):tt=null}break t}}yt=0,Fn=null,Xs(n,i,p,5);break;case 6:yt=0,Fn=null,Xs(n,i,p,6);break;case 8:zf(),$t=6;break e;default:throw Error(s(462))}}fw();break}catch(he){Yg(n,he)}while(!0);return Yr=rs=null,q.H=o,q.A=h,mt=a,tt!==null?0:(Ct=null,st=0,oo(),$t)}function fw(){for(;tt!==null&&!pn();)Xg(tt)}function Xg(n){var i=xg(n.alternate,n,ti);n.memoizedProps=n.pendingProps,i===null?$o(n):tt=i}function Kg(n){var i=n,a=i.alternate;switch(i.tag){case 15:case 0:i=dg(a,i,i.pendingProps,i.type,void 0,st);break;case 11:i=dg(a,i,i.pendingProps,i.type.render,i.ref,st);break;case 5:Qc(i);default:wg(a,i),i=tt=Jm(i,ti),i=xg(a,i,ti)}n.memoizedProps=n.pendingProps,i===null?$o(n):tt=i}function Xs(n,i,a,o){Yr=rs=null,Qc(i),Bs=null,qa=0;var h=i.return;try{if(Wv(n,h,i,a,st)){$t=1,Oo(n,ir(a,n.current)),tt=null;return}}catch(p){if(h!==null)throw tt=h,p;$t=1,Oo(n,ir(a,n.current)),tt=null;return}i.flags&32768?(lt||o===1?n=!0:Ys||(st&536870912)!==0?n=!1:(Ci=n=!0,(o===2||o===9||o===3||o===6)&&(o=qn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Qg(i,n)):$o(i)}function $o(n){var i=n;do{if((i.flags&32768)!==0){Qg(i,Ci);return}n=i.return;var a=nw(i.alternate,i,ti);if(a!==null){tt=a;return}if(i=i.sibling,i!==null){tt=i;return}tt=i=n}while(i!==null);$t===0&&($t=5)}function Qg(n,i){do{var a=rw(n.alternate,n);if(a!==null){a.flags&=32767,tt=a;return}if(a=n.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(n=n.sibling,n!==null)){tt=n;return}tt=n=a}while(n!==null);$t=6,tt=null}function Zg(n,i,a,o,h,p,w,k,H){n.cancelPendingCommit=null;do Yo();while(sn!==0);if((mt&6)!==0)throw Error(s(327));if(i!==null){if(i===n.current)throw Error(s(177));if(p=i.lanes|i.childLanes,p|=kc,hi(n,a,p,w,k,H),n===Ct&&(tt=Ct=null,st=0),Gs=i,Ti=n,ni=a,Mf=p,Df=h,qg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,pw(Pe,function(){return ry(),null})):(n.callbackNode=null,n.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=q.T,q.T=null,h=Y.p,Y.p=2,w=mt,mt|=4;try{iw(n,i,a)}finally{mt=w,Y.p=h,q.T=o}}sn=1,Wg(),ey(),ty()}}function Wg(){if(sn===1){sn=0;var n=Ti,i=Gs,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=q.T,q.T=null;var o=Y.p;Y.p=2;var h=mt;mt|=4;try{Mg(i,n);var p=Xf,w=Pm(n.containerInfo),k=p.focusedElem,H=p.selectionRange;if(w!==k&&k&&k.ownerDocument&&Bm(k.ownerDocument.documentElement,k)){if(H!==null&&xc(k)){var ne=H.start,he=H.end;if(he===void 0&&(he=ne),"selectionStart"in k)k.selectionStart=ne,k.selectionEnd=Math.min(he,k.value.length);else{var ge=k.ownerDocument||document,ie=ge&&ge.defaultView||window;if(ie.getSelection){var le=ie.getSelection(),ze=k.textContent.length,Ye=Math.min(H.start,ze),wt=H.end===void 0?Ye:Math.min(H.end,ze);!le.extend&&Ye>wt&&(w=wt,wt=Ye,Ye=w);var K=Um(k,Ye),X=Um(k,wt);if(K&&X&&(le.rangeCount!==1||le.anchorNode!==K.node||le.anchorOffset!==K.offset||le.focusNode!==X.node||le.focusOffset!==X.offset)){var te=ge.createRange();te.setStart(K.node,K.offset),le.removeAllRanges(),Ye>wt?(le.addRange(te),le.extend(X.node,X.offset)):(te.setEnd(X.node,X.offset),le.addRange(te))}}}}for(ge=[],le=k;le=le.parentNode;)le.nodeType===1&&ge.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<ge.length;k++){var de=ge[k];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}ru=!!Jf,Xf=Jf=null}finally{mt=h,Y.p=o,q.T=a}}n.current=i,sn=2}}function ey(){if(sn===2){sn=0;var n=Ti,i=Gs,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=q.T,q.T=null;var o=Y.p;Y.p=2;var h=mt;mt|=4;try{jg(n,i.alternate,i)}finally{mt=h,Y.p=o,q.T=a}}sn=3}}function ty(){if(sn===4||sn===3){sn=0,Un();var n=Ti,i=Gs,a=ni,o=qg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?sn=5:(sn=0,Gs=Ti=null,ny(n,n.pendingLanes));var h=n.pendingLanes;if(h===0&&(ji=null),Xi(a),i=i.stateNode,ke&&typeof ke.onCommitFiberRoot=="function")try{ke.onCommitFiberRoot(xe,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=q.T,h=Y.p,Y.p=2,q.T=null;try{for(var p=n.onRecoverableError,w=0;w<o.length;w++){var k=o[w];p(k.value,{componentStack:k.stack})}}finally{q.T=i,Y.p=h}}(ni&3)!==0&&Yo(),Rr(n),h=n.pendingLanes,(a&261930)!==0&&(h&42)!==0?n===Lf?il++:(il=0,Lf=n):il=0,sl(0)}}function ny(n,i){(n.pooledCacheLanes&=i)===0&&(i=n.pooledCache,i!=null&&(n.pooledCache=null,Pa(i)))}function Yo(){return Wg(),ey(),ty(),ry()}function ry(){if(sn!==5)return!1;var n=Ti,i=Mf;Mf=0;var a=Xi(ni),o=q.T,h=Y.p;try{Y.p=32>a?32:a,q.T=null,a=Df,Df=null;var p=Ti,w=ni;if(sn=0,Gs=Ti=null,ni=0,(mt&6)!==0)throw Error(s(331));var k=mt;if(mt|=4,Bg(p.current),Lg(p,p.current,w,a),mt=k,sl(0,!1),ke&&typeof ke.onPostCommitFiberRoot=="function")try{ke.onPostCommitFiberRoot(xe,p)}catch{}return!0}finally{Y.p=h,q.T=o,ny(n,i)}}function iy(n,i,a){i=ir(a,i),i=df(n.stateNode,i,2),n=Si(n,i,2),n!==null&&(gr(n,2),Rr(n))}function bt(n,i,a){if(n.tag===3)iy(n,n,a);else for(;i!==null;){if(i.tag===3){iy(i,n,a);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(ji===null||!ji.has(o))){n=ir(a,n),a=sg(2),o=Si(i,a,2),o!==null&&(ag(a,o,i,n),gr(o,2),Rr(o));break}}i=i.return}}function Bf(n,i,a){var o=n.pingCache;if(o===null){o=n.pingCache=new lw;var h=new Set;o.set(i,h)}else h=o.get(i),h===void 0&&(h=new Set,o.set(i,h));h.has(a)||(Nf=!0,h.add(a),n=hw.bind(null,n,i,a),i.then(n,n))}function hw(n,i,a){var o=n.pingCache;o!==null&&o.delete(i),n.pingedLanes|=n.suspendedLanes&a,n.warmLanes&=~a,Ct===n&&(st&a)===a&&($t===4||$t===3&&(st&62914560)===st&&300>dt()-Po?(mt&2)===0&&Js(n,0):Of|=a,Vs===st&&(Vs=0)),Rr(n)}function sy(n,i){i===0&&(i=Ht()),n=es(n,i),n!==null&&(gr(n,i),Rr(n))}function dw(n){var i=n.memoizedState,a=0;i!==null&&(a=i.retryLane),sy(n,a)}function mw(n,i){var a=0;switch(n.tag){case 31:case 13:var o=n.stateNode,h=n.memoizedState;h!==null&&(a=h.retryLane);break;case 19:o=n.stateNode;break;case 22:o=n.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(i),sy(n,a)}function pw(n,i){return qt(n,i)}var Vo=null,Ks=null,Pf=!1,Go=!1,Hf=!1,Oi=0;function Rr(n){n!==Ks&&n.next===null&&(Ks===null?Vo=Ks=n:Ks=Ks.next=n),Go=!0,Pf||(Pf=!0,yw())}function sl(n,i){if(!Hf&&Go){Hf=!0;do for(var a=!1,o=Vo;o!==null;){if(n!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var w=o.suspendedLanes,k=o.pingedLanes;p=(1<<31-Oe(42|n)+1)-1,p&=h&~(w&~k),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,uy(o,p))}else p=st,p=Yt(o,o===Ct?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||gn(o,p)||(a=!0,uy(o,p));o=o.next}while(a);Hf=!1}}function gw(){ay()}function ay(){Go=Pf=!1;var n=0;Oi!==0&&Aw()&&(n=Oi);for(var i=dt(),a=null,o=Vo;o!==null;){var h=o.next,p=ly(o,i);p===0?(o.next=null,a===null?Vo=h:a.next=h,h===null&&(Ks=a)):(a=o,(n!==0||(p&3)!==0)&&(Go=!0)),o=h}sn!==0&&sn!==5||sl(n),Oi!==0&&(Oi=0)}function ly(n,i){for(var a=n.suspendedLanes,o=n.pingedLanes,h=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var w=31-Oe(p),k=1<<w,H=h[w];H===-1?((k&a)===0||(k&o)!==0)&&(h[w]=fi(k,i)):H<=i&&(n.expiredLanes|=k),p&=~k}if(i=Ct,a=st,a=Yt(n,n===i?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o=n.callbackNode,a===0||n===i&&(yt===2||yt===9)||n.cancelPendingCommit!==null)return o!==null&&o!==null&&nn(o),n.callbackNode=null,n.callbackPriority=0;if((a&3)===0||gn(n,a)){if(i=a&-a,i===n.callbackPriority)return i;switch(o!==null&&nn(o),Xi(a)){case 2:case 8:a=_e;break;case 32:a=Pe;break;case 268435456:a=it;break;default:a=Pe}return o=oy.bind(null,n),a=qt(a,o),n.callbackPriority=i,n.callbackNode=a,i}return o!==null&&o!==null&&nn(o),n.callbackPriority=2,n.callbackNode=null,2}function oy(n,i){if(sn!==0&&sn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var a=n.callbackNode;if(Yo()&&n.callbackNode!==a)return null;var o=st;return o=Yt(n,n===Ct?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o===0?null:(Fg(n,o,i),ly(n,dt()),n.callbackNode!=null&&n.callbackNode===a?oy.bind(null,n):null)}function uy(n,i){if(Yo())return null;Fg(n,i,!0)}function yw(){Tw(function(){(mt&6)!==0?qt(fe,gw):ay()})}function qf(){if(Oi===0){var n=Ls;n===0&&(n=Ue,Ue<<=1,(Ue&261888)===0&&(Ue=256)),Oi=n}return Oi}function cy(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:eo(""+n)}function fy(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 bw(n,i,a,o,h){if(i==="submit"&&a&&a.stateNode===h){var p=cy((h[It]||null).action),w=o.submitter;w&&(i=(i=w[It]||null)?cy(i.formAction):w.getAttribute("formAction"),i!==null&&(p=i,w=null));var k=new io("action","action",null,o,h);n.push({event:k,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Oi!==0){var H=w?fy(h,w):new FormData(h);lf(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(k.preventDefault(),H=w?fy(h,w):new FormData(h),lf(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var If=0;If<_c.length;If++){var Ff=_c[If],xw=Ff.toLowerCase(),vw=Ff[0].toUpperCase()+Ff.slice(1);br(xw,"on"+vw)}br(Im,"onAnimationEnd"),br(Fm,"onAnimationIteration"),br($m,"onAnimationStart"),br("dblclick","onDoubleClick"),br("focusin","onFocus"),br("focusout","onBlur"),br(zv,"onTransitionRun"),br(Uv,"onTransitionStart"),br(Bv,"onTransitionCancel"),br(Ym,"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 al="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(" "),ww=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(al));function hy(n,i){i=(i&4)!==0;for(var a=0;a<n.length;a++){var o=n[a],h=o.event;o=o.listeners;e:{var p=void 0;if(i)for(var w=o.length-1;0<=w;w--){var k=o[w],H=k.instance,ne=k.currentTarget;if(k=k.listener,H!==p&&h.isPropagationStopped())break e;p=k,h.currentTarget=ne;try{p(h)}catch(he){lo(he)}h.currentTarget=null,p=H}else for(w=0;w<o.length;w++){if(k=o[w],H=k.instance,ne=k.currentTarget,k=k.listener,H!==p&&h.isPropagationStopped())break e;p=k,h.currentTarget=ne;try{p(h)}catch(he){lo(he)}h.currentTarget=null,p=H}}}}function nt(n,i){var a=i[Ki];a===void 0&&(a=i[Ki]=new Set);var o=n+"__bubble";a.has(o)||(dy(i,n,2,!1),a.add(o))}function $f(n,i,a){var o=0;i&&(o|=4),dy(a,n,o,i)}var Jo="_reactListening"+Math.random().toString(36).slice(2);function Yf(n){if(!n[Jo]){n[Jo]=!0,Q.forEach(function(a){a!=="selectionchange"&&(ww.has(a)||$f(a,!1,n),$f(a,!0,n))});var i=n.nodeType===9?n:n.ownerDocument;i===null||i[Jo]||(i[Jo]=!0,$f("selectionchange",!1,i))}}function dy(n,i,a,o){switch(Iy(i)){case 2:var h=Xw;break;case 8:h=Kw;break;default:h=ah}a=h.bind(null,i,a,n),h=void 0,!cc||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?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 Vf(n,i,a,o,h){var p=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var w=o.tag;if(w===3||w===4){var k=o.stateNode.containerInfo;if(k===h)break;if(w===4)for(w=o.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;k!==null;){if(w=E(k),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){o=p=w;continue e}k=k.parentNode}}o=o.return}bm(function(){var ne=p,he=oc(a),ge=[];e:{var ie=Vm.get(n);if(ie!==void 0){var le=io,ze=n;switch(n){case"keypress":if(no(a)===0)break e;case"keydown":case"keyup":le=mv;break;case"focusin":ze="focus",le=mc;break;case"focusout":ze="blur",le=mc;break;case"beforeblur":case"afterblur":le=mc;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":le=wm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=nv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=yv;break;case Im:case Fm:case $m:le=sv;break;case Ym:le=xv;break;case"scroll":case"scrollend":le=ev;break;case"wheel":le=wv;break;case"copy":case"cut":case"paste":le=lv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=_m;break;case"toggle":case"beforetoggle":le=_v}var Ye=(i&4)!==0,wt=!Ye&&(n==="scroll"||n==="scrollend"),K=Ye?ie!==null?ie+"Capture":null:ie;Ye=[];for(var X=ne,te;X!==null;){var de=X;if(te=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||te===null||K===null||(de=ja(X,K),de!=null&&Ye.push(ll(X,de,te))),wt)break;X=X.return}0<Ye.length&&(ie=new le(ie,ze,null,a,he),ge.push({event:ie,listeners:Ye}))}}if((i&7)===0){e:{if(ie=n==="mouseover"||n==="pointerover",le=n==="mouseout"||n==="pointerout",ie&&a!==lc&&(ze=a.relatedTarget||a.fromElement)&&(E(ze)||ze[Bn]))break e;if((le||ie)&&(ie=he.window===he?he:(ie=he.ownerDocument)?ie.defaultView||ie.parentWindow:window,le?(ze=a.relatedTarget||a.toElement,le=ne,ze=ze?E(ze):null,ze!==null&&(wt=u(ze),Ye=ze.tag,ze!==wt||Ye!==5&&Ye!==27&&Ye!==6)&&(ze=null)):(le=null,ze=ne),le!==ze)){if(Ye=wm,de="onMouseLeave",K="onMouseEnter",X="mouse",(n==="pointerout"||n==="pointerover")&&(Ye=_m,de="onPointerLeave",K="onPointerEnter",X="pointer"),wt=le==null?ie:T(le),te=ze==null?ie:T(ze),ie=new Ye(de,X+"leave",le,a,he),ie.target=wt,ie.relatedTarget=te,de=null,E(he)===ne&&(Ye=new Ye(K,X+"enter",ze,a,he),Ye.target=te,Ye.relatedTarget=wt,de=Ye),wt=de,le&&ze)t:{for(Ye=Sw,K=le,X=ze,te=0,de=K;de;de=Ye(de))te++;de=0;for(var Fe=X;Fe;Fe=Ye(Fe))de++;for(;0<te-de;)K=Ye(K),te--;for(;0<de-te;)X=Ye(X),de--;for(;te--;){if(K===X||X!==null&&K===X.alternate){Ye=K;break t}K=Ye(K),X=Ye(X)}Ye=null}else Ye=null;le!==null&&my(ge,ie,le,Ye,!1),ze!==null&&wt!==null&&my(ge,wt,ze,Ye,!0)}}e:{if(ie=ne?T(ne):window,le=ie.nodeName&&ie.nodeName.toLowerCase(),le==="select"||le==="input"&&ie.type==="file")var ft=Om;else if(Tm(ie))if(Rm)ft=Mv;else{ft=Ov;var He=Nv}else le=ie.nodeName,!le||le.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?ne&&ac(ne.elementType)&&(ft=Om):ft=Rv;if(ft&&(ft=ft(n,ne))){Nm(ge,ft,a,he);break e}He&&He(n,ie,ne),n==="focusout"&&ne&&ie.type==="number"&&ne.memoizedProps.value!=null&&sc(ie,"number",ie.value)}switch(He=ne?T(ne):window,n){case"focusin":(Tm(He)||He.contentEditable==="true")&&(As=He,vc=ne,za=null);break;case"focusout":za=vc=As=null;break;case"mousedown":wc=!0;break;case"contextmenu":case"mouseup":case"dragend":wc=!1,Hm(ge,a,he);break;case"selectionchange":if(Lv)break;case"keydown":case"keyup":Hm(ge,a,he)}var Qe;if(gc)e:{switch(n){case"compositionstart":var at="onCompositionStart";break e;case"compositionend":at="onCompositionEnd";break e;case"compositionupdate":at="onCompositionUpdate";break e}at=void 0}else Cs?Am(n,a)&&(at="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(at="onCompositionStart");at&&(km&&a.locale!=="ko"&&(Cs||at!=="onCompositionStart"?at==="onCompositionEnd"&&Cs&&(Qe=xm()):(pi=he,fc="value"in pi?pi.value:pi.textContent,Cs=!0)),He=Xo(ne,at),0<He.length&&(at=new Sm(at,n,null,a,he),ge.push({event:at,listeners:He}),Qe?at.data=Qe:(Qe=jm(a),Qe!==null&&(at.data=Qe)))),(Qe=Ev?Cv(n,a):Av(n,a))&&(at=Xo(ne,"onBeforeInput"),0<at.length&&(He=new Sm("onBeforeInput","beforeinput",null,a,he),ge.push({event:He,listeners:at}),He.data=Qe)),bw(ge,n,ne,a,he)}hy(ge,i)})}function ll(n,i,a){return{instance:n,listener:i,currentTarget:a}}function Xo(n,i){for(var a=i+"Capture",o=[];n!==null;){var h=n,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=ja(n,a),h!=null&&o.unshift(ll(n,h,p)),h=ja(n,i),h!=null&&o.push(ll(n,h,p))),n.tag===3)return o;n=n.return}return[]}function Sw(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function my(n,i,a,o,h){for(var p=i._reactName,w=[];a!==null&&a!==o;){var k=a,H=k.alternate,ne=k.stateNode;if(k=k.tag,H!==null&&H===o)break;k!==5&&k!==26&&k!==27||ne===null||(H=ne,h?(ne=ja(a,p),ne!=null&&w.unshift(ll(a,ne,H))):h||(ne=ja(a,p),ne!=null&&w.push(ll(a,ne,H)))),a=a.return}w.length!==0&&n.push({event:i,listeners:w})}var _w=/\r\n?/g,kw=/\u0000|\uFFFD/g;function py(n){return(typeof n=="string"?n:""+n).replace(_w,`
|
|
49
|
+
`).replace(kw,"")}function gy(n,i){return i=py(i),py(n)===i}function vt(n,i,a,o,h,p){switch(a){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||_s(n,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&_s(n,""+o);break;case"className":yr(n,"class",o);break;case"tabIndex":yr(n,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":yr(n,a,o);break;case"style":gm(n,o,p);break;case"data":if(i!=="object"){yr(n,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||a!=="href")){n.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){n.removeAttribute(a);break}o=eo(""+o),n.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="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"&&vt(n,i,"name",h.name,h,null),vt(n,i,"formEncType",h.formEncType,h,null),vt(n,i,"formMethod",h.formMethod,h,null),vt(n,i,"formTarget",h.formTarget,h,null)):(vt(n,i,"encType",h.encType,h,null),vt(n,i,"method",h.method,h,null),vt(n,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){n.removeAttribute(a);break}o=eo(""+o),n.setAttribute(a,o);break;case"onClick":o!=null&&(n.onclick=qr);break;case"onScroll":o!=null&&nt("scroll",n);break;case"onScrollEnd":o!=null&&nt("scrollend",n);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"multiple":n.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":n.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){n.removeAttribute("xlink:href");break}a=eo(""+o),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":o!=null&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(a,""+o):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":o&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(a,""):n.removeAttribute(a);break;case"capture":case"download":o===!0?n.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(a,o):n.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?n.setAttribute(a,o):n.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?n.removeAttribute(a):n.setAttribute(a,o);break;case"popover":nt("beforetoggle",n),nt("toggle",n),yn(n,"popover",o);break;case"xlinkActuate":Hr(n,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Hr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Hr(n,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Hr(n,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Hr(n,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Hr(n,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Hr(n,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Hr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Hr(n,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":yn(n,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Z1.get(a)||a,yn(n,a,o))}}function Gf(n,i,a,o,h,p){switch(a){case"style":gm(n,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"children":typeof o=="string"?_s(n,o):(typeof o=="number"||typeof o=="bigint")&&_s(n,""+o);break;case"onScroll":o!=null&&nt("scroll",n);break;case"onScrollEnd":o!=null&&nt("scrollend",n);break;case"onClick":o!=null&&(n.onclick=qr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!pe.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[It]||null,p=p!=null?p[a]:null,typeof p=="function"&&n.removeEventListener(i,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(a in n?n[a]=null:n.hasAttribute(a)&&n.removeAttribute(a)),n.addEventListener(i,o,h);break e}a in n?n[a]=o:o===!0?n.setAttribute(a,""):yn(n,a,o)}}}function mn(n,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":nt("error",n),nt("load",n);var o=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:vt(n,i,p,w,a,null)}}h&&vt(n,i,"srcSet",a.srcSet,a,null),o&&vt(n,i,"src",a.src,a,null);return;case"input":nt("invalid",n);var k=p=w=h=null,H=null,ne=null;for(o in a)if(a.hasOwnProperty(o)){var he=a[o];if(he!=null)switch(o){case"name":h=he;break;case"type":w=he;break;case"checked":H=he;break;case"defaultChecked":ne=he;break;case"value":p=he;break;case"defaultValue":k=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(s(137,i));break;default:vt(n,i,o,he,a,null)}}hm(n,p,k,H,ne,w,h,!1);return;case"select":nt("invalid",n),o=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(k=a[h],k!=null))switch(h){case"value":p=k;break;case"defaultValue":w=k;break;case"multiple":o=k;default:vt(n,i,h,k,a,null)}i=p,a=w,n.multiple=!!o,i!=null?Ss(n,!!o,i,!1):a!=null&&Ss(n,!!o,a,!0);return;case"textarea":nt("invalid",n),p=h=o=null;for(w in a)if(a.hasOwnProperty(w)&&(k=a[w],k!=null))switch(w){case"value":o=k;break;case"defaultValue":h=k;break;case"children":p=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(s(91));break;default:vt(n,i,w,k,a,null)}mm(n,o,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"selected":n.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:vt(n,i,H,o,a,null)}return;case"dialog":nt("beforetoggle",n),nt("toggle",n),nt("cancel",n),nt("close",n);break;case"iframe":case"object":nt("load",n);break;case"video":case"audio":for(o=0;o<al.length;o++)nt(al[o],n);break;case"image":nt("error",n),nt("load",n);break;case"details":nt("toggle",n);break;case"embed":case"source":case"link":nt("error",n),nt("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(ne in a)if(a.hasOwnProperty(ne)&&(o=a[ne],o!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:vt(n,i,ne,o,a,null)}return;default:if(ac(i)){for(he in a)a.hasOwnProperty(he)&&(o=a[he],o!==void 0&&Gf(n,i,he,o,a,void 0));return}}for(k in a)a.hasOwnProperty(k)&&(o=a[k],o!=null&&vt(n,i,k,o,a,null))}function Ew(n,i,a,o){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,k=null,H=null,ne=null,he=null;for(le in a){var ge=a[le];if(a.hasOwnProperty(le)&&ge!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":H=ge;default:o.hasOwnProperty(le)||vt(n,i,le,null,o,ge)}}for(var ie in o){var le=o[ie];if(ge=a[ie],o.hasOwnProperty(ie)&&(le!=null||ge!=null))switch(ie){case"type":p=le;break;case"name":h=le;break;case"checked":ne=le;break;case"defaultChecked":he=le;break;case"value":w=le;break;case"defaultValue":k=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(s(137,i));break;default:le!==ge&&vt(n,i,ie,le,o,ge)}}ic(n,w,k,H,ne,he,p,h);return;case"select":le=w=k=ie=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":le=H;default:o.hasOwnProperty(p)||vt(n,i,p,null,o,H)}for(h in o)if(p=o[h],H=a[h],o.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":ie=p;break;case"defaultValue":k=p;break;case"multiple":w=p;default:p!==H&&vt(n,i,h,p,o,H)}i=k,a=w,o=le,ie!=null?Ss(n,!!a,ie,!1):!!o!=!!a&&(i!=null?Ss(n,!!a,i,!0):Ss(n,!!a,a?[]:"",!1));return;case"textarea":le=ie=null;for(k in a)if(h=a[k],a.hasOwnProperty(k)&&h!=null&&!o.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:vt(n,i,k,null,o,h)}for(w in o)if(h=o[w],p=a[w],o.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":ie=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&vt(n,i,w,h,o,p)}dm(n,ie,le);return;case"option":for(var ze in a)if(ie=a[ze],a.hasOwnProperty(ze)&&ie!=null&&!o.hasOwnProperty(ze))switch(ze){case"selected":n.selected=!1;break;default:vt(n,i,ze,null,o,ie)}for(H in o)if(ie=o[H],le=a[H],o.hasOwnProperty(H)&&ie!==le&&(ie!=null||le!=null))switch(H){case"selected":n.selected=ie&&typeof ie!="function"&&typeof ie!="symbol";break;default:vt(n,i,H,ie,o,le)}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 Ye in a)ie=a[Ye],a.hasOwnProperty(Ye)&&ie!=null&&!o.hasOwnProperty(Ye)&&vt(n,i,Ye,null,o,ie);for(ne in o)if(ie=o[ne],le=a[ne],o.hasOwnProperty(ne)&&ie!==le&&(ie!=null||le!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,i));break;default:vt(n,i,ne,ie,o,le)}return;default:if(ac(i)){for(var wt in a)ie=a[wt],a.hasOwnProperty(wt)&&ie!==void 0&&!o.hasOwnProperty(wt)&&Gf(n,i,wt,void 0,o,ie);for(he in o)ie=o[he],le=a[he],!o.hasOwnProperty(he)||ie===le||ie===void 0&&le===void 0||Gf(n,i,he,ie,o,le);return}}for(var K in a)ie=a[K],a.hasOwnProperty(K)&&ie!=null&&!o.hasOwnProperty(K)&&vt(n,i,K,null,o,ie);for(ge in o)ie=o[ge],le=a[ge],!o.hasOwnProperty(ge)||ie===le||ie==null&&le==null||vt(n,i,ge,ie,o,le)}function yy(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Cw(){if(typeof performance.getEntriesByType=="function"){for(var n=0,i=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var h=a[o],p=h.transferSize,w=h.initiatorType,k=h.duration;if(p&&k&&yy(w)){for(w=0,k=h.responseEnd,o+=1;o<a.length;o++){var H=a[o],ne=H.startTime;if(ne>k)break;var he=H.transferSize,ge=H.initiatorType;he&&yy(ge)&&(H=H.responseEnd,w+=he*(H<k?1:(k-ne)/(H-ne)))}if(--o,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 Jf=null,Xf=null;function Ko(n){return n.nodeType===9?n:n.ownerDocument}function by(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 xy(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 Kf(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 Qf=null;function Aw(){var n=window.event;return n&&n.type==="popstate"?n===Qf?!1:(Qf=n,!0):(Qf=null,!1)}var vy=typeof setTimeout=="function"?setTimeout:void 0,jw=typeof clearTimeout=="function"?clearTimeout:void 0,wy=typeof Promise=="function"?Promise:void 0,Tw=typeof queueMicrotask=="function"?queueMicrotask:typeof wy<"u"?function(n){return wy.resolve(null).then(n).catch(Nw)}:vy;function Nw(n){setTimeout(function(){throw n})}function Ri(n){return n==="head"}function Sy(n,i){var a=i,o=0;do{var h=a.nextSibling;if(n.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(o===0){n.removeChild(h),ea(i);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")ol(n.ownerDocument.documentElement);else if(a==="head"){a=n.ownerDocument.head,ol(a);for(var p=a.firstChild;p;){var w=p.nextSibling,k=p.nodeName;p[rn]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&ol(n.ownerDocument.body);a=h}while(a);ea(i)}function _y(n,i){var a=n;n=0;do{var o=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||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(n===0)break;n--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||n++;a=o}while(a)}function Zf(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":Zf(a),ws(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}n.removeChild(a)}}function Ow(n,i,a,o){for(;n.nodeType===1;){var h=a;if(n.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(o){if(!n[rn])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=ur(n.nextSibling),n===null)break}return null}function Rw(n,i,a){if(i==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=ur(n.nextSibling),n===null))return null;return n}function ky(n,i){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=ur(n.nextSibling),n===null))return null;return n}function Wf(n){return n.data==="$?"||n.data==="$~"}function eh(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Mw(n,i){var a=n.ownerDocument;if(n.data==="$~")n._reactRetry=i;else if(n.data!=="$?"||a.readyState!=="loading")i();else{var o=function(){i(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),n._reactRetry=o}}function ur(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 th=null;function Ey(n){n=n.nextSibling;for(var i=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"||a==="/&"){if(i===0)return ur(n.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}n=n.nextSibling}return null}function Cy(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 Ay(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 ol(n){for(var i=n.attributes;i.length;)n.removeAttributeNode(i[0]);ws(n)}var cr=new Map,jy=new Set;function Qo(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var ri=Y.d;Y.d={f:Dw,r:Lw,D:zw,C:Uw,L:Bw,m:Pw,X:qw,S:Hw,M:Iw};function Dw(){var n=ri.f(),i=Io();return n||i}function Lw(n){var i=R(n);i!==null&&i.tag===5&&i.type==="form"?Yp(i):ri.r(n)}var Qs=typeof document>"u"?null:document;function Ty(n,i,a){var o=Qs;if(o&&typeof i=="string"&&i){var h=nr(i);h='link[rel="'+n+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),jy.has(h)||(jy.add(h),n={rel:n,crossOrigin:a,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),mn(i,"link",n),V(i),o.head.appendChild(i)))}}function zw(n){ri.D(n),Ty("dns-prefetch",n,null)}function Uw(n,i){ri.C(n,i),Ty("preconnect",n,i)}function Bw(n,i,a){ri.L(n,i,a);var o=Qs;if(o&&n&&i){var h='link[rel="preload"][as="'+nr(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+nr(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+nr(a.imageSizes)+'"]')):h+='[href="'+nr(n)+'"]';var p=h;switch(i){case"style":p=Zs(n);break;case"script":p=Ws(n)}cr.has(p)||(n=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:n,as:i},a),cr.set(p,n),o.querySelector(h)!==null||i==="style"&&o.querySelector(ul(p))||i==="script"&&o.querySelector(cl(p))||(i=o.createElement("link"),mn(i,"link",n),V(i),o.head.appendChild(i)))}}function Pw(n,i){ri.m(n,i);var a=Qs;if(a&&n){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+nr(o)+'"][href="'+nr(n)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Ws(n)}if(!cr.has(p)&&(n=g({rel:"modulepreload",href:n},i),cr.set(p,n),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(cl(p)))return}o=a.createElement("link"),mn(o,"link",n),V(o),a.head.appendChild(o)}}}function Hw(n,i,a){ri.S(n,i,a);var o=Qs;if(o&&n){var h=U(o).hoistableStyles,p=Zs(n);i=i||"default";var w=h.get(p);if(!w){var k={loading:0,preload:null};if(w=o.querySelector(ul(p)))k.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":i},a),(a=cr.get(p))&&nh(n,a);var H=w=o.createElement("link");V(H),mn(H,"link",n),H._p=new Promise(function(ne,he){H.onload=ne,H.onerror=he}),H.addEventListener("load",function(){k.loading|=1}),H.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Zo(w,i,o)}w={type:"stylesheet",instance:w,count:1,state:k},h.set(p,w)}}}function qw(n,i){ri.X(n,i);var a=Qs;if(a&&n){var o=U(a).hoistableScripts,h=Ws(n),p=o.get(h);p||(p=a.querySelector(cl(h)),p||(n=g({src:n,async:!0},i),(i=cr.get(h))&&rh(n,i),p=a.createElement("script"),V(p),mn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Iw(n,i){ri.M(n,i);var a=Qs;if(a&&n){var o=U(a).hoistableScripts,h=Ws(n),p=o.get(h);p||(p=a.querySelector(cl(h)),p||(n=g({src:n,async:!0,type:"module"},i),(i=cr.get(h))&&rh(n,i),p=a.createElement("script"),V(p),mn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Ny(n,i,a,o){var h=(h=Se.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=Zs(a.href),a=U(h).hoistableStyles,o=a.get(i),o||(o={type:"style",instance:null,count:0,state:null},a.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){n=Zs(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(ul(n)))&&!p._p&&(w.instance=p,w.state.loading=5),cr.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},cr.set(n,a),p||Fw(h,n,a,w.state))),i&&o===null)throw Error(s(528,""));return w}if(i&&o!==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=Ws(a),a=U(h).hoistableScripts,o=a.get(i),o||(o={type:"script",instance:null,count:0,state:null},a.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function Zs(n){return'href="'+nr(n)+'"'}function ul(n){return'link[rel="stylesheet"]['+n+"]"}function Oy(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function Fw(n,i,a,o){n.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=n.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),mn(i,"link",a),V(i),n.head.appendChild(i))}function Ws(n){return'[src="'+nr(n)+'"]'}function cl(n){return"script[async]"+n}function Ry(n,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var o=n.querySelector('style[data-href~="'+nr(a.href)+'"]');if(o)return i.instance=o,V(o),o;var h=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(n.ownerDocument||n).createElement("style"),V(o),mn(o,"style",h),Zo(o,a.precedence,n),i.instance=o;case"stylesheet":h=Zs(a.href);var p=n.querySelector(ul(h));if(p)return i.state.loading|=4,i.instance=p,V(p),p;o=Oy(a),(h=cr.get(h))&&nh(o,h),p=(n.ownerDocument||n).createElement("link"),V(p);var w=p;return w._p=new Promise(function(k,H){w.onload=k,w.onerror=H}),mn(p,"link",o),i.state.loading|=4,Zo(p,a.precedence,n),i.instance=p;case"script":return p=Ws(a.src),(h=n.querySelector(cl(p)))?(i.instance=h,V(h),h):(o=a,(h=cr.get(p))&&(o=g({},a),rh(o,h)),n=n.ownerDocument||n,h=n.createElement("script"),V(h),mn(h,"link",o),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&&(o=i.instance,i.state.loading|=4,Zo(o,a.precedence,n));return i.instance}function Zo(n,i,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,w=0;w<o.length;w++){var k=o[w];if(k.dataset.precedence===i)p=k;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 nh(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.title==null&&(n.title=i.title)}function rh(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 My(n,i,a){if(Wo===null){var o=new Map,h=Wo=new Map;h.set(a,o)}else h=Wo,o=h.get(a),o||(o=new Map,h.set(a,o));if(o.has(n))return o;for(o.set(n,null),a=a.getElementsByTagName(n),h=0;h<a.length;h++){var p=a[h];if(!(p[rn]||p[Et]||n==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(i)||"";w=n+w;var k=o.get(w);k?k.push(p):o.set(w,[p])}}return o}function Dy(n,i,a){n=n.ownerDocument||n,n.head.insertBefore(a,i==="title"?n.querySelector("head > title"):null)}function $w(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 Ly(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function Yw(n,i,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=Zs(o.href),p=i.querySelector(ul(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,V(p);return}p=i.ownerDocument||i,o=Oy(o),(h=cr.get(h))&&nh(o,h),p=p.createElement("link"),V(p);var w=p;w._p=new Promise(function(k,H){w.onload=k,w.onerror=H}),mn(p,"link",o),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 ih=0;function Vw(n,i){return n.stylesheets&&n.count===0&&nu(n,n.stylesheets),0<n.count||0<n.imgCount?function(a){var o=setTimeout(function(){if(n.stylesheets&&nu(n,n.stylesheets),n.unsuspend){var p=n.unsuspend;n.unsuspend=null,p()}},6e4+i);0<n.imgBytes&&ih===0&&(ih=62500*Cw());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>ih?50:800)+i);return n.unsuspend=a,function(){n.unsuspend=null,clearTimeout(o),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(Gw,n),tu=null,eu.call(n))}function Gw(n,i){if(!(i.state.loading&4)){var a=tu.get(n);if(a)var o=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),o=w)}o&&a.set(null,o)}h=i.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||o,p===o&&a.set(null,h),a.set(w,h),this.count++,o=eu.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),p?p.parentNode.insertBefore(h,p.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(h,n.firstChild)),i.state.loading|=4}}var fl={$$typeof:I,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function Jw(n,i,a,o,h,p,w,k,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=pr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pr(0),this.hiddenUpdates=pr(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function zy(n,i,a,o,h,p,w,k,H,ne,he,ge){return n=new Jw(n,i,a,w,H,ne,he,ge,k),i=1,p===!0&&(i|=24),p=Hn(3,null,null,i),n.current=p,p.stateNode=n,i=zc(),i.refCount++,n.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:i},Hc(p),n}function Uy(n){return n?(n=Ns,n):Ns}function By(n,i,a,o,h,p){h=Uy(h),o.context===null?o.context=h:o.pendingContext=h,o=wi(i),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=Si(n,o,i),a!==null&&(Mn(a,n,i),Fa(a,n,i))}function Py(n,i){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<i?a:i}}function sh(n,i){Py(n,i),(n=n.alternate)&&Py(n,i)}function Hy(n){if(n.tag===13||n.tag===31){var i=es(n,67108864);i!==null&&Mn(i,n,67108864),sh(n,67108864)}}function qy(n){if(n.tag===13||n.tag===31){var i=Yn();i=Pr(i);var a=es(n,i);a!==null&&Mn(a,n,i),sh(n,i)}}var ru=!0;function Xw(n,i,a,o){var h=q.T;q.T=null;var p=Y.p;try{Y.p=2,ah(n,i,a,o)}finally{Y.p=p,q.T=h}}function Kw(n,i,a,o){var h=q.T;q.T=null;var p=Y.p;try{Y.p=8,ah(n,i,a,o)}finally{Y.p=p,q.T=h}}function ah(n,i,a,o){if(ru){var h=lh(o);if(h===null)Vf(n,i,o,iu,a),Fy(n,o);else if(Zw(h,n,i,a,o))o.stopPropagation();else if(Fy(n,o),i&4&&-1<Qw.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=Nt(p.pendingLanes);if(w!==0){var k=p;for(k.pendingLanes|=2,k.entangledLanes|=2;w;){var H=1<<31-Oe(w);k.entanglements[1]|=H,w&=~H}Rr(p),(mt&6)===0&&(Ho=dt()+500,sl(0))}}break;case 31:case 13:k=es(p,2),k!==null&&Mn(k,p,2),Io(),sh(p,2)}if(p=lh(o),p===null&&Vf(n,i,o,iu,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else Vf(n,i,o,null,a)}}function lh(n){return n=oc(n),oh(n)}var iu=null;function oh(n){if(iu=null,n=E(n),n!==null){var i=u(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 Iy(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(Xt()){case fe:return 2;case _e:return 8;case Pe:case Je:return 32;case it:return 268435456;default:return 32}default:return 32}}var uh=!1,Mi=null,Di=null,Li=null,hl=new Map,dl=new Map,zi=[],Qw="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 Fy(n,i){switch(n){case"focusin":case"focusout":Mi=null;break;case"dragenter":case"dragleave":Di=null;break;case"mouseover":case"mouseout":Li=null;break;case"pointerover":case"pointerout":hl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":dl.delete(i.pointerId)}}function ml(n,i,a,o,h,p){return n===null||n.nativeEvent!==p?(n={blockedOn:i,domEventName:a,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=R(i),i!==null&&Hy(i)),n):(n.eventSystemFlags|=o,i=n.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),n)}function Zw(n,i,a,o,h){switch(i){case"focusin":return Mi=ml(Mi,n,i,a,o,h),!0;case"dragenter":return Di=ml(Di,n,i,a,o,h),!0;case"mouseover":return Li=ml(Li,n,i,a,o,h),!0;case"pointerover":var p=h.pointerId;return hl.set(p,ml(hl.get(p)||null,n,i,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,dl.set(p,ml(dl.get(p)||null,n,i,a,o,h)),!0}return!1}function $y(n){var i=E(n.target);if(i!==null){var a=u(i);if(a!==null){if(i=a.tag,i===13){if(i=c(a),i!==null){n.blockedOn=i,Kl(n.priority,function(){qy(a)});return}}else if(i===31){if(i=f(a),i!==null){n.blockedOn=i,Kl(n.priority,function(){qy(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=lh(n.nativeEvent);if(a===null){a=n.nativeEvent;var o=new a.constructor(a.type,a);lc=o,a.target.dispatchEvent(o),lc=null}else return i=R(a),i!==null&&Hy(i),n.blockedOn=a,!1;i.shift()}return!0}function Yy(n,i,a){su(n)&&a.delete(i)}function Ww(){uh=!1,Mi!==null&&su(Mi)&&(Mi=null),Di!==null&&su(Di)&&(Di=null),Li!==null&&su(Li)&&(Li=null),hl.forEach(Yy),dl.forEach(Yy)}function au(n,i){n.blockedOn===i&&(n.blockedOn=null,uh||(uh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Ww)))}var lu=null;function Vy(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],o=n[i+1],h=n[i+2];if(typeof o!="function"){if(oh(o||a)===null)continue;break}var p=R(a);p!==null&&(n.splice(i,3),i-=3,lf(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function ea(n){function i(H){return au(H,n)}Mi!==null&&au(Mi,n),Di!==null&&au(Di,n),Li!==null&&au(Li,n),hl.forEach(i),dl.forEach(i);for(var a=0;a<zi.length;a++){var o=zi[a];o.blockedOn===n&&(o.blockedOn=null)}for(;0<zi.length&&(a=zi[0],a.blockedOn===null);)$y(a),a.blockedOn===null&&zi.shift();if(a=(n.ownerDocument||n).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var h=a[o],p=a[o+1],w=h[It]||null;if(typeof p=="function")w||Vy(a);else if(w){var k=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[It]||null)k=w.formAction;else if(oh(h)!==null)continue}else k=w.action;typeof k=="function"?a[o+1]=k:(a.splice(o,3),o-=3),Vy(a)}}}function Gy(){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),o||setTimeout(a,20)}function a(){if(!o&&!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 o=!1,h=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function ch(n){this._internalRoot=n}ou.prototype.render=ch.prototype.render=function(n){var i=this._internalRoot;if(i===null)throw Error(s(409));var a=i.current,o=Yn();By(a,o,n,i,null,null)},ou.prototype.unmount=ch.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var i=n.containerInfo;By(n.current,2,null,n,null,null),Io(),i[Bn]=null}};function ou(n){this._internalRoot=n}ou.prototype.unstable_scheduleHydration=function(n){if(n){var i=Ca();n={blockedOn:null,target:n,priority:i};for(var a=0;a<zi.length&&i!==0&&i<zi[a].priority;a++);zi.splice(a,0,n),a===0&&$y(n)}};var Jy=t.version;if(Jy!=="19.2.4")throw Error(s(527,Jy,"19.2.4"));Y.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?y(n):null,n=n===null?null:n.stateNode,n};var eS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uu.isDisabled&&uu.supportsFiber)try{xe=uu.inject(eS),ke=uu}catch{}}return gl.createRoot=function(n,i){if(!l(n))throw Error(s(299));var a=!1,o="",h=tg,p=ng,w=rg;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),i=zy(n,1,!1,null,null,a,o,null,h,p,w,Gy),n[Bn]=i.current,Yf(n),new ch(i)},gl.hydrateRoot=function(n,i,a){if(!l(n))throw Error(s(299));var o=!1,h="",p=tg,w=ng,k=rg,H=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!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&&(k=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),i=zy(n,1,!0,i,a??null,o,h,H,p,w,k,Gy),i.context=Uy(null),a=i.current,o=Yn(),o=Pr(o),h=wi(o),h.callback=null,Si(a,h,o),a=o,i.current.lanes=a,gr(i,a),Rr(i),n[Bn]=i.current,Yf(n),new ou(i)},gl.version="19.2.4",gl}var i0;function fS(){if(i0)return dh.exports;i0=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(),dh.exports=cS(),dh.exports}var hS=fS();/**
|
|
50
50
|
* react-router v7.13.1
|
|
51
51
|
*
|
|
52
52
|
* Copyright (c) Remix Software Inc.
|
|
@@ -55,22 +55,22 @@ Error generating stack: `+o.message+`
|
|
|
55
55
|
* LICENSE.md file in the root directory of this source tree.
|
|
56
56
|
*
|
|
57
57
|
* @license MIT
|
|
58
|
-
*/var s0="popstate";function a0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function dS(e={}){function t(s,l){var m;let u=(m=l.state)==null?void 0:m.masked,{pathname:c,search:f,hash:d}=u||s.location;return Qh("",{pathname:c,search:f,hash:d},l.state&&l.state.usr||null,l.state&&l.state.key||"default",u?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,l){return typeof l=="string"?l:Ll(l)}return pS(t,r,null,e)}function Pt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Sr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function mS(){return Math.random().toString(36).substring(2,10)}function l0(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 Qh(e,t,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?xa(t):t,state:r,key:t&&t.key||s||mS(),unstable_mask:l}}function Ll({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 xa(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 pS(e,t,r,s={}){let{window:l=document.defaultView,v5Compat:u=!1}=s,c=l.history,f="POP",d=null,m=y();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let O=y(),M=O==null?null:O-m;m=O,d&&d({action:f,location:T.location,delta:M})}function x(O,M){f="PUSH";let B=a0(O)?O:Qh(T.location,O,M);m=y()+1;let I=l0(B,m),ee=T.createHref(B.unstable_mask||B);try{c.pushState(I,"",ee)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;l.location.assign(ee)}u&&d&&d({action:f,location:T.location,delta:1})}function v(O,M){f="REPLACE";let B=a0(O)?O:Qh(T.location,O,M);m=y();let I=l0(B,m),ee=T.createHref(B.unstable_mask||B);c.replaceState(I,"",ee),u&&d&&d({action:f,location:T.location,delta:0})}function S(O){return gS(O)}let T={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(s0,g),d=O,()=>{l.removeEventListener(s0,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 T}function gS(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Pt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Ll(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function Jb(e,t,r="/"){return yS(e,t,r,!1)}function yS(e,t,r,s){let l=typeof t=="string"?xa(t):t,u=ri(l.pathname||"/",r);if(u==null)return null;let c=Xb(e);bS(c);let f=null;for(let d=0;f==null&&d<c.length;++d){let m=jS(u);f=AS(c[d],m,s)}return f}function Xb(e,t=[],r=[],s="",l=!1){let u=(c,f,d=l,m)=>{let y={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(s)&&d)return;Pt(y.relativePath.startsWith(s),`Absolute route path "${y.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(s.length)}let g=Rr([s,y.relativePath]),x=r.concat(y);c.children&&c.children.length>0&&(Pt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Xb(c.children,t,x,g,d)),!(c.path==null&&!c.index)&&t.push({path:g,score:ES(g,c.index),routesMeta:x})};return e.forEach((c,f)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))u(c,f);else for(let m of Kb(c.path))u(c,f,!0,m)}),t}function Kb(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,l=r.endsWith("?"),u=r.replace(/\?$/,"");if(s.length===0)return l?[u,""]:[u];let c=Kb(s.join("/")),f=[];return f.push(...c.map(d=>d===""?u:[u,d].join("/"))),l&&f.push(...c),f.map(d=>e.startsWith("/")&&d===""?"/":d)}function bS(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:CS(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var xS=/^:[\w-]+$/,vS=3,wS=2,SS=1,_S=10,kS=-2,o0=e=>e==="*";function ES(e,t){let r=e.split("/"),s=r.length;return r.some(o0)&&(s+=kS),t&&(s+=wS),r.filter(l=>!o0(l)).reduce((l,u)=>l+(xS.test(u)?vS:u===""?SS:_S),s)}function CS(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 AS(e,t,r=!1){let{routesMeta:s}=e,l={},u="/",c=[];for(let f=0;f<s.length;++f){let d=s[f],m=f===s.length-1,y=u==="/"?t:t.slice(u.length)||"/",g=Au({path:d.relativePath,caseSensitive:d.caseSensitive,end:m},y),x=d.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=Au({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:Rr([u,g.pathname]),pathnameBase:MS(Rr([u,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(u=Rr([u,g.pathnameBase]))}return c}function Au(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=TS(e.path,e.caseSensitive,e.end),l=t.match(r);if(!l)return null;let u=l[0],c=u.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:s.reduce((m,{paramName:y,isOptional:g},x)=>{if(y==="*"){let S=f[x]||"";c=u.slice(0,u.length-S.length).replace(/(.)\/+$/,"$1")}const v=f[x];return g&&!v?m[y]=void 0:m[y]=(v||"").replace(/%2F/g,"/"),m},{}),pathname:u,pathnameBase:c,pattern:e}}function TS(e,t=!1,r=!0){Sr(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,y)=>{if(s.push({paramName:f,isOptional:d!=null}),d){let g=y.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 jS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Sr(!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 ri(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 NS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function OS(e,t="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?xa(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=u0(r.substring(1),"/"):u=u0(r,t)):u=t,{pathname:u,search:DS(s),hash:LS(l)}}function u0(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 yh(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 RS(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Td(e){let t=RS(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function Fu(e,t,r,s=!1){let l;typeof e=="string"?l=xa(e):(l={...e},Pt(!l.pathname||!l.pathname.includes("?"),yh("?","pathname","search",l)),Pt(!l.pathname||!l.pathname.includes("#"),yh("#","pathname","hash",l)),Pt(!l.search||!l.search.includes("#"),yh("#","search","hash",l)));let u=e===""||l.pathname==="",c=u?"/":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=OS(l,f),m=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(m||y)&&(d.pathname+="/"),d}var Rr=e=>e.join("/").replace(/\/\/+/g,"/"),MS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),DS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,LS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,zS=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 US(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function BS(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Qb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Zb(e,t){let r=e;if(typeof r!="string"||!NS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,l=!1;if(Qb)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=ri(c.pathname,t);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{Sr(!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 Wb=["POST","PUT","PATCH","DELETE"];new Set(Wb);var PS=["GET",...Wb];new Set(PS);var va=A.createContext(null);va.displayName="DataRouter";var $u=A.createContext(null);$u.displayName="DataRouterState";var HS=A.createContext(!1),ex=A.createContext({isTransitioning:!1});ex.displayName="ViewTransition";var qS=A.createContext(new Map);qS.displayName="Fetchers";var IS=A.createContext(null);IS.displayName="Await";var Xn=A.createContext(null);Xn.displayName="Navigation";var Fl=A.createContext(null);Fl.displayName="Location";var _r=A.createContext({outlet:null,matches:[],isDataRoute:!1});_r.displayName="Route";var jd=A.createContext(null);jd.displayName="RouteError";var tx="REACT_ROUTER_ERROR",FS="REDIRECT",$S="ROUTE_ERROR_RESPONSE";function YS(e){if(e.startsWith(`${tx}:${FS}:{`))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 VS(e){if(e.startsWith(`${tx}:${$S}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new zS(t.status,t.statusText,t.data)}catch{}}function GS(e,{relative:t}={}){Pt(wa(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=A.useContext(Xn),{hash:l,pathname:u,search:c}=$l(e,{relative:t}),f=u;return r!=="/"&&(f=u==="/"?r:Rr([r,u])),s.createHref({pathname:f,search:c,hash:l})}function wa(){return A.useContext(Fl)!=null}function cr(){return Pt(wa(),"useLocation() may be used only in the context of a <Router> component."),A.useContext(Fl).location}var nx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function rx(e){A.useContext(Xn).static||A.useLayoutEffect(e)}function Mr(){let{isDataRoute:e}=A.useContext(_r);return e?a_():JS()}function JS(){Pt(wa(),"useNavigate() may be used only in the context of a <Router> component.");let e=A.useContext(va),{basename:t,navigator:r}=A.useContext(Xn),{matches:s}=A.useContext(_r),{pathname:l}=cr(),u=JSON.stringify(Td(s)),c=A.useRef(!1);return rx(()=>{c.current=!0}),A.useCallback((d,m={})=>{if(Sr(c.current,nx),!c.current)return;if(typeof d=="number"){r.go(d);return}let y=Fu(d,JSON.parse(u),l,m.relative==="path");e==null&&t!=="/"&&(y.pathname=y.pathname==="/"?t:Rr([t,y.pathname])),(m.replace?r.replace:r.push)(y,m.state,m)},[t,r,u,l,e])}A.createContext(null);function Yu(){let{matches:e}=A.useContext(_r),t=e[e.length-1];return t?t.params:{}}function $l(e,{relative:t}={}){let{matches:r}=A.useContext(_r),{pathname:s}=cr(),l=JSON.stringify(Td(r));return A.useMemo(()=>Fu(e,JSON.parse(l),s,t==="path"),[e,l,s,t])}function XS(e,t){return ix(e,t)}function ix(e,t,r){var O;Pt(wa(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=A.useContext(Xn),{matches:l}=A.useContext(_r),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",d=u?u.pathnameBase:"/",m=u&&u.route;{let M=m&&m.path||"";ax(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 s0="popstate";function a0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function dS(e={}){function t(s,l){var m;let u=(m=l.state)==null?void 0:m.masked,{pathname:c,search:f,hash:d}=u||s.location;return Qh("",{pathname:c,search:f,hash:d},l.state&&l.state.usr||null,l.state&&l.state.key||"default",u?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,l){return typeof l=="string"?l:Ll(l)}return pS(t,r,null,e)}function Pt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Cr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function mS(){return Math.random().toString(36).substring(2,10)}function l0(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 Qh(e,t,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?va(t):t,state:r,key:t&&t.key||s||mS(),unstable_mask:l}}function Ll({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 va(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 pS(e,t,r,s={}){let{window:l=document.defaultView,v5Compat:u=!1}=s,c=l.history,f="POP",d=null,m=y();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let O=y(),M=O==null?null:O-m;m=O,d&&d({action:f,location:j.location,delta:M})}function x(O,M){f="PUSH";let B=a0(O)?O:Qh(j.location,O,M);m=y()+1;let I=l0(B,m),ee=j.createHref(B.unstable_mask||B);try{c.pushState(I,"",ee)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;l.location.assign(ee)}u&&d&&d({action:f,location:j.location,delta:1})}function v(O,M){f="REPLACE";let B=a0(O)?O:Qh(j.location,O,M);m=y();let I=l0(B,m),ee=j.createHref(B.unstable_mask||B);c.replaceState(I,"",ee),u&&d&&d({action:f,location:j.location,delta:0})}function S(O){return gS(O)}let j={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(s0,g),d=O,()=>{l.removeEventListener(s0,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 j}function gS(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Pt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Ll(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function Jb(e,t,r="/"){return yS(e,t,r,!1)}function yS(e,t,r,s){let l=typeof t=="string"?va(t):t,u=li(l.pathname||"/",r);if(u==null)return null;let c=Xb(e);bS(c);let f=null;for(let d=0;f==null&&d<c.length;++d){let m=TS(u);f=AS(c[d],m,s)}return f}function Xb(e,t=[],r=[],s="",l=!1){let u=(c,f,d=l,m)=>{let y={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(s)&&d)return;Pt(y.relativePath.startsWith(s),`Absolute route path "${y.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(s.length)}let g=zr([s,y.relativePath]),x=r.concat(y);c.children&&c.children.length>0&&(Pt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Xb(c.children,t,x,g,d)),!(c.path==null&&!c.index)&&t.push({path:g,score:ES(g,c.index),routesMeta:x})};return e.forEach((c,f)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))u(c,f);else for(let m of Kb(c.path))u(c,f,!0,m)}),t}function Kb(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,l=r.endsWith("?"),u=r.replace(/\?$/,"");if(s.length===0)return l?[u,""]:[u];let c=Kb(s.join("/")),f=[];return f.push(...c.map(d=>d===""?u:[u,d].join("/"))),l&&f.push(...c),f.map(d=>e.startsWith("/")&&d===""?"/":d)}function bS(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:CS(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var xS=/^:[\w-]+$/,vS=3,wS=2,SS=1,_S=10,kS=-2,o0=e=>e==="*";function ES(e,t){let r=e.split("/"),s=r.length;return r.some(o0)&&(s+=kS),t&&(s+=wS),r.filter(l=>!o0(l)).reduce((l,u)=>l+(xS.test(u)?vS:u===""?SS:_S),s)}function CS(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 AS(e,t,r=!1){let{routesMeta:s}=e,l={},u="/",c=[];for(let f=0;f<s.length;++f){let d=s[f],m=f===s.length-1,y=u==="/"?t:t.slice(u.length)||"/",g=Au({path:d.relativePath,caseSensitive:d.caseSensitive,end:m},y),x=d.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=Au({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:zr([u,g.pathname]),pathnameBase:MS(zr([u,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(u=zr([u,g.pathnameBase]))}return c}function Au(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=jS(e.path,e.caseSensitive,e.end),l=t.match(r);if(!l)return null;let u=l[0],c=u.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:s.reduce((m,{paramName:y,isOptional:g},x)=>{if(y==="*"){let S=f[x]||"";c=u.slice(0,u.length-S.length).replace(/(.)\/+$/,"$1")}const v=f[x];return g&&!v?m[y]=void 0:m[y]=(v||"").replace(/%2F/g,"/"),m},{}),pathname:u,pathnameBase:c,pattern:e}}function jS(e,t=!1,r=!0){Cr(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,y)=>{if(s.push({paramName:f,isOptional:d!=null}),d){let g=y.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 TS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Cr(!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 li(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 NS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function OS(e,t="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?va(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=u0(r.substring(1),"/"):u=u0(r,t)):u=t,{pathname:u,search:DS(s),hash:LS(l)}}function u0(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 yh(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 RS(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function jd(e){let t=RS(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function Fu(e,t,r,s=!1){let l;typeof e=="string"?l=va(e):(l={...e},Pt(!l.pathname||!l.pathname.includes("?"),yh("?","pathname","search",l)),Pt(!l.pathname||!l.pathname.includes("#"),yh("#","pathname","hash",l)),Pt(!l.search||!l.search.includes("#"),yh("#","search","hash",l)));let u=e===""||l.pathname==="",c=u?"/":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=OS(l,f),m=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(m||y)&&(d.pathname+="/"),d}var zr=e=>e.join("/").replace(/\/\/+/g,"/"),MS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),DS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,LS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,zS=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 US(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function BS(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Qb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Zb(e,t){let r=e;if(typeof r!="string"||!NS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,l=!1;if(Qb)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=li(c.pathname,t);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{Cr(!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 Wb=["POST","PUT","PATCH","DELETE"];new Set(Wb);var PS=["GET",...Wb];new Set(PS);var wa=A.createContext(null);wa.displayName="DataRouter";var $u=A.createContext(null);$u.displayName="DataRouterState";var HS=A.createContext(!1),ex=A.createContext({isTransitioning:!1});ex.displayName="ViewTransition";var qS=A.createContext(new Map);qS.displayName="Fetchers";var IS=A.createContext(null);IS.displayName="Await";var er=A.createContext(null);er.displayName="Navigation";var Fl=A.createContext(null);Fl.displayName="Location";var Ar=A.createContext({outlet:null,matches:[],isDataRoute:!1});Ar.displayName="Route";var Td=A.createContext(null);Td.displayName="RouteError";var tx="REACT_ROUTER_ERROR",FS="REDIRECT",$S="ROUTE_ERROR_RESPONSE";function YS(e){if(e.startsWith(`${tx}:${FS}:{`))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 VS(e){if(e.startsWith(`${tx}:${$S}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new zS(t.status,t.statusText,t.data)}catch{}}function GS(e,{relative:t}={}){Pt(Sa(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=A.useContext(er),{hash:l,pathname:u,search:c}=$l(e,{relative:t}),f=u;return r!=="/"&&(f=u==="/"?r:zr([r,u])),s.createHref({pathname:f,search:c,hash:l})}function Sa(){return A.useContext(Fl)!=null}function mr(){return Pt(Sa(),"useLocation() may be used only in the context of a <Router> component."),A.useContext(Fl).location}var nx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function rx(e){A.useContext(er).static||A.useLayoutEffect(e)}function Ur(){let{isDataRoute:e}=A.useContext(Ar);return e?a_():JS()}function JS(){Pt(Sa(),"useNavigate() may be used only in the context of a <Router> component.");let e=A.useContext(wa),{basename:t,navigator:r}=A.useContext(er),{matches:s}=A.useContext(Ar),{pathname:l}=mr(),u=JSON.stringify(jd(s)),c=A.useRef(!1);return rx(()=>{c.current=!0}),A.useCallback((d,m={})=>{if(Cr(c.current,nx),!c.current)return;if(typeof d=="number"){r.go(d);return}let y=Fu(d,JSON.parse(u),l,m.relative==="path");e==null&&t!=="/"&&(y.pathname=y.pathname==="/"?t:zr([t,y.pathname])),(m.replace?r.replace:r.push)(y,m.state,m)},[t,r,u,l,e])}A.createContext(null);function Yu(){let{matches:e}=A.useContext(Ar),t=e[e.length-1];return t?t.params:{}}function $l(e,{relative:t}={}){let{matches:r}=A.useContext(Ar),{pathname:s}=mr(),l=JSON.stringify(jd(r));return A.useMemo(()=>Fu(e,JSON.parse(l),s,t==="path"),[e,l,s,t])}function XS(e,t){return ix(e,t)}function ix(e,t,r){var O;Pt(Sa(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=A.useContext(er),{matches:l}=A.useContext(Ar),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",d=u?u.pathnameBase:"/",m=u&&u.route;{let M=m&&m.path||"";ax(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 y=cr(),g;if(t){let M=typeof t=="string"?xa(t):t;Pt(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=y;let x=g.pathname||"/",v=x;if(d!=="/"){let M=d.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(M.length).join("/")}let S=Jb(e,{pathname:v});Sr(m||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Sr(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 T=e_(S&&S.map(M=>Object.assign({},M,{params:Object.assign({},c,M.params),pathname:Rr([d,s.encodeLocation?s.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?d:Rr([d,s.encodeLocation?s.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),l,r);return t&&T?A.createElement(Fl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},T):T}function KS(){let e=s_(),t=US(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},u={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=A.createElement(A.Fragment,null,A.createElement("p",null,"💿 Hey developer 👋"),A.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",A.createElement("code",{style:u},"ErrorBoundary")," or"," ",A.createElement("code",{style:u},"errorElement")," prop on your route.")),A.createElement(A.Fragment,null,A.createElement("h2",null,"Unexpected Application Error!"),A.createElement("h3",{style:{fontStyle:"italic"}},t),r?A.createElement("pre",{style:l},r):null,c)}var QS=A.createElement(KS,null),sx=class extends A.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=VS(e.digest);r&&(e=r)}let t=e!==void 0?A.createElement(_r.Provider,{value:this.props.routeContext},A.createElement(jd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?A.createElement(ZS,{error:e},t):t}};sx.contextType=HS;var bh=new WeakMap;function ZS({children:e,error:t}){let{basename:r}=A.useContext(Xn);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=YS(t.digest);if(s){let l=bh.get(t);if(l)throw l;let u=Zb(s.location,r);if(Qb&&!bh.get(t))if(u.isExternal||s.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:s.replace}));throw bh.set(t,c),c}return A.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function WS({routeContext:e,match:t,children:r}){let s=A.useContext(va);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),A.createElement(_r.Provider,{value:e},r)}function e_(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,u=s==null?void 0:s.errors;if(u!=null){let y=l.findIndex(g=>g.route.id&&(u==null?void 0:u[g.route.id])!==void 0);Pt(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),l=l.slice(0,Math.min(l.length,y+1))}let c=!1,f=-1;if(r&&s){c=s.renderFallback;for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=y),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?(y,g)=>{var x,v;d(y,{location:s.location,params:((v=(x=s.matches)==null?void 0:x[0])==null?void 0:v.params)??{},unstable_pattern:BS(s.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,x)=>{let v,S=!1,T=null,O=null;s&&(v=u&&g.route.id?u[g.route.id]:void 0,T=g.route.errorElement||QS,c&&(f<0&&x===0?(ax("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)),B=()=>{let I;return v?I=T:S?I=O:g.route.Component?I=A.createElement(g.route.Component,null):g.route.element?I=g.route.element:I=y,A.createElement(WS,{match:g,routeContext:{outlet:y,matches:M,isDataRoute:s!=null},children:I})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?A.createElement(sx,{location:s.location,revalidation:s.revalidation,component:T,error:v,children:B(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:m}):B()},null)}function Nd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function t_(e){let t=A.useContext(va);return Pt(t,Nd(e)),t}function n_(e){let t=A.useContext($u);return Pt(t,Nd(e)),t}function r_(e){let t=A.useContext(_r);return Pt(t,Nd(e)),t}function Od(e){let t=r_(e),r=t.matches[t.matches.length-1];return Pt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function i_(){return Od("useRouteId")}function s_(){var s;let e=A.useContext(jd),t=n_("useRouteError"),r=Od("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function a_(){let{router:e}=t_("useNavigate"),t=Od("useNavigate"),r=A.useRef(!1);return rx(()=>{r.current=!0}),A.useCallback(async(l,u={})=>{Sr(r.current,nx),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...u}))},[e,t])}var c0={};function ax(e,t,r){!t&&!c0[e]&&(c0[e]=!0,Sr(!1,r))}A.memo(l_);function l_({routes:e,future:t,state:r,isStatic:s,onError:l}){return ix(e,void 0,{state:r,isStatic:s,onError:l})}function zl({to:e,replace:t,state:r,relative:s}){Pt(wa(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=A.useContext(Xn);Sr(!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:u}=A.useContext(_r),{pathname:c}=cr(),f=Mr(),d=Fu(e,Td(u),c,s==="path"),m=JSON.stringify(d);return A.useEffect(()=>{f(JSON.parse(m),{replace:t,state:r,relative:s})},[f,m,s,t,r]),null}function br(e){Pt(!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 o_({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Pt(!wa(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),d=A.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=xa(r));let{pathname:m="/",search:y="",hash:g="",state:x=null,key:v="default",unstable_mask:S}=r,T=A.useMemo(()=>{let O=ri(m,f);return O==null?null:{location:{pathname:O,search:y,hash:g,state:x,key:v,unstable_mask:S},navigationType:s}},[f,m,y,g,x,v,s,S]);return Sr(T!=null,`<Router basename="${f}"> is not able to match the URL "${m}${y}${g}" because it does not start with the basename, so the <Router> won't render anything.`),T==null?null:A.createElement(Xn.Provider,{value:d},A.createElement(Fl.Provider,{children:t,value:T}))}function lx({children:e,location:t}){return XS(Zh(e),t)}function Zh(e,t=[]){let r=[];return A.Children.forEach(e,(s,l)=>{if(!A.isValidElement(s))return;let u=[...t,l];if(s.type===A.Fragment){r.push.apply(r,Zh(s.props.children,u));return}Pt(s.type===br,`[${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>`),Pt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||u.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=Zh(s.props.children,u)),r.push(c)}),r}var wu="get",Su="application/x-www-form-urlencoded";function Vu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function u_(e){return Vu(e)&&e.tagName.toLowerCase()==="button"}function c_(e){return Vu(e)&&e.tagName.toLowerCase()==="form"}function f_(e){return Vu(e)&&e.tagName.toLowerCase()==="input"}function h_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function d_(e,t){return e.button===0&&(!t||t==="_self")&&!h_(e)}var cu=null;function m_(){if(cu===null)try{new FormData(document.createElement("form"),0),cu=!1}catch{cu=!0}return cu}var p_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function xh(e){return e!=null&&!p_.has(e)?(Sr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Su}"`),null):e}function g_(e,t){let r,s,l,u,c;if(c_(e)){let f=e.getAttribute("action");s=f?ri(f,t):null,r=e.getAttribute("method")||wu,l=xh(e.getAttribute("enctype"))||Su,u=new FormData(e)}else if(u_(e)||f_(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?ri(d,t):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||wu,l=xh(e.getAttribute("formenctype"))||xh(f.getAttribute("enctype"))||Su,u=new FormData(f,e),!m_()){let{name:m,type:y,value:g}=e;if(y==="image"){let x=m?`${m}.`:"";u.append(`${x}x`,"0"),u.append(`${x}y`,"0")}else m&&u.append(m,g)}}else{if(Vu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=wu,s=null,l=Su,c=e}return u&&l==="text/plain"&&(c=u,u=void 0),{action:s,method:r.toLowerCase(),encType:l,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Rd(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function y_(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&&ri(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function b_(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 x_(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 v_(e,t,r){let s=await Promise.all(e.map(async l=>{let u=t.routes[l.route.id];if(u){let c=await b_(u,r);return c.links?c.links():[]}return[]}));return k_(s.flat(1).filter(x_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function f0(e,t,r,s,l,u){let c=(d,m)=>r[m]?d.route.id!==r[m].route.id:!0,f=(d,m)=>{var y;return r[m].pathname!==d.pathname||((y=r[m].route.path)==null?void 0:y.endsWith("*"))&&r[m].params["*"]!==d.params["*"]};return u==="assets"?t.filter((d,m)=>c(d,m)||f(d,m)):u==="data"?t.filter((d,m)=>{var g;let y=s.routes[d.route.id];if(!y||!y.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 w_(e,t,{includeHydrateFallback:r}={}){return S_(e.map(s=>{let l=t.routes[s.route.id];if(!l)return[];let u=[l.module];return l.clientActionModule&&(u=u.concat(l.clientActionModule)),l.clientLoaderModule&&(u=u.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(u=u.concat(l.hydrateFallbackModule)),l.imports&&(u=u.concat(l.imports)),u}).flat(1))}function S_(e){return[...new Set(e)]}function __(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function k_(e,t){let r=new Set;return new Set(t),e.reduce((s,l)=>{let u=JSON.stringify(__(l));return r.has(u)||(r.add(u),s.push({key:u,link:l})),s},[])}function ox(){let e=A.useContext(va);return Rd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function E_(){let e=A.useContext($u);return Rd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Md=A.createContext(void 0);Md.displayName="FrameworkContext";function ux(){let e=A.useContext(Md);return Rd(e,"You must render this element inside a <HydratedRouter> element"),e}function C_(e,t){let r=A.useContext(Md),[s,l]=A.useState(!1),[u,c]=A.useState(!1),{onFocus:f,onBlur:d,onMouseEnter:m,onMouseLeave:y,onTouchStart:g}=t,x=A.useRef(null);A.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let T=M=>{M.forEach(B=>{c(B.isIntersecting)})},O=new IntersectionObserver(T,{threshold:.5});return x.current&&O.observe(x.current),()=>{O.disconnect()}}},[e]),A.useEffect(()=>{if(s){let T=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(T)}}},[s]);let v=()=>{l(!0)},S=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,x,{}]:[u,x,{onFocus:yl(f,v),onBlur:yl(d,S),onMouseEnter:yl(m,v),onMouseLeave:yl(y,S),onTouchStart:yl(g,v)}]:[!1,x,{}]}function yl(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function A_({page:e,...t}){let{router:r}=ox(),s=A.useMemo(()=>Jb(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?A.createElement(j_,{page:e,matches:s,...t}):null}function T_(e){let{manifest:t,routeModules:r}=ux(),[s,l]=A.useState([]);return A.useEffect(()=>{let u=!1;return v_(e,t,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,t,r]),s}function j_({page:e,matches:t,...r}){let s=cr(),{future:l,manifest:u,routeModules:c}=ux(),{basename:f}=ox(),{loaderData:d,matches:m}=E_(),y=A.useMemo(()=>f0(e,t,m,u,s,"data"),[e,t,m,u,s]),g=A.useMemo(()=>f0(e,t,m,u,s,"assets"),[e,t,m,u,s]),x=A.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let T=new Set,O=!1;if(t.forEach(B=>{var ee;let I=u.routes[B.route.id];!I||!I.hasLoader||(!y.some(P=>P.route.id===B.route.id)&&B.route.id in d&&((ee=c[B.route.id])!=null&&ee.shouldRevalidate)||I.hasClientLoader?O=!0:T.add(B.route.id))}),T.size===0)return[];let M=y_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return O&&T.size>0&&M.searchParams.set("_routes",t.filter(B=>T.has(B.route.id)).map(B=>B.route.id).join(",")),[M.pathname+M.search]},[f,l.unstable_trailingSlashAwareDataRequests,d,s,u,y,t,e,c]),v=A.useMemo(()=>w_(g,u),[g,u]),S=T_(g);return A.createElement(A.Fragment,null,x.map(T=>A.createElement("link",{key:T,rel:"prefetch",as:"fetch",href:T,...r})),v.map(T=>A.createElement("link",{key:T,rel:"modulepreload",href:T,...r})),S.map(({key:T,link:O})=>A.createElement("link",{key:T,nonce:r.nonce,...O,crossOrigin:O.crossOrigin??r.crossOrigin})))}function N_(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var O_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{O_&&(window.__reactRouterVersion="7.13.1")}catch{}function R_({basename:e,children:t,unstable_useTransitions:r,window:s}){let l=A.useRef();l.current==null&&(l.current=dS({window:s,v5Compat:!0}));let u=l.current,[c,f]=A.useState({action:u.action,location:u.location}),d=A.useCallback(m=>{r===!1?f(m):A.startTransition(()=>f(m))},[r]);return A.useLayoutEffect(()=>u.listen(d),[u,d]),A.createElement(o_,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var cx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fx=A.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:d,target:m,to:y,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:v,...S},T){let{basename:O,navigator:M,unstable_useTransitions:B}=A.useContext(Xn),I=typeof y=="string"&&cx.test(y),ee=Zb(y,O);y=ee.to;let P=GS(y,{relative:l}),D=cr(),Z=null;if(f){let re=Fu(f,[],D.unstable_mask?D.unstable_mask.pathname:"/",!0);O!=="/"&&(re.pathname=re.pathname==="/"?O:Rr([O,re.pathname])),Z=M.createHref(re)}let[F,$,L]=C_(s,S),J=z_(y,{replace:c,unstable_mask:f,state:d,target:m,preventScrollReset:g,relative:l,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:B});function G(re){t&&t(re),re.defaultPrevented||J(re)}let ue=!(ee.isExternal||u),oe=A.createElement("a",{...S,...L,href:(ue?Z:void 0)||ee.absoluteURL||P,onClick:ue?G:t,ref:N_(T,$),target:m,"data-discover":!I&&r==="render"?"true":void 0});return F&&!I?A.createElement(A.Fragment,null,oe,A.createElement(A_,{page:P})):oe});fx.displayName="Link";var M_=A.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:l=!1,style:u,to:c,viewTransition:f,children:d,...m},y){let g=$l(c,{relative:m.relative}),x=cr(),v=A.useContext($u),{navigator:S,basename:T}=A.useContext(Xn),O=v!=null&&q_(g)&&f===!0,M=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,B=x.pathname,I=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(B=B.toLowerCase(),I=I?I.toLowerCase():null,M=M.toLowerCase()),I&&T&&(I=ri(I,T)||I);const ee=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let P=B===M||!l&&B.startsWith(M)&&B.charAt(ee)==="/",D=I!=null&&(I===M||!l&&I.startsWith(M)&&I.charAt(M.length)==="/"),Z={isActive:P,isPending:D,isTransitioning:O},F=P?t:void 0,$;typeof s=="function"?$=s(Z):$=[s,P?"active":null,D?"pending":null,O?"transitioning":null].filter(Boolean).join(" ");let L=typeof u=="function"?u(Z):u;return A.createElement(fx,{...m,"aria-current":F,className:$,ref:y,style:L,to:c,viewTransition:f},typeof d=="function"?d(Z):d)});M_.displayName="NavLink";var D_=A.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:l,state:u,method:c=wu,action:f,onSubmit:d,relative:m,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},S)=>{let{unstable_useTransitions:T}=A.useContext(Xn),O=P_(),M=H_(f,{relative:m}),B=c.toLowerCase()==="get"?"get":"post",I=typeof f=="string"&&cx.test(f),ee=P=>{if(d&&d(P),P.defaultPrevented)return;P.preventDefault();let D=P.nativeEvent.submitter,Z=(D==null?void 0:D.getAttribute("formmethod"))||c,F=()=>O(D||P.currentTarget,{fetcherKey:t,method:Z,navigate:r,replace:l,state:u,relative:m,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x});T&&r!==!1?A.startTransition(()=>F()):F()};return A.createElement("form",{ref:S,method:B,action:M,onSubmit:s?d:ee,...v,"data-discover":!I&&e==="render"?"true":void 0})});D_.displayName="Form";function L_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hx(e){let t=A.useContext(va);return Pt(t,L_(e)),t}function z_(e,{target:t,replace:r,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d,unstable_useTransitions:m}={}){let y=Mr(),g=cr(),x=$l(e,{relative:c});return A.useCallback(v=>{if(d_(v,t)){v.preventDefault();let S=r!==void 0?r:Ll(g)===Ll(x),T=()=>y(e,{replace:S,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d});m?A.startTransition(()=>T()):T()}},[g,y,x,r,s,l,t,e,u,c,f,d,m])}var U_=0,B_=()=>`__${String(++U_)}__`;function P_(){let{router:e}=hx("useSubmit"),{basename:t}=A.useContext(Xn),r=i_(),s=e.fetch,l=e.navigate;return A.useCallback(async(u,c={})=>{let{action:f,method:d,encType:m,formData:y,body:g}=g_(u,t);if(c.navigate===!1){let x=c.fetcherKey||B_();await s(x,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,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:y,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 H_(e,{relative:t}={}){let{basename:r}=A.useContext(Xn),s=A.useContext(_r);Pt(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),u={...$l(e||".",{relative:t})},c=cr();if(e==null){u.search=c.search;let f=new URLSearchParams(u.search),d=f.getAll("index");if(d.some(y=>y==="")){f.delete("index"),d.filter(g=>g).forEach(g=>f.append("index",g));let y=f.toString();u.search=y?`?${y}`:""}}return(!e||e===".")&&l.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:Rr([r,u.pathname])),Ll(u)}function q_(e,{relative:t}={}){let r=A.useContext(ex);Pt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=hx("useViewTransitionState"),l=$l(e,{relative:t});if(!r.isTransitioning)return!1;let u=ri(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=ri(r.nextLocation.pathname,s)||r.nextLocation.pathname;return Au(l.pathname,c)!=null||Au(l.pathname,u)!=null}var ds=Gb();const dx=A.createContext(null),mx="palmier_paired_hosts",h0="palmier_last_host";function I_(){try{const e=localStorage.getItem(mx);if(e)return JSON.parse(e)}catch{}return[]}function F_(e){localStorage.setItem(mx,JSON.stringify(e))}const d0="local",$_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function Y_({children:e}){const[t,r]=A.useState(()=>{const x=I_();return $_&&!x.some(v=>v.hostId===d0)&&x.push({hostId:d0,clientToken:"",directUrl:window.location.origin}),x}),[s,l]=A.useState(()=>{try{return localStorage.getItem(h0)}catch{return null}});A.useEffect(()=>{F_(t)},[t]);const u=A.useCallback(x=>{l(v=>v===x?v:x);try{localStorage.setItem(h0,x)}catch{}},[]),c=A.useCallback(x=>{r(v=>[...v.filter(T=>T.hostId!==x.hostId),x])},[]),f=A.useCallback(x=>{r(v=>v.filter(S=>S.hostId!==x))},[]),d=A.useCallback((x,v)=>{r(S=>S.map(T=>T.hostId===x?{...T,name:v}:T))},[]),m=A.useCallback((x,v)=>{r(S=>S.map(T=>T.hostId!==x||T.lanUrl===v?T:{...T,lanUrl:v}))},[]),y=A.useCallback((x,v)=>{r(S=>S.map(T=>T.hostId!==x||T.lastAgent===v?T:{...T,lastAgent:v}))},[]),g=A.useCallback((x,v)=>{r(S=>S.map(T=>T.hostId!==x||T.timezone===v?T:{...T,timezone:v}))},[]);return b.jsx(dx.Provider,{value:{pairedHosts:t,lastHostId:s,addPairedHost:c,removePairedHost:f,renamePairedHost:d,setHostLanUrl:m,setHostLastAgent:y,setHostTimezone:g,setLastHostId:u},children:e})}function qi(){const e=A.useContext(dx);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const Gn=new Uint8Array(0),Ii=new TextEncoder,$n=new TextDecoder;function V_(...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 Al(...e){const t=[];for(let r=0;r<e.length;r++)t.push(Ii.encode(e[r]));return t.length===0?Gn:t.length===1?t[0]:V_(...t)}function m0(e){return!e||e.length===0?"":$n.decode(e)}const p0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",g0=36,G_=0xcfd41b9100000,y0=33,J_=333,b0=22;function X_(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*255)}function K_(e){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(e):X_(e)}class Q_{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(b0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*G_),this.inc=Math.floor(Math.random()*(J_-y0)+y0)}setPre(){const t=new Uint8Array(12);K_(t);for(let r=0;r<12;r++){const s=t[r]%36;this.buf[r]=p0.charCodeAt(s)}}fillSeq(){let t=this.seq;for(let r=b0-1;r>=12;r--)this.buf[r]=p0.charCodeAt(t%g0),t=Math.floor(t/g0)}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 Pi=new Q_;var ei;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(ei||(ei={}));var la;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(la||(la={}));var Ee;(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"})(Ee||(Ee={}));function Z_(e){return typeof e.code=="string"}class px{constructor(){C(this,"messages");this.messages=new Map,this.messages.set(Ee.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(Ee.BadJson,"Bad JSON"),this.messages.set(Ee.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return W_.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const W_=new px;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=px.getMessage(r);return new De(l,r,s)}isAuthError(){return this.code===Ee.AuthenticationExpired||this.code===Ee.AuthorizationViolation||this.code===Ee.AccountExpired}isAuthTimeout(){return this.code===Ee.AuthenticationTimeout}isPermissionError(){return this.code===Ee.PermissionsViolation}isProtocolError(){return this.code===Ee.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var In;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(In||(In={}));var xr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(xr||(xr={}));var Tl;(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"})(Tl||(Tl={}));const Tu="Nats-Service-Error",ju="Nats-Service-Error-Code";class Nu extends Error{constructor(r,s){super(s);C(this,"code");this.code=r}static isServiceError(r){return Nu.toServiceError(r)!==null}static toServiceError(r){var l,u;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(ju))||"";if(s!==""){const c=parseInt(s)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(Tu))||"";return new Nu(c,f.length?f:s)}return null}}function ni(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}.${Pi.next()}`}const Wh="127.0.0.1";var zi;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(zi||(zi={}));function Gu(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 $n.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ma(e,t=!0){const r=t?De.errorForCode(Ee.Timeout):null;let s,l;const u=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?De.errorForCode(Ee.Timeout):r)},e)});return Object.assign(u,s)}function Sa(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 Bt(){let e={};const t=new Promise((r,s)=>{e={resolve:r,reject:s}});return Object.assign(t,e)}function gx(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 e2(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function Dd(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 e2(r>t?e[t]:e[r])}}}function Ut(e){return e*1e6}function Ld(e){return Math.floor(e/1e6)}function x0(e){let s=!0;const l=new Array(e.length);for(let u=0;u<e.length;u++){let c=e.charCodeAt(u);if(c===58||c<33||c>126)throw new De(`'${e[u]}' is not a valid character for a header key`,Ee.BadHeader);s&&97<=c&&c<=122?c-=32:!s&&65<=c&&c<=90&&(c+=32),l[u]=c,s=c==45}return String.fromCharCode(...l)}function ii(e=0,t=""){if(e===0&&t!==""||e>0&&t==="")throw new Error("setting status requires both code and description");return new Ui(e,t)}const vh="NATS/1.0";class Ui{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 u=[...s].sort(),c=[...l].sort();for(let f=0;f<u.length;f++)if(u[f]!==c[f])return!1}return!0}return!1}static decode(t){const r=new Ui,l=$n.decode(t).split(`\r
|
|
60
|
+
Please change the parent <Route path="${M}"> to <Route path="${M==="/"?"*":`${M}/*`}">.`)}let y=mr(),g;if(t){let M=typeof t=="string"?va(t):t;Pt(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=y;let x=g.pathname||"/",v=x;if(d!=="/"){let M=d.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(M.length).join("/")}let S=Jb(e,{pathname:v});Cr(m||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Cr(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=e_(S&&S.map(M=>Object.assign({},M,{params:Object.assign({},c,M.params),pathname:zr([d,s.encodeLocation?s.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?d:zr([d,s.encodeLocation?s.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),l,r);return t&&j?A.createElement(Fl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function KS(){let e=s_(),t=US(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},u={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=A.createElement(A.Fragment,null,A.createElement("p",null,"💿 Hey developer 👋"),A.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",A.createElement("code",{style:u},"ErrorBoundary")," or"," ",A.createElement("code",{style:u},"errorElement")," prop on your route.")),A.createElement(A.Fragment,null,A.createElement("h2",null,"Unexpected Application Error!"),A.createElement("h3",{style:{fontStyle:"italic"}},t),r?A.createElement("pre",{style:l},r):null,c)}var QS=A.createElement(KS,null),sx=class extends A.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=VS(e.digest);r&&(e=r)}let t=e!==void 0?A.createElement(Ar.Provider,{value:this.props.routeContext},A.createElement(Td.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?A.createElement(ZS,{error:e},t):t}};sx.contextType=HS;var bh=new WeakMap;function ZS({children:e,error:t}){let{basename:r}=A.useContext(er);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=YS(t.digest);if(s){let l=bh.get(t);if(l)throw l;let u=Zb(s.location,r);if(Qb&&!bh.get(t))if(u.isExternal||s.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:s.replace}));throw bh.set(t,c),c}return A.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function WS({routeContext:e,match:t,children:r}){let s=A.useContext(wa);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),A.createElement(Ar.Provider,{value:e},r)}function e_(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,u=s==null?void 0:s.errors;if(u!=null){let y=l.findIndex(g=>g.route.id&&(u==null?void 0:u[g.route.id])!==void 0);Pt(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),l=l.slice(0,Math.min(l.length,y+1))}let c=!1,f=-1;if(r&&s){c=s.renderFallback;for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=y),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?(y,g)=>{var x,v;d(y,{location:s.location,params:((v=(x=s.matches)==null?void 0:x[0])==null?void 0:v.params)??{},unstable_pattern:BS(s.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,x)=>{let v,S=!1,j=null,O=null;s&&(v=u&&g.route.id?u[g.route.id]:void 0,j=g.route.errorElement||QS,c&&(f<0&&x===0?(ax("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)),B=()=>{let I;return v?I=j:S?I=O:g.route.Component?I=A.createElement(g.route.Component,null):g.route.element?I=g.route.element:I=y,A.createElement(WS,{match:g,routeContext:{outlet:y,matches:M,isDataRoute:s!=null},children:I})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?A.createElement(sx,{location:s.location,revalidation:s.revalidation,component:j,error:v,children:B(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:m}):B()},null)}function Nd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function t_(e){let t=A.useContext(wa);return Pt(t,Nd(e)),t}function n_(e){let t=A.useContext($u);return Pt(t,Nd(e)),t}function r_(e){let t=A.useContext(Ar);return Pt(t,Nd(e)),t}function Od(e){let t=r_(e),r=t.matches[t.matches.length-1];return Pt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function i_(){return Od("useRouteId")}function s_(){var s;let e=A.useContext(Td),t=n_("useRouteError"),r=Od("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function a_(){let{router:e}=t_("useNavigate"),t=Od("useNavigate"),r=A.useRef(!1);return rx(()=>{r.current=!0}),A.useCallback(async(l,u={})=>{Cr(r.current,nx),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...u}))},[e,t])}var c0={};function ax(e,t,r){!t&&!c0[e]&&(c0[e]=!0,Cr(!1,r))}A.memo(l_);function l_({routes:e,future:t,state:r,isStatic:s,onError:l}){return ix(e,void 0,{state:r,isStatic:s,onError:l})}function zl({to:e,replace:t,state:r,relative:s}){Pt(Sa(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=A.useContext(er);Cr(!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:u}=A.useContext(Ar),{pathname:c}=mr(),f=Ur(),d=Fu(e,jd(u),c,s==="path"),m=JSON.stringify(d);return A.useEffect(()=>{f(JSON.parse(m),{replace:t,state:r,relative:s})},[f,m,s,t,r]),null}function Sr(e){Pt(!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 o_({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Pt(!Sa(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),d=A.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=va(r));let{pathname:m="/",search:y="",hash:g="",state:x=null,key:v="default",unstable_mask:S}=r,j=A.useMemo(()=>{let O=li(m,f);return O==null?null:{location:{pathname:O,search:y,hash:g,state:x,key:v,unstable_mask:S},navigationType:s}},[f,m,y,g,x,v,s,S]);return Cr(j!=null,`<Router basename="${f}"> is not able to match the URL "${m}${y}${g}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:A.createElement(er.Provider,{value:d},A.createElement(Fl.Provider,{children:t,value:j}))}function lx({children:e,location:t}){return XS(Zh(e),t)}function Zh(e,t=[]){let r=[];return A.Children.forEach(e,(s,l)=>{if(!A.isValidElement(s))return;let u=[...t,l];if(s.type===A.Fragment){r.push.apply(r,Zh(s.props.children,u));return}Pt(s.type===Sr,`[${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>`),Pt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||u.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=Zh(s.props.children,u)),r.push(c)}),r}var wu="get",Su="application/x-www-form-urlencoded";function Vu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function u_(e){return Vu(e)&&e.tagName.toLowerCase()==="button"}function c_(e){return Vu(e)&&e.tagName.toLowerCase()==="form"}function f_(e){return Vu(e)&&e.tagName.toLowerCase()==="input"}function h_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function d_(e,t){return e.button===0&&(!t||t==="_self")&&!h_(e)}var cu=null;function m_(){if(cu===null)try{new FormData(document.createElement("form"),0),cu=!1}catch{cu=!0}return cu}var p_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function xh(e){return e!=null&&!p_.has(e)?(Cr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Su}"`),null):e}function g_(e,t){let r,s,l,u,c;if(c_(e)){let f=e.getAttribute("action");s=f?li(f,t):null,r=e.getAttribute("method")||wu,l=xh(e.getAttribute("enctype"))||Su,u=new FormData(e)}else if(u_(e)||f_(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?li(d,t):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||wu,l=xh(e.getAttribute("formenctype"))||xh(f.getAttribute("enctype"))||Su,u=new FormData(f,e),!m_()){let{name:m,type:y,value:g}=e;if(y==="image"){let x=m?`${m}.`:"";u.append(`${x}x`,"0"),u.append(`${x}y`,"0")}else m&&u.append(m,g)}}else{if(Vu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=wu,s=null,l=Su,c=e}return u&&l==="text/plain"&&(c=u,u=void 0),{action:s,method:r.toLowerCase(),encType:l,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Rd(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function y_(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&&li(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function b_(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 x_(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 v_(e,t,r){let s=await Promise.all(e.map(async l=>{let u=t.routes[l.route.id];if(u){let c=await b_(u,r);return c.links?c.links():[]}return[]}));return k_(s.flat(1).filter(x_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function f0(e,t,r,s,l,u){let c=(d,m)=>r[m]?d.route.id!==r[m].route.id:!0,f=(d,m)=>{var y;return r[m].pathname!==d.pathname||((y=r[m].route.path)==null?void 0:y.endsWith("*"))&&r[m].params["*"]!==d.params["*"]};return u==="assets"?t.filter((d,m)=>c(d,m)||f(d,m)):u==="data"?t.filter((d,m)=>{var g;let y=s.routes[d.route.id];if(!y||!y.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 w_(e,t,{includeHydrateFallback:r}={}){return S_(e.map(s=>{let l=t.routes[s.route.id];if(!l)return[];let u=[l.module];return l.clientActionModule&&(u=u.concat(l.clientActionModule)),l.clientLoaderModule&&(u=u.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(u=u.concat(l.hydrateFallbackModule)),l.imports&&(u=u.concat(l.imports)),u}).flat(1))}function S_(e){return[...new Set(e)]}function __(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function k_(e,t){let r=new Set;return new Set(t),e.reduce((s,l)=>{let u=JSON.stringify(__(l));return r.has(u)||(r.add(u),s.push({key:u,link:l})),s},[])}function ox(){let e=A.useContext(wa);return Rd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function E_(){let e=A.useContext($u);return Rd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Md=A.createContext(void 0);Md.displayName="FrameworkContext";function ux(){let e=A.useContext(Md);return Rd(e,"You must render this element inside a <HydratedRouter> element"),e}function C_(e,t){let r=A.useContext(Md),[s,l]=A.useState(!1),[u,c]=A.useState(!1),{onFocus:f,onBlur:d,onMouseEnter:m,onMouseLeave:y,onTouchStart:g}=t,x=A.useRef(null);A.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=M=>{M.forEach(B=>{c(B.isIntersecting)})},O=new IntersectionObserver(j,{threshold:.5});return x.current&&O.observe(x.current),()=>{O.disconnect()}}},[e]),A.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"?[u,x,{}]:[u,x,{onFocus:yl(f,v),onBlur:yl(d,S),onMouseEnter:yl(m,v),onMouseLeave:yl(y,S),onTouchStart:yl(g,v)}]:[!1,x,{}]}function yl(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function A_({page:e,...t}){let{router:r}=ox(),s=A.useMemo(()=>Jb(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?A.createElement(T_,{page:e,matches:s,...t}):null}function j_(e){let{manifest:t,routeModules:r}=ux(),[s,l]=A.useState([]);return A.useEffect(()=>{let u=!1;return v_(e,t,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,t,r]),s}function T_({page:e,matches:t,...r}){let s=mr(),{future:l,manifest:u,routeModules:c}=ux(),{basename:f}=ox(),{loaderData:d,matches:m}=E_(),y=A.useMemo(()=>f0(e,t,m,u,s,"data"),[e,t,m,u,s]),g=A.useMemo(()=>f0(e,t,m,u,s,"assets"),[e,t,m,u,s]),x=A.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let j=new Set,O=!1;if(t.forEach(B=>{var ee;let I=u.routes[B.route.id];!I||!I.hasLoader||(!y.some(P=>P.route.id===B.route.id)&&B.route.id in d&&((ee=c[B.route.id])!=null&&ee.shouldRevalidate)||I.hasClientLoader?O=!0:j.add(B.route.id))}),j.size===0)return[];let M=y_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return O&&j.size>0&&M.searchParams.set("_routes",t.filter(B=>j.has(B.route.id)).map(B=>B.route.id).join(",")),[M.pathname+M.search]},[f,l.unstable_trailingSlashAwareDataRequests,d,s,u,y,t,e,c]),v=A.useMemo(()=>w_(g,u),[g,u]),S=j_(g);return A.createElement(A.Fragment,null,x.map(j=>A.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...r})),v.map(j=>A.createElement("link",{key:j,rel:"modulepreload",href:j,...r})),S.map(({key:j,link:O})=>A.createElement("link",{key:j,nonce:r.nonce,...O,crossOrigin:O.crossOrigin??r.crossOrigin})))}function N_(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var O_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{O_&&(window.__reactRouterVersion="7.13.1")}catch{}function R_({basename:e,children:t,unstable_useTransitions:r,window:s}){let l=A.useRef();l.current==null&&(l.current=dS({window:s,v5Compat:!0}));let u=l.current,[c,f]=A.useState({action:u.action,location:u.location}),d=A.useCallback(m=>{r===!1?f(m):A.startTransition(()=>f(m))},[r]);return A.useLayoutEffect(()=>u.listen(d),[u,d]),A.createElement(o_,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var cx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fx=A.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:d,target:m,to:y,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:v,...S},j){let{basename:O,navigator:M,unstable_useTransitions:B}=A.useContext(er),I=typeof y=="string"&&cx.test(y),ee=Zb(y,O);y=ee.to;let P=GS(y,{relative:l}),D=mr(),Z=null;if(f){let re=Fu(f,[],D.unstable_mask?D.unstable_mask.pathname:"/",!0);O!=="/"&&(re.pathname=re.pathname==="/"?O:zr([O,re.pathname])),Z=M.createHref(re)}let[F,$,L]=C_(s,S),J=z_(y,{replace:c,unstable_mask:f,state:d,target:m,preventScrollReset:g,relative:l,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:B});function G(re){t&&t(re),re.defaultPrevented||J(re)}let ce=!(ee.isExternal||u),ue=A.createElement("a",{...S,...L,href:(ce?Z:void 0)||ee.absoluteURL||P,onClick:ce?G:t,ref:N_(j,$),target:m,"data-discover":!I&&r==="render"?"true":void 0});return F&&!I?A.createElement(A.Fragment,null,ue,A.createElement(A_,{page:P})):ue});fx.displayName="Link";var M_=A.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:l=!1,style:u,to:c,viewTransition:f,children:d,...m},y){let g=$l(c,{relative:m.relative}),x=mr(),v=A.useContext($u),{navigator:S,basename:j}=A.useContext(er),O=v!=null&&q_(g)&&f===!0,M=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,B=x.pathname,I=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(B=B.toLowerCase(),I=I?I.toLowerCase():null,M=M.toLowerCase()),I&&j&&(I=li(I,j)||I);const ee=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let P=B===M||!l&&B.startsWith(M)&&B.charAt(ee)==="/",D=I!=null&&(I===M||!l&&I.startsWith(M)&&I.charAt(M.length)==="/"),Z={isActive:P,isPending:D,isTransitioning:O},F=P?t:void 0,$;typeof s=="function"?$=s(Z):$=[s,P?"active":null,D?"pending":null,O?"transitioning":null].filter(Boolean).join(" ");let L=typeof u=="function"?u(Z):u;return A.createElement(fx,{...m,"aria-current":F,className:$,ref:y,style:L,to:c,viewTransition:f},typeof d=="function"?d(Z):d)});M_.displayName="NavLink";var D_=A.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:l,state:u,method:c=wu,action:f,onSubmit:d,relative:m,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},S)=>{let{unstable_useTransitions:j}=A.useContext(er),O=P_(),M=H_(f,{relative:m}),B=c.toLowerCase()==="get"?"get":"post",I=typeof f=="string"&&cx.test(f),ee=P=>{if(d&&d(P),P.defaultPrevented)return;P.preventDefault();let D=P.nativeEvent.submitter,Z=(D==null?void 0:D.getAttribute("formmethod"))||c,F=()=>O(D||P.currentTarget,{fetcherKey:t,method:Z,navigate:r,replace:l,state:u,relative:m,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x});j&&r!==!1?A.startTransition(()=>F()):F()};return A.createElement("form",{ref:S,method:B,action:M,onSubmit:s?d:ee,...v,"data-discover":!I&&e==="render"?"true":void 0})});D_.displayName="Form";function L_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hx(e){let t=A.useContext(wa);return Pt(t,L_(e)),t}function z_(e,{target:t,replace:r,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d,unstable_useTransitions:m}={}){let y=Ur(),g=mr(),x=$l(e,{relative:c});return A.useCallback(v=>{if(d_(v,t)){v.preventDefault();let S=r!==void 0?r:Ll(g)===Ll(x),j=()=>y(e,{replace:S,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d});m?A.startTransition(()=>j()):j()}},[g,y,x,r,s,l,t,e,u,c,f,d,m])}var U_=0,B_=()=>`__${String(++U_)}__`;function P_(){let{router:e}=hx("useSubmit"),{basename:t}=A.useContext(er),r=i_(),s=e.fetch,l=e.navigate;return A.useCallback(async(u,c={})=>{let{action:f,method:d,encType:m,formData:y,body:g}=g_(u,t);if(c.navigate===!1){let x=c.fetcherKey||B_();await s(x,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,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:y,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 H_(e,{relative:t}={}){let{basename:r}=A.useContext(er),s=A.useContext(Ar);Pt(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),u={...$l(e||".",{relative:t})},c=mr();if(e==null){u.search=c.search;let f=new URLSearchParams(u.search),d=f.getAll("index");if(d.some(y=>y==="")){f.delete("index"),d.filter(g=>g).forEach(g=>f.append("index",g));let y=f.toString();u.search=y?`?${y}`:""}}return(!e||e===".")&&l.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:zr([r,u.pathname])),Ll(u)}function q_(e,{relative:t}={}){let r=A.useContext(ex);Pt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=hx("useViewTransitionState"),l=$l(e,{relative:t});if(!r.isTransitioning)return!1;let u=li(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=li(r.nextLocation.pathname,s)||r.nextLocation.pathname;return Au(l.pathname,c)!=null||Au(l.pathname,u)!=null}var ps=Gb();const dx=A.createContext(null),mx="palmier_paired_hosts",h0="palmier_last_host";function I_(){try{const e=localStorage.getItem(mx);if(e)return JSON.parse(e)}catch{}return[]}function F_(e){localStorage.setItem(mx,JSON.stringify(e))}const d0="local",$_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function Y_({children:e}){const[t,r]=A.useState(()=>{const x=I_();return $_&&!x.some(v=>v.hostId===d0)&&x.push({hostId:d0,clientToken:"",directUrl:window.location.origin}),x}),[s,l]=A.useState(()=>{try{return localStorage.getItem(h0)}catch{return null}});A.useEffect(()=>{F_(t)},[t]);const u=A.useCallback(x=>{l(v=>v===x?v:x);try{localStorage.setItem(h0,x)}catch{}},[]),c=A.useCallback(x=>{r(v=>[...v.filter(j=>j.hostId!==x.hostId),x])},[]),f=A.useCallback(x=>{r(v=>v.filter(S=>S.hostId!==x))},[]),d=A.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId===x?{...j,name:v}:j))},[]),m=A.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId!==x||j.lanUrl===v?j:{...j,lanUrl:v}))},[]),y=A.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId!==x||j.lastAgent===v?j:{...j,lastAgent:v}))},[]),g=A.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId!==x||j.timezone===v?j:{...j,timezone:v}))},[]);return b.jsx(dx.Provider,{value:{pairedHosts:t,lastHostId:s,addPairedHost:c,removePairedHost:f,renamePairedHost:d,setHostLanUrl:m,setHostLastAgent:y,setHostTimezone:g,setLastHostId:u},children:e})}function Yi(){const e=A.useContext(dx);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const Zn=new Uint8Array(0),Vi=new TextEncoder,Xn=new TextDecoder;function V_(...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 Al(...e){const t=[];for(let r=0;r<e.length;r++)t.push(Vi.encode(e[r]));return t.length===0?Zn:t.length===1?t[0]:V_(...t)}function m0(e){return!e||e.length===0?"":Xn.decode(e)}const p0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",g0=36,G_=0xcfd41b9100000,y0=33,J_=333,b0=22;function X_(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*255)}function K_(e){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(e):X_(e)}class Q_{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(b0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*G_),this.inc=Math.floor(Math.random()*(J_-y0)+y0)}setPre(){const t=new Uint8Array(12);K_(t);for(let r=0;r<12;r++){const s=t[r]%36;this.buf[r]=p0.charCodeAt(s)}}fillSeq(){let t=this.seq;for(let r=b0-1;r>=12;r--)this.buf[r]=p0.charCodeAt(t%g0),t=Math.floor(t/g0)}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 Fi=new Q_;var ii;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(ii||(ii={}));var oa;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(oa||(oa={}));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 Z_(e){return typeof e.code=="string"}class px{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 W_.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const W_=new px;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=px.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 Gn;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(Gn||(Gn={}));var _r;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(_r||(_r={}));var jl;(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"})(jl||(jl={}));const ju="Nats-Service-Error",Tu="Nats-Service-Error-Code";class Nu extends Error{constructor(r,s){super(s);C(this,"code");this.code=r}static isServiceError(r){return Nu.toServiceError(r)!==null}static toServiceError(r){var l,u;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(Tu))||"";if(s!==""){const c=parseInt(s)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(ju))||"";return new Nu(c,f.length?f:s)}return null}}function ai(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}.${Fi.next()}`}const Wh="127.0.0.1";var Hi;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Hi||(Hi={}));function Gu(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 Xn.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function pa(e,t=!0){const r=t?De.errorForCode(Ce.Timeout):null;let s,l;const u=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?De.errorForCode(Ce.Timeout):r)},e)});return Object.assign(u,s)}function _a(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 Bt(){let e={};const t=new Promise((r,s)=>{e={resolve:r,reject:s}});return Object.assign(t,e)}function gx(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 e2(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function Dd(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 e2(r>t?e[t]:e[r])}}}function Ut(e){return e*1e6}function Ld(e){return Math.floor(e/1e6)}function x0(e){let s=!0;const l=new Array(e.length);for(let u=0;u<e.length;u++){let c=e.charCodeAt(u);if(c===58||c<33||c>126)throw new De(`'${e[u]}' 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[u]=c,s=c==45}return String.fromCharCode(...l)}function oi(e=0,t=""){if(e===0&&t!==""||e>0&&t==="")throw new Error("setting status requires both code and description");return new qi(e,t)}const vh="NATS/1.0";class qi{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 u=[...s].sort(),c=[...l].sort();for(let f=0;f<u.length;f++)if(u[f]!==c[f])return!1}return!0}return!1}static decode(t){const r=new qi,l=Xn.decode(t).split(`\r
|
|
61
61
|
`),u=l[0];if(u!==vh){let c=u.replace(vh,"").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=vh;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
|
|
64
|
+
`}encode(){return Vi.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=Gn.Exact){const s=this.keys();switch(r){case Gn.Exact:return s.filter(l=>l===t);case Gn.CanonicalMIME:return t=x0(t),s.filter(l=>l===t);default:{const l=t.toLowerCase();return s.filter(u=>l===u.toLowerCase())}}}get(t,r=Gn.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=Gn.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=Gn.Exact){return this.findKeys(t,r).length>0}set(t,r,s=Gn.Exact){this.delete(t,s),this.append(t,r,s)}append(t,r,s=Gn.Exact){const l=x0(t);s===Gn.CanonicalMIME&&(t=l);const u=this.findKeys(t,s);t=u.length>0?u[0]:t;const c=qi.validHeaderValue(r);let f=this.headers.get(t);f||(f=[],this.headers.set(t,f)),f.push(c)}values(t,r=Gn.Exact){const s=[];return this.findKeys(t,r).forEach(u=>{const c=this.headers.get(u);c&&s.push(...c)}),s}delete(t,r=Gn.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 qi;for(const s in t)r.headers.set(s,t[s]);return r}}function Ou(){return{encode(e){return Vi.encode(e)},decode(e){return Xn.decode(e)}}}function kr(e){return{encode(t){try{return t===void 0&&(t=null),Vi.encode(JSON.stringify(t))}catch(r){throw De.errorForCode(Ce.BadJson,r)}},decode(t){try{return JSON.parse(Xn.decode(t),e)}catch(r){throw De.errorForCode(Ce.BadJson,r)}}}}function yx(e){var t;return e&&e.data.length===0&&((t=e.headers)==null?void 0:t.code)===503?De.errorForCode(Ce.NoResponders):null}class zd{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=Xn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Xn.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=qi.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=Zn,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 kr(t).decode(this.data)}string(){return Xn.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(zd,"jc");function ua(e){return Ju("durable",e)}function _n(e){return Ju("stream",e)}function Ju(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 El(e,t=""){if(t==="")throw Error(`${e} name required`);const r=t2(t);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function t2(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 ed(e){if(e.data.length>0)return!1;const t=e.headers;return t?t.code>=100&&t.code<200:!1}function td(e){var t;return ed(e)&&((t=e.headers)==null?void 0:t.description)==="Idle Heartbeat"}function n2(e,t,r){const s=ii(e,t),l={hdr:1,sid:0,size:0},u=new zd(l,Gn,{});return u._headers=s,u._subject=r,u}function ua(e){if(e.data.length!==0)return null;const t=e.headers;return t?bx(t.code,t.description):null}var or;(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"})(or||(or={}));function r2(e){return e.code!==Ee.JetStream409?!1:[or.MaxBatchExceeded,or.MaxExpiresExceeded,or.MaxBytesExceeded,or.MaxMessageSizeExceeded,or.PushConsumer,or.IdleHeartbeatMissed,or.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function bx(e,t=""){if(e<300)return null;switch(t=t.toLowerCase(),e){case 404:return new De(t,Ee.JetStream404NoMessages);case 408:return new De(t,Ee.JetStream408RequestTimeout);case 409:{const r=t.startsWith(or.IdleHeartbeatMissed)?Ee.JetStreamIdleHeartBeat:Ee.JetStream409;return new De(t,r)}case 503:return De.errorForCode(Ee.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=Ee.Unknown),new De(t,`${e}`)}}class sn{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=Bt(),this.yields=[],this.iterClosed=Bt(),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",Ee.ApiError);if(this.yielding)throw new De("already yielding",Ee.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(u){throw u}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=Bt())}}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 Ud{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 nd;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(nd||(nd={}));var Ul;(function(e){e.Old="old",e.New="new"})(Ul||(Ul={}));var rd;(function(e){e.File="file",e.Memory="memory"})(rd||(rd={}));var Vt;(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"})(Vt||(Vt={}));var rn;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(rn||(rn={}));var pa;(function(e){e.Instant="instant",e.Original="original"})(pa||(pa={}));var Hi;(function(e){e.None="none",e.S2="s2"})(Hi||(Hi={}));var Ru;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Ru||(Ru={}));function i2(e,t={}){return Object.assign({name:e,deliver_policy:Vt.All,ack_policy:rn.Explicit,ack_wait:Ut(30*1e3),replay_policy:pa.Instant},t)}var v0;(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"})(v0||(v0={}));var vn;(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"})(vn||(vn={}));var yr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(yr||(yr={}));var sa;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(sa||(sa={}));var w0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(w0||(w0={}));const Fn="KV_";class s2{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=i2("",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?rn.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 oa(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=Vt.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=Vt.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=Vt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Vt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Vt.Last,this}deliverNew(){return this.config.deliver_policy=Vt.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=rn.None,this}ackAll(){return this.config.ack_policy=rn.All,this}ackExplicit(){return this.config.ack_policy=rn.Explicit,this}ackWait(t){return this.config.ack_wait=Ut(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=pa.Instant,this}replayOriginal(){return this.config.replay_policy=pa.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=Ut(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=Ut(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=Ut(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 Bi(e){return new s2(e)}function S0(e){return typeof e.getOpts=="function"}class a2{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 ca{static encode(t){return ca.toB64URLEncoding(a2.encode(t))}static decode(t,r=!1){return ca.decode(ca.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class ga{constructor(){C(this,"buffers");C(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let r=0;for(let u=0;u<t.length;u++)r+=t[u].length;const s=new Uint8Array(r);let l=0;for(let u=0;u<t.length;u++)s.set(t[u],l),l+=t[u].length;return s}static fromAscii(t){return t||(t=""),Ii.encode(t)}static toAscii(t){return $n.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 l2(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 o2=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},bl=o2.performance||{};bl.now||bl.mozNow||bl.msNow||bl.oNow||bl.webkitNow;var _0={versions:{}},u2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function c2(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 wh,Xu={exports:{}},k0={},E0=c2(l2({__proto__:null,default:k0},[k0]));wh=Xu,(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&&_0.versions&&_0.versions.node;l?r=u2:s&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&wh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),d=[-2147483648,8388608,32768,128],m=[24,16,8,0],y=[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(P){return Object.prototype.toString.call(P)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(P){return typeof P=="object"&&P.buffer&&P.buffer.constructor===ArrayBuffer});var v=function(P,D){return function(Z){return new B(D,!0).update(Z)[P]()}},S=function(P){var D=v("hex",P);l&&(D=T(D,P)),D.create=function(){return new B(P)},D.update=function($){return D.create().update($)};for(var Z=0;Z<g.length;++Z){var F=g[Z];D[F]=v(F,P)}return D},T=function(P,D){var Z,F=E0,$=E0.Buffer,L=D?"sha224":"sha256";return Z=$.from&&!r.JS_SHA256_NO_BUFFER_FROM?$.from:function(J){return new $(J)},function(J){if(typeof J=="string")return F.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===$?F.createHash(L).update(Z(J)).digest("hex"):P(J)}},O=function(P,D){return function(Z,F){return new I(Z,D,!0).update(F)[P]()}},M=function(P){var D=O("hex",P);D.create=function($){return new I($,P)},D.update=function($,L){return D.create($).update(L)};for(var Z=0;Z<g.length;++Z){var F=g[Z];D[F]=O(F,P)}return D};function B(P,D){D?(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],P?(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=P}function I(P,D,Z){var F,$=typeof P;if($==="string"){var L,J=[],G=P.length,ue=0;for(F=0;F<G;++F)(L=P.charCodeAt(F))<128?J[ue++]=L:L<2048?(J[ue++]=192|L>>>6,J[ue++]=128|63&L):L<55296||L>=57344?(J[ue++]=224|L>>>12,J[ue++]=128|L>>>6&63,J[ue++]=128|63&L):(L=65536+((1023&L)<<10|1023&P.charCodeAt(++F)),J[ue++]=240|L>>>18,J[ue++]=128|L>>>12&63,J[ue++]=128|L>>>6&63,J[ue++]=128|63&L);P=J}else{if($!=="object")throw new Error(e);if(P===null)throw new Error(e);if(c&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!(Array.isArray(P)||c&&ArrayBuffer.isView(P)))throw new Error(e)}P.length>64&&(P=new B(D,!0).update(P).array());var oe=[],re=[];for(F=0;F<64;++F){var q=P[F]||0;oe[F]=92^q,re[F]=54^q}B.call(this,D,Z),this.update(re),this.oKeyPad=oe,this.inner=!0,this.sharedMemory=Z}B.prototype.update=function(P){if(!this.finalized){var D,Z=typeof P;if(Z!=="string"){if(Z!=="object")throw new Error(e);if(P===null)throw new Error(e);if(c&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!(Array.isArray(P)||c&&ArrayBuffer.isView(P)))throw new Error(e);D=!0}for(var F,$,L=0,J=P.length,G=this.blocks;L<J;){if(this.hashed&&(this.hashed=!1,G[0]=this.block,this.block=G[16]=G[1]=G[2]=G[3]=G[4]=G[5]=G[6]=G[7]=G[8]=G[9]=G[10]=G[11]=G[12]=G[13]=G[14]=G[15]=0),D)for($=this.start;L<J&&$<64;++L)G[$>>>2]|=P[L]<<m[3&$++];else for($=this.start;L<J&&$<64;++L)(F=P.charCodeAt(L))<128?G[$>>>2]|=F<<m[3&$++]:F<2048?(G[$>>>2]|=(192|F>>>6)<<m[3&$++],G[$>>>2]|=(128|63&F)<<m[3&$++]):F<55296||F>=57344?(G[$>>>2]|=(224|F>>>12)<<m[3&$++],G[$>>>2]|=(128|F>>>6&63)<<m[3&$++],G[$>>>2]|=(128|63&F)<<m[3&$++]):(F=65536+((1023&F)<<10|1023&P.charCodeAt(++L)),G[$>>>2]|=(240|F>>>18)<<m[3&$++],G[$>>>2]|=(128|F>>>12&63)<<m[3&$++],G[$>>>2]|=(128|F>>>6&63)<<m[3&$++],G[$>>>2]|=(128|63&F)<<m[3&$++]);this.lastByteIndex=$,this.bytes+=$-this.start,$>=64?(this.block=G[16],this.start=$-64,this.hash(),this.hashed=!0):this.start=$}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},B.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var P=this.blocks,D=this.lastByteIndex;P[16]=this.block,P[D>>>2]|=d[3&D],this.block=P[16],D>=56&&(this.hashed||this.hash(),P[0]=this.block,P[16]=P[1]=P[2]=P[3]=P[4]=P[5]=P[6]=P[7]=P[8]=P[9]=P[10]=P[11]=P[12]=P[13]=P[14]=P[15]=0),P[14]=this.hBytes<<3|this.bytes>>>29,P[15]=this.bytes<<3,this.hash()}},B.prototype.hash=function(){var P,D,Z,F,$,L,J,G,ue,oe=this.h0,re=this.h1,q=this.h2,Y=this.h3,ae=this.h4,ve=this.h5,N=this.h6,z=this.h7,W=this.blocks;for(P=16;P<64;++P)D=(($=W[P-15])>>>7|$<<25)^($>>>18|$<<14)^$>>>3,Z=(($=W[P-2])>>>17|$<<15)^($>>>19|$<<13)^$>>>10,W[P]=W[P-16]+D+W[P-7]+Z|0;for(ue=re&q,P=0;P<64;P+=4)this.first?(this.is224?(L=300032,z=($=W[0]-1413257819)-150054599|0,Y=$+24177077|0):(L=704751109,z=($=W[0]-210244248)-1521486534|0,Y=$+143694565|0),this.first=!1):(D=(oe>>>2|oe<<30)^(oe>>>13|oe<<19)^(oe>>>22|oe<<10),F=(L=oe&re)^oe&q^ue,z=Y+($=z+(Z=(ae>>>6|ae<<26)^(ae>>>11|ae<<21)^(ae>>>25|ae<<7))+(ae&ve^~ae&N)+y[P]+W[P])|0,Y=$+(D+F)|0),D=(Y>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),F=(J=Y&oe)^Y&re^L,N=q+($=N+(Z=(z>>>6|z<<26)^(z>>>11|z<<21)^(z>>>25|z<<7))+(z&ae^~z&ve)+y[P+1]+W[P+1])|0,D=((q=$+(D+F)|0)>>>2|q<<30)^(q>>>13|q<<19)^(q>>>22|q<<10),F=(G=q&Y)^q&oe^J,ve=re+($=ve+(Z=(N>>>6|N<<26)^(N>>>11|N<<21)^(N>>>25|N<<7))+(N&z^~N&ae)+y[P+2]+W[P+2])|0,D=((re=$+(D+F)|0)>>>2|re<<30)^(re>>>13|re<<19)^(re>>>22|re<<10),F=(ue=re&q)^re&Y^G,ae=oe+($=ae+(Z=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&N^~ve&z)+y[P+3]+W[P+3])|0,oe=$+(D+F)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+oe|0,this.h1=this.h1+re|0,this.h2=this.h2+q|0,this.h3=this.h3+Y|0,this.h4=this.h4+ae|0,this.h5=this.h5+ve|0,this.h6=this.h6+N|0,this.h7=this.h7+z|0},B.prototype.hex=function(){this.finalize();var P=this.h0,D=this.h1,Z=this.h2,F=this.h3,$=this.h4,L=this.h5,J=this.h6,G=this.h7,ue=f[P>>>28&15]+f[P>>>24&15]+f[P>>>20&15]+f[P>>>16&15]+f[P>>>12&15]+f[P>>>8&15]+f[P>>>4&15]+f[15&P]+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[Z>>>28&15]+f[Z>>>24&15]+f[Z>>>20&15]+f[Z>>>16&15]+f[Z>>>12&15]+f[Z>>>8&15]+f[Z>>>4&15]+f[15&Z]+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]+f[$>>>28&15]+f[$>>>24&15]+f[$>>>20&15]+f[$>>>16&15]+f[$>>>12&15]+f[$>>>8&15]+f[$>>>4&15]+f[15&$]+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||(ue+=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]),ue},B.prototype.toString=B.prototype.hex,B.prototype.digest=function(){this.finalize();var P=this.h0,D=this.h1,Z=this.h2,F=this.h3,$=this.h4,L=this.h5,J=this.h6,G=this.h7,ue=[P>>>24&255,P>>>16&255,P>>>8&255,255&P,D>>>24&255,D>>>16&255,D>>>8&255,255&D,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,F>>>24&255,F>>>16&255,F>>>8&255,255&F,$>>>24&255,$>>>16&255,$>>>8&255,255&$,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||ue.push(G>>>24&255,G>>>16&255,G>>>8&255,255&G),ue},B.prototype.array=B.prototype.digest,B.prototype.arrayBuffer=function(){this.finalize();var P=new ArrayBuffer(this.is224?28:32),D=new DataView(P);return D.setUint32(0,this.h0),D.setUint32(4,this.h1),D.setUint32(8,this.h2),D.setUint32(12,this.h3),D.setUint32(16,this.h4),D.setUint32(20,this.h5),D.setUint32(24,this.h6),this.is224||D.setUint32(28,this.h7),P},I.prototype=new B,I.prototype.finalize=function(){if(B.prototype.finalize.call(this),this.inner){this.inner=!1;var P=this.array();B.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(P),B.prototype.finalize.call(this)}};var ee=S();ee.sha256=ee,ee.sha224=S(!0),ee.sha256.hmac=M(),ee.sha224.hmac=M(!0),u?wh.exports=ee:(r.sha256=ee.sha256,r.sha224=ee.sha224)})();Xu.exports;Xu.exports.sha224;var C0=Xu.exports.sha256;function id(e){return g2(e)}function f2(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 h2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function d2(e){return f2(e)?"hex":h2(e)?"b64":""}function m2(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 p2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const t=atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0))}function g2(e){switch(d2(e)){case"hex":return m2(e);case"b64":return p2(e)}return null}function y2(e,t){const r=typeof e=="string"?id(e):e,s=typeof t=="string"?id(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 xx{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=Pi.next(),s&&(this.ctx=new Error)}}class b2 extends xx{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=Bt(),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 El(e,t=""){if(t==="")throw Error(`${e} name required`);const r=t2(t);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function t2(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 ed(e){if(e.data.length>0)return!1;const t=e.headers;return t?t.code>=100&&t.code<200:!1}function td(e){var t;return ed(e)&&((t=e.headers)==null?void 0:t.description)==="Idle Heartbeat"}function n2(e,t,r){const s=oi(e,t),l={hdr:1,sid:0,size:0},u=new zd(l,Zn,{});return u._headers=s,u._subject=r,u}function ca(e){if(e.data.length!==0)return null;const t=e.headers;return t?bx(t.code,t.description):null}var hr;(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"})(hr||(hr={}));function r2(e){return e.code!==Ce.JetStream409?!1:[hr.MaxBatchExceeded,hr.MaxExpiresExceeded,hr.MaxBytesExceeded,hr.MaxMessageSizeExceeded,hr.PushConsumer,hr.IdleHeartbeatMissed,hr.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function bx(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(hr.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 un{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=Bt(),this.yields=[],this.iterClosed=Bt(),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(u){throw u}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=Bt())}}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 Ud{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 nd;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(nd||(nd={}));var Ul;(function(e){e.Old="old",e.New="new"})(Ul||(Ul={}));var rd;(function(e){e.File="file",e.Memory="memory"})(rd||(rd={}));var Jt;(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"})(Jt||(Jt={}));var on;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(on||(on={}));var ga;(function(e){e.Instant="instant",e.Original="original"})(ga||(ga={}));var $i;(function(e){e.None="none",e.S2="s2"})($i||($i={}));var Ru;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Ru||(Ru={}));function i2(e,t={}){return Object.assign({name:e,deliver_policy:Jt.All,ack_policy:on.Explicit,ack_wait:Ut(30*1e3),replay_policy:ga.Instant},t)}var v0;(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"})(v0||(v0={}));var An;(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"})(An||(An={}));var wr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(wr||(wr={}));var aa;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(aa||(aa={}));var w0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(w0||(w0={}));const Jn="KV_";class s2{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=i2("",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?on.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 ua(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=Jt.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=Jt.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=Jt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Jt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Jt.Last,this}deliverNew(){return this.config.deliver_policy=Jt.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=on.None,this}ackAll(){return this.config.ack_policy=on.All,this}ackExplicit(){return this.config.ack_policy=on.Explicit,this}ackWait(t){return this.config.ack_wait=Ut(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=ga.Instant,this}replayOriginal(){return this.config.replay_policy=ga.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=Ut(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=Ut(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=Ut(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 Ii(e){return new s2(e)}function S0(e){return typeof e.getOpts=="function"}class a2{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 fa{static encode(t){return fa.toB64URLEncoding(a2.encode(t))}static decode(t,r=!1){return fa.decode(fa.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class ya{constructor(){C(this,"buffers");C(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let r=0;for(let u=0;u<t.length;u++)r+=t[u].length;const s=new Uint8Array(r);let l=0;for(let u=0;u<t.length;u++)s.set(t[u],l),l+=t[u].length;return s}static fromAscii(t){return t||(t=""),Vi.encode(t)}static toAscii(t){return Xn.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 l2(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 o2=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},bl=o2.performance||{};bl.now||bl.mozNow||bl.msNow||bl.oNow||bl.webkitNow;var _0={versions:{}},u2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function c2(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 wh,Xu={exports:{}},k0={},E0=c2(l2({__proto__:null,default:k0},[k0]));wh=Xu,(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&&_0.versions&&_0.versions.node;l?r=u2:s&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&wh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),d=[-2147483648,8388608,32768,128],m=[24,16,8,0],y=[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(P){return Object.prototype.toString.call(P)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(P){return typeof P=="object"&&P.buffer&&P.buffer.constructor===ArrayBuffer});var v=function(P,D){return function(Z){return new B(D,!0).update(Z)[P]()}},S=function(P){var D=v("hex",P);l&&(D=j(D,P)),D.create=function(){return new B(P)},D.update=function($){return D.create().update($)};for(var Z=0;Z<g.length;++Z){var F=g[Z];D[F]=v(F,P)}return D},j=function(P,D){var Z,F=E0,$=E0.Buffer,L=D?"sha224":"sha256";return Z=$.from&&!r.JS_SHA256_NO_BUFFER_FROM?$.from:function(J){return new $(J)},function(J){if(typeof J=="string")return F.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===$?F.createHash(L).update(Z(J)).digest("hex"):P(J)}},O=function(P,D){return function(Z,F){return new I(Z,D,!0).update(F)[P]()}},M=function(P){var D=O("hex",P);D.create=function($){return new I($,P)},D.update=function($,L){return D.create($).update(L)};for(var Z=0;Z<g.length;++Z){var F=g[Z];D[F]=O(F,P)}return D};function B(P,D){D?(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],P?(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=P}function I(P,D,Z){var F,$=typeof P;if($==="string"){var L,J=[],G=P.length,ce=0;for(F=0;F<G;++F)(L=P.charCodeAt(F))<128?J[ce++]=L:L<2048?(J[ce++]=192|L>>>6,J[ce++]=128|63&L):L<55296||L>=57344?(J[ce++]=224|L>>>12,J[ce++]=128|L>>>6&63,J[ce++]=128|63&L):(L=65536+((1023&L)<<10|1023&P.charCodeAt(++F)),J[ce++]=240|L>>>18,J[ce++]=128|L>>>12&63,J[ce++]=128|L>>>6&63,J[ce++]=128|63&L);P=J}else{if($!=="object")throw new Error(e);if(P===null)throw new Error(e);if(c&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!(Array.isArray(P)||c&&ArrayBuffer.isView(P)))throw new Error(e)}P.length>64&&(P=new B(D,!0).update(P).array());var ue=[],re=[];for(F=0;F<64;++F){var q=P[F]||0;ue[F]=92^q,re[F]=54^q}B.call(this,D,Z),this.update(re),this.oKeyPad=ue,this.inner=!0,this.sharedMemory=Z}B.prototype.update=function(P){if(!this.finalized){var D,Z=typeof P;if(Z!=="string"){if(Z!=="object")throw new Error(e);if(P===null)throw new Error(e);if(c&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!(Array.isArray(P)||c&&ArrayBuffer.isView(P)))throw new Error(e);D=!0}for(var F,$,L=0,J=P.length,G=this.blocks;L<J;){if(this.hashed&&(this.hashed=!1,G[0]=this.block,this.block=G[16]=G[1]=G[2]=G[3]=G[4]=G[5]=G[6]=G[7]=G[8]=G[9]=G[10]=G[11]=G[12]=G[13]=G[14]=G[15]=0),D)for($=this.start;L<J&&$<64;++L)G[$>>>2]|=P[L]<<m[3&$++];else for($=this.start;L<J&&$<64;++L)(F=P.charCodeAt(L))<128?G[$>>>2]|=F<<m[3&$++]:F<2048?(G[$>>>2]|=(192|F>>>6)<<m[3&$++],G[$>>>2]|=(128|63&F)<<m[3&$++]):F<55296||F>=57344?(G[$>>>2]|=(224|F>>>12)<<m[3&$++],G[$>>>2]|=(128|F>>>6&63)<<m[3&$++],G[$>>>2]|=(128|63&F)<<m[3&$++]):(F=65536+((1023&F)<<10|1023&P.charCodeAt(++L)),G[$>>>2]|=(240|F>>>18)<<m[3&$++],G[$>>>2]|=(128|F>>>12&63)<<m[3&$++],G[$>>>2]|=(128|F>>>6&63)<<m[3&$++],G[$>>>2]|=(128|63&F)<<m[3&$++]);this.lastByteIndex=$,this.bytes+=$-this.start,$>=64?(this.block=G[16],this.start=$-64,this.hash(),this.hashed=!0):this.start=$}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},B.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var P=this.blocks,D=this.lastByteIndex;P[16]=this.block,P[D>>>2]|=d[3&D],this.block=P[16],D>=56&&(this.hashed||this.hash(),P[0]=this.block,P[16]=P[1]=P[2]=P[3]=P[4]=P[5]=P[6]=P[7]=P[8]=P[9]=P[10]=P[11]=P[12]=P[13]=P[14]=P[15]=0),P[14]=this.hBytes<<3|this.bytes>>>29,P[15]=this.bytes<<3,this.hash()}},B.prototype.hash=function(){var P,D,Z,F,$,L,J,G,ce,ue=this.h0,re=this.h1,q=this.h2,Y=this.h3,ae=this.h4,ve=this.h5,N=this.h6,z=this.h7,W=this.blocks;for(P=16;P<64;++P)D=(($=W[P-15])>>>7|$<<25)^($>>>18|$<<14)^$>>>3,Z=(($=W[P-2])>>>17|$<<15)^($>>>19|$<<13)^$>>>10,W[P]=W[P-16]+D+W[P-7]+Z|0;for(ce=re&q,P=0;P<64;P+=4)this.first?(this.is224?(L=300032,z=($=W[0]-1413257819)-150054599|0,Y=$+24177077|0):(L=704751109,z=($=W[0]-210244248)-1521486534|0,Y=$+143694565|0),this.first=!1):(D=(ue>>>2|ue<<30)^(ue>>>13|ue<<19)^(ue>>>22|ue<<10),F=(L=ue&re)^ue&q^ce,z=Y+($=z+(Z=(ae>>>6|ae<<26)^(ae>>>11|ae<<21)^(ae>>>25|ae<<7))+(ae&ve^~ae&N)+y[P]+W[P])|0,Y=$+(D+F)|0),D=(Y>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),F=(J=Y&ue)^Y&re^L,N=q+($=N+(Z=(z>>>6|z<<26)^(z>>>11|z<<21)^(z>>>25|z<<7))+(z&ae^~z&ve)+y[P+1]+W[P+1])|0,D=((q=$+(D+F)|0)>>>2|q<<30)^(q>>>13|q<<19)^(q>>>22|q<<10),F=(G=q&Y)^q&ue^J,ve=re+($=ve+(Z=(N>>>6|N<<26)^(N>>>11|N<<21)^(N>>>25|N<<7))+(N&z^~N&ae)+y[P+2]+W[P+2])|0,D=((re=$+(D+F)|0)>>>2|re<<30)^(re>>>13|re<<19)^(re>>>22|re<<10),F=(ce=re&q)^re&Y^G,ae=ue+($=ae+(Z=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&N^~ve&z)+y[P+3]+W[P+3])|0,ue=$+(D+F)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+ue|0,this.h1=this.h1+re|0,this.h2=this.h2+q|0,this.h3=this.h3+Y|0,this.h4=this.h4+ae|0,this.h5=this.h5+ve|0,this.h6=this.h6+N|0,this.h7=this.h7+z|0},B.prototype.hex=function(){this.finalize();var P=this.h0,D=this.h1,Z=this.h2,F=this.h3,$=this.h4,L=this.h5,J=this.h6,G=this.h7,ce=f[P>>>28&15]+f[P>>>24&15]+f[P>>>20&15]+f[P>>>16&15]+f[P>>>12&15]+f[P>>>8&15]+f[P>>>4&15]+f[15&P]+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[Z>>>28&15]+f[Z>>>24&15]+f[Z>>>20&15]+f[Z>>>16&15]+f[Z>>>12&15]+f[Z>>>8&15]+f[Z>>>4&15]+f[15&Z]+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]+f[$>>>28&15]+f[$>>>24&15]+f[$>>>20&15]+f[$>>>16&15]+f[$>>>12&15]+f[$>>>8&15]+f[$>>>4&15]+f[15&$]+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||(ce+=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]),ce},B.prototype.toString=B.prototype.hex,B.prototype.digest=function(){this.finalize();var P=this.h0,D=this.h1,Z=this.h2,F=this.h3,$=this.h4,L=this.h5,J=this.h6,G=this.h7,ce=[P>>>24&255,P>>>16&255,P>>>8&255,255&P,D>>>24&255,D>>>16&255,D>>>8&255,255&D,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,F>>>24&255,F>>>16&255,F>>>8&255,255&F,$>>>24&255,$>>>16&255,$>>>8&255,255&$,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||ce.push(G>>>24&255,G>>>16&255,G>>>8&255,255&G),ce},B.prototype.array=B.prototype.digest,B.prototype.arrayBuffer=function(){this.finalize();var P=new ArrayBuffer(this.is224?28:32),D=new DataView(P);return D.setUint32(0,this.h0),D.setUint32(4,this.h1),D.setUint32(8,this.h2),D.setUint32(12,this.h3),D.setUint32(16,this.h4),D.setUint32(20,this.h5),D.setUint32(24,this.h6),this.is224||D.setUint32(28,this.h7),P},I.prototype=new B,I.prototype.finalize=function(){if(B.prototype.finalize.call(this),this.inner){this.inner=!1;var P=this.array();B.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(P),B.prototype.finalize.call(this)}};var ee=S();ee.sha256=ee,ee.sha224=S(!0),ee.sha256.hmac=M(),ee.sha224.hmac=M(!0),u?wh.exports=ee:(r.sha256=ee.sha256,r.sha224=ee.sha224)})();Xu.exports;Xu.exports.sha224;var C0=Xu.exports.sha256;function id(e){return g2(e)}function f2(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 h2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function d2(e){return f2(e)?"hex":h2(e)?"b64":""}function m2(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 p2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const t=atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0))}function g2(e){switch(d2(e)){case"hex":return m2(e);case"b64":return p2(e)}return null}function y2(e,t){const r=typeof e=="string"?id(e):e,s=typeof t=="string"?id(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 xx{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=Fi.next(),s&&(this.ctx=new Error)}}class b2 extends xx{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=Bt(),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===_r.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===_r.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===_r.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class vx extends xx{constructor(r,s,l={timeout:1e3},u=!0){super(r,s,u);C(this,"deferred");C(this,"timer");this.deferred=Bt(),this.timer=pa(l.timeout,u)}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(
|
|
71
|
-
`,Du=ga.fromAscii(_u),E2=new Uint8Array(Du)[0],C2=new Uint8Array(Du)[1];function A2(e){for(let t=0;t<e.length;t++){const r=t+1;if(e.byteLength>r&&e[t]===E2&&e[r]===C2)return r+1}return 0}function T2(e){const t=A2(e);if(t>0){const s=new Uint8Array(e).slice(0,t);return $n.decode(s)}return""}const j2=4,Sx=48,N2=65,O2=97;function R2(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 ld(e){return M2(e)!==void 0}function M2(e){for(let t=0;t<e.length;t++)switch(e[t]){case".":return _x(e);case":":return D2(e)}}function _x(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:u}=L2(e);if(!u||s>255)return;e=e.substring(l),t[r]=s}return R2(t[0],t[1],t[2],t[3])}function D2(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:u,ok:c}=z2(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&s!=12||s+4>16)return;const f=_x(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+=j2;break}if(t[s]=l>>8,t[s+1]=l,s+=2,e=e.substring(u),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 u=s-1;u>=r;u--)t[u+l]=t[u];for(let u=r+l-1;u>=r;u--)t[u]=0}else if(r>=0)return;return t}}function L2(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)-Sx),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 z2(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)-Sx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)t*=16,t+=e.charCodeAt(r)-O2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)t*=16,t+=e.charCodeAt(r)-N2+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 U2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function od(e){return!U2(e)}function B2(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 P2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=B2(e),od(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const t=od(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 u=l.hostname;return u.charAt(0)==="["&&(u=u.substring(1,u.length-1)),{listen:l.host,hostname:u,port:r}}class jl{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=P2(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(ld(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 u=this.port===80?"https":"http",c=new URL(`${u}://${od(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new jl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return t.randomize&&gx(r),this.resolves=r,r}}class H2{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=Sh();t&&(t.forEach(l=>{l=s?s(l):l,this.servers.push(new jl(l))}),this.randomize&&(this.servers=gx(this.servers))),this.servers.length===0&&this.addServer(`${Wh}:${wx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();ld(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=Sh();t=s?s(t):t;const l=new jl(t,r);ld(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 u=Sh(),c=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(d=>{d=u?u(d,r):d;const m=new jl(d,!0);c.set(d,m)});const f=[];return this.servers.forEach((d,m)=>{const y=d.listen;d.gossiped&&this.currentServer.listen!==y&&c.get(y)===void 0&&f.push(m),c.delete(y)}),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 q2{constructor(){C(this,"baseInbox");C(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${ni(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(u=>u.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=yx(r)),l.resolver(t,r))}}}close(){const t=De.errorForCode(Ee.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class I2{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:la.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=Bt();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 F2 extends Error{constructor(t){super(t),this.name="AssertionError"}}function $2(e,t="Assertion failed."){if(!e)throw new F2(t)}const A0=32*1024,_h=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 kh{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){$2(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(Ii.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>_h)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+t,_h));hu(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+t,_h)),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(A0);for(;;){const l=this.capacity-this.length<A0,u=l?s:new Uint8Array(this._buf.buffer,this.length),c=t.read(u);if(c===null)return r;l?this.write(u.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var yn;(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"})(yn||(yn={}));function T0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const Y2=48;class j0{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 je.M:case je.m:this.state=Te.OP_M,this.hdr=-1,this.ma=T0();break;case je.H:case je.h:this.state=Te.OP_H,this.hdr=0,this.ma=T0();break;case je.P:case je.p:this.state=Te.OP_P;break;case je.PLUS:this.state=Te.OP_PLUS;break;case je.MINUS:this.state=Te.OP_MINUS;break;case je.I:case je.i:this.state=Te.OP_I;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_H:switch(s){case je.M:case je.m:this.state=Te.OP_M;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_M:switch(s){case je.S:case je.s:this.state=Te.OP_MS;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MS:switch(s){case je.G:case je.g:this.state=Te.OP_MSG;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MSG:switch(s){case je.SPACE:case je.TAB:this.state=Te.OP_MSG_SPC;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MSG_SPC:switch(s){case je.SPACE:case je.TAB:continue;default:this.state=Te.MSG_ARG,this.as=r}break;case Te.MSG_ARG:switch(s){case je.CR:this.drop=1;break;case je.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:yn.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 u=t.length-r;u<l&&(l=u),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:yn.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 je.NL:this.drop=0,this.as=r+1,this.state=Te.OP_START;break;default:continue}break;case Te.OP_PLUS:switch(s){case je.O:case je.o:this.state=Te.OP_PLUS_O;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PLUS_O:switch(s){case je.K:case je.k:this.state=Te.OP_PLUS_OK;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PLUS_OK:switch(s){case je.NL:this.dispatcher.push({kind:yn.OK}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_MINUS:switch(s){case je.E:case je.e:this.state=Te.OP_MINUS_E;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_E:switch(s){case je.R:case je.r:this.state=Te.OP_MINUS_ER;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_ER:switch(s){case je.R:case je.r:this.state=Te.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_ERR:switch(s){case je.SPACE:case je.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 je.SPACE:case je.TAB:continue;default:this.state=Te.MINUS_ERR_ARG,this.as=r}break;case Te.MINUS_ERR_ARG:switch(s){case je.CR:this.drop=1;break;case je.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:yn.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 je.I:case je.i:this.state=Te.OP_PI;break;case je.O:case je.o:this.state=Te.OP_PO;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PO:switch(s){case je.N:case je.n:this.state=Te.OP_PON;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PON:switch(s){case je.G:case je.g:this.state=Te.OP_PONG;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PONG:switch(s){case je.NL:this.dispatcher.push({kind:yn.PONG}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_PI:switch(s){case je.N:case je.n:this.state=Te.OP_PIN;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PIN:switch(s){case je.G:case je.g:this.state=Te.OP_PING;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PING:switch(s){case je.NL:this.dispatcher.push({kind:yn.PING}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_I:switch(s){case je.N:case je.n:this.state=Te.OP_IN;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_IN:switch(s){case je.F:case je.f:this.state=Te.OP_INF;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_INF:switch(s){case je.O:case je.o:this.state=Te.OP_INFO;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_INFO:switch(s){case je.SPACE:case je.TAB:this.state=Te.OP_INFO_SPC;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_INFO_SPC:switch(s){case je.SPACE:case je.TAB:continue;default:this.state=Te.INFO_ARG,this.as=r}break;case Te.INFO_ARG:switch(s){case je.CR:this.drop=1;break;case je.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:yn.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 kh(t.subarray(this.as,r-this.drop))),this.state===Te.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new kh(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 kh(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 je.SPACE:case je.TAB:case je.CR:case je.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}: ${$n.decode(t)}`)}processHeaderMsgArgs(t){const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case je.SPACE:case je.TAB:case je.CR:case je.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]-Y2)}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 je;(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"})(je||(je={}));(function(e){var t=function(E,R){this.hi=E|0,this.lo=R|0},r=function(E){var R,j=new Float64Array(16);if(E)for(R=0;R<E.length;R++)j[R]=E[R];return j},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),u=new Uint8Array(32);u[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]),y=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(E,R){return E<<R|E>>>32-R}function T(E,R){var j=E[R+3]&255;return j=j<<8|E[R+2]&255,j=j<<8|E[R+1]&255,j<<8|E[R+0]&255}function O(E,R){var j=E[R]<<24|E[R+1]<<16|E[R+2]<<8|E[R+3],U=E[R+4]<<24|E[R+5]<<16|E[R+6]<<8|E[R+7];return new t(j,U)}function M(E,R,j){var U;for(U=0;U<4;U++)E[R+U]=j&255,j>>>=8}function B(E,R,j){E[R]=j.hi>>24&255,E[R+1]=j.hi>>16&255,E[R+2]=j.hi>>8&255,E[R+3]=j.hi&255,E[R+4]=j.lo>>24&255,E[R+5]=j.lo>>16&255,E[R+6]=j.lo>>8&255,E[R+7]=j.lo&255}function I(E,R,j,U,V){var Q,pe=0;for(Q=0;Q<V;Q++)pe|=E[R+Q]^j[U+Q];return(1&pe-1>>>8)-1}function ee(E,R,j,U){return I(E,R,j,U,16)}function P(E,R,j,U){return I(E,R,j,U,32)}function D(E,R,j,U,V){var Q=new Uint32Array(16),pe=new Uint32Array(16),xe=new Uint32Array(16),se=new Uint32Array(4),me,Le,We;for(me=0;me<4;me++)pe[5*me]=T(U,4*me),pe[1+me]=T(j,4*me),pe[6+me]=T(R,4*me),pe[11+me]=T(j,16+4*me);for(me=0;me<16;me++)xe[me]=pe[me];for(me=0;me<20;me++){for(Le=0;Le<4;Le++){for(We=0;We<4;We++)se[We]=pe[(5*Le+4*We)%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),We=0;We<4;We++)Q[4*Le+(Le+We)%4]=se[We]}for(We=0;We<16;We++)pe[We]=Q[We]}if(V){for(me=0;me<16;me++)pe[me]=pe[me]+xe[me]|0;for(me=0;me<4;me++)pe[5*me]=pe[5*me]-T(U,4*me)|0,pe[6+me]=pe[6+me]-T(R,4*me)|0;for(me=0;me<4;me++)M(E,4*me,pe[5*me]),M(E,16+4*me,pe[6+me])}else for(me=0;me<16;me++)M(E,4*me,pe[me]+xe[me]|0)}function Z(E,R,j,U){return D(E,R,j,U,!1),0}function F(E,R,j,U){return D(E,R,j,U,!0),0}var $=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function L(E,R,j,U,V,Q,pe){var xe=new Uint8Array(16),se=new Uint8Array(64),me,Le;if(!V)return 0;for(Le=0;Le<16;Le++)xe[Le]=0;for(Le=0;Le<8;Le++)xe[Le]=Q[Le];for(;V>=64;){for(Z(se,xe,pe,$),Le=0;Le<64;Le++)E[R+Le]=(j?j[U+Le]:0)^se[Le];for(me=1,Le=8;Le<16;Le++)me=me+(xe[Le]&255)|0,xe[Le]=me&255,me>>>=8;V-=64,R+=64,j&&(U+=64)}if(V>0)for(Z(se,xe,pe,$),Le=0;Le<V;Le++)E[R+Le]=(j?j[U+Le]:0)^se[Le];return 0}function J(E,R,j,U,V){return L(E,R,null,0,j,U,V)}function G(E,R,j,U,V){var Q=new Uint8Array(32);return F(Q,U,V,$),J(E,R,j,U.subarray(16),Q)}function ue(E,R,j,U,V,Q,pe){var xe=new Uint8Array(32);return F(xe,Q,pe,$),L(E,R,j,U,V,Q.subarray(16),xe)}function oe(E,R){var j,U=0;for(j=0;j<17;j++)U=U+(E[j]+R[j]|0)|0,E[j]=U&255,U>>>=8}var re=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function q(E,R,j,U,V,Q){var pe,xe,se,me,Le=new Uint32Array(17),We=new Uint32Array(17),Mt=new Uint32Array(17),cn=new Uint32Array(17),dr=new Uint32Array(17);for(se=0;se<17;se++)We[se]=Mt[se]=0;for(se=0;se<16;se++)We[se]=Q[se];for(We[3]&=15,We[4]&=252,We[7]&=15,We[8]&=252,We[11]&=15,We[12]&=252,We[15]&=15;V>0;){for(se=0;se<17;se++)cn[se]=0;for(se=0;se<16&&se<V;++se)cn[se]=j[U+se];for(cn[se]=1,U+=se,V-=se,oe(Mt,cn),xe=0;xe<17;xe++)for(Le[xe]=0,se=0;se<17;se++)Le[xe]=Le[xe]+Mt[se]*(se<=xe?We[xe-se]:320*We[xe+17-se]|0)|0|0;for(xe=0;xe<17;xe++)Mt[xe]=Le[xe];for(me=0,se=0;se<16;se++)me=me+Mt[se]|0,Mt[se]=me&255,me>>>=8;for(me=me+Mt[16]|0,Mt[16]=me&3,me=5*(me>>>2)|0,se=0;se<16;se++)me=me+Mt[se]|0,Mt[se]=me&255,me>>>=8;me=me+Mt[16]|0,Mt[16]=me}for(se=0;se<17;se++)dr[se]=Mt[se];for(oe(Mt,re),pe=-(Mt[16]>>>7)|0,se=0;se<17;se++)Mt[se]^=pe&(dr[se]^Mt[se]);for(se=0;se<16;se++)cn[se]=Q[se+16];for(cn[16]=0,oe(Mt,cn),se=0;se<16;se++)E[R+se]=Mt[se];return 0}function Y(E,R,j,U,V,Q){var pe=new Uint8Array(16);return q(pe,0,j,U,V,Q),ee(E,R,pe,0)}function ae(E,R,j,U,V){var Q;if(j<32)return-1;for(ue(E,0,R,0,j,U,V),q(E,16,E,32,j-32,E),Q=0;Q<16;Q++)E[Q]=0;return 0}function ve(E,R,j,U,V){var Q,pe=new Uint8Array(32);if(j<32||(G(pe,0,32,U,V),Y(R,16,R,32,j-32,pe)!==0))return-1;for(ue(E,0,R,0,j,U,V),Q=0;Q<32;Q++)E[Q]=0;return 0}function N(E,R){var j;for(j=0;j<16;j++)E[j]=R[j]|0}function z(E){var R,j;for(j=0;j<16;j++)E[j]+=65536,R=Math.floor(E[j]/65536),E[(j+1)*(j<15?1:0)]+=R-1+37*(R-1)*(j===15?1:0),E[j]-=R*65536}function W(E,R,j){for(var U,V=~(j-1),Q=0;Q<16;Q++)U=V&(E[Q]^R[Q]),E[Q]^=U,R[Q]^=U}function _(E,R){var j,U,V,Q=r(),pe=r();for(j=0;j<16;j++)pe[j]=R[j];for(z(pe),z(pe),z(pe),U=0;U<2;U++){for(Q[0]=pe[0]-65517,j=1;j<15;j++)Q[j]=pe[j]-65535-(Q[j-1]>>16&1),Q[j-1]&=65535;Q[15]=pe[15]-32767-(Q[14]>>16&1),V=Q[15]>>16&1,Q[14]&=65535,W(pe,Q,1-V)}for(j=0;j<16;j++)E[2*j]=pe[j]&255,E[2*j+1]=pe[j]>>8}function ye(E,R){var j=new Uint8Array(32),U=new Uint8Array(32);return _(j,E),_(U,R),P(j,0,U,0)}function Ae(E){var R=new Uint8Array(32);return _(R,E),R[0]&1}function _e(E,R){var j;for(j=0;j<16;j++)E[j]=R[2*j]+(R[2*j+1]<<8);E[15]&=32767}function Re(E,R,j){var U;for(U=0;U<16;U++)E[U]=R[U]+j[U]|0}function Ye(E,R,j){var U;for(U=0;U<16;U++)E[U]=R[U]-j[U]|0}function Ce(E,R,j){var U,V,Q=new Float64Array(31);for(U=0;U<31;U++)Q[U]=0;for(U=0;U<16;U++)for(V=0;V<16;V++)Q[U+V]+=R[U]*j[V];for(U=0;U<15;U++)Q[U]+=38*Q[U+16];for(U=0;U<16;U++)E[U]=Q[U];z(E),z(E)}function ot(E,R){Ce(E,R,R)}function jt(E,R){var j=r(),U;for(U=0;U<16;U++)j[U]=R[U];for(U=253;U>=0;U--)ot(j,j),U!==2&&U!==4&&Ce(j,j,R);for(U=0;U<16;U++)E[U]=j[U]}function en(E,R){var j=r(),U;for(U=0;U<16;U++)j[U]=R[U];for(U=250;U>=0;U--)ot(j,j),U!==1&&Ce(j,j,R);for(U=0;U<16;U++)E[U]=j[U]}function Ht(E,R,j){var U=new Uint8Array(32),V=new Float64Array(80),Q,pe,xe=r(),se=r(),me=r(),Le=r(),We=r(),Mt=r();for(pe=0;pe<31;pe++)U[pe]=R[pe];for(U[31]=R[31]&127|64,U[0]&=248,_e(V,j),pe=0;pe<16;pe++)se[pe]=V[pe],Le[pe]=xe[pe]=me[pe]=0;for(xe[0]=Le[0]=1,pe=254;pe>=0;--pe)Q=U[pe>>>3]>>>(pe&7)&1,W(xe,se,Q),W(me,Le,Q),Re(We,xe,me),Ye(xe,xe,me),Re(me,se,Le),Ye(se,se,Le),ot(Le,We),ot(Mt,xe),Ce(xe,me,xe),Ce(me,se,We),Re(We,xe,me),Ye(xe,xe,me),ot(se,xe),Ye(me,Le,Mt),Ce(xe,me,d),Re(xe,xe,Le),Ce(me,me,xe),Ce(xe,Le,Mt),Ce(Le,se,V),ot(se,We),W(xe,se,Q),W(me,Le,Q);for(pe=0;pe<16;pe++)V[pe+16]=xe[pe],V[pe+32]=me[pe],V[pe+48]=se[pe],V[pe+64]=Le[pe];var cn=V.subarray(32),dr=V.subarray(16);return jt(cn,cn),Ce(dr,dr,cn),_(E,dr),0}function Be(E,R){return Ht(E,R,u)}function rt(E,R){return s(R,32),Be(E,R)}function Ve(E,R,j){var U=new Uint8Array(32);return Ht(U,j,R),F(E,l,U,$)}var Et=ae,Rt=ve;function Kn(E,R,j,U,V,Q){var pe=new Uint8Array(32);return Ve(pe,V,Q),Et(E,R,j,U,pe)}function Nt(E,R,j,U,V,Q){var pe=new Uint8Array(32);return Ve(pe,V,Q),Rt(E,R,j,U,pe)}function tn(){var E=0,R=0,j=0,U=0,V=65535,Q,pe,xe;for(xe=0;xe<arguments.length;xe++)Q=arguments[xe].lo,pe=arguments[xe].hi,E+=Q&V,R+=Q>>>16,j+=pe&V,U+=pe>>>16;return R+=E>>>16,j+=R>>>16,U+=j>>>16,new t(j&V|U<<16,E&V|R<<16)}function wn(E,R){return new t(E.hi>>>R,E.lo>>>R|E.hi<<32-R)}function Rn(){var E=0,R=0,j;for(j=0;j<arguments.length;j++)E^=arguments[j].lo,R^=arguments[j].hi;return new t(R,E)}function mt(E,R){var j,U,V=32-R;return R<32?(j=E.hi>>>R|E.lo<<V,U=E.lo>>>R|E.hi<<V):R<64&&(j=E.lo>>>R|E.hi<<V,U=E.hi>>>R|E.lo<<V),new t(j,U)}function Sn(E,R,j){var U=E.hi&R.hi^~E.hi&j.hi,V=E.lo&R.lo^~E.lo&j.lo;return new t(U,V)}function ce(E,R,j){var U=E.hi&R.hi^E.hi&j.hi^R.hi&j.hi,V=E.lo&R.lo^E.lo&j.lo^R.lo&j.lo;return new t(U,V)}function ke(E){return Rn(mt(E,28),mt(E,34),mt(E,39))}function be(E){return Rn(mt(E,14),mt(E,18),mt(E,41))}function we(E){return Rn(mt(E,1),mt(E,8),wn(E,7))}function Ne(E){return Rn(mt(E,19),mt(E,61),wn(E,6))}var Ge=[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 Ze(E,R,j){var U=[],V=[],Q=[],pe=[],xe,se,me;for(se=0;se<8;se++)U[se]=Q[se]=O(E,8*se);for(var Le=0;j>=128;){for(se=0;se<16;se++)pe[se]=O(R,8*se+Le);for(se=0;se<80;se++){for(me=0;me<8;me++)V[me]=Q[me];for(xe=tn(Q[7],be(Q[4]),Sn(Q[4],Q[5],Q[6]),Ge[se],pe[se%16]),V[7]=tn(xe,ke(Q[0]),ce(Q[0],Q[1],Q[2])),V[3]=tn(V[3],xe),me=0;me<8;me++)Q[(me+1)%8]=V[me];if(se%16===15)for(me=0;me<16;me++)pe[me]=tn(pe[me],pe[(me+9)%16],we(pe[(me+1)%16]),Ne(pe[(me+14)%16]))}for(se=0;se<8;se++)Q[se]=tn(Q[se],U[se]),U[se]=Q[se];Le+=128,j-=128}for(se=0;se<8;se++)B(E,8*se,U[se]);return j}var ct=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 Ie(E,R,j){var U=new Uint8Array(64),V=new Uint8Array(256),Q,pe=j;for(Q=0;Q<64;Q++)U[Q]=ct[Q];for(Ze(U,R,j),j%=128,Q=0;Q<256;Q++)V[Q]=0;for(Q=0;Q<j;Q++)V[Q]=R[pe-j+Q];for(V[j]=128,j=256-128*(j<112?1:0),V[j-9]=0,B(V,j-8,new t(pe/536870912|0,pe<<3)),Ze(U,V,j),Q=0;Q<64;Q++)E[Q]=U[Q];return 0}function qe(E,R){var j=r(),U=r(),V=r(),Q=r(),pe=r(),xe=r(),se=r(),me=r(),Le=r();Ye(j,E[1],E[0]),Ye(Le,R[1],R[0]),Ce(j,j,Le),Re(U,E[0],E[1]),Re(Le,R[0],R[1]),Ce(U,U,Le),Ce(V,E[3],R[3]),Ce(V,V,y),Ce(Q,E[2],R[2]),Re(Q,Q,Q),Ye(pe,U,j),Ye(xe,Q,V),Re(se,Q,V),Re(me,U,j),Ce(E[0],pe,xe),Ce(E[1],me,se),Ce(E[2],se,xe),Ce(E[3],pe,me)}function Pe(E,R,j){var U;for(U=0;U<4;U++)W(E[U],R[U],j)}function de(E,R){var j=r(),U=r(),V=r();jt(V,R[2]),Ce(j,R[0],V),Ce(U,R[1],V),_(E,U),E[31]^=Ae(j)<<7}function Me(E,R,j){var U,V;for(N(E[0],c),N(E[1],f),N(E[2],f),N(E[3],c),V=255;V>=0;--V)U=j[V/8|0]>>(V&7)&1,Pe(E,R,U),qe(R,E),qe(E,E),Pe(E,R,U)}function Oe(E,R){var j=[r(),r(),r(),r()];N(j[0],g),N(j[1],x),N(j[2],f),Ce(j[3],g,x),Me(E,j,R)}function gt(E,R,j){var U=new Uint8Array(64),V=[r(),r(),r(),r()],Q;for(j||s(R,32),Ie(U,R,32),U[0]&=248,U[31]&=127,U[31]|=64,Oe(V,U),de(E,V),Q=0;Q<32;Q++)R[Q+32]=E[Q];return 0}var it=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 _n(E,R){var j,U,V,Q;for(U=63;U>=32;--U){for(j=0,V=U-32,Q=U-12;V<Q;++V)R[V]+=j-16*R[U]*it[V-(U-32)],j=Math.floor((R[V]+128)/256),R[V]-=j*256;R[V]+=j,R[U]=0}for(j=0,V=0;V<32;V++)R[V]+=j-(R[31]>>4)*it[V],j=R[V]>>8,R[V]&=255;for(V=0;V<32;V++)R[V]-=j*it[V];for(U=0;U<32;U++)R[U+1]+=R[U]>>8,E[U]=R[U]&255}function fr(E){var R=new Float64Array(64),j;for(j=0;j<64;j++)R[j]=E[j];for(j=0;j<64;j++)E[j]=0;_n(E,R)}function $i(E,R,j,U){var V=new Uint8Array(64),Q=new Uint8Array(64),pe=new Uint8Array(64),xe,se,me=new Float64Array(64),Le=[r(),r(),r(),r()];Ie(V,U,32),V[0]&=248,V[31]&=127,V[31]|=64;var We=j+64;for(xe=0;xe<j;xe++)E[64+xe]=R[xe];for(xe=0;xe<32;xe++)E[32+xe]=V[32+xe];for(Ie(pe,E.subarray(32),j+32),fr(pe),Oe(Le,pe),de(E,Le),xe=32;xe<64;xe++)E[xe]=U[xe];for(Ie(Q,E,j+64),fr(Q),xe=0;xe<64;xe++)me[xe]=0;for(xe=0;xe<32;xe++)me[xe]=pe[xe];for(xe=0;xe<32;xe++)for(se=0;se<32;se++)me[xe+se]+=Q[xe]*V[se];return _n(E.subarray(32),me),We}function Yi(E,R){var j=r(),U=r(),V=r(),Q=r(),pe=r(),xe=r(),se=r();return N(E[2],f),_e(E[1],R),ot(V,E[1]),Ce(Q,V,m),Ye(V,V,E[2]),Re(Q,E[2],Q),ot(pe,Q),ot(xe,pe),Ce(se,xe,pe),Ce(j,se,V),Ce(j,j,Q),en(j,j),Ce(j,j,V),Ce(j,j,Q),Ce(j,j,Q),Ce(E[0],j,Q),ot(U,E[0]),Ce(U,U,Q),ye(U,V)&&Ce(E[0],E[0],v),ot(U,E[0]),Ce(U,U,Q),ye(U,V)?-1:(Ae(E[0])===R[31]>>7&&Ye(E[0],c,E[0]),Ce(E[3],E[0],E[1]),0)}function Ea(E,R,j,U){var V,Q=new Uint8Array(32),pe=new Uint8Array(64),xe=[r(),r(),r(),r()],se=[r(),r(),r(),r()];if(j<64||Yi(se,U))return-1;for(V=0;V<j;V++)E[V]=R[V];for(V=0;V<32;V++)E[V+32]=U[V];if(Ie(pe,E,j),fr(pe),Me(xe,se,pe),Oe(se,R.subarray(32)),qe(xe,se),de(Q,xe),j-=64,P(R,0,Q,0)){for(V=0;V<j;V++)E[V]=0;return-1}for(V=0;V<j;V++)E[V]=R[V+64];return j}var xs=32,li=24,hr=32,oi=16,ui=32,Vi=32,ci=32,Lr=32,Gi=32,Ca=li,Kl=hr,kr=oi,Ct=64,qt=32,Mn=64,Ji=32,Aa=64;e.lowlevel={crypto_core_hsalsa20:F,crypto_stream_xor:ue,crypto_stream:G,crypto_stream_salsa20_xor:L,crypto_stream_salsa20:J,crypto_onetimeauth:q,crypto_onetimeauth_verify:Y,crypto_verify_16:ee,crypto_verify_32:P,crypto_secretbox:ae,crypto_secretbox_open:ve,crypto_scalarmult:Ht,crypto_scalarmult_base:Be,crypto_box_beforenm:Ve,crypto_box_afternm:Et,crypto_box:Kn,crypto_box_open:Nt,crypto_box_keypair:rt,crypto_hash:Ie,crypto_sign:$i,crypto_sign_keypair:gt,crypto_sign_open:Ea,crypto_secretbox_KEYBYTES:xs,crypto_secretbox_NONCEBYTES:li,crypto_secretbox_ZEROBYTES:hr,crypto_secretbox_BOXZEROBYTES:oi,crypto_scalarmult_BYTES:ui,crypto_scalarmult_SCALARBYTES:Vi,crypto_box_PUBLICKEYBYTES:ci,crypto_box_SECRETKEYBYTES:Lr,crypto_box_BEFORENMBYTES:Gi,crypto_box_NONCEBYTES:Ca,crypto_box_ZEROBYTES:Kl,crypto_box_BOXZEROBYTES:kr,crypto_sign_BYTES:Ct,crypto_sign_PUBLICKEYBYTES:qt,crypto_sign_SECRETKEYBYTES:Mn,crypto_sign_SEEDBYTES:Ji,crypto_hash_BYTES:Aa,gf:r,D:m,L:it,pack25519:_,unpack25519:_e,M:Ce,A:Re,S:ot,Z:Ye,pow2523:en,add:qe,set25519:N,modL:_n,scalarmult:Me,scalarbase:Oe};function Ql(E,R){if(E.length!==xs)throw new Error("bad key size");if(R.length!==li)throw new Error("bad nonce size")}function Zl(E,R){if(E.length!==ci)throw new Error("bad public key size");if(R.length!==Lr)throw new Error("bad secret key size")}function Zt(){for(var E=0;E<arguments.length;E++)if(!(arguments[E]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function vs(E){for(var R=0;R<E.length;R++)E[R]=0}e.randomBytes=function(E){var R=new Uint8Array(E);return s(R,E),R},e.secretbox=function(E,R,j){Zt(E,R,j),Ql(j,R);for(var U=new Uint8Array(hr+E.length),V=new Uint8Array(U.length),Q=0;Q<E.length;Q++)U[Q+hr]=E[Q];return ae(V,U,U.length,R,j),V.subarray(oi)},e.secretbox.open=function(E,R,j){Zt(E,R,j),Ql(j,R);for(var U=new Uint8Array(oi+E.length),V=new Uint8Array(U.length),Q=0;Q<E.length;Q++)U[Q+oi]=E[Q];return U.length<32||ve(V,U,U.length,R,j)!==0?null:V.subarray(hr)},e.secretbox.keyLength=xs,e.secretbox.nonceLength=li,e.secretbox.overheadLength=oi,e.scalarMult=function(E,R){if(Zt(E,R),E.length!==Vi)throw new Error("bad n size");if(R.length!==ui)throw new Error("bad p size");var j=new Uint8Array(ui);return Ht(j,E,R),j},e.scalarMult.base=function(E){if(Zt(E),E.length!==Vi)throw new Error("bad n size");var R=new Uint8Array(ui);return Be(R,E),R},e.scalarMult.scalarLength=Vi,e.scalarMult.groupElementLength=ui,e.box=function(E,R,j,U){var V=e.box.before(j,U);return e.secretbox(E,R,V)},e.box.before=function(E,R){Zt(E,R),Zl(E,R);var j=new Uint8Array(Gi);return Ve(j,E,R),j},e.box.after=e.secretbox,e.box.open=function(E,R,j,U){var V=e.box.before(j,U);return e.secretbox.open(E,R,V)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var E=new Uint8Array(ci),R=new Uint8Array(Lr);return rt(E,R),{publicKey:E,secretKey:R}},e.box.keyPair.fromSecretKey=function(E){if(Zt(E),E.length!==Lr)throw new Error("bad secret key size");var R=new Uint8Array(ci);return Be(R,E),{publicKey:R,secretKey:new Uint8Array(E)}},e.box.publicKeyLength=ci,e.box.secretKeyLength=Lr,e.box.sharedKeyLength=Gi,e.box.nonceLength=Ca,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(E,R){if(Zt(E,R),R.length!==Mn)throw new Error("bad secret key size");var j=new Uint8Array(Ct+E.length);return $i(j,E,E.length,R),j},e.sign.open=function(E,R){if(Zt(E,R),R.length!==qt)throw new Error("bad public key size");var j=new Uint8Array(E.length),U=Ea(j,E,E.length,R);if(U<0)return null;for(var V=new Uint8Array(U),Q=0;Q<V.length;Q++)V[Q]=j[Q];return V},e.sign.detached=function(E,R){for(var j=e.sign(E,R),U=new Uint8Array(Ct),V=0;V<U.length;V++)U[V]=j[V];return U},e.sign.detached.verify=function(E,R,j){if(Zt(E,R,j),R.length!==Ct)throw new Error("bad signature size");if(j.length!==qt)throw new Error("bad public key size");var U=new Uint8Array(Ct+E.length),V=new Uint8Array(Ct+E.length),Q;for(Q=0;Q<Ct;Q++)U[Q]=R[Q];for(Q=0;Q<E.length;Q++)U[Q+Ct]=E[Q];return Ea(V,U,U.length,j)>=0},e.sign.keyPair=function(){var E=new Uint8Array(qt),R=new Uint8Array(Mn);return gt(E,R),{publicKey:E,secretKey:R}},e.sign.keyPair.fromSecretKey=function(E){if(Zt(E),E.length!==Mn)throw new Error("bad secret key size");for(var R=new Uint8Array(qt),j=0;j<R.length;j++)R[j]=E[32+j];return{publicKey:R,secretKey:new Uint8Array(E)}},e.sign.keyPair.fromSeed=function(E){if(Zt(E),E.length!==Ji)throw new Error("bad seed size");for(var R=new Uint8Array(qt),j=new Uint8Array(Mn),U=0;U<32;U++)j[U]=E[U];return gt(R,j,!0),{publicKey:R,secretKey:j}},e.sign.publicKeyLength=qt,e.sign.secretKeyLength=Mn,e.sign.seedLength=Ji,e.sign.signatureLength=Ct,e.hash=function(E){Zt(E);var R=new Uint8Array(Aa);return Ie(R,E,E.length),R},e.hash.hashLength=Aa,e.verify=function(E,R){return Zt(E,R),E.length===0||R.length===0||E.length!==R.length?!1:I(E,0,R,0,E.length)===0},e.setPRNG=function(E){s=E},(function(){var E=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(E&&E.getRandomValues){var R=65536;e.setPRNG(function(j,U){var V,Q=new Uint8Array(U);for(V=0;V<U;V+=R)E.getRandomValues(Q.subarray(V,V+Math.min(U-V,R)));for(V=0;V<U;V++)j[V]=Q[V];vs(Q)})}else typeof require<"u"&&(E=require("crypto"),E&&E.randomBytes&&e.setPRNG(function(j,U){var V,Q=E.randomBytes(U);for(V=0;V<U;V++)j[V]=Q[V];vs(Q)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const du=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,V2={fromSeed:du.sign.keyPair.fromSeed,sign:du.sign.detached,verify:du.sign.detached.verify,randomBytes:du.randomBytes};let kx;function G2(e){kx=e}function Li(){return kx}const J2=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 Lu{static checksum(t){let r=0;for(let s=0;s<t.byteLength;s++){let l=t[s];r=r<<8&65535^J2[(r>>8^l)&255]}return r}static validate(t,r){return Lu.checksum(t)==r}}const Eh="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class N0{static encode(t){let r=0,s=0,l=new Uint8Array(t),u=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;u[c++]=Eh.charAt(d).charCodeAt(0),r-=5}if(r>0){let f=s<<5-r&31;u[c++]=Eh.charAt(f).charCodeAt(0)}return u.slice(0,c)}static decode(t){let r=0,s=0,l=0,u=new Uint8Array(t),c=new Uint8Array(u.byteLength*5/8|0);for(let f=0;f<u.byteLength;f++){let d=String.fromCharCode(u[f]),m=Eh.indexOf(d);if(m===-1)throw new Error("Illegal Base32 character: "+u[f]);s=s<<5|m,r+=5,r>=8&&(c[l++]=s>>>r-8&255,r-=8)}return c.slice(0,l)}}class kt 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 X2(){return Ku(_t.Operator)}function K2(){return Ku(_t.Account)}function Q2(){return Ku(_t.User)}var yt;(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"})(yt||(yt={}));var _t;(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"})(_t||(_t={}));class aa{static isValidPublicPrefix(t){return t==_t.Server||t==_t.Operator||t==_t.Cluster||t==_t.Account||t==_t.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 _t.Seed:return _t.Seed;case _t.Private:return _t.Private;case _t.Operator:return _t.Operator;case _t.Server:return _t.Server;case _t.Cluster:return _t.Cluster;case _t.Account:return _t.Account;case _t.User:return _t.User;default:return-1}}}class bn{static encode(t,r){if(!r||!(r instanceof Uint8Array))throw new kt(yt.SerializationError);if(!aa.isValidPrefix(t))throw new kt(yt.InvalidPrefixByte);return bn._encode(!1,t,r)}static encodeSeed(t,r){if(!r)throw new kt(yt.ApiError);if(!aa.isValidPublicPrefix(t))throw new kt(yt.InvalidPrefixByte);if(r.byteLength!==32)throw new kt(yt.InvalidSeedLen);return bn._encode(!0,t,r)}static decode(t,r){if(!aa.isValidPrefix(t))throw new kt(yt.InvalidPrefixByte);const s=bn._decode(r);if(s[0]!==t)throw new kt(yt.InvalidPrefixByte);return s.slice(1)}static decodeSeed(t){const r=bn._decode(t),s=bn._decodePrefix(r);if(s[0]!=_t.Seed)throw new kt(yt.InvalidSeed);if(!aa.isValidPublicPrefix(s[1]))throw new kt(yt.InvalidPrefixByte);return{buf:r.slice(2),prefix:s[1]}}static _encode(t,r,s){const l=t?2:1,u=s.byteLength,c=l+u+2,f=l+u,d=new Uint8Array(c);if(t){const g=bn._encodePrefix(_t.Seed,r);d.set(g)}else d[0]=r;d.set(s,l);const m=Lu.checksum(d.slice(0,f));return new DataView(d.buffer).setUint16(f,m,!0),N0.encode(d)}static _decode(t){if(t.byteLength<4)throw new kt(yt.InvalidEncoding);let r;try{r=N0.decode(t)}catch(f){throw new kt(yt.InvalidEncoding,f)}const s=r.byteLength-2,u=new DataView(r.buffer).getUint16(s,!0),c=r.slice(0,s);if(!Lu.validate(c,u))throw new kt(yt.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 Ex{constructor(t){C(this,"seed");this.seed=t}getRawSeed(){if(!this.seed)throw new kt(yt.ClearedPair);return bn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new kt(yt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new kt(yt.ClearedPair);const t=bn.decodeSeed(this.seed),r=Li().fromSeed(this.getRawSeed()),s=bn.encode(t.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new kt(yt.ClearedPair);const t=Li().fromSeed(this.getRawSeed());return bn.encode(_t.Private,t.secretKey)}sign(t){if(!this.seed)throw new kt(yt.ClearedPair);const r=Li().fromSeed(this.getRawSeed());return Li().sign(t,r.secretKey)}verify(t,r){if(!this.seed)throw new kt(yt.ClearedPair);const s=Li().fromSeed(this.getRawSeed());return Li().verify(t,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Ku(e){const t=Li().randomBytes(32);let r=bn.encodeSeed(e,new Uint8Array(t));return new Ex(r)}class Z2{constructor(t){C(this,"publicKey");this.publicKey=t}getPublicKey(){if(!this.publicKey)throw new kt(yt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new kt(yt.PublicKeyOnly):new kt(yt.ClearedPair)}getSeed(){throw this.publicKey?new kt(yt.PublicKeyOnly):new kt(yt.ClearedPair)}sign(t){throw this.publicKey?new kt(yt.CannotSign):new kt(yt.ClearedPair)}verify(t,r){if(!this.publicKey)throw new kt(yt.ClearedPair);let s=bn._decode(this.publicKey);return Li().verify(t,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function W2(e){const t=new TextEncoder().encode(e),r=bn._decode(t),s=aa.parsePrefix(r[0]);if(aa.isValidPublicPrefix(s))return new Z2(t);throw new kt(yt.InvalidPublicKey)}function ek(e){return bn.decodeSeed(e),new Ex(e)}function tk(e){return btoa(String.fromCharCode(...e))}function nk(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}G2(V2);const O0={createAccount:K2,createOperator:X2,createPair:Ku,createUser:Q2,fromPublic:W2,fromSeed:ek,NKeysError:kt,NKeysErrorCode:yt,Prefix:_t,decode:nk,encode:tk};function rk(e){return t=>{let r={};return e.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function ik(){return()=>{}}function sk(e,t){return()=>{const r=typeof e=="function"?e():e,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function ak(e){return()=>({auth_token:typeof e=="function"?e():e})}function lk(e){return t=>{const r=typeof e=="function"?e():e,s=r?O0.fromSeed(r):void 0,l=s?s.getPublicKey():"",u=Ii.encode(t||""),c=s!==void 0&&t?s.sign(u):void 0,f=c?O0.encode(c):"";return{nkey:l,sig:f}}}function Cx(e,t){return r=>{const s=typeof e=="function"?e():e,l=lk(t),{nkey:u,sig:c}=l(r);return{jwt:s,nkey:u,sig:c}}}const Ax=120*1e3,ok=2,Tx=2*1e3;function uk(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Ax,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Tx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function ck(e){const t=[];return typeof e.authenticator=="function"&&t.push(e.authenticator),Array.isArray(e.authenticator)&&t.push(...e.authenticator),e.token&&t.push(ak(e.token)),e.user&&t.push(sk(e.user,e.pass)),t.length===0?ik():rk(t)}function fk(e){const t=`${Wh}:${wx()}`;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",Ee.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${Wh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[t]);const r=Gu(uk(),e);if(r.authenticator=ck(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new De(`${s} option should be a function`,Ee.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{ni(r.inboxPrefix)}catch(s){throw new De(s.message,Ee.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof ad()=="function"),r.resolve&&typeof ad()!="function")throw new De("'resolve' is not supported on this client",Ee.InvalidOption);return r}function hk(e,t){const{proto:r,tls_required:s,tls_available:l}=e;if((r===void 0||r<1)&&t.noEcho)throw new De("noEcho",Ee.ServerOptionNotAvailable);const u=s||l||!1;if(t.tls&&!u)throw new De("tls",Ee.ServerOptionNotAvailable)}const dk=1024*32,mk=/^INFO\s+([^\r\n]+)\r\n/i,pk=Al(`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 x2="$JS.API";function v2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Gu({apiPrefix:x2,timeout:5e3},e)}class Yl{constructor(t,r){C(this,"nc");C(this,"opts");C(this,"prefix");C(this,"timeout");C(this,"jc");this.nc=t,this.opts=v2(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=kr()}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=Zn;r&&(l=this.jc.encode(r));let{retries:u}=s;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=Dd();for(let f=0;f<u;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<u)await _a(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=bx(s.error.code,s.error.description);if(l!==null)throw l.api_error=s.error,l}return r}}class Cl{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 gs(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 sd(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 ct;(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"})(ct||(ct={}));class w2{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=gs(t)),this.server=t,this.set(ct.JS_KV,"2.6.2"),this.set(ct.JS_OBJECTSTORE,"2.6.3"),this.set(ct.JS_PULL_MAX_BYTES,"2.8.3"),this.set(ct.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(ct.JS_ALLOW_DIRECT,"2.9.0"),this.set(ct.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(ct.JS_SIMPLIFICATION,"2.9.4"),this.set(ct.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(ct.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(ct.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(ct.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(ct.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(ct.JS_STREAM_COMPRESSION,"2.10.0"),this.set(ct.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(ct.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:sd(this.server,gs(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=gs(t)),sd(this.server,t)>=0}}class Mu extends Yl{constructor(t,r){super(t,r)}async add(t,r,s=Ru.Create){if(_n(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&&ua(l.config.durable_name);const u=this.nc;let{min:c,ok:f}=u.features.get(ct.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{Ju("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,y="";if(Array.isArray(r.filter_subjects)){const{min:x,ok:v}=u.features.get(ct.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}=u.features.get(ct.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(f&&(y=r.name??r.durable_name??""),y!==""){let x=r.filter_subject??void 0;x===">"&&(x=void 0),m=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${y}.${x}`:`${this.prefix}.CONSUMER.CREATE.${t}.${y}`}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),u=s;return this.add(t,Object.assign(l.config,u),Ru.Update)}async info(t,r){return _n(t),ua(r),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${r}`)}async delete(t,r){return _n(t),ua(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${r}`)).success}list(t){_n(t);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${t}`;return new Cl(s,r,this)}pause(t,r,s){const l=`${this.prefix}.CONSUMER.PAUSE.${t}.${r}`,u={pause_until:s.toISOString()};return this._request(l,u)}resume(t,r){return this.pause(t,r,new Date(0))}}function ta(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 S2 extends un{constructor(r,s,l){super();C(this,"sub");C(this,"adapter");C(this,"subIterDone");ta(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&ta(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(ta(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(ta(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(ta(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&ta(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,x)=>{const[v,S]=this.adapter(g,x);if(v){y(v,null);return}const{ingest:j}=this.ingestionFilterFn?this.ingestionFilterFn(S,this):{ingest:!0};j&&(!this.protocolFilterFn||this.protocolFilterFn(S))&&(y(v,S),this.dispatchedFn&&S&&this.dispatchedFn(S))}}const{max:c,queue:f,timeout:d}=l,m={queue:f,timeout:d,callback:u};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=Bt(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async y=>{await y.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,u]=this.adapter(r,s);l&&this.stop(l),u&&this.push(u)}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 Kn;function _2(e){Kn=e}function wx(){return Kn!==void 0&&Kn.defaultPort!==void 0?Kn.defaultPort:4222}function Sh(){return Kn!==void 0&&Kn.urlParseFn?Kn.urlParseFn:void 0}function k2(){if(!Kn||typeof Kn.factory!="function")throw new Error("transport fn is not set");return Kn.factory()}function ad(){return Kn!==void 0&&Kn.dnsResolveFn?Kn.dnsResolveFn:void 0}const _u=`\r
|
|
71
|
+
`,Du=ya.fromAscii(_u),E2=new Uint8Array(Du)[0],C2=new Uint8Array(Du)[1];function A2(e){for(let t=0;t<e.length;t++){const r=t+1;if(e.byteLength>r&&e[t]===E2&&e[r]===C2)return r+1}return 0}function j2(e){const t=A2(e);if(t>0){const s=new Uint8Array(e).slice(0,t);return Xn.decode(s)}return""}const T2=4,Sx=48,N2=65,O2=97;function R2(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 ld(e){return M2(e)!==void 0}function M2(e){for(let t=0;t<e.length;t++)switch(e[t]){case".":return _x(e);case":":return D2(e)}}function _x(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:u}=L2(e);if(!u||s>255)return;e=e.substring(l),t[r]=s}return R2(t[0],t[1],t[2],t[3])}function D2(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:u,ok:c}=z2(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&s!=12||s+4>16)return;const f=_x(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+=T2;break}if(t[s]=l>>8,t[s+1]=l,s+=2,e=e.substring(u),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 u=s-1;u>=r;u--)t[u+l]=t[u];for(let u=r+l-1;u>=r;u--)t[u]=0}else if(r>=0)return;return t}}function L2(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)-Sx),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 z2(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)-Sx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)t*=16,t+=e.charCodeAt(r)-O2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)t*=16,t+=e.charCodeAt(r)-N2+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 U2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function od(e){return!U2(e)}function B2(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 P2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=B2(e),od(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const t=od(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 u=l.hostname;return u.charAt(0)==="["&&(u=u.substring(1,u.length-1)),{listen:l.host,hostname:u,port:r}}class Tl{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=P2(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(ld(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 u=this.port===80?"https":"http",c=new URL(`${u}://${od(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new Tl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return t.randomize&&gx(r),this.resolves=r,r}}class H2{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=Sh();t&&(t.forEach(l=>{l=s?s(l):l,this.servers.push(new Tl(l))}),this.randomize&&(this.servers=gx(this.servers))),this.servers.length===0&&this.addServer(`${Wh}:${wx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();ld(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=Sh();t=s?s(t):t;const l=new Tl(t,r);ld(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 u=Sh(),c=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(d=>{d=u?u(d,r):d;const m=new Tl(d,!0);c.set(d,m)});const f=[];return this.servers.forEach((d,m)=>{const y=d.listen;d.gossiped&&this.currentServer.listen!==y&&c.get(y)===void 0&&f.push(m),c.delete(y)}),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 q2{constructor(){C(this,"baseInbox");C(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${ai(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(u=>u.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=yx(r)),l.resolver(t,r))}}}close(){const t=De.errorForCode(Ce.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class I2{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:oa.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=Bt();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 F2 extends Error{constructor(t){super(t),this.name="AssertionError"}}function $2(e,t="Assertion failed."){if(!e)throw new F2(t)}const A0=32*1024,_h=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 kh{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){$2(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(Vi.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>_h)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+t,_h));hu(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+t,_h)),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(A0);for(;;){const l=this.capacity-this.length<A0,u=l?s:new Uint8Array(this._buf.buffer,this.length),c=t.read(u);if(c===null)return r;l?this.write(u.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var kn;(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"})(kn||(kn={}));function j0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const Y2=48;class T0{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 Ne.M:case Ne.m:this.state=Te.OP_M,this.hdr=-1,this.ma=j0();break;case Ne.H:case Ne.h:this.state=Te.OP_H,this.hdr=0,this.ma=j0();break;case Ne.P:case Ne.p:this.state=Te.OP_P;break;case Ne.PLUS:this.state=Te.OP_PLUS;break;case Ne.MINUS:this.state=Te.OP_MINUS;break;case Ne.I:case Ne.i:this.state=Te.OP_I;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_H:switch(s){case Ne.M:case Ne.m:this.state=Te.OP_M;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_M:switch(s){case Ne.S:case Ne.s:this.state=Te.OP_MS;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MS:switch(s){case Ne.G:case Ne.g:this.state=Te.OP_MSG;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MSG:switch(s){case Ne.SPACE:case Ne.TAB:this.state=Te.OP_MSG_SPC;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MSG_SPC:switch(s){case Ne.SPACE:case Ne.TAB:continue;default:this.state=Te.MSG_ARG,this.as=r}break;case Te.MSG_ARG:switch(s){case Ne.CR:this.drop=1;break;case Ne.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:kn.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 u=t.length-r;u<l&&(l=u),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:kn.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 Ne.NL:this.drop=0,this.as=r+1,this.state=Te.OP_START;break;default:continue}break;case Te.OP_PLUS:switch(s){case Ne.O:case Ne.o:this.state=Te.OP_PLUS_O;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PLUS_O:switch(s){case Ne.K:case Ne.k:this.state=Te.OP_PLUS_OK;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PLUS_OK:switch(s){case Ne.NL:this.dispatcher.push({kind:kn.OK}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_MINUS:switch(s){case Ne.E:case Ne.e:this.state=Te.OP_MINUS_E;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_E:switch(s){case Ne.R:case Ne.r:this.state=Te.OP_MINUS_ER;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_ER:switch(s){case Ne.R:case Ne.r:this.state=Te.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_ERR:switch(s){case Ne.SPACE:case Ne.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 Ne.SPACE:case Ne.TAB:continue;default:this.state=Te.MINUS_ERR_ARG,this.as=r}break;case Te.MINUS_ERR_ARG:switch(s){case Ne.CR:this.drop=1;break;case Ne.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:kn.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 Ne.I:case Ne.i:this.state=Te.OP_PI;break;case Ne.O:case Ne.o:this.state=Te.OP_PO;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PO:switch(s){case Ne.N:case Ne.n:this.state=Te.OP_PON;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PON:switch(s){case Ne.G:case Ne.g:this.state=Te.OP_PONG;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PONG:switch(s){case Ne.NL:this.dispatcher.push({kind:kn.PONG}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_PI:switch(s){case Ne.N:case Ne.n:this.state=Te.OP_PIN;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PIN:switch(s){case Ne.G:case Ne.g:this.state=Te.OP_PING;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PING:switch(s){case Ne.NL:this.dispatcher.push({kind:kn.PING}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_I:switch(s){case Ne.N:case Ne.n:this.state=Te.OP_IN;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_IN:switch(s){case Ne.F:case Ne.f:this.state=Te.OP_INF;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_INF:switch(s){case Ne.O:case Ne.o:this.state=Te.OP_INFO;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_INFO:switch(s){case Ne.SPACE:case Ne.TAB:this.state=Te.OP_INFO_SPC;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_INFO_SPC:switch(s){case Ne.SPACE:case Ne.TAB:continue;default:this.state=Te.INFO_ARG,this.as=r}break;case Te.INFO_ARG:switch(s){case Ne.CR:this.drop=1;break;case Ne.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:kn.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 kh(t.subarray(this.as,r-this.drop))),this.state===Te.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new kh(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 kh(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 Ne.SPACE:case Ne.TAB:case Ne.CR:case Ne.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}: ${Xn.decode(t)}`)}processHeaderMsgArgs(t){const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case Ne.SPACE:case Ne.TAB:case Ne.CR:case Ne.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]-Y2)}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 Ne;(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"})(Ne||(Ne={}));(function(e){var t=function(E,R){this.hi=E|0,this.lo=R|0},r=function(E){var R,T=new Float64Array(16);if(E)for(R=0;R<E.length;R++)T[R]=E[R];return T},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),u=new Uint8Array(32);u[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]),y=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(E,R){return E<<R|E>>>32-R}function j(E,R){var T=E[R+3]&255;return T=T<<8|E[R+2]&255,T=T<<8|E[R+1]&255,T<<8|E[R+0]&255}function O(E,R){var T=E[R]<<24|E[R+1]<<16|E[R+2]<<8|E[R+3],U=E[R+4]<<24|E[R+5]<<16|E[R+6]<<8|E[R+7];return new t(T,U)}function M(E,R,T){var U;for(U=0;U<4;U++)E[R+U]=T&255,T>>>=8}function B(E,R,T){E[R]=T.hi>>24&255,E[R+1]=T.hi>>16&255,E[R+2]=T.hi>>8&255,E[R+3]=T.hi&255,E[R+4]=T.lo>>24&255,E[R+5]=T.lo>>16&255,E[R+6]=T.lo>>8&255,E[R+7]=T.lo&255}function I(E,R,T,U,V){var Q,pe=0;for(Q=0;Q<V;Q++)pe|=E[R+Q]^T[U+Q];return(1&pe-1>>>8)-1}function ee(E,R,T,U){return I(E,R,T,U,16)}function P(E,R,T,U){return I(E,R,T,U,32)}function D(E,R,T,U,V){var Q=new Uint32Array(16),pe=new Uint32Array(16),be=new Uint32Array(16),se=new Uint32Array(4),me,Le,We;for(me=0;me<4;me++)pe[5*me]=j(U,4*me),pe[1+me]=j(T,4*me),pe[6+me]=j(R,4*me),pe[11+me]=j(T,16+4*me);for(me=0;me<16;me++)be[me]=pe[me];for(me=0;me<20;me++){for(Le=0;Le<4;Le++){for(We=0;We<4;We++)se[We]=pe[(5*Le+4*We)%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),We=0;We<4;We++)Q[4*Le+(Le+We)%4]=se[We]}for(We=0;We<16;We++)pe[We]=Q[We]}if(V){for(me=0;me<16;me++)pe[me]=pe[me]+be[me]|0;for(me=0;me<4;me++)pe[5*me]=pe[5*me]-j(U,4*me)|0,pe[6+me]=pe[6+me]-j(R,4*me)|0;for(me=0;me<4;me++)M(E,4*me,pe[5*me]),M(E,16+4*me,pe[6+me])}else for(me=0;me<16;me++)M(E,4*me,pe[me]+be[me]|0)}function Z(E,R,T,U){return D(E,R,T,U,!1),0}function F(E,R,T,U){return D(E,R,T,U,!0),0}var $=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function L(E,R,T,U,V,Q,pe){var be=new Uint8Array(16),se=new Uint8Array(64),me,Le;if(!V)return 0;for(Le=0;Le<16;Le++)be[Le]=0;for(Le=0;Le<8;Le++)be[Le]=Q[Le];for(;V>=64;){for(Z(se,be,pe,$),Le=0;Le<64;Le++)E[R+Le]=(T?T[U+Le]:0)^se[Le];for(me=1,Le=8;Le<16;Le++)me=me+(be[Le]&255)|0,be[Le]=me&255,me>>>=8;V-=64,R+=64,T&&(U+=64)}if(V>0)for(Z(se,be,pe,$),Le=0;Le<V;Le++)E[R+Le]=(T?T[U+Le]:0)^se[Le];return 0}function J(E,R,T,U,V){return L(E,R,null,0,T,U,V)}function G(E,R,T,U,V){var Q=new Uint8Array(32);return F(Q,U,V,$),J(E,R,T,U.subarray(16),Q)}function ce(E,R,T,U,V,Q,pe){var be=new Uint8Array(32);return F(be,Q,pe,$),L(E,R,T,U,V,Q.subarray(16),be)}function ue(E,R){var T,U=0;for(T=0;T<17;T++)U=U+(E[T]+R[T]|0)|0,E[T]=U&255,U>>>=8}var re=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function q(E,R,T,U,V,Q){var pe,be,se,me,Le=new Uint32Array(17),We=new Uint32Array(17),Rt=new Uint32Array(17),yn=new Uint32Array(17),yr=new Uint32Array(17);for(se=0;se<17;se++)We[se]=Rt[se]=0;for(se=0;se<16;se++)We[se]=Q[se];for(We[3]&=15,We[4]&=252,We[7]&=15,We[8]&=252,We[11]&=15,We[12]&=252,We[15]&=15;V>0;){for(se=0;se<17;se++)yn[se]=0;for(se=0;se<16&&se<V;++se)yn[se]=T[U+se];for(yn[se]=1,U+=se,V-=se,ue(Rt,yn),be=0;be<17;be++)for(Le[be]=0,se=0;se<17;se++)Le[be]=Le[be]+Rt[se]*(se<=be?We[be-se]:320*We[be+17-se]|0)|0|0;for(be=0;be<17;be++)Rt[be]=Le[be];for(me=0,se=0;se<16;se++)me=me+Rt[se]|0,Rt[se]=me&255,me>>>=8;for(me=me+Rt[16]|0,Rt[16]=me&3,me=5*(me>>>2)|0,se=0;se<16;se++)me=me+Rt[se]|0,Rt[se]=me&255,me>>>=8;me=me+Rt[16]|0,Rt[16]=me}for(se=0;se<17;se++)yr[se]=Rt[se];for(ue(Rt,re),pe=-(Rt[16]>>>7)|0,se=0;se<17;se++)Rt[se]^=pe&(yr[se]^Rt[se]);for(se=0;se<16;se++)yn[se]=Q[se+16];for(yn[16]=0,ue(Rt,yn),se=0;se<16;se++)E[R+se]=Rt[se];return 0}function Y(E,R,T,U,V,Q){var pe=new Uint8Array(16);return q(pe,0,T,U,V,Q),ee(E,R,pe,0)}function ae(E,R,T,U,V){var Q;if(T<32)return-1;for(ce(E,0,R,0,T,U,V),q(E,16,E,32,T-32,E),Q=0;Q<16;Q++)E[Q]=0;return 0}function ve(E,R,T,U,V){var Q,pe=new Uint8Array(32);if(T<32||(G(pe,0,32,U,V),Y(R,16,R,32,T-32,pe)!==0))return-1;for(ce(E,0,R,0,T,U,V),Q=0;Q<32;Q++)E[Q]=0;return 0}function N(E,R){var T;for(T=0;T<16;T++)E[T]=R[T]|0}function z(E){var R,T;for(T=0;T<16;T++)E[T]+=65536,R=Math.floor(E[T]/65536),E[(T+1)*(T<15?1:0)]+=R-1+37*(R-1)*(T===15?1:0),E[T]-=R*65536}function W(E,R,T){for(var U,V=~(T-1),Q=0;Q<16;Q++)U=V&(E[Q]^R[Q]),E[Q]^=U,R[Q]^=U}function _(E,R){var T,U,V,Q=r(),pe=r();for(T=0;T<16;T++)pe[T]=R[T];for(z(pe),z(pe),z(pe),U=0;U<2;U++){for(Q[0]=pe[0]-65517,T=1;T<15;T++)Q[T]=pe[T]-65535-(Q[T-1]>>16&1),Q[T-1]&=65535;Q[15]=pe[15]-32767-(Q[14]>>16&1),V=Q[15]>>16&1,Q[14]&=65535,W(pe,Q,1-V)}for(T=0;T<16;T++)E[2*T]=pe[T]&255,E[2*T+1]=pe[T]>>8}function ye(E,R){var T=new Uint8Array(32),U=new Uint8Array(32);return _(T,E),_(U,R),P(T,0,U,0)}function je(E){var R=new Uint8Array(32);return _(R,E),R[0]&1}function Se(E,R){var T;for(T=0;T<16;T++)E[T]=R[2*T]+(R[2*T+1]<<8);E[15]&=32767}function Me(E,R,T){var U;for(U=0;U<16;U++)E[U]=R[U]+T[U]|0}function Ve(E,R,T){var U;for(U=0;U<16;U++)E[U]=R[U]-T[U]|0}function Ae(E,R,T){var U,V,Q=new Float64Array(31);for(U=0;U<31;U++)Q[U]=0;for(U=0;U<16;U++)for(V=0;V<16;V++)Q[U+V]+=R[U]*T[V];for(U=0;U<15;U++)Q[U]+=38*Q[U+16];for(U=0;U<16;U++)E[U]=Q[U];z(E),z(E)}function ot(E,R){Ae(E,R,R)}function kt(E,R){var T=r(),U;for(U=0;U<16;U++)T[U]=R[U];for(U=253;U>=0;U--)ot(T,T),U!==2&&U!==4&&Ae(T,T,R);for(U=0;U<16;U++)E[U]=T[U]}function an(E,R){var T=r(),U;for(U=0;U<16;U++)T[U]=R[U];for(U=250;U>=0;U--)ot(T,T),U!==1&&Ae(T,T,R);for(U=0;U<16;U++)E[U]=T[U]}function Lt(E,R,T){var U=new Uint8Array(32),V=new Float64Array(80),Q,pe,be=r(),se=r(),me=r(),Le=r(),We=r(),Rt=r();for(pe=0;pe<31;pe++)U[pe]=R[pe];for(U[31]=R[31]&127|64,U[0]&=248,Se(V,T),pe=0;pe<16;pe++)se[pe]=V[pe],Le[pe]=be[pe]=me[pe]=0;for(be[0]=Le[0]=1,pe=254;pe>=0;--pe)Q=U[pe>>>3]>>>(pe&7)&1,W(be,se,Q),W(me,Le,Q),Me(We,be,me),Ve(be,be,me),Me(me,se,Le),Ve(se,se,Le),ot(Le,We),ot(Rt,be),Ae(be,me,be),Ae(me,se,We),Me(We,be,me),Ve(be,be,me),ot(se,be),Ve(me,Le,Rt),Ae(be,me,d),Me(be,be,Le),Ae(me,me,be),Ae(be,Le,Rt),Ae(Le,se,V),ot(se,We),W(be,se,Q),W(me,Le,Q);for(pe=0;pe<16;pe++)V[pe+16]=be[pe],V[pe+32]=me[pe],V[pe+48]=se[pe],V[pe+64]=Le[pe];var yn=V.subarray(32),yr=V.subarray(16);return kt(yn,yn),Ae(yr,yr,yn),_(E,yr),0}function Ie(E,R){return Lt(E,R,u)}function et(E,R){return s(R,32),Ie(E,R)}function qe(E,R,T){var U=new Uint8Array(32);return Lt(U,T,R),F(E,l,U,$)}var jt=ae,gt=ve;function zn(E,R,T,U,V,Q){var pe=new Uint8Array(32);return qe(pe,V,Q),jt(E,R,T,U,pe)}function qt(E,R,T,U,V,Q){var pe=new Uint8Array(32);return qe(pe,V,Q),gt(E,R,T,U,pe)}function nn(){var E=0,R=0,T=0,U=0,V=65535,Q,pe,be;for(be=0;be<arguments.length;be++)Q=arguments[be].lo,pe=arguments[be].hi,E+=Q&V,R+=Q>>>16,T+=pe&V,U+=pe>>>16;return R+=E>>>16,T+=R>>>16,U+=T>>>16,new t(T&V|U<<16,E&V|R<<16)}function pn(E,R){return new t(E.hi>>>R,E.lo>>>R|E.hi<<32-R)}function Un(){var E=0,R=0,T;for(T=0;T<arguments.length;T++)E^=arguments[T].lo,R^=arguments[T].hi;return new t(R,E)}function dt(E,R){var T,U,V=32-R;return R<32?(T=E.hi>>>R|E.lo<<V,U=E.lo>>>R|E.hi<<V):R<64&&(T=E.lo>>>R|E.hi<<V,U=E.hi>>>R|E.lo<<V),new t(T,U)}function Xt(E,R,T){var U=E.hi&R.hi^~E.hi&T.hi,V=E.lo&R.lo^~E.lo&T.lo;return new t(U,V)}function fe(E,R,T){var U=E.hi&R.hi^E.hi&T.hi^R.hi&T.hi,V=E.lo&R.lo^E.lo&T.lo^R.lo&T.lo;return new t(U,V)}function _e(E){return Un(dt(E,28),dt(E,34),dt(E,39))}function Pe(E){return Un(dt(E,14),dt(E,18),dt(E,41))}function Je(E){return Un(dt(E,1),dt(E,8),pn(E,7))}function it(E){return Un(dt(E,19),dt(E,61),pn(E,6))}var Kt=[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 cn(E,R,T){var U=[],V=[],Q=[],pe=[],be,se,me;for(se=0;se<8;se++)U[se]=Q[se]=O(E,8*se);for(var Le=0;T>=128;){for(se=0;se<16;se++)pe[se]=O(R,8*se+Le);for(se=0;se<80;se++){for(me=0;me<8;me++)V[me]=Q[me];for(be=nn(Q[7],Pe(Q[4]),Xt(Q[4],Q[5],Q[6]),Kt[se],pe[se%16]),V[7]=nn(be,_e(Q[0]),fe(Q[0],Q[1],Q[2])),V[3]=nn(V[3],be),me=0;me<8;me++)Q[(me+1)%8]=V[me];if(se%16===15)for(me=0;me<16;me++)pe[me]=nn(pe[me],pe[(me+9)%16],Je(pe[(me+1)%16]),it(pe[(me+14)%16]))}for(se=0;se<8;se++)Q[se]=nn(Q[se],U[se]),U[se]=Q[se];Le+=128,T-=128}for(se=0;se<8;se++)B(E,8*se,U[se]);return T}var xe=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 ke(E,R,T){var U=new Uint8Array(64),V=new Uint8Array(256),Q,pe=T;for(Q=0;Q<64;Q++)U[Q]=xe[Q];for(cn(U,R,T),T%=128,Q=0;Q<256;Q++)V[Q]=0;for(Q=0;Q<T;Q++)V[Q]=R[pe-T+Q];for(V[T]=128,T=256-128*(T<112?1:0),V[T-9]=0,B(V,T-8,new t(pe/536870912|0,pe<<3)),cn(U,V,T),Q=0;Q<64;Q++)E[Q]=U[Q];return 0}function Be(E,R){var T=r(),U=r(),V=r(),Q=r(),pe=r(),be=r(),se=r(),me=r(),Le=r();Ve(T,E[1],E[0]),Ve(Le,R[1],R[0]),Ae(T,T,Le),Me(U,E[0],E[1]),Me(Le,R[0],R[1]),Ae(U,U,Le),Ae(V,E[3],R[3]),Ae(V,V,y),Ae(Q,E[2],R[2]),Me(Q,Q,Q),Ve(pe,U,T),Ve(be,Q,V),Me(se,Q,V),Me(me,U,T),Ae(E[0],pe,be),Ae(E[1],me,se),Ae(E[2],se,be),Ae(E[3],pe,me)}function Oe(E,R,T){var U;for(U=0;U<4;U++)W(E[U],R[U],T)}function oe(E,R){var T=r(),U=r(),V=r();kt(V,R[2]),Ae(T,R[0],V),Ae(U,R[1],V),_(E,U),E[31]^=je(T)<<7}function Re(E,R,T){var U,V;for(N(E[0],c),N(E[1],f),N(E[2],f),N(E[3],c),V=255;V>=0;--V)U=T[V/8|0]>>(V&7)&1,Oe(E,R,U),Be(R,E),Be(E,E),Oe(E,R,U)}function Ee(E,R){var T=[r(),r(),r(),r()];N(T[0],g),N(T[1],x),N(T[2],f),Ae(T[3],g,x),Re(E,T,R)}function Ue(E,R,T){var U=new Uint8Array(64),V=[r(),r(),r(),r()],Q;for(T||s(R,32),ke(U,R,32),U[0]&=248,U[31]&=127,U[31]|=64,Ee(V,U),oe(E,V),Q=0;Q<32;Q++)R[Q+32]=E[Q];return 0}var Xe=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 Tt(E,R){var T,U,V,Q;for(U=63;U>=32;--U){for(T=0,V=U-32,Q=U-12;V<Q;++V)R[V]+=T-16*R[U]*Xe[V-(U-32)],T=Math.floor((R[V]+128)/256),R[V]-=T*256;R[V]+=T,R[U]=0}for(T=0,V=0;V<32;V++)R[V]+=T-(R[31]>>4)*Xe[V],T=R[V]>>8,R[V]&=255;for(V=0;V<32;V++)R[V]-=T*Xe[V];for(U=0;U<32;U++)R[U+1]+=R[U]>>8,E[U]=R[U]&255}function Nt(E){var R=new Float64Array(64),T;for(T=0;T<64;T++)R[T]=E[T];for(T=0;T<64;T++)E[T]=0;Tt(E,R)}function Yt(E,R,T,U){var V=new Uint8Array(64),Q=new Uint8Array(64),pe=new Uint8Array(64),be,se,me=new Float64Array(64),Le=[r(),r(),r(),r()];ke(V,U,32),V[0]&=248,V[31]&=127,V[31]|=64;var We=T+64;for(be=0;be<T;be++)E[64+be]=R[be];for(be=0;be<32;be++)E[32+be]=V[32+be];for(ke(pe,E.subarray(32),T+32),Nt(pe),Ee(Le,pe),oe(E,Le),be=32;be<64;be++)E[be]=U[be];for(ke(Q,E,T+64),Nt(Q),be=0;be<64;be++)me[be]=0;for(be=0;be<32;be++)me[be]=pe[be];for(be=0;be<32;be++)for(se=0;se<32;se++)me[be+se]+=Q[be]*V[se];return Tt(E.subarray(32),me),We}function gn(E,R){var T=r(),U=r(),V=r(),Q=r(),pe=r(),be=r(),se=r();return N(E[2],f),Se(E[1],R),ot(V,E[1]),Ae(Q,V,m),Ve(V,V,E[2]),Me(Q,E[2],Q),ot(pe,Q),ot(be,pe),Ae(se,be,pe),Ae(T,se,V),Ae(T,T,Q),an(T,T),Ae(T,T,V),Ae(T,T,Q),Ae(T,T,Q),Ae(E[0],T,Q),ot(U,E[0]),Ae(U,U,Q),ye(U,V)&&Ae(E[0],E[0],v),ot(U,E[0]),Ae(U,U,Q),ye(U,V)?-1:(je(E[0])===R[31]>>7&&Ve(E[0],c,E[0]),Ae(E[3],E[0],E[1]),0)}function fi(E,R,T,U){var V,Q=new Uint8Array(32),pe=new Uint8Array(64),be=[r(),r(),r(),r()],se=[r(),r(),r(),r()];if(T<64||gn(se,U))return-1;for(V=0;V<T;V++)E[V]=R[V];for(V=0;V<32;V++)E[V+32]=U[V];if(ke(pe,E,T),Nt(pe),Re(be,se,pe),Ee(se,R.subarray(32)),Be(be,se),oe(Q,be),T-=64,P(R,0,Q,0)){for(V=0;V<T;V++)E[V]=0;return-1}for(V=0;V<T;V++)E[V]=R[V+64];return T}var Ht=32,pr=24,gr=32,hi=16,di=32,Ji=32,mi=32,Pr=32,Xi=32,Ca=pr,Kl=gr,jr=hi,Et=64,It=32,Bn=64,Ki=32,Aa=64;e.lowlevel={crypto_core_hsalsa20:F,crypto_stream_xor:ce,crypto_stream:G,crypto_stream_salsa20_xor:L,crypto_stream_salsa20:J,crypto_onetimeauth:q,crypto_onetimeauth_verify:Y,crypto_verify_16:ee,crypto_verify_32:P,crypto_secretbox:ae,crypto_secretbox_open:ve,crypto_scalarmult:Lt,crypto_scalarmult_base:Ie,crypto_box_beforenm:qe,crypto_box_afternm:jt,crypto_box:zn,crypto_box_open:qt,crypto_box_keypair:et,crypto_hash:ke,crypto_sign:Yt,crypto_sign_keypair:Ue,crypto_sign_open:fi,crypto_secretbox_KEYBYTES:Ht,crypto_secretbox_NONCEBYTES:pr,crypto_secretbox_ZEROBYTES:gr,crypto_secretbox_BOXZEROBYTES:hi,crypto_scalarmult_BYTES:di,crypto_scalarmult_SCALARBYTES:Ji,crypto_box_PUBLICKEYBYTES:mi,crypto_box_SECRETKEYBYTES:Pr,crypto_box_BEFORENMBYTES:Xi,crypto_box_NONCEBYTES:Ca,crypto_box_ZEROBYTES:Kl,crypto_box_BOXZEROBYTES:jr,crypto_sign_BYTES:Et,crypto_sign_PUBLICKEYBYTES:It,crypto_sign_SECRETKEYBYTES:Bn,crypto_sign_SEEDBYTES:Ki,crypto_hash_BYTES:Aa,gf:r,D:m,L:Xe,pack25519:_,unpack25519:Se,M:Ae,A:Me,S:ot,Z:Ve,pow2523:an,add:Be,set25519:N,modL:Tt,scalarmult:Re,scalarbase:Ee};function Ql(E,R){if(E.length!==Ht)throw new Error("bad key size");if(R.length!==pr)throw new Error("bad nonce size")}function Zl(E,R){if(E.length!==mi)throw new Error("bad public key size");if(R.length!==Pr)throw new Error("bad secret key size")}function rn(){for(var E=0;E<arguments.length;E++)if(!(arguments[E]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ws(E){for(var R=0;R<E.length;R++)E[R]=0}e.randomBytes=function(E){var R=new Uint8Array(E);return s(R,E),R},e.secretbox=function(E,R,T){rn(E,R,T),Ql(T,R);for(var U=new Uint8Array(gr+E.length),V=new Uint8Array(U.length),Q=0;Q<E.length;Q++)U[Q+gr]=E[Q];return ae(V,U,U.length,R,T),V.subarray(hi)},e.secretbox.open=function(E,R,T){rn(E,R,T),Ql(T,R);for(var U=new Uint8Array(hi+E.length),V=new Uint8Array(U.length),Q=0;Q<E.length;Q++)U[Q+hi]=E[Q];return U.length<32||ve(V,U,U.length,R,T)!==0?null:V.subarray(gr)},e.secretbox.keyLength=Ht,e.secretbox.nonceLength=pr,e.secretbox.overheadLength=hi,e.scalarMult=function(E,R){if(rn(E,R),E.length!==Ji)throw new Error("bad n size");if(R.length!==di)throw new Error("bad p size");var T=new Uint8Array(di);return Lt(T,E,R),T},e.scalarMult.base=function(E){if(rn(E),E.length!==Ji)throw new Error("bad n size");var R=new Uint8Array(di);return Ie(R,E),R},e.scalarMult.scalarLength=Ji,e.scalarMult.groupElementLength=di,e.box=function(E,R,T,U){var V=e.box.before(T,U);return e.secretbox(E,R,V)},e.box.before=function(E,R){rn(E,R),Zl(E,R);var T=new Uint8Array(Xi);return qe(T,E,R),T},e.box.after=e.secretbox,e.box.open=function(E,R,T,U){var V=e.box.before(T,U);return e.secretbox.open(E,R,V)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var E=new Uint8Array(mi),R=new Uint8Array(Pr);return et(E,R),{publicKey:E,secretKey:R}},e.box.keyPair.fromSecretKey=function(E){if(rn(E),E.length!==Pr)throw new Error("bad secret key size");var R=new Uint8Array(mi);return Ie(R,E),{publicKey:R,secretKey:new Uint8Array(E)}},e.box.publicKeyLength=mi,e.box.secretKeyLength=Pr,e.box.sharedKeyLength=Xi,e.box.nonceLength=Ca,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(E,R){if(rn(E,R),R.length!==Bn)throw new Error("bad secret key size");var T=new Uint8Array(Et+E.length);return Yt(T,E,E.length,R),T},e.sign.open=function(E,R){if(rn(E,R),R.length!==It)throw new Error("bad public key size");var T=new Uint8Array(E.length),U=fi(T,E,E.length,R);if(U<0)return null;for(var V=new Uint8Array(U),Q=0;Q<V.length;Q++)V[Q]=T[Q];return V},e.sign.detached=function(E,R){for(var T=e.sign(E,R),U=new Uint8Array(Et),V=0;V<U.length;V++)U[V]=T[V];return U},e.sign.detached.verify=function(E,R,T){if(rn(E,R,T),R.length!==Et)throw new Error("bad signature size");if(T.length!==It)throw new Error("bad public key size");var U=new Uint8Array(Et+E.length),V=new Uint8Array(Et+E.length),Q;for(Q=0;Q<Et;Q++)U[Q]=R[Q];for(Q=0;Q<E.length;Q++)U[Q+Et]=E[Q];return fi(V,U,U.length,T)>=0},e.sign.keyPair=function(){var E=new Uint8Array(It),R=new Uint8Array(Bn);return Ue(E,R),{publicKey:E,secretKey:R}},e.sign.keyPair.fromSecretKey=function(E){if(rn(E),E.length!==Bn)throw new Error("bad secret key size");for(var R=new Uint8Array(It),T=0;T<R.length;T++)R[T]=E[32+T];return{publicKey:R,secretKey:new Uint8Array(E)}},e.sign.keyPair.fromSeed=function(E){if(rn(E),E.length!==Ki)throw new Error("bad seed size");for(var R=new Uint8Array(It),T=new Uint8Array(Bn),U=0;U<32;U++)T[U]=E[U];return Ue(R,T,!0),{publicKey:R,secretKey:T}},e.sign.publicKeyLength=It,e.sign.secretKeyLength=Bn,e.sign.seedLength=Ki,e.sign.signatureLength=Et,e.hash=function(E){rn(E);var R=new Uint8Array(Aa);return ke(R,E,E.length),R},e.hash.hashLength=Aa,e.verify=function(E,R){return rn(E,R),E.length===0||R.length===0||E.length!==R.length?!1:I(E,0,R,0,E.length)===0},e.setPRNG=function(E){s=E},(function(){var E=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(E&&E.getRandomValues){var R=65536;e.setPRNG(function(T,U){var V,Q=new Uint8Array(U);for(V=0;V<U;V+=R)E.getRandomValues(Q.subarray(V,V+Math.min(U-V,R)));for(V=0;V<U;V++)T[V]=Q[V];ws(Q)})}else typeof require<"u"&&(E=require("crypto"),E&&E.randomBytes&&e.setPRNG(function(T,U){var V,Q=E.randomBytes(U);for(V=0;V<U;V++)T[V]=Q[V];ws(Q)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const du=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,V2={fromSeed:du.sign.keyPair.fromSeed,sign:du.sign.detached,verify:du.sign.detached.verify,randomBytes:du.randomBytes};let kx;function G2(e){kx=e}function Pi(){return kx}const J2=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 Lu{static checksum(t){let r=0;for(let s=0;s<t.byteLength;s++){let l=t[s];r=r<<8&65535^J2[(r>>8^l)&255]}return r}static validate(t,r){return Lu.checksum(t)==r}}const Eh="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class N0{static encode(t){let r=0,s=0,l=new Uint8Array(t),u=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;u[c++]=Eh.charAt(d).charCodeAt(0),r-=5}if(r>0){let f=s<<5-r&31;u[c++]=Eh.charAt(f).charCodeAt(0)}return u.slice(0,c)}static decode(t){let r=0,s=0,l=0,u=new Uint8Array(t),c=new Uint8Array(u.byteLength*5/8|0);for(let f=0;f<u.byteLength;f++){let d=String.fromCharCode(u[f]),m=Eh.indexOf(d);if(m===-1)throw new Error("Illegal Base32 character: "+u[f]);s=s<<5|m,r+=5,r>=8&&(c[l++]=s>>>r-8&255,r-=8)}return c.slice(0,l)}}class _t 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 X2(){return Ku(St.Operator)}function K2(){return Ku(St.Account)}function Q2(){return Ku(St.User)}var pt;(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"})(pt||(pt={}));var St;(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"})(St||(St={}));class la{static isValidPublicPrefix(t){return t==St.Server||t==St.Operator||t==St.Cluster||t==St.Account||t==St.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 St.Seed:return St.Seed;case St.Private:return St.Private;case St.Operator:return St.Operator;case St.Server:return St.Server;case St.Cluster:return St.Cluster;case St.Account:return St.Account;case St.User:return St.User;default:return-1}}}class En{static encode(t,r){if(!r||!(r instanceof Uint8Array))throw new _t(pt.SerializationError);if(!la.isValidPrefix(t))throw new _t(pt.InvalidPrefixByte);return En._encode(!1,t,r)}static encodeSeed(t,r){if(!r)throw new _t(pt.ApiError);if(!la.isValidPublicPrefix(t))throw new _t(pt.InvalidPrefixByte);if(r.byteLength!==32)throw new _t(pt.InvalidSeedLen);return En._encode(!0,t,r)}static decode(t,r){if(!la.isValidPrefix(t))throw new _t(pt.InvalidPrefixByte);const s=En._decode(r);if(s[0]!==t)throw new _t(pt.InvalidPrefixByte);return s.slice(1)}static decodeSeed(t){const r=En._decode(t),s=En._decodePrefix(r);if(s[0]!=St.Seed)throw new _t(pt.InvalidSeed);if(!la.isValidPublicPrefix(s[1]))throw new _t(pt.InvalidPrefixByte);return{buf:r.slice(2),prefix:s[1]}}static _encode(t,r,s){const l=t?2:1,u=s.byteLength,c=l+u+2,f=l+u,d=new Uint8Array(c);if(t){const g=En._encodePrefix(St.Seed,r);d.set(g)}else d[0]=r;d.set(s,l);const m=Lu.checksum(d.slice(0,f));return new DataView(d.buffer).setUint16(f,m,!0),N0.encode(d)}static _decode(t){if(t.byteLength<4)throw new _t(pt.InvalidEncoding);let r;try{r=N0.decode(t)}catch(f){throw new _t(pt.InvalidEncoding,f)}const s=r.byteLength-2,u=new DataView(r.buffer).getUint16(s,!0),c=r.slice(0,s);if(!Lu.validate(c,u))throw new _t(pt.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 Ex{constructor(t){C(this,"seed");this.seed=t}getRawSeed(){if(!this.seed)throw new _t(pt.ClearedPair);return En.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new _t(pt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new _t(pt.ClearedPair);const t=En.decodeSeed(this.seed),r=Pi().fromSeed(this.getRawSeed()),s=En.encode(t.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new _t(pt.ClearedPair);const t=Pi().fromSeed(this.getRawSeed());return En.encode(St.Private,t.secretKey)}sign(t){if(!this.seed)throw new _t(pt.ClearedPair);const r=Pi().fromSeed(this.getRawSeed());return Pi().sign(t,r.secretKey)}verify(t,r){if(!this.seed)throw new _t(pt.ClearedPair);const s=Pi().fromSeed(this.getRawSeed());return Pi().verify(t,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Ku(e){const t=Pi().randomBytes(32);let r=En.encodeSeed(e,new Uint8Array(t));return new Ex(r)}class Z2{constructor(t){C(this,"publicKey");this.publicKey=t}getPublicKey(){if(!this.publicKey)throw new _t(pt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new _t(pt.PublicKeyOnly):new _t(pt.ClearedPair)}getSeed(){throw this.publicKey?new _t(pt.PublicKeyOnly):new _t(pt.ClearedPair)}sign(t){throw this.publicKey?new _t(pt.CannotSign):new _t(pt.ClearedPair)}verify(t,r){if(!this.publicKey)throw new _t(pt.ClearedPair);let s=En._decode(this.publicKey);return Pi().verify(t,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function W2(e){const t=new TextEncoder().encode(e),r=En._decode(t),s=la.parsePrefix(r[0]);if(la.isValidPublicPrefix(s))return new Z2(t);throw new _t(pt.InvalidPublicKey)}function ek(e){return En.decodeSeed(e),new Ex(e)}function tk(e){return btoa(String.fromCharCode(...e))}function nk(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}G2(V2);const O0={createAccount:K2,createOperator:X2,createPair:Ku,createUser:Q2,fromPublic:W2,fromSeed:ek,NKeysError:_t,NKeysErrorCode:pt,Prefix:St,decode:nk,encode:tk};function rk(e){return t=>{let r={};return e.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function ik(){return()=>{}}function sk(e,t){return()=>{const r=typeof e=="function"?e():e,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function ak(e){return()=>({auth_token:typeof e=="function"?e():e})}function lk(e){return t=>{const r=typeof e=="function"?e():e,s=r?O0.fromSeed(r):void 0,l=s?s.getPublicKey():"",u=Vi.encode(t||""),c=s!==void 0&&t?s.sign(u):void 0,f=c?O0.encode(c):"";return{nkey:l,sig:f}}}function Cx(e,t){return r=>{const s=typeof e=="function"?e():e,l=lk(t),{nkey:u,sig:c}=l(r);return{jwt:s,nkey:u,sig:c}}}const Ax=120*1e3,ok=2,jx=2*1e3;function uk(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Ax,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:jx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function ck(e){const t=[];return typeof e.authenticator=="function"&&t.push(e.authenticator),Array.isArray(e.authenticator)&&t.push(...e.authenticator),e.token&&t.push(ak(e.token)),e.user&&t.push(sk(e.user,e.pass)),t.length===0?ik():rk(t)}function fk(e){const t=`${Wh}:${wx()}`;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=[`${Wh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[t]);const r=Gu(uk(),e);if(r.authenticator=ck(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{ai(r.inboxPrefix)}catch(s){throw new De(s.message,Ce.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof ad()=="function"),r.resolve&&typeof ad()!="function")throw new De("'resolve' is not supported on this client",Ce.InvalidOption);return r}function hk(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 u=s||l||!1;if(t.tls&&!u)throw new De("tls",Ce.ServerOptionNotAvailable)}const dk=1024*32,mk=/^INFO\s+([^\r\n]+)\r\n/i,pk=Al(`PONG\r
|
|
72
72
|
`),R0=Al(`PING\r
|
|
73
|
-
`);class gk{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):{})||{};Gu(this,l)}}class jx extends sn{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");Gu(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Bt();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=ma(l.timeout,u),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}),u=r.protocolFilterFn?r.protocolFilterFn:()=>!0,c=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(f,d)=>{const{ingest:m}=l(d);m&&u(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(Ee.ConnectionClosed)):this.isClosed()?Promise.reject(De.errorForCode(Ee.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Bt()).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 yk{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(u=>u.subject===r.subject&&u.queue===r.queue)),r.operation==="publish"&&(l=s.find(u=>u.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 zu{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=dk,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new yk,this.muxSubscriptions=new q2,this.outbound=new ga,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new w2({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new H2(s,{randomize:!t.noRandomize}),this.closed=Bt(),this.parser=new j0(this),this.heartbeats=new I2(this,this.options.pingInterval||Ax,this.options.maxPingOut||ok)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const r=De.errorForCode(Ee.Disconnect);r.stack="",t.forEach(s=>{s.reject(r)}),this.parser=new j0(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(r=>{r.push(t)})}status(){const t=new sn;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=Bt();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=k2(),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:la.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:la.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:ei.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:ei.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===Ee.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=ma(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,s]),(async()=>{try{for await(const u of this.transport)this.parser.parse(u)}catch(u){console.log("reader closed",u)}})().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:ad(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of s)try{l=null,this.dispatchStatus({type:la.Reconnecting,data:u.toString()}),await this.dial(u);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():Tx;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:De.errorForCode(Ee.ConnectionRefused));const u=Date.now();if(l.lastConnect===0||l.lastConnect+r<=u){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-u),await Sa(s)}}static async connect(t,r){const s=new zu(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,Ee.PermissionsViolation),l=t.match(/(Publish|Subscription) to "(\S+)"/);if(l){s.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const u=t.match(/using queue "(\S+)"/);u&&(s.permissionContext.queue=u[1])}return s}else return r.indexOf("authorization violation")!==-1?new De(t,Ee.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new De(t,Ee.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new De(t,Ee.AccountExpired):r.indexOf("authentication timeout")!==-1?new De(t,Ee.AuthenticationTimeout):new De(t,Ee.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 zd(t,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(t){const r=m0(t),s=zu.toError(r),l={type:ei.Error,data:s.code};if(s.isPermissionError()){let u=!1;if(s.permissionContext){l.permissionContext=s.permissionContext;const c=this.subscriptions.getMux();u=(c==null?void 0:c.subject)===s.permissionContext.subject}this.subscriptions.handleError(s),this.muxSubscriptions.handleError(u,s),u&&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(pk)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const r=JSON.parse(m0(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(ms(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new gk({version:u,lang:c},this.options,r.nonce);r.headers&&(f.headers=!0,f.no_responders=!0);const d=JSON.stringify(f);this.transport.send(Al(`CONNECT ${d}${_u}`)),this.transport.send(R0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:ei.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:ei.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case yn.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case yn.OK:break;case yn.ERR:this.processError(t.data);break;case yn.PING:this.processPing();break;case yn.PONG:this.processPong();break;case yn.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=Al(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=Gn,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Ii.encode(r);else throw De.errorForCode(Ee.BadPayload);let u=l.length;s=s||{},s.reply=s.reply||"";let c=Gn,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new De("headers",Ee.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw De.errorForCode(Ee.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let d;s.headers?(s.reply?d=`HPUB ${t} ${s.reply} ${f} ${u}\r
|
|
73
|
+
`);class gk{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):{})||{};Gu(this,l)}}class Tx extends un{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");Gu(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Bt();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=pa(l.timeout,u),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}),u=r.protocolFilterFn?r.protocolFilterFn:()=>!0,c=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(f,d)=>{const{ingest:m}=l(d);m&&u(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(Bt()).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 yk{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(u=>u.subject===r.subject&&u.queue===r.queue)),r.operation==="publish"&&(l=s.find(u=>u.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 zu{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=dk,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new yk,this.muxSubscriptions=new q2,this.outbound=new ya,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new w2({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new H2(s,{randomize:!t.noRandomize}),this.closed=Bt(),this.parser=new T0(this),this.heartbeats=new I2(this,this.options.pingInterval||Ax,this.options.maxPingOut||ok)}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 T0(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(r=>{r.push(t)})}status(){const t=new un;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=Bt();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=k2(),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:oa.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:oa.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:ii.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:ii.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=pa(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,s]),(async()=>{try{for await(const u of this.transport)this.parser.parse(u)}catch(u){console.log("reader closed",u)}})().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:ad(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of s)try{l=null,this.dispatchStatus({type:oa.Reconnecting,data:u.toString()}),await this.dial(u);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():jx;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:De.errorForCode(Ce.ConnectionRefused));const u=Date.now();if(l.lastConnect===0||l.lastConnect+r<=u){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-u),await _a(s)}}static async connect(t,r){const s=new zu(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 u=t.match(/using queue "(\S+)"/);u&&(s.permissionContext.queue=u[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 zd(t,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(t){const r=m0(t),s=zu.toError(r),l={type:ii.Error,data:s.code};if(s.isPermissionError()){let u=!1;if(s.permissionContext){l.permissionContext=s.permissionContext;const c=this.subscriptions.getMux();u=(c==null?void 0:c.subject)===s.permissionContext.subject}this.subscriptions.handleError(s),this.muxSubscriptions.handleError(u,s),u&&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(pk)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const r=JSON.parse(m0(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(gs(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new gk({version:u,lang:c},this.options,r.nonce);r.headers&&(f.headers=!0,f.no_responders=!0);const d=JSON.stringify(f);this.transport.send(Al(`CONNECT ${d}${_u}`)),this.transport.send(R0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:ii.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:ii.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case kn.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case kn.OK:break;case kn.ERR:this.processError(t.data);break;case kn.PING:this.processPing();break;case kn.PONG:this.processPong();break;case kn.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=Al(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=Zn,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Vi.encode(r);else throw De.errorForCode(Ce.BadPayload);let u=l.length;s=s||{},s.reply=s.reply||"";let c=Zn,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new De("headers",Ce.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw De.errorForCode(Ce.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let d;s.headers?(s.reply?d=`HPUB ${t} ${s.reply} ${f} ${u}\r
|
|
74
74
|
`:d=`HPUB ${t} ${f} ${u}\r
|
|
75
75
|
`,this.sendCommand(d,c,l,Du)):(s.reply?d=`PUB ${t} ${s.reply} ${u}\r
|
|
76
76
|
`:d=`PUB ${t} ${u}\r
|
|
@@ -78,43 +78,43 @@ ${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=Bt()),this.pongs.push(t),this.outbound.fill(R0),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}${_u}`):t.push(`SUB ${s.subject} ${s.sid}${_u}`)}),t.length&&this.transport.send(Al(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 bk="$SRV";class M0{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 u,c;return l=l||{},l.headers=l.headers||ii(),(u=l.headers)==null||u.set(ju,`${t}`),(c=l.headers)==null||c.set(Tu,r),this.msg.respond(s,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class Bl{constructor(t,r="",s=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&vk("service group",r);let l="";if(t instanceof Vl)this.srv=t,l="";else if(t instanceof Bl){const u=t;this.srv=u.srv,s===""&&u.queue!==""&&(s=u.queue),l=u.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;El("endpoint",t);let{subject:l,handler:u,metadata:c,queue:f}=s;l=l||t,f=f||this.queue,xk("endpoint subject",l),l=this.calcSubject(this.subject,l);const d={name:t,subject:l,queue:f,handler:u,metadata:c};return this.srv._addEndpoint(d)}addGroup(t="",r=""){return new Bl(this,t,r)}}function xk(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 vk(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 Vl{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"),El("name",this.config.name),El("queue",this.config.queue),ms(this.config.version),this._id=Pi.next(),this.internal=[],this._done=Bt(),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 u=l??bk;return r===""&&s===""?`${u}.${t}`:(El("control subject name",r),s!==""?(El("control subject id",s),`${u}.${t}.${r}.${s}`):`${u}.${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=ii();if(t instanceof Nu){const s=t;r.set(Tu,s.message),r.set(ju,`${s.code}`)}else r.set(Tu,t.message),r.set(ju,"500");return r}setupHandler(t,r=!1){const s=r?"":t.queue?t.queue:this.config.queue,{name:l,subject:u,handler:c}=t,f=t;f.internal=r,r&&this.internal.push(f),f.stats=new wk(l,u,s),f.queue=s;const d=c?(m,y)=>{if(m){this.close(m);return}const g=Date.now();try{c(m,new M0(y))}catch(x){f.stats.countError(x),y==null||y.respond(Gn,{headers:this.errorToHeader(x)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(u,{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 y=new Error(`required subscription ${t.subject} errored: ${m.message}`);y.stack=m.stack,this.close(y).catch()}}),f}info(){return{type:Tl.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:u}=t;return{subject:r,metadata:s,name:l,queue_group:u}})}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:Tl.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="",u=""){const c={};c.name=t,c.subject=Vl.controlSubject(r,l,u),c.handler=s,this.setupHandler(c,!0)}start(){const t=vr(),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()),u=(c,f)=>c?(this.close(c).then().catch(),Promise.reject(c)):(f.respond(l),Promise.resolve());return this.addInternalHandler(zi.PING,u),this.addInternalHandler(zi.STATS,r),this.addInternalHandler(zi.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:Tl.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 Bl(this,t,r)}addEndpoint(t,r){return new Bl(this).addEndpoint(t,r)}_addEndpoint(t){const r=new sn;r.noIterator=typeof t.handler=="function",r.noIterator||(t.handler=(l,u)=>{l?this.stop(l).catch():r.push(new M0(u))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(t,!1);return s.qi=r,this.handlers.push(s),r}}class wk{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+=Ut(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:u,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:u,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=Ut(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 Sk{constructor(t,r={strategy:xr.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(zi.PING,t,r)}stats(t="",r=""){return this.q(zi.STATS,t,r)}info(t="",r=""){return this.q(zi.INFO,t,r)}async q(t,r="",s=""){const l=new sn,u=vr(),c=Vl.controlSubject(t,r,s,this.prefix),f=await this.nc.requestMany(c,Gn,this.opts);return(async()=>{for await(const d of f)try{const m=u.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 _k(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Nx(),storage:rd.File}}const Uu="KV-Operation",D0="$KV",kk=/^[-/=.\w]+$/,Ek=/^[-/=.>*\w]+$/,Ck=/^[-\w]+$/;function Ak(e){if(e.startsWith(".")||e.endsWith(".")||!kk.test(e))throw new Error(`invalid key: ${e}`)}function Tk(e){if(e.startsWith(".")||e.endsWith(".")||!Ek.test(e))throw new Error(`invalid key: ${e}`)}function jk(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 ku(e){if(!Ck.test(e))throw new Error(`invalid bucket name: ${e}`)}var Nr;(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"})(Nr||(Nr={}));class Pl{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",Ak);C(this,"validateSearchKey",Tk);C(this,"hasWildcards",jk);ku(t),this.js=r,this.jsm=s,this.bucket=t,this.prefix=D0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,r,s={}){ku(r);const l=await t.jetstreamManager(),u=new Pl(r,t,l);return await u.init(s),u}static async bind(t,r,s={}){const l=await t.jetstreamManager(),u={config:{allow_direct:s.allow_direct}};ku(r);const c=new Pl(r,t,l);return u.config.name=s.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=s.codec||Nx(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(t={}){const r=Object.assign(_k(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=nd.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(Fn)||(g.name=`${Fn}${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(Fn)?v.name.substring(Fn.length):v.name;return v.name.startsWith(Fn)||(v.name=`${Fn}${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?Hi.S2:Hi.None);const u=this.js.nc,c=u.getServerVersion(),f=c?sd(c,ms("2.7.2"))>=0:!1;s.discard=f?Ul.New:Ul.Old;const{ok:d,min:m}=u.features.get(ft.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=Ut(r.ttl)),s.allow_rollup_hdrs=!0;let y;try{y=await this.jsm.streams.info(s.name),!y.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(g){if(g.message==="stream not found")y=await this.jsm.streams.add(s);else throw g}this.initializePrefixes(y)}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(Fn)&&(s=s.substring(Fn.length)),r.external&&r.external.api!==""){const l=r.name.substring(Fn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Fn}${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}`:`${D0}.${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(vn.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new $k(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new Yk(this.bucket,r,t)}async create(t,r){var u;let s;try{const c=await this.put(t,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(s=c,((u=c==null?void 0:c.api_error)==null?void 0:u.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 u={};if(s.previousSeq!==void 0){const d=ii();u.headers=d,d.set(Nr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,u)).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 u;try{this.direct?u=await this.jsm.direct.getMessage(this.bucketName(),l):u=await this.jsm.streams.getMessage(this.bucketName(),l);const c=this.smToEntry(u);return c.key!==s?null:c}catch(c){if(c.code===Ee.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=Bt(),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 u=Date.now()-t,c=s.map(d=>{const m=this.subjectForKey(d.key);return d.created.getTime()>=u?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),u=[];for await(const c of l)u.push(this._doDeleteOrPurge(c,r)),u.length===100&&(await Promise.all(u),u.length=0);u.length>0&&await Promise.all(u)}async _doDeleteOrPurge(t,r,s){const l=this.encodeKey(t);this.validateKey(l);const u=ii();u.set(Uu,r),r==="PURGE"&&u.set(vn.RollupHdr,vn.RollupValueSubject),s!=null&&s.previousSeq&&u.set(Nr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),Gn,{headers:u})}_buildCC(t,r,s={}){let u=(Array.isArray(t)?t:[t]).map(d=>{const m=this.encodeKey(d);return this.validateSearchKey(d),this.fullKeyName(m)}),c=Vt.LastPerSubject;r===yr.AllHistory&&(c=Vt.All),r===yr.UpdatesOnly&&(c=Vt.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:rn.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:Ut(5*1e3)},s)}remove(t){return this.purge(t)}async history(t={}){const r=t.key??">",s=new sn,l={};l.headers_only=t.headers_only||!1;let u;u=()=>{s.stop()};let c=0;const f=this._buildCC(r,yr.AllHistory,l),d=f.filter_subject,m=Bi(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++,(u&&c>0&&s.received>=c||x.info.pending===0)&&(s.push(u),u=void 0)}});const y=await this.js.subscribe(d,m);if(u){const{info:{last:g}}=y,x=g.num_pending+g.delivered.consumer_seq;if(x===0||s.received>=x)try{u()}catch(v){s.stop(v)}finally{u=void 0}else c=x}return s._data=y,s.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{s.stop()}).catch(g=>{s.stop(g)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(ft.JS_NEW_CONSUMER_CREATE_API);return s}async watch(t={}){const r=t.key??">",s=new sn,l={};l.headers_only=t.headers_only||!1;let u=yr.LastValue;t.include===yr.AllHistory?u=yr.AllHistory:t.include===yr.UpdatesOnly&&(u=yr.UpdatesOnly);const c=t.ignoreDeletes===!0;let f=t.initializedFn,d=0;const m=this._buildCC(r,u,l),y=m.filter_subject,g=Bi(m);this.canSetWatcherName()&&g.consumerName(Pi.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 T=this.jmToEntry(S);if(c&&T.operation==="DEL")return;s.push(T),s.received++,f&&(d>0&&s.received>=d||S.info.pending===0)&&(s.push(f),f=void 0)}});const x=await this.js.subscribe(y,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(T){s.stop(T)}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 sn,s=this._buildCC(t,yr.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,u=Bi(s);u.bindStream(this.stream),u.orderedConsumer();const c=await this.js.subscribe(l,u);return(async()=>{var d;for await(const m of c){const y=(d=m.headers)==null?void 0:d.get(Uu);if(y!=="DEL"&&y!=="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 u;const r=((u=this.js.nc.info)==null?void 0:u.cluster)??"",s=this.bucketName(),l=await this.jsm.streams.info(s);return new Ox(l,r)}}class Ox{constructor(t,r=""){C(this,"si");C(this,"cluster");this.si=t,this.cluster=r}get bucket(){return this.si.config.name.startsWith(Fn)?this.si.config.name.substring(Fn.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 Ld(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!==Hi.None:!1}}const Bd="OBJ_",L0="SHA-256=";function Nk(e){return ku(e),`${Bd}${e}`}function Ok(e){return e.startsWith(Bd)?e.substring(4):e}class ud{constructor(t){C(this,"si");C(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return Ok(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!==Hi.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 lr;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(lr||(lr={}));var Or;(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"})(Or||(Or={}));var fa;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(fa||(fa={}));const z0=Uint8Array.of(43,65,67,75),Rk=Uint8Array.of(45,78,65,75),xl=Uint8Array.of(43,87,80,73),Mk=Uint8Array.of(43,78,88,84),Dk=Uint8Array.of(43,84,69,82,77),Lk=Uint8Array.of(32);function Hl(e,t=5e3){return new Zk(e,t)}class Ch extends sn{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 u=s;this.opts=this.parseOptions(s,l),this.callback=u.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=ni(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=u.abort_on_missing_resource===!0,this.bind=u.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:s,idle_heartbeat:l,threshold_bytes:u,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(td(m))return;const T=(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:B}=this.parseDiscard(m.headers);if(M>0||B>0)this.pending.msgs-=M,this.pending.bytes-=B,this.pending.requests--,this.notify(fa.Discard,{msgsLeft:M,bytesLeft:B});else if(T===400){this.stop(new De(O,`${T}`));return}else if(T===409&&O==="consumer deleted"){if(this.notify(Or.ConsumerDeleted,`${T} ${O}`),!this.refilling||this.abortOnMissingResource){const I=new De(O,`${T}`);this.stop(I);return}}else if(T===503){if(this.notify(Or.NoResponders,`${T} No Responders`),!this.refilling||this.abortOnMissingResource){const I=new De("no responders",`${T}`);this.stop(I);return}}else this.notify(fa.DebugEvent,`${T} ${O}`)}else this._push(Hl(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<=u){const T=this.pullOptions();this.pull(T)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Ud(l,d=>(this.notify(Or.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 y of d)switch(y.type){case ei.Disconnect:(m=this.monitor)==null||m.cancel();break;case ei.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=Dd([this.opts.expires]);let u=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(Or.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(Or.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(u),d=Sa(f);await Promise.race([d,this.consumer.api.nc.closed()]),d.cancel(),u++}}}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(fa.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=Ut(this.opts.idle_heartbeat),u=Ut(this.opts.expires);return{batch:r,max_bytes:s,idle_heartbeat:l,expires:u}}parseDiscard(r){const s={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(vn.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(vn.PendingBytesHdr);return u&&(s.bytesLeft=parseInt(u)),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(u=>{u.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 u=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||u;const c=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||c}return l}status(){const r=new sn;return this.listeners.push(r),Promise.resolve(r)}}class zk extends sn{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 sn;return this.listeners.push(r),Promise.resolve(r)}}class cd{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 Ch(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const r=new Ch(this,t,!1),s=Math.round(r.opts.expires*1.05),l=ma(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=Bt(),s=t;s.max_messages=1;const l=new Ch(this,s,!1),u=Math.round(l.opts.expires*1.05);u>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===Or.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=ma(u);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 Uk{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=Pi.next(),typeof s.name_prefix=="string"&&(Ju("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=lr.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:Vt.StartSequence,opt_start_seq:t,ack_policy:rn.None,inactive_threshold:Ut(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||Vt.StartSequence,(this.consumerOpts.deliver_policy===Vt.LastPerSubject||this.consumerOpts.deliver_policy===Vt.New||this.consumerOpts.deliver_policy===Vt.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===Vt.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=Vt.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=Ut(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var c,f,d,m,y;Pi.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=Dd([((f=this.opts)==null?void 0:f.expires)||3e4]);let u;for(let g=0;;g++)try{u=await this.api.add(this.stream,s),(d=this.iter)==null||d.notify(Or.OrderedConsumerRecreated,u.name);break}catch(x){if(x.message==="stream not found"&&((m=this.iter)==null||m.notify(Or.StreamNotFound,g),this.type===lr.Fetch||this.opts.abort_on_missing_resource===!0))return(y=this.iter)==null||y.stop(x),Promise.reject(x);if(r&&g>=this.maxInitialReset)throw x;await Sa(l.backoff(g+1))}return u}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===lr.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 zk),this.consumer=new cd(this.api,this.currentConsumer);const u=t;u.callback=this.internalHandler(this.serial);let c=null;this.type===lr.Fetch&&s?c=await this.consumer.fetch(t):this.type===lr.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(fa.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===lr.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===lr.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=lr.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===lr.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=lr.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=Bt();return r.callback=u=>{this.userCallback=null,s.resolve(u)},(await this.fetch(r)).iterClosed.then(u=>{u&&s.reject(u),s.resolve(null)}).catch(u=>{s.reject(u)}),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 fd{constructor(t){C(this,"api");C(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(ft.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 cd(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 cd(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(t,r){await this.checkVersion();const s=this.api;return new Pd(s.nc,s.opts).info(t).then(u=>Promise.resolve(new Uk(this.api,t,r))).catch(u=>Promise.reject(u))}}class Qu{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 Qu(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 fd(new Mu(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new fd(new Mu(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 Pd extends Yl{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.metadata){const{min:l,ok:u}=r.features.get(ft.JS_STREAM_CONSUMER_METADATA);if(!u)throw new Error(`stream 'metadata' requires server ${l}`)}if(t.first_seq){const{min:l,ok:u}=r.features.get(ft.JS_STREAM_FIRST_SEQ);if(!u)throw new Error(`stream 'first_seq' requires server ${l}`)}if(t.subject_transform){const{min:l,ok:u}=r.features.get(ft.JS_STREAM_SUBJECT_TRANSFORM);if(!u)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(t.compression){const{min:l,ok:u}=r.features.get(ft.JS_STREAM_COMPRESSION);if(!u)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:u}=r.features.get(ft.JS_DEFAULT_CONSUMER_LIMITS);if(!u)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function s(l,u){var f;if((((f=u==null?void 0:u.subject_transforms)==null?void 0:f.length)||0)>0){const{min:d,ok:m}=r.features.get(ft.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),gn(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 gn(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),gn(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){gn(t);const s=`${this.prefix}.STREAM.INFO.${t}`;let u=await this._request(s,r),{total:c,limit:f}=u,d=u.state.subjects?Object.getOwnPropertyNames(u.state.subjects).length:1;if(c&&c>d){const m=[u],y=r||{};let g=0;for(;c>d;){g++,y.offset=f*g;const v=await this._request(s,y);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++)u=m[v],u.state.subjects&&(x=Object.assign(x,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=x}return this._fixInfo(u),u}list(t=""){const r=t!=null&&t.length?{subject:t}:{},s=u=>{const c=u;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new Cl(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:u}=r;if(typeof l=="number"&&typeof u=="number")throw new Error("can specify one of keep or seq")}return gn(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){gn(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){gn(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,r);return new Rx(l)}find(t){return this.findStream(t)}listKvs(){const t=s=>{var d;const u=s.streams.filter(m=>m.config.name.startsWith(Fn));u.forEach(m=>{this._fixInfo(m)});let c="";return u.length&&(c=((d=this.nc.info)==null?void 0:d.cluster)??""),u.map(m=>new Ox(m,c))},r=`${this.prefix}.STREAM.LIST`;return new Cl(r,t,this)}listObjectStores(){const t=s=>{const u=s.streams.filter(f=>f.config.name.startsWith(Bd));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new ud(f))},r=`${this.prefix}.STREAM.LIST`;return new Cl(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new Cl(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new Qu(this,r))}}class Bk extends Yl{constructor(t,r){super(t,r)}async getMessage(t,r){gn(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const u=s?this.jc.encode(s):Gn,c=this.opts.apiPrefix||"$JS.API",f=l?`${c}.DIRECT.GET.${t}.${l}`:`${c}.DIRECT.GET.${t}`,d=await this.nc.request(f,u,{timeout:this.timeout}),m=ua(d);if(m)return Promise.reject(m);const y=new hd(d);return Promise.resolve(y)}async getBatch(t,r){gn(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 u=JSON.stringify(r,(d,m)=>d==="up_to_time"&&m instanceof Date?m.toISOString():m),c=new sn,f=await this.nc.requestMany(l,u,{strategy:xr.SentinelMsg});return(async()=>{var g,x,v;let d=!1,m=!1,y;for await(const S of f){if(!d){d=!0;const T=((g=S.headers)==null?void 0:g.code)||0;if(T!==0&&T<200||T>299){y=(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 hd(S))}c.push(()=>{if(m)throw new Error("batch direct get not supported by the server");if(y)throw new Error(`bad request: ${y}`);c.stop()})})(),Promise.resolve(c)}}class hd{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(sa.Subject)}get seq(){const t=this.header.last(sa.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(sa.TimeStamp)}get stream(){return this.header.last(sa.Stream)}json(t){return vr(t).decode(this.data)}string(){return $n.decode(this.data)}}C(hd,"jc");class Pk extends Yl{constructor(r,s){super(r,s);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new Pd(r,s),this.consumers=new Mu(r,s),this.direct=new Bk(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new sn;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(s,l)=>{if(s)throw s;try{const u=this.parseJsResponse(l),c=u.type.split("."),f=c[c.length-1];r.push({kind:f,data:u})}catch(u){r.stop(u)}}}),r}}class Rx{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):Gn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=Ui.decode(t)}else this._header=ii();return this._header}_parse(t){const r=atob(t),s=r.length,l=new Uint8Array(s);for(let u=0;u<s;u++)l[u]=r.charCodeAt(u);return l}json(t){return vr(t).decode(this.data)}string(){return $n.decode(this.data)}}C(Rx,"jc");class Hk{constructor(t){C(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new Qu(this.api,r))}}class Ah{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=Ui.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 U0(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 qk(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Nl{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 Ah(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 u=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=vr().decode(u.data);return f.revision=u.seq,f}catch(u){return u.code==="404"?null:Promise.reject(u)}}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 ud(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new ud(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var ee;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout:u,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=((ee=t.options)==null?void 0:ee.max_chunk_size)||128*1024;m=m>d?d:m,t.options.max_chunk_size=m;const y=await this.info(t.name),{name:g,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=Pi.next(),S=this._chunkSubject(v),T=this._metaSubject(g),O=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},U0(t)),M=Bt(),B=[],I=new ga;try{const P=r?r.getReader():null,D=C0.create();for(;;){const{done:Z,value:F}=P?await P.read():{done:!0,value:void 0};if(Z){if(I.size()>0){const G=I.drain();D.update(G),O.chunks++,O.size+=G.length,B.push(this.js.publish(S,G,{timeout:u}))}await Promise.all(B),B.length=0,O.mtime=new Date().toISOString();const $=ca.encode(D.digest());O.digest=`${L0}${$}`,O.deleted=!1;const L=ii();typeof c=="number"&&L.set(Nr.ExpectedLastSubjectSequenceHdr,`${c}`),L.set(vn.RollupHdr,vn.RollupValueSubject);const J=await this.js.publish(T,vr().encode(O),{headers:L,timeout:u});if(O.revision=J.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}M.resolve(new Ah(O));break}if(F)for(I.fill(F);I.size()>m;){O.chunks++,O.size+=m;const $=I.drain(t.options.max_chunk_size);D.update($),B.push(this.js.publish(S,$,{timeout:u}))}}}catch(P){await this.jsm.streams.purge(this.stream,{filter:S}),M.reject(P)}return M}putBlob(t,r,s){function l(u){return new ReadableStream({pull(c){c.enqueue(u),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(u){const c=new ga,f=u.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 Nl.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(L0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=id(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Bt(),u={info:new Ah(r),error:l};if(r.size===0)return u.data=qk(),l.resolve(null),Promise.resolve(u);let c;const f=Bi();f.orderedConsumer();const d=C0.create(),m=`$O.${this.name}.C.${r.nuid}`,y=await this.js.subscribe(m,f);return(async()=>{for await(const g of y)g.data.length>0&&(d.update(g.data),c.enqueue(g.data)),g.info.pending===0&&(y2(s,d.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),y.unsubscribe())})().then(()=>{l.resolve()}).catch(g=>{c.error(g),l.reject(g)}),u.data=new ReadableStream({start(g){c=g},cancel(){y.unsubscribe()}}),u}linkStore(t,r){if(!(r instanceof Nl))return Promise.reject("bucket required");const s=r,{name:l,error:u}=this._checkNotEmpty(t);if(u)return Promise.reject(u);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 u=await this.rawInfo(t);if(u!==null&&!u.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=vr(),l=ii();return l.set(vn.RollupHdr,vn.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:u}=this._checkNotEmpty(r.name);if(u)return Promise.reject(u);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,U0(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 sn,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 u=vr(),c=Bi();c.orderedConsumer(),t.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((d,m)=>{var y;if(d){s.stop(d);return}if(m!==null){const g=u.decode(m.data);g.deleted&&t.ignoreDeletes===!0||s.push(g),((y=m.info)==null?void 0:y.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.${ca.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=Nk(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=Ul.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?Hi.S2:Hi.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(),u=new Nl(r,l,t);return await u.init(s),Promise.resolve(u)}}class Ik{constructor(t){C(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:u}=s.nc.features.get(ft.JS_KV);return l?r.bindOnly?Pl.bind(this.js,t,r):Pl.create(this.js,t,r):Promise.reject(new Error(`kv is only supported on servers ${u} 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:u}=s.nc.features.get(ft.JS_OBJECTSTORE);return l?Nl.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class Hd extends Yl{constructor(r,s){super(r,s);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new Mu(r,s),this.streamAPI=new Pd(r,s),this.consumers=new fd(this.consumerAPI),this.streams=new Hk(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 Ik(this)}async publish(r,s=Gn,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||ii();l&&(l.msgID&&u.set(Nr.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(Nr.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(Nr.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(Nr.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(Nr.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=u);let{retries:d,retry_delay:m}=l;d=d||1,m=m||250;let y;for(let x=0;x<d;x++)try{y=await this.nc.request(r,s,f);break}catch(v){if(v.code==="503"&&x+1<d)await Sa(m);else throw v}const g=this.parseJsResponse(y);if(g.stream==="")throw De.errorForCode(Ee.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){gn(r),oa(s);let u=this.timeout;l>u&&(u=l),l=l<0?0:Ut(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:u}),d=ua(f);if(d)throw d;return Hl(f,this.timeout)}fetch(r,s,l={}){gn(r),oa(s);let u=null;const c=(l.max_bytes??0)>0;let f=0;const d=c?l.max_bytes:0;let m=null;const y={};if(y.batch=l.batch||1,d){const B=this.nc.features.get(ft.JS_PULL_MAX_BYTES);if(!B.ok)throw new Error(`max_bytes is only supported on servers ${B.min} or better`);y.max_bytes=d}y.no_wait=l.no_wait||!1,y.no_wait&&y.expires&&(y.expires=0);const g=l.expires||0;if(g&&(y.expires=Ut(g)),g===0&&y.no_wait===!1)throw new Error("expires or no_wait is required");const x=l.idle_heartbeat||0;x&&(y.idle_heartbeat=Ut(x),l.delay_heartbeat===!0&&(y.idle_heartbeat=Ut(x*4)));const v=new sn,S=y.batch;let T=0;v.protocolFilterFn=(B,I=!1)=>td(B.msg)?(m==null||m.work(),!1):!0,v.dispatchedFn=B=>{if(B){if(c&&(f+=B.data.length),T++,u&&B.info.pending===0)return;(v.getPending()===1&&B.info.pending===0||S===T||d>0&&f>=d)&&v.stop()}};const O=ni(this.nc.options.inboxPrefix),M=this.nc.subscribe(O,{max:l.batch,callback:(B,I)=>{B===null&&(B=ua(I)),B!==null?(u&&(u.cancel(),u=null),Z_(B)?v.stop(Dx(B)===null?void 0:B):v.stop(B)):(m==null||m.work(),v.received++,v.push(Hl(I,this.timeout)))}});return g&&(u=ma(g),u.catch(()=>{M.isClosed()||(M.drain().catch(()=>{}),u=null),m&&m.cancel()})),(async()=>{try{x&&(m=new Ud(x,B=>(v.push(()=>{v.err=new De(`${or.IdleHeartbeatMissed}: ${B}`,Ee.JetStreamIdleHeartBeat)}),!0)))}catch{}await M.closed,u!==null&&(u.cancel(),u=null),m&&m.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(y),{reply:O}),v}async pullSubscribe(r,s=Bi()){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 u=l.config.ack_policy;if(u===rn.None||u===rn.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new Vk(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(d){throw f.unsubscribe(),d}return f}async subscribe(r,s=Bi()){const l=await this._processOptions(r,s);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const u=this._buildTypedSubscriptionOpts(l),c=new Mx(this,l.deliver,u);c.info=l;try{await this._maybeCreateConsumer(l)}catch(f){throw c.unsubscribe(),f}return c._maybeSetupHbMonitoring(),c}async _processOptions(r,s=Bi()){const l=S0(s)?s.getOpts():s;if(l.isBind=S0(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!==rn.NotSet&&l.config.ack_policy!==rn.None)throw new De("ordered consumer: ack_policy can only be set to 'none'",Ee.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new De("ordered consumer: durable_name cannot be set",Ee.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new De("ordered consumer: deliver_subject cannot be set",Ee.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new De("ordered consumer: max_deliver cannot be set",Ee.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new De("ordered consumer: deliver_group cannot be set",Ee.ApiError);l.config.deliver_subject=ni(this.nc.options.inboxPrefix),l.config.ack_policy=rn.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||Ut(5e3),l.config.ack_wait=Ut(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===rn.NotSet&&(l.config.ack_policy=rn.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 u=await this.consumerAPI.info(l.stream,l.config.durable_name);if(u){if(u.config.filter_subject&&u.config.filter_subject!==r)throw new Error("subject does not match consumer");const c=l.config.deliver_group??"";if(c===""&&u.push_bound===!0)throw new Error("duplicate subscription");const f=u.config.deliver_group??"";if(c!==f)throw f===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${f}'`);l.last=u,l.config=u.config,l.attached=!0,l.config.durable_name||(l.name=u.name)}}catch(u){if(u.code!=="404")throw u}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||ni(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=Gk(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Hd.ingestionFn(r.ordered),s.protocolFilterFn=(l,u=!1)=>{const c=l;return ed(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==rn.None&&(s.dispatchedFn=Kk),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:Vt.All,ack_policy:rn.Explicit,ack_wait:Ut(30*1e3),replay_policy:pa.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 u=l;if(!s)return{ingest:!1,protocol:!1};const c=s;if(ua(c.msg)||(d=u.monitor)==null||d.work(),td(c.msg)){const m=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:m,protocol:!0}}else if(ed(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(s):!0,protocol:!1}}}}class qd{constructor(t){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=fk(t),this.listeners=[]}static connect(t={}){return new Promise((r,s)=>{const l=new qd(t);zu.connect(l.options,l).then(u=>{l.protocol=u,(async function(){for await(const c of u.status())l.listeners.forEach(f=>{f.push(c)})})(),r(l)}).catch(u=>{s(u)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,r,s){if(this.isClosed())throw De.errorForCode(Ee.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw De.errorForCode(Ee.ConnectionDraining);if(t=t||"",t.length===0)throw De.errorForCode(Ee.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=Gn,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||xr.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new De("timeout",Ee.InvalidOption));const u=new sn;function c(d){u.push(()=>{u.stop(d)})}function f(d,m){d||m===null?c(d===null?void 0:d):u.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 y=this.subscribe(ni(this.options.inboxPrefix),{callback:(S,T)=>{var O,M;if(((O=T==null?void 0:T.data)==null?void 0:O.length)===0&&((M=T==null?void 0:T.headers)==null?void 0:M.status)===Ee.NoResponders&&(S=De.errorForCode(Ee.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=Bt()),this.pongs.push(t),this.outbound.fill(R0),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}${_u}`):t.push(`SUB ${s.subject} ${s.sid}${_u}`)}),t.length&&this.transport.send(Al(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 Tx(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 bk="$SRV";class M0{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 u,c;return l=l||{},l.headers=l.headers||oi(),(u=l.headers)==null||u.set(Tu,`${t}`),(c=l.headers)==null||c.set(ju,r),this.msg.respond(s,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class Bl{constructor(t,r="",s=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&vk("service group",r);let l="";if(t instanceof Vl)this.srv=t,l="";else if(t instanceof Bl){const u=t;this.srv=u.srv,s===""&&u.queue!==""&&(s=u.queue),l=u.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;El("endpoint",t);let{subject:l,handler:u,metadata:c,queue:f}=s;l=l||t,f=f||this.queue,xk("endpoint subject",l),l=this.calcSubject(this.subject,l);const d={name:t,subject:l,queue:f,handler:u,metadata:c};return this.srv._addEndpoint(d)}addGroup(t="",r=""){return new Bl(this,t,r)}}function xk(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 vk(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 Vl{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"),El("name",this.config.name),El("queue",this.config.queue),gs(this.config.version),this._id=Fi.next(),this.internal=[],this._done=Bt(),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 u=l??bk;return r===""&&s===""?`${u}.${t}`:(El("control subject name",r),s!==""?(El("control subject id",s),`${u}.${t}.${r}.${s}`):`${u}.${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=oi();if(t instanceof Nu){const s=t;r.set(ju,s.message),r.set(Tu,`${s.code}`)}else r.set(ju,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:u,handler:c}=t,f=t;f.internal=r,r&&this.internal.push(f),f.stats=new wk(l,u,s),f.queue=s;const d=c?(m,y)=>{if(m){this.close(m);return}const g=Date.now();try{c(m,new M0(y))}catch(x){f.stats.countError(x),y==null||y.respond(Zn,{headers:this.errorToHeader(x)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(u,{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 y=new Error(`required subscription ${t.subject} errored: ${m.message}`);y.stack=m.stack,this.close(y).catch()}}),f}info(){return{type:jl.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:u}=t;return{subject:r,metadata:s,name:l,queue_group:u}})}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:jl.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="",u=""){const c={};c.name=t,c.subject=Vl.controlSubject(r,l,u),c.handler=s,this.setupHandler(c,!0)}start(){const t=kr(),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()),u=(c,f)=>c?(this.close(c).then().catch(),Promise.reject(c)):(f.respond(l),Promise.resolve());return this.addInternalHandler(Hi.PING,u),this.addInternalHandler(Hi.STATS,r),this.addInternalHandler(Hi.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:jl.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 Bl(this,t,r)}addEndpoint(t,r){return new Bl(this).addEndpoint(t,r)}_addEndpoint(t){const r=new un;r.noIterator=typeof t.handler=="function",r.noIterator||(t.handler=(l,u)=>{l?this.stop(l).catch():r.push(new M0(u))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(t,!1);return s.qi=r,this.handlers.push(s),r}}class wk{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+=Ut(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:u,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:u,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=Ut(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 Sk{constructor(t,r={strategy:_r.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(Hi.PING,t,r)}stats(t="",r=""){return this.q(Hi.STATS,t,r)}info(t="",r=""){return this.q(Hi.INFO,t,r)}async q(t,r="",s=""){const l=new un,u=kr(),c=Vl.controlSubject(t,r,s,this.prefix),f=await this.nc.requestMany(c,Zn,this.opts);return(async()=>{for await(const d of f)try{const m=u.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 _k(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Nx(),storage:rd.File}}const Uu="KV-Operation",D0="$KV",kk=/^[-/=.\w]+$/,Ek=/^[-/=.>*\w]+$/,Ck=/^[-\w]+$/;function Ak(e){if(e.startsWith(".")||e.endsWith(".")||!kk.test(e))throw new Error(`invalid key: ${e}`)}function jk(e){if(e.startsWith(".")||e.endsWith(".")||!Ek.test(e))throw new Error(`invalid key: ${e}`)}function Tk(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 ku(e){if(!Ck.test(e))throw new Error(`invalid bucket name: ${e}`)}var Dr;(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"})(Dr||(Dr={}));class Pl{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",Ak);C(this,"validateSearchKey",jk);C(this,"hasWildcards",Tk);ku(t),this.js=r,this.jsm=s,this.bucket=t,this.prefix=D0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,r,s={}){ku(r);const l=await t.jetstreamManager(),u=new Pl(r,t,l);return await u.init(s),u}static async bind(t,r,s={}){const l=await t.jetstreamManager(),u={config:{allow_direct:s.allow_direct}};ku(r);const c=new Pl(r,t,l);return u.config.name=s.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=s.codec||Nx(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(t={}){const r=Object.assign(_k(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=nd.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(Jn)||(g.name=`${Jn}${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(Jn)?v.name.substring(Jn.length):v.name;return v.name.startsWith(Jn)||(v.name=`${Jn}${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?$i.S2:$i.None);const u=this.js.nc,c=u.getServerVersion(),f=c?sd(c,gs("2.7.2"))>=0:!1;s.discard=f?Ul.New:Ul.Old;const{ok:d,min:m}=u.features.get(ct.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=Ut(r.ttl)),s.allow_rollup_hdrs=!0;let y;try{y=await this.jsm.streams.info(s.name),!y.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(g){if(g.message==="stream not found")y=await this.jsm.streams.add(s);else throw g}this.initializePrefixes(y)}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(Jn)&&(s=s.substring(Jn.length)),r.external&&r.external.api!==""){const l=r.name.substring(Jn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Jn}${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}`:`${D0}.${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(An.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new $k(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new Yk(this.bucket,r,t)}async create(t,r){var u;let s;try{const c=await this.put(t,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(s=c,((u=c==null?void 0:c.api_error)==null?void 0:u.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 u={};if(s.previousSeq!==void 0){const d=oi();u.headers=d,d.set(Dr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,u)).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 u;try{this.direct?u=await this.jsm.direct.getMessage(this.bucketName(),l):u=await this.jsm.streams.getMessage(this.bucketName(),l);const c=this.smToEntry(u);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=Bt(),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 u=Date.now()-t,c=s.map(d=>{const m=this.subjectForKey(d.key);return d.created.getTime()>=u?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),u=[];for await(const c of l)u.push(this._doDeleteOrPurge(c,r)),u.length===100&&(await Promise.all(u),u.length=0);u.length>0&&await Promise.all(u)}async _doDeleteOrPurge(t,r,s){const l=this.encodeKey(t);this.validateKey(l);const u=oi();u.set(Uu,r),r==="PURGE"&&u.set(An.RollupHdr,An.RollupValueSubject),s!=null&&s.previousSeq&&u.set(Dr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),Zn,{headers:u})}_buildCC(t,r,s={}){let u=(Array.isArray(t)?t:[t]).map(d=>{const m=this.encodeKey(d);return this.validateSearchKey(d),this.fullKeyName(m)}),c=Jt.LastPerSubject;r===wr.AllHistory&&(c=Jt.All),r===wr.UpdatesOnly&&(c=Jt.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:on.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:Ut(5*1e3)},s)}remove(t){return this.purge(t)}async history(t={}){const r=t.key??">",s=new un,l={};l.headers_only=t.headers_only||!1;let u;u=()=>{s.stop()};let c=0;const f=this._buildCC(r,wr.AllHistory,l),d=f.filter_subject,m=Ii(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++,(u&&c>0&&s.received>=c||x.info.pending===0)&&(s.push(u),u=void 0)}});const y=await this.js.subscribe(d,m);if(u){const{info:{last:g}}=y,x=g.num_pending+g.delivered.consumer_seq;if(x===0||s.received>=x)try{u()}catch(v){s.stop(v)}finally{u=void 0}else c=x}return s._data=y,s.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{s.stop()}).catch(g=>{s.stop(g)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(ct.JS_NEW_CONSUMER_CREATE_API);return s}async watch(t={}){const r=t.key??">",s=new un,l={};l.headers_only=t.headers_only||!1;let u=wr.LastValue;t.include===wr.AllHistory?u=wr.AllHistory:t.include===wr.UpdatesOnly&&(u=wr.UpdatesOnly);const c=t.ignoreDeletes===!0;let f=t.initializedFn,d=0;const m=this._buildCC(r,u,l),y=m.filter_subject,g=Ii(m);this.canSetWatcherName()&&g.consumerName(Fi.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(y,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 un,s=this._buildCC(t,wr.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,u=Ii(s);u.bindStream(this.stream),u.orderedConsumer();const c=await this.js.subscribe(l,u);return(async()=>{var d;for await(const m of c){const y=(d=m.headers)==null?void 0:d.get(Uu);if(y!=="DEL"&&y!=="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 u;const r=((u=this.js.nc.info)==null?void 0:u.cluster)??"",s=this.bucketName(),l=await this.jsm.streams.info(s);return new Ox(l,r)}}class Ox{constructor(t,r=""){C(this,"si");C(this,"cluster");this.si=t,this.cluster=r}get bucket(){return this.si.config.name.startsWith(Jn)?this.si.config.name.substring(Jn.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 Ld(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!==$i.None:!1}}const Bd="OBJ_",L0="SHA-256=";function Nk(e){return ku(e),`${Bd}${e}`}function Ok(e){return e.startsWith(Bd)?e.substring(4):e}class ud{constructor(t){C(this,"si");C(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return Ok(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!==$i.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 fr;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(fr||(fr={}));var Lr;(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"})(Lr||(Lr={}));var ha;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(ha||(ha={}));const z0=Uint8Array.of(43,65,67,75),Rk=Uint8Array.of(45,78,65,75),xl=Uint8Array.of(43,87,80,73),Mk=Uint8Array.of(43,78,88,84),Dk=Uint8Array.of(43,84,69,82,77),Lk=Uint8Array.of(32);function Hl(e,t=5e3){return new Zk(e,t)}class Ch extends un{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 u=s;this.opts=this.parseOptions(s,l),this.callback=u.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=ai(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=u.abort_on_missing_resource===!0,this.bind=u.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:s,idle_heartbeat:l,threshold_bytes:u,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(td(m))return;const j=(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:B}=this.parseDiscard(m.headers);if(M>0||B>0)this.pending.msgs-=M,this.pending.bytes-=B,this.pending.requests--,this.notify(ha.Discard,{msgsLeft:M,bytesLeft:B});else if(j===400){this.stop(new De(O,`${j}`));return}else if(j===409&&O==="consumer deleted"){if(this.notify(Lr.ConsumerDeleted,`${j} ${O}`),!this.refilling||this.abortOnMissingResource){const I=new De(O,`${j}`);this.stop(I);return}}else if(j===503){if(this.notify(Lr.NoResponders,`${j} No Responders`),!this.refilling||this.abortOnMissingResource){const I=new De("no responders",`${j}`);this.stop(I);return}}else this.notify(ha.DebugEvent,`${j} ${O}`)}else this._push(Hl(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<=u){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 Ud(l,d=>(this.notify(Lr.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 y of d)switch(y.type){case ii.Disconnect:(m=this.monitor)==null||m.cancel();break;case ii.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=Dd([this.opts.expires]);let u=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(Lr.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(Lr.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(u),d=_a(f);await Promise.race([d,this.consumer.api.nc.closed()]),d.cancel(),u++}}}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(ha.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=Ut(this.opts.idle_heartbeat),u=Ut(this.opts.expires);return{batch:r,max_bytes:s,idle_heartbeat:l,expires:u}}parseDiscard(r){const s={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(An.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(An.PendingBytesHdr);return u&&(s.bytesLeft=parseInt(u)),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(u=>{u.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 u=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||u;const c=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||c}return l}status(){const r=new un;return this.listeners.push(r),Promise.resolve(r)}}class zk extends un{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 un;return this.listeners.push(r),Promise.resolve(r)}}class cd{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 Ch(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const r=new Ch(this,t,!1),s=Math.round(r.opts.expires*1.05),l=pa(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=Bt(),s=t;s.max_messages=1;const l=new Ch(this,s,!1),u=Math.round(l.opts.expires*1.05);u>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===Lr.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=pa(u);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 Uk{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=Fi.next(),typeof s.name_prefix=="string"&&(Ju("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=fr.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:Jt.StartSequence,opt_start_seq:t,ack_policy:on.None,inactive_threshold:Ut(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||Jt.StartSequence,(this.consumerOpts.deliver_policy===Jt.LastPerSubject||this.consumerOpts.deliver_policy===Jt.New||this.consumerOpts.deliver_policy===Jt.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===Jt.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=Jt.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=Ut(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var c,f,d,m,y;Fi.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=Dd([((f=this.opts)==null?void 0:f.expires)||3e4]);let u;for(let g=0;;g++)try{u=await this.api.add(this.stream,s),(d=this.iter)==null||d.notify(Lr.OrderedConsumerRecreated,u.name);break}catch(x){if(x.message==="stream not found"&&((m=this.iter)==null||m.notify(Lr.StreamNotFound,g),this.type===fr.Fetch||this.opts.abort_on_missing_resource===!0))return(y=this.iter)==null||y.stop(x),Promise.reject(x);if(r&&g>=this.maxInitialReset)throw x;await _a(l.backoff(g+1))}return u}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===fr.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 zk),this.consumer=new cd(this.api,this.currentConsumer);const u=t;u.callback=this.internalHandler(this.serial);let c=null;this.type===fr.Fetch&&s?c=await this.consumer.fetch(t):this.type===fr.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(ha.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===fr.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===fr.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=fr.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===fr.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=fr.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=Bt();return r.callback=u=>{this.userCallback=null,s.resolve(u)},(await this.fetch(r)).iterClosed.then(u=>{u&&s.reject(u),s.resolve(null)}).catch(u=>{s.reject(u)}),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 fd{constructor(t){C(this,"api");C(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(ct.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 cd(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 cd(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(t,r){await this.checkVersion();const s=this.api;return new Pd(s.nc,s.opts).info(t).then(u=>Promise.resolve(new Uk(this.api,t,r))).catch(u=>Promise.reject(u))}}class Qu{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 Qu(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 fd(new Mu(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new fd(new Mu(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 Pd extends Yl{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.metadata){const{min:l,ok:u}=r.features.get(ct.JS_STREAM_CONSUMER_METADATA);if(!u)throw new Error(`stream 'metadata' requires server ${l}`)}if(t.first_seq){const{min:l,ok:u}=r.features.get(ct.JS_STREAM_FIRST_SEQ);if(!u)throw new Error(`stream 'first_seq' requires server ${l}`)}if(t.subject_transform){const{min:l,ok:u}=r.features.get(ct.JS_STREAM_SUBJECT_TRANSFORM);if(!u)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(t.compression){const{min:l,ok:u}=r.features.get(ct.JS_STREAM_COMPRESSION);if(!u)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:u}=r.features.get(ct.JS_DEFAULT_CONSUMER_LIMITS);if(!u)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function s(l,u){var f;if((((f=u==null?void 0:u.subject_transforms)==null?void 0:f.length)||0)>0){const{min:d,ok:m}=r.features.get(ct.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),_n(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 _n(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),_n(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){_n(t);const s=`${this.prefix}.STREAM.INFO.${t}`;let u=await this._request(s,r),{total:c,limit:f}=u,d=u.state.subjects?Object.getOwnPropertyNames(u.state.subjects).length:1;if(c&&c>d){const m=[u],y=r||{};let g=0;for(;c>d;){g++,y.offset=f*g;const v=await this._request(s,y);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++)u=m[v],u.state.subjects&&(x=Object.assign(x,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=x}return this._fixInfo(u),u}list(t=""){const r=t!=null&&t.length?{subject:t}:{},s=u=>{const c=u;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new Cl(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:u}=r;if(typeof l=="number"&&typeof u=="number")throw new Error("can specify one of keep or seq")}return _n(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){_n(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){_n(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,r);return new Rx(l)}find(t){return this.findStream(t)}listKvs(){const t=s=>{var d;const u=s.streams.filter(m=>m.config.name.startsWith(Jn));u.forEach(m=>{this._fixInfo(m)});let c="";return u.length&&(c=((d=this.nc.info)==null?void 0:d.cluster)??""),u.map(m=>new Ox(m,c))},r=`${this.prefix}.STREAM.LIST`;return new Cl(r,t,this)}listObjectStores(){const t=s=>{const u=s.streams.filter(f=>f.config.name.startsWith(Bd));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new ud(f))},r=`${this.prefix}.STREAM.LIST`;return new Cl(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new Cl(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new Qu(this,r))}}class Bk extends Yl{constructor(t,r){super(t,r)}async getMessage(t,r){_n(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const u=s?this.jc.encode(s):Zn,c=this.opts.apiPrefix||"$JS.API",f=l?`${c}.DIRECT.GET.${t}.${l}`:`${c}.DIRECT.GET.${t}`,d=await this.nc.request(f,u,{timeout:this.timeout}),m=ca(d);if(m)return Promise.reject(m);const y=new hd(d);return Promise.resolve(y)}async getBatch(t,r){_n(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 u=JSON.stringify(r,(d,m)=>d==="up_to_time"&&m instanceof Date?m.toISOString():m),c=new un,f=await this.nc.requestMany(l,u,{strategy:_r.SentinelMsg});return(async()=>{var g,x,v;let d=!1,m=!1,y;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){y=(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 hd(S))}c.push(()=>{if(m)throw new Error("batch direct get not supported by the server");if(y)throw new Error(`bad request: ${y}`);c.stop()})})(),Promise.resolve(c)}}class hd{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(aa.Subject)}get seq(){const t=this.header.last(aa.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(aa.TimeStamp)}get stream(){return this.header.last(aa.Stream)}json(t){return kr(t).decode(this.data)}string(){return Xn.decode(this.data)}}C(hd,"jc");class Pk extends Yl{constructor(r,s){super(r,s);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new Pd(r,s),this.consumers=new Mu(r,s),this.direct=new Bk(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new un;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(s,l)=>{if(s)throw s;try{const u=this.parseJsResponse(l),c=u.type.split("."),f=c[c.length-1];r.push({kind:f,data:u})}catch(u){r.stop(u)}}}),r}}class Rx{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):Zn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=qi.decode(t)}else this._header=oi();return this._header}_parse(t){const r=atob(t),s=r.length,l=new Uint8Array(s);for(let u=0;u<s;u++)l[u]=r.charCodeAt(u);return l}json(t){return kr(t).decode(this.data)}string(){return Xn.decode(this.data)}}C(Rx,"jc");class Hk{constructor(t){C(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new Qu(this.api,r))}}class Ah{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=qi.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 U0(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 qk(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Nl{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 Ah(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 u=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=kr().decode(u.data);return f.revision=u.seq,f}catch(u){return u.code==="404"?null:Promise.reject(u)}}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 ud(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new ud(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var ee;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout:u,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=((ee=t.options)==null?void 0:ee.max_chunk_size)||128*1024;m=m>d?d:m,t.options.max_chunk_size=m;const y=await this.info(t.name),{name:g,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=Fi.next(),S=this._chunkSubject(v),j=this._metaSubject(g),O=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},U0(t)),M=Bt(),B=[],I=new ya;try{const P=r?r.getReader():null,D=C0.create();for(;;){const{done:Z,value:F}=P?await P.read():{done:!0,value:void 0};if(Z){if(I.size()>0){const G=I.drain();D.update(G),O.chunks++,O.size+=G.length,B.push(this.js.publish(S,G,{timeout:u}))}await Promise.all(B),B.length=0,O.mtime=new Date().toISOString();const $=fa.encode(D.digest());O.digest=`${L0}${$}`,O.deleted=!1;const L=oi();typeof c=="number"&&L.set(Dr.ExpectedLastSubjectSequenceHdr,`${c}`),L.set(An.RollupHdr,An.RollupValueSubject);const J=await this.js.publish(j,kr().encode(O),{headers:L,timeout:u});if(O.revision=J.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}M.resolve(new Ah(O));break}if(F)for(I.fill(F);I.size()>m;){O.chunks++,O.size+=m;const $=I.drain(t.options.max_chunk_size);D.update($),B.push(this.js.publish(S,$,{timeout:u}))}}}catch(P){await this.jsm.streams.purge(this.stream,{filter:S}),M.reject(P)}return M}putBlob(t,r,s){function l(u){return new ReadableStream({pull(c){c.enqueue(u),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(u){const c=new ya,f=u.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 Nl.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(L0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=id(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Bt(),u={info:new Ah(r),error:l};if(r.size===0)return u.data=qk(),l.resolve(null),Promise.resolve(u);let c;const f=Ii();f.orderedConsumer();const d=C0.create(),m=`$O.${this.name}.C.${r.nuid}`,y=await this.js.subscribe(m,f);return(async()=>{for await(const g of y)g.data.length>0&&(d.update(g.data),c.enqueue(g.data)),g.info.pending===0&&(y2(s,d.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),y.unsubscribe())})().then(()=>{l.resolve()}).catch(g=>{c.error(g),l.reject(g)}),u.data=new ReadableStream({start(g){c=g},cancel(){y.unsubscribe()}}),u}linkStore(t,r){if(!(r instanceof Nl))return Promise.reject("bucket required");const s=r,{name:l,error:u}=this._checkNotEmpty(t);if(u)return Promise.reject(u);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 u=await this.rawInfo(t);if(u!==null&&!u.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=kr(),l=oi();return l.set(An.RollupHdr,An.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:u}=this._checkNotEmpty(r.name);if(u)return Promise.reject(u);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,U0(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 un,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 u=kr(),c=Ii();c.orderedConsumer(),t.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((d,m)=>{var y;if(d){s.stop(d);return}if(m!==null){const g=u.decode(m.data);g.deleted&&t.ignoreDeletes===!0||s.push(g),((y=m.info)==null?void 0:y.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.${fa.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=Nk(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=Ul.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?$i.S2:$i.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(),u=new Nl(r,l,t);return await u.init(s),Promise.resolve(u)}}class Ik{constructor(t){C(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:u}=s.nc.features.get(ct.JS_KV);return l?r.bindOnly?Pl.bind(this.js,t,r):Pl.create(this.js,t,r):Promise.reject(new Error(`kv is only supported on servers ${u} 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:u}=s.nc.features.get(ct.JS_OBJECTSTORE);return l?Nl.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class Hd extends Yl{constructor(r,s){super(r,s);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new Mu(r,s),this.streamAPI=new Pd(r,s),this.consumers=new fd(this.consumerAPI),this.streams=new Hk(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 Ik(this)}async publish(r,s=Zn,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||oi();l&&(l.msgID&&u.set(Dr.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(Dr.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(Dr.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(Dr.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(Dr.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=u);let{retries:d,retry_delay:m}=l;d=d||1,m=m||250;let y;for(let x=0;x<d;x++)try{y=await this.nc.request(r,s,f);break}catch(v){if(v.code==="503"&&x+1<d)await _a(m);else throw v}const g=this.parseJsResponse(y);if(g.stream==="")throw De.errorForCode(Ce.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){_n(r),ua(s);let u=this.timeout;l>u&&(u=l),l=l<0?0:Ut(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:u}),d=ca(f);if(d)throw d;return Hl(f,this.timeout)}fetch(r,s,l={}){_n(r),ua(s);let u=null;const c=(l.max_bytes??0)>0;let f=0;const d=c?l.max_bytes:0;let m=null;const y={};if(y.batch=l.batch||1,d){const B=this.nc.features.get(ct.JS_PULL_MAX_BYTES);if(!B.ok)throw new Error(`max_bytes is only supported on servers ${B.min} or better`);y.max_bytes=d}y.no_wait=l.no_wait||!1,y.no_wait&&y.expires&&(y.expires=0);const g=l.expires||0;if(g&&(y.expires=Ut(g)),g===0&&y.no_wait===!1)throw new Error("expires or no_wait is required");const x=l.idle_heartbeat||0;x&&(y.idle_heartbeat=Ut(x),l.delay_heartbeat===!0&&(y.idle_heartbeat=Ut(x*4)));const v=new un,S=y.batch;let j=0;v.protocolFilterFn=(B,I=!1)=>td(B.msg)?(m==null||m.work(),!1):!0,v.dispatchedFn=B=>{if(B){if(c&&(f+=B.data.length),j++,u&&B.info.pending===0)return;(v.getPending()===1&&B.info.pending===0||S===j||d>0&&f>=d)&&v.stop()}};const O=ai(this.nc.options.inboxPrefix),M=this.nc.subscribe(O,{max:l.batch,callback:(B,I)=>{B===null&&(B=ca(I)),B!==null?(u&&(u.cancel(),u=null),Z_(B)?v.stop(Dx(B)===null?void 0:B):v.stop(B)):(m==null||m.work(),v.received++,v.push(Hl(I,this.timeout)))}});return g&&(u=pa(g),u.catch(()=>{M.isClosed()||(M.drain().catch(()=>{}),u=null),m&&m.cancel()})),(async()=>{try{x&&(m=new Ud(x,B=>(v.push(()=>{v.err=new De(`${hr.IdleHeartbeatMissed}: ${B}`,Ce.JetStreamIdleHeartBeat)}),!0)))}catch{}await M.closed,u!==null&&(u.cancel(),u=null),m&&m.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(y),{reply:O}),v}async pullSubscribe(r,s=Ii()){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 u=l.config.ack_policy;if(u===on.None||u===on.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new Vk(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(d){throw f.unsubscribe(),d}return f}async subscribe(r,s=Ii()){const l=await this._processOptions(r,s);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const u=this._buildTypedSubscriptionOpts(l),c=new Mx(this,l.deliver,u);c.info=l;try{await this._maybeCreateConsumer(l)}catch(f){throw c.unsubscribe(),f}return c._maybeSetupHbMonitoring(),c}async _processOptions(r,s=Ii()){const l=S0(s)?s.getOpts():s;if(l.isBind=S0(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!==on.NotSet&&l.config.ack_policy!==on.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=ai(this.nc.options.inboxPrefix),l.config.ack_policy=on.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||Ut(5e3),l.config.ack_wait=Ut(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===on.NotSet&&(l.config.ack_policy=on.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 u=await this.consumerAPI.info(l.stream,l.config.durable_name);if(u){if(u.config.filter_subject&&u.config.filter_subject!==r)throw new Error("subject does not match consumer");const c=l.config.deliver_group??"";if(c===""&&u.push_bound===!0)throw new Error("duplicate subscription");const f=u.config.deliver_group??"";if(c!==f)throw f===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${f}'`);l.last=u,l.config=u.config,l.attached=!0,l.config.durable_name||(l.name=u.name)}}catch(u){if(u.code!=="404")throw u}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||ai(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=Gk(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Hd.ingestionFn(r.ordered),s.protocolFilterFn=(l,u=!1)=>{const c=l;return ed(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==on.None&&(s.dispatchedFn=Kk),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:Jt.All,ack_policy:on.Explicit,ack_wait:Ut(30*1e3),replay_policy:ga.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 u=l;if(!s)return{ingest:!1,protocol:!1};const c=s;if(ca(c.msg)||(d=u.monitor)==null||d.work(),td(c.msg)){const m=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:m,protocol:!0}}else if(ed(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(s):!0,protocol:!1}}}}class qd{constructor(t){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=fk(t),this.listeners=[]}static connect(t={}){return new Promise((r,s)=>{const l=new qd(t);zu.connect(l.options,l).then(u=>{l.protocol=u,(async function(){for await(const c of u.status())l.listeners.forEach(f=>{f.push(c)})})(),r(l)}).catch(u=>{s(u)})})}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 Tx(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=Zn,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||_r.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new De("timeout",Ce.InvalidOption));const u=new un;function c(d){u.push(()=>{u.stop(d)})}function f(d,m){d||m===null?c(d===null?void 0:d):u.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 y=this.subscribe(ai(this.options.inboxPrefix),{callback:(S,j)=>{var O,M;if(((O=j==null?void 0:j.data)==null?void 0:O.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===_r.Count&&(m--,m===0&&g()),s.strategy===_r.JitterTimer&&(v(),x=setTimeout(()=>{g()},300)),s.strategy===_r.SentinelMsg&&j&&j.data.length===0&&g()}});y.requestSubject=t,y.closed.then(()=>{c()}).catch(S=>{u.stop(S)});const g=S=>{S&&u.push(()=>{throw S}),v(),y.drain().then(()=>{c()}).catch(j=>{c()})};u.iterClosed.then(()=>{v(),y==null||y.unsubscribe()}).catch(S=>{v(),y==null||y.unsubscribe()});try{this.publish(t,r,{reply:y.getSubject()})}catch(S){g(S)}let x=setTimeout(()=>{g()},s.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const d=s;d.callback=f,u.iterClosed.then(()=>{m.cancel()}).catch(y=>{m.cancel(y)});const m=new b2(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(y){m.cancel(y)}}return Promise.resolve(u)}request(t,r,s={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(u){return Promise.reject(u)}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 u=s.reply?s.reply:ai(this.options.inboxPrefix),c=Bt(),f=l?new Error:null,d=this.subscribe(u,{max:1,timeout:s.timeout,callback:(m,y)=>{m?(f&&m.code!==Ce.Timeout&&(m.stack+=`
|
|
84
84
|
|
|
85
85
|
${f.stack}`),d.unsubscribe(),c.reject(m)):(m=yx(y),m?(f&&(m.stack+=`
|
|
86
86
|
|
|
87
|
-
${f.stack}`),c.reject(m)):c.resolve(y))}});return d.requestSubject=t,this.protocol.publish(t,r,{reply:u,headers:s.headers}),c}else{const u=new vx(this.protocol.muxSubscriptions,t,s,l);this.protocol.request(u);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:s.headers})}catch(f){u.cancel(f)}const c=Promise.race([u.timer,u.deferred]);return c.catch(()=>{u.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(De.errorForCode(Ee.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(De.errorForCode(Ee.ConnectionClosed)):this.isDraining()?Promise.reject(De.errorForCode(Ee.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 sn;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 Pk(this,t);if(t.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===Ee.NoResponders&&(l.code=Ee.JetStreamNotEnabled),l}return r}jetstream(t={}){return new Hd(this,t)}getServerVersion(){const t=this.info;return t?ms(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw De.errorForCode(Ee.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 Fk(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(De.errorForCode(Ee.ConnectionClosed)):this.isDraining()?Promise.reject(De.errorForCode(Ee.ConnectionDraining)):this.protocol.reconnect()}}class Fk{constructor(t){C(this,"nc");this.nc=t}add(t){try{return new Vl(this.nc,t).start()}catch(r){return Promise.reject(r)}}client(t,r){return new Sk(this.nc,t,r)}}class $k{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(Uu)||"PUT"}get length(){const t=this.sm.header.get(vn.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Yk{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(Ld(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(Uu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const t=((r=this.sm.headers)==null?void 0:r.get(vn.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Mx extends S2{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=ni(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const u=this.info;u.config.name=Pi.next(),u.ordered_consumer_sequence.delivery_seq=0,u.flow_control.heartbeat_count=0,u.flow_control.fc_count=0,u.flow_control.consumer_restarts++,u.deliver=s,u.config.deliver_subject=s,u.config.deliver_policy=Vt.StartSequence,u.config.opt_start_seq=r;const c={};c.stream_name=this.info.stream,c.config=u.config;const f=`${u.api.prefix}.CONSUMER.CREATE.${u.stream}`;this.js._request(f,c,{retries:-1}).then(d=>{const m=d,y=this.sub.info;y.last=m,this.info.config=m.config,this.info.name=m.name}).catch(d=>{const m=new De(`unable to recreate ordered consumer ${u.stream} at seq ${r}`,Ee.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(Ld(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const u=this.sub,c=f=>{var y,g,x,v;const d=n2(409,`${or.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((y=this.info)==null?void 0:y.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!u.noIterator};this.monitor=new Ud(r,c,l)}_checkHbOrderConsumer(r){const s=r.headers.get(vn.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(vn.LastConsumerSeqHdr),10),u=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==u.delivery_seq&&this._resetOrderedConsumer(u.stream_seq+1),!1}_checkOrderedConsumer(r){const s=this.info.ordered_consumer_sequence,l=r.info.streamSequence,u=r.info.deliverySequence;return u!=s.delivery_seq+1?(this._resetOrderedConsumer(s.stream_seq+1),!1):(s.delivery_seq=u,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}`,u=await r.api._request(l);return r.last=u,u}}class Vk extends Mx{constructor(t,r,s){super(t,r,s)}pull(t={batch:1}){const{stream:r,config:s,name:l}=this.sub.info,u=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(ft.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=Ut(f));let d=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(d=t.idle_heartbeat,c.idle_heartbeat=Ut(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,y=`${m.prefix}.CONSUMER.MSG.NEXT.${r}.${u}`,g=this.sub.subject;m.nc.publish(y,m.jc.encode(c),{reply:g})}}}function Gk(e,t){return e?Xk(t):Jk(t)}function Jk(e){return(t,r)=>t?[t,null]:(t=ua(r),t?[t,null]:[null,Hl(r,e)])}function Xk(e){return(t,r)=>{if(t)return[t,null];const s=ua(r);return s!==null?[Dx(s),null]:[null,Hl(r,e)]}}function Dx(e){if(e!==null)switch(e.code){case Ee.JetStream404NoMessages:case Ee.JetStream408RequestTimeout:return null;case Ee.JetStream409:return r2(e)?e:null;default:return e}return null}function Kk(e){e&&e.ack()}function Qk(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 Zk{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=Qk(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]===xl[0]&&t[1]===xl[1]&&t[2]===xl[2]&&t[3]===xl[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=Bt();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const u=this.msg.publisher,c=!((s=u.options)!=null&&s.noAsyncTraces),f=new vx(u.muxSubscriptions,this.msg.reply,{timeout:t.timeout},c);u.request(f);try{u.publish(this.msg.reply,z0,{reply:`${u.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(z0)}nak(t){let r=Rk;t&&(r=Ou().encode(`-NAK ${JSON.stringify({delay:Ut(t)})}`)),this.doAck(r)}working(){this.doAck(xl)}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=Ut(r.expires));const l=vr().encode(s),u=ga.concat(Mk,Lk,l),c=t?{reply:t}:void 0;this.msg.respond(u,c)}term(t=""){let r=Dk;(t==null?void 0:t.length)>0&&(r=Ou().encode(`+TERM ${t}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const Wk="1.30.3",eE="nats.ws";class tE{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=Wk,this.lang=eE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Bt(),this.closedNotification=Bt()}async connect(t,r){const s=Bt();if(r.tls)return s.reject(new De("tls",Ee.InvalidOption)),s;this.options=r;const l=t.src;if(r.wsFactory){const{socket:u,encrypted:c}=await r.wsFactory(t.src,r);this.socket=u,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=u=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(u.data)),this.peeked){this.signal.resolve();return}const c=ga.concat(...this.yields),f=T2(c);if(f!==""){const d=mk.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]);hk(m,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(m){s.reject(m);return}}},this.socket.onclose=u=>{if(this.isDiscarded())return;this.socketClosed=!0;let c;this.done||(u.wasClean||(c=new Error(u.reason)),this._closed(c))},this.socket.onerror=u=>{if(this.isDiscarded())return;const c=u,f=new De(c.message,Ee.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 Sa(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=Bt())}}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 nE(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 u,c;const f=s.hostname,d=s.pathname,m=s.search||"";switch(l){case"http:":case"ws:":case"nats:":c=s.port||"80",u="ws:";break;case"https:":case"wss:":case"tls:":c=s.port||"443",u="wss:";break;default:c=s.port||t===!0?"443":"80",u=t===!0?"wss:":"ws:";break}return`${u}//${f}:${c}${d}${m}`}function Lx(e={}){return _2({defaultPort:443,urlParseFn:nE,factory:()=>new tE}),qd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var ya;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(ya||(ya={}));class Th extends Error{constructor(t,r,s){super(t),this.message=t,this.code=r,this.data=s}}const rE=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"},iE=e=>{const t=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>t!==null?t.name:rE(e),u=()=>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,y=(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(),T=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),B=(F,$)=>{var L,J;if(T){const G=T==null?void 0:T.methods.find(ue=>$===ue.name);if(G)return G.rtype==="promise"?ue=>r.nativePromise(g,$.toString(),ue):(ue,oe)=>r.nativeCallback(g,$.toString(),ue,oe);if(F)return(L=F[$])===null||L===void 0?void 0:L.bind(F)}else{if(F)return(J=F[$])===null||J===void 0?void 0:J.bind(F);throw new Th(`"${g}" plugin is not implemented on ${S}`,ya.Unimplemented)}},I=F=>{let $;const L=(...J)=>{const G=M().then(ue=>{const oe=B(ue,F);if(oe){const re=oe(...J);return $=re==null?void 0:re.remove,re}else throw new Th(`"${g}.${F}()" is not implemented on ${S}`,ya.Unimplemented)});return F==="addListener"&&(G.remove=async()=>$()),G};return L.toString=()=>`${F.toString()}() { [capacitor code] }`,Object.defineProperty(L,"name",{value:F,writable:!1,configurable:!1}),L},ee=I("addListener"),P=I("removeListener"),D=(F,$)=>{const L=ee({eventName:F},$),J=async()=>{const ue=await L;P({eventName:F,callbackId:ue},$)},G=new Promise(ue=>L.then(()=>ue({remove:J})));return G.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await J()},G},Z=new Proxy({},{get(F,$){switch($){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return T?D:ee;case"removeListener":return P;default:return I($)}}});return s[g]=Z,m.set(g,{name:g,proxy:Z,platforms:new Set([...Object.keys(x),...T?[S]:[]])}),Z};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=d,r.isNativePlatform=u,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=Th,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},sE=e=>e.Capacitor=iE(e),Jn=sE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ys=Jn.registerPlugin;class Id{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 u=this.windowListeners[t];u&&!u.registered&&this.addWindowListener(u),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 u=this.retainedEventArguments[t];u||(u=[]),u.push(r),this.retainedEventArguments[t]=u}return}l.forEach(u=>u(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,ya.Unimplemented)}unavailable(t="not available"){return new Jn.Exception(t,ya.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 B0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),P0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class aE extends Id{async getCookies(){const t=document.cookie,r={};return t.split(";").forEach(s=>{if(s.length<=0)return;let[l,u]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=P0(l).trim(),u=P0(u).trim(),r[l]=u}),r}async setCookie(t){try{const r=B0(t.key),s=B0(t.value),l=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",u=(t.path||"/").replace("path=",""),c=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${r}=${s||""}${l}; path=${u}; ${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)}}}ys("CapacitorCookies",{web:()=>new aE});const lE=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)}),oE=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[t[c]],l),{})},uE=(e,t=!0)=>e?Object.entries(e).reduce((s,l)=>{const[u,c]=l;let f,d;return Array.isArray(c)?(d="",c.forEach(m=>{f=t?encodeURIComponent(m):m,d+=`${u}=${f}&`}),d.slice(0,-1)):(f=t?encodeURIComponent(c):c,d=`${u}=${f}`),`${s}&${d}`},"").substr(1):null,cE=(e,t={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},t),l=oE(e.headers)["content-type"]||"";if(typeof e.data=="string")r.body=e.data;else if(l.includes("application/x-www-form-urlencoded")){const u=new URLSearchParams;for(const[c,f]of Object.entries(e.data||{}))u.set(c,f);r.body=u.toString()}else if(l.includes("multipart/form-data")||e.data instanceof FormData){const u=new FormData;if(e.data instanceof FormData)e.data.forEach((f,d)=>{u.append(d,f)});else for(const f of Object.keys(e.data))u.append(f,e.data[f]);r.body=u;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 fE extends Id{async request(t){const r=cE(t,t.webFetchExtra),s=uE(t.params,t.shouldEncodeUrlParams),l=s?`${t.url}?${s}`:t.url,u=await fetch(l,r),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?t:{};c.includes("application/json")&&(f="json");let d,m;switch(f){case"arraybuffer":case"blob":m=await u.blob(),d=await lE(m);break;case"json":d=await u.json();break;case"document":case"text":default:d=await u.text()}const y={};return u.headers.forEach((g,x)=>{y[x]=g}),{data:d,headers:y,status:u.status,url:u.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"}))}}ys("CapacitorHttp",{web:()=>new fE});var H0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(H0||(H0={}));var q0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(q0||(q0={}));class hE extends Id{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")}}ys("SystemBars",{web:()=>new hE});const dE="modulepreload",mE=function(e){return"/"+e},I0={},Fd=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let c=function(m){return Promise.all(m.map(y=>Promise.resolve(y).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=mE(m),m in I0)return;I0[m]=!0;const y=m.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const x=document.createElement("link");if(x.rel=y?"stylesheet":dE,y||(x.as="script"),x.crossOrigin="",x.href=m,d&&x.setAttribute("nonce",d),document.head.appendChild(x),y)return new Promise((v,S)=>{x.addEventListener("load",v),x.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${m}`)))})}))}function u(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"&&u(f.reason);return t().catch(u)})},dd=ys("App",{web:()=>Fd(()=>import("./web-BICLWfuY.js"),[]).then(e=>new e.AppWeb)}),pE=ys("Network",{web:()=>Fd(()=>import("./web-Ct4onsL_.js"),[]).then(e=>new e.NetworkWeb)}),Bu=Jn.isNativePlatform()?"https://app.palmier.me":"";async function zx(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 gE(e,t,r){return zx("POST",e,t)}function yE(e,t){return zx("GET",e,void 0)}const F0=Jn.isNativePlatform(),Ux=A.createContext(null),bE=2e3,jh=6e3,xE=1500,vE=6e4;function wE({children:e,activeHost:t}){const[r,s]=A.useState(null),[l,u]=A.useState(!1),c=A.useRef(null),[f,d]=A.useState(!1),[m,y]=A.useState(!1),[g,x]=A.useState(!1),[v,S]=A.useState(!1),T=A.useRef(Ou()),O=A.useRef(new Set),M=A.useRef(0),B=!!t.directUrl,I=F0&&!B&&!!t.lanUrl&&v,ee=m||g?"disconnected":B?f?"direct":"connecting":l?I?"lan":"nats":"connecting",P=ee!=="connecting"&&ee!=="disconnected";A.useEffect(()=>{if(!F0||B||!t.lanUrl){S(!1);return}let F=!1;const $=t.lanUrl,L=t.hostId;async function J(){console.log("[HOST/LAN] probing",$);try{const re=await fetch(`${$}/health`,{signal:AbortSignal.timeout(xE)});if(F)return;if(!re.ok){console.log("[HOST/LAN] probe got non-ok:",re.status),S(!1);return}const q=await re.json(),Y=q.hostId===L;Y?console.log("[HOST/LAN] reachable"):console.log("[HOST/LAN] hostId mismatch — got:",q.hostId,"expected:",L),S(Y)}catch(re){F||(console.log("[HOST/LAN] probe failed:",re instanceof Error?re.message:re),S(!1))}}J();const G=window.setInterval(J,vE),ue=dd.addListener("appStateChange",re=>{re.isActive&&J()}),oe=pE.addListener("networkStatusChange",()=>J());return()=>{F=!0,clearInterval(G),ue.then(re=>re.remove()),oe.then(re=>re.remove())}},[t.hostId,t.lanUrl,B]),A.useEffect(()=>{if(B){c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),u(!1));return}let F=!1,$=1e3;const L=3e4;async function J(){for(;!F;)try{const G=await fetch(`${Bu}/api/nats-credentials/${t.hostId}`);if(F)return;if(G.status===401||G.status===403||G.status===404){console.error("[NATS] Host not found or rejected by relay:",G.status),x(!0);return}if(!G.ok)throw new Error(`credentials fetch ${G.status}`);const ue=await G.json();if(!ue.natsWsUrl){console.error("[NATS] Relay returned empty natsWsUrl — treating as terminal"),x(!0);return}if(F)return;console.log("[NATS] Connecting to",ue.natsWsUrl);const oe=await Lx({servers:ue.natsWsUrl,authenticator:Cx(ue.natsJwt,new TextEncoder().encode(ue.natsNkeySeed)),pingInterval:3e4,maxPingOut:2});if(F){oe.close().catch(()=>{});return}if(console.log("[NATS] Connected"),c.current=oe,s(oe),u(!0),$=1e3,await oe.closed(),F)return;console.log("[NATS] Connection closed, will reconnect"),c.current=null,s(null),u(!1)}catch(G){if(F)return;console.warn(`[NATS] Connect failed, retrying in ${$}ms:`,G),u(!1),await new Promise(ue=>setTimeout(ue,$)),$=Math.min($*2,L)}}return J(),()=>{F=!0,c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),u(!1))}},[B,t]),A.useEffect(()=>{if(B)return;const F=dd.addListener("appStateChange",$=>{if(!$.isActive||!c.current)return;const L=c.current;Promise.race([L.flush(),new Promise((J,G)=>setTimeout(()=>G(new Error("ping timeout")),2e3))]).catch(()=>{console.log("[NATS] Resume probe failed — cycling conn"),L.close().catch(()=>{})})});return()=>{F.then($=>$.remove())}},[B]),A.useEffect(()=>{if(!B){d(!1);return}const F=new AbortController;async function $(){var ue;const J=new AbortController,G=setTimeout(()=>J.abort(),bE);F.signal.addEventListener("abort",()=>J.abort());try{const oe=await fetch(`${t.directUrl}/events`,{headers:{Authorization:`Bearer ${t.clientToken}`},signal:J.signal});return clearTimeout(G),oe.ok?((ue=oe.body)==null?void 0:ue.getReader())??null:null}catch{return clearTimeout(G),null}}async function L(J){d(!0),console.log("[HOST] SSE connected to",t.directUrl),M.current=Date.now();function G(){setTimeout(()=>{F.signal.aborted||Date.now()-M.current<jh||(console.log("[HOST] Heartbeat timeout — no data for",jh/1e3,"s"),F.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},jh)}G();const ue=new TextDecoder;let oe="";try{for(;;){const{done:re,value:q}=await J.read();if(re)break;oe+=ue.decode(q,{stream:!0}),M.current=Date.now(),G();const Y=oe.split(`
|
|
88
|
-
`);oe=Y.pop()??"";for(const ae of Y)if(ae.startsWith("data: ")){const ve=ae.slice(6);try{const N=JSON.parse(ve);if(N.task_id&&N.event_type){const z=`host-event.${t.hostId}.${N.task_id}`;for(const W of O.current)W({subject:z,data:T.current.encode(ve)})}}catch{}}}}catch{}}return(async()=>{const J=await $();J&&await L(J)})(),()=>{F.abort(),d(!1)}},[t,B]);const D=A.useCallback(async(F,$,L)=>{function J(oe){oe&&typeof oe=="object"&&oe.error==="Unauthorized"&&y(!0)}async function G(oe,re){console.log(`[HOST/${re}] → ${F}`,$??"");const q=await fetch(`${oe}/rpc/${F}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.clientToken}`},body:$!=null?JSON.stringify($):void 0,signal:L!=null&&L.timeout?AbortSignal.timeout(L.timeout):void 0});if(q.status===401)throw y(!0),new Error("Unauthorized");const Y=await q.json();return J(Y),console.log(`[HOST/${re}] ← ${F}`,Y),Y}async function ue(){if(!c.current)throw new Error("Not connected");const oe=`host.${t.hostId}.rpc.${F}`,re={...$??{},clientToken:t.clientToken},q=T.current.encode(JSON.stringify(re));console.log(`[HOST/NATS] → ${F}`,$??"");const Y=await c.current.request(oe,q,{timeout:(L==null?void 0:L.timeout)??1e4}),ae=JSON.parse(T.current.decode(Y.data));return J(ae),console.log(`[HOST/NATS] ← ${F}`,ae),ae}if(B)return G(t.directUrl,"HTTP");if(I&&t.lanUrl)try{return await G(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 ue()},[t,B,I]),Z=A.useCallback((F,$)=>{if(B)return O.current.add($),()=>{O.current.delete($)};if(c.current){const L=c.current.subscribe(`host-event.${F}.>`);let J=!1;return(async()=>{try{for await(const G of L){if(J)break;$({subject:G.subject,data:G.data})}}catch{}})(),()=>{J=!0,L.unsubscribe()}}return()=>{}},[t,B]);return b.jsx(Ux.Provider,{value:{connected:P,mode:ee,nc:r,request:D,subscribeEvents:Z,activeHost:t,unauthorized:m},children:e})}function si(){const e=A.useContext(Ux);if(!e)throw new Error("useHostConnection must be used within HostConnectionProvider");return e}const hn=Jn.isNativePlatform()?ys("Device"):null;function SE(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 $d(){const{activeHost:e}=si(),t=e.timezone;return A.useCallback(r=>SE(r,t),[t])}function _E(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(u=>u.type===s))==null?void 0:l.value)??""};return{date:`${r("year")}-${r("month")}-${r("day")}`,time:`${r("hour")}:${r("minute")}`}}function kE(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(u=>u.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 EE(e,t,r){return new Date(Date.UTC(e,t-1,r)).getUTCDay()}function CE(e,t){return new Date(Date.UTC(e,t,0)).getUTCDate()}function $0(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 Ol(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 AE(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")},u=Date.UTC(l("year"),l("month")-1,l("day"),l("hour")%24,l("minute"),l("second"));return r-(u-r)}function TE(e,t){const r=e.split(" ");if(r.length!==5)return null;const[s,l,u,,c]=r;if(l==="*"){const y=Number(s);if(Number.isNaN(y))return null;if(y>t.minute)return{...t,minute:y};const g=new Date(Date.UTC(t.year,t.month-1,t.day,t.hour+1,y));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 y=Number(c);if(Number.isNaN(y))return null;for(let g=0;g<8;g++){const x=$0({...t,hour:d,minute:f},g);if(EE(x.year,x.month,x.day)===y&&Ol(x,t)>0)return x}return null}if(u!=="*"){const y=Number(u);if(Number.isNaN(y))return null;let g=t.year,x=t.month;for(let v=0;v<24;v++){if(y<=CE(g,x)){const S={year:g,month:x,day:y,hour:d,minute:f};if(Ol(S,t)>0)return S}x++,x>12&&(x=1,g++)}return null}const m={...t,hour:d,minute:f};return Ol(m,t)>0?m:$0(m,1)}function jE(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 NE(e,t,r){if(!e||!t||t.length===0||e==="on_new_notification"||e==="on_new_sms")return null;const s=kE(r),l=[];for(const u of t)if(e==="specific_times"){const c=jE(u);c&&Ol(c,s)>0&&l.push(c)}else{const c=TE(u,s);c&&l.push(c)}return l.length===0?null:(l.sort(Ol),AE(l[0],r))}const Bx={};function OE(e){for(const t of e)Bx[t.key]=t.label}function md(e){return Bx[e]??e}const RE=()=>window.matchMedia("(max-width: 600px)").matches;function ME({task:e,lastEvent:t,onEdit:r,onDelete:s,onViewRun:l}){var q;const{request:u,activeHost:c}=si(),f=$d(),d=c.timezone,[m,y]=A.useState(!1),[g,x]=A.useState(!1),[v,S]=A.useState(!1),T=A.useRef(null),O=(t==null?void 0:t.running_state)==="started",M=(((q=e.schedule_values)==null?void 0:q.length)??0)>0,B=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",I=!!e.command,ee=!!e.schedule_type&&(M||B)||I,D=!!e.schedule_enabled&&ee?O?"var(--color-success)":(t==null?void 0:t.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";A.useEffect(()=>{if(!g)return;function Y(ae){T.current&&!T.current.contains(ae.target)&&x(!1)}return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[g]);function Z(){RE()?S(!0):x(Y=>!Y)}function F(){x(!1),S(!1)}async function $(){if(F(),!!confirm("Abort this task?")){y(!0);try{await u("task.abort",{id:e.id})}catch(Y){console.error("Abort failed:",Y)}finally{y(!1)}}}async function L(){F();try{const Y=await u("task.run",{id:e.id});l(e.id,Y.run_id)}catch(Y){console.error("Run failed:",Y)}}async function J(){if(F(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),s(e.id)}catch(Y){console.error("Delete failed:",Y)}}const G={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function ue(){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 Y=NE(e.schedule_type,e.schedule_values,d);return Y===null?"No upcoming runs":`Next: ${f(Y)}`}const oe=ue(),re=b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:()=>{F(),r(e)},children:[b.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),b.jsxs("button",{onClick:()=>{F(),l(e.id)},children:[b.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),O?b.jsxs("button",{className:"menu-item-danger",onClick:$,disabled:m,children:[b.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:L,children:[b.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),b.jsxs("button",{className:"menu-item-danger",onClick:J,children:[b.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"task-card",onClick:()=>l(e.id,O?"latest":void 0),children:[b.jsxs("div",{className:"task-card-header",children:[b.jsxs("div",{className:"task-card-title-row",children:[O?b.jsx("span",{className:"status-spinner",children:b.jsx("span",{})}):b.jsx("span",{className:"status-dot",style:{backgroundColor:D}}),b.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),b.jsx("div",{className:"task-card-actions",onClick:Y=>Y.stopPropagation(),children:b.jsxs("div",{className:"task-card-menu",ref:T,children:[b.jsx("button",{className:"task-card-menu-btn",onClick:Z,"aria-label":"Task actions",children:"⋮"}),g&&b.jsx("div",{className:"task-card-menu-dropdown",children:re})]})})]}),b.jsxs("div",{className:"task-card-meta",children:[e.agent&&b.jsx("span",{className:"task-card-agent",children:md(e.agent)}),t&&G[t.running_state]&&b.jsxs("span",{className:"task-card-last-event",children:[G[t.running_state]," ",f(t.time_stamp)]}),ee&&b.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?oe:"Schedule disabled"})]})]}),v&&ds.createPortal(b.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>S(!1),children:b.jsxs("div",{className:"bottom-sheet",onClick:Y=>Y.stopPropagation(),children:[b.jsx("div",{className:"bottom-sheet-handle"}),b.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),b.jsx("div",{className:"bottom-sheet-actions",children:re})]})}),document.body)]})}function DE({permissions:e}){return b.jsxs("div",{className:"permissions-dialog",children:[b.jsx("h2",{children:"Granted Permissions"}),b.jsx("div",{className:"permissions-dialog-scroll",children:e&&e.length>0?b.jsx("div",{className:"permissions-section",children:b.jsx("ul",{className:"permissions-list",children:e.map((t,r)=>b.jsxs("li",{className:"permission-item",children:[b.jsx("span",{className:"permission-tool",children:t.name}),b.jsx("span",{className:"permission-desc",children:t.description})]},r))})}):b.jsx("p",{className:"permissions-empty",children:"No permissions have been granted for this task."})}),b.jsx("div",{className:"permissions-dialog-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const ra=[];function LE(){const e=ra.pop();e&&(e.pushed.current=!1,e.close())}let Y0=!1;function zE(){Y0||(Y0=!0,window.addEventListener("popstate",LE))}function pd(e,t){const r=A.useRef(!1),s=A.useRef(t);s.current=t;const l=A.useCallback(()=>s.current(),[]),u=A.useRef({close:l,pushed:r});u.current.close=l,A.useEffect(()=>{if(e&&!r.current)zE(),history.pushState({modal:!0},""),ra.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=ra.indexOf(u.current);c!==-1&&ra.splice(c,1),history.back()}},[e,l]),A.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=ra.indexOf(c);f!==-1&&ra.splice(f,1),history.back()}}},[])}const UE=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],BE=["specific_times","hourly","daily","weekly","monthly"];function pu(e){return BE.includes(e)}function PE(e){return e==="on_new_notification"||e==="on_new_sms"}function ti(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function HE(e){const t=e.split(" ");if(t.length!==5)return ti();const[r,s,l,,u]=t;if(s==="*")return ti("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...ti("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...ti("monthly"),time:c,dayOfMonth:l}:{...ti("daily"),time:c}}function Px(e,t){if(e==="specific_times"){const[r,s]=t.split("T");return{...ti("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return HE(t)}function qE(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 IE(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:qE(e)}function Nh(e){return e==="specific_times"?"specific_times":e==="on_new_notification"?"on_new_notification":e==="on_new_sms"?"on_new_sms":"crons"}function Oh(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 FE({initial:e,agents:t,hostPlatform:r,isNotificationListener:s,onSaved:l,onCancel:u}){var Pe;const{request:c,activeHost:f}=si(),{setHostLastAgent:d}=qi(),m=()=>{var Oe;const de=f.lastAgent,Me=t.map(gt=>gt.key);return de&&Me.includes(de)?de:((Oe=t[0])==null?void 0:Oe.key)??""},[y,g]=A.useState((e==null?void 0:e.user_prompt)??""),[x,v]=A.useState((e==null?void 0:e.agent)??m()),S=!!((Pe=e==null?void 0:e.permissions)!=null&&Pe.length)&&x===(e==null?void 0:e.agent),[T,O]=A.useState(!1),M=A.useCallback(()=>O(!1),[]);pd(T,M);const[B,I]=A.useState(null),[ee,P]=A.useState(()=>Oh(e)),[D,Z]=A.useState(()=>{const de=e==null?void 0:e.schedule_type,Me=e==null?void 0:e.schedule_values;if(Me&&(de==="crons"||de==="specific_times"))return Me.map(gt=>Px(de,gt));const Oe=Oh(e);return pu(Oe)?[ti(Oe)]:[]}),[F,$]=A.useState((e==null?void 0:e.requires_confirmation)??!1),[L,J]=A.useState(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0),[G,ue]=A.useState((e==null?void 0:e.yolo_mode)??!1),[oe,re]=A.useState((e==null?void 0:e.foreground_mode)??!1),[q,Y]=A.useState((e==null?void 0:e.command)??""),[ae,ve]=A.useState(!1),N=(e==null?void 0:e.schedule_type)==="on_new_notification"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[z,W]=A.useState(N),[_,ye]=A.useState([]),[Ae,_e]=A.useState(!1),[Re,Ye]=A.useState(!1),[Ce,ot]=A.useState(""),jt=A.useCallback(()=>Ye(!1),[]);pd(Re,jt),A.useEffect(()=>{if(ee!=="on_new_notification"||!s||!Jn.isNativePlatform()||!hn)return;let de=!1;return _e(!0),hn.getInstalledApps().then(({apps:Me})=>{if(de)return;const Oe="com.palmier.app",gt=Me.filter(it=>it.packageName!==Oe).sort((it,_n)=>(it.appName||it.packageName).localeCompare(_n.appName||_n.packageName));ye(gt)}).catch(()=>{}).finally(()=>{de||_e(!1)}),()=>{de=!0}},[ee,s]);const en=(e==null?void 0:e.schedule_type)==="on_new_sms"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[Ht,Be]=A.useState(en),rt=A.useRef(null),Ve=pu(ee),Et=ee==="command",Rt=PE(ee),Kn=ee==="specific_times"||ee==="daily"||ee==="weekly"||ee==="monthly",Nt=t.find(de=>de.key===x),tn=!!(Nt!=null&&Nt.supportsYolo);A.useEffect(()=>{!tn&&G&&ue(!1)},[tn,G]);const wn=!!e,Rn=Oh(e),mt=!wn||y!==((e==null?void 0:e.user_prompt)??"")||x!==((e==null?void 0:e.agent)??"")||ee!==Rn||F!==((e==null?void 0:e.requires_confirmation)??!1)||L!==(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0)||G!==((e==null?void 0:e.yolo_mode)??!1)||oe!==((e==null?void 0:e.foreground_mode)??!1)||Et&&q!==((e==null?void 0:e.command)??"")||Ve&&(JSON.stringify(Ze())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Nh(ee)!==((e==null?void 0:e.schedule_type)??void 0))||Rt&&ee!==(e==null?void 0:e.schedule_type)||ee==="on_new_notification"&&z.trim()!==N.trim()||ee==="on_new_sms"&&Ht.trim()!==en.trim(),Sn=_E(f.timezone),ce=Ve&&D.some(de=>de.schedule==="specific_times"&&(!de.onceDate||de.onceDate<Sn.date||de.onceDate===Sn.date&&(de.onceTime??"")<=Sn.time)),ke=mt&&!!y.trim()&&!ce&&(!Et||!!q.trim())&&(!Ve||D.length>0);function be(de,Me){Z(Oe=>Oe.map((gt,it)=>it===de?{...gt,...Me}:gt))}function we(de){Z(Me=>Me.filter((Oe,gt)=>gt!==de))}function Ne(){pu(ee)&&Z(de=>[...de,de.length>0?{...de[de.length-1]}:ti(ee)])}function Ge(de){P(de),pu(de)?Z([ti(de)]):(Z([]),$(!1)),de==="command"?setTimeout(()=>{var Me;return(Me=rt.current)==null?void 0:Me.focus()},0):Y(""),de!=="on_new_notification"&&W(N),de!=="on_new_sms"&&Be(en)}function Ze(){return D.flatMap(de=>{const Me=IE(de);return Me?[Me]:[]})}function ct(){return G?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(y))}});return d.requestSubject=t,this.protocol.publish(t,r,{reply:u,headers:s.headers}),c}else{const u=new vx(this.protocol.muxSubscriptions,t,s,l);this.protocol.request(u);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:s.headers})}catch(f){u.cancel(f)}const c=Promise.race([u.timer,u.deferred]);return c.catch(()=>{u.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 un;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 Pk(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 Hd(this,t)}getServerVersion(){const t=this.info;return t?gs(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 Fk(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 Fk{constructor(t){C(this,"nc");this.nc=t}add(t){try{return new Vl(this.nc,t).start()}catch(r){return Promise.reject(r)}}client(t,r){return new Sk(this.nc,t,r)}}class $k{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(Uu)||"PUT"}get length(){const t=this.sm.header.get(An.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Yk{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(Ld(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(Uu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const t=((r=this.sm.headers)==null?void 0:r.get(An.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Mx extends S2{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=ai(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const u=this.info;u.config.name=Fi.next(),u.ordered_consumer_sequence.delivery_seq=0,u.flow_control.heartbeat_count=0,u.flow_control.fc_count=0,u.flow_control.consumer_restarts++,u.deliver=s,u.config.deliver_subject=s,u.config.deliver_policy=Jt.StartSequence,u.config.opt_start_seq=r;const c={};c.stream_name=this.info.stream,c.config=u.config;const f=`${u.api.prefix}.CONSUMER.CREATE.${u.stream}`;this.js._request(f,c,{retries:-1}).then(d=>{const m=d,y=this.sub.info;y.last=m,this.info.config=m.config,this.info.name=m.name}).catch(d=>{const m=new De(`unable to recreate ordered consumer ${u.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(Ld(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const u=this.sub,c=f=>{var y,g,x,v;const d=n2(409,`${hr.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((y=this.info)==null?void 0:y.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!u.noIterator};this.monitor=new Ud(r,c,l)}_checkHbOrderConsumer(r){const s=r.headers.get(An.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(An.LastConsumerSeqHdr),10),u=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==u.delivery_seq&&this._resetOrderedConsumer(u.stream_seq+1),!1}_checkOrderedConsumer(r){const s=this.info.ordered_consumer_sequence,l=r.info.streamSequence,u=r.info.deliverySequence;return u!=s.delivery_seq+1?(this._resetOrderedConsumer(s.stream_seq+1),!1):(s.delivery_seq=u,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}`,u=await r.api._request(l);return r.last=u,u}}class Vk extends Mx{constructor(t,r,s){super(t,r,s)}pull(t={batch:1}){const{stream:r,config:s,name:l}=this.sub.info,u=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(ct.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=Ut(f));let d=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(d=t.idle_heartbeat,c.idle_heartbeat=Ut(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,y=`${m.prefix}.CONSUMER.MSG.NEXT.${r}.${u}`,g=this.sub.subject;m.nc.publish(y,m.jc.encode(c),{reply:g})}}}function Gk(e,t){return e?Xk(t):Jk(t)}function Jk(e){return(t,r)=>t?[t,null]:(t=ca(r),t?[t,null]:[null,Hl(r,e)])}function Xk(e){return(t,r)=>{if(t)return[t,null];const s=ca(r);return s!==null?[Dx(s),null]:[null,Hl(r,e)]}}function Dx(e){if(e!==null)switch(e.code){case Ce.JetStream404NoMessages:case Ce.JetStream408RequestTimeout:return null;case Ce.JetStream409:return r2(e)?e:null;default:return e}return null}function Kk(e){e&&e.ack()}function Qk(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 Zk{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=Qk(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]===xl[0]&&t[1]===xl[1]&&t[2]===xl[2]&&t[3]===xl[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=Bt();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const u=this.msg.publisher,c=!((s=u.options)!=null&&s.noAsyncTraces),f=new vx(u.muxSubscriptions,this.msg.reply,{timeout:t.timeout},c);u.request(f);try{u.publish(this.msg.reply,z0,{reply:`${u.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(z0)}nak(t){let r=Rk;t&&(r=Ou().encode(`-NAK ${JSON.stringify({delay:Ut(t)})}`)),this.doAck(r)}working(){this.doAck(xl)}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=Ut(r.expires));const l=kr().encode(s),u=ya.concat(Mk,Lk,l),c=t?{reply:t}:void 0;this.msg.respond(u,c)}term(t=""){let r=Dk;(t==null?void 0:t.length)>0&&(r=Ou().encode(`+TERM ${t}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const Wk="1.30.3",eE="nats.ws";class tE{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=Wk,this.lang=eE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Bt(),this.closedNotification=Bt()}async connect(t,r){const s=Bt();if(r.tls)return s.reject(new De("tls",Ce.InvalidOption)),s;this.options=r;const l=t.src;if(r.wsFactory){const{socket:u,encrypted:c}=await r.wsFactory(t.src,r);this.socket=u,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=u=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(u.data)),this.peeked){this.signal.resolve();return}const c=ya.concat(...this.yields),f=j2(c);if(f!==""){const d=mk.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]);hk(m,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(m){s.reject(m);return}}},this.socket.onclose=u=>{if(this.isDiscarded())return;this.socketClosed=!0;let c;this.done||(u.wasClean||(c=new Error(u.reason)),this._closed(c))},this.socket.onerror=u=>{if(this.isDiscarded())return;const c=u,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 _a(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=Bt())}}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 nE(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 u,c;const f=s.hostname,d=s.pathname,m=s.search||"";switch(l){case"http:":case"ws:":case"nats:":c=s.port||"80",u="ws:";break;case"https:":case"wss:":case"tls:":c=s.port||"443",u="wss:";break;default:c=s.port||t===!0?"443":"80",u=t===!0?"wss:":"ws:";break}return`${u}//${f}:${c}${d}${m}`}function Lx(e={}){return _2({defaultPort:443,urlParseFn:nE,factory:()=>new tE}),qd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var ba;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(ba||(ba={}));class jh extends Error{constructor(t,r,s){super(t),this.message=t,this.code=r,this.data=s}}const rE=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"},iE=e=>{const t=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>t!==null?t.name:rE(e),u=()=>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,y=(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 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),B=(F,$)=>{var L,J;if(j){const G=j==null?void 0:j.methods.find(ce=>$===ce.name);if(G)return G.rtype==="promise"?ce=>r.nativePromise(g,$.toString(),ce):(ce,ue)=>r.nativeCallback(g,$.toString(),ce,ue);if(F)return(L=F[$])===null||L===void 0?void 0:L.bind(F)}else{if(F)return(J=F[$])===null||J===void 0?void 0:J.bind(F);throw new jh(`"${g}" plugin is not implemented on ${S}`,ba.Unimplemented)}},I=F=>{let $;const L=(...J)=>{const G=M().then(ce=>{const ue=B(ce,F);if(ue){const re=ue(...J);return $=re==null?void 0:re.remove,re}else throw new jh(`"${g}.${F}()" is not implemented on ${S}`,ba.Unimplemented)});return F==="addListener"&&(G.remove=async()=>$()),G};return L.toString=()=>`${F.toString()}() { [capacitor code] }`,Object.defineProperty(L,"name",{value:F,writable:!1,configurable:!1}),L},ee=I("addListener"),P=I("removeListener"),D=(F,$)=>{const L=ee({eventName:F},$),J=async()=>{const ce=await L;P({eventName:F,callbackId:ce},$)},G=new Promise(ce=>L.then(()=>ce({remove:J})));return G.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await J()},G},Z=new Proxy({},{get(F,$){switch($){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return j?D:ee;case"removeListener":return P;default:return I($)}}});return s[g]=Z,m.set(g,{name:g,proxy:Z,platforms:new Set([...Object.keys(x),...j?[S]:[]])}),Z};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=d,r.isNativePlatform=u,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=jh,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},sE=e=>e.Capacitor=iE(e),Wn=sE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),xs=Wn.registerPlugin;class Id{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 u=this.windowListeners[t];u&&!u.registered&&this.addWindowListener(u),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 u=this.retainedEventArguments[t];u||(u=[]),u.push(r),this.retainedEventArguments[t]=u}return}l.forEach(u=>u(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 Wn.Exception(t,ba.Unimplemented)}unavailable(t="not available"){return new Wn.Exception(t,ba.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 B0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),P0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class aE extends Id{async getCookies(){const t=document.cookie,r={};return t.split(";").forEach(s=>{if(s.length<=0)return;let[l,u]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=P0(l).trim(),u=P0(u).trim(),r[l]=u}),r}async setCookie(t){try{const r=B0(t.key),s=B0(t.value),l=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",u=(t.path||"/").replace("path=",""),c=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${r}=${s||""}${l}; path=${u}; ${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)}}}xs("CapacitorCookies",{web:()=>new aE});const lE=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)}),oE=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[t[c]],l),{})},uE=(e,t=!0)=>e?Object.entries(e).reduce((s,l)=>{const[u,c]=l;let f,d;return Array.isArray(c)?(d="",c.forEach(m=>{f=t?encodeURIComponent(m):m,d+=`${u}=${f}&`}),d.slice(0,-1)):(f=t?encodeURIComponent(c):c,d=`${u}=${f}`),`${s}&${d}`},"").substr(1):null,cE=(e,t={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},t),l=oE(e.headers)["content-type"]||"";if(typeof e.data=="string")r.body=e.data;else if(l.includes("application/x-www-form-urlencoded")){const u=new URLSearchParams;for(const[c,f]of Object.entries(e.data||{}))u.set(c,f);r.body=u.toString()}else if(l.includes("multipart/form-data")||e.data instanceof FormData){const u=new FormData;if(e.data instanceof FormData)e.data.forEach((f,d)=>{u.append(d,f)});else for(const f of Object.keys(e.data))u.append(f,e.data[f]);r.body=u;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 fE extends Id{async request(t){const r=cE(t,t.webFetchExtra),s=uE(t.params,t.shouldEncodeUrlParams),l=s?`${t.url}?${s}`:t.url,u=await fetch(l,r),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?t:{};c.includes("application/json")&&(f="json");let d,m;switch(f){case"arraybuffer":case"blob":m=await u.blob(),d=await lE(m);break;case"json":d=await u.json();break;case"document":case"text":default:d=await u.text()}const y={};return u.headers.forEach((g,x)=>{y[x]=g}),{data:d,headers:y,status:u.status,url:u.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"}))}}xs("CapacitorHttp",{web:()=>new fE});var H0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(H0||(H0={}));var q0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(q0||(q0={}));class hE extends Id{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")}}xs("SystemBars",{web:()=>new hE});const dE="modulepreload",mE=function(e){return"/"+e},I0={},Fd=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let c=function(m){return Promise.all(m.map(y=>Promise.resolve(y).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=mE(m),m in I0)return;I0[m]=!0;const y=m.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const x=document.createElement("link");if(x.rel=y?"stylesheet":dE,y||(x.as="script"),x.crossOrigin="",x.href=m,d&&x.setAttribute("nonce",d),document.head.appendChild(x),y)return new Promise((v,S)=>{x.addEventListener("load",v),x.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${m}`)))})}))}function u(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"&&u(f.reason);return t().catch(u)})},dd=xs("App",{web:()=>Fd(()=>import("./web-CqKL3jGH.js"),[]).then(e=>new e.AppWeb)}),pE=xs("Network",{web:()=>Fd(()=>import("./web-DNTmjXM5.js"),[]).then(e=>new e.NetworkWeb)}),Bu=Wn.isNativePlatform()?"https://app.palmier.me":"";async function zx(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 gE(e,t,r){return zx("POST",e,t)}function yE(e,t){return zx("GET",e,void 0)}const F0=Wn.isNativePlatform(),Ux=A.createContext(null),bE=2e3,Th=6e3,xE=1500,vE=6e4;function wE({children:e,activeHost:t}){const[r,s]=A.useState(null),[l,u]=A.useState(!1),c=A.useRef(null),[f,d]=A.useState(!1),[m,y]=A.useState(!1),[g,x]=A.useState(!1),[v,S]=A.useState(!1),j=A.useRef(Ou()),O=A.useRef(new Set),M=A.useRef(0),B=!!t.directUrl,I=F0&&!B&&!!t.lanUrl&&v,ee=m||g?"disconnected":B?f?"direct":"connecting":l?I?"lan":"nats":"connecting",P=ee!=="connecting"&&ee!=="disconnected";A.useEffect(()=>{if(!F0||B||!t.lanUrl){S(!1);return}let F=!1;const $=t.lanUrl,L=t.hostId;async function J(){console.log("[HOST/LAN] probing",$);try{const re=await fetch(`${$}/health`,{signal:AbortSignal.timeout(xE)});if(F)return;if(!re.ok){console.log("[HOST/LAN] probe got non-ok:",re.status),S(!1);return}const q=await re.json(),Y=q.hostId===L;Y?console.log("[HOST/LAN] reachable"):console.log("[HOST/LAN] hostId mismatch — got:",q.hostId,"expected:",L),S(Y)}catch(re){F||(console.log("[HOST/LAN] probe failed:",re instanceof Error?re.message:re),S(!1))}}J();const G=window.setInterval(J,vE),ce=dd.addListener("appStateChange",re=>{re.isActive&&J()}),ue=pE.addListener("networkStatusChange",()=>J());return()=>{F=!0,clearInterval(G),ce.then(re=>re.remove()),ue.then(re=>re.remove())}},[t.hostId,t.lanUrl,B]),A.useEffect(()=>{if(B){c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),u(!1));return}let F=!1,$=1e3;const L=3e4;async function J(){for(;!F;)try{const G=await fetch(`${Bu}/api/nats-credentials/${t.hostId}`);if(F)return;if(G.status===401||G.status===403||G.status===404){console.error("[NATS] Host not found or rejected by relay:",G.status),x(!0);return}if(!G.ok)throw new Error(`credentials fetch ${G.status}`);const ce=await G.json();if(!ce.natsWsUrl){console.error("[NATS] Relay returned empty natsWsUrl — treating as terminal"),x(!0);return}if(F)return;console.log("[NATS] Connecting to",ce.natsWsUrl);const ue=await Lx({servers:ce.natsWsUrl,authenticator:Cx(ce.natsJwt,new TextEncoder().encode(ce.natsNkeySeed)),pingInterval:3e4,maxPingOut:2});if(F){ue.close().catch(()=>{});return}if(console.log("[NATS] Connected"),c.current=ue,s(ue),u(!0),$=1e3,await ue.closed(),F)return;console.log("[NATS] Connection closed, will reconnect"),c.current=null,s(null),u(!1)}catch(G){if(F)return;console.warn(`[NATS] Connect failed, retrying in ${$}ms:`,G),u(!1),await new Promise(ce=>setTimeout(ce,$)),$=Math.min($*2,L)}}return J(),()=>{F=!0,c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),u(!1))}},[B,t]),A.useEffect(()=>{if(B)return;const F=dd.addListener("appStateChange",$=>{if(!$.isActive||!c.current)return;const L=c.current;Promise.race([L.flush(),new Promise((J,G)=>setTimeout(()=>G(new Error("ping timeout")),2e3))]).catch(()=>{console.log("[NATS] Resume probe failed — cycling conn"),L.close().catch(()=>{})})});return()=>{F.then($=>$.remove())}},[B]),A.useEffect(()=>{if(!B){d(!1);return}const F=new AbortController;async function $(){var ce;const J=new AbortController,G=setTimeout(()=>J.abort(),bE);F.signal.addEventListener("abort",()=>J.abort());try{const ue=await fetch(`${t.directUrl}/events`,{headers:{Authorization:`Bearer ${t.clientToken}`},signal:J.signal});return clearTimeout(G),ue.ok?((ce=ue.body)==null?void 0:ce.getReader())??null:null}catch{return clearTimeout(G),null}}async function L(J){d(!0),console.log("[HOST] SSE connected to",t.directUrl),M.current=Date.now();function G(){setTimeout(()=>{F.signal.aborted||Date.now()-M.current<Th||(console.log("[HOST] Heartbeat timeout — no data for",Th/1e3,"s"),F.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},Th)}G();const ce=new TextDecoder;let ue="";try{for(;;){const{done:re,value:q}=await J.read();if(re)break;ue+=ce.decode(q,{stream:!0}),M.current=Date.now(),G();const Y=ue.split(`
|
|
88
|
+
`);ue=Y.pop()??"";for(const ae of Y)if(ae.startsWith("data: ")){const ve=ae.slice(6);try{const N=JSON.parse(ve);if(N.task_id&&N.event_type){const z=`host-event.${t.hostId}.${N.task_id}`;for(const W of O.current)W({subject:z,data:j.current.encode(ve)})}}catch{}}}}catch{}}return(async()=>{const J=await $();J&&await L(J)})(),()=>{F.abort(),d(!1)}},[t,B]);const D=A.useCallback(async(F,$,L)=>{function J(ue){ue&&typeof ue=="object"&&ue.error==="Unauthorized"&&y(!0)}async function G(ue,re){console.log(`[HOST/${re}] → ${F}`,$??"");const q=await fetch(`${ue}/rpc/${F}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.clientToken}`},body:$!=null?JSON.stringify($):void 0,signal:L!=null&&L.timeout?AbortSignal.timeout(L.timeout):void 0});if(q.status===401)throw y(!0),new Error("Unauthorized");const Y=await q.json();return J(Y),console.log(`[HOST/${re}] ← ${F}`,Y),Y}async function ce(){if(!c.current)throw new Error("Not connected");const ue=`host.${t.hostId}.rpc.${F}`,re={...$??{},clientToken:t.clientToken},q=j.current.encode(JSON.stringify(re));console.log(`[HOST/NATS] → ${F}`,$??"");const Y=await c.current.request(ue,q,{timeout:(L==null?void 0:L.timeout)??1e4}),ae=JSON.parse(j.current.decode(Y.data));return J(ae),console.log(`[HOST/NATS] ← ${F}`,ae),ae}if(B)return G(t.directUrl,"HTTP");if(I&&t.lanUrl)try{return await G(t.lanUrl,"LAN")}catch(ue){if(ue instanceof Error&&ue.message==="Unauthorized")throw ue;console.log("[HOST/LAN] failed, falling back to NATS:",ue),S(!1)}return ce()},[t,B,I]),Z=A.useCallback((F,$)=>{if(B)return O.current.add($),()=>{O.current.delete($)};if(c.current){const L=c.current.subscribe(`host-event.${F}.>`);let J=!1;return(async()=>{try{for await(const G of L){if(J)break;$({subject:G.subject,data:G.data})}}catch{}})(),()=>{J=!0,L.unsubscribe()}}return()=>{}},[t,B]);return b.jsx(Ux.Provider,{value:{connected:P,mode:ee,nc:r,request:D,subscribeEvents:Z,activeHost:t,unauthorized:m},children:e})}function ui(){const e=A.useContext(Ux);if(!e)throw new Error("useHostConnection must be used within HostConnectionProvider");return e}const xn=Wn.isNativePlatform()?xs("Device"):null;function SE(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 $d(){const{activeHost:e}=ui(),t=e.timezone;return A.useCallback(r=>SE(r,t),[t])}function _E(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(u=>u.type===s))==null?void 0:l.value)??""};return{date:`${r("year")}-${r("month")}-${r("day")}`,time:`${r("hour")}:${r("minute")}`}}function kE(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(u=>u.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 EE(e,t,r){return new Date(Date.UTC(e,t-1,r)).getUTCDay()}function CE(e,t){return new Date(Date.UTC(e,t,0)).getUTCDate()}function $0(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 Ol(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 AE(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")},u=Date.UTC(l("year"),l("month")-1,l("day"),l("hour")%24,l("minute"),l("second"));return r-(u-r)}function jE(e,t){const r=e.split(" ");if(r.length!==5)return null;const[s,l,u,,c]=r;if(l==="*"){const y=Number(s);if(Number.isNaN(y))return null;if(y>t.minute)return{...t,minute:y};const g=new Date(Date.UTC(t.year,t.month-1,t.day,t.hour+1,y));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 y=Number(c);if(Number.isNaN(y))return null;for(let g=0;g<8;g++){const x=$0({...t,hour:d,minute:f},g);if(EE(x.year,x.month,x.day)===y&&Ol(x,t)>0)return x}return null}if(u!=="*"){const y=Number(u);if(Number.isNaN(y))return null;let g=t.year,x=t.month;for(let v=0;v<24;v++){if(y<=CE(g,x)){const S={year:g,month:x,day:y,hour:d,minute:f};if(Ol(S,t)>0)return S}x++,x>12&&(x=1,g++)}return null}const m={...t,hour:d,minute:f};return Ol(m,t)>0?m:$0(m,1)}function TE(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 NE(e,t,r){if(!e||!t||t.length===0||e==="on_new_notification"||e==="on_new_sms")return null;const s=kE(r),l=[];for(const u of t)if(e==="specific_times"){const c=TE(u);c&&Ol(c,s)>0&&l.push(c)}else{const c=jE(u,s);c&&l.push(c)}return l.length===0?null:(l.sort(Ol),AE(l[0],r))}const Bx={};function OE(e){for(const t of e)Bx[t.key]=t.label}function md(e){return Bx[e]??e}const RE=()=>window.matchMedia("(max-width: 600px)").matches;function ME({task:e,lastEvent:t,onEdit:r,onDelete:s,onViewRun:l}){var q;const{request:u,activeHost:c}=ui(),f=$d(),d=c.timezone,[m,y]=A.useState(!1),[g,x]=A.useState(!1),[v,S]=A.useState(!1),j=A.useRef(null),O=(t==null?void 0:t.running_state)==="started",M=(((q=e.schedule_values)==null?void 0:q.length)??0)>0,B=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",I=!!e.command,ee=!!e.schedule_type&&(M||B)||I,D=!!e.schedule_enabled&&ee?O?"var(--color-success)":(t==null?void 0:t.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";A.useEffect(()=>{if(!g)return;function Y(ae){j.current&&!j.current.contains(ae.target)&&x(!1)}return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[g]);function Z(){RE()?S(!0):x(Y=>!Y)}function F(){x(!1),S(!1)}async function $(){if(F(),!!confirm("Abort this task?")){y(!0);try{await u("task.abort",{id:e.id})}catch(Y){console.error("Abort failed:",Y)}finally{y(!1)}}}async function L(){F();try{const Y=await u("task.run",{id:e.id});l(e.id,Y.run_id)}catch(Y){console.error("Run failed:",Y)}}async function J(){if(F(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),s(e.id)}catch(Y){console.error("Delete failed:",Y)}}const G={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function ce(){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 Y=NE(e.schedule_type,e.schedule_values,d);return Y===null?"No upcoming runs":`Next: ${f(Y)}`}const ue=ce(),re=b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:()=>{F(),r(e)},children:[b.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),b.jsxs("button",{onClick:()=>{F(),l(e.id)},children:[b.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),O?b.jsxs("button",{className:"menu-item-danger",onClick:$,disabled:m,children:[b.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:L,children:[b.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),b.jsxs("button",{className:"menu-item-danger",onClick:J,children:[b.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"task-card",onClick:()=>l(e.id,O?"latest":void 0),children:[b.jsxs("div",{className:"task-card-header",children:[b.jsxs("div",{className:"task-card-title-row",children:[O?b.jsx("span",{className:"status-spinner",children:b.jsx("span",{})}):b.jsx("span",{className:"status-dot",style:{backgroundColor:D}}),b.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),b.jsx("div",{className:"task-card-actions",onClick:Y=>Y.stopPropagation(),children:b.jsxs("div",{className:"task-card-menu",ref:j,children:[b.jsx("button",{className:"task-card-menu-btn",onClick:Z,"aria-label":"Task actions",children:"⋮"}),g&&b.jsx("div",{className:"task-card-menu-dropdown",children:re})]})})]}),b.jsxs("div",{className:"task-card-meta",children:[e.agent&&b.jsx("span",{className:"task-card-agent",children:md(e.agent)}),t&&G[t.running_state]&&b.jsxs("span",{className:"task-card-last-event",children:[G[t.running_state]," ",f(t.time_stamp)]}),ee&&b.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?ue:"Schedule disabled"})]})]}),v&&ps.createPortal(b.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>S(!1),children:b.jsxs("div",{className:"bottom-sheet",onClick:Y=>Y.stopPropagation(),children:[b.jsx("div",{className:"bottom-sheet-handle"}),b.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),b.jsx("div",{className:"bottom-sheet-actions",children:re})]})}),document.body)]})}function DE({permissions:e}){return b.jsxs("div",{className:"permissions-dialog",children:[b.jsx("h2",{children:"Granted Permissions"}),b.jsx("div",{className:"permissions-dialog-scroll",children:e&&e.length>0?b.jsx("div",{className:"permissions-section",children:b.jsx("ul",{className:"permissions-list",children:e.map((t,r)=>b.jsxs("li",{className:"permission-item",children:[b.jsx("span",{className:"permission-tool",children:t.name}),b.jsx("span",{className:"permission-desc",children:t.description})]},r))})}):b.jsx("p",{className:"permissions-empty",children:"No permissions have been granted for this task."})}),b.jsx("div",{className:"permissions-dialog-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const ia=[];function LE(){const e=ia.pop();e&&(e.pushed.current=!1,e.close())}let Y0=!1;function zE(){Y0||(Y0=!0,window.addEventListener("popstate",LE))}function pd(e,t){const r=A.useRef(!1),s=A.useRef(t);s.current=t;const l=A.useCallback(()=>s.current(),[]),u=A.useRef({close:l,pushed:r});u.current.close=l,A.useEffect(()=>{if(e&&!r.current)zE(),history.pushState({modal:!0},""),ia.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=ia.indexOf(u.current);c!==-1&&ia.splice(c,1),history.back()}},[e,l]),A.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=ia.indexOf(c);f!==-1&&ia.splice(f,1),history.back()}}},[])}const UE=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],BE=["specific_times","hourly","daily","weekly","monthly"];function pu(e){return BE.includes(e)}function PE(e){return e==="on_new_notification"||e==="on_new_sms"}function si(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function HE(e){const t=e.split(" ");if(t.length!==5)return si();const[r,s,l,,u]=t;if(s==="*")return si("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...si("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...si("monthly"),time:c,dayOfMonth:l}:{...si("daily"),time:c}}function Px(e,t){if(e==="specific_times"){const[r,s]=t.split("T");return{...si("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return HE(t)}function qE(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 IE(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:qE(e)}function Nh(e){return e==="specific_times"?"specific_times":e==="on_new_notification"?"on_new_notification":e==="on_new_sms"?"on_new_sms":"crons"}function Oh(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 FE({initial:e,agents:t,hostPlatform:r,isNotificationListener:s,onSaved:l,onCancel:u}){var Oe;const{request:c,activeHost:f}=ui(),{setHostLastAgent:d}=Yi(),m=()=>{var Ee;const oe=f.lastAgent,Re=t.map(Ue=>Ue.key);return oe&&Re.includes(oe)?oe:((Ee=t[0])==null?void 0:Ee.key)??""},[y,g]=A.useState((e==null?void 0:e.user_prompt)??""),[x,v]=A.useState((e==null?void 0:e.agent)??m()),S=!!((Oe=e==null?void 0:e.permissions)!=null&&Oe.length)&&x===(e==null?void 0:e.agent),[j,O]=A.useState(!1),M=A.useCallback(()=>O(!1),[]);pd(j,M);const[B,I]=A.useState(null),[ee,P]=A.useState(()=>Oh(e)),[D,Z]=A.useState(()=>{const oe=e==null?void 0:e.schedule_type,Re=e==null?void 0:e.schedule_values;if(Re&&(oe==="crons"||oe==="specific_times"))return Re.map(Ue=>Px(oe,Ue));const Ee=Oh(e);return pu(Ee)?[si(Ee)]:[]}),[F,$]=A.useState((e==null?void 0:e.requires_confirmation)??!1),[L,J]=A.useState(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0),[G,ce]=A.useState((e==null?void 0:e.yolo_mode)??!1),[ue,re]=A.useState((e==null?void 0:e.foreground_mode)??!1),[q,Y]=A.useState((e==null?void 0:e.command)??""),[ae,ve]=A.useState(!1),N=(e==null?void 0:e.schedule_type)==="on_new_notification"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[z,W]=A.useState(N),[_,ye]=A.useState([]),[je,Se]=A.useState(!1),[Me,Ve]=A.useState(!1),[Ae,ot]=A.useState(""),kt=A.useCallback(()=>Ve(!1),[]);pd(Me,kt),A.useEffect(()=>{if(ee!=="on_new_notification"||!s||!Wn.isNativePlatform()||!xn)return;let oe=!1;return Se(!0),xn.getInstalledApps().then(({apps:Re})=>{if(oe)return;const Ee="com.palmier.app",Ue=Re.filter(Xe=>Xe.packageName!==Ee).sort((Xe,Tt)=>(Xe.appName||Xe.packageName).localeCompare(Tt.appName||Tt.packageName));ye(Ue)}).catch(()=>{}).finally(()=>{oe||Se(!1)}),()=>{oe=!0}},[ee,s]);const an=(e==null?void 0:e.schedule_type)==="on_new_sms"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[Lt,Ie]=A.useState(an),et=A.useRef(null),qe=pu(ee),jt=ee==="command",gt=PE(ee),zn=ee==="specific_times"||ee==="daily"||ee==="weekly"||ee==="monthly",qt=t.find(oe=>oe.key===x),nn=!!(qt!=null&&qt.supportsYolo);A.useEffect(()=>{!nn&&G&&ce(!1)},[nn,G]);const pn=!!e,Un=Oh(e),dt=!pn||y!==((e==null?void 0:e.user_prompt)??"")||x!==((e==null?void 0:e.agent)??"")||ee!==Un||F!==((e==null?void 0:e.requires_confirmation)??!1)||L!==(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0)||G!==((e==null?void 0:e.yolo_mode)??!1)||ue!==((e==null?void 0:e.foreground_mode)??!1)||jt&&q!==((e==null?void 0:e.command)??"")||qe&&(JSON.stringify(cn())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Nh(ee)!==((e==null?void 0:e.schedule_type)??void 0))||gt&&ee!==(e==null?void 0:e.schedule_type)||ee==="on_new_notification"&&z.trim()!==N.trim()||ee==="on_new_sms"&&Lt.trim()!==an.trim(),Xt=_E(f.timezone),fe=qe&&D.some(oe=>oe.schedule==="specific_times"&&(!oe.onceDate||oe.onceDate<Xt.date||oe.onceDate===Xt.date&&(oe.onceTime??"")<=Xt.time)),_e=dt&&!!y.trim()&&!fe&&(!jt||!!q.trim())&&(!qe||D.length>0);function Pe(oe,Re){Z(Ee=>Ee.map((Ue,Xe)=>Xe===oe?{...Ue,...Re}:Ue))}function Je(oe){Z(Re=>Re.filter((Ee,Ue)=>Ue!==oe))}function it(){pu(ee)&&Z(oe=>[...oe,oe.length>0?{...oe[oe.length-1]}:si(ee)])}function Kt(oe){P(oe),pu(oe)?Z([si(oe)]):(Z([]),$(!1)),oe==="command"?setTimeout(()=>{var Re;return(Re=et.current)==null?void 0:Re.focus()},0):Y(""),oe!=="on_new_notification"&&W(N),oe!=="on_new_sms"&&Ie(an)}function cn(){return D.flatMap(oe=>{const Re=IE(oe);return Re?[Re]:[]})}function xe(){return G?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 Ie(){ve(!0),I(null);try{const de=Ve?Ze():ee==="on_new_notification"&&z.trim()?[z.trim()]:ee==="on_new_sms"&&Ht.trim()?[Ht.trim()]:[],Me=Ve||Rt?Nh(ee):null,Oe={user_prompt:y,agent:x,schedule_type:Me,schedule_values:de.length>0?de:null,schedule_enabled:ee==="ondemand"?!0:L,requires_confirmation:Ve?F:!1,yolo_mode:G,foreground_mode:oe,command:Et?q:""};wn&&(Oe.id=e.id);const it=await c(wn?"task.update":"task.create",Oe,{timeout:45e3});if(it.error){I(it.error);return}wn||d(f.hostId,x),l(it)}catch(de){I(de instanceof Error?de.message:String(de))}finally{ve(!1)}}const qe=wn?"Save":(Ve||Rt||Et)&&L?"Schedule":"Save";return b.jsxs("div",{className:"task-form-overlay",children:[b.jsx("div",{className:"task-form",children:T?b.jsx(DE,{permissions:e==null?void 0:e.permissions}):b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"task-form-header",children:b.jsx("h2",{children:e?"Edit Task":"New Task"})}),B&&b.jsx("div",{className:"form-error",children:B}),b.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:y,onChange:de=>g(de.target.value),placeholder:Et?"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:ae}),b.jsxs("div",{className:"plan-actions",children:[t.length>0&&b.jsx("div",{className:"agent-picker-section-inline",children:t.length>1?b.jsx("select",{className:"form-select form-select-sm",value:x,onChange:de=>v(de.target.value),disabled:ae,children:t.map(de=>b.jsx("option",{value:de.key,children:de.label},de.key))}):b.jsx("span",{className:"agent-picker-single",children:(Nt==null?void 0:Nt.label)??t[0].label})}),tn&&b.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[b.jsx("input",{type:"checkbox",checked:G,onChange:de=>ue(de.target.checked),disabled:ae}),"Yolo"]}),tn&&G&&b.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),S&&b.jsx("div",{className:"granted-permissions-row",children:b.jsx("button",{className:"btn btn-link",onClick:()=>O(!0),children:"Granted Permissions"})})]}),b.jsx("div",{className:"toggles-group",children:b.jsxs("div",{className:"schedule-section",children:[b.jsxs("h3",{className:"schedule-section-title",children:["Schedule ",Kn&&b.jsx("span",{className:"schedule-section-hint",children:"based on host time"})]}),b.jsxs("select",{className:"form-select",value:ee,onChange:de=>Ge(de.target.value),disabled:ae,children:[b.jsx("option",{value:"ondemand",children:"On User Demand"}),b.jsx("option",{value:"specific_times",children:"Specific Times"}),b.jsx("option",{value:"hourly",children:"Hourly"}),b.jsx("option",{value:"daily",children:"Daily"}),b.jsx("option",{value:"weekly",children:"Weekly"}),b.jsx("option",{value:"monthly",children:"Monthly"}),b.jsx("option",{value:"on_new_notification",children:"On New Notification"}),b.jsx("option",{value:"on_new_sms",children:"On New SMS"}),b.jsx("option",{value:"command",children:"On Command Output"})]}),Rt&&b.jsxs("div",{className:"schedule-reactive",children:[b.jsxs("p",{className:"command-help-text",children:[ee==="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 ",ee==="on_new_notification"?"notification":"SMS","”."]}),ee==="on_new_notification"&&(()=>{const de=_.find(Oe=>Oe.packageName===z),Me=(de==null?void 0:de.appName)||z;return b.jsxs(b.Fragment,{children:[s?z.trim()?b.jsxs("div",{className:"app-filter-selected",children:[b.jsx("span",{className:"app-filter-selected-name",children:Me}),(de==null?void 0:de.appName)&&b.jsx("span",{className:"app-filter-selected-pkg",children:de.packageName}),b.jsx("button",{type:"button",className:"app-filter-selected-clear",onClick:()=>W(""),"aria-label":"Clear app filter",disabled:ae,children:"✕"})]}):b.jsx("button",{type:"button",className:"btn btn-link app-filter-trigger",onClick:()=>{ot(""),Ye(!0)},disabled:ae,children:"Select app"}):b.jsx("input",{className:"form-input",type:"text",value:z,onChange:Oe=>W(Oe.target.value),placeholder:"App (optional), e.g. com.google.android.gm",disabled:ae}),b.jsx("p",{className:"command-help-text app-filter-help",children:z.trim()?`Only notifications from ${Me} will trigger this task.`:"Every notification from your device triggers this task."})]})})(),ee==="on_new_sms"&&b.jsxs(b.Fragment,{children:[b.jsx("input",{className:"form-input",type:"text",value:Ht,onChange:de=>Be(de.target.value),placeholder:"From (optional), e.g. +1 555-1234)",disabled:ae}),b.jsx("p",{className:"command-help-text app-filter-help",children:Ht.trim()?`Only SMS from ${Ht.trim()} will trigger this task. Formatting (spaces, dashes, parens) is ignored.`:"Every SMS that arrives on your device triggers this task."})]})]}),Et&&b.jsxs("div",{className:"schedule-reactive",children:[b.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."}),b.jsx("input",{ref:rt,className:"form-input form-input-mono",type:"text",value:q,onChange:de=>Y(de.target.value),placeholder:"gws gmail +watch --project my-project",disabled:ae})]}),Ve&&ee!=="hourly"&&b.jsxs(b.Fragment,{children:[D.map((de,Me)=>b.jsxs("div",{className:"trigger-row-card",children:[b.jsxs("div",{className:"trigger-row-content",children:[ee==="daily"&&b.jsx("input",{className:"form-input",type:"time",value:de.time,onChange:Oe=>be(Me,{time:Oe.target.value})}),ee==="weekly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:de.dayOfWeek,onChange:Oe=>be(Me,{dayOfWeek:Oe.target.value}),children:UE.map((Oe,gt)=>b.jsx("option",{value:String(gt),children:Oe},gt))}),b.jsx("input",{className:"form-input",type:"time",value:de.time,onChange:Oe=>be(Me,{time:Oe.target.value})})]}),ee==="monthly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:de.dayOfMonth,onChange:Oe=>be(Me,{dayOfMonth:Oe.target.value}),children:Array.from({length:28},(Oe,gt)=>gt+1).map(Oe=>b.jsxs("option",{value:String(Oe),children:["Day ",Oe]},Oe))}),b.jsx("input",{className:"form-input",type:"time",value:de.time,onChange:Oe=>be(Me,{time:Oe.target.value})})]}),ee==="specific_times"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("input",{className:"form-input",type:"date",value:de.onceDate,min:Sn.date,onChange:Oe=>be(Me,{onceDate:Oe.target.value})}),b.jsx("input",{className:"form-input",type:"time",value:de.onceTime,min:de.onceDate===Sn.date?Sn.time:void 0,onChange:Oe=>be(Me,{onceTime:Oe.target.value})})]})]}),D.length>1&&b.jsx("button",{className:"trigger-remove-btn",onClick:()=>we(Me),title:"Remove trigger",children:"×"})]},Me)),b.jsx("button",{className:"trigger-add-btn",onClick:Ne,children:"+ Add"})]}),r==="win32"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:oe,onChange:de=>re(de.target.checked),disabled:ae}),"Run in the foreground (host must login to Windows)"]}),Ve&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:F,onChange:de=>$(de.target.checked),disabled:ae}),"Confirm before each run"]}),ee!=="ondemand"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:L,onChange:de=>J(de.target.checked),disabled:ae}),"Enabled"]})]})}),!G&&Nt&&!Nt.supportsPermissions&&b.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",Nt.label,". The task may fail if required permissions are not pre-configured."]}),b.jsxs("div",{className:"form-actions",children:[b.jsxs("button",{className:"btn btn-primary",onClick:()=>ct()&&Ie(),disabled:!ke||ae,children:[ae&&b.jsx("span",{className:"btn-spinner"}),qe]}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{mt&&y.trim()&&!confirm("You have unsaved changes. Discard?")||u()},style:{marginLeft:"auto"},children:"Cancel"})]})]})}),Re&&(()=>{const de=Ce.trim().toLowerCase(),Me=de?_.filter(Oe=>Oe.packageName.toLowerCase().includes(de)||Oe.appName.toLowerCase().includes(de)):_;return b.jsx("div",{className:"app-filter-overlay",onClick:jt,children:b.jsxs("div",{className:"app-filter-dialog",onClick:Oe=>Oe.stopPropagation(),children:[b.jsxs("div",{className:"app-filter-header",children:[b.jsx("h2",{children:"Select app"}),b.jsx("button",{className:"app-filter-close",onClick:jt,"aria-label":"Close",children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:b.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),b.jsx("input",{className:"form-input app-filter-search",type:"text",value:Ce,onChange:Oe=>ot(Oe.target.value),onKeyDown:Oe=>{Oe.key==="Enter"&&Ce.trim()&&(W(Ce.trim()),jt())},placeholder:"Search or type a package name",autoFocus:!0}),b.jsxs("ul",{className:"app-filter-list",children:[Ae&&_.length===0?Array.from({length:6}).map((Oe,gt)=>b.jsx("li",{className:"app-filter-row app-filter-skeleton",children:b.jsx("div",{className:"app-filter-skeleton-bar"})},`sk-${gt}`)):Me.length===0&&!Ce.trim()?b.jsx("li",{className:"app-filter-empty",children:"No apps"}):Me.map(Oe=>b.jsx("li",{className:"app-filter-row",onClick:()=>{W(Oe.packageName),jt()},children:b.jsxs("div",{className:"app-filter-row-labels",children:[b.jsx("div",{className:"app-filter-row-name",children:Oe.appName||Oe.packageName}),Oe.appName&&b.jsx("div",{className:"app-filter-row-pkg",children:Oe.packageName})]})},Oe.packageName)),Ce.trim()&&b.jsx("li",{className:"app-filter-row",onClick:()=>{W(Ce.trim()),jt()},children:b.jsx("div",{className:"app-filter-row-labels",children:b.jsx("div",{className:"app-filter-row-name",children:Ce.trim()})})})]})]})})})()]})}function Hx({pullDistance:e,refreshing:t,threshold:r}){const s=e>0||t,l=e>=r;return b.jsx("div",{className:"pull-to-refresh",style:{transform:`translateY(${e}px)`,opacity:s?Math.min(1,e/30):0},"aria-hidden":!s,children:b.jsx("div",{className:"pull-to-refresh-badge",children:t?b.jsx("div",{className:"spinner"}):b.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:[b.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),b.jsx("polyline",{points:"19 12 12 19 5 12"})]})})})}function qx({onRefresh:e,threshold:t=70,maxPull:r=110,enabled:s=!0}){const[l,u]=A.useState(0),[c,f]=A.useState(!1),d=A.useRef(null),m=A.useRef(!1),y=A.useRef(0),g=A.useRef(!1),x=A.useRef(e);return A.useEffect(()=>{x.current=e}),A.useEffect(()=>{if(!s)return;const v=O=>{if(g.current||window.scrollY>0){d.current=null;return}if($E(O.target)){d.current=null;return}d.current=O.touches[0].clientY,m.current=!1,y.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,y.current=0,u(0);return}m.current=!0;const B=Math.min(r,M*.5);y.current=B,u(B),O.cancelable&&O.preventDefault()},T=()=>{if(!m.current){d.current=null,u(0);return}const O=y.current;d.current=null,m.current=!1,y.current=0,O>=t?(g.current=!0,f(!0),u(t),Promise.resolve(x.current()).catch(()=>{}).finally(()=>{g.current=!1,f(!1),u(0)})):u(0)};return window.addEventListener("touchstart",v,{passive:!0}),window.addEventListener("touchmove",S,{passive:!1}),window.addEventListener("touchend",T,{passive:!0}),window.addEventListener("touchcancel",T,{passive:!0}),()=>{window.removeEventListener("touchstart",v),window.removeEventListener("touchmove",S),window.removeEventListener("touchend",T),window.removeEventListener("touchcancel",T)}},[s,t,r]),{pullDistance:l,refreshing:c,threshold:t}}function $E(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 YE(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 VE({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:u,isNotificationListener:c,onViewRun:f,hostInfoStatus:d}){const[m,y]=A.useState([]),[g,x]=A.useState(!1),[v,S]=A.useState(null),[T,O]=A.useState(new Map),[M,B]=A.useState(!1),[I,ee]=A.useState(void 0),P=A.useCallback(()=>{B(!1),ee(void 0)},[]),D=A.useCallback(async()=>{if(e){x(!0),S(null);try{const J=(await r("task.list")).tasks??[],G=new Map;for(const ue of J)ue.status&&G.set(ue.id,ue.status);O(G),y(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),y([])}finally{x(!1)}}},[e,t,r]);A.useEffect(()=>{e?D():(y([]),x(!1))},[e,t,D]);const Z=qx({onRefresh:D,enabled:e});A.useEffect(()=>!e||!t?void 0:s(t,async J=>{const G=J.subject.split(".");if(G.length<3)return;const ue=G.slice(2).join(".");let oe={};try{oe=JSON.parse(new TextDecoder().decode(J.data))}catch{return}const re=oe.event_type;if(!(re!=="running-state"&&re!=="permission-resolved"))try{const q=await r("task.status",{id:ue},{timeout:5e3});if(q.error)return;O(Y=>{const ae=new Map(Y);return ae.set(ue,q),ae})}catch{}}),[e,t,s,r]);function F(L){y(J=>{const G=J.findIndex(ue=>ue.id===L.id);if(G>=0){const ue=[...J];return ue[G]=L,ue}return[L,...J]}),B(!1),ee(void 0)}function $(L){y(J=>J.filter(G=>G.id!==L)),O(J=>{const G=new Map(J);return G.delete(L),G})}return b.jsxs(b.Fragment,{children:[b.jsx(Hx,{pullDistance:Z.pullDistance,refreshing:Z.refreshing,threshold:Z.threshold}),v&&b.jsxs("div",{className:"form-error",children:[v,v.toLowerCase().includes("failed to fetch")&&b.jsxs(b.Fragment,{children:[" ",b.jsx("a",{href:"#",onClick:L=>{L.preventDefault(),window.location.reload()},children:"Reload"})]})]}),g&&!m.length&&d==="ready"?b.jsx("div",{className:"task-list",children:[0,1,2].map(L=>b.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[b.jsx("div",{className:"task-card-header",children:b.jsxs("div",{className:"task-card-title-row",children:[b.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),b.jsx("div",{className:"skeleton-line",style:{width:`${60+L*12}%`}})]})}),b.jsxs("div",{className:"task-card-meta",children:[b.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},L))}):m.length===0?d==="loading"?b.jsx("div",{className:"empty-state",children:b.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),b.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Try running ",b.jsx("code",{children:"palmier restart"})," on the host machine to restart the daemon."]})]}):b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No tasks yet"}),b.jsx("p",{className:"empty-state-hint",children:"Tap the + button to create your first task."})]}):b.jsx("div",{className:"task-list",children:m.map(L=>b.jsx(ME,{task:L,lastEvent:T.get(L.id),onEdit:J=>{ee(J),B(!0),r("task.get",{id:J.id}).then(G=>{G.error||ee(G)}).catch(()=>{})},onDelete:$,onViewRun:f},L.id))}),b.jsx("button",{className:"fab",onClick:()=>{ee(void 0),B(!0)},"aria-label":"New task",title:"New task",children:b.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),b.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),M&&b.jsx(FE,{initial:I,agents:l,hostPlatform:u,isNotificationListener:c,onSaved:F,onCancel:P},I?YE(I):"new")]})}let ha=null;function V0(e){ha&&(e.preventDefault(),e.returnValue="")}function Rh(e){const t=!!ha;ha=e;const r=!!ha;r&&!t?window.addEventListener("beforeunload",V0):!r&&t&&window.removeEventListener("beforeunload",V0)}function ps(){return ha?window.confirm(ha):!0}function GE(){const e=Mr(),t=cr(),{hostId:r}=Yu(),s=t.pathname.endsWith("/tasks"),l=!s;function u(c){ps()&&r&&e(`/hosts/${encodeURIComponent(r)}${c}`)}return b.jsxs(b.Fragment,{children:[b.jsxs("button",{className:`tab-btn ${l?"tab-btn-active":""}`,onClick:()=>u(""),children:[b.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:b.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),b.jsxs("button",{className:`tab-btn ${s?"tab-btn-active":""}`,onClick:()=>u("/tasks"),children:[b.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:[b.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),b.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}function Ix(e){const[t,r]=A.useState(()=>window.matchMedia(e).matches);return A.useEffect(()=>{const s=window.matchMedia(e),l=u=>r(u.matches);return s.addEventListener("change",l),r(s.matches),()=>s.removeEventListener("change",l)},[e]),t}const Eu=Jn.isNativePlatform(),JE=["Device","Data","Messaging"],XE=[{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 KE(){if(!Eu||!hn)return new Set;try{const{capabilities:e}=await hn.getCapabilityStatus();return new Set(e.filter(t=>t.enabled).map(t=>t.name))}catch{return new Set}}function Fx({onChange:e,confirmDisable:t=!1}){const[r,s]=A.useState(new Map),[l,u]=A.useState(null),[c,f]=A.useState(null),d=A.useCallback(async()=>{if(!(!Eu||!hn))try{const{capabilities:S}=await hn.getCapabilityStatus(),T=new Map;for(const O of S)T.set(O.name,O);s(T),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]);A.useEffect(()=>{d()},[d]),A.useEffect(()=>{if(!Eu)return;const S=dd.addListener("resume",d);return()=>{S.then(T=>T.remove())}},[d]);async function m(S,T){if(hn){u(S.capability);try{const O=await hn.setCapabilityEnabled({capability:S.capability,enabled:T});!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{u(null)}}}function y(S){const T=r.get(S.capability);if(T){if(T.enabled&&t){f(S);return}m(S,!T.enabled)}}function g(){const S=c;S&&(f(null),m(S,!1))}if(!Eu)return null;const x=JE.map(S=>({group:S,items:XE.filter(T=>{const O=r.get(T.capability);return T.group===S&&(O==null?void 0:O.supported)})})).filter(S=>S.items.length>0);if(x.length===0)return b.jsx("div",{className:"capability-toggles-loading",children:b.jsx("span",{className:"spinner"})});const v=c&&ds.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>f(null),children:b.jsxs("div",{className:"confirm-modal",onClick:S=>S.stopPropagation(),children:[b.jsxs("h2",{className:"confirm-modal-title",children:["Disable ",c.label,"?"]}),b.jsxs("p",{className:"confirm-modal-message",children:["All hosts linked to this device will no longer be able to use ",c.label,"."]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:g,children:"Disable"})]})]})}),document.body);return b.jsxs(b.Fragment,{children:[x.map(({group:S,items:T},O)=>b.jsx("div",{className:O>0?"drawer-toggle-group drawer-toggle-group-divided":"drawer-toggle-group",children:T.map(M=>{const B=r.get(M.capability),I=!!(B!=null&&B.enabled);return b.jsxs("label",{className:"drawer-toggle",children:[b.jsx("span",{className:"drawer-toggle-label",children:M.label}),b.jsx("button",{className:`toggle-switch ${I?"toggle-switch-on":""}`,onClick:()=>y(M),disabled:l===M.capability,role:"switch","aria-checked":I,children:b.jsx("span",{className:"toggle-switch-thumb"})})]},M.capability)})},S)),v]})}const G0=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),QE=Jn.isNativePlatform();function J0({daemonVersion:e,agents:t,linkedClientToken:r,request:s,onEnabledCapabilitiesChange:l,onLinkedClientTokenChange:u}){var Ht;const{pairedHosts:c,removePairedHost:f,renamePairedHost:d}=qi(),{activeHost:m}=si(),y=Mr(),g=cr(),v=Yu().hostId??null,S=m.clientToken||null,T=!!S&&r===S,O=Ix("(min-width: 768px)"),[M,B]=A.useState(!1),[I,ee]=A.useState(()=>Date.now());A.useEffect(()=>{const Be=()=>ee(Date.now()),rt=6e4-Date.now()%6e4,Ve=setTimeout(()=>{Be();const Et=setInterval(Be,6e4);Ve._iv=Et},rt);return()=>{const Et=Ve._iv;Et&&clearInterval(Et),clearTimeout(Ve)}},[]);const P=m.timezone?new Date(I).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:m.timezone}):"";async function D(){if(!(!hn||!s||!S)){B(!0);try{const{token:Be}=await hn.getFcmToken();if(!Be)return;await s("device.link",{fcmToken:Be}),u==null||u(S)}catch(Be){console.error("Failed to make this the linked device:",Be)}finally{B(!1)}}}async function Z(Be){const rt=Be===v;if(rt&&s)try{await s("clients.revoke_self")}catch{}f(Be),ae(null),rt&&y("/",{replace:!0})}function F(Be){const Ve=g.pathname.endsWith("/tasks")?"/tasks":"";y(`/hosts/${encodeURIComponent(Be)}${Ve}`)}const[$,L]=A.useState(!1),[J,G]=A.useState(!1),[ue,oe]=A.useState(null),[re,q]=A.useState(""),[Y,ae]=A.useState(null),[ve,N]=A.useState(!1),z=A.useRef(null),W=A.useRef(null),_=A.useCallback(()=>{G(!0)},[]);function ye(){J&&(L(!1),G(!1))}function Ae(){G(!1),L(!0)}function _e(Be,rt){oe(Be),q(rt)}function Re(){ue&&re.trim()&&d(ue,re.trim()),oe(null),q("")}function Ye(){oe(null),q("")}A.useEffect(()=>{ue&&W.current&&(W.current.focus(),W.current.select())},[ue]),A.useEffect(()=>{if(!$||J)return;function Be(rt){rt.key==="Escape"&&_()}return document.addEventListener("keydown",Be),()=>{document.removeEventListener("keydown",Be)}},[$,J,_]);const Ce=b.jsxs(b.Fragment,{children:[!O&&b.jsx("button",{className:"drawer-close-btn",onClick:_,"aria-label":"Close menu",children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:b.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),!G0&&c.length>0&&b.jsxs("div",{className:"drawer-section",children:[b.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),b.jsx("div",{className:"host-picker-inline",children:b.jsx("div",{className:"host-picker-list",role:"listbox",children:c.map(Be=>{const rt=Be.hostId===v,Ve=ue===Be.hostId,Et=Be.name||Be.hostId.slice(0,8);return b.jsx("div",{className:"host-picker-item-wrapper",children:b.jsxs("div",{className:`host-picker-item ${rt?"host-picker-item-active":""}`,onClick:()=>{if(!Ve&&!rt){if(!ps())return;F(Be.hostId),O||_()}},role:"option","aria-selected":rt,children:[Ve?b.jsx("input",{ref:W,className:"form-input host-picker-rename-input",type:"text",value:re,onChange:Rt=>q(Rt.target.value),onKeyDown:Rt=>{Rt.key==="Enter"&&Re(),Rt.key==="Escape"&&Ye()},onBlur:Re,onClick:Rt=>Rt.stopPropagation()}):b.jsx("span",{className:"host-picker-item-name",children:Et}),b.jsxs("div",{className:"host-picker-item-actions",children:[rt&&!Ve&&b.jsx("button",{className:"host-picker-edit-btn",onClick:Rt=>{Rt.stopPropagation(),_e(Be.hostId,Et)},"aria-label":"Rename host",children:b.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:b.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"})})}),!rt&&b.jsx("button",{className:"host-picker-delete-btn",onClick:Rt=>{Rt.stopPropagation(),ae(Be.hostId)},"aria-label":`Unpair ${Et}`,children:b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:b.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)})})})]}),!G0&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-divider"}),b.jsx("div",{className:"drawer-section",children:b.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{ps()&&(y("/pair"),O||_())},children:"Add New Host"})})]}),QE&&s&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-divider"}),b.jsxs("div",{className:"drawer-section",children:[b.jsx("h3",{className:"drawer-section-label",children:"Device Capabilities"}),T?b.jsx(Fx,{onChange:l,confirmDisable:!0}):b.jsxs(b.Fragment,{children:[b.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.)."}),b.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>{r&&r!==S?N(!0):D()},disabled:M,children:M?"Linking…":"Link the host to this device"})]})]})]}),b.jsxs("div",{className:"drawer-footer",children:[t&&t.length>0&&(()=>{const Be=t.filter(Ve=>Ve.version),rt=t.filter(Ve=>!Ve.version);return b.jsxs("div",{className:"drawer-agents",children:[Be.length>0&&b.jsxs("div",{className:"drawer-agents-section",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Agents"}),Be.map(Ve=>b.jsxs("div",{className:"drawer-agents-row",children:[b.jsx("span",{children:Ve.label}),b.jsxs("span",{className:"drawer-agents-version",children:["v",Ve.version]})]},Ve.key))]}),rt.length>0&&b.jsxs("div",{className:"drawer-agents-section",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Version not managed by Palmier"}),rt.map(Ve=>b.jsx("div",{className:"drawer-agents-row",children:b.jsx("span",{children:Ve.label})},Ve.key))]})]})})(),(m.timezone||e)&&b.jsxs("div",{className:"drawer-host-info",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Host"}),m.timezone&&b.jsxs("div",{className:"drawer-host-time",children:[P," · ",m.timezone]}),e&&b.jsxs("div",{className:"drawer-version",children:["Version: v",e]})]}),b.jsxs("div",{className:"drawer-legal",children:[b.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),b.jsx("span",{className:"drawer-legal-sep",children:"·"}),b.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),ot=!!Y&&Y===v&&T,jt=Y&&ds.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>ae(null),children:b.jsxs("div",{className:"confirm-modal",onClick:Be=>Be.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Remove host?"}),b.jsxs("p",{className:"confirm-modal-message",children:['"',((Ht=c.find(Be=>Be.hostId===Y))==null?void 0:Ht.name)||Y.slice(0,8),'" will be ',ot?"removed and unlinked":"removed",".",ot&&b.jsx(b.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."})]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>ae(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:()=>Z(Y),children:"Remove"})]})]})}),document.body),en=ve&&ds.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>N(!1),children:b.jsxs("div",{className:"confirm-modal",onClick:Be=>Be.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),b.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."}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>N(!1),children:"Cancel"}),b.jsx("button",{className:"btn btn-primary",onClick:()=>{N(!1),D()},children:"Link"})]})]})}),document.body);return O?b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:z,children:Ce}),jt,en]}):b.jsxs(b.Fragment,{children:[b.jsx("button",{className:"hamburger-btn",onClick:Ae,"aria-label":"Open menu",children:b.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:b.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),$&&ds.createPortal(b.jsx("div",{className:`drawer-overlay ${J?"drawer-overlay-closing":""}`,onClick:_,onAnimationEnd:ye,children:b.jsx("div",{className:`drawer-panel ${J?"drawer-panel-closing":""}`,ref:z,onClick:Be=>Be.stopPropagation(),children:Ce})}),document.body),jt,en]})}const ZE=Jn.isNativePlatform(),Yd={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function WE(){return b.jsxs("svg",{...Yd,"aria-hidden":"true",children:[b.jsx("path",{d:"M3 11 L12 3 L21 11"}),b.jsx("path",{d:"M5 9.5 V21 H19 V9.5"})]})}function X0(){return b.jsxs("svg",{...Yd,"aria-hidden":"true",children:[b.jsx("circle",{cx:"12",cy:"12",r:"10"}),b.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),b.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 eC(){return b.jsxs("svg",{...Yd,"aria-hidden":"true",children:[b.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"}),b.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),b.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function tC(){const{mode:e}=si(),[t,r]=A.useState(!1),s=A.useRef(null);if(A.useEffect(()=>{if(!t)return;function f(m){var y;(y=s.current)!=null&&y.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,u,c;switch(e){case"lan":l=b.jsx(WE,{}),u="Connected via LAN",c="lan";break;case"nats":l=b.jsx(X0,{}),u=ZE?"Connected via relay":"Connected",c="relay";break;case"disconnected":l=b.jsx(eC,{}),u="Disconnected",c="disconnected";break;case"connecting":default:l=b.jsx(X0,{}),u="Connecting…",c="connecting";break}return b.jsxs("div",{ref:s,className:`conn-status conn-status--${c}`,children:[b.jsx("button",{type:"button",className:"conn-status-btn","aria-label":u,onClick:()=>r(f=>!f),children:l}),b.jsx("div",{className:`conn-status-popover ${t?"conn-status-popover--open":""}`,role:"tooltip",children:u})]})}function K0(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 nC({agents:e,hostPlatform:t,onStarted:r}){const{request:s,activeHost:l}=si(),{setHostLastAgent:u}=qi(),[c,f]=A.useState(""),[d,m]=A.useState(()=>K0(e,l.lastAgent)),[y,g]=A.useState(!1),[x,v]=A.useState(!1),[S,T]=A.useState(null);A.useEffect(()=>{e.length&&(e.find(D=>D.key===d)||m(K0(e,l.lastAgent)))},[e,d,l.lastAgent]),A.useEffect(()=>{const D=c.trim().length>0;return Rh(D?"Your session draft will be lost. Continue?":null),()=>Rh(null)},[c]);const O=e.find(D=>D.key===d),M=!!(O!=null&&O.supportsYolo);A.useEffect(()=>{!M&&y&&g(!1)},[M,y]);const B=!!c.trim()&&!!d&&!x;function I(){return y?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 ke(){ve(!0),I(null);try{const oe=qe?cn():ee==="on_new_notification"&&z.trim()?[z.trim()]:ee==="on_new_sms"&&Lt.trim()?[Lt.trim()]:[],Re=qe||gt?Nh(ee):null,Ee={user_prompt:y,agent:x,schedule_type:Re,schedule_values:oe.length>0?oe:null,schedule_enabled:ee==="ondemand"?!0:L,requires_confirmation:qe?F:!1,yolo_mode:G,foreground_mode:ue,command:jt?q:""};pn&&(Ee.id=e.id);const Xe=await c(pn?"task.update":"task.create",Ee,{timeout:45e3});if(Xe.error){I(Xe.error);return}pn||d(f.hostId,x),l(Xe)}catch(oe){I(oe instanceof Error?oe.message:String(oe))}finally{ve(!1)}}const Be=pn?"Save":(qe||gt||jt)&&L?"Schedule":"Save";return b.jsxs("div",{className:"task-form-overlay",children:[b.jsx("div",{className:"task-form",children:j?b.jsx(DE,{permissions:e==null?void 0:e.permissions}):b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"task-form-header",children:b.jsx("h2",{children:e?"Edit Task":"New Task"})}),B&&b.jsx("div",{className:"form-error",children:B}),b.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:y,onChange:oe=>g(oe.target.value),placeholder:jt?"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:ae}),b.jsxs("div",{className:"plan-actions",children:[t.length>0&&b.jsx("div",{className:"agent-picker-section-inline",children:t.length>1?b.jsx("select",{className:"form-select form-select-sm",value:x,onChange:oe=>v(oe.target.value),disabled:ae,children:t.map(oe=>b.jsx("option",{value:oe.key,children:oe.label},oe.key))}):b.jsx("span",{className:"agent-picker-single",children:(qt==null?void 0:qt.label)??t[0].label})}),nn&&b.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[b.jsx("input",{type:"checkbox",checked:G,onChange:oe=>ce(oe.target.checked),disabled:ae}),"Yolo"]}),nn&&G&&b.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),S&&b.jsx("div",{className:"granted-permissions-row",children:b.jsx("button",{className:"btn btn-link",onClick:()=>O(!0),children:"Granted Permissions"})})]}),b.jsx("div",{className:"toggles-group",children:b.jsxs("div",{className:"schedule-section",children:[b.jsxs("h3",{className:"schedule-section-title",children:["Schedule ",zn&&b.jsx("span",{className:"schedule-section-hint",children:"based on host time"})]}),b.jsxs("select",{className:"form-select",value:ee,onChange:oe=>Kt(oe.target.value),disabled:ae,children:[b.jsx("option",{value:"ondemand",children:"On User Demand"}),b.jsx("option",{value:"specific_times",children:"Specific Times"}),b.jsx("option",{value:"hourly",children:"Hourly"}),b.jsx("option",{value:"daily",children:"Daily"}),b.jsx("option",{value:"weekly",children:"Weekly"}),b.jsx("option",{value:"monthly",children:"Monthly"}),b.jsx("option",{value:"on_new_notification",children:"On New Notification"}),b.jsx("option",{value:"on_new_sms",children:"On New SMS"}),b.jsx("option",{value:"command",children:"On Command Output"})]}),gt&&b.jsxs("div",{className:"schedule-reactive",children:[b.jsxs("p",{className:"command-help-text",children:[ee==="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 ",ee==="on_new_notification"?"notification":"SMS","”."]}),ee==="on_new_notification"&&(()=>{const oe=_.find(Ee=>Ee.packageName===z),Re=(oe==null?void 0:oe.appName)||z;return b.jsxs(b.Fragment,{children:[s?z.trim()?b.jsxs("div",{className:"app-filter-selected",children:[b.jsx("span",{className:"app-filter-selected-name",children:Re}),(oe==null?void 0:oe.appName)&&b.jsx("span",{className:"app-filter-selected-pkg",children:oe.packageName}),b.jsx("button",{type:"button",className:"app-filter-selected-clear",onClick:()=>W(""),"aria-label":"Clear app filter",disabled:ae,children:"✕"})]}):b.jsx("button",{type:"button",className:"btn btn-link app-filter-trigger",onClick:()=>{ot(""),Ve(!0)},disabled:ae,children:"Select app"}):b.jsx("input",{className:"form-input",type:"text",value:z,onChange:Ee=>W(Ee.target.value),placeholder:"App (optional), e.g. com.google.android.gm",disabled:ae}),b.jsx("p",{className:"command-help-text app-filter-help",children:z.trim()?`Only notifications from ${Re} will trigger this task.`:"Every notification from your device triggers this task."})]})})(),ee==="on_new_sms"&&b.jsxs(b.Fragment,{children:[b.jsx("input",{className:"form-input",type:"text",value:Lt,onChange:oe=>Ie(oe.target.value),placeholder:"From (optional), e.g. +1 555-1234)",disabled:ae}),b.jsx("p",{className:"command-help-text app-filter-help",children:Lt.trim()?`Only SMS from ${Lt.trim()} will trigger this task. Formatting (spaces, dashes, parens) is ignored.`:"Every SMS that arrives on your device triggers this task."})]})]}),jt&&b.jsxs("div",{className:"schedule-reactive",children:[b.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."}),b.jsx("input",{ref:et,className:"form-input form-input-mono",type:"text",value:q,onChange:oe=>Y(oe.target.value),placeholder:"gws gmail +watch --project my-project",disabled:ae})]}),qe&&ee!=="hourly"&&b.jsxs(b.Fragment,{children:[D.map((oe,Re)=>b.jsxs("div",{className:"trigger-row-card",children:[b.jsxs("div",{className:"trigger-row-content",children:[ee==="daily"&&b.jsx("input",{className:"form-input",type:"time",value:oe.time,onChange:Ee=>Pe(Re,{time:Ee.target.value})}),ee==="weekly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:oe.dayOfWeek,onChange:Ee=>Pe(Re,{dayOfWeek:Ee.target.value}),children:UE.map((Ee,Ue)=>b.jsx("option",{value:String(Ue),children:Ee},Ue))}),b.jsx("input",{className:"form-input",type:"time",value:oe.time,onChange:Ee=>Pe(Re,{time:Ee.target.value})})]}),ee==="monthly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:oe.dayOfMonth,onChange:Ee=>Pe(Re,{dayOfMonth:Ee.target.value}),children:Array.from({length:28},(Ee,Ue)=>Ue+1).map(Ee=>b.jsxs("option",{value:String(Ee),children:["Day ",Ee]},Ee))}),b.jsx("input",{className:"form-input",type:"time",value:oe.time,onChange:Ee=>Pe(Re,{time:Ee.target.value})})]}),ee==="specific_times"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("input",{className:"form-input",type:"date",value:oe.onceDate,min:Xt.date,onChange:Ee=>Pe(Re,{onceDate:Ee.target.value})}),b.jsx("input",{className:"form-input",type:"time",value:oe.onceTime,min:oe.onceDate===Xt.date?Xt.time:void 0,onChange:Ee=>Pe(Re,{onceTime:Ee.target.value})})]})]}),D.length>1&&b.jsx("button",{className:"trigger-remove-btn",onClick:()=>Je(Re),title:"Remove trigger",children:"×"})]},Re)),b.jsx("button",{className:"trigger-add-btn",onClick:it,children:"+ Add"})]}),r==="win32"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:ue,onChange:oe=>re(oe.target.checked),disabled:ae}),"Run in the foreground (host must login to Windows)"]}),qe&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:F,onChange:oe=>$(oe.target.checked),disabled:ae}),"Confirm before each run"]}),ee!=="ondemand"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:L,onChange:oe=>J(oe.target.checked),disabled:ae}),"Enabled"]})]})}),!G&&qt&&!qt.supportsPermissions&&b.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",qt.label,". The task may fail if required permissions are not pre-configured."]}),b.jsxs("div",{className:"form-actions",children:[b.jsxs("button",{className:"btn btn-primary",onClick:()=>xe()&&ke(),disabled:!_e||ae,children:[ae&&b.jsx("span",{className:"btn-spinner"}),Be]}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{dt&&y.trim()&&!confirm("You have unsaved changes. Discard?")||u()},style:{marginLeft:"auto"},children:"Cancel"})]})]})}),Me&&(()=>{const oe=Ae.trim().toLowerCase(),Re=oe?_.filter(Ee=>Ee.packageName.toLowerCase().includes(oe)||Ee.appName.toLowerCase().includes(oe)):_;return b.jsx("div",{className:"app-filter-overlay",onClick:kt,children:b.jsxs("div",{className:"app-filter-dialog",onClick:Ee=>Ee.stopPropagation(),children:[b.jsxs("div",{className:"app-filter-header",children:[b.jsx("h2",{children:"Select app"}),b.jsx("button",{className:"app-filter-close",onClick:kt,"aria-label":"Close",children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:b.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),b.jsx("input",{className:"form-input app-filter-search",type:"text",value:Ae,onChange:Ee=>ot(Ee.target.value),onKeyDown:Ee=>{Ee.key==="Enter"&&Ae.trim()&&(W(Ae.trim()),kt())},placeholder:"Search or type a package name",autoFocus:!0}),b.jsxs("ul",{className:"app-filter-list",children:[je&&_.length===0?Array.from({length:6}).map((Ee,Ue)=>b.jsx("li",{className:"app-filter-row app-filter-skeleton",children:b.jsx("div",{className:"app-filter-skeleton-bar"})},`sk-${Ue}`)):Re.length===0&&!Ae.trim()?b.jsx("li",{className:"app-filter-empty",children:"No apps"}):Re.map(Ee=>b.jsx("li",{className:"app-filter-row",onClick:()=>{W(Ee.packageName),kt()},children:b.jsxs("div",{className:"app-filter-row-labels",children:[b.jsx("div",{className:"app-filter-row-name",children:Ee.appName||Ee.packageName}),Ee.appName&&b.jsx("div",{className:"app-filter-row-pkg",children:Ee.packageName})]})},Ee.packageName)),Ae.trim()&&b.jsx("li",{className:"app-filter-row",onClick:()=>{W(Ae.trim()),kt()},children:b.jsx("div",{className:"app-filter-row-labels",children:b.jsx("div",{className:"app-filter-row-name",children:Ae.trim()})})})]})]})})})()]})}function Hx({pullDistance:e,refreshing:t,threshold:r}){const s=e>0||t,l=e>=r;return b.jsx("div",{className:"pull-to-refresh",style:{transform:`translateY(${e}px)`,opacity:s?Math.min(1,e/30):0},"aria-hidden":!s,children:b.jsx("div",{className:"pull-to-refresh-badge",children:t?b.jsx("div",{className:"spinner"}):b.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:[b.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),b.jsx("polyline",{points:"19 12 12 19 5 12"})]})})})}function qx({onRefresh:e,threshold:t=70,maxPull:r=110,enabled:s=!0}){const[l,u]=A.useState(0),[c,f]=A.useState(!1),d=A.useRef(null),m=A.useRef(!1),y=A.useRef(0),g=A.useRef(!1),x=A.useRef(e);return A.useEffect(()=>{x.current=e}),A.useEffect(()=>{if(!s)return;const v=O=>{if(g.current||window.scrollY>0){d.current=null;return}if($E(O.target)){d.current=null;return}d.current=O.touches[0].clientY,m.current=!1,y.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,y.current=0,u(0);return}m.current=!0;const B=Math.min(r,M*.5);y.current=B,u(B),O.cancelable&&O.preventDefault()},j=()=>{if(!m.current){d.current=null,u(0);return}const O=y.current;d.current=null,m.current=!1,y.current=0,O>=t?(g.current=!0,f(!0),u(t),Promise.resolve(x.current()).catch(()=>{}).finally(()=>{g.current=!1,f(!1),u(0)})):u(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 $E(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 YE(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 VE({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:u,isNotificationListener:c,onViewRun:f,hostInfoStatus:d}){const[m,y]=A.useState([]),[g,x]=A.useState(!1),[v,S]=A.useState(null),[j,O]=A.useState(new Map),[M,B]=A.useState(!1),[I,ee]=A.useState(void 0),P=A.useCallback(()=>{B(!1),ee(void 0)},[]),D=A.useCallback(async()=>{if(e){x(!0),S(null);try{const J=(await r("task.list")).tasks??[],G=new Map;for(const ce of J)ce.status&&G.set(ce.id,ce.status);O(G),y(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),y([])}finally{x(!1)}}},[e,t,r]);A.useEffect(()=>{e?D():(y([]),x(!1))},[e,t,D]);const Z=qx({onRefresh:D,enabled:e});A.useEffect(()=>!e||!t?void 0:s(t,async J=>{const G=J.subject.split(".");if(G.length<3)return;const ce=G.slice(2).join(".");let ue={};try{ue=JSON.parse(new TextDecoder().decode(J.data))}catch{return}const re=ue.event_type;if(!(re!=="running-state"&&re!=="permission-resolved"))try{const q=await r("task.status",{id:ce},{timeout:5e3});if(q.error)return;O(Y=>{const ae=new Map(Y);return ae.set(ce,q),ae})}catch{}}),[e,t,s,r]);function F(L){y(J=>{const G=J.findIndex(ce=>ce.id===L.id);if(G>=0){const ce=[...J];return ce[G]=L,ce}return[L,...J]}),B(!1),ee(void 0)}function $(L){y(J=>J.filter(G=>G.id!==L)),O(J=>{const G=new Map(J);return G.delete(L),G})}return b.jsxs(b.Fragment,{children:[b.jsx(Hx,{pullDistance:Z.pullDistance,refreshing:Z.refreshing,threshold:Z.threshold}),v&&b.jsxs("div",{className:"form-error",children:[v,v.toLowerCase().includes("failed to fetch")&&b.jsxs(b.Fragment,{children:[" ",b.jsx("a",{href:"#",onClick:L=>{L.preventDefault(),window.location.reload()},children:"Reload"})]})]}),g&&!m.length&&d==="ready"?b.jsx("div",{className:"task-list",children:[0,1,2].map(L=>b.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[b.jsx("div",{className:"task-card-header",children:b.jsxs("div",{className:"task-card-title-row",children:[b.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),b.jsx("div",{className:"skeleton-line",style:{width:`${60+L*12}%`}})]})}),b.jsxs("div",{className:"task-card-meta",children:[b.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},L))}):m.length===0?d==="loading"?b.jsx("div",{className:"empty-state",children:b.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),b.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Try running ",b.jsx("code",{children:"palmier restart"})," on the host machine to restart the daemon."]})]}):b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No tasks yet"}),b.jsx("p",{className:"empty-state-hint",children:"Tap the + button to create your first task."})]}):b.jsx("div",{className:"task-list",children:m.map(L=>b.jsx(ME,{task:L,lastEvent:j.get(L.id),onEdit:J=>{ee(J),B(!0),r("task.get",{id:J.id}).then(G=>{G.error||ee(G)}).catch(()=>{})},onDelete:$,onViewRun:f},L.id))}),b.jsx("button",{className:"fab",onClick:()=>{ee(void 0),B(!0)},"aria-label":"New task",title:"New task",children:b.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),b.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),M&&b.jsx(FE,{initial:I,agents:l,hostPlatform:u,isNotificationListener:c,onSaved:F,onCancel:P},I?YE(I):"new")]})}let da=null;function V0(e){da&&(e.preventDefault(),e.returnValue="")}function Rh(e){const t=!!da;da=e;const r=!!da;r&&!t?window.addEventListener("beforeunload",V0):!r&&t&&window.removeEventListener("beforeunload",V0)}function ys(){return da?window.confirm(da):!0}function GE(){const e=Ur(),t=mr(),{hostId:r}=Yu(),s=t.pathname.endsWith("/tasks"),l=!s;function u(c){ys()&&r&&e(`/hosts/${encodeURIComponent(r)}${c}`)}return b.jsxs(b.Fragment,{children:[b.jsxs("button",{className:`tab-btn ${l?"tab-btn-active":""}`,onClick:()=>u(""),children:[b.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:b.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),b.jsxs("button",{className:`tab-btn ${s?"tab-btn-active":""}`,onClick:()=>u("/tasks"),children:[b.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:[b.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),b.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}function Ix(e){const[t,r]=A.useState(()=>window.matchMedia(e).matches);return A.useEffect(()=>{const s=window.matchMedia(e),l=u=>r(u.matches);return s.addEventListener("change",l),r(s.matches),()=>s.removeEventListener("change",l)},[e]),t}const Eu=Wn.isNativePlatform(),JE=["Device","Data","Messaging"],XE=[{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 KE(){if(!Eu||!xn)return new Set;try{const{capabilities:e}=await xn.getCapabilityStatus();return new Set(e.filter(t=>t.enabled).map(t=>t.name))}catch{return new Set}}function Fx({onChange:e,confirmDisable:t=!1}){const[r,s]=A.useState(new Map),[l,u]=A.useState(null),[c,f]=A.useState(null),d=A.useCallback(async()=>{if(!(!Eu||!xn))try{const{capabilities:S}=await xn.getCapabilityStatus(),j=new Map;for(const O of S)j.set(O.name,O);s(j),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]);A.useEffect(()=>{d()},[d]),A.useEffect(()=>{if(!Eu)return;const S=dd.addListener("resume",d);return()=>{S.then(j=>j.remove())}},[d]);async function m(S,j){if(xn){u(S.capability);try{const O=await xn.setCapabilityEnabled({capability:S.capability,enabled:j});!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{u(null)}}}function y(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(!Eu)return null;const x=JE.map(S=>({group:S,items:XE.filter(j=>{const O=r.get(j.capability);return j.group===S&&(O==null?void 0:O.supported)})})).filter(S=>S.items.length>0);if(x.length===0)return b.jsx("div",{className:"capability-toggles-loading",children:b.jsx("span",{className:"spinner"})});const v=c&&ps.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>f(null),children:b.jsxs("div",{className:"confirm-modal",onClick:S=>S.stopPropagation(),children:[b.jsxs("h2",{className:"confirm-modal-title",children:["Disable ",c.label,"?"]}),b.jsxs("p",{className:"confirm-modal-message",children:["All hosts linked to this device will no longer be able to use ",c.label,"."]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:g,children:"Disable"})]})]})}),document.body);return b.jsxs(b.Fragment,{children:[x.map(({group:S,items:j},O)=>b.jsx("div",{className:O>0?"drawer-toggle-group drawer-toggle-group-divided":"drawer-toggle-group",children:j.map(M=>{const B=r.get(M.capability),I=!!(B!=null&&B.enabled);return b.jsxs("label",{className:"drawer-toggle",children:[b.jsx("span",{className:"drawer-toggle-label",children:M.label}),b.jsx("button",{className:`toggle-switch ${I?"toggle-switch-on":""}`,onClick:()=>y(M),disabled:l===M.capability,role:"switch","aria-checked":I,children:b.jsx("span",{className:"toggle-switch-thumb"})})]},M.capability)})},S)),v]})}const G0=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),QE=Wn.isNativePlatform();function J0({daemonVersion:e,agents:t,linkedClientToken:r,request:s,onEnabledCapabilitiesChange:l,onLinkedClientTokenChange:u}){var Lt;const{pairedHosts:c,removePairedHost:f,renamePairedHost:d}=Yi(),{activeHost:m}=ui(),y=Ur(),g=mr(),v=Yu().hostId??null,S=m.clientToken||null,j=!!S&&r===S,O=Ix("(min-width: 768px)"),[M,B]=A.useState(!1),[I,ee]=A.useState(()=>Date.now());A.useEffect(()=>{const Ie=()=>ee(Date.now()),et=6e4-Date.now()%6e4,qe=setTimeout(()=>{Ie();const jt=setInterval(Ie,6e4);qe._iv=jt},et);return()=>{const jt=qe._iv;jt&&clearInterval(jt),clearTimeout(qe)}},[]);const P=m.timezone?new Date(I).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:m.timezone}):"";async function D(){if(!(!xn||!s||!S)){B(!0);try{const{token:Ie}=await xn.getFcmToken();if(!Ie)return;await s("device.link",{fcmToken:Ie}),u==null||u(S)}catch(Ie){console.error("Failed to make this the linked device:",Ie)}finally{B(!1)}}}async function Z(Ie){const et=Ie===v;if(et&&s)try{await s("clients.revoke_self")}catch{}f(Ie),ae(null),et&&y("/",{replace:!0})}function F(Ie){const qe=g.pathname.endsWith("/tasks")?"/tasks":"";y(`/hosts/${encodeURIComponent(Ie)}${qe}`)}const[$,L]=A.useState(!1),[J,G]=A.useState(!1),[ce,ue]=A.useState(null),[re,q]=A.useState(""),[Y,ae]=A.useState(null),[ve,N]=A.useState(!1),z=A.useRef(null),W=A.useRef(null),_=A.useCallback(()=>{G(!0)},[]);function ye(){J&&(L(!1),G(!1))}function je(){G(!1),L(!0)}function Se(Ie,et){ue(Ie),q(et)}function Me(){ce&&re.trim()&&d(ce,re.trim()),ue(null),q("")}function Ve(){ue(null),q("")}A.useEffect(()=>{ce&&W.current&&(W.current.focus(),W.current.select())},[ce]),A.useEffect(()=>{if(!$||J)return;function Ie(et){et.key==="Escape"&&_()}return document.addEventListener("keydown",Ie),()=>{document.removeEventListener("keydown",Ie)}},[$,J,_]);const Ae=b.jsxs(b.Fragment,{children:[!O&&b.jsx("button",{className:"drawer-close-btn",onClick:_,"aria-label":"Close menu",children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:b.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),!G0&&c.length>0&&b.jsxs("div",{className:"drawer-section",children:[b.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),b.jsx("div",{className:"host-picker-inline",children:b.jsx("div",{className:"host-picker-list",role:"listbox",children:c.map(Ie=>{const et=Ie.hostId===v,qe=ce===Ie.hostId,jt=Ie.name||Ie.hostId.slice(0,8);return b.jsx("div",{className:"host-picker-item-wrapper",children:b.jsxs("div",{className:`host-picker-item ${et?"host-picker-item-active":""}`,onClick:()=>{if(!qe&&!et){if(!ys())return;F(Ie.hostId),O||_()}},role:"option","aria-selected":et,children:[qe?b.jsx("input",{ref:W,className:"form-input host-picker-rename-input",type:"text",value:re,onChange:gt=>q(gt.target.value),onKeyDown:gt=>{gt.key==="Enter"&&Me(),gt.key==="Escape"&&Ve()},onBlur:Me,onClick:gt=>gt.stopPropagation()}):b.jsx("span",{className:"host-picker-item-name",children:jt}),b.jsxs("div",{className:"host-picker-item-actions",children:[et&&!qe&&b.jsx("button",{className:"host-picker-edit-btn",onClick:gt=>{gt.stopPropagation(),Se(Ie.hostId,jt)},"aria-label":"Rename host",children:b.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:b.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"})})}),!et&&b.jsx("button",{className:"host-picker-delete-btn",onClick:gt=>{gt.stopPropagation(),ae(Ie.hostId)},"aria-label":`Unpair ${jt}`,children:b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:b.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)})})})]}),!G0&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-divider"}),b.jsx("div",{className:"drawer-section",children:b.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{ys()&&(y("/pair"),O||_())},children:"Add New Host"})})]}),QE&&s&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-divider"}),b.jsxs("div",{className:"drawer-section",children:[b.jsx("h3",{className:"drawer-section-label",children:"Device Capabilities"}),j?b.jsx(Fx,{onChange:l,confirmDisable:!0}):b.jsxs(b.Fragment,{children:[b.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.)."}),b.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>{r&&r!==S?N(!0):D()},disabled:M,children:M?"Linking…":"Link the host to this device"})]})]})]}),b.jsxs("div",{className:"drawer-footer",children:[t&&t.length>0&&(()=>{const Ie=t.filter(qe=>qe.version),et=t.filter(qe=>!qe.version);return b.jsxs("div",{className:"drawer-agents",children:[Ie.length>0&&b.jsxs("div",{className:"drawer-agents-section",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Agents"}),Ie.map(qe=>b.jsxs("div",{className:"drawer-agents-row",children:[b.jsx("span",{children:qe.label}),b.jsxs("span",{className:"drawer-agents-version",children:["v",qe.version]})]},qe.key))]}),et.length>0&&b.jsxs("div",{className:"drawer-agents-section",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Version not managed by Palmier"}),et.map(qe=>b.jsx("div",{className:"drawer-agents-row",children:b.jsx("span",{children:qe.label})},qe.key))]})]})})(),(m.timezone||e)&&b.jsxs("div",{className:"drawer-host-info",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Host"}),m.timezone&&b.jsxs("div",{className:"drawer-host-time",children:[P," · ",m.timezone]}),e&&b.jsxs("div",{className:"drawer-version",children:["Version: v",e]})]}),b.jsxs("div",{className:"drawer-legal",children:[b.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),b.jsx("span",{className:"drawer-legal-sep",children:"·"}),b.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),ot=!!Y&&Y===v&&j,kt=Y&&ps.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>ae(null),children:b.jsxs("div",{className:"confirm-modal",onClick:Ie=>Ie.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Remove host?"}),b.jsxs("p",{className:"confirm-modal-message",children:['"',((Lt=c.find(Ie=>Ie.hostId===Y))==null?void 0:Lt.name)||Y.slice(0,8),'" will be ',ot?"removed and unlinked":"removed",".",ot&&b.jsx(b.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."})]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>ae(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:()=>Z(Y),children:"Remove"})]})]})}),document.body),an=ve&&ps.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>N(!1),children:b.jsxs("div",{className:"confirm-modal",onClick:Ie=>Ie.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),b.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."}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>N(!1),children:"Cancel"}),b.jsx("button",{className:"btn btn-primary",onClick:()=>{N(!1),D()},children:"Link"})]})]})}),document.body);return O?b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:z,children:Ae}),kt,an]}):b.jsxs(b.Fragment,{children:[b.jsx("button",{className:"hamburger-btn",onClick:je,"aria-label":"Open menu",children:b.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:b.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),$&&ps.createPortal(b.jsx("div",{className:`drawer-overlay ${J?"drawer-overlay-closing":""}`,onClick:_,onAnimationEnd:ye,children:b.jsx("div",{className:`drawer-panel ${J?"drawer-panel-closing":""}`,ref:z,onClick:Ie=>Ie.stopPropagation(),children:Ae})}),document.body),kt,an]})}const ZE=Wn.isNativePlatform(),Yd={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function WE(){return b.jsxs("svg",{...Yd,"aria-hidden":"true",children:[b.jsx("path",{d:"M3 11 L12 3 L21 11"}),b.jsx("path",{d:"M5 9.5 V21 H19 V9.5"})]})}function X0(){return b.jsxs("svg",{...Yd,"aria-hidden":"true",children:[b.jsx("circle",{cx:"12",cy:"12",r:"10"}),b.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),b.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 eC(){return b.jsxs("svg",{...Yd,"aria-hidden":"true",children:[b.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"}),b.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),b.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function tC(){const{mode:e}=ui(),[t,r]=A.useState(!1),s=A.useRef(null);if(A.useEffect(()=>{if(!t)return;function f(m){var y;(y=s.current)!=null&&y.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,u,c;switch(e){case"lan":l=b.jsx(WE,{}),u="Connected via LAN",c="lan";break;case"nats":l=b.jsx(X0,{}),u=ZE?"Connected via relay":"Connected",c="relay";break;case"disconnected":l=b.jsx(eC,{}),u="Disconnected",c="disconnected";break;case"connecting":default:l=b.jsx(X0,{}),u="Connecting…",c="connecting";break}return b.jsxs("div",{ref:s,className:`conn-status conn-status--${c}`,children:[b.jsx("button",{type:"button",className:"conn-status-btn","aria-label":u,onClick:()=>r(f=>!f),children:l}),b.jsx("div",{className:`conn-status-popover ${t?"conn-status-popover--open":""}`,role:"tooltip",children:u})]})}function K0(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 nC({agents:e,hostPlatform:t,onStarted:r}){const{request:s,activeHost:l}=ui(),{setHostLastAgent:u}=Yi(),[c,f]=A.useState(""),[d,m]=A.useState(()=>K0(e,l.lastAgent)),[y,g]=A.useState(!1),[x,v]=A.useState(!1),[S,j]=A.useState(null);A.useEffect(()=>{e.length&&(e.find(D=>D.key===d)||m(K0(e,l.lastAgent)))},[e,d,l.lastAgent]),A.useEffect(()=>{const D=c.trim().length>0;return Rh(D?"Your session draft will be lost. Continue?":null),()=>Rh(null)},[c]);const O=e.find(D=>D.key===d),M=!!(O!=null&&O.supportsYolo);A.useEffect(()=>{!M&&y&&g(!1)},[M,y]);const B=!!c.trim()&&!!d&&!x;function I(){return y?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.
|
|
91
91
|
|
|
92
|
-
Are you sure you want to continue?`):!0}async function ee(){if(!(!B||!I())){v(!0),T(null);try{const D=await s("task.run_oneoff",{user_prompt:c,agent:d,yolo_mode:y,...t==="win32"?{foreground_mode:!0}:{}});if(D.error){T(D.error);return}u(l.hostId,d),f(""),Rh(null),D.task_id&&r(D.task_id,D.run_id)}catch(D){T(D instanceof Error?D.message:String(D))}finally{v(!1)}}}function P(D){D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&(D.preventDefault(),ee())}return b.jsxs("div",{className:"session-composer",children:[S&&b.jsx("div",{className:"form-error",children:S}),b.jsx("textarea",{className:"session-composer-textarea",value:c,onChange:D=>f(D.target.value),onKeyDown:P,placeholder:"What can I do for you?",rows:3,disabled:x}),b.jsxs("div",{className:"session-composer-controls",children:[e.length>0&&b.jsx("div",{className:"agent-picker-section-inline",children:e.length>1?b.jsx("select",{className:"form-select form-select-sm",value:d,onChange:D=>m(D.target.value),disabled:x,children:e.map(D=>b.jsx("option",{value:D.key,children:D.label},D.key))}):b.jsx("span",{className:"agent-picker-single",children:(O==null?void 0:O.label)??e[0].label})}),M&&b.jsxs("label",{className:"session-composer-yolo",children:[b.jsx("input",{type:"checkbox",checked:y,onChange:D=>g(D.target.checked),disabled:x}),"Yolo"]}),b.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:ee,disabled:!B,"aria-label":"Run session",title:"Run session",children:x?b.jsx("span",{className:"btn-spinner"}):b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),b.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),M&&y&&b.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const fs=72,Q0=6;function rC({id:e,revealedId:t,setRevealedId:r,onDelete:s,onClick:l,children:u,actionLabel:c="Delete",confirmMessage:f="Delete this item? This can't be undone."}){const d=t===e,[m,y]=A.useState(0),[g,x]=A.useState(!1),v=A.useRef(0),S=A.useRef(0),T=A.useRef(null),O=A.useRef(0),M=A.useRef(!1),B=A.useRef(null);A.useEffect(()=>{d||y(0)},[d]),A.useEffect(()=>{if(!d)return;function F($){var L;(L=B.current)!=null&&L.contains($.target)||r(null)}return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[d,r]);function I(F){F.button!==void 0&&F.button!==0||(v.current=F.clientX,S.current=F.clientY,T.current=null,O.current=d?-fs:0,M.current=!1)}function ee(F){if(F.pointerType==="mouse"&&F.buttons===0)return;const $=F.clientX-v.current,L=F.clientY-S.current;if(T.current===null){if(Math.abs($)<Q0&&Math.abs(L)<Q0)return;if(T.current=Math.abs($)>Math.abs(L)?"x":"y",T.current==="x")try{F.currentTarget.setPointerCapture(F.pointerId)}catch{}}if(T.current!=="x")return;M.current=!0,g||x(!0);let J=O.current+$;J>0&&(J=J/4),J<-fs&&(J=-fs+(J+fs)/4),y(J)}function P(){if(T.current!=="x"){x(!1);return}T.current=null,x(!1),m<=-36?(y(-fs),r(e)):(y(0),d&&r(null))}function D(F){if(M.current){M.current=!1,F.stopPropagation(),F.preventDefault();return}d&&(F.stopPropagation(),F.preventDefault(),r(null))}const Z=m!==0?m:d?-fs:0;return b.jsxs("div",{ref:B,className:"swipe-row",children:[b.jsxs("button",{type:"button",className:"swipe-row-action",style:{width:fs},onClick:F=>{F.stopPropagation(),window.confirm(f)&&s()},tabIndex:d?0:-1,"aria-hidden":!d,"aria-label":c,children:[b.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:[b.jsx("polyline",{points:"3 6 5 6 21 6"}),b.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),b.jsx("path",{d:"M10 11v6M14 11v6"}),b.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]}),b.jsx("span",{className:"swipe-row-action-label",children:c})]}),b.jsx("div",{className:`swipe-row-content ${g?"swipe-row-content-dragging":""}`,style:{transform:`translateX(${Z}px)`},onPointerDown:I,onPointerMove:ee,onPointerUp:P,onPointerCancel:P,onClickCapture:D,onClick:l,children:u})]})}const iC=10;function sC({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:u,filterTaskId:c,onClearFilter:f,hostInfoStatus:d}){const m=$d(),[y,g]=A.useState([]),[x,v]=A.useState(0),[S,T]=A.useState(!1),[O,M]=A.useState(!1),[B,I]=A.useState(null),ee=Mr();async function P(Y){const ae=`${Y.task_id}:${Y.run_id}`;g(ve=>ve.filter(N=>`${N.task_id}:${N.run_id}`!==ae)),v(ve=>Math.max(0,ve-1)),I(null);try{await r("taskrun.delete",{task_id:Y.task_id,run_id:Y.run_id})}catch(ve){console.error("Failed to delete run:",ve),g(N=>[Y,...N]),v(N=>N+1)}}const D=A.useRef(null),Z=A.useCallback(Y=>{const ae={offset:Y,limit:iC};return c&&(ae.task_id=c),ae},[c]),F=A.useCallback(async(Y,ae)=>{if(e){ae?M(!0):T(!0);try{const ve=await r("taskrun.list",Z(Y)),N=ve.entries??[];v(ve.total??0),g(ae?z=>{const W=new Set(z.map(ye=>`${ye.task_id}:${ye.run_id}`)),_=N.filter(ye=>!W.has(`${ye.task_id}:${ye.run_id}`));return[...z,..._]}:N)}catch(ve){ve instanceof Error&&ve.message==="Not connected"||console.error("Failed to load runs:",ve)}finally{T(!1),M(!1)}}},[e,r,Z]);A.useEffect(()=>{e?(g([]),v(0),F(0,!1)):(g([]),v(0))},[e,t,F,c]);const $=qx({onRefresh:()=>F(0,!1),enabled:e});A.useEffect(()=>!e||!t?void 0:s(t,async ae=>{try{const ve=JSON.parse(new TextDecoder().decode(ae.data));if(ve.event_type==="running-state"&&ve.running_state&&["started","finished","failed","aborted"].includes(ve.running_state)){const N=await r("taskrun.list",Z(0)),z=N.entries??[];v(N.total??0),g(W=>{const _=new Map(z.map(Re=>[`${Re.task_id}:${Re.run_id}`,Re])),ye=W.map(Re=>{const Ye=`${Re.task_id}:${Re.run_id}`;return _.get(Ye)??Re}),Ae=new Set(ye.map(Re=>`${Re.task_id}:${Re.run_id}`));return[...z.filter(Re=>!Ae.has(`${Re.task_id}:${Re.run_id}`)),...ye]})}}catch{}}),[e,t,s,r]),A.useEffect(()=>{const Y=D.current;if(!Y)return;const ae=new IntersectionObserver(ve=>{ve[0].isIntersecting&&!O&&y.length<x&&F(y.length,!0)},{threshold:.1});return ae.observe(Y),()=>ae.disconnect()},[y.length,x,O,F]);function L(Y,ae){if(!Y||!ae)return"";const ve=Math.round((ae-Y)/1e3);if(ve<60)return`${ve}s`;const N=Math.floor(ve/60),z=ve%60;return`${N}m ${z}s`}const J={started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function G(Y,ae){ps()&&t&&ee(`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(Y)}/${encodeURIComponent(ae)}`)}const ue=!c&&d==="ready"&&b.jsx(nC,{agents:l,hostPlatform:u,onStarted:(Y,ae)=>{if(!t)return;const ve=`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(Y)}`;ee(ae?`${ve}/${encodeURIComponent(ae)}`:ve)}}),oe=b.jsx(Hx,{pullDistance:$.pullDistance,refreshing:$.refreshing,threshold:$.threshold}),re=c&&f&&b.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:b.jsxs("span",{className:"sessions-filter-chip",children:["Filtered by task",b.jsx("button",{onClick:f,"aria-label":"Clear filter",children:"×"})]})});function q(Y){if(Y==="failed")return"var(--color-error)";if(Y==="aborted")return"var(--color-warning, #d97706)"}return S&&y.length===0&&e&&d==="ready"?b.jsxs(b.Fragment,{children:[oe,ue,b.jsx("div",{className:"task-list",children:[0,1,2].map(Y=>b.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[b.jsx("div",{className:"task-card-header",children:b.jsx("div",{className:"task-card-title-row",children:b.jsx("div",{className:"skeleton-line",style:{width:`${70+Y*10}%`}})})}),b.jsx("div",{className:"task-card-meta",children:b.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},Y))})]}):y.length===0?b.jsxs(b.Fragment,{children:[oe,ue,re,b.jsx("div",{className:"sessions-view",children:d==="loading"?b.jsx("div",{className:"empty-state",children:b.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),b.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Try running ",b.jsx("code",{children:"palmier restart"})," on the host machine to restart the daemon."]})]}):b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),b.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."})]})})]}):b.jsxs(b.Fragment,{children:[oe,ue,re,b.jsxs("div",{className:"task-list",children:[y.map((Y,ae)=>{const ve=`${Y.task_id}:${Y.run_id}`;return b.jsx(rC,{id:ve,revealedId:B,setRevealedId:I,onDelete:()=>P(Y),confirmMessage:"Delete this session? Its run history will be removed from the host.",onClick:()=>!Y.error&&G(Y.task_id,Y.run_id),children:b.jsxs("div",{className:"sessions-card",children:[b.jsxs("div",{className:"sessions-card-body",children:[b.jsx("h3",{className:"sessions-card-name",children:Y.task_name||Y.task_id}),b.jsxs("div",{className:"sessions-card-meta",children:[Y.running_state==="started"?b.jsx("span",{className:"status-spinner","aria-label":"Running",children:b.jsx("span",{})}):b.jsx("span",{style:{color:q(Y.running_state)},children:J[Y.running_state??""]??Y.running_state}),Y.end_time&&b.jsx("span",{children:m(Y.end_time)}),Y.start_time&&Y.end_time&&b.jsx("span",{style:{color:"var(--color-muted)"},children:L(Y.start_time,Y.end_time)}),Y.error&&b.jsx("span",{style:{color:"var(--color-muted)"},children:Y.error})]})]}),b.jsx("span",{className:"sessions-card-chevron",children:"›"})]})},`${ve}-${ae}`)}),b.jsx("div",{ref:D,style:{height:1}}),O&&b.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:b.jsx("div",{className:"spinner"})})]})]})}function aC(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const lC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uC={};function Z0(e,t){return(uC.jsx?oC:lC).test(e)}const cC=/[ \t\n\f\r]/g;function fC(e){return typeof e=="object"?e.type==="text"?W0(e.value):!1:W0(e)}function W0(e){return e.replace(cC,"")===""}class Gl{constructor(t,r,s){this.normal=r,this.property=t,s&&(this.space=s)}}Gl.prototype.normal={};Gl.prototype.property={};Gl.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 Gl(r,s,t)}function gd(e){return e.toLowerCase()}class On{constructor(t,r){this.attribute=r,this.property=t}}On.prototype.attribute="";On.prototype.booleanish=!1;On.prototype.boolean=!1;On.prototype.commaOrSpaceSeparated=!1;On.prototype.commaSeparated=!1;On.prototype.defined=!1;On.prototype.mustUseProperty=!1;On.prototype.number=!1;On.prototype.overloadedBoolean=!1;On.prototype.property="";On.prototype.spaceSeparated=!1;On.prototype.space=void 0;let hC=0;const Qe=bs(),Qt=bs(),yd=bs(),Se=bs(),Ot=bs(),da=bs(),qn=bs();function bs(){return 2**++hC}const bd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Qe,booleanish:Qt,commaOrSpaceSeparated:qn,commaSeparated:da,number:Se,overloadedBoolean:yd,spaceSeparated:Ot},Symbol.toStringTag,{value:"Module"})),Mh=Object.keys(bd);class Vd extends On{constructor(t,r,s,l){let u=-1;if(super(t,r),eb(this,"space",l),typeof s=="number")for(;++u<Mh.length;){const c=Mh[u];eb(this,Mh[u],(s&bd[c])===bd[c])}}}Vd.prototype.defined=!0;function eb(e,t,r){r&&(e[t]=r)}function _a(e){const t={},r={};for(const[s,l]of Object.entries(e.properties)){const u=new Vd(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),t[s]=u,r[gd(s)]=s,r[gd(u.attribute)]=s}return new Gl(t,r,e.space)}const Yx=_a({properties:{ariaActiveDescendant:null,ariaAtomic:Qt,ariaAutoComplete:null,ariaBusy:Qt,ariaChecked:Qt,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Ot,ariaCurrent:null,ariaDescribedBy:Ot,ariaDetails:null,ariaDisabled:Qt,ariaDropEffect:Ot,ariaErrorMessage:null,ariaExpanded:Qt,ariaFlowTo:Ot,ariaGrabbed:Qt,ariaHasPopup:null,ariaHidden:Qt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ot,ariaLevel:Se,ariaLive:null,ariaModal:Qt,ariaMultiLine:Qt,ariaMultiSelectable:Qt,ariaOrientation:null,ariaOwns:Ot,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:Qt,ariaReadOnly:Qt,ariaRelevant:null,ariaRequired:Qt,ariaRoleDescription:Ot,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:Qt,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 Vx(e,t){return t in e?e[t]:t}function Gx(e,t){return Vx(e,t.toLowerCase())}const dC=_a({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:da,acceptCharset:Ot,accessKey:Ot,action:null,allow:null,allowFullScreen:Qe,allowPaymentRequest:Qe,allowUserMedia:Qe,alt:null,as:null,async:Qe,autoCapitalize:null,autoComplete:Ot,autoFocus:Qe,autoPlay:Qe,blocking:Ot,capture:null,charSet:null,checked:Qe,cite:null,className:Ot,cols:Se,colSpan:null,content:null,contentEditable:Qt,controls:Qe,controlsList:Ot,coords:Se|da,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Qe,defer:Qe,dir:null,dirName:null,disabled:Qe,download:yd,draggable:Qt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Qe,formTarget:null,headers:Ot,height:Se,hidden:yd,high:Se,href:null,hrefLang:null,htmlFor:Ot,httpEquiv:Ot,id:null,imageSizes:null,imageSrcSet:null,inert:Qe,inputMode:null,integrity:null,is:null,isMap:Qe,itemId:null,itemProp:Ot,itemRef:Ot,itemScope:Qe,itemType:Ot,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Qe,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Qe,muted:Qe,name:null,nonce:null,noModule:Qe,noValidate:Qe,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:Qe,optimum:Se,pattern:null,ping:Ot,placeholder:null,playsInline:Qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Qe,referrerPolicy:null,rel:Ot,required:Qe,reversed:Qe,rows:Se,rowSpan:Se,sandbox:Ot,scope:null,scoped:Qe,seamless:Qe,selected:Qe,shadowRootClonable:Qe,shadowRootDelegatesFocus:Qe,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:Qt,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:Qe,useMap:null,value:Qt,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ot,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:Qe,declare:Qe,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Qe,noHref:Qe,noShade:Qe,noWrap:Qe,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:Qt,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:Qe,disableRemotePlayback:Qe,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:Gx}),mC=_a({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:qn,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:Ot,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:Qe,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:da,g2:da,glyphName:da,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:qn,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:Ot,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:qn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:qn,rev:qn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:qn,requiredFeatures:qn,requiredFonts:qn,requiredFormats:qn,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:qn,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:qn,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:qn,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:Vx}),Jx=_a({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=_a({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Gx}),Kx=_a({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),pC={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"},gC=/[A-Z]/g,tb=/-[a-z]/g,yC=/^data[-\w.:]+$/i;function bC(e,t){const r=gd(t);let s=t,l=On;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&yC.test(t)){if(t.charAt(4)==="-"){const u=t.slice(5).replace(tb,vC);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=t.slice(4);if(!tb.test(u)){let c=u.replace(gC,xC);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=Vd}return new l(s,t)}function xC(e){return"-"+e.toLowerCase()}function vC(e){return e.charAt(1).toUpperCase()}const wC=$x([Yx,dC,Jx,Xx,Kx],"html"),Gd=$x([Yx,mC,Jx,Xx,Kx],"svg");function SC(e){return e.join(" ").trim()}var ta={},Dh,nb;function _C(){if(nb)return Dh;nb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,d=`
|
|
93
|
-
`,m="/",y="*",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 B=1,I=1;function ee(oe){var re=oe.match(t);re&&(B+=re.length);var q=oe.lastIndexOf(d);I=~q?oe.length-q:I+oe.length}function P(){var oe={line:B,column:I};return function(re){return re.position=new D(oe),$(),re}}function D(oe){this.start=oe,this.end={line:B,column:I},this.source=M.source}D.prototype.content=O;function Z(oe){var re=new Error(M.source+":"+B+":"+I+": "+oe);if(re.reason=oe,re.filename=M.source,re.line=B,re.column=I,re.source=O,!M.silent)throw re}function F(oe){var re=oe.exec(O);if(re){var q=re[0];return ee(q),O=O.slice(q.length),re}}function $(){F(r)}function L(oe){var re;for(oe=oe||[];re=J();)re!==!1&&oe.push(re);return oe}function J(){var oe=P();if(!(m!=O.charAt(0)||y!=O.charAt(1))){for(var re=2;g!=O.charAt(re)&&(y!=O.charAt(re)||m!=O.charAt(re+1));)++re;if(re+=2,g===O.charAt(re-1))return Z("End of comment missing");var q=O.slice(2,re-2);return I+=2,ee(q),O=O.slice(re),I+=2,oe({type:x,comment:q})}}function G(){var oe=P(),re=F(s);if(re){if(J(),!F(l))return Z("property missing ':'");var q=F(u),Y=oe({type:v,property:T(re[0].replace(e,g)),value:q?T(q[0].replace(e,g)):g});return F(c),Y}}function ue(){var oe=[];L(oe);for(var re;re=G();)re!==!1&&(oe.push(re),L(oe));return oe}return $(),ue()}function T(O){return O?O.replace(f,g):g}return Dh=S,Dh}var rb;function kC(){if(rb)return ta;rb=1;var e=ta&&ta.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ta,"__esModule",{value:!0}),ta.default=r;const t=e(_C());function r(s,l){let u=null;if(!s||typeof s!="string")return u;const c=(0,t.default)(s),f=typeof l=="function";return c.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:y}=d;f?l(m,y,d):y&&(u=u||{},u[m]=y)}),u}return ta}var vl={},ib;function EC(){if(ib)return vl;ib=1,Object.defineProperty(vl,"__esModule",{value:!0}),vl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(m){return!m||r.test(m)||e.test(m)},c=function(m,y){return y.toUpperCase()},f=function(m,y){return"".concat(y,"-")},d=function(m,y){return y===void 0&&(y={}),u(m)?m:(m=m.toLowerCase(),y.reactCompat?m=m.replace(l,f):m=m.replace(s,f),m.replace(t,c))};return vl.camelCase=d,vl}var wl,sb;function CC(){if(sb)return wl;sb=1;var e=wl&&wl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(kC()),r=EC();function s(l,u){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(f,d){f&&d&&(c[(0,r.camelCase)(f,u)]=d)}),c}return s.default=s,wl=s,wl}var AC=CC();const TC=Vb(AC),Qx=Zx("end"),Jd=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 jC(e){const t=Jd(e),r=Qx(e);if(t&&r)return{start:t,end:r}}function Rl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ab(e.position):"start"in e||"end"in e?ab(e):"line"in e||"column"in e?xd(e):""}function xd(e){return lb(e&&e.line)+":"+lb(e&&e.column)}function ab(e){return xd(e&&e.start)+"-"+xd(e&&e.end)}function lb(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="",u={},c=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof t=="string"?l=t:!u.cause&&t&&(c=!0,l=t.message,u.cause=t),!u.ruleId&&!u.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?u.ruleId=s:(u.source=s.slice(0,d),u.ruleId=s.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.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=Rl(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.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 Xd={}.hasOwnProperty,NC=new Map,OC=/[A-Z]/g,RC=new Set(["table","tbody","thead","tfoot","tr"]),MC=new Set(["td","th"]),Wx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function DC(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=IC(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=qC(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"?Gd:wC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},u=e1(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function e1(e,t,r){if(t.type==="element")return LC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return zC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return BC(e,t,r);if(t.type==="mdxjsEsm")return UC(e,t);if(t.type==="root")return PC(e,t,r);if(t.type==="text")return HC(e,t)}function LC(e,t,r){const s=e.schema;let l=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Gd,e.schema=l),e.ancestors.push(t);const u=n1(e,t.tagName,!1),c=FC(e,t);let f=Qd(e,t);return RC.has(t.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!fC(d):!0})),t1(e,c,u,t),Kd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,u,c,r)}function zC(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)}ql(e,t.position)}function UC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ql(e,t.position)}function BC(e,t,r){const s=e.schema;let l=s;t.name==="svg"&&s.space==="html"&&(l=Gd,e.schema=l),e.ancestors.push(t);const u=t.name===null?e.Fragment:n1(e,t.name,!0),c=$C(e,t),f=Qd(e,t);return t1(e,c,u,t),Kd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,u,c,r)}function PC(e,t,r){const s={};return Kd(s,Qd(e,t)),e.create(t,e.Fragment,s,r)}function HC(e,t){return t.value}function t1(e,t,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=s)}function Kd(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function qC(e,t,r){return s;function s(l,u,c,f){const m=Array.isArray(c.children)?r:t;return f?m(u,c,f):m(u,c)}}function IC(e,t){return r;function r(s,l,u,c){const f=Array.isArray(u.children),d=Jd(s);return t(l,u,c,f,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function FC(e,t){const r={};let s,l;for(l in t.properties)if(l!=="children"&&Xd.call(t.properties,l)){const u=YC(e,l,t.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&MC.has(t.tagName)?s=f:r[c]=f}}if(s){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function $C(e,t){const r={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else ql(e,t.position);else{const l=s.name;let u;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,u=e.evaluater.evaluateExpression(f.expression)}else ql(e,t.position);else u=s.value===null?!0:s.value;r[l]=u}return r}function Qd(e,t){const r=[];let s=-1;const l=e.passKeys?new Map:NC;for(;++s<t.children.length;){const u=t.children[s];let c;if(e.passKeys){const d=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(d){const m=l.get(d)||0;c=d+"-"+m,l.set(d,m+1)}}const f=e1(e,u,c);f!==void 0&&r.push(f)}return r}function YC(e,t,r){const s=bC(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?aC(r):SC(r)),s.property==="style"){let l=typeof r=="object"?r:VC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=GC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?pC[s.property]||s.property:s.attribute,r]}}function VC(e,t){try{return TC(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 u=-1,c;for(;++u<l.length;){const f=Z0(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}s=c}else s=Z0(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const l=s.value;return Xd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);ql(e)}function ql(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 GC(e){const t={};let r;for(r in e)Xd.call(e,r)&&(t[JC(r)]=e[r]);return t}function JC(e){let t=e.replace(OC,XC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function XC(e){return"-"+e.toLowerCase()}const Lh={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"]},KC={};function Zd(e,t){const r=KC,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(QC(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 ob(e.children,t,r)}return Array.isArray(e)?ob(e,t,r):""}function ob(e,t,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=r1(e[l],t,r);return s.join("")}function QC(e){return!!(e&&typeof e=="object")}const ub=document.createElement("i");function Wd(e){const t="&"+e+";";ub.innerHTML=t;const r=ub.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function Vn(e,t,r,s){const l=e.length;let u=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);u<s.length;)c=s.slice(u,u+1e4),c.unshift(t,0),e.splice(...c),u+=1e4,t+=1e4}function ur(e,t){return e.length>0?(Vn(e,e.length,0,t),e):t}const cb={}.hasOwnProperty;function i1(e){const t={};let r=-1;for(;++r<e.length;)ZC(t,e[r]);return t}function ZC(e,t){let r;for(r in t){const l=(cb.call(e,r)?e[r]:void 0)||(e[r]={}),u=t[r];let c;if(u)for(c in u){cb.call(l,c)||(l[c]=[]);const f=u[c];WC(l[c],Array.isArray(f)?f:f?[f]:[])}}}function WC(e,t){let r=-1;const s=[];for(;++r<t.length;)(t[r].add==="after"?e:s).push(t[r]);Vn(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 wr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xn=Fi(/[A-Za-z]/),dn=Fi(/[\dA-Za-z]/),eA=Fi(/[#-'*+\--9=?A-Z^-~]/);function Pu(e){return e!==null&&(e<32||e===127)}const vd=Fi(/\d/),tA=Fi(/[\dA-Fa-f]/),nA=Fi(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function Tt(e){return e!==null&&(e<0||e===32)}function nt(e){return e===-2||e===-1||e===32}const Zu=Fi(new RegExp("\\p{P}|\\p{S}","u")),gs=Fi(/\s/);function Fi(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function ka(e){const t=[];let r=-1,s=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&dn(e.charCodeAt(r+1))&&dn(e.charCodeAt(r+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(r+1);u<56320&&f>56319&&f<57344?(c=String.fromCharCode(u,f),l=1):c="�"}else c=String.fromCharCode(u);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 ut(e,t,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(d){return nt(d)?(e.enter(r),f(d)):t(d)}function f(d){return nt(d)&&u++<l?(e.consume(d),f):(e.exit(r),t(d))}}const rA={tokenize:iA};function iA(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"),ut(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),u(f)}function u(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"),u):(e.consume(f),c)}}const sA={tokenize:aA},fb={tokenize:lA};function aA(e){const t=this,r=[];let s=0,l,u,c;return f;function f(I){if(s<r.length){const ee=r[s];return t.containerState=ee[1],e.attempt(ee[0].continuation,d,m)(I)}return m(I)}function d(I){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&B();const ee=t.events.length;let P=ee,D;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){D=t.events[P][1].end;break}M(s);let Z=ee;for(;Z<t.events.length;)t.events[Z][1].end={...D},Z++;return Vn(t.events,P+1,0,t.events.slice(ee)),t.events.length=Z,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(fb,y,g)(I)}function y(I){return l&&B(),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(fb,v,S)(I)}function v(I){return s++,r.push([t.currentConstruct,t.containerState]),x(I)}function S(I){if(I===null){l&&B(),M(0),e.consume(I);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),T(I)}function T(I){if(I===null){O(e.exit("chunkFlow"),!0),M(0),e.consume(I);return}return Fe(I)?(e.consume(I),O(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(I),T)}function O(I,ee){const P=t.sliceStream(I);if(ee&&P.push(null),I.previous=u,u&&(u.next=I),u=I,l.defineSkip(I.start),l.write(P),t.parser.lazy[I.start.line]){let D=l.events.length;for(;D--;)if(l.events[D][1].start.offset<c&&(!l.events[D][1].end||l.events[D][1].end.offset>c))return;const Z=t.events.length;let F=Z,$,L;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if($){L=t.events[F][1].end;break}$=!0}for(M(s),D=Z;D<t.events.length;)t.events[D][1].end={...L},D++;Vn(t.events,F+1,0,t.events.slice(Z)),t.events.length=D}}function M(I){let ee=r.length;for(;ee-- >I;){const P=r[ee];t.containerState=P[1],P[0].exit.call(t,e)}r.length=I}function B(){l.write([null]),u=void 0,l=void 0,t.containerState._closeFlow=void 0}}function lA(e,t,r){return ut(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ba(e){if(e===null||Tt(e)||gs(e))return 1;if(Zu(e))return 2}function Wu(e,t,r){const s=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!s.includes(u)&&(t=u(t,r),s.push(u))}return t}const wd={name:"attention",resolveAll:oA,tokenize:uA};function oA(e,t){let r=-1,s,l,u,c,f,d,m,y;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};hb(g,-d),hb(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},u={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=ur(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=ur(m,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",u,t]]),m=ur(m,Wu(t.parser.constructs.insideSpan.null,e.slice(s+1,r),t)),m=ur(m,[["exit",u,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[r][1].end.offset-e[r][1].start.offset?(y=2,m=ur(m,[["enter",e[r][1],t],["exit",e[r][1],t]])):y=0,Vn(e,s-1,r-s+3,m),r=s+m.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function uA(e,t){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=ba(s);let u;return c;function c(d){return u=d,e.enter("attentionSequence"),f(d)}function f(d){if(d===u)return e.consume(d),f;const m=e.exit("attentionSequence"),y=ba(d),g=!y||y===2&&l||r.includes(d),x=!l||l===2&&y||r.includes(s);return m._open=!!(u===42?g:g&&(l||!x)),m._close=!!(u===42?x:x&&(y||!g)),t(d)}}function hb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const cA={name:"autolink",tokenize:fA};function fA(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"),u}function u(v){return xn(v)?(e.consume(v),c):v===64?r(v):m(v)}function c(v){return v===43||v===45||v===46||dn(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||dn(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||Pu(v)?r(v):(e.consume(v),d)}function m(v){return v===64?(e.consume(v),y):eA(v)?(e.consume(v),m):r(v)}function y(v){return dn(v)?g(v):r(v)}function g(v){return v===46?(e.consume(v),s=0,y):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||dn(v))&&s++<63){const S=v===45?x:g;return e.consume(v),S}return r(v)}}const Jl={partial:!0,tokenize:hA};function hA(e,t,r){return s;function s(u){return nt(u)?ut(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Fe(u)?t(u):r(u)}}const a1={continuation:{tokenize:mA},exit:pA,name:"blockQuote",tokenize:dA};function dA(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"),u}return r(c)}function u(c){return nt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function mA(e,t,r){const s=this;return l;function l(c){return nt(c)?ut(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(a1,t,r)(c)}}function pA(e){e.exit("blockQuote")}const l1={name:"characterEscape",tokenize:gA};function gA(e,t,r){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return nA(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(u)}}const o1={name:"characterReference",tokenize:yA};function yA(e,t,r){const s=this;let l=0,u,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"),u=31,c=dn,y(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=tA,y):(e.enter("characterReferenceValue"),u=7,c=vd,y(g))}function y(g){if(g===59&&l){const x=e.exit("characterReferenceValue");return c===dn&&!Wd(s.sliceSerialize(x))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&l++<u?(e.consume(g),y):r(g)}}const db={partial:!0,tokenize:xA},mb={concrete:!0,name:"codeFenced",tokenize:bA};function bA(e,t,r){const s=this,l={partial:!0,tokenize:P};let u=0,c=0,f;return d;function d(D){return m(D)}function m(D){const Z=s.events[s.events.length-1];return u=Z&&Z[1].type==="linePrefix"?Z[2].sliceSerialize(Z[1],!0).length:0,f=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(D)}function y(D){return D===f?(c++,e.consume(D),y):c<3?r(D):(e.exit("codeFencedFenceSequence"),nt(D)?ut(e,g,"whitespace")(D):g(D))}function g(D){return D===null||Fe(D)?(e.exit("codeFencedFence"),s.interrupt?t(D):e.check(db,T,ee)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(D))}function x(D){return D===null||Fe(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(D)):nt(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ut(e,v,"whitespace")(D)):D===96&&D===f?r(D):(e.consume(D),x)}function v(D){return D===null||Fe(D)?g(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(D))}function S(D){return D===null||Fe(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(D)):D===96&&D===f?r(D):(e.consume(D),S)}function T(D){return e.attempt(l,ee,O)(D)}function O(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),M}function M(D){return u>0&&nt(D)?ut(e,B,"linePrefix",u+1)(D):B(D)}function B(D){return D===null||Fe(D)?e.check(db,T,ee)(D):(e.enter("codeFlowValue"),I(D))}function I(D){return D===null||Fe(D)?(e.exit("codeFlowValue"),B(D)):(e.consume(D),I)}function ee(D){return e.exit("codeFenced"),t(D)}function P(D,Z,F){let $=0;return L;function L(re){return D.enter("lineEnding"),D.consume(re),D.exit("lineEnding"),J}function J(re){return D.enter("codeFencedFence"),nt(re)?ut(D,G,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(re):G(re)}function G(re){return re===f?(D.enter("codeFencedFenceSequence"),ue(re)):F(re)}function ue(re){return re===f?($++,D.consume(re),ue):$>=c?(D.exit("codeFencedFenceSequence"),nt(re)?ut(D,oe,"whitespace")(re):oe(re)):F(re)}function oe(re){return re===null||Fe(re)?(D.exit("codeFencedFence"),Z(re)):F(re)}}}function xA(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"),u)}function u(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}const zh={name:"codeIndented",tokenize:wA},vA={partial:!0,tokenize:SA};function wA(e,t,r){const s=this;return l;function l(m){return e.enter("codeIndented"),ut(e,u,"linePrefix",5)(m)}function u(m){const y=s.events[s.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?c(m):r(m)}function c(m){return m===null?d(m):Fe(m)?e.attempt(vA,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 SA(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):ut(e,u,"linePrefix",5)(c)}function u(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 _A={name:"codeText",previous:EA,resolve:kA,tokenize:CA};function kA(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 EA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function CA(e,t,r){let s=0,l,u;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?(u=e.enter("codeTextSequence"),l=0,y(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 y(g){return g===96?(e.consume(g),l++,y):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(u.type="codeTextData",m(g))}}class AA{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 u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&Sl(this.left,s),u.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),Sl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Sl(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);Sl(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Sl(this.left,r.reverse())}}}function Sl(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,u,c,f,d,m;const y=new AA(e);for(;++r<y.length;){for(;r in t;)r=t[r];if(s=y.get(r),r&&s[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,u=0,u<d.length&&d[u][1].type==="lineEndingBlank"&&(u+=2),u<d.length&&d[u][1].type==="content"))for(;++u<d.length&&d[u][1].type!=="content";)d[u][1].type==="chunkText"&&(d[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,TA(y,r)),r=t[r],m=!0);else if(s[1]._container){for(u=r,l=void 0;u--;)if(c=y.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(y.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(s[1].end={...y.get(l)[1].start},f=y.slice(l,r),f.unshift(s),y.splice(l,r-l+1,f))}}return Vn(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!m}function TA(e,t){const r=e.get(t)[1],s=e.get(t)[2];let l=t-1;const u=[];let c=r._tokenizer;c||(c=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,d=[],m={};let y,g,x=-1,v=r,S=0,T=0;const O=[T];for(;v;){for(;e.get(++l)[1]!==v;);u.push(l),v._tokenizer||(y=s.sliceStream(v),v.next||y.push(null),g&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),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&&(T=x+1,O.push(T),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]),B=u.pop();d.push([B,B+M.length-1]),e.splice(B,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 jA={resolve:OA,tokenize:RA},NA={partial:!0,tokenize:MA};function OA(e){return u1(e),e}function RA(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?u(f):Fe(f)?e.check(NA,c,u)(f):(e.consume(f),l)}function u(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 MA(e,t,r){const s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),ut(e,u,"linePrefix")}function u(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,u,c,f,d){const m=d||Number.POSITIVE_INFINITY;let y=0;return g;function g(M){return M===60?(e.enter(s),e.enter(l),e.enter(u),e.consume(M),e.exit(u),x):M===null||M===32||M===41||Pu(M)?r(M):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),T(M))}function x(M){return M===62?(e.enter(u),e.consume(M),e.exit(u),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 T(M){return!y&&(M===null||M===41||Tt(M))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(M)):y<m&&M===40?(e.consume(M),y++,T):M===41?(e.consume(M),y--,T):M===null||M===32||M===40||Pu(M)?r(M):(e.consume(M),M===92?O:T)}function O(M){return M===40||M===41||M===92?(e.consume(M),T):T(M)}}function f1(e,t,r,s,l,u){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(u),y}function y(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(u),e.enter(l),e.consume(v),e.exit(l),e.exit(s),t):Fe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Fe(v)||f++>999?(e.exit("chunkString"),y(v)):(e.consume(v),d||(d=!nt(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,u){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(u),m(x))}function m(x){return x===c?(e.exit(u),d(c)):x===null?r(x):Fe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),ut(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===c||x===null||Fe(x)?(e.exit("chunkString"),m(x)):(e.consume(x),x===92?g:y)}function g(x){return x===c||x===92?(e.consume(x),y):y(x)}}function Ml(e,t){let r;return s;function s(l){return Fe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):nt(l)?ut(e,s,r?"linePrefix":"lineSuffix")(l):t(l)}}const DA={name:"definition",tokenize:zA},LA={partial:!0,tokenize:UA};function zA(e,t,r){const s=this;let l;return u;function u(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=wr(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 Tt(v)?Ml(e,m)(v):m(v)}function m(v){return c1(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function y(v){return e.attempt(LA,g,g)(v)}function g(v){return nt(v)?ut(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 UA(e,t,r){return s;function s(f){return Tt(f)?Ml(e,l)(f):r(f)}function l(f){return h1(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return nt(f)?ut(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Fe(f)?t(f):r(f)}}const BA={name:"hardBreakEscape",tokenize:PA};function PA(e,t,r){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Fe(u)?(e.exit("hardBreakEscape"),t(u)):r(u)}}const HA={name:"headingAtx",resolve:qA,tokenize:IA};function qA(e,t){let r=e.length-2,s=3,l,u;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},u={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},Vn(e,s,r-s+1,[["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t]])),e}function IA(e,t,r){let s=0;return l;function l(y){return e.enter("atxHeading"),u(y)}function u(y){return e.enter("atxHeadingSequence"),c(y)}function c(y){return y===35&&s++<6?(e.consume(y),c):y===null||Tt(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),d(y)):y===null||Fe(y)?(e.exit("atxHeading"),t(y)):nt(y)?ut(e,f,"whitespace")(y):(e.enter("atxHeadingText"),m(y))}function d(y){return y===35?(e.consume(y),d):(e.exit("atxHeadingSequence"),f(y))}function m(y){return y===null||y===35||Tt(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),m)}}const FA=["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"],pb=["pre","script","style","textarea"],$A={concrete:!0,name:"htmlFlow",resolveTo:GA,tokenize:JA},YA={partial:!0,tokenize:KA},VA={partial:!0,tokenize:XA};function GA(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 JA(e,t,r){const s=this;let l,u,c,f,d;return m;function m(_){return y(_)}function y(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),g}function g(_){return _===33?(e.consume(_),x):_===47?(e.consume(_),u=!0,T):_===63?(e.consume(_),l=3,s.interrupt?t:N):xn(_)?(e.consume(_),c=String.fromCharCode(_),O):r(_)}function x(_){return _===45?(e.consume(_),l=2,v):_===91?(e.consume(_),l=5,f=0,S):xn(_)?(e.consume(_),l=4,s.interrupt?t:N):r(_)}function v(_){return _===45?(e.consume(_),s.interrupt?t:N):r(_)}function S(_){const ye="CDATA[";return _===ye.charCodeAt(f++)?(e.consume(_),f===ye.length?s.interrupt?t:G:S):r(_)}function T(_){return xn(_)?(e.consume(_),c=String.fromCharCode(_),O):r(_)}function O(_){if(_===null||_===47||_===62||Tt(_)){const ye=_===47,Ae=c.toLowerCase();return!ye&&!u&&pb.includes(Ae)?(l=1,s.interrupt?t(_):G(_)):FA.includes(c.toLowerCase())?(l=6,ye?(e.consume(_),M):s.interrupt?t(_):G(_)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(_):u?B(_):I(_))}return _===45||dn(_)?(e.consume(_),c+=String.fromCharCode(_),O):r(_)}function M(_){return _===62?(e.consume(_),s.interrupt?t:G):r(_)}function B(_){return nt(_)?(e.consume(_),B):L(_)}function I(_){return _===47?(e.consume(_),L):_===58||_===95||xn(_)?(e.consume(_),ee):nt(_)?(e.consume(_),I):L(_)}function ee(_){return _===45||_===46||_===58||_===95||dn(_)?(e.consume(_),ee):P(_)}function P(_){return _===61?(e.consume(_),D):nt(_)?(e.consume(_),P):I(_)}function D(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(e.consume(_),d=_,Z):nt(_)?(e.consume(_),D):F(_)}function Z(_){return _===d?(e.consume(_),d=null,$):_===null||Fe(_)?r(_):(e.consume(_),Z)}function F(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||Tt(_)?P(_):(e.consume(_),F)}function $(_){return _===47||_===62||nt(_)?I(_):r(_)}function L(_){return _===62?(e.consume(_),J):r(_)}function J(_){return _===null||Fe(_)?G(_):nt(_)?(e.consume(_),J):r(_)}function G(_){return _===45&&l===2?(e.consume(_),q):_===60&&l===1?(e.consume(_),Y):_===62&&l===4?(e.consume(_),z):_===63&&l===3?(e.consume(_),N):_===93&&l===5?(e.consume(_),ve):Fe(_)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(YA,W,ue)(_)):_===null||Fe(_)?(e.exit("htmlFlowData"),ue(_)):(e.consume(_),G)}function ue(_){return e.check(VA,oe,W)(_)}function oe(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),re}function re(_){return _===null||Fe(_)?ue(_):(e.enter("htmlFlowData"),G(_))}function q(_){return _===45?(e.consume(_),N):G(_)}function Y(_){return _===47?(e.consume(_),c="",ae):G(_)}function ae(_){if(_===62){const ye=c.toLowerCase();return pb.includes(ye)?(e.consume(_),z):G(_)}return xn(_)&&c.length<8?(e.consume(_),c+=String.fromCharCode(_),ae):G(_)}function ve(_){return _===93?(e.consume(_),N):G(_)}function N(_){return _===62?(e.consume(_),z):_===45&&l===2?(e.consume(_),N):G(_)}function z(_){return _===null||Fe(_)?(e.exit("htmlFlowData"),W(_)):(e.consume(_),z)}function W(_){return e.exit("htmlFlow"),t(_)}}function XA(e,t,r){const s=this;return l;function l(c){return Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}function KA(e,t,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Jl,t,r)}}const QA={name:"htmlText",tokenize:ZA};function ZA(e,t,r){const s=this;let l,u,c;return f;function f(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),d}function d(N){return N===33?(e.consume(N),m):N===47?(e.consume(N),P):N===63?(e.consume(N),I):xn(N)?(e.consume(N),F):r(N)}function m(N){return N===45?(e.consume(N),y):N===91?(e.consume(N),u=0,S):xn(N)?(e.consume(N),B):r(N)}function y(N){return N===45?(e.consume(N),v):r(N)}function g(N){return N===null?r(N):N===45?(e.consume(N),x):Fe(N)?(c=g,Y(N)):(e.consume(N),g)}function x(N){return N===45?(e.consume(N),v):g(N)}function v(N){return N===62?q(N):N===45?x(N):g(N)}function S(N){const z="CDATA[";return N===z.charCodeAt(u++)?(e.consume(N),u===z.length?T:S):r(N)}function T(N){return N===null?r(N):N===93?(e.consume(N),O):Fe(N)?(c=T,Y(N)):(e.consume(N),T)}function O(N){return N===93?(e.consume(N),M):T(N)}function M(N){return N===62?q(N):N===93?(e.consume(N),M):T(N)}function B(N){return N===null||N===62?q(N):Fe(N)?(c=B,Y(N)):(e.consume(N),B)}function I(N){return N===null?r(N):N===63?(e.consume(N),ee):Fe(N)?(c=I,Y(N)):(e.consume(N),I)}function ee(N){return N===62?q(N):I(N)}function P(N){return xn(N)?(e.consume(N),D):r(N)}function D(N){return N===45||dn(N)?(e.consume(N),D):Z(N)}function Z(N){return Fe(N)?(c=Z,Y(N)):nt(N)?(e.consume(N),Z):q(N)}function F(N){return N===45||dn(N)?(e.consume(N),F):N===47||N===62||Tt(N)?$(N):r(N)}function $(N){return N===47?(e.consume(N),q):N===58||N===95||xn(N)?(e.consume(N),L):Fe(N)?(c=$,Y(N)):nt(N)?(e.consume(N),$):q(N)}function L(N){return N===45||N===46||N===58||N===95||dn(N)?(e.consume(N),L):J(N)}function J(N){return N===61?(e.consume(N),G):Fe(N)?(c=J,Y(N)):nt(N)?(e.consume(N),J):$(N)}function G(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),l=N,ue):Fe(N)?(c=G,Y(N)):nt(N)?(e.consume(N),G):(e.consume(N),oe)}function ue(N){return N===l?(e.consume(N),l=void 0,re):N===null?r(N):Fe(N)?(c=ue,Y(N)):(e.consume(N),ue)}function oe(N){return N===null||N===34||N===39||N===60||N===61||N===96?r(N):N===47||N===62||Tt(N)?$(N):(e.consume(N),oe)}function re(N){return N===47||N===62||Tt(N)?$(N):r(N)}function q(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):r(N)}function Y(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),ae}function ae(N){return nt(N)?ut(e,ve,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):ve(N)}function ve(N){return e.enter("htmlTextData"),c(N)}}const em={name:"labelEnd",resolveAll:nT,resolveTo:rT,tokenize:iT},WA={tokenize:sT},eT={tokenize:aT},tT={tokenize:lT};function nT(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&&Vn(e,0,e.length,r),e}function rT(e,t){let r=e.length,s=0,l,u,c,f;for(;r--;)if(l=e[r][1],u){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&&(u=r,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(c=r);const d={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},y={type:"labelText",start:{...e[u+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",d,t],["enter",m,t]],f=ur(f,e.slice(u+1,u+s+3)),f=ur(f,[["enter",y,t]]),f=ur(f,Wu(t.parser.constructs.insideSpan.null,e.slice(u+s+4,c-3),t)),f=ur(f,[["exit",y,t],e[c-2],e[c-1],["exit",m,t]]),f=ur(f,e.slice(c+1)),f=ur(f,[["exit",d,t]]),Vn(e,u,e.length,f),e}function iT(e,t,r){const s=this;let l=s.events.length,u,c;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){u=s.events[l][1];break}return f;function f(x){return u?u._inactive?g(x):(c=s.parser.defined.includes(wr(s.sliceSerialize({start:u.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(WA,y,c?y:g)(x):x===91?e.attempt(eT,y,c?m:g)(x):c?y(x):g(x)}function m(x){return e.attempt(tT,y,g)(x)}function y(x){return t(x)}function g(x){return u._balanced=!0,r(x)}}function sT(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 Tt(g)?Ml(e,u)(g):u(g)}function u(g){return g===41?y(g):c1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Tt(g)?Ml(e,d)(g):y(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):y(g)}function m(g){return Tt(g)?Ml(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):r(g)}}function aT(e,t,r){const s=this;return l;function l(f){return f1.call(s,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return s.parser.defined.includes(wr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):r(f)}function c(f){return r(f)}}function lT(e,t,r){return s;function s(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),l}function l(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),t):r(u)}}const oT={name:"labelStartImage",resolveAll:em.resolveAll,tokenize:uT};function uT(e,t,r){const s=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(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 cT={name:"labelStartLink",resolveAll:em.resolveAll,tokenize:fT};function fT(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"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(c):t(c)}}const Uh={name:"lineEnding",tokenize:hT};function hT(e,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ut(e,t,"linePrefix")}}const Cu={name:"thematicBreak",tokenize:dT};function dT(e,t,r){let s=0,l;return u;function u(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"),nt(m)?ut(e,f,"whitespace")(m):f(m))}}const Nn={continuation:{tokenize:yT},exit:xT,name:"list",tokenize:gT},mT={partial:!0,tokenize:vT},pT={partial:!0,tokenize:bT};function gT(e,t,r){const s=this,l=s.events[s.events.length-1];let u=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:vd(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(Cu,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 vd(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(Jl,s.interrupt?r:y,e.attempt(mT,x,g))}function y(v){return s.containerState.initialBlankLine=!0,u++,x(v)}function g(v){return nt(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),x):r(v)}function x(v){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function yT(e,t,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Jl,l,u);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ut(e,t,"listItemIndent",s.containerState.size+1)(f)}function u(f){return s.containerState.furtherBlankLines||!nt(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(pT,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,ut(e,e.attempt(Nn,t,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function bT(e,t,r){const s=this;return ut(e,l,"listItemIndent",s.containerState.size+1);function l(u){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(u):r(u)}}function xT(e){e.exit(this.containerState.type)}function vT(e,t,r){const s=this;return ut(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const c=s.events[s.events.length-1];return!nt(u)&&c&&c[1].type==="listItemPrefixWhitespace"?t(u):r(u)}}const gb={name:"setextUnderline",resolveTo:wT,tokenize:ST};function wT(e,t){let r=e.length,s,l,u;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),!u&&e[r][1].type==="definition"&&(u=r);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",u?(e.splice(l,0,["enter",c,t]),e.splice(u+1,0,["exit",e[s][1],t]),e[s][1].end={...e[u][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function ST(e,t,r){const s=this;let l;return u;function u(m){let y=s.events.length,g;for(;y--;)if(s.events[y][1].type!=="lineEnding"&&s.events[y][1].type!=="linePrefix"&&s.events[y][1].type!=="content"){g=s.events[y][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"),nt(m)?ut(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||Fe(m)?(e.exit("setextHeadingLine"),t(m)):r(m)}}const _T={tokenize:kT};function kT(e){const t=this,r=e.attempt(Jl,s,e.attempt(this.parser.constructs.flowInitial,l,ut(e,e.attempt(this.parser.constructs.flow,l,e.attempt(jA,l)),"linePrefix")));return r;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const ET={resolveAll:m1()},CT=d1("string"),AT=d1("text");function d1(e){return{resolveAll:m1(e==="text"?TT:void 0),tokenize:t};function t(r){const s=this,l=this.parser.constructs[e],u=r.attempt(l,c,f);return c;function c(y){return m(y)?u(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),d}function d(y){return m(y)?(r.exit("data"),u(y)):(r.consume(y),d)}function m(y){if(y===null)return!0;const g=l[y];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,u;for(;++l<=r.length;)u===void 0?r[l]&&r[l][1].type==="data"&&(u=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==u+2&&(r[u][1].end=r[l-1][1].end,r.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(r,s):r}}function TT(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 u=l.length,c=-1,f=0,d;for(;u--;){const m=l[u];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){u++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(f=0),f){const m={type:r===e.length||d||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:s.start._bufferIndex+c,_index:s.start._index+u,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 jT={42:Nn,43:Nn,45:Nn,48:Nn,49:Nn,50:Nn,51:Nn,52:Nn,53:Nn,54:Nn,55:Nn,56:Nn,57:Nn,62:a1},NT={91:DA},OT={[-2]:zh,[-1]:zh,32:zh},RT={35:HA,42:Cu,45:[gb,Cu],60:$A,61:gb,95:Cu,96:mb,126:mb},MT={38:o1,92:l1},DT={[-5]:Uh,[-4]:Uh,[-3]:Uh,33:oT,38:o1,42:wd,60:[cA,QA],91:cT,92:[BA,l1],93:em,95:wd,96:_A},LT={null:[wd,ET]},zT={null:[42,95]},UT={null:[]},BT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:zT,contentInitial:NT,disable:UT,document:jT,flow:RT,flowInitial:OT,insideSpan:LT,string:MT,text:DT},Symbol.toStringTag,{value:"Module"}));function PT(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={},u=[];let c=[],f=[];const d={attempt:Z(P),check:Z(D),consume:B,enter:I,exit:ee,interrupt:Z(D,{interrupt:!0})},m={code:null,containerState:{},defineSkip:T,events:[],now:S,parser:e,previous:null,sliceSerialize:x,sliceStream:v,write:g};let y=t.tokenize.call(m,d);return t.resolveAll&&u.push(t),m;function g(J){return c=ur(c,J),O(),c[c.length-1]!==null?[]:(F(t,0),m.events=Wu(u,m.events,m),m.events)}function x(J,G){return qT(v(J),G)}function v(J){return HT(c,J)}function S(){const{_bufferIndex:J,_index:G,line:ue,column:oe,offset:re}=s;return{_bufferIndex:J,_index:G,line:ue,column:oe,offset:re}}function T(J){l[J.line]=J.column,L()}function O(){let J;for(;s._index<c.length;){const G=c[s._index];if(typeof G=="string")for(J=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===J&&s._bufferIndex<G.length;)M(G.charCodeAt(s._bufferIndex));else M(G)}}function M(J){y=y(J)}function B(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,G){const ue=G||{};return ue.type=J,ue.start=S(),m.events.push(["enter",ue,m]),f.push(ue),ue}function ee(J){const G=f.pop();return G.end=S(),m.events.push(["exit",G,m]),G}function P(J,G){F(J,G.from)}function D(J,G){G.restore()}function Z(J,G){return ue;function ue(oe,re,q){let Y,ae,ve,N;return Array.isArray(oe)?W(oe):"tokenize"in oe?W([oe]):z(oe);function z(_e){return Re;function Re(Ye){const Ce=Ye!==null&&_e[Ye],ot=Ye!==null&&_e.null,jt=[...Array.isArray(Ce)?Ce:Ce?[Ce]:[],...Array.isArray(ot)?ot:ot?[ot]:[]];return W(jt)(Ye)}}function W(_e){return Y=_e,ae=0,_e.length===0?q:_(_e[ae])}function _(_e){return Re;function Re(Ye){return N=$(),ve=_e,_e.partial||(m.currentConstruct=_e),_e.name&&m.parser.constructs.disable.null.includes(_e.name)?Ae():_e.tokenize.call(G?Object.assign(Object.create(m),G):m,d,ye,Ae)(Ye)}}function ye(_e){return J(ve,N),re}function Ae(_e){return N.restore(),++ae<Y.length?_(Y[ae]):q}}}function F(J,G){J.resolveAll&&!u.includes(J)&&u.push(J),J.resolve&&Vn(m.events,G,m.events.length-G,J.resolve(m.events.slice(G),m)),J.resolveTo&&(m.events=J.resolveTo(m.events,m))}function $(){const J=S(),G=m.previous,ue=m.currentConstruct,oe=m.events.length,re=Array.from(f);return{from:oe,restore:q};function q(){s=J,m.previous=G,m.currentConstruct=ue,m.events.length=oe,f=re,L()}}function L(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function HT(e,t){const r=t.start._index,s=t.start._bufferIndex,l=t.end._index,u=t.end._bufferIndex;let c;if(r===l)c=[e[r].slice(s,u)];else{if(c=e.slice(r,l),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}u>0&&c.push(e[l].slice(0,u))}return c}function qT(e,t){let r=-1;const s=[];let l;for(;++r<e.length;){const u=e[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
|
|
92
|
+
Are you sure you want to continue?`):!0}async function ee(){if(!(!B||!I())){v(!0),j(null);try{const D=await s("task.run_oneoff",{user_prompt:c,agent:d,yolo_mode:y,...t==="win32"?{foreground_mode:!0}:{}});if(D.error){j(D.error);return}u(l.hostId,d),f(""),Rh(null),D.task_id&&r(D.task_id,D.run_id)}catch(D){j(D instanceof Error?D.message:String(D))}finally{v(!1)}}}function P(D){D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&(D.preventDefault(),ee())}return b.jsxs("div",{className:"session-composer",children:[S&&b.jsx("div",{className:"form-error",children:S}),b.jsx("textarea",{className:"session-composer-textarea",value:c,onChange:D=>f(D.target.value),onKeyDown:P,placeholder:"What can I do for you?",rows:3,disabled:x}),b.jsxs("div",{className:"session-composer-controls",children:[e.length>0&&b.jsx("div",{className:"agent-picker-section-inline",children:e.length>1?b.jsx("select",{className:"form-select form-select-sm",value:d,onChange:D=>m(D.target.value),disabled:x,children:e.map(D=>b.jsx("option",{value:D.key,children:D.label},D.key))}):b.jsx("span",{className:"agent-picker-single",children:(O==null?void 0:O.label)??e[0].label})}),M&&b.jsxs("label",{className:"session-composer-yolo",children:[b.jsx("input",{type:"checkbox",checked:y,onChange:D=>g(D.target.checked),disabled:x}),"Yolo"]}),b.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:ee,disabled:!B,"aria-label":"Run session",title:"Run session",children:x?b.jsx("span",{className:"btn-spinner"}):b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),b.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),M&&y&&b.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const ds=72,Q0=6;function rC({id:e,revealedId:t,setRevealedId:r,onDelete:s,onClick:l,children:u,actionLabel:c="Delete",confirmMessage:f="Delete this item? This can't be undone."}){const d=t===e,[m,y]=A.useState(0),[g,x]=A.useState(!1),v=A.useRef(0),S=A.useRef(0),j=A.useRef(null),O=A.useRef(0),M=A.useRef(!1),B=A.useRef(null);A.useEffect(()=>{d||y(0)},[d]),A.useEffect(()=>{if(!d)return;function F($){var L;(L=B.current)!=null&&L.contains($.target)||r(null)}return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[d,r]);function I(F){F.button!==void 0&&F.button!==0||(v.current=F.clientX,S.current=F.clientY,j.current=null,O.current=d?-ds:0,M.current=!1)}function ee(F){if(F.pointerType==="mouse"&&F.buttons===0)return;const $=F.clientX-v.current,L=F.clientY-S.current;if(j.current===null){if(Math.abs($)<Q0&&Math.abs(L)<Q0)return;if(j.current=Math.abs($)>Math.abs(L)?"x":"y",j.current==="x")try{F.currentTarget.setPointerCapture(F.pointerId)}catch{}}if(j.current!=="x")return;M.current=!0,g||x(!0);let J=O.current+$;J>0&&(J=J/4),J<-ds&&(J=-ds+(J+ds)/4),y(J)}function P(){if(j.current!=="x"){x(!1);return}j.current=null,x(!1),m<=-36?(y(-ds),r(e)):(y(0),d&&r(null))}function D(F){if(M.current){M.current=!1,F.stopPropagation(),F.preventDefault();return}d&&(F.stopPropagation(),F.preventDefault(),r(null))}const Z=m!==0?m:d?-ds:0;return b.jsxs("div",{ref:B,className:"swipe-row",children:[b.jsxs("button",{type:"button",className:"swipe-row-action",style:{width:ds},onClick:F=>{F.stopPropagation(),window.confirm(f)&&s()},tabIndex:d?0:-1,"aria-hidden":!d,"aria-label":c,children:[b.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:[b.jsx("polyline",{points:"3 6 5 6 21 6"}),b.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),b.jsx("path",{d:"M10 11v6M14 11v6"}),b.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]}),b.jsx("span",{className:"swipe-row-action-label",children:c})]}),b.jsx("div",{className:`swipe-row-content ${g?"swipe-row-content-dragging":""}`,style:{transform:`translateX(${Z}px)`},onPointerDown:I,onPointerMove:ee,onPointerUp:P,onPointerCancel:P,onClickCapture:D,onClick:l,children:u})]})}const iC=10;function sC({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:u,filterTaskId:c,onClearFilter:f,hostInfoStatus:d}){const m=$d(),[y,g]=A.useState([]),[x,v]=A.useState(0),[S,j]=A.useState(!1),[O,M]=A.useState(!1),[B,I]=A.useState(null),ee=Ur();async function P(Y){const ae=`${Y.task_id}:${Y.run_id}`;g(ve=>ve.filter(N=>`${N.task_id}:${N.run_id}`!==ae)),v(ve=>Math.max(0,ve-1)),I(null);try{await r("taskrun.delete",{task_id:Y.task_id,run_id:Y.run_id})}catch(ve){console.error("Failed to delete run:",ve),g(N=>[Y,...N]),v(N=>N+1)}}const D=A.useRef(null),Z=A.useCallback(Y=>{const ae={offset:Y,limit:iC};return c&&(ae.task_id=c),ae},[c]),F=A.useCallback(async(Y,ae)=>{if(e){ae?M(!0):j(!0);try{const ve=await r("taskrun.list",Z(Y)),N=ve.entries??[];v(ve.total??0),g(ae?z=>{const W=new Set(z.map(ye=>`${ye.task_id}:${ye.run_id}`)),_=N.filter(ye=>!W.has(`${ye.task_id}:${ye.run_id}`));return[...z,..._]}:N)}catch(ve){ve instanceof Error&&ve.message==="Not connected"||console.error("Failed to load runs:",ve)}finally{j(!1),M(!1)}}},[e,r,Z]);A.useEffect(()=>{e?(g([]),v(0),F(0,!1)):(g([]),v(0))},[e,t,F,c]);const $=qx({onRefresh:()=>F(0,!1),enabled:e});A.useEffect(()=>!e||!t?void 0:s(t,async ae=>{try{const ve=JSON.parse(new TextDecoder().decode(ae.data));if(ve.event_type==="running-state"&&ve.running_state&&["started","finished","failed","aborted"].includes(ve.running_state)){const N=await r("taskrun.list",Z(0)),z=N.entries??[];v(N.total??0),g(W=>{const _=new Map(z.map(Me=>[`${Me.task_id}:${Me.run_id}`,Me])),ye=W.map(Me=>{const Ve=`${Me.task_id}:${Me.run_id}`;return _.get(Ve)??Me}),je=new Set(ye.map(Me=>`${Me.task_id}:${Me.run_id}`));return[...z.filter(Me=>!je.has(`${Me.task_id}:${Me.run_id}`)),...ye]})}}catch{}}),[e,t,s,r]),A.useEffect(()=>{const Y=D.current;if(!Y)return;const ae=new IntersectionObserver(ve=>{ve[0].isIntersecting&&!O&&y.length<x&&F(y.length,!0)},{threshold:.1});return ae.observe(Y),()=>ae.disconnect()},[y.length,x,O,F]);function L(Y,ae){if(!Y||!ae)return"";const ve=Math.round((ae-Y)/1e3);if(ve<60)return`${ve}s`;const N=Math.floor(ve/60),z=ve%60;return`${N}m ${z}s`}const J={started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function G(Y,ae){ys()&&t&&ee(`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(Y)}/${encodeURIComponent(ae)}`)}const ce=!c&&d==="ready"&&b.jsx(nC,{agents:l,hostPlatform:u,onStarted:(Y,ae)=>{if(!t)return;const ve=`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(Y)}`;ee(ae?`${ve}/${encodeURIComponent(ae)}`:ve)}}),ue=b.jsx(Hx,{pullDistance:$.pullDistance,refreshing:$.refreshing,threshold:$.threshold}),re=c&&f&&b.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:b.jsxs("span",{className:"sessions-filter-chip",children:["Filtered by task",b.jsx("button",{onClick:f,"aria-label":"Clear filter",children:"×"})]})});function q(Y){if(Y==="failed")return"var(--color-error)";if(Y==="aborted")return"var(--color-warning, #d97706)"}return S&&y.length===0&&e&&d==="ready"?b.jsxs(b.Fragment,{children:[ue,ce,b.jsx("div",{className:"task-list",children:[0,1,2].map(Y=>b.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[b.jsx("div",{className:"task-card-header",children:b.jsx("div",{className:"task-card-title-row",children:b.jsx("div",{className:"skeleton-line",style:{width:`${70+Y*10}%`}})})}),b.jsx("div",{className:"task-card-meta",children:b.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},Y))})]}):y.length===0?b.jsxs(b.Fragment,{children:[ue,ce,re,b.jsx("div",{className:"sessions-view",children:d==="loading"?b.jsx("div",{className:"empty-state",children:b.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),b.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Try running ",b.jsx("code",{children:"palmier restart"})," on the host machine to restart the daemon."]})]}):b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),b.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."})]})})]}):b.jsxs(b.Fragment,{children:[ue,ce,re,b.jsxs("div",{className:"task-list",children:[y.map((Y,ae)=>{const ve=`${Y.task_id}:${Y.run_id}`;return b.jsx(rC,{id:ve,revealedId:B,setRevealedId:I,onDelete:()=>P(Y),confirmMessage:"Delete this session? Its run history will be removed from the host.",onClick:()=>!Y.error&&G(Y.task_id,Y.run_id),children:b.jsxs("div",{className:"sessions-card",children:[b.jsxs("div",{className:"sessions-card-body",children:[b.jsx("h3",{className:"sessions-card-name",children:Y.task_name||Y.task_id}),b.jsxs("div",{className:"sessions-card-meta",children:[Y.running_state==="started"?b.jsx("span",{className:"status-spinner","aria-label":"Running",children:b.jsx("span",{})}):b.jsx("span",{style:{color:q(Y.running_state)},children:J[Y.running_state??""]??Y.running_state}),Y.end_time&&b.jsx("span",{children:m(Y.end_time)}),Y.start_time&&Y.end_time&&b.jsx("span",{style:{color:"var(--color-muted)"},children:L(Y.start_time,Y.end_time)}),Y.error&&b.jsx("span",{style:{color:"var(--color-muted)"},children:Y.error})]})]}),b.jsx("span",{className:"sessions-card-chevron",children:"›"})]})},`${ve}-${ae}`)}),b.jsx("div",{ref:D,style:{height:1}}),O&&b.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:b.jsx("div",{className:"spinner"})})]})]})}function aC(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const lC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uC={};function Z0(e,t){return(uC.jsx?oC:lC).test(e)}const cC=/[ \t\n\f\r]/g;function fC(e){return typeof e=="object"?e.type==="text"?W0(e.value):!1:W0(e)}function W0(e){return e.replace(cC,"")===""}class Gl{constructor(t,r,s){this.normal=r,this.property=t,s&&(this.space=s)}}Gl.prototype.normal={};Gl.prototype.property={};Gl.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 Gl(r,s,t)}function gd(e){return e.toLowerCase()}class Ln{constructor(t,r){this.attribute=r,this.property=t}}Ln.prototype.attribute="";Ln.prototype.booleanish=!1;Ln.prototype.boolean=!1;Ln.prototype.commaOrSpaceSeparated=!1;Ln.prototype.commaSeparated=!1;Ln.prototype.defined=!1;Ln.prototype.mustUseProperty=!1;Ln.prototype.number=!1;Ln.prototype.overloadedBoolean=!1;Ln.prototype.property="";Ln.prototype.spaceSeparated=!1;Ln.prototype.space=void 0;let hC=0;const Ze=vs(),tn=vs(),yd=vs(),we=vs(),Ot=vs(),ma=vs(),Vn=vs();function vs(){return 2**++hC}const bd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:tn,commaOrSpaceSeparated:Vn,commaSeparated:ma,number:we,overloadedBoolean:yd,spaceSeparated:Ot},Symbol.toStringTag,{value:"Module"})),Mh=Object.keys(bd);class Vd extends Ln{constructor(t,r,s,l){let u=-1;if(super(t,r),eb(this,"space",l),typeof s=="number")for(;++u<Mh.length;){const c=Mh[u];eb(this,Mh[u],(s&bd[c])===bd[c])}}}Vd.prototype.defined=!0;function eb(e,t,r){r&&(e[t]=r)}function ka(e){const t={},r={};for(const[s,l]of Object.entries(e.properties)){const u=new Vd(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),t[s]=u,r[gd(s)]=s,r[gd(u.attribute)]=s}return new Gl(t,r,e.space)}const Yx=ka({properties:{ariaActiveDescendant:null,ariaAtomic:tn,ariaAutoComplete:null,ariaBusy:tn,ariaChecked:tn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Ot,ariaCurrent:null,ariaDescribedBy:Ot,ariaDetails:null,ariaDisabled:tn,ariaDropEffect:Ot,ariaErrorMessage:null,ariaExpanded:tn,ariaFlowTo:Ot,ariaGrabbed:tn,ariaHasPopup:null,ariaHidden:tn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ot,ariaLevel:we,ariaLive:null,ariaModal:tn,ariaMultiLine:tn,ariaMultiSelectable:tn,ariaOrientation:null,ariaOwns:Ot,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:tn,ariaReadOnly:tn,ariaRelevant:null,ariaRequired:tn,ariaRoleDescription:Ot,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:tn,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Vx(e,t){return t in e?e[t]:t}function Gx(e,t){return Vx(e,t.toLowerCase())}const dC=ka({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ma,acceptCharset:Ot,accessKey:Ot,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:Ot,autoFocus:Ze,autoPlay:Ze,blocking:Ot,capture:null,charSet:null,checked:Ze,cite:null,className:Ot,cols:we,colSpan:null,content:null,contentEditable:tn,controls:Ze,controlsList:Ot,coords:we|ma,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:yd,draggable:tn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:Ot,height:we,hidden:yd,high:we,href:null,hrefLang:null,htmlFor:Ot,httpEquiv:Ot,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:Ot,itemRef:Ot,itemScope:Ze,itemType:Ot,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,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:Ze,optimum:we,pattern:null,ping:Ot,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:Ot,required:Ze,reversed:Ze,rows:we,rowSpan:we,sandbox:Ot,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:tn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:tn,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ot,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:tn,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ze,disableRemotePlayback:Ze,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:Gx}),mC=ka({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:Vn,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:Ot,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:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:Ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,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:ma,g2:ma,glyphName:ma,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:Vn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,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:we,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:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ot,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vn,rev:Vn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vn,requiredFeatures:Vn,requiredFonts:Vn,requiredFormats:Vn,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:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:Vn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vn,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Vx}),Jx=ka({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=ka({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Gx}),Kx=ka({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),pC={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"},gC=/[A-Z]/g,tb=/-[a-z]/g,yC=/^data[-\w.:]+$/i;function bC(e,t){const r=gd(t);let s=t,l=Ln;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&yC.test(t)){if(t.charAt(4)==="-"){const u=t.slice(5).replace(tb,vC);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=t.slice(4);if(!tb.test(u)){let c=u.replace(gC,xC);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=Vd}return new l(s,t)}function xC(e){return"-"+e.toLowerCase()}function vC(e){return e.charAt(1).toUpperCase()}const wC=$x([Yx,dC,Jx,Xx,Kx],"html"),Gd=$x([Yx,mC,Jx,Xx,Kx],"svg");function SC(e){return e.join(" ").trim()}var na={},Dh,nb;function _C(){if(nb)return Dh;nb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,d=`
|
|
93
|
+
`,m="/",y="*",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 B=1,I=1;function ee(ue){var re=ue.match(t);re&&(B+=re.length);var q=ue.lastIndexOf(d);I=~q?ue.length-q:I+ue.length}function P(){var ue={line:B,column:I};return function(re){return re.position=new D(ue),$(),re}}function D(ue){this.start=ue,this.end={line:B,column:I},this.source=M.source}D.prototype.content=O;function Z(ue){var re=new Error(M.source+":"+B+":"+I+": "+ue);if(re.reason=ue,re.filename=M.source,re.line=B,re.column=I,re.source=O,!M.silent)throw re}function F(ue){var re=ue.exec(O);if(re){var q=re[0];return ee(q),O=O.slice(q.length),re}}function $(){F(r)}function L(ue){var re;for(ue=ue||[];re=J();)re!==!1&&ue.push(re);return ue}function J(){var ue=P();if(!(m!=O.charAt(0)||y!=O.charAt(1))){for(var re=2;g!=O.charAt(re)&&(y!=O.charAt(re)||m!=O.charAt(re+1));)++re;if(re+=2,g===O.charAt(re-1))return Z("End of comment missing");var q=O.slice(2,re-2);return I+=2,ee(q),O=O.slice(re),I+=2,ue({type:x,comment:q})}}function G(){var ue=P(),re=F(s);if(re){if(J(),!F(l))return Z("property missing ':'");var q=F(u),Y=ue({type:v,property:j(re[0].replace(e,g)),value:q?j(q[0].replace(e,g)):g});return F(c),Y}}function ce(){var ue=[];L(ue);for(var re;re=G();)re!==!1&&(ue.push(re),L(ue));return ue}return $(),ce()}function j(O){return O?O.replace(f,g):g}return Dh=S,Dh}var rb;function kC(){if(rb)return na;rb=1;var e=na&&na.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(na,"__esModule",{value:!0}),na.default=r;const t=e(_C());function r(s,l){let u=null;if(!s||typeof s!="string")return u;const c=(0,t.default)(s),f=typeof l=="function";return c.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:y}=d;f?l(m,y,d):y&&(u=u||{},u[m]=y)}),u}return na}var vl={},ib;function EC(){if(ib)return vl;ib=1,Object.defineProperty(vl,"__esModule",{value:!0}),vl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(m){return!m||r.test(m)||e.test(m)},c=function(m,y){return y.toUpperCase()},f=function(m,y){return"".concat(y,"-")},d=function(m,y){return y===void 0&&(y={}),u(m)?m:(m=m.toLowerCase(),y.reactCompat?m=m.replace(l,f):m=m.replace(s,f),m.replace(t,c))};return vl.camelCase=d,vl}var wl,sb;function CC(){if(sb)return wl;sb=1;var e=wl&&wl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(kC()),r=EC();function s(l,u){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(f,d){f&&d&&(c[(0,r.camelCase)(f,u)]=d)}),c}return s.default=s,wl=s,wl}var AC=CC();const jC=Vb(AC),Qx=Zx("end"),Jd=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 TC(e){const t=Jd(e),r=Qx(e);if(t&&r)return{start:t,end:r}}function Rl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ab(e.position):"start"in e||"end"in e?ab(e):"line"in e||"column"in e?xd(e):""}function xd(e){return lb(e&&e.line)+":"+lb(e&&e.column)}function ab(e){return xd(e&&e.start)+"-"+xd(e&&e.end)}function lb(e){return e&&typeof e=="number"?e:1}class wn extends Error{constructor(t,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let l="",u={},c=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof t=="string"?l=t:!u.cause&&t&&(c=!0,l=t.message,u.cause=t),!u.ruleId&&!u.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?u.ruleId=s:(u.source=s.slice(0,d),u.ruleId=s.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.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=Rl(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}wn.prototype.file="";wn.prototype.name="";wn.prototype.reason="";wn.prototype.message="";wn.prototype.stack="";wn.prototype.column=void 0;wn.prototype.line=void 0;wn.prototype.ancestors=void 0;wn.prototype.cause=void 0;wn.prototype.fatal=void 0;wn.prototype.place=void 0;wn.prototype.ruleId=void 0;wn.prototype.source=void 0;const Xd={}.hasOwnProperty,NC=new Map,OC=/[A-Z]/g,RC=new Set(["table","tbody","thead","tfoot","tr"]),MC=new Set(["td","th"]),Wx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function DC(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=IC(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=qC(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"?Gd:wC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},u=e1(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function e1(e,t,r){if(t.type==="element")return LC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return zC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return BC(e,t,r);if(t.type==="mdxjsEsm")return UC(e,t);if(t.type==="root")return PC(e,t,r);if(t.type==="text")return HC(e,t)}function LC(e,t,r){const s=e.schema;let l=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Gd,e.schema=l),e.ancestors.push(t);const u=n1(e,t.tagName,!1),c=FC(e,t);let f=Qd(e,t);return RC.has(t.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!fC(d):!0})),t1(e,c,u,t),Kd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,u,c,r)}function zC(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)}ql(e,t.position)}function UC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ql(e,t.position)}function BC(e,t,r){const s=e.schema;let l=s;t.name==="svg"&&s.space==="html"&&(l=Gd,e.schema=l),e.ancestors.push(t);const u=t.name===null?e.Fragment:n1(e,t.name,!0),c=$C(e,t),f=Qd(e,t);return t1(e,c,u,t),Kd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,u,c,r)}function PC(e,t,r){const s={};return Kd(s,Qd(e,t)),e.create(t,e.Fragment,s,r)}function HC(e,t){return t.value}function t1(e,t,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=s)}function Kd(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function qC(e,t,r){return s;function s(l,u,c,f){const m=Array.isArray(c.children)?r:t;return f?m(u,c,f):m(u,c)}}function IC(e,t){return r;function r(s,l,u,c){const f=Array.isArray(u.children),d=Jd(s);return t(l,u,c,f,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function FC(e,t){const r={};let s,l;for(l in t.properties)if(l!=="children"&&Xd.call(t.properties,l)){const u=YC(e,l,t.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&MC.has(t.tagName)?s=f:r[c]=f}}if(s){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function $C(e,t){const r={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else ql(e,t.position);else{const l=s.name;let u;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,u=e.evaluater.evaluateExpression(f.expression)}else ql(e,t.position);else u=s.value===null?!0:s.value;r[l]=u}return r}function Qd(e,t){const r=[];let s=-1;const l=e.passKeys?new Map:NC;for(;++s<t.children.length;){const u=t.children[s];let c;if(e.passKeys){const d=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(d){const m=l.get(d)||0;c=d+"-"+m,l.set(d,m+1)}}const f=e1(e,u,c);f!==void 0&&r.push(f)}return r}function YC(e,t,r){const s=bC(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?aC(r):SC(r)),s.property==="style"){let l=typeof r=="object"?r:VC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=GC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?pC[s.property]||s.property:s.attribute,r]}}function VC(e,t){try{return jC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new wn("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 u=-1,c;for(;++u<l.length;){const f=Z0(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}s=c}else s=Z0(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const l=s.value;return Xd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);ql(e)}function ql(e,t){const r=new wn("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 GC(e){const t={};let r;for(r in e)Xd.call(e,r)&&(t[JC(r)]=e[r]);return t}function JC(e){let t=e.replace(OC,XC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function XC(e){return"-"+e.toLowerCase()}const Lh={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"]},KC={};function Zd(e,t){const r=KC,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(QC(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 ob(e.children,t,r)}return Array.isArray(e)?ob(e,t,r):""}function ob(e,t,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=r1(e[l],t,r);return s.join("")}function QC(e){return!!(e&&typeof e=="object")}const ub=document.createElement("i");function Wd(e){const t="&"+e+";";ub.innerHTML=t;const r=ub.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function Qn(e,t,r,s){const l=e.length;let u=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);u<s.length;)c=s.slice(u,u+1e4),c.unshift(t,0),e.splice(...c),u+=1e4,t+=1e4}function dr(e,t){return e.length>0?(Qn(e,e.length,0,t),e):t}const cb={}.hasOwnProperty;function i1(e){const t={};let r=-1;for(;++r<e.length;)ZC(t,e[r]);return t}function ZC(e,t){let r;for(r in t){const l=(cb.call(e,r)?e[r]:void 0)||(e[r]={}),u=t[r];let c;if(u)for(c in u){cb.call(l,c)||(l[c]=[]);const f=u[c];WC(l[c],Array.isArray(f)?f:f?[f]:[])}}}function WC(e,t){let r=-1;const s=[];for(;++r<t.length;)(t[r].add==="after"?e:s).push(t[r]);Qn(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 Er(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Cn=Gi(/[A-Za-z]/),vn=Gi(/[\dA-Za-z]/),eA=Gi(/[#-'*+\--9=?A-Z^-~]/);function Pu(e){return e!==null&&(e<32||e===127)}const vd=Gi(/\d/),tA=Gi(/[\dA-Fa-f]/),nA=Gi(/[!-/:-@[-`{-~]/);function $e(e){return e!==null&&e<-2}function At(e){return e!==null&&(e<0||e===32)}function rt(e){return e===-2||e===-1||e===32}const Zu=Gi(new RegExp("\\p{P}|\\p{S}","u")),bs=Gi(/\s/);function Gi(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Ea(e){const t=[];let r=-1,s=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&vn(e.charCodeAt(r+1))&&vn(e.charCodeAt(r+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(r+1);u<56320&&f>56319&&f<57344?(c=String.fromCharCode(u,f),l=1):c="�"}else c=String.fromCharCode(u);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 ut(e,t,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(d){return rt(d)?(e.enter(r),f(d)):t(d)}function f(d){return rt(d)&&u++<l?(e.consume(d),f):(e.exit(r),t(d))}}const rA={tokenize:iA};function iA(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"),ut(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),u(f)}function u(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"),u):(e.consume(f),c)}}const sA={tokenize:aA},fb={tokenize:lA};function aA(e){const t=this,r=[];let s=0,l,u,c;return f;function f(I){if(s<r.length){const ee=r[s];return t.containerState=ee[1],e.attempt(ee[0].continuation,d,m)(I)}return m(I)}function d(I){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&B();const ee=t.events.length;let P=ee,D;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){D=t.events[P][1].end;break}M(s);let Z=ee;for(;Z<t.events.length;)t.events[Z][1].end={...D},Z++;return Qn(t.events,P+1,0,t.events.slice(ee)),t.events.length=Z,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(fb,y,g)(I)}function y(I){return l&&B(),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(fb,v,S)(I)}function v(I){return s++,r.push([t.currentConstruct,t.containerState]),x(I)}function S(I){if(I===null){l&&B(),M(0),e.consume(I);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),j(I)}function j(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),j)}function O(I,ee){const P=t.sliceStream(I);if(ee&&P.push(null),I.previous=u,u&&(u.next=I),u=I,l.defineSkip(I.start),l.write(P),t.parser.lazy[I.start.line]){let D=l.events.length;for(;D--;)if(l.events[D][1].start.offset<c&&(!l.events[D][1].end||l.events[D][1].end.offset>c))return;const Z=t.events.length;let F=Z,$,L;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if($){L=t.events[F][1].end;break}$=!0}for(M(s),D=Z;D<t.events.length;)t.events[D][1].end={...L},D++;Qn(t.events,F+1,0,t.events.slice(Z)),t.events.length=D}}function M(I){let ee=r.length;for(;ee-- >I;){const P=r[ee];t.containerState=P[1],P[0].exit.call(t,e)}r.length=I}function B(){l.write([null]),u=void 0,l=void 0,t.containerState._closeFlow=void 0}}function lA(e,t,r){return ut(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function xa(e){if(e===null||At(e)||bs(e))return 1;if(Zu(e))return 2}function Wu(e,t,r){const s=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!s.includes(u)&&(t=u(t,r),s.push(u))}return t}const wd={name:"attention",resolveAll:oA,tokenize:uA};function oA(e,t){let r=-1,s,l,u,c,f,d,m,y;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};hb(g,-d),hb(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},u={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=dr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=dr(m,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",u,t]]),m=dr(m,Wu(t.parser.constructs.insideSpan.null,e.slice(s+1,r),t)),m=dr(m,[["exit",u,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[r][1].end.offset-e[r][1].start.offset?(y=2,m=dr(m,[["enter",e[r][1],t],["exit",e[r][1],t]])):y=0,Qn(e,s-1,r-s+3,m),r=s+m.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function uA(e,t){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=xa(s);let u;return c;function c(d){return u=d,e.enter("attentionSequence"),f(d)}function f(d){if(d===u)return e.consume(d),f;const m=e.exit("attentionSequence"),y=xa(d),g=!y||y===2&&l||r.includes(d),x=!l||l===2&&y||r.includes(s);return m._open=!!(u===42?g:g&&(l||!x)),m._close=!!(u===42?x:x&&(y||!g)),t(d)}}function hb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const cA={name:"autolink",tokenize:fA};function fA(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"),u}function u(v){return Cn(v)?(e.consume(v),c):v===64?r(v):m(v)}function c(v){return v===43||v===45||v===46||vn(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||vn(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||Pu(v)?r(v):(e.consume(v),d)}function m(v){return v===64?(e.consume(v),y):eA(v)?(e.consume(v),m):r(v)}function y(v){return vn(v)?g(v):r(v)}function g(v){return v===46?(e.consume(v),s=0,y):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||vn(v))&&s++<63){const S=v===45?x:g;return e.consume(v),S}return r(v)}}const Jl={partial:!0,tokenize:hA};function hA(e,t,r){return s;function s(u){return rt(u)?ut(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||$e(u)?t(u):r(u)}}const a1={continuation:{tokenize:mA},exit:pA,name:"blockQuote",tokenize:dA};function dA(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"),u}return r(c)}function u(c){return rt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function mA(e,t,r){const s=this;return l;function l(c){return rt(c)?ut(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(a1,t,r)(c)}}function pA(e){e.exit("blockQuote")}const l1={name:"characterEscape",tokenize:gA};function gA(e,t,r){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return nA(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(u)}}const o1={name:"characterReference",tokenize:yA};function yA(e,t,r){const s=this;let l=0,u,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"),u=31,c=vn,y(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=tA,y):(e.enter("characterReferenceValue"),u=7,c=vd,y(g))}function y(g){if(g===59&&l){const x=e.exit("characterReferenceValue");return c===vn&&!Wd(s.sliceSerialize(x))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&l++<u?(e.consume(g),y):r(g)}}const db={partial:!0,tokenize:xA},mb={concrete:!0,name:"codeFenced",tokenize:bA};function bA(e,t,r){const s=this,l={partial:!0,tokenize:P};let u=0,c=0,f;return d;function d(D){return m(D)}function m(D){const Z=s.events[s.events.length-1];return u=Z&&Z[1].type==="linePrefix"?Z[2].sliceSerialize(Z[1],!0).length:0,f=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(D)}function y(D){return D===f?(c++,e.consume(D),y):c<3?r(D):(e.exit("codeFencedFenceSequence"),rt(D)?ut(e,g,"whitespace")(D):g(D))}function g(D){return D===null||$e(D)?(e.exit("codeFencedFence"),s.interrupt?t(D):e.check(db,j,ee)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(D))}function x(D){return D===null||$e(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(D)):rt(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ut(e,v,"whitespace")(D)):D===96&&D===f?r(D):(e.consume(D),x)}function v(D){return D===null||$e(D)?g(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(D))}function S(D){return D===null||$e(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(D)):D===96&&D===f?r(D):(e.consume(D),S)}function j(D){return e.attempt(l,ee,O)(D)}function O(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),M}function M(D){return u>0&&rt(D)?ut(e,B,"linePrefix",u+1)(D):B(D)}function B(D){return D===null||$e(D)?e.check(db,j,ee)(D):(e.enter("codeFlowValue"),I(D))}function I(D){return D===null||$e(D)?(e.exit("codeFlowValue"),B(D)):(e.consume(D),I)}function ee(D){return e.exit("codeFenced"),t(D)}function P(D,Z,F){let $=0;return L;function L(re){return D.enter("lineEnding"),D.consume(re),D.exit("lineEnding"),J}function J(re){return D.enter("codeFencedFence"),rt(re)?ut(D,G,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(re):G(re)}function G(re){return re===f?(D.enter("codeFencedFenceSequence"),ce(re)):F(re)}function ce(re){return re===f?($++,D.consume(re),ce):$>=c?(D.exit("codeFencedFenceSequence"),rt(re)?ut(D,ue,"whitespace")(re):ue(re)):F(re)}function ue(re){return re===null||$e(re)?(D.exit("codeFencedFence"),Z(re)):F(re)}}}function xA(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"),u)}function u(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}const zh={name:"codeIndented",tokenize:wA},vA={partial:!0,tokenize:SA};function wA(e,t,r){const s=this;return l;function l(m){return e.enter("codeIndented"),ut(e,u,"linePrefix",5)(m)}function u(m){const y=s.events[s.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?c(m):r(m)}function c(m){return m===null?d(m):$e(m)?e.attempt(vA,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 SA(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):ut(e,u,"linePrefix",5)(c)}function u(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 _A={name:"codeText",previous:EA,resolve:kA,tokenize:CA};function kA(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 EA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function CA(e,t,r){let s=0,l,u;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?(u=e.enter("codeTextSequence"),l=0,y(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 y(g){return g===96?(e.consume(g),l++,y):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(u.type="codeTextData",m(g))}}class AA{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 u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&Sl(this.left,s),u.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),Sl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Sl(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);Sl(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Sl(this.left,r.reverse())}}}function Sl(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,u,c,f,d,m;const y=new AA(e);for(;++r<y.length;){for(;r in t;)r=t[r];if(s=y.get(r),r&&s[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,u=0,u<d.length&&d[u][1].type==="lineEndingBlank"&&(u+=2),u<d.length&&d[u][1].type==="content"))for(;++u<d.length&&d[u][1].type!=="content";)d[u][1].type==="chunkText"&&(d[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,jA(y,r)),r=t[r],m=!0);else if(s[1]._container){for(u=r,l=void 0;u--;)if(c=y.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(y.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(s[1].end={...y.get(l)[1].start},f=y.slice(l,r),f.unshift(s),y.splice(l,r-l+1,f))}}return Qn(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!m}function jA(e,t){const r=e.get(t)[1],s=e.get(t)[2];let l=t-1;const u=[];let c=r._tokenizer;c||(c=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,d=[],m={};let y,g,x=-1,v=r,S=0,j=0;const O=[j];for(;v;){for(;e.get(++l)[1]!==v;);u.push(l),v._tokenizer||(y=s.sliceStream(v),v.next||y.push(null),g&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),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,O.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):O.pop(),x=O.length;x--;){const M=f.slice(O[x],O[x+1]),B=u.pop();d.push([B,B+M.length-1]),e.splice(B,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 TA={resolve:OA,tokenize:RA},NA={partial:!0,tokenize:MA};function OA(e){return u1(e),e}function RA(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?u(f):$e(f)?e.check(NA,c,u)(f):(e.consume(f),l)}function u(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 MA(e,t,r){const s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),ut(e,u,"linePrefix")}function u(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,u,c,f,d){const m=d||Number.POSITIVE_INFINITY;let y=0;return g;function g(M){return M===60?(e.enter(s),e.enter(l),e.enter(u),e.consume(M),e.exit(u),x):M===null||M===32||M===41||Pu(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(u),e.consume(M),e.exit(u),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 j(M){return!y&&(M===null||M===41||At(M))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(M)):y<m&&M===40?(e.consume(M),y++,j):M===41?(e.consume(M),y--,j):M===null||M===32||M===40||Pu(M)?r(M):(e.consume(M),M===92?O:j)}function O(M){return M===40||M===41||M===92?(e.consume(M),j):j(M)}}function f1(e,t,r,s,l,u){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(u),y}function y(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(u),e.enter(l),e.consume(v),e.exit(l),e.exit(s),t):$e(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||$e(v)||f++>999?(e.exit("chunkString"),y(v)):(e.consume(v),d||(d=!rt(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,u){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(u),m(x))}function m(x){return x===c?(e.exit(u),d(c)):x===null?r(x):$e(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),ut(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===c||x===null||$e(x)?(e.exit("chunkString"),m(x)):(e.consume(x),x===92?g:y)}function g(x){return x===c||x===92?(e.consume(x),y):y(x)}}function Ml(e,t){let r;return s;function s(l){return $e(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):rt(l)?ut(e,s,r?"linePrefix":"lineSuffix")(l):t(l)}}const DA={name:"definition",tokenize:zA},LA={partial:!0,tokenize:UA};function zA(e,t,r){const s=this;let l;return u;function u(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=Er(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 At(v)?Ml(e,m)(v):m(v)}function m(v){return c1(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function y(v){return e.attempt(LA,g,g)(v)}function g(v){return rt(v)?ut(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 UA(e,t,r){return s;function s(f){return At(f)?Ml(e,l)(f):r(f)}function l(f){return h1(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return rt(f)?ut(e,c,"whitespace")(f):c(f)}function c(f){return f===null||$e(f)?t(f):r(f)}}const BA={name:"hardBreakEscape",tokenize:PA};function PA(e,t,r){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return $e(u)?(e.exit("hardBreakEscape"),t(u)):r(u)}}const HA={name:"headingAtx",resolve:qA,tokenize:IA};function qA(e,t){let r=e.length-2,s=3,l,u;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},u={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},Qn(e,s,r-s+1,[["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t]])),e}function IA(e,t,r){let s=0;return l;function l(y){return e.enter("atxHeading"),u(y)}function u(y){return e.enter("atxHeadingSequence"),c(y)}function c(y){return y===35&&s++<6?(e.consume(y),c):y===null||At(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),d(y)):y===null||$e(y)?(e.exit("atxHeading"),t(y)):rt(y)?ut(e,f,"whitespace")(y):(e.enter("atxHeadingText"),m(y))}function d(y){return y===35?(e.consume(y),d):(e.exit("atxHeadingSequence"),f(y))}function m(y){return y===null||y===35||At(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),m)}}const FA=["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"],pb=["pre","script","style","textarea"],$A={concrete:!0,name:"htmlFlow",resolveTo:GA,tokenize:JA},YA={partial:!0,tokenize:KA},VA={partial:!0,tokenize:XA};function GA(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 JA(e,t,r){const s=this;let l,u,c,f,d;return m;function m(_){return y(_)}function y(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),g}function g(_){return _===33?(e.consume(_),x):_===47?(e.consume(_),u=!0,j):_===63?(e.consume(_),l=3,s.interrupt?t:N):Cn(_)?(e.consume(_),c=String.fromCharCode(_),O):r(_)}function x(_){return _===45?(e.consume(_),l=2,v):_===91?(e.consume(_),l=5,f=0,S):Cn(_)?(e.consume(_),l=4,s.interrupt?t:N):r(_)}function v(_){return _===45?(e.consume(_),s.interrupt?t:N):r(_)}function S(_){const ye="CDATA[";return _===ye.charCodeAt(f++)?(e.consume(_),f===ye.length?s.interrupt?t:G:S):r(_)}function j(_){return Cn(_)?(e.consume(_),c=String.fromCharCode(_),O):r(_)}function O(_){if(_===null||_===47||_===62||At(_)){const ye=_===47,je=c.toLowerCase();return!ye&&!u&&pb.includes(je)?(l=1,s.interrupt?t(_):G(_)):FA.includes(c.toLowerCase())?(l=6,ye?(e.consume(_),M):s.interrupt?t(_):G(_)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(_):u?B(_):I(_))}return _===45||vn(_)?(e.consume(_),c+=String.fromCharCode(_),O):r(_)}function M(_){return _===62?(e.consume(_),s.interrupt?t:G):r(_)}function B(_){return rt(_)?(e.consume(_),B):L(_)}function I(_){return _===47?(e.consume(_),L):_===58||_===95||Cn(_)?(e.consume(_),ee):rt(_)?(e.consume(_),I):L(_)}function ee(_){return _===45||_===46||_===58||_===95||vn(_)?(e.consume(_),ee):P(_)}function P(_){return _===61?(e.consume(_),D):rt(_)?(e.consume(_),P):I(_)}function D(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(e.consume(_),d=_,Z):rt(_)?(e.consume(_),D):F(_)}function Z(_){return _===d?(e.consume(_),d=null,$):_===null||$e(_)?r(_):(e.consume(_),Z)}function F(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||At(_)?P(_):(e.consume(_),F)}function $(_){return _===47||_===62||rt(_)?I(_):r(_)}function L(_){return _===62?(e.consume(_),J):r(_)}function J(_){return _===null||$e(_)?G(_):rt(_)?(e.consume(_),J):r(_)}function G(_){return _===45&&l===2?(e.consume(_),q):_===60&&l===1?(e.consume(_),Y):_===62&&l===4?(e.consume(_),z):_===63&&l===3?(e.consume(_),N):_===93&&l===5?(e.consume(_),ve):$e(_)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(YA,W,ce)(_)):_===null||$e(_)?(e.exit("htmlFlowData"),ce(_)):(e.consume(_),G)}function ce(_){return e.check(VA,ue,W)(_)}function ue(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),re}function re(_){return _===null||$e(_)?ce(_):(e.enter("htmlFlowData"),G(_))}function q(_){return _===45?(e.consume(_),N):G(_)}function Y(_){return _===47?(e.consume(_),c="",ae):G(_)}function ae(_){if(_===62){const ye=c.toLowerCase();return pb.includes(ye)?(e.consume(_),z):G(_)}return Cn(_)&&c.length<8?(e.consume(_),c+=String.fromCharCode(_),ae):G(_)}function ve(_){return _===93?(e.consume(_),N):G(_)}function N(_){return _===62?(e.consume(_),z):_===45&&l===2?(e.consume(_),N):G(_)}function z(_){return _===null||$e(_)?(e.exit("htmlFlowData"),W(_)):(e.consume(_),z)}function W(_){return e.exit("htmlFlow"),t(_)}}function XA(e,t,r){const s=this;return l;function l(c){return $e(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}function KA(e,t,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Jl,t,r)}}const QA={name:"htmlText",tokenize:ZA};function ZA(e,t,r){const s=this;let l,u,c;return f;function f(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),d}function d(N){return N===33?(e.consume(N),m):N===47?(e.consume(N),P):N===63?(e.consume(N),I):Cn(N)?(e.consume(N),F):r(N)}function m(N){return N===45?(e.consume(N),y):N===91?(e.consume(N),u=0,S):Cn(N)?(e.consume(N),B):r(N)}function y(N){return N===45?(e.consume(N),v):r(N)}function g(N){return N===null?r(N):N===45?(e.consume(N),x):$e(N)?(c=g,Y(N)):(e.consume(N),g)}function x(N){return N===45?(e.consume(N),v):g(N)}function v(N){return N===62?q(N):N===45?x(N):g(N)}function S(N){const z="CDATA[";return N===z.charCodeAt(u++)?(e.consume(N),u===z.length?j:S):r(N)}function j(N){return N===null?r(N):N===93?(e.consume(N),O):$e(N)?(c=j,Y(N)):(e.consume(N),j)}function O(N){return N===93?(e.consume(N),M):j(N)}function M(N){return N===62?q(N):N===93?(e.consume(N),M):j(N)}function B(N){return N===null||N===62?q(N):$e(N)?(c=B,Y(N)):(e.consume(N),B)}function I(N){return N===null?r(N):N===63?(e.consume(N),ee):$e(N)?(c=I,Y(N)):(e.consume(N),I)}function ee(N){return N===62?q(N):I(N)}function P(N){return Cn(N)?(e.consume(N),D):r(N)}function D(N){return N===45||vn(N)?(e.consume(N),D):Z(N)}function Z(N){return $e(N)?(c=Z,Y(N)):rt(N)?(e.consume(N),Z):q(N)}function F(N){return N===45||vn(N)?(e.consume(N),F):N===47||N===62||At(N)?$(N):r(N)}function $(N){return N===47?(e.consume(N),q):N===58||N===95||Cn(N)?(e.consume(N),L):$e(N)?(c=$,Y(N)):rt(N)?(e.consume(N),$):q(N)}function L(N){return N===45||N===46||N===58||N===95||vn(N)?(e.consume(N),L):J(N)}function J(N){return N===61?(e.consume(N),G):$e(N)?(c=J,Y(N)):rt(N)?(e.consume(N),J):$(N)}function G(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),l=N,ce):$e(N)?(c=G,Y(N)):rt(N)?(e.consume(N),G):(e.consume(N),ue)}function ce(N){return N===l?(e.consume(N),l=void 0,re):N===null?r(N):$e(N)?(c=ce,Y(N)):(e.consume(N),ce)}function ue(N){return N===null||N===34||N===39||N===60||N===61||N===96?r(N):N===47||N===62||At(N)?$(N):(e.consume(N),ue)}function re(N){return N===47||N===62||At(N)?$(N):r(N)}function q(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):r(N)}function Y(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),ae}function ae(N){return rt(N)?ut(e,ve,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):ve(N)}function ve(N){return e.enter("htmlTextData"),c(N)}}const em={name:"labelEnd",resolveAll:nj,resolveTo:rj,tokenize:ij},WA={tokenize:sj},ej={tokenize:aj},tj={tokenize:lj};function nj(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&&Qn(e,0,e.length,r),e}function rj(e,t){let r=e.length,s=0,l,u,c,f;for(;r--;)if(l=e[r][1],u){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&&(u=r,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(c=r);const d={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},y={type:"labelText",start:{...e[u+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",d,t],["enter",m,t]],f=dr(f,e.slice(u+1,u+s+3)),f=dr(f,[["enter",y,t]]),f=dr(f,Wu(t.parser.constructs.insideSpan.null,e.slice(u+s+4,c-3),t)),f=dr(f,[["exit",y,t],e[c-2],e[c-1],["exit",m,t]]),f=dr(f,e.slice(c+1)),f=dr(f,[["exit",d,t]]),Qn(e,u,e.length,f),e}function ij(e,t,r){const s=this;let l=s.events.length,u,c;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){u=s.events[l][1];break}return f;function f(x){return u?u._inactive?g(x):(c=s.parser.defined.includes(Er(s.sliceSerialize({start:u.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(WA,y,c?y:g)(x):x===91?e.attempt(ej,y,c?m:g)(x):c?y(x):g(x)}function m(x){return e.attempt(tj,y,g)(x)}function y(x){return t(x)}function g(x){return u._balanced=!0,r(x)}}function sj(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 At(g)?Ml(e,u)(g):u(g)}function u(g){return g===41?y(g):c1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return At(g)?Ml(e,d)(g):y(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):y(g)}function m(g){return At(g)?Ml(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):r(g)}}function aj(e,t,r){const s=this;return l;function l(f){return f1.call(s,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return s.parser.defined.includes(Er(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):r(f)}function c(f){return r(f)}}function lj(e,t,r){return s;function s(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),l}function l(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),t):r(u)}}const oj={name:"labelStartImage",resolveAll:em.resolveAll,tokenize:uj};function uj(e,t,r){const s=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(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 cj={name:"labelStartLink",resolveAll:em.resolveAll,tokenize:fj};function fj(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"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(c):t(c)}}const Uh={name:"lineEnding",tokenize:hj};function hj(e,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ut(e,t,"linePrefix")}}const Cu={name:"thematicBreak",tokenize:dj};function dj(e,t,r){let s=0,l;return u;function u(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"),rt(m)?ut(e,f,"whitespace")(m):f(m))}}const Dn={continuation:{tokenize:yj},exit:xj,name:"list",tokenize:gj},mj={partial:!0,tokenize:vj},pj={partial:!0,tokenize:bj};function gj(e,t,r){const s=this,l=s.events[s.events.length-1];let u=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:vd(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(Cu,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 vd(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(Jl,s.interrupt?r:y,e.attempt(mj,x,g))}function y(v){return s.containerState.initialBlankLine=!0,u++,x(v)}function g(v){return rt(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),x):r(v)}function x(v){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function yj(e,t,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Jl,l,u);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ut(e,t,"listItemIndent",s.containerState.size+1)(f)}function u(f){return s.containerState.furtherBlankLines||!rt(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(pj,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,ut(e,e.attempt(Dn,t,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function bj(e,t,r){const s=this;return ut(e,l,"listItemIndent",s.containerState.size+1);function l(u){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(u):r(u)}}function xj(e){e.exit(this.containerState.type)}function vj(e,t,r){const s=this;return ut(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const c=s.events[s.events.length-1];return!rt(u)&&c&&c[1].type==="listItemPrefixWhitespace"?t(u):r(u)}}const gb={name:"setextUnderline",resolveTo:wj,tokenize:Sj};function wj(e,t){let r=e.length,s,l,u;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),!u&&e[r][1].type==="definition"&&(u=r);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",u?(e.splice(l,0,["enter",c,t]),e.splice(u+1,0,["exit",e[s][1],t]),e[s][1].end={...e[u][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function Sj(e,t,r){const s=this;let l;return u;function u(m){let y=s.events.length,g;for(;y--;)if(s.events[y][1].type!=="lineEnding"&&s.events[y][1].type!=="linePrefix"&&s.events[y][1].type!=="content"){g=s.events[y][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"),rt(m)?ut(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||$e(m)?(e.exit("setextHeadingLine"),t(m)):r(m)}}const _j={tokenize:kj};function kj(e){const t=this,r=e.attempt(Jl,s,e.attempt(this.parser.constructs.flowInitial,l,ut(e,e.attempt(this.parser.constructs.flow,l,e.attempt(TA,l)),"linePrefix")));return r;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const Ej={resolveAll:m1()},Cj=d1("string"),Aj=d1("text");function d1(e){return{resolveAll:m1(e==="text"?jj:void 0),tokenize:t};function t(r){const s=this,l=this.parser.constructs[e],u=r.attempt(l,c,f);return c;function c(y){return m(y)?u(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),d}function d(y){return m(y)?(r.exit("data"),u(y)):(r.consume(y),d)}function m(y){if(y===null)return!0;const g=l[y];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,u;for(;++l<=r.length;)u===void 0?r[l]&&r[l][1].type==="data"&&(u=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==u+2&&(r[u][1].end=r[l-1][1].end,r.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(r,s):r}}function jj(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 u=l.length,c=-1,f=0,d;for(;u--;){const m=l[u];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){u++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(f=0),f){const m={type:r===e.length||d||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:s.start._bufferIndex+c,_index:s.start._index+u,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 Tj={42:Dn,43:Dn,45:Dn,48:Dn,49:Dn,50:Dn,51:Dn,52:Dn,53:Dn,54:Dn,55:Dn,56:Dn,57:Dn,62:a1},Nj={91:DA},Oj={[-2]:zh,[-1]:zh,32:zh},Rj={35:HA,42:Cu,45:[gb,Cu],60:$A,61:gb,95:Cu,96:mb,126:mb},Mj={38:o1,92:l1},Dj={[-5]:Uh,[-4]:Uh,[-3]:Uh,33:oj,38:o1,42:wd,60:[cA,QA],91:cj,92:[BA,l1],93:em,95:wd,96:_A},Lj={null:[wd,Ej]},zj={null:[42,95]},Uj={null:[]},Bj=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:zj,contentInitial:Nj,disable:Uj,document:Tj,flow:Rj,flowInitial:Oj,insideSpan:Lj,string:Mj,text:Dj},Symbol.toStringTag,{value:"Module"}));function Pj(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={},u=[];let c=[],f=[];const d={attempt:Z(P),check:Z(D),consume:B,enter:I,exit:ee,interrupt:Z(D,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:S,parser:e,previous:null,sliceSerialize:x,sliceStream:v,write:g};let y=t.tokenize.call(m,d);return t.resolveAll&&u.push(t),m;function g(J){return c=dr(c,J),O(),c[c.length-1]!==null?[]:(F(t,0),m.events=Wu(u,m.events,m),m.events)}function x(J,G){return qj(v(J),G)}function v(J){return Hj(c,J)}function S(){const{_bufferIndex:J,_index:G,line:ce,column:ue,offset:re}=s;return{_bufferIndex:J,_index:G,line:ce,column:ue,offset:re}}function j(J){l[J.line]=J.column,L()}function O(){let J;for(;s._index<c.length;){const G=c[s._index];if(typeof G=="string")for(J=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===J&&s._bufferIndex<G.length;)M(G.charCodeAt(s._bufferIndex));else M(G)}}function M(J){y=y(J)}function B(J){$e(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,G){const ce=G||{};return ce.type=J,ce.start=S(),m.events.push(["enter",ce,m]),f.push(ce),ce}function ee(J){const G=f.pop();return G.end=S(),m.events.push(["exit",G,m]),G}function P(J,G){F(J,G.from)}function D(J,G){G.restore()}function Z(J,G){return ce;function ce(ue,re,q){let Y,ae,ve,N;return Array.isArray(ue)?W(ue):"tokenize"in ue?W([ue]):z(ue);function z(Se){return Me;function Me(Ve){const Ae=Ve!==null&&Se[Ve],ot=Ve!==null&&Se.null,kt=[...Array.isArray(Ae)?Ae:Ae?[Ae]:[],...Array.isArray(ot)?ot:ot?[ot]:[]];return W(kt)(Ve)}}function W(Se){return Y=Se,ae=0,Se.length===0?q:_(Se[ae])}function _(Se){return Me;function Me(Ve){return N=$(),ve=Se,Se.partial||(m.currentConstruct=Se),Se.name&&m.parser.constructs.disable.null.includes(Se.name)?je():Se.tokenize.call(G?Object.assign(Object.create(m),G):m,d,ye,je)(Ve)}}function ye(Se){return J(ve,N),re}function je(Se){return N.restore(),++ae<Y.length?_(Y[ae]):q}}}function F(J,G){J.resolveAll&&!u.includes(J)&&u.push(J),J.resolve&&Qn(m.events,G,m.events.length-G,J.resolve(m.events.slice(G),m)),J.resolveTo&&(m.events=J.resolveTo(m.events,m))}function $(){const J=S(),G=m.previous,ce=m.currentConstruct,ue=m.events.length,re=Array.from(f);return{from:ue,restore:q};function q(){s=J,m.previous=G,m.currentConstruct=ce,m.events.length=ue,f=re,L()}}function L(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function Hj(e,t){const r=t.start._index,s=t.start._bufferIndex,l=t.end._index,u=t.end._bufferIndex;let c;if(r===l)c=[e[r].slice(s,u)];else{if(c=e.slice(r,l),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}u>0&&c.push(e[l].slice(0,u))}return c}function qj(e,t){let r=-1;const s=[];let l;for(;++r<e.length;){const u=e[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
|
|
94
94
|
`;break}case-3:{c=`\r
|
|
95
|
-
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&l)continue;c=" ";break}default:c=String.fromCharCode(u)}l=u===-2,s.push(c)}return s.join("")}function IT(e){const s={constructs:i1([BT,...(e||{}).extensions||[]]),content:l(rA),defined:[],document:l(sA),flow:l(_T),lazy:{},string:l(CT),text:l(AT)};return s;function l(u){return c;function c(f){return PT(s,u,f)}}}function FT(e){for(;!u1(e););return e}const yb=/[\0\t\n\r]/g;function $T(){let e=1,t="",r=!0,s;return l;function l(u,c,f){const d=[];let m,y,g,x,v;for(u=t+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),g=0,t="",r&&(u.charCodeAt(0)===65279&&g++,r=void 0);g<u.length;){if(yb.lastIndex=g,m=yb.exec(u),x=m&&m.index!==void 0?m.index:u.length,v=u.charCodeAt(x),!m){t=u.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(u.slice(g,x)),e+=x-g),v){case 0:{d.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,d.push(-2);e++<y;)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 YT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function VT(e){return e.replace(YT,GT)}function GT(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return s1(r.slice(u?2:1),u?16:10)}return Wd(r)||e}const p1={}.hasOwnProperty;function JT(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),XT(r)(FT(IT(r).document().write($T()(e,t,!0))))}function XT(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Kn),autolinkProtocol:$,autolinkEmail:$,atxHeading:u(rt),blockQuote:u(ot),characterEscape:$,characterReference:$,codeFenced:u(jt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(jt,c),codeText:u(en,c),codeTextData:$,data:$,codeFlowValue:$,definition:u(Ht),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(Be),hardBreakEscape:u(Ve),hardBreakTrailing:u(Ve),htmlFlow:u(Et,c),htmlFlowData:$,htmlText:u(Et,c),htmlTextData:$,image:u(Rt),label:c,link:u(Kn),listItem:u(tn),listItemValue:x,listOrdered:u(Nt,g),listUnordered:u(Nt),paragraph:u(wn),reference:_,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(rt),strong:u(Rn),thematicBreak:u(Sn)},exit:{atxHeading:d(),atxHeadingSequence:P,autolink:d(),autolinkEmail:Ce,autolinkProtocol:Ye,blockQuote:d(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:Ae,characterReferenceMarkerNumeric:Ae,characterReferenceValue:_e,characterReference:Re,codeFenced:d(O),codeFencedFence:T,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:L,codeIndented:d(M),codeText:d(re),codeTextData:L,data:L,definition:d(),definitionDestinationString:ee,definitionLabelString:B,definitionTitleString:I,emphasis:d(),hardBreakEscape:d(G),hardBreakTrailing:d(G),htmlFlow:d(ue),htmlFlowData:L,htmlText:d(oe),htmlTextData:L,image:d(Y),label:ve,labelText:ae,lineEnding:J,link:d(q),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ye,resourceDestinationString:N,resourceTitleString:z,resource:W,setextHeading:d(F),setextHeadingLineSequence:Z,setextHeadingText:D,strong:d(),thematicBreak:d()}};g1(t,(e||{}).mdastExtensions||[]);const r={};return s;function s(ce){let ke={type:"root",children:[]};const be={stack:[ke],tokenStack:[],config:t,enter:f,exit:m,buffer:c,resume:y,data:r},we=[];let Ne=-1;for(;++Ne<ce.length;)if(ce[Ne][1].type==="listOrdered"||ce[Ne][1].type==="listUnordered")if(ce[Ne][0]==="enter")we.push(Ne);else{const Ge=we.pop();Ne=l(ce,Ge,Ne)}for(Ne=-1;++Ne<ce.length;){const Ge=t[ce[Ne][0]];p1.call(Ge,ce[Ne][1].type)&&Ge[ce[Ne][1].type].call(Object.assign({sliceSerialize:ce[Ne][2].sliceSerialize},be),ce[Ne][1])}if(be.tokenStack.length>0){const Ge=be.tokenStack[be.tokenStack.length-1];(Ge[1]||bb).call(be,void 0,Ge[0])}for(ke.position={start:Di(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:Di(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},Ne=-1;++Ne<t.transforms.length;)ke=t.transforms[Ne](ke)||ke;return ke}function l(ce,ke,be){let we=ke-1,Ne=-1,Ge=!1,Ze,ct,Ie,qe;for(;++we<=be;){const Pe=ce[we];switch(Pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Pe[0]==="enter"?Ne++:Ne--,qe=void 0;break}case"lineEndingBlank":{Pe[0]==="enter"&&(Ze&&!qe&&!Ne&&!Ie&&(Ie=we),qe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:qe=void 0}if(!Ne&&Pe[0]==="enter"&&Pe[1].type==="listItemPrefix"||Ne===-1&&Pe[0]==="exit"&&(Pe[1].type==="listUnordered"||Pe[1].type==="listOrdered")){if(Ze){let de=we;for(ct=void 0;de--;){const Me=ce[de];if(Me[1].type==="lineEnding"||Me[1].type==="lineEndingBlank"){if(Me[0]==="exit")continue;ct&&(ce[ct][1].type="lineEndingBlank",Ge=!0),Me[1].type="lineEnding",ct=de}else if(!(Me[1].type==="linePrefix"||Me[1].type==="blockQuotePrefix"||Me[1].type==="blockQuotePrefixWhitespace"||Me[1].type==="blockQuoteMarker"||Me[1].type==="listItemIndent"))break}Ie&&(!ct||Ie<ct)&&(Ze._spread=!0),Ze.end=Object.assign({},ct?ce[ct][1].start:Pe[1].end),ce.splice(ct||we,0,["exit",Ze,Pe[2]]),we++,be++}if(Pe[1].type==="listItemPrefix"){const de={type:"listItem",_spread:!1,start:Object.assign({},Pe[1].start),end:void 0};Ze=de,ce.splice(we,0,["enter",de,Pe[2]]),we++,be++,Ie=void 0,qe=!0}}}return ce[ke][1]._spread=Ge,be}function u(ce,ke){return be;function be(we){f.call(this,ce(we),we),ke&&ke.call(this,we)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ce,ke,be){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([ke,be||void 0]),ce.position={start:Di(ke.start),end:void 0}}function d(ce){return ke;function ke(be){ce&&ce.call(this,be),m.call(this,be)}}function m(ce,ke){const be=this.stack.pop(),we=this.tokenStack.pop();if(we)we[0].type!==ce.type&&(ke?ke.call(this,ce,we[0]):(we[1]||bb).call(this,ce,we[0]));else throw new Error("Cannot close `"+ce.type+"` ("+Rl({start:ce.start,end:ce.end})+"): it’s not open");be.position.end=Di(ce.end)}function y(){return Zd(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(ce){if(this.data.expectingFirstListItemValue){const ke=this.stack[this.stack.length-2];ke.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ce=this.resume(),ke=this.stack[this.stack.length-1];ke.lang=ce}function S(){const ce=this.resume(),ke=this.stack[this.stack.length-1];ke.meta=ce}function T(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function O(){const ce=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const ce=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ce.replace(/(\r?\n|\r)$/g,"")}function B(ce){const ke=this.resume(),be=this.stack[this.stack.length-1];be.label=ke,be.identifier=wr(this.sliceSerialize(ce)).toLowerCase()}function I(){const ce=this.resume(),ke=this.stack[this.stack.length-1];ke.title=ce}function ee(){const ce=this.resume(),ke=this.stack[this.stack.length-1];ke.url=ce}function P(ce){const ke=this.stack[this.stack.length-1];if(!ke.depth){const be=this.sliceSerialize(ce).length;ke.depth=be}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function Z(ce){const ke=this.stack[this.stack.length-1];ke.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function $(ce){const be=this.stack[this.stack.length-1].children;let we=be[be.length-1];(!we||we.type!=="text")&&(we=mt(),we.position={start:Di(ce.start),end:void 0},be.push(we)),this.stack.push(we)}function L(ce){const ke=this.stack.pop();ke.value+=this.sliceSerialize(ce),ke.position.end=Di(ce.end)}function J(ce){const ke=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=ke.children[ke.children.length-1];be.position.end=Di(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ke.type)&&($.call(this,ce),L.call(this,ce))}function G(){this.data.atHardBreak=!0}function ue(){const ce=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ce}function oe(){const ce=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ce}function re(){const ce=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ce}function q(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=ke,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function Y(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=ke,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function ae(ce){const ke=this.sliceSerialize(ce),be=this.stack[this.stack.length-2];be.label=VT(ke),be.identifier=wr(ke).toLowerCase()}function ve(){const ce=this.stack[this.stack.length-1],ke=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const we=ce.children;be.children=we}else be.alt=ke}function N(){const ce=this.resume(),ke=this.stack[this.stack.length-1];ke.url=ce}function z(){const ce=this.resume(),ke=this.stack[this.stack.length-1];ke.title=ce}function W(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function ye(ce){const ke=this.resume(),be=this.stack[this.stack.length-1];be.label=ke,be.identifier=wr(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function Ae(ce){this.data.characterReferenceType=ce.type}function _e(ce){const ke=this.sliceSerialize(ce),be=this.data.characterReferenceType;let we;be?(we=s1(ke,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):we=Wd(ke);const Ne=this.stack[this.stack.length-1];Ne.value+=we}function Re(ce){const ke=this.stack.pop();ke.position.end=Di(ce.end)}function Ye(ce){L.call(this,ce);const ke=this.stack[this.stack.length-1];ke.url=this.sliceSerialize(ce)}function Ce(ce){L.call(this,ce);const ke=this.stack[this.stack.length-1];ke.url="mailto:"+this.sliceSerialize(ce)}function ot(){return{type:"blockquote",children:[]}}function jt(){return{type:"code",lang:null,meta:null,value:""}}function en(){return{type:"inlineCode",value:""}}function Ht(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Be(){return{type:"emphasis",children:[]}}function rt(){return{type:"heading",depth:0,children:[]}}function Ve(){return{type:"break"}}function Et(){return{type:"html",value:""}}function Rt(){return{type:"image",title:null,url:"",alt:null}}function Kn(){return{type:"link",title:null,url:"",children:[]}}function Nt(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function tn(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function wn(){return{type:"paragraph",children:[]}}function Rn(){return{type:"strong",children:[]}}function mt(){return{type:"text",value:""}}function Sn(){return{type:"thematicBreak"}}}function Di(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):KT(e,s)}}function KT(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 bb(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Rl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Rl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Rl({start:t.start,end:t.end})+") is still open")}function QT(e){const t=this;t.parser=r;function r(s){return JT(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function ZT(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 WT(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
96
|
-
`}]}function
|
|
97
|
-
`:"",s={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(s.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return t.meta&&(u.data={meta:t.meta}),e.patch(t,u),u=e.applyData(t,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(t,u),u}function
|
|
95
|
+
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&l)continue;c=" ";break}default:c=String.fromCharCode(u)}l=u===-2,s.push(c)}return s.join("")}function Ij(e){const s={constructs:i1([Bj,...(e||{}).extensions||[]]),content:l(rA),defined:[],document:l(sA),flow:l(_j),lazy:{},string:l(Cj),text:l(Aj)};return s;function l(u){return c;function c(f){return Pj(s,u,f)}}}function Fj(e){for(;!u1(e););return e}const yb=/[\0\t\n\r]/g;function $j(){let e=1,t="",r=!0,s;return l;function l(u,c,f){const d=[];let m,y,g,x,v;for(u=t+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),g=0,t="",r&&(u.charCodeAt(0)===65279&&g++,r=void 0);g<u.length;){if(yb.lastIndex=g,m=yb.exec(u),x=m&&m.index!==void 0?m.index:u.length,v=u.charCodeAt(x),!m){t=u.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(u.slice(g,x)),e+=x-g),v){case 0:{d.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,d.push(-2);e++<y;)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 Yj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Vj(e){return e.replace(Yj,Gj)}function Gj(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return s1(r.slice(u?2:1),u?16:10)}return Wd(r)||e}const p1={}.hasOwnProperty;function Jj(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),Xj(r)(Fj(Ij(r).document().write($j()(e,t,!0))))}function Xj(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(zn),autolinkProtocol:$,autolinkEmail:$,atxHeading:u(et),blockQuote:u(ot),characterEscape:$,characterReference:$,codeFenced:u(kt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(kt,c),codeText:u(an,c),codeTextData:$,data:$,codeFlowValue:$,definition:u(Lt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(Ie),hardBreakEscape:u(qe),hardBreakTrailing:u(qe),htmlFlow:u(jt,c),htmlFlowData:$,htmlText:u(jt,c),htmlTextData:$,image:u(gt),label:c,link:u(zn),listItem:u(nn),listItemValue:x,listOrdered:u(qt,g),listUnordered:u(qt),paragraph:u(pn),reference:_,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(et),strong:u(Un),thematicBreak:u(Xt)},exit:{atxHeading:d(),atxHeadingSequence:P,autolink:d(),autolinkEmail:Ae,autolinkProtocol:Ve,blockQuote:d(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:je,characterReferenceMarkerNumeric:je,characterReferenceValue:Se,characterReference:Me,codeFenced:d(O),codeFencedFence:j,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:L,codeIndented:d(M),codeText:d(re),codeTextData:L,data:L,definition:d(),definitionDestinationString:ee,definitionLabelString:B,definitionTitleString:I,emphasis:d(),hardBreakEscape:d(G),hardBreakTrailing:d(G),htmlFlow:d(ce),htmlFlowData:L,htmlText:d(ue),htmlTextData:L,image:d(Y),label:ve,labelText:ae,lineEnding:J,link:d(q),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ye,resourceDestinationString:N,resourceTitleString:z,resource:W,setextHeading:d(F),setextHeadingLineSequence:Z,setextHeadingText:D,strong:d(),thematicBreak:d()}};g1(t,(e||{}).mdastExtensions||[]);const r={};return s;function s(fe){let _e={type:"root",children:[]};const Pe={stack:[_e],tokenStack:[],config:t,enter:f,exit:m,buffer:c,resume:y,data:r},Je=[];let it=-1;for(;++it<fe.length;)if(fe[it][1].type==="listOrdered"||fe[it][1].type==="listUnordered")if(fe[it][0]==="enter")Je.push(it);else{const Kt=Je.pop();it=l(fe,Kt,it)}for(it=-1;++it<fe.length;){const Kt=t[fe[it][0]];p1.call(Kt,fe[it][1].type)&&Kt[fe[it][1].type].call(Object.assign({sliceSerialize:fe[it][2].sliceSerialize},Pe),fe[it][1])}if(Pe.tokenStack.length>0){const Kt=Pe.tokenStack[Pe.tokenStack.length-1];(Kt[1]||bb).call(Pe,void 0,Kt[0])}for(_e.position={start:Bi(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:Bi(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},it=-1;++it<t.transforms.length;)_e=t.transforms[it](_e)||_e;return _e}function l(fe,_e,Pe){let Je=_e-1,it=-1,Kt=!1,cn,xe,ke,Be;for(;++Je<=Pe;){const Oe=fe[Je];switch(Oe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Oe[0]==="enter"?it++:it--,Be=void 0;break}case"lineEndingBlank":{Oe[0]==="enter"&&(cn&&!Be&&!it&&!ke&&(ke=Je),Be=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Be=void 0}if(!it&&Oe[0]==="enter"&&Oe[1].type==="listItemPrefix"||it===-1&&Oe[0]==="exit"&&(Oe[1].type==="listUnordered"||Oe[1].type==="listOrdered")){if(cn){let oe=Je;for(xe=void 0;oe--;){const Re=fe[oe];if(Re[1].type==="lineEnding"||Re[1].type==="lineEndingBlank"){if(Re[0]==="exit")continue;xe&&(fe[xe][1].type="lineEndingBlank",Kt=!0),Re[1].type="lineEnding",xe=oe}else if(!(Re[1].type==="linePrefix"||Re[1].type==="blockQuotePrefix"||Re[1].type==="blockQuotePrefixWhitespace"||Re[1].type==="blockQuoteMarker"||Re[1].type==="listItemIndent"))break}ke&&(!xe||ke<xe)&&(cn._spread=!0),cn.end=Object.assign({},xe?fe[xe][1].start:Oe[1].end),fe.splice(xe||Je,0,["exit",cn,Oe[2]]),Je++,Pe++}if(Oe[1].type==="listItemPrefix"){const oe={type:"listItem",_spread:!1,start:Object.assign({},Oe[1].start),end:void 0};cn=oe,fe.splice(Je,0,["enter",oe,Oe[2]]),Je++,Pe++,ke=void 0,Be=!0}}}return fe[_e][1]._spread=Kt,Pe}function u(fe,_e){return Pe;function Pe(Je){f.call(this,fe(Je),Je),_e&&_e.call(this,Je)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(fe,_e,Pe){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([_e,Pe||void 0]),fe.position={start:Bi(_e.start),end:void 0}}function d(fe){return _e;function _e(Pe){fe&&fe.call(this,Pe),m.call(this,Pe)}}function m(fe,_e){const Pe=this.stack.pop(),Je=this.tokenStack.pop();if(Je)Je[0].type!==fe.type&&(_e?_e.call(this,fe,Je[0]):(Je[1]||bb).call(this,fe,Je[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Rl({start:fe.start,end:fe.end})+"): it’s not open");Pe.position.end=Bi(fe.end)}function y(){return Zd(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(fe){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function v(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=fe}function S(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=fe}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function O(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe.replace(/(\r?\n|\r)$/g,"")}function B(fe){const _e=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=_e,Pe.identifier=Er(this.sliceSerialize(fe)).toLowerCase()}function I(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.title=fe}function ee(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.url=fe}function P(fe){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Pe=this.sliceSerialize(fe).length;_e.depth=Pe}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function Z(fe){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function $(fe){const Pe=this.stack[this.stack.length-1].children;let Je=Pe[Pe.length-1];(!Je||Je.type!=="text")&&(Je=dt(),Je.position={start:Bi(fe.start),end:void 0},Pe.push(Je)),this.stack.push(Je)}function L(fe){const _e=this.stack.pop();_e.value+=this.sliceSerialize(fe),_e.position.end=Bi(fe.end)}function J(fe){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Pe=_e.children[_e.children.length-1];Pe.position.end=Bi(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(_e.type)&&($.call(this,fe),L.call(this,fe))}function G(){this.data.atHardBreak=!0}function ce(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe}function ue(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe}function re(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe}function q(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=_e,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function Y(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=_e,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function ae(fe){const _e=this.sliceSerialize(fe),Pe=this.stack[this.stack.length-2];Pe.label=Vj(_e),Pe.identifier=Er(_e).toLowerCase()}function ve(){const fe=this.stack[this.stack.length-1],_e=this.resume(),Pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Pe.type==="link"){const Je=fe.children;Pe.children=Je}else Pe.alt=_e}function N(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.url=fe}function z(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.title=fe}function W(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function ye(fe){const _e=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=_e,Pe.identifier=Er(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function je(fe){this.data.characterReferenceType=fe.type}function Se(fe){const _e=this.sliceSerialize(fe),Pe=this.data.characterReferenceType;let Je;Pe?(Je=s1(_e,Pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Je=Wd(_e);const it=this.stack[this.stack.length-1];it.value+=Je}function Me(fe){const _e=this.stack.pop();_e.position.end=Bi(fe.end)}function Ve(fe){L.call(this,fe);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(fe)}function Ae(fe){L.call(this,fe);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(fe)}function ot(){return{type:"blockquote",children:[]}}function kt(){return{type:"code",lang:null,meta:null,value:""}}function an(){return{type:"inlineCode",value:""}}function Lt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ie(){return{type:"emphasis",children:[]}}function et(){return{type:"heading",depth:0,children:[]}}function qe(){return{type:"break"}}function jt(){return{type:"html",value:""}}function gt(){return{type:"image",title:null,url:"",alt:null}}function zn(){return{type:"link",title:null,url:"",children:[]}}function qt(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function nn(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function pn(){return{type:"paragraph",children:[]}}function Un(){return{type:"strong",children:[]}}function dt(){return{type:"text",value:""}}function Xt(){return{type:"thematicBreak"}}}function Bi(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):Kj(e,s)}}function Kj(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 bb(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Rl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Rl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Rl({start:t.start,end:t.end})+") is still open")}function Qj(e){const t=this;t.parser=r;function r(s){return Jj(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Zj(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 Wj(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
96
|
+
`}]}function eT(e,t){const r=t.value?t.value+`
|
|
97
|
+
`:"",s={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(s.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return t.meta&&(u.data={meta:t.meta}),e.patch(t,u),u=e.applyData(t,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(t,u),u}function tT(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function nT(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function rT(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),l=Ea(s.toLowerCase()),u=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=u+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 iT(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 sT(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),u=l[0];u&&u.type==="text"?u.value="["+u.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 aT(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return y1(e,t);const l={src:Ea(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,u),e.applyData(t,u)}function lT(e,t){const r={src:Ea(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 oT(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 uT(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return y1(e,t);const l={href:Ea(s.url||"")};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,u),e.applyData(t,u)}function cT(e,t){const r={href:Ea(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 fT(e,t,r){const s=e.all(t),l=r?hT(r):b1(t),u={},c=[];if(typeof t.checked=="boolean"){const y=s[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(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:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const y=s[f];(l||f!==0||y.type!=="element"||y.tagName!=="p")&&c.push({type:"text",value:`
|
|
98
98
|
`}),y.type==="element"&&y.tagName==="p"&&!l?c.push(...y.children):c.push(y)}const d=s[s.length-1];d&&(l||d.type!=="element"||d.tagName!=="p")&&c.push({type:"text",value:`
|
|
99
|
-
`});const m={type:"element",tagName:"li",properties:u,children:c};return e.patch(t,m),e.applyData(t,m)}function
|
|
99
|
+
`});const m={type:"element",tagName:"li",properties:u,children:c};return e.patch(t,m),e.applyData(t,m)}function hT(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 dT(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 u={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(t,u),e.applyData(t,u)}function mT(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function pT(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function gT(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function yT(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=Jd(t.children[1]),d=Qx(t.children[t.children.length-1]);f&&d&&(c.position={start:f,end:d}),l.push(c)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,u),e.applyData(t,u)}function bT(e,t,r){const s=r?r.children:void 0,u=(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:u,properties:x,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),m.push(S)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,y),e.applyData(t,y)}function xT(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const xb=9,vb=32;function vT(e){const t=String(e),r=/\r?\n|\r/g;let s=r.exec(t),l=0;const u=[];for(;s;)u.push(wb(t.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=r.exec(t);return u.push(wb(t.slice(l),l>0,!1)),u.join("")}function wb(e,t,r){let s=0,l=e.length;if(t){let u=e.codePointAt(s);for(;u===xb||u===vb;)s++,u=e.codePointAt(s)}if(r){let u=e.codePointAt(l-1);for(;u===xb||u===vb;)l--,u=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function wT(e,t){const r={type:"text",value:vT(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function ST(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const _T={blockquote:Zj,break:Wj,code:eT,delete:tT,emphasis:nT,footnoteReference:rT,heading:iT,html:sT,imageReference:aT,image:lT,inlineCode:oT,linkReference:uT,link:cT,listItem:fT,list:dT,paragraph:mT,root:pT,strong:gT,table:yT,tableCell:xT,tableRow:bT,text:wT,thematicBreak:ST,toml:gu,yaml:gu,definition:gu,footnoteDefinition:gu};function gu(){}const x1=-1,ec=0,Dl=1,Hu=2,tm=3,nm=4,rm=5,im=6,v1=7,w1=8,Sb=typeof self=="object"?self:globalThis,kT=(e,t)=>{const r=(l,u)=>(e.set(u,l),l),s=l=>{if(e.has(l))return e.get(l);const[u,c]=t[l];switch(u){case ec:case x1:return r(c,l);case Dl:{const f=r([],l);for(const d of c)f.push(s(d));return f}case Hu:{const f=r({},l);for(const[d,m]of c)f[s(d)]=s(m);return f}case tm:return r(new Date(c),l);case nm:{const{source:f,flags:d}=c;return r(new RegExp(f,d),l)}case rm:{const f=r(new Map,l);for(const[d,m]of c)f.set(s(d),s(m));return f}case im:{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 Sb[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 Sb[u](c),l)};return s},_b=e=>kT(new Map,e)(0),ra="",{toString:ET}={},{keys:CT}=Object,_l=e=>{const t=typeof e;if(t!=="object"||!e)return[ec,t];const r=ET.call(e).slice(8,-1);switch(r){case"Array":return[Dl,ra];case"Object":return[Hu,ra];case"Date":return[tm,ra];case"RegExp":return[nm,ra];case"Map":return[rm,ra];case"Set":return[im,ra];case"DataView":return[Dl,r]}return r.includes("Array")?[Dl,r]:r.includes("Error")?[v1,r]:[Hu,r]},yu=([e,t])=>e===ec&&(t==="function"||t==="symbol"),AT=(e,t,r,s)=>{const l=(c,f)=>{const d=s.push(c)-1;return r.set(f,d),d},u=c=>{if(r.has(c))return r.get(c);let[f,d]=_l(c);switch(f){case ec:{let y=c;switch(d){case"bigint":f=w1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);y=null;break;case"undefined":return l([x1],c)}return l([f,y],c)}case Dl:{if(d){let x=c;return d==="DataView"?x=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(c)),l([d,[...x]],c)}const y=[],g=l([f,y],c);for(const x of c)y.push(u(x));return g}case Hu:{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 u(c.toJSON());const y=[],g=l([f,y],c);for(const x of CT(c))(e||!yu(_l(c[x])))&&y.push([u(x),u(c[x])]);return g}case tm:return l([f,c.toISOString()],c);case nm:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case rm:{const y=[],g=l([f,y],c);for(const[x,v]of c)(e||!(yu(_l(x))||yu(_l(v))))&&y.push([u(x),u(v)]);return g}case im:{const y=[],g=l([f,y],c);for(const x of c)(e||!yu(_l(x)))&&y.push(u(x));return g}}const{message:m}=c;return l([f,{name:d,message:m}],c)};return u},kb=(e,{json:t,lossy:r}={})=>{const s=[];return AT(!(t||r),!!t,new Map,s)(e),s},qu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?_b(kb(e,t)):structuredClone(e):(e,t)=>_b(kb(e,t));function jT(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 TT(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function NT(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||jT,s=e.options.footnoteBackLabel||TT,l=e.options.footnoteLabel||"Footnotes",u=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 y=e.all(m),g=String(m.identifier).toUpperCase(),x=Ea(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 B=typeof r=="string"?r:r(d,v);typeof B=="string"&&(B={type:"text",value:B}),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(B)?B:[B]})}const O=y[y.length-1];if(O&&O.type==="element"&&O.tagName==="p"){const B=O.children[O.children.length-1];B&&B.type==="text"?B.value+=" ":O.children.push({type:"text",value:" "}),O.children.push(...S)}else y.push(...S);const M={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(y,!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:u,properties:{...qu(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
100
100
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
101
|
-
`}]}}const tc=(function(e){if(e==null)return
|
|
101
|
+
`}]}}const tc=(function(e){if(e==null)return DT;if(typeof e=="function")return nc(e);if(typeof e=="object")return Array.isArray(e)?OT(e):RT(e);if(typeof e=="string")return MT(e);throw new Error("Expected function, string, or object as test")});function OT(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=tc(e[r]);return nc(s);function s(...l){let u=-1;for(;++u<t.length;)if(t[u].apply(this,l))return!0;return!1}}function RT(e){const t=e;return nc(r);function r(s){const l=s;let u;for(u in e)if(l[u]!==t[u])return!1;return!0}}function MT(e){return nc(t);function t(r){return r&&r.type===e}}function nc(e){return t;function t(r,s,l){return!!(LT(r)&&e.call(this,r,typeof s=="number"?s:void 0,l||void 0))}}function DT(){return!0}function LT(e){return e!==null&&typeof e=="object"&&"type"in e}const S1=[],zT=!0,Sd=!1,UT="skip";function _1(e,t,r,s){let l;typeof t=="function"&&typeof r!="function"?(s=r,r=t):l=t;const u=tc(l),c=s?-1:1;f(e,void 0,[])();function f(d,m,y){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,O;if((!t||u(d,m,y[y.length-1]||void 0))&&(v=BT(r(d,y)),v[0]===Sd))return v;if("children"in d&&d.children){const M=d;if(M.children&&v[0]!==UT)for(j=(s?M.children.length:-1)+c,O=y.concat(M);j>-1&&j<M.children.length;){const B=M.children[j];if(S=f(B,j,O)(),S[0]===Sd)return S;j=typeof S[1]=="number"?S[1]:j+c}}return v}}}function BT(e){return Array.isArray(e)?e:typeof e=="number"?[zT,e]:e==null?S1:[e]}function sm(e,t,r,s){let l,u,c;typeof t=="function"&&typeof r!="function"?(u=void 0,c=t,l=r):(u=t,c=r,l=s),_1(e,u,f,l);function f(d,m){const y=m[m.length-1],g=y?y.children.indexOf(d):void 0;return c(d,g,y)}}const _d={}.hasOwnProperty,PT={};function HT(e,t){const r=t||PT,s=new Map,l=new Map,u=new Map,c={..._T,...r.handlers},f={all:m,applyData:IT,definitionById:s,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:d,options:r,patch:qT,wrap:$T};return sm(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?s:l,x=String(y.identifier).toUpperCase();g.has(x)||g.set(x,y)}}),f;function d(y,g){const x=y.type,v=f.handlers[x];if(_d.call(f.handlers,x)&&v)return v(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in y){const{children:j,...O}=y,M=qu(O);return M.children=f.all(y),M}return qu(y)}return(f.options.unknownHandler||FT)(f,y,g)}function m(y){const g=[];if("children"in y){const x=y.children;let v=-1;for(;++v<x.length;){const S=f.one(x[v],y);if(S){if(v&&x[v-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=Eb(S.value)),!Array.isArray(S)&&S.type==="element")){const j=S.children[0];j&&j.type==="text"&&(j.value=Eb(j.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function qT(e,t){e.position&&(t.position=TC(e))}function IT(e,t){let r=t;if(e&&e.data){const s=e.data.hName,l=e.data.hChildren,u=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"&&u&&Object.assign(r.properties,qu(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function FT(e,t){const r=t.data||{},s="value"in t&&!(_d.call(r,"hProperties")||_d.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 $T(e,t){const r=[];let s=-1;for(t&&r.push({type:"text",value:`
|
|
102
102
|
`});++s<e.length;)s&&r.push({type:"text",value:`
|
|
103
103
|
`}),r.push(e[s]);return t&&e.length>0&&r.push({type:"text",value:`
|
|
104
|
-
`}),r}function Eb(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Cb(e,t){const r=
|
|
105
|
-
`},l),u}function Yj(e,t){return e&&"run"in e?async function(r,s){const l=Cb(r,{file:s,...t});await e.run(l,s)}:function(r,s){return Cb(r,{file:s,...e||t})}}function Ab(e){if(e)throw e}var Bh,Tb;function Vj(){if(Tb)return Bh;Tb=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]"},u=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var y=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!y&&!g)return!1;var x;for(x in m);return typeof x>"u"||e.call(m,x)},c=function(m,y){r&&y.name==="__proto__"?r(m,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):m[y.name]=y.newValue},f=function(m,y){if(y==="__proto__")if(e.call(m,y)){if(s)return s(m,y).value}else return;return m[y]};return Bh=function d(){var m,y,g,x,v,S,T=arguments[0],O=1,M=arguments.length,B=!1;for(typeof T=="boolean"&&(B=T,T=arguments[1]||{},O=2),(T==null||typeof T!="object"&&typeof T!="function")&&(T={});O<M;++O)if(m=arguments[O],m!=null)for(y in m)g=f(T,y),x=f(m,y),T!==x&&(B&&x&&(u(x)||(v=l(x)))?(v?(v=!1,S=g&&l(g)?g:[]):S=g&&u(g)?g:{},c(T,{name:y,newValue:d(B,S,x)})):typeof x<"u"&&c(T,{name:y,newValue:x}));return T},Bh}var Gj=Vj();const Ph=Vb(Gj);function kd(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 Jj(){const e=[],t={run:r,use:s};return t;function r(...l){let u=-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 y=e[++u];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,y?Xj(y,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 Xj(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 y=m;if(f&&r)throw y;return l(y)}f||(d&&d.then&&typeof d.then=="function"?d.then(u,l):d instanceof Error?l(d):u(d))}function l(c,...f){r||(r=!0,t(c,...f))}function u(c){l(null,c)}}const jr={basename:Kj,dirname:Qj,extname:Zj,join:Wj,sep:"/"};function Kj(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Xl(e);let r=0,s=-1,l=e.length,u;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else s<0&&(u=!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(u){r=l+1;break}}else c<0&&(u=!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 Qj(e){if(Xl(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 Zj(e){Xl(e);let t=e.length,r=-1,s=0,l=-1,u=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:u!==1&&(u=1):l>-1&&(u=-1)}return l<0||r<0||u===0||u===1&&l===r-1&&l===s+1?"":e.slice(l,r)}function Wj(...e){let t=-1,r;for(;++t<e.length;)Xl(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":eN(r)}function eN(e){Xl(e);const t=e.codePointAt(0)===47;let r=tN(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function tN(e,t){let r="",s=0,l=-1,u=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||u===1))if(l!==c-1&&u===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,u=0;continue}}else if(r.length>0){r="",s=0,l=c,u=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,u=0}else f===46&&u>-1?u++:u=-1}return r}function Xl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const nN={cwd:rN};function rN(){return"/"}function Ed(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function iN(e){if(typeof e=="string")e=new URL(e);else if(!Ed(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 sN(e)}function sN(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 Hh=["history","path","basename","stem","extname","dirname"];class k1{constructor(t){let r;t?Ed(t)?r={path:t}:typeof t=="string"||aN(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":nN.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Hh.length;){const u=Hh[s];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let l;for(l in r)Hh.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?jr.basename(this.path):void 0}set basename(t){Ih(t,"basename"),qh(t,"basename"),this.path=jr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?jr.dirname(this.path):void 0}set dirname(t){jb(this.basename,"dirname"),this.path=jr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?jr.extname(this.path):void 0}set extname(t){if(qh(t,"extname"),jb(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=jr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ed(t)&&(t=iN(t)),Ih(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?jr.basename(this.path,this.extname):void 0}set stem(t){Ih(t,"stem"),qh(t,"stem"),this.path=jr.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 qh(e,t){if(e&&e.includes(jr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+jr.sep+"`")}function Ih(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function jb(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function aN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const lN=(function(e){const s=this.constructor.prototype,l=s[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),oN={}.hasOwnProperty;class am extends lN{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=Jj()}copy(){const t=new am;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];t.use(...s)}return t.data(Ph(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Yh("data",this.frozen),this.namespace[t]=r,this):oN.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Yh("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 Fh("parse",s),s(String(r),r)}process(t,r){const s=this;return this.freeze(),Fh("process",this.parser||this.Parser),$h("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=bu(t),d=s.parse(f);s.run(d,f,function(y,g,x){if(y||!g||!x)return m(y);const v=g,S=s.stringify(v,x);fN(S)?x.value=S:x.result=S,m(y,x)});function m(y,g){y||!g?c(y):u?u(g):r(void 0,g)}}}processSync(t){let r=!1,s;return this.freeze(),Fh("processSync",this.parser||this.Parser),$h("processSync",this.compiler||this.Compiler),this.process(t,l),Ob("processSync","process",r),s;function l(u,c){r=!0,Ab(u),s=c}}run(t,r,s){Nb(t),this.freeze();const l=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?u(void 0,s):new Promise(u);function u(c,f){const d=bu(r);l.run(t,d,m);function m(y,g,x){const v=g||t;y?f(y):c?c(v):s(void 0,v,x)}}}runSync(t,r){let s=!1,l;return this.run(t,r,u),Ob("runSync","run",s),l;function u(c,f){Ab(c),l=f,s=!0}}stringify(t,r){this.freeze();const s=bu(r),l=this.compiler||this.Compiler;return $h("stringify",l),Nb(t),l(t,s)}use(t,...r){const s=this.attachers,l=this.namespace;if(Yh("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 u(m){if(typeof m=="function")d(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[y,...g]=m;d(y,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=Ph(!0,l.settings,m.settings))}function f(m){let y=-1;if(m!=null)if(Array.isArray(m))for(;++y<m.length;){const g=m[y];u(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function d(m,y){let g=-1,x=-1;for(;++g<s.length;)if(s[g][0]===m){x=g;break}if(x===-1)s.push([m,...y]);else if(y.length>0){let[v,...S]=y;const T=s[x][1];kd(T)&&kd(v)&&(v=Ph(!0,T,v)),s[x]=[m,v,...S]}}}}const uN=new am().freeze();function Fh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $h(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yh(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 Nb(e){if(!kd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ob(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function bu(e){return cN(e)?e:new k1(e)}function cN(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function fN(e){return typeof e=="string"||hN(e)}function hN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dN="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Rb=[],Mb={allowDangerousHtml:!0},mN=/^(https?|ircs?|mailto|xmpp)$/i,pN=[{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 Db(e){const t=gN(e),r=yN(e);return bN(t.runSync(t.parse(r),r),e)}function gN(e){const t=e.rehypePlugins||Rb,r=e.remarkPlugins||Rb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Mb}:Mb;return uN().use(QT).use(r).use(Yj,s).use(t)}function yN(e){const t=e.children||"",r=new k1;return typeof t=="string"&&(r.value=t),r}function bN(e,t){const r=t.allowedElements,s=t.allowElement,l=t.components,u=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,d=t.urlTransform||xN;for(const y of pN)Object.hasOwn(t,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+dN+y.id,void 0);return sm(e,m),DC(e,{Fragment:b.Fragment,components:l,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0});function m(y,g,x){if(y.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let v;for(v in Lh)if(Object.hasOwn(Lh,v)&&Object.hasOwn(y.properties,v)){const S=y.properties[v],T=Lh[v];(T===null||T.includes(y.tagName))&&(y.properties[v]=d(String(S||""),v,y))}}if(y.type==="element"){let v=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!v&&s&&typeof g=="number"&&(v=!s(y,g,x)),v&&x&&typeof g=="number")return f&&y.children?x.children.splice(g,1,...y.children):x.children.splice(g,1),g}}}function xN(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||mN.test(e.slice(0,t))?e:""}function Lb(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 vN(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function E1(e,t,r){const l=tc((r||{}).ignore||[]),u=wN(t);let c=-1;for(;++c<u.length;)_1(e,"text",f);function f(m,y){let g=-1,x;for(;++g<y.length;){const v=y[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,y)}function d(m,y){const g=y[y.length-1],x=u[c][0],v=u[c][1];let S=0;const O=g.children.indexOf(m);let M=!1,B=[];x.lastIndex=0;let I=x.exec(m.value);for(;I;){const ee=I.index,P={index:I.index,input:I.input,stack:[...y,m]};let D=v(...I,P);if(typeof D=="string"&&(D=D.length>0?{type:"text",value:D}:void 0),D===!1?x.lastIndex=ee+1:(S!==ee&&B.push({type:"text",value:m.value.slice(S,ee)}),Array.isArray(D)?B.push(...D):D&&B.push(D),S=ee+I[0].length,M=!0),!x.global)break;I=x.exec(m.value)}return M?(S<m.value.length&&B.push({type:"text",value:m.value.slice(S)}),g.children.splice(O,1,...B)):B=[m],O+B.length}}function wN(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([SN(l[0]),_N(l[1])])}return t}function SN(e){return typeof e=="string"?new RegExp(vN(e),"g"):e}function _N(e){return typeof e=="function"?e:function(){return e}}const Vh="phrasing",Gh=["autolink","link","image","label"];function kN(){return{transforms:[ON],enter:{literalAutolink:CN,literalAutolinkEmail:Jh,literalAutolinkHttp:Jh,literalAutolinkWww:Jh},exit:{literalAutolink:NN,literalAutolinkEmail:jN,literalAutolinkHttp:AN,literalAutolinkWww:TN}}}function EN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Vh,notInConstruct:Gh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Vh,notInConstruct:Gh},{character:":",before:"[ps]",after:"\\/",inConstruct:Vh,notInConstruct:Gh}]}}function CN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Jh(e){this.config.enter.autolinkProtocol.call(this,e)}function AN(e){this.config.exit.autolinkProtocol.call(this,e)}function TN(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 jN(e){this.config.exit.autolinkEmail.call(this,e)}function NN(e){this.exit(e)}function ON(e){E1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,RN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),MN]],{ignore:["link","linkReference"]})}function RN(e,t,r,s,l){let u="";if(!C1(l)||(/^w/i.test(t)&&(r=t+r,t="",u="http://"),!DN(r)))return!1;const c=LN(r+s);if(!c[0])return!1;const f={type:"link",title:null,url:u+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function MN(e,t,r,s){return!C1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function DN(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 LN(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=Lb(e,"(");let u=Lb(e,")");for(;s!==-1&&l>u;)e+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),u++;return[e,r]}function C1(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||gs(r)||Zu(r))&&(!t||r!==47)}A1.peek=$N;function zN(){this.buffer()}function UN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function BN(){this.buffer()}function PN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function HN(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=wr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function qN(e){this.exit(e)}function IN(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=wr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function FN(e){this.exit(e)}function $N(){return"["}function A1(e,t,r,s){const l=r.createTracker(s);let u=l.move("[^");const c=r.enter("footnoteReference"),f=r.enter("reference");return u+=l.move(r.safe(r.associationId(e),{after:"]",before:u})),f(),c(),u+=l.move("]"),u}function YN(){return{enter:{gfmFootnoteCallString:zN,gfmFootnoteCall:UN,gfmFootnoteDefinitionLabelString:BN,gfmFootnoteDefinition:PN},exit:{gfmFootnoteCallString:HN,gfmFootnoteCall:qN,gfmFootnoteDefinitionLabelString:IN,gfmFootnoteDefinition:FN}}}function VN(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:A1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,l,u,c){const f=u.createTracker(c);let d=f.move("[^");const m=u.enter("footnoteDefinition"),y=u.enter("label");return d+=f.move(u.safe(u.associationId(s),{before:d,after:"]"})),y(),d+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),d+=f.move((t?`
|
|
106
|
-
`:" ")+u.indentLines(u.containerFlow(s,f.current()),t?
|
|
104
|
+
`}),r}function Eb(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Cb(e,t){const r=HT(e,t),s=r.one(e,void 0),l=NT(r),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
|
|
105
|
+
`},l),u}function YT(e,t){return e&&"run"in e?async function(r,s){const l=Cb(r,{file:s,...t});await e.run(l,s)}:function(r,s){return Cb(r,{file:s,...e||t})}}function Ab(e){if(e)throw e}var Bh,jb;function VT(){if(jb)return Bh;jb=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]"},u=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var y=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!y&&!g)return!1;var x;for(x in m);return typeof x>"u"||e.call(m,x)},c=function(m,y){r&&y.name==="__proto__"?r(m,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):m[y.name]=y.newValue},f=function(m,y){if(y==="__proto__")if(e.call(m,y)){if(s)return s(m,y).value}else return;return m[y]};return Bh=function d(){var m,y,g,x,v,S,j=arguments[0],O=1,M=arguments.length,B=!1;for(typeof j=="boolean"&&(B=j,j=arguments[1]||{},O=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});O<M;++O)if(m=arguments[O],m!=null)for(y in m)g=f(j,y),x=f(m,y),j!==x&&(B&&x&&(u(x)||(v=l(x)))?(v?(v=!1,S=g&&l(g)?g:[]):S=g&&u(g)?g:{},c(j,{name:y,newValue:d(B,S,x)})):typeof x<"u"&&c(j,{name:y,newValue:x}));return j},Bh}var GT=VT();const Ph=Vb(GT);function kd(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 JT(){const e=[],t={run:r,use:s};return t;function r(...l){let u=-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 y=e[++u];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,y?XT(y,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 XT(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 y=m;if(f&&r)throw y;return l(y)}f||(d&&d.then&&typeof d.then=="function"?d.then(u,l):d instanceof Error?l(d):u(d))}function l(c,...f){r||(r=!0,t(c,...f))}function u(c){l(null,c)}}const Mr={basename:KT,dirname:QT,extname:ZT,join:WT,sep:"/"};function KT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Xl(e);let r=0,s=-1,l=e.length,u;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else s<0&&(u=!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(u){r=l+1;break}}else c<0&&(u=!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 QT(e){if(Xl(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 ZT(e){Xl(e);let t=e.length,r=-1,s=0,l=-1,u=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:u!==1&&(u=1):l>-1&&(u=-1)}return l<0||r<0||u===0||u===1&&l===r-1&&l===s+1?"":e.slice(l,r)}function WT(...e){let t=-1,r;for(;++t<e.length;)Xl(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":eN(r)}function eN(e){Xl(e);const t=e.codePointAt(0)===47;let r=tN(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function tN(e,t){let r="",s=0,l=-1,u=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||u===1))if(l!==c-1&&u===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,u=0;continue}}else if(r.length>0){r="",s=0,l=c,u=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,u=0}else f===46&&u>-1?u++:u=-1}return r}function Xl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const nN={cwd:rN};function rN(){return"/"}function Ed(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function iN(e){if(typeof e=="string")e=new URL(e);else if(!Ed(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 sN(e)}function sN(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 Hh=["history","path","basename","stem","extname","dirname"];class k1{constructor(t){let r;t?Ed(t)?r={path:t}:typeof t=="string"||aN(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":nN.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Hh.length;){const u=Hh[s];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let l;for(l in r)Hh.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?Mr.basename(this.path):void 0}set basename(t){Ih(t,"basename"),qh(t,"basename"),this.path=Mr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Mr.dirname(this.path):void 0}set dirname(t){Tb(this.basename,"dirname"),this.path=Mr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Mr.extname(this.path):void 0}set extname(t){if(qh(t,"extname"),Tb(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=Mr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ed(t)&&(t=iN(t)),Ih(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Mr.basename(this.path,this.extname):void 0}set stem(t){Ih(t,"stem"),qh(t,"stem"),this.path=Mr.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 wn(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 qh(e,t){if(e&&e.includes(Mr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Mr.sep+"`")}function Ih(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Tb(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function aN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const lN=(function(e){const s=this.constructor.prototype,l=s[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),oN={}.hasOwnProperty;class am extends lN{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=JT()}copy(){const t=new am;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];t.use(...s)}return t.data(Ph(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Yh("data",this.frozen),this.namespace[t]=r,this):oN.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Yh("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 Fh("parse",s),s(String(r),r)}process(t,r){const s=this;return this.freeze(),Fh("process",this.parser||this.Parser),$h("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=bu(t),d=s.parse(f);s.run(d,f,function(y,g,x){if(y||!g||!x)return m(y);const v=g,S=s.stringify(v,x);fN(S)?x.value=S:x.result=S,m(y,x)});function m(y,g){y||!g?c(y):u?u(g):r(void 0,g)}}}processSync(t){let r=!1,s;return this.freeze(),Fh("processSync",this.parser||this.Parser),$h("processSync",this.compiler||this.Compiler),this.process(t,l),Ob("processSync","process",r),s;function l(u,c){r=!0,Ab(u),s=c}}run(t,r,s){Nb(t),this.freeze();const l=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?u(void 0,s):new Promise(u);function u(c,f){const d=bu(r);l.run(t,d,m);function m(y,g,x){const v=g||t;y?f(y):c?c(v):s(void 0,v,x)}}}runSync(t,r){let s=!1,l;return this.run(t,r,u),Ob("runSync","run",s),l;function u(c,f){Ab(c),l=f,s=!0}}stringify(t,r){this.freeze();const s=bu(r),l=this.compiler||this.Compiler;return $h("stringify",l),Nb(t),l(t,s)}use(t,...r){const s=this.attachers,l=this.namespace;if(Yh("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 u(m){if(typeof m=="function")d(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[y,...g]=m;d(y,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=Ph(!0,l.settings,m.settings))}function f(m){let y=-1;if(m!=null)if(Array.isArray(m))for(;++y<m.length;){const g=m[y];u(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function d(m,y){let g=-1,x=-1;for(;++g<s.length;)if(s[g][0]===m){x=g;break}if(x===-1)s.push([m,...y]);else if(y.length>0){let[v,...S]=y;const j=s[x][1];kd(j)&&kd(v)&&(v=Ph(!0,j,v)),s[x]=[m,v,...S]}}}}const uN=new am().freeze();function Fh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $h(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yh(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 Nb(e){if(!kd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ob(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function bu(e){return cN(e)?e:new k1(e)}function cN(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function fN(e){return typeof e=="string"||hN(e)}function hN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dN="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Rb=[],Mb={allowDangerousHtml:!0},mN=/^(https?|ircs?|mailto|xmpp)$/i,pN=[{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 Db(e){const t=gN(e),r=yN(e);return bN(t.runSync(t.parse(r),r),e)}function gN(e){const t=e.rehypePlugins||Rb,r=e.remarkPlugins||Rb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Mb}:Mb;return uN().use(Qj).use(r).use(YT,s).use(t)}function yN(e){const t=e.children||"",r=new k1;return typeof t=="string"&&(r.value=t),r}function bN(e,t){const r=t.allowedElements,s=t.allowElement,l=t.components,u=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,d=t.urlTransform||xN;for(const y of pN)Object.hasOwn(t,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+dN+y.id,void 0);return sm(e,m),DC(e,{Fragment:b.Fragment,components:l,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0});function m(y,g,x){if(y.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let v;for(v in Lh)if(Object.hasOwn(Lh,v)&&Object.hasOwn(y.properties,v)){const S=y.properties[v],j=Lh[v];(j===null||j.includes(y.tagName))&&(y.properties[v]=d(String(S||""),v,y))}}if(y.type==="element"){let v=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!v&&s&&typeof g=="number"&&(v=!s(y,g,x)),v&&x&&typeof g=="number")return f&&y.children?x.children.splice(g,1,...y.children):x.children.splice(g,1),g}}}function xN(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||mN.test(e.slice(0,t))?e:""}function Lb(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 vN(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function E1(e,t,r){const l=tc((r||{}).ignore||[]),u=wN(t);let c=-1;for(;++c<u.length;)_1(e,"text",f);function f(m,y){let g=-1,x;for(;++g<y.length;){const v=y[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,y)}function d(m,y){const g=y[y.length-1],x=u[c][0],v=u[c][1];let S=0;const O=g.children.indexOf(m);let M=!1,B=[];x.lastIndex=0;let I=x.exec(m.value);for(;I;){const ee=I.index,P={index:I.index,input:I.input,stack:[...y,m]};let D=v(...I,P);if(typeof D=="string"&&(D=D.length>0?{type:"text",value:D}:void 0),D===!1?x.lastIndex=ee+1:(S!==ee&&B.push({type:"text",value:m.value.slice(S,ee)}),Array.isArray(D)?B.push(...D):D&&B.push(D),S=ee+I[0].length,M=!0),!x.global)break;I=x.exec(m.value)}return M?(S<m.value.length&&B.push({type:"text",value:m.value.slice(S)}),g.children.splice(O,1,...B)):B=[m],O+B.length}}function wN(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([SN(l[0]),_N(l[1])])}return t}function SN(e){return typeof e=="string"?new RegExp(vN(e),"g"):e}function _N(e){return typeof e=="function"?e:function(){return e}}const Vh="phrasing",Gh=["autolink","link","image","label"];function kN(){return{transforms:[ON],enter:{literalAutolink:CN,literalAutolinkEmail:Jh,literalAutolinkHttp:Jh,literalAutolinkWww:Jh},exit:{literalAutolink:NN,literalAutolinkEmail:TN,literalAutolinkHttp:AN,literalAutolinkWww:jN}}}function EN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Vh,notInConstruct:Gh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Vh,notInConstruct:Gh},{character:":",before:"[ps]",after:"\\/",inConstruct:Vh,notInConstruct:Gh}]}}function CN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Jh(e){this.config.enter.autolinkProtocol.call(this,e)}function AN(e){this.config.exit.autolinkProtocol.call(this,e)}function jN(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 TN(e){this.config.exit.autolinkEmail.call(this,e)}function NN(e){this.exit(e)}function ON(e){E1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,RN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),MN]],{ignore:["link","linkReference"]})}function RN(e,t,r,s,l){let u="";if(!C1(l)||(/^w/i.test(t)&&(r=t+r,t="",u="http://"),!DN(r)))return!1;const c=LN(r+s);if(!c[0])return!1;const f={type:"link",title:null,url:u+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function MN(e,t,r,s){return!C1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function DN(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 LN(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=Lb(e,"(");let u=Lb(e,")");for(;s!==-1&&l>u;)e+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),u++;return[e,r]}function C1(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||bs(r)||Zu(r))&&(!t||r!==47)}A1.peek=$N;function zN(){this.buffer()}function UN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function BN(){this.buffer()}function PN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function HN(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Er(this.sliceSerialize(e)).toLowerCase(),r.label=t}function qN(e){this.exit(e)}function IN(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Er(this.sliceSerialize(e)).toLowerCase(),r.label=t}function FN(e){this.exit(e)}function $N(){return"["}function A1(e,t,r,s){const l=r.createTracker(s);let u=l.move("[^");const c=r.enter("footnoteReference"),f=r.enter("reference");return u+=l.move(r.safe(r.associationId(e),{after:"]",before:u})),f(),c(),u+=l.move("]"),u}function YN(){return{enter:{gfmFootnoteCallString:zN,gfmFootnoteCall:UN,gfmFootnoteDefinitionLabelString:BN,gfmFootnoteDefinition:PN},exit:{gfmFootnoteCallString:HN,gfmFootnoteCall:qN,gfmFootnoteDefinitionLabelString:IN,gfmFootnoteDefinition:FN}}}function VN(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:A1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,l,u,c){const f=u.createTracker(c);let d=f.move("[^");const m=u.enter("footnoteDefinition"),y=u.enter("label");return d+=f.move(u.safe(u.associationId(s),{before:d,after:"]"})),y(),d+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),d+=f.move((t?`
|
|
106
|
+
`:" ")+u.indentLines(u.containerFlow(s,f.current()),t?j1:GN))),m(),d}}function GN(e,t,r){return t===0?e:j1(e,t,r)}function j1(e,t,r){return(r?"":" ")+e}const JN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];T1.peek=WN;function XN(){return{canContainEols:["delete"],enter:{strikethrough:QN},exit:{strikethrough:ZN}}}function KN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:JN}],handlers:{delete:T1}}}function QN(e){this.enter({type:"delete",children:[]},e)}function ZN(e){this.exit(e)}function T1(e,t,r,s){const l=r.createTracker(s),u=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),u(),c}function WN(){return"~"}function e3(e){return e.length}function t3(e,t){const r=t||{},s=(r.align||[]).concat(),l=r.stringLength||e3,u=[],c=[],f=[],d=[];let m=0,y=-1;for(;++y<e.length;){const j=[],O=[];let M=-1;for(e[y].length>m&&(m=e[y].length);++M<e[y].length;){const B=n3(e[y][M]);if(r.alignDelimiters!==!1){const I=l(B);O[M]=I,(d[M]===void 0||I>d[M])&&(d[M]=I)}j.push(B)}c[y]=j,f[y]=O}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<m;)u[g]=zb(s[g]);else{const j=zb(s);for(;++g<m;)u[g]=j}g=-1;const x=[],v=[];for(;++g<m;){const j=u[g];let O="",M="";j===99?(O=":",M=":"):j===108?O=":":j===114&&(M=":");let B=r.alignDelimiters===!1?1:Math.max(1,d[g]-O.length-M.length);const I=O+"-".repeat(B)+M;r.alignDelimiters!==!1&&(B=O.length+B+M.length,B>d[g]&&(d[g]=B),v[g]=B),x[g]=I}c.splice(1,0,x),f.splice(1,0,v),y=-1;const S=[];for(;++y<c.length;){const j=c[y],O=f[y];g=-1;const M=[];for(;++g<m;){const B=j[g]||"";let I="",ee="";if(r.alignDelimiters!==!1){const P=d[g]-(O[g]||0),D=u[g];D===114?I=" ".repeat(P):D===99?P%2?(I=" ".repeat(P/2+.5),ee=" ".repeat(P/2-.5)):(I=" ".repeat(P/2),ee=I):ee=" ".repeat(P)}r.delimiterStart!==!1&&!g&&M.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&B==="")&&(r.delimiterStart!==!1||g)&&M.push(" "),r.alignDelimiters!==!1&&M.push(I),M.push(B),r.alignDelimiters!==!1&&M.push(ee),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(`
|
|
107
107
|
`)}function n3(e){return e==null?"":String(e)}function zb(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 r3(e,t,r,s){const l=r.enter("blockquote"),u=r.createTracker(s);u.move("> "),u.shift(2);const c=r.indentLines(r.containerFlow(e,u.current()),i3);return l(),c}function i3(e,t,r){return">"+(r?"":" ")+e}function s3(e,t){return Ub(e,t.inConstruct,!0)&&!Ub(e,t.notInConstruct,!1)}function Ub(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 Bb(e,t,r,s){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
|
|
108
108
|
`&&s3(r.stack,r.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
109
109
|
`}function a3(e,t){const r=String(e);let s=r.indexOf(t),l=s,u=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===l?++u>c&&(c=u):u=1,l=s+t.length,s=r.indexOf(t,l);return c}function l3(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 o3(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 u3(e,t,r,s){const l=o3(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(l3(e,r)){const g=r.enter("codeIndented"),x=r.indentLines(u,c3);return g(),x}const f=r.createTracker(s),d=l.repeat(Math.max(a3(u,l)+1,3)),m=r.enter("codeFenced");let y=f.move(d);if(e.lang){const g=r.enter(`codeFencedLang${c}`);y+=f.move(r.safe(e.lang,{before:y,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=r.enter(`codeFencedMeta${c}`);y+=f.move(" "),y+=f.move(r.safe(e.meta,{before:y,after:`
|
|
110
110
|
`,encode:["`"],...f.current()})),g()}return y+=f.move(`
|
|
111
111
|
`),u&&(y+=f.move(u+`
|
|
112
112
|
`)),y+=f.move(d),m(),y}function c3(e,t,r){return(r?"":" ")+e}function lm(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function f3(e,t,r,s){const l=lm(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const d=r.createTracker(s);let m=d.move("[");return m+=d.move(r.safe(r.associationId(e),{before:m,after:"]",...d.current()})),m+=d.move("]: "),f(),!e.url||/[\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?" ":`
|
|
113
|
-
`,...d.current()}))),f(),e.title&&(f=r.enter(`title${u}`),m+=d.move(" "+l),m+=d.move(r.safe(e.title,{before:m,after:l,...d.current()})),m+=d.move(l),f()),c(),m}function h3(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Il(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Iu(e,t,r){const s=
|
|
113
|
+
`,...d.current()}))),f(),e.title&&(f=r.enter(`title${u}`),m+=d.move(" "+l),m+=d.move(r.safe(e.title,{before:m,after:l,...d.current()})),m+=d.move(l),f()),c(),m}function h3(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Il(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Iu(e,t,r){const s=xa(e),l=xa(t);return s===void 0?l===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}N1.peek=d3;function N1(e,t,r,s){const l=h3(r),u=r.enter("emphasis"),c=r.createTracker(s),f=c.move(l);let d=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const m=d.charCodeAt(0),y=Iu(s.before.charCodeAt(s.before.length-1),m,l);y.inside&&(d=Il(m)+d.slice(1));const g=d.charCodeAt(d.length-1),x=Iu(s.after.charCodeAt(0),g,l);x.inside&&(d=d.slice(0,-1)+Il(g));const v=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+d+v}function d3(e,t,r){return r.options.emphasis||"*"}function m3(e,t){let r=!1;return sm(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,Sd}),!!((!e.depth||e.depth<3)&&Zd(e)&&(t.options.setext||r))}function p3(e,t,r,s){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(s);if(m3(e,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),x=r.containerPhrasing(e,{...u.current(),before:`
|
|
114
114
|
`,after:`
|
|
115
115
|
`});return g(),y(),x+`
|
|
116
116
|
`+(l===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
117
117
|
`))+1))}const c="#".repeat(l),f=r.enter("headingAtx"),d=r.enter("phrasing");u.move(c+" ");let m=r.containerPhrasing(e,{before:"# ",after:`
|
|
118
|
-
`,...u.current()});return/^[\t ]/.test(m)&&(m=Il(m.charCodeAt(0))+m.slice(1)),m=m?c+" "+m:c,r.options.closeAtx&&(m+=" "+c),d(),f(),m}O1.peek=g3;function O1(e){return e.value||""}function g3(){return"<"}R1.peek=y3;function R1(e,t,r,s){const l=lm(r),u=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${u}`),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 y3(){return"!"}M1.peek=b3;function M1(e,t,r,s){const l=e.referenceType,u=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 y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!m||m!==g?d+=f.move(g+"]"):l==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function b3(){return"!"}D1.peek=x3;function D1(e,t,r){let s=e.value||"",l="`",u=-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+" ");++u<r.unsafe.length;){const c=r.unsafe[u],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 x3(){return"`"}function L1(e,t){const r=Zd(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))}z1.peek=v3;function z1(e,t,r,s){const l=lm(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(s);let f,d;if(L1(e,r)){const y=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=y,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${u}`),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 v3(e,t,r){return L1(e,r)?"<":"["}U1.peek=w3;function U1(e,t,r,s){const l=e.referenceType,u=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 y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!m||m!==g?d+=f.move(g+"]"):l==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function w3(){return"["}function om(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 S3(e){const t=om(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 _3(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 B1(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 k3(e,t,r,s){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?_3(r):om(r);const f=e.ordered?c==="."?")":".":S3(r);let d=t&&r.bulletLastUsed?c===r.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&y&&(!y.children||!y.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),B1(r)===c&&y){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=u,l(),m}function E3(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 C3(e,t,r,s){const l=E3(r);let u=r.bulletCurrent||om(r);t&&t.type==="list"&&t.ordered&&(u=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+u);let c=u.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(u+" ".repeat(c-u.length)),f.shift(c);const d=r.enter("listItem"),m=r.indentLines(r.containerFlow(e,f.current()),y);return d(),m;function y(g,x,v){return x?(v?"":" ".repeat(c))+g:(v?u:u+" ".repeat(c-u.length))+g}}function A3(e,t,r,s){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,s);return u(),l(),c}const
|
|
119
|
-
`,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,
|
|
120
|
-
`))}function d(v,S,T,O){const M=T.enter("tableCell"),B=T.enter("phrasing"),I=T.containerPhrasing(v,{...O,before:u,after:u});return B(),M(),I}function m(v,S){return t3(v,{align:S,alignDelimiters:s,padding:r,stringLength:l})}function y(v,S,T){const O=v.children;let M=-1;const B=[],I=S.enter("table");for(;++M<O.length;)B[M]=g(O[M],S,T);return I(),B}function g(v,S,T){const O=v.children;let M=-1;const B=[],I=S.enter("tableRow");for(;++M<O.length;)B[M]=d(O[M],v,S,T);return I(),B}function x(v,S,T){let O=H1.inlineCode(v,S,T);return T.stack.includes("tableCell")&&(O=O.replace(/\|/g,"\\$&")),O}}function I3(){return{exit:{taskListCheckValueChecked:Hb,taskListCheckValueUnchecked:Hb,paragraph:$3}}}function F3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Y3}}}function Hb(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function $3(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 u=-1,c;for(;++u<l.length;){const f=l[u];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 Y3(e,t,r,s){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(s);u&&f.move(c);let d=H1.listItem(e,t,r,{...s,...f.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(y){return y+c}}function V3(){return[kN(),YN(),XN(),L3(),I3()]}function G3(e){return{extensions:[EN(),VN(e),KN(),q3(e),F3()]}}const J3={tokenize:eO,partial:!0},q1={tokenize:tO,partial:!0},I1={tokenize:nO,partial:!0},F1={tokenize:rO,partial:!0},X3={tokenize:iO,partial:!0},$1={name:"wwwAutolink",tokenize:Z3,previous:V1},Y1={name:"protocolAutolink",tokenize:W3,previous:G1},ai={name:"emailAutolink",tokenize:Q3,previous:J1},Dr={};function K3(){return{text:Dr}}let hs=48;for(;hs<123;)Dr[hs]=ai,hs++,hs===58?hs=65:hs===91&&(hs=97);Dr[43]=ai;Dr[45]=ai;Dr[46]=ai;Dr[95]=ai;Dr[72]=[ai,Y1];Dr[104]=[ai,Y1];Dr[87]=[ai,$1];Dr[119]=[ai,$1];function Q3(e,t,r){const s=this;let l,u;return c;function c(g){return!Cd(g)||!J1.call(s,s.previous)||um(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return Cd(g)?(e.consume(g),f):g===64?(e.consume(g),d):r(g)}function d(g){return g===46?e.check(X3,y,m)(g):g===45||g===95||dn(g)?(u=!0,e.consume(g),d):y(g)}function m(g){return e.consume(g),l=!0,d}function y(g){return u&&l&&xn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):r(g)}}function Z3(e,t,r){const s=this;return l;function l(c){return c!==87&&c!==119||!V1.call(s,s.previous)||um(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(J3,e.attempt(q1,e.attempt(I1,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function W3(e,t,r){const s=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&G1.call(s,s.previous)&&!um(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(xn(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),u?m:(u=!0,d)):r(g)}function m(g){return g===null||Pu(g)||Tt(g)||gs(g)||Zu(g)?r(g):e.attempt(q1,e.attempt(I1,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function eO(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),u):r(c)}function u(c){return c===null?r(c):t(c)}}function tO(e,t,r){let s,l,u;return c;function c(m){return m===46||m===95?e.check(F1,d,f)(m):m===null||Tt(m)||gs(m)||m!==45&&Zu(m)?d(m):(u=!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||!u?r(m):t(m)}}function nO(e,t){let r=0,s=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&s<r?u(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(F1,t,u)(c):c===null||Tt(c)||gs(c)?t(c):(e.consume(c),l)}function u(c){return c===41&&s++,e.consume(c),l}}function rO(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),u):f===93?(e.consume(f),l):f===60||f===null||Tt(f)||gs(f)?t(f):r(f)}function l(f){return f===null||f===40||f===91||Tt(f)||gs(f)?t(f):s(f)}function u(f){return xn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):xn(f)?(e.consume(f),c):r(f)}}function iO(e,t,r){return s;function s(u){return e.consume(u),l}function l(u){return dn(u)?r(u):t(u)}}function V1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function G1(e){return!xn(e)}function J1(e){return!(e===47||Cd(e))}function Cd(e){return e===43||e===45||e===46||e===95||dn(e)}function um(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 sO={tokenize:dO,partial:!0};function aO(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:cO,continuation:{tokenize:fO},exit:hO}},text:{91:{name:"gfmFootnoteCall",tokenize:uO},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:lO,resolveTo:oO}}}}function lO(e,t,r){const s=this;let l=s.events.length;const u=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=wr(s.sliceSerialize({start:c.end,end:s.now()}));return m.codePointAt(0)!==94||!u.includes(m.slice(1))?r(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function oO(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 u={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[r+1],e[r+2],["enter",s,t],e[r+3],e[r+4],["enter",l,t],["exit",l,t],["enter",u,t],["enter",c,t],["exit",c,t],["exit",u,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(r,e.length-r+1,...f),e}function uO(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u=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(u>999||g===93&&!c||g===null||g===91||Tt(g))return r(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return l.includes(wr(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(g)}return Tt(g)||(c=!0),u++,e.consume(g),g===92?y:m}function y(g){return g===91||g===92||g===93?(e.consume(g),u++,m):m(g)}}function cO(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,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",y):r(S)}function y(S){if(c>999||S===93&&!f||S===null||S===91||Tt(S))return r(S);if(S===93){e.exit("chunkString");const T=e.exit("gfmFootnoteDefinitionLabelString");return u=wr(s.sliceSerialize(T)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Tt(S)||(f=!0),c++,e.consume(S),S===92?g:y}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,y):y(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),l.includes(u)||l.push(u),ut(e,v,"gfmFootnoteDefinitionWhitespace")):r(S)}function v(S){return t(S)}}function fO(e,t,r){return e.check(Jl,t,e.attempt(sO,t,r))}function hO(e){e.exit("gfmFootnoteDefinition")}function dO(e,t,r){const s=this;return ut(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(u):r(u)}}function mO(e){let r=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,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 y={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",y,f],["enter",c[m][1],f],["exit",c[m][1],f],["enter",g,f]],v=f.parser.constructs.insideSpan.null;v&&Vn(x,x.length,0,Wu(v,c.slice(m+1,d),f)),Vn(x,x.length,0,[["exit",g,f],["enter",c[d][1],f],["exit",c[d][1],f],["exit",y,f]]),Vn(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 u(c,f,d){const m=this.previous,y=this.events;let g=0;return x;function x(S){return m===126&&y[y.length-1][1].type!=="characterEscape"?d(S):(c.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const T=ba(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=ba(S);return O._open=!M||M===2&&!!T,O._close=!T||T===2&&!!M,f(S)}}}class pO{constructor(){this.map=[]}add(t,r,s){gO(this,t,r,s)}consume(t){if(this.map.sort(function(u,c){return u[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 u of l)t.push(u);l=s.pop()}this.map.length=0}}function gO(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 yO(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 u=s.length-1;s[u]=s[u]==="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 bO(){return{flow:{null:{name:"table",tokenize:xO,resolveAll:vO}}}}function xO(e,t,r){const s=this;let l=0,u=0,c;return f;function f(L){let J=s.events.length-1;for(;J>-1;){const oe=s.events[J][1].type;if(oe==="lineEnding"||oe==="linePrefix")J--;else break}const G=J>-1?s.events[J][1].type:null,ue=G==="tableHead"||G==="tableRow"?D:d;return ue===D&&s.parser.lazy[s.now().line]?r(L):ue(L)}function d(L){return e.enter("tableHead"),e.enter("tableRow"),m(L)}function m(L){return L===124||(c=!0,u+=1),y(L)}function y(L){return L===null?r(L):Fe(L)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),v):r(L):nt(L)?ut(e,y,"whitespace")(L):(u+=1,c&&(c=!1,l+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(L)))}function g(L){return L===null||L===124||Tt(L)?(e.exit("data"),y(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,nt(L)?ut(e,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):S(L))}function S(L){return L===45||L===58?O(L):L===124?(c=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),T):P(L)}function T(L){return nt(L)?ut(e,O,"whitespace")(L):O(L)}function O(L){return L===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),M):L===45?(u+=1,M(L)):L===null||Fe(L)?ee(L):P(L)}function M(L){return L===45?(e.enter("tableDelimiterFiller"),B(L)):P(L)}function B(L){return L===45?(e.consume(L),B):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 nt(L)?ut(e,ee,"whitespace")(L):ee(L)}function ee(L){return L===124?S(L):L===null||Fe(L)?!c||l!==u?P(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):P(L)}function P(L){return r(L)}function D(L){return e.enter("tableRow"),Z(L)}function Z(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),Z):L===null||Fe(L)?(e.exit("tableRow"),t(L)):nt(L)?ut(e,Z,"whitespace")(L):(e.enter("data"),F(L))}function F(L){return L===null||L===124||Tt(L)?(e.exit("data"),Z(L)):(e.consume(L),L===92?$:F)}function $(L){return L===92||L===124?(e.consume(L),F):F(L)}}function vO(e,t){let r=-1,s=!0,l=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,d=0,m,y,g;const x=new pO;for(;++r<e.length;){const v=e[r],S=v[1];v[0]==="enter"?S.type==="tableHead"?(f=!1,d!==0&&(qb(x,t,d,m,y),y=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,u=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,y={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",y,t]])),l=S.type==="tableDelimiterRow"?2:y?3:1):l&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=xu(x,t,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):S.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(c[0]=c[1],g=xu(x,t,u,l,void 0,g)),u=c,c=[u[1],r,0,0])):S.type==="tableHead"?(f=!0,d=r):S.type==="tableRow"||S.type==="tableDelimiterRow"?(d=r,u[1]!==0?(c[0]=c[1],g=xu(x,t,u,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&&qb(x,t,d,m,y),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=yO(t.events,r))}return e}function xu(e,t,r,s,l,u){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},ia(t.events,r[0])),e.add(r[0],0,[["exit",u,t]]));const d=ia(t.events,r[1]);if(u={type:c,start:Object.assign({},d),end:Object.assign({},d)},e.add(r[1],0,[["enter",u,t]]),r[2]!==0){const m=ia(t.events,r[2]),y=ia(t.events,r[3]),g={type:f,start:Object.assign({},m),end:Object.assign({},y)};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,T=r[3]-r[2]-1;e.add(S,T,[])}}e.add(r[3]+1,0,[["exit",g,t]])}return l!==void 0&&(u.end=Object.assign({},ia(t.events,l)),e.add(l,0,[["exit",u,t]]),u=void 0),u}function qb(e,t,r,s,l){const u=[],c=ia(t.events,r);l&&(l.end=Object.assign({},c),u.push(["exit",l,t])),s.end=Object.assign({},c),u.push(["exit",s,t]),e.add(r+1,0,u)}function ia(e,t){const r=e[t],s=r[0]==="enter"?"start":"end";return r[1][s]}const wO={name:"tasklistCheck",tokenize:_O};function SO(){return{text:{91:wO}}}function _O(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"),u)}function u(d){return Tt(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):nt(d)?e.check({tokenize:kO},t,r)(d):r(d)}}function kO(e,t,r){return ut(e,s,"whitespace");function s(l){return l===null?r(l):t(l)}}function EO(e){return i1([K3(),aO(),mO(e),bO(),SO()])}const CO={};function Ib(e){const t=this,r=e||CO,s=t.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(EO(r)),u.push(V3()),c.push(G3(r))}function AO(e){E1(e,[/\r?\n|\r/g,TO])}function TO(){return{type:"break"}}function Fb(){return function(e){AO(e)}}function jO({connected:e,hostId:t,request:r,subscribeEvents:s,taskId:l,runId:u}){const c=Mr(),f=$d(),[d,m]=A.useState(!0),[y,g]=A.useState([]),[x,v]=A.useState(),[S,T]=A.useState(),[O,M]=A.useState(),B=x==="started",I=x==="followup",ee=x==="started"||x==="followup",[P,D]=A.useState(null);pd(P!==null,()=>D(null));const[Z,F]=A.useState(!1),[$,L]=A.useState(""),[J,G]=A.useState(!1),ue=A.useRef(null),oe=A.useRef(null),re=A.useRef(null),[q,Y]=A.useState(u==="latest"?void 0:u),ae=u==="latest"&&q===null;A.useEffect(()=>{if(u!=="latest"){Y(u);return}e&&(Y(void 0),r("taskrun.list",{task_id:l,limit:1}).then(_=>{var ye,Ae;return Y(((Ae=(ye=_.entries)==null?void 0:ye[0])==null?void 0:Ae.run_id)??null)}).catch(()=>Y(null)))},[u,l,e,r]);async function ve(){if(q)try{const _=await r("task.result",{id:l,run_id:q});if(_.error){console.error("No result:",_.error),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0});return}g(_.messages??[]),v(_.running_state),T(_.agent),M(_.agent_version)}catch(_){console.error("Failed to load result:",_),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0})}finally{m(!1)}}async function N(_){var ye;if(q)try{const _e=(ye=(await r("task.reports",{id:l,run_id:q,report_files:[_]})).reports)==null?void 0:ye[0];_e!=null&&_e.data_url?D({file:_,data_url:_e.data_url}):D({file:_,content:(_e==null?void 0:_e.content)??"Report not found."})}catch{D({file:_,content:"Failed to load report."})}}A.useEffect(()=>{!e||!q||(m(!0),ve())},[e,l,q]),A.useEffect(()=>!e||!t||!q?void 0:s(t,async ye=>{try{const Ae=JSON.parse(new TextDecoder().decode(ye.data));if(Ae.event_type!=="running-state"&&Ae.event_type!=="result-updated"||ye.subject.split(".").pop()!==l||Ae.event_type==="result-updated"&&Ae.run_id&&Ae.run_id!==q)return;ve()}catch{}}),[e,t,l,q,s,r]),A.useEffect(()=>{ue.current&&(ue.current.scrollTop=ue.current.scrollHeight)},[y]),A.useEffect(()=>{d||ae||!q||re.current!==q&&(re.current=q,requestAnimationFrame(()=>{ue.current&&(ue.current.scrollTop=ue.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"})}))},[d,ae,q]);function z(_){if(_==="input")return"User Input";if(_==="permission")return"Permission";if(_==="confirmation")return"Confirmation"}function W(_){return _==="started"?"Task started":_==="finished"?"Task finished":_==="failed"?"Task failed":_==="error"?"Command failed":_==="aborted"?"Task aborted":_==="confirmation"?"Task confirmed":_==="stopped"?"Follow-up stopped":_??""}return b.jsxs("div",{className:"run-detail",children:[b.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),ae?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No runs yet"}),b.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?b.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[b.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"chat-thread",ref:ue,children:[y.map((_,ye)=>{const Ae=ee&&_.role==="assistant"&&!y.slice(ye+1).some(_e=>_e.role==="assistant"||_e.role==="user");return _.role==="status"?b.jsxs("div",{className:`chat-status${_.type==="error"?" chat-status--error":""}`,children:[b.jsxs("div",{children:[W(_.type),_.time>0&&b.jsx("span",{className:"chat-status-time",children:f(_.time)})]}),_.content&&b.jsx("pre",{className:"chat-status-detail",children:_.content})]},ye):b.jsxs("div",{className:`chat-message chat-message--${_.role}${_.role==="assistant"&&_.stream==="stderr"?" chat-message--stderr":""}`,children:[_.role==="assistant"&&S&&b.jsxs("div",{className:"chat-message-agent",children:[md(S),O&&b.jsxs("span",{className:"chat-message-agent-version",children:[" v",O]})]}),b.jsxs("div",{className:"chat-message-content",children:[b.jsx(Db,{remarkPlugins:[Ib,Fb],components:{a:({..._e})=>b.jsx("a",{..._e,target:"_blank",rel:"noopener noreferrer"})},children:_.content}),Ae&&b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]}),_.attachments&&_.attachments.length>0&&b.jsx("div",{className:"chat-message-attachments",children:_.attachments.map(_e=>b.jsx("button",{className:"chat-attachment-chip",onClick:()=>N(_e),children:_e},_e))}),b.jsxs("div",{className:"chat-message-meta",children:[z(_.type)&&b.jsx("span",{className:"chat-message-type",children:z(_.type)}),_.time>0&&b.jsx("span",{children:f(_.time)})]})]},ye)}),ee&&(()=>{const _=y.filter(ye=>ye.role!=="status");return _.length===0||_[_.length-1].role!=="assistant"})()&&b.jsxs("div",{className:"chat-message chat-message--assistant",children:[S&&b.jsxs("div",{className:"chat-message-agent",children:[md(S),O&&b.jsxs("span",{className:"chat-message-agent-version",children:[" v",O]})]}),b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]})]}),B||I?b.jsx("div",{className:"chat-input-bar",children:b.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:Z,"aria-label":"Abort task",onClick:async()=>{if(confirm("Abort this task?")){F(!0);try{await r("task.abort",{id:l})}catch(_){console.error("Abort failed:",_)}finally{F(!1)}}},children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:b.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):b.jsxs("form",{className:"chat-input-bar",onSubmit:async _=>{_.preventDefault();const ye=$.trim();if(!(!ye||J)){G(!0);try{await r("task.followup",{id:l,run_id:q,message:ye}),L("")}catch(Ae){console.error("Follow-up failed:",Ae)}finally{G(!1)}}},children:[b.jsx("input",{ref:oe,className:"chat-input",type:"text",placeholder:"Follow-up message",value:$,onChange:_=>L(_.target.value),disabled:J}),b.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!$.trim()||J,children:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),b.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),b.jsxs("button",{className:"run-detail-back run-detail-back--footer",onClick:()=>c(-1),children:[b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]})]}),P&&b.jsx("div",{className:"report-dialog-overlay",onClick:()=>D(null),children:b.jsxs("div",{className:"report-dialog",onClick:_=>_.stopPropagation(),children:[b.jsxs("div",{className:"report-dialog-header",children:[b.jsx("span",{className:"report-dialog-title",children:P.file}),b.jsx("button",{className:"report-dialog-close",onClick:()=>D(null),"aria-label":"Close",children:b.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),b.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),b.jsx("div",{className:"report-dialog-body",children:P.data_url?b.jsx("img",{src:P.data_url,alt:P.file,style:{maxWidth:"100%",height:"auto"}}):b.jsx(Db,{remarkPlugins:[Ib,Fb],components:{a:({..._})=>b.jsx("a",{..._,target:"_blank",rel:"noopener noreferrer"})},children:P.content??""})})]})})]})}function $b({title:e,message:t,onUpdate:r,onDismiss:s}){return b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:e}),b.jsx("p",{className:"confirm-modal-message",children:t}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:r,children:"Update Now"}),s&&b.jsx("button",{className:"btn btn-secondary",onClick:s,children:"Dismiss"})]})]})})}function NO(){const{activeHost:e}=si(),t=A.useRef(null);A.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 u=await l.pushManager.getSubscription();if(!u){const{publicKey:f}=await yE("/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}u=await l.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:f})}const c=u.toJSON();await gE("/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 OO="0.9.9";function Kh(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 vu(){const{removePairedHost:e,setHostLanUrl:t,setHostTimezone:r}=qi(),{connected:s,request:l,subscribeEvents:u,unauthorized:c,activeHost:f}=si(),d=f.hostId,m=f.clientToken||null,y=Mr(),g=cr(),x=Yu(),v=Ix("(min-width: 768px)"),S=g.pathname.endsWith("/tasks"),T=x.runId?void 0:x.taskId,O=!!(x.taskId&&x.runId),[M,B]=A.useState(!1),[I,ee]=A.useState(!1),[P,D]=A.useState(null),[Z,F]=A.useState(null),[$,L]=A.useState(null),[J,G]=A.useState(()=>localStorage.getItem(`palmier.${d}.dismissedUpdateVersion`)),[ue,oe]=A.useState({}),[re,q]=A.useState({}),[Y,ae]=A.useState(null),[ve,N]=A.useState(new Set),[z,W]=A.useState([]),[_,ye]=A.useState(),[Ae,_e]=A.useState("loading"),Re=!!m&&Y===m,[Ye,Ce]=A.useState(new Map),[ot,jt]=A.useState(new Map),[en,Ht]=A.useState(new Map),[Be,rt]=A.useState(new Map);NO(),A.useEffect(()=>{window.scrollTo(0,0)},[d]),A.useEffect(()=>{let be=!1;return KE().then(we=>{be||N(we)}),()=>{be=!0}},[]),A.useEffect(()=>{if(!s){_e("loading");return}_e("loading");let be=!1;return l("host.info",void 0,{timeout:15e3}).then(we=>{var qe,Pe,de,Me,Oe,gt;if(be)return;W(we.agents??[]),ye(we.host_platform),ae(we.linked_client_token??null),OE(we.agents??[]);const Ne=we.version??null;F(Ne),B(!!Ne&&Kh(Ne,OO)),t(d,we.lan_url??void 0),r(d,we.host_timezone);const Ge=new Map,Ze=new Map,ct=new Map,Ie=new Map;for(const it of we.pending_prompts??[])if(it.type==="confirmation")Ge.set(it.key,{description:((qe=it.meta)==null?void 0:qe.description)??"",sessionName:(Pe=it.meta)==null?void 0:Pe.session_name});else if(it.type==="permission")Ze.set(it.key,{permissions:it.params??[],sessionName:(de=it.meta)==null?void 0:de.session_name});else if(it.type==="input"){const _n=it.params??((Me=it.meta)==null?void 0:Me.input_questions)??[];ct.set(it.key,{questions:_n,description:(Oe=it.meta)==null?void 0:Oe.description,sessionName:(gt=it.meta)==null?void 0:gt.session_name}),Ie.set(it.key,new Array(_n.length).fill(""))}Ce(Ge),jt(Ze),Ht(ct),rt(Ie),_e("ready")}).catch(()=>{be||_e("error")}),()=>{be=!0}},[s,d,l,t,r]),A.useEffect(()=>s?u(d,we=>{const Ne=we.subject.split(".");if(Ne.length<3)return;const Ge=Ne.slice(2).join(".");let Ze={};try{Ze=JSON.parse(new TextDecoder().decode(we.data))}catch{return}const ct=Ze.event_type,Ie=Ze.session_id;if(ct==="input-request"&&Ie){const qe=Ze.input_questions,Pe=Ze.session_name,de=Ze.description;qe!=null&&qe.length&&(Ht(Me=>{if(Me.has(Ie))return Me;const Oe=new Map(Me);return Oe.set(Ie,{questions:qe,description:de,sessionName:Pe}),Oe}),rt(Me=>{if(Me.has(Ie))return Me;const Oe=new Map(Me);return Oe.set(Ie,new Array(qe.length).fill("")),Oe}));return}if(ct==="input-resolved"&&Ie){Ht(qe=>{if(!qe.has(Ie))return qe;const Pe=new Map(qe);return Pe.delete(Ie),Pe}),rt(qe=>{const Pe=new Map(qe);return Pe.delete(Ie),Pe});return}if(ct==="confirm-request"&&Ie){const qe=Ze.description,Pe=Ze.session_name;qe&&Ce(de=>{if(de.has(Ie))return de;const Me=new Map(de);return Me.set(Ie,{description:qe,sessionName:Pe}),Me});return}if(ct==="confirm-resolved"&&Ie){Ce(qe=>{if(!qe.has(Ie))return qe;const Pe=new Map(qe);return Pe.delete(Ie),Pe});return}if(ct==="permission-request"){const qe=Ze.required_permissions,Pe=Ze.session_name;qe!=null&&qe.length&&jt(de=>{if(de.has(Ge))return de;const Me=new Map(de);return Me.set(Ge,{permissions:qe,sessionName:Pe}),Me});return}if(ct==="permission-resolved"){jt(qe=>{if(!qe.has(Ge))return qe;const Pe=new Map(qe);return Pe.delete(Ge),Pe});return}}):void 0,[s,d,u]);async function Ve(be,we){try{await l("task.user_input",{id:be,value:[we]})}catch(Ne){console.error("[Dashboard] Failed to respond to confirmation:",Ne)}}async function Et(be,we){try{await l("task.user_input",{id:be,value:[we]})}catch(Ne){console.error("[Dashboard] Failed to respond to permission request:",Ne)}}async function Rt(be,we){try{await l("task.user_input",{id:be,value:we})}catch(Ne){console.error("[Dashboard] Failed to respond to input request:",Ne)}}function Kn(be,we){if(!ps())return;const Ne=`/hosts/${encodeURIComponent(d)}/runs/${encodeURIComponent(be)}`;y(we?`${Ne}/${encodeURIComponent(we)}`:Ne)}A.useEffect(()=>{if(!Z)return;let be=!1;return fetch("https://registry.npmjs.org/palmier/latest").then(we=>we.ok?we.json():null).then(we=>{!be&&(we!=null&&we.version)&&L(we.version)}).catch(()=>{}),()=>{be=!0}},[Z]),A.useEffect(()=>{let be=!1;const we={};for(const Ne of z){if(!Ne.version)continue;const Ge=localStorage.getItem(`palmier.${d}.dismissedAgentUpdate.${Ne.key}`);Ge&&(we[Ne.key]=Ge)}q(we);for(const Ne of z)!Ne.version||!Ne.npmPackage||fetch(`https://registry.npmjs.org/${Ne.npmPackage}/latest`).then(Ge=>Ge.ok?Ge.json():null).then(Ge=>{be||!(Ge!=null&&Ge.version)||oe(Ze=>Ze[Ne.key]===Ge.version?Ze:{...Ze,[Ne.key]:Ge.version})}).catch(()=>{});return()=>{be=!0}},[z]);const Nt=z.find(be=>{if(!be.version)return!1;const we=ue[be.key];return!we||!Kh(be.version,we)?!1:re[be.key]!==we});function tn(be,we){localStorage.setItem(`palmier.${d}.dismissedAgentUpdate.${be}`,we),q(Ne=>({...Ne,[be]:we}))}async function wn(be){ee("agent"),D(null);try{const we=await l("host.updateAgent",{key:be});if(we.error){D(we.error),ee(!1);return}const Ne=await l("host.info");Ne.agents&&W(Ne.agents)}catch(we){D(we instanceof Error?we.message:String(we))}finally{ee(!1)}}const Rn=!M&&!!Z&&!!$&&Kh(Z,$)&&J!==$;function mt(){$&&(localStorage.setItem(`palmier.${d}.dismissedUpdateVersion`,$),G($))}async function Sn(){ee("daemon"),D(null);try{const be=await l("host.update");if(be.error){D(be.error),ee(!1);return}}catch{}setTimeout(()=>window.location.reload(),3e4)}const ce=Ye.size>0||ot.size>0||en.size>0,ke=s&&!c;return b.jsxs("div",{className:"dashboard",children:[v&&b.jsx(J0,{daemonVersion:Z,agents:z,linkedClientToken:Y,request:l,onEnabledCapabilitiesChange:N,onLinkedClientTokenChange:ae}),b.jsxs("div",{className:"dashboard-content",children:[b.jsxs("header",{className:"app-header",children:[b.jsxs("div",{className:"app-title-bar",children:[!v&&b.jsx(J0,{daemonVersion:Z,agents:z,linkedClientToken:Y,request:l,onEnabledCapabilitiesChange:N,onLinkedClientTokenChange:ae}),b.jsx("h1",{className:"app-title",children:"Palmier"}),b.jsx(tC,{})]}),b.jsx("div",{className:"tab-bar",children:b.jsx(GE,{})})]}),b.jsx("main",{className:"dashboard-main",children:c?b.jsxs("div",{className:"revoked-state",children:[b.jsx("div",{className:"revoked-icon",children:b.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),b.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),b.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),b.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),b.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),b.jsx("div",{className:"revoked-command",children:b.jsx("code",{children:"palmier pair"})}),b.jsxs("div",{className:"revoked-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>{ps()&&y("/pair")},children:"Re-pair Device"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{e(d),y("/",{replace:!0})},children:"Remove Host"})]})]}):ke?b.jsxs(b.Fragment,{children:[S&&!O&&b.jsx(VE,{connected:s,hostId:d,request:l,subscribeEvents:u,agents:z,hostPlatform:_,isNotificationListener:Re&&ve.has("notifications"),onViewRun:Kn,hostInfoStatus:Ae}),O?b.jsx(jO,{connected:s,hostId:d,request:l,subscribeEvents:u,taskId:x.taskId,runId:decodeURIComponent(x.runId)}):S?null:b.jsx(sC,{connected:s,hostId:d,request:l,subscribeEvents:u,agents:z,hostPlatform:_,filterTaskId:T,onClearFilter:()=>{ps()&&y(`/hosts/${encodeURIComponent(d)}`)},hostInfoStatus:Ae})]}):b.jsx("div",{className:"empty-state",children:b.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})})}),(M||Rn)&&!I&&!P&&!ce&&b.jsx($b,{title:M?"Update Required":"Update Available",message:M?`Your Palmier host${Z?` (v${Z})`:""} is too old for this version of the app. Please update to continue.`:`A new version of Palmier (v${$}) is available. You're running v${Z}.`,onUpdate:Sn,onDismiss:M?void 0:mt}),!M&&!Rn&&Nt&&!I&&!P&&!ce&&b.jsx($b,{title:"Agent Update Available",message:`A new version of ${Nt.label} (v${ue[Nt.key]}) is available. You're running v${Nt.version}.`,onUpdate:()=>wn(Nt.key),onDismiss:()=>tn(Nt.key,ue[Nt.key])}),I&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),b.jsx("p",{className:"confirm-modal-message",children:I==="agent"?"Installing update. Please wait...":"Installing update and restarting daemon. Please wait..."})]})}),P&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),b.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:P}),b.jsx("div",{className:"confirm-modal-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>{D(null)},children:"Retry"})})]})})]}),ds.createPortal(b.jsxs(b.Fragment,{children:[[...Ye.entries()].map(([be,{description:we,sessionName:Ne}])=>b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),Ne&&b.jsx("p",{className:"confirm-modal-subtitle",children:Ne}),b.jsx("p",{className:"confirm-modal-message",children:we}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>Ve(be,"confirmed"),children:"Confirm"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>Ve(be,"aborted"),children:"Abort"})]})]})},be)),[...ot.entries()].map(([be,{permissions:we,sessionName:Ne}])=>b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal permission-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),b.jsx("p",{className:"confirm-modal-message",children:b.jsx("strong",{children:Ne||be})}),b.jsx("div",{className:"permission-list",children:we.map((Ge,Ze)=>b.jsxs("div",{className:"permission-item",children:[b.jsx("span",{className:"permission-name",children:Ge.name}),Ge.description&&b.jsx("span",{className:"permission-desc",children:Ge.description})]},Ze))}),b.jsxs("div",{className:"permission-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>Et(be,"granted"),children:"Allow Once"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>Et(be,"granted_all"),children:"Allow Always"})]}),b.jsx("button",{className:"permission-abort-link",onClick:()=>Et(be,"aborted"),children:"Deny & Abort Task"})]})},be)),[...en.entries()].map(([be,{questions:we,description:Ne,sessionName:Ge}])=>{const Ze=Be.get(be)??new Array(we.length).fill("");return b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal input-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),Ge&&b.jsx("p",{className:"confirm-modal-subtitle",children:Ge}),Ne&&b.jsx("p",{className:"confirm-modal-message",children:Ne}),b.jsx("div",{className:"input-list",children:we.map((ct,Ie)=>b.jsxs("div",{className:"input-item",children:[b.jsx("label",{className:"input-label",children:ct}),b.jsx("input",{type:"text",className:"input-field",value:Ze[Ie]??"",onChange:qe=>{rt(Pe=>{const de=new Map(Pe),Me=[...de.get(be)??[]];return Me[Ie]=qe.target.value,de.set(be,Me),de})},autoFocus:Ie===0})]},Ie))}),b.jsx("div",{className:"input-actions",children:b.jsx("button",{className:"btn btn-primary",disabled:Ze.some(ct=>!ct.trim()),onClick:()=>Rt(be,Ze),children:"Submit"})}),b.jsx("button",{className:"permission-abort-link",onClick:()=>Rt(be,["aborted"]),children:"Cancel"})]})},be)})]}),document.body)]})}const RO=ys("Preferences",{web:()=>Fd(()=>import("./web-DZ51_ut2.js"),[]).then(e=>new e.PreferencesWeb)}),kl=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),Yb=Jn.isNativePlatform();function MO(){const[e,t]=A.useState(""),[r,s]=A.useState(!0),[l,u]=A.useState(!1),[c,f]=A.useState(null),{addPairedHost:d,pairedHosts:m}=qi(),y=Mr();async function g(){const x=e.trim().toUpperCase();if(!x){f("Enter a pairing code.");return}u(!0),f(null);try{let v;if(kl){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 B=await Lx({servers:M.natsWsUrl,authenticator:Cx(M.natsJwt,new TextEncoder().encode(M.natsNkeySeed))}),I=Ou(),ee=`pair.${x}`,P=await B.request(ee,I.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});v=JSON.parse(I.decode(P.data)),await B.close()}const S={hostId:v.hostId,clientToken:v.clientToken,directUrl:kl?window.location.origin:void 0,...v.hostName?{name:v.hostName}:{}};if(d(S),Jn.isNativePlatform()&&hn){await RO.set({key:"hostId",value:v.hostId});try{const{token:O}=await hn.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 T=`/hosts/${encodeURIComponent(v.hostId)}`;y(Yb&&r?`${T}/pair/setup`:T)}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{u(!1)}}return b.jsx("div",{className:"pair-page",children:b.jsxs("div",{className:"pair-card",children:[b.jsxs("div",{className:"pair-header",children:[b.jsx("h1",{className:"pair-title",children:kl?"Pair":"Pair with Host"}),b.jsx("p",{className:"pair-subtitle",children:kl?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!kl&&b.jsxs("div",{className:"pair-instructions",children:[b.jsxs("div",{className:"pair-instruction-block",children:[b.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),b.jsxs("ol",{className:"pair-steps",children:[b.jsxs("li",{children:["Install Palmier on your host machine.",b.jsx("span",{className:"pair-platform-label",children:"Linux / macOS:"}),b.jsx("code",{className:"pair-command",children:"curl -fsSL https://palmier.me/install.sh | bash"}),b.jsx("span",{className:"pair-platform-label",children:"Windows (PowerShell):"}),b.jsx("code",{className:"pair-command",children:"irm https://palmier.me/install.ps1 | iex"})]}),b.jsxs("li",{children:["Run the setup wizard:",b.jsx("code",{className:"pair-command",children:"palmier init"})]}),b.jsx("li",{children:"A pairing code will display automatically"})]})]}),b.jsx("div",{className:"pair-instruction-divider"}),b.jsxs("div",{className:"pair-instruction-block",children:[b.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),b.jsxs("ol",{className:"pair-steps",children:[b.jsxs("li",{children:["Run ",b.jsx("code",{children:"palmier pair"})," on the host machine"]}),b.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),b.jsxs("div",{className:"pair-form",children:[b.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",b.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})]}),Yb&&b.jsxs("label",{className:"pair-checkbox",children:[b.jsx("input",{type:"checkbox",checked:r,onChange:x=>s(x.target.checked),disabled:l}),b.jsxs("span",{className:"pair-checkbox-text",children:[b.jsx("span",{className:"pair-checkbox-title",children:"Link the host to this device"}),b.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&&b.jsx("p",{className:"pair-error",children:c}),b.jsxs("button",{className:"btn btn-primary btn-full",onClick:g,disabled:l||!e.trim(),children:[l&&b.jsx("span",{className:"btn-spinner"}),l?"Pairing...":"Pair"]}),m.length>0&&b.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>y("/"),disabled:l,children:"Cancel"}),b.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",b.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",b.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function DO(){const e=Mr(),{connected:t,request:r,activeHost:s}=si(),{setHostLanUrl:l,pairedHosts:u}=qi(),c=u.length<=1,[f,d]=A.useState("loading"),[m,y]=A.useState(null),[g,x]=A.useState(null);function v(){e(`/hosts/${encodeURIComponent(s.hostId)}`,{replace:!0})}A.useEffect(()=>{if(!t||f!=="loading")return;let B=!1;return r("host.info").catch(()=>({})).then(I=>{if(B)return;l(s.hostId,I.lan_url??void 0);const ee=I.linked_client_token??null;y(ee);const P=!!ee&&ee!==s.clientToken;d(P?"confirming":"linking")}),()=>{B=!0}},[t,f,s,r,l]),A.useEffect(()=>{if(f!=="linking")return;let B=!1;return(async()=>{try{if(hn){const{token:I}=await hn.getFcmToken();if(!I)throw new Error("Could not read FCM token");await r("device.link",{fcmToken:I})}if(B)return;c?d("wizard"):v()}catch(I){if(B)return;x(I instanceof Error?I.message:String(I)),d("linkError")}})(),()=>{B=!0}},[f]);function S(){d("linking")}function T(){v()}function O(){x(null),d("linking")}const M=f==="confirming"&&ds.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:T,children:b.jsxs("div",{className:"confirm-modal",onClick:B=>B.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),b.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."}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:T,children:"Cancel"}),b.jsx("button",{className:"btn btn-primary",onClick:S,children:"Link"})]})]})}),document.body);if(f==="loading"||f==="confirming"||f==="linking"||f==="linkError"){const B=c,I=f==="loading"||f==="confirming"||f==="linking";return b.jsxs("div",{className:"pair-setup",children:[b.jsxs("div",{className:"pair-setup-inner",children:[B&&b.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),b.jsxs("div",{className:"pair-setup-loading",children:[I&&b.jsx("span",{className:"spinner spinner-lg"}),f==="loading"&&b.jsx("span",{children:"Connecting to host…"}),f==="confirming"&&b.jsx("span",{children:"Awaiting confirmation…"}),f==="linking"&&b.jsx("span",{children:"Linking device…"}),f==="linkError"&&b.jsxs(b.Fragment,{children:[b.jsx("p",{className:"pair-error",children:g}),b.jsx("button",{className:"btn btn-primary",onClick:O,children:"Retry"}),b.jsx("button",{className:"btn btn-secondary",onClick:v,children:"Skip linking"})]})]})]}),M]})}return b.jsx("div",{className:"pair-setup",children:b.jsxs("div",{className:"pair-setup-inner",children:[b.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),b.jsx("p",{className:"pair-setup-description",children:"Choose what the host can use this device for. You can change these later from the menu."}),b.jsx(Fx,{}),b.jsx("div",{className:"pair-setup-actions",children:b.jsx("button",{className:"btn btn-primary btn-full",onClick:v,children:"Finish"})})]})})}function LO(){const e=Mr();return A.useEffect(()=>{if(!hn)return;const t=hn.addListener("deepLink",({path:r})=>e(r));return()=>{t.then(r=>r.remove())}},[e]),null}function zO(){const{pairedHosts:e,lastHostId:t}=qi();if(e.length===0)return b.jsx(zl,{to:"/pair",replace:!0});const r=e.find(s=>s.hostId===t)??e[0];return b.jsx(zl,{to:`/hosts/${encodeURIComponent(r.hostId)}`,replace:!0})}function UO(){const{hostId:e}=Yu(),{pairedHosts:t,setLastHostId:r}=qi(),s=t.find(l=>l.hostId===e)??null;return A.useEffect(()=>{s&&r(s.hostId)},[s==null?void 0:s.hostId,r]),s?b.jsx(wE,{activeHost:s,children:b.jsxs(lx,{children:[b.jsx(br,{index:!0,element:b.jsx(vu,{},e)}),b.jsx(br,{path:"tasks",element:b.jsx(vu,{},e)}),b.jsx(br,{path:"runs/:taskId",element:b.jsx(vu,{},e)}),b.jsx(br,{path:"runs/:taskId/:runId",element:b.jsx(vu,{},e)}),b.jsx(br,{path:"pair/setup",element:b.jsx(DO,{})}),b.jsx(br,{path:"*",element:b.jsx(zl,{to:".",replace:!0})})]})},`${s.hostId}|${s.clientToken}`):b.jsx(zl,{to:"/",replace:!0})}function BO(){return b.jsxs(Y_,{children:[b.jsx(LO,{}),b.jsxs(lx,{children:[b.jsx(br,{path:"/",element:b.jsx(zO,{})}),b.jsx(br,{path:"/pair",element:b.jsx(MO,{})}),b.jsx(br,{path:"/hosts/:hostId/*",element:b.jsx(UO,{})}),b.jsx(br,{path:"*",element:b.jsx(zl,{to:"/",replace:!0})})]})]})}hS.createRoot(document.getElementById("root")).render(b.jsx(A.StrictMode,{children:b.jsx(R_,{children:b.jsx(BO,{})})}));export{Id as W};
|
|
118
|
+
`,...u.current()});return/^[\t ]/.test(m)&&(m=Il(m.charCodeAt(0))+m.slice(1)),m=m?c+" "+m:c,r.options.closeAtx&&(m+=" "+c),d(),f(),m}O1.peek=g3;function O1(e){return e.value||""}function g3(){return"<"}R1.peek=y3;function R1(e,t,r,s){const l=lm(r),u=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${u}`),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 y3(){return"!"}M1.peek=b3;function M1(e,t,r,s){const l=e.referenceType,u=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 y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!m||m!==g?d+=f.move(g+"]"):l==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function b3(){return"!"}D1.peek=x3;function D1(e,t,r){let s=e.value||"",l="`",u=-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+" ");++u<r.unsafe.length;){const c=r.unsafe[u],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 x3(){return"`"}function L1(e,t){const r=Zd(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))}z1.peek=v3;function z1(e,t,r,s){const l=lm(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(s);let f,d;if(L1(e,r)){const y=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=y,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${u}`),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 v3(e,t,r){return L1(e,r)?"<":"["}U1.peek=w3;function U1(e,t,r,s){const l=e.referenceType,u=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 y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!m||m!==g?d+=f.move(g+"]"):l==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function w3(){return"["}function om(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 S3(e){const t=om(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 _3(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 B1(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 k3(e,t,r,s){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?_3(r):om(r);const f=e.ordered?c==="."?")":".":S3(r);let d=t&&r.bulletLastUsed?c===r.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&y&&(!y.children||!y.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),B1(r)===c&&y){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=u,l(),m}function E3(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 C3(e,t,r,s){const l=E3(r);let u=r.bulletCurrent||om(r);t&&t.type==="list"&&t.ordered&&(u=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+u);let c=u.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(u+" ".repeat(c-u.length)),f.shift(c);const d=r.enter("listItem"),m=r.indentLines(r.containerFlow(e,f.current()),y);return d(),m;function y(g,x,v){return x?(v?"":" ".repeat(c))+g:(v?u:u+" ".repeat(c-u.length))+g}}function A3(e,t,r,s){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,s);return u(),l(),c}const j3=tc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function T3(e,t,r,s){return(e.children.some(function(c){return j3(c)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function N3(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}P1.peek=O3;function P1(e,t,r,s){const l=N3(r),u=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),y=Iu(s.before.charCodeAt(s.before.length-1),m,l);y.inside&&(d=Il(m)+d.slice(1));const g=d.charCodeAt(d.length-1),x=Iu(s.after.charCodeAt(0),g,l);x.inside&&(d=d.slice(0,-1)+Il(g));const v=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+d+v}function O3(e,t,r){return r.options.strong||"*"}function R3(e,t,r,s){return r.safe(e.value,s)}function M3(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 D3(e,t,r){const s=(B1(r)+(r.options.ruleSpaces?" ":"")).repeat(M3(r));return r.options.ruleSpaces?s.slice(0,-1):s}const H1={blockquote:r3,break:Bb,code:u3,definition:f3,emphasis:N1,hardBreak:Bb,heading:p3,html:O1,image:R1,imageReference:M1,inlineCode:D1,link:z1,linkReference:U1,list:k3,listItem:C3,paragraph:A3,root:T3,strong:P1,text:R3,thematicBreak:D3};function L3(){return{enter:{table:z3,tableData:Pb,tableHeader:Pb,tableRow:B3},exit:{codeText:P3,table:U3,tableData:Xh,tableHeader:Xh,tableRow:Xh}}}function z3(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 U3(e){this.exit(e),this.data.inTable=void 0}function B3(e){this.enter({type:"tableRow",children:[]},e)}function Xh(e){this.exit(e)}function Pb(e){this.enter({type:"tableCell",children:[]},e)}function P3(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,H3));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function H3(e,t){return t==="|"?t:e}function q3(e){const t=e||{},r=t.tableCellPadding,s=t.tablePipeAlign,l=t.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
119
|
+
`,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,O){return m(y(v,j,O),v.align)}function f(v,S,j,O){const M=g(v,j,O),B=m([M]);return B.slice(0,B.indexOf(`
|
|
120
|
+
`))}function d(v,S,j,O){const M=j.enter("tableCell"),B=j.enter("phrasing"),I=j.containerPhrasing(v,{...O,before:u,after:u});return B(),M(),I}function m(v,S){return t3(v,{align:S,alignDelimiters:s,padding:r,stringLength:l})}function y(v,S,j){const O=v.children;let M=-1;const B=[],I=S.enter("table");for(;++M<O.length;)B[M]=g(O[M],S,j);return I(),B}function g(v,S,j){const O=v.children;let M=-1;const B=[],I=S.enter("tableRow");for(;++M<O.length;)B[M]=d(O[M],v,S,j);return I(),B}function x(v,S,j){let O=H1.inlineCode(v,S,j);return j.stack.includes("tableCell")&&(O=O.replace(/\|/g,"\\$&")),O}}function I3(){return{exit:{taskListCheckValueChecked:Hb,taskListCheckValueUnchecked:Hb,paragraph:$3}}}function F3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Y3}}}function Hb(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function $3(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 u=-1,c;for(;++u<l.length;){const f=l[u];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 Y3(e,t,r,s){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(s);u&&f.move(c);let d=H1.listItem(e,t,r,{...s,...f.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(y){return y+c}}function V3(){return[kN(),YN(),XN(),L3(),I3()]}function G3(e){return{extensions:[EN(),VN(e),KN(),q3(e),F3()]}}const J3={tokenize:eO,partial:!0},q1={tokenize:tO,partial:!0},I1={tokenize:nO,partial:!0},F1={tokenize:rO,partial:!0},X3={tokenize:iO,partial:!0},$1={name:"wwwAutolink",tokenize:Z3,previous:V1},Y1={name:"protocolAutolink",tokenize:W3,previous:G1},ci={name:"emailAutolink",tokenize:Q3,previous:J1},Br={};function K3(){return{text:Br}}let ms=48;for(;ms<123;)Br[ms]=ci,ms++,ms===58?ms=65:ms===91&&(ms=97);Br[43]=ci;Br[45]=ci;Br[46]=ci;Br[95]=ci;Br[72]=[ci,Y1];Br[104]=[ci,Y1];Br[87]=[ci,$1];Br[119]=[ci,$1];function Q3(e,t,r){const s=this;let l,u;return c;function c(g){return!Cd(g)||!J1.call(s,s.previous)||um(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return Cd(g)?(e.consume(g),f):g===64?(e.consume(g),d):r(g)}function d(g){return g===46?e.check(X3,y,m)(g):g===45||g===95||vn(g)?(u=!0,e.consume(g),d):y(g)}function m(g){return e.consume(g),l=!0,d}function y(g){return u&&l&&Cn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):r(g)}}function Z3(e,t,r){const s=this;return l;function l(c){return c!==87&&c!==119||!V1.call(s,s.previous)||um(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(J3,e.attempt(q1,e.attempt(I1,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function W3(e,t,r){const s=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&G1.call(s,s.previous)&&!um(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(Cn(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),u?m:(u=!0,d)):r(g)}function m(g){return g===null||Pu(g)||At(g)||bs(g)||Zu(g)?r(g):e.attempt(q1,e.attempt(I1,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function eO(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),u):r(c)}function u(c){return c===null?r(c):t(c)}}function tO(e,t,r){let s,l,u;return c;function c(m){return m===46||m===95?e.check(F1,d,f)(m):m===null||At(m)||bs(m)||m!==45&&Zu(m)?d(m):(u=!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||!u?r(m):t(m)}}function nO(e,t){let r=0,s=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&s<r?u(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(F1,t,u)(c):c===null||At(c)||bs(c)?t(c):(e.consume(c),l)}function u(c){return c===41&&s++,e.consume(c),l}}function rO(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),u):f===93?(e.consume(f),l):f===60||f===null||At(f)||bs(f)?t(f):r(f)}function l(f){return f===null||f===40||f===91||At(f)||bs(f)?t(f):s(f)}function u(f){return Cn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):Cn(f)?(e.consume(f),c):r(f)}}function iO(e,t,r){return s;function s(u){return e.consume(u),l}function l(u){return vn(u)?r(u):t(u)}}function V1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||At(e)}function G1(e){return!Cn(e)}function J1(e){return!(e===47||Cd(e))}function Cd(e){return e===43||e===45||e===46||e===95||vn(e)}function um(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 sO={tokenize:dO,partial:!0};function aO(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:cO,continuation:{tokenize:fO},exit:hO}},text:{91:{name:"gfmFootnoteCall",tokenize:uO},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:lO,resolveTo:oO}}}}function lO(e,t,r){const s=this;let l=s.events.length;const u=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=Er(s.sliceSerialize({start:c.end,end:s.now()}));return m.codePointAt(0)!==94||!u.includes(m.slice(1))?r(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function oO(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 u={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[r+1],e[r+2],["enter",s,t],e[r+3],e[r+4],["enter",l,t],["exit",l,t],["enter",u,t],["enter",c,t],["exit",c,t],["exit",u,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(r,e.length-r+1,...f),e}function uO(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u=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(u>999||g===93&&!c||g===null||g===91||At(g))return r(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return l.includes(Er(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(g)}return At(g)||(c=!0),u++,e.consume(g),g===92?y:m}function y(g){return g===91||g===92||g===93?(e.consume(g),u++,m):m(g)}}function cO(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,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",y):r(S)}function y(S){if(c>999||S===93&&!f||S===null||S===91||At(S))return r(S);if(S===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return u=Er(s.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return At(S)||(f=!0),c++,e.consume(S),S===92?g:y}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,y):y(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),l.includes(u)||l.push(u),ut(e,v,"gfmFootnoteDefinitionWhitespace")):r(S)}function v(S){return t(S)}}function fO(e,t,r){return e.check(Jl,t,e.attempt(sO,t,r))}function hO(e){e.exit("gfmFootnoteDefinition")}function dO(e,t,r){const s=this;return ut(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(u):r(u)}}function mO(e){let r=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,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 y={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",y,f],["enter",c[m][1],f],["exit",c[m][1],f],["enter",g,f]],v=f.parser.constructs.insideSpan.null;v&&Qn(x,x.length,0,Wu(v,c.slice(m+1,d),f)),Qn(x,x.length,0,[["exit",g,f],["enter",c[d][1],f],["exit",c[d][1],f],["exit",y,f]]),Qn(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 u(c,f,d){const m=this.previous,y=this.events;let g=0;return x;function x(S){return m===126&&y[y.length-1][1].type!=="characterEscape"?d(S):(c.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const j=xa(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=xa(S);return O._open=!M||M===2&&!!j,O._close=!j||j===2&&!!M,f(S)}}}class pO{constructor(){this.map=[]}add(t,r,s){gO(this,t,r,s)}consume(t){if(this.map.sort(function(u,c){return u[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 u of l)t.push(u);l=s.pop()}this.map.length=0}}function gO(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 yO(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 u=s.length-1;s[u]=s[u]==="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 bO(){return{flow:{null:{name:"table",tokenize:xO,resolveAll:vO}}}}function xO(e,t,r){const s=this;let l=0,u=0,c;return f;function f(L){let J=s.events.length-1;for(;J>-1;){const ue=s.events[J][1].type;if(ue==="lineEnding"||ue==="linePrefix")J--;else break}const G=J>-1?s.events[J][1].type:null,ce=G==="tableHead"||G==="tableRow"?D:d;return ce===D&&s.parser.lazy[s.now().line]?r(L):ce(L)}function d(L){return e.enter("tableHead"),e.enter("tableRow"),m(L)}function m(L){return L===124||(c=!0,u+=1),y(L)}function y(L){return L===null?r(L):$e(L)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),v):r(L):rt(L)?ut(e,y,"whitespace")(L):(u+=1,c&&(c=!1,l+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(L)))}function g(L){return L===null||L===124||At(L)?(e.exit("data"),y(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,rt(L)?ut(e,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):S(L))}function S(L){return L===45||L===58?O(L):L===124?(c=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),j):P(L)}function j(L){return rt(L)?ut(e,O,"whitespace")(L):O(L)}function O(L){return L===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),M):L===45?(u+=1,M(L)):L===null||$e(L)?ee(L):P(L)}function M(L){return L===45?(e.enter("tableDelimiterFiller"),B(L)):P(L)}function B(L){return L===45?(e.consume(L),B):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 rt(L)?ut(e,ee,"whitespace")(L):ee(L)}function ee(L){return L===124?S(L):L===null||$e(L)?!c||l!==u?P(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):P(L)}function P(L){return r(L)}function D(L){return e.enter("tableRow"),Z(L)}function Z(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),Z):L===null||$e(L)?(e.exit("tableRow"),t(L)):rt(L)?ut(e,Z,"whitespace")(L):(e.enter("data"),F(L))}function F(L){return L===null||L===124||At(L)?(e.exit("data"),Z(L)):(e.consume(L),L===92?$:F)}function $(L){return L===92||L===124?(e.consume(L),F):F(L)}}function vO(e,t){let r=-1,s=!0,l=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,d=0,m,y,g;const x=new pO;for(;++r<e.length;){const v=e[r],S=v[1];v[0]==="enter"?S.type==="tableHead"?(f=!1,d!==0&&(qb(x,t,d,m,y),y=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,u=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,y={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",y,t]])),l=S.type==="tableDelimiterRow"?2:y?3:1):l&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=xu(x,t,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):S.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(c[0]=c[1],g=xu(x,t,u,l,void 0,g)),u=c,c=[u[1],r,0,0])):S.type==="tableHead"?(f=!0,d=r):S.type==="tableRow"||S.type==="tableDelimiterRow"?(d=r,u[1]!==0?(c[0]=c[1],g=xu(x,t,u,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&&qb(x,t,d,m,y),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=yO(t.events,r))}return e}function xu(e,t,r,s,l,u){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},sa(t.events,r[0])),e.add(r[0],0,[["exit",u,t]]));const d=sa(t.events,r[1]);if(u={type:c,start:Object.assign({},d),end:Object.assign({},d)},e.add(r[1],0,[["enter",u,t]]),r[2]!==0){const m=sa(t.events,r[2]),y=sa(t.events,r[3]),g={type:f,start:Object.assign({},m),end:Object.assign({},y)};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&&(u.end=Object.assign({},sa(t.events,l)),e.add(l,0,[["exit",u,t]]),u=void 0),u}function qb(e,t,r,s,l){const u=[],c=sa(t.events,r);l&&(l.end=Object.assign({},c),u.push(["exit",l,t])),s.end=Object.assign({},c),u.push(["exit",s,t]),e.add(r+1,0,u)}function sa(e,t){const r=e[t],s=r[0]==="enter"?"start":"end";return r[1][s]}const wO={name:"tasklistCheck",tokenize:_O};function SO(){return{text:{91:wO}}}function _O(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"),u)}function u(d){return At(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):rt(d)?e.check({tokenize:kO},t,r)(d):r(d)}}function kO(e,t,r){return ut(e,s,"whitespace");function s(l){return l===null?r(l):t(l)}}function EO(e){return i1([K3(),aO(),mO(e),bO(),SO()])}const CO={};function Ib(e){const t=this,r=e||CO,s=t.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(EO(r)),u.push(V3()),c.push(G3(r))}function AO(e){E1(e,[/\r?\n|\r/g,jO])}function jO(){return{type:"break"}}function Fb(){return function(e){AO(e)}}function TO({connected:e,hostId:t,request:r,subscribeEvents:s,taskId:l,runId:u}){const c=Ur(),f=$d(),[d,m]=A.useState(!0),[y,g]=A.useState([]),[x,v]=A.useState(),[S,j]=A.useState(),[O,M]=A.useState(),B=x==="started",I=x==="followup",ee=x==="started"||x==="followup",[P,D]=A.useState(null);pd(P!==null,()=>D(null));const[Z,F]=A.useState(!1),[$,L]=A.useState(""),[J,G]=A.useState(!1),ce=A.useRef(null),ue=A.useRef(null),re=A.useRef(null),[q,Y]=A.useState(u==="latest"?void 0:u),ae=u==="latest"&&q===null;A.useEffect(()=>{if(u!=="latest"){Y(u);return}e&&(Y(void 0),r("taskrun.list",{task_id:l,limit:1}).then(_=>{var ye,je;return Y(((je=(ye=_.entries)==null?void 0:ye[0])==null?void 0:je.run_id)??null)}).catch(()=>Y(null)))},[u,l,e,r]);async function ve(){if(q)try{const _=await r("task.result",{id:l,run_id:q});if(_.error){console.error("No result:",_.error),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0});return}g(_.messages??[]),v(_.running_state),j(_.agent),M(_.agent_version)}catch(_){console.error("Failed to load result:",_),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0})}finally{m(!1)}}async function N(_){var ye;if(q)try{const Se=(ye=(await r("task.reports",{id:l,run_id:q,report_files:[_]})).reports)==null?void 0:ye[0];Se!=null&&Se.data_url?D({file:_,data_url:Se.data_url}):D({file:_,content:(Se==null?void 0:Se.content)??"Report not found."})}catch{D({file:_,content:"Failed to load report."})}}A.useEffect(()=>{!e||!q||(m(!0),ve())},[e,l,q]),A.useEffect(()=>!e||!t||!q?void 0:s(t,async ye=>{try{const je=JSON.parse(new TextDecoder().decode(ye.data));if(je.event_type!=="running-state"&&je.event_type!=="result-updated"||ye.subject.split(".").pop()!==l||je.event_type==="result-updated"&&je.run_id&&je.run_id!==q)return;ve()}catch{}}),[e,t,l,q,s,r]),A.useEffect(()=>{ce.current&&(ce.current.scrollTop=ce.current.scrollHeight)},[y]),A.useEffect(()=>{d||ae||!q||re.current!==q&&(re.current=q,requestAnimationFrame(()=>{ce.current&&(ce.current.scrollTop=ce.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"})}))},[d,ae,q]);function z(_){if(_==="input")return"User Input";if(_==="permission")return"Permission";if(_==="confirmation")return"Confirmation"}function W(_){return _==="started"?"Task started":_==="finished"?"Task finished":_==="failed"?"Task failed":_==="error"?"Command failed":_==="aborted"?"Task aborted":_==="confirmation"?"Task confirmed":_==="stopped"?"Follow-up stopped":_??""}return b.jsxs("div",{className:"run-detail",children:[b.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),ae?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No runs yet"}),b.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?b.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[b.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"chat-thread",ref:ce,children:[y.map((_,ye)=>{const je=ee&&_.role==="assistant"&&!y.slice(ye+1).some(Se=>Se.role==="assistant"||Se.role==="user");return _.role==="status"?b.jsxs("div",{className:`chat-status${_.type==="error"?" chat-status--error":""}`,children:[b.jsxs("div",{children:[W(_.type),_.time>0&&b.jsx("span",{className:"chat-status-time",children:f(_.time)})]}),_.content&&b.jsx("pre",{className:"chat-status-detail",children:_.content})]},ye):b.jsxs("div",{className:`chat-message chat-message--${_.role}${_.role==="assistant"&&_.stream==="stderr"?" chat-message--stderr":""}`,children:[_.role==="assistant"&&S&&b.jsxs("div",{className:"chat-message-agent",children:[md(S),O&&b.jsxs("span",{className:"chat-message-agent-version",children:[" v",O]})]}),b.jsxs("div",{className:"chat-message-content",children:[b.jsx(Db,{remarkPlugins:[Ib,Fb],components:{a:({...Se})=>b.jsx("a",{...Se,target:"_blank",rel:"noopener noreferrer"})},children:_.content}),je&&b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]}),_.attachments&&_.attachments.length>0&&b.jsx("div",{className:"chat-message-attachments",children:_.attachments.map(Se=>b.jsx("button",{className:"chat-attachment-chip",onClick:()=>N(Se),children:Se},Se))}),b.jsxs("div",{className:"chat-message-meta",children:[z(_.type)&&b.jsx("span",{className:"chat-message-type",children:z(_.type)}),_.time>0&&b.jsx("span",{children:f(_.time)})]})]},ye)}),ee&&(()=>{const _=y.filter(ye=>ye.role!=="status");return _.length===0||_[_.length-1].role!=="assistant"})()&&b.jsxs("div",{className:"chat-message chat-message--assistant",children:[S&&b.jsxs("div",{className:"chat-message-agent",children:[md(S),O&&b.jsxs("span",{className:"chat-message-agent-version",children:[" v",O]})]}),b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]})]}),B||I?b.jsx("div",{className:"chat-input-bar",children:b.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:Z,"aria-label":"Abort task",onClick:async()=>{if(confirm("Abort this task?")){F(!0);try{await r("task.abort",{id:l})}catch(_){console.error("Abort failed:",_)}finally{F(!1)}}},children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:b.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):b.jsxs("form",{className:"chat-input-bar",onSubmit:async _=>{_.preventDefault();const ye=$.trim();if(!(!ye||J)){G(!0);try{await r("task.followup",{id:l,run_id:q,message:ye}),L("")}catch(je){console.error("Follow-up failed:",je)}finally{G(!1)}}},children:[b.jsx("input",{ref:ue,className:"chat-input",type:"text",placeholder:"Follow-up message",value:$,onChange:_=>L(_.target.value),disabled:J}),b.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!$.trim()||J,children:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),b.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),b.jsxs("button",{className:"run-detail-back run-detail-back--footer",onClick:()=>c(-1),children:[b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]})]}),P&&b.jsx("div",{className:"report-dialog-overlay",onClick:()=>D(null),children:b.jsxs("div",{className:"report-dialog",onClick:_=>_.stopPropagation(),children:[b.jsxs("div",{className:"report-dialog-header",children:[b.jsx("span",{className:"report-dialog-title",children:P.file}),b.jsx("button",{className:"report-dialog-close",onClick:()=>D(null),"aria-label":"Close",children:b.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),b.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),b.jsx("div",{className:"report-dialog-body",children:P.data_url?b.jsx("img",{src:P.data_url,alt:P.file,style:{maxWidth:"100%",height:"auto"}}):b.jsx(Db,{remarkPlugins:[Ib,Fb],components:{a:({..._})=>b.jsx("a",{..._,target:"_blank",rel:"noopener noreferrer"})},children:P.content??""})})]})})]})}function $b({title:e,message:t,onUpdate:r,onDismiss:s}){return b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:e}),b.jsx("p",{className:"confirm-modal-message",children:t}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:r,children:"Update Now"}),s&&b.jsx("button",{className:"btn btn-secondary",onClick:s,children:"Dismiss"})]})]})})}function NO(){const{activeHost:e}=ui(),t=A.useRef(null);A.useEffect(()=>{if(Wn.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 u=await l.pushManager.getSubscription();if(!u){const{publicKey:f}=await yE("/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}u=await l.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:f})}const c=u.toJSON();await gE("/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 OO="0.9.9";function Kh(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 vu(){const{removePairedHost:e,setHostLanUrl:t,setHostTimezone:r}=Yi(),{connected:s,request:l,subscribeEvents:u,unauthorized:c,activeHost:f}=ui(),d=f.hostId,m=f.clientToken||null,y=Ur(),g=mr(),x=Yu(),v=Ix("(min-width: 768px)"),S=g.pathname.endsWith("/tasks"),j=x.runId?void 0:x.taskId,O=!!(x.taskId&&x.runId),[M,B]=A.useState(!1),[I,ee]=A.useState(!1),[P,D]=A.useState(null),[Z,F]=A.useState(null),[$,L]=A.useState(null),[J,G]=A.useState(()=>localStorage.getItem(`palmier.${d}.dismissedUpdateVersion`)),[ce,ue]=A.useState({}),[re,q]=A.useState({}),[Y,ae]=A.useState(null),[ve,N]=A.useState(new Set),[z,W]=A.useState([]),[_,ye]=A.useState(),[je,Se]=A.useState("loading"),Me=!!m&&Y===m,[Ve,Ae]=A.useState(new Map),[ot,kt]=A.useState(new Map),[an,Lt]=A.useState(new Map),[Ie,et]=A.useState(new Map),[qe,jt]=A.useState(new Map),[gt,zn]=A.useState(new Map);NO(),A.useEffect(()=>{window.scrollTo(0,0)},[d]),A.useEffect(()=>{let xe=!1;return KE().then(ke=>{xe||N(ke)}),()=>{xe=!0}},[]),A.useEffect(()=>{if(!s){Se("loading");return}Se("loading");let xe=!1;return l("host.info",void 0,{timeout:15e3}).then(ke=>{var Ue,Xe,Tt,Nt,Yt,gn,fi;if(xe)return;W(ke.agents??[]),ye(ke.host_platform),ae(ke.linked_client_token??null),OE(ke.agents??[]);const Be=ke.version??null;F(Be),B(!!Be&&Kh(Be,OO)),t(d,ke.lan_url??void 0),r(d,ke.host_timezone);const Oe=new Map,oe=new Map,Re=new Map,Ee=new Map;for(const Ht of ke.pending_prompts??[])if(Ht.type==="confirmation")Oe.set(Ht.key,{description:((Ue=Ht.meta)==null?void 0:Ue.description)??"",sessionName:(Xe=Ht.meta)==null?void 0:Xe.session_name});else if(Ht.type==="permission")oe.set(Ht.key,{permissions:Ht.params??[],sessionName:(Tt=Ht.meta)==null?void 0:Tt.session_name});else if(Ht.type==="input"){const pr=Ht.params??((Nt=Ht.meta)==null?void 0:Nt.input_questions)??[];Re.set(Ht.key,{questions:pr,description:(Yt=Ht.meta)==null?void 0:Yt.description,sessionName:(gn=Ht.meta)==null?void 0:gn.session_name,secret:(fi=Ht.meta)==null?void 0:fi.secret}),Ee.set(Ht.key,new Array(pr.length).fill(""))}Ae(Oe),kt(oe),Lt(Re),et(Ee),Se("ready")}).catch(()=>{xe||Se("error")}),()=>{xe=!0}},[s,d,l,t,r]),A.useEffect(()=>s?u(d,ke=>{const Be=ke.subject.split(".");if(Be.length<3)return;const Oe=Be.slice(2).join(".");let oe={};try{oe=JSON.parse(new TextDecoder().decode(ke.data))}catch{return}const Re=oe.event_type,Ee=oe.session_id;if(Re==="input-request"&&Ee){const Ue=oe.input_questions,Xe=oe.session_name,Tt=oe.description,Nt=oe.secret;Ue!=null&&Ue.length&&(Lt(Yt=>{if(Yt.has(Ee))return Yt;const gn=new Map(Yt);return gn.set(Ee,{questions:Ue,description:Tt,sessionName:Xe,secret:Nt}),gn}),et(Yt=>{if(Yt.has(Ee))return Yt;const gn=new Map(Yt);return gn.set(Ee,new Array(Ue.length).fill("")),gn}));return}if(Re==="input-resolved"&&Ee){Lt(Ue=>{if(!Ue.has(Ee))return Ue;const Xe=new Map(Ue);return Xe.delete(Ee),Xe}),et(Ue=>{const Xe=new Map(Ue);return Xe.delete(Ee),Xe});return}if(Re==="confirm-request"&&Ee){const Ue=oe.description,Xe=oe.session_name;Ue&&Ae(Tt=>{if(Tt.has(Ee))return Tt;const Nt=new Map(Tt);return Nt.set(Ee,{description:Ue,sessionName:Xe}),Nt});return}if(Re==="confirm-resolved"&&Ee){Ae(Ue=>{if(!Ue.has(Ee))return Ue;const Xe=new Map(Ue);return Xe.delete(Ee),Xe});return}if(Re==="permission-request"){const Ue=oe.required_permissions,Xe=oe.session_name;Ue!=null&&Ue.length&&kt(Tt=>{if(Tt.has(Oe))return Tt;const Nt=new Map(Tt);return Nt.set(Oe,{permissions:Ue,sessionName:Xe}),Nt});return}if(Re==="permission-resolved"){kt(Ue=>{if(!Ue.has(Oe))return Ue;const Xe=new Map(Ue);return Xe.delete(Oe),Xe});return}}):void 0,[s,d,u]);async function qt(xe,ke,Be,Oe){if(!qe.has(xe)){jt(oe=>new Map(oe).set(xe,ke)),zn(oe=>{const Re=new Map(oe);return Re.delete(xe),Re});try{await l("task.user_input",{id:xe,value:Be},{timeout:3e4}),Oe()}catch(oe){console.error("[Dashboard] Failed to send user input:",oe),zn(Re=>new Map(Re).set(xe,"Couldn't reach the host. Try again."))}finally{jt(oe=>{const Re=new Map(oe);return Re.delete(xe),Re})}}}function nn(xe,ke){qt(xe,ke,[ke],()=>{Ae(Be=>{const Oe=new Map(Be);return Oe.delete(xe),Oe})})}function pn(xe,ke){qt(xe,ke,[ke],()=>{kt(Be=>{const Oe=new Map(Be);return Oe.delete(xe),Oe})})}function Un(xe,ke,Be){qt(xe,ke,Be,()=>{Lt(Oe=>{const oe=new Map(Oe);return oe.delete(xe),oe}),et(Oe=>{const oe=new Map(Oe);return oe.delete(xe),oe})})}function dt(xe,ke){if(!ys())return;const Be=`/hosts/${encodeURIComponent(d)}/runs/${encodeURIComponent(xe)}`;y(ke?`${Be}/${encodeURIComponent(ke)}`:Be)}A.useEffect(()=>{if(!Z)return;let xe=!1;return fetch("https://registry.npmjs.org/palmier/latest").then(ke=>ke.ok?ke.json():null).then(ke=>{!xe&&(ke!=null&&ke.version)&&L(ke.version)}).catch(()=>{}),()=>{xe=!0}},[Z]),A.useEffect(()=>{let xe=!1;const ke={};for(const Be of z){if(!Be.version)continue;const Oe=localStorage.getItem(`palmier.${d}.dismissedAgentUpdate.${Be.key}`);Oe&&(ke[Be.key]=Oe)}q(ke);for(const Be of z)!Be.version||!Be.npmPackage||fetch(`https://registry.npmjs.org/${Be.npmPackage}/latest`).then(Oe=>Oe.ok?Oe.json():null).then(Oe=>{xe||!(Oe!=null&&Oe.version)||ue(oe=>oe[Be.key]===Oe.version?oe:{...oe,[Be.key]:Oe.version})}).catch(()=>{});return()=>{xe=!0}},[z]);const Xt=z.find(xe=>{if(!xe.version)return!1;const ke=ce[xe.key];return!ke||!Kh(xe.version,ke)?!1:re[xe.key]!==ke});function fe(xe,ke){localStorage.setItem(`palmier.${d}.dismissedAgentUpdate.${xe}`,ke),q(Be=>({...Be,[xe]:ke}))}async function _e(xe){ee("agent"),D(null);try{const ke=await l("host.updateAgent",{key:xe});if(ke.error){D(ke.error),ee(!1);return}const Be=await l("host.info");Be.agents&&W(Be.agents)}catch(ke){D(ke instanceof Error?ke.message:String(ke))}finally{ee(!1)}}const Pe=!M&&!!Z&&!!$&&Kh(Z,$)&&J!==$;function Je(){$&&(localStorage.setItem(`palmier.${d}.dismissedUpdateVersion`,$),G($))}async function it(){ee("daemon"),D(null);try{const xe=await l("host.update");if(xe.error){D(xe.error),ee(!1);return}}catch{}setTimeout(()=>window.location.reload(),3e4)}const Kt=Ve.size>0||ot.size>0||an.size>0,cn=s&&!c;return b.jsxs("div",{className:"dashboard",children:[v&&b.jsx(J0,{daemonVersion:Z,agents:z,linkedClientToken:Y,request:l,onEnabledCapabilitiesChange:N,onLinkedClientTokenChange:ae}),b.jsxs("div",{className:"dashboard-content",children:[b.jsxs("header",{className:"app-header",children:[b.jsxs("div",{className:"app-title-bar",children:[!v&&b.jsx(J0,{daemonVersion:Z,agents:z,linkedClientToken:Y,request:l,onEnabledCapabilitiesChange:N,onLinkedClientTokenChange:ae}),b.jsx("h1",{className:"app-title",children:"Palmier"}),b.jsx(tC,{})]}),b.jsx("div",{className:"tab-bar",children:b.jsx(GE,{})})]}),b.jsx("main",{className:"dashboard-main",children:c?b.jsxs("div",{className:"revoked-state",children:[b.jsx("div",{className:"revoked-icon",children:b.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),b.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),b.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),b.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),b.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),b.jsx("div",{className:"revoked-command",children:b.jsx("code",{children:"palmier pair"})}),b.jsxs("div",{className:"revoked-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>{ys()&&y("/pair")},children:"Re-pair Device"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{e(d),y("/",{replace:!0})},children:"Remove Host"})]})]}):cn?b.jsxs(b.Fragment,{children:[S&&!O&&b.jsx(VE,{connected:s,hostId:d,request:l,subscribeEvents:u,agents:z,hostPlatform:_,isNotificationListener:Me&&ve.has("notifications"),onViewRun:dt,hostInfoStatus:je}),O?b.jsx(TO,{connected:s,hostId:d,request:l,subscribeEvents:u,taskId:x.taskId,runId:decodeURIComponent(x.runId)}):S?null:b.jsx(sC,{connected:s,hostId:d,request:l,subscribeEvents:u,agents:z,hostPlatform:_,filterTaskId:j,onClearFilter:()=>{ys()&&y(`/hosts/${encodeURIComponent(d)}`)},hostInfoStatus:je})]}):b.jsx("div",{className:"empty-state",children:b.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})})}),(M||Pe)&&!I&&!P&&!Kt&&b.jsx($b,{title:M?"Update Required":"Update Available",message:M?`Your Palmier host${Z?` (v${Z})`:""} is too old for this version of the app. Please update to continue.`:`A new version of Palmier (v${$}) is available. You're running v${Z}.`,onUpdate:it,onDismiss:M?void 0:Je}),!M&&!Pe&&Xt&&!I&&!P&&!Kt&&b.jsx($b,{title:"Agent Update Available",message:`A new version of ${Xt.label} (v${ce[Xt.key]}) is available. You're running v${Xt.version}.`,onUpdate:()=>_e(Xt.key),onDismiss:()=>fe(Xt.key,ce[Xt.key])}),I&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),b.jsx("p",{className:"confirm-modal-message",children:I==="agent"?"Installing update. Please wait...":"Installing update and restarting daemon. Please wait..."})]})}),P&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),b.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:P}),b.jsx("div",{className:"confirm-modal-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>{D(null)},children:"Retry"})})]})})]}),ps.createPortal(b.jsxs(b.Fragment,{children:[[...Ve.entries()].map(([xe,{description:ke,sessionName:Be}])=>b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),Be&&b.jsx("p",{className:"confirm-modal-subtitle",children:Be}),b.jsx("p",{className:"confirm-modal-message",children:ke}),gt.has(xe)&&b.jsx("p",{className:"form-error",children:gt.get(xe)}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsxs("button",{className:"btn btn-primary",disabled:qe.has(xe),onClick:()=>nn(xe,"confirmed"),children:[qe.get(xe)==="confirmed"&&b.jsx("span",{className:"btn-spinner"}),"Confirm"]}),b.jsxs("button",{className:"btn btn-secondary",disabled:qe.has(xe),onClick:()=>nn(xe,"aborted"),children:[qe.get(xe)==="aborted"&&b.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort"]})]})]})},xe)),[...ot.entries()].map(([xe,{permissions:ke,sessionName:Be}])=>b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal permission-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),b.jsx("p",{className:"confirm-modal-message",children:b.jsx("strong",{children:Be||xe})}),b.jsx("div",{className:"permission-list",children:ke.map((Oe,oe)=>b.jsxs("div",{className:"permission-item",children:[b.jsx("span",{className:"permission-name",children:Oe.name}),Oe.description&&b.jsx("span",{className:"permission-desc",children:Oe.description})]},oe))}),gt.has(xe)&&b.jsx("p",{className:"form-error",children:gt.get(xe)}),b.jsxs("div",{className:"permission-actions",children:[b.jsxs("button",{className:"btn btn-primary",disabled:qe.has(xe),onClick:()=>pn(xe,"granted"),children:[qe.get(xe)==="granted"&&b.jsx("span",{className:"btn-spinner"}),"Allow Once"]}),b.jsxs("button",{className:"btn btn-secondary",disabled:qe.has(xe),onClick:()=>pn(xe,"granted_all"),children:[qe.get(xe)==="granted_all"&&b.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Allow Always"]})]}),b.jsxs("button",{className:"permission-abort-link",disabled:qe.has(xe),onClick:()=>pn(xe,"aborted"),children:[qe.get(xe)==="aborted"&&b.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Deny & Abort Task"]})]})},xe)),[...an.entries()].map(([xe,{questions:ke,description:Be,sessionName:Oe,secret:oe}])=>{const Re=Ie.get(xe)??new Array(ke.length).fill("");return b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal input-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:oe?"Password Required":"Input Required"}),Oe&&b.jsx("p",{className:"confirm-modal-subtitle",children:Oe}),Be&&b.jsx("p",{className:"confirm-modal-message",children:Be}),b.jsx("div",{className:"input-list",children:ke.map((Ee,Ue)=>b.jsxs("div",{className:"input-item",children:[b.jsx("label",{className:"input-label",children:Ee}),b.jsx("input",{type:oe?"password":"text",autoComplete:oe?"off":void 0,className:"input-field",value:Re[Ue]??"",onChange:Xe=>{et(Tt=>{const Nt=new Map(Tt),Yt=[...Nt.get(xe)??[]];return Yt[Ue]=Xe.target.value,Nt.set(xe,Yt),Nt})},disabled:qe.has(xe),autoFocus:Ue===0})]},Ue))}),gt.has(xe)&&b.jsx("p",{className:"form-error",children:gt.get(xe)}),b.jsx("div",{className:"input-actions",children:b.jsxs("button",{className:"btn btn-primary",disabled:qe.has(xe)||Re.some(Ee=>!Ee.trim()),onClick:()=>Un(xe,"submit",Re),children:[qe.get(xe)==="submit"&&b.jsx("span",{className:"btn-spinner"}),"Submit"]})}),b.jsxs("button",{className:"permission-abort-link",disabled:qe.has(xe),onClick:()=>Un(xe,"aborted",["aborted"]),children:[qe.get(xe)==="aborted"&&b.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Cancel"]})]})},xe)})]}),document.body)]})}const RO=xs("Preferences",{web:()=>Fd(()=>import("./web-ZugiRoEF.js"),[]).then(e=>new e.PreferencesWeb)}),kl=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),Yb=Wn.isNativePlatform();function MO(){const[e,t]=A.useState(""),[r,s]=A.useState(!0),[l,u]=A.useState(!1),[c,f]=A.useState(null),{addPairedHost:d,pairedHosts:m}=Yi(),y=Ur();async function g(){const x=e.trim().toUpperCase();if(!x){f("Enter a pairing code.");return}u(!0),f(null);try{let v;if(kl){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 B=await Lx({servers:M.natsWsUrl,authenticator:Cx(M.natsJwt,new TextEncoder().encode(M.natsNkeySeed))}),I=Ou(),ee=`pair.${x}`,P=await B.request(ee,I.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});v=JSON.parse(I.decode(P.data)),await B.close()}const S={hostId:v.hostId,clientToken:v.clientToken,directUrl:kl?window.location.origin:void 0,...v.hostName?{name:v.hostName}:{}};if(d(S),Wn.isNativePlatform()&&xn){await RO.set({key:"hostId",value:v.hostId});try{const{token:O}=await xn.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 j=`/hosts/${encodeURIComponent(v.hostId)}`;y(Yb&&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{u(!1)}}return b.jsx("div",{className:"pair-page",children:b.jsxs("div",{className:"pair-card",children:[b.jsxs("div",{className:"pair-header",children:[b.jsx("h1",{className:"pair-title",children:kl?"Pair":"Pair with Host"}),b.jsx("p",{className:"pair-subtitle",children:kl?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!kl&&b.jsxs("div",{className:"pair-instructions",children:[b.jsxs("div",{className:"pair-instruction-block",children:[b.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),b.jsxs("ol",{className:"pair-steps",children:[b.jsxs("li",{children:["Install Palmier on your host machine.",b.jsx("span",{className:"pair-platform-label",children:"Linux / macOS:"}),b.jsx("code",{className:"pair-command",children:"curl -fsSL https://palmier.me/install.sh | bash"}),b.jsx("span",{className:"pair-platform-label",children:"Windows (PowerShell):"}),b.jsx("code",{className:"pair-command",children:"irm https://palmier.me/install.ps1 | iex"})]}),b.jsxs("li",{children:["Run the setup wizard:",b.jsx("code",{className:"pair-command",children:"palmier init"})]}),b.jsx("li",{children:"A pairing code will display automatically"})]})]}),b.jsx("div",{className:"pair-instruction-divider"}),b.jsxs("div",{className:"pair-instruction-block",children:[b.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),b.jsxs("ol",{className:"pair-steps",children:[b.jsxs("li",{children:["Run ",b.jsx("code",{children:"palmier pair"})," on the host machine"]}),b.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),b.jsxs("div",{className:"pair-form",children:[b.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",b.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})]}),Yb&&b.jsxs("label",{className:"pair-checkbox",children:[b.jsx("input",{type:"checkbox",checked:r,onChange:x=>s(x.target.checked),disabled:l}),b.jsxs("span",{className:"pair-checkbox-text",children:[b.jsx("span",{className:"pair-checkbox-title",children:"Link the host to this device"}),b.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&&b.jsx("p",{className:"pair-error",children:c}),b.jsxs("button",{className:"btn btn-primary btn-full",onClick:g,disabled:l||!e.trim(),children:[l&&b.jsx("span",{className:"btn-spinner"}),l?"Pairing...":"Pair"]}),m.length>0&&b.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>y("/"),disabled:l,children:"Cancel"}),b.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",b.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",b.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function DO(){const e=Ur(),{connected:t,request:r,activeHost:s}=ui(),{setHostLanUrl:l,pairedHosts:u}=Yi(),c=u.length<=1,[f,d]=A.useState("loading"),[m,y]=A.useState(null),[g,x]=A.useState(null);function v(){e(`/hosts/${encodeURIComponent(s.hostId)}`,{replace:!0})}A.useEffect(()=>{if(!t||f!=="loading")return;let B=!1;return r("host.info").catch(()=>({})).then(I=>{if(B)return;l(s.hostId,I.lan_url??void 0);const ee=I.linked_client_token??null;y(ee);const P=!!ee&&ee!==s.clientToken;d(P?"confirming":"linking")}),()=>{B=!0}},[t,f,s,r,l]),A.useEffect(()=>{if(f!=="linking")return;let B=!1;return(async()=>{try{if(xn){const{token:I}=await xn.getFcmToken();if(!I)throw new Error("Could not read FCM token");await r("device.link",{fcmToken:I})}if(B)return;c?d("wizard"):v()}catch(I){if(B)return;x(I instanceof Error?I.message:String(I)),d("linkError")}})(),()=>{B=!0}},[f]);function S(){d("linking")}function j(){v()}function O(){x(null),d("linking")}const M=f==="confirming"&&ps.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:j,children:b.jsxs("div",{className:"confirm-modal",onClick:B=>B.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),b.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."}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:j,children:"Cancel"}),b.jsx("button",{className:"btn btn-primary",onClick:S,children:"Link"})]})]})}),document.body);if(f==="loading"||f==="confirming"||f==="linking"||f==="linkError"){const B=c,I=f==="loading"||f==="confirming"||f==="linking";return b.jsxs("div",{className:"pair-setup",children:[b.jsxs("div",{className:"pair-setup-inner",children:[B&&b.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),b.jsxs("div",{className:"pair-setup-loading",children:[I&&b.jsx("span",{className:"spinner spinner-lg"}),f==="loading"&&b.jsx("span",{children:"Connecting to host…"}),f==="confirming"&&b.jsx("span",{children:"Awaiting confirmation…"}),f==="linking"&&b.jsx("span",{children:"Linking device…"}),f==="linkError"&&b.jsxs(b.Fragment,{children:[b.jsx("p",{className:"pair-error",children:g}),b.jsx("button",{className:"btn btn-primary",onClick:O,children:"Retry"}),b.jsx("button",{className:"btn btn-secondary",onClick:v,children:"Skip linking"})]})]})]}),M]})}return b.jsx("div",{className:"pair-setup",children:b.jsxs("div",{className:"pair-setup-inner",children:[b.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),b.jsx("p",{className:"pair-setup-description",children:"Choose what the host can use this device for. You can change these later from the menu."}),b.jsx(Fx,{}),b.jsx("div",{className:"pair-setup-actions",children:b.jsx("button",{className:"btn btn-primary btn-full",onClick:v,children:"Finish"})})]})})}function LO(){const e=Ur();return A.useEffect(()=>{if(!xn)return;const t=xn.addListener("deepLink",({path:r})=>e(r));return()=>{t.then(r=>r.remove())}},[e]),null}function zO(){const{pairedHosts:e,lastHostId:t}=Yi();if(e.length===0)return b.jsx(zl,{to:"/pair",replace:!0});const r=e.find(s=>s.hostId===t)??e[0];return b.jsx(zl,{to:`/hosts/${encodeURIComponent(r.hostId)}`,replace:!0})}function UO(){const{hostId:e}=Yu(),{pairedHosts:t,setLastHostId:r}=Yi(),s=t.find(l=>l.hostId===e)??null;return A.useEffect(()=>{s&&r(s.hostId)},[s==null?void 0:s.hostId,r]),s?b.jsx(wE,{activeHost:s,children:b.jsxs(lx,{children:[b.jsx(Sr,{index:!0,element:b.jsx(vu,{},e)}),b.jsx(Sr,{path:"tasks",element:b.jsx(vu,{},e)}),b.jsx(Sr,{path:"runs/:taskId",element:b.jsx(vu,{},e)}),b.jsx(Sr,{path:"runs/:taskId/:runId",element:b.jsx(vu,{},e)}),b.jsx(Sr,{path:"pair/setup",element:b.jsx(DO,{})}),b.jsx(Sr,{path:"*",element:b.jsx(zl,{to:".",replace:!0})})]})},`${s.hostId}|${s.clientToken}`):b.jsx(zl,{to:"/",replace:!0})}function BO(){return b.jsxs(Y_,{children:[b.jsx(LO,{}),b.jsxs(lx,{children:[b.jsx(Sr,{path:"/",element:b.jsx(zO,{})}),b.jsx(Sr,{path:"/pair",element:b.jsx(MO,{})}),b.jsx(Sr,{path:"/hosts/:hostId/*",element:b.jsx(UO,{})}),b.jsx(Sr,{path:"*",element:b.jsx(zl,{to:"/",replace:!0})})]})]})}hS.createRoot(document.getElementById("root")).render(b.jsx(A.StrictMode,{children:b.jsx(R_,{children:b.jsx(BO,{})})}));export{Id as W};
|