palmier 0.8.3 → 0.8.4
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 +6 -4
- package/dist/commands/pair.js +2 -0
- package/dist/commands/serve.js +0 -4
- package/dist/platform/index.js +7 -3
- package/dist/platform/macos.d.ts +32 -0
- package/dist/platform/macos.js +287 -0
- package/dist/pwa/assets/index-499vYQvR.js +120 -0
- package/dist/pwa/assets/{index-B0F9mtid.css → index-UaZFu6XL.css} +1 -1
- package/dist/pwa/assets/{web-Z1623me-.js → web-Bp48ONY3.js} +1 -1
- package/dist/pwa/assets/{web-C6lkQj9J.js → web-CyJutAy4.js} +1 -1
- package/dist/pwa/index.html +2 -2
- package/dist/pwa/service-worker.js +1 -1
- package/dist/rpc-handler.js +0 -4
- package/dist/transports/http-transport.js +1 -0
- package/package.json +1 -1
- package/palmier-server/pwa/src/App.css +191 -33
- package/palmier-server/pwa/src/App.tsx +2 -0
- package/palmier-server/pwa/src/components/CapabilityToggles.tsx +288 -0
- package/palmier-server/pwa/src/components/HostMenu.tsx +15 -312
- package/palmier-server/pwa/src/components/SessionComposer.tsx +11 -2
- package/palmier-server/pwa/src/components/SessionsView.tsx +3 -1
- package/palmier-server/pwa/src/components/TaskCard.tsx +1 -1
- package/palmier-server/pwa/src/components/TaskForm.tsx +126 -74
- package/palmier-server/pwa/src/components/TasksView.tsx +3 -1
- package/palmier-server/pwa/src/native/Device.ts +0 -2
- package/palmier-server/pwa/src/pages/Dashboard.tsx +2 -0
- package/palmier-server/pwa/src/pages/PairHost.tsx +3 -1
- package/palmier-server/pwa/src/pages/PairSetup.tsx +70 -0
- package/src/commands/pair.ts +2 -0
- package/src/commands/serve.ts +0 -3
- package/src/platform/index.ts +4 -3
- package/src/platform/macos.ts +310 -0
- package/src/rpc-handler.ts +0 -5
- package/src/transports/http-transport.ts +1 -0
- package/test/macos-plist.test.ts +112 -0
- package/dist/app-registry.d.ts +0 -10
- package/dist/app-registry.js +0 -44
- package/dist/pwa/assets/index-SYs3mcdJ.js +0 -120
- package/src/app-registry.ts +0 -52
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
var Fw=Object.defineProperty;var $w=(e,n,r)=>n in e?Fw(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var C=(e,n,r)=>$w(e,typeof n!="symbol"?n+"":n,r);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function r(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(l){if(l.ep)return;l.ep=!0;const u=r(l);fetch(l.href,u)}})();function Mb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oh={exports:{}},hl={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Fy;function Yw(){if(Fy)return hl;Fy=1;var e=Symbol.for("react.transitional.element"),n=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 hl.Fragment=n,hl.jsx=r,hl.jsxs=r,hl}var $y;function Gw(){return $y||($y=1,oh.exports=Yw()),oh.exports}var v=Gw(),uh={exports:{}},Ve={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Yy;function Vw(){if(Yy)return Ve;Yy=1;var e=Symbol.for("react.transitional.element"),n=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"),m=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function w(R){return R===null||typeof R!="object"?null:(R=b&&R[b]||R["@@iterator"],typeof R=="function"?R:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,U={};function M(R,ee,A){this.props=R,this.context=ee,this.refs=U,this.updater=A||k}M.prototype.isReactComponent={},M.prototype.setState=function(R,ee){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,ee,"setState")},M.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function q(){}q.prototype=M.prototype;function H(R,ee,A){this.props=R,this.context=ee,this.refs=U,this.updater=A||k}var ae=H.prototype=new q;ae.constructor=H,D(ae,M.prototype),ae.isPureReactComponent=!0;var B=Array.isArray;function z(){}var V={H:null,A:null,T:null,S:null},Y=Object.prototype.hasOwnProperty;function $(R,ee,A){var ve=A.ref;return{$$typeof:e,type:R,key:ee,ref:ve!==void 0?ve:null,props:A}}function O(R,ee){return $(R.type,ee,R.props)}function W(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function Z(R){var ee={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(A){return ee[A]})}var fe=/\/+/g;function J(R,ee){return typeof R=="object"&&R!==null&&R.key!=null?Z(""+R.key):ee.toString(36)}function Q(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(z,z):(R.status="pending",R.then(function(ee){R.status==="pending"&&(R.status="fulfilled",R.value=ee)},function(ee){R.status==="pending"&&(R.status="rejected",R.reason=ee)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function P(R,ee,A,ve,Ne){var je=typeof R;(je==="undefined"||je==="boolean")&&(R=null);var Ue=!1;if(R===null)Ue=!0;else switch(je){case"bigint":case"string":case"number":Ue=!0;break;case"object":switch(R.$$typeof){case e:case n:Ue=!0;break;case y:return Ue=R._init,P(Ue(R._payload),ee,A,ve,Ne)}}if(Ue)return Ne=Ne(R),Ue=ve===""?"."+J(R,0):ve,B(Ne)?(A="",Ue!=null&&(A=Ue.replace(fe,"$&/")+"/"),P(Ne,ee,A,"",function(Le){return Le})):Ne!=null&&(W(Ne)&&(Ne=O(Ne,A+(Ne.key==null||R&&R.key===Ne.key?"":(""+Ne.key).replace(fe,"$&/")+"/")+Ue)),ee.push(Ne)),1;Ue=0;var Ye=ve===""?".":ve+":";if(B(R))for(var me=0;me<R.length;me++)ve=R[me],je=Ye+J(ve,me),Ue+=P(ve,ee,A,je,Ne);else if(me=w(R),typeof me=="function")for(R=me.call(R),me=0;!(ve=R.next()).done;)ve=ve.value,je=Ye+J(ve,me++),Ue+=P(ve,ee,A,je,Ne);else if(je==="object"){if(typeof R.then=="function")return P(Q(R),ee,A,ve,Ne);throw ee=String(R),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.")}return Ue}function se(R,ee,A){if(R==null)return R;var ve=[],Ne=0;return P(R,ve,"","",function(je){return ee.call(A,je,Ne++)}),ve}function ye(R){if(R._status===-1){var ee=R._result;ee=ee(),ee.then(function(A){(R._status===0||R._status===-1)&&(R._status=1,R._result=A)},function(A){(R._status===0||R._status===-1)&&(R._status=2,R._result=A)}),R._status===-1&&(R._status=0,R._result=ee)}if(R._status===1)return R._result.default;throw R._result}var _e=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ee=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(ee))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},_={map:se,forEach:function(R,ee,A){se(R,function(){ee.apply(this,arguments)},A)},count:function(R){var ee=0;return se(R,function(){ee++}),ee},toArray:function(R){return se(R,function(ee){return ee})||[]},only:function(R){if(!W(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Ve.Activity=g,Ve.Children=_,Ve.Component=M,Ve.Fragment=r,Ve.Profiler=l,Ve.PureComponent=H,Ve.StrictMode=s,Ve.Suspense=m,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,Ve.__COMPILER_RUNTIME={__proto__:null,c:function(R){return V.H.useMemoCache(R)}},Ve.cache=function(R){return function(){return R.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function(R,ee,A){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var ve=D({},R.props),Ne=R.key;if(ee!=null)for(je in ee.key!==void 0&&(Ne=""+ee.key),ee)!Y.call(ee,je)||je==="key"||je==="__self"||je==="__source"||je==="ref"&&ee.ref===void 0||(ve[je]=ee[je]);var je=arguments.length-2;if(je===1)ve.children=A;else if(1<je){for(var Ue=Array(je),Ye=0;Ye<je;Ye++)Ue[Ye]=arguments[Ye+2];ve.children=Ue}return $(R.type,Ne,ve)},Ve.createContext=function(R){return R={$$typeof:c,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:u,_context:R},R},Ve.createElement=function(R,ee,A){var ve,Ne={},je=null;if(ee!=null)for(ve in ee.key!==void 0&&(je=""+ee.key),ee)Y.call(ee,ve)&&ve!=="key"&&ve!=="__self"&&ve!=="__source"&&(Ne[ve]=ee[ve]);var Ue=arguments.length-2;if(Ue===1)Ne.children=A;else if(1<Ue){for(var Ye=Array(Ue),me=0;me<Ue;me++)Ye[me]=arguments[me+2];Ne.children=Ye}if(R&&R.defaultProps)for(ve in Ue=R.defaultProps,Ue)Ne[ve]===void 0&&(Ne[ve]=Ue[ve]);return $(R,je,Ne)},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(R){return{$$typeof:f,render:R}},Ve.isValidElement=W,Ve.lazy=function(R){return{$$typeof:y,_payload:{_status:-1,_result:R},_init:ye}},Ve.memo=function(R,ee){return{$$typeof:d,type:R,compare:ee===void 0?null:ee}},Ve.startTransition=function(R){var ee=V.T,A={};V.T=A;try{var ve=R(),Ne=V.S;Ne!==null&&Ne(A,ve),typeof ve=="object"&&ve!==null&&typeof ve.then=="function"&&ve.then(z,_e)}catch(je){_e(je)}finally{ee!==null&&A.types!==null&&(ee.types=A.types),V.T=ee}},Ve.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},Ve.use=function(R){return V.H.use(R)},Ve.useActionState=function(R,ee,A){return V.H.useActionState(R,ee,A)},Ve.useCallback=function(R,ee){return V.H.useCallback(R,ee)},Ve.useContext=function(R){return V.H.useContext(R)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(R,ee){return V.H.useDeferredValue(R,ee)},Ve.useEffect=function(R,ee){return V.H.useEffect(R,ee)},Ve.useEffectEvent=function(R){return V.H.useEffectEvent(R)},Ve.useId=function(){return V.H.useId()},Ve.useImperativeHandle=function(R,ee,A){return V.H.useImperativeHandle(R,ee,A)},Ve.useInsertionEffect=function(R,ee){return V.H.useInsertionEffect(R,ee)},Ve.useLayoutEffect=function(R,ee){return V.H.useLayoutEffect(R,ee)},Ve.useMemo=function(R,ee){return V.H.useMemo(R,ee)},Ve.useOptimistic=function(R,ee){return V.H.useOptimistic(R,ee)},Ve.useReducer=function(R,ee,A){return V.H.useReducer(R,ee,A)},Ve.useRef=function(R){return V.H.useRef(R)},Ve.useState=function(R){return V.H.useState(R)},Ve.useSyncExternalStore=function(R,ee,A){return V.H.useSyncExternalStore(R,ee,A)},Ve.useTransition=function(){return V.H.useTransition()},Ve.version="19.2.4",Ve}var Gy;function Ed(){return Gy||(Gy=1,uh.exports=Vw()),uh.exports}var N=Ed(),ch={exports:{}},dl={},fh={exports:{}},hh={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var Vy;function Jw(){return Vy||(Vy=1,(function(e){function n(P,se){var ye=P.length;P.push(se);e:for(;0<ye;){var _e=ye-1>>>1,_=P[_e];if(0<l(_,se))P[_e]=se,P[ye]=_,ye=_e;else break e}}function r(P){return P.length===0?null:P[0]}function s(P){if(P.length===0)return null;var se=P[0],ye=P.pop();if(ye!==se){P[0]=ye;e:for(var _e=0,_=P.length,R=_>>>1;_e<R;){var ee=2*(_e+1)-1,A=P[ee],ve=ee+1,Ne=P[ve];if(0>l(A,ye))ve<_&&0>l(Ne,A)?(P[_e]=Ne,P[ve]=ye,_e=ve):(P[_e]=A,P[ee]=ye,_e=ee);else if(ve<_&&0>l(Ne,ye))P[_e]=Ne,P[ve]=ye,_e=ve;else break e}}return se}function l(P,se){var ye=P.sortIndex-se.sortIndex;return ye!==0?ye:P.id-se.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 m=[],d=[],y=1,g=null,b=3,w=!1,k=!1,D=!1,U=!1,M=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function ae(P){for(var se=r(d);se!==null;){if(se.callback===null)s(d);else if(se.startTime<=P)s(d),se.sortIndex=se.expirationTime,n(m,se);else break;se=r(d)}}function B(P){if(D=!1,ae(P),!k)if(r(m)!==null)k=!0,z||(z=!0,Z());else{var se=r(d);se!==null&&Q(B,se.startTime-P)}}var z=!1,V=-1,Y=5,$=-1;function O(){return U?!0:!(e.unstable_now()-$<Y)}function W(){if(U=!1,z){var P=e.unstable_now();$=P;var se=!0;try{e:{k=!1,D&&(D=!1,q(V),V=-1),w=!0;var ye=b;try{t:{for(ae(P),g=r(m);g!==null&&!(g.expirationTime>P&&O());){var _e=g.callback;if(typeof _e=="function"){g.callback=null,b=g.priorityLevel;var _=_e(g.expirationTime<=P);if(P=e.unstable_now(),typeof _=="function"){g.callback=_,ae(P),se=!0;break t}g===r(m)&&s(m),ae(P)}else s(m);g=r(m)}if(g!==null)se=!0;else{var R=r(d);R!==null&&Q(B,R.startTime-P),se=!1}}break e}finally{g=null,b=ye,w=!1}se=void 0}}finally{se?Z():z=!1}}}var Z;if(typeof H=="function")Z=function(){H(W)};else if(typeof MessageChannel<"u"){var fe=new MessageChannel,J=fe.port2;fe.port1.onmessage=W,Z=function(){J.postMessage(null)}}else Z=function(){M(W,0)};function Q(P,se){V=M(function(){P(e.unstable_now())},se)}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(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(P){switch(b){case 1:case 2:case 3:var se=3;break;default:se=b}var ye=b;b=se;try{return P()}finally{b=ye}},e.unstable_requestPaint=function(){U=!0},e.unstable_runWithPriority=function(P,se){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var ye=b;b=P;try{return se()}finally{b=ye}},e.unstable_scheduleCallback=function(P,se,ye){var _e=e.unstable_now();switch(typeof ye=="object"&&ye!==null?(ye=ye.delay,ye=typeof ye=="number"&&0<ye?_e+ye:_e):ye=_e,P){case 1:var _=-1;break;case 2:_=250;break;case 5:_=1073741823;break;case 4:_=1e4;break;default:_=5e3}return _=ye+_,P={id:y++,callback:se,priorityLevel:P,startTime:ye,expirationTime:_,sortIndex:-1},ye>_e?(P.sortIndex=ye,n(d,P),r(m)===null&&P===r(d)&&(D?(q(V),V=-1):D=!0,Q(B,ye-_e))):(P.sortIndex=_,n(m,P),k||w||(k=!0,z||(z=!0,Z()))),P},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(P){var se=b;return function(){var ye=b;b=se;try{return P.apply(this,arguments)}finally{b=ye}}}})(hh)),hh}var Jy;function Xw(){return Jy||(Jy=1,fh.exports=Jw()),fh.exports}var dh={exports:{}},on={};/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var Xy;function Kw(){if(Xy)return on;Xy=1;var e=Ed();function n(m){var d="https://react.dev/errors/"+m;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)d+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+m+"; visit "+d+" 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(n(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(m,d,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:m,containerInfo:d,implementation:y}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,d){if(m==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return on.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,on.createPortal=function(m,d){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(n(299));return u(m,d,null,y)},on.flushSync=function(m){var d=c.T,y=s.p;try{if(c.T=null,s.p=2,m)return m()}finally{c.T=d,s.p=y,s.d.f()}},on.preconnect=function(m,d){typeof m=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,s.d.C(m,d))},on.prefetchDNS=function(m){typeof m=="string"&&s.d.D(m)},on.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,w=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;y==="style"?s.d.S(m,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:w}):y==="script"&&s.d.X(m,{crossOrigin:g,integrity:b,fetchPriority:w,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},on.preinitModule=function(m,d){if(typeof m=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var y=f(d.as,d.crossOrigin);s.d.M(m,{crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&s.d.M(m)},on.preload=function(m,d){if(typeof m=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin);s.d.L(m,y,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},on.preloadModule=function(m,d){if(typeof m=="string")if(d){var y=f(d.as,d.crossOrigin);s.d.m(m,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else s.d.m(m)},on.requestFormReset=function(m){s.d.r(m)},on.unstable_batchedUpdates=function(m,d){return m(d)},on.useFormState=function(m,d,y){return c.H.useFormState(m,d,y)},on.useFormStatus=function(){return c.H.useHostTransitionStatus()},on.version="19.2.4",on}var Ky;function Db(){if(Ky)return dh.exports;Ky=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(n){console.error(n)}}return e(),dh.exports=Kw(),dh.exports}/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-dom-client.production.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var Qy;function Qw(){if(Qy)return dl;Qy=1;var e=Xw(),n=Ed(),r=Db();function s(t){var i="https://react.dev/errors/"+t;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 #"+t+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var i=t,a=t;if(t.alternate)for(;i.return;)i=i.return;else{t=i;do i=t,(i.flags&4098)!==0&&(a=i.return),t=i.return;while(t)}return i.tag===3?a:null}function c(t){if(t.tag===13){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function f(t){if(t.tag===31){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function m(t){if(u(t)!==t)throw Error(s(188))}function d(t){var i=t.alternate;if(!i){if(i=u(t),i===null)throw Error(s(188));return i!==t?null:t}for(var a=t,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 m(h),t;if(p===o)return m(h),i;p=p.sibling}throw Error(s(188))}if(a.return!==o.return)a=h,o=p;else{for(var x=!1,S=h.child;S;){if(S===a){x=!0,a=h,o=p;break}if(S===o){x=!0,o=h,a=p;break}S=S.sibling}if(!x){for(S=p.child;S;){if(S===a){x=!0,a=p,o=h;break}if(S===o){x=!0,o=p,a=h;break}S=S.sibling}if(!x)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?t:i}function y(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t;for(t=t.child;t!==null;){if(i=y(t),i!==null)return i;t=t.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),H=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function Z(t){return t===null||typeof t!="object"?null:(t=W&&t[W]||t["@@iterator"],typeof t=="function"?t:null)}var fe=Symbol.for("react.client.reference");function J(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===fe?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case D:return"Fragment";case M:return"Profiler";case U:return"StrictMode";case B:return"Suspense";case z:return"SuspenseList";case $:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case H:return t.displayName||"Context";case q:return(t._context.displayName||"Context")+".Consumer";case ae:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case V:return i=t.displayName||null,i!==null?i:J(t.type)||"Memo";case Y:i=t._payload,t=t._init;try{return J(t(i))}catch{}}return null}var Q=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ye={pending:!1,data:null,method:null,action:null},_e=[],_=-1;function R(t){return{current:t}}function ee(t){0>_||(t.current=_e[_],_e[_]=null,_--)}function A(t,i){_++,_e[_]=t.current,t.current=i}var ve=R(null),Ne=R(null),je=R(null),Ue=R(null);function Ye(t,i){switch(A(je,i),A(Ne,t),A(ve,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?hy(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=hy(i),t=dy(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}ee(ve),A(ve,t)}function me(){ee(ve),ee(Ne),ee(je)}function Le(t){t.memoizedState!==null&&A(Ue,t);var i=ve.current,a=dy(i,t.type);i!==a&&(A(Ne,t),A(ve,a))}function be(t){Ne.current===t&&(ee(ve),ee(Ne)),Ue.current===t&&(ee(Ue),ol._currentValue=ye)}var ze,qe;function $e(t){if(ze===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);ze=i&&i[1]||"",qe=-1<a.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+ze+t+qe}var Be=!1;function He(t,i){if(!t||Be)return"";Be=!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 re=le}Reflect.construct(t,[],ge)}else{try{ge.call()}catch(le){re=le}t.call(ge.prototype)}}else{try{throw Error()}catch(le){re=le}(ge=t())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(le){if(le&&re&&typeof le.stack=="string")return[le.stack,re.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(),x=p[0],S=p[1];if(x&&S){var I=x.split(`
|
|
44
|
-
`),ne=S.split(`
|
|
45
|
-
`);for(h=o=0;o<I.length&&!I[o].includes("DetermineComponentFrameRoot");)o++;for(;h<ne.length&&!ne[h].includes("DetermineComponentFrameRoot");)h++;if(o===I.length||h===ne.length)for(o=I.length-1,h=ne.length-1;1<=o&&0<=h&&I[o]!==ne[h];)h--;for(;1<=o&&0<=h;o--,h--)if(I[o]!==ne[h]){if(o!==1||h!==1)do if(o--,h--,0>h||I[o]!==ne[h]){var ue=`
|
|
46
|
-
`+I[o].replace(" at new "," at ");return t.displayName&&ue.includes("<anonymous>")&&(ue=ue.replace("<anonymous>",t.displayName)),ue}while(1<=o&&0<=h);break}}}finally{Be=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?$e(a):""}function Qe(t,i){switch(t.tag){case 26:case 27:case 5:return $e(t.type);case 16:return $e("Lazy");case 13:return t.child!==i&&i!==null?$e("Suspense Fallback"):$e("Suspense");case 19:return $e("SuspenseList");case 0:case 15:return He(t.type,!1);case 11:return He(t.type.render,!1);case 1:return He(t.type,!0);case 31:return $e("Activity");default:return""}}function Et(t){try{var i="",a=null;do i+=Qe(t,a),a=t,t=t.return;while(t);return i}catch(o){return`
|
|
47
|
-
Error generating stack: `+o.message+`
|
|
48
|
-
`+o.stack}}var Ze=Object.prototype.hasOwnProperty,Ht=e.unstable_scheduleCallback,Ge=e.unstable_cancelCallback,fn=e.unstable_shouldYield,rr=e.unstable_requestPaint,bt=e.unstable_now,Pi=e.unstable_getCurrentPriorityLevel,ce=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,oe=e.unstable_NormalPriority,Te=e.unstable_LowPriority,ke=e.unstable_IdlePriority,st=e.log,dt=e.unstable_setDisableYieldValue,at=null,kt=null;function Kt(t){if(typeof st=="function"&&dt(t),kt&&typeof kt.setStrictMode=="function")try{kt.setStrictMode(at,t)}catch{}}var mt=Math.clz32?Math.clz32:ms,In=Math.log,hn=Math.LN2;function ms(t){return t>>>=0,t===0?32:31-(In(t)/hn|0)|0}var ei=256,Tr=262144,ti=4194304;function ir(t){var i=t&42;if(i!==0)return i;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function qi(t,i,a){var o=t.pendingLanes;if(o===0)return 0;var h=0,p=t.suspendedLanes,x=t.pingedLanes;t=t.warmLanes;var S=o&134217727;return S!==0?(o=S&~p,o!==0?h=ir(o):(x&=S,x!==0?h=ir(x):a||(a=S&~t,a!==0&&(h=ir(a))))):(S=o&~p,S!==0?h=ir(S):x!==0?h=ir(x):a||(a=o&~t,a!==0&&(h=ir(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 Hi(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function Sa(t,i){switch(t){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 ps(){var t=ti;return ti<<=1,(ti&62914560)===0&&(ti=4194304),t}function ni(t){for(var i=[],a=0;31>a;a++)i.push(t);return i}function sr(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function ri(t,i,a,o,h,p){var x=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var S=t.entanglements,I=t.expirationTimes,ne=t.hiddenUpdates;for(a=x&~a;0<a;){var ue=31-mt(a),ge=1<<ue;S[ue]=0,I[ue]=-1;var re=ne[ue];if(re!==null)for(ne[ue]=null,ue=0;ue<re.length;ue++){var le=re[ue];le!==null&&(le.lane&=-536870913)}a&=~ge}o!==0&&ii(t,o,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(x&~i))}function ii(t,i,a){t.pendingLanes|=i,t.suspendedLanes&=~i;var o=31-mt(i);t.entangledLanes|=i,t.entanglements[o]=t.entanglements[o]|1073741824|a&261930}function Ii(t,i){var a=t.entangledLanes|=i;for(t=t.entanglements;a;){var o=31-mt(a),h=1<<o;h&i|t[o]&i&&(t[o]|=i),a&=~h}}function si(t,i){var a=i&-i;return a=(a&42)!==0?1:jr(a),(a&(t.suspendedLanes|i))!==0?0:a}function jr(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Fi(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function _a(){var t=se.p;return t!==0?t:(t=window.event,t===void 0?32:zy(t.type))}function Jl(t,i){var a=se.p;try{return se.p=t,i()}finally{se.p=a}}var mr=Math.random().toString(36).slice(2),Ct="__reactFiber$"+mr,Bt="__reactProps$"+mr,An="__reactContainer$"+mr,$i="__reactEvents$"+mr,Ea="__reactListeners$"+mr,Xl="__reactHandles$"+mr,Kl="__reactResources$"+mr,Qt="__reactMarker$"+mr;function gs(t){delete t[Ct],delete t[Bt],delete t[$i],delete t[Ea],delete t[Xl]}function E(t){var i=t[Ct];if(i)return i;for(var a=t.parentNode;a;){if(i=a[An]||a[Ct]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(t=vy(t);t!==null;){if(a=t[Ct])return a;t=vy(t)}return i}t=a,a=t.parentNode}return null}function j(t){if(t=t[Ct]||t[An]){var i=t.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return t}return null}function T(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t.stateNode;throw Error(s(33))}function L(t){var i=t[Kl];return i||(i=t[Kl]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function F(t){t[Qt]=!0}var K=new Set,pe={};function xe(t,i){ie(t,i),ie(t+"Capture",i)}function ie(t,i){for(pe[t]=i,t=0;t<i.length;t++)K.add(i[t])}var de=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]*$"),Re={},We={};function Nt(t){return Ze.call(We,t)?!0:Ze.call(Re,t)?!1:de.test(t)?We[t]=!0:(Re[t]=!0,!1)}function ln(t,i,a){if(Nt(i))if(a===null)t.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(i);return}}t.setAttribute(i,""+a)}}function ar(t,i,a){if(a===null)t.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttribute(i,""+a)}}function Nr(t,i,a,o){if(o===null)t.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(i,a,""+o)}}function Fn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function im(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function z1(t,i,a){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,i);if(!t.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return h.call(this)},set:function(x){a=""+x,p.call(this,x)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function ec(t){if(!t._valueTracker){var i=im(t)?"checked":"value";t._valueTracker=z1(t,i,""+t[i])}}function sm(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var a=i.getValue(),o="";return t&&(o=im(t)?t.checked?"true":"false":t.value),t=o,t!==a?(i.setValue(t),!0):!1}function Ql(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var U1=/[\n"\\]/g;function $n(t){return t.replace(U1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function tc(t,i,a,o,h,p,x,S){t.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?t.type=x:t.removeAttribute("type"),i!=null?x==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+Fn(i)):t.value!==""+Fn(i)&&(t.value=""+Fn(i)):x!=="submit"&&x!=="reset"||t.removeAttribute("value"),i!=null?nc(t,x,Fn(i)):a!=null?nc(t,x,Fn(a)):o!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.name=""+Fn(S):t.removeAttribute("name")}function am(t,i,a,o,h,p,x,S){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),i!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){ec(t);return}a=a!=null?""+Fn(a):"",i=i!=null?""+Fn(i):a,S||i===t.value||(t.value=i),t.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=S?t.checked:!!o,t.defaultChecked=!!o,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(t.name=x),ec(t)}function nc(t,i,a){i==="number"&&Ql(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function ys(t,i,a,o){if(t=t.options,i){i={};for(var h=0;h<a.length;h++)i["$"+a[h]]=!0;for(a=0;a<t.length;a++)h=i.hasOwnProperty("$"+t[a].value),t[a].selected!==h&&(t[a].selected=h),h&&o&&(t[a].defaultSelected=!0)}else{for(a=""+Fn(a),i=null,h=0;h<t.length;h++){if(t[h].value===a){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}i!==null||t[h].disabled||(i=t[h])}i!==null&&(i.selected=!0)}}function lm(t,i,a){if(i!=null&&(i=""+Fn(i),i!==t.value&&(t.value=i),a==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=a!=null?""+Fn(a):""}function om(t,i,a,o){if(i==null){if(o!=null){if(a!=null)throw Error(s(92));if(Q(o)){if(1<o.length)throw Error(s(93));o=o[0]}a=o}a==null&&(a=""),i=a}a=Fn(i),t.defaultValue=a,o=t.textContent,o===a&&o!==""&&o!==null&&(t.value=o),ec(t)}function bs(t,i){if(i){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=i;return}}t.textContent=i}var B1=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 um(t,i,a){var o=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="":o?t.setProperty(i,a):typeof a!="number"||a===0||B1.has(i)?i==="float"?t.cssFloat=a:t[i]=(""+a).trim():t[i]=a+"px"}function cm(t,i,a){if(i!=null&&typeof i!="object")throw Error(s(62));if(t=t.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var h in i)o=i[h],i.hasOwnProperty(h)&&a[h]!==o&&um(t,h,o)}else for(var p in i)i.hasOwnProperty(p)&&um(t,p,i[p])}function rc(t){if(t.indexOf("-")===-1)return!1;switch(t){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 P1=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"]]),q1=/^[\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 Zl(t){return q1.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Or(){}var ic=null;function sc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var xs=null,vs=null;function fm(t){var i=j(t);if(i&&(t=i.stateNode)){var a=t[Bt]||null;e:switch(t=i.stateNode,i.type){case"input":if(tc(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),i=a.name,a.type==="radio"&&i!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+$n(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var o=a[i];if(o!==t&&o.form===t.form){var h=o[Bt]||null;if(!h)throw Error(s(90));tc(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===t.form&&sm(o)}break e;case"textarea":lm(t,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&ys(t,!!a.multiple,i,!1)}}}var ac=!1;function hm(t,i,a){if(ac)return t(i,a);ac=!0;try{var o=t(i);return o}finally{if(ac=!1,(xs!==null||vs!==null)&&(qo(),xs&&(i=xs,t=vs,vs=xs=null,fm(i),t)))for(i=0;i<t.length;i++)fm(t[i])}}function ka(t,i){var a=t.stateNode;if(a===null)return null;var o=a[Bt]||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)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,i,typeof a));return a}var Rr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),lc=!1;if(Rr)try{var Ca={};Object.defineProperty(Ca,"passive",{get:function(){lc=!0}}),window.addEventListener("test",Ca,Ca),window.removeEventListener("test",Ca,Ca)}catch{lc=!1}var ai=null,oc=null,Wl=null;function dm(){if(Wl)return Wl;var t,i=oc,a=i.length,o,h="value"in ai?ai.value:ai.textContent,p=h.length;for(t=0;t<a&&i[t]===h[t];t++);var x=a-t;for(o=1;o<=x&&i[a-o]===h[p-o];o++);return Wl=h.slice(t,1<o?1-o:void 0)}function eo(t){var i=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&i===13&&(t=13)):t=i,t===10&&(t=13),32<=t||t===13?t:0}function to(){return!0}function mm(){return!1}function xn(t){function i(a,o,h,p,x){this._reactName=a,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=x,this.currentTarget=null;for(var S in t)t.hasOwnProperty(S)&&(a=t[S],this[S]=a?a(p):p[S]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?to:mm,this.isPropagationStopped=mm,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=to)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=to)},persist:function(){},isPersistent:to}),i}var Yi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},no=xn(Yi),Aa=g({},Yi,{view:0,detail:0}),H1=xn(Aa),uc,cc,Ta,ro=g({},Aa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ta&&(Ta&&t.type==="mousemove"?(uc=t.screenX-Ta.screenX,cc=t.screenY-Ta.screenY):cc=uc=0,Ta=t),uc)},movementY:function(t){return"movementY"in t?t.movementY:cc}}),pm=xn(ro),I1=g({},ro,{dataTransfer:0}),F1=xn(I1),$1=g({},Aa,{relatedTarget:0}),fc=xn($1),Y1=g({},Yi,{animationName:0,elapsedTime:0,pseudoElement:0}),G1=xn(Y1),V1=g({},Yi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),J1=xn(V1),X1=g({},Yi,{data:0}),gm=xn(X1),K1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Q1={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"},Z1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function W1(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=Z1[t])?!!i[t]:!1}function hc(){return W1}var ev=g({},Aa,{key:function(t){if(t.key){var i=K1[t.key]||t.key;if(i!=="Unidentified")return i}return t.type==="keypress"?(t=eo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Q1[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hc,charCode:function(t){return t.type==="keypress"?eo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?eo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),tv=xn(ev),nv=g({},ro,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ym=xn(nv),rv=g({},Aa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hc}),iv=xn(rv),sv=g({},Yi,{propertyName:0,elapsedTime:0,pseudoElement:0}),av=xn(sv),lv=g({},ro,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),ov=xn(lv),uv=g({},Yi,{newState:0,oldState:0}),cv=xn(uv),fv=[9,13,27,32],dc=Rr&&"CompositionEvent"in window,ja=null;Rr&&"documentMode"in document&&(ja=document.documentMode);var hv=Rr&&"TextEvent"in window&&!ja,bm=Rr&&(!dc||ja&&8<ja&&11>=ja),xm=" ",vm=!1;function wm(t,i){switch(t){case"keyup":return fv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ws=!1;function dv(t,i){switch(t){case"compositionend":return Sm(i);case"keypress":return i.which!==32?null:(vm=!0,xm);case"textInput":return t=i.data,t===xm&&vm?null:t;default:return null}}function mv(t,i){if(ws)return t==="compositionend"||!dc&&wm(t,i)?(t=dm(),Wl=oc=ai=null,ws=!1,t):null;switch(t){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 bm&&i.locale!=="ko"?null:i.data;default:return null}}var pv={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 _m(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!pv[t.type]:i==="textarea"}function Em(t,i,a,o){xs?vs?vs.push(o):vs=[o]:xs=o,i=Vo(i,"onChange"),0<i.length&&(a=new no("onChange","change",null,a,o),t.push({event:a,listeners:i}))}var Na=null,Oa=null;function gv(t){ay(t,0)}function io(t){var i=T(t);if(sm(i))return t}function km(t,i){if(t==="change")return i}var Cm=!1;if(Rr){var mc;if(Rr){var pc="oninput"in document;if(!pc){var Am=document.createElement("div");Am.setAttribute("oninput","return;"),pc=typeof Am.oninput=="function"}mc=pc}else mc=!1;Cm=mc&&(!document.documentMode||9<document.documentMode)}function Tm(){Na&&(Na.detachEvent("onpropertychange",jm),Oa=Na=null)}function jm(t){if(t.propertyName==="value"&&io(Oa)){var i=[];Em(i,Oa,t,sc(t)),hm(gv,i)}}function yv(t,i,a){t==="focusin"?(Tm(),Na=i,Oa=a,Na.attachEvent("onpropertychange",jm)):t==="focusout"&&Tm()}function bv(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return io(Oa)}function xv(t,i){if(t==="click")return io(i)}function vv(t,i){if(t==="input"||t==="change")return io(i)}function wv(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var Tn=typeof Object.is=="function"?Object.is:wv;function Ra(t,i){if(Tn(t,i))return!0;if(typeof t!="object"||t===null||typeof i!="object"||i===null)return!1;var a=Object.keys(t),o=Object.keys(i);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var h=a[o];if(!Ze.call(i,h)||!Tn(t[h],i[h]))return!1}return!0}function Nm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Om(t,i){var a=Nm(t);t=0;for(var o;a;){if(a.nodeType===3){if(o=t+a.textContent.length,t<=i&&o>=i)return{node:a,offset:i-t};t=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Nm(a)}}function Rm(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Rm(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Mm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=Ql(t.document);i instanceof t.HTMLIFrameElement;){try{var a=typeof i.contentWindow.location.href=="string"}catch{a=!1}if(a)t=i.contentWindow;else break;i=Ql(t.document)}return i}function gc(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}var Sv=Rr&&"documentMode"in document&&11>=document.documentMode,Ss=null,yc=null,Ma=null,bc=!1;function Dm(t,i,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;bc||Ss==null||Ss!==Ql(o)||(o=Ss,"selectionStart"in o&&gc(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}),Ma&&Ra(Ma,o)||(Ma=o,o=Vo(yc,"onSelect"),0<o.length&&(i=new no("onSelect","select",null,i,a),t.push({event:i,listeners:o}),i.target=Ss)))}function Gi(t,i){var a={};return a[t.toLowerCase()]=i.toLowerCase(),a["Webkit"+t]="webkit"+i,a["Moz"+t]="moz"+i,a}var _s={animationend:Gi("Animation","AnimationEnd"),animationiteration:Gi("Animation","AnimationIteration"),animationstart:Gi("Animation","AnimationStart"),transitionrun:Gi("Transition","TransitionRun"),transitionstart:Gi("Transition","TransitionStart"),transitioncancel:Gi("Transition","TransitionCancel"),transitionend:Gi("Transition","TransitionEnd")},xc={},Lm={};Rr&&(Lm=document.createElement("div").style,"AnimationEvent"in window||(delete _s.animationend.animation,delete _s.animationiteration.animation,delete _s.animationstart.animation),"TransitionEvent"in window||delete _s.transitionend.transition);function Vi(t){if(xc[t])return xc[t];if(!_s[t])return t;var i=_s[t],a;for(a in i)if(i.hasOwnProperty(a)&&a in Lm)return xc[t]=i[a];return t}var zm=Vi("animationend"),Um=Vi("animationiteration"),Bm=Vi("animationstart"),_v=Vi("transitionrun"),Ev=Vi("transitionstart"),kv=Vi("transitioncancel"),Pm=Vi("transitionend"),qm=new Map,vc="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(" ");vc.push("scrollEnd");function lr(t,i){qm.set(t,i),xe(i,[t])}var so=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Yn=[],Es=0,wc=0;function ao(){for(var t=Es,i=wc=Es=0;i<t;){var a=Yn[i];Yn[i++]=null;var o=Yn[i];Yn[i++]=null;var h=Yn[i];Yn[i++]=null;var p=Yn[i];if(Yn[i++]=null,o!==null&&h!==null){var x=o.pending;x===null?h.next=h:(h.next=x.next,x.next=h),o.pending=h}p!==0&&Hm(a,h,p)}}function lo(t,i,a,o){Yn[Es++]=t,Yn[Es++]=i,Yn[Es++]=a,Yn[Es++]=o,wc|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function Sc(t,i,a,o){return lo(t,i,a,o),oo(t)}function Ji(t,i){return lo(t,null,null,i),oo(t)}function Hm(t,i,a){t.lanes|=a;var o=t.alternate;o!==null&&(o.lanes|=a);for(var h=!1,p=t.return;p!==null;)p.childLanes|=a,o=p.alternate,o!==null&&(o.childLanes|=a),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(h=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,h&&i!==null&&(h=31-mt(a),t=p.hiddenUpdates,o=t[h],o===null?t[h]=[i]:o.push(i),i.lane=a|536870912),p):null}function oo(t){if(50<tl)throw tl=0,Rf=null,Error(s(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var ks={};function Cv(t,i,a,o){this.tag=t,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 jn(t,i,a,o){return new Cv(t,i,a,o)}function _c(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Mr(t,i){var a=t.alternate;return a===null?(a=jn(t.tag,i,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=i,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,i=t.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function Im(t,i){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=i,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,i=a.dependencies,t.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),t}function uo(t,i,a,o,h,p){var x=0;if(o=t,typeof t=="function")_c(t)&&(x=1);else if(typeof t=="string")x=Ow(t,a,ve.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case $:return t=jn(31,a,i,h),t.elementType=$,t.lanes=p,t;case D:return Xi(a.children,h,p,i);case U:x=8,h|=24;break;case M:return t=jn(12,a,i,h|2),t.elementType=M,t.lanes=p,t;case B:return t=jn(13,a,i,h),t.elementType=B,t.lanes=p,t;case z:return t=jn(19,a,i,h),t.elementType=z,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case H:x=10;break e;case q:x=9;break e;case ae:x=11;break e;case V:x=14;break e;case Y:x=16,o=null;break e}x=29,a=Error(s(130,t===null?"null":typeof t,"")),o=null}return i=jn(x,a,i,h),i.elementType=t,i.type=o,i.lanes=p,i}function Xi(t,i,a,o){return t=jn(7,t,o,i),t.lanes=a,t}function Ec(t,i,a){return t=jn(6,t,null,i),t.lanes=a,t}function Fm(t){var i=jn(18,null,null,0);return i.stateNode=t,i}function kc(t,i,a){return i=jn(4,t.children!==null?t.children:[],t.key,i),i.lanes=a,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var $m=new WeakMap;function Gn(t,i){if(typeof t=="object"&&t!==null){var a=$m.get(t);return a!==void 0?a:(i={value:t,source:i,stack:Et(i)},$m.set(t,i),i)}return{value:t,source:i,stack:Et(i)}}var Cs=[],As=0,co=null,Da=0,Vn=[],Jn=0,li=null,pr=1,gr="";function Dr(t,i){Cs[As++]=Da,Cs[As++]=co,co=t,Da=i}function Ym(t,i,a){Vn[Jn++]=pr,Vn[Jn++]=gr,Vn[Jn++]=li,li=t;var o=pr;t=gr;var h=32-mt(o)-1;o&=~(1<<h),a+=1;var p=32-mt(i)+h;if(30<p){var x=h-h%5;p=(o&(1<<x)-1).toString(32),o>>=x,h-=x,pr=1<<32-mt(i)+h|a<<h|o,gr=p+t}else pr=1<<p|a<<h|o,gr=t}function Cc(t){t.return!==null&&(Dr(t,1),Ym(t,1,0))}function Ac(t){for(;t===co;)co=Cs[--As],Cs[As]=null,Da=Cs[--As],Cs[As]=null;for(;t===li;)li=Vn[--Jn],Vn[Jn]=null,gr=Vn[--Jn],Vn[Jn]=null,pr=Vn[--Jn],Vn[Jn]=null}function Gm(t,i){Vn[Jn++]=pr,Vn[Jn++]=gr,Vn[Jn++]=li,pr=i.id,gr=i.overflow,li=t}var nn=null,Ot=null,lt=!1,oi=null,Xn=!1,Tc=Error(s(519));function ui(t){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw La(Gn(i,t)),Tc}function Vm(t){var i=t.stateNode,a=t.type,o=t.memoizedProps;switch(i[Ct]=t,i[Bt]=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<rl.length;a++)tt(rl[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),am(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),om(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||cy(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=Or),i=!0):i=!1,i||ui(t,!0)}function Jm(t){for(nn=t.return;nn;)switch(nn.tag){case 5:case 31:case 13:Xn=!1;return;case 27:case 3:Xn=!0;return;default:nn=nn.return}}function Ts(t){if(t!==nn)return!1;if(!lt)return Jm(t),lt=!0,!1;var i=t.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Vf(t.type,t.memoizedProps)),a=!a),a&&Ot&&ui(t),Jm(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));Ot=xy(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));Ot=xy(t)}else i===27?(i=Ot,_i(t.type)?(t=Zf,Zf=null,Ot=t):Ot=i):Ot=nn?Qn(t.stateNode.nextSibling):null;return!0}function Ki(){Ot=nn=null,lt=!1}function jc(){var t=oi;return t!==null&&(_n===null?_n=t:_n.push.apply(_n,t),oi=null),t}function La(t){oi===null?oi=[t]:oi.push(t)}var Nc=R(null),Qi=null,Lr=null;function ci(t,i,a){A(Nc,i._currentValue),i._currentValue=a}function zr(t){t._currentValue=Nc.current,ee(Nc)}function Oc(t,i,a){for(;t!==null;){var o=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),t===a)break;t=t.return}}function Rc(t,i,a,o){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var p=h.dependencies;if(p!==null){var x=h.child;p=p.firstContext;e:for(;p!==null;){var S=p;p=h;for(var I=0;I<i.length;I++)if(S.context===i[I]){p.lanes|=a,S=p.alternate,S!==null&&(S.lanes|=a),Oc(p.return,a,t),o||(x=null);break e}p=S.next}}else if(h.tag===18){if(x=h.return,x===null)throw Error(s(341));x.lanes|=a,p=x.alternate,p!==null&&(p.lanes|=a),Oc(x,a,t),x=null}else x=h.child;if(x!==null)x.return=h;else for(x=h;x!==null;){if(x===t){x=null;break}if(h=x.sibling,h!==null){h.return=x.return,x=h;break}x=x.return}h=x}}function js(t,i,a,o){t=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 x=h.alternate;if(x===null)throw Error(s(387));if(x=x.memoizedProps,x!==null){var S=h.type;Tn(h.pendingProps.value,x.value)||(t!==null?t.push(S):t=[S])}}else if(h===Ue.current){if(x=h.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(ol):t=[ol])}h=h.return}t!==null&&Rc(i,t,a,o),i.flags|=262144}function fo(t){for(t=t.firstContext;t!==null;){if(!Tn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Zi(t){Qi=t,Lr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function rn(t){return Xm(Qi,t)}function ho(t,i){return Qi===null&&Zi(t),Xm(t,i)}function Xm(t,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},Lr===null){if(t===null)throw Error(s(308));Lr=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else Lr=Lr.next=i;return a}var Av=typeof AbortController<"u"?AbortController:function(){var t=[],i=this.signal={aborted:!1,addEventListener:function(a,o){t.push(o)}};this.abort=function(){i.aborted=!0,t.forEach(function(a){return a()})}},Tv=e.unstable_scheduleCallback,jv=e.unstable_NormalPriority,Yt={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mc(){return{controller:new Av,data:new Map,refCount:0}}function za(t){t.refCount--,t.refCount===0&&Tv(jv,function(){t.controller.abort()})}var Ua=null,Dc=0,Ns=0,Os=null;function Nv(t,i){if(Ua===null){var a=Ua=[];Dc=0,Ns=Bf(),Os={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Dc++,i.then(Km,Km),i}function Km(){if(--Dc===0&&Ua!==null){Os!==null&&(Os.status="fulfilled");var t=Ua;Ua=null,Ns=0,Os=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function Ov(t,i){var a=[],o={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return t.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 Qm=P.S;P.S=function(t,i){Dg=bt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Nv(t,i),Qm!==null&&Qm(t,i)};var Wi=R(null);function Lc(){var t=Wi.current;return t!==null?t:At.pooledCache}function mo(t,i){i===null?A(Wi,Wi.current):A(Wi,i.pool)}function Zm(){var t=Lc();return t===null?null:{parent:Yt._currentValue,pool:t}}var Rs=Error(s(460)),zc=Error(s(474)),po=Error(s(542)),go={then:function(){}};function Wm(t){return t=t.status,t==="fulfilled"||t==="rejected"}function ep(t,i,a){switch(a=t[a],a===void 0?t.push(i):a!==i&&(i.then(Or,Or),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,np(t),t;default:if(typeof i.status=="string")i.then(Or,Or);else{if(t=At,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=i,t.status="pending",t.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 t=i.reason,np(t),t}throw ts=i,Rs}}function es(t){try{var i=t._init;return i(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ts=a,Rs):a}}var ts=null;function tp(){if(ts===null)throw Error(s(459));var t=ts;return ts=null,t}function np(t){if(t===Rs||t===po)throw Error(s(483))}var Ms=null,Ba=0;function yo(t){var i=Ba;return Ba+=1,Ms===null&&(Ms=[]),ep(Ms,t,i)}function Pa(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function bo(t,i){throw i.$$typeof===b?Error(s(525)):(t=Object.prototype.toString.call(i),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)))}function rp(t){function i(X,G){if(t){var te=X.deletions;te===null?(X.deletions=[G],X.flags|=16):te.push(G)}}function a(X,G){if(!t)return null;for(;G!==null;)i(X,G),G=G.sibling;return null}function o(X){for(var G=new Map;X!==null;)X.key!==null?G.set(X.key,X):G.set(X.index,X),X=X.sibling;return G}function h(X,G){return X=Mr(X,G),X.index=0,X.sibling=null,X}function p(X,G,te){return X.index=te,t?(te=X.alternate,te!==null?(te=te.index,te<G?(X.flags|=67108866,G):te):(X.flags|=67108866,G)):(X.flags|=1048576,G)}function x(X){return t&&X.alternate===null&&(X.flags|=67108866),X}function S(X,G,te,he){return G===null||G.tag!==6?(G=Ec(te,X.mode,he),G.return=X,G):(G=h(G,te),G.return=X,G)}function I(X,G,te,he){var Pe=te.type;return Pe===D?ue(X,G,te.props.children,he,te.key):G!==null&&(G.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===Y&&es(Pe)===G.type)?(G=h(G,te.props),Pa(G,te),G.return=X,G):(G=uo(te.type,te.key,te.props,null,X.mode,he),Pa(G,te),G.return=X,G)}function ne(X,G,te,he){return G===null||G.tag!==4||G.stateNode.containerInfo!==te.containerInfo||G.stateNode.implementation!==te.implementation?(G=kc(te,X.mode,he),G.return=X,G):(G=h(G,te.children||[]),G.return=X,G)}function ue(X,G,te,he,Pe){return G===null||G.tag!==7?(G=Xi(te,X.mode,he,Pe),G.return=X,G):(G=h(G,te),G.return=X,G)}function ge(X,G,te){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=Ec(""+G,X.mode,te),G.return=X,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return te=uo(G.type,G.key,G.props,null,X.mode,te),Pa(te,G),te.return=X,te;case k:return G=kc(G,X.mode,te),G.return=X,G;case Y:return G=es(G),ge(X,G,te)}if(Q(G)||Z(G))return G=Xi(G,X.mode,te,null),G.return=X,G;if(typeof G.then=="function")return ge(X,yo(G),te);if(G.$$typeof===H)return ge(X,ho(X,G),te);bo(X,G)}return null}function re(X,G,te,he){var Pe=G!==null?G.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Pe!==null?null:S(X,G,""+te,he);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case w:return te.key===Pe?I(X,G,te,he):null;case k:return te.key===Pe?ne(X,G,te,he):null;case Y:return te=es(te),re(X,G,te,he)}if(Q(te)||Z(te))return Pe!==null?null:ue(X,G,te,he,null);if(typeof te.then=="function")return re(X,G,yo(te),he);if(te.$$typeof===H)return re(X,G,ho(X,te),he);bo(X,te)}return null}function le(X,G,te,he,Pe){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return X=X.get(te)||null,S(G,X,""+he,Pe);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case w:return X=X.get(he.key===null?te:he.key)||null,I(G,X,he,Pe);case k:return X=X.get(he.key===null?te:he.key)||null,ne(G,X,he,Pe);case Y:return he=es(he),le(X,G,te,he,Pe)}if(Q(he)||Z(he))return X=X.get(te)||null,ue(G,X,he,Pe,null);if(typeof he.then=="function")return le(X,G,te,yo(he),Pe);if(he.$$typeof===H)return le(X,G,te,ho(G,he),Pe);bo(G,he)}return null}function Me(X,G,te,he){for(var Pe=null,ct=null,De=G,Xe=G=0,it=null;De!==null&&Xe<te.length;Xe++){De.index>Xe?(it=De,De=null):it=De.sibling;var ft=re(X,De,te[Xe],he);if(ft===null){De===null&&(De=it);break}t&&De&&ft.alternate===null&&i(X,De),G=p(ft,G,Xe),ct===null?Pe=ft:ct.sibling=ft,ct=ft,De=it}if(Xe===te.length)return a(X,De),lt&&Dr(X,Xe),Pe;if(De===null){for(;Xe<te.length;Xe++)De=ge(X,te[Xe],he),De!==null&&(G=p(De,G,Xe),ct===null?Pe=De:ct.sibling=De,ct=De);return lt&&Dr(X,Xe),Pe}for(De=o(De);Xe<te.length;Xe++)it=le(De,X,Xe,te[Xe],he),it!==null&&(t&&it.alternate!==null&&De.delete(it.key===null?Xe:it.key),G=p(it,G,Xe),ct===null?Pe=it:ct.sibling=it,ct=it);return t&&De.forEach(function(Ti){return i(X,Ti)}),lt&&Dr(X,Xe),Pe}function Fe(X,G,te,he){if(te==null)throw Error(s(151));for(var Pe=null,ct=null,De=G,Xe=G=0,it=null,ft=te.next();De!==null&&!ft.done;Xe++,ft=te.next()){De.index>Xe?(it=De,De=null):it=De.sibling;var Ti=re(X,De,ft.value,he);if(Ti===null){De===null&&(De=it);break}t&&De&&Ti.alternate===null&&i(X,De),G=p(Ti,G,Xe),ct===null?Pe=Ti:ct.sibling=Ti,ct=Ti,De=it}if(ft.done)return a(X,De),lt&&Dr(X,Xe),Pe;if(De===null){for(;!ft.done;Xe++,ft=te.next())ft=ge(X,ft.value,he),ft!==null&&(G=p(ft,G,Xe),ct===null?Pe=ft:ct.sibling=ft,ct=ft);return lt&&Dr(X,Xe),Pe}for(De=o(De);!ft.done;Xe++,ft=te.next())ft=le(De,X,Xe,ft.value,he),ft!==null&&(t&&ft.alternate!==null&&De.delete(ft.key===null?Xe:ft.key),G=p(ft,G,Xe),ct===null?Pe=ft:ct.sibling=ft,ct=ft);return t&&De.forEach(function(Iw){return i(X,Iw)}),lt&&Dr(X,Xe),Pe}function wt(X,G,te,he){if(typeof te=="object"&&te!==null&&te.type===D&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case w:e:{for(var Pe=te.key;G!==null;){if(G.key===Pe){if(Pe=te.type,Pe===D){if(G.tag===7){a(X,G.sibling),he=h(G,te.props.children),he.return=X,X=he;break e}}else if(G.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===Y&&es(Pe)===G.type){a(X,G.sibling),he=h(G,te.props),Pa(he,te),he.return=X,X=he;break e}a(X,G);break}else i(X,G);G=G.sibling}te.type===D?(he=Xi(te.props.children,X.mode,he,te.key),he.return=X,X=he):(he=uo(te.type,te.key,te.props,null,X.mode,he),Pa(he,te),he.return=X,X=he)}return x(X);case k:e:{for(Pe=te.key;G!==null;){if(G.key===Pe)if(G.tag===4&&G.stateNode.containerInfo===te.containerInfo&&G.stateNode.implementation===te.implementation){a(X,G.sibling),he=h(G,te.children||[]),he.return=X,X=he;break e}else{a(X,G);break}else i(X,G);G=G.sibling}he=kc(te,X.mode,he),he.return=X,X=he}return x(X);case Y:return te=es(te),wt(X,G,te,he)}if(Q(te))return Me(X,G,te,he);if(Z(te)){if(Pe=Z(te),typeof Pe!="function")throw Error(s(150));return te=Pe.call(te),Fe(X,G,te,he)}if(typeof te.then=="function")return wt(X,G,yo(te),he);if(te.$$typeof===H)return wt(X,G,ho(X,te),he);bo(X,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,G!==null&&G.tag===6?(a(X,G.sibling),he=h(G,te),he.return=X,X=he):(a(X,G),he=Ec(te,X.mode,he),he.return=X,X=he),x(X)):a(X,G)}return function(X,G,te,he){try{Ba=0;var Pe=wt(X,G,te,he);return Ms=null,Pe}catch(De){if(De===Rs||De===po)throw De;var ct=jn(29,De,null,X.mode);return ct.lanes=he,ct.return=X,ct}finally{}}}var ns=rp(!0),ip=rp(!1),fi=!1;function Uc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bc(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function hi(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function di(t,i,a){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(ht&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=oo(t),Hm(t,null,a),i}return lo(t,o,i,a),oo(t)}function qa(t,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var o=i.lanes;o&=t.pendingLanes,a|=o,i.lanes=a,Ii(t,a)}}function Pc(t,i){var a=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=x:p=p.next=x,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},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=i:t.next=i,a.lastBaseUpdate=i}var qc=!1;function Ha(){if(qc){var t=Os;if(t!==null)throw t}}function Ia(t,i,a,o){qc=!1;var h=t.updateQueue;fi=!1;var p=h.firstBaseUpdate,x=h.lastBaseUpdate,S=h.shared.pending;if(S!==null){h.shared.pending=null;var I=S,ne=I.next;I.next=null,x===null?p=ne:x.next=ne,x=I;var ue=t.alternate;ue!==null&&(ue=ue.updateQueue,S=ue.lastBaseUpdate,S!==x&&(S===null?ue.firstBaseUpdate=ne:S.next=ne,ue.lastBaseUpdate=I))}if(p!==null){var ge=h.baseState;x=0,ue=ne=I=null,S=p;do{var re=S.lane&-536870913,le=re!==S.lane;if(le?(rt&re)===re:(o&re)===re){re!==0&&re===Ns&&(qc=!0),ue!==null&&(ue=ue.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Me=t,Fe=S;re=i;var wt=a;switch(Fe.tag){case 1:if(Me=Fe.payload,typeof Me=="function"){ge=Me.call(wt,ge,re);break e}ge=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=Fe.payload,re=typeof Me=="function"?Me.call(wt,ge,re):Me,re==null)break e;ge=g({},ge,re);break e;case 2:fi=!0}}re=S.callback,re!==null&&(t.flags|=64,le&&(t.flags|=8192),le=h.callbacks,le===null?h.callbacks=[re]:le.push(re))}else le={lane:re,tag:S.tag,payload:S.payload,callback:S.callback,next:null},ue===null?(ne=ue=le,I=ge):ue=ue.next=le,x|=re;if(S=S.next,S===null){if(S=h.shared.pending,S===null)break;le=S,S=le.next,le.next=null,h.lastBaseUpdate=le,h.shared.pending=null}}while(!0);ue===null&&(I=ge),h.baseState=I,h.firstBaseUpdate=ne,h.lastBaseUpdate=ue,p===null&&(h.shared.lanes=0),bi|=x,t.lanes=x,t.memoizedState=ge}}function sp(t,i){if(typeof t!="function")throw Error(s(191,t));t.call(i)}function ap(t,i){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)sp(a[t],i)}var Ds=R(null),xo=R(0);function lp(t,i){t=Yr,A(xo,t),A(Ds,i),Yr=t|i.baseLanes}function Hc(){A(xo,Yr),A(Ds,Ds.current)}function Ic(){Yr=xo.current,ee(Ds),ee(xo)}var Nn=R(null),Kn=null;function mi(t){var i=t.alternate;A(It,It.current&1),A(Nn,t),Kn===null&&(i===null||Ds.current!==null||i.memoizedState!==null)&&(Kn=t)}function Fc(t){A(It,It.current),A(Nn,t),Kn===null&&(Kn=t)}function op(t){t.tag===22?(A(It,It.current),A(Nn,t),Kn===null&&(Kn=t)):pi()}function pi(){A(It,It.current),A(Nn,Nn.current)}function On(t){ee(Nn),Kn===t&&(Kn=null),ee(It)}var It=R(0);function vo(t){for(var i=t;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Kf(a)||Qf(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===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Ur=0,Je=null,xt=null,Gt=null,wo=!1,Ls=!1,rs=!1,So=0,Fa=0,zs=null,Rv=0;function Pt(){throw Error(s(321))}function $c(t,i){if(i===null)return!1;for(var a=0;a<i.length&&a<t.length;a++)if(!Tn(t[a],i[a]))return!1;return!0}function Yc(t,i,a,o,h,p){return Ur=p,Je=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,P.H=t===null||t.memoizedState===null?Yp:lf,rs=!1,p=a(o,h),rs=!1,Ls&&(p=cp(i,a,o,h)),up(t),p}function up(t){P.H=Ga;var i=xt!==null&&xt.next!==null;if(Ur=0,Gt=xt=Je=null,wo=!1,Fa=0,zs=null,i)throw Error(s(300));t===null||Vt||(t=t.dependencies,t!==null&&fo(t)&&(Vt=!0))}function cp(t,i,a,o){Je=t;var h=0;do{if(Ls&&(zs=null),Fa=0,Ls=!1,25<=h)throw Error(s(301));if(h+=1,Gt=xt=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}P.H=Gp,p=i(a,o)}while(Ls);return p}function Mv(){var t=P.H,i=t.useState()[0];return i=typeof i.then=="function"?$a(i):i,t=t.useState()[0],(xt!==null?xt.memoizedState:null)!==t&&(Je.flags|=1024),i}function Gc(){var t=So!==0;return So=0,t}function Vc(t,i,a){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~a}function Jc(t){if(wo){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}wo=!1}Ur=0,Gt=xt=Je=null,Ls=!1,Fa=So=0,zs=null}function dn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gt===null?Je.memoizedState=Gt=t:Gt=Gt.next=t,Gt}function Ft(){if(xt===null){var t=Je.alternate;t=t!==null?t.memoizedState:null}else t=xt.next;var i=Gt===null?Je.memoizedState:Gt.next;if(i!==null)Gt=i,xt=t;else{if(t===null)throw Je.alternate===null?Error(s(467)):Error(s(310));xt=t,t={memoizedState:xt.memoizedState,baseState:xt.baseState,baseQueue:xt.baseQueue,queue:xt.queue,next:null},Gt===null?Je.memoizedState=Gt=t:Gt=Gt.next=t}return Gt}function _o(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $a(t){var i=Fa;return Fa+=1,zs===null&&(zs=[]),t=ep(zs,t,i),i=Je,(Gt===null?i.memoizedState:Gt.next)===null&&(i=i.alternate,P.H=i===null||i.memoizedState===null?Yp:lf),t}function Eo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return $a(t);if(t.$$typeof===H)return rn(t)}throw Error(s(438,String(t)))}function Xc(t){var i=null,a=Je.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var o=Je.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=_o(),Je.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(t),o=0;o<t;o++)a[o]=O;return i.index++,a}function Br(t,i){return typeof i=="function"?i(t):i}function ko(t){var i=Ft();return Kc(i,xt,t)}function Kc(t,i,a){var o=t.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=a;var h=t.baseQueue,p=o.pending;if(p!==null){if(h!==null){var x=h.next;h.next=p.next,p.next=x}i.baseQueue=h=p,o.pending=null}if(p=t.baseState,h===null)t.memoizedState=p;else{i=h.next;var S=x=null,I=null,ne=i,ue=!1;do{var ge=ne.lane&-536870913;if(ge!==ne.lane?(rt&ge)===ge:(Ur&ge)===ge){var re=ne.revertLane;if(re===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),ge===Ns&&(ue=!0);else if((Ur&re)===re){ne=ne.next,re===Ns&&(ue=!0);continue}else ge={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},I===null?(S=I=ge,x=p):I=I.next=ge,Je.lanes|=re,bi|=re;ge=ne.action,rs&&a(p,ge),p=ne.hasEagerState?ne.eagerState:a(p,ge)}else re={lane:ge,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},I===null?(S=I=re,x=p):I=I.next=re,Je.lanes|=ge,bi|=ge;ne=ne.next}while(ne!==null&&ne!==i);if(I===null?x=p:I.next=S,!Tn(p,t.memoizedState)&&(Vt=!0,ue&&(a=Os,a!==null)))throw a;t.memoizedState=p,t.baseState=x,t.baseQueue=I,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Qc(t){var i=Ft(),a=i.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var o=a.dispatch,h=a.pending,p=i.memoizedState;if(h!==null){a.pending=null;var x=h=h.next;do p=t(p,x.action),x=x.next;while(x!==h);Tn(p,i.memoizedState)||(Vt=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,o]}function fp(t,i,a){var o=Je,h=Ft(),p=lt;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var x=!Tn((xt||h).memoizedState,a);if(x&&(h.memoizedState=a,Vt=!0),h=h.queue,ef(mp.bind(null,o,h,t),[t]),h.getSnapshot!==i||x||Gt!==null&&Gt.memoizedState.tag&1){if(o.flags|=2048,Us(9,{destroy:void 0},dp.bind(null,o,h,a,i),null),At===null)throw Error(s(349));p||(Ur&127)!==0||hp(o,i,a)}return a}function hp(t,i,a){t.flags|=16384,t={getSnapshot:i,value:a},i=Je.updateQueue,i===null?(i=_o(),Je.updateQueue=i,i.stores=[t]):(a=i.stores,a===null?i.stores=[t]:a.push(t))}function dp(t,i,a,o){i.value=a,i.getSnapshot=o,pp(i)&&gp(t)}function mp(t,i,a){return a(function(){pp(i)&&gp(t)})}function pp(t){var i=t.getSnapshot;t=t.value;try{var a=i();return!Tn(t,a)}catch{return!0}}function gp(t){var i=Ji(t,2);i!==null&&En(i,t,2)}function Zc(t){var i=dn();if(typeof t=="function"){var a=t;if(t=a(),rs){Kt(!0);try{a()}finally{Kt(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Br,lastRenderedState:t},i}function yp(t,i,a,o){return t.baseState=a,Kc(t,xt,typeof o=="function"?o:Br)}function Dv(t,i,a,o,h){if(To(t))throw Error(s(485));if(t=i.action,t!==null){var p={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){p.listeners.push(x)}};P.T!==null?a(!0):p.isTransition=!1,o(p),a=i.pending,a===null?(p.next=i.pending=p,bp(i,p)):(p.next=a.next,i.pending=a.next=p)}}function bp(t,i){var a=i.action,o=i.payload,h=t.state;if(i.isTransition){var p=P.T,x={};P.T=x;try{var S=a(h,o),I=P.S;I!==null&&I(x,S),xp(t,i,S)}catch(ne){Wc(t,i,ne)}finally{p!==null&&x.types!==null&&(p.types=x.types),P.T=p}}else try{p=a(h,o),xp(t,i,p)}catch(ne){Wc(t,i,ne)}}function xp(t,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){vp(t,i,o)},function(o){return Wc(t,i,o)}):vp(t,i,a)}function vp(t,i,a){i.status="fulfilled",i.value=a,wp(i),t.state=a,i=t.pending,i!==null&&(a=i.next,a===i?t.pending=null:(a=a.next,i.next=a,bp(t,a)))}function Wc(t,i,a){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=a,wp(i),i=i.next;while(i!==o)}t.action=null}function wp(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function Sp(t,i){return i}function _p(t,i){if(lt){var a=At.formState;if(a!==null){e:{var o=Je;if(lt){if(Ot){t:{for(var h=Ot,p=Xn;h.nodeType!==8;){if(!p){h=null;break t}if(h=Qn(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Ot=Qn(h.nextSibling),o=h.data==="F!";break e}}ui(o)}o=!1}o&&(i=a[0])}}return a=dn(),a.memoizedState=a.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sp,lastRenderedState:i},a.queue=o,a=Ip.bind(null,Je,o),o.dispatch=a,o=Zc(!1),p=af.bind(null,Je,!1,o.queue),o=dn(),h={state:i,dispatch:null,action:t,pending:null},o.queue=h,a=Dv.bind(null,Je,h,p,a),h.dispatch=a,o.memoizedState=t,[i,a,!1]}function Ep(t){var i=Ft();return kp(i,xt,t)}function kp(t,i,a){if(i=Kc(t,i,Sp)[0],t=ko(Br)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=$a(i)}catch(x){throw x===Rs?po:x}else o=i;i=Ft();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(Je.flags|=2048,Us(9,{destroy:void 0},Lv.bind(null,h,a),null)),[o,p,t]}function Lv(t,i){t.action=i}function Cp(t){var i=Ft(),a=xt;if(a!==null)return kp(i,a,t);Ft(),i=i.memoizedState,a=Ft();var o=a.queue.dispatch;return a.memoizedState=t,[i,o,!1]}function Us(t,i,a,o){return t={tag:t,create:a,deps:o,inst:i,next:null},i=Je.updateQueue,i===null&&(i=_o(),Je.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=t.next=t:(o=a.next,a.next=t,t.next=o,i.lastEffect=t),t}function Ap(){return Ft().memoizedState}function Co(t,i,a,o){var h=dn();Je.flags|=t,h.memoizedState=Us(1|i,{destroy:void 0},a,o===void 0?null:o)}function Ao(t,i,a,o){var h=Ft();o=o===void 0?null:o;var p=h.memoizedState.inst;xt!==null&&o!==null&&$c(o,xt.memoizedState.deps)?h.memoizedState=Us(i,p,a,o):(Je.flags|=t,h.memoizedState=Us(1|i,p,a,o))}function Tp(t,i){Co(8390656,8,t,i)}function ef(t,i){Ao(2048,8,t,i)}function zv(t){Je.flags|=4;var i=Je.updateQueue;if(i===null)i=_o(),Je.updateQueue=i,i.events=[t];else{var a=i.events;a===null?i.events=[t]:a.push(t)}}function jp(t){var i=Ft().memoizedState;return zv({ref:i,nextImpl:t}),function(){if((ht&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function Np(t,i){return Ao(4,2,t,i)}function Op(t,i){return Ao(4,4,t,i)}function Rp(t,i){if(typeof i=="function"){t=t();var a=i(t);return function(){typeof a=="function"?a():i(null)}}if(i!=null)return t=t(),i.current=t,function(){i.current=null}}function Mp(t,i,a){a=a!=null?a.concat([t]):null,Ao(4,4,Rp.bind(null,i,t),a)}function tf(){}function Dp(t,i){var a=Ft();i=i===void 0?null:i;var o=a.memoizedState;return i!==null&&$c(i,o[1])?o[0]:(a.memoizedState=[t,i],t)}function Lp(t,i){var a=Ft();i=i===void 0?null:i;var o=a.memoizedState;if(i!==null&&$c(i,o[1]))return o[0];if(o=t(),rs){Kt(!0);try{t()}finally{Kt(!1)}}return a.memoizedState=[o,i],o}function nf(t,i,a){return a===void 0||(Ur&1073741824)!==0&&(rt&261930)===0?t.memoizedState=i:(t.memoizedState=a,t=zg(),Je.lanes|=t,bi|=t,a)}function zp(t,i,a,o){return Tn(a,i)?a:Ds.current!==null?(t=nf(t,a,o),Tn(t,i)||(Vt=!0),t):(Ur&42)===0||(Ur&1073741824)!==0&&(rt&261930)===0?(Vt=!0,t.memoizedState=a):(t=zg(),Je.lanes|=t,bi|=t,i)}function Up(t,i,a,o,h){var p=se.p;se.p=p!==0&&8>p?p:8;var x=P.T,S={};P.T=S,af(t,!1,i,a);try{var I=h(),ne=P.S;if(ne!==null&&ne(S,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var ue=Ov(I,o);Ya(t,i,ue,Dn(t))}else Ya(t,i,o,Dn(t))}catch(ge){Ya(t,i,{then:function(){},status:"rejected",reason:ge},Dn())}finally{se.p=p,x!==null&&S.types!==null&&(x.types=S.types),P.T=x}}function Uv(){}function rf(t,i,a,o){if(t.tag!==5)throw Error(s(476));var h=Bp(t).queue;Up(t,h,i,ye,a===null?Uv:function(){return Pp(t),a(o)})}function Bp(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:ye,baseState:ye,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Br,lastRenderedState:ye},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Br,lastRenderedState:a},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function Pp(t){var i=Bp(t);i.next===null&&(i=t.alternate.memoizedState),Ya(t,i.next.queue,{},Dn())}function sf(){return rn(ol)}function qp(){return Ft().memoizedState}function Hp(){return Ft().memoizedState}function Bv(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var a=Dn();t=hi(a);var o=di(i,t,a);o!==null&&(En(o,i,a),qa(o,i,a)),i={cache:Mc()},t.payload=i;return}i=i.return}}function Pv(t,i,a){var o=Dn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},To(t)?Fp(i,a):(a=Sc(t,i,a,o),a!==null&&(En(a,t,o),$p(a,i,o)))}function Ip(t,i,a){var o=Dn();Ya(t,i,a,o)}function Ya(t,i,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(To(t))Fp(i,h);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var x=i.lastRenderedState,S=p(x,a);if(h.hasEagerState=!0,h.eagerState=S,Tn(S,x))return lo(t,i,h,0),At===null&&ao(),!1}catch{}finally{}if(a=Sc(t,i,h,o),a!==null)return En(a,t,o),$p(a,i,o),!0}return!1}function af(t,i,a,o){if(o={lane:2,revertLane:Bf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},To(t)){if(i)throw Error(s(479))}else i=Sc(t,a,o,2),i!==null&&En(i,t,2)}function To(t){var i=t.alternate;return t===Je||i!==null&&i===Je}function Fp(t,i){Ls=wo=!0;var a=t.pending;a===null?i.next=i:(i.next=a.next,a.next=i),t.pending=i}function $p(t,i,a){if((a&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,a|=o,i.lanes=a,Ii(t,a)}}var Ga={readContext:rn,use:Eo,useCallback:Pt,useContext:Pt,useEffect:Pt,useImperativeHandle:Pt,useLayoutEffect:Pt,useInsertionEffect:Pt,useMemo:Pt,useReducer:Pt,useRef:Pt,useState:Pt,useDebugValue:Pt,useDeferredValue:Pt,useTransition:Pt,useSyncExternalStore:Pt,useId:Pt,useHostTransitionStatus:Pt,useFormState:Pt,useActionState:Pt,useOptimistic:Pt,useMemoCache:Pt,useCacheRefresh:Pt};Ga.useEffectEvent=Pt;var Yp={readContext:rn,use:Eo,useCallback:function(t,i){return dn().memoizedState=[t,i===void 0?null:i],t},useContext:rn,useEffect:Tp,useImperativeHandle:function(t,i,a){a=a!=null?a.concat([t]):null,Co(4194308,4,Rp.bind(null,i,t),a)},useLayoutEffect:function(t,i){return Co(4194308,4,t,i)},useInsertionEffect:function(t,i){Co(4,2,t,i)},useMemo:function(t,i){var a=dn();i=i===void 0?null:i;var o=t();if(rs){Kt(!0);try{t()}finally{Kt(!1)}}return a.memoizedState=[o,i],o},useReducer:function(t,i,a){var o=dn();if(a!==void 0){var h=a(i);if(rs){Kt(!0);try{a(i)}finally{Kt(!1)}}}else h=i;return o.memoizedState=o.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},o.queue=t,t=t.dispatch=Pv.bind(null,Je,t),[o.memoizedState,t]},useRef:function(t){var i=dn();return t={current:t},i.memoizedState=t},useState:function(t){t=Zc(t);var i=t.queue,a=Ip.bind(null,Je,i);return i.dispatch=a,[t.memoizedState,a]},useDebugValue:tf,useDeferredValue:function(t,i){var a=dn();return nf(a,t,i)},useTransition:function(){var t=Zc(!1);return t=Up.bind(null,Je,t.queue,!0,!1),dn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,a){var o=Je,h=dn();if(lt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),At===null)throw Error(s(349));(rt&127)!==0||hp(o,i,a)}h.memoizedState=a;var p={value:a,getSnapshot:i};return h.queue=p,Tp(mp.bind(null,o,p,t),[t]),o.flags|=2048,Us(9,{destroy:void 0},dp.bind(null,o,p,a,i),null),a},useId:function(){var t=dn(),i=At.identifierPrefix;if(lt){var a=gr,o=pr;a=(o&~(1<<32-mt(o)-1)).toString(32)+a,i="_"+i+"R_"+a,a=So++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Rv++,i="_"+i+"r_"+a.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:sf,useFormState:_p,useActionState:_p,useOptimistic:function(t){var i=dn();i.memoizedState=i.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=af.bind(null,Je,!0,a),a.dispatch=i,[t,i]},useMemoCache:Xc,useCacheRefresh:function(){return dn().memoizedState=Bv.bind(null,Je)},useEffectEvent:function(t){var i=dn(),a={impl:t};return i.memoizedState=a,function(){if((ht&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},lf={readContext:rn,use:Eo,useCallback:Dp,useContext:rn,useEffect:ef,useImperativeHandle:Mp,useInsertionEffect:Np,useLayoutEffect:Op,useMemo:Lp,useReducer:ko,useRef:Ap,useState:function(){return ko(Br)},useDebugValue:tf,useDeferredValue:function(t,i){var a=Ft();return zp(a,xt.memoizedState,t,i)},useTransition:function(){var t=ko(Br)[0],i=Ft().memoizedState;return[typeof t=="boolean"?t:$a(t),i]},useSyncExternalStore:fp,useId:qp,useHostTransitionStatus:sf,useFormState:Ep,useActionState:Ep,useOptimistic:function(t,i){var a=Ft();return yp(a,xt,t,i)},useMemoCache:Xc,useCacheRefresh:Hp};lf.useEffectEvent=jp;var Gp={readContext:rn,use:Eo,useCallback:Dp,useContext:rn,useEffect:ef,useImperativeHandle:Mp,useInsertionEffect:Np,useLayoutEffect:Op,useMemo:Lp,useReducer:Qc,useRef:Ap,useState:function(){return Qc(Br)},useDebugValue:tf,useDeferredValue:function(t,i){var a=Ft();return xt===null?nf(a,t,i):zp(a,xt.memoizedState,t,i)},useTransition:function(){var t=Qc(Br)[0],i=Ft().memoizedState;return[typeof t=="boolean"?t:$a(t),i]},useSyncExternalStore:fp,useId:qp,useHostTransitionStatus:sf,useFormState:Cp,useActionState:Cp,useOptimistic:function(t,i){var a=Ft();return xt!==null?yp(a,xt,t,i):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Xc,useCacheRefresh:Hp};Gp.useEffectEvent=jp;function of(t,i,a,o){i=t.memoizedState,a=a(o,i),a=a==null?i:g({},i,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var uf={enqueueSetState:function(t,i,a){t=t._reactInternals;var o=Dn(),h=hi(o);h.payload=i,a!=null&&(h.callback=a),i=di(t,h,o),i!==null&&(En(i,t,o),qa(i,t,o))},enqueueReplaceState:function(t,i,a){t=t._reactInternals;var o=Dn(),h=hi(o);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=di(t,h,o),i!==null&&(En(i,t,o),qa(i,t,o))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var a=Dn(),o=hi(a);o.tag=2,i!=null&&(o.callback=i),i=di(t,o,a),i!==null&&(En(i,t,a),qa(i,t,a))}};function Vp(t,i,a,o,h,p,x){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,p,x):i.prototype&&i.prototype.isPureReactComponent?!Ra(a,o)||!Ra(h,p):!0}function Jp(t,i,a,o){t=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,o),i.state!==t&&uf.enqueueReplaceState(i,i.state,null)}function is(t,i){var a=i;if("ref"in i){a={};for(var o in i)o!=="ref"&&(a[o]=i[o])}if(t=t.defaultProps){a===i&&(a=g({},a));for(var h in t)a[h]===void 0&&(a[h]=t[h])}return a}function Xp(t){so(t)}function Kp(t){console.error(t)}function Qp(t){so(t)}function jo(t,i){try{var a=t.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function Zp(t,i,a){try{var o=t.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function cf(t,i,a){return a=hi(a),a.tag=3,a.payload={element:null},a.callback=function(){jo(t,i)},a}function Wp(t){return t=hi(t),t.tag=3,t}function eg(t,i,a,o){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;t.payload=function(){return h(p)},t.callback=function(){Zp(i,a,o)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(t.callback=function(){Zp(i,a,o),typeof h!="function"&&(xi===null?xi=new Set([this]):xi.add(this));var S=o.stack;this.componentDidCatch(o.value,{componentStack:S!==null?S:""})})}function qv(t,i,a,o,h){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=a.alternate,i!==null&&js(i,a,h,!0),a=Nn.current,a!==null){switch(a.tag){case 31:case 13:return Kn===null?Ho():a.alternate===null&&qt===0&&(qt=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===go?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([o]):i.add(o),Lf(t,o,h)),!1;case 22:return a.flags|=65536,o===go?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)),Lf(t,o,h)),!1}throw Error(s(435,a.tag))}return Lf(t,o,h),Ho(),!1}if(lt)return i=Nn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==Tc&&(t=Error(s(422),{cause:o}),La(Gn(t,a)))):(o!==Tc&&(i=Error(s(423),{cause:o}),La(Gn(i,a))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=Gn(o,a),h=cf(t.stateNode,o,h),Pc(t,h),qt!==4&&(qt=2)),!1;var p=Error(s(520),{cause:o});if(p=Gn(p,a),el===null?el=[p]:el.push(p),qt!==4&&(qt=2),i===null)return!0;o=Gn(o,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,t=h&-h,a.lanes|=t,t=cf(a.stateNode,o,t),Pc(a,t),!1;case 1:if(i=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(xi===null||!xi.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=Wp(h),eg(h,t,a,o),Pc(a,h),!1}a=a.return}while(a!==null);return!1}var ff=Error(s(461)),Vt=!1;function sn(t,i,a,o){i.child=t===null?ip(i,null,a,o):ns(i,t.child,a,o)}function tg(t,i,a,o,h){a=a.render;var p=i.ref;if("ref"in o){var x={};for(var S in o)S!=="ref"&&(x[S]=o[S])}else x=o;return Zi(i),o=Yc(t,i,a,x,p,h),S=Gc(),t!==null&&!Vt?(Vc(t,i,h),Pr(t,i,h)):(lt&&S&&Cc(i),i.flags|=1,sn(t,i,o,h),i.child)}function ng(t,i,a,o,h){if(t===null){var p=a.type;return typeof p=="function"&&!_c(p)&&p.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=p,rg(t,i,p,o,h)):(t=uo(a.type,null,o,i,i.mode,h),t.ref=i.ref,t.return=i,i.child=t)}if(p=t.child,!xf(t,h)){var x=p.memoizedProps;if(a=a.compare,a=a!==null?a:Ra,a(x,o)&&t.ref===i.ref)return Pr(t,i,h)}return i.flags|=1,t=Mr(p,o),t.ref=i.ref,t.return=i,i.child=t}function rg(t,i,a,o,h){if(t!==null){var p=t.memoizedProps;if(Ra(p,o)&&t.ref===i.ref)if(Vt=!1,i.pendingProps=o=p,xf(t,h))(t.flags&131072)!==0&&(Vt=!0);else return i.lanes=t.lanes,Pr(t,i,h)}return hf(t,i,a,o,h)}function ig(t,i,a,o){var h=o.children,p=t!==null?t.memoizedState:null;if(t===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,t!==null){for(o=i.child=t.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,i.child=null;return sg(t,i,p,a,o)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&mo(i,p!==null?p.cachePool:null),p!==null?lp(i,p):Hc(),op(i);else return o=i.lanes=536870912,sg(t,i,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(mo(i,p.cachePool),lp(i,p),pi(),i.memoizedState=null):(t!==null&&mo(i,null),Hc(),pi());return sn(t,i,h,a),i.child}function Va(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function sg(t,i,a,o,h){var p=Lc();return p=p===null?null:{parent:Yt._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},t!==null&&mo(i,null),Hc(),op(i),t!==null&&js(t,i,o,!0),i.childLanes=h,null}function No(t,i){return i=Ro({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function ag(t,i,a){return ns(i,t.child,null,a),t=No(i,i.pendingProps),t.flags|=2,On(i),i.memoizedState=null,t}function Hv(t,i,a){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(lt){if(o.mode==="hidden")return t=No(i,o),i.lanes=536870912,Va(null,t);if(Fc(i),(t=Ot)?(t=by(t,Xn),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:li!==null?{id:pr,overflow:gr}:null,retryLane:536870912,hydrationErrors:null},a=Fm(t),a.return=i,i.child=a,nn=i,Ot=null)):t=null,t===null)throw ui(i);return i.lanes=536870912,null}return No(i,o)}var p=t.memoizedState;if(p!==null){var x=p.dehydrated;if(Fc(i),h)if(i.flags&256)i.flags&=-257,i=ag(t,i,a);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(s(558));else if(Vt||js(t,i,a,!1),h=(a&t.childLanes)!==0,Vt||h){if(o=At,o!==null&&(x=si(o,a),x!==0&&x!==p.retryLane))throw p.retryLane=x,Ji(t,x),En(o,t,x),ff;Ho(),i=ag(t,i,a)}else t=p.treeContext,Ot=Qn(x.nextSibling),nn=i,lt=!0,oi=null,Xn=!1,t!==null&&Gm(i,t),i=No(i,o),i.flags|=4096;return i}return t=Mr(t.child,{mode:o.mode,children:o.children}),t.ref=i.ref,i.child=t,t.return=i,t}function Oo(t,i){var a=i.ref;if(a===null)t!==null&&t.ref!==null&&(i.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(t===null||t.ref!==a)&&(i.flags|=4194816)}}function hf(t,i,a,o,h){return Zi(i),a=Yc(t,i,a,o,void 0,h),o=Gc(),t!==null&&!Vt?(Vc(t,i,h),Pr(t,i,h)):(lt&&o&&Cc(i),i.flags|=1,sn(t,i,a,h),i.child)}function lg(t,i,a,o,h,p){return Zi(i),i.updateQueue=null,a=cp(i,o,a,h),up(t),o=Gc(),t!==null&&!Vt?(Vc(t,i,p),Pr(t,i,p)):(lt&&o&&Cc(i),i.flags|=1,sn(t,i,a,p),i.child)}function og(t,i,a,o,h){if(Zi(i),i.stateNode===null){var p=ks,x=a.contextType;typeof x=="object"&&x!==null&&(p=rn(x)),p=new a(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=uf,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},Uc(i),x=a.contextType,p.context=typeof x=="object"&&x!==null?rn(x):ks,p.state=i.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(of(i,a,x,o),p.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(x=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),x!==p.state&&uf.enqueueReplaceState(p,p.state,null),Ia(i,o,p,h),Ha(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(t===null){p=i.stateNode;var S=i.memoizedProps,I=is(a,S);p.props=I;var ne=p.context,ue=a.contextType;x=ks,typeof ue=="object"&&ue!==null&&(x=rn(ue));var ge=a.getDerivedStateFromProps;ue=typeof ge=="function"||typeof p.getSnapshotBeforeUpdate=="function",S=i.pendingProps!==S,ue||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(S||ne!==x)&&Jp(i,p,o,x),fi=!1;var re=i.memoizedState;p.state=re,Ia(i,o,p,h),Ha(),ne=i.memoizedState,S||re!==ne||fi?(typeof ge=="function"&&(of(i,a,ge,o),ne=i.memoizedState),(I=fi||Vp(i,a,I,o,re,ne,x))?(ue||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=x,o=I):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,Bc(t,i),x=i.memoizedProps,ue=is(a,x),p.props=ue,ge=i.pendingProps,re=p.context,ne=a.contextType,I=ks,typeof ne=="object"&&ne!==null&&(I=rn(ne)),S=a.getDerivedStateFromProps,(ne=typeof S=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(x!==ge||re!==I)&&Jp(i,p,o,I),fi=!1,re=i.memoizedState,p.state=re,Ia(i,o,p,h),Ha();var le=i.memoizedState;x!==ge||re!==le||fi||t!==null&&t.dependencies!==null&&fo(t.dependencies)?(typeof S=="function"&&(of(i,a,S,o),le=i.memoizedState),(ue=fi||Vp(i,a,ue,o,re,le,I)||t!==null&&t.dependencies!==null&&fo(t.dependencies))?(ne||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,le,I),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,le,I)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||x===t.memoizedProps&&re===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===t.memoizedProps&&re===t.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=le),p.props=o,p.state=le,p.context=I,o=ue):(typeof p.componentDidUpdate!="function"||x===t.memoizedProps&&re===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===t.memoizedProps&&re===t.memoizedState||(i.flags|=1024),o=!1)}return p=o,Oo(t,i),o=(i.flags&128)!==0,p||o?(p=i.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,t!==null&&o?(i.child=ns(i,t.child,null,h),i.child=ns(i,null,a,h)):sn(t,i,a,h),i.memoizedState=p.state,t=i.child):t=Pr(t,i,h),t}function ug(t,i,a,o){return Ki(),i.flags|=256,sn(t,i,a,o),i.child}var df={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mf(t){return{baseLanes:t,cachePool:Zm()}}function pf(t,i,a){return t=t!==null?t.childLanes&~a:0,i&&(t|=Mn),t}function cg(t,i,a){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,x;if((x=p)||(x=t!==null&&t.memoizedState===null?!1:(It.current&2)!==0),x&&(h=!0,i.flags&=-129),x=(i.flags&32)!==0,i.flags&=-33,t===null){if(lt){if(h?mi(i):pi(),(t=Ot)?(t=by(t,Xn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:li!==null?{id:pr,overflow:gr}:null,retryLane:536870912,hydrationErrors:null},a=Fm(t),a.return=i,i.child=a,nn=i,Ot=null)):t=null,t===null)throw ui(i);return Qf(t)?i.lanes=32:i.lanes=536870912,null}var S=o.children;return o=o.fallback,h?(pi(),h=i.mode,S=Ro({mode:"hidden",children:S},h),o=Xi(o,h,a,null),S.return=i,o.return=i,S.sibling=o,i.child=S,o=i.child,o.memoizedState=mf(a),o.childLanes=pf(t,x,a),i.memoizedState=df,Va(null,o)):(mi(i),gf(i,S))}var I=t.memoizedState;if(I!==null&&(S=I.dehydrated,S!==null)){if(p)i.flags&256?(mi(i),i.flags&=-257,i=yf(t,i,a)):i.memoizedState!==null?(pi(),i.child=t.child,i.flags|=128,i=null):(pi(),S=o.fallback,h=i.mode,o=Ro({mode:"visible",children:o.children},h),S=Xi(S,h,a,null),S.flags|=2,o.return=i,S.return=i,o.sibling=S,i.child=o,ns(i,t.child,null,a),o=i.child,o.memoizedState=mf(a),o.childLanes=pf(t,x,a),i.memoizedState=df,i=Va(null,o));else if(mi(i),Qf(S)){if(x=S.nextSibling&&S.nextSibling.dataset,x)var ne=x.dgst;x=ne,o=Error(s(419)),o.stack="",o.digest=x,La({value:o,source:null,stack:null}),i=yf(t,i,a)}else if(Vt||js(t,i,a,!1),x=(a&t.childLanes)!==0,Vt||x){if(x=At,x!==null&&(o=si(x,a),o!==0&&o!==I.retryLane))throw I.retryLane=o,Ji(t,o),En(x,t,o),ff;Kf(S)||Ho(),i=yf(t,i,a)}else Kf(S)?(i.flags|=192,i.child=t.child,i=null):(t=I.treeContext,Ot=Qn(S.nextSibling),nn=i,lt=!0,oi=null,Xn=!1,t!==null&&Gm(i,t),i=gf(i,o.children),i.flags|=4096);return i}return h?(pi(),S=o.fallback,h=i.mode,I=t.child,ne=I.sibling,o=Mr(I,{mode:"hidden",children:o.children}),o.subtreeFlags=I.subtreeFlags&65011712,ne!==null?S=Mr(ne,S):(S=Xi(S,h,a,null),S.flags|=2),S.return=i,o.return=i,o.sibling=S,i.child=o,Va(null,o),o=i.child,S=t.child.memoizedState,S===null?S=mf(a):(h=S.cachePool,h!==null?(I=Yt._currentValue,h=h.parent!==I?{parent:I,pool:I}:h):h=Zm(),S={baseLanes:S.baseLanes|a,cachePool:h}),o.memoizedState=S,o.childLanes=pf(t,x,a),i.memoizedState=df,Va(t.child,o)):(mi(i),a=t.child,t=a.sibling,a=Mr(a,{mode:"visible",children:o.children}),a.return=i,a.sibling=null,t!==null&&(x=i.deletions,x===null?(i.deletions=[t],i.flags|=16):x.push(t)),i.child=a,i.memoizedState=null,a)}function gf(t,i){return i=Ro({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function Ro(t,i){return t=jn(22,t,null,i),t.lanes=0,t}function yf(t,i,a){return ns(i,t.child,null,a),t=gf(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function fg(t,i,a){t.lanes|=i;var o=t.alternate;o!==null&&(o.lanes|=i),Oc(t.return,i,a)}function bf(t,i,a,o,h,p){var x=t.memoizedState;x===null?t.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:h,treeForkCount:p}:(x.isBackwards=i,x.rendering=null,x.renderingStartTime=0,x.last=o,x.tail=a,x.tailMode=h,x.treeForkCount=p)}function hg(t,i,a){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var x=It.current,S=(x&2)!==0;if(S?(x=x&1|2,i.flags|=128):x&=1,A(It,x),sn(t,i,o,a),o=lt?Da:0,!S&&t!==null&&(t.flags&128)!==0)e:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&fg(t,a,i);else if(t.tag===19)fg(t,a,i);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break e;for(;t.sibling===null;){if(t.return===null||t.return===i)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(a=i.child,h=null;a!==null;)t=a.alternate,t!==null&&vo(t)===null&&(h=a),a=a.sibling;a=h,a===null?(h=i.child,i.child=null):(h=a.sibling,a.sibling=null),bf(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(t=h.alternate,t!==null&&vo(t)===null){i.child=h;break}t=h.sibling,h.sibling=a,a=h,h=t}bf(i,!0,a,null,p,o);break;case"together":bf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Pr(t,i,a){if(t!==null&&(i.dependencies=t.dependencies),bi|=i.lanes,(a&i.childLanes)===0)if(t!==null){if(js(t,i,a,!1),(a&i.childLanes)===0)return null}else return null;if(t!==null&&i.child!==t.child)throw Error(s(153));if(i.child!==null){for(t=i.child,a=Mr(t,t.pendingProps),i.child=a,a.return=i;t.sibling!==null;)t=t.sibling,a=a.sibling=Mr(t,t.pendingProps),a.return=i;a.sibling=null}return i.child}function xf(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&fo(t)))}function Iv(t,i,a){switch(i.tag){case 3:Ye(i,i.stateNode.containerInfo),ci(i,Yt,t.memoizedState.cache),Ki();break;case 27:case 5:Le(i);break;case 4:Ye(i,i.stateNode.containerInfo);break;case 10:ci(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Fc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(mi(i),i.flags|=128,null):(a&i.child.childLanes)!==0?cg(t,i,a):(mi(i),t=Pr(t,i,a),t!==null?t.sibling:null);mi(i);break;case 19:var h=(t.flags&128)!==0;if(o=(a&i.childLanes)!==0,o||(js(t,i,a,!1),o=(a&i.childLanes)!==0),h){if(o)return hg(t,i,a);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),A(It,It.current),o)break;return null;case 22:return i.lanes=0,ig(t,i,a,i.pendingProps);case 24:ci(i,Yt,t.memoizedState.cache)}return Pr(t,i,a)}function dg(t,i,a){if(t!==null)if(t.memoizedProps!==i.pendingProps)Vt=!0;else{if(!xf(t,a)&&(i.flags&128)===0)return Vt=!1,Iv(t,i,a);Vt=(t.flags&131072)!==0}else Vt=!1,lt&&(i.flags&1048576)!==0&&Ym(i,Da,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(t=es(i.elementType),i.type=t,typeof t=="function")_c(t)?(o=is(t,o),i.tag=1,i=og(null,i,t,o,a)):(i.tag=0,i=hf(null,i,t,o,a));else{if(t!=null){var h=t.$$typeof;if(h===ae){i.tag=11,i=tg(null,i,t,o,a);break e}else if(h===V){i.tag=14,i=ng(null,i,t,o,a);break e}}throw i=J(t)||t,Error(s(306,i,""))}}return i;case 0:return hf(t,i,i.type,i.pendingProps,a);case 1:return o=i.type,h=is(o,i.pendingProps),og(t,i,o,h,a);case 3:e:{if(Ye(i,i.stateNode.containerInfo),t===null)throw Error(s(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,Bc(t,i),Ia(i,o,null,a);var x=i.memoizedState;if(o=x.cache,ci(i,Yt,o),o!==p.cache&&Rc(i,[Yt],a,!0),Ha(),o=x.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:x.cache},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){i=ug(t,i,o,a);break e}else if(o!==h){h=Gn(Error(s(424)),i),La(h),i=ug(t,i,o,a);break e}else{switch(t=i.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Ot=Qn(t.firstChild),nn=i,lt=!0,oi=null,Xn=!0,a=ip(i,null,o,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ki(),o===h){i=Pr(t,i,a);break e}sn(t,i,o,a)}i=i.child}return i;case 26:return Oo(t,i),t===null?(a=Ey(i.type,null,i.pendingProps,null))?i.memoizedState=a:lt||(a=i.type,t=i.pendingProps,o=Jo(je.current).createElement(a),o[Ct]=i,o[Bt]=t,an(o,a,t),F(o),i.stateNode=o):i.memoizedState=Ey(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return Le(i),t===null&<&&(o=i.stateNode=wy(i.type,i.pendingProps,je.current),nn=i,Xn=!0,h=Ot,_i(i.type)?(Zf=h,Ot=Qn(o.firstChild)):Ot=h),sn(t,i,i.pendingProps.children,a),Oo(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&<&&((h=o=Ot)&&(o=bw(o,i.type,i.pendingProps,Xn),o!==null?(i.stateNode=o,nn=i,Ot=Qn(o.firstChild),Xn=!1,h=!0):h=!1),h||ui(i)),Le(i),h=i.type,p=i.pendingProps,x=t!==null?t.memoizedProps:null,o=p.children,Vf(h,p)?o=null:x!==null&&Vf(h,x)&&(i.flags|=32),i.memoizedState!==null&&(h=Yc(t,i,Mv,null,null,a),ol._currentValue=h),Oo(t,i),sn(t,i,o,a),i.child;case 6:return t===null&<&&((t=a=Ot)&&(a=xw(a,i.pendingProps,Xn),a!==null?(i.stateNode=a,nn=i,Ot=null,t=!0):t=!1),t||ui(i)),null;case 13:return cg(t,i,a);case 4:return Ye(i,i.stateNode.containerInfo),o=i.pendingProps,t===null?i.child=ns(i,null,o,a):sn(t,i,o,a),i.child;case 11:return tg(t,i,i.type,i.pendingProps,a);case 7:return sn(t,i,i.pendingProps,a),i.child;case 8:return sn(t,i,i.pendingProps.children,a),i.child;case 12:return sn(t,i,i.pendingProps.children,a),i.child;case 10:return o=i.pendingProps,ci(i,i.type,o.value),sn(t,i,o.children,a),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,Zi(i),h=rn(h),o=o(h),i.flags|=1,sn(t,i,o,a),i.child;case 14:return ng(t,i,i.type,i.pendingProps,a);case 15:return rg(t,i,i.type,i.pendingProps,a);case 19:return hg(t,i,a);case 31:return Hv(t,i,a);case 22:return ig(t,i,a,i.pendingProps);case 24:return Zi(i),o=rn(Yt),t===null?(h=Lc(),h===null&&(h=At,p=Mc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),i.memoizedState={parent:o,cache:h},Uc(i),ci(i,Yt,h)):((t.lanes&a)!==0&&(Bc(t,i),Ia(i,null,null,a),Ha()),h=t.memoizedState,p=i.memoizedState,h.parent!==o?(h={parent:o,cache:o},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),ci(i,Yt,o)):(o=p.cache,ci(i,Yt,o),o!==h.cache&&Rc(i,[Yt],a,!0))),sn(t,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function qr(t){t.flags|=4}function vf(t,i,a,o,h){if((i=(t.mode&32)!==0)&&(i=!1),i){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(qg())t.flags|=8192;else throw ts=go,zc}else t.flags&=-16777217}function mg(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!jy(i))if(qg())t.flags|=8192;else throw ts=go,zc}function Mo(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?ps():536870912,t.lanes|=i,Hs|=i)}function Ja(t,i){if(!lt)switch(t.tailMode){case"hidden":i=t.tail;for(var a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?i||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function Rt(t){var i=t.alternate!==null&&t.alternate.child===t.child,a=0,o=0;if(i)for(var h=t.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=a,i}function Fv(t,i,a){var o=i.pendingProps;switch(Ac(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(i),null;case 1:return Rt(i),null;case 3:return a=i.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),zr(Yt),me(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Ts(i)?qr(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,jc())),Rt(i),null;case 26:var h=i.type,p=i.memoizedState;return t===null?(qr(i),p!==null?(Rt(i),mg(i,p)):(Rt(i),vf(i,h,null,o,a))):p?p!==t.memoizedState?(qr(i),Rt(i),mg(i,p)):(Rt(i),i.flags&=-16777217):(t=t.memoizedProps,t!==o&&qr(i),Rt(i),vf(i,h,t,o,a)),null;case 27:if(be(i),a=je.current,h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&qr(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Rt(i),null}t=ve.current,Ts(i)?Vm(i):(t=wy(h,o,a),i.stateNode=t,qr(i))}return Rt(i),null;case 5:if(be(i),h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&qr(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Rt(i),null}if(p=ve.current,Ts(i))Vm(i);else{var x=Jo(je.current);switch(p){case 1:p=x.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=x.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=x.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=x.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=x.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?x.createElement("select",{is:o.is}):x.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?x.createElement(h,{is:o.is}):x.createElement(h)}}p[Ct]=i,p[Bt]=o;e:for(x=i.child;x!==null;){if(x.tag===5||x.tag===6)p.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===i)break e;for(;x.sibling===null;){if(x.return===null||x.return===i)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}i.stateNode=p;e:switch(an(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&&qr(i)}}return Rt(i),vf(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,a),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&qr(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(s(166));if(t=je.current,Ts(i)){if(t=i.stateNode,a=i.memoizedProps,o=null,h=nn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[Ct]=i,t=!!(t.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||cy(t.nodeValue,a)),t||ui(i,!0)}else t=Jo(t).createTextNode(o),t[Ct]=i,i.stateNode=t}return Rt(i),null;case 31:if(a=i.memoizedState,t===null||t.memoizedState!==null){if(o=Ts(i),a!==null){if(t===null){if(!o)throw Error(s(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Ct]=i}else Ki(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Rt(i),t=!1}else a=jc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return i.flags&256?(On(i),i):(On(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Rt(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Ts(i),o!==null&&o.dehydrated!==null){if(t===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 Ki(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Rt(i),h=!1}else h=jc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(On(i),i):(On(i),null)}return On(i),(i.flags&128)!==0?(i.lanes=a,i):(a=o!==null,t=t!==null&&t.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!==t&&a&&(i.child.flags|=8192),Mo(i,i.updateQueue),Rt(i),null);case 4:return me(),t===null&&If(i.stateNode.containerInfo),Rt(i),null;case 10:return zr(i.type),Rt(i),null;case 19:if(ee(It),o=i.memoizedState,o===null)return Rt(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Ja(o,!1);else{if(qt!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(p=vo(t),p!==null){for(i.flags|=128,Ja(o,!1),t=p.updateQueue,i.updateQueue=t,Mo(i,t),i.subtreeFlags=0,t=a,a=i.child;a!==null;)Im(a,t),a=a.sibling;return A(It,It.current&1|2),lt&&Dr(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&&bt()>Bo&&(i.flags|=128,h=!0,Ja(o,!1),i.lanes=4194304)}else{if(!h)if(t=vo(p),t!==null){if(i.flags|=128,h=!0,t=t.updateQueue,i.updateQueue=t,Mo(i,t),Ja(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!lt)return Rt(i),null}else 2*bt()-o.renderingStartTime>Bo&&a!==536870912&&(i.flags|=128,h=!0,Ja(o,!1),i.lanes=4194304);o.isBackwards?(p.sibling=i.child,i.child=p):(t=o.last,t!==null?t.sibling=p:i.child=p,o.last=p)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=bt(),t.sibling=null,a=It.current,A(It,h?a&1|2:a&1),lt&&Dr(i,o.treeForkCount),t):(Rt(i),null);case 22:case 23:return On(i),Ic(),o=i.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(a&536870912)!==0&&(i.flags&128)===0&&(Rt(i),i.subtreeFlags&6&&(i.flags|=8192)):Rt(i),a=i.updateQueue,a!==null&&Mo(i,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==a&&(i.flags|=2048),t!==null&&ee(Wi),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),zr(Yt),Rt(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function $v(t,i){switch(Ac(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return zr(Yt),me(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return be(i),null;case 31:if(i.memoizedState!==null){if(On(i),i.alternate===null)throw Error(s(340));Ki()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(On(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(s(340));Ki()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return ee(It),null;case 4:return me(),null;case 10:return zr(i.type),null;case 22:case 23:return On(i),Ic(),t!==null&&ee(Wi),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return zr(Yt),null;case 25:return null;default:return null}}function pg(t,i){switch(Ac(i),i.tag){case 3:zr(Yt),me();break;case 26:case 27:case 5:be(i);break;case 4:me();break;case 31:i.memoizedState!==null&&On(i);break;case 13:On(i);break;case 19:ee(It);break;case 10:zr(i.type);break;case 22:case 23:On(i),Ic(),t!==null&&ee(Wi);break;case 24:zr(Yt)}}function Xa(t,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&t)===t){o=void 0;var p=a.create,x=a.inst;o=p(),x.destroy=o}a=a.next}while(a!==h)}}catch(S){yt(i,i.return,S)}}function gi(t,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&t)===t){var x=o.inst,S=x.destroy;if(S!==void 0){x.destroy=void 0,h=i;var I=a,ne=S;try{ne()}catch(ue){yt(h,I,ue)}}}o=o.next}while(o!==p)}}catch(ue){yt(i,i.return,ue)}}function gg(t){var i=t.updateQueue;if(i!==null){var a=t.stateNode;try{ap(i,a)}catch(o){yt(t,t.return,o)}}}function yg(t,i,a){a.props=is(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(o){yt(t,i,o)}}function Ka(t,i){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof a=="function"?t.refCleanup=a(o):a.current=o}}catch(h){yt(t,i,h)}}function yr(t,i){var a=t.ref,o=t.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){yt(t,i,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){yt(t,i,h)}else a.current=null}function bg(t){var i=t.type,a=t.memoizedProps,o=t.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){yt(t,t.return,h)}}function wf(t,i,a){try{var o=t.stateNode;hw(o,t.type,a,i),o[Bt]=i}catch(h){yt(t,t.return,h)}}function xg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&_i(t.type)||t.tag===4}function Sf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||xg(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&_i(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function _f(t,i,a){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,i):(i=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,i.appendChild(t),a=a._reactRootContainer,a!=null||i.onclick!==null||(i.onclick=Or));else if(o!==4&&(o===27&&_i(t.type)&&(a=t.stateNode,i=null),t=t.child,t!==null))for(_f(t,i,a),t=t.sibling;t!==null;)_f(t,i,a),t=t.sibling}function Do(t,i,a){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?a.insertBefore(t,i):a.appendChild(t);else if(o!==4&&(o===27&&_i(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Do(t,i,a),t=t.sibling;t!==null;)Do(t,i,a),t=t.sibling}function vg(t){var i=t.stateNode,a=t.memoizedProps;try{for(var o=t.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);an(i,o,a),i[Ct]=t,i[Bt]=a}catch(p){yt(t,t.return,p)}}var Hr=!1,Jt=!1,Ef=!1,wg=typeof WeakSet=="function"?WeakSet:Set,Wt=null;function Yv(t,i){if(t=t.containerInfo,Yf=tu,t=Mm(t),gc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.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 x=0,S=-1,I=-1,ne=0,ue=0,ge=t,re=null;t:for(;;){for(var le;ge!==a||h!==0&&ge.nodeType!==3||(S=x+h),ge!==p||o!==0&&ge.nodeType!==3||(I=x+o),ge.nodeType===3&&(x+=ge.nodeValue.length),(le=ge.firstChild)!==null;)re=ge,ge=le;for(;;){if(ge===t)break t;if(re===a&&++ne===h&&(S=x),re===p&&++ue===o&&(I=x),(le=ge.nextSibling)!==null)break;ge=re,re=ge.parentNode}ge=le}a=S===-1||I===-1?null:{start:S,end:I}}else a=null}a=a||{start:0,end:0}}else a=null;for(Gf={focusedElem:t,selectionRange:a},tu=!1,Wt=i;Wt!==null;)if(i=Wt,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,Wt=t;else for(;Wt!==null;){switch(i=Wt,p=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)h=t[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,a=i,h=p.memoizedProps,p=p.memoizedState,o=a.stateNode;try{var Me=is(a.type,h);t=o.getSnapshotBeforeUpdate(Me,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(Fe){yt(a,a.return,Fe)}}break;case 3:if((t&1024)!==0){if(t=i.stateNode.containerInfo,a=t.nodeType,a===9)Xf(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Xf(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=i.sibling,t!==null){t.return=i.return,Wt=t;break}Wt=i.return}}function Sg(t,i,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:Fr(t,a),o&4&&Xa(5,a);break;case 1:if(Fr(t,a),o&4)if(t=a.stateNode,i===null)try{t.componentDidMount()}catch(x){yt(a,a.return,x)}else{var h=is(a.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(h,i,t.__reactInternalSnapshotBeforeUpdate)}catch(x){yt(a,a.return,x)}}o&64&&gg(a),o&512&&Ka(a,a.return);break;case 3:if(Fr(t,a),o&64&&(t=a.updateQueue,t!==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{ap(t,i)}catch(x){yt(a,a.return,x)}}break;case 27:i===null&&o&4&&vg(a);case 26:case 5:Fr(t,a),i===null&&o&4&&bg(a),o&512&&Ka(a,a.return);break;case 12:Fr(t,a);break;case 31:Fr(t,a),o&4&&kg(t,a);break;case 13:Fr(t,a),o&4&&Cg(t,a),o&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=ew.bind(null,a),vw(t,a))));break;case 22:if(o=a.memoizedState!==null||Hr,!o){i=i!==null&&i.memoizedState!==null||Jt,h=Hr;var p=Jt;Hr=o,(Jt=i)&&!p?$r(t,a,(a.subtreeFlags&8772)!==0):Fr(t,a),Hr=h,Jt=p}break;case 30:break;default:Fr(t,a)}}function _g(t){var i=t.alternate;i!==null&&(t.alternate=null,_g(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&gs(i)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Mt=null,vn=!1;function Ir(t,i,a){for(a=a.child;a!==null;)Eg(t,i,a),a=a.sibling}function Eg(t,i,a){if(kt&&typeof kt.onCommitFiberUnmount=="function")try{kt.onCommitFiberUnmount(at,a)}catch{}switch(a.tag){case 26:Jt||yr(a,i),Ir(t,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Jt||yr(a,i);var o=Mt,h=vn;_i(a.type)&&(Mt=a.stateNode,vn=!1),Ir(t,i,a),sl(a.stateNode),Mt=o,vn=h;break;case 5:Jt||yr(a,i);case 6:if(o=Mt,h=vn,Mt=null,Ir(t,i,a),Mt=o,vn=h,Mt!==null)if(vn)try{(Mt.nodeType===9?Mt.body:Mt.nodeName==="HTML"?Mt.ownerDocument.body:Mt).removeChild(a.stateNode)}catch(p){yt(a,i,p)}else try{Mt.removeChild(a.stateNode)}catch(p){yt(a,i,p)}break;case 18:Mt!==null&&(vn?(t=Mt,gy(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),Xs(t)):gy(Mt,a.stateNode));break;case 4:o=Mt,h=vn,Mt=a.stateNode.containerInfo,vn=!0,Ir(t,i,a),Mt=o,vn=h;break;case 0:case 11:case 14:case 15:gi(2,a,i),Jt||gi(4,a,i),Ir(t,i,a);break;case 1:Jt||(yr(a,i),o=a.stateNode,typeof o.componentWillUnmount=="function"&&yg(a,i,o)),Ir(t,i,a);break;case 21:Ir(t,i,a);break;case 22:Jt=(o=Jt)||a.memoizedState!==null,Ir(t,i,a),Jt=o;break;default:Ir(t,i,a)}}function kg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Xs(t)}catch(a){yt(i,i.return,a)}}}function Cg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Xs(t)}catch(a){yt(i,i.return,a)}}function Gv(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new wg),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new wg),i;default:throw Error(s(435,t.tag))}}function Lo(t,i){var a=Gv(t);i.forEach(function(o){if(!a.has(o)){a.add(o);var h=tw.bind(null,t,o);o.then(h,h)}})}function wn(t,i){var a=i.deletions;if(a!==null)for(var o=0;o<a.length;o++){var h=a[o],p=t,x=i,S=x;e:for(;S!==null;){switch(S.tag){case 27:if(_i(S.type)){Mt=S.stateNode,vn=!1;break e}break;case 5:Mt=S.stateNode,vn=!1;break e;case 3:case 4:Mt=S.stateNode.containerInfo,vn=!0;break e}S=S.return}if(Mt===null)throw Error(s(160));Eg(p,x,h),Mt=null,vn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Ag(i,t),i=i.sibling}var or=null;function Ag(t,i){var a=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:wn(i,t),Sn(t),o&4&&(gi(3,t,t.return),Xa(3,t),gi(5,t,t.return));break;case 1:wn(i,t),Sn(t),o&512&&(Jt||a===null||yr(a,a.return)),o&64&&Hr&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var h=or;if(wn(i,t),Sn(t),o&512&&(Jt||a===null||yr(a,a.return)),o&4){var p=a!==null?a.memoizedState:null;if(o=t.memoizedState,a===null)if(o===null)if(t.stateNode===null){e:{o=t.type,a=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[Qt]||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"))),an(p,o,a),p[Ct]=t,F(p),o=p;break e;case"link":var x=Ay("link","href",h).get(o+(a.href||""));if(x){for(var S=0;S<x.length;S++)if(p=x[S],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)){x.splice(S,1);break t}}p=h.createElement(o),an(p,o,a),h.head.appendChild(p);break;case"meta":if(x=Ay("meta","content",h).get(o+(a.content||""))){for(S=0;S<x.length;S++)if(p=x[S],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)){x.splice(S,1);break t}}p=h.createElement(o),an(p,o,a),h.head.appendChild(p);break;default:throw Error(s(468,o))}p[Ct]=t,F(p),o=p}t.stateNode=o}else Ty(h,t.type,t.stateNode);else t.stateNode=Cy(h,o,t.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?Ty(h,t.type,t.stateNode):Cy(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&wf(t,t.memoizedProps,a.memoizedProps)}break;case 27:wn(i,t),Sn(t),o&512&&(Jt||a===null||yr(a,a.return)),a!==null&&o&4&&wf(t,t.memoizedProps,a.memoizedProps);break;case 5:if(wn(i,t),Sn(t),o&512&&(Jt||a===null||yr(a,a.return)),t.flags&32){h=t.stateNode;try{bs(h,"")}catch(Me){yt(t,t.return,Me)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,wf(t,h,a!==null?a.memoizedProps:h)),o&1024&&(Ef=!0);break;case 6:if(wn(i,t),Sn(t),o&4){if(t.stateNode===null)throw Error(s(162));o=t.memoizedProps,a=t.stateNode;try{a.nodeValue=o}catch(Me){yt(t,t.return,Me)}}break;case 3:if(Qo=null,h=or,or=Xo(i.containerInfo),wn(i,t),or=h,Sn(t),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Xs(i.containerInfo)}catch(Me){yt(t,t.return,Me)}Ef&&(Ef=!1,Tg(t));break;case 4:o=or,or=Xo(t.stateNode.containerInfo),wn(i,t),Sn(t),or=o;break;case 12:wn(i,t),Sn(t);break;case 31:wn(i,t),Sn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Lo(t,o)));break;case 13:wn(i,t),Sn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Uo=bt()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Lo(t,o)));break;case 22:h=t.memoizedState!==null;var I=a!==null&&a.memoizedState!==null,ne=Hr,ue=Jt;if(Hr=ne||h,Jt=ue||I,wn(i,t),Jt=ue,Hr=ne,Sn(t),o&8192)e:for(i=t.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||I||Hr||Jt||ss(t)),a=null,i=t;;){if(i.tag===5||i.tag===26){if(a===null){I=a=i;try{if(p=I.stateNode,h)x=p.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{S=I.stateNode;var ge=I.memoizedProps.style,re=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;S.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(Me){yt(I,I.return,Me)}}}else if(i.tag===6){if(a===null){I=i;try{I.stateNode.nodeValue=h?"":I.memoizedProps}catch(Me){yt(I,I.return,Me)}}}else if(i.tag===18){if(a===null){I=i;try{var le=I.stateNode;h?yy(le,!0):yy(I.stateNode,!1)}catch(Me){yt(I,I.return,Me)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===t)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;a===i&&(a=null),i=i.return}a===i&&(a=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=t.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,Lo(t,a))));break;case 19:wn(i,t),Sn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Lo(t,o)));break;case 30:break;case 21:break;default:wn(i,t),Sn(t)}}function Sn(t){var i=t.flags;if(i&2){try{for(var a,o=t.return;o!==null;){if(xg(o)){a=o;break}o=o.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var h=a.stateNode,p=Sf(t);Do(t,p,h);break;case 5:var x=a.stateNode;a.flags&32&&(bs(x,""),a.flags&=-33);var S=Sf(t);Do(t,S,x);break;case 3:case 4:var I=a.stateNode.containerInfo,ne=Sf(t);_f(t,ne,I);break;default:throw Error(s(161))}}catch(ue){yt(t,t.return,ue)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function Tg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;Tg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),t=t.sibling}}function Fr(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Sg(t,i.alternate,i),i=i.sibling}function ss(t){for(t=t.child;t!==null;){var i=t;switch(i.tag){case 0:case 11:case 14:case 15:gi(4,i,i.return),ss(i);break;case 1:yr(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&yg(i,i.return,a),ss(i);break;case 27:sl(i.stateNode);case 26:case 5:yr(i,i.return),ss(i);break;case 22:i.memoizedState===null&&ss(i);break;case 30:ss(i);break;default:ss(i)}t=t.sibling}}function $r(t,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,h=t,p=i,x=p.flags;switch(p.tag){case 0:case 11:case 15:$r(h,p,a),Xa(4,p);break;case 1:if($r(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ne){yt(o,o.return,ne)}if(o=p,h=o.updateQueue,h!==null){var S=o.stateNode;try{var I=h.shared.hiddenCallbacks;if(I!==null)for(h.shared.hiddenCallbacks=null,h=0;h<I.length;h++)sp(I[h],S)}catch(ne){yt(o,o.return,ne)}}a&&x&64&&gg(p),Ka(p,p.return);break;case 27:vg(p);case 26:case 5:$r(h,p,a),a&&o===null&&x&4&&bg(p),Ka(p,p.return);break;case 12:$r(h,p,a);break;case 31:$r(h,p,a),a&&x&4&&kg(h,p);break;case 13:$r(h,p,a),a&&x&4&&Cg(h,p);break;case 22:p.memoizedState===null&&$r(h,p,a),Ka(p,p.return);break;case 30:break;default:$r(h,p,a)}i=i.sibling}}function kf(t,i){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(t=i.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&za(a))}function Cf(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&za(t))}function ur(t,i,a,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)jg(t,i,a,o),i=i.sibling}function jg(t,i,a,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:ur(t,i,a,o),h&2048&&Xa(9,i);break;case 1:ur(t,i,a,o);break;case 3:ur(t,i,a,o),h&2048&&(t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&za(t)));break;case 12:if(h&2048){ur(t,i,a,o),t=i.stateNode;try{var p=i.memoizedProps,x=p.id,S=p.onPostCommit;typeof S=="function"&&S(x,i.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(I){yt(i,i.return,I)}}else ur(t,i,a,o);break;case 31:ur(t,i,a,o);break;case 13:ur(t,i,a,o);break;case 23:break;case 22:p=i.stateNode,x=i.alternate,i.memoizedState!==null?p._visibility&2?ur(t,i,a,o):Qa(t,i):p._visibility&2?ur(t,i,a,o):(p._visibility|=2,Bs(t,i,a,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&kf(x,i);break;case 24:ur(t,i,a,o),h&2048&&Cf(i.alternate,i);break;default:ur(t,i,a,o)}}function Bs(t,i,a,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=t,x=i,S=a,I=o,ne=x.flags;switch(x.tag){case 0:case 11:case 15:Bs(p,x,S,I,h),Xa(8,x);break;case 23:break;case 22:var ue=x.stateNode;x.memoizedState!==null?ue._visibility&2?Bs(p,x,S,I,h):Qa(p,x):(ue._visibility|=2,Bs(p,x,S,I,h)),h&&ne&2048&&kf(x.alternate,x);break;case 24:Bs(p,x,S,I,h),h&&ne&2048&&Cf(x.alternate,x);break;default:Bs(p,x,S,I,h)}i=i.sibling}}function Qa(t,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=t,o=i,h=o.flags;switch(o.tag){case 22:Qa(a,o),h&2048&&kf(o.alternate,o);break;case 24:Qa(a,o),h&2048&&Cf(o.alternate,o);break;default:Qa(a,o)}i=i.sibling}}var Za=8192;function Ps(t,i,a){if(t.subtreeFlags&Za)for(t=t.child;t!==null;)Ng(t,i,a),t=t.sibling}function Ng(t,i,a){switch(t.tag){case 26:Ps(t,i,a),t.flags&Za&&t.memoizedState!==null&&Rw(a,or,t.memoizedState,t.memoizedProps);break;case 5:Ps(t,i,a);break;case 3:case 4:var o=or;or=Xo(t.stateNode.containerInfo),Ps(t,i,a),or=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=Za,Za=16777216,Ps(t,i,a),Za=o):Ps(t,i,a));break;default:Ps(t,i,a)}}function Og(t){var i=t.alternate;if(i!==null&&(t=i.child,t!==null)){i.child=null;do i=t.sibling,t.sibling=null,t=i;while(t!==null)}}function Wa(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];Wt=o,Mg(o,t)}Og(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Rg(t),t=t.sibling}function Rg(t){switch(t.tag){case 0:case 11:case 15:Wa(t),t.flags&2048&&gi(9,t,t.return);break;case 3:Wa(t);break;case 12:Wa(t);break;case 22:var i=t.stateNode;t.memoizedState!==null&&i._visibility&2&&(t.return===null||t.return.tag!==13)?(i._visibility&=-3,zo(t)):Wa(t);break;default:Wa(t)}}function zo(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];Wt=o,Mg(o,t)}Og(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:gi(8,i,i.return),zo(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,zo(i));break;default:zo(i)}t=t.sibling}}function Mg(t,i){for(;Wt!==null;){var a=Wt;switch(a.tag){case 0:case 11:case 15:gi(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:za(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,Wt=o;else e:for(a=t;Wt!==null;){o=Wt;var h=o.sibling,p=o.return;if(_g(o),o===a){Wt=null;break e}if(h!==null){h.return=p,Wt=h;break e}Wt=p}}}var Vv={getCacheForType:function(t){var i=rn(Yt),a=i.data.get(t);return a===void 0&&(a=t(),i.data.set(t,a)),a},cacheSignal:function(){return rn(Yt).controller.signal}},Jv=typeof WeakMap=="function"?WeakMap:Map,ht=0,At=null,et=null,rt=0,gt=0,Rn=null,yi=!1,qs=!1,Af=!1,Yr=0,qt=0,bi=0,as=0,Tf=0,Mn=0,Hs=0,el=null,_n=null,jf=!1,Uo=0,Dg=0,Bo=1/0,Po=null,xi=null,Zt=0,vi=null,Is=null,Gr=0,Nf=0,Of=null,Lg=null,tl=0,Rf=null;function Dn(){return(ht&2)!==0&&rt!==0?rt&-rt:P.T!==null?Bf():_a()}function zg(){if(Mn===0)if((rt&536870912)===0||lt){var t=Tr;Tr<<=1,(Tr&3932160)===0&&(Tr=262144),Mn=t}else Mn=536870912;return t=Nn.current,t!==null&&(t.flags|=32),Mn}function En(t,i,a){(t===At&&(gt===2||gt===9)||t.cancelPendingCommit!==null)&&(Fs(t,0),wi(t,rt,Mn,!1)),sr(t,a),((ht&2)===0||t!==At)&&(t===At&&((ht&2)===0&&(as|=a),qt===4&&wi(t,rt,Mn,!1)),br(t))}function Ug(t,i,a){if((ht&6)!==0)throw Error(s(327));var o=!a&&(i&127)===0&&(i&t.expiredLanes)===0||Hi(t,i),h=o?Qv(t,i):Df(t,i,!0),p=o;do{if(h===0){qs&&!o&&wi(t,i,0,!1);break}else{if(a=t.current.alternate,p&&!Xv(a)){h=Df(t,i,!1),p=!1;continue}if(h===2){if(p=i,t.errorRecoveryDisabledLanes&p)var x=0;else x=t.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){i=x;e:{var S=t;h=el;var I=S.current.memoizedState.isDehydrated;if(I&&(Fs(S,x).flags|=256),x=Df(S,x,!1),x!==2){if(Af&&!I){S.errorRecoveryDisabledLanes|=p,as|=p,h=4;break e}p=_n,_n=h,p!==null&&(_n===null?_n=p:_n.push.apply(_n,p))}h=x}if(p=!1,h!==2)continue}}if(h===1){Fs(t,0),wi(t,i,0,!0);break}e:{switch(o=t,p=h,p){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:wi(o,i,Mn,!yi);break e;case 2:_n=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=Uo+300-bt(),10<h)){if(wi(o,i,Mn,!yi),qi(o,0,!0)!==0)break e;Gr=i,o.timeoutHandle=my(Bg.bind(null,o,a,_n,Po,jf,i,Mn,as,Hs,yi,p,"Throttled",-0,0),h);break e}Bg(o,a,_n,Po,jf,i,Mn,as,Hs,yi,p,null,-0,0)}}break}while(!0);br(t)}function Bg(t,i,a,o,h,p,x,S,I,ne,ue,ge,re,le){if(t.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:Or},Ng(i,p,ge);var Me=(p&62914560)===p?Uo-bt():(p&4194048)===p?Dg-bt():0;if(Me=Mw(ge,Me),Me!==null){Gr=p,t.cancelPendingCommit=Me(Gg.bind(null,t,i,p,a,o,h,x,S,I,ue,ge,null,re,le)),wi(t,p,x,!ne);return}}Gg(t,i,p,a,o,h,x,S,I)}function Xv(t){for(var i=t;;){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(!Tn(p(),h))return!1}catch{return!1}}if(a=i.child,i.subtreeFlags&16384&&a!==null)a.return=i,i=a;else{if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function wi(t,i,a,o){i&=~Tf,i&=~as,t.suspendedLanes|=i,t.pingedLanes&=~i,o&&(t.warmLanes|=i),o=t.expirationTimes;for(var h=i;0<h;){var p=31-mt(h),x=1<<p;o[p]=-1,h&=~x}a!==0&&ii(t,a,i)}function qo(){return(ht&6)===0?(nl(0),!1):!0}function Mf(){if(et!==null){if(gt===0)var t=et.return;else t=et,Lr=Qi=null,Jc(t),Ms=null,Ba=0,t=et;for(;t!==null;)pg(t.alternate,t),t=t.return;et=null}}function Fs(t,i){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,pw(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Gr=0,Mf(),At=t,et=a=Mr(t.current,null),rt=i,gt=0,Rn=null,yi=!1,qs=Hi(t,i),Af=!1,Hs=Mn=Tf=as=bi=qt=0,_n=el=null,jf=!1,(i&8)!==0&&(i|=i&32);var o=t.entangledLanes;if(o!==0)for(t=t.entanglements,o&=i;0<o;){var h=31-mt(o),p=1<<h;i|=t[h],o&=~p}return Yr=i,ao(),a}function Pg(t,i){Je=null,P.H=Ga,i===Rs||i===po?(i=tp(),gt=3):i===zc?(i=tp(),gt=4):gt=i===ff?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Rn=i,et===null&&(qt=1,jo(t,Gn(i,t.current)))}function qg(){var t=Nn.current;return t===null?!0:(rt&4194048)===rt?Kn===null:(rt&62914560)===rt||(rt&536870912)!==0?t===Kn:!1}function Hg(){var t=P.H;return P.H=Ga,t===null?Ga:t}function Ig(){var t=P.A;return P.A=Vv,t}function Ho(){qt=4,yi||(rt&4194048)!==rt&&Nn.current!==null||(qs=!0),(bi&134217727)===0&&(as&134217727)===0||At===null||wi(At,rt,Mn,!1)}function Df(t,i,a){var o=ht;ht|=2;var h=Hg(),p=Ig();(At!==t||rt!==i)&&(Po=null,Fs(t,i)),i=!1;var x=qt;e:do try{if(gt!==0&&et!==null){var S=et,I=Rn;switch(gt){case 8:Mf(),x=6;break e;case 3:case 2:case 9:case 6:Nn.current===null&&(i=!0);var ne=gt;if(gt=0,Rn=null,$s(t,S,I,ne),a&&qs){x=0;break e}break;default:ne=gt,gt=0,Rn=null,$s(t,S,I,ne)}}Kv(),x=qt;break}catch(ue){Pg(t,ue)}while(!0);return i&&t.shellSuspendCounter++,Lr=Qi=null,ht=o,P.H=h,P.A=p,et===null&&(At=null,rt=0,ao()),x}function Kv(){for(;et!==null;)Fg(et)}function Qv(t,i){var a=ht;ht|=2;var o=Hg(),h=Ig();At!==t||rt!==i?(Po=null,Bo=bt()+500,Fs(t,i)):qs=Hi(t,i);e:do try{if(gt!==0&&et!==null){i=et;var p=Rn;t:switch(gt){case 1:gt=0,Rn=null,$s(t,i,p,1);break;case 2:case 9:if(Wm(p)){gt=0,Rn=null,$g(i);break}i=function(){gt!==2&>!==9||At!==t||(gt=7),br(t)},p.then(i,i);break e;case 3:gt=7;break e;case 4:gt=5;break e;case 7:Wm(p)?(gt=0,Rn=null,$g(i)):(gt=0,Rn=null,$s(t,i,p,7));break;case 5:var x=null;switch(et.tag){case 26:x=et.memoizedState;case 5:case 27:var S=et;if(x?jy(x):S.stateNode.complete){gt=0,Rn=null;var I=S.sibling;if(I!==null)et=I;else{var ne=S.return;ne!==null?(et=ne,Io(ne)):et=null}break t}}gt=0,Rn=null,$s(t,i,p,5);break;case 6:gt=0,Rn=null,$s(t,i,p,6);break;case 8:Mf(),qt=6;break e;default:throw Error(s(462))}}Zv();break}catch(ue){Pg(t,ue)}while(!0);return Lr=Qi=null,P.H=o,P.A=h,ht=a,et!==null?0:(At=null,rt=0,ao(),qt)}function Zv(){for(;et!==null&&!fn();)Fg(et)}function Fg(t){var i=dg(t.alternate,t,Yr);t.memoizedProps=t.pendingProps,i===null?Io(t):et=i}function $g(t){var i=t,a=i.alternate;switch(i.tag){case 15:case 0:i=lg(a,i,i.pendingProps,i.type,void 0,rt);break;case 11:i=lg(a,i,i.pendingProps,i.type.render,i.ref,rt);break;case 5:Jc(i);default:pg(a,i),i=et=Im(i,Yr),i=dg(a,i,Yr)}t.memoizedProps=t.pendingProps,i===null?Io(t):et=i}function $s(t,i,a,o){Lr=Qi=null,Jc(i),Ms=null,Ba=0;var h=i.return;try{if(qv(t,h,i,a,rt)){qt=1,jo(t,Gn(a,t.current)),et=null;return}}catch(p){if(h!==null)throw et=h,p;qt=1,jo(t,Gn(a,t.current)),et=null;return}i.flags&32768?(lt||o===1?t=!0:qs||(rt&536870912)!==0?t=!1:(yi=t=!0,(o===2||o===9||o===3||o===6)&&(o=Nn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Yg(i,t)):Io(i)}function Io(t){var i=t;do{if((i.flags&32768)!==0){Yg(i,yi);return}t=i.return;var a=Fv(i.alternate,i,Yr);if(a!==null){et=a;return}if(i=i.sibling,i!==null){et=i;return}et=i=t}while(i!==null);qt===0&&(qt=5)}function Yg(t,i){do{var a=$v(t.alternate,t);if(a!==null){a.flags&=32767,et=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(t=t.sibling,t!==null)){et=t;return}et=t=a}while(t!==null);qt=6,et=null}function Gg(t,i,a,o,h,p,x,S,I){t.cancelPendingCommit=null;do Fo();while(Zt!==0);if((ht&6)!==0)throw Error(s(327));if(i!==null){if(i===t.current)throw Error(s(177));if(p=i.lanes|i.childLanes,p|=wc,ri(t,a,p,x,S,I),t===At&&(et=At=null,rt=0),Is=i,vi=t,Gr=a,Nf=p,Of=h,Lg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,nw(oe,function(){return Qg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=P.T,P.T=null,h=se.p,se.p=2,x=ht,ht|=4;try{Yv(t,i,a)}finally{ht=x,se.p=h,P.T=o}}Zt=1,Vg(),Jg(),Xg()}}function Vg(){if(Zt===1){Zt=0;var t=vi,i=Is,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=P.T,P.T=null;var o=se.p;se.p=2;var h=ht;ht|=4;try{Ag(i,t);var p=Gf,x=Mm(t.containerInfo),S=p.focusedElem,I=p.selectionRange;if(x!==S&&S&&S.ownerDocument&&Rm(S.ownerDocument.documentElement,S)){if(I!==null&&gc(S)){var ne=I.start,ue=I.end;if(ue===void 0&&(ue=ne),"selectionStart"in S)S.selectionStart=ne,S.selectionEnd=Math.min(ue,S.value.length);else{var ge=S.ownerDocument||document,re=ge&&ge.defaultView||window;if(re.getSelection){var le=re.getSelection(),Me=S.textContent.length,Fe=Math.min(I.start,Me),wt=I.end===void 0?Fe:Math.min(I.end,Me);!le.extend&&Fe>wt&&(x=wt,wt=Fe,Fe=x);var X=Om(S,Fe),G=Om(S,wt);if(X&&G&&(le.rangeCount!==1||le.anchorNode!==X.node||le.anchorOffset!==X.offset||le.focusNode!==G.node||le.focusOffset!==G.offset)){var te=ge.createRange();te.setStart(X.node,X.offset),le.removeAllRanges(),Fe>wt?(le.addRange(te),le.extend(G.node,G.offset)):(te.setEnd(G.node,G.offset),le.addRange(te))}}}}for(ge=[],le=S;le=le.parentNode;)le.nodeType===1&&ge.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<ge.length;S++){var he=ge[S];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}tu=!!Yf,Gf=Yf=null}finally{ht=h,se.p=o,P.T=a}}t.current=i,Zt=2}}function Jg(){if(Zt===2){Zt=0;var t=vi,i=Is,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=P.T,P.T=null;var o=se.p;se.p=2;var h=ht;ht|=4;try{Sg(t,i.alternate,i)}finally{ht=h,se.p=o,P.T=a}}Zt=3}}function Xg(){if(Zt===4||Zt===3){Zt=0,rr();var t=vi,i=Is,a=Gr,o=Lg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Zt=5:(Zt=0,Is=vi=null,Kg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(xi=null),Fi(a),i=i.stateNode,kt&&typeof kt.onCommitFiberRoot=="function")try{kt.onCommitFiberRoot(at,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=P.T,h=se.p,se.p=2,P.T=null;try{for(var p=t.onRecoverableError,x=0;x<o.length;x++){var S=o[x];p(S.value,{componentStack:S.stack})}}finally{P.T=i,se.p=h}}(Gr&3)!==0&&Fo(),br(t),h=t.pendingLanes,(a&261930)!==0&&(h&42)!==0?t===Rf?tl++:(tl=0,Rf=t):tl=0,nl(0)}}function Kg(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,za(i)))}function Fo(){return Vg(),Jg(),Xg(),Qg()}function Qg(){if(Zt!==5)return!1;var t=vi,i=Nf;Nf=0;var a=Fi(Gr),o=P.T,h=se.p;try{se.p=32>a?32:a,P.T=null,a=Of,Of=null;var p=vi,x=Gr;if(Zt=0,Is=vi=null,Gr=0,(ht&6)!==0)throw Error(s(331));var S=ht;if(ht|=4,Rg(p.current),jg(p,p.current,x,a),ht=S,nl(0,!1),kt&&typeof kt.onPostCommitFiberRoot=="function")try{kt.onPostCommitFiberRoot(at,p)}catch{}return!0}finally{se.p=h,P.T=o,Kg(t,i)}}function Zg(t,i,a){i=Gn(a,i),i=cf(t.stateNode,i,2),t=di(t,i,2),t!==null&&(sr(t,2),br(t))}function yt(t,i,a){if(t.tag===3)Zg(t,t,a);else for(;i!==null;){if(i.tag===3){Zg(i,t,a);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(xi===null||!xi.has(o))){t=Gn(a,t),a=Wp(2),o=di(i,a,2),o!==null&&(eg(a,o,i,t),sr(o,2),br(o));break}}i=i.return}}function Lf(t,i,a){var o=t.pingCache;if(o===null){o=t.pingCache=new Jv;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)||(Af=!0,h.add(a),t=Wv.bind(null,t,i,a),i.then(t,t))}function Wv(t,i,a){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,At===t&&(rt&a)===a&&(qt===4||qt===3&&(rt&62914560)===rt&&300>bt()-Uo?(ht&2)===0&&Fs(t,0):Tf|=a,Hs===rt&&(Hs=0)),br(t)}function Wg(t,i){i===0&&(i=ps()),t=Ji(t,i),t!==null&&(sr(t,i),br(t))}function ew(t){var i=t.memoizedState,a=0;i!==null&&(a=i.retryLane),Wg(t,a)}function tw(t,i){var a=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(a=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(i),Wg(t,a)}function nw(t,i){return Ht(t,i)}var $o=null,Ys=null,zf=!1,Yo=!1,Uf=!1,Si=0;function br(t){t!==Ys&&t.next===null&&(Ys===null?$o=Ys=t:Ys=Ys.next=t),Yo=!0,zf||(zf=!0,iw())}function nl(t,i){if(!Uf&&Yo){Uf=!0;do for(var a=!1,o=$o;o!==null;){if(t!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var x=o.suspendedLanes,S=o.pingedLanes;p=(1<<31-mt(42|t)+1)-1,p&=h&~(x&~S),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,ry(o,p))}else p=rt,p=qi(o,o===At?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Hi(o,p)||(a=!0,ry(o,p));o=o.next}while(a);Uf=!1}}function rw(){ey()}function ey(){Yo=zf=!1;var t=0;Si!==0&&mw()&&(t=Si);for(var i=bt(),a=null,o=$o;o!==null;){var h=o.next,p=ty(o,i);p===0?(o.next=null,a===null?$o=h:a.next=h,h===null&&(Ys=a)):(a=o,(t!==0||(p&3)!==0)&&(Yo=!0)),o=h}Zt!==0&&Zt!==5||nl(t),Si!==0&&(Si=0)}function ty(t,i){for(var a=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var x=31-mt(p),S=1<<x,I=h[x];I===-1?((S&a)===0||(S&o)!==0)&&(h[x]=Sa(S,i)):I<=i&&(t.expiredLanes|=S),p&=~S}if(i=At,a=rt,a=qi(t,t===i?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,a===0||t===i&&(gt===2||gt===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&Ge(o),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Hi(t,a)){if(i=a&-a,i===t.callbackPriority)return i;switch(o!==null&&Ge(o),Fi(a)){case 2:case 8:a=Se;break;case 32:a=oe;break;case 268435456:a=ke;break;default:a=oe}return o=ny.bind(null,t),a=Ht(a,o),t.callbackPriority=i,t.callbackNode=a,i}return o!==null&&o!==null&&Ge(o),t.callbackPriority=2,t.callbackNode=null,2}function ny(t,i){if(Zt!==0&&Zt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(Fo()&&t.callbackNode!==a)return null;var o=rt;return o=qi(t,t===At?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(Ug(t,o,i),ty(t,bt()),t.callbackNode!=null&&t.callbackNode===a?ny.bind(null,t):null)}function ry(t,i){if(Fo())return null;Ug(t,i,!0)}function iw(){gw(function(){(ht&6)!==0?Ht(ce,rw):ey()})}function Bf(){if(Si===0){var t=Ns;t===0&&(t=ei,ei<<=1,(ei&261888)===0&&(ei=256)),Si=t}return Si}function iy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Zl(""+t)}function sy(t,i){var a=i.ownerDocument.createElement("input");return a.name=i.name,a.value=i.value,t.id&&a.setAttribute("form",t.id),i.parentNode.insertBefore(a,i),t=new FormData(t),a.parentNode.removeChild(a),t}function sw(t,i,a,o,h){if(i==="submit"&&a&&a.stateNode===h){var p=iy((h[Bt]||null).action),x=o.submitter;x&&(i=(i=x[Bt]||null)?iy(i.formAction):x.getAttribute("formAction"),i!==null&&(p=i,x=null));var S=new no("action","action",null,o,h);t.push({event:S,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Si!==0){var I=x?sy(h,x):new FormData(h);rf(a,{pending:!0,data:I,method:h.method,action:p},null,I)}}else typeof p=="function"&&(S.preventDefault(),I=x?sy(h,x):new FormData(h),rf(a,{pending:!0,data:I,method:h.method,action:p},p,I))},currentTarget:h}]})}}for(var Pf=0;Pf<vc.length;Pf++){var qf=vc[Pf],aw=qf.toLowerCase(),lw=qf[0].toUpperCase()+qf.slice(1);lr(aw,"on"+lw)}lr(zm,"onAnimationEnd"),lr(Um,"onAnimationIteration"),lr(Bm,"onAnimationStart"),lr("dblclick","onDoubleClick"),lr("focusin","onFocus"),lr("focusout","onBlur"),lr(_v,"onTransitionRun"),lr(Ev,"onTransitionStart"),lr(kv,"onTransitionCancel"),lr(Pm,"onTransitionEnd"),ie("onMouseEnter",["mouseout","mouseover"]),ie("onMouseLeave",["mouseout","mouseover"]),ie("onPointerEnter",["pointerout","pointerover"]),ie("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 rl="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(" "),ow=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(rl));function ay(t,i){i=(i&4)!==0;for(var a=0;a<t.length;a++){var o=t[a],h=o.event;o=o.listeners;e:{var p=void 0;if(i)for(var x=o.length-1;0<=x;x--){var S=o[x],I=S.instance,ne=S.currentTarget;if(S=S.listener,I!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=ne;try{p(h)}catch(ue){so(ue)}h.currentTarget=null,p=I}else for(x=0;x<o.length;x++){if(S=o[x],I=S.instance,ne=S.currentTarget,S=S.listener,I!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=ne;try{p(h)}catch(ue){so(ue)}h.currentTarget=null,p=I}}}}function tt(t,i){var a=i[$i];a===void 0&&(a=i[$i]=new Set);var o=t+"__bubble";a.has(o)||(ly(i,t,2,!1),a.add(o))}function Hf(t,i,a){var o=0;i&&(o|=4),ly(a,t,o,i)}var Go="_reactListening"+Math.random().toString(36).slice(2);function If(t){if(!t[Go]){t[Go]=!0,K.forEach(function(a){a!=="selectionchange"&&(ow.has(a)||Hf(a,!1,t),Hf(a,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[Go]||(i[Go]=!0,Hf("selectionchange",!1,i))}}function ly(t,i,a,o){switch(zy(i)){case 2:var h=zw;break;case 8:h=Uw;break;default:h=rh}a=h.bind(null,i,a,t),h=void 0,!lc||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(i,a,{capture:!0,passive:h}):t.addEventListener(i,a,!0):h!==void 0?t.addEventListener(i,a,{passive:h}):t.addEventListener(i,a,!1)}function Ff(t,i,a,o,h){var p=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var x=o.tag;if(x===3||x===4){var S=o.stateNode.containerInfo;if(S===h)break;if(x===4)for(x=o.return;x!==null;){var I=x.tag;if((I===3||I===4)&&x.stateNode.containerInfo===h)return;x=x.return}for(;S!==null;){if(x=E(S),x===null)return;if(I=x.tag,I===5||I===6||I===26||I===27){o=p=x;continue e}S=S.parentNode}}o=o.return}hm(function(){var ne=p,ue=sc(a),ge=[];e:{var re=qm.get(t);if(re!==void 0){var le=no,Me=t;switch(t){case"keypress":if(eo(a)===0)break e;case"keydown":case"keyup":le=tv;break;case"focusin":Me="focus",le=fc;break;case"focusout":Me="blur",le=fc;break;case"beforeblur":case"afterblur":le=fc;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=pm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=F1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=iv;break;case zm:case Um:case Bm:le=G1;break;case Pm:le=av;break;case"scroll":case"scrollend":le=H1;break;case"wheel":le=ov;break;case"copy":case"cut":case"paste":le=J1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=ym;break;case"toggle":case"beforetoggle":le=cv}var Fe=(i&4)!==0,wt=!Fe&&(t==="scroll"||t==="scrollend"),X=Fe?re!==null?re+"Capture":null:re;Fe=[];for(var G=ne,te;G!==null;){var he=G;if(te=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||te===null||X===null||(he=ka(G,X),he!=null&&Fe.push(il(G,he,te))),wt)break;G=G.return}0<Fe.length&&(re=new le(re,Me,null,a,ue),ge.push({event:re,listeners:Fe}))}}if((i&7)===0){e:{if(re=t==="mouseover"||t==="pointerover",le=t==="mouseout"||t==="pointerout",re&&a!==ic&&(Me=a.relatedTarget||a.fromElement)&&(E(Me)||Me[An]))break e;if((le||re)&&(re=ue.window===ue?ue:(re=ue.ownerDocument)?re.defaultView||re.parentWindow:window,le?(Me=a.relatedTarget||a.toElement,le=ne,Me=Me?E(Me):null,Me!==null&&(wt=u(Me),Fe=Me.tag,Me!==wt||Fe!==5&&Fe!==27&&Fe!==6)&&(Me=null)):(le=null,Me=ne),le!==Me)){if(Fe=pm,he="onMouseLeave",X="onMouseEnter",G="mouse",(t==="pointerout"||t==="pointerover")&&(Fe=ym,he="onPointerLeave",X="onPointerEnter",G="pointer"),wt=le==null?re:T(le),te=Me==null?re:T(Me),re=new Fe(he,G+"leave",le,a,ue),re.target=wt,re.relatedTarget=te,he=null,E(ue)===ne&&(Fe=new Fe(X,G+"enter",Me,a,ue),Fe.target=te,Fe.relatedTarget=wt,he=Fe),wt=he,le&&Me)t:{for(Fe=uw,X=le,G=Me,te=0,he=X;he;he=Fe(he))te++;he=0;for(var Pe=G;Pe;Pe=Fe(Pe))he++;for(;0<te-he;)X=Fe(X),te--;for(;0<he-te;)G=Fe(G),he--;for(;te--;){if(X===G||G!==null&&X===G.alternate){Fe=X;break t}X=Fe(X),G=Fe(G)}Fe=null}else Fe=null;le!==null&&oy(ge,re,le,Fe,!1),Me!==null&&wt!==null&&oy(ge,wt,Me,Fe,!0)}}e:{if(re=ne?T(ne):window,le=re.nodeName&&re.nodeName.toLowerCase(),le==="select"||le==="input"&&re.type==="file")var ct=km;else if(_m(re))if(Cm)ct=vv;else{ct=bv;var De=yv}else le=re.nodeName,!le||le.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?ne&&rc(ne.elementType)&&(ct=km):ct=xv;if(ct&&(ct=ct(t,ne))){Em(ge,ct,a,ue);break e}De&&De(t,re,ne),t==="focusout"&&ne&&re.type==="number"&&ne.memoizedProps.value!=null&&nc(re,"number",re.value)}switch(De=ne?T(ne):window,t){case"focusin":(_m(De)||De.contentEditable==="true")&&(Ss=De,yc=ne,Ma=null);break;case"focusout":Ma=yc=Ss=null;break;case"mousedown":bc=!0;break;case"contextmenu":case"mouseup":case"dragend":bc=!1,Dm(ge,a,ue);break;case"selectionchange":if(Sv)break;case"keydown":case"keyup":Dm(ge,a,ue)}var Xe;if(dc)e:{switch(t){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else ws?wm(t,a)&&(it="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(it="onCompositionStart");it&&(bm&&a.locale!=="ko"&&(ws||it!=="onCompositionStart"?it==="onCompositionEnd"&&ws&&(Xe=dm()):(ai=ue,oc="value"in ai?ai.value:ai.textContent,ws=!0)),De=Vo(ne,it),0<De.length&&(it=new gm(it,t,null,a,ue),ge.push({event:it,listeners:De}),Xe?it.data=Xe:(Xe=Sm(a),Xe!==null&&(it.data=Xe)))),(Xe=hv?dv(t,a):mv(t,a))&&(it=Vo(ne,"onBeforeInput"),0<it.length&&(De=new gm("onBeforeInput","beforeinput",null,a,ue),ge.push({event:De,listeners:it}),De.data=Xe)),sw(ge,t,ne,a,ue)}ay(ge,i)})}function il(t,i,a){return{instance:t,listener:i,currentTarget:a}}function Vo(t,i){for(var a=i+"Capture",o=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=ka(t,a),h!=null&&o.unshift(il(t,h,p)),h=ka(t,i),h!=null&&o.push(il(t,h,p))),t.tag===3)return o;t=t.return}return[]}function uw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function oy(t,i,a,o,h){for(var p=i._reactName,x=[];a!==null&&a!==o;){var S=a,I=S.alternate,ne=S.stateNode;if(S=S.tag,I!==null&&I===o)break;S!==5&&S!==26&&S!==27||ne===null||(I=ne,h?(ne=ka(a,p),ne!=null&&x.unshift(il(a,ne,I))):h||(ne=ka(a,p),ne!=null&&x.push(il(a,ne,I)))),a=a.return}x.length!==0&&t.push({event:i,listeners:x})}var cw=/\r\n?/g,fw=/\u0000|\uFFFD/g;function uy(t){return(typeof t=="string"?t:""+t).replace(cw,`
|
|
49
|
-
`).replace(fw,"")}function cy(t,i){return i=uy(i),uy(t)===i}function vt(t,i,a,o,h,p){switch(a){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||bs(t,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&bs(t,""+o);break;case"className":ar(t,"class",o);break;case"tabIndex":ar(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":ar(t,a,o);break;case"style":cm(t,o,p);break;case"data":if(i!=="object"){ar(t,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||a!=="href")){t.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(a);break}o=Zl(""+o),t.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){t.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(t,i,"name",h.name,h,null),vt(t,i,"formEncType",h.formEncType,h,null),vt(t,i,"formMethod",h.formMethod,h,null),vt(t,i,"formTarget",h.formTarget,h,null)):(vt(t,i,"encType",h.encType,h,null),vt(t,i,"method",h.method,h,null),vt(t,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(a);break}o=Zl(""+o),t.setAttribute(a,o);break;case"onClick":o!=null&&(t.onclick=Or);break;case"onScroll":o!=null&&tt("scroll",t);break;case"onScrollEnd":o!=null&&tt("scrollend",t);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));t.innerHTML=a}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.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"){t.removeAttribute("xlink:href");break}a=Zl(""+o),t.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"?t.setAttribute(a,""+o):t.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"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":o===!0?t.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,o):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(a,o):t.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(a):t.setAttribute(a,o);break;case"popover":tt("beforetoggle",t),tt("toggle",t),ln(t,"popover",o);break;case"xlinkActuate":Nr(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Nr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Nr(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Nr(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Nr(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Nr(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Nr(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Nr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Nr(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":ln(t,"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=P1.get(a)||a,ln(t,a,o))}}function $f(t,i,a,o,h,p){switch(a){case"style":cm(t,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));t.innerHTML=a}}break;case"children":typeof o=="string"?bs(t,o):(typeof o=="number"||typeof o=="bigint")&&bs(t,""+o);break;case"onScroll":o!=null&&tt("scroll",t);break;case"onScrollEnd":o!=null&&tt("scrollend",t);break;case"onClick":o!=null&&(t.onclick=Or);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=t[Bt]||null,p=p!=null?p[a]:null,typeof p=="function"&&t.removeEventListener(i,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(i,o,h);break e}a in t?t[a]=o:o===!0?t.setAttribute(a,""):ln(t,a,o)}}}function an(t,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",t),tt("load",t);var o=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var x=a[p];if(x!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:vt(t,i,p,x,a,null)}}h&&vt(t,i,"srcSet",a.srcSet,a,null),o&&vt(t,i,"src",a.src,a,null);return;case"input":tt("invalid",t);var S=p=x=h=null,I=null,ne=null;for(o in a)if(a.hasOwnProperty(o)){var ue=a[o];if(ue!=null)switch(o){case"name":h=ue;break;case"type":x=ue;break;case"checked":I=ue;break;case"defaultChecked":ne=ue;break;case"value":p=ue;break;case"defaultValue":S=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,i));break;default:vt(t,i,o,ue,a,null)}}am(t,p,S,I,ne,x,h,!1);return;case"select":tt("invalid",t),o=x=p=null;for(h in a)if(a.hasOwnProperty(h)&&(S=a[h],S!=null))switch(h){case"value":p=S;break;case"defaultValue":x=S;break;case"multiple":o=S;default:vt(t,i,h,S,a,null)}i=p,a=x,t.multiple=!!o,i!=null?ys(t,!!o,i,!1):a!=null&&ys(t,!!o,a,!0);return;case"textarea":tt("invalid",t),p=h=o=null;for(x in a)if(a.hasOwnProperty(x)&&(S=a[x],S!=null))switch(x){case"value":o=S;break;case"defaultValue":h=S;break;case"children":p=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(s(91));break;default:vt(t,i,x,S,a,null)}om(t,o,h,p);return;case"option":for(I in a)if(a.hasOwnProperty(I)&&(o=a[I],o!=null))switch(I){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:vt(t,i,I,o,a,null)}return;case"dialog":tt("beforetoggle",t),tt("toggle",t),tt("cancel",t),tt("close",t);break;case"iframe":case"object":tt("load",t);break;case"video":case"audio":for(o=0;o<rl.length;o++)tt(rl[o],t);break;case"image":tt("error",t),tt("load",t);break;case"details":tt("toggle",t);break;case"embed":case"source":case"link":tt("error",t),tt("load",t);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(t,i,ne,o,a,null)}return;default:if(rc(i)){for(ue in a)a.hasOwnProperty(ue)&&(o=a[ue],o!==void 0&&$f(t,i,ue,o,a,void 0));return}}for(S in a)a.hasOwnProperty(S)&&(o=a[S],o!=null&&vt(t,i,S,o,a,null))}function hw(t,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,x=null,S=null,I=null,ne=null,ue=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":I=ge;default:o.hasOwnProperty(le)||vt(t,i,le,null,o,ge)}}for(var re in o){var le=o[re];if(ge=a[re],o.hasOwnProperty(re)&&(le!=null||ge!=null))switch(re){case"type":p=le;break;case"name":h=le;break;case"checked":ne=le;break;case"defaultChecked":ue=le;break;case"value":x=le;break;case"defaultValue":S=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(s(137,i));break;default:le!==ge&&vt(t,i,re,le,o,ge)}}tc(t,x,S,I,ne,ue,p,h);return;case"select":le=x=S=re=null;for(p in a)if(I=a[p],a.hasOwnProperty(p)&&I!=null)switch(p){case"value":break;case"multiple":le=I;default:o.hasOwnProperty(p)||vt(t,i,p,null,o,I)}for(h in o)if(p=o[h],I=a[h],o.hasOwnProperty(h)&&(p!=null||I!=null))switch(h){case"value":re=p;break;case"defaultValue":S=p;break;case"multiple":x=p;default:p!==I&&vt(t,i,h,p,o,I)}i=S,a=x,o=le,re!=null?ys(t,!!a,re,!1):!!o!=!!a&&(i!=null?ys(t,!!a,i,!0):ys(t,!!a,a?[]:"",!1));return;case"textarea":le=re=null;for(S in a)if(h=a[S],a.hasOwnProperty(S)&&h!=null&&!o.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:vt(t,i,S,null,o,h)}for(x in o)if(h=o[x],p=a[x],o.hasOwnProperty(x)&&(h!=null||p!=null))switch(x){case"value":re=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&vt(t,i,x,h,o,p)}lm(t,re,le);return;case"option":for(var Me in a)if(re=a[Me],a.hasOwnProperty(Me)&&re!=null&&!o.hasOwnProperty(Me))switch(Me){case"selected":t.selected=!1;break;default:vt(t,i,Me,null,o,re)}for(I in o)if(re=o[I],le=a[I],o.hasOwnProperty(I)&&re!==le&&(re!=null||le!=null))switch(I){case"selected":t.selected=re&&typeof re!="function"&&typeof re!="symbol";break;default:vt(t,i,I,re,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 Fe in a)re=a[Fe],a.hasOwnProperty(Fe)&&re!=null&&!o.hasOwnProperty(Fe)&&vt(t,i,Fe,null,o,re);for(ne in o)if(re=o[ne],le=a[ne],o.hasOwnProperty(ne)&&re!==le&&(re!=null||le!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(s(137,i));break;default:vt(t,i,ne,re,o,le)}return;default:if(rc(i)){for(var wt in a)re=a[wt],a.hasOwnProperty(wt)&&re!==void 0&&!o.hasOwnProperty(wt)&&$f(t,i,wt,void 0,o,re);for(ue in o)re=o[ue],le=a[ue],!o.hasOwnProperty(ue)||re===le||re===void 0&&le===void 0||$f(t,i,ue,re,o,le);return}}for(var X in a)re=a[X],a.hasOwnProperty(X)&&re!=null&&!o.hasOwnProperty(X)&&vt(t,i,X,null,o,re);for(ge in o)re=o[ge],le=a[ge],!o.hasOwnProperty(ge)||re===le||re==null&&le==null||vt(t,i,ge,re,o,le)}function fy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function dw(){if(typeof performance.getEntriesByType=="function"){for(var t=0,i=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var h=a[o],p=h.transferSize,x=h.initiatorType,S=h.duration;if(p&&S&&fy(x)){for(x=0,S=h.responseEnd,o+=1;o<a.length;o++){var I=a[o],ne=I.startTime;if(ne>S)break;var ue=I.transferSize,ge=I.initiatorType;ue&&fy(ge)&&(I=I.responseEnd,x+=ue*(I<S?1:(S-ne)/(I-ne)))}if(--o,i+=8*(p+x)/(h.duration/1e3),t++,10<t)break}}if(0<t)return i/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Yf=null,Gf=null;function Jo(t){return t.nodeType===9?t:t.ownerDocument}function hy(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function dy(t,i){if(t===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&i==="foreignObject"?0:t}function Vf(t,i){return t==="textarea"||t==="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 Jf=null;function mw(){var t=window.event;return t&&t.type==="popstate"?t===Jf?!1:(Jf=t,!0):(Jf=null,!1)}var my=typeof setTimeout=="function"?setTimeout:void 0,pw=typeof clearTimeout=="function"?clearTimeout:void 0,py=typeof Promise=="function"?Promise:void 0,gw=typeof queueMicrotask=="function"?queueMicrotask:typeof py<"u"?function(t){return py.resolve(null).then(t).catch(yw)}:my;function yw(t){setTimeout(function(){throw t})}function _i(t){return t==="head"}function gy(t,i){var a=i,o=0;do{var h=a.nextSibling;if(t.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(o===0){t.removeChild(h),Xs(i);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")sl(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,sl(a);for(var p=a.firstChild;p;){var x=p.nextSibling,S=p.nodeName;p[Qt]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=x}}else a==="body"&&sl(t.ownerDocument.body);a=h}while(a);Xs(i)}function yy(t,i){var a=t;t=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(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=o}while(a)}function Xf(t){var i=t.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":Xf(a),gs(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function bw(t,i,a,o){for(;t.nodeType===1;){var h=a;if(t.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[Qt])switch(i){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(p=t.getAttribute("rel"),p==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(p!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(p=t.getAttribute("src"),(p!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(i==="input"&&t.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===p)return t}else return t;if(t=Qn(t.nextSibling),t===null)break}return null}function xw(t,i,a){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Qn(t.nextSibling),t===null))return null;return t}function by(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Qn(t.nextSibling),t===null))return null;return t}function Kf(t){return t.data==="$?"||t.data==="$~"}function Qf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function vw(t,i){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=i;else if(t.data!=="$?"||a.readyState!=="loading")i();else{var o=function(){i(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function Qn(t){for(;t!=null;t=t.nextSibling){var i=t.nodeType;if(i===1||i===3)break;if(i===8){if(i=t.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return t}var Zf=null;function xy(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(i===0)return Qn(t.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}t=t.nextSibling}return null}function vy(t){t=t.previousSibling;for(var i=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(i===0)return t;i--}else a!=="/$"&&a!=="/&"||i++}t=t.previousSibling}return null}function wy(t,i,a){switch(i=Jo(a),t){case"html":if(t=i.documentElement,!t)throw Error(s(452));return t;case"head":if(t=i.head,!t)throw Error(s(453));return t;case"body":if(t=i.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function sl(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);gs(t)}var Zn=new Map,Sy=new Set;function Xo(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Vr=se.d;se.d={f:ww,r:Sw,D:_w,C:Ew,L:kw,m:Cw,X:Tw,S:Aw,M:jw};function ww(){var t=Vr.f(),i=qo();return t||i}function Sw(t){var i=j(t);i!==null&&i.tag===5&&i.type==="form"?Pp(i):Vr.r(t)}var Gs=typeof document>"u"?null:document;function _y(t,i,a){var o=Gs;if(o&&typeof i=="string"&&i){var h=$n(i);h='link[rel="'+t+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Sy.has(h)||(Sy.add(h),t={rel:t,crossOrigin:a,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),an(i,"link",t),F(i),o.head.appendChild(i)))}}function _w(t){Vr.D(t),_y("dns-prefetch",t,null)}function Ew(t,i){Vr.C(t,i),_y("preconnect",t,i)}function kw(t,i,a){Vr.L(t,i,a);var o=Gs;if(o&&t&&i){var h='link[rel="preload"][as="'+$n(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+$n(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+$n(a.imageSizes)+'"]')):h+='[href="'+$n(t)+'"]';var p=h;switch(i){case"style":p=Vs(t);break;case"script":p=Js(t)}Zn.has(p)||(t=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:t,as:i},a),Zn.set(p,t),o.querySelector(h)!==null||i==="style"&&o.querySelector(al(p))||i==="script"&&o.querySelector(ll(p))||(i=o.createElement("link"),an(i,"link",t),F(i),o.head.appendChild(i)))}}function Cw(t,i){Vr.m(t,i);var a=Gs;if(a&&t){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+$n(o)+'"][href="'+$n(t)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Js(t)}if(!Zn.has(p)&&(t=g({rel:"modulepreload",href:t},i),Zn.set(p,t),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ll(p)))return}o=a.createElement("link"),an(o,"link",t),F(o),a.head.appendChild(o)}}}function Aw(t,i,a){Vr.S(t,i,a);var o=Gs;if(o&&t){var h=L(o).hoistableStyles,p=Vs(t);i=i||"default";var x=h.get(p);if(!x){var S={loading:0,preload:null};if(x=o.querySelector(al(p)))S.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":i},a),(a=Zn.get(p))&&Wf(t,a);var I=x=o.createElement("link");F(I),an(I,"link",t),I._p=new Promise(function(ne,ue){I.onload=ne,I.onerror=ue}),I.addEventListener("load",function(){S.loading|=1}),I.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Ko(x,i,o)}x={type:"stylesheet",instance:x,count:1,state:S},h.set(p,x)}}}function Tw(t,i){Vr.X(t,i);var a=Gs;if(a&&t){var o=L(a).hoistableScripts,h=Js(t),p=o.get(h);p||(p=a.querySelector(ll(h)),p||(t=g({src:t,async:!0},i),(i=Zn.get(h))&&eh(t,i),p=a.createElement("script"),F(p),an(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function jw(t,i){Vr.M(t,i);var a=Gs;if(a&&t){var o=L(a).hoistableScripts,h=Js(t),p=o.get(h);p||(p=a.querySelector(ll(h)),p||(t=g({src:t,async:!0,type:"module"},i),(i=Zn.get(h))&&eh(t,i),p=a.createElement("script"),F(p),an(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Ey(t,i,a,o){var h=(h=je.current)?Xo(h):null;if(!h)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(i=Vs(a.href),a=L(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"){t=Vs(a.href);var p=L(h).hoistableStyles,x=p.get(t);if(x||(h=h.ownerDocument||h,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,x),(p=h.querySelector(al(t)))&&!p._p&&(x.instance=p,x.state.loading=5),Zn.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Zn.set(t,a),p||Nw(h,t,a,x.state))),i&&o===null)throw Error(s(528,""));return x}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=Js(a),a=L(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,t))}}function Vs(t){return'href="'+$n(t)+'"'}function al(t){return'link[rel="stylesheet"]['+t+"]"}function ky(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function Nw(t,i,a,o){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=t.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),an(i,"link",a),F(i),t.head.appendChild(i))}function Js(t){return'[src="'+$n(t)+'"]'}function ll(t){return"script[async]"+t}function Cy(t,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+$n(a.href)+'"]');if(o)return i.instance=o,F(o),o;var h=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),F(o),an(o,"style",h),Ko(o,a.precedence,t),i.instance=o;case"stylesheet":h=Vs(a.href);var p=t.querySelector(al(h));if(p)return i.state.loading|=4,i.instance=p,F(p),p;o=ky(a),(h=Zn.get(h))&&Wf(o,h),p=(t.ownerDocument||t).createElement("link"),F(p);var x=p;return x._p=new Promise(function(S,I){x.onload=S,x.onerror=I}),an(p,"link",o),i.state.loading|=4,Ko(p,a.precedence,t),i.instance=p;case"script":return p=Js(a.src),(h=t.querySelector(ll(p)))?(i.instance=h,F(h),h):(o=a,(h=Zn.get(p))&&(o=g({},a),eh(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),F(h),an(h,"link",o),t.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,Ko(o,a.precedence,t));return i.instance}function Ko(t,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,x=0;x<o.length;x++){var S=o[x];if(S.dataset.precedence===i)p=S;else if(p!==h)break}p?p.parentNode.insertBefore(t,p.nextSibling):(i=a.nodeType===9?a.head:a,i.insertBefore(t,i.firstChild))}function Wf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function eh(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.integrity==null&&(t.integrity=i.integrity)}var Qo=null;function Ay(t,i,a){if(Qo===null){var o=new Map,h=Qo=new Map;h.set(a,o)}else h=Qo,o=h.get(a),o||(o=new Map,h.set(a,o));if(o.has(t))return o;for(o.set(t,null),a=a.getElementsByTagName(t),h=0;h<a.length;h++){var p=a[h];if(!(p[Qt]||p[Ct]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var x=p.getAttribute(i)||"";x=t+x;var S=o.get(x);S?S.push(p):o.set(x,[p])}}return o}function Ty(t,i,a){t=t.ownerDocument||t,t.head.insertBefore(a,i==="title"?t.querySelector("head > title"):null)}function Ow(t,i,a){if(a===1||i.itemProp!=null)return!1;switch(t){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 t=i.disabled,typeof i.precedence=="string"&&t==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 jy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Rw(t,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=Vs(o.href),p=i.querySelector(al(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=Zo.bind(t),i.then(t,t)),a.state.loading|=4,a.instance=p,F(p);return}p=i.ownerDocument||i,o=ky(o),(h=Zn.get(h))&&Wf(o,h),p=p.createElement("link"),F(p);var x=p;x._p=new Promise(function(S,I){x.onload=S,x.onerror=I}),an(p,"link",o),a.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,i),(i=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=Zo.bind(t),i.addEventListener("load",a),i.addEventListener("error",a))}}var th=0;function Mw(t,i){return t.stylesheets&&t.count===0&&eu(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var o=setTimeout(function(){if(t.stylesheets&&eu(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+i);0<t.imgBytes&&th===0&&(th=62500*dw());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&eu(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>th?50:800)+i);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function Zo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)eu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Wo=null;function eu(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Wo=new Map,i.forEach(Dw,t),Wo=null,Zo.call(t))}function Dw(t,i){if(!(i.state.loading&4)){var a=Wo.get(t);if(a)var o=a.get(null);else{a=new Map,Wo.set(t,a);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var x=h[p];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),o=x)}o&&a.set(null,o)}h=i.instance,x=h.getAttribute("data-precedence"),p=a.get(x)||o,p===o&&a.set(null,h),a.set(x,h),this.count++,o=Zo.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),p?p.parentNode.insertBefore(h,p.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),i.state.loading|=4}}var ol={$$typeof:H,Provider:null,Consumer:null,_currentValue:ye,_currentValue2:ye,_threadCount:0};function Lw(t,i,a,o,h,p,x,S,I){this.tag=1,this.containerInfo=t,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=ni(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ni(0),this.hiddenUpdates=ni(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function Ny(t,i,a,o,h,p,x,S,I,ne,ue,ge){return t=new Lw(t,i,a,x,I,ne,ue,ge,S),i=1,p===!0&&(i|=24),p=jn(3,null,null,i),t.current=p,p.stateNode=t,i=Mc(),i.refCount++,t.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:i},Uc(p),t}function Oy(t){return t?(t=ks,t):ks}function Ry(t,i,a,o,h,p){h=Oy(h),o.context===null?o.context=h:o.pendingContext=h,o=hi(i),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=di(t,o,i),a!==null&&(En(a,t,i),qa(a,t,i))}function My(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<i?a:i}}function nh(t,i){My(t,i),(t=t.alternate)&&My(t,i)}function Dy(t){if(t.tag===13||t.tag===31){var i=Ji(t,67108864);i!==null&&En(i,t,67108864),nh(t,67108864)}}function Ly(t){if(t.tag===13||t.tag===31){var i=Dn();i=jr(i);var a=Ji(t,i);a!==null&&En(a,t,i),nh(t,i)}}var tu=!0;function zw(t,i,a,o){var h=P.T;P.T=null;var p=se.p;try{se.p=2,rh(t,i,a,o)}finally{se.p=p,P.T=h}}function Uw(t,i,a,o){var h=P.T;P.T=null;var p=se.p;try{se.p=8,rh(t,i,a,o)}finally{se.p=p,P.T=h}}function rh(t,i,a,o){if(tu){var h=ih(o);if(h===null)Ff(t,i,o,nu,a),Uy(t,o);else if(Pw(h,t,i,a,o))o.stopPropagation();else if(Uy(t,o),i&4&&-1<Bw.indexOf(t)){for(;h!==null;){var p=j(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var x=ir(p.pendingLanes);if(x!==0){var S=p;for(S.pendingLanes|=2,S.entangledLanes|=2;x;){var I=1<<31-mt(x);S.entanglements[1]|=I,x&=~I}br(p),(ht&6)===0&&(Bo=bt()+500,nl(0))}}break;case 31:case 13:S=Ji(p,2),S!==null&&En(S,p,2),qo(),nh(p,2)}if(p=ih(o),p===null&&Ff(t,i,o,nu,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else Ff(t,i,o,null,a)}}function ih(t){return t=sc(t),sh(t)}var nu=null;function sh(t){if(nu=null,t=E(t),t!==null){var i=u(t);if(i===null)t=null;else{var a=i.tag;if(a===13){if(t=c(i),t!==null)return t;t=null}else if(a===31){if(t=f(i),t!==null)return t;t=null}else if(a===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;t=null}else i!==t&&(t=null)}}return nu=t,null}function zy(t){switch(t){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(Pi()){case ce:return 2;case Se:return 8;case oe:case Te:return 32;case ke:return 268435456;default:return 32}default:return 32}}var ah=!1,Ei=null,ki=null,Ci=null,ul=new Map,cl=new Map,Ai=[],Bw="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 Uy(t,i){switch(t){case"focusin":case"focusout":Ei=null;break;case"dragenter":case"dragleave":ki=null;break;case"mouseover":case"mouseout":Ci=null;break;case"pointerover":case"pointerout":ul.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":cl.delete(i.pointerId)}}function fl(t,i,a,o,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:i,domEventName:a,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=j(i),i!==null&&Dy(i)),t):(t.eventSystemFlags|=o,i=t.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),t)}function Pw(t,i,a,o,h){switch(i){case"focusin":return Ei=fl(Ei,t,i,a,o,h),!0;case"dragenter":return ki=fl(ki,t,i,a,o,h),!0;case"mouseover":return Ci=fl(Ci,t,i,a,o,h),!0;case"pointerover":var p=h.pointerId;return ul.set(p,fl(ul.get(p)||null,t,i,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,cl.set(p,fl(cl.get(p)||null,t,i,a,o,h)),!0}return!1}function By(t){var i=E(t.target);if(i!==null){var a=u(i);if(a!==null){if(i=a.tag,i===13){if(i=c(a),i!==null){t.blockedOn=i,Jl(t.priority,function(){Ly(a)});return}}else if(i===31){if(i=f(a),i!==null){t.blockedOn=i,Jl(t.priority,function(){Ly(a)});return}}else if(i===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ru(t){if(t.blockedOn!==null)return!1;for(var i=t.targetContainers;0<i.length;){var a=ih(t.nativeEvent);if(a===null){a=t.nativeEvent;var o=new a.constructor(a.type,a);ic=o,a.target.dispatchEvent(o),ic=null}else return i=j(a),i!==null&&Dy(i),t.blockedOn=a,!1;i.shift()}return!0}function Py(t,i,a){ru(t)&&a.delete(i)}function qw(){ah=!1,Ei!==null&&ru(Ei)&&(Ei=null),ki!==null&&ru(ki)&&(ki=null),Ci!==null&&ru(Ci)&&(Ci=null),ul.forEach(Py),cl.forEach(Py)}function iu(t,i){t.blockedOn===i&&(t.blockedOn=null,ah||(ah=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,qw)))}var su=null;function qy(t){su!==t&&(su=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){su===t&&(su=null);for(var i=0;i<t.length;i+=3){var a=t[i],o=t[i+1],h=t[i+2];if(typeof o!="function"){if(sh(o||a)===null)continue;break}var p=j(a);p!==null&&(t.splice(i,3),i-=3,rf(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function Xs(t){function i(I){return iu(I,t)}Ei!==null&&iu(Ei,t),ki!==null&&iu(ki,t),Ci!==null&&iu(Ci,t),ul.forEach(i),cl.forEach(i);for(var a=0;a<Ai.length;a++){var o=Ai[a];o.blockedOn===t&&(o.blockedOn=null)}for(;0<Ai.length&&(a=Ai[0],a.blockedOn===null);)By(a),a.blockedOn===null&&Ai.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var h=a[o],p=a[o+1],x=h[Bt]||null;if(typeof p=="function")x||qy(a);else if(x){var S=null;if(p&&p.hasAttribute("formAction")){if(h=p,x=p[Bt]||null)S=x.formAction;else if(sh(h)!==null)continue}else S=x.action;typeof S=="function"?a[o+1]=S:(a.splice(o,3),o-=3),qy(a)}}}function Hy(){function t(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(x){return h=x})},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",t),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function lh(t){this._internalRoot=t}au.prototype.render=lh.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(s(409));var a=i.current,o=Dn();Ry(a,o,t,i,null,null)},au.prototype.unmount=lh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;Ry(t.current,2,null,t,null,null),qo(),i[An]=null}};function au(t){this._internalRoot=t}au.prototype.unstable_scheduleHydration=function(t){if(t){var i=_a();t={blockedOn:null,target:t,priority:i};for(var a=0;a<Ai.length&&i!==0&&i<Ai[a].priority;a++);Ai.splice(a,0,t),a===0&&By(t)}};var Iy=n.version;if(Iy!=="19.2.4")throw Error(s(527,Iy,"19.2.4"));se.findDOMNode=function(t){var i=t._reactInternals;if(i===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=d(i),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var Hw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lu.isDisabled&&lu.supportsFiber)try{at=lu.inject(Hw),kt=lu}catch{}}return dl.createRoot=function(t,i){if(!l(t))throw Error(s(299));var a=!1,o="",h=Xp,p=Kp,x=Qp;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&&(x=i.onRecoverableError)),i=Ny(t,1,!1,null,null,a,o,null,h,p,x,Hy),t[An]=i.current,If(t),new lh(i)},dl.hydrateRoot=function(t,i,a){if(!l(t))throw Error(s(299));var o=!1,h="",p=Xp,x=Kp,S=Qp,I=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&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError),a.formState!==void 0&&(I=a.formState)),i=Ny(t,1,!0,i,a??null,o,h,I,p,x,S,Hy),i.context=Oy(null),a=i.current,o=Dn(),o=jr(o),h=hi(o),h.callback=null,di(a,h,o),a=o,i.current.lanes=a,sr(i,a),br(i),t[An]=i.current,If(t),new au(i)},dl.version="19.2.4",dl}var Zy;function Zw(){if(Zy)return ch.exports;Zy=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(n){console.error(n)}}return e(),ch.exports=Qw(),ch.exports}var Ww=Zw();/**
|
|
50
|
-
* react-router v7.13.1
|
|
51
|
-
*
|
|
52
|
-
* Copyright (c) Remix Software Inc.
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the MIT license found in the
|
|
55
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
-
*
|
|
57
|
-
* @license MIT
|
|
58
|
-
*/var Wy="popstate";function e0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function eS(e={}){function n(s,l){var d;let u=(d=l.state)==null?void 0:d.masked,{pathname:c,search:f,hash:m}=u||s.location;return Xh("",{pathname:c,search:f,hash:m},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:Rl(l)}return nS(n,r,null,e)}function Ut(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function _r(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function tS(){return Math.random().toString(36).substring(2,10)}function t0(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Xh(e,n,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?ga(n):n,state:r,key:n&&n.key||s||tS(),unstable_mask:l}}function Rl({pathname:e="/",search:n="",hash:r=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function ga(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(n.search=e.substring(s),e=e.substring(0,s)),e&&(n.pathname=e)}return n}function nS(e,n,r,s={}){let{window:l=document.defaultView,v5Compat:u=!1}=s,c=l.history,f="POP",m=null,d=y();d==null&&(d=0,c.replaceState({...c.state,idx:d},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let U=y(),M=U==null?null:U-d;d=U,m&&m({action:f,location:D.location,delta:M})}function b(U,M){f="PUSH";let q=e0(U)?U:Xh(D.location,U,M);d=y()+1;let H=t0(q,d),ae=D.createHref(q.unstable_mask||q);try{c.pushState(H,"",ae)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;l.location.assign(ae)}u&&m&&m({action:f,location:D.location,delta:1})}function w(U,M){f="REPLACE";let q=e0(U)?U:Xh(D.location,U,M);d=y();let H=t0(q,d),ae=D.createHref(q.unstable_mask||q);c.replaceState(H,"",ae),u&&m&&m({action:f,location:D.location,delta:0})}function k(U){return rS(U)}let D={get action(){return f},get location(){return e(l,c)},listen(U){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(Wy,g),m=U,()=>{l.removeEventListener(Wy,g),m=null}},createHref(U){return n(l,U)},createURL:k,encodeLocation(U){let M=k(U);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:b,replace:w,go(U){return c.go(U)}};return D}function rS(e,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Ut(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Rl(e);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function Lb(e,n,r="/"){return iS(e,n,r,!1)}function iS(e,n,r,s){let l=typeof n=="string"?ga(n):n,u=Qr(l.pathname||"/",r);if(u==null)return null;let c=zb(e);sS(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let d=gS(u);f=mS(c[m],d,s)}return f}function zb(e,n=[],r=[],s="",l=!1){let u=(c,f,m=l,d)=>{let y={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(s)&&m)return;Ut(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=Sr([s,y.relativePath]),b=r.concat(y);c.children&&c.children.length>0&&(Ut(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),zb(c.children,n,b,g,m)),!(c.path==null&&!c.index)&&n.push({path:g,score:hS(g,c.index),routesMeta:b})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))u(c,f);else for(let d of Ub(c.path))u(c,f,!0,d)}),n}function Ub(e){let n=e.split("/");if(n.length===0)return[];let[r,...s]=n,l=r.endsWith("?"),u=r.replace(/\?$/,"");if(s.length===0)return l?[u,""]:[u];let c=Ub(s.join("/")),f=[];return f.push(...c.map(m=>m===""?u:[u,m].join("/"))),l&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function sS(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:dS(n.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var aS=/^:[\w-]+$/,lS=3,oS=2,uS=1,cS=10,fS=-2,n0=e=>e==="*";function hS(e,n){let r=e.split("/"),s=r.length;return r.some(n0)&&(s+=fS),n&&(s+=oS),r.filter(l=>!n0(l)).reduce((l,u)=>l+(aS.test(u)?lS:u===""?uS:cS),s)}function dS(e,n){return e.length===n.length&&e.slice(0,-1).every((s,l)=>s===n[l])?e[e.length-1]-n[n.length-1]:0}function mS(e,n,r=!1){let{routesMeta:s}=e,l={},u="/",c=[];for(let f=0;f<s.length;++f){let m=s[f],d=f===s.length-1,y=u==="/"?n:n.slice(u.length)||"/",g=Eu({path:m.relativePath,caseSensitive:m.caseSensitive,end:d},y),b=m.route;if(!g&&d&&r&&!s[s.length-1].route.index&&(g=Eu({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:Sr([u,g.pathname]),pathnameBase:vS(Sr([u,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(u=Sr([u,g.pathnameBase]))}return c}function Eu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=pS(e.path,e.caseSensitive,e.end),l=n.match(r);if(!l)return null;let u=l[0],c=u.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:s.reduce((d,{paramName:y,isOptional:g},b)=>{if(y==="*"){let k=f[b]||"";c=u.slice(0,u.length-k.length).replace(/(.)\/+$/,"$1")}const w=f[b];return g&&!w?d[y]=void 0:d[y]=(w||"").replace(/%2F/g,"/"),d},{}),pathname:u,pathnameBase:c,pattern:e}}function pS(e,n=!1,r=!0){_r(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,m,d,y)=>{if(s.push({paramName:f,isOptional:m!=null}),m){let g=y.charAt(d+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,n?void 0:"i"),s]}function gS(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return _r(!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 (${n}).`),e}}function Qr(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}var yS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function bS(e,n="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?ga(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=r0(r.substring(1),"/"):u=r0(r,n)):u=n,{pathname:u,search:wS(s),hash:SS(l)}}function r0(e,n){let r=n.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?r.length>1&&r.pop():l!=="."&&r.push(l)}),r.length>1?r.join("/"):"/"}function mh(e,n,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` 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 xS(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Bb(e){let n=xS(e);return n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase)}function kd(e,n,r,s=!1){let l;typeof e=="string"?l=ga(e):(l={...e},Ut(!l.pathname||!l.pathname.includes("?"),mh("?","pathname","search",l)),Ut(!l.pathname||!l.pathname.includes("#"),mh("#","pathname","hash",l)),Ut(!l.search||!l.search.includes("#"),mh("#","search","hash",l)));let u=e===""||l.pathname==="",c=u?"/":l.pathname,f;if(c==null)f=r;else{let g=n.length-1;if(!s&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),g-=1;l.pathname=b.join("/")}f=g>=0?n[g]:"/"}let m=bS(l,f),d=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(d||y)&&(m.pathname+="/"),m}var Sr=e=>e.join("/").replace(/\/\/+/g,"/"),vS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),wS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,SS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,_S=class{constructor(e,n,r,s=!1){this.status=e,this.statusText=n||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function ES(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function kS(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Pb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function qb(e,n){let r=e;if(typeof r!="string"||!yS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,l=!1;if(Pb)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=Qr(c.pathname,n);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{_r(!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 Hb=["POST","PUT","PATCH","DELETE"];new Set(Hb);var CS=["GET",...Hb];new Set(CS);var ya=N.createContext(null);ya.displayName="DataRouter";var Hu=N.createContext(null);Hu.displayName="DataRouterState";var AS=N.createContext(!1),Ib=N.createContext({isTransitioning:!1});Ib.displayName="ViewTransition";var TS=N.createContext(new Map);TS.displayName="Fetchers";var jS=N.createContext(null);jS.displayName="Await";var nr=N.createContext(null);nr.displayName="Navigation";var Pl=N.createContext(null);Pl.displayName="Location";var kr=N.createContext({outlet:null,matches:[],isDataRoute:!1});kr.displayName="Route";var Cd=N.createContext(null);Cd.displayName="RouteError";var Fb="REACT_ROUTER_ERROR",NS="REDIRECT",OS="ROUTE_ERROR_RESPONSE";function RS(e){if(e.startsWith(`${Fb}:${NS}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function MS(e){if(e.startsWith(`${Fb}:${OS}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new _S(n.status,n.statusText,n.data)}catch{}}function DS(e,{relative:n}={}){Ut(ql(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=N.useContext(nr),{hash:l,pathname:u,search:c}=Hl(e,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:Sr([r,u])),s.createHref({pathname:f,search:c,hash:l})}function ql(){return N.useContext(Pl)!=null}function Cr(){return Ut(ql(),"useLocation() may be used only in the context of a <Router> component."),N.useContext(Pl).location}var $b="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Yb(e){N.useContext(nr).static||N.useLayoutEffect(e)}function zi(){let{isDataRoute:e}=N.useContext(kr);return e?JS():LS()}function LS(){Ut(ql(),"useNavigate() may be used only in the context of a <Router> component.");let e=N.useContext(ya),{basename:n,navigator:r}=N.useContext(nr),{matches:s}=N.useContext(kr),{pathname:l}=Cr(),u=JSON.stringify(Bb(s)),c=N.useRef(!1);return Yb(()=>{c.current=!0}),N.useCallback((m,d={})=>{if(_r(c.current,$b),!c.current)return;if(typeof m=="number"){r.go(m);return}let y=kd(m,JSON.parse(u),l,d.relative==="path");e==null&&n!=="/"&&(y.pathname=y.pathname==="/"?n:Sr([n,y.pathname])),(d.replace?r.replace:r.push)(y,d.state,d)},[n,r,u,l,e])}N.createContext(null);function zS(){let{matches:e}=N.useContext(kr),n=e[e.length-1];return n?n.params:{}}function Hl(e,{relative:n}={}){let{matches:r}=N.useContext(kr),{pathname:s}=Cr(),l=JSON.stringify(Bb(r));return N.useMemo(()=>kd(e,JSON.parse(l),s,n==="path"),[e,l,s,n])}function US(e,n){return Gb(e,n)}function Gb(e,n,r){var U;Ut(ql(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=N.useContext(nr),{matches:l}=N.useContext(kr),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",d=u&&u.route;{let M=d&&d.path||"";Jb(f,!d||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
|
-
|
|
60
|
-
Please change the parent <Route path="${M}"> to <Route path="${M==="/"?"*":`${M}/*`}">.`)}let y=Cr(),g;if(n){let M=typeof n=="string"?ga(n):n;Ut(m==="/"||((U=M.pathname)==null?void 0:U.startsWith(m)),`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 "${m}" but pathname "${M.pathname}" was given in the \`location\` prop.`),g=M}else g=y;let b=g.pathname||"/",w=b;if(m!=="/"){let M=m.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(M.length).join("/")}let k=Lb(e,{pathname:w});_r(d||k!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),_r(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.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 D=IS(k&&k.map(M=>Object.assign({},M,{params:Object.assign({},c,M.params),pathname:Sr([m,s.encodeLocation?s.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?m:Sr([m,s.encodeLocation?s.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),l,r);return n&&D?N.createElement(Pl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},D):D}function BS(){let e=VS(),n=ES(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=N.createElement(N.Fragment,null,N.createElement("p",null,"💿 Hey developer 👋"),N.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",N.createElement("code",{style:u},"ErrorBoundary")," or"," ",N.createElement("code",{style:u},"errorElement")," prop on your route.")),N.createElement(N.Fragment,null,N.createElement("h2",null,"Unexpected Application Error!"),N.createElement("h3",{style:{fontStyle:"italic"}},n),r?N.createElement("pre",{style:l},r):null,c)}var PS=N.createElement(BS,null),Vb=class extends N.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,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):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=MS(e.digest);r&&(e=r)}let n=e!==void 0?N.createElement(kr.Provider,{value:this.props.routeContext},N.createElement(Cd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?N.createElement(qS,{error:e},n):n}};Vb.contextType=AS;var ph=new WeakMap;function qS({children:e,error:n}){let{basename:r}=N.useContext(nr);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let s=RS(n.digest);if(s){let l=ph.get(n);if(l)throw l;let u=qb(s.location,r);if(Pb&&!ph.get(n))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 ph.set(n,c),c}return N.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function HS({routeContext:e,match:n,children:r}){let s=N.useContext(ya);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),N.createElement(kr.Provider,{value:e},r)}function IS(e,n=[],r){let s=r==null?void 0:r.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(n.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);Ut(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:b,errors:w}=s,k=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||k){r.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let m=r==null?void 0:r.onError,d=s&&m?(y,g)=>{var b,w;m(y,{location:s.location,params:((w=(b=s.matches)==null?void 0:b[0])==null?void 0:w.params)??{},unstable_pattern:kS(s.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,b)=>{let w,k=!1,D=null,U=null;s&&(w=u&&g.route.id?u[g.route.id]:void 0,D=g.route.errorElement||PS,c&&(f<0&&b===0?(Jb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,U=null):f===b&&(k=!0,U=g.route.hydrateFallbackElement||null)));let M=n.concat(l.slice(0,b+1)),q=()=>{let H;return w?H=D:k?H=U:g.route.Component?H=N.createElement(g.route.Component,null):g.route.element?H=g.route.element:H=y,N.createElement(HS,{match:g,routeContext:{outlet:y,matches:M,isDataRoute:s!=null},children:H})};return s&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?N.createElement(Vb,{location:s.location,revalidation:s.revalidation,component:D,error:w,children:q(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:d}):q()},null)}function Ad(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function FS(e){let n=N.useContext(ya);return Ut(n,Ad(e)),n}function $S(e){let n=N.useContext(Hu);return Ut(n,Ad(e)),n}function YS(e){let n=N.useContext(kr);return Ut(n,Ad(e)),n}function Td(e){let n=YS(e),r=n.matches[n.matches.length-1];return Ut(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function GS(){return Td("useRouteId")}function VS(){var s;let e=N.useContext(Cd),n=$S("useRouteError"),r=Td("useRouteError");return e!==void 0?e:(s=n.errors)==null?void 0:s[r]}function JS(){let{router:e}=FS("useNavigate"),n=Td("useNavigate"),r=N.useRef(!1);return Yb(()=>{r.current=!0}),N.useCallback(async(l,u={})=>{_r(r.current,$b),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...u}))},[e,n])}var i0={};function Jb(e,n,r){!n&&!i0[e]&&(i0[e]=!0,_r(!1,r))}N.memo(XS);function XS({routes:e,future:n,state:r,isStatic:s,onError:l}){return Gb(e,void 0,{state:r,isStatic:s,onError:l})}function us(e){Ut(!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 KS({basename:e="/",children:n=null,location:r,navigationType:s="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Ut(!ql(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=N.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=ga(r));let{pathname:d="/",search:y="",hash:g="",state:b=null,key:w="default",unstable_mask:k}=r,D=N.useMemo(()=>{let U=Qr(d,f);return U==null?null:{location:{pathname:U,search:y,hash:g,state:b,key:w,unstable_mask:k},navigationType:s}},[f,d,y,g,b,w,s,k]);return _r(D!=null,`<Router basename="${f}"> is not able to match the URL "${d}${y}${g}" because it does not start with the basename, so the <Router> won't render anything.`),D==null?null:N.createElement(nr.Provider,{value:m},N.createElement(Pl.Provider,{children:n,value:D}))}function QS({children:e,location:n}){return US(Kh(e),n)}function Kh(e,n=[]){let r=[];return N.Children.forEach(e,(s,l)=>{if(!N.isValidElement(s))return;let u=[...n,l];if(s.type===N.Fragment){r.push.apply(r,Kh(s.props.children,u));return}Ut(s.type===us,`[${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>`),Ut(!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=Kh(s.props.children,u)),r.push(c)}),r}var xu="get",vu="application/x-www-form-urlencoded";function Iu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function ZS(e){return Iu(e)&&e.tagName.toLowerCase()==="button"}function WS(e){return Iu(e)&&e.tagName.toLowerCase()==="form"}function e_(e){return Iu(e)&&e.tagName.toLowerCase()==="input"}function t_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function n_(e,n){return e.button===0&&(!n||n==="_self")&&!t_(e)}var ou=null;function r_(){if(ou===null)try{new FormData(document.createElement("form"),0),ou=!1}catch{ou=!0}return ou}var i_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function gh(e){return e!=null&&!i_.has(e)?(_r(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${vu}"`),null):e}function s_(e,n){let r,s,l,u,c;if(WS(e)){let f=e.getAttribute("action");s=f?Qr(f,n):null,r=e.getAttribute("method")||xu,l=gh(e.getAttribute("enctype"))||vu,u=new FormData(e)}else if(ZS(e)||e_(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 m=e.getAttribute("formaction")||f.getAttribute("action");if(s=m?Qr(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||xu,l=gh(e.getAttribute("formenctype"))||gh(f.getAttribute("enctype"))||vu,u=new FormData(f,e),!r_()){let{name:d,type:y,value:g}=e;if(y==="image"){let b=d?`${d}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else d&&u.append(d,g)}}else{if(Iu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=xu,s=null,l=vu,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 jd(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function a_(e,n,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}`:n&&Qr(l.pathname,n)==="/"?l.pathname=`${n.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function l_(e,n){if(e.id in n)return n[e.id];try{let r=await import(e.module);return n[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 o_(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 u_(e,n,r){let s=await Promise.all(e.map(async l=>{let u=n.routes[l.route.id];if(u){let c=await l_(u,r);return c.links?c.links():[]}return[]}));return d_(s.flat(1).filter(o_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function s0(e,n,r,s,l,u){let c=(m,d)=>r[d]?m.route.id!==r[d].route.id:!0,f=(m,d)=>{var y;return r[d].pathname!==m.pathname||((y=r[d].route.path)==null?void 0:y.endsWith("*"))&&r[d].params["*"]!==m.params["*"]};return u==="assets"?n.filter((m,d)=>c(m,d)||f(m,d)):u==="data"?n.filter((m,d)=>{var g;let y=s.routes[m.route.id];if(!y||!y.hasLoader)return!1;if(c(m,d)||f(m,d))return!0;if(m.route.shouldRevalidate){let b=m.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:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function c_(e,n,{includeHydrateFallback:r}={}){return f_(e.map(s=>{let l=n.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 f_(e){return[...new Set(e)]}function h_(e){let n={},r=Object.keys(e).sort();for(let s of r)n[s]=e[s];return n}function d_(e,n){let r=new Set;return new Set(n),e.reduce((s,l)=>{let u=JSON.stringify(h_(l));return r.has(u)||(r.add(u),s.push({key:u,link:l})),s},[])}function Xb(){let e=N.useContext(ya);return jd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function m_(){let e=N.useContext(Hu);return jd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Nd=N.createContext(void 0);Nd.displayName="FrameworkContext";function Kb(){let e=N.useContext(Nd);return jd(e,"You must render this element inside a <HydratedRouter> element"),e}function p_(e,n){let r=N.useContext(Nd),[s,l]=N.useState(!1),[u,c]=N.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:y,onTouchStart:g}=n,b=N.useRef(null);N.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let D=M=>{M.forEach(q=>{c(q.isIntersecting)})},U=new IntersectionObserver(D,{threshold:.5});return b.current&&U.observe(b.current),()=>{U.disconnect()}}},[e]),N.useEffect(()=>{if(s){let D=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(D)}}},[s]);let w=()=>{l(!0)},k=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,b,{}]:[u,b,{onFocus:ml(f,w),onBlur:ml(m,k),onMouseEnter:ml(d,w),onMouseLeave:ml(y,k),onTouchStart:ml(g,w)}]:[!1,b,{}]}function ml(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function g_({page:e,...n}){let{router:r}=Xb(),s=N.useMemo(()=>Lb(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?N.createElement(b_,{page:e,matches:s,...n}):null}function y_(e){let{manifest:n,routeModules:r}=Kb(),[s,l]=N.useState([]);return N.useEffect(()=>{let u=!1;return u_(e,n,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,n,r]),s}function b_({page:e,matches:n,...r}){let s=Cr(),{future:l,manifest:u,routeModules:c}=Kb(),{basename:f}=Xb(),{loaderData:m,matches:d}=m_(),y=N.useMemo(()=>s0(e,n,d,u,s,"data"),[e,n,d,u,s]),g=N.useMemo(()=>s0(e,n,d,u,s,"assets"),[e,n,d,u,s]),b=N.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let D=new Set,U=!1;if(n.forEach(q=>{var ae;let H=u.routes[q.route.id];!H||!H.hasLoader||(!y.some(B=>B.route.id===q.route.id)&&q.route.id in m&&((ae=c[q.route.id])!=null&&ae.shouldRevalidate)||H.hasClientLoader?U=!0:D.add(q.route.id))}),D.size===0)return[];let M=a_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return U&&D.size>0&&M.searchParams.set("_routes",n.filter(q=>D.has(q.route.id)).map(q=>q.route.id).join(",")),[M.pathname+M.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,s,u,y,n,e,c]),w=N.useMemo(()=>c_(g,u),[g,u]),k=y_(g);return N.createElement(N.Fragment,null,b.map(D=>N.createElement("link",{key:D,rel:"prefetch",as:"fetch",href:D,...r})),w.map(D=>N.createElement("link",{key:D,rel:"modulepreload",href:D,...r})),k.map(({key:D,link:U})=>N.createElement("link",{key:D,nonce:r.nonce,...U,crossOrigin:U.crossOrigin??r.crossOrigin})))}function x_(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var v_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{v_&&(window.__reactRouterVersion="7.13.1")}catch{}function w_({basename:e,children:n,unstable_useTransitions:r,window:s}){let l=N.useRef();l.current==null&&(l.current=eS({window:s,v5Compat:!0}));let u=l.current,[c,f]=N.useState({action:u.action,location:u.location}),m=N.useCallback(d=>{r===!1?f(d):N.startTransition(()=>f(d))},[r]);return N.useLayoutEffect(()=>u.listen(m),[u,m]),N.createElement(KS,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var Qb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Zb=N.forwardRef(function({onClick:n,discover:r="render",prefetch:s="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:m,target:d,to:y,preventScrollReset:g,viewTransition:b,unstable_defaultShouldRevalidate:w,...k},D){let{basename:U,navigator:M,unstable_useTransitions:q}=N.useContext(nr),H=typeof y=="string"&&Qb.test(y),ae=qb(y,U);y=ae.to;let B=DS(y,{relative:l}),z=Cr(),V=null;if(f){let Q=kd(f,[],z.unstable_mask?z.unstable_mask.pathname:"/",!0);U!=="/"&&(Q.pathname=Q.pathname==="/"?U:Sr([U,Q.pathname])),V=M.createHref(Q)}let[Y,$,O]=p_(s,k),W=k_(y,{replace:c,unstable_mask:f,state:m,target:d,preventScrollReset:g,relative:l,viewTransition:b,unstable_defaultShouldRevalidate:w,unstable_useTransitions:q});function Z(Q){n&&n(Q),Q.defaultPrevented||W(Q)}let fe=!(ae.isExternal||u),J=N.createElement("a",{...k,...O,href:(fe?V:void 0)||ae.absoluteURL||B,onClick:fe?Z:n,ref:x_(D,$),target:d,"data-discover":!H&&r==="render"?"true":void 0});return Y&&!H?N.createElement(N.Fragment,null,J,N.createElement(g_,{page:B})):J});Zb.displayName="Link";var S_=N.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:s="",end:l=!1,style:u,to:c,viewTransition:f,children:m,...d},y){let g=Hl(c,{relative:d.relative}),b=Cr(),w=N.useContext(Hu),{navigator:k,basename:D}=N.useContext(nr),U=w!=null&&N_(g)&&f===!0,M=k.encodeLocation?k.encodeLocation(g).pathname:g.pathname,q=b.pathname,H=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(q=q.toLowerCase(),H=H?H.toLowerCase():null,M=M.toLowerCase()),H&&D&&(H=Qr(H,D)||H);const ae=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let B=q===M||!l&&q.startsWith(M)&&q.charAt(ae)==="/",z=H!=null&&(H===M||!l&&H.startsWith(M)&&H.charAt(M.length)==="/"),V={isActive:B,isPending:z,isTransitioning:U},Y=B?n:void 0,$;typeof s=="function"?$=s(V):$=[s,B?"active":null,z?"pending":null,U?"transitioning":null].filter(Boolean).join(" ");let O=typeof u=="function"?u(V):u;return N.createElement(Zb,{...d,"aria-current":Y,className:$,ref:y,style:O,to:c,viewTransition:f},typeof m=="function"?m(V):m)});S_.displayName="NavLink";var __=N.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:s,replace:l,state:u,method:c=xu,action:f,onSubmit:m,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b,...w},k)=>{let{unstable_useTransitions:D}=N.useContext(nr),U=T_(),M=j_(f,{relative:d}),q=c.toLowerCase()==="get"?"get":"post",H=typeof f=="string"&&Qb.test(f),ae=B=>{if(m&&m(B),B.defaultPrevented)return;B.preventDefault();let z=B.nativeEvent.submitter,V=(z==null?void 0:z.getAttribute("formmethod"))||c,Y=()=>U(z||B.currentTarget,{fetcherKey:n,method:V,navigate:r,replace:l,state:u,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b});D&&r!==!1?N.startTransition(()=>Y()):Y()};return N.createElement("form",{ref:k,method:q,action:M,onSubmit:s?m:ae,...w,"data-discover":!H&&e==="render"?"true":void 0})});__.displayName="Form";function E_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Wb(e){let n=N.useContext(ya);return Ut(n,E_(e)),n}function k_(e,{target:n,replace:r,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:d}={}){let y=zi(),g=Cr(),b=Hl(e,{relative:c});return N.useCallback(w=>{if(n_(w,n)){w.preventDefault();let k=r!==void 0?r:Rl(g)===Rl(b),D=()=>y(e,{replace:k,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});d?N.startTransition(()=>D()):D()}},[g,y,b,r,s,l,n,e,u,c,f,m,d])}var C_=0,A_=()=>`__${String(++C_)}__`;function T_(){let{router:e}=Wb("useSubmit"),{basename:n}=N.useContext(nr),r=GS(),s=e.fetch,l=e.navigate;return N.useCallback(async(u,c={})=>{let{action:f,method:m,encType:d,formData:y,body:g}=s_(u,n);if(c.navigate===!1){let b=c.fetcherKey||A_();await s(b,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,l,n,r])}function j_(e,{relative:n}={}){let{basename:r}=N.useContext(nr),s=N.useContext(kr);Ut(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),u={...Hl(e||".",{relative:n})},c=Cr();if(e==null){u.search=c.search;let f=new URLSearchParams(u.search),m=f.getAll("index");if(m.some(y=>y==="")){f.delete("index"),m.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:Sr([r,u.pathname])),Rl(u)}function N_(e,{relative:n}={}){let r=N.useContext(Ib);Ut(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Wb("useViewTransitionState"),l=Hl(e,{relative:n});if(!r.isTransitioning)return!1;let u=Qr(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=Qr(r.nextLocation.pathname,s)||r.nextLocation.pathname;return Eu(l.pathname,c)!=null||Eu(l.pathname,u)!=null}var ta=Db();const ex=N.createContext(null),tx="palmier_paired_hosts",Qh="palmier_active_host";function yh(){try{const e=localStorage.getItem(tx);if(e)return JSON.parse(e)}catch{}return[]}function O_(e){localStorage.setItem(tx,JSON.stringify(e))}function R_(){return localStorage.getItem(Qh)}function M_(e){e?localStorage.setItem(Qh,e):localStorage.removeItem(Qh)}const D_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function L_({children:e}){const[n,r]=N.useState(yh),[s,l]=N.useState(()=>{const y=R_(),g=yh();return y&&g.some(b=>b.hostId===y)?y:g.length>0?g[0].hostId:null});N.useEffect(()=>{if(!D_)return;const y="local";if(!yh().find(b=>b.hostId===y)){const b={hostId:y,clientToken:"",directUrl:window.location.origin};r(w=>[...w.filter(k=>k.hostId!==y),b]),l(y)}},[]),N.useEffect(()=>{O_(n)},[n]),N.useEffect(()=>{M_(s)},[s]);const u=N.useCallback(y=>{r(g=>[...g.filter(w=>w.hostId!==y.hostId),y]),l(y.hostId)},[]),c=N.useCallback(y=>{r(g=>g.filter(b=>b.hostId!==y)),l(g=>g!==y?g:null)},[]);N.useEffect(()=>{var y;s!==null&&!n.find(g=>g.hostId===s)?l(((y=n[0])==null?void 0:y.hostId)??null):s===null&&n.length>0&&l(n[0].hostId)},[n,s]);const f=N.useCallback((y,g)=>{r(b=>b.map(w=>w.hostId===y?{...w,name:g}:w))},[]),m=N.useCallback(y=>{l(y)},[]),d=N.useCallback(()=>n.find(y=>y.hostId===s)??null,[n,s]);return v.jsx(ex.Provider,{value:{pairedHosts:n,activeHostId:s,addPairedHost:u,removePairedHost:c,renamePairedHost:f,setActiveHostId:m,getActiveHost:d},children:e})}function Il(){const e=N.useContext(ex);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const Hn=new Uint8Array(0),Ui=new TextEncoder,Bn=new TextDecoder;function z_(...e){let n=0;for(let l=0;l<e.length;l++)n+=e[l].length;const r=new Uint8Array(n);let s=0;for(let l=0;l<e.length;l++)r.set(e[l],s),s+=e[l].length;return r}function kl(...e){const n=[];for(let r=0;r<e.length;r++)n.push(Ui.encode(e[r]));return n.length===0?Hn:n.length===1?n[0]:z_(...n)}function a0(e){return!e||e.length===0?"":Bn.decode(e)}const l0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",o0=36,U_=0xcfd41b9100000,u0=33,B_=333,c0=22;function P_(e){for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*255)}function q_(e){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(e):P_(e)}class H_{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(c0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*U_),this.inc=Math.floor(Math.random()*(B_-u0)+u0)}setPre(){const n=new Uint8Array(12);q_(n);for(let r=0;r<12;r++){const s=n[r]%36;this.buf[r]=l0.charCodeAt(s)}}fillSeq(){let n=this.seq;for(let r=c0-1;r>=12;r--)this.buf[r]=l0.charCodeAt(n%o0),n=Math.floor(n/o0)}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 Di=new H_;var Jr;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(Jr||(Jr={}));var ia;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(ia||(ia={}));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 I_(e){return typeof e.code=="string"}class nx{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(n){return F_.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const F_=new nx;class Oe 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=nx.getMessage(r);return new Oe(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 zn;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(zn||(zn={}));var fr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(fr||(fr={}));var Cl;(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"})(Cl||(Cl={}));const ku="Nats-Service-Error",Cu="Nats-Service-Error-Code";class Au extends Error{constructor(r,s){super(s);C(this,"code");this.code=r}static isServiceError(r){return Au.toServiceError(r)!==null}static toServiceError(r){var l,u;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(Cu))||"";if(s!==""){const c=parseInt(s)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(ku))||"";return new Au(c,f.length?f:s)}return null}}function Kr(e=""){if(e=e||"_INBOX",typeof e!="string")throw new Error("prefix must be a string");return e.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${e}'`)}),`${e}.${Di.next()}`}const Zh="127.0.0.1";var Oi;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Oi||(Oi={}));function Fu(e,...n){for(let r=0;r<n.length;r++){const s=n[r];Object.keys(s).forEach(function(l){e[l]=s[l]})}return e}function uu(e){return Bn.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function fa(e,n=!0){const r=n?Oe.errorForCode(Ee.Timeout):null;let s,l;const u=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?Oe.errorForCode(Ee.Timeout):r)},e)});return Object.assign(u,s)}function ba(e=0){let n;const r=new Promise(s=>{const l=setTimeout(()=>{s()},e);n={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,n)}function Lt(){let e={};const n=new Promise((r,s)=>{e={resolve:r,reject:s}});return Object.assign(n,e)}function rx(e){for(let n=e.length-1;n>0;n--){const r=Math.floor(Math.random()*(n+1));[e[n],e[r]]=[e[r],e[n]]}return e}function $_(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function Od(e=[0,250,250,500,500,3e3,5e3]){Array.isArray(e)||(e=[0,250,250,500,500,3e3,5e3]);const n=e.length-1;return{backoff(r){return $_(r>n?e[n]:e[r])}}}function Dt(e){return e*1e6}function Rd(e){return Math.floor(e/1e6)}function f0(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 Oe(`'${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 Zr(e=0,n=""){if(e===0&&n!==""||e>0&&n==="")throw new Error("setting status requires both code and description");return new Ri(e,n)}const bh="NATS/1.0";class Ri{constructor(n=0,r=""){C(this,"_code");C(this,"headers");C(this,"_description");this._code=n,this._description=r,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[r,s]of this.headers){const l=n.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(n){const r=new Ri,l=Bn.decode(n).split(`\r
|
|
61
|
-
`),u=l[0];if(u!==bh){let c=u.replace(bh,"").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 m=c.slice(0,f),d=c.slice(f+1).trim();r.append(m,d)}}}),r}toString(){if(this.headers.size===0&&this._code===0)return"";let n=bh;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[r,s]of this.headers)for(let l=0;l<s.length;l++)n=`${n}\r
|
|
62
|
-
${r}: ${s[l]}`;return`${n}\r
|
|
63
|
-
\r
|
|
64
|
-
`}encode(){return Ui.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new Oe("invalid header value - \\r and \\n are not allowed.",Ee.BadHeader);return n.trim()}keys(){const n=[];for(const r of this.headers.keys())n.push(r);return n}findKeys(n,r=zn.Exact){const s=this.keys();switch(r){case zn.Exact:return s.filter(l=>l===n);case zn.CanonicalMIME:return n=f0(n),s.filter(l=>l===n);default:{const l=n.toLowerCase();return s.filter(u=>l===u.toLowerCase())}}}get(n,r=zn.Exact){const s=this.findKeys(n,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(n,r=zn.Exact){const s=this.findKeys(n,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(n,r=zn.Exact){return this.findKeys(n,r).length>0}set(n,r,s=zn.Exact){this.delete(n,s),this.append(n,r,s)}append(n,r,s=zn.Exact){const l=f0(n);s===zn.CanonicalMIME&&(n=l);const u=this.findKeys(n,s);n=u.length>0?u[0]:n;const c=Ri.validHeaderValue(r);let f=this.headers.get(n);f||(f=[],this.headers.set(n,f)),f.push(c)}values(n,r=zn.Exact){const s=[];return this.findKeys(n,r).forEach(u=>{const c=this.headers.get(u);c&&s.push(...c)}),s}delete(n,r=zn.Exact){this.findKeys(n,r).forEach(l=>{this.headers.delete(l)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(r=>{n[r]=this.values(r)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const r=new Ri;for(const s in n)r.headers.set(s,n[s]);return r}}function Tu(){return{encode(e){return Ui.encode(e)},decode(e){return Bn.decode(e)}}}function hr(e){return{encode(n){try{return n===void 0&&(n=null),Ui.encode(JSON.stringify(n))}catch(r){throw Oe.errorForCode(Ee.BadJson,r)}},decode(n){try{return JSON.parse(Bn.decode(n),e)}catch(r){throw Oe.errorForCode(Ee.BadJson,r)}}}}function ix(e){var n;return e&&e.data.length===0&&((n=e.headers)==null?void 0:n.code)===503?Oe.errorForCode(Ee.NoResponders):null}class Md{constructor(n,r,s){C(this,"_headers");C(this,"_msg");C(this,"_rdata");C(this,"_reply");C(this,"_subject");C(this,"publisher");this._msg=n,this._rdata=r,this.publisher=s}get subject(){return this._subject?this._subject:(this._subject=Bn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Bn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const n=this._rdata.subarray(0,this._msg.hdr);this._headers=Ri.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=Hn,r){return this.reply?(this.publisher.publish(this.reply,n,r),!0):!1}size(){var l;const n=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 n+r+s}json(n){return hr(n).decode(this.data)}string(){return Bn.decode(this.data)}requestInfo(){var r;const n=(r=this.headers)==null?void 0:r.get("Nats-Request-Info");return n?JSON.parse(n,function(s,l){return(s==="start"||s==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}C(Md,"jc");function sa(e){return $u("durable",e)}function mn(e){return $u("stream",e)}function $u(e,n=""){if(n==="")throw Error(`${e} name required`);return[".","*",">","/","\\"," "," ",`
|
|
65
|
-
`,"\r"].forEach(s=>{if(n.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 _l(e,n=""){if(n==="")throw Error(`${e} name required`);const r=Y_(n);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function Y_(e=""){if(e==="")throw Error("name required");const n=/^[-\w]+$/g;if(e.match(n)===null){for(const s of e.split(""))if(s.match(n)===null)return`cannot contain '${s}'`}return""}function Wh(e){if(e.data.length>0)return!1;const n=e.headers;return n?n.code>=100&&n.code<200:!1}function ed(e){var n;return Wh(e)&&((n=e.headers)==null?void 0:n.description)==="Idle Heartbeat"}function G_(e,n,r){const s=Zr(e,n),l={hdr:1,sid:0,size:0},u=new Md(l,Hn,{});return u._headers=s,u._subject=r,u}function aa(e){if(e.data.length!==0)return null;const n=e.headers;return n?sx(n.code,n.description):null}var er;(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"})(er||(er={}));function V_(e){return e.code!==Ee.JetStream409?!1:[er.MaxBatchExceeded,er.MaxExpiresExceeded,er.MaxBytesExceeded,er.MaxMessageSizeExceeded,er.PushConsumer,er.IdleHeartbeatMissed,er.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function sx(e,n=""){if(e<300)return null;switch(n=n.toLowerCase(),e){case 404:return new Oe(n,Ee.JetStream404NoMessages);case 408:return new Oe(n,Ee.JetStream408RequestTimeout);case 409:{const r=n.startsWith(er.IdleHeartbeatMissed)?Ee.JetStreamIdleHeartBeat:Ee.JetStream409;return new Oe(n,r)}case 503:return Oe.errorForCode(Ee.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=Ee.Unknown),new Oe(n,`${e}`)}}class tn{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=Lt(),this.yields=[],this.iterClosed=Lt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:r,protocol:s}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};r&&(s&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new Oe("unsupported iterator",Ee.ApiError);if(this.yielding)throw new Oe("already yielding",Ee.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let r=0;r<n.length;r++){if(typeof n[r]=="function"){const l=n[r];try{l()}catch(u){throw u}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[r]):!0){this.processed++;const l=Date.now();yield n[r],this.time=Date.now()-l,this.dispatchedFn&&n[r]&&this.dispatchedFn(n[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=Lt())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Dd{constructor(n,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=n,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(n,r=0,s=2){this.interval=n,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(n){console.log(n)}},this.interval)}}var td;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(td||(td={}));var Ml;(function(e){e.Old="old",e.New="new"})(Ml||(Ml={}));var nd;(function(e){e.File="file",e.Memory="memory"})(nd||(nd={}));var $t;(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"})($t||($t={}));var en;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(en||(en={}));var ha;(function(e){e.Instant="instant",e.Original="original"})(ha||(ha={}));var Li;(function(e){e.None="none",e.S2="s2"})(Li||(Li={}));var ju;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(ju||(ju={}));function J_(e,n={}){return Object.assign({name:e,deliver_policy:$t.All,ack_policy:en.Explicit,ack_wait:Dt(30*1e3),replay_policy:ha.Instant},n)}var h0;(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"})(h0||(h0={}));var bn;(function(e){e.StreamSourceHdr="Nats-Stream-Source",e.LastConsumerSeqHdr="Nats-Last-Consumer",e.LastStreamSeqHdr="Nats-Last-Stream",e.ConsumerStalledHdr="Nats-Consumer-Stalled",e.MessageSizeHdr="Nats-Msg-Size",e.RollupHdr="Nats-Rollup",e.RollupValueSubject="sub",e.RollupValueAll="all",e.PendingMessagesHdr="Nats-Pending-Messages",e.PendingBytesHdr="Nats-Pending-Bytes"})(bn||(bn={}));var cr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(cr||(cr={}));var na;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(na||(na={}));var d0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(d0||(d0={}));const Un="KV_";class X_{constructor(n){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=J_("",n||{})}getOpts(){var r;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((r=n.config.filter_subjects)==null||r.forEach(s=>{this.filterSubject(s)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?en.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return sa(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=$t.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=$t.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=$t.All,this}deliverLastPerSubject(){return this.config.deliver_policy=$t.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=$t.Last,this}deliverNew(){return this.config.deliver_policy=$t.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=en.None,this}ackAll(){return this.config.ack_policy=en.All,this}ackExplicit(){return this.config.ack_policy=en.Explicit,this}ackWait(n){return this.config.ack_wait=Dt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=ha.Instant,this}replayOriginal(){return this.config.replay_policy=ha.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=Dt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,r){return this.stream=n,this.config.durable_name=r,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=Dt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=Dt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Mi(e){return new X_(e)}function m0(e){return typeof e.getOpts=="function"}class K_{static encode(n){if(typeof n=="string")return btoa(n);const r=Array.from(n);return btoa(String.fromCharCode(...r))}static decode(n,r=!1){const s=atob(n);return r?Uint8Array.from(s,l=>l.charCodeAt(0)):s}}class la{static encode(n){return la.toB64URLEncoding(K_.encode(n))}static decode(n,r=!1){return la.decode(la.fromB64URLEncoding(n),r)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class da{constructor(){C(this,"buffers");C(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let r=0;for(let u=0;u<n.length;u++)r+=n[u].length;const s=new Uint8Array(r);let l=0;for(let u=0;u<n.length;u++)s.set(n[u],l),l+=n[u].length;return s}static fromAscii(n){return n||(n=""),Ui.encode(n)}static toAscii(n){return Bn.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let r=0;for(let s=0;s<this.buffers.length;s++)n.set(this.buffers[s],r),r+=this.buffers[s].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const r=this.buffers.pop();if(r){const s=this.byteLength;(n===void 0||n>s)&&(n=s);const l=r.subarray(0,n);return s>n&&this.buffers.push(r.subarray(n)),this.byteLength=s-n,l}}return new Uint8Array(0)}fill(n,...r){n&&(this.buffers.push(n),this.byteLength+=n.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 Q_(e,n){return n.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 Z_=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},pl=Z_.performance||{};pl.now||pl.mozNow||pl.msNow||pl.oNow||pl.webkitNow;var p0={versions:{}},W_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function e2(e){if(e.__esModule)return e;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var xh,Yu={exports:{}},g0={},y0=e2(Q_({__proto__:null,default:g0},[g0]));xh=Yu,(function(){var e="input is invalid type",n=typeof window=="object",r=n?window:{};r.JS_SHA256_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&p0.versions&&p0.versions.node;l?r=W_:s&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&xh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),m=[-2147483648,8388608,32768,128],d=[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"],b=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(B){return Object.prototype.toString.call(B)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(B){return typeof B=="object"&&B.buffer&&B.buffer.constructor===ArrayBuffer});var w=function(B,z){return function(V){return new q(z,!0).update(V)[B]()}},k=function(B){var z=w("hex",B);l&&(z=D(z,B)),z.create=function(){return new q(B)},z.update=function($){return z.create().update($)};for(var V=0;V<g.length;++V){var Y=g[V];z[Y]=w(Y,B)}return z},D=function(B,z){var V,Y=y0,$=y0.Buffer,O=z?"sha224":"sha256";return V=$.from&&!r.JS_SHA256_NO_BUFFER_FROM?$.from:function(W){return new $(W)},function(W){if(typeof W=="string")return Y.createHash(O).update(W,"utf8").digest("hex");if(W==null)throw new Error(e);return W.constructor===ArrayBuffer&&(W=new Uint8Array(W)),Array.isArray(W)||ArrayBuffer.isView(W)||W.constructor===$?Y.createHash(O).update(V(W)).digest("hex"):B(W)}},U=function(B,z){return function(V,Y){return new H(V,z,!0).update(Y)[B]()}},M=function(B){var z=U("hex",B);z.create=function($){return new H($,B)},z.update=function($,O){return z.create($).update(O)};for(var V=0;V<g.length;++V){var Y=g[V];z[Y]=U(Y,B)}return z};function q(B,z){z?(b[0]=b[16]=b[1]=b[2]=b[3]=b[4]=b[5]=b[6]=b[7]=b[8]=b[9]=b[10]=b[11]=b[12]=b[13]=b[14]=b[15]=0,this.blocks=b):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],B?(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=B}function H(B,z,V){var Y,$=typeof B;if($==="string"){var O,W=[],Z=B.length,fe=0;for(Y=0;Y<Z;++Y)(O=B.charCodeAt(Y))<128?W[fe++]=O:O<2048?(W[fe++]=192|O>>>6,W[fe++]=128|63&O):O<55296||O>=57344?(W[fe++]=224|O>>>12,W[fe++]=128|O>>>6&63,W[fe++]=128|63&O):(O=65536+((1023&O)<<10|1023&B.charCodeAt(++Y)),W[fe++]=240|O>>>18,W[fe++]=128|O>>>12&63,W[fe++]=128|O>>>6&63,W[fe++]=128|63&O);B=W}else{if($!=="object")throw new Error(e);if(B===null)throw new Error(e);if(c&&B.constructor===ArrayBuffer)B=new Uint8Array(B);else if(!(Array.isArray(B)||c&&ArrayBuffer.isView(B)))throw new Error(e)}B.length>64&&(B=new q(z,!0).update(B).array());var J=[],Q=[];for(Y=0;Y<64;++Y){var P=B[Y]||0;J[Y]=92^P,Q[Y]=54^P}q.call(this,z,V),this.update(Q),this.oKeyPad=J,this.inner=!0,this.sharedMemory=V}q.prototype.update=function(B){if(!this.finalized){var z,V=typeof B;if(V!=="string"){if(V!=="object")throw new Error(e);if(B===null)throw new Error(e);if(c&&B.constructor===ArrayBuffer)B=new Uint8Array(B);else if(!(Array.isArray(B)||c&&ArrayBuffer.isView(B)))throw new Error(e);z=!0}for(var Y,$,O=0,W=B.length,Z=this.blocks;O<W;){if(this.hashed&&(this.hashed=!1,Z[0]=this.block,this.block=Z[16]=Z[1]=Z[2]=Z[3]=Z[4]=Z[5]=Z[6]=Z[7]=Z[8]=Z[9]=Z[10]=Z[11]=Z[12]=Z[13]=Z[14]=Z[15]=0),z)for($=this.start;O<W&&$<64;++O)Z[$>>>2]|=B[O]<<d[3&$++];else for($=this.start;O<W&&$<64;++O)(Y=B.charCodeAt(O))<128?Z[$>>>2]|=Y<<d[3&$++]:Y<2048?(Z[$>>>2]|=(192|Y>>>6)<<d[3&$++],Z[$>>>2]|=(128|63&Y)<<d[3&$++]):Y<55296||Y>=57344?(Z[$>>>2]|=(224|Y>>>12)<<d[3&$++],Z[$>>>2]|=(128|Y>>>6&63)<<d[3&$++],Z[$>>>2]|=(128|63&Y)<<d[3&$++]):(Y=65536+((1023&Y)<<10|1023&B.charCodeAt(++O)),Z[$>>>2]|=(240|Y>>>18)<<d[3&$++],Z[$>>>2]|=(128|Y>>>12&63)<<d[3&$++],Z[$>>>2]|=(128|Y>>>6&63)<<d[3&$++],Z[$>>>2]|=(128|63&Y)<<d[3&$++]);this.lastByteIndex=$,this.bytes+=$-this.start,$>=64?(this.block=Z[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}},q.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var B=this.blocks,z=this.lastByteIndex;B[16]=this.block,B[z>>>2]|=m[3&z],this.block=B[16],z>=56&&(this.hashed||this.hash(),B[0]=this.block,B[16]=B[1]=B[2]=B[3]=B[4]=B[5]=B[6]=B[7]=B[8]=B[9]=B[10]=B[11]=B[12]=B[13]=B[14]=B[15]=0),B[14]=this.hBytes<<3|this.bytes>>>29,B[15]=this.bytes<<3,this.hash()}},q.prototype.hash=function(){var B,z,V,Y,$,O,W,Z,fe,J=this.h0,Q=this.h1,P=this.h2,se=this.h3,ye=this.h4,_e=this.h5,_=this.h6,R=this.h7,ee=this.blocks;for(B=16;B<64;++B)z=(($=ee[B-15])>>>7|$<<25)^($>>>18|$<<14)^$>>>3,V=(($=ee[B-2])>>>17|$<<15)^($>>>19|$<<13)^$>>>10,ee[B]=ee[B-16]+z+ee[B-7]+V|0;for(fe=Q&P,B=0;B<64;B+=4)this.first?(this.is224?(O=300032,R=($=ee[0]-1413257819)-150054599|0,se=$+24177077|0):(O=704751109,R=($=ee[0]-210244248)-1521486534|0,se=$+143694565|0),this.first=!1):(z=(J>>>2|J<<30)^(J>>>13|J<<19)^(J>>>22|J<<10),Y=(O=J&Q)^J&P^fe,R=se+($=R+(V=(ye>>>6|ye<<26)^(ye>>>11|ye<<21)^(ye>>>25|ye<<7))+(ye&_e^~ye&_)+y[B]+ee[B])|0,se=$+(z+Y)|0),z=(se>>>2|se<<30)^(se>>>13|se<<19)^(se>>>22|se<<10),Y=(W=se&J)^se&Q^O,_=P+($=_+(V=(R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7))+(R&ye^~R&_e)+y[B+1]+ee[B+1])|0,z=((P=$+(z+Y)|0)>>>2|P<<30)^(P>>>13|P<<19)^(P>>>22|P<<10),Y=(Z=P&se)^P&J^W,_e=Q+($=_e+(V=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&R^~_&ye)+y[B+2]+ee[B+2])|0,z=((Q=$+(z+Y)|0)>>>2|Q<<30)^(Q>>>13|Q<<19)^(Q>>>22|Q<<10),Y=(fe=Q&P)^Q&se^Z,ye=J+($=ye+(V=(_e>>>6|_e<<26)^(_e>>>11|_e<<21)^(_e>>>25|_e<<7))+(_e&_^~_e&R)+y[B+3]+ee[B+3])|0,J=$+(z+Y)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+J|0,this.h1=this.h1+Q|0,this.h2=this.h2+P|0,this.h3=this.h3+se|0,this.h4=this.h4+ye|0,this.h5=this.h5+_e|0,this.h6=this.h6+_|0,this.h7=this.h7+R|0},q.prototype.hex=function(){this.finalize();var B=this.h0,z=this.h1,V=this.h2,Y=this.h3,$=this.h4,O=this.h5,W=this.h6,Z=this.h7,fe=f[B>>>28&15]+f[B>>>24&15]+f[B>>>20&15]+f[B>>>16&15]+f[B>>>12&15]+f[B>>>8&15]+f[B>>>4&15]+f[15&B]+f[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[V>>>28&15]+f[V>>>24&15]+f[V>>>20&15]+f[V>>>16&15]+f[V>>>12&15]+f[V>>>8&15]+f[V>>>4&15]+f[15&V]+f[Y>>>28&15]+f[Y>>>24&15]+f[Y>>>20&15]+f[Y>>>16&15]+f[Y>>>12&15]+f[Y>>>8&15]+f[Y>>>4&15]+f[15&Y]+f[$>>>28&15]+f[$>>>24&15]+f[$>>>20&15]+f[$>>>16&15]+f[$>>>12&15]+f[$>>>8&15]+f[$>>>4&15]+f[15&$]+f[O>>>28&15]+f[O>>>24&15]+f[O>>>20&15]+f[O>>>16&15]+f[O>>>12&15]+f[O>>>8&15]+f[O>>>4&15]+f[15&O]+f[W>>>28&15]+f[W>>>24&15]+f[W>>>20&15]+f[W>>>16&15]+f[W>>>12&15]+f[W>>>8&15]+f[W>>>4&15]+f[15&W];return this.is224||(fe+=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]),fe},q.prototype.toString=q.prototype.hex,q.prototype.digest=function(){this.finalize();var B=this.h0,z=this.h1,V=this.h2,Y=this.h3,$=this.h4,O=this.h5,W=this.h6,Z=this.h7,fe=[B>>>24&255,B>>>16&255,B>>>8&255,255&B,z>>>24&255,z>>>16&255,z>>>8&255,255&z,V>>>24&255,V>>>16&255,V>>>8&255,255&V,Y>>>24&255,Y>>>16&255,Y>>>8&255,255&Y,$>>>24&255,$>>>16&255,$>>>8&255,255&$,O>>>24&255,O>>>16&255,O>>>8&255,255&O,W>>>24&255,W>>>16&255,W>>>8&255,255&W];return this.is224||fe.push(Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z),fe},q.prototype.array=q.prototype.digest,q.prototype.arrayBuffer=function(){this.finalize();var B=new ArrayBuffer(this.is224?28:32),z=new DataView(B);return z.setUint32(0,this.h0),z.setUint32(4,this.h1),z.setUint32(8,this.h2),z.setUint32(12,this.h3),z.setUint32(16,this.h4),z.setUint32(20,this.h5),z.setUint32(24,this.h6),this.is224||z.setUint32(28,this.h7),B},H.prototype=new q,H.prototype.finalize=function(){if(q.prototype.finalize.call(this),this.inner){this.inner=!1;var B=this.array();q.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(B),q.prototype.finalize.call(this)}};var ae=k();ae.sha256=ae,ae.sha224=k(!0),ae.sha256.hmac=M(),ae.sha224.hmac=M(!0),u?xh.exports=ae:(r.sha256=ae.sha256,r.sha224=ae.sha224)})();Yu.exports;Yu.exports.sha224;var b0=Yu.exports.sha256;function rd(e){return a2(e)}function t2(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 n2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function r2(e){return t2(e)?"hex":n2(e)?"b64":""}function i2(e){if(e.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)n[r/2]=parseInt(e.substring(r,r+2),16);return n}function s2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))}function a2(e){switch(r2(e)){case"hex":return i2(e);case"b64":return s2(e)}return null}function l2(e,n){const r=typeof e=="string"?rd(e):e,s=typeof n=="string"?rd(n):n;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 ax{constructor(n,r,s=!0){C(this,"token");C(this,"received");C(this,"ctx");C(this,"requestSubject");C(this,"mux");this.mux=n,this.requestSubject=r,this.received=0,this.token=Di.next(),s&&(this.ctx=new Error)}}class o2 extends ax{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=Lt(),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
|
-
|
|
68
|
-
${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===fr.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===fr.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===fr.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class lx extends ax{constructor(r,s,l={timeout:1e3},u=!0){super(r,s,u);C(this,"deferred");C(this,"timer");this.deferred=Lt(),this.timer=fa(l.timeout,u)}resolver(r,s){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
|
|
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||Oe.errorForCode(Ee.Cancelled))}}const u2="$JS.API";function c2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Fu({apiPrefix:u2,timeout:5e3},e)}class Fl{constructor(n,r){C(this,"nc");C(this,"opts");C(this,"prefix");C(this,"timeout");C(this,"jc");this.nc=n,this.opts=c2(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=hr()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,r=null,s){s=s||{},s.timeout=this.timeout;let l=Hn;r&&(l=this.jc.encode(r));let{retries:u}=s;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=Od();for(let f=0;f<u;f++)try{const m=await this.nc.request(n,l,s);return this.parseJsResponse(m)}catch(m){const d=m;if((d.code==="503"||d.code===Ee.Timeout)&&f+1<u)await ba(c.backoff(f));else throw m}}async findStream(n){const r={subject:n},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(n){const r=this.jc.decode(n.data),s=r;if(s.error){const l=sx(s.error.code,s.error.description);if(l!==null)throw l.api_error=s.error,l}return r}}class El{constructor(n,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(!n)throw new Error("subject is required");this.subject=n,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 n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const r=await this.jsm._request(this.subject,n,{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(n){var r,s,l;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((r=n.streams)==null?void 0:r.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((s=n.consumers)==null?void 0:s.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((l=n.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const r of n)yield r;n=await this.next()}}}function cs(e=""){const n=e.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${e}' is not a semver value`)}function id(e,n){return e.major<n.major?-1:e.major>n.major?1:e.minor<n.minor?-1:e.minor>n.minor?1:e.micro<n.micro?-1:e.micro>n.micro?1:0}var ut;(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"})(ut||(ut={}));class f2{constructor(n){C(this,"server");C(this,"features");C(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=cs(n)),this.server=n,this.set(ut.JS_KV,"2.6.2"),this.set(ut.JS_OBJECTSTORE,"2.6.3"),this.set(ut.JS_PULL_MAX_BYTES,"2.8.3"),this.set(ut.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(ut.JS_ALLOW_DIRECT,"2.9.0"),this.set(ut.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(ut.JS_SIMPLIFICATION,"2.9.4"),this.set(ut.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(ut.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(ut.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(ut.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(ut.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(ut.JS_STREAM_COMPRESSION,"2.10.0"),this.set(ut.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(ut.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(r=>{this.features.delete(r)})}set(n,r){this.features.set(n,{min:r,ok:id(this.server,cs(r))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var r;return((r=this.get(n))==null?void 0:r.ok)||!1}require(n){return typeof n=="string"&&(n=cs(n)),id(this.server,n)>=0}}class Nu extends Fl{constructor(n,r){super(n,r)}async add(n,r,s=ju.Create){if(mn(n),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=n,l.action=s,l.config.durable_name&&sa(l.config.durable_name);const u=this.nc;let{min:c,ok:f}=u.features.get(ut.JS_NEW_CONSUMER_CREATE_API);const m=r.name===""?void 0:r.name;if(m&&!f)throw new Error(`consumer 'name' requires server ${c}`);if(m)try{$u("name",m)}catch(b){const w=b.message,k=w.indexOf("cannot contain");throw k!==-1?new Error(`consumer 'name' ${w.substring(k)}`):b}let d,y="";if(Array.isArray(r.filter_subjects)){const{min:b,ok:w}=u.features.get(ut.JS_MULTIPLE_CONSUMER_FILTER);if(!w)throw new Error(`consumer 'filter_subjects' requires server ${b}`);f=!1}if(r.metadata){const{min:b,ok:w}=u.features.get(ut.JS_STREAM_CONSUMER_METADATA);if(!w)throw new Error(`consumer 'metadata' requires server ${b}`)}if(f&&(y=r.name??r.durable_name??""),y!==""){let b=r.filter_subject??void 0;b===">"&&(b=void 0),d=b!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${y}.${b}`:`${this.prefix}.CONSUMER.CREATE.${n}.${y}`}else d=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(d,l)}async update(n,r,s){const l=await this.info(n,r),u=s;return this.add(n,Object.assign(l.config,u),ju.Update)}async info(n,r){return mn(n),sa(r),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${r}`)}async delete(n,r){return mn(n),sa(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${r}`)).success}list(n){mn(n);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${n}`;return new El(s,r,this)}pause(n,r,s){const l=`${this.prefix}.CONSUMER.PAUSE.${n}.${r}`,u={pause_until:s.toISOString()};return this._request(l,u)}resume(n,r){return this.pause(n,r,new Date(0))}}function Ks(e,n,r=!1){if(r===!0&&!e)throw Oe.errorForCode(Ee.ApiError,new Error(`${n} is not a function`));if(e&&typeof e!="function")throw Oe.errorForCode(Ee.ApiError,new Error(`${n} is not a function`))}class h2 extends tn{constructor(r,s,l){super();C(this,"sub");C(this,"adapter");C(this,"subIterDone");Ks(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&Ks(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(Ks(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(Ks(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(Ks(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&Ks(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,b)=>{const[w,k]=this.adapter(g,b);if(w){y(w,null);return}const{ingest:D}=this.ingestionFilterFn?this.ingestionFilterFn(k,this):{ingest:!0};D&&(!this.protocolFilterFn||this.protocolFilterFn(k))&&(y(w,k),this.dispatchedFn&&k&&this.dispatchedFn(k))}}const{max:c,queue:f,timeout:m}=l,d={queue:f,timeout:m,callback:u};c&&c>0&&(d.max=c),this.sub=r.subscribe(s,d),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=Lt(),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 Pn;function d2(e){Pn=e}function ox(){return Pn!==void 0&&Pn.defaultPort!==void 0?Pn.defaultPort:4222}function vh(){return Pn!==void 0&&Pn.urlParseFn?Pn.urlParseFn:void 0}function m2(){if(!Pn||typeof Pn.factory!="function")throw new Error("transport fn is not set");return Pn.factory()}function sd(){return Pn!==void 0&&Pn.dnsResolveFn?Pn.dnsResolveFn:void 0}const wu=`\r
|
|
71
|
-
`,Ou=da.fromAscii(wu),p2=new Uint8Array(Ou)[0],g2=new Uint8Array(Ou)[1];function y2(e){for(let n=0;n<e.length;n++){const r=n+1;if(e.byteLength>r&&e[n]===p2&&e[r]===g2)return r+1}return 0}function b2(e){const n=y2(e);if(n>0){const s=new Uint8Array(e).slice(0,n);return Bn.decode(s)}return""}const x2=4,ux=48,v2=65,w2=97;function S2(e,n,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]=n,l[14]=r,l[15]=s,l}function ad(e){return _2(e)!==void 0}function _2(e){for(let n=0;n<e.length;n++)switch(e[n]){case".":return cx(e);case":":return E2(e)}}function cx(e){const n=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}=k2(e);if(!u||s>255)return;e=e.substring(l),n[r]=s}return S2(n[0],n[1],n[2],n[3])}function E2(e){const n=new Uint8Array(16);let r=-1;if(e.length>=2&&e[0]===":"&&e[1]===":"&&(r=0,e=e.substring(2),e.length===0))return n;let s=0;for(;s<16;){const{n:l,c:u,ok:c}=C2(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&s!=12||s+4>16)return;const f=cx(e);if(f===void 0)return;n[s]=f[12],n[s+1]=f[13],n[s+2]=f[14],n[s+3]=f[15],e="",s+=x2;break}if(n[s]=l>>8,n[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--)n[u+l]=n[u];for(let u=r+l-1;u>=r;u--)n[u]=0}else if(r>=0)return;return n}}function k2(e){let n=0,r=0;for(n=0;n<e.length&&48<=e.charCodeAt(n)&&e.charCodeAt(n)<=57;n++)if(r=r*10+(e.charCodeAt(n)-ux),r>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:r,c:n,ok:!0}}function C2(e){let n=0,r=0;for(r=0;r<e.length;r++){if(48<=e.charCodeAt(r)&&e.charCodeAt(r)<=57)n*=16,n+=e.charCodeAt(r)-ux;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)n*=16,n+=e.charCodeAt(r)-w2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)n*=16,n+=e.charCodeAt(r)-v2+10;else break;if(n>=16777215)return{n:0,c:r,ok:!1}}return r===0?{n:0,c:r,ok:!1}:{n,c:r,ok:!0}}function A2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function ld(e){return!A2(e)}function T2(e){const n="::FFFF:",r=e.toUpperCase().indexOf(n);if(r!==-1&&e.indexOf(".")!==-1){let s=e.substring(r+n.length);return s=s.replace("[",""),s.replace("]","")}return e}function j2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=T2(e),ld(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const n=ld(e)?e.match(/(]:)(\d+)/):e.match(/(:)(\d+)/),r=n&&n.length===3&&n[1]&&n[2]?parseInt(n[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 Al{constructor(n,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=n,this.tlsName="";const s=j2(n);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(n){if(!n.fn||n.resolve===!1)return[this];const r=[];if(ad(this.hostname))return[this];{const s=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${s.join(",")}`);for(const l of s){const u=this.port===80?"https":"http",c=new URL(`${u}://${ld(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new Al(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return n.randomize&&rx(r),this.resolves=r,r}}class N2{constructor(n=[],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=vh();n&&(n.forEach(l=>{l=s?s(l):l,this.servers.push(new Al(l))}),this.randomize&&(this.servers=rx(this.servers))),this.servers.length===0&&this.addServer(`${Zh}:${ox()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();ad(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,r=!1){const s=vh();n=s?s(n):n;const l=new Al(n,r);ad(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const r=this.servers.indexOf(n);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(n,r){const s=[];let l=[];const u=vh(),c=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(m=>{m=u?u(m,r):m;const d=new Al(m,!0);c.set(m,d)});const f=[];return this.servers.forEach((m,d)=>{const y=m.listen;m.gossiped&&this.currentServer.listen!==y&&c.get(y)===void 0&&f.push(d),c.delete(y)}),f.reverse(),f.forEach(m=>{const d=this.servers.splice(m,1);l=l.concat(d[0].listen)}),c.forEach((m,d)=>{this.servers.push(m),s.push(d)}),{added:s,deleted:l}}}class O2{constructor(){C(this,"baseInbox");C(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${Kr(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const r=n.subject||"";return r.indexOf(this.baseInbox)===0?r.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,r){if(r&&r.permissionContext){if(n)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(n,r)=>{const s=this.getToken(r);if(s){const l=this.get(s);l&&(n===null&&r.headers&&(n=ix(r)),l.resolver(n,r))}}}close(){const n=Oe.errorForCode(Ee.Timeout);this.reqs.forEach(r=>{r.resolver(n,{})})}}class R2{constructor(n,r,s){C(this,"ph");C(this,"interval");C(this,"maxOut");C(this,"timer");C(this,"pendings");this.ph=n,this.interval=r,this.maxOut=s,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:ia.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=Lt();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class M2 extends Error{constructor(n){super(n),this.name="AssertionError"}}function D2(e,n="Assertion failed."){if(!e)throw new M2(n)}const x0=32*1024,wh=2**32-2;function cu(e,n,r=0){const s=n.byteLength-r;return e.byteLength>s&&(e=e.subarray(0,s)),n.set(e,r),e.byteLength}class Sh{constructor(n){C(this,"_buf");C(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.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(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const r=this._buf.byteLength;return n<=this.capacity-r?(this._reslice(r+n),r):-1}_reslice(n){D2(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const r=cu(this._buf.subarray(this._off),n);return this._off+=r,r}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(Ui.encode(n))}write(n){const r=this._grow(n.byteLength);return cu(n,this._buf,r)}_grow(n){const r=this.length;r===0&&this._off!==0&&this.reset();const s=this._tryGrowByReslice(n);if(s>=0)return s;const l=this.capacity;if(n<=Math.floor(l/2)-r)cu(this._buf.subarray(this._off),this._buf);else{if(l+n>wh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+n,wh));cu(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+n,wh)),r}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const r=this._grow(n);this._reslice(r)}readFrom(n){let r=0;const s=new Uint8Array(x0);for(;;){const l=this.capacity-this.length<x0,u=l?s:new Uint8Array(this._buf.buffer,this.length),c=n.read(u);if(c===null)return r;l?this.write(u.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var pn;(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"})(pn||(pn={}));function v0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const L2=48;class w0{constructor(n){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=n,this.state=Ce.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let r;for(r=0;r<n.length;r++){const s=n[r];switch(this.state){case Ce.OP_START:switch(s){case Ae.M:case Ae.m:this.state=Ce.OP_M,this.hdr=-1,this.ma=v0();break;case Ae.H:case Ae.h:this.state=Ce.OP_H,this.hdr=0,this.ma=v0();break;case Ae.P:case Ae.p:this.state=Ce.OP_P;break;case Ae.PLUS:this.state=Ce.OP_PLUS;break;case Ae.MINUS:this.state=Ce.OP_MINUS;break;case Ae.I:case Ae.i:this.state=Ce.OP_I;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_H:switch(s){case Ae.M:case Ae.m:this.state=Ce.OP_M;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_M:switch(s){case Ae.S:case Ae.s:this.state=Ce.OP_MS;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_MS:switch(s){case Ae.G:case Ae.g:this.state=Ce.OP_MSG;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_MSG:switch(s){case Ae.SPACE:case Ae.TAB:this.state=Ce.OP_MSG_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_MSG_SPC:switch(s){case Ae.SPACE:case Ae.TAB:continue;default:this.state=Ce.MSG_ARG,this.as=r}break;case Ce.MSG_ARG:switch(s){case Ae.CR:this.drop=1;break;case Ae.NL:{const l=this.argBuf?this.argBuf.bytes():n.subarray(this.as,r-this.drop);this.processMsgArgs(l),this.drop=0,this.as=r+1,this.state=Ce.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case Ce.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:pn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ce.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const u=n.length-r;u<l&&(l=u),l>0?(this.msgBuf.write(n.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(s)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:pn.MSG,msg:this.ma,data:n.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ce.MSG_END);break;case Ce.MSG_END:switch(s){case Ae.NL:this.drop=0,this.as=r+1,this.state=Ce.OP_START;break;default:continue}break;case Ce.OP_PLUS:switch(s){case Ae.O:case Ae.o:this.state=Ce.OP_PLUS_O;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_PLUS_O:switch(s){case Ae.K:case Ae.k:this.state=Ce.OP_PLUS_OK;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_PLUS_OK:switch(s){case Ae.NL:this.dispatcher.push({kind:pn.OK}),this.drop=0,this.state=Ce.OP_START;break}break;case Ce.OP_MINUS:switch(s){case Ae.E:case Ae.e:this.state=Ce.OP_MINUS_E;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_MINUS_E:switch(s){case Ae.R:case Ae.r:this.state=Ce.OP_MINUS_ER;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_MINUS_ER:switch(s){case Ae.R:case Ae.r:this.state=Ce.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_MINUS_ERR:switch(s){case Ae.SPACE:case Ae.TAB:this.state=Ce.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_MINUS_ERR_SPC:switch(s){case Ae.SPACE:case Ae.TAB:continue;default:this.state=Ce.MINUS_ERR_ARG,this.as=r}break;case Ce.MINUS_ERR_ARG:switch(s){case Ae.CR:this.drop=1;break;case Ae.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=n.subarray(this.as,r-this.drop),this.dispatcher.push({kind:pn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=Ce.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case Ce.OP_P:switch(s){case Ae.I:case Ae.i:this.state=Ce.OP_PI;break;case Ae.O:case Ae.o:this.state=Ce.OP_PO;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_PO:switch(s){case Ae.N:case Ae.n:this.state=Ce.OP_PON;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_PON:switch(s){case Ae.G:case Ae.g:this.state=Ce.OP_PONG;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_PONG:switch(s){case Ae.NL:this.dispatcher.push({kind:pn.PONG}),this.drop=0,this.state=Ce.OP_START;break}break;case Ce.OP_PI:switch(s){case Ae.N:case Ae.n:this.state=Ce.OP_PIN;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_PIN:switch(s){case Ae.G:case Ae.g:this.state=Ce.OP_PING;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_PING:switch(s){case Ae.NL:this.dispatcher.push({kind:pn.PING}),this.drop=0,this.state=Ce.OP_START;break}break;case Ce.OP_I:switch(s){case Ae.N:case Ae.n:this.state=Ce.OP_IN;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_IN:switch(s){case Ae.F:case Ae.f:this.state=Ce.OP_INF;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_INF:switch(s){case Ae.O:case Ae.o:this.state=Ce.OP_INFO;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_INFO:switch(s){case Ae.SPACE:case Ae.TAB:this.state=Ce.OP_INFO_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ce.OP_INFO_SPC:switch(s){case Ae.SPACE:case Ae.TAB:continue;default:this.state=Ce.INFO_ARG,this.as=r}break;case Ce.INFO_ARG:switch(s){case Ae.CR:this.drop=1;break;case Ae.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=n.subarray(this.as,r-this.drop),this.dispatcher.push({kind:pn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=Ce.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(n.subarray(r))}}(this.state===Ce.MSG_ARG||this.state===Ce.MINUS_ERR_ARG||this.state===Ce.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Sh(n.subarray(this.as,r-this.drop))),this.state===Ce.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Sh(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,s=new Uint8Array(n+r);s.set(this.ma.subject),this.ma.reply&&s.set(this.ma.reply,n),this.argBuf=new Sh(s),this.ma.subject=s.subarray(0,n),this.ma.reply&&(this.ma.reply=s.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const r=[];let s=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Ae.SPACE:case Ae.TAB:case Ae.CR:case Ae.NL:s>=0&&(r.push(n.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(n.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(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${Bn.decode(n)}`)}processHeaderMsgArgs(n){const r=[];let s=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Ae.SPACE:case Ae.TAB:case Ae.CR:case Ae.NL:s>=0&&(r.push(n.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(n.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(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let r=0;for(let s=0;s<n.length;s++){if(n[s]<48||n[s]>57)return-1;r=r*10+(n[s]-L2)}return r}}var Ce;(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"})(Ce||(Ce={}));var Ae;(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"})(Ae||(Ae={}));(function(e){var n=function(E,j){this.hi=E|0,this.lo=j|0},r=function(E){var j,T=new Float64Array(16);if(E)for(j=0;j<E.length;j++)T[j]=E[j];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]),m=r([56129,1]),d=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]),b=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),w=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function k(E,j){return E<<j|E>>>32-j}function D(E,j){var T=E[j+3]&255;return T=T<<8|E[j+2]&255,T=T<<8|E[j+1]&255,T<<8|E[j+0]&255}function U(E,j){var T=E[j]<<24|E[j+1]<<16|E[j+2]<<8|E[j+3],L=E[j+4]<<24|E[j+5]<<16|E[j+6]<<8|E[j+7];return new n(T,L)}function M(E,j,T){var L;for(L=0;L<4;L++)E[j+L]=T&255,T>>>=8}function q(E,j,T){E[j]=T.hi>>24&255,E[j+1]=T.hi>>16&255,E[j+2]=T.hi>>8&255,E[j+3]=T.hi&255,E[j+4]=T.lo>>24&255,E[j+5]=T.lo>>16&255,E[j+6]=T.lo>>8&255,E[j+7]=T.lo&255}function H(E,j,T,L,F){var K,pe=0;for(K=0;K<F;K++)pe|=E[j+K]^T[L+K];return(1&pe-1>>>8)-1}function ae(E,j,T,L){return H(E,j,T,L,16)}function B(E,j,T,L){return H(E,j,T,L,32)}function z(E,j,T,L,F){var K=new Uint32Array(16),pe=new Uint32Array(16),xe=new Uint32Array(16),ie=new Uint32Array(4),de,Re,We;for(de=0;de<4;de++)pe[5*de]=D(L,4*de),pe[1+de]=D(T,4*de),pe[6+de]=D(j,4*de),pe[11+de]=D(T,16+4*de);for(de=0;de<16;de++)xe[de]=pe[de];for(de=0;de<20;de++){for(Re=0;Re<4;Re++){for(We=0;We<4;We++)ie[We]=pe[(5*Re+4*We)%16];for(ie[1]^=k(ie[0]+ie[3]|0,7),ie[2]^=k(ie[1]+ie[0]|0,9),ie[3]^=k(ie[2]+ie[1]|0,13),ie[0]^=k(ie[3]+ie[2]|0,18),We=0;We<4;We++)K[4*Re+(Re+We)%4]=ie[We]}for(We=0;We<16;We++)pe[We]=K[We]}if(F){for(de=0;de<16;de++)pe[de]=pe[de]+xe[de]|0;for(de=0;de<4;de++)pe[5*de]=pe[5*de]-D(L,4*de)|0,pe[6+de]=pe[6+de]-D(j,4*de)|0;for(de=0;de<4;de++)M(E,4*de,pe[5*de]),M(E,16+4*de,pe[6+de])}else for(de=0;de<16;de++)M(E,4*de,pe[de]+xe[de]|0)}function V(E,j,T,L){return z(E,j,T,L,!1),0}function Y(E,j,T,L){return z(E,j,T,L,!0),0}var $=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function O(E,j,T,L,F,K,pe){var xe=new Uint8Array(16),ie=new Uint8Array(64),de,Re;if(!F)return 0;for(Re=0;Re<16;Re++)xe[Re]=0;for(Re=0;Re<8;Re++)xe[Re]=K[Re];for(;F>=64;){for(V(ie,xe,pe,$),Re=0;Re<64;Re++)E[j+Re]=(T?T[L+Re]:0)^ie[Re];for(de=1,Re=8;Re<16;Re++)de=de+(xe[Re]&255)|0,xe[Re]=de&255,de>>>=8;F-=64,j+=64,T&&(L+=64)}if(F>0)for(V(ie,xe,pe,$),Re=0;Re<F;Re++)E[j+Re]=(T?T[L+Re]:0)^ie[Re];return 0}function W(E,j,T,L,F){return O(E,j,null,0,T,L,F)}function Z(E,j,T,L,F){var K=new Uint8Array(32);return Y(K,L,F,$),W(E,j,T,L.subarray(16),K)}function fe(E,j,T,L,F,K,pe){var xe=new Uint8Array(32);return Y(xe,K,pe,$),O(E,j,T,L,F,K.subarray(16),xe)}function J(E,j){var T,L=0;for(T=0;T<17;T++)L=L+(E[T]+j[T]|0)|0,E[T]=L&255,L>>>=8}var Q=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function P(E,j,T,L,F,K){var pe,xe,ie,de,Re=new Uint32Array(17),We=new Uint32Array(17),Nt=new Uint32Array(17),ln=new Uint32Array(17),ar=new Uint32Array(17);for(ie=0;ie<17;ie++)We[ie]=Nt[ie]=0;for(ie=0;ie<16;ie++)We[ie]=K[ie];for(We[3]&=15,We[4]&=252,We[7]&=15,We[8]&=252,We[11]&=15,We[12]&=252,We[15]&=15;F>0;){for(ie=0;ie<17;ie++)ln[ie]=0;for(ie=0;ie<16&&ie<F;++ie)ln[ie]=T[L+ie];for(ln[ie]=1,L+=ie,F-=ie,J(Nt,ln),xe=0;xe<17;xe++)for(Re[xe]=0,ie=0;ie<17;ie++)Re[xe]=Re[xe]+Nt[ie]*(ie<=xe?We[xe-ie]:320*We[xe+17-ie]|0)|0|0;for(xe=0;xe<17;xe++)Nt[xe]=Re[xe];for(de=0,ie=0;ie<16;ie++)de=de+Nt[ie]|0,Nt[ie]=de&255,de>>>=8;for(de=de+Nt[16]|0,Nt[16]=de&3,de=5*(de>>>2)|0,ie=0;ie<16;ie++)de=de+Nt[ie]|0,Nt[ie]=de&255,de>>>=8;de=de+Nt[16]|0,Nt[16]=de}for(ie=0;ie<17;ie++)ar[ie]=Nt[ie];for(J(Nt,Q),pe=-(Nt[16]>>>7)|0,ie=0;ie<17;ie++)Nt[ie]^=pe&(ar[ie]^Nt[ie]);for(ie=0;ie<16;ie++)ln[ie]=K[ie+16];for(ln[16]=0,J(Nt,ln),ie=0;ie<16;ie++)E[j+ie]=Nt[ie];return 0}function se(E,j,T,L,F,K){var pe=new Uint8Array(16);return P(pe,0,T,L,F,K),ae(E,j,pe,0)}function ye(E,j,T,L,F){var K;if(T<32)return-1;for(fe(E,0,j,0,T,L,F),P(E,16,E,32,T-32,E),K=0;K<16;K++)E[K]=0;return 0}function _e(E,j,T,L,F){var K,pe=new Uint8Array(32);if(T<32||(Z(pe,0,32,L,F),se(j,16,j,32,T-32,pe)!==0))return-1;for(fe(E,0,j,0,T,L,F),K=0;K<32;K++)E[K]=0;return 0}function _(E,j){var T;for(T=0;T<16;T++)E[T]=j[T]|0}function R(E){var j,T;for(T=0;T<16;T++)E[T]+=65536,j=Math.floor(E[T]/65536),E[(T+1)*(T<15?1:0)]+=j-1+37*(j-1)*(T===15?1:0),E[T]-=j*65536}function ee(E,j,T){for(var L,F=~(T-1),K=0;K<16;K++)L=F&(E[K]^j[K]),E[K]^=L,j[K]^=L}function A(E,j){var T,L,F,K=r(),pe=r();for(T=0;T<16;T++)pe[T]=j[T];for(R(pe),R(pe),R(pe),L=0;L<2;L++){for(K[0]=pe[0]-65517,T=1;T<15;T++)K[T]=pe[T]-65535-(K[T-1]>>16&1),K[T-1]&=65535;K[15]=pe[15]-32767-(K[14]>>16&1),F=K[15]>>16&1,K[14]&=65535,ee(pe,K,1-F)}for(T=0;T<16;T++)E[2*T]=pe[T]&255,E[2*T+1]=pe[T]>>8}function ve(E,j){var T=new Uint8Array(32),L=new Uint8Array(32);return A(T,E),A(L,j),B(T,0,L,0)}function Ne(E){var j=new Uint8Array(32);return A(j,E),j[0]&1}function je(E,j){var T;for(T=0;T<16;T++)E[T]=j[2*T]+(j[2*T+1]<<8);E[15]&=32767}function Ue(E,j,T){var L;for(L=0;L<16;L++)E[L]=j[L]+T[L]|0}function Ye(E,j,T){var L;for(L=0;L<16;L++)E[L]=j[L]-T[L]|0}function me(E,j,T){var L,F,K=new Float64Array(31);for(L=0;L<31;L++)K[L]=0;for(L=0;L<16;L++)for(F=0;F<16;F++)K[L+F]+=j[L]*T[F];for(L=0;L<15;L++)K[L]+=38*K[L+16];for(L=0;L<16;L++)E[L]=K[L];R(E),R(E)}function Le(E,j){me(E,j,j)}function be(E,j){var T=r(),L;for(L=0;L<16;L++)T[L]=j[L];for(L=253;L>=0;L--)Le(T,T),L!==2&&L!==4&&me(T,T,j);for(L=0;L<16;L++)E[L]=T[L]}function ze(E,j){var T=r(),L;for(L=0;L<16;L++)T[L]=j[L];for(L=250;L>=0;L--)Le(T,T),L!==1&&me(T,T,j);for(L=0;L<16;L++)E[L]=T[L]}function qe(E,j,T){var L=new Uint8Array(32),F=new Float64Array(80),K,pe,xe=r(),ie=r(),de=r(),Re=r(),We=r(),Nt=r();for(pe=0;pe<31;pe++)L[pe]=j[pe];for(L[31]=j[31]&127|64,L[0]&=248,je(F,T),pe=0;pe<16;pe++)ie[pe]=F[pe],Re[pe]=xe[pe]=de[pe]=0;for(xe[0]=Re[0]=1,pe=254;pe>=0;--pe)K=L[pe>>>3]>>>(pe&7)&1,ee(xe,ie,K),ee(de,Re,K),Ue(We,xe,de),Ye(xe,xe,de),Ue(de,ie,Re),Ye(ie,ie,Re),Le(Re,We),Le(Nt,xe),me(xe,de,xe),me(de,ie,We),Ue(We,xe,de),Ye(xe,xe,de),Le(ie,xe),Ye(de,Re,Nt),me(xe,de,m),Ue(xe,xe,Re),me(de,de,xe),me(xe,Re,Nt),me(Re,ie,F),Le(ie,We),ee(xe,ie,K),ee(de,Re,K);for(pe=0;pe<16;pe++)F[pe+16]=xe[pe],F[pe+32]=de[pe],F[pe+48]=ie[pe],F[pe+64]=Re[pe];var ln=F.subarray(32),ar=F.subarray(16);return be(ln,ln),me(ar,ar,ln),A(E,ar),0}function $e(E,j){return qe(E,j,u)}function Be(E,j){return s(j,32),$e(E,j)}function He(E,j,T){var L=new Uint8Array(32);return qe(L,T,j),Y(E,l,L,$)}var Qe=ye,Et=_e;function Ze(E,j,T,L,F,K){var pe=new Uint8Array(32);return He(pe,F,K),Qe(E,j,T,L,pe)}function Ht(E,j,T,L,F,K){var pe=new Uint8Array(32);return He(pe,F,K),Et(E,j,T,L,pe)}function Ge(){var E=0,j=0,T=0,L=0,F=65535,K,pe,xe;for(xe=0;xe<arguments.length;xe++)K=arguments[xe].lo,pe=arguments[xe].hi,E+=K&F,j+=K>>>16,T+=pe&F,L+=pe>>>16;return j+=E>>>16,T+=j>>>16,L+=T>>>16,new n(T&F|L<<16,E&F|j<<16)}function fn(E,j){return new n(E.hi>>>j,E.lo>>>j|E.hi<<32-j)}function rr(){var E=0,j=0,T;for(T=0;T<arguments.length;T++)E^=arguments[T].lo,j^=arguments[T].hi;return new n(j,E)}function bt(E,j){var T,L,F=32-j;return j<32?(T=E.hi>>>j|E.lo<<F,L=E.lo>>>j|E.hi<<F):j<64&&(T=E.lo>>>j|E.hi<<F,L=E.hi>>>j|E.lo<<F),new n(T,L)}function Pi(E,j,T){var L=E.hi&j.hi^~E.hi&T.hi,F=E.lo&j.lo^~E.lo&T.lo;return new n(L,F)}function ce(E,j,T){var L=E.hi&j.hi^E.hi&T.hi^j.hi&T.hi,F=E.lo&j.lo^E.lo&T.lo^j.lo&T.lo;return new n(L,F)}function Se(E){return rr(bt(E,28),bt(E,34),bt(E,39))}function oe(E){return rr(bt(E,14),bt(E,18),bt(E,41))}function Te(E){return rr(bt(E,1),bt(E,8),fn(E,7))}function ke(E){return rr(bt(E,19),bt(E,61),fn(E,6))}var st=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function dt(E,j,T){var L=[],F=[],K=[],pe=[],xe,ie,de;for(ie=0;ie<8;ie++)L[ie]=K[ie]=U(E,8*ie);for(var Re=0;T>=128;){for(ie=0;ie<16;ie++)pe[ie]=U(j,8*ie+Re);for(ie=0;ie<80;ie++){for(de=0;de<8;de++)F[de]=K[de];for(xe=Ge(K[7],oe(K[4]),Pi(K[4],K[5],K[6]),st[ie],pe[ie%16]),F[7]=Ge(xe,Se(K[0]),ce(K[0],K[1],K[2])),F[3]=Ge(F[3],xe),de=0;de<8;de++)K[(de+1)%8]=F[de];if(ie%16===15)for(de=0;de<16;de++)pe[de]=Ge(pe[de],pe[(de+9)%16],Te(pe[(de+1)%16]),ke(pe[(de+14)%16]))}for(ie=0;ie<8;ie++)K[ie]=Ge(K[ie],L[ie]),L[ie]=K[ie];Re+=128,T-=128}for(ie=0;ie<8;ie++)q(E,8*ie,L[ie]);return T}var at=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 kt(E,j,T){var L=new Uint8Array(64),F=new Uint8Array(256),K,pe=T;for(K=0;K<64;K++)L[K]=at[K];for(dt(L,j,T),T%=128,K=0;K<256;K++)F[K]=0;for(K=0;K<T;K++)F[K]=j[pe-T+K];for(F[T]=128,T=256-128*(T<112?1:0),F[T-9]=0,q(F,T-8,new n(pe/536870912|0,pe<<3)),dt(L,F,T),K=0;K<64;K++)E[K]=L[K];return 0}function Kt(E,j){var T=r(),L=r(),F=r(),K=r(),pe=r(),xe=r(),ie=r(),de=r(),Re=r();Ye(T,E[1],E[0]),Ye(Re,j[1],j[0]),me(T,T,Re),Ue(L,E[0],E[1]),Ue(Re,j[0],j[1]),me(L,L,Re),me(F,E[3],j[3]),me(F,F,y),me(K,E[2],j[2]),Ue(K,K,K),Ye(pe,L,T),Ye(xe,K,F),Ue(ie,K,F),Ue(de,L,T),me(E[0],pe,xe),me(E[1],de,ie),me(E[2],ie,xe),me(E[3],pe,de)}function mt(E,j,T){var L;for(L=0;L<4;L++)ee(E[L],j[L],T)}function In(E,j){var T=r(),L=r(),F=r();be(F,j[2]),me(T,j[0],F),me(L,j[1],F),A(E,L),E[31]^=Ne(T)<<7}function hn(E,j,T){var L,F;for(_(E[0],c),_(E[1],f),_(E[2],f),_(E[3],c),F=255;F>=0;--F)L=T[F/8|0]>>(F&7)&1,mt(E,j,L),Kt(j,E),Kt(E,E),mt(E,j,L)}function ms(E,j){var T=[r(),r(),r(),r()];_(T[0],g),_(T[1],b),_(T[2],f),me(T[3],g,b),hn(E,T,j)}function ei(E,j,T){var L=new Uint8Array(64),F=[r(),r(),r(),r()],K;for(T||s(j,32),kt(L,j,32),L[0]&=248,L[31]&=127,L[31]|=64,ms(F,L),In(E,F),K=0;K<32;K++)j[K+32]=E[K];return 0}var Tr=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 ti(E,j){var T,L,F,K;for(L=63;L>=32;--L){for(T=0,F=L-32,K=L-12;F<K;++F)j[F]+=T-16*j[L]*Tr[F-(L-32)],T=Math.floor((j[F]+128)/256),j[F]-=T*256;j[F]+=T,j[L]=0}for(T=0,F=0;F<32;F++)j[F]+=T-(j[31]>>4)*Tr[F],T=j[F]>>8,j[F]&=255;for(F=0;F<32;F++)j[F]-=T*Tr[F];for(L=0;L<32;L++)j[L+1]+=j[L]>>8,E[L]=j[L]&255}function ir(E){var j=new Float64Array(64),T;for(T=0;T<64;T++)j[T]=E[T];for(T=0;T<64;T++)E[T]=0;ti(E,j)}function qi(E,j,T,L){var F=new Uint8Array(64),K=new Uint8Array(64),pe=new Uint8Array(64),xe,ie,de=new Float64Array(64),Re=[r(),r(),r(),r()];kt(F,L,32),F[0]&=248,F[31]&=127,F[31]|=64;var We=T+64;for(xe=0;xe<T;xe++)E[64+xe]=j[xe];for(xe=0;xe<32;xe++)E[32+xe]=F[32+xe];for(kt(pe,E.subarray(32),T+32),ir(pe),ms(Re,pe),In(E,Re),xe=32;xe<64;xe++)E[xe]=L[xe];for(kt(K,E,T+64),ir(K),xe=0;xe<64;xe++)de[xe]=0;for(xe=0;xe<32;xe++)de[xe]=pe[xe];for(xe=0;xe<32;xe++)for(ie=0;ie<32;ie++)de[xe+ie]+=K[xe]*F[ie];return ti(E.subarray(32),de),We}function Hi(E,j){var T=r(),L=r(),F=r(),K=r(),pe=r(),xe=r(),ie=r();return _(E[2],f),je(E[1],j),Le(F,E[1]),me(K,F,d),Ye(F,F,E[2]),Ue(K,E[2],K),Le(pe,K),Le(xe,pe),me(ie,xe,pe),me(T,ie,F),me(T,T,K),ze(T,T),me(T,T,F),me(T,T,K),me(T,T,K),me(E[0],T,K),Le(L,E[0]),me(L,L,K),ve(L,F)&&me(E[0],E[0],w),Le(L,E[0]),me(L,L,K),ve(L,F)?-1:(Ne(E[0])===j[31]>>7&&Ye(E[0],c,E[0]),me(E[3],E[0],E[1]),0)}function Sa(E,j,T,L){var F,K=new Uint8Array(32),pe=new Uint8Array(64),xe=[r(),r(),r(),r()],ie=[r(),r(),r(),r()];if(T<64||Hi(ie,L))return-1;for(F=0;F<T;F++)E[F]=j[F];for(F=0;F<32;F++)E[F+32]=L[F];if(kt(pe,E,T),ir(pe),hn(xe,ie,pe),ms(ie,j.subarray(32)),Kt(xe,ie),In(K,xe),T-=64,B(j,0,K,0)){for(F=0;F<T;F++)E[F]=0;return-1}for(F=0;F<T;F++)E[F]=j[F+64];return T}var ps=32,ni=24,sr=32,ri=16,ii=32,Ii=32,si=32,jr=32,Fi=32,_a=ni,Jl=sr,mr=ri,Ct=64,Bt=32,An=64,$i=32,Ea=64;e.lowlevel={crypto_core_hsalsa20:Y,crypto_stream_xor:fe,crypto_stream:Z,crypto_stream_salsa20_xor:O,crypto_stream_salsa20:W,crypto_onetimeauth:P,crypto_onetimeauth_verify:se,crypto_verify_16:ae,crypto_verify_32:B,crypto_secretbox:ye,crypto_secretbox_open:_e,crypto_scalarmult:qe,crypto_scalarmult_base:$e,crypto_box_beforenm:He,crypto_box_afternm:Qe,crypto_box:Ze,crypto_box_open:Ht,crypto_box_keypair:Be,crypto_hash:kt,crypto_sign:qi,crypto_sign_keypair:ei,crypto_sign_open:Sa,crypto_secretbox_KEYBYTES:ps,crypto_secretbox_NONCEBYTES:ni,crypto_secretbox_ZEROBYTES:sr,crypto_secretbox_BOXZEROBYTES:ri,crypto_scalarmult_BYTES:ii,crypto_scalarmult_SCALARBYTES:Ii,crypto_box_PUBLICKEYBYTES:si,crypto_box_SECRETKEYBYTES:jr,crypto_box_BEFORENMBYTES:Fi,crypto_box_NONCEBYTES:_a,crypto_box_ZEROBYTES:Jl,crypto_box_BOXZEROBYTES:mr,crypto_sign_BYTES:Ct,crypto_sign_PUBLICKEYBYTES:Bt,crypto_sign_SECRETKEYBYTES:An,crypto_sign_SEEDBYTES:$i,crypto_hash_BYTES:Ea,gf:r,D:d,L:Tr,pack25519:A,unpack25519:je,M:me,A:Ue,S:Le,Z:Ye,pow2523:ze,add:Kt,set25519:_,modL:ti,scalarmult:hn,scalarbase:ms};function Xl(E,j){if(E.length!==ps)throw new Error("bad key size");if(j.length!==ni)throw new Error("bad nonce size")}function Kl(E,j){if(E.length!==si)throw new Error("bad public key size");if(j.length!==jr)throw new Error("bad secret key size")}function Qt(){for(var E=0;E<arguments.length;E++)if(!(arguments[E]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function gs(E){for(var j=0;j<E.length;j++)E[j]=0}e.randomBytes=function(E){var j=new Uint8Array(E);return s(j,E),j},e.secretbox=function(E,j,T){Qt(E,j,T),Xl(T,j);for(var L=new Uint8Array(sr+E.length),F=new Uint8Array(L.length),K=0;K<E.length;K++)L[K+sr]=E[K];return ye(F,L,L.length,j,T),F.subarray(ri)},e.secretbox.open=function(E,j,T){Qt(E,j,T),Xl(T,j);for(var L=new Uint8Array(ri+E.length),F=new Uint8Array(L.length),K=0;K<E.length;K++)L[K+ri]=E[K];return L.length<32||_e(F,L,L.length,j,T)!==0?null:F.subarray(sr)},e.secretbox.keyLength=ps,e.secretbox.nonceLength=ni,e.secretbox.overheadLength=ri,e.scalarMult=function(E,j){if(Qt(E,j),E.length!==Ii)throw new Error("bad n size");if(j.length!==ii)throw new Error("bad p size");var T=new Uint8Array(ii);return qe(T,E,j),T},e.scalarMult.base=function(E){if(Qt(E),E.length!==Ii)throw new Error("bad n size");var j=new Uint8Array(ii);return $e(j,E),j},e.scalarMult.scalarLength=Ii,e.scalarMult.groupElementLength=ii,e.box=function(E,j,T,L){var F=e.box.before(T,L);return e.secretbox(E,j,F)},e.box.before=function(E,j){Qt(E,j),Kl(E,j);var T=new Uint8Array(Fi);return He(T,E,j),T},e.box.after=e.secretbox,e.box.open=function(E,j,T,L){var F=e.box.before(T,L);return e.secretbox.open(E,j,F)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var E=new Uint8Array(si),j=new Uint8Array(jr);return Be(E,j),{publicKey:E,secretKey:j}},e.box.keyPair.fromSecretKey=function(E){if(Qt(E),E.length!==jr)throw new Error("bad secret key size");var j=new Uint8Array(si);return $e(j,E),{publicKey:j,secretKey:new Uint8Array(E)}},e.box.publicKeyLength=si,e.box.secretKeyLength=jr,e.box.sharedKeyLength=Fi,e.box.nonceLength=_a,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(E,j){if(Qt(E,j),j.length!==An)throw new Error("bad secret key size");var T=new Uint8Array(Ct+E.length);return qi(T,E,E.length,j),T},e.sign.open=function(E,j){if(Qt(E,j),j.length!==Bt)throw new Error("bad public key size");var T=new Uint8Array(E.length),L=Sa(T,E,E.length,j);if(L<0)return null;for(var F=new Uint8Array(L),K=0;K<F.length;K++)F[K]=T[K];return F},e.sign.detached=function(E,j){for(var T=e.sign(E,j),L=new Uint8Array(Ct),F=0;F<L.length;F++)L[F]=T[F];return L},e.sign.detached.verify=function(E,j,T){if(Qt(E,j,T),j.length!==Ct)throw new Error("bad signature size");if(T.length!==Bt)throw new Error("bad public key size");var L=new Uint8Array(Ct+E.length),F=new Uint8Array(Ct+E.length),K;for(K=0;K<Ct;K++)L[K]=j[K];for(K=0;K<E.length;K++)L[K+Ct]=E[K];return Sa(F,L,L.length,T)>=0},e.sign.keyPair=function(){var E=new Uint8Array(Bt),j=new Uint8Array(An);return ei(E,j),{publicKey:E,secretKey:j}},e.sign.keyPair.fromSecretKey=function(E){if(Qt(E),E.length!==An)throw new Error("bad secret key size");for(var j=new Uint8Array(Bt),T=0;T<j.length;T++)j[T]=E[32+T];return{publicKey:j,secretKey:new Uint8Array(E)}},e.sign.keyPair.fromSeed=function(E){if(Qt(E),E.length!==$i)throw new Error("bad seed size");for(var j=new Uint8Array(Bt),T=new Uint8Array(An),L=0;L<32;L++)T[L]=E[L];return ei(j,T,!0),{publicKey:j,secretKey:T}},e.sign.publicKeyLength=Bt,e.sign.secretKeyLength=An,e.sign.seedLength=$i,e.sign.signatureLength=Ct,e.hash=function(E){Qt(E);var j=new Uint8Array(Ea);return kt(j,E,E.length),j},e.hash.hashLength=Ea,e.verify=function(E,j){return Qt(E,j),E.length===0||j.length===0||E.length!==j.length?!1:H(E,0,j,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 j=65536;e.setPRNG(function(T,L){var F,K=new Uint8Array(L);for(F=0;F<L;F+=j)E.getRandomValues(K.subarray(F,F+Math.min(L-F,j)));for(F=0;F<L;F++)T[F]=K[F];gs(K)})}else typeof require<"u"&&(E=require("crypto"),E&&E.randomBytes&&e.setPRNG(function(T,L){var F,K=E.randomBytes(L);for(F=0;F<L;F++)T[F]=K[F];gs(K)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const fu=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,z2={fromSeed:fu.sign.keyPair.fromSeed,sign:fu.sign.detached,verify:fu.sign.detached.verify,randomBytes:fu.randomBytes};let fx;function U2(e){fx=e}function Ni(){return fx}const B2=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 Ru{static checksum(n){let r=0;for(let s=0;s<n.byteLength;s++){let l=n[s];r=r<<8&65535^B2[(r>>8^l)&255]}return r}static validate(n,r){return Ru.checksum(n)==r}}const _h="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class S0{static encode(n){let r=0,s=0,l=new Uint8Array(n),u=new Uint8Array(n.byteLength*2),c=0;for(let f=0;f<l.byteLength;f++)for(s=s<<8|l[f],r+=8;r>=5;){let m=s>>>r-5&31;u[c++]=_h.charAt(m).charCodeAt(0),r-=5}if(r>0){let f=s<<5-r&31;u[c++]=_h.charAt(f).charCodeAt(0)}return u.slice(0,c)}static decode(n){let r=0,s=0,l=0,u=new Uint8Array(n),c=new Uint8Array(u.byteLength*5/8|0);for(let f=0;f<u.byteLength;f++){let m=String.fromCharCode(u[f]),d=_h.indexOf(m);if(d===-1)throw new Error("Illegal Base32 character: "+u[f]);s=s<<5|d,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 P2(){return Gu(St.Operator)}function q2(){return Gu(St.Account)}function H2(){return Gu(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 ra{static isValidPublicPrefix(n){return n==St.Server||n==St.Operator||n==St.Cluster||n==St.Account||n==St.User}static startsWithValidPrefix(n){let r=n[0];return r=="S"||r=="P"||r=="O"||r=="N"||r=="C"||r=="A"||r=="U"}static isValidPrefix(n){return this.parsePrefix(n)!=-1}static parsePrefix(n){switch(n){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 gn{static encode(n,r){if(!r||!(r instanceof Uint8Array))throw new _t(pt.SerializationError);if(!ra.isValidPrefix(n))throw new _t(pt.InvalidPrefixByte);return gn._encode(!1,n,r)}static encodeSeed(n,r){if(!r)throw new _t(pt.ApiError);if(!ra.isValidPublicPrefix(n))throw new _t(pt.InvalidPrefixByte);if(r.byteLength!==32)throw new _t(pt.InvalidSeedLen);return gn._encode(!0,n,r)}static decode(n,r){if(!ra.isValidPrefix(n))throw new _t(pt.InvalidPrefixByte);const s=gn._decode(r);if(s[0]!==n)throw new _t(pt.InvalidPrefixByte);return s.slice(1)}static decodeSeed(n){const r=gn._decode(n),s=gn._decodePrefix(r);if(s[0]!=St.Seed)throw new _t(pt.InvalidSeed);if(!ra.isValidPublicPrefix(s[1]))throw new _t(pt.InvalidPrefixByte);return{buf:r.slice(2),prefix:s[1]}}static _encode(n,r,s){const l=n?2:1,u=s.byteLength,c=l+u+2,f=l+u,m=new Uint8Array(c);if(n){const g=gn._encodePrefix(St.Seed,r);m.set(g)}else m[0]=r;m.set(s,l);const d=Ru.checksum(m.slice(0,f));return new DataView(m.buffer).setUint16(f,d,!0),S0.encode(m)}static _decode(n){if(n.byteLength<4)throw new _t(pt.InvalidEncoding);let r;try{r=S0.decode(n)}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(!Ru.validate(c,u))throw new _t(pt.InvalidChecksum);return c}static _encodePrefix(n,r){const s=n|r>>5,l=(r&31)<<3;return new Uint8Array([s,l])}static _decodePrefix(n){const r=n[0]&248,s=(n[0]&7)<<5|(n[1]&248)>>3;return new Uint8Array([r,s])}}class hx{constructor(n){C(this,"seed");this.seed=n}getRawSeed(){if(!this.seed)throw new _t(pt.ClearedPair);return gn.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 n=gn.decodeSeed(this.seed),r=Ni().fromSeed(this.getRawSeed()),s=gn.encode(n.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new _t(pt.ClearedPair);const n=Ni().fromSeed(this.getRawSeed());return gn.encode(St.Private,n.secretKey)}sign(n){if(!this.seed)throw new _t(pt.ClearedPair);const r=Ni().fromSeed(this.getRawSeed());return Ni().sign(n,r.secretKey)}verify(n,r){if(!this.seed)throw new _t(pt.ClearedPair);const s=Ni().fromSeed(this.getRawSeed());return Ni().verify(n,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Gu(e){const n=Ni().randomBytes(32);let r=gn.encodeSeed(e,new Uint8Array(n));return new hx(r)}class I2{constructor(n){C(this,"publicKey");this.publicKey=n}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(n){throw this.publicKey?new _t(pt.CannotSign):new _t(pt.ClearedPair)}verify(n,r){if(!this.publicKey)throw new _t(pt.ClearedPair);let s=gn._decode(this.publicKey);return Ni().verify(n,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function F2(e){const n=new TextEncoder().encode(e),r=gn._decode(n),s=ra.parsePrefix(r[0]);if(ra.isValidPublicPrefix(s))return new I2(n);throw new _t(pt.InvalidPublicKey)}function $2(e){return gn.decodeSeed(e),new hx(e)}function Y2(e){return btoa(String.fromCharCode(...e))}function G2(e){const n=atob(e),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r}U2(z2);const _0={createAccount:q2,createOperator:P2,createPair:Gu,createUser:H2,fromPublic:F2,fromSeed:$2,NKeysError:_t,NKeysErrorCode:pt,Prefix:St,decode:G2,encode:Y2};function V2(e){return n=>{let r={};return e.forEach(s=>{const l=s(n)||{};r=Object.assign(r,l)}),r}}function J2(){return()=>{}}function X2(e,n){return()=>{const r=typeof e=="function"?e():e,s=typeof n=="function"?n():n;return{user:r,pass:s}}}function K2(e){return()=>({auth_token:typeof e=="function"?e():e})}function Q2(e){return n=>{const r=typeof e=="function"?e():e,s=r?_0.fromSeed(r):void 0,l=s?s.getPublicKey():"",u=Ui.encode(n||""),c=s!==void 0&&n?s.sign(u):void 0,f=c?_0.encode(c):"";return{nkey:l,sig:f}}}function dx(e,n){return r=>{const s=typeof e=="function"?e():e,l=Q2(n),{nkey:u,sig:c}=l(r);return{jwt:s,nkey:u,sig:c}}}const mx=120*1e3,Z2=2,px=2*1e3;function W2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:mx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:px,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function eE(e){const n=[];return typeof e.authenticator=="function"&&n.push(e.authenticator),Array.isArray(e.authenticator)&&n.push(...e.authenticator),e.token&&n.push(K2(e.token)),e.user&&n.push(X2(e.user,e.pass)),n.length===0?J2():V2(n)}function tE(e){const n=`${Zh}:${ox()}`;if(e=e||{servers:[n]},e.servers=e.servers||[],typeof e.servers=="string"&&(e.servers=[e.servers]),e.servers.length>0&&e.port)throw new Oe("port and servers options are mutually exclusive",Ee.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${Zh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[n]);const r=Fu(W2(),e);if(r.authenticator=eE(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new Oe(`${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{Kr(r.inboxPrefix)}catch(s){throw new Oe(s.message,Ee.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof sd()=="function"),r.resolve&&typeof sd()!="function")throw new Oe("'resolve' is not supported on this client",Ee.InvalidOption);return r}function nE(e,n){const{proto:r,tls_required:s,tls_available:l}=e;if((r===void 0||r<1)&&n.noEcho)throw new Oe("noEcho",Ee.ServerOptionNotAvailable);const u=s||l||!1;if(n.tls&&!u)throw new Oe("tls",Ee.ServerOptionNotAvailable)}const rE=1024*32,iE=/^INFO\s+([^\r\n]+)\r\n/i,sE=kl(`PONG\r
|
|
72
|
-
`),E0=kl(`PING\r
|
|
73
|
-
`);class aE{constructor(n,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=n.version,this.lang=n.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):{})||{};Fu(this,l)}}class gx extends tn{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");Fu(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Lt();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=fa(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,m)=>{const{ingest:d}=l(m);d&&u(m)&&(s(f,m),c(m))}}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(Oe.errorForCode(Ee.ConnectionClosed)):this.isClosed()?Promise.reject(Oe.errorForCode(Ee.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Lt()).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 lE{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(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const r=n.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(n,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Mu{constructor(n,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=rE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=r,this.subscriptions=new lE,this.muxSubscriptions=new O2,this.outbound=new da,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new f2({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new N2(s,{randomize:!n.noRandomize}),this.closed=Lt(),this.parser=new w0(this),this.heartbeats=new R2(this,this.options.pingInterval||mx,this.options.maxPingOut||Z2)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const r=Oe.errorForCode(Ee.Disconnect);r.stack="",n.forEach(s=>{s.reject(r)}),this.parser=new w0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(r=>{r.push(n)})}status(){const n=new tn;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=Lt();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=r=>{n.reject(r)},this.transport=m2(),this.transport.closed().then(async r=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:ia.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:ia.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:Jr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:Jr.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(n)}async dial(n){const r=this.prepare();let s;try{s=fa(this.options.timeout||2e4);const l=this.transport.connect(n,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(n){const{resolve:r}=this.options,s=await n.resolve({fn:sd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of s)try{l=null,this.dispatchStatus({type:ia.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 n;for(;;){this._closed&&this.servers.clear();const r=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():px;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw n||(this.lastError?this.lastError:Oe.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(n=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 ba(s)}}static async connect(n,r){const s=new Mu(n,r);return await s.dialLoop(),s}static toError(n){const r=n?n.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new Oe(n,Ee.PermissionsViolation),l=n.match(/(Publish|Subscription) to "(\S+)"/);if(l){s.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const u=n.match(/using queue "(\S+)"/);u&&(s.permissionContext.queue=u[1])}return s}else return r.indexOf("authorization violation")!==-1?new Oe(n,Ee.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new Oe(n,Ee.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new Oe(n,Ee.AccountExpired):r.indexOf("authentication timeout")!==-1?new Oe(n,Ee.AuthenticationTimeout):new Oe(n,Ee.ProtocolError)}processMsg(n,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const s=this.subscriptions.get(n.sid);s&&(s.received+=1,s.callback&&s.callback(null,new Md(n,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(n){const r=a0(n),s=Mu.toError(r),l={type:Jr.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(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(sE)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const r=JSON.parse(a0(n));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(cs(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new aE({version:u,lang:c},this.options,r.nonce);r.headers&&(f.headers=!0,f.no_responders=!0);const m=JSON.stringify(f);this.transport.send(kl(`CONNECT ${m}${wu}`)),this.transport.send(E0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:Jr.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:Jr.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case pn.MSG:{const{msg:r,data:s}=n;this.processMsg(r,s);break}case pn.OK:break;case pn.ERR:this.processError(n.data);break;case pn.PING:this.processPing();break;case pn.PONG:this.processPong();break;case pn.INFO:this.processInfo(n.data);break}}sendCommand(n,...r){const s=this.outbound.length();let l;typeof n=="string"?l=kl(n):l=n,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,r=Hn,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Ui.encode(r);else throw Oe.errorForCode(Ee.BadPayload);let u=l.length;s=s||{},s.reply=s.reply||"";let c=Hn,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new Oe("headers",Ee.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw Oe.errorForCode(Ee.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let m;s.headers?(s.reply?m=`HPUB ${n} ${s.reply} ${f} ${u}\r
|
|
74
|
-
`:m=`HPUB ${n} ${f} ${u}\r
|
|
75
|
-
`,this.sendCommand(m,c,l,Ou)):(s.reply?m=`PUB ${n} ${s.reply} ${u}\r
|
|
76
|
-
`:m=`PUB ${n} ${u}\r
|
|
77
|
-
`,this.sendCommand(m,l,Ou))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
|
|
78
|
-
`):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
|
|
79
|
-
`)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,r){this.unsub(n,r),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,r){!n||this.isClosed()||(r?this.sendCommand(`UNSUB ${n.sid} ${r}\r
|
|
80
|
-
`):this.sendCommand(`UNSUB ${n.sid}\r
|
|
81
|
-
`),n.max=r)}resub(n,r){!n||this.isClosed()||(this.unsub(n),n.subject=r,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=Lt()),this.pongs.push(n),this.outbound.fill(E0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(r=>{const s=r;s.queue?n.push(`SUB ${s.subject} ${s.queue} ${s.sid}${wu}`):n.push(`SUB ${s.subject} ${s.sid}${wu}`)}),n.length&&this.transport.send(kl(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(r=>{r.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),r=[];return n.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 n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const r=this.muxSubscriptions.init(this.options.inboxPrefix),s=new gx(this,`${r}*`);s.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(s),this.subscribe(s)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const oE="$SRV";class k0{constructor(n){C(this,"msg");this.msg=n}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(n,r){return this.msg.respond(n,r)}respondError(n,r,s,l){var u,c;return l=l||{},l.headers=l.headers||Zr(),(u=l.headers)==null||u.set(Cu,`${n}`),(c=l.headers)==null||c.set(ku,r),this.msg.respond(s,l)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Dl{constructor(n,r="",s=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&cE("service group",r);let l="";if(n instanceof $l)this.srv=n,l="";else if(n instanceof Dl){const u=n;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(n,r=""){return r===""?n:n!==""?`${n}.${r}`:r}addEndpoint(n="",r){r=r||{subject:n};const s=typeof r=="function"?{handler:r,subject:n}:r;_l("endpoint",n);let{subject:l,handler:u,metadata:c,queue:f}=s;l=l||n,f=f||this.queue,uE("endpoint subject",l),l=this.calcSubject(this.subject,l);const m={name:n,subject:l,queue:f,handler:u,metadata:c};return this.srv._addEndpoint(m)}addGroup(n="",r=""){return new Dl(this,n,r)}}function uE(e,n){if(n==="")throw new Error(`${e} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);const r=n.split(".");r.forEach((s,l)=>{if(s===">"&&l!==r.length-1)throw new Error(`${e} cannot have internal '>': '${n}'`)})}function cE(e,n){if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);n.split(".").forEach(s=>{if(s===">")throw new Error(`${e} name cannot contain internal '>': '${n}'`)})}class $l{constructor(n,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=n,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),_l("name",this.config.name),_l("queue",this.config.queue),cs(this.config.version),this._id=Di.next(),this.internal=[],this._done=Lt(),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(n,r="",s="",l){const u=l??oE;return r===""&&s===""?`${u}.${n}`:(_l("control subject name",r),s!==""?(_l("control subject id",s),`${u}.${n}.${r}.${s}`):`${u}.${n}.${r}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.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(n){const r=Zr();if(n instanceof Au){const s=n;r.set(ku,s.message),r.set(Cu,`${s.code}`)}else r.set(ku,n.message),r.set(Cu,"500");return r}setupHandler(n,r=!1){const s=r?"":n.queue?n.queue:this.config.queue,{name:l,subject:u,handler:c}=n,f=n;f.internal=r,r&&this.internal.push(f),f.stats=new fE(l,u,s),f.queue=s;const m=c?(d,y)=>{if(d){this.close(d);return}const g=Date.now();try{c(d,new k0(y))}catch(b){f.stats.countError(b),y==null||y.respond(Hn,{headers:this.errorToHeader(b)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(u,{callback:m,queue:s}),f.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(d=>{if(!this._stopped){const y=new Error(`required subscription ${n.subject} errored: ${d.message}`);y.stack=d.stack,this.close(y).catch()}}),f}info(){return{type:Cl.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:r,metadata:s,name:l,queue:u}=n;return{subject:r,metadata:s,name:l,queue_group:u}})}async stats(){const n=[];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)}n.push(r.stats.stats(r.qi))}return{type:Cl.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,r){const s=`${n}`.toUpperCase();this._doAddInternalHandler(`${s}-all`,n,r),this._doAddInternalHandler(`${s}-kind`,n,r,this.name),this._doAddInternalHandler(`${s}`,n,r,this.name,this.id)}_doAddInternalHandler(n,r,s,l="",u=""){const c={};c.name=n,c.subject=$l.controlSubject(r,l,u),c.handler=s,this.setupHandler(c,!0)}start(){const n=hr(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(m=>(f==null||f.respond(n.encode(m)),Promise.resolve())),s=(c,f)=>c?(this.close(c),Promise.reject(c)):(f==null||f.respond(n.encode(this.info())),Promise.resolve()),l=n.encode(this.ping()),u=(c,f)=>c?(this.close(c).then().catch(),Promise.reject(c)):(f.respond(l),Promise.resolve());return this.addInternalHandler(Oi.PING,u),this.addInternalHandler(Oi.STATS,r),this.addInternalHandler(Oi.INFO,s),this.handlers.forEach(c=>{const{subject:f}=c;typeof f=="string"&&c.handler!==null&&this.setupHandler(c)}),Promise.resolve(this)}close(n){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(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Cl.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,r){return new Dl(this,n,r)}addEndpoint(n,r){return new Dl(this).addEndpoint(n,r)}_addEndpoint(n){const r=new tn;r.noIterator=typeof n.handler=="function",r.noIterator||(n.handler=(l,u)=>{l?this.stop(l).catch():r.push(new k0(u))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(n,!1);return s.qi=r,this.handlers.push(s),r}}class fE{constructor(n,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=n,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=s}reset(n){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=n;r&&(r.time=0,r.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=Dt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:r,average_processing_time:s,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue:d}=this;return{name:n,subject:r,average_processing_time:s,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue_group:d}}stats(n){const r=n;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=Dt(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 hE{constructor(n,r={strategy:fr.JitterTimer,maxWait:2e3},s){C(this,"nc");C(this,"prefix");C(this,"opts");this.nc=n,this.prefix=s,this.opts=r}ping(n="",r=""){return this.q(Oi.PING,n,r)}stats(n="",r=""){return this.q(Oi.STATS,n,r)}info(n="",r=""){return this.q(Oi.INFO,n,r)}async q(n,r="",s=""){const l=new tn,u=hr(),c=$l.controlSubject(n,r,s,this.prefix),f=await this.nc.requestMany(c,Hn,this.opts);return(async()=>{for await(const m of f)try{const d=u.decode(m.data);l.push(d)}catch(d){l.push(()=>{l.stop(d)})}l.push(()=>{l.stop()})})().catch(m=>{l.stop(m)}),l}}function yx(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function dE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:yx(),storage:nd.File}}const Du="KV-Operation",C0="$KV",mE=/^[-/=.\w]+$/,pE=/^[-/=.>*\w]+$/,gE=/^[-\w]+$/;function yE(e){if(e.startsWith(".")||e.endsWith(".")||!mE.test(e))throw new Error(`invalid key: ${e}`)}function bE(e){if(e.startsWith(".")||e.endsWith(".")||!pE.test(e))throw new Error(`invalid key: ${e}`)}function xE(e){if(e.startsWith(".")||e.endsWith("."))throw new Error(`invalid key: ${e}`);const n=e.split(".");let r=!1;for(let s=0;s<n.length;s++)switch(n[s]){case"*":r=!0;break;case">":if(s!==n.length-1)throw new Error(`invalid key: ${e}`);r=!0;break}return r}function Su(e){if(!gE.test(e))throw new Error(`invalid bucket name: ${e}`)}var vr;(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"})(vr||(vr={}));class Ll{constructor(n,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",yE);C(this,"validateSearchKey",bE);C(this,"hasWildcards",xE);Su(n),this.js=r,this.jsm=s,this.bucket=n,this.prefix=C0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,r,s={}){Su(r);const l=await n.jetstreamManager(),u=new Ll(r,n,l);return await u.init(s),u}static async bind(n,r,s={}){const l=await n.jetstreamManager(),u={config:{allow_direct:s.allow_direct}};Su(r);const c=new Ll(r,n,l);return u.config.name=s.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=s.codec||yx(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(n={}){const r=Object.assign(dE(),n);this.codec=r.codec;const s={};this.stream=s.name=n.streamName??this.bucketName(),s.retention=td.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=n.placementCluster??"";if(l&&(n.placement={},n.placement.cluster=l,n.placement.tags=[]),n.placement&&(s.placement=n.placement),n.republish&&(s.republish=n.republish),n.description&&(s.description=n.description),n.mirror){const g=Object.assign({},n.mirror);g.name.startsWith(Un)||(g.name=`${Un}${g.name}`),s.mirror=g,s.mirror_direct=!0}else if(n.sources){const g=n.sources.map(b=>{const w=Object.assign({},b),k=w.name.startsWith(Un)?w.name.substring(Un.length):w.name;return w.name.startsWith(Un)||(w.name=`${Un}${w.name}`),!b.external&&k!==this.bucket&&(w.subject_transforms=[{src:`$KV.${k}.>`,dest:`$KV.${this.bucket}.>`}]),w});s.sources=g,s.subjects=[this.subjectForBucket()]}else s.subjects=[this.subjectForBucket()];n.metadata&&(s.metadata=n.metadata),typeof n.compression=="boolean"&&(s.compression=n.compression?Li.S2:Li.None);const u=this.js.nc,c=u.getServerVersion(),f=c?id(c,cs("2.7.2"))>=0:!1;s.discard=f?Ml.New:Ml.Old;const{ok:m,min:d}=u.features.get(ut.JS_ALLOW_DIRECT);if(!m&&n.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 ${d}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:m,s.allow_direct=n.allow_direct,this.direct=s.allow_direct,s.num_replicas=r.replicas,r.ttl&&(s.max_age=Dt(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(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=n.config;if(r){let s=r.name;if(s.startsWith(Un)&&(s=s.substring(Un.length)),r.external&&r.external.api!==""){const l=r.name.substring(Un.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Un}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,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(n),s.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${C0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const r=[];for(const s of n.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.encode(s));break}return r.join(".")}decodeKey(n){const r=[];for(const s of n.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(n,r){const s=r&&r.get(bn.MessageSizeHdr)||"";return s!==""?parseInt(s,10):n.length}smToEntry(n){return new DE(this.bucket,this.prefixLen,n)}jmToEntry(n){const r=this.decodeKey(n.subject.substring(this.prefixLen));return new LE(this.bucket,r,n)}async create(n,r){var u;let s;try{const c=await this.put(n,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(n);return(c==null?void 0:c.operation)==="DEL"||(c==null?void 0:c.operation)==="PURGE"?(l=c!==null?c.revision:0,this.update(n,r,l)):Promise.reject(s)}catch(c){return Promise.reject(c)}}update(n,r,s){if(s<=0)throw new Error("version must be greater than 0");return this.put(n,r,{previousSeq:s})}async put(n,r,s={}){var c,f;const l=this.encodeKey(n);this.validateKey(l);const u={};if(s.previousSeq!==void 0){const m=Zr();u.headers=m,m.set(vr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,u)).seq}catch(m){const d=m;return d.isJetStreamError()?(d.message=(c=d.api_error)==null?void 0:c.description,d.code=`${(f=d.api_error)==null?void 0:f.code}`,Promise.reject(d)):Promise.reject(m)}}async get(n,r){const s=this.encodeKey(n);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(n,r){return this._deleteOrPurge(n,"PURGE",r)}delete(n,r){return this._deleteOrPurge(n,"DEL",r)}async purgeDeletes(n=1800*1e3){const r=Lt(),s=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const m of l)(m.operation==="DEL"||m.operation==="PURGE")&&s.push(m)})().then(),await r,l.stop();const u=Date.now()-n,c=s.map(m=>{const d=this.subjectForKey(m.key);return m.created.getTime()>=u?this.jsm.streams.purge(this.stream,{filter:d,keep:1}):this.jsm.streams.purge(this.stream,{filter:d,keep:0})}),f=await Promise.all(c);return f.unshift({success:!0,purged:0}),f.reduce((m,d)=>(m.purged+=d.purged,m))}async _deleteOrPurge(n,r,s){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,r,s);const l=await this.keys(n),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(n,r,s){const l=this.encodeKey(n);this.validateKey(l);const u=Zr();u.set(Du,r),r==="PURGE"&&u.set(bn.RollupHdr,bn.RollupValueSubject),s!=null&&s.previousSeq&&u.set(vr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),Hn,{headers:u})}_buildCC(n,r,s={}){let u=(Array.isArray(n)?n:[n]).map(m=>{const d=this.encodeKey(m);return this.validateSearchKey(m),this.fullKeyName(d)}),c=$t.LastPerSubject;r===cr.AllHistory&&(c=$t.All),r===cr.UpdatesOnly&&(c=$t.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:en.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:Dt(5*1e3)},s)}remove(n){return this.purge(n)}async history(n={}){const r=n.key??">",s=new tn,l={};l.headers_only=n.headers_only||!1;let u;u=()=>{s.stop()};let c=0;const f=this._buildCC(r,cr.AllHistory,l),m=f.filter_subject,d=Mi(f);d.bindStream(this.stream),d.orderedConsumer(),d.callback((g,b)=>{if(g){s.stop(g);return}if(b){const w=this.jmToEntry(b);s.push(w),s.received++,(u&&c>0&&s.received>=c||b.info.pending===0)&&(s.push(u),u=void 0)}});const y=await this.js.subscribe(m,d);if(u){const{info:{last:g}}=y,b=g.num_pending+g.delivered.consumer_seq;if(b===0||s.received>=b)try{u()}catch(w){s.stop(w)}finally{u=void 0}else c=b}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(ut.JS_NEW_CONSUMER_CREATE_API);return s}async watch(n={}){const r=n.key??">",s=new tn,l={};l.headers_only=n.headers_only||!1;let u=cr.LastValue;n.include===cr.AllHistory?u=cr.AllHistory:n.include===cr.UpdatesOnly&&(u=cr.UpdatesOnly);const c=n.ignoreDeletes===!0;let f=n.initializedFn,m=0;const d=this._buildCC(r,u,l),y=d.filter_subject,g=Mi(d);this.canSetWatcherName()&&g.consumerName(Di.next()),g.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&g.startSequence(n.resumeFromRevision),g.orderedConsumer(),g.callback((w,k)=>{if(w){s.stop(w);return}if(k){const D=this.jmToEntry(k);if(c&&D.operation==="DEL")return;s.push(D),s.received++,f&&(m>0&&s.received>=m||k.info.pending===0)&&(s.push(f),f=void 0)}});const b=await this.js.subscribe(y,g);if(f){const{info:{last:w}}=b,k=w.num_pending+w.delivered.consumer_seq;if(k===0||s.received>=k)try{f()}catch(D){s.stop(D)}finally{f=void 0}else m=k}return s._data=b,s.iterClosed.then(()=>{b.unsubscribe()}),b.closed.then(()=>{s.stop()}).catch(w=>{s.stop(w)}),s}async keys(n=">"){const r=new tn,s=this._buildCC(n,cr.LastValue,{headers_only:!0}),l=Array.isArray(n)?">":s.filter_subject,u=Mi(s);u.bindStream(this.stream),u.orderedConsumer();const c=await this.js.subscribe(l,u);return(async()=>{var m;for await(const d of c){const y=(m=d.headers)==null?void 0:m.get(Du);if(y!=="DEL"&&y!=="PURGE"){const g=this.decodeKey(d.subject.substring(this.prefixLen));r.push(g)}d.info.pending===0&&c.unsubscribe()}})().then(()=>{r.stop()}).catch(m=>{r.stop(m)}),c.info.last.num_pending===0&&c.unsubscribe(),r}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}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 bx(l,r)}}class bx{constructor(n,r=""){C(this,"si");C(this,"cluster");this.si=n,this.cluster=r}get bucket(){return this.si.config.name.startsWith(Un)?this.si.config.name.substring(Un.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 Rd(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 n;return((n=this.si.config.placement)==null?void 0:n.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!==Li.None:!1}}const Ld="OBJ_",A0="SHA-256=";function vE(e){return Su(e),`${Ld}${e}`}function wE(e){return e.startsWith(Ld)?e.substring(4):e}class od{constructor(n){C(this,"si");C(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return wE(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!==Li.None:!1}}function hu(e){if(e===void 0)return;const{domain:n}=e;if(n===void 0)return e;const r=Object.assign({},e);if(delete r.domain,n==="")return r;if(r.external)throw new Error("domain and external are both set");return r.external={api:`$JS.${n}.API`},r}var Wn;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(Wn||(Wn={}));var wr;(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"})(wr||(wr={}));var oa;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(oa||(oa={}));const T0=Uint8Array.of(43,65,67,75),SE=Uint8Array.of(45,78,65,75),gl=Uint8Array.of(43,87,80,73),_E=Uint8Array.of(43,78,88,84),EE=Uint8Array.of(43,84,69,82,77),kE=Uint8Array.of(32);function zl(e,n=5e3){return new IE(e,n)}class Eh extends tn{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=Kr(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(m=>{if(this.cleanupHandler)try{this.cleanupHandler(m)}catch{}});const{sub:f}=this;f&&f.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(m,d)=>{var g,b,w,k;if(m){this.stop(m);return}if((g=this.monitor)==null||g.work(),d.subject===this.inbox){if(ed(d))return;const D=(b=d.headers)==null?void 0:b.code,U=((k=(w=d.headers)==null?void 0:w.description)==null?void 0:k.toLowerCase())||"unknown",{msgsLeft:M,bytesLeft:q}=this.parseDiscard(d.headers);if(M>0||q>0)this.pending.msgs-=M,this.pending.bytes-=q,this.pending.requests--,this.notify(oa.Discard,{msgsLeft:M,bytesLeft:q});else if(D===400){this.stop(new Oe(U,`${D}`));return}else if(D===409&&U==="consumer deleted"){if(this.notify(wr.ConsumerDeleted,`${D} ${U}`),!this.refilling||this.abortOnMissingResource){const H=new Oe(U,`${D}`);this.stop(H);return}}else if(D===503){if(this.notify(wr.NoResponders,`${D} No Responders`),!this.refilling||this.abortOnMissingResource){const H=new Oe("no responders",`${D}`);this.stop(H);return}}else this.notify(oa.DebugEvent,`${D} ${U}`)}else this._push(zl(d,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=d.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 D=this.pullOptions();this.pull(D)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Dd(l,m=>(this.notify(wr.HeartbeatsMissed,m),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var d;const m=this.consumer.api.nc.status();this.statusIterator=m;for await(const y of m)switch(y.type){case Jr.Disconnect:(d=this.monitor)==null||d.cancel();break;case Jr.Reconnect:this.resetPending().then(g=>{var b;g&&((b=this.monitor)==null||b.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=Od([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(wr.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(wr.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),m=ba(f);await Promise.race([m,this.consumer.api.nc.closed()]),m.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(oa.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=Dt(this.opts.idle_heartbeat),u=Dt(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(bn.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(bn.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 tn;return this.listeners.push(r),Promise.resolve(r)}}class CE extends tn{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 tn;return this.listeners.push(r),Promise.resolve(r)}}class ud{constructor(n,r){C(this,"api");C(this,"_info");C(this,"stream");C(this,"name");this.api=n,this._info=r,this.stream=r.stream_name,this.name=r.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new Eh(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const r=new Eh(this,n,!1),s=Math.round(r.opts.expires*1.05),l=fa(s);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(n={expires:3e4}){const r=Lt(),s=n;s.max_messages=1;const l=new Eh(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===wr.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=fa(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:n,name:r}=this._info;return this.api.delete(n,r)}info(n=!1){if(n)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 AE{constructor(n,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=n,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Di.next(),typeof s.name_prefix=="string"&&($u("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=Wn.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(n){this.serial++;const r=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const s={name:r,deliver_policy:$t.StartSequence,opt_start_seq:n,ack_policy:en.None,inactive_threshold:Dt(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),n===this.startSeq+1&&(s.deliver_policy=this.consumerOpts.deliver_policy||$t.StartSequence,(this.consumerOpts.deliver_policy===$t.LastPerSubject||this.consumerOpts.deliver_policy===$t.New||this.consumerOpts.deliver_policy===$t.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===$t.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=$t.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=Dt(this.consumerOpts.inactive_threshold))),s}async resetConsumer(n=0){var c,f,m,d,y;Di.next();const r=this.serial===0;(c=this.consumer)==null||c.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const s=this.getConsumerOpts(n);s.max_deliver=1,s.mem_storage=!0;const l=Od([((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),(m=this.iter)==null||m.notify(wr.OrderedConsumerRecreated,u.name);break}catch(b){if(b.message==="stream not found"&&((d=this.iter)==null||d.notify(wr.StreamNotFound,g),this.type===Wn.Fetch||this.opts.abort_on_missing_resource===!0))return(y=this.iter)==null||y.stop(b),Promise.reject(b);if(r&&g>=this.maxInitialReset)throw b;await ba(l.backoff(g+1))}return u}internalHandler(n){return r=>{var l;if(this.serial!==n)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(n={max_messages:100,expires:3e4},r){var m,d;r=r||{};const s=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===Wn.Fetch&&l){(m=this.iter)==null||m.src.stop(),await((d=this.iter)==null?void 0:d.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 CE),this.consumer=new ud(this.api,this.currentConsumer);const u=n;u.callback=this.internalHandler(this.serial);let c=null;this.type===Wn.Fetch&&s?c=await this.consumer.fetch(n):this.type===Wn.Consume&&(c=await this.consumer.consume(n));const f=c;f.forOrderedConsumer=!0,f.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(f)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(oa.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Wn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Wn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=n;return s&&(this.userCallback=s),this.type=Wn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var l;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Wn.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}=n;return s&&(this.userCallback=s),this.type=Wn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const r=n;if(r.bind)return Promise.reject(new Error("bind is not supported"));r.max_messages=1;const s=Lt();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(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class cd{constructor(n){C(this,"api");C(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(ut.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new ud(this.api,n)}async get(n,r={}){return typeof r=="object"?this.ordered(n,r):(await this.checkVersion(),this.api.info(n,r).then(s=>s.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new ud(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(n,r){await this.checkVersion();const s=this.api;return new zd(s.nc,s.opts).info(n).then(u=>Promise.resolve(new AE(this.api,n,r))).catch(u=>Promise.reject(u))}}class Vu{constructor(n,r){C(this,"api");C(this,"_info");this.api=n,this._info=r}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Vu(this.api,n)}else return this}info(n=!1,r){return n?Promise.resolve(this._info):this.api.info(this.name,r).then(s=>(this._info=s,this._info))}getConsumerFromInfo(n){return new cd(new Nu(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new cd(new Nu(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,r){return this.api.deleteMessage(this.name,n,r)}}class zd extends Fl{constructor(n,r){super(n,r)}checkStreamConfigVersions(n){const r=this.nc;if(n.metadata){const{min:l,ok:u}=r.features.get(ut.JS_STREAM_CONSUMER_METADATA);if(!u)throw new Error(`stream 'metadata' requires server ${l}`)}if(n.first_seq){const{min:l,ok:u}=r.features.get(ut.JS_STREAM_FIRST_SEQ);if(!u)throw new Error(`stream 'first_seq' requires server ${l}`)}if(n.subject_transform){const{min:l,ok:u}=r.features.get(ut.JS_STREAM_SUBJECT_TRANSFORM);if(!u)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(n.compression){const{min:l,ok:u}=r.features.get(ut.JS_STREAM_COMPRESSION);if(!u)throw new Error(`stream 'compression' requires server ${l}`)}if(n.consumer_limits){const{min:l,ok:u}=r.features.get(ut.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:m,ok:d}=r.features.get(ut.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!d)throw new Error(`${l} 'subject_transforms' requires server ${m}`)}}n.sources&&n.sources.forEach(l=>{s("stream sources",l)}),n.mirror&&s("stream mirror",n.mirror)}async add(n={}){var l;this.checkStreamConfigVersions(n),mn(n.name),n.mirror=hu(n.mirror),n.sources=(l=n.sources)==null?void 0:l.map(hu);const s=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(s),s}async delete(n){return mn(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,r={}){var f;if(typeof n=="object"){const m=n;n=m.name,r=m,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),mn(n);const s=await this.info(n),l=Object.assign(s.config,r);l.mirror=hu(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(hu);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,l);return this._fixInfo(c),c}async info(n,r){mn(n);const s=`${this.prefix}.STREAM.INFO.${n}`;let u=await this._request(s,r),{total:c,limit:f}=u,m=u.state.subjects?Object.getOwnPropertyNames(u.state.subjects).length:1;if(c&&c>m){const d=[u],y=r||{};let g=0;for(;c>m;){g++,y.offset=f*g;const w=await this._request(s,y);c=w.total,d.push(w);const k=Object.getOwnPropertyNames(w.state.subjects).length;if(m+=k,k<f)break}let b={};for(let w=0;w<d.length;w++)u=d[w],u.state.subjects&&(b=Object.assign(b,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=b}return this._fixInfo(u),u}list(n=""){const r=n!=null&&n.length?{subject:n}:{},s=u=>{const c=u;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new El(l,s,this,r)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,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 mn(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,r)}async deleteMessage(n,r,s=!0){mn(n);const l={seq:r};return s||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,l)).success}async getMessage(n,r){mn(n);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,r);return new xx(l)}find(n){return this.findStream(n)}listKvs(){const n=s=>{var m;const u=s.streams.filter(d=>d.config.name.startsWith(Un));u.forEach(d=>{this._fixInfo(d)});let c="";return u.length&&(c=((m=this.nc.info)==null?void 0:m.cluster)??""),u.map(d=>new bx(d,c))},r=`${this.prefix}.STREAM.LIST`;return new El(r,n,this)}listObjectStores(){const n=s=>{const u=s.streams.filter(f=>f.config.name.startsWith(Ld));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new od(f))},r=`${this.prefix}.STREAM.LIST`;return new El(r,n,this)}names(n=""){const r=n!=null&&n.length?{subject:n}:{},s=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new El(l,s,this,r)}async get(n){const r=await this.info(n);return Promise.resolve(new Vu(this,r))}}class TE extends Fl{constructor(n,r){super(n,r)}async getMessage(n,r){mn(n);let s=r;const{last_by_subj:l}=s;l&&(s=null);const u=s?this.jc.encode(s):Hn,c=this.opts.apiPrefix||"$JS.API",f=l?`${c}.DIRECT.GET.${n}.${l}`:`${c}.DIRECT.GET.${n}`,m=await this.nc.request(f,u,{timeout:this.timeout}),d=aa(m);if(d)return Promise.reject(d);const y=new fd(m);return Promise.resolve(y)}async getBatch(n,r){mn(n);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(r.multi_last)||r.multi_last.length===0)return Promise.reject("multi_last is required");const u=JSON.stringify(r,(m,d)=>m==="up_to_time"&&d instanceof Date?d.toISOString():d),c=new tn,f=await this.nc.requestMany(l,u,{strategy:fr.SentinelMsg});return(async()=>{var g,b,w;let m=!1,d=!1,y;for await(const k of f){if(!m){m=!0;const D=((g=k.headers)==null?void 0:g.code)||0;if(D!==0&&D<200||D>299){y=(b=k.headers)==null?void 0:b.description.toLowerCase();break}if(((w=k.headers)==null?void 0:w.get("Nats-Num-Pending"))===""){d=!0;break}}if(k.data.length===0)break;c.push(new fd(k))}c.push(()=>{if(d)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 fd{constructor(n){C(this,"data");C(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(na.Subject)}get seq(){const n=this.header.last(na.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(na.TimeStamp)}get stream(){return this.header.last(na.Stream)}json(n){return hr(n).decode(this.data)}string(){return Bn.decode(this.data)}}C(fd,"jc");class jE extends Fl{constructor(r,s){super(r,s);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new zd(r,s),this.consumers=new Nu(r,s),this.direct=new TE(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new tn;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 xx{constructor(n){C(this,"_header");C(this,"smr");this.smr=n}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):Hn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Ri.decode(n)}else this._header=Zr();return this._header}_parse(n){const r=atob(n),s=r.length,l=new Uint8Array(s);for(let u=0;u<s;u++)l[u]=r.charCodeAt(u);return l}json(n){return hr(n).decode(this.data)}string(){return Bn.decode(this.data)}}C(xx,"jc");class NE{constructor(n){C(this,"api");this.api=n}get(n){return this.api.info(n).then(r=>new Vu(this.api,r))}}class kh{constructor(n){C(this,"info");C(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Ri.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 n,r;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((r=this.info.options)==null?void 0:r.link)!==null}}function j0(e){const n={name:e.name,description:e.description??"",options:e.options,metadata:e.metadata};if(e.headers){const r=e.headers;n.headers=r.toRecord()}return n}function OE(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Tl{constructor(n,r,s){C(this,"jsm");C(this,"js");C(this,"stream");C(this,"name");this.name=n,this.jsm=r,this.js=s}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const r=await this.rawInfo(n);return r?new kh(r):null}async list(){const n=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const s of r){if(s===null)break;n.push(s)}return Promise.resolve(n)}async rawInfo(n){const{name:r,error:s}=this._checkNotEmpty(n);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=hr().decode(u.data);return f.revision=u.seq,f}catch(u){return u.code==="404"?null:Promise.reject(u)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(r){return r.code==="404"?null:Promise.reject(r)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new od(n)))}async status(n){const r=await this._si(n);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new od(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,r,s){var ae;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,m=(f==null?void 0:f.max_payload)||1024;n=n||{},n.options=n.options||{};let d=((ae=n.options)==null?void 0:ae.max_chunk_size)||128*1024;d=d>m?m:d,n.options.max_chunk_size=d;const y=await this.info(n.name),{name:g,error:b}=this._checkNotEmpty(n.name);if(b)return Promise.reject(b);const w=Di.next(),k=this._chunkSubject(w),D=this._metaSubject(g),U=Object.assign({bucket:this.name,nuid:w,size:0,chunks:0},j0(n)),M=Lt(),q=[],H=new da;try{const B=r?r.getReader():null,z=b0.create();for(;;){const{done:V,value:Y}=B?await B.read():{done:!0,value:void 0};if(V){if(H.size()>0){const Z=H.drain();z.update(Z),U.chunks++,U.size+=Z.length,q.push(this.js.publish(k,Z,{timeout:u}))}await Promise.all(q),q.length=0,U.mtime=new Date().toISOString();const $=la.encode(z.digest());U.digest=`${A0}${$}`,U.deleted=!1;const O=Zr();typeof c=="number"&&O.set(vr.ExpectedLastSubjectSequenceHdr,`${c}`),O.set(bn.RollupHdr,bn.RollupValueSubject);const W=await this.js.publish(D,hr().encode(U),{headers:O,timeout:u});if(U.revision=W.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}M.resolve(new kh(U));break}if(Y)for(H.fill(Y);H.size()>d;){U.chunks++,U.size+=d;const $=H.drain(n.options.max_chunk_size);z.update($),q.push(this.js.publish(k,$,{timeout:u}))}}}catch(B){await this.jsm.streams.purge(this.stream,{filter:k}),M.reject(B)}return M}putBlob(n,r,s){function l(u){return new ReadableStream({pull(c){c.enqueue(u),c.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(n,l(r),s)}put(n,r,s){var l;return(l=n==null?void 0:n.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,r,s)}async getBlob(n){async function r(u){const c=new da,f=u.getReader();for(;;){const{done:m,value:d}=await f.read();if(m)return c.drain();d&&d.length&&c.fill(d)}}const s=await this.get(n);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(n){const r=await this.rawInfo(n);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 Tl.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(A0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=rd(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Lt(),u={info:new kh(r),error:l};if(r.size===0)return u.data=OE(),l.resolve(null),Promise.resolve(u);let c;const f=Mi();f.orderedConsumer();const m=b0.create(),d=`$O.${this.name}.C.${r.nuid}`,y=await this.js.subscribe(d,f);return(async()=>{for await(const g of y)g.data.length>0&&(m.update(g.data),c.enqueue(g.data)),g.info.pending===0&&(l2(s,m.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(n,r){if(!(r instanceof Tl))return Promise.reject("bucket required");const s=r,{name:l,error:u}=this._checkNotEmpty(n);if(u)return Promise.reject(u);const c={name:l,options:{link:{bucket:s.name}}};return this._put(c,null)}async link(n,r){const{name:s,error:l}=this._checkNotEmpty(n);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(n);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(n),JSON.stringify(f));const m=await this.info(n);return Promise.resolve(m)}async delete(n){const r=await this.rawInfo(n);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const s=hr(),l=Zr();return l.set(bn.RollupHdr,bn.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),s.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(n,r={}){const s=await this.rawInfo(n);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(n!==r.name){const m=await this.info(r.name);if(m&&!m.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const c=Object.assign({},s,j0(r)),f=await this.js.publish(this._metaSubject(c.name),JSON.stringify(c));return n!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(f)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let r=!1;const s=new tn,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(m){m.code==="404"?(s.push(null),r=!0):s.stop(m)}const u=hr(),c=Mi();c.orderedConsumer(),n.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((m,d)=>{var y;if(m){s.stop(m);return}if(d!==null){const g=u.decode(d.data);g.deleted&&n.ignoreDeletes===!0||s.push(g),((y=d.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(m=>{s.stop(m)}),s}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${la.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=vE(this.name)}catch(l){return Promise.reject(l)}const r=(n==null?void 0:n.ttl)||0;delete n.ttl;const s=Object.assign({max_age:r},n);s.name=this.stream,s.num_replicas=n.replicas??1,s.allow_direct=!0,s.allow_rollup_hdrs=!0,s.discard=Ml.New,s.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(s.placement=n.placement),n.metadata&&(s.metadata=n.metadata),typeof n.compression=="boolean"&&(s.compression=n.compression?Li.S2:Li.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(n,r,s={}){const l=await n.jetstreamManager(),u=new Tl(r,l,n);return await u.init(s),Promise.resolve(u)}}class RE{constructor(n){C(this,"js");this.js=n}kv(n,r={}){const s=this.js,{ok:l,min:u}=s.nc.features.get(ut.JS_KV);return l?r.bindOnly?Ll.bind(this.js,n,r):Ll.create(this.js,n,r):Promise.reject(new Error(`kv is only supported on servers ${u} or better`))}os(n,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(ut.JS_OBJECTSTORE);return l?Tl.create(this.js,n,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class Ud extends Fl{constructor(r,s){super(r,s);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new Nu(r,s),this.streamAPI=new zd(r,s),this.consumers=new cd(this.consumerAPI),this.streams=new NE(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 RE(this)}async publish(r,s=Hn,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||Zr();l&&(l.msgID&&u.set(vr.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(vr.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(vr.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(vr.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(vr.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=u);let{retries:m,retry_delay:d}=l;m=m||1,d=d||250;let y;for(let b=0;b<m;b++)try{y=await this.nc.request(r,s,f);break}catch(w){if(w.code==="503"&&b+1<m)await ba(d);else throw w}const g=this.parseJsResponse(y);if(g.stream==="")throw Oe.errorForCode(Ee.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){mn(r),sa(s);let u=this.timeout;l>u&&(u=l),l=l<0?0:Dt(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}),m=aa(f);if(m)throw m;return zl(f,this.timeout)}fetch(r,s,l={}){mn(r),sa(s);let u=null;const c=(l.max_bytes??0)>0;let f=0;const m=c?l.max_bytes:0;let d=null;const y={};if(y.batch=l.batch||1,m){const q=this.nc.features.get(ut.JS_PULL_MAX_BYTES);if(!q.ok)throw new Error(`max_bytes is only supported on servers ${q.min} or better`);y.max_bytes=m}y.no_wait=l.no_wait||!1,y.no_wait&&y.expires&&(y.expires=0);const g=l.expires||0;if(g&&(y.expires=Dt(g)),g===0&&y.no_wait===!1)throw new Error("expires or no_wait is required");const b=l.idle_heartbeat||0;b&&(y.idle_heartbeat=Dt(b),l.delay_heartbeat===!0&&(y.idle_heartbeat=Dt(b*4)));const w=new tn,k=y.batch;let D=0;w.protocolFilterFn=(q,H=!1)=>ed(q.msg)?(d==null||d.work(),!1):!0,w.dispatchedFn=q=>{if(q){if(c&&(f+=q.data.length),D++,u&&q.info.pending===0)return;(w.getPending()===1&&q.info.pending===0||k===D||m>0&&f>=m)&&w.stop()}};const U=Kr(this.nc.options.inboxPrefix),M=this.nc.subscribe(U,{max:l.batch,callback:(q,H)=>{q===null&&(q=aa(H)),q!==null?(u&&(u.cancel(),u=null),I_(q)?w.stop(wx(q)===null?void 0:q):w.stop(q)):(d==null||d.work(),w.received++,w.push(zl(H,this.timeout)))}});return g&&(u=fa(g),u.catch(()=>{M.isClosed()||(M.drain().catch(()=>{}),u=null),d&&d.cancel()})),(async()=>{try{b&&(d=new Dd(b,q=>(w.push(()=>{w.err=new Oe(`${er.IdleHeartbeatMissed}: ${q}`,Ee.JetStreamIdleHeartBeat)}),!0)))}catch{}await M.closed,u!==null&&(u.cancel(),u=null),d&&d.cancel(),w.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(y),{reply:U}),w}async pullSubscribe(r,s=Mi()){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===en.None||u===en.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new zE(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(m){throw f.unsubscribe(),m}return f}async subscribe(r,s=Mi()){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 vx(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=Mi()){const l=m0(s)?s.getOpts():s;if(l.isBind=m0(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!==en.NotSet&&l.config.ack_policy!==en.None)throw new Oe("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 Oe("ordered consumer: durable_name cannot be set",Ee.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new Oe("ordered consumer: deliver_subject cannot be set",Ee.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new Oe("ordered consumer: max_deliver cannot be set",Ee.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new Oe("ordered consumer: deliver_group cannot be set",Ee.ApiError);l.config.deliver_subject=Kr(this.nc.options.inboxPrefix),l.config.ack_policy=en.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||Dt(5e3),l.config.ack_wait=Dt(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===en.NotSet&&(l.config.ack_policy=en.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||Kr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=UE(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Ud.ingestionFn(r.ordered),s.protocolFilterFn=(l,u=!1)=>{const c=l;return Wh(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==en.None&&(s.dispatchedFn=qE),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:$t.All,ack_policy:en.Explicit,ack_wait:Dt(30*1e3),replay_policy:ha.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 m;const u=l;if(!s)return{ingest:!1,protocol:!1};const c=s;if(aa(c.msg)||(m=u.monitor)==null||m.work(),ed(c.msg)){const d=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:d,protocol:!0}}else if(Wh(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(s):!0,protocol:!1}}}}class Bd{constructor(n){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=tE(n),this.listeners=[]}static connect(n={}){return new Promise((r,s)=>{const l=new Bd(n);Mu.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(n,r,s){if(this.isClosed())throw Oe.errorForCode(Ee.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw Oe.errorForCode(Ee.ConnectionDraining);if(n=n||"",n.length===0)throw Oe.errorForCode(Ee.BadSubject)}publish(n,r,s){this._check(n,!1,!0),this.protocol.publish(n,r,s)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,r={}){this._check(n,!0,!1);const s=new gx(this.protocol,n,r);return this.protocol.subscribe(s),s}_resub(n,r,s){this._check(r,!0,!1);const l=n;l.max=s,s&&(l.max=s+l.received),this.protocol.resub(l,r)}requestMany(n,r=Hn,s={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(m){return Promise.reject(m)}if(s.strategy=s.strategy||fr.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new Oe("timeout",Ee.InvalidOption));const u=new tn;function c(m){u.push(()=>{u.stop(m)})}function f(m,d){m||d===null?c(m===null?void 0:m):u.push(d)}if(s.noMux){const m=l?new Error().stack:null;let d=typeof s.maxMessages=="number"&&s.maxMessages>0?s.maxMessages:-1;const y=this.subscribe(Kr(this.options.inboxPrefix),{callback:(k,D)=>{var U,M;if(((U=D==null?void 0:D.data)==null?void 0:U.length)===0&&((M=D==null?void 0:D.headers)==null?void 0:M.status)===Ee.NoResponders&&(k=Oe.errorForCode(Ee.NoResponders)),k){m&&(k.stack+=`
|
|
82
|
-
|
|
83
|
-
${m}`),g(k);return}f(null,D),s.strategy===fr.Count&&(d--,d===0&&g()),s.strategy===fr.JitterTimer&&(w(),b=setTimeout(()=>{g()},300)),s.strategy===fr.SentinelMsg&&D&&D.data.length===0&&g()}});y.requestSubject=n,y.closed.then(()=>{c()}).catch(k=>{u.stop(k)});const g=k=>{k&&u.push(()=>{throw k}),w(),y.drain().then(()=>{c()}).catch(D=>{c()})};u.iterClosed.then(()=>{w(),y==null||y.unsubscribe()}).catch(k=>{w(),y==null||y.unsubscribe()});try{this.publish(n,r,{reply:y.getSubject()})}catch(k){g(k)}let b=setTimeout(()=>{g()},s.maxWait);const w=()=>{b&&clearTimeout(b)}}else{const m=s;m.callback=f,u.iterClosed.then(()=>{d.cancel()}).catch(y=>{d.cancel(y)});const d=new o2(this.protocol.muxSubscriptions,n,m);this.protocol.request(d);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${d.token}`,headers:s.headers})}catch(y){d.cancel(y)}}return Promise.resolve(u)}request(n,r,s={timeout:1e3,noMux:!1}){try{this._check(n,!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 Oe("timeout",Ee.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new Oe("reply can only be used with noMux",Ee.InvalidOption));if(s.noMux){const u=s.reply?s.reply:Kr(this.options.inboxPrefix),c=Lt(),f=l?new Error:null,m=this.subscribe(u,{max:1,timeout:s.timeout,callback:(d,y)=>{d?(f&&d.code!==Ee.Timeout&&(d.stack+=`
|
|
84
|
-
|
|
85
|
-
${f.stack}`),m.unsubscribe(),c.reject(d)):(d=ix(y),d?(f&&(d.stack+=`
|
|
86
|
-
|
|
87
|
-
${f.stack}`),c.reject(d)):c.resolve(y))}});return m.requestSubject=n,this.protocol.publish(n,r,{reply:u,headers:s.headers}),c}else{const u=new lx(this.protocol.muxSubscriptions,n,s,l);this.protocol.request(u);try{this.publish(n,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(Oe.errorForCode(Ee.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Oe.errorForCode(Ee.ConnectionClosed)):this.isDraining()?Promise.reject(Oe.errorForCode(Ee.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new tn;return n.iterClosed.then(()=>{const r=this.listeners.indexOf(n);this.listeners.splice(r,1)}),this.listeners.push(n),n}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(n={}){const r=new jE(this,n);if(n.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===Ee.NoResponders&&(l.code=Ee.JetStreamNotEnabled),l}return r}jetstream(n={}){return new Ud(this,n)}getServerVersion(){const n=this.info;return n?cs(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Oe.errorForCode(Ee.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new ME(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Oe.errorForCode(Ee.ConnectionClosed)):this.isDraining()?Promise.reject(Oe.errorForCode(Ee.ConnectionDraining)):this.protocol.reconnect()}}class ME{constructor(n){C(this,"nc");this.nc=n}add(n){try{return new $l(this.nc,n).start()}catch(r){return Promise.reject(r)}}client(n,r){return new hE(this.nc,n,r)}}class DE{constructor(n,r,s){C(this,"bucket");C(this,"sm");C(this,"prefixLen");this.bucket=n,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(Du)||"PUT"}get length(){const n=this.sm.header.get(bn.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class LE{constructor(n,r,s){C(this,"bucket");C(this,"key");C(this,"sm");this.bucket=n,this.key=r,this.sm=s}get value(){return this.sm.data}get created(){return new Date(Rd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Du))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const n=((r=this.sm.headers)==null?void 0:r.get(bn.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class vx extends h2{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=Kr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const u=this.info;u.config.name=Di.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=$t.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(m=>{const d=m,y=this.sub.info;y.last=d,this.info.config=d.config,this.info.name=d.name}).catch(m=>{const d=new Oe(`unable to recreate ordered consumer ${u.stream} at seq ${r}`,Ee.RequestError,m);this.sub.callback(d,{})})}_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(Rd(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const u=this.sub,c=f=>{var y,g,b,w;const m=G_(409,`${er.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((y=this.info)==null?void 0:y.ordered))this.sub.callback(null,m);else{if(!this.js.nc.protocol.connected)return!1;const k=((b=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:b.stream_seq)||0;return this._resetOrderedConsumer(k+1),(w=this.monitor)==null||w.restart(),!1}return!u.noIterator};this.monitor=new Dd(r,c,l)}_checkHbOrderConsumer(r){const s=r.headers.get(bn.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(bn.LastConsumerSeqHdr),10),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 zE extends vx{constructor(n,r,s){super(n,r,s)}pull(n={batch:1}){const{stream:r,config:s,name:l}=this.sub.info,u=s.durable_name??l,c={};if(c.batch=n.batch||1,c.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const d=this.js.nc.features.get(ut.JS_PULL_MAX_BYTES);if(!d.ok)throw new Error(`max_bytes is only supported on servers ${d.min} or better`);c.max_bytes=n.max_bytes}let f=0;n.expires&&n.expires>0&&(f=n.expires,c.expires=Dt(f));let m=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(m=n.idle_heartbeat,c.idle_heartbeat=Dt(m)),m&&f===0)throw new Error("idle_heartbeat requires expires");if(m>f)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),f&&m&&(this.monitor?this.monitor._change(m,f):this._setupHbMonitoring(m,f));const d=this.info.api,y=`${d.prefix}.CONSUMER.MSG.NEXT.${r}.${u}`,g=this.sub.subject;d.nc.publish(y,d.jc.encode(c),{reply:g})}}}function UE(e,n){return e?PE(n):BE(n)}function BE(e){return(n,r)=>n?[n,null]:(n=aa(r),n?[n,null]:[null,zl(r,e)])}function PE(e){return(n,r)=>{if(n)return[n,null];const s=aa(r);return s!==null?[wx(s),null]:[null,zl(r,e)]}}function wx(e){if(e!==null)switch(e.code){case Ee.JetStream404NoMessages:case Ee.JetStream408RequestTimeout:return null;case Ee.JetStream409:return V_(e)?e:null;default:return e}return null}function qE(e){e&&e.ack()}function HE(e){const n=e.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const r={};return r.domain=n[2]==="_"?"":n[2],r.account_hash=n[3],r.stream=n[4],r.consumer=n[5],r.deliveryCount=parseInt(n[6],10),r.redeliveryCount=r.deliveryCount,r.redelivered=r.deliveryCount>1,r.streamSequence=parseInt(n[7],10),r.deliverySequence=parseInt(n[8],10),r.timestampNanos=parseInt(n[9],10),r.pending=parseInt(n[10],10),r}class IE{constructor(n,r){C(this,"msg");C(this,"di");C(this,"didAck");C(this,"timeout");this.msg=n,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=HE(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===gl[0]&&n[1]===gl[1]&&n[2]===gl[2]&&n[3]===gl[3]}async ackAck(n){var s;n=n||{},n.timeout=n.timeout||this.timeout;const r=Lt();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 lx(u.muxSubscriptions,this.msg.reply,{timeout:n.timeout},c);u.request(f);try{u.publish(this.msg.reply,T0,{reply:`${u.muxSubscriptions.baseInbox}${f.token}`})}catch(m){f.cancel(m)}try{await Promise.race([f.timer,f.deferred]),r.resolve(!0)}catch(m){f.cancel(m),r.reject(m)}}else r.resolve(!1);return r}ack(){this.doAck(T0)}nak(n){let r=SE;n&&(r=Tu().encode(`-NAK ${JSON.stringify({delay:Dt(n)})}`)),this.doAck(r)}working(){this.doAck(gl)}next(n,r={batch:1}){const s={};s.batch=r.batch||1,s.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(s.expires=Dt(r.expires));const l=hr().encode(s),u=da.concat(_E,kE,l),c=n?{reply:n}:void 0;this.msg.respond(u,c)}term(n=""){let r=EE;(n==null?void 0:n.length)>0&&(r=Tu().encode(`+TERM ${n}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const FE="1.30.3",$E="nats.ws";class YE{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=FE,this.lang=$E,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Lt(),this.closedNotification=Lt()}async connect(n,r){const s=Lt();if(r.tls)return s.reject(new Oe("tls",Ee.InvalidOption)),s;this.options=r;const l=n.src;if(r.wsFactory){const{socket:u,encrypted:c}=await r.wsFactory(n.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=da.concat(...this.yields),f=b2(c);if(f!==""){const m=iE.exec(f);if(!m){r.debug&&console.error("!!!",uu(c)),s.reject(new Error("unexpected response from server"));return}try{const d=JSON.parse(m[1]);nE(d,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(d){s.reject(d);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 Oe(c.message,Ee.Unknown,new Error(c.error));s.reject(f)},s}disconnect(){this._closed(void 0,!0)}async _closed(n,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ba(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}r&&this.closedNotification.resolve(n)}}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 n=this.yields;this.yields=[];for(let r=0;r<n.length;r++)this.options.debug&&console.info(`> ${uu(n[r])}`),yield n[r];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=Lt())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${uu(n)}`);return}catch(r){this.options.debug&&console.error(`!!! ${uu(n)}: ${r}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function GE(e,n){/^(.*:\/\/)(.*)/.test(e)||(typeof n=="boolean"?e=`${n===!0?"https":"http"}://${e}`:e=`https://${e}`);let s=new URL(e);const l=s.protocol.toLowerCase();l==="ws:"&&(n=!1),l==="wss:"&&(n=!0),l!=="https:"&&l!=="http"&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2"),s=new URL(`http://${e}`));let u,c;const f=s.hostname,m=s.pathname,d=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||n===!0?"443":"80",u=n===!0?"wss:":"ws:";break}return`${u}//${f}:${c}${m}${d}`}function Sx(e={}){return d2({defaultPort:443,urlParseFn:GE,factory:()=>new YE}),Bd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var ma;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(ma||(ma={}));class Ch extends Error{constructor(n,r,s){super(n),this.message=n,this.code=r,this.data=s}}const VE=e=>{var n,r;return e!=null&&e.androidBridge?"android":!((r=(n=e==null?void 0:e.webkit)===null||n===void 0?void 0:n.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},JE=e=>{const n=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>n!==null?n.name:VE(e),u=()=>l()!=="web",c=g=>{const b=d.get(g);return!!(b!=null&&b.platforms.has(l())||f(g))},f=g=>{var b;return(b=r.PluginHeaders)===null||b===void 0?void 0:b.find(w=>w.name===g)},m=g=>e.console.error(g),d=new Map,y=(g,b={})=>{const w=d.get(g);if(w)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),w.proxy;const k=l(),D=f(g);let U;const M=async()=>(!U&&k in b?U=typeof b[k]=="function"?U=await b[k]():U=b[k]:n!==null&&!U&&"web"in b&&(U=typeof b.web=="function"?U=await b.web():U=b.web),U),q=(Y,$)=>{var O,W;if(D){const Z=D==null?void 0:D.methods.find(fe=>$===fe.name);if(Z)return Z.rtype==="promise"?fe=>r.nativePromise(g,$.toString(),fe):(fe,J)=>r.nativeCallback(g,$.toString(),fe,J);if(Y)return(O=Y[$])===null||O===void 0?void 0:O.bind(Y)}else{if(Y)return(W=Y[$])===null||W===void 0?void 0:W.bind(Y);throw new Ch(`"${g}" plugin is not implemented on ${k}`,ma.Unimplemented)}},H=Y=>{let $;const O=(...W)=>{const Z=M().then(fe=>{const J=q(fe,Y);if(J){const Q=J(...W);return $=Q==null?void 0:Q.remove,Q}else throw new Ch(`"${g}.${Y}()" is not implemented on ${k}`,ma.Unimplemented)});return Y==="addListener"&&(Z.remove=async()=>$()),Z};return O.toString=()=>`${Y.toString()}() { [capacitor code] }`,Object.defineProperty(O,"name",{value:Y,writable:!1,configurable:!1}),O},ae=H("addListener"),B=H("removeListener"),z=(Y,$)=>{const O=ae({eventName:Y},$),W=async()=>{const fe=await O;B({eventName:Y,callbackId:fe},$)},Z=new Promise(fe=>O.then(()=>fe({remove:W})));return Z.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await W()},Z},V=new Proxy({},{get(Y,$){switch($){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return D?z:ae;case"removeListener":return B;default:return H($)}}});return s[g]=V,d.set(g,{name:g,proxy:V,platforms:new Set([...Object.keys(b),...D?[k]:[]])}),V};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=m,r.isNativePlatform=u,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=Ch,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},XE=e=>e.Capacitor=JE(e),Er=XE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),xa=Er.registerPlugin;class Pd{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(n,r){let s=!1;this.listeners[n]||(this.listeners[n]=[],s=!0),this.listeners[n].push(r);const u=this.windowListeners[n];u&&!u.registered&&this.addWindowListener(u),s&&this.sendRetainedArgumentsForEvent(n);const c=async()=>this.removeListener(n,r);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const n in this.windowListeners)this.removeWindowListener(this.windowListeners[n]);this.windowListeners={}}notifyListeners(n,r,s){const l=this.listeners[n];if(!l){if(s){let u=this.retainedEventArguments[n];u||(u=[]),u.push(r),this.retainedEventArguments[n]=u}return}l.forEach(u=>u(r))}hasListeners(n){var r;return!!(!((r=this.listeners[n])===null||r===void 0)&&r.length)}registerWindowListener(n,r){this.windowListeners[r]={registered:!1,windowEventName:n,pluginEventName:r,handler:s=>{this.notifyListeners(r,s)}}}unimplemented(n="not implemented"){return new Er.Exception(n,ma.Unimplemented)}unavailable(n="not available"){return new Er.Exception(n,ma.Unavailable)}async removeListener(n,r){const s=this.listeners[n];if(!s)return;const l=s.indexOf(r);this.listeners[n].splice(l,1),this.listeners[n].length||this.removeWindowListener(this.windowListeners[n])}addWindowListener(n){window.addEventListener(n.windowEventName,n.handler),n.registered=!0}removeWindowListener(n){n&&(window.removeEventListener(n.windowEventName,n.handler),n.registered=!1)}sendRetainedArgumentsForEvent(n){const r=this.retainedEventArguments[n];r&&(delete this.retainedEventArguments[n],r.forEach(s=>{this.notifyListeners(n,s)}))}}const N0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),O0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class KE extends Pd{async getCookies(){const n=document.cookie,r={};return n.split(";").forEach(s=>{if(s.length<=0)return;let[l,u]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=O0(l).trim(),u=O0(u).trim(),r[l]=u}),r}async setCookie(n){try{const r=N0(n.key),s=N0(n.value),l=n.expires?`; expires=${n.expires.replace("expires=","")}`:"",u=(n.path||"/").replace("path=",""),c=n.url!=null&&n.url.length>0?`domain=${n.url}`:"";document.cookie=`${r}=${s||""}${l}; path=${u}; ${c};`}catch(r){return Promise.reject(r)}}async deleteCookie(n){try{document.cookie=`${n.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const n=document.cookie.split(";")||[];for(const r of n)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(n){return Promise.reject(n)}}async clearAllCookies(){try{await this.clearCookies()}catch(n){return Promise.reject(n)}}}xa("CapacitorCookies",{web:()=>new KE});const QE=async e=>new Promise((n,r)=>{const s=new FileReader;s.onload=()=>{const l=s.result;n(l.indexOf(",")>=0?l.split(",")[1]:l)},s.onerror=l=>r(l),s.readAsDataURL(e)}),ZE=(e={})=>{const n=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[n[c]],l),{})},WE=(e,n=!0)=>e?Object.entries(e).reduce((s,l)=>{const[u,c]=l;let f,m;return Array.isArray(c)?(m="",c.forEach(d=>{f=n?encodeURIComponent(d):d,m+=`${u}=${f}&`}),m.slice(0,-1)):(f=n?encodeURIComponent(c):c,m=`${u}=${f}`),`${s}&${m}`},"").substr(1):null,ek=(e,n={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},n),l=ZE(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,m)=>{u.append(m,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 tk extends Pd{async request(n){const r=ek(n,n.webFetchExtra),s=WE(n.params,n.shouldEncodeUrlParams),l=s?`${n.url}?${s}`:n.url,u=await fetch(l,r),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?n:{};c.includes("application/json")&&(f="json");let m,d;switch(f){case"arraybuffer":case"blob":d=await u.blob(),m=await QE(d);break;case"json":m=await u.json();break;case"document":case"text":default:m=await u.text()}const y={};return u.headers.forEach((g,b)=>{y[b]=g}),{data:m,headers:y,status:u.status,url:u.url}}async get(n){return this.request(Object.assign(Object.assign({},n),{method:"GET"}))}async post(n){return this.request(Object.assign(Object.assign({},n),{method:"POST"}))}async put(n){return this.request(Object.assign(Object.assign({},n),{method:"PUT"}))}async patch(n){return this.request(Object.assign(Object.assign({},n),{method:"PATCH"}))}async delete(n){return this.request(Object.assign(Object.assign({},n),{method:"DELETE"}))}}xa("CapacitorHttp",{web:()=>new tk});var R0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(R0||(R0={}));var M0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(M0||(M0={}));class nk extends Pd{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")}}xa("SystemBars",{web:()=>new nk});const Lu=Er.isNativePlatform()?"https://app.palmier.me":"";async function _x(e,n,r,s){const l=`${Lu}${n}`;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 m;try{const d=JSON.parse(f);m=d.error??d.message??f}catch{m=f}throw console.error(`[API] ${e} ${n} failed:`,c.status,m),new Error(m||`Request failed with status ${c.status}`)}return console.log(`[API] ${e} ${n} ->`,c.status),c.json()}function rk(e,n,r){return _x("POST",e,n)}function ik(e,n){return _x("GET",e,void 0)}const Ex=N.createContext({connected:!1,mode:"disconnected",nc:null,request(){return Promise.reject(new Error("No host connection"))},subscribeEvents(){return()=>{}},activeHost:null,unauthorized:!1}),sk=2e3,Ah=6e3;function ak({children:e}){const{getActiveHost:n}=Il(),r=n(),[s,l]=N.useState(null),[u,c]=N.useState(!1),f=N.useRef(null),[m,d]=N.useState(!1),[y,g]=N.useState(!1),b=N.useRef(Tu()),w=N.useRef(new Set),k=N.useRef(0),D=r!=null&&!!r.directUrl,U=r?D?m?"direct":"disconnected":u?"nats":"disconnected":"disconnected",M=U!=="disconnected";N.useEffect(()=>{g(!1)},[r==null?void 0:r.hostId,r==null?void 0:r.clientToken]),N.useEffect(()=>{if(D){f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1));return}if(!r)return;let ae=!1;async function B(){try{const z=await fetch(`${Lu}/api/nats-credentials/${r.hostId}`);if(!z.ok){console.error("[NATS] Failed to fetch credentials");return}const V=await z.json();if(!V.natsWsUrl){console.warn("[NATS] No WebSocket URL configured");return}if(ae)return;console.log("[NATS] Connecting to",V.natsWsUrl);const Y=await Sx({servers:V.natsWsUrl,authenticator:dx(V.natsJwt,new TextEncoder().encode(V.natsNkeySeed))});if(ae){Y.close().catch(()=>{});return}console.log("[NATS] Connected"),f.current=Y,l(Y),c(!0),Y.closed().then(()=>{console.log("[NATS] Connection closed"),ae||(l(null),c(!1),f.current=null)})}catch(z){console.error("[NATS] Connection failed:",z),ae||c(!1)}}return B(),()=>{ae=!0,f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1))}},[D,r]),N.useEffect(()=>{if(!r||!D){d(!1);return}const ae=new AbortController;async function B(){var $;const V=new AbortController,Y=setTimeout(()=>V.abort(),sk);ae.signal.addEventListener("abort",()=>V.abort());try{const O=await fetch(`${r.directUrl}/events`,{headers:{Authorization:`Bearer ${r.clientToken}`},signal:V.signal});return clearTimeout(Y),O.ok?(($=O.body)==null?void 0:$.getReader())??null:null}catch{return clearTimeout(Y),null}}async function z(V){d(!0),console.log("[HOST] SSE connected to",r.directUrl),k.current=Date.now();function Y(){setTimeout(()=>{ae.signal.aborted||Date.now()-k.current<Ah||(console.log("[HOST] Heartbeat timeout — no data for",Ah/1e3,"s"),ae.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},Ah)}Y();const $=new TextDecoder;let O="";try{for(;;){const{done:W,value:Z}=await V.read();if(W)break;O+=$.decode(Z,{stream:!0}),k.current=Date.now(),Y();const fe=O.split(`
|
|
88
|
-
`);O=fe.pop()??"";for(const J of fe)if(J.startsWith("data: ")){const Q=J.slice(6);try{const P=JSON.parse(Q);if(P.task_id&&P.event_type){const se=`host-event.${r.hostId}.${P.task_id}`;for(const ye of w.current)ye({subject:se,data:b.current.encode(Q)})}}catch{}}}}catch{}}return(async()=>{const V=await B();V&&await z(V)})(),()=>{ae.abort(),d(!1)}},[r,D]);const q=N.useCallback(async(ae,B,z)=>{if(!r)throw new Error("No active host");function V(fe){fe&&typeof fe=="object"&&fe.error==="Unauthorized"&&g(!0)}if(D){console.log(`[HOST/HTTP] → ${ae}`,B??"");const fe=await fetch(`${r.directUrl}/rpc/${ae}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.clientToken}`},body:B!=null?JSON.stringify(B):void 0,signal:z!=null&&z.timeout?AbortSignal.timeout(z.timeout):void 0});if(fe.status===401)throw g(!0),new Error("Unauthorized");const J=await fe.json();return V(J),console.log(`[HOST/HTTP] ← ${ae}`,J),J}if(!f.current)throw new Error("Not connected");const Y=`host.${r.hostId}.rpc.${ae}`,$={...B??{},clientToken:r.clientToken},O=b.current.encode(JSON.stringify($));console.log(`[HOST/NATS] → ${ae}`,B??"");const W=await f.current.request(Y,O,{timeout:(z==null?void 0:z.timeout)??1e4}),Z=JSON.parse(b.current.decode(W.data));return V(Z),console.log(`[HOST/NATS] ← ${ae}`,Z),Z},[r,D]),H=N.useCallback((ae,B)=>{if(D)return w.current.add(B),()=>{w.current.delete(B)};if(f.current){const z=f.current.subscribe(`host-event.${ae}.>`);let V=!1;return(async()=>{try{for await(const Y of z){if(V)break;B({subject:Y.subject,data:Y.data})}}catch{}})(),()=>{V=!0,z.unsubscribe()}}return()=>{}},[r,D]);return v.jsx(Ex.Provider,{value:{connected:M,mode:U,nc:s,request:q,subscribeEvents:H,activeHost:r,unauthorized:y},children:e})}function Ju(){return N.useContext(Ex)}const zt=Er.isNativePlatform()?xa("Device"):null;function zu(e){const n=new Date(e),r=new Date,s=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return n.toDateString()===r.toDateString()?s:`${n.toLocaleDateString(void 0,{month:"short",day:"numeric"})} ${s}`}const kx={};function lk(e){for(const n of e)kx[n.key]=n.label}function hd(e){return kx[e]??e}const ok=()=>window.matchMedia("(max-width: 600px)").matches;function uk({task:e,lastEvent:n,onEdit:r,onDelete:s,onViewRun:l}){var fe;const{request:u}=Ju(),[c,f]=N.useState(!1),[m,d]=N.useState(!1),[y,g]=N.useState(!1),b=N.useRef(null),w=(n==null?void 0:n.running_state)==="started",k=(((fe=e.schedule_values)==null?void 0:fe.length)??0)>0,D=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",M=!!e.schedule_enabled&&!!e.schedule_type&&(k||D)?w?"var(--color-success)":(n==null?void 0:n.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";N.useEffect(()=>{if(!m)return;function J(Q){b.current&&!b.current.contains(Q.target)&&d(!1)}return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[m]);function q(){ok()?g(!0):d(J=>!J)}function H(){d(!1),g(!1)}async function ae(){if(H(),!!confirm("Abort this task?")){f(!0);try{await u("task.abort",{id:e.id})}catch(J){console.error("Abort failed:",J)}finally{f(!1)}}}async function B(){H();try{const J=await u("task.run",{id:e.id});l(e.id,J.run_id)}catch(J){console.error("Run failed:",J)}}async function z(){if(H(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),s(e.id)}catch(J){console.error("Delete failed:",J)}}const V={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function Y(J,Q){if(J==="specific_times"){const ve=new Date(Q);return{kind:"specific_times",detail:isNaN(ve.getTime())?Q:`${ve.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})} at ${ve.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}}const P=Q.split(" ");if(P.length!==5)return{kind:"unknown",detail:Q};const[se,ye,_e,,_]=P,R=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(ye==="*")return{kind:"hourly",detail:""};const ee=new Date;ee.setHours(Number(ye),Number(se),0,0);const A=ee.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return _!=="*"?{kind:"weekly",detail:`${R[Number(_)]??_} at ${A}`}:_e!=="*"?{kind:"monthly",detail:`day ${_e} at ${A}`}:{kind:"daily",detail:A}}function $(J,Q){const P=Y(J,Q);return P.kind==="hourly"?"Every hour":P.kind==="specific_times"?`Once on ${P.detail}`:`${P.kind.charAt(0).toUpperCase()+P.kind.slice(1)}: ${P.detail}`}function O(J,Q){if(!J)return"";if(J==="on_new_notification")return"On new push notification";if(J==="on_new_sms")return"On new SMS";if(!Q||Q.length===0)return"";if(Q.length===1)return $(J,Q[0]);const P=Q.map(ye=>Y(J,ye));if(new Set(P.map(ye=>ye.kind)).size===1){const ye=P[0].kind;if(ye==="hourly")return"Every hour";const _e=P.map(_=>_.detail);return`${ye.charAt(0).toUpperCase()+ye.slice(1)}: ${_e.join(", ")}`}return Q.map(ye=>$(J,ye)).join(", ")}const W=O(e.schedule_type,e.schedule_values),Z=v.jsxs(v.Fragment,{children:[v.jsxs("button",{onClick:()=>{H(),r(e)},children:[v.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),v.jsxs("button",{onClick:()=>{H(),l(e.id)},children:[v.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),w?v.jsxs("button",{className:"menu-item-danger",onClick:ae,disabled:c,children:[v.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):v.jsxs(v.Fragment,{children:[v.jsxs("button",{onClick:B,children:[v.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),v.jsxs("button",{className:"menu-item-danger",onClick:z,children:[v.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"task-card",onClick:()=>l(e.id,"latest"),children:[v.jsxs("div",{className:"task-card-header",children:[v.jsxs("div",{className:"task-card-title-row",children:[w?v.jsx("span",{className:"status-spinner",children:v.jsx("span",{})}):v.jsx("span",{className:"status-dot",style:{backgroundColor:M}}),v.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),v.jsx("div",{className:"task-card-actions",onClick:J=>J.stopPropagation(),children:v.jsxs("div",{className:"task-card-menu",ref:b,children:[v.jsx("button",{className:"task-card-menu-btn",onClick:q,"aria-label":"Task actions",children:"⋮"}),m&&v.jsx("div",{className:"task-card-menu-dropdown",children:Z})]})})]}),v.jsxs("div",{className:"task-card-meta",children:[e.agent&&v.jsx("span",{className:"task-card-agent",children:hd(e.agent)}),n&&V[n.running_state]&&v.jsxs("span",{className:"task-card-last-event",children:[V[n.running_state]," ",zu(n.time_stamp)]}),e.schedule_type&&(k||D)&&v.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?W:"Schedule disabled"})]})]}),y&&ta.createPortal(v.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>g(!1),children:v.jsxs("div",{className:"bottom-sheet",onClick:J=>J.stopPropagation(),children:[v.jsx("div",{className:"bottom-sheet-handle"}),v.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),v.jsx("div",{className:"bottom-sheet-actions",children:Z})]})}),document.body)]})}function ck({permissions:e}){return v.jsxs("div",{className:"plan-dialog",children:[v.jsx("h2",{children:"Granted Permissions"}),v.jsx("div",{className:"plan-dialog-scroll",children:e&&e.length>0?v.jsx("div",{className:"permissions-section",children:v.jsx("ul",{className:"permissions-list",children:e.map((n,r)=>v.jsxs("li",{className:"permission-item",children:[v.jsx("span",{className:"permission-tool",children:n.name}),v.jsx("span",{className:"permission-desc",children:n.description})]},r))})}):v.jsx("p",{className:"plan-empty",children:"No permissions have been granted for this task."})}),v.jsx("div",{className:"plan-dialog-actions",children:v.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const Ws=[];function fk(){const e=Ws.pop();e&&(e.pushed.current=!1,e.close())}let D0=!1;function hk(){D0||(D0=!0,window.addEventListener("popstate",fk))}function dk(e,n){const r=N.useRef(!1),s=N.useRef(n);s.current=n;const l=N.useCallback(()=>s.current(),[]),u=N.useRef({close:l,pushed:r});u.current.close=l,N.useEffect(()=>{if(e&&!r.current)hk(),history.pushState({modal:!0},""),Ws.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=Ws.indexOf(u.current);c!==-1&&Ws.splice(c,1),history.back()}},[e,l]),N.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=Ws.indexOf(c);f!==-1&&Ws.splice(f,1),history.back()}}},[])}const mk=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],pk=["specific_times","hourly","daily","weekly","monthly"];function du(e){return pk.includes(e)}function gk(e){return e==="on_new_notification"||e==="on_new_sms"}function Xr(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function yk(e){const n=e.split(" ");if(n.length!==5)return Xr();const[r,s,l,,u]=n;if(s==="*")return Xr("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...Xr("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...Xr("monthly"),time:c,dayOfMonth:l}:{...Xr("daily"),time:c}}function Cx(e,n){if(e==="specific_times"){const[r,s]=n.split("T");return{...Xr("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return yk(n)}function bk(e){const[n,r]=e.time.split(":").map(Number);switch(e.schedule){case"hourly":return"0 * * * *";case"daily":return`${r} ${n} * * *`;case"weekly":return`${r} ${n} * * ${e.dayOfWeek}`;case"monthly":return`${r} ${n} ${e.dayOfMonth} * *`;default:return"0 * * * *"}}function xk(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:bk(e)}function Th(e){return e==="specific_times"?"specific_times":e==="on_new_notification"?"on_new_notification":e==="on_new_sms"?"on_new_sms":"crons"}function jh(e){var s;if(!e)return"daily";if(e.command)return"command";const n=e.schedule_type;if(n==="on_new_notification"||n==="on_new_sms")return n;if(n!=="crons"&&n!=="specific_times")return"ondemand";const r=(s=e.schedule_values)==null?void 0:s[0];return r?Cx(n,r).schedule:"ondemand"}function vk({initial:e,agents:n,hostPlatform:r,onSaved:s,onRun:l,onCancel:u}){var Se;const{request:c}=Ju(),f=()=>{var ke;const oe=localStorage.getItem("palmier:lastAgent"),Te=n.map(st=>st.key);return oe&&Te.includes(oe)?oe:((ke=n[0])==null?void 0:ke.key)??""},[m,d]=N.useState((e==null?void 0:e.user_prompt)??""),[y,g]=N.useState((e==null?void 0:e.agent)??f()),b=!!((Se=e==null?void 0:e.permissions)!=null&&Se.length),[w,k]=N.useState(!1),D=N.useCallback(()=>k(!1),[]);dk(w,D);const[U,M]=N.useState(null),[q,H]=N.useState(()=>jh(e)),[ae,B]=N.useState(()=>{const oe=e==null?void 0:e.schedule_type,Te=e==null?void 0:e.schedule_values;if(Te&&(oe==="crons"||oe==="specific_times"))return Te.map(st=>Cx(oe,st));const ke=jh(e);return du(ke)?[Xr(ke)]:[]}),[z,V]=N.useState((e==null?void 0:e.requires_confirmation)??!1),[Y,$]=N.useState((e==null?void 0:e.schedule_enabled)??!0),[O,W]=N.useState((e==null?void 0:e.yolo_mode)??!1),[Z,fe]=N.useState((e==null?void 0:e.foreground_mode)??!1),[J,Q]=N.useState((e==null?void 0:e.command)??""),[P,se]=N.useState(!1),ye=(e==null?void 0:e.schedule_type)==="on_new_notification"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[_e,_]=N.useState(ye),[R,ee]=N.useState([]),[A,ve]=N.useState(!1);N.useEffect(()=>{if(q!=="on_new_notification")return;let oe=!1;const Te=new Map,ke="com.palmier.app",st=()=>{oe||ee(Array.from(Te.values()).sort((dt,at)=>(dt.appName||dt.packageName).localeCompare(at.appName||at.packageName)))};return Er.isNativePlatform()&&zt&&zt.getInstalledApps().then(({apps:dt})=>{if(!oe){for(const at of dt)at.packageName!==ke&&Te.set(at.packageName,{packageName:at.packageName,appName:at.appName,icon:at.icon});st()}}).catch(()=>{}),c("device.notifications.apps").then(dt=>{if(!(oe||!dt.apps)){for(const at of dt.apps)at.packageName!==ke&&(Te.has(at.packageName)||Te.set(at.packageName,at));st()}}).catch(()=>{}),()=>{oe=!0}},[q]);const Ne=(e==null?void 0:e.schedule_type)==="on_new_sms"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[je,Ue]=N.useState(Ne),Ye=N.useRef(null),me=du(q),Le=q==="command",be=gk(q),ze=n.find(oe=>oe.key===y),qe=!!(ze!=null&&ze.supportsYolo);N.useEffect(()=>{!qe&&O&&W(!1)},[qe,O]);const $e=!!e,Be=jh(e),He=!$e||m!==((e==null?void 0:e.user_prompt)??"")||y!==((e==null?void 0:e.agent)??"")||q!==Be||z!==((e==null?void 0:e.requires_confirmation)??!1)||Y!==((e==null?void 0:e.schedule_enabled)??!0)||O!==((e==null?void 0:e.yolo_mode)??!1)||Z!==((e==null?void 0:e.foreground_mode)??!1)||Le&&J!==((e==null?void 0:e.command)??"")||me&&(JSON.stringify(rr())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Th(q)!==((e==null?void 0:e.schedule_type)??void 0))||be&&q!==(e==null?void 0:e.schedule_type)||q==="on_new_notification"&&_e.trim()!==ye.trim()||q==="on_new_sms"&&je.trim()!==Ne.trim(),Qe=me&&ae.some(oe=>oe.schedule==="specific_times"&&(!oe.onceDate||new Date(`${oe.onceDate}T${oe.onceTime}`)<=new Date)),Et=He&&!!m.trim()&&!Qe&&(!Le||!!J.trim())&&(!me||ae.length>0);function Ze(oe,Te){B(ke=>ke.map((st,dt)=>dt===oe?{...st,...Te}:st))}function Ht(oe){B(Te=>Te.filter((ke,st)=>st!==oe))}function Ge(){du(q)&&B(oe=>[...oe,oe.length>0?{...oe[oe.length-1]}:Xr(q)])}function fn(oe){H(oe),du(oe)?B([Xr(oe)]):(B([]),V(!1)),oe==="command"?setTimeout(()=>{var Te;return(Te=Ye.current)==null?void 0:Te.focus()},0):Q(""),oe!=="on_new_notification"&&_(ye),oe!=="on_new_sms"&&Ue(Ne)}function rr(){return ae.flatMap(oe=>{const Te=xk(oe);return Te?[Te]:[]})}function bt(){return O?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
|
-
|
|
90
|
-
Are you sure you want to continue?`):!0}async function Pi(){se(!0),M(null);try{const oe=me?rr():q==="on_new_notification"&&_e.trim()?[_e.trim()]:q==="on_new_sms"&&je.trim()?[je.trim()]:[],Te=me||be?Th(q):null,ke={user_prompt:m,agent:y,schedule_type:Te,schedule_values:oe.length>0?oe:null,schedule_enabled:q!=="ondemand"&&Y,requires_confirmation:me?z:!1,yolo_mode:O,foreground_mode:Z,command:Le?J:""};$e&&(ke.id=e.id);const dt=await c($e?"task.update":"task.create",ke,{timeout:45e3});if(dt.error){M(dt.error);return}if($e||localStorage.setItem("palmier:lastAgent",y),Le&&!$e){s(dt);try{const at=await c("task.run",{id:dt.id});at.run_id?l(dt.id,at.run_id):at.error||l(dt.id)}catch{}return}s(dt)}catch(oe){M(oe instanceof Error?oe.message:String(oe))}finally{se(!1)}}const ce=$e?"Save":Le?"Run":(me||be)&&Y?"Schedule":"Save";return v.jsx("div",{className:"task-form-overlay",children:v.jsx("div",{className:"task-form",children:w?v.jsx(ck,{permissions:e==null?void 0:e.permissions}):v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"task-form-header",children:v.jsx("h2",{children:e?"Edit Task":"New Task"})}),U&&v.jsx("div",{className:"form-error",children:U}),v.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:m,onChange:oe=>d(oe.target.value),placeholder:Le?"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:P}),v.jsxs("div",{className:"plan-actions",children:[v.jsxs("div",{className:"agent-picker-section-inline",children:[v.jsx("span",{className:"agent-picker-label",children:"Run with"}),v.jsx("select",{className:"form-select form-select-sm",value:y,onChange:oe=>g(oe.target.value),disabled:P,children:n.map(oe=>v.jsx("option",{value:oe.key,children:oe.label},oe.key))})]}),qe&&v.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[v.jsx("input",{type:"checkbox",checked:O,onChange:oe=>W(oe.target.checked),disabled:P}),"Yolo"]}),qe&&O&&v.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),b&&v.jsx("div",{className:"granted-permissions-row",children:v.jsx("button",{className:"btn btn-link",onClick:()=>k(!0),children:"Granted Permissions"})})]}),v.jsx("div",{className:"toggles-group",children:v.jsxs("div",{className:"schedule-section",children:[v.jsx("h3",{className:"schedule-section-title",children:"Schedule"}),v.jsxs("select",{className:"form-select",value:q,onChange:oe=>fn(oe.target.value),disabled:P,children:[v.jsx("option",{value:"ondemand",children:"On Demand"}),v.jsx("option",{value:"specific_times",children:"Specific Times"}),v.jsx("option",{value:"hourly",children:"Hourly"}),v.jsx("option",{value:"daily",children:"Daily"}),v.jsx("option",{value:"weekly",children:"Weekly"}),v.jsx("option",{value:"monthly",children:"Monthly"}),v.jsx("option",{value:"on_new_notification",children:"On New Push Notification"}),v.jsx("option",{value:"on_new_sms",children:"On New SMS"}),v.jsx("option",{value:"command",children:"Command-triggered"})]}),be&&v.jsxs("div",{className:"schedule-reactive",children:[v.jsxs("p",{className:"command-help-text",children:[q==="on_new_notification"?"Runs each time a new 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 ",q==="on_new_notification"?"notification":"SMS","”."]}),q==="on_new_notification"&&(()=>{const oe=_e.trim().toLowerCase(),Te=oe?R.filter(ke=>ke.packageName.toLowerCase().includes(oe)||ke.appName.toLowerCase().includes(oe)):R;return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"app-combobox",children:[v.jsx("input",{className:"form-input",type:"text",value:_e,onChange:ke=>{_(ke.target.value),ve(!0)},onFocus:()=>ve(!0),onBlur:()=>ve(!1),placeholder:Er.isNativePlatform()?"App (optional)":"App (optional, e.g. com.google.android.gm)",disabled:P}),A&&Te.length>0&&v.jsx("ul",{className:"app-combobox-list",children:Te.map(ke=>v.jsxs("li",{className:"app-combobox-row",onMouseDown:st=>{st.preventDefault(),_(ke.packageName),ve(!1)},children:[ke.icon?v.jsx("img",{src:ke.icon,alt:"",className:"app-combobox-icon"}):v.jsx("div",{className:"app-combobox-icon app-combobox-icon-placeholder"}),v.jsxs("div",{className:"app-combobox-labels",children:[v.jsx("div",{className:"app-combobox-name",children:ke.appName||ke.packageName}),ke.appName&&v.jsx("div",{className:"app-combobox-pkg",children:ke.packageName})]})]},ke.packageName))})]}),v.jsx("p",{className:"command-help-text app-filter-help",children:_e.trim()?`Only notifications from ${_e.trim()} will trigger this task.`:"Every notification from your device triggers this task."})]})})(),q==="on_new_sms"&&v.jsxs(v.Fragment,{children:[v.jsx("input",{className:"form-input",type:"text",value:je,onChange:oe=>Ue(oe.target.value),placeholder:"From (optional), e.g. +1 555-1234)",disabled:P}),v.jsx("p",{className:"command-help-text app-filter-help",children:je.trim()?`Only SMS from ${je.trim()} will trigger this task. Formatting (spaces, dashes, parens) is ignored.`:"Every SMS that arrives on your device triggers this task."})]})]}),Le&&v.jsxs("div",{className:"schedule-reactive",children:[v.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."}),v.jsx("input",{ref:Ye,className:"form-input form-input-mono",type:"text",value:J,onChange:oe=>Q(oe.target.value),placeholder:"gws gmail +watch --project my-project",disabled:P})]}),me&&q!=="hourly"&&v.jsxs(v.Fragment,{children:[ae.map((oe,Te)=>v.jsxs("div",{className:"trigger-row-card",children:[v.jsxs("div",{className:"trigger-row-content",children:[q==="daily"&&v.jsx("input",{className:"form-input",type:"time",value:oe.time,onChange:ke=>Ze(Te,{time:ke.target.value})}),q==="weekly"&&v.jsxs("div",{className:"trigger-row-top",children:[v.jsx("select",{className:"form-select",value:oe.dayOfWeek,onChange:ke=>Ze(Te,{dayOfWeek:ke.target.value}),children:mk.map((ke,st)=>v.jsx("option",{value:String(st),children:ke},st))}),v.jsx("input",{className:"form-input",type:"time",value:oe.time,onChange:ke=>Ze(Te,{time:ke.target.value})})]}),q==="monthly"&&v.jsxs("div",{className:"trigger-row-top",children:[v.jsx("select",{className:"form-select",value:oe.dayOfMonth,onChange:ke=>Ze(Te,{dayOfMonth:ke.target.value}),children:Array.from({length:28},(ke,st)=>st+1).map(ke=>v.jsxs("option",{value:String(ke),children:["Day ",ke]},ke))}),v.jsx("input",{className:"form-input",type:"time",value:oe.time,onChange:ke=>Ze(Te,{time:ke.target.value})})]}),q==="specific_times"&&v.jsxs("div",{className:"trigger-row-top",children:[v.jsx("input",{className:"form-input",type:"date",value:oe.onceDate,min:new Date().toISOString().split("T")[0],onChange:ke=>Ze(Te,{onceDate:ke.target.value})}),v.jsx("input",{className:"form-input",type:"time",value:oe.onceTime,min:oe.onceDate===new Date().toISOString().split("T")[0]?new Date().toTimeString().slice(0,5):void 0,onChange:ke=>Ze(Te,{onceTime:ke.target.value})})]})]}),ae.length>1&&v.jsx("button",{className:"trigger-remove-btn",onClick:()=>Ht(Te),title:"Remove trigger",children:"×"})]},Te)),v.jsx("button",{className:"trigger-add-btn",onClick:Ge,children:"+ Add"})]}),r==="win32"&&v.jsxs("label",{className:"toggle-label",children:[v.jsx("input",{type:"checkbox",checked:Z,onChange:oe=>fe(oe.target.checked),disabled:P}),"Run in the foreground (host must login to Windows)"]}),me&&v.jsxs("label",{className:"toggle-label",children:[v.jsx("input",{type:"checkbox",checked:z,onChange:oe=>V(oe.target.checked),disabled:P}),"Confirm before each run"]}),q!=="ondemand"&&v.jsxs("label",{className:"toggle-label",children:[v.jsx("input",{type:"checkbox",checked:Y,onChange:oe=>$(oe.target.checked),disabled:P}),"Enabled"]})]})}),!O&&ze&&!ze.supportsPermissions&&v.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",ze.label,". The task may fail if required permissions are not pre-configured."]}),v.jsxs("div",{className:"form-actions",children:[v.jsxs("button",{className:"btn btn-primary",onClick:()=>bt()&&Pi(),disabled:!Et||P,children:[P&&v.jsx("span",{className:"btn-spinner"}),ce]}),v.jsx("button",{className:"btn btn-secondary",onClick:()=>{He&&m.trim()&&!confirm("You have unsaved changes. Discard?")||u()},style:{marginLeft:"auto"},children:"Cancel"})]})]})})})}function Ax({pullDistance:e,refreshing:n,threshold:r}){const s=e>0||n,l=e>=r;return v.jsx("div",{className:"pull-to-refresh",style:{transform:`translateY(${e}px)`,opacity:s?Math.min(1,e/30):0},"aria-hidden":!s,children:v.jsx("div",{className:"pull-to-refresh-badge",children:n?v.jsx("div",{className:"spinner"}):v.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:[v.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),v.jsx("polyline",{points:"19 12 12 19 5 12"})]})})})}function Tx({onRefresh:e,threshold:n=70,maxPull:r=110,enabled:s=!0}){const[l,u]=N.useState(0),[c,f]=N.useState(!1),m=N.useRef(null),d=N.useRef(!1),y=N.useRef(0),g=N.useRef(!1),b=N.useRef(e);return N.useEffect(()=>{b.current=e}),N.useEffect(()=>{if(!s)return;const w=U=>{if(g.current||window.scrollY>0){m.current=null;return}m.current=U.touches[0].clientY,d.current=!1,y.current=0},k=U=>{if(g.current||m.current==null)return;const M=U.touches[0].clientY-m.current;if(M<=0){d.current=!1,y.current=0,u(0);return}d.current=!0;const q=Math.min(r,M*.5);y.current=q,u(q),U.cancelable&&U.preventDefault()},D=()=>{if(!d.current){m.current=null,u(0);return}const U=y.current;m.current=null,d.current=!1,y.current=0,U>=n?(g.current=!0,f(!0),u(n),Promise.resolve(b.current()).catch(()=>{}).finally(()=>{g.current=!1,f(!1),u(0)})):u(0)};return window.addEventListener("touchstart",w,{passive:!0}),window.addEventListener("touchmove",k,{passive:!1}),window.addEventListener("touchend",D,{passive:!0}),window.addEventListener("touchcancel",D,{passive:!0}),()=>{window.removeEventListener("touchstart",w),window.removeEventListener("touchmove",k),window.removeEventListener("touchend",D),window.removeEventListener("touchcancel",D)}},[s,n,r]),{pullDistance:l,refreshing:c,threshold:n}}function wk({connected:e,hostId:n,request:r,subscribeEvents:s,agents:l,hostPlatform:u,onViewRun:c}){const[f,m]=N.useState([]),[d,y]=N.useState(!1),[g,b]=N.useState(null),[w,k]=N.useState(new Map),[D,U]=N.useState(!1),[M,q]=N.useState(void 0),H=N.useCallback(()=>{U(!1),q(void 0)},[]),ae=N.useCallback(async()=>{if(e){y(!0),b(null);try{const $=(await r("task.list")).tasks??[],O=new Map;for(const W of $)W.status&&O.set(W.id,W.status);k(O),m($)}catch(Y){const $=Y instanceof Error?Y.message:String(Y);$==="Not connected"||$.includes("503")||$.toLowerCase().includes("no responders")?b(null):b($),m([])}finally{y(!1)}}},[e,n,r]);N.useEffect(()=>{e?ae():(m([]),y(!1))},[e,n,ae]);const B=Tx({onRefresh:ae,enabled:e});N.useEffect(()=>!e||!n?void 0:s(n,async $=>{const O=$.subject.split(".");if(O.length<3)return;const W=O.slice(2).join(".");let Z={};try{Z=JSON.parse(new TextDecoder().decode($.data))}catch{return}const fe=Z.event_type;if(!(fe!=="running-state"&&fe!=="permission-resolved"))try{const J=await r("task.status",{id:W},{timeout:5e3});if(J.error)return;k(Q=>{const P=new Map(Q);return P.set(W,J),P})}catch{}}),[e,n,s,r]);function z(Y){m($=>{const O=$.findIndex(W=>W.id===Y.id);if(O>=0){const W=[...$];return W[O]=Y,W}return[Y,...$]}),U(!1),q(void 0)}function V(Y){m($=>$.filter(O=>O.id!==Y)),k($=>{const O=new Map($);return O.delete(Y),O})}return v.jsxs(v.Fragment,{children:[v.jsx(Ax,{pullDistance:B.pullDistance,refreshing:B.refreshing,threshold:B.threshold}),g&&v.jsxs("div",{className:"form-error",children:[g,g.toLowerCase().includes("failed to fetch")&&v.jsxs(v.Fragment,{children:[" ",v.jsx("a",{href:"#",onClick:Y=>{Y.preventDefault(),window.location.reload()},children:"Reload"})]})]}),d&&!f.length?v.jsx("div",{className:"task-list",children:[0,1,2].map(Y=>v.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[v.jsx("div",{className:"task-card-header",children:v.jsxs("div",{className:"task-card-title-row",children:[v.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),v.jsx("div",{className:"skeleton-line",style:{width:`${60+Y*12}%`}})]})}),v.jsxs("div",{className:"task-card-meta",children:[v.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),v.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},Y))}):f.length===0?v.jsxs("div",{className:"empty-state",children:[v.jsx("p",{className:"empty-state-text",children:"No tasks yet"}),v.jsx("p",{className:"empty-state-hint",children:"Tap the + button to create your first task."})]}):v.jsx("div",{className:"task-list",children:f.map(Y=>v.jsx(uk,{task:Y,lastEvent:w.get(Y.id),onEdit:async $=>{try{const O=await r("task.get",{id:$.id});q(O.error?$:O)}catch{q($)}U(!0)},onDelete:V,onViewRun:c},Y.id))}),v.jsx("button",{className:"fab",onClick:()=>{q(void 0),U(!0)},"aria-label":"New task",title:"New task",children:v.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),v.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),D&&v.jsx(vk,{initial:M,agents:l,hostPlatform:u,onSaved:z,onRun:c,onCancel:H})]})}let ua=null;function L0(e){ua&&(e.preventDefault(),e.returnValue="")}function Nh(e){const n=!!ua;ua=e;const r=!!ua;r&&!n?window.addEventListener("beforeunload",L0):!r&&n&&window.removeEventListener("beforeunload",L0)}function fs(){return ua?window.confirm(ua):!0}function Sk(){const e=zi(),r=Cr().pathname.startsWith("/tasks"),s=!r;function l(u){fs()&&e(u)}return v.jsxs(v.Fragment,{children:[v.jsxs("button",{className:`tab-btn ${s?"tab-btn-active":""}`,onClick:()=>l("/"),children:[v.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:v.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),v.jsxs("button",{className:`tab-btn ${r?"tab-btn-active":""}`,onClick:()=>l("/tasks"),children:[v.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:[v.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),v.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}const _k="modulepreload",Ek=function(e){return"/"+e},z0={},jx=function(n,r,s){let l=Promise.resolve();if(r&&r.length>0){let c=function(d){return Promise.all(d.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]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=c(r.map(d=>{if(d=Ek(d),d in z0)return;z0[d]=!0;const y=d.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":_k,y||(b.as="script"),b.crossOrigin="",b.href=d,m&&b.setAttribute("nonce",m),document.head.appendChild(b),y)return new Promise((w,k)=>{b.addEventListener("load",w),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${d}`)))})}))}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 n().catch(u)})},kk=xa("App",{web:()=>jx(()=>import("./web-Z1623me-.js"),[]).then(e=>new e.AppWeb)});function Nx(e){const[n,r]=N.useState(()=>window.matchMedia(e).matches);return N.useEffect(()=>{const s=window.matchMedia(e),l=u=>r(u.matches);return s.addEventListener("change",l),r(s.matches),()=>s.removeEventListener("change",l)},[e]),n}const U0=!!window.__PALMIER_SERVE__,mu=Er.isNativePlatform(),Ck=["Device","Data","Messaging"],Oh=[{capability:"sms-read",label:"Read SMS",group:"Messaging",permission:"smsRead"},{capability:"sms-send",label:"Send SMS",group:"Messaging",permission:"smsSend"},{capability:"send-email",label:"Send Email",group:"Messaging",permission:"postNotifications"},{capability:"notifications",label:"Read Notifications",group:"Data",permission:"notificationListener"},{capability:"contacts",label:"Manage Contacts",group:"Data",permission:"contacts"},{capability:"calendar",label:"Manage Calendar",group:"Data",permission:"calendar"},{capability:"location",label:"Get Location",group:"Device",permission:"location",enableMethod:"device.location.enable",disableMethod:"device.location.disable",enableParams:e=>({fcmToken:e}),disableParams:()=>({})},{capability:"battery",label:"Read Battery Status",group:"Device"},{capability:"dnd",label:"Set Ringer Mode",group:"Device",permission:"dnd"},{capability:"alarm",label:"Trigger Alarms",group:"Device",needsFullScreenIntent:!0}];function B0({daemonVersion:e,capabilityTokens:n,activeClientToken:r,request:s,onCapabilityTokensChange:l}){var Le;const{pairedHosts:u,activeHostId:c,setActiveHostId:f,removePairedHost:m,renamePairedHost:d}=Il(),y=zi(),g=Nx("(min-width: 768px)"),[b,w]=N.useState(!1),[k,D]=N.useState(!1),[U,M]=N.useState(null),[q,H]=N.useState(""),[ae,B]=N.useState(null),[z,V]=N.useState(null),[Y,$]=N.useState(null),[O,W]=N.useState(null),[Z,fe]=N.useState(null);N.useEffect(()=>{if(!mu||!zt){fe(new Set);return}zt.getSupportedPermissions().then(({types:be})=>fe(new Set(be))).catch(()=>fe(new Set))},[]);function J(be){return!!(r&&(n==null?void 0:n[be])===r)}function Q(be){return Z?Z.size===0?!0:!(be.permission&&!Z.has(be.permission)||be.needsFullScreenIntent&&!Z.has("fullScreenIntent")):!1}function P(be,ze){const qe={};for(const[$e,Be]of Object.entries(n??{}))qe[$e]=Be??null;qe[be]=ze?r??null:null,l==null||l(qe)}N.useEffect(()=>{if(!mu||!zt||!s||!J("location"))return;function ze(){zt.checkPermission({type:"location"}).then(({granted:$e})=>{$e||s("device.location.disable").then(()=>{P("location",!1)}).catch(()=>{})})}ze();const qe=kk.addListener("resume",ze);return()=>{qe.then($e=>$e.remove())}},[n,r]),N.useEffect(()=>{if(!mu||!zt)return;const be=Oh.map(ze=>ze.capability).filter(ze=>(n==null?void 0:n[ze])===r);zt.setEnabledCapabilities({capabilities:be}).catch(()=>{})},[n,r]);async function se(be,ze=!1){var Be,He;if(!s)return;const qe=J(be.capability);if(qe&&!ze){W(be);return}if(!qe&&!!(n!=null&&n[be.capability])&&n[be.capability]!==r&&!ze){$(be);return}V(be.capability);try{if(qe){const Ge=be.disableMethod??"device.capability.disable",fn=((Be=be.disableParams)==null?void 0:Be.call(be))??{capability:be.capability};await s(Ge,fn),P(be.capability,!1);return}if(zt&&be.capability==="send-email")try{const Ge=await zt.hasEmailClient();if(Ge.supported&&!Ge.available){alert("No email app is installed on this device. Install one (e.g. Gmail) before enabling Sending Email.");return}}catch{}if(zt&&be.permission){const Ge=await zt.checkPermission({type:be.permission});if(!Ge.supported){console.warn(`Native build does not support permission '${be.permission}'`);return}if(!Ge.granted&&!(await zt.requestPermission({type:be.permission})).granted)return}if(zt&&be.needsFullScreenIntent){const Ge=await zt.checkPermission({type:"fullScreenIntent"});if(!Ge.supported){console.warn("Native build does not support fullScreenIntent");return}if(!Ge.granted&&!(await zt.requestPermission({type:"fullScreenIntent"})).granted)return}if(!zt)return;const{token:Qe}=await zt.getFcmToken();if(!Qe){console.warn("No FCM token available");return}const Et=Oh.map(Ge=>Ge.capability).filter(Ge=>Ge===be.capability||(n==null?void 0:n[Ge])===r);await zt.setEnabledCapabilities({capabilities:Et});const Ze=be.enableMethod??"device.capability.enable",Ht=((He=be.enableParams)==null?void 0:He.call(be,Qe))??{capability:be.capability,fcmToken:Qe};await s(Ze,Ht),P(be.capability,!0)}catch(Qe){console.error(`Failed to toggle ${be.capability}:`,Qe)}finally{V(null)}}const ye=N.useRef(null),_e=N.useRef(null),_=N.useCallback(()=>{D(!0)},[]);function R(){k&&(w(!1),D(!1))}function ee(){D(!1),w(!0)}function A(be,ze){M(be),H(ze)}function ve(){U&&q.trim()&&d(U,q.trim()),M(null),H("")}function Ne(){M(null),H("")}N.useEffect(()=>{U&&_e.current&&(_e.current.focus(),_e.current.select())},[U]),N.useEffect(()=>{if(!b||k)return;function be(ze){ze.key==="Escape"&&_()}return document.addEventListener("keydown",be),()=>{document.removeEventListener("keydown",be)}},[b,k,_]);const je=v.jsxs(v.Fragment,{children:[!g&&v.jsx("button",{className:"drawer-close-btn",onClick:_,"aria-label":"Close menu",children:v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),!U0&&u.length>0&&v.jsxs("div",{className:"drawer-section",children:[v.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),v.jsx("div",{className:"host-picker-inline",children:v.jsx("div",{className:"host-picker-list",role:"listbox",children:u.map(be=>{const ze=be.hostId===c,qe=U===be.hostId,$e=be.name||be.hostId.slice(0,8);return v.jsx("div",{className:"host-picker-item-wrapper",children:v.jsxs("div",{className:`host-picker-item ${ze?"host-picker-item-active":""}`,onClick:()=>{if(!qe&&!ze){if(!fs())return;f(be.hostId),g||_()}},role:"option","aria-selected":ze,children:[qe?v.jsx("input",{ref:_e,className:"form-input host-picker-rename-input",type:"text",value:q,onChange:Be=>H(Be.target.value),onKeyDown:Be=>{Be.key==="Enter"&&ve(),Be.key==="Escape"&&Ne()},onBlur:ve,onClick:Be=>Be.stopPropagation()}):v.jsx("span",{className:"host-picker-item-name",children:$e}),v.jsxs("div",{className:"host-picker-item-actions",children:[ze&&!qe&&v.jsx("button",{className:"host-picker-edit-btn",onClick:Be=>{Be.stopPropagation(),A(be.hostId,$e)},"aria-label":"Rename host",children:v.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:v.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"})})}),!ze&&v.jsx("button",{className:"host-picker-delete-btn",onClick:Be=>{Be.stopPropagation(),B(be.hostId)},"aria-label":`Unpair ${$e}`,children:v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:v.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)})})})]}),!U0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"drawer-divider"}),v.jsx("div",{className:"drawer-section",children:v.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{fs()&&(y("/pair"),g||_())},children:"Pair New Host"})})]}),mu&&(()=>{const be=Ck.map(ze=>({group:ze,items:Oh.filter(qe=>qe.group===ze&&Q(qe))})).filter(ze=>ze.items.length>0);return be.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"drawer-divider"}),v.jsxs("div",{className:"drawer-section",children:[v.jsx("h3",{className:"drawer-section-label",children:"Host capabilities on this device"}),be.map(({group:ze,items:qe},$e)=>v.jsx("div",{className:$e>0?"drawer-toggle-group drawer-toggle-group-divided":"drawer-toggle-group",children:qe.map(Be=>{const He=J(Be.capability);return v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:Be.label}),v.jsx("button",{className:`toggle-switch ${He?"toggle-switch-on":""}`,onClick:()=>se(Be),disabled:z===Be.capability,role:"switch","aria-checked":He,children:v.jsx("span",{className:"toggle-switch-thumb"})})]},Be.capability)})},ze))]})]})})(),v.jsxs("div",{className:"drawer-footer",children:[e&&v.jsxs("div",{className:"drawer-version",children:["Palmier v",e]}),v.jsxs("div",{className:"drawer-legal",children:[v.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),v.jsx("span",{className:"drawer-legal-sep",children:"·"}),v.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),Ue=ae&&ta.createPortal(v.jsx("div",{className:"confirm-modal-overlay",onClick:()=>B(null),children:v.jsxs("div",{className:"confirm-modal",onClick:be=>be.stopPropagation(),children:[v.jsx("h2",{className:"confirm-modal-title",children:"Delete host?"}),v.jsxs("p",{className:"confirm-modal-message",children:['"',((Le=u.find(be=>be.hostId===ae))==null?void 0:Le.name)||ae.slice(0,8),'" will be unpaired from this device.']}),v.jsxs("div",{className:"confirm-modal-actions",children:[v.jsx("button",{className:"btn btn-secondary",onClick:()=>B(null),children:"Cancel"}),v.jsx("button",{className:"btn btn-danger",onClick:()=>{m(ae),B(null)},children:"Delete"})]})]})}),document.body),Ye=O&&ta.createPortal(v.jsx("div",{className:"confirm-modal-overlay",onClick:()=>W(null),children:v.jsxs("div",{className:"confirm-modal",onClick:be=>be.stopPropagation(),children:[v.jsxs("h2",{className:"confirm-modal-title",children:["Disable ",O.label,"?"]}),v.jsxs("p",{className:"confirm-modal-message",children:["Agents running on the host will no longer be able to use ",O.label," until it is re-enabled on a device."]}),v.jsxs("div",{className:"confirm-modal-actions",children:[v.jsx("button",{className:"btn btn-secondary",onClick:()=>W(null),children:"Cancel"}),v.jsx("button",{className:"btn btn-danger",onClick:()=>{const be=O;W(null),se(be,!0)},children:"Disable"})]})]})}),document.body),me=Y&&ta.createPortal(v.jsx("div",{className:"confirm-modal-overlay",onClick:()=>$(null),children:v.jsxs("div",{className:"confirm-modal",onClick:be=>be.stopPropagation(),children:[v.jsxs("h2",{className:"confirm-modal-title",children:["Switch ",Y.label," to this device?"]}),v.jsxs("p",{className:"confirm-modal-message",children:[Y.label," is currently enabled on another device. Switching will make this device the one the host uses for ",Y.label,", and it will be disabled on the other device."]}),v.jsxs("div",{className:"confirm-modal-actions",children:[v.jsx("button",{className:"btn btn-secondary",onClick:()=>$(null),children:"Cancel"}),v.jsx("button",{className:"btn btn-primary",onClick:()=>{const be=Y;$(null),se(be,!0)},children:"Switch"})]})]})}),document.body);return g?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:ye,children:je}),Ue,me,Ye]}):v.jsxs(v.Fragment,{children:[v.jsx("button",{className:"hamburger-btn",onClick:ee,"aria-label":"Open menu",children:v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:v.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),b&&ta.createPortal(v.jsx("div",{className:`drawer-overlay ${k?"drawer-overlay-closing":""}`,onClick:_,onAnimationEnd:R,children:v.jsx("div",{className:`drawer-panel ${k?"drawer-panel-closing":""}`,ref:ye,onClick:be=>be.stopPropagation(),children:je})}),document.body),Ue,me,Ye]})}function P0(e){var s;const n=localStorage.getItem("palmier:lastAgent"),r=e.map(l=>l.key);return n&&r.includes(n)?n:((s=e[0])==null?void 0:s.key)??""}function Ak({agents:e,onStarted:n}){const{request:r}=Ju(),[s,l]=N.useState(""),[u,c]=N.useState(()=>P0(e)),[f,m]=N.useState(!1),[d,y]=N.useState(!1),[g,b]=N.useState(null);N.useEffect(()=>{e.length&&(e.find(H=>H.key===u)||c(P0(e)))},[e,u]),N.useEffect(()=>{const H=s.trim().length>0;return Nh(H?"Your session draft will be lost. Continue?":null),()=>Nh(null)},[s]);const w=e.find(H=>H.key===u),k=!!(w!=null&&w.supportsYolo);N.useEffect(()=>{!k&&f&&m(!1)},[k,f]);const D=!!s.trim()&&!!u&&!d;function U(){return f?confirm(`Yolo mode is enabled. The agent will auto-approve all tool calls — it can read, write, delete files, run arbitrary commands, and access the network without asking for permission.
|
|
91
|
-
|
|
92
|
-
Are you sure you want to continue?`):!0}async function M(){if(!(!D||!U())){y(!0),b(null);try{const H=await r("task.run_oneoff",{user_prompt:s,agent:u,yolo_mode:f});if(H.error){b(H.error);return}localStorage.setItem("palmier:lastAgent",u),l(""),Nh(null),H.task_id&&n(H.task_id,H.run_id)}catch(H){b(H instanceof Error?H.message:String(H))}finally{y(!1)}}}function q(H){H.key==="Enter"&&(H.metaKey||H.ctrlKey)&&(H.preventDefault(),M())}return v.jsxs("div",{className:"session-composer",children:[g&&v.jsx("div",{className:"form-error",children:g}),v.jsx("textarea",{className:"session-composer-textarea",value:s,onChange:H=>l(H.target.value),onKeyDown:q,placeholder:"What can I do for you?",rows:3,disabled:d}),v.jsxs("div",{className:"session-composer-controls",children:[v.jsxs("div",{className:"agent-picker-section-inline",children:[v.jsx("span",{className:"agent-picker-label",children:"Run with"}),v.jsx("select",{className:"form-select form-select-sm",value:u,onChange:H=>c(H.target.value),disabled:d||!e.length,children:e.map(H=>v.jsx("option",{value:H.key,children:H.label},H.key))})]}),k&&v.jsxs("label",{className:"session-composer-yolo",children:[v.jsx("input",{type:"checkbox",checked:f,onChange:H=>m(H.target.checked),disabled:d}),"Yolo"]}),v.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:M,disabled:!D,"aria-label":"Run session",title:"Run session",children:d?v.jsx("span",{className:"btn-spinner"}):v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),v.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),k&&f&&v.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const ls=88,q0=6;function Tk({id:e,revealedId:n,setRevealedId:r,onDelete:s,onClick:l,children:u,actionLabel:c="Delete"}){const f=n===e,[m,d]=N.useState(0),[y,g]=N.useState(!1),b=N.useRef(0),w=N.useRef(0),k=N.useRef(null),D=N.useRef(0),U=N.useRef(!1),M=N.useRef(null);N.useEffect(()=>{f||d(0)},[f]),N.useEffect(()=>{if(!f)return;function V(Y){var $;($=M.current)!=null&&$.contains(Y.target)||r(null)}return document.addEventListener("pointerdown",V),()=>document.removeEventListener("pointerdown",V)},[f,r]);function q(V){V.button!==void 0&&V.button!==0||(b.current=V.clientX,w.current=V.clientY,k.current=null,D.current=f?-ls:0,U.current=!1)}function H(V){if(V.pointerType==="mouse"&&V.buttons===0)return;const Y=V.clientX-b.current,$=V.clientY-w.current;if(k.current===null){if(Math.abs(Y)<q0&&Math.abs($)<q0)return;if(k.current=Math.abs(Y)>Math.abs($)?"x":"y",k.current==="x")try{V.currentTarget.setPointerCapture(V.pointerId)}catch{}}if(k.current!=="x")return;U.current=!0,y||g(!0);let O=D.current+Y;O>0&&(O=O/4),O<-ls&&(O=-ls+(O+ls)/4),d(O)}function ae(){if(k.current!=="x"){g(!1);return}k.current=null,g(!1),m<=-44?(d(-ls),r(e)):(d(0),f&&r(null))}function B(V){if(U.current){U.current=!1,V.stopPropagation(),V.preventDefault();return}f&&(V.stopPropagation(),V.preventDefault(),r(null))}const z=m!==0?m:f?-ls:0;return v.jsxs("div",{ref:M,className:"swipe-row",children:[v.jsx("button",{type:"button",className:"swipe-row-action",style:{width:ls},onClick:V=>{V.stopPropagation(),s()},tabIndex:f?0:-1,"aria-hidden":!f,children:c}),v.jsx("div",{className:`swipe-row-content ${y?"swipe-row-content-dragging":""}`,style:{transform:`translateX(${z}px)`},onPointerDown:q,onPointerMove:H,onPointerUp:ae,onPointerCancel:ae,onClickCapture:B,onClick:l,children:u})]})}const jk=10;function Nk({connected:e,hostId:n,request:r,subscribeEvents:s,agents:l,filterTaskId:u,onClearFilter:c}){const[f,m]=N.useState([]),[d,y]=N.useState(0),[g,b]=N.useState(!1),[w,k]=N.useState(!1),[D,U]=N.useState(null),M=zi();async function q(J){const Q=`${J.task_id}:${J.run_id}`;m(P=>P.filter(se=>`${se.task_id}:${se.run_id}`!==Q)),y(P=>Math.max(0,P-1)),U(null);try{await r("taskrun.delete",{task_id:J.task_id,run_id:J.run_id})}catch(P){console.error("Failed to delete run:",P),m(se=>[J,...se]),y(se=>se+1)}}const H=N.useRef(null),ae=N.useCallback(J=>{const Q={offset:J,limit:jk};return u&&(Q.task_id=u),Q},[u]),B=N.useCallback(async(J,Q)=>{if(e){Q?k(!0):b(!0);try{const P=await r("taskrun.list",ae(J)),se=P.entries??[];y(P.total??0),m(Q?ye=>{const _e=new Set(ye.map(R=>`${R.task_id}:${R.run_id}`)),_=se.filter(R=>!_e.has(`${R.task_id}:${R.run_id}`));return[...ye,..._]}:se)}catch(P){P instanceof Error&&P.message==="Not connected"||console.error("Failed to load runs:",P)}finally{b(!1),k(!1)}}},[e,r,ae]);N.useEffect(()=>{e?(m([]),y(0),B(0,!1)):(m([]),y(0))},[e,n,B,u]);const z=Tx({onRefresh:()=>B(0,!1),enabled:e});N.useEffect(()=>!e||!n?void 0:s(n,async Q=>{try{const P=JSON.parse(new TextDecoder().decode(Q.data));if(P.event_type==="running-state"&&P.running_state&&["monitoring","started","finished","failed","aborted"].includes(P.running_state)){const se=await r("taskrun.list",ae(0)),ye=se.entries??[];y(se.total??0),m(_e=>{const _=new Map(ye.map(ve=>[`${ve.task_id}:${ve.run_id}`,ve])),R=_e.map(ve=>{const Ne=`${ve.task_id}:${ve.run_id}`;return _.get(Ne)??ve}),ee=new Set(R.map(ve=>`${ve.task_id}:${ve.run_id}`));return[...ye.filter(ve=>!ee.has(`${ve.task_id}:${ve.run_id}`)),...R]})}}catch{}}),[e,n,s,r]),N.useEffect(()=>{const J=H.current;if(!J)return;const Q=new IntersectionObserver(P=>{P[0].isIntersecting&&!w&&f.length<d&&B(f.length,!0)},{threshold:.1});return Q.observe(J),()=>Q.disconnect()},[f.length,d,w,B]);function V(J,Q){if(!J||!Q)return"";const P=Math.round((Q-J)/1e3);if(P<60)return`${P}s`;const se=Math.floor(P/60),ye=P%60;return`${se}m ${ye}s`}const Y={monitoring:"Monitoring",started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function $(J,Q){fs()&&M(`/runs/${J}/${encodeURIComponent(Q)}`)}const O=!u&&v.jsx(Ak,{agents:l,onStarted:(J,Q)=>{M(Q?`/runs/${encodeURIComponent(J)}/${encodeURIComponent(Q)}`:`/runs/${encodeURIComponent(J)}`)}}),W=v.jsx(Ax,{pullDistance:z.pullDistance,refreshing:z.refreshing,threshold:z.threshold}),Z=u&&c&&v.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:v.jsxs("span",{className:"sessions-filter-chip",children:["Filtered by task",v.jsx("button",{onClick:c,"aria-label":"Clear filter",children:"×"})]})});function fe(J){if(J==="failed")return"var(--color-error)";if(J==="aborted")return"var(--color-warning, #d97706)"}return g&&f.length===0&&e?v.jsxs(v.Fragment,{children:[W,O,v.jsx("div",{className:"task-list",children:[0,1,2].map(J=>v.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[v.jsx("div",{className:"task-card-header",children:v.jsx("div",{className:"task-card-title-row",children:v.jsx("div",{className:"skeleton-line",style:{width:`${70+J*10}%`}})})}),v.jsx("div",{className:"task-card-meta",children:v.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},J))})]}):!e||g&&f.length===0?v.jsxs(v.Fragment,{children:[W,O,v.jsx("div",{className:"sessions-view",children:v.jsxs("div",{className:"empty-state",children:[v.jsx("p",{className:"empty-state-text",children:"Sessions"}),v.jsx("p",{className:"empty-state-hint",children:"Your sessions will appear here"})]})})]}):f.length===0?v.jsxs(v.Fragment,{children:[W,O,Z,v.jsx("div",{className:"sessions-view",children:v.jsxs("div",{className:"empty-state",children:[v.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),v.jsx("p",{className:"empty-state-hint",children:u?"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger.":"Your sessions will appear here."})]})})]}):v.jsxs(v.Fragment,{children:[W,O,Z,v.jsxs("div",{className:"task-list",children:[f.map((J,Q)=>{const P=`${J.task_id}:${J.run_id}`;return v.jsx(Tk,{id:P,revealedId:D,setRevealedId:U,onDelete:()=>q(J),onClick:()=>!J.error&&$(J.task_id,J.run_id),children:v.jsxs("div",{className:"sessions-card",children:[v.jsxs("div",{className:"sessions-card-body",children:[v.jsx("h3",{className:"sessions-card-name",children:J.task_name||J.task_id}),v.jsxs("div",{className:"sessions-card-meta",children:[J.running_state==="started"?v.jsx("span",{className:"status-spinner","aria-label":"Running",children:v.jsx("span",{})}):v.jsx("span",{style:{color:fe(J.running_state)},children:Y[J.running_state??""]??J.running_state}),J.end_time&&v.jsx("span",{children:zu(J.end_time)}),J.start_time&&J.end_time&&v.jsx("span",{style:{color:"var(--color-muted)"},children:V(J.start_time,J.end_time)}),J.error&&v.jsx("span",{style:{color:"var(--color-muted)"},children:J.error})]})]}),v.jsx("span",{className:"sessions-card-chevron",children:"›"})]})},`${P}-${Q}`)}),v.jsx("div",{ref:H,style:{height:1}}),w&&v.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:v.jsx("div",{className:"spinner"})})]})]})}function Ok(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Rk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Mk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dk={};function H0(e,n){return(Dk.jsx?Mk:Rk).test(e)}const Lk=/[ \t\n\f\r]/g;function zk(e){return typeof e=="object"?e.type==="text"?I0(e.value):!1:I0(e)}function I0(e){return e.replace(Lk,"")===""}class Yl{constructor(n,r,s){this.normal=r,this.property=n,s&&(this.space=s)}}Yl.prototype.normal={};Yl.prototype.property={};Yl.prototype.space=void 0;function Ox(e,n){const r={},s={};for(const l of e)Object.assign(r,l.property),Object.assign(s,l.normal);return new Yl(r,s,n)}function dd(e){return e.toLowerCase()}class Cn{constructor(n,r){this.attribute=r,this.property=n}}Cn.prototype.attribute="";Cn.prototype.booleanish=!1;Cn.prototype.boolean=!1;Cn.prototype.commaOrSpaceSeparated=!1;Cn.prototype.commaSeparated=!1;Cn.prototype.defined=!1;Cn.prototype.mustUseProperty=!1;Cn.prototype.number=!1;Cn.prototype.overloadedBoolean=!1;Cn.prototype.property="";Cn.prototype.spaceSeparated=!1;Cn.prototype.space=void 0;let Uk=0;const Ke=ds(),Xt=ds(),md=ds(),we=ds(),jt=ds(),ca=ds(),Ln=ds();function ds(){return 2**++Uk}const pd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ke,booleanish:Xt,commaOrSpaceSeparated:Ln,commaSeparated:ca,number:we,overloadedBoolean:md,spaceSeparated:jt},Symbol.toStringTag,{value:"Module"})),Rh=Object.keys(pd);class qd extends Cn{constructor(n,r,s,l){let u=-1;if(super(n,r),F0(this,"space",l),typeof s=="number")for(;++u<Rh.length;){const c=Rh[u];F0(this,Rh[u],(s&pd[c])===pd[c])}}}qd.prototype.defined=!0;function F0(e,n,r){r&&(e[n]=r)}function va(e){const n={},r={};for(const[s,l]of Object.entries(e.properties)){const u=new qd(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),n[s]=u,r[dd(s)]=s,r[dd(u.attribute)]=s}return new Yl(n,r,e.space)}const Rx=va({properties:{ariaActiveDescendant:null,ariaAtomic:Xt,ariaAutoComplete:null,ariaBusy:Xt,ariaChecked:Xt,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:jt,ariaCurrent:null,ariaDescribedBy:jt,ariaDetails:null,ariaDisabled:Xt,ariaDropEffect:jt,ariaErrorMessage:null,ariaExpanded:Xt,ariaFlowTo:jt,ariaGrabbed:Xt,ariaHasPopup:null,ariaHidden:Xt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:jt,ariaLevel:we,ariaLive:null,ariaModal:Xt,ariaMultiLine:Xt,ariaMultiSelectable:Xt,ariaOrientation:null,ariaOwns:jt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:Xt,ariaReadOnly:Xt,ariaRelevant:null,ariaRequired:Xt,ariaRoleDescription:jt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:Xt,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Mx(e,n){return n in e?e[n]:n}function Dx(e,n){return Mx(e,n.toLowerCase())}const Bk=va({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ca,acceptCharset:jt,accessKey:jt,action:null,allow:null,allowFullScreen:Ke,allowPaymentRequest:Ke,allowUserMedia:Ke,alt:null,as:null,async:Ke,autoCapitalize:null,autoComplete:jt,autoFocus:Ke,autoPlay:Ke,blocking:jt,capture:null,charSet:null,checked:Ke,cite:null,className:jt,cols:we,colSpan:null,content:null,contentEditable:Xt,controls:Ke,controlsList:jt,coords:we|ca,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ke,defer:Ke,dir:null,dirName:null,disabled:Ke,download:md,draggable:Xt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ke,formTarget:null,headers:jt,height:we,hidden:md,high:we,href:null,hrefLang:null,htmlFor:jt,httpEquiv:jt,id:null,imageSizes:null,imageSrcSet:null,inert:Ke,inputMode:null,integrity:null,is:null,isMap:Ke,itemId:null,itemProp:jt,itemRef:jt,itemScope:Ke,itemType:jt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ke,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Ke,muted:Ke,name:null,nonce:null,noModule:Ke,noValidate:Ke,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:Ke,optimum:we,pattern:null,ping:jt,placeholder:null,playsInline:Ke,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ke,referrerPolicy:null,rel:jt,required:Ke,reversed:Ke,rows:we,rowSpan:we,sandbox:jt,scope:null,scoped:Ke,seamless:Ke,selected:Ke,shadowRootClonable:Ke,shadowRootDelegatesFocus:Ke,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:Xt,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:Ke,useMap:null,value:Xt,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:jt,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:Ke,declare:Ke,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Ke,noHref:Ke,noShade:Ke,noWrap:Ke,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:Xt,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:Ke,disableRemotePlayback:Ke,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:Dx}),Pk=va({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:Ln,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:jt,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:Ke,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:ca,g2:ca,glyphName:ca,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:Ln,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:jt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ln,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ln,rev:Ln,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ln,requiredFeatures:Ln,requiredFonts:Ln,requiredFormats:Ln,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:Ln,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:Ln,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:Ln,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:Mx}),Lx=va({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),zx=va({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Dx}),Ux=va({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),qk={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"},Hk=/[A-Z]/g,$0=/-[a-z]/g,Ik=/^data[-\w.:]+$/i;function Fk(e,n){const r=dd(n);let s=n,l=Cn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Ik.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace($0,Yk);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!$0.test(u)){let c=u.replace(Hk,$k);c.charAt(0)!=="-"&&(c="-"+c),n="data"+c}}l=qd}return new l(s,n)}function $k(e){return"-"+e.toLowerCase()}function Yk(e){return e.charAt(1).toUpperCase()}const Gk=Ox([Rx,Bk,Lx,zx,Ux],"html"),Hd=Ox([Rx,Pk,Lx,zx,Ux],"svg");function Vk(e){return e.join(" ").trim()}var Qs={},Mh,Y0;function Jk(){if(Y0)return Mh;Y0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
93
|
-
`,d="/",y="*",g="",b="comment",w="declaration";function k(U,M){if(typeof U!="string")throw new TypeError("First argument must be a string");if(!U)return[];M=M||{};var q=1,H=1;function ae(J){var Q=J.match(n);Q&&(q+=Q.length);var P=J.lastIndexOf(m);H=~P?J.length-P:H+J.length}function B(){var J={line:q,column:H};return function(Q){return Q.position=new z(J),$(),Q}}function z(J){this.start=J,this.end={line:q,column:H},this.source=M.source}z.prototype.content=U;function V(J){var Q=new Error(M.source+":"+q+":"+H+": "+J);if(Q.reason=J,Q.filename=M.source,Q.line=q,Q.column=H,Q.source=U,!M.silent)throw Q}function Y(J){var Q=J.exec(U);if(Q){var P=Q[0];return ae(P),U=U.slice(P.length),Q}}function $(){Y(r)}function O(J){var Q;for(J=J||[];Q=W();)Q!==!1&&J.push(Q);return J}function W(){var J=B();if(!(d!=U.charAt(0)||y!=U.charAt(1))){for(var Q=2;g!=U.charAt(Q)&&(y!=U.charAt(Q)||d!=U.charAt(Q+1));)++Q;if(Q+=2,g===U.charAt(Q-1))return V("End of comment missing");var P=U.slice(2,Q-2);return H+=2,ae(P),U=U.slice(Q),H+=2,J({type:b,comment:P})}}function Z(){var J=B(),Q=Y(s);if(Q){if(W(),!Y(l))return V("property missing ':'");var P=Y(u),se=J({type:w,property:D(Q[0].replace(e,g)),value:P?D(P[0].replace(e,g)):g});return Y(c),se}}function fe(){var J=[];O(J);for(var Q;Q=Z();)Q!==!1&&(J.push(Q),O(J));return J}return $(),fe()}function D(U){return U?U.replace(f,g):g}return Mh=k,Mh}var G0;function Xk(){if(G0)return Qs;G0=1;var e=Qs&&Qs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.default=r;const n=e(Jk());function r(s,l){let u=null;if(!s||typeof s!="string")return u;const c=(0,n.default)(s),f=typeof l=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:d,value:y}=m;f?l(d,y,m):y&&(u=u||{},u[d]=y)}),u}return Qs}var yl={},V0;function Kk(){if(V0)return yl;V0=1,Object.defineProperty(yl,"__esModule",{value:!0}),yl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(d){return!d||r.test(d)||e.test(d)},c=function(d,y){return y.toUpperCase()},f=function(d,y){return"".concat(y,"-")},m=function(d,y){return y===void 0&&(y={}),u(d)?d:(d=d.toLowerCase(),y.reactCompat?d=d.replace(l,f):d=d.replace(s,f),d.replace(n,c))};return yl.camelCase=m,yl}var bl,J0;function Qk(){if(J0)return bl;J0=1;var e=bl&&bl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},n=e(Xk()),r=Kk();function s(l,u){var c={};return!l||typeof l!="string"||(0,n.default)(l,function(f,m){f&&m&&(c[(0,r.camelCase)(f,u)]=m)}),c}return s.default=s,bl=s,bl}var Zk=Qk();const Wk=Mb(Zk),Bx=Px("end"),Id=Px("start");function Px(e){return n;function n(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 eC(e){const n=Id(e),r=Bx(e);if(n&&r)return{start:n,end:r}}function jl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?X0(e.position):"start"in e||"end"in e?X0(e):"line"in e||"column"in e?gd(e):""}function gd(e){return K0(e&&e.line)+":"+K0(e&&e.column)}function X0(e){return gd(e&&e.start)+"-"+gd(e&&e.end)}function K0(e){return e&&typeof e=="number"?e:1}class cn extends Error{constructor(n,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 n=="string"?l=n:!u.cause&&n&&(c=!0,l=n.message,u.cause=n),!u.ruleId&&!u.source&&typeof s=="string"){const m=s.indexOf(":");m===-1?u.ruleId=s:(u.source=s.slice(0,m),u.ruleId=s.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.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=jl(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}}cn.prototype.file="";cn.prototype.name="";cn.prototype.reason="";cn.prototype.message="";cn.prototype.stack="";cn.prototype.column=void 0;cn.prototype.line=void 0;cn.prototype.ancestors=void 0;cn.prototype.cause=void 0;cn.prototype.fatal=void 0;cn.prototype.place=void 0;cn.prototype.ruleId=void 0;cn.prototype.source=void 0;const Fd={}.hasOwnProperty,tC=new Map,nC=/[A-Z]/g,rC=new Set(["table","tbody","thead","tfoot","tr"]),iC=new Set(["td","th"]),qx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function sC(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let s;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=dC(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=hC(r,n.jsx,n.jsxs)}const l={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:s,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Hd:Gk,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=Hx(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function Hx(e,n,r){if(n.type==="element")return aC(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return lC(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return uC(e,n,r);if(n.type==="mdxjsEsm")return oC(e,n);if(n.type==="root")return cC(e,n,r);if(n.type==="text")return fC(e,n)}function aC(e,n,r){const s=e.schema;let l=s;n.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Hd,e.schema=l),e.ancestors.push(n);const u=Fx(e,n.tagName,!1),c=mC(e,n);let f=Yd(e,n);return rC.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!zk(m):!0})),Ix(e,c,u,n),$d(c,f),e.ancestors.pop(),e.schema=s,e.create(n,u,c,r)}function lC(e,n){if(n.data&&n.data.estree&&e.evaluater){const s=n.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Ul(e,n.position)}function oC(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Ul(e,n.position)}function uC(e,n,r){const s=e.schema;let l=s;n.name==="svg"&&s.space==="html"&&(l=Hd,e.schema=l),e.ancestors.push(n);const u=n.name===null?e.Fragment:Fx(e,n.name,!0),c=pC(e,n),f=Yd(e,n);return Ix(e,c,u,n),$d(c,f),e.ancestors.pop(),e.schema=s,e.create(n,u,c,r)}function cC(e,n,r){const s={};return $d(s,Yd(e,n)),e.create(n,e.Fragment,s,r)}function fC(e,n){return n.value}function Ix(e,n,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=s)}function $d(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function hC(e,n,r){return s;function s(l,u,c,f){const d=Array.isArray(c.children)?r:n;return f?d(u,c,f):d(u,c)}}function dC(e,n){return r;function r(s,l,u,c){const f=Array.isArray(u.children),m=Id(s);return n(l,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function mC(e,n){const r={};let s,l;for(l in n.properties)if(l!=="children"&&Fd.call(n.properties,l)){const u=gC(e,l,n.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&iC.has(n.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 pC(e,n){const r={};for(const s of n.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 Ul(e,n.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 Ul(e,n.position);else u=s.value===null?!0:s.value;r[l]=u}return r}function Yd(e,n){const r=[];let s=-1;const l=e.passKeys?new Map:tC;for(;++s<n.children.length;){const u=n.children[s];let c;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const d=l.get(m)||0;c=m+"-"+d,l.set(m,d+1)}}const f=Hx(e,u,c);f!==void 0&&r.push(f)}return r}function gC(e,n,r){const s=Fk(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?Ok(r):Vk(r)),s.property==="style"){let l=typeof r=="object"?r:yC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=bC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?qk[s.property]||s.property:s.attribute,r]}}function yC(e,n){try{return Wk(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new cn("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=qx+"#cannot-parse-style-attribute",l}}function Fx(e,n,r){let s;if(!r)s={type:"Literal",value:n};else if(n.includes(".")){const l=n.split(".");let u=-1,c;for(;++u<l.length;){const f=H0(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=H0(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(s.type==="Literal"){const l=s.value;return Fd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);Ul(e)}function Ul(e,n){const r=new cn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=qx+"#cannot-handle-mdx-estrees-without-createevaluater",r}function bC(e){const n={};let r;for(r in e)Fd.call(e,r)&&(n[xC(r)]=e[r]);return n}function xC(e){let n=e.replace(nC,vC);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function vC(e){return"-"+e.toLowerCase()}const Dh={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"]},wC={};function Gd(e,n){const r=wC,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return $x(e,s,l)}function $x(e,n,r){if(SC(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Q0(e.children,n,r)}return Array.isArray(e)?Q0(e,n,r):""}function Q0(e,n,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=$x(e[l],n,r);return s.join("")}function SC(e){return!!(e&&typeof e=="object")}const Z0=document.createElement("i");function Vd(e){const n="&"+e+";";Z0.innerHTML=n;const r=Z0.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function qn(e,n,r,s){const l=e.length;let u=0,c;if(n<0?n=-n>l?0:l+n:n=n>l?l:n,r=r>0?r:0,s.length<1e4)c=Array.from(s),c.unshift(n,r),e.splice(...c);else for(r&&e.splice(n,r);u<s.length;)c=s.slice(u,u+1e4),c.unshift(n,0),e.splice(...c),u+=1e4,n+=1e4}function tr(e,n){return e.length>0?(qn(e,e.length,0,n),e):n}const W0={}.hasOwnProperty;function Yx(e){const n={};let r=-1;for(;++r<e.length;)_C(n,e[r]);return n}function _C(e,n){let r;for(r in n){const l=(W0.call(e,r)?e[r]:void 0)||(e[r]={}),u=n[r];let c;if(u)for(c in u){W0.call(l,c)||(l[c]=[]);const f=u[c];EC(l[c],Array.isArray(f)?f:f?[f]:[])}}}function EC(e,n){let r=-1;const s=[];for(;++r<n.length;)(n[r].add==="after"?e:s).push(n[r]);qn(e,0,0,s)}function Gx(e,n){const r=Number.parseInt(e,n);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function dr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const yn=Bi(/[A-Za-z]/),un=Bi(/[\dA-Za-z]/),kC=Bi(/[#-'*+\--9=?A-Z^-~]/);function Uu(e){return e!==null&&(e<32||e===127)}const yd=Bi(/\d/),CC=Bi(/[\dA-Fa-f]/),AC=Bi(/[!-/:-@[-`{-~]/);function Ie(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 Xu=Bi(new RegExp("\\p{P}|\\p{S}","u")),hs=Bi(/\s/);function Bi(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function wa(e){const n=[];let r=-1,s=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&un(e.charCodeAt(r+1))&&un(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&&(n.push(e.slice(s,r),encodeURIComponent(c)),s=r+l+1,c=""),l&&(r+=l,l=0)}return n.join("")+e.slice(s)}function ot(e,n,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return nt(m)?(e.enter(r),f(m)):n(m)}function f(m){return nt(m)&&u++<l?(e.consume(m),f):(e.exit(r),n(m))}}const TC={tokenize:jC};function jC(e){const n=e.attempt(this.parser.constructs.contentInitial,s,l);let r;return n;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ot(e,n,"linePrefix")}function l(f){return e.enter("paragraph"),u(f)}function u(f){const m=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Ie(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const NC={tokenize:OC},eb={tokenize:RC};function OC(e){const n=this,r=[];let s=0,l,u,c;return f;function f(H){if(s<r.length){const ae=r[s];return n.containerState=ae[1],e.attempt(ae[0].continuation,m,d)(H)}return d(H)}function m(H){if(s++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,l&&q();const ae=n.events.length;let B=ae,z;for(;B--;)if(n.events[B][0]==="exit"&&n.events[B][1].type==="chunkFlow"){z=n.events[B][1].end;break}M(s);let V=ae;for(;V<n.events.length;)n.events[V][1].end={...z},V++;return qn(n.events,B+1,0,n.events.slice(ae)),n.events.length=V,d(H)}return f(H)}function d(H){if(s===r.length){if(!l)return b(H);if(l.currentConstruct&&l.currentConstruct.concrete)return k(H);n.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(eb,y,g)(H)}function y(H){return l&&q(),M(s),b(H)}function g(H){return n.parser.lazy[n.now().line]=s!==r.length,c=n.now().offset,k(H)}function b(H){return n.containerState={},e.attempt(eb,w,k)(H)}function w(H){return s++,r.push([n.currentConstruct,n.containerState]),b(H)}function k(H){if(H===null){l&&q(),M(0),e.consume(H);return}return l=l||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),D(H)}function D(H){if(H===null){U(e.exit("chunkFlow"),!0),M(0),e.consume(H);return}return Ie(H)?(e.consume(H),U(e.exit("chunkFlow")),s=0,n.interrupt=void 0,f):(e.consume(H),D)}function U(H,ae){const B=n.sliceStream(H);if(ae&&B.push(null),H.previous=u,u&&(u.next=H),u=H,l.defineSkip(H.start),l.write(B),n.parser.lazy[H.start.line]){let z=l.events.length;for(;z--;)if(l.events[z][1].start.offset<c&&(!l.events[z][1].end||l.events[z][1].end.offset>c))return;const V=n.events.length;let Y=V,$,O;for(;Y--;)if(n.events[Y][0]==="exit"&&n.events[Y][1].type==="chunkFlow"){if($){O=n.events[Y][1].end;break}$=!0}for(M(s),z=V;z<n.events.length;)n.events[z][1].end={...O},z++;qn(n.events,Y+1,0,n.events.slice(V)),n.events.length=z}}function M(H){let ae=r.length;for(;ae-- >H;){const B=r[ae];n.containerState=B[1],B[0].exit.call(n,e)}r.length=H}function q(){l.write([null]),u=void 0,l=void 0,n.containerState._closeFlow=void 0}}function RC(e,n,r){return ot(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function pa(e){if(e===null||Tt(e)||hs(e))return 1;if(Xu(e))return 2}function Ku(e,n,r){const s=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!s.includes(u)&&(n=u(n,r),s.push(u))}return n}const bd={name:"attention",resolveAll:MC,tokenize:DC};function MC(e,n){let r=-1,s,l,u,c,f,m,d,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&&n.sliceSerialize(e[s][1]).charCodeAt(0)===n.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;m=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},b={...e[r][1].start};tb(g,-m),tb(b,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:b},u={type:m>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[r][1].start={...f.end},d=[],e[s][1].end.offset-e[s][1].start.offset&&(d=tr(d,[["enter",e[s][1],n],["exit",e[s][1],n]])),d=tr(d,[["enter",l,n],["enter",c,n],["exit",c,n],["enter",u,n]]),d=tr(d,Ku(n.parser.constructs.insideSpan.null,e.slice(s+1,r),n)),d=tr(d,[["exit",u,n],["enter",f,n],["exit",f,n],["exit",l,n]]),e[r][1].end.offset-e[r][1].start.offset?(y=2,d=tr(d,[["enter",e[r][1],n],["exit",e[r][1],n]])):y=0,qn(e,s-1,r-s+3,d),r=s+d.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function DC(e,n){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=pa(s);let u;return c;function c(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const d=e.exit("attentionSequence"),y=pa(m),g=!y||y===2&&l||r.includes(m),b=!l||l===2&&y||r.includes(s);return d._open=!!(u===42?g:g&&(l||!b)),d._close=!!(u===42?b:b&&(y||!g)),n(m)}}function tb(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const LC={name:"autolink",tokenize:zC};function zC(e,n,r){let s=0;return l;function l(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(w){return yn(w)?(e.consume(w),c):w===64?r(w):d(w)}function c(w){return w===43||w===45||w===46||un(w)?(s=1,f(w)):d(w)}function f(w){return w===58?(e.consume(w),s=0,m):(w===43||w===45||w===46||un(w))&&s++<32?(e.consume(w),f):(s=0,d(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):w===null||w===32||w===60||Uu(w)?r(w):(e.consume(w),m)}function d(w){return w===64?(e.consume(w),y):kC(w)?(e.consume(w),d):r(w)}function y(w){return un(w)?g(w):r(w)}function g(w){return w===46?(e.consume(w),s=0,y):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):b(w)}function b(w){if((w===45||un(w))&&s++<63){const k=w===45?b:g;return e.consume(w),k}return r(w)}}const Gl={partial:!0,tokenize:UC};function UC(e,n,r){return s;function s(u){return nt(u)?ot(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Ie(u)?n(u):r(u)}}const Vx={continuation:{tokenize:PC},exit:qC,name:"blockQuote",tokenize:BC};function BC(e,n,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"),n):(e.exit("blockQuotePrefix"),n(c))}}function PC(e,n,r){const s=this;return l;function l(c){return nt(c)?ot(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(Vx,n,r)(c)}}function qC(e){e.exit("blockQuote")}const Jx={name:"characterEscape",tokenize:HC};function HC(e,n,r){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return AC(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(u)}}const Xx={name:"characterReference",tokenize:IC};function IC(e,n,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"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),u=31,c=un,y(g))}function d(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=CC,y):(e.enter("characterReferenceValue"),u=7,c=yd,y(g))}function y(g){if(g===59&&l){const b=e.exit("characterReferenceValue");return c===un&&!Vd(s.sliceSerialize(b))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return c(g)&&l++<u?(e.consume(g),y):r(g)}}const nb={partial:!0,tokenize:$C},rb={concrete:!0,name:"codeFenced",tokenize:FC};function FC(e,n,r){const s=this,l={partial:!0,tokenize:B};let u=0,c=0,f;return m;function m(z){return d(z)}function d(z){const V=s.events[s.events.length-1];return u=V&&V[1].type==="linePrefix"?V[2].sliceSerialize(V[1],!0).length:0,f=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(z)}function y(z){return z===f?(c++,e.consume(z),y):c<3?r(z):(e.exit("codeFencedFenceSequence"),nt(z)?ot(e,g,"whitespace")(z):g(z))}function g(z){return z===null||Ie(z)?(e.exit("codeFencedFence"),s.interrupt?n(z):e.check(nb,D,ae)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(z))}function b(z){return z===null||Ie(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(z)):nt(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ot(e,w,"whitespace")(z)):z===96&&z===f?r(z):(e.consume(z),b)}function w(z){return z===null||Ie(z)?g(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(z))}function k(z){return z===null||Ie(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(z)):z===96&&z===f?r(z):(e.consume(z),k)}function D(z){return e.attempt(l,ae,U)(z)}function U(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),M}function M(z){return u>0&&nt(z)?ot(e,q,"linePrefix",u+1)(z):q(z)}function q(z){return z===null||Ie(z)?e.check(nb,D,ae)(z):(e.enter("codeFlowValue"),H(z))}function H(z){return z===null||Ie(z)?(e.exit("codeFlowValue"),q(z)):(e.consume(z),H)}function ae(z){return e.exit("codeFenced"),n(z)}function B(z,V,Y){let $=0;return O;function O(Q){return z.enter("lineEnding"),z.consume(Q),z.exit("lineEnding"),W}function W(Q){return z.enter("codeFencedFence"),nt(Q)?ot(z,Z,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Q):Z(Q)}function Z(Q){return Q===f?(z.enter("codeFencedFenceSequence"),fe(Q)):Y(Q)}function fe(Q){return Q===f?($++,z.consume(Q),fe):$>=c?(z.exit("codeFencedFenceSequence"),nt(Q)?ot(z,J,"whitespace")(Q):J(Q)):Y(Q)}function J(Q){return Q===null||Ie(Q)?(z.exit("codeFencedFence"),V(Q)):Y(Q)}}}function $C(e,n,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):n(c)}}const Lh={name:"codeIndented",tokenize:GC},YC={partial:!0,tokenize:VC};function GC(e,n,r){const s=this;return l;function l(d){return e.enter("codeIndented"),ot(e,u,"linePrefix",5)(d)}function u(d){const y=s.events[s.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?c(d):r(d)}function c(d){return d===null?m(d):Ie(d)?e.attempt(YC,c,m)(d):(e.enter("codeFlowValue"),f(d))}function f(d){return d===null||Ie(d)?(e.exit("codeFlowValue"),c(d)):(e.consume(d),f)}function m(d){return e.exit("codeIndented"),n(d)}}function VC(e,n,r){const s=this;return l;function l(c){return s.parser.lazy[s.now().line]?r(c):Ie(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):ot(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?n(c):Ie(c)?l(c):r(c)}}const JC={name:"codeText",previous:KC,resolve:XC,tokenize:QC};function XC(e){let n=e.length-4,r=3,s,l;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(s=r;++s<n;)if(e[s][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(s=r-1,n++;++s<=n;)l===void 0?s!==n&&e[s][1].type!=="lineEnding"&&(l=s):(s===n||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),n-=s-l-2,s=l+2),l=void 0);return e}function KC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function QC(e,n,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"),m(g))}function m(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(u=e.enter("codeTextSequence"),l=0,y(g)):Ie(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),d(g))}function d(g){return g===null||g===32||g===96||Ie(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),d)}function y(g){return g===96?(e.consume(g),l++,y):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),n(g)):(u.type="codeTextData",d(g))}}class ZC{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const s=r??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(n,s):n>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(n,r,s){const l=r||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&xl(this.left,s),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),xl(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),xl(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const r=this.left.splice(n,Number.POSITIVE_INFINITY);xl(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);xl(this.left,r.reverse())}}}function xl(e,n){let r=0;if(n.length<1e4)e.push(...n);else for(;r<n.length;)e.push(...n.slice(r,r+1e4)),r+=1e4}function Kx(e){const n={};let r=-1,s,l,u,c,f,m,d;const y=new ZC(e);for(;++r<y.length;){for(;r in n;)r=n[r];if(s=y.get(r),r&&s[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(m=s[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(n,WC(y,r)),r=n[r],d=!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)),!d}function WC(e,n){const r=e.get(n)[1],s=e.get(n)[2];let l=n-1;const u=[];let c=r._tokenizer;c||(c=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],d={};let y,g,b=-1,w=r,k=0,D=0;const U=[D];for(;w;){for(;e.get(++l)[1]!==w;);u.push(l),w._tokenizer||(y=s.sliceStream(w),w.next||y.push(null),g&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=w,w=w.next}for(w=r;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(D=b+1,U.push(D),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(c.events=[],w?(w._tokenizer=void 0,w.previous=void 0):U.pop(),b=U.length;b--;){const M=f.slice(U[b],U[b+1]),q=u.pop();m.push([q,q+M.length-1]),e.splice(q,2,M)}for(m.reverse(),b=-1;++b<m.length;)d[k+m[b][0]]=k+m[b][1],k+=m[b][1]-m[b][0]-1;return d}const eA={resolve:nA,tokenize:rA},tA={partial:!0,tokenize:iA};function nA(e){return Kx(e),e}function rA(e,n){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):Ie(f)?e.check(tA,c,u)(f):(e.consume(f),l)}function u(f){return e.exit("chunkContent"),e.exit("content"),n(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 iA(e,n,r){const s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),ot(e,u,"linePrefix")}function u(c){if(c===null||Ie(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?n(c):e.interrupt(s.parser.constructs.flow,r,n)(c)}}function Qx(e,n,r,s,l,u,c,f,m){const d=m||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),b):M===null||M===32||M===41||Uu(M)?r(M):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),D(M))}function b(M){return M===62?(e.enter(u),e.consume(M),e.exit(u),e.exit(l),e.exit(s),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(M))}function w(M){return M===62?(e.exit("chunkString"),e.exit(f),b(M)):M===null||M===60||Ie(M)?r(M):(e.consume(M),M===92?k:w)}function k(M){return M===60||M===62||M===92?(e.consume(M),w):w(M)}function D(M){return!y&&(M===null||M===41||Tt(M))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),n(M)):y<d&&M===40?(e.consume(M),y++,D):M===41?(e.consume(M),y--,D):M===null||M===32||M===40||Uu(M)?r(M):(e.consume(M),M===92?U:D)}function U(M){return M===40||M===41||M===92?(e.consume(M),D):D(M)}}function Zx(e,n,r,s,l,u){const c=this;let f=0,m;return d;function d(w){return e.enter(s),e.enter(l),e.consume(w),e.exit(l),e.enter(u),y}function y(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(w):w===93?(e.exit(u),e.enter(l),e.consume(w),e.exit(l),e.exit(s),n):Ie(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||w===91||w===93||Ie(w)||f++>999?(e.exit("chunkString"),y(w)):(e.consume(w),m||(m=!nt(w)),w===92?b:g)}function b(w){return w===91||w===92||w===93?(e.consume(w),f++,g):g(w)}}function Wx(e,n,r,s,l,u){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(s),e.enter(l),e.consume(b),e.exit(l),c=b===40?41:b,m):r(b)}function m(b){return b===c?(e.enter(l),e.consume(b),e.exit(l),e.exit(s),n):(e.enter(u),d(b))}function d(b){return b===c?(e.exit(u),m(c)):b===null?r(b):Ie(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),ot(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===c||b===null||Ie(b)?(e.exit("chunkString"),d(b)):(e.consume(b),b===92?g:y)}function g(b){return b===c||b===92?(e.consume(b),y):y(b)}}function Nl(e,n){let r;return s;function s(l){return Ie(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):nt(l)?ot(e,s,r?"linePrefix":"lineSuffix")(l):n(l)}}const sA={name:"definition",tokenize:lA},aA={partial:!0,tokenize:oA};function lA(e,n,r){const s=this;let l;return u;function u(w){return e.enter("definition"),c(w)}function c(w){return Zx.call(s,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return l=dr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):r(w)}function m(w){return Tt(w)?Nl(e,d)(w):d(w)}function d(w){return Qx(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function y(w){return e.attempt(aA,g,g)(w)}function g(w){return nt(w)?ot(e,b,"whitespace")(w):b(w)}function b(w){return w===null||Ie(w)?(e.exit("definition"),s.parser.defined.push(l),n(w)):r(w)}}function oA(e,n,r){return s;function s(f){return Tt(f)?Nl(e,l)(f):r(f)}function l(f){return Wx(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return nt(f)?ot(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Ie(f)?n(f):r(f)}}const uA={name:"hardBreakEscape",tokenize:cA};function cA(e,n,r){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Ie(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const fA={name:"headingAtx",resolve:hA,tokenize:dA};function hA(e,n){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,n],["enter",u,n],["exit",u,n],["exit",l,n]])),e}function dA(e,n,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"),m(y)):y===null||Ie(y)?(e.exit("atxHeading"),n(y)):nt(y)?ot(e,f,"whitespace")(y):(e.enter("atxHeadingText"),d(y))}function m(y){return y===35?(e.consume(y),m):(e.exit("atxHeadingSequence"),f(y))}function d(y){return y===null||y===35||Tt(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),d)}}const mA=["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"],ib=["pre","script","style","textarea"],pA={concrete:!0,name:"htmlFlow",resolveTo:bA,tokenize:xA},gA={partial:!0,tokenize:wA},yA={partial:!0,tokenize:vA};function bA(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function xA(e,n,r){const s=this;let l,u,c,f,m;return d;function d(A){return y(A)}function y(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),g}function g(A){return A===33?(e.consume(A),b):A===47?(e.consume(A),u=!0,D):A===63?(e.consume(A),l=3,s.interrupt?n:_):yn(A)?(e.consume(A),c=String.fromCharCode(A),U):r(A)}function b(A){return A===45?(e.consume(A),l=2,w):A===91?(e.consume(A),l=5,f=0,k):yn(A)?(e.consume(A),l=4,s.interrupt?n:_):r(A)}function w(A){return A===45?(e.consume(A),s.interrupt?n:_):r(A)}function k(A){const ve="CDATA[";return A===ve.charCodeAt(f++)?(e.consume(A),f===ve.length?s.interrupt?n:Z:k):r(A)}function D(A){return yn(A)?(e.consume(A),c=String.fromCharCode(A),U):r(A)}function U(A){if(A===null||A===47||A===62||Tt(A)){const ve=A===47,Ne=c.toLowerCase();return!ve&&!u&&ib.includes(Ne)?(l=1,s.interrupt?n(A):Z(A)):mA.includes(c.toLowerCase())?(l=6,ve?(e.consume(A),M):s.interrupt?n(A):Z(A)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(A):u?q(A):H(A))}return A===45||un(A)?(e.consume(A),c+=String.fromCharCode(A),U):r(A)}function M(A){return A===62?(e.consume(A),s.interrupt?n:Z):r(A)}function q(A){return nt(A)?(e.consume(A),q):O(A)}function H(A){return A===47?(e.consume(A),O):A===58||A===95||yn(A)?(e.consume(A),ae):nt(A)?(e.consume(A),H):O(A)}function ae(A){return A===45||A===46||A===58||A===95||un(A)?(e.consume(A),ae):B(A)}function B(A){return A===61?(e.consume(A),z):nt(A)?(e.consume(A),B):H(A)}function z(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),m=A,V):nt(A)?(e.consume(A),z):Y(A)}function V(A){return A===m?(e.consume(A),m=null,$):A===null||Ie(A)?r(A):(e.consume(A),V)}function Y(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Tt(A)?B(A):(e.consume(A),Y)}function $(A){return A===47||A===62||nt(A)?H(A):r(A)}function O(A){return A===62?(e.consume(A),W):r(A)}function W(A){return A===null||Ie(A)?Z(A):nt(A)?(e.consume(A),W):r(A)}function Z(A){return A===45&&l===2?(e.consume(A),P):A===60&&l===1?(e.consume(A),se):A===62&&l===4?(e.consume(A),R):A===63&&l===3?(e.consume(A),_):A===93&&l===5?(e.consume(A),_e):Ie(A)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(gA,ee,fe)(A)):A===null||Ie(A)?(e.exit("htmlFlowData"),fe(A)):(e.consume(A),Z)}function fe(A){return e.check(yA,J,ee)(A)}function J(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),Q}function Q(A){return A===null||Ie(A)?fe(A):(e.enter("htmlFlowData"),Z(A))}function P(A){return A===45?(e.consume(A),_):Z(A)}function se(A){return A===47?(e.consume(A),c="",ye):Z(A)}function ye(A){if(A===62){const ve=c.toLowerCase();return ib.includes(ve)?(e.consume(A),R):Z(A)}return yn(A)&&c.length<8?(e.consume(A),c+=String.fromCharCode(A),ye):Z(A)}function _e(A){return A===93?(e.consume(A),_):Z(A)}function _(A){return A===62?(e.consume(A),R):A===45&&l===2?(e.consume(A),_):Z(A)}function R(A){return A===null||Ie(A)?(e.exit("htmlFlowData"),ee(A)):(e.consume(A),R)}function ee(A){return e.exit("htmlFlow"),n(A)}}function vA(e,n,r){const s=this;return l;function l(c){return Ie(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):n(c)}}function wA(e,n,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Gl,n,r)}}const SA={name:"htmlText",tokenize:_A};function _A(e,n,r){const s=this;let l,u,c;return f;function f(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),m}function m(_){return _===33?(e.consume(_),d):_===47?(e.consume(_),B):_===63?(e.consume(_),H):yn(_)?(e.consume(_),Y):r(_)}function d(_){return _===45?(e.consume(_),y):_===91?(e.consume(_),u=0,k):yn(_)?(e.consume(_),q):r(_)}function y(_){return _===45?(e.consume(_),w):r(_)}function g(_){return _===null?r(_):_===45?(e.consume(_),b):Ie(_)?(c=g,se(_)):(e.consume(_),g)}function b(_){return _===45?(e.consume(_),w):g(_)}function w(_){return _===62?P(_):_===45?b(_):g(_)}function k(_){const R="CDATA[";return _===R.charCodeAt(u++)?(e.consume(_),u===R.length?D:k):r(_)}function D(_){return _===null?r(_):_===93?(e.consume(_),U):Ie(_)?(c=D,se(_)):(e.consume(_),D)}function U(_){return _===93?(e.consume(_),M):D(_)}function M(_){return _===62?P(_):_===93?(e.consume(_),M):D(_)}function q(_){return _===null||_===62?P(_):Ie(_)?(c=q,se(_)):(e.consume(_),q)}function H(_){return _===null?r(_):_===63?(e.consume(_),ae):Ie(_)?(c=H,se(_)):(e.consume(_),H)}function ae(_){return _===62?P(_):H(_)}function B(_){return yn(_)?(e.consume(_),z):r(_)}function z(_){return _===45||un(_)?(e.consume(_),z):V(_)}function V(_){return Ie(_)?(c=V,se(_)):nt(_)?(e.consume(_),V):P(_)}function Y(_){return _===45||un(_)?(e.consume(_),Y):_===47||_===62||Tt(_)?$(_):r(_)}function $(_){return _===47?(e.consume(_),P):_===58||_===95||yn(_)?(e.consume(_),O):Ie(_)?(c=$,se(_)):nt(_)?(e.consume(_),$):P(_)}function O(_){return _===45||_===46||_===58||_===95||un(_)?(e.consume(_),O):W(_)}function W(_){return _===61?(e.consume(_),Z):Ie(_)?(c=W,se(_)):nt(_)?(e.consume(_),W):$(_)}function Z(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(e.consume(_),l=_,fe):Ie(_)?(c=Z,se(_)):nt(_)?(e.consume(_),Z):(e.consume(_),J)}function fe(_){return _===l?(e.consume(_),l=void 0,Q):_===null?r(_):Ie(_)?(c=fe,se(_)):(e.consume(_),fe)}function J(_){return _===null||_===34||_===39||_===60||_===61||_===96?r(_):_===47||_===62||Tt(_)?$(_):(e.consume(_),J)}function Q(_){return _===47||_===62||Tt(_)?$(_):r(_)}function P(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),n):r(_)}function se(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),ye}function ye(_){return nt(_)?ot(e,_e,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):_e(_)}function _e(_){return e.enter("htmlTextData"),c(_)}}const Jd={name:"labelEnd",resolveAll:AA,resolveTo:TA,tokenize:jA},EA={tokenize:NA},kA={tokenize:OA},CA={tokenize:RA};function AA(e){let n=-1;const r=[];for(;++n<e.length;){const s=e[n][1];if(r.push(e[n]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const l=s.type==="labelImage"?4:2;s.type="data",n+=l}}return e.length!==r.length&&qn(e,0,e.length,r),e}function TA(e,n){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 m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},d={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",m,n],["enter",d,n]],f=tr(f,e.slice(u+1,u+s+3)),f=tr(f,[["enter",y,n]]),f=tr(f,Ku(n.parser.constructs.insideSpan.null,e.slice(u+s+4,c-3),n)),f=tr(f,[["exit",y,n],e[c-2],e[c-1],["exit",d,n]]),f=tr(f,e.slice(c+1)),f=tr(f,[["exit",m,n]]),qn(e,u,e.length,f),e}function jA(e,n,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(b){return u?u._inactive?g(b):(c=s.parser.defined.includes(dr(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),m):r(b)}function m(b){return b===40?e.attempt(EA,y,c?y:g)(b):b===91?e.attempt(kA,y,c?d:g)(b):c?y(b):g(b)}function d(b){return e.attempt(CA,y,g)(b)}function y(b){return n(b)}function g(b){return u._balanced=!0,r(b)}}function NA(e,n,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)?Nl(e,u)(g):u(g)}function u(g){return g===41?y(g):Qx(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Tt(g)?Nl(e,m)(g):y(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?Wx(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function d(g){return Tt(g)?Nl(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),n):r(g)}}function OA(e,n,r){const s=this;return l;function l(f){return Zx.call(s,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return s.parser.defined.includes(dr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function c(f){return r(f)}}function RA(e,n,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"),n):r(u)}}const MA={name:"labelStartImage",resolveAll:Jd.resolveAll,tokenize:DA};function DA(e,n,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):n(f)}}const LA={name:"labelStartLink",resolveAll:Jd.resolveAll,tokenize:zA};function zA(e,n,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):n(c)}}const zh={name:"lineEnding",tokenize:UA};function UA(e,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ot(e,n,"linePrefix")}}const _u={name:"thematicBreak",tokenize:BA};function BA(e,n,r){let s=0,l;return u;function u(d){return e.enter("thematicBreak"),c(d)}function c(d){return l=d,f(d)}function f(d){return d===l?(e.enter("thematicBreakSequence"),m(d)):s>=3&&(d===null||Ie(d))?(e.exit("thematicBreak"),n(d)):r(d)}function m(d){return d===l?(e.consume(d),s++,m):(e.exit("thematicBreakSequence"),nt(d)?ot(e,f,"whitespace")(d):f(d))}}const kn={continuation:{tokenize:IA},exit:$A,name:"list",tokenize:HA},PA={partial:!0,tokenize:YA},qA={partial:!0,tokenize:FA};function HA(e,n,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(w){const k=s.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!s.containerState.marker||w===s.containerState.marker:yd(w)){if(s.containerState.type||(s.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(_u,r,d)(w):d(w);if(!s.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return r(w)}function m(w){return yd(w)&&++c<10?(e.consume(w),m):(!s.interrupt||c<2)&&(s.containerState.marker?w===s.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),d(w)):r(w)}function d(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||w,e.check(Gl,s.interrupt?r:y,e.attempt(PA,b,g))}function y(w){return s.containerState.initialBlankLine=!0,u++,b(w)}function g(w){return nt(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),b):r(w)}function b(w){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(w)}}function IA(e,n,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Gl,l,u);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ot(e,n,"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(qA,n,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,ot(e,e.attempt(kn,n,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function FA(e,n,r){const s=this;return ot(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?n(u):r(u)}}function $A(e){e.exit(this.containerState.type)}function YA(e,n,r){const s=this;return ot(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"?n(u):r(u)}}const sb={name:"setextUnderline",resolveTo:GA,tokenize:VA};function GA(e,n){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,n]),e.splice(u+1,0,["exit",e[s][1],n]),e[s][1].end={...e[u][1].end}):e[s][1]=c,e.push(["exit",c,n]),e}function VA(e,n,r){const s=this;let l;return u;function u(d){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=d,c(d)):r(d)}function c(d){return e.enter("setextHeadingLineSequence"),f(d)}function f(d){return d===l?(e.consume(d),f):(e.exit("setextHeadingLineSequence"),nt(d)?ot(e,m,"lineSuffix")(d):m(d))}function m(d){return d===null||Ie(d)?(e.exit("setextHeadingLine"),n(d)):r(d)}}const JA={tokenize:XA};function XA(e){const n=this,r=e.attempt(Gl,s,e.attempt(this.parser.constructs.flowInitial,l,ot(e,e.attempt(this.parser.constructs.flow,l,e.attempt(eA,l)),"linePrefix")));return r;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const KA={resolveAll:t1()},QA=e1("string"),ZA=e1("text");function e1(e){return{resolveAll:t1(e==="text"?WA:void 0),tokenize:n};function n(r){const s=this,l=this.parser.constructs[e],u=r.attempt(l,c,f);return c;function c(y){return d(y)?u(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),m}function m(y){return d(y)?(r.exit("data"),u(y)):(r.consume(y),m)}function d(y){if(y===null)return!0;const g=l[y];let b=-1;if(g)for(;++b<g.length;){const w=g[b];if(!w.previous||w.previous.call(s,s.previous))return!0}return!1}}}function t1(e){return n;function n(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 WA(e,n){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=n.sliceStream(s);let u=l.length,c=-1,f=0,m;for(;u--;){const d=l[u];if(typeof d=="string"){for(c=d.length;d.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(d===-2)m=!0,f++;else if(d!==-1){u++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(f=0),f){const d={type:r===e.length||m||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={...d.start},s.start.offset===s.end.offset?Object.assign(s,d):(e.splice(r,0,["enter",d,n],["exit",d,n]),r+=2)}r++}return e}const eT={42:kn,43:kn,45:kn,48:kn,49:kn,50:kn,51:kn,52:kn,53:kn,54:kn,55:kn,56:kn,57:kn,62:Vx},tT={91:sA},nT={[-2]:Lh,[-1]:Lh,32:Lh},rT={35:fA,42:_u,45:[sb,_u],60:pA,61:sb,95:_u,96:rb,126:rb},iT={38:Xx,92:Jx},sT={[-5]:zh,[-4]:zh,[-3]:zh,33:MA,38:Xx,42:bd,60:[LC,SA],91:LA,92:[uA,Jx],93:Jd,95:bd,96:JC},aT={null:[bd,KA]},lT={null:[42,95]},oT={null:[]},uT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:lT,contentInitial:tT,disable:oT,document:eT,flow:rT,flowInitial:nT,insideSpan:aT,string:iT,text:sT},Symbol.toStringTag,{value:"Module"}));function cT(e,n,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 m={attempt:V(B),check:V(z),consume:q,enter:H,exit:ae,interrupt:V(z,{interrupt:!0})},d={code:null,containerState:{},defineSkip:D,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:w,write:g};let y=n.tokenize.call(d,m);return n.resolveAll&&u.push(n),d;function g(W){return c=tr(c,W),U(),c[c.length-1]!==null?[]:(Y(n,0),d.events=Ku(u,d.events,d),d.events)}function b(W,Z){return hT(w(W),Z)}function w(W){return fT(c,W)}function k(){const{_bufferIndex:W,_index:Z,line:fe,column:J,offset:Q}=s;return{_bufferIndex:W,_index:Z,line:fe,column:J,offset:Q}}function D(W){l[W.line]=W.column,O()}function U(){let W;for(;s._index<c.length;){const Z=c[s._index];if(typeof Z=="string")for(W=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===W&&s._bufferIndex<Z.length;)M(Z.charCodeAt(s._bufferIndex));else M(Z)}}function M(W){y=y(W)}function q(W){Ie(W)?(s.line++,s.column=1,s.offset+=W===-3?2:1,O()):W!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),d.previous=W}function H(W,Z){const fe=Z||{};return fe.type=W,fe.start=k(),d.events.push(["enter",fe,d]),f.push(fe),fe}function ae(W){const Z=f.pop();return Z.end=k(),d.events.push(["exit",Z,d]),Z}function B(W,Z){Y(W,Z.from)}function z(W,Z){Z.restore()}function V(W,Z){return fe;function fe(J,Q,P){let se,ye,_e,_;return Array.isArray(J)?ee(J):"tokenize"in J?ee([J]):R(J);function R(je){return Ue;function Ue(Ye){const me=Ye!==null&&je[Ye],Le=Ye!==null&&je.null,be=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(Le)?Le:Le?[Le]:[]];return ee(be)(Ye)}}function ee(je){return se=je,ye=0,je.length===0?P:A(je[ye])}function A(je){return Ue;function Ue(Ye){return _=$(),_e=je,je.partial||(d.currentConstruct=je),je.name&&d.parser.constructs.disable.null.includes(je.name)?Ne():je.tokenize.call(Z?Object.assign(Object.create(d),Z):d,m,ve,Ne)(Ye)}}function ve(je){return W(_e,_),Q}function Ne(je){return _.restore(),++ye<se.length?A(se[ye]):P}}}function Y(W,Z){W.resolveAll&&!u.includes(W)&&u.push(W),W.resolve&&qn(d.events,Z,d.events.length-Z,W.resolve(d.events.slice(Z),d)),W.resolveTo&&(d.events=W.resolveTo(d.events,d))}function $(){const W=k(),Z=d.previous,fe=d.currentConstruct,J=d.events.length,Q=Array.from(f);return{from:J,restore:P};function P(){s=W,d.previous=Z,d.currentConstruct=fe,d.events.length=J,f=Q,O()}}function O(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function fT(e,n){const r=n.start._index,s=n.start._bufferIndex,l=n.end._index,u=n.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 hT(e,n){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
|
-
`;break}case-3:{c=`\r
|
|
95
|
-
`;break}case-2:{c=n?" ":" ";break}case-1:{if(!n&&l)continue;c=" ";break}default:c=String.fromCharCode(u)}l=u===-2,s.push(c)}return s.join("")}function dT(e){const s={constructs:Yx([uT,...(e||{}).extensions||[]]),content:l(TC),defined:[],document:l(NC),flow:l(JA),lazy:{},string:l(QA),text:l(ZA)};return s;function l(u){return c;function c(f){return cT(s,u,f)}}}function mT(e){for(;!Kx(e););return e}const ab=/[\0\t\n\r]/g;function pT(){let e=1,n="",r=!0,s;return l;function l(u,c,f){const m=[];let d,y,g,b,w;for(u=n+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),g=0,n="",r&&(u.charCodeAt(0)===65279&&g++,r=void 0);g<u.length;){if(ab.lastIndex=g,d=ab.exec(u),b=d&&d.index!==void 0?d.index:u.length,w=u.charCodeAt(b),!d){n=u.slice(g);break}if(w===10&&g===b&&s)m.push(-3),s=void 0;else switch(s&&(m.push(-5),s=void 0),g<b&&(m.push(u.slice(g,b)),e+=b-g),w){case 0:{m.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,m.push(-2);e++<y;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:s=!0,e=1}g=b+1}return f&&(s&&m.push(-5),n&&m.push(n),m.push(null)),m}}const gT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function yT(e){return e.replace(gT,bT)}function bT(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return Gx(r.slice(u?2:1),u?16:10)}return Vd(r)||e}const n1={}.hasOwnProperty;function xT(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),vT(r)(mT(dT(r).document().write(pT()(e,n,!0))))}function vT(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Ze),autolinkProtocol:$,autolinkEmail:$,atxHeading:u(Be),blockQuote:u(Le),characterEscape:$,characterReference:$,codeFenced:u(be),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(be,c),codeText:u(ze,c),codeTextData:$,data:$,codeFlowValue:$,definition:u(qe),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u($e),hardBreakEscape:u(He),hardBreakTrailing:u(He),htmlFlow:u(Qe,c),htmlFlowData:$,htmlText:u(Qe,c),htmlTextData:$,image:u(Et),label:c,link:u(Ze),listItem:u(Ge),listItemValue:b,listOrdered:u(Ht,g),listUnordered:u(Ht),paragraph:u(fn),reference:A,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(Be),strong:u(rr),thematicBreak:u(Pi)},exit:{atxHeading:m(),atxHeadingSequence:B,autolink:m(),autolinkEmail:me,autolinkProtocol:Ye,blockQuote:m(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:Ne,characterReferenceMarkerNumeric:Ne,characterReferenceValue:je,characterReference:Ue,codeFenced:m(U),codeFencedFence:D,codeFencedFenceInfo:w,codeFencedFenceMeta:k,codeFlowValue:O,codeIndented:m(M),codeText:m(Q),codeTextData:O,data:O,definition:m(),definitionDestinationString:ae,definitionLabelString:q,definitionTitleString:H,emphasis:m(),hardBreakEscape:m(Z),hardBreakTrailing:m(Z),htmlFlow:m(fe),htmlFlowData:O,htmlText:m(J),htmlTextData:O,image:m(se),label:_e,labelText:ye,lineEnding:W,link:m(P),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:ve,resourceDestinationString:_,resourceTitleString:R,resource:ee,setextHeading:m(Y),setextHeadingLineSequence:V,setextHeadingText:z,strong:m(),thematicBreak:m()}};r1(n,(e||{}).mdastExtensions||[]);const r={};return s;function s(ce){let Se={type:"root",children:[]};const oe={stack:[Se],tokenStack:[],config:n,enter:f,exit:d,buffer:c,resume:y,data:r},Te=[];let ke=-1;for(;++ke<ce.length;)if(ce[ke][1].type==="listOrdered"||ce[ke][1].type==="listUnordered")if(ce[ke][0]==="enter")Te.push(ke);else{const st=Te.pop();ke=l(ce,st,ke)}for(ke=-1;++ke<ce.length;){const st=n[ce[ke][0]];n1.call(st,ce[ke][1].type)&&st[ce[ke][1].type].call(Object.assign({sliceSerialize:ce[ke][2].sliceSerialize},oe),ce[ke][1])}if(oe.tokenStack.length>0){const st=oe.tokenStack[oe.tokenStack.length-1];(st[1]||lb).call(oe,void 0,st[0])}for(Se.position={start:ji(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:ji(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke<n.transforms.length;)Se=n.transforms[ke](Se)||Se;return Se}function l(ce,Se,oe){let Te=Se-1,ke=-1,st=!1,dt,at,kt,Kt;for(;++Te<=oe;){const mt=ce[Te];switch(mt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{mt[0]==="enter"?ke++:ke--,Kt=void 0;break}case"lineEndingBlank":{mt[0]==="enter"&&(dt&&!Kt&&!ke&&!kt&&(kt=Te),Kt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Kt=void 0}if(!ke&&mt[0]==="enter"&&mt[1].type==="listItemPrefix"||ke===-1&&mt[0]==="exit"&&(mt[1].type==="listUnordered"||mt[1].type==="listOrdered")){if(dt){let In=Te;for(at=void 0;In--;){const hn=ce[In];if(hn[1].type==="lineEnding"||hn[1].type==="lineEndingBlank"){if(hn[0]==="exit")continue;at&&(ce[at][1].type="lineEndingBlank",st=!0),hn[1].type="lineEnding",at=In}else if(!(hn[1].type==="linePrefix"||hn[1].type==="blockQuotePrefix"||hn[1].type==="blockQuotePrefixWhitespace"||hn[1].type==="blockQuoteMarker"||hn[1].type==="listItemIndent"))break}kt&&(!at||kt<at)&&(dt._spread=!0),dt.end=Object.assign({},at?ce[at][1].start:mt[1].end),ce.splice(at||Te,0,["exit",dt,mt[2]]),Te++,oe++}if(mt[1].type==="listItemPrefix"){const In={type:"listItem",_spread:!1,start:Object.assign({},mt[1].start),end:void 0};dt=In,ce.splice(Te,0,["enter",In,mt[2]]),Te++,oe++,kt=void 0,Kt=!0}}}return ce[Se][1]._spread=st,oe}function u(ce,Se){return oe;function oe(Te){f.call(this,ce(Te),Te),Se&&Se.call(this,Te)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ce,Se,oe){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([Se,oe||void 0]),ce.position={start:ji(Se.start),end:void 0}}function m(ce){return Se;function Se(oe){ce&&ce.call(this,oe),d.call(this,oe)}}function d(ce,Se){const oe=this.stack.pop(),Te=this.tokenStack.pop();if(Te)Te[0].type!==ce.type&&(Se?Se.call(this,ce,Te[0]):(Te[1]||lb).call(this,ce,Te[0]));else throw new Error("Cannot close `"+ce.type+"` ("+jl({start:ce.start,end:ce.end})+"): it’s not open");oe.position.end=ji(ce.end)}function y(){return Gd(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(ce){if(this.data.expectingFirstListItemValue){const Se=this.stack[this.stack.length-2];Se.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function w(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.lang=ce}function k(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.meta=ce}function D(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function U(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ce.replace(/(\r?\n|\r)$/g,"")}function q(ce){const Se=this.resume(),oe=this.stack[this.stack.length-1];oe.label=Se,oe.identifier=dr(this.sliceSerialize(ce)).toLowerCase()}function H(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ce}function ae(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ce}function B(ce){const Se=this.stack[this.stack.length-1];if(!Se.depth){const oe=this.sliceSerialize(ce).length;Se.depth=oe}}function z(){this.data.setextHeadingSlurpLineEnding=!0}function V(ce){const Se=this.stack[this.stack.length-1];Se.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function Y(){this.data.setextHeadingSlurpLineEnding=void 0}function $(ce){const oe=this.stack[this.stack.length-1].children;let Te=oe[oe.length-1];(!Te||Te.type!=="text")&&(Te=bt(),Te.position={start:ji(ce.start),end:void 0},oe.push(Te)),this.stack.push(Te)}function O(ce){const Se=this.stack.pop();Se.value+=this.sliceSerialize(ce),Se.position.end=ji(ce.end)}function W(ce){const Se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const oe=Se.children[Se.children.length-1];oe.position.end=ji(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(Se.type)&&($.call(this,ce),O.call(this,ce))}function Z(){this.data.atHardBreak=!0}function fe(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ce}function J(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ce}function Q(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ce}function P(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=Se,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function se(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=Se,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function ye(ce){const Se=this.sliceSerialize(ce),oe=this.stack[this.stack.length-2];oe.label=yT(Se),oe.identifier=dr(Se).toLowerCase()}function _e(){const ce=this.stack[this.stack.length-1],Se=this.resume(),oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,oe.type==="link"){const Te=ce.children;oe.children=Te}else oe.alt=Se}function _(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ce}function R(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ce}function ee(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ve(ce){const Se=this.resume(),oe=this.stack[this.stack.length-1];oe.label=Se,oe.identifier=dr(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function Ne(ce){this.data.characterReferenceType=ce.type}function je(ce){const Se=this.sliceSerialize(ce),oe=this.data.characterReferenceType;let Te;oe?(Te=Gx(Se,oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Te=Vd(Se);const ke=this.stack[this.stack.length-1];ke.value+=Te}function Ue(ce){const Se=this.stack.pop();Se.position.end=ji(ce.end)}function Ye(ce){O.call(this,ce);const Se=this.stack[this.stack.length-1];Se.url=this.sliceSerialize(ce)}function me(ce){O.call(this,ce);const Se=this.stack[this.stack.length-1];Se.url="mailto:"+this.sliceSerialize(ce)}function Le(){return{type:"blockquote",children:[]}}function be(){return{type:"code",lang:null,meta:null,value:""}}function ze(){return{type:"inlineCode",value:""}}function qe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function $e(){return{type:"emphasis",children:[]}}function Be(){return{type:"heading",depth:0,children:[]}}function He(){return{type:"break"}}function Qe(){return{type:"html",value:""}}function Et(){return{type:"image",title:null,url:"",alt:null}}function Ze(){return{type:"link",title:null,url:"",children:[]}}function Ht(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function Ge(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function fn(){return{type:"paragraph",children:[]}}function rr(){return{type:"strong",children:[]}}function bt(){return{type:"text",value:""}}function Pi(){return{type:"thematicBreak"}}}function ji(e){return{line:e.line,column:e.column,offset:e.offset}}function r1(e,n){let r=-1;for(;++r<n.length;){const s=n[r];Array.isArray(s)?r1(e,s):wT(e,s)}}function wT(e,n){let r;for(r in n)if(n1.call(n,r))switch(r){case"canContainEols":{const s=n[r];s&&e[r].push(...s);break}case"transforms":{const s=n[r];s&&e[r].push(...s);break}case"enter":case"exit":{const s=n[r];s&&Object.assign(e[r],s);break}}}function lb(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+jl({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+jl({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+jl({start:n.start,end:n.end})+") is still open")}function ST(e){const n=this;n.parser=r;function r(s){return xT(s,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function _T(e,n){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,r),e.applyData(n,r)}function ET(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
|
|
96
|
-
`}]}function kT(e,n){const r=n.value?n.value+`
|
|
97
|
-
`:"",s={},l=n.lang?n.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 n.meta&&(u.data={meta:n.meta}),e.patch(n,u),u=e.applyData(n,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(n,u),u}function CT(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function AT(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function TT(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(n.identifier).toUpperCase(),l=wa(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 m={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(n,m);const d={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(n,d),e.applyData(n,d)}function jT(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function NT(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function i1(e,n){const r=n.referenceType;let s="]";if(r==="collapsed"?s+="[]":r==="full"&&(s+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+s}];const l=e.all(n),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 OT(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return i1(e,n);const l={src:wa(s.url||""),alt:n.alt};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(n,u),e.applyData(n,u)}function RT(e,n){const r={src:wa(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,s),e.applyData(n,s)}function MT(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const s={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,s),e.applyData(n,s)}function DT(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return i1(e,n);const l={href:wa(s.url||"")};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"a",properties:l,children:e.all(n)};return e.patch(n,u),e.applyData(n,u)}function LT(e,n){const r={href:wa(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const s={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function zT(e,n,r){const s=e.all(n),l=r?UT(r):s1(n),u={},c=[];if(typeof n.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:n.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
|
-
`}),y.type==="element"&&y.tagName==="p"&&!l?c.push(...y.children):c.push(y)}const m=s[s.length-1];m&&(l||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
|
|
99
|
-
`});const d={type:"element",tagName:"li",properties:u,children:c};return e.patch(n,d),e.applyData(n,d)}function UT(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let s=-1;for(;!n&&++s<r.length;)n=s1(r[s])}return n}function s1(e){const n=e.spread;return n??e.children.length>1}function BT(e,n){const r={},s=e.all(n);let l=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.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:n.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(n,u),e.applyData(n,u)}function PT(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function qT(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function HT(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function IT(e,n){const r=e.all(n),s=r.shift(),l=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(n.children[0],c),l.push(c)}if(r.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=Id(n.children[1]),m=Bx(n.children[n.children.length-1]);f&&m&&(c.position={start:f,end:m}),l.push(c)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(n,u),e.applyData(n,u)}function FT(e,n,r){const s=r?r.children:void 0,u=(s?s.indexOf(n):1)===0?"th":"td",c=r&&r.type==="table"?r.align:void 0,f=c?c.length:n.children.length;let m=-1;const d=[];for(;++m<f;){const g=n.children[m],b={},w=c?c[m]:void 0;w&&(b.align=w);let k={type:"element",tagName:u,properties:b,children:[]};g&&(k.children=e.all(g),e.patch(g,k),k=e.applyData(g,k)),d.push(k)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(n,y),e.applyData(n,y)}function $T(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const ob=9,ub=32;function YT(e){const n=String(e),r=/\r?\n|\r/g;let s=r.exec(n),l=0;const u=[];for(;s;)u.push(cb(n.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=r.exec(n);return u.push(cb(n.slice(l),l>0,!1)),u.join("")}function cb(e,n,r){let s=0,l=e.length;if(n){let u=e.codePointAt(s);for(;u===ob||u===ub;)s++,u=e.codePointAt(s)}if(r){let u=e.codePointAt(l-1);for(;u===ob||u===ub;)l--,u=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function GT(e,n){const r={type:"text",value:YT(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function VT(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const JT={blockquote:_T,break:ET,code:kT,delete:CT,emphasis:AT,footnoteReference:TT,heading:jT,html:NT,imageReference:OT,image:RT,inlineCode:MT,linkReference:DT,link:LT,listItem:zT,list:BT,paragraph:PT,root:qT,strong:HT,table:IT,tableCell:$T,tableRow:FT,text:GT,thematicBreak:VT,toml:pu,yaml:pu,definition:pu,footnoteDefinition:pu};function pu(){}const a1=-1,Qu=0,Ol=1,Bu=2,Xd=3,Kd=4,Qd=5,Zd=6,l1=7,o1=8,fb=typeof self=="object"?self:globalThis,XT=(e,n)=>{const r=(l,u)=>(e.set(u,l),l),s=l=>{if(e.has(l))return e.get(l);const[u,c]=n[l];switch(u){case Qu:case a1:return r(c,l);case Ol:{const f=r([],l);for(const m of c)f.push(s(m));return f}case Bu:{const f=r({},l);for(const[m,d]of c)f[s(m)]=s(d);return f}case Xd:return r(new Date(c),l);case Kd:{const{source:f,flags:m}=c;return r(new RegExp(f,m),l)}case Qd:{const f=r(new Map,l);for(const[m,d]of c)f.set(s(m),s(d));return f}case Zd:{const f=r(new Set,l);for(const m of c)f.add(s(m));return f}case l1:{const{name:f,message:m}=c;return r(new fb[f](m),l)}case o1: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 fb[u](c),l)};return s},hb=e=>XT(new Map,e)(0),Zs="",{toString:KT}={},{keys:QT}=Object,vl=e=>{const n=typeof e;if(n!=="object"||!e)return[Qu,n];const r=KT.call(e).slice(8,-1);switch(r){case"Array":return[Ol,Zs];case"Object":return[Bu,Zs];case"Date":return[Xd,Zs];case"RegExp":return[Kd,Zs];case"Map":return[Qd,Zs];case"Set":return[Zd,Zs];case"DataView":return[Ol,r]}return r.includes("Array")?[Ol,r]:r.includes("Error")?[l1,r]:[Bu,r]},gu=([e,n])=>e===Qu&&(n==="function"||n==="symbol"),ZT=(e,n,r,s)=>{const l=(c,f)=>{const m=s.push(c)-1;return r.set(f,m),m},u=c=>{if(r.has(c))return r.get(c);let[f,m]=vl(c);switch(f){case Qu:{let y=c;switch(m){case"bigint":f=o1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([a1],c)}return l([f,y],c)}case Ol:{if(m){let b=c;return m==="DataView"?b=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(b=new Uint8Array(c)),l([m,[...b]],c)}const y=[],g=l([f,y],c);for(const b of c)y.push(u(b));return g}case Bu:{if(m)switch(m){case"BigInt":return l([m,c.toString()],c);case"Boolean":case"Number":case"String":return l([m,c.valueOf()],c)}if(n&&"toJSON"in c)return u(c.toJSON());const y=[],g=l([f,y],c);for(const b of QT(c))(e||!gu(vl(c[b])))&&y.push([u(b),u(c[b])]);return g}case Xd:return l([f,c.toISOString()],c);case Kd:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case Qd:{const y=[],g=l([f,y],c);for(const[b,w]of c)(e||!(gu(vl(b))||gu(vl(w))))&&y.push([u(b),u(w)]);return g}case Zd:{const y=[],g=l([f,y],c);for(const b of c)(e||!gu(vl(b)))&&y.push(u(b));return g}}const{message:d}=c;return l([f,{name:m,message:d}],c)};return u},db=(e,{json:n,lossy:r}={})=>{const s=[];return ZT(!(n||r),!!n,new Map,s)(e),s},Pu=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?hb(db(e,n)):structuredClone(e):(e,n)=>hb(db(e,n));function WT(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function ej(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function tj(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||WT,s=e.options.footnoteBackLabel||ej,l=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[m]);if(!d)continue;const y=e.all(d),g=String(d.identifier).toUpperCase(),b=wa(g.toLowerCase());let w=0;const k=[],D=e.footnoteCounts.get(g);for(;D!==void 0&&++w<=D;){k.length>0&&k.push({type:"text",value:" "});let q=typeof r=="string"?r:r(m,w);typeof q=="string"&&(q={type:"text",value:q}),k.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+b+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(m,w),className:["data-footnote-backref"]},children:Array.isArray(q)?q:[q]})}const U=y[y.length-1];if(U&&U.type==="element"&&U.tagName==="p"){const q=U.children[U.children.length-1];q&&q.type==="text"?q.value+=" ":U.children.push({type:"text",value:" "}),U.children.push(...k)}else y.push(...k);const M={type:"element",tagName:"li",properties:{id:n+"fn-"+b},children:e.wrap(y,!0)};e.patch(d,M),f.push(M)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Pu(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
100
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
101
|
-
`}]}}const Zu=(function(e){if(e==null)return sj;if(typeof e=="function")return Wu(e);if(typeof e=="object")return Array.isArray(e)?nj(e):rj(e);if(typeof e=="string")return ij(e);throw new Error("Expected function, string, or object as test")});function nj(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Zu(e[r]);return Wu(s);function s(...l){let u=-1;for(;++u<n.length;)if(n[u].apply(this,l))return!0;return!1}}function rj(e){const n=e;return Wu(r);function r(s){const l=s;let u;for(u in e)if(l[u]!==n[u])return!1;return!0}}function ij(e){return Wu(n);function n(r){return r&&r.type===e}}function Wu(e){return n;function n(r,s,l){return!!(aj(r)&&e.call(this,r,typeof s=="number"?s:void 0,l||void 0))}}function sj(){return!0}function aj(e){return e!==null&&typeof e=="object"&&"type"in e}const u1=[],lj=!0,xd=!1,oj="skip";function c1(e,n,r,s){let l;typeof n=="function"&&typeof r!="function"?(s=r,r=n):l=n;const u=Zu(l),c=s?-1:1;f(e,void 0,[])();function f(m,d,y){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const w=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return b;function b(){let w=u1,k,D,U;if((!n||u(m,d,y[y.length-1]||void 0))&&(w=uj(r(m,y)),w[0]===xd))return w;if("children"in m&&m.children){const M=m;if(M.children&&w[0]!==oj)for(D=(s?M.children.length:-1)+c,U=y.concat(M);D>-1&&D<M.children.length;){const q=M.children[D];if(k=f(q,D,U)(),k[0]===xd)return k;D=typeof k[1]=="number"?k[1]:D+c}}return w}}}function uj(e){return Array.isArray(e)?e:typeof e=="number"?[lj,e]:e==null?u1:[e]}function Wd(e,n,r,s){let l,u,c;typeof n=="function"&&typeof r!="function"?(u=void 0,c=n,l=r):(u=n,c=r,l=s),c1(e,u,f,l);function f(m,d){const y=d[d.length-1],g=y?y.children.indexOf(m):void 0;return c(m,g,y)}}const vd={}.hasOwnProperty,cj={};function fj(e,n){const r=n||cj,s=new Map,l=new Map,u=new Map,c={...JT,...r.handlers},f={all:d,applyData:dj,definitionById:s,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:hj,wrap:pj};return Wd(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?s:l,b=String(y.identifier).toUpperCase();g.has(b)||g.set(b,y)}}),f;function m(y,g){const b=y.type,w=f.handlers[b];if(vd.call(f.handlers,b)&&w)return w(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in y){const{children:D,...U}=y,M=Pu(U);return M.children=f.all(y),M}return Pu(y)}return(f.options.unknownHandler||mj)(f,y,g)}function d(y){const g=[];if("children"in y){const b=y.children;let w=-1;for(;++w<b.length;){const k=f.one(b[w],y);if(k){if(w&&b[w-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=mb(k.value)),!Array.isArray(k)&&k.type==="element")){const D=k.children[0];D&&D.type==="text"&&(D.value=mb(D.value))}Array.isArray(k)?g.push(...k):g.push(k)}}}return g}}function hj(e,n){e.position&&(n.position=eC(e))}function dj(e,n){let r=n;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,Pu(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function mj(e,n){const r=n.data||{},s="value"in n&&!(vd.call(r,"hProperties")||vd.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function pj(e,n){const r=[];let s=-1;for(n&&r.push({type:"text",value:`
|
|
102
|
-
`});++s<e.length;)s&&r.push({type:"text",value:`
|
|
103
|
-
`}),r.push(e[s]);return n&&e.length>0&&r.push({type:"text",value:`
|
|
104
|
-
`}),r}function mb(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function pb(e,n){const r=fj(e,n),s=r.one(e,void 0),l=tj(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 gj(e,n){return e&&"run"in e?async function(r,s){const l=pb(r,{file:s,...n});await e.run(l,s)}:function(r,s){return pb(r,{file:s,...e||n})}}function gb(e){if(e)throw e}var Uh,yb;function yj(){if(yb)return Uh;yb=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(d){return typeof Array.isArray=="function"?Array.isArray(d):n.call(d)==="[object Array]"},u=function(d){if(!d||n.call(d)!=="[object Object]")return!1;var y=e.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!y&&!g)return!1;var b;for(b in d);return typeof b>"u"||e.call(d,b)},c=function(d,y){r&&y.name==="__proto__"?r(d,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):d[y.name]=y.newValue},f=function(d,y){if(y==="__proto__")if(e.call(d,y)){if(s)return s(d,y).value}else return;return d[y]};return Uh=function m(){var d,y,g,b,w,k,D=arguments[0],U=1,M=arguments.length,q=!1;for(typeof D=="boolean"&&(q=D,D=arguments[1]||{},U=2),(D==null||typeof D!="object"&&typeof D!="function")&&(D={});U<M;++U)if(d=arguments[U],d!=null)for(y in d)g=f(D,y),b=f(d,y),D!==b&&(q&&b&&(u(b)||(w=l(b)))?(w?(w=!1,k=g&&l(g)?g:[]):k=g&&u(g)?g:{},c(D,{name:y,newValue:m(q,k,b)})):typeof b<"u"&&c(D,{name:y,newValue:b}));return D},Uh}var bj=yj();const Bh=Mb(bj);function wd(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function xj(){const e=[],n={run:r,use:s};return n;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(m,...d){const y=e[++u];let g=-1;if(m){c(m);return}for(;++g<l.length;)(d[g]===null||d[g]===void 0)&&(d[g]=l[g]);l=d,y?vj(y,f)(...d):c(null,...d)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),n}}function vj(e,n){let r;return s;function s(...c){const f=e.length>c.length;let m;f&&c.push(l);try{m=e.apply(this,c)}catch(d){const y=d;if(f&&r)throw y;return l(y)}f||(m&&m.then&&typeof m.then=="function"?m.then(u,l):m instanceof Error?l(m):u(m))}function l(c,...f){r||(r=!0,n(c,...f))}function u(c){l(null,c)}}const xr={basename:wj,dirname:Sj,extname:_j,join:Ej,sep:"/"};function wj(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Vl(e);let r=0,s=-1,l=e.length,u;if(n===void 0||n.length===0||n.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(n===e)return"";let c=-1,f=n.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)===n.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 Sj(e){if(Vl(e),e.length===0)return".";let n=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){n=r;break}}else s||(s=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function _j(e){Vl(e);let n=e.length,r=-1,s=0,l=-1,u=0,c;for(;n--;){const f=e.codePointAt(n);if(f===47){if(c){s=n+1;break}continue}r<0&&(c=!0,r=n+1),f===46?l<0?l=n: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 Ej(...e){let n=-1,r;for(;++n<e.length;)Vl(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":kj(r)}function kj(e){Vl(e);const n=e.codePointAt(0)===47;let r=Cj(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function Cj(e,n){let r="",s=0,l=-1,u=0,c=-1,f,m;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(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",s=0):(r=r.slice(0,m),s=r.length-1-r.lastIndexOf("/")),l=c,u=0;continue}}else if(r.length>0){r="",s=0,l=c,u=0;continue}}n&&(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 Vl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Aj={cwd:Tj};function Tj(){return"/"}function Sd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function jj(e){if(typeof e=="string")e=new URL(e);else if(!Sd(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return Nj(e)}function Nj(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 n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const s=n.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(n)}const Ph=["history","path","basename","stem","extname","dirname"];class f1{constructor(n){let r;n?Sd(n)?r={path:n}:typeof n=="string"||Oj(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":Aj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Ph.length;){const u=Ph[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)Ph.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?xr.basename(this.path):void 0}set basename(n){Hh(n,"basename"),qh(n,"basename"),this.path=xr.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?xr.dirname(this.path):void 0}set dirname(n){bb(this.basename,"dirname"),this.path=xr.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?xr.extname(this.path):void 0}set extname(n){if(qh(n,"extname"),bb(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=xr.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Sd(n)&&(n=jj(n)),Hh(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?xr.basename(this.path,this.extname):void 0}set stem(n){Hh(n,"stem"),qh(n,"stem"),this.path=xr.join(this.dirname||"",n+(this.extname||""))}fail(n,r,s){const l=this.message(n,r,s);throw l.fatal=!0,l}info(n,r,s){const l=this.message(n,r,s);return l.fatal=void 0,l}message(n,r,s){const l=new cn(n,r,s);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function qh(e,n){if(e&&e.includes(xr.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+xr.sep+"`")}function Hh(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function bb(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function Oj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Rj=(function(e){const s=this.constructor.prototype,l=s[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),Mj={}.hasOwnProperty;class em extends Rj{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=xj()}copy(){const n=new em;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];n.use(...s)}return n.data(Bh(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?($h("data",this.frozen),this.namespace[n]=r,this):Mj.call(this.namespace,n)&&this.namespace[n]||void 0:n?($h("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=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(n,...s);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=yu(n),s=this.parser||this.Parser;return Ih("parse",s),s(String(r),r)}process(n,r){const s=this;return this.freeze(),Ih("process",this.parser||this.Parser),Fh("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=yu(n),m=s.parse(f);s.run(m,f,function(y,g,b){if(y||!g||!b)return d(y);const w=g,k=s.stringify(w,b);zj(k)?b.value=k:b.result=k,d(y,b)});function d(y,g){y||!g?c(y):u?u(g):r(void 0,g)}}}processSync(n){let r=!1,s;return this.freeze(),Ih("processSync",this.parser||this.Parser),Fh("processSync",this.compiler||this.Compiler),this.process(n,l),vb("processSync","process",r),s;function l(u,c){r=!0,gb(u),s=c}}run(n,r,s){xb(n),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 m=yu(r);l.run(n,m,d);function d(y,g,b){const w=g||n;y?f(y):c?c(w):s(void 0,w,b)}}}runSync(n,r){let s=!1,l;return this.run(n,r,u),vb("runSync","run",s),l;function u(c,f){gb(c),l=f,s=!0}}stringify(n,r){this.freeze();const s=yu(r),l=this.compiler||this.Compiler;return Fh("stringify",l),xb(n),l(n,s)}use(n,...r){const s=this.attachers,l=this.namespace;if($h("use",this.frozen),n!=null)if(typeof n=="function")m(n,r);else if(typeof n=="object")Array.isArray(n)?f(n):c(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function u(d){if(typeof d=="function")m(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[y,...g]=d;m(y,g)}else c(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function c(d){if(!("plugins"in d)&&!("settings"in d))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(d.plugins),d.settings&&(l.settings=Bh(!0,l.settings,d.settings))}function f(d){let y=-1;if(d!=null)if(Array.isArray(d))for(;++y<d.length;){const g=d[y];u(g)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function m(d,y){let g=-1,b=-1;for(;++g<s.length;)if(s[g][0]===d){b=g;break}if(b===-1)s.push([d,...y]);else if(y.length>0){let[w,...k]=y;const D=s[b][1];wd(D)&&wd(w)&&(w=Bh(!0,D,w)),s[b]=[d,w,...k]}}}}const Dj=new em().freeze();function Ih(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Fh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $h(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function xb(e){if(!wd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function vb(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function yu(e){return Lj(e)?e:new f1(e)}function Lj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function zj(e){return typeof e=="string"||Uj(e)}function Uj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Bj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",wb=[],Sb={allowDangerousHtml:!0},Pj=/^(https?|ircs?|mailto|xmpp)$/i,qj=[{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 _b(e){const n=Hj(e),r=Ij(e);return Fj(n.runSync(n.parse(r),r),e)}function Hj(e){const n=e.rehypePlugins||wb,r=e.remarkPlugins||wb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Sb}:Sb;return Dj().use(ST).use(r).use(gj,s).use(n)}function Ij(e){const n=e.children||"",r=new f1;return typeof n=="string"&&(r.value=n),r}function Fj(e,n){const r=n.allowedElements,s=n.allowElement,l=n.components,u=n.disallowedElements,c=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||$j;for(const y of qj)Object.hasOwn(n,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+Bj+y.id,void 0);return Wd(e,d),sC(e,{Fragment:v.Fragment,components:l,ignoreInvalidStyle:!0,jsx:v.jsx,jsxs:v.jsxs,passKeys:!0,passNode:!0});function d(y,g,b){if(y.type==="raw"&&b&&typeof g=="number")return c?b.children.splice(g,1):b.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let w;for(w in Dh)if(Object.hasOwn(Dh,w)&&Object.hasOwn(y.properties,w)){const k=y.properties[w],D=Dh[w];(D===null||D.includes(y.tagName))&&(y.properties[w]=m(String(k||""),w,y))}}if(y.type==="element"){let w=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!w&&s&&typeof g=="number"&&(w=!s(y,g,b)),w&&b&&typeof g=="number")return f&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function $j(e){const n=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),l=e.indexOf("/");return n===-1||l!==-1&&n>l||r!==-1&&n>r||s!==-1&&n>s||Pj.test(e.slice(0,n))?e:""}function Eb(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let s=0,l=r.indexOf(n);for(;l!==-1;)s++,l=r.indexOf(n,l+n.length);return s}function Yj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function h1(e,n,r){const l=Zu((r||{}).ignore||[]),u=Gj(n);let c=-1;for(;++c<u.length;)c1(e,"text",f);function f(d,y){let g=-1,b;for(;++g<y.length;){const w=y[g],k=b?b.children:void 0;if(l(w,k?k.indexOf(w):void 0,b))return;b=w}if(b)return m(d,y)}function m(d,y){const g=y[y.length-1],b=u[c][0],w=u[c][1];let k=0;const U=g.children.indexOf(d);let M=!1,q=[];b.lastIndex=0;let H=b.exec(d.value);for(;H;){const ae=H.index,B={index:H.index,input:H.input,stack:[...y,d]};let z=w(...H,B);if(typeof z=="string"&&(z=z.length>0?{type:"text",value:z}:void 0),z===!1?b.lastIndex=ae+1:(k!==ae&&q.push({type:"text",value:d.value.slice(k,ae)}),Array.isArray(z)?q.push(...z):z&&q.push(z),k=ae+H[0].length,M=!0),!b.global)break;H=b.exec(d.value)}return M?(k<d.value.length&&q.push({type:"text",value:d.value.slice(k)}),g.children.splice(U,1,...q)):q=[d],U+q.length}}function Gj(e){const n=[];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];n.push([Vj(l[0]),Jj(l[1])])}return n}function Vj(e){return typeof e=="string"?new RegExp(Yj(e),"g"):e}function Jj(e){return typeof e=="function"?e:function(){return e}}const Yh="phrasing",Gh=["autolink","link","image","label"];function Xj(){return{transforms:[nN],enter:{literalAutolink:Qj,literalAutolinkEmail:Vh,literalAutolinkHttp:Vh,literalAutolinkWww:Vh},exit:{literalAutolink:tN,literalAutolinkEmail:eN,literalAutolinkHttp:Zj,literalAutolinkWww:Wj}}}function Kj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Yh,notInConstruct:Gh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Yh,notInConstruct:Gh},{character:":",before:"[ps]",after:"\\/",inConstruct:Yh,notInConstruct:Gh}]}}function Qj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Vh(e){this.config.enter.autolinkProtocol.call(this,e)}function Zj(e){this.config.exit.autolinkProtocol.call(this,e)}function Wj(e){this.config.exit.data.call(this,e);const n=this.stack[this.stack.length-1];n.type,n.url="http://"+this.sliceSerialize(e)}function eN(e){this.config.exit.autolinkEmail.call(this,e)}function tN(e){this.exit(e)}function nN(e){h1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,rN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),iN]],{ignore:["link","linkReference"]})}function rN(e,n,r,s,l){let u="";if(!d1(l)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!sN(r)))return!1;const c=aN(r+s);if(!c[0])return!1;const f={type:"link",title:null,url:u+n+c[0],children:[{type:"text",value:n+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function iN(e,n,r,s){return!d1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function sN(e){const n=e.split(".");return!(n.length<2||n[n.length-1]&&(/_/.test(n[n.length-1])||!/[a-zA-Z\d]/.test(n[n.length-1]))||n[n.length-2]&&(/_/.test(n[n.length-2])||!/[a-zA-Z\d]/.test(n[n.length-2])))}function aN(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],s=r.indexOf(")");const l=Eb(e,"(");let u=Eb(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 d1(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||hs(r)||Xu(r))&&(!n||r!==47)}m1.peek=pN;function lN(){this.buffer()}function oN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function uN(){this.buffer()}function cN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function fN(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=dr(this.sliceSerialize(e)).toLowerCase(),r.label=n}function hN(e){this.exit(e)}function dN(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=dr(this.sliceSerialize(e)).toLowerCase(),r.label=n}function mN(e){this.exit(e)}function pN(){return"["}function m1(e,n,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 gN(){return{enter:{gfmFootnoteCallString:lN,gfmFootnoteCall:oN,gfmFootnoteDefinitionLabelString:uN,gfmFootnoteDefinition:cN},exit:{gfmFootnoteCallString:fN,gfmFootnoteCall:hN,gfmFootnoteDefinitionLabelString:dN,gfmFootnoteDefinition:mN}}}function yN(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:m1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,l,u,c){const f=u.createTracker(c);let m=f.move("[^");const d=u.enter("footnoteDefinition"),y=u.enter("label");return m+=f.move(u.safe(u.associationId(s),{before:m,after:"]"})),y(),m+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),m+=f.move((n?`
|
|
106
|
-
`:" ")+u.indentLines(u.containerFlow(s,f.current()),n?p1:bN))),d(),m}}function bN(e,n,r){return n===0?e:p1(e,n,r)}function p1(e,n,r){return(r?"":" ")+e}const xN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];g1.peek=EN;function vN(){return{canContainEols:["delete"],enter:{strikethrough:SN},exit:{strikethrough:_N}}}function wN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:xN}],handlers:{delete:g1}}}function SN(e){this.enter({type:"delete",children:[]},e)}function _N(e){this.exit(e)}function g1(e,n,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 EN(){return"~"}function kN(e){return e.length}function CN(e,n){const r=n||{},s=(r.align||[]).concat(),l=r.stringLength||kN,u=[],c=[],f=[],m=[];let d=0,y=-1;for(;++y<e.length;){const D=[],U=[];let M=-1;for(e[y].length>d&&(d=e[y].length);++M<e[y].length;){const q=AN(e[y][M]);if(r.alignDelimiters!==!1){const H=l(q);U[M]=H,(m[M]===void 0||H>m[M])&&(m[M]=H)}D.push(q)}c[y]=D,f[y]=U}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<d;)u[g]=kb(s[g]);else{const D=kb(s);for(;++g<d;)u[g]=D}g=-1;const b=[],w=[];for(;++g<d;){const D=u[g];let U="",M="";D===99?(U=":",M=":"):D===108?U=":":D===114&&(M=":");let q=r.alignDelimiters===!1?1:Math.max(1,m[g]-U.length-M.length);const H=U+"-".repeat(q)+M;r.alignDelimiters!==!1&&(q=U.length+q+M.length,q>m[g]&&(m[g]=q),w[g]=q),b[g]=H}c.splice(1,0,b),f.splice(1,0,w),y=-1;const k=[];for(;++y<c.length;){const D=c[y],U=f[y];g=-1;const M=[];for(;++g<d;){const q=D[g]||"";let H="",ae="";if(r.alignDelimiters!==!1){const B=m[g]-(U[g]||0),z=u[g];z===114?H=" ".repeat(B):z===99?B%2?(H=" ".repeat(B/2+.5),ae=" ".repeat(B/2-.5)):(H=" ".repeat(B/2),ae=H):ae=" ".repeat(B)}r.delimiterStart!==!1&&!g&&M.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&q==="")&&(r.delimiterStart!==!1||g)&&M.push(" "),r.alignDelimiters!==!1&&M.push(H),M.push(q),r.alignDelimiters!==!1&&M.push(ae),r.padding!==!1&&M.push(" "),(r.delimiterEnd!==!1||g!==d-1)&&M.push("|")}k.push(r.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return k.join(`
|
|
107
|
-
`)}function AN(e){return e==null?"":String(e)}function kb(e){const n=typeof e=="string"?e.codePointAt(0):0;return n===67||n===99?99:n===76||n===108?108:n===82||n===114?114:0}function TN(e,n,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()),jN);return l(),c}function jN(e,n,r){return">"+(r?"":" ")+e}function NN(e,n){return Cb(e,n.inConstruct,!0)&&!Cb(e,n.notInConstruct,!1)}function Cb(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let s=-1;for(;++s<n.length;)if(e.includes(n[s]))return!0;return!1}function Ab(e,n,r,s){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
|
|
108
|
-
`&&NN(r.stack,r.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
109
|
-
`}function ON(e,n){const r=String(e);let s=r.indexOf(n),l=s,u=0,c=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===l?++u>c&&(c=u):u=1,l=s+n.length,s=r.indexOf(n,l);return c}function RN(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function MN(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function DN(e,n,r,s){const l=MN(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(RN(e,r)){const g=r.enter("codeIndented"),b=r.indentLines(u,LN);return g(),b}const f=r.createTracker(s),m=l.repeat(Math.max(ON(u,l)+1,3)),d=r.enter("codeFenced");let y=f.move(m);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
|
-
`,encode:["`"],...f.current()})),g()}return y+=f.move(`
|
|
111
|
-
`),u&&(y+=f.move(u+`
|
|
112
|
-
`)),y+=f.move(m),d(),y}function LN(e,n,r){return(r?"":" ")+e}function tm(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function zN(e,n,r,s){const l=tm(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const m=r.createTracker(s);let d=m.move("[");return d+=m.move(r.safe(r.associationId(e),{before:d,after:"]",...m.current()})),d+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":`
|
|
113
|
-
`,...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),c(),d}function UN(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function Bl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function qu(e,n,r){const s=pa(e),l=pa(n);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}}y1.peek=BN;function y1(e,n,r,s){const l=UN(r),u=r.enter("emphasis"),c=r.createTracker(s),f=c.move(l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=qu(s.before.charCodeAt(s.before.length-1),d,l);y.inside&&(m=Bl(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=qu(s.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Bl(g));const w=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+w}function BN(e,n,r){return r.options.emphasis||"*"}function PN(e,n){let r=!1;return Wd(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,xd}),!!((!e.depth||e.depth<3)&&Gd(e)&&(n.options.setext||r))}function qN(e,n,r,s){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(s);if(PN(e,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),b=r.containerPhrasing(e,{...u.current(),before:`
|
|
114
|
-
`,after:`
|
|
115
|
-
`});return g(),y(),b+`
|
|
116
|
-
`+(l===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
117
|
-
`))+1))}const c="#".repeat(l),f=r.enter("headingAtx"),m=r.enter("phrasing");u.move(c+" ");let d=r.containerPhrasing(e,{before:"# ",after:`
|
|
118
|
-
`,...u.current()});return/^[\t ]/.test(d)&&(d=Bl(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,r.options.closeAtx&&(d+=" "+c),m(),f(),d}b1.peek=HN;function b1(e){return e.value||""}function HN(){return"<"}x1.peek=IN;function x1(e,n,r,s){const l=tm(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("image");let f=r.enter("label");const m=r.createTracker(s);let d=m.move("![");return d+=m.move(r.safe(e.alt,{before:d,after:"]",...m.current()})),d+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),d+=m.move(")"),c(),d}function IN(){return"!"}v1.peek=FN;function v1(e,n,r,s){const l=e.referenceType,u=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(s);let m=f.move("![");const d=r.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function FN(){return"!"}w1.peek=$N;function w1(e,n,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 m;if(c.atBreak)for(;m=f.exec(s);){let d=m.index;s.charCodeAt(d)===10&&s.charCodeAt(d-1)===13&&d--,s=s.slice(0,d)+" "+s.slice(m.index+1)}}return l+s+l}function $N(){return"`"}function S1(e,n){const r=Gd(e);return!!(!n.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))}_1.peek=YN;function _1(e,n,r,s){const l=tm(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(s);let f,m;if(S1(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"),m=r.enter("label");let d=c.move("[");return d+=c.move(r.containerPhrasing(e,{before:d,after:"](",...c.current()})),d+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=r.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(r.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(m=r.enter("destinationRaw"),d+=c.move(r.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=r.enter(`title${u}`),d+=c.move(" "+l),d+=c.move(r.safe(e.title,{before:d,after:l,...c.current()})),d+=c.move(l),m()),d+=c.move(")"),f(),d}function YN(e,n,r){return S1(e,r)?"<":"["}E1.peek=GN;function E1(e,n,r,s){const l=e.referenceType,u=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(s);let m=f.move("[");const d=r.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function GN(){return"["}function nm(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function VN(e){const n=nm(e),r=e.options.bulletOther;if(!r)return n==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+r+"`) to be different");return r}function JN(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function k1(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function XN(e,n,r,s){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?JN(r):nm(r);const f=e.ordered?c==="."?")":".":VN(r);let m=n&&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&&(m=!0),k1(r)===c&&y){let g=-1;for(;++g<e.children.length;){const b=e.children[g];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),r.bulletCurrent=c;const d=r.containerFlow(e,s);return r.bulletLastUsed=c,r.bulletCurrent=u,l(),d}function KN(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function QN(e,n,r,s){const l=KN(r);let u=r.bulletCurrent||nm(r);n&&n.type==="list"&&n.ordered&&(u=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+u);let c=u.length+1;(l==="tab"||l==="mixed"&&(n&&n.type==="list"&&n.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 m=r.enter("listItem"),d=r.indentLines(r.containerFlow(e,f.current()),y);return m(),d;function y(g,b,w){return b?(w?"":" ".repeat(c))+g:(w?u:u+" ".repeat(c-u.length))+g}}function ZN(e,n,r,s){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,s);return u(),l(),c}const WN=Zu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function e3(e,n,r,s){return(e.children.some(function(c){return WN(c)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function t3(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}C1.peek=n3;function C1(e,n,r,s){const l=t3(r),u=r.enter("strong"),c=r.createTracker(s),f=c.move(l+l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=qu(s.before.charCodeAt(s.before.length-1),d,l);y.inside&&(m=Bl(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=qu(s.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Bl(g));const w=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+w}function n3(e,n,r){return r.options.strong||"*"}function r3(e,n,r,s){return r.safe(e.value,s)}function i3(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function s3(e,n,r){const s=(k1(r)+(r.options.ruleSpaces?" ":"")).repeat(i3(r));return r.options.ruleSpaces?s.slice(0,-1):s}const A1={blockquote:TN,break:Ab,code:DN,definition:zN,emphasis:y1,hardBreak:Ab,heading:qN,html:b1,image:x1,imageReference:v1,inlineCode:w1,link:_1,linkReference:E1,list:XN,listItem:QN,paragraph:ZN,root:e3,strong:C1,text:r3,thematicBreak:s3};function a3(){return{enter:{table:l3,tableData:Tb,tableHeader:Tb,tableRow:u3},exit:{codeText:c3,table:o3,tableData:Jh,tableHeader:Jh,tableRow:Jh}}}function l3(e){const n=e._align;this.enter({type:"table",align:n.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function o3(e){this.exit(e),this.data.inTable=void 0}function u3(e){this.enter({type:"tableRow",children:[]},e)}function Jh(e){this.exit(e)}function Tb(e){this.enter({type:"tableCell",children:[]},e)}function c3(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,f3));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function f3(e,n){return n==="|"?n:e}function h3(e){const n=e||{},r=n.tableCellPadding,s=n.tablePipeAlign,l=n.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:b,table:c,tableCell:m,tableRow:f}};function c(w,k,D,U){return d(y(w,D,U),w.align)}function f(w,k,D,U){const M=g(w,D,U),q=d([M]);return q.slice(0,q.indexOf(`
|
|
120
|
-
`))}function m(w,k,D,U){const M=D.enter("tableCell"),q=D.enter("phrasing"),H=D.containerPhrasing(w,{...U,before:u,after:u});return q(),M(),H}function d(w,k){return CN(w,{align:k,alignDelimiters:s,padding:r,stringLength:l})}function y(w,k,D){const U=w.children;let M=-1;const q=[],H=k.enter("table");for(;++M<U.length;)q[M]=g(U[M],k,D);return H(),q}function g(w,k,D){const U=w.children;let M=-1;const q=[],H=k.enter("tableRow");for(;++M<U.length;)q[M]=m(U[M],w,k,D);return H(),q}function b(w,k,D){let U=A1.inlineCode(w,k,D);return D.stack.includes("tableCell")&&(U=U.replace(/\|/g,"\\$&")),U}}function d3(){return{exit:{taskListCheckValueChecked:jb,taskListCheckValueUnchecked:jb,paragraph:p3}}}function m3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:g3}}}function jb(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function p3(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const s=r.children[0];if(s&&s.type==="text"){const l=n.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 g3(e,n,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 m=A1.listItem(e,n,r,{...s,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),m;function d(y){return y+c}}function y3(){return[Xj(),gN(),vN(),a3(),d3()]}function b3(e){return{extensions:[Kj(),yN(e),wN(),h3(e),m3()]}}const x3={tokenize:k3,partial:!0},T1={tokenize:C3,partial:!0},j1={tokenize:A3,partial:!0},N1={tokenize:T3,partial:!0},v3={tokenize:j3,partial:!0},O1={name:"wwwAutolink",tokenize:_3,previous:M1},R1={name:"protocolAutolink",tokenize:E3,previous:D1},Wr={name:"emailAutolink",tokenize:S3,previous:L1},Ar={};function w3(){return{text:Ar}}let os=48;for(;os<123;)Ar[os]=Wr,os++,os===58?os=65:os===91&&(os=97);Ar[43]=Wr;Ar[45]=Wr;Ar[46]=Wr;Ar[95]=Wr;Ar[72]=[Wr,R1];Ar[104]=[Wr,R1];Ar[87]=[Wr,O1];Ar[119]=[Wr,O1];function S3(e,n,r){const s=this;let l,u;return c;function c(g){return!_d(g)||!L1.call(s,s.previous)||rm(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return _d(g)?(e.consume(g),f):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(v3,y,d)(g):g===45||g===95||un(g)?(u=!0,e.consume(g),m):y(g)}function d(g){return e.consume(g),l=!0,m}function y(g){return u&&l&&yn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):r(g)}}function _3(e,n,r){const s=this;return l;function l(c){return c!==87&&c!==119||!M1.call(s,s.previous)||rm(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(x3,e.attempt(T1,e.attempt(j1,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(c)}}function E3(e,n,r){const s=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&D1.call(s,s.previous)&&!rm(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(yn(g)&&l.length<5)return l+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const b=l.toLowerCase();if(b==="http"||b==="https")return e.consume(g),m}return r(g)}function m(g){return g===47?(e.consume(g),u?d:(u=!0,m)):r(g)}function d(g){return g===null||Uu(g)||Tt(g)||hs(g)||Xu(g)?r(g):e.attempt(T1,e.attempt(j1,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function k3(e,n,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):n(c)}}function C3(e,n,r){let s,l,u;return c;function c(d){return d===46||d===95?e.check(N1,m,f)(d):d===null||Tt(d)||hs(d)||d!==45&&Xu(d)?m(d):(u=!0,e.consume(d),c)}function f(d){return d===95?s=!0:(l=s,s=void 0),e.consume(d),c}function m(d){return l||s||!u?r(d):n(d)}}function A3(e,n){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(N1,n,u)(c):c===null||Tt(c)||hs(c)?n(c):(e.consume(c),l)}function u(c){return c===41&&s++,e.consume(c),l}}function T3(e,n,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)||hs(f)?n(f):r(f)}function l(f){return f===null||f===40||f===91||Tt(f)||hs(f)?n(f):s(f)}function u(f){return yn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):yn(f)?(e.consume(f),c):r(f)}}function j3(e,n,r){return s;function s(u){return e.consume(u),l}function l(u){return un(u)?r(u):n(u)}}function M1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function D1(e){return!yn(e)}function L1(e){return!(e===47||_d(e))}function _d(e){return e===43||e===45||e===46||e===95||un(e)}function rm(e){let n=e.length,r=!1;for(;n--;){const s=e[n][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 N3={tokenize:B3,partial:!0};function O3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:L3,continuation:{tokenize:z3},exit:U3}},text:{91:{name:"gfmFootnoteCall",tokenize:D3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:R3,resolveTo:M3}}}}function R3(e,n,r){const s=this;let l=s.events.length;const u=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;l--;){const m=s.events[l][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return r(m);const d=dr(s.sliceSerialize({start:c.end,end:s.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function M3(e,n){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,n],e[r+3],e[r+4],["enter",l,n],["exit",l,n],["enter",u,n],["enter",c,n],["exit",c,n],["exit",u,n],e[e.length-2],e[e.length-1],["exit",s,n]];return e.splice(r,e.length-r+1,...f),e}function D3(e,n,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"),m}function m(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(g){if(u>999||g===93&&!c||g===null||g===91||Tt(g))return r(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return l.includes(dr(s.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(g)}return Tt(g)||(c=!0),u++,e.consume(g),g===92?y:d}function y(g){return g===91||g===92||g===93?(e.consume(g),u++,d):d(g)}}function L3(e,n,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):r(k)}function y(k){if(c>999||k===93&&!f||k===null||k===91||Tt(k))return r(k);if(k===93){e.exit("chunkString");const D=e.exit("gfmFootnoteDefinitionLabelString");return u=dr(s.sliceSerialize(D)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Tt(k)||(f=!0),c++,e.consume(k),k===92?g:y}function g(k){return k===91||k===92||k===93?(e.consume(k),c++,y):y(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),l.includes(u)||l.push(u),ot(e,w,"gfmFootnoteDefinitionWhitespace")):r(k)}function w(k){return n(k)}}function z3(e,n,r){return e.check(Gl,n,e.attempt(N3,n,r))}function U3(e){e.exit("gfmFootnoteDefinition")}function B3(e,n,r){const s=this;return ot(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?n(u):r(u)}}function P3(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 m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let d=m;for(;d--;)if(c[d][0]==="exit"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[d][1].end.offset-c[d][1].start.offset){c[m][1].type="strikethroughSequence",c[d][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[d][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[d][1].end),end:Object.assign({},c[m][1].start)},b=[["enter",y,f],["enter",c[d][1],f],["exit",c[d][1],f],["enter",g,f]],w=f.parser.constructs.insideSpan.null;w&&qn(b,b.length,0,Ku(w,c.slice(d+1,m),f)),qn(b,b.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",y,f]]),qn(c,d-1,m-d+3,b),m=d+b.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,f,m){const d=this.previous,y=this.events;let g=0;return b;function b(k){return d===126&&y[y.length-1][1].type!=="characterEscape"?m(k):(c.enter("strikethroughSequenceTemporary"),w(k))}function w(k){const D=pa(d);if(k===126)return g>1?m(k):(c.consume(k),g++,w);if(g<2&&!r)return m(k);const U=c.exit("strikethroughSequenceTemporary"),M=pa(k);return U._open=!M||M===2&&!!D,U._close=!D||D===2&&!!M,f(k)}}}class q3{constructor(){this.map=[]}add(n,r,s){H3(this,n,r,s)}consume(n){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(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];s.push(n.slice()),n.length=0;let l=s.pop();for(;l;){for(const u of l)n.push(u);l=s.pop()}this.map.length=0}}function H3(e,n,r,s){let l=0;if(!(r===0&&s.length===0)){for(;l<e.map.length;){if(e.map[l][0]===n){e.map[l][1]+=r,e.map[l][2].push(...s);return}l+=1}e.map.push([n,r,s])}}function I3(e,n){let r=!1;const s=[];for(;n<e.length;){const l=e[n];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&s.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[n-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);n+=1}return s}function F3(){return{flow:{null:{name:"table",tokenize:$3,resolveAll:Y3}}}}function $3(e,n,r){const s=this;let l=0,u=0,c;return f;function f(O){let W=s.events.length-1;for(;W>-1;){const J=s.events[W][1].type;if(J==="lineEnding"||J==="linePrefix")W--;else break}const Z=W>-1?s.events[W][1].type:null,fe=Z==="tableHead"||Z==="tableRow"?z:m;return fe===z&&s.parser.lazy[s.now().line]?r(O):fe(O)}function m(O){return e.enter("tableHead"),e.enter("tableRow"),d(O)}function d(O){return O===124||(c=!0,u+=1),y(O)}function y(O){return O===null?r(O):Ie(O)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),w):r(O):nt(O)?ot(e,y,"whitespace")(O):(u+=1,c&&(c=!1,l+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(O)))}function g(O){return O===null||O===124||Tt(O)?(e.exit("data"),y(O)):(e.consume(O),O===92?b:g)}function b(O){return O===92||O===124?(e.consume(O),g):g(O)}function w(O){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(O):(e.enter("tableDelimiterRow"),c=!1,nt(O)?ot(e,k,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):k(O))}function k(O){return O===45||O===58?U(O):O===124?(c=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),D):B(O)}function D(O){return nt(O)?ot(e,U,"whitespace")(O):U(O)}function U(O){return O===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),M):O===45?(u+=1,M(O)):O===null||Ie(O)?ae(O):B(O)}function M(O){return O===45?(e.enter("tableDelimiterFiller"),q(O)):B(O)}function q(O){return O===45?(e.consume(O),q):O===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),H):(e.exit("tableDelimiterFiller"),H(O))}function H(O){return nt(O)?ot(e,ae,"whitespace")(O):ae(O)}function ae(O){return O===124?k(O):O===null||Ie(O)?!c||l!==u?B(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(O)):B(O)}function B(O){return r(O)}function z(O){return e.enter("tableRow"),V(O)}function V(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),V):O===null||Ie(O)?(e.exit("tableRow"),n(O)):nt(O)?ot(e,V,"whitespace")(O):(e.enter("data"),Y(O))}function Y(O){return O===null||O===124||Tt(O)?(e.exit("data"),V(O)):(e.consume(O),O===92?$:Y)}function $(O){return O===92||O===124?(e.consume(O),Y):Y(O)}}function Y3(e,n){let r=-1,s=!0,l=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,d,y,g;const b=new q3;for(;++r<e.length;){const w=e[r],k=w[1];w[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(Nb(b,n,m,d,y),y=void 0,m=0),d={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(r,0,[["enter",d,n]])):k.type==="tableRow"||k.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({},k.start),end:Object.assign({},k.end)},b.add(r,0,[["enter",y,n]])),l=k.type==="tableDelimiterRow"?2:y?3:1):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=bu(b,n,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):k.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(c[0]=c[1],g=bu(b,n,u,l,void 0,g)),u=c,c=[u[1],r,0,0])):k.type==="tableHead"?(f=!0,m=r):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=r,u[1]!==0?(c[0]=c[1],g=bu(b,n,u,l,r,g)):c[1]!==0&&(g=bu(b,n,c,l,r,g)),l=0):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&Nb(b,n,m,d,y),b.consume(n.events),r=-1;++r<n.events.length;){const w=n.events[r];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=I3(n.events,r))}return e}function bu(e,n,r,s,l,u){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},ea(n.events,r[0])),e.add(r[0],0,[["exit",u,n]]));const m=ea(n.events,r[1]);if(u={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",u,n]]),r[2]!==0){const d=ea(n.events,r[2]),y=ea(n.events,r[3]),g={type:f,start:Object.assign({},d),end:Object.assign({},y)};if(e.add(r[2],0,[["enter",g,n]]),s!==2){const b=n.events[r[2]],w=n.events[r[3]];if(b[1].end=Object.assign({},w[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const k=r[2]+1,D=r[3]-r[2]-1;e.add(k,D,[])}}e.add(r[3]+1,0,[["exit",g,n]])}return l!==void 0&&(u.end=Object.assign({},ea(n.events,l)),e.add(l,0,[["exit",u,n]]),u=void 0),u}function Nb(e,n,r,s,l){const u=[],c=ea(n.events,r);l&&(l.end=Object.assign({},c),u.push(["exit",l,n])),s.end=Object.assign({},c),u.push(["exit",s,n]),e.add(r+1,0,u)}function ea(e,n){const r=e[n],s=r[0]==="enter"?"start":"end";return r[1][s]}const G3={name:"tasklistCheck",tokenize:J3};function V3(){return{text:{91:G3}}}function J3(e,n,r){const s=this;return l;function l(m){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return Tt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):r(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(m)}function f(m){return Ie(m)?n(m):nt(m)?e.check({tokenize:X3},n,r)(m):r(m)}}function X3(e,n,r){return ot(e,s,"whitespace");function s(l){return l===null?r(l):n(l)}}function K3(e){return Yx([w3(),O3(),P3(e),F3(),V3()])}const Q3={};function Ob(e){const n=this,r=e||Q3,s=n.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(K3(r)),u.push(y3()),c.push(b3(r))}function Z3(e){h1(e,[/\r?\n|\r/g,W3])}function W3(){return{type:"break"}}function Rb(){return function(e){Z3(e)}}function eO({connected:e,hostId:n,request:r,subscribeEvents:s,taskId:l,runId:u}){const c=zi(),[f,m]=N.useState(!0),[d,y]=N.useState([]),[g,b]=N.useState(),[w,k]=N.useState(),D=g==="started"||g==="monitoring",U=g==="followup",M=g==="started"||g==="followup",[q,H]=N.useState(null),[ae,B]=N.useState(!1),[z,V]=N.useState(""),[Y,$]=N.useState(!1),O=N.useRef(null),W=N.useRef(null),Z=N.useRef(null),[fe,J]=N.useState(u==="latest"?void 0:u),Q=u==="latest"&&fe===null;N.useEffect(()=>{if(u!=="latest"){J(u);return}e&&(J(void 0),r("taskrun.list",{task_id:l,limit:1}).then(_=>{var R,ee;return J(((ee=(R=_.entries)==null?void 0:R[0])==null?void 0:ee.run_id)??null)}).catch(()=>J(null)))},[u,l,e,r]);async function P(){if(fe)try{const _=await r("task.result",{id:l,run_id:fe});if(_.error){console.error("No result:",_.error),c("/runs",{replace:!0});return}y(_.messages??[]),b(_.running_state),k(_.agent)}catch(_){console.error("Failed to load result:",_),c("/runs",{replace:!0})}finally{m(!1)}}async function se(_){var R;if(fe)try{const A=(R=(await r("task.reports",{id:l,run_id:fe,report_files:[_]})).reports)==null?void 0:R[0];A!=null&&A.data_url?H({file:_,data_url:A.data_url}):H({file:_,content:(A==null?void 0:A.content)??"Report not found."})}catch{H({file:_,content:"Failed to load report."})}}N.useEffect(()=>{!e||!fe||(m(!0),P())},[e,l,fe]),N.useEffect(()=>!e||!n||!fe?void 0:s(n,async R=>{try{const ee=JSON.parse(new TextDecoder().decode(R.data));if(ee.event_type!=="running-state"&&ee.event_type!=="result-updated"||R.subject.split(".").pop()!==l||ee.event_type==="result-updated"&&ee.run_id&&ee.run_id!==fe)return;P()}catch{}}),[e,n,l,fe,s,r]),N.useEffect(()=>{O.current&&(O.current.scrollTop=O.current.scrollHeight)},[d]),N.useEffect(()=>{f||Q||!fe||Z.current!==fe&&(Z.current=fe,requestAnimationFrame(()=>{O.current&&(O.current.scrollTop=O.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"})}))},[f,Q,fe]);function ye(_){if(_==="input")return"User Input";if(_==="permission")return"Permission";if(_==="confirmation")return"Confirmation"}function _e(_){return _==="started"?"Task started":_==="finished"?"Task finished":_==="failed"?"Task failed":_==="error"?"Command failed":_==="aborted"?"Task aborted":_==="confirmation"?"Task confirmed":_==="stopped"?"Follow-up stopped":_??""}return v.jsxs("div",{className:"run-detail",children:[v.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:v.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),Q?v.jsxs("div",{className:"empty-state",children:[v.jsx("p",{className:"empty-state-text",children:"No runs yet"}),v.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."})]}):f?v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[v.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),v.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),v.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"chat-thread",ref:O,children:[d.map((_,R)=>{const ee=M&&_.role==="assistant"&&!d.slice(R+1).some(A=>A.role==="assistant"||A.role==="user");return _.role==="status"&&_.type==="monitoring"?null:_.role==="status"?v.jsxs("div",{className:`chat-status${_.type==="error"?" chat-status--error":""}`,children:[v.jsxs("div",{children:[_e(_.type),_.time>0&&v.jsx("span",{className:"chat-status-time",children:zu(_.time)})]}),_.content&&v.jsx("pre",{className:"chat-status-detail",children:_.content})]},R):v.jsxs("div",{className:`chat-message chat-message--${_.role}`,children:[_.role==="assistant"&&w&&v.jsx("div",{className:"chat-message-agent",children:hd(w)}),v.jsxs("div",{className:"chat-message-content",children:[v.jsx(_b,{remarkPlugins:[Ob,Rb],children:_.content}),ee&&v.jsxs("div",{className:"chat-typing-indicator",children:[v.jsx("span",{}),v.jsx("span",{}),v.jsx("span",{})]})]}),_.attachments&&_.attachments.length>0&&v.jsx("div",{className:"chat-message-attachments",children:_.attachments.map(A=>v.jsx("button",{className:"chat-attachment-chip",onClick:()=>se(A),children:A},A))}),v.jsxs("div",{className:"chat-message-meta",children:[ye(_.type)&&v.jsx("span",{className:"chat-message-type",children:ye(_.type)}),_.time>0&&v.jsx("span",{children:zu(_.time)})]})]},R)}),M&&(()=>{const _=d.filter(R=>R.role!=="status");return _.length===0||_[_.length-1].role!=="assistant"})()&&v.jsxs("div",{className:"chat-message chat-message--assistant",children:[w&&v.jsx("div",{className:"chat-message-agent",children:hd(w)}),v.jsxs("div",{className:"chat-typing-indicator",children:[v.jsx("span",{}),v.jsx("span",{}),v.jsx("span",{})]})]}),g==="monitoring"&&v.jsxs("div",{className:"chat-monitoring-indicator",children:[v.jsx("span",{className:"chat-monitoring-dot"}),"Monitoring command output"]})]}),D?v.jsx("div",{className:"chat-abort-bar",children:v.jsx("button",{className:"btn btn-secondary chat-abort-btn",disabled:ae,onClick:async()=>{if(confirm("Abort this task?")){B(!0);try{await r("task.abort",{id:l})}catch(_){console.error("Abort failed:",_)}finally{B(!1)}}},children:ae?"Aborting...":"Abort Task"})}):U?v.jsx("div",{className:"chat-input-bar",children:v.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:ae,onClick:async()=>{B(!0);try{await r("task.stop_followup",{id:l,run_id:fe})}catch(_){console.error("Stop failed:",_)}finally{B(!1)}},children:v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:v.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):v.jsxs("form",{className:"chat-input-bar",onSubmit:async _=>{_.preventDefault();const R=z.trim();if(!(!R||Y)){$(!0);try{await r("task.followup",{id:l,run_id:fe,message:R}),V("")}catch(ee){console.error("Follow-up failed:",ee)}finally{$(!1)}}},children:[v.jsx("input",{ref:W,className:"chat-input",type:"text",placeholder:"Follow-up message",value:z,onChange:_=>V(_.target.value),disabled:Y}),v.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!z.trim()||Y,children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),v.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),q&&v.jsx("div",{className:"report-dialog-overlay",onClick:()=>H(null),children:v.jsxs("div",{className:"report-dialog",onClick:_=>_.stopPropagation(),children:[v.jsxs("div",{className:"report-dialog-header",children:[v.jsx("span",{className:"report-dialog-title",children:q.file}),v.jsx("button",{className:"report-dialog-close",onClick:()=>H(null),"aria-label":"Close",children:v.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),v.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),v.jsx("div",{className:"report-dialog-body",children:q.data_url?v.jsx("img",{src:q.data_url,alt:q.file,style:{maxWidth:"100%",height:"auto"}}):v.jsx(_b,{remarkPlugins:[Ob,Rb],components:{a:({..._})=>v.jsx("a",{..._,target:"_blank",rel:"noopener noreferrer"})},children:q.content??""})})]})})]})}function tO(){const{getActiveHost:e}=Il(),n=e(),r=N.useRef(null);N.useEffect(()=>{if(Er.isNativePlatform()||!n||n.directUrl||r.current===n.hostId)return;async function s(){var l;try{if(!("serviceWorker"in navigator)||!("PushManager"in window)){console.warn("[Push] Push notifications not supported");return}const u=await navigator.serviceWorker.ready;(l=u.active)==null||l.postMessage({type:"set-host-id",hostId:n.hostId});let c=await u.pushManager.getSubscription();if(!c){const{publicKey:m}=await ik("/api/push/vapid-key");if(!m){console.warn("[Push] No VAPID public key configured on server");return}if(await Notification.requestPermission()!=="granted"){console.log("[Push] Permission denied");return}c=await u.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:m})}const f=c.toJSON();await rk("/api/push/subscribe",{hostId:n.hostId,endpoint:f.endpoint,keys:{p256dh:f.keys.p256dh,auth:f.keys.auth}}),r.current=n.hostId}catch(u){console.error("[Push] Subscription failed:",u)}}s()},[n])}const nO="0.8.3";function rO(e,n){if(e.includes("-"))return!1;const r=e.split(".").map(Number),s=n.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 wl(){var Ye;const{pairedHosts:e,activeHostId:n,removePairedHost:r}=Il(),{connected:s,request:l,subscribeEvents:u,unauthorized:c}=Ju(),f=zi(),m=Cr(),d=zS(),y=Nx("(min-width: 768px)"),g=m.pathname.startsWith("/tasks"),b=d.runId?void 0:d.taskId,w=!!(d.taskId&&d.runId),[k,D]=N.useState(!1),[U,M]=N.useState(!1),[q,H]=N.useState(null),[ae,B]=N.useState(null),[z,V]=N.useState({}),[Y,$]=N.useState([]),[O,W]=N.useState(),[Z,fe]=N.useState(new Map),[J,Q]=N.useState(new Map),[P,se]=N.useState(new Map),[ye,_e]=N.useState(new Map);tO(),N.useEffect(()=>{window.scrollTo(0,0)},[n]),N.useEffect(()=>{s&&l("host.info").then(me=>{var Be,He,Qe,Et,Ze,Ht;$(me.agents??[]),W(me.host_platform),V(me.capability_tokens??{}),lk(me.agents??[]);const Le=me.version??null;B(Le),D(!!Le&&rO(Le,nO));const be=new Map,ze=new Map,qe=new Map,$e=new Map;for(const Ge of me.pending_prompts??[])if(Ge.type==="confirmation")be.set(Ge.key,{description:((Be=Ge.meta)==null?void 0:Be.description)??"",sessionName:(He=Ge.meta)==null?void 0:He.session_name});else if(Ge.type==="permission")ze.set(Ge.key,{permissions:Ge.params??[],sessionName:(Qe=Ge.meta)==null?void 0:Qe.session_name});else if(Ge.type==="input"){const fn=Ge.params??((Et=Ge.meta)==null?void 0:Et.input_questions)??[];qe.set(Ge.key,{questions:fn,description:(Ze=Ge.meta)==null?void 0:Ze.description,sessionName:(Ht=Ge.meta)==null?void 0:Ht.session_name}),$e.set(Ge.key,new Array(fn.length).fill(""))}fe(be),Q(ze),se(qe),_e($e)}).catch(()=>{})},[s,n,l]),N.useEffect(()=>!s||!n?void 0:u(n,Le=>{const be=Le.subject.split(".");if(be.length<3)return;const ze=be.slice(2).join(".");let qe={};try{qe=JSON.parse(new TextDecoder().decode(Le.data))}catch{return}const $e=qe.event_type,Be=qe.session_id;if($e==="input-request"&&Be){const He=qe.input_questions,Qe=qe.session_name,Et=qe.description;He!=null&&He.length&&(se(Ze=>{if(Ze.has(Be))return Ze;const Ht=new Map(Ze);return Ht.set(Be,{questions:He,description:Et,sessionName:Qe}),Ht}),_e(Ze=>{if(Ze.has(Be))return Ze;const Ht=new Map(Ze);return Ht.set(Be,new Array(He.length).fill("")),Ht}));return}if($e==="input-resolved"&&Be){se(He=>{if(!He.has(Be))return He;const Qe=new Map(He);return Qe.delete(Be),Qe}),_e(He=>{const Qe=new Map(He);return Qe.delete(Be),Qe});return}if($e==="confirm-request"&&Be){const He=qe.description,Qe=qe.session_name;He&&fe(Et=>{if(Et.has(Be))return Et;const Ze=new Map(Et);return Ze.set(Be,{description:He,sessionName:Qe}),Ze});return}if($e==="confirm-resolved"&&Be){fe(He=>{if(!He.has(Be))return He;const Qe=new Map(He);return Qe.delete(Be),Qe});return}if($e==="permission-request"){const He=qe.required_permissions,Qe=qe.session_name;He!=null&&He.length&&Q(Et=>{if(Et.has(ze))return Et;const Ze=new Map(Et);return Ze.set(ze,{permissions:He,sessionName:Qe}),Ze});return}if($e==="permission-resolved"){Q(He=>{if(!He.has(ze))return He;const Qe=new Map(He);return Qe.delete(ze),Qe});return}}),[s,n,u]);async function _(me,Le){try{await l("task.user_input",{id:me,value:[Le]})}catch(be){console.error("[Dashboard] Failed to respond to confirmation:",be)}}async function R(me,Le){try{await l("task.user_input",{id:me,value:[Le]})}catch(be){console.error("[Dashboard] Failed to respond to permission request:",be)}}async function ee(me,Le){try{await l("task.user_input",{id:me,value:Le})}catch(be){console.error("[Dashboard] Failed to respond to input request:",be)}}function A(me,Le){fs()&&f(Le?`/runs/${encodeURIComponent(me)}/${encodeURIComponent(Le)}`:`/runs/${encodeURIComponent(me)}`)}async function ve(){M(!0),H(null);try{const me=await l("host.update");if(me.error){H(me.error),M(!1);return}}catch{}setTimeout(()=>window.location.reload(),15e3)}const Ne=e.length>0,je=Ne&&s&&n&&!c,Ue=((Ye=e.find(me=>me.hostId===n))==null?void 0:Ye.clientToken)??null;return v.jsxs("div",{className:"dashboard",children:[y&&v.jsx(B0,{daemonVersion:ae,capabilityTokens:z,activeClientToken:Ue,request:l,onCapabilityTokensChange:V}),v.jsxs("div",{className:"dashboard-content",children:[v.jsxs("header",{className:"app-header",children:[v.jsxs("div",{className:"app-title-bar",children:[!y&&v.jsx(B0,{daemonVersion:ae,capabilityTokens:z,activeClientToken:Ue,request:l,onCapabilityTokensChange:V}),v.jsx("h1",{className:"app-title",children:"Palmier"})]}),v.jsx("div",{className:"tab-bar",children:v.jsx(Sk,{})})]}),v.jsx("main",{className:"dashboard-main",children:c?v.jsxs("div",{className:"revoked-state",children:[v.jsx("div",{className:"revoked-icon",children:v.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),v.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),v.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),v.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),v.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),v.jsx("div",{className:"revoked-command",children:v.jsx("code",{children:"palmier pair"})}),v.jsxs("div",{className:"revoked-actions",children:[v.jsx("button",{className:"btn btn-primary",onClick:()=>{fs()&&f("/pair")},children:"Re-pair Device"}),v.jsx("button",{className:"btn btn-secondary",onClick:()=>{n&&r(n)},children:"Remove Host"})]})]}):je?v.jsxs(v.Fragment,{children:[g&&!w&&v.jsx(wk,{connected:s,hostId:n,request:l,subscribeEvents:u,agents:Y,hostPlatform:O,onViewRun:A}),w?v.jsx(eO,{connected:s,hostId:n,request:l,subscribeEvents:u,taskId:d.taskId,runId:decodeURIComponent(d.runId)}):g?null:v.jsx(Nk,{connected:s,hostId:n,request:l,subscribeEvents:u,agents:Y,filterTaskId:b,onClearFilter:()=>{fs()&&f("/")}})]}):v.jsxs("div",{className:"empty-state",children:[v.jsx("p",{children:Ne?"Connecting to host...":"No host computer paired yet."}),!Ne&&v.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Pair Host"})]})}),k&&!U&&!q&&v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Update Required"}),v.jsxs("p",{className:"confirm-modal-message",children:["Your Palmier host",ae?` (v${ae})`:""," is too old for this version of the app. Please update to continue."]}),v.jsx("div",{className:"confirm-modal-actions",children:v.jsx("button",{className:"btn btn-primary",onClick:ve,children:"Update Now"})})]})}),U&&v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),v.jsx("p",{className:"confirm-modal-message",children:"Installing update and restarting daemon. Please wait..."})]})}),q&&v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),v.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:q}),v.jsx("div",{className:"confirm-modal-actions",children:v.jsx("button",{className:"btn btn-secondary",onClick:()=>{H(null)},children:"Retry"})})]})})]}),ta.createPortal(v.jsxs(v.Fragment,{children:[[...Z.entries()].map(([me,{description:Le,sessionName:be}])=>v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),be&&v.jsx("p",{className:"confirm-modal-subtitle",children:be}),v.jsx("p",{className:"confirm-modal-message",children:Le}),v.jsxs("div",{className:"confirm-modal-actions",children:[v.jsx("button",{className:"btn btn-primary",onClick:()=>_(me,"confirmed"),children:"Confirm"}),v.jsx("button",{className:"btn btn-secondary",onClick:()=>_(me,"aborted"),children:"Abort"})]})]})},me)),[...J.entries()].map(([me,{permissions:Le,sessionName:be}])=>v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal permission-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),v.jsx("p",{className:"confirm-modal-message",children:v.jsx("strong",{children:be||me})}),v.jsx("div",{className:"permission-list",children:Le.map((ze,qe)=>v.jsxs("div",{className:"permission-item",children:[v.jsx("span",{className:"permission-name",children:ze.name}),ze.description&&v.jsx("span",{className:"permission-desc",children:ze.description})]},qe))}),v.jsxs("div",{className:"permission-actions",children:[v.jsx("button",{className:"btn btn-primary",onClick:()=>R(me,"granted"),children:"Allow Once"}),v.jsx("button",{className:"btn btn-secondary",onClick:()=>R(me,"granted_all"),children:"Allow Always"})]}),v.jsx("button",{className:"permission-abort-link",onClick:()=>R(me,"aborted"),children:"Deny & Abort Task"})]})},me)),[...P.entries()].map(([me,{questions:Le,description:be,sessionName:ze}])=>{const qe=ye.get(me)??new Array(Le.length).fill("");return v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal input-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),ze&&v.jsx("p",{className:"confirm-modal-subtitle",children:ze}),be&&v.jsx("p",{className:"confirm-modal-message",children:be}),v.jsx("div",{className:"input-list",children:Le.map(($e,Be)=>v.jsxs("div",{className:"input-item",children:[v.jsx("label",{className:"input-label",children:$e}),v.jsx("input",{type:"text",className:"input-field",value:qe[Be]??"",onChange:He=>{_e(Qe=>{const Et=new Map(Qe),Ze=[...Et.get(me)??[]];return Ze[Be]=He.target.value,Et.set(me,Ze),Et})},autoFocus:Be===0})]},Be))}),v.jsx("div",{className:"input-actions",children:v.jsx("button",{className:"btn btn-primary",disabled:qe.some($e=>!$e.trim()),onClick:()=>ee(me,qe),children:"Submit"})}),v.jsx("button",{className:"permission-abort-link",onClick:()=>ee(me,["aborted"]),children:"Cancel"})]})},me)})]}),document.body)]})}const iO=xa("Preferences",{web:()=>jx(()=>import("./web-C6lkQj9J.js"),[]).then(e=>new e.PreferencesWeb)}),Sl=!!window.__PALMIER_SERVE__;function sO(){const[e,n]=N.useState(""),[r,s]=N.useState(!1),[l,u]=N.useState(null),{addPairedHost:c}=Il(),f=zi();async function m(){const d=e.trim().toUpperCase();if(!d){u("Enter a pairing code.");return}s(!0),u(null);try{let y;if(Sl){const b=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,label:navigator.userAgent})});if(!b.ok){const w=await b.json().catch(()=>({error:"Connection failed"}));throw new Error(w.error||`HTTP ${b.status}`)}y=await b.json()}else{const b=await fetch(`${Lu}/api/config`);if(!b.ok)throw new Error("Failed to fetch server config");const w=await b.json();if(!w.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const k=await Sx({servers:w.natsWsUrl,authenticator:dx(w.natsJwt,new TextEncoder().encode(w.natsNkeySeed))}),D=Tu(),U=`pair.${d}`,M=await k.request(U,D.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});y=JSON.parse(D.decode(M.data)),await k.close()}const g={hostId:y.hostId,clientToken:y.clientToken,directUrl:Sl?window.location.origin:void 0};if(c(g),Er.isNativePlatform()&&zt){await iO.set({key:"hostId",value:y.hostId});try{const{token:b}=await zt.getFcmToken();await fetch(`${Lu}/api/fcm/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hostId:y.hostId,fcmToken:b})})}catch(b){console.warn("FCM token registration failed:",b)}}f("/")}catch(y){const g=y instanceof Error?y.message:String(y);g.includes("timeout")||g.includes("TIMEOUT")||g.includes("503")||g.toLowerCase().includes("no responders")?u("Code not found or expired. Check the code and try again."):u(g)}finally{s(!1)}}return v.jsx("div",{className:"pair-page",children:v.jsxs("div",{className:"pair-card",children:[v.jsxs("div",{className:"pair-header",children:[v.jsx("h1",{className:"pair-title",children:Sl?"Pair":"Pair with Host"}),v.jsx("p",{className:"pair-subtitle",children:Sl?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!Sl&&v.jsxs("div",{className:"pair-instructions",children:[v.jsxs("div",{className:"pair-instruction-block",children:[v.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),v.jsxs("ol",{className:"pair-steps",children:[v.jsxs("li",{children:["Install at least one agent CLI (e.g., ",v.jsx("a",{href:"https://www.palmier.me/agents",target:"_blank",rel:"noopener noreferrer",children:"Claude Code, Gemini CLI, Codex CLI"}),")"]}),v.jsxs("li",{children:["Install Palmier on your host machine:",v.jsx("code",{className:"pair-command",children:"npm install -g palmier"})]}),v.jsxs("li",{children:["Run the setup wizard:",v.jsx("code",{className:"pair-command",children:"palmier init"})]}),v.jsx("li",{children:"A pairing code will display automatically"})]})]}),v.jsx("div",{className:"pair-instruction-divider"}),v.jsxs("div",{className:"pair-instruction-block",children:[v.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),v.jsxs("ol",{className:"pair-steps",children:[v.jsxs("li",{children:["Run ",v.jsx("code",{children:"palmier pair"})," on the host machine"]}),v.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),v.jsxs("div",{className:"pair-form",children:[v.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",v.jsx("input",{id:"pair-code",type:"text",maxLength:6,value:e,onChange:d=>n(d.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:r})]}),l&&v.jsx("p",{className:"pair-error",children:l}),v.jsxs("button",{className:"btn btn-primary btn-full",onClick:m,disabled:r||!e.trim(),children:[r&&v.jsx("span",{className:"btn-spinner"}),r?"Pairing...":"Pair"]}),v.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>f("/"),disabled:r,children:"Cancel"}),v.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",v.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",v.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function aO(){const e=zi();return N.useEffect(()=>{if(!zt)return;const n=zt.addListener("deepLink",({path:r})=>e(r));return()=>{n.then(r=>r.remove())}},[e]),null}function lO(){return v.jsx(L_,{children:v.jsxs(ak,{children:[v.jsx(aO,{}),v.jsxs(QS,{children:[v.jsx(us,{path:"/",element:v.jsx(wl,{})}),v.jsx(us,{path:"/tasks",element:v.jsx(wl,{})}),v.jsx(us,{path:"/runs",element:v.jsx(wl,{})}),v.jsx(us,{path:"/runs/:taskId",element:v.jsx(wl,{})}),v.jsx(us,{path:"/runs/:taskId/:runId",element:v.jsx(wl,{})}),v.jsx(us,{path:"/pair",element:v.jsx(sO,{})})]})]})})}Ww.createRoot(document.getElementById("root")).render(v.jsx(N.StrictMode,{children:v.jsx(w_,{children:v.jsx(lO,{})})}));export{Pd as W};
|