palmier 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,120 @@
1
+ var Hw=Object.defineProperty;var Iw=(e,n,r)=>n in e?Hw(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var C=(e,n,r)=>Iw(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 Nb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lh={exports:{}},cl={};/**
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 Iy;function Fw(){if(Iy)return cl;Iy=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 cl.Fragment=n,cl.jsx=r,cl.jsxs=r,cl}var Fy;function $w(){return Fy||(Fy=1,lh.exports=Fw()),lh.exports}var w=$w(),oh={exports:{}},Fe={};/**
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 $y;function Yw(){if($y)return Fe;$y=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 v(O){return O===null||typeof O!="object"?null:(O=b&&O[b]||O["@@iterator"],typeof O=="function"?O:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,U={};function R(O,Z,A){this.props=O,this.context=Z,this.refs=U,this.updater=A||k}R.prototype.isReactComponent={},R.prototype.setState=function(O,Z){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,Z,"setState")},R.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function P(){}P.prototype=R.prototype;function q(O,Z,A){this.props=O,this.context=Z,this.refs=U,this.updater=A||k}var ae=q.prototype=new P;ae.constructor=q,M(ae,R.prototype),ae.isPureReactComponent=!0;var B=Array.isArray;function L(){}var K={H:null,A:null,T:null,S:null},Y=Object.prototype.hasOwnProperty;function $(O,Z,A){var xe=A.ref;return{$$typeof:e,type:O,key:Z,ref:xe!==void 0?xe:null,props:A}}function N(O,Z){return $(O.type,Z,O.props)}function G(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function J(O){var Z={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(A){return Z[A]})}var le=/\/+/g;function re(O,Z){return typeof O=="object"&&O!==null&&O.key!=null?J(""+O.key):Z.toString(36)}function W(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(L,L):(O.status="pending",O.then(function(Z){O.status==="pending"&&(O.status="fulfilled",O.value=Z)},function(Z){O.status==="pending"&&(O.status="rejected",O.reason=Z)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function I(O,Z,A,xe,he){var Se=typeof O;(Se==="undefined"||Se==="boolean")&&(O=null);var Te=!1;if(O===null)Te=!0;else switch(Se){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(O.$$typeof){case e:case n:Te=!0;break;case y:return Te=O._init,I(Te(O._payload),Z,A,xe,he)}}if(Te)return he=he(O),Te=xe===""?"."+re(O,0):xe,B(he)?(A="",Te!=null&&(A=Te.replace(le,"$&/")+"/"),I(he,Z,A,"",function(Le){return Le})):he!=null&&(G(he)&&(he=N(he,A+(he.key==null||O&&O.key===he.key?"":(""+he.key).replace(le,"$&/")+"/")+Te)),Z.push(he)),1;Te=0;var ze=xe===""?".":xe+":";if(B(O))for(var ue=0;ue<O.length;ue++)xe=O[ue],Se=ze+re(xe,ue),Te+=I(xe,Z,A,Se,he);else if(ue=v(O),typeof ue=="function")for(O=ue.call(O),ue=0;!(xe=O.next()).done;)xe=xe.value,Se=ze+re(xe,ue++),Te+=I(xe,Z,A,Se,he);else if(Se==="object"){if(typeof O.then=="function")return I(W(O),Z,A,xe,he);throw Z=String(O),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return Te}function oe(O,Z,A){if(O==null)return O;var xe=[],he=0;return I(O,xe,"","",function(Se){return Z.call(A,Se,he++)}),xe}function ye(O){if(O._status===-1){var Z=O._result;Z=Z(),Z.then(function(A){(O._status===0||O._status===-1)&&(O._status=1,O._result=A)},function(A){(O._status===0||O._status===-1)&&(O._status=2,O._result=A)}),O._status===-1&&(O._status=0,O._result=Z)}if(O._status===1)return O._result.default;throw O._result}var ke=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},_={map:oe,forEach:function(O,Z,A){oe(O,function(){Z.apply(this,arguments)},A)},count:function(O){var Z=0;return oe(O,function(){Z++}),Z},toArray:function(O){return oe(O,function(Z){return Z})||[]},only:function(O){if(!G(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return Fe.Activity=g,Fe.Children=_,Fe.Component=R,Fe.Fragment=r,Fe.Profiler=l,Fe.PureComponent=q,Fe.StrictMode=s,Fe.Suspense=m,Fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=K,Fe.__COMPILER_RUNTIME={__proto__:null,c:function(O){return K.H.useMemoCache(O)}},Fe.cache=function(O){return function(){return O.apply(null,arguments)}},Fe.cacheSignal=function(){return null},Fe.cloneElement=function(O,Z,A){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var xe=M({},O.props),he=O.key;if(Z!=null)for(Se in Z.key!==void 0&&(he=""+Z.key),Z)!Y.call(Z,Se)||Se==="key"||Se==="__self"||Se==="__source"||Se==="ref"&&Z.ref===void 0||(xe[Se]=Z[Se]);var Se=arguments.length-2;if(Se===1)xe.children=A;else if(1<Se){for(var Te=Array(Se),ze=0;ze<Se;ze++)Te[ze]=arguments[ze+2];xe.children=Te}return $(O.type,he,xe)},Fe.createContext=function(O){return O={$$typeof:c,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:u,_context:O},O},Fe.createElement=function(O,Z,A){var xe,he={},Se=null;if(Z!=null)for(xe in Z.key!==void 0&&(Se=""+Z.key),Z)Y.call(Z,xe)&&xe!=="key"&&xe!=="__self"&&xe!=="__source"&&(he[xe]=Z[xe]);var Te=arguments.length-2;if(Te===1)he.children=A;else if(1<Te){for(var ze=Array(Te),ue=0;ue<Te;ue++)ze[ue]=arguments[ue+2];he.children=ze}if(O&&O.defaultProps)for(xe in Te=O.defaultProps,Te)he[xe]===void 0&&(he[xe]=Te[xe]);return $(O,Se,he)},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(O){return{$$typeof:f,render:O}},Fe.isValidElement=G,Fe.lazy=function(O){return{$$typeof:y,_payload:{_status:-1,_result:O},_init:ye}},Fe.memo=function(O,Z){return{$$typeof:d,type:O,compare:Z===void 0?null:Z}},Fe.startTransition=function(O){var Z=K.T,A={};K.T=A;try{var xe=O(),he=K.S;he!==null&&he(A,xe),typeof xe=="object"&&xe!==null&&typeof xe.then=="function"&&xe.then(L,ke)}catch(Se){ke(Se)}finally{Z!==null&&A.types!==null&&(Z.types=A.types),K.T=Z}},Fe.unstable_useCacheRefresh=function(){return K.H.useCacheRefresh()},Fe.use=function(O){return K.H.use(O)},Fe.useActionState=function(O,Z,A){return K.H.useActionState(O,Z,A)},Fe.useCallback=function(O,Z){return K.H.useCallback(O,Z)},Fe.useContext=function(O){return K.H.useContext(O)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(O,Z){return K.H.useDeferredValue(O,Z)},Fe.useEffect=function(O,Z){return K.H.useEffect(O,Z)},Fe.useEffectEvent=function(O){return K.H.useEffectEvent(O)},Fe.useId=function(){return K.H.useId()},Fe.useImperativeHandle=function(O,Z,A){return K.H.useImperativeHandle(O,Z,A)},Fe.useInsertionEffect=function(O,Z){return K.H.useInsertionEffect(O,Z)},Fe.useLayoutEffect=function(O,Z){return K.H.useLayoutEffect(O,Z)},Fe.useMemo=function(O,Z){return K.H.useMemo(O,Z)},Fe.useOptimistic=function(O,Z){return K.H.useOptimistic(O,Z)},Fe.useReducer=function(O,Z,A){return K.H.useReducer(O,Z,A)},Fe.useRef=function(O){return K.H.useRef(O)},Fe.useState=function(O){return K.H.useState(O)},Fe.useSyncExternalStore=function(O,Z,A){return K.H.useSyncExternalStore(O,Z,A)},Fe.useTransition=function(){return K.H.useTransition()},Fe.version="19.2.4",Fe}var Yy;function _d(){return Yy||(Yy=1,oh.exports=Yw()),oh.exports}var D=_d(),uh={exports:{}},fl={},ch={exports:{}},fh={};/**
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 Gy;function Gw(){return Gy||(Gy=1,(function(e){function n(I,oe){var ye=I.length;I.push(oe);e:for(;0<ye;){var ke=ye-1>>>1,_=I[ke];if(0<l(_,oe))I[ke]=oe,I[ye]=_,ye=ke;else break e}}function r(I){return I.length===0?null:I[0]}function s(I){if(I.length===0)return null;var oe=I[0],ye=I.pop();if(ye!==oe){I[0]=ye;e:for(var ke=0,_=I.length,O=_>>>1;ke<O;){var Z=2*(ke+1)-1,A=I[Z],xe=Z+1,he=I[xe];if(0>l(A,ye))xe<_&&0>l(he,A)?(I[ke]=he,I[xe]=ye,ke=xe):(I[ke]=A,I[Z]=ye,ke=Z);else if(xe<_&&0>l(he,ye))I[ke]=he,I[xe]=ye,ke=xe;else break e}}return oe}function l(I,oe){var ye=I.sortIndex-oe.sortIndex;return ye!==0?ye:I.id-oe.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,v=!1,k=!1,M=!1,U=!1,R=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function ae(I){for(var oe=r(d);oe!==null;){if(oe.callback===null)s(d);else if(oe.startTime<=I)s(d),oe.sortIndex=oe.expirationTime,n(m,oe);else break;oe=r(d)}}function B(I){if(M=!1,ae(I),!k)if(r(m)!==null)k=!0,L||(L=!0,J());else{var oe=r(d);oe!==null&&W(B,oe.startTime-I)}}var L=!1,K=-1,Y=5,$=-1;function N(){return U?!0:!(e.unstable_now()-$<Y)}function G(){if(U=!1,L){var I=e.unstable_now();$=I;var oe=!0;try{e:{k=!1,M&&(M=!1,P(K),K=-1),v=!0;var ye=b;try{t:{for(ae(I),g=r(m);g!==null&&!(g.expirationTime>I&&N());){var ke=g.callback;if(typeof ke=="function"){g.callback=null,b=g.priorityLevel;var _=ke(g.expirationTime<=I);if(I=e.unstable_now(),typeof _=="function"){g.callback=_,ae(I),oe=!0;break t}g===r(m)&&s(m),ae(I)}else s(m);g=r(m)}if(g!==null)oe=!0;else{var O=r(d);O!==null&&W(B,O.startTime-I),oe=!1}}break e}finally{g=null,b=ye,v=!1}oe=void 0}}finally{oe?J():L=!1}}}var J;if(typeof q=="function")J=function(){q(G)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,re=le.port2;le.port1.onmessage=G,J=function(){re.postMessage(null)}}else J=function(){R(G,0)};function W(I,oe){K=R(function(){I(e.unstable_now())},oe)}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(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(I){switch(b){case 1:case 2:case 3:var oe=3;break;default:oe=b}var ye=b;b=oe;try{return I()}finally{b=ye}},e.unstable_requestPaint=function(){U=!0},e.unstable_runWithPriority=function(I,oe){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var ye=b;b=I;try{return oe()}finally{b=ye}},e.unstable_scheduleCallback=function(I,oe,ye){var ke=e.unstable_now();switch(typeof ye=="object"&&ye!==null?(ye=ye.delay,ye=typeof ye=="number"&&0<ye?ke+ye:ke):ye=ke,I){case 1:var _=-1;break;case 2:_=250;break;case 5:_=1073741823;break;case 4:_=1e4;break;default:_=5e3}return _=ye+_,I={id:y++,callback:oe,priorityLevel:I,startTime:ye,expirationTime:_,sortIndex:-1},ye>ke?(I.sortIndex=ye,n(d,I),r(m)===null&&I===r(d)&&(M?(P(K),K=-1):M=!0,W(B,ye-ke))):(I.sortIndex=_,n(m,I),k||v||(k=!0,L||(L=!0,J()))),I},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(I){var oe=b;return function(){var ye=b;b=oe;try{return I.apply(this,arguments)}finally{b=ye}}}})(fh)),fh}var Vy;function Vw(){return Vy||(Vy=1,ch.exports=Gw()),ch.exports}var hh={exports:{}},ln={};/**
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 Jy;function Jw(){if(Jy)return ln;Jy=1;var e=_d();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 ln.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,ln.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)},ln.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()}},ln.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))},ln.prefetchDNS=function(m){typeof m=="string"&&s.d.D(m)},ln.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,v=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:v}):y==="script"&&s.d.X(m,{crossOrigin:g,integrity:b,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},ln.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)},ln.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})}},ln.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)},ln.requestFormReset=function(m){s.d.r(m)},ln.unstable_batchedUpdates=function(m,d){return m(d)},ln.useFormState=function(m,d,y){return c.H.useFormState(m,d,y)},ln.useFormStatus=function(){return c.H.useHostTransitionStatus()},ln.version="19.2.4",ln}var Xy;function Rb(){if(Xy)return hh.exports;Xy=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(),hh.exports=Jw(),hh.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 Ky;function Xw(){if(Ky)return fl;Ky=1;var e=Vw(),n=_d(),r=Rb();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"),v=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),q=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),N=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function J(t){return t===null||typeof t!="object"?null:(t=G&&t[G]||t["@@iterator"],typeof t=="function"?t:null)}var le=Symbol.for("react.client.reference");function re(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===le?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case M:return"Fragment";case R:return"Profiler";case U:return"StrictMode";case B:return"Suspense";case L:return"SuspenseList";case $:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case q:return t.displayName||"Context";case P: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 K:return i=t.displayName||null,i!==null?i:re(t.type)||"Memo";case Y:i=t._payload,t=t._init;try{return re(t(i))}catch{}}return null}var W=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ye={pending:!1,data:null,method:null,action:null},ke=[],_=-1;function O(t){return{current:t}}function Z(t){0>_||(t.current=ke[_],ke[_]=null,_--)}function A(t,i){_++,ke[_]=t.current,t.current=i}var xe=O(null),he=O(null),Se=O(null),Te=O(null);function ze(t,i){switch(A(Se,i),A(he,t),A(xe,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?fy(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=fy(i),t=hy(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Z(xe),A(xe,t)}function ue(){Z(xe),Z(he),Z(Se)}function Le(t){t.memoizedState!==null&&A(Te,t);var i=xe.current,a=hy(i,t.type);i!==a&&(A(he,t),A(xe,a))}function We(t){he.current===t&&(Z(xe),Z(he)),Te.current===t&&(Z(Te),al._currentValue=ye)}var wt,Ie;function it(t){if(wt===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);wt=i&&i[1]||"",Ie=-1<a.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+wt+t+Ie}var nt=!1;function He(t,i){if(!t||nt)return"";nt=!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(se){var ne=se}Reflect.construct(t,[],ge)}else{try{ge.call()}catch(se){ne=se}t.call(ge.prototype)}}else{try{throw Error()}catch(se){ne=se}(ge=t())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(se){if(se&&ne&&typeof se.stack=="string")return[se.stack,ne.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 H=x.split(`
44
+ `),te=S.split(`
45
+ `);for(h=o=0;o<H.length&&!H[o].includes("DetermineComponentFrameRoot");)o++;for(;h<te.length&&!te[h].includes("DetermineComponentFrameRoot");)h++;if(o===H.length||h===te.length)for(o=H.length-1,h=te.length-1;1<=o&&0<=h&&H[o]!==te[h];)h--;for(;1<=o&&0<=h;o--,h--)if(H[o]!==te[h]){if(o!==1||h!==1)do if(o--,h--,0>h||H[o]!==te[h]){var ce=`
46
+ `+H[o].replace(" at new "," at ");return t.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",t.displayName)),ce}while(1<=o&&0<=h);break}}}finally{nt=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?it(a):""}function at(t,i){switch(t.tag){case 26:case 27:case 5:return it(t.type);case 16:return it("Lazy");case 13:return t.child!==i&&i!==null?it("Suspense Fallback"):it("Suspense");case 19:return it("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 it("Activity");default:return""}}function we(t){try{var i="",a=null;do i+=at(t,a),a=t,t=t.return;while(t);return i}catch(o){return`
47
+ Error generating stack: `+o.message+`
48
+ `+o.stack}}var Me=Object.prototype.hasOwnProperty,Pe=e.unstable_scheduleCallback,$e=e.unstable_cancelCallback,Gt=e.unstable_shouldYield,Hn=e.unstable_requestPaint,Ct=e.unstable_now,xa=e.unstable_getCurrentPriorityLevel,fe=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,qe=e.unstable_NormalPriority,Je=e.unstable_LowPriority,ot=e.unstable_IdlePriority,cn=e.log,In=e.unstable_setDisableYieldValue,en=null,St=null;function Vt(t){if(typeof cn=="function"&&In(t),St&&typeof St.setStrictMode=="function")try{St.setStrictMode(en,t)}catch{}}var ht=Math.clz32?Math.clz32:hs,Fn=Math.log,fn=Math.LN2;function hs(t){return t>>>=0,t===0?32:31-(Fn(t)/fn|0)|0}var Wr=256,Ar=262144,ei=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 Pi(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 qi(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function va(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 ds(){var t=ei;return ei<<=1,(ei&62914560)===0&&(ei=4194304),t}function ti(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 ni(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,H=t.expirationTimes,te=t.hiddenUpdates;for(a=x&~a;0<a;){var ce=31-ht(a),ge=1<<ce;S[ce]=0,H[ce]=-1;var ne=te[ce];if(ne!==null)for(te[ce]=null,ce=0;ce<ne.length;ce++){var se=ne[ce];se!==null&&(se.lane&=-536870913)}a&=~ge}o!==0&&ri(t,o,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(x&~i))}function ri(t,i,a){t.pendingLanes|=i,t.suspendedLanes&=~i;var o=31-ht(i);t.entangledLanes|=i,t.entanglements[o]=t.entanglements[o]|1073741824|a&261930}function Hi(t,i){var a=t.entangledLanes|=i;for(t=t.entanglements;a;){var o=31-ht(a),h=1<<o;h&i|t[o]&i&&(t[o]|=i),a&=~h}}function ii(t,i){var a=i&-i;return a=(a&42)!==0?1:Tr(a),(a&(t.suspendedLanes|i))!==0?0:a}function Tr(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 Ii(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function wa(){var t=oe.p;return t!==0?t:(t=window.event,t===void 0?32:zy(t.type))}function Gl(t,i){var a=oe.p;try{return oe.p=t,i()}finally{oe.p=a}}var mr=Math.random().toString(36).slice(2),_t="__reactFiber$"+mr,zt="__reactProps$"+mr,Cn="__reactContainer$"+mr,Fi="__reactEvents$"+mr,Sa="__reactListeners$"+mr,Vl="__reactHandles$"+mr,Jl="__reactResources$"+mr,Jt="__reactMarker$"+mr;function ms(t){delete t[_t],delete t[zt],delete t[Fi],delete t[Sa],delete t[Vl]}function E(t){var i=t[_t];if(i)return i;for(var a=t.parentNode;a;){if(i=a[Cn]||a[_t]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(t=xy(t);t!==null;){if(a=t[_t])return a;t=xy(t)}return i}t=a,a=t.parentNode}return null}function j(t){if(t=t[_t]||t[Cn]){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 z(t){var i=t[Jl];return i||(i=t[Jl]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function F(t){t[Jt]=!0}var Q=new Set,pe={};function be(t,i){ie(t,i),ie(t+"Capture",i)}function ie(t,i){for(pe[t]=i,t=0;t<i.length;t++)Q.add(i[t])}var me=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Oe={},Xe={};function Tt(t){return Me.call(Xe,t)?!0:Me.call(Oe,t)?!1:me.test(t)?Xe[t]=!0:(Oe[t]=!0,!1)}function an(t,i,a){if(Tt(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 jr(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 $n(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function rm(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function D1(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 Wu(t){if(!t._valueTracker){var i=rm(t)?"checked":"value";t._valueTracker=D1(t,i,""+t[i])}}function im(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var a=i.getValue(),o="";return t&&(o=rm(t)?t.checked?"true":"false":t.value),t=o,t!==a?(i.setValue(t),!0):!1}function Xl(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 z1=/[\n"\\]/g;function Yn(t){return t.replace(z1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function ec(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=""+$n(i)):t.value!==""+$n(i)&&(t.value=""+$n(i)):x!=="submit"&&x!=="reset"||t.removeAttribute("value"),i!=null?tc(t,x,$n(i)):a!=null?tc(t,x,$n(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=""+$n(S):t.removeAttribute("name")}function sm(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)){Wu(t);return}a=a!=null?""+$n(a):"",i=i!=null?""+$n(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),Wu(t)}function tc(t,i,a){i==="number"&&Xl(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function ps(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=""+$n(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 am(t,i,a){if(i!=null&&(i=""+$n(i),i!==t.value&&(t.value=i),a==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=a!=null?""+$n(a):""}function lm(t,i,a,o){if(i==null){if(o!=null){if(a!=null)throw Error(s(92));if(W(o)){if(1<o.length)throw Error(s(93));o=o[0]}a=o}a==null&&(a=""),i=a}a=$n(i),t.defaultValue=a,o=t.textContent,o===a&&o!==""&&o!==null&&(t.value=o),Wu(t)}function gs(t,i){if(i){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=i;return}}t.textContent=i}var L1=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 om(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||L1.has(i)?i==="float"?t.cssFloat=a:t[i]=(""+a).trim():t[i]=a+"px"}function um(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&&om(t,h,o)}else for(var p in i)i.hasOwnProperty(p)&&om(t,p,i[p])}function nc(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 U1=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"]]),B1=/^[\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 Kl(t){return B1.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Or(){}var rc=null;function ic(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ys=null,bs=null;function cm(t){var i=j(t);if(i&&(t=i.stateNode)){var a=t[zt]||null;e:switch(t=i.stateNode,i.type){case"input":if(ec(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="'+Yn(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var o=a[i];if(o!==t&&o.form===t.form){var h=o[zt]||null;if(!h)throw Error(s(90));ec(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&&im(o)}break e;case"textarea":am(t,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&ps(t,!!a.multiple,i,!1)}}}var sc=!1;function fm(t,i,a){if(sc)return t(i,a);sc=!0;try{var o=t(i);return o}finally{if(sc=!1,(ys!==null||bs!==null)&&(Bo(),ys&&(i=ys,t=bs,bs=ys=null,cm(i),t)))for(i=0;i<t.length;i++)cm(t[i])}}function _a(t,i){var a=t.stateNode;if(a===null)return null;var o=a[zt]||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 Nr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ac=!1;if(Nr)try{var Ea={};Object.defineProperty(Ea,"passive",{get:function(){ac=!0}}),window.addEventListener("test",Ea,Ea),window.removeEventListener("test",Ea,Ea)}catch{ac=!1}var si=null,lc=null,Ql=null;function hm(){if(Ql)return Ql;var t,i=lc,a=i.length,o,h="value"in si?si.value:si.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 Ql=h.slice(t,1<o?1-o:void 0)}function Zl(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 Wl(){return!0}function dm(){return!1}function bn(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)?Wl:dm,this.isPropagationStopped=dm,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=Wl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Wl)},persist:function(){},isPersistent:Wl}),i}var $i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eo=bn($i),ka=g({},$i,{view:0,detail:0}),P1=bn(ka),oc,uc,Ca,to=g({},ka,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fc,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!==Ca&&(Ca&&t.type==="mousemove"?(oc=t.screenX-Ca.screenX,uc=t.screenY-Ca.screenY):uc=oc=0,Ca=t),oc)},movementY:function(t){return"movementY"in t?t.movementY:uc}}),mm=bn(to),q1=g({},to,{dataTransfer:0}),H1=bn(q1),I1=g({},ka,{relatedTarget:0}),cc=bn(I1),F1=g({},$i,{animationName:0,elapsedTime:0,pseudoElement:0}),$1=bn(F1),Y1=g({},$i,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),G1=bn(Y1),V1=g({},$i,{data:0}),pm=bn(V1),J1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},X1={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"},K1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Q1(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=K1[t])?!!i[t]:!1}function fc(){return Q1}var Z1=g({},ka,{key:function(t){if(t.key){var i=J1[t.key]||t.key;if(i!=="Unidentified")return i}return t.type==="keypress"?(t=Zl(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?X1[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fc,charCode:function(t){return t.type==="keypress"?Zl(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Zl(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),W1=bn(Z1),ev=g({},to,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gm=bn(ev),tv=g({},ka,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fc}),nv=bn(tv),rv=g({},$i,{propertyName:0,elapsedTime:0,pseudoElement:0}),iv=bn(rv),sv=g({},to,{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}),av=bn(sv),lv=g({},$i,{newState:0,oldState:0}),ov=bn(lv),uv=[9,13,27,32],hc=Nr&&"CompositionEvent"in window,Aa=null;Nr&&"documentMode"in document&&(Aa=document.documentMode);var cv=Nr&&"TextEvent"in window&&!Aa,ym=Nr&&(!hc||Aa&&8<Aa&&11>=Aa),bm=" ",xm=!1;function vm(t,i){switch(t){case"keyup":return uv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var xs=!1;function fv(t,i){switch(t){case"compositionend":return wm(i);case"keypress":return i.which!==32?null:(xm=!0,bm);case"textInput":return t=i.data,t===bm&&xm?null:t;default:return null}}function hv(t,i){if(xs)return t==="compositionend"||!hc&&vm(t,i)?(t=hm(),Ql=lc=si=null,xs=!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 ym&&i.locale!=="ko"?null:i.data;default:return null}}var dv={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 Sm(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!dv[t.type]:i==="textarea"}function _m(t,i,a,o){ys?bs?bs.push(o):bs=[o]:ys=o,i=Yo(i,"onChange"),0<i.length&&(a=new eo("onChange","change",null,a,o),t.push({event:a,listeners:i}))}var Ta=null,ja=null;function mv(t){sy(t,0)}function no(t){var i=T(t);if(im(i))return t}function Em(t,i){if(t==="change")return i}var km=!1;if(Nr){var dc;if(Nr){var mc="oninput"in document;if(!mc){var Cm=document.createElement("div");Cm.setAttribute("oninput","return;"),mc=typeof Cm.oninput=="function"}dc=mc}else dc=!1;km=dc&&(!document.documentMode||9<document.documentMode)}function Am(){Ta&&(Ta.detachEvent("onpropertychange",Tm),ja=Ta=null)}function Tm(t){if(t.propertyName==="value"&&no(ja)){var i=[];_m(i,ja,t,ic(t)),fm(mv,i)}}function pv(t,i,a){t==="focusin"?(Am(),Ta=i,ja=a,Ta.attachEvent("onpropertychange",Tm)):t==="focusout"&&Am()}function gv(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return no(ja)}function yv(t,i){if(t==="click")return no(i)}function bv(t,i){if(t==="input"||t==="change")return no(i)}function xv(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var An=typeof Object.is=="function"?Object.is:xv;function Oa(t,i){if(An(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(!Me.call(i,h)||!An(t[h],i[h]))return!1}return!0}function jm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Om(t,i){var a=jm(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=jm(a)}}function Nm(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Nm(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Rm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=Xl(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=Xl(t.document)}return i}function pc(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 vv=Nr&&"documentMode"in document&&11>=document.documentMode,vs=null,gc=null,Na=null,yc=!1;function Mm(t,i,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;yc||vs==null||vs!==Xl(o)||(o=vs,"selectionStart"in o&&pc(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}),Na&&Oa(Na,o)||(Na=o,o=Yo(gc,"onSelect"),0<o.length&&(i=new eo("onSelect","select",null,i,a),t.push({event:i,listeners:o}),i.target=vs)))}function Yi(t,i){var a={};return a[t.toLowerCase()]=i.toLowerCase(),a["Webkit"+t]="webkit"+i,a["Moz"+t]="moz"+i,a}var ws={animationend:Yi("Animation","AnimationEnd"),animationiteration:Yi("Animation","AnimationIteration"),animationstart:Yi("Animation","AnimationStart"),transitionrun:Yi("Transition","TransitionRun"),transitionstart:Yi("Transition","TransitionStart"),transitioncancel:Yi("Transition","TransitionCancel"),transitionend:Yi("Transition","TransitionEnd")},bc={},Dm={};Nr&&(Dm=document.createElement("div").style,"AnimationEvent"in window||(delete ws.animationend.animation,delete ws.animationiteration.animation,delete ws.animationstart.animation),"TransitionEvent"in window||delete ws.transitionend.transition);function Gi(t){if(bc[t])return bc[t];if(!ws[t])return t;var i=ws[t],a;for(a in i)if(i.hasOwnProperty(a)&&a in Dm)return bc[t]=i[a];return t}var zm=Gi("animationend"),Lm=Gi("animationiteration"),Um=Gi("animationstart"),wv=Gi("transitionrun"),Sv=Gi("transitionstart"),_v=Gi("transitioncancel"),Bm=Gi("transitionend"),Pm=new Map,xc="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(" ");xc.push("scrollEnd");function lr(t,i){Pm.set(t,i),be(i,[t])}var ro=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)},Gn=[],Ss=0,vc=0;function io(){for(var t=Ss,i=vc=Ss=0;i<t;){var a=Gn[i];Gn[i++]=null;var o=Gn[i];Gn[i++]=null;var h=Gn[i];Gn[i++]=null;var p=Gn[i];if(Gn[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&&qm(a,h,p)}}function so(t,i,a,o){Gn[Ss++]=t,Gn[Ss++]=i,Gn[Ss++]=a,Gn[Ss++]=o,vc|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function wc(t,i,a,o){return so(t,i,a,o),ao(t)}function Vi(t,i){return so(t,null,null,i),ao(t)}function qm(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-ht(a),t=p.hiddenUpdates,o=t[h],o===null?t[h]=[i]:o.push(i),i.lane=a|536870912),p):null}function ao(t){if(50<Wa)throw Wa=0,Nf=null,Error(s(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var _s={};function Ev(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 Tn(t,i,a,o){return new Ev(t,i,a,o)}function Sc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Rr(t,i){var a=t.alternate;return a===null?(a=Tn(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 Hm(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 lo(t,i,a,o,h,p){var x=0;if(o=t,typeof t=="function")Sc(t)&&(x=1);else if(typeof t=="string")x=jw(t,a,xe.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case $:return t=Tn(31,a,i,h),t.elementType=$,t.lanes=p,t;case M:return Ji(a.children,h,p,i);case U:x=8,h|=24;break;case R:return t=Tn(12,a,i,h|2),t.elementType=R,t.lanes=p,t;case B:return t=Tn(13,a,i,h),t.elementType=B,t.lanes=p,t;case L:return t=Tn(19,a,i,h),t.elementType=L,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case q:x=10;break e;case P:x=9;break e;case ae:x=11;break e;case K: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=Tn(x,a,i,h),i.elementType=t,i.type=o,i.lanes=p,i}function Ji(t,i,a,o){return t=Tn(7,t,o,i),t.lanes=a,t}function _c(t,i,a){return t=Tn(6,t,null,i),t.lanes=a,t}function Im(t){var i=Tn(18,null,null,0);return i.stateNode=t,i}function Ec(t,i,a){return i=Tn(4,t.children!==null?t.children:[],t.key,i),i.lanes=a,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var Fm=new WeakMap;function Vn(t,i){if(typeof t=="object"&&t!==null){var a=Fm.get(t);return a!==void 0?a:(i={value:t,source:i,stack:we(i)},Fm.set(t,i),i)}return{value:t,source:i,stack:we(i)}}var Es=[],ks=0,oo=null,Ra=0,Jn=[],Xn=0,ai=null,pr=1,gr="";function Mr(t,i){Es[ks++]=Ra,Es[ks++]=oo,oo=t,Ra=i}function $m(t,i,a){Jn[Xn++]=pr,Jn[Xn++]=gr,Jn[Xn++]=ai,ai=t;var o=pr;t=gr;var h=32-ht(o)-1;o&=~(1<<h),a+=1;var p=32-ht(i)+h;if(30<p){var x=h-h%5;p=(o&(1<<x)-1).toString(32),o>>=x,h-=x,pr=1<<32-ht(i)+h|a<<h|o,gr=p+t}else pr=1<<p|a<<h|o,gr=t}function kc(t){t.return!==null&&(Mr(t,1),$m(t,1,0))}function Cc(t){for(;t===oo;)oo=Es[--ks],Es[ks]=null,Ra=Es[--ks],Es[ks]=null;for(;t===ai;)ai=Jn[--Xn],Jn[Xn]=null,gr=Jn[--Xn],Jn[Xn]=null,pr=Jn[--Xn],Jn[Xn]=null}function Ym(t,i){Jn[Xn++]=pr,Jn[Xn++]=gr,Jn[Xn++]=ai,pr=i.id,gr=i.overflow,ai=t}var tn=null,jt=null,rt=!1,li=null,Kn=!1,Ac=Error(s(519));function oi(t){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ma(Vn(i,t)),Ac}function Gm(t){var i=t.stateNode,a=t.type,o=t.memoizedProps;switch(i[_t]=t,i[zt]=o,a){case"dialog":Qe("cancel",i),Qe("close",i);break;case"iframe":case"object":case"embed":Qe("load",i);break;case"video":case"audio":for(a=0;a<tl.length;a++)Qe(tl[a],i);break;case"source":Qe("error",i);break;case"img":case"image":case"link":Qe("error",i),Qe("load",i);break;case"details":Qe("toggle",i);break;case"input":Qe("invalid",i),sm(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Qe("invalid",i);break;case"textarea":Qe("invalid",i),lm(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||uy(i.textContent,a)?(o.popover!=null&&(Qe("beforetoggle",i),Qe("toggle",i)),o.onScroll!=null&&Qe("scroll",i),o.onScrollEnd!=null&&Qe("scrollend",i),o.onClick!=null&&(i.onclick=Or),i=!0):i=!1,i||oi(t,!0)}function Vm(t){for(tn=t.return;tn;)switch(tn.tag){case 5:case 31:case 13:Kn=!1;return;case 27:case 3:Kn=!0;return;default:tn=tn.return}}function Cs(t){if(t!==tn)return!1;if(!rt)return Vm(t),rt=!0,!1;var i=t.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Gf(t.type,t.memoizedProps)),a=!a),a&&jt&&oi(t),Vm(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));jt=by(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));jt=by(t)}else i===27?(i=jt,Si(t.type)?(t=Qf,Qf=null,jt=t):jt=i):jt=tn?Zn(t.stateNode.nextSibling):null;return!0}function Xi(){jt=tn=null,rt=!1}function Tc(){var t=li;return t!==null&&(Sn===null?Sn=t:Sn.push.apply(Sn,t),li=null),t}function Ma(t){li===null?li=[t]:li.push(t)}var jc=O(null),Ki=null,Dr=null;function ui(t,i,a){A(jc,i._currentValue),i._currentValue=a}function zr(t){t._currentValue=jc.current,Z(jc)}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 Nc(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 H=0;H<i.length;H++)if(S.context===i[H]){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 As(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;An(h.pendingProps.value,x.value)||(t!==null?t.push(S):t=[S])}}else if(h===Te.current){if(x=h.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(al):t=[al])}h=h.return}t!==null&&Nc(i,t,a,o),i.flags|=262144}function uo(t){for(t=t.firstContext;t!==null;){if(!An(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Qi(t){Ki=t,Dr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function nn(t){return Jm(Ki,t)}function co(t,i){return Ki===null&&Qi(t),Jm(t,i)}function Jm(t,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},Dr===null){if(t===null)throw Error(s(308));Dr=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else Dr=Dr.next=i;return a}var kv=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()})}},Cv=e.unstable_scheduleCallback,Av=e.unstable_NormalPriority,Ht={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Rc(){return{controller:new kv,data:new Map,refCount:0}}function Da(t){t.refCount--,t.refCount===0&&Cv(Av,function(){t.controller.abort()})}var za=null,Mc=0,Ts=0,js=null;function Tv(t,i){if(za===null){var a=za=[];Mc=0,Ts=Uf(),js={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Mc++,i.then(Xm,Xm),i}function Xm(){if(--Mc===0&&za!==null){js!==null&&(js.status="fulfilled");var t=za;za=null,Ts=0,js=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function jv(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 Km=I.S;I.S=function(t,i){Mg=Ct(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Tv(t,i),Km!==null&&Km(t,i)};var Zi=O(null);function Dc(){var t=Zi.current;return t!==null?t:Et.pooledCache}function fo(t,i){i===null?A(Zi,Zi.current):A(Zi,i.pool)}function Qm(){var t=Dc();return t===null?null:{parent:Ht._currentValue,pool:t}}var Os=Error(s(460)),zc=Error(s(474)),ho=Error(s(542)),mo={then:function(){}};function Zm(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Wm(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,tp(t),t;default:if(typeof i.status=="string")i.then(Or,Or);else{if(t=Et,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,tp(t),t}throw es=i,Os}}function Wi(t){try{var i=t._init;return i(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(es=a,Os):a}}var es=null;function ep(){if(es===null)throw Error(s(459));var t=es;return es=null,t}function tp(t){if(t===Os||t===ho)throw Error(s(483))}var Ns=null,La=0;function po(t){var i=La;return La+=1,Ns===null&&(Ns=[]),Wm(Ns,t,i)}function Ua(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function go(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 np(t){function i(X,V){if(t){var ee=X.deletions;ee===null?(X.deletions=[V],X.flags|=16):ee.push(V)}}function a(X,V){if(!t)return null;for(;V!==null;)i(X,V),V=V.sibling;return null}function o(X){for(var V=new Map;X!==null;)X.key!==null?V.set(X.key,X):V.set(X.index,X),X=X.sibling;return V}function h(X,V){return X=Rr(X,V),X.index=0,X.sibling=null,X}function p(X,V,ee){return X.index=ee,t?(ee=X.alternate,ee!==null?(ee=ee.index,ee<V?(X.flags|=67108866,V):ee):(X.flags|=67108866,V)):(X.flags|=1048576,V)}function x(X){return t&&X.alternate===null&&(X.flags|=67108866),X}function S(X,V,ee,de){return V===null||V.tag!==6?(V=_c(ee,X.mode,de),V.return=X,V):(V=h(V,ee),V.return=X,V)}function H(X,V,ee,de){var De=ee.type;return De===M?ce(X,V,ee.props.children,de,ee.key):V!==null&&(V.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===Y&&Wi(De)===V.type)?(V=h(V,ee.props),Ua(V,ee),V.return=X,V):(V=lo(ee.type,ee.key,ee.props,null,X.mode,de),Ua(V,ee),V.return=X,V)}function te(X,V,ee,de){return V===null||V.tag!==4||V.stateNode.containerInfo!==ee.containerInfo||V.stateNode.implementation!==ee.implementation?(V=Ec(ee,X.mode,de),V.return=X,V):(V=h(V,ee.children||[]),V.return=X,V)}function ce(X,V,ee,de,De){return V===null||V.tag!==7?(V=Ji(ee,X.mode,de,De),V.return=X,V):(V=h(V,ee),V.return=X,V)}function ge(X,V,ee){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=_c(""+V,X.mode,ee),V.return=X,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case v:return ee=lo(V.type,V.key,V.props,null,X.mode,ee),Ua(ee,V),ee.return=X,ee;case k:return V=Ec(V,X.mode,ee),V.return=X,V;case Y:return V=Wi(V),ge(X,V,ee)}if(W(V)||J(V))return V=Ji(V,X.mode,ee,null),V.return=X,V;if(typeof V.then=="function")return ge(X,po(V),ee);if(V.$$typeof===q)return ge(X,co(X,V),ee);go(X,V)}return null}function ne(X,V,ee,de){var De=V!==null?V.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return De!==null?null:S(X,V,""+ee,de);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:return ee.key===De?H(X,V,ee,de):null;case k:return ee.key===De?te(X,V,ee,de):null;case Y:return ee=Wi(ee),ne(X,V,ee,de)}if(W(ee)||J(ee))return De!==null?null:ce(X,V,ee,de,null);if(typeof ee.then=="function")return ne(X,V,po(ee),de);if(ee.$$typeof===q)return ne(X,V,co(X,ee),de);go(X,ee)}return null}function se(X,V,ee,de,De){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return X=X.get(ee)||null,S(V,X,""+de,De);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case v:return X=X.get(de.key===null?ee:de.key)||null,H(V,X,de,De);case k:return X=X.get(de.key===null?ee:de.key)||null,te(V,X,de,De);case Y:return de=Wi(de),se(X,V,ee,de,De)}if(W(de)||J(de))return X=X.get(ee)||null,ce(V,X,de,De,null);if(typeof de.then=="function")return se(X,V,ee,po(de),De);if(de.$$typeof===q)return se(X,V,ee,co(V,de),De);go(V,de)}return null}function Ne(X,V,ee,de){for(var De=null,ut=null,Re=V,Ge=V=0,tt=null;Re!==null&&Ge<ee.length;Ge++){Re.index>Ge?(tt=Re,Re=null):tt=Re.sibling;var ct=ne(X,Re,ee[Ge],de);if(ct===null){Re===null&&(Re=tt);break}t&&Re&&ct.alternate===null&&i(X,Re),V=p(ct,V,Ge),ut===null?De=ct:ut.sibling=ct,ut=ct,Re=tt}if(Ge===ee.length)return a(X,Re),rt&&Mr(X,Ge),De;if(Re===null){for(;Ge<ee.length;Ge++)Re=ge(X,ee[Ge],de),Re!==null&&(V=p(Re,V,Ge),ut===null?De=Re:ut.sibling=Re,ut=Re);return rt&&Mr(X,Ge),De}for(Re=o(Re);Ge<ee.length;Ge++)tt=se(Re,X,Ge,ee[Ge],de),tt!==null&&(t&&tt.alternate!==null&&Re.delete(tt.key===null?Ge:tt.key),V=p(tt,V,Ge),ut===null?De=tt:ut.sibling=tt,ut=tt);return t&&Re.forEach(function(Ai){return i(X,Ai)}),rt&&Mr(X,Ge),De}function Be(X,V,ee,de){if(ee==null)throw Error(s(151));for(var De=null,ut=null,Re=V,Ge=V=0,tt=null,ct=ee.next();Re!==null&&!ct.done;Ge++,ct=ee.next()){Re.index>Ge?(tt=Re,Re=null):tt=Re.sibling;var Ai=ne(X,Re,ct.value,de);if(Ai===null){Re===null&&(Re=tt);break}t&&Re&&Ai.alternate===null&&i(X,Re),V=p(Ai,V,Ge),ut===null?De=Ai:ut.sibling=Ai,ut=Ai,Re=tt}if(ct.done)return a(X,Re),rt&&Mr(X,Ge),De;if(Re===null){for(;!ct.done;Ge++,ct=ee.next())ct=ge(X,ct.value,de),ct!==null&&(V=p(ct,V,Ge),ut===null?De=ct:ut.sibling=ct,ut=ct);return rt&&Mr(X,Ge),De}for(Re=o(Re);!ct.done;Ge++,ct=ee.next())ct=se(Re,X,Ge,ct.value,de),ct!==null&&(t&&ct.alternate!==null&&Re.delete(ct.key===null?Ge:ct.key),V=p(ct,V,Ge),ut===null?De=ct:ut.sibling=ct,ut=ct);return t&&Re.forEach(function(qw){return i(X,qw)}),rt&&Mr(X,Ge),De}function bt(X,V,ee,de){if(typeof ee=="object"&&ee!==null&&ee.type===M&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:e:{for(var De=ee.key;V!==null;){if(V.key===De){if(De=ee.type,De===M){if(V.tag===7){a(X,V.sibling),de=h(V,ee.props.children),de.return=X,X=de;break e}}else if(V.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===Y&&Wi(De)===V.type){a(X,V.sibling),de=h(V,ee.props),Ua(de,ee),de.return=X,X=de;break e}a(X,V);break}else i(X,V);V=V.sibling}ee.type===M?(de=Ji(ee.props.children,X.mode,de,ee.key),de.return=X,X=de):(de=lo(ee.type,ee.key,ee.props,null,X.mode,de),Ua(de,ee),de.return=X,X=de)}return x(X);case k:e:{for(De=ee.key;V!==null;){if(V.key===De)if(V.tag===4&&V.stateNode.containerInfo===ee.containerInfo&&V.stateNode.implementation===ee.implementation){a(X,V.sibling),de=h(V,ee.children||[]),de.return=X,X=de;break e}else{a(X,V);break}else i(X,V);V=V.sibling}de=Ec(ee,X.mode,de),de.return=X,X=de}return x(X);case Y:return ee=Wi(ee),bt(X,V,ee,de)}if(W(ee))return Ne(X,V,ee,de);if(J(ee)){if(De=J(ee),typeof De!="function")throw Error(s(150));return ee=De.call(ee),Be(X,V,ee,de)}if(typeof ee.then=="function")return bt(X,V,po(ee),de);if(ee.$$typeof===q)return bt(X,V,co(X,ee),de);go(X,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,V!==null&&V.tag===6?(a(X,V.sibling),de=h(V,ee),de.return=X,X=de):(a(X,V),de=_c(ee,X.mode,de),de.return=X,X=de),x(X)):a(X,V)}return function(X,V,ee,de){try{La=0;var De=bt(X,V,ee,de);return Ns=null,De}catch(Re){if(Re===Os||Re===ho)throw Re;var ut=Tn(29,Re,null,X.mode);return ut.lanes=de,ut.return=X,ut}finally{}}}var ts=np(!0),rp=np(!1),ci=!1;function Lc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Uc(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 fi(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function hi(t,i,a){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(ft&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=ao(t),qm(t,null,a),i}return so(t,o,i,a),ao(t)}function Ba(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,Hi(t,a)}}function Bc(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 Pc=!1;function Pa(){if(Pc){var t=js;if(t!==null)throw t}}function qa(t,i,a,o){Pc=!1;var h=t.updateQueue;ci=!1;var p=h.firstBaseUpdate,x=h.lastBaseUpdate,S=h.shared.pending;if(S!==null){h.shared.pending=null;var H=S,te=H.next;H.next=null,x===null?p=te:x.next=te,x=H;var ce=t.alternate;ce!==null&&(ce=ce.updateQueue,S=ce.lastBaseUpdate,S!==x&&(S===null?ce.firstBaseUpdate=te:S.next=te,ce.lastBaseUpdate=H))}if(p!==null){var ge=h.baseState;x=0,ce=te=H=null,S=p;do{var ne=S.lane&-536870913,se=ne!==S.lane;if(se?(et&ne)===ne:(o&ne)===ne){ne!==0&&ne===Ts&&(Pc=!0),ce!==null&&(ce=ce.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Ne=t,Be=S;ne=i;var bt=a;switch(Be.tag){case 1:if(Ne=Be.payload,typeof Ne=="function"){ge=Ne.call(bt,ge,ne);break e}ge=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Be.payload,ne=typeof Ne=="function"?Ne.call(bt,ge,ne):Ne,ne==null)break e;ge=g({},ge,ne);break e;case 2:ci=!0}}ne=S.callback,ne!==null&&(t.flags|=64,se&&(t.flags|=8192),se=h.callbacks,se===null?h.callbacks=[ne]:se.push(ne))}else se={lane:ne,tag:S.tag,payload:S.payload,callback:S.callback,next:null},ce===null?(te=ce=se,H=ge):ce=ce.next=se,x|=ne;if(S=S.next,S===null){if(S=h.shared.pending,S===null)break;se=S,S=se.next,se.next=null,h.lastBaseUpdate=se,h.shared.pending=null}}while(!0);ce===null&&(H=ge),h.baseState=H,h.firstBaseUpdate=te,h.lastBaseUpdate=ce,p===null&&(h.shared.lanes=0),yi|=x,t.lanes=x,t.memoizedState=ge}}function ip(t,i){if(typeof t!="function")throw Error(s(191,t));t.call(i)}function sp(t,i){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)ip(a[t],i)}var Rs=O(null),yo=O(0);function ap(t,i){t=$r,A(yo,t),A(Rs,i),$r=t|i.baseLanes}function qc(){A(yo,$r),A(Rs,Rs.current)}function Hc(){$r=yo.current,Z(Rs),Z(yo)}var jn=O(null),Qn=null;function di(t){var i=t.alternate;A(Bt,Bt.current&1),A(jn,t),Qn===null&&(i===null||Rs.current!==null||i.memoizedState!==null)&&(Qn=t)}function Ic(t){A(Bt,Bt.current),A(jn,t),Qn===null&&(Qn=t)}function lp(t){t.tag===22?(A(Bt,Bt.current),A(jn,t),Qn===null&&(Qn=t)):mi()}function mi(){A(Bt,Bt.current),A(jn,jn.current)}function On(t){Z(jn),Qn===t&&(Qn=null),Z(Bt)}var Bt=O(0);function bo(t){for(var i=t;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Xf(a)||Kf(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 Lr=0,Ye=null,gt=null,It=null,xo=!1,Ms=!1,ns=!1,vo=0,Ha=0,Ds=null,Ov=0;function Lt(){throw Error(s(321))}function Fc(t,i){if(i===null)return!1;for(var a=0;a<i.length&&a<t.length;a++)if(!An(t[a],i[a]))return!1;return!0}function $c(t,i,a,o,h,p){return Lr=p,Ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,I.H=t===null||t.memoizedState===null?$p:af,ns=!1,p=a(o,h),ns=!1,Ms&&(p=up(i,a,o,h)),op(t),p}function op(t){I.H=$a;var i=gt!==null&&gt.next!==null;if(Lr=0,It=gt=Ye=null,xo=!1,Ha=0,Ds=null,i)throw Error(s(300));t===null||Ft||(t=t.dependencies,t!==null&&uo(t)&&(Ft=!0))}function up(t,i,a,o){Ye=t;var h=0;do{if(Ms&&(Ds=null),Ha=0,Ms=!1,25<=h)throw Error(s(301));if(h+=1,It=gt=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}I.H=Yp,p=i(a,o)}while(Ms);return p}function Nv(){var t=I.H,i=t.useState()[0];return i=typeof i.then=="function"?Ia(i):i,t=t.useState()[0],(gt!==null?gt.memoizedState:null)!==t&&(Ye.flags|=1024),i}function Yc(){var t=vo!==0;return vo=0,t}function Gc(t,i,a){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~a}function Vc(t){if(xo){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}xo=!1}Lr=0,It=gt=Ye=null,Ms=!1,Ha=vo=0,Ds=null}function hn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?Ye.memoizedState=It=t:It=It.next=t,It}function Pt(){if(gt===null){var t=Ye.alternate;t=t!==null?t.memoizedState:null}else t=gt.next;var i=It===null?Ye.memoizedState:It.next;if(i!==null)It=i,gt=t;else{if(t===null)throw Ye.alternate===null?Error(s(467)):Error(s(310));gt=t,t={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},It===null?Ye.memoizedState=It=t:It=It.next=t}return It}function wo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ia(t){var i=Ha;return Ha+=1,Ds===null&&(Ds=[]),t=Wm(Ds,t,i),i=Ye,(It===null?i.memoizedState:It.next)===null&&(i=i.alternate,I.H=i===null||i.memoizedState===null?$p:af),t}function So(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ia(t);if(t.$$typeof===q)return nn(t)}throw Error(s(438,String(t)))}function Jc(t){var i=null,a=Ye.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var o=Ye.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=wo(),Ye.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]=N;return i.index++,a}function Ur(t,i){return typeof i=="function"?i(t):i}function _o(t){var i=Pt();return Xc(i,gt,t)}function Xc(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,H=null,te=i,ce=!1;do{var ge=te.lane&-536870913;if(ge!==te.lane?(et&ge)===ge:(Lr&ge)===ge){var ne=te.revertLane;if(ne===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),ge===Ts&&(ce=!0);else if((Lr&ne)===ne){te=te.next,ne===Ts&&(ce=!0);continue}else ge={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},H===null?(S=H=ge,x=p):H=H.next=ge,Ye.lanes|=ne,yi|=ne;ge=te.action,ns&&a(p,ge),p=te.hasEagerState?te.eagerState:a(p,ge)}else ne={lane:ge,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},H===null?(S=H=ne,x=p):H=H.next=ne,Ye.lanes|=ge,yi|=ge;te=te.next}while(te!==null&&te!==i);if(H===null?x=p:H.next=S,!An(p,t.memoizedState)&&(Ft=!0,ce&&(a=js,a!==null)))throw a;t.memoizedState=p,t.baseState=x,t.baseQueue=H,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Kc(t){var i=Pt(),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);An(p,i.memoizedState)||(Ft=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,o]}function cp(t,i,a){var o=Ye,h=Pt(),p=rt;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var x=!An((gt||h).memoizedState,a);if(x&&(h.memoizedState=a,Ft=!0),h=h.queue,Wc(dp.bind(null,o,h,t),[t]),h.getSnapshot!==i||x||It!==null&&It.memoizedState.tag&1){if(o.flags|=2048,zs(9,{destroy:void 0},hp.bind(null,o,h,a,i),null),Et===null)throw Error(s(349));p||(Lr&127)!==0||fp(o,i,a)}return a}function fp(t,i,a){t.flags|=16384,t={getSnapshot:i,value:a},i=Ye.updateQueue,i===null?(i=wo(),Ye.updateQueue=i,i.stores=[t]):(a=i.stores,a===null?i.stores=[t]:a.push(t))}function hp(t,i,a,o){i.value=a,i.getSnapshot=o,mp(i)&&pp(t)}function dp(t,i,a){return a(function(){mp(i)&&pp(t)})}function mp(t){var i=t.getSnapshot;t=t.value;try{var a=i();return!An(t,a)}catch{return!0}}function pp(t){var i=Vi(t,2);i!==null&&_n(i,t,2)}function Qc(t){var i=hn();if(typeof t=="function"){var a=t;if(t=a(),ns){Vt(!0);try{a()}finally{Vt(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ur,lastRenderedState:t},i}function gp(t,i,a,o){return t.baseState=a,Xc(t,gt,typeof o=="function"?o:Ur)}function Rv(t,i,a,o,h){if(Co(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)}};I.T!==null?a(!0):p.isTransition=!1,o(p),a=i.pending,a===null?(p.next=i.pending=p,yp(i,p)):(p.next=a.next,i.pending=a.next=p)}}function yp(t,i){var a=i.action,o=i.payload,h=t.state;if(i.isTransition){var p=I.T,x={};I.T=x;try{var S=a(h,o),H=I.S;H!==null&&H(x,S),bp(t,i,S)}catch(te){Zc(t,i,te)}finally{p!==null&&x.types!==null&&(p.types=x.types),I.T=p}}else try{p=a(h,o),bp(t,i,p)}catch(te){Zc(t,i,te)}}function bp(t,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){xp(t,i,o)},function(o){return Zc(t,i,o)}):xp(t,i,a)}function xp(t,i,a){i.status="fulfilled",i.value=a,vp(i),t.state=a,i=t.pending,i!==null&&(a=i.next,a===i?t.pending=null:(a=a.next,i.next=a,yp(t,a)))}function Zc(t,i,a){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=a,vp(i),i=i.next;while(i!==o)}t.action=null}function vp(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function wp(t,i){return i}function Sp(t,i){if(rt){var a=Et.formState;if(a!==null){e:{var o=Ye;if(rt){if(jt){t:{for(var h=jt,p=Kn;h.nodeType!==8;){if(!p){h=null;break t}if(h=Zn(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){jt=Zn(h.nextSibling),o=h.data==="F!";break e}}oi(o)}o=!1}o&&(i=a[0])}}return a=hn(),a.memoizedState=a.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wp,lastRenderedState:i},a.queue=o,a=Hp.bind(null,Ye,o),o.dispatch=a,o=Qc(!1),p=sf.bind(null,Ye,!1,o.queue),o=hn(),h={state:i,dispatch:null,action:t,pending:null},o.queue=h,a=Rv.bind(null,Ye,h,p,a),h.dispatch=a,o.memoizedState=t,[i,a,!1]}function _p(t){var i=Pt();return Ep(i,gt,t)}function Ep(t,i,a){if(i=Xc(t,i,wp)[0],t=_o(Ur)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Ia(i)}catch(x){throw x===Os?ho:x}else o=i;i=Pt();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(Ye.flags|=2048,zs(9,{destroy:void 0},Mv.bind(null,h,a),null)),[o,p,t]}function Mv(t,i){t.action=i}function kp(t){var i=Pt(),a=gt;if(a!==null)return Ep(i,a,t);Pt(),i=i.memoizedState,a=Pt();var o=a.queue.dispatch;return a.memoizedState=t,[i,o,!1]}function zs(t,i,a,o){return t={tag:t,create:a,deps:o,inst:i,next:null},i=Ye.updateQueue,i===null&&(i=wo(),Ye.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 Cp(){return Pt().memoizedState}function Eo(t,i,a,o){var h=hn();Ye.flags|=t,h.memoizedState=zs(1|i,{destroy:void 0},a,o===void 0?null:o)}function ko(t,i,a,o){var h=Pt();o=o===void 0?null:o;var p=h.memoizedState.inst;gt!==null&&o!==null&&Fc(o,gt.memoizedState.deps)?h.memoizedState=zs(i,p,a,o):(Ye.flags|=t,h.memoizedState=zs(1|i,p,a,o))}function Ap(t,i){Eo(8390656,8,t,i)}function Wc(t,i){ko(2048,8,t,i)}function Dv(t){Ye.flags|=4;var i=Ye.updateQueue;if(i===null)i=wo(),Ye.updateQueue=i,i.events=[t];else{var a=i.events;a===null?i.events=[t]:a.push(t)}}function Tp(t){var i=Pt().memoizedState;return Dv({ref:i,nextImpl:t}),function(){if((ft&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function jp(t,i){return ko(4,2,t,i)}function Op(t,i){return ko(4,4,t,i)}function Np(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 Rp(t,i,a){a=a!=null?a.concat([t]):null,ko(4,4,Np.bind(null,i,t),a)}function ef(){}function Mp(t,i){var a=Pt();i=i===void 0?null:i;var o=a.memoizedState;return i!==null&&Fc(i,o[1])?o[0]:(a.memoizedState=[t,i],t)}function Dp(t,i){var a=Pt();i=i===void 0?null:i;var o=a.memoizedState;if(i!==null&&Fc(i,o[1]))return o[0];if(o=t(),ns){Vt(!0);try{t()}finally{Vt(!1)}}return a.memoizedState=[o,i],o}function tf(t,i,a){return a===void 0||(Lr&1073741824)!==0&&(et&261930)===0?t.memoizedState=i:(t.memoizedState=a,t=zg(),Ye.lanes|=t,yi|=t,a)}function zp(t,i,a,o){return An(a,i)?a:Rs.current!==null?(t=tf(t,a,o),An(t,i)||(Ft=!0),t):(Lr&42)===0||(Lr&1073741824)!==0&&(et&261930)===0?(Ft=!0,t.memoizedState=a):(t=zg(),Ye.lanes|=t,yi|=t,i)}function Lp(t,i,a,o,h){var p=oe.p;oe.p=p!==0&&8>p?p:8;var x=I.T,S={};I.T=S,sf(t,!1,i,a);try{var H=h(),te=I.S;if(te!==null&&te(S,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ce=jv(H,o);Fa(t,i,ce,Mn(t))}else Fa(t,i,o,Mn(t))}catch(ge){Fa(t,i,{then:function(){},status:"rejected",reason:ge},Mn())}finally{oe.p=p,x!==null&&S.types!==null&&(x.types=S.types),I.T=x}}function zv(){}function nf(t,i,a,o){if(t.tag!==5)throw Error(s(476));var h=Up(t).queue;Lp(t,h,i,ye,a===null?zv:function(){return Bp(t),a(o)})}function Up(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:Ur,lastRenderedState:ye},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ur,lastRenderedState:a},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function Bp(t){var i=Up(t);i.next===null&&(i=t.alternate.memoizedState),Fa(t,i.next.queue,{},Mn())}function rf(){return nn(al)}function Pp(){return Pt().memoizedState}function qp(){return Pt().memoizedState}function Lv(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var a=Mn();t=fi(a);var o=hi(i,t,a);o!==null&&(_n(o,i,a),Ba(o,i,a)),i={cache:Rc()},t.payload=i;return}i=i.return}}function Uv(t,i,a){var o=Mn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Co(t)?Ip(i,a):(a=wc(t,i,a,o),a!==null&&(_n(a,t,o),Fp(a,i,o)))}function Hp(t,i,a){var o=Mn();Fa(t,i,a,o)}function Fa(t,i,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Co(t))Ip(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,An(S,x))return so(t,i,h,0),Et===null&&io(),!1}catch{}finally{}if(a=wc(t,i,h,o),a!==null)return _n(a,t,o),Fp(a,i,o),!0}return!1}function sf(t,i,a,o){if(o={lane:2,revertLane:Uf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Co(t)){if(i)throw Error(s(479))}else i=wc(t,a,o,2),i!==null&&_n(i,t,2)}function Co(t){var i=t.alternate;return t===Ye||i!==null&&i===Ye}function Ip(t,i){Ms=xo=!0;var a=t.pending;a===null?i.next=i:(i.next=a.next,a.next=i),t.pending=i}function Fp(t,i,a){if((a&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,a|=o,i.lanes=a,Hi(t,a)}}var $a={readContext:nn,use:So,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useLayoutEffect:Lt,useInsertionEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useSyncExternalStore:Lt,useId:Lt,useHostTransitionStatus:Lt,useFormState:Lt,useActionState:Lt,useOptimistic:Lt,useMemoCache:Lt,useCacheRefresh:Lt};$a.useEffectEvent=Lt;var $p={readContext:nn,use:So,useCallback:function(t,i){return hn().memoizedState=[t,i===void 0?null:i],t},useContext:nn,useEffect:Ap,useImperativeHandle:function(t,i,a){a=a!=null?a.concat([t]):null,Eo(4194308,4,Np.bind(null,i,t),a)},useLayoutEffect:function(t,i){return Eo(4194308,4,t,i)},useInsertionEffect:function(t,i){Eo(4,2,t,i)},useMemo:function(t,i){var a=hn();i=i===void 0?null:i;var o=t();if(ns){Vt(!0);try{t()}finally{Vt(!1)}}return a.memoizedState=[o,i],o},useReducer:function(t,i,a){var o=hn();if(a!==void 0){var h=a(i);if(ns){Vt(!0);try{a(i)}finally{Vt(!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=Uv.bind(null,Ye,t),[o.memoizedState,t]},useRef:function(t){var i=hn();return t={current:t},i.memoizedState=t},useState:function(t){t=Qc(t);var i=t.queue,a=Hp.bind(null,Ye,i);return i.dispatch=a,[t.memoizedState,a]},useDebugValue:ef,useDeferredValue:function(t,i){var a=hn();return tf(a,t,i)},useTransition:function(){var t=Qc(!1);return t=Lp.bind(null,Ye,t.queue,!0,!1),hn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,a){var o=Ye,h=hn();if(rt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),Et===null)throw Error(s(349));(et&127)!==0||fp(o,i,a)}h.memoizedState=a;var p={value:a,getSnapshot:i};return h.queue=p,Ap(dp.bind(null,o,p,t),[t]),o.flags|=2048,zs(9,{destroy:void 0},hp.bind(null,o,p,a,i),null),a},useId:function(){var t=hn(),i=Et.identifierPrefix;if(rt){var a=gr,o=pr;a=(o&~(1<<32-ht(o)-1)).toString(32)+a,i="_"+i+"R_"+a,a=vo++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Ov++,i="_"+i+"r_"+a.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:rf,useFormState:Sp,useActionState:Sp,useOptimistic:function(t){var i=hn();i.memoizedState=i.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=sf.bind(null,Ye,!0,a),a.dispatch=i,[t,i]},useMemoCache:Jc,useCacheRefresh:function(){return hn().memoizedState=Lv.bind(null,Ye)},useEffectEvent:function(t){var i=hn(),a={impl:t};return i.memoizedState=a,function(){if((ft&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},af={readContext:nn,use:So,useCallback:Mp,useContext:nn,useEffect:Wc,useImperativeHandle:Rp,useInsertionEffect:jp,useLayoutEffect:Op,useMemo:Dp,useReducer:_o,useRef:Cp,useState:function(){return _o(Ur)},useDebugValue:ef,useDeferredValue:function(t,i){var a=Pt();return zp(a,gt.memoizedState,t,i)},useTransition:function(){var t=_o(Ur)[0],i=Pt().memoizedState;return[typeof t=="boolean"?t:Ia(t),i]},useSyncExternalStore:cp,useId:Pp,useHostTransitionStatus:rf,useFormState:_p,useActionState:_p,useOptimistic:function(t,i){var a=Pt();return gp(a,gt,t,i)},useMemoCache:Jc,useCacheRefresh:qp};af.useEffectEvent=Tp;var Yp={readContext:nn,use:So,useCallback:Mp,useContext:nn,useEffect:Wc,useImperativeHandle:Rp,useInsertionEffect:jp,useLayoutEffect:Op,useMemo:Dp,useReducer:Kc,useRef:Cp,useState:function(){return Kc(Ur)},useDebugValue:ef,useDeferredValue:function(t,i){var a=Pt();return gt===null?tf(a,t,i):zp(a,gt.memoizedState,t,i)},useTransition:function(){var t=Kc(Ur)[0],i=Pt().memoizedState;return[typeof t=="boolean"?t:Ia(t),i]},useSyncExternalStore:cp,useId:Pp,useHostTransitionStatus:rf,useFormState:kp,useActionState:kp,useOptimistic:function(t,i){var a=Pt();return gt!==null?gp(a,gt,t,i):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Jc,useCacheRefresh:qp};Yp.useEffectEvent=Tp;function lf(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 of={enqueueSetState:function(t,i,a){t=t._reactInternals;var o=Mn(),h=fi(o);h.payload=i,a!=null&&(h.callback=a),i=hi(t,h,o),i!==null&&(_n(i,t,o),Ba(i,t,o))},enqueueReplaceState:function(t,i,a){t=t._reactInternals;var o=Mn(),h=fi(o);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=hi(t,h,o),i!==null&&(_n(i,t,o),Ba(i,t,o))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var a=Mn(),o=fi(a);o.tag=2,i!=null&&(o.callback=i),i=hi(t,o,a),i!==null&&(_n(i,t,a),Ba(i,t,a))}};function Gp(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?!Oa(a,o)||!Oa(h,p):!0}function Vp(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&&of.enqueueReplaceState(i,i.state,null)}function rs(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 Jp(t){ro(t)}function Xp(t){console.error(t)}function Kp(t){ro(t)}function Ao(t,i){try{var a=t.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function Qp(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 uf(t,i,a){return a=fi(a),a.tag=3,a.payload={element:null},a.callback=function(){Ao(t,i)},a}function Zp(t){return t=fi(t),t.tag=3,t}function Wp(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(){Qp(i,a,o)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(t.callback=function(){Qp(i,a,o),typeof h!="function"&&(bi===null?bi=new Set([this]):bi.add(this));var S=o.stack;this.componentDidCatch(o.value,{componentStack:S!==null?S:""})})}function Bv(t,i,a,o,h){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=a.alternate,i!==null&&As(i,a,h,!0),a=jn.current,a!==null){switch(a.tag){case 31:case 13:return Qn===null?Po():a.alternate===null&&Ut===0&&(Ut=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===mo?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([o]):i.add(o),Df(t,o,h)),!1;case 22:return a.flags|=65536,o===mo?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)),Df(t,o,h)),!1}throw Error(s(435,a.tag))}return Df(t,o,h),Po(),!1}if(rt)return i=jn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==Ac&&(t=Error(s(422),{cause:o}),Ma(Vn(t,a)))):(o!==Ac&&(i=Error(s(423),{cause:o}),Ma(Vn(i,a))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=Vn(o,a),h=uf(t.stateNode,o,h),Bc(t,h),Ut!==4&&(Ut=2)),!1;var p=Error(s(520),{cause:o});if(p=Vn(p,a),Za===null?Za=[p]:Za.push(p),Ut!==4&&(Ut=2),i===null)return!0;o=Vn(o,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,t=h&-h,a.lanes|=t,t=uf(a.stateNode,o,t),Bc(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"&&(bi===null||!bi.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=Zp(h),Wp(h,t,a,o),Bc(a,h),!1}a=a.return}while(a!==null);return!1}var cf=Error(s(461)),Ft=!1;function rn(t,i,a,o){i.child=t===null?rp(i,null,a,o):ts(i,t.child,a,o)}function eg(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 Qi(i),o=$c(t,i,a,x,p,h),S=Yc(),t!==null&&!Ft?(Gc(t,i,h),Br(t,i,h)):(rt&&S&&kc(i),i.flags|=1,rn(t,i,o,h),i.child)}function tg(t,i,a,o,h){if(t===null){var p=a.type;return typeof p=="function"&&!Sc(p)&&p.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=p,ng(t,i,p,o,h)):(t=lo(a.type,null,o,i,i.mode,h),t.ref=i.ref,t.return=i,i.child=t)}if(p=t.child,!bf(t,h)){var x=p.memoizedProps;if(a=a.compare,a=a!==null?a:Oa,a(x,o)&&t.ref===i.ref)return Br(t,i,h)}return i.flags|=1,t=Rr(p,o),t.ref=i.ref,t.return=i,i.child=t}function ng(t,i,a,o,h){if(t!==null){var p=t.memoizedProps;if(Oa(p,o)&&t.ref===i.ref)if(Ft=!1,i.pendingProps=o=p,bf(t,h))(t.flags&131072)!==0&&(Ft=!0);else return i.lanes=t.lanes,Br(t,i,h)}return ff(t,i,a,o,h)}function rg(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 ig(t,i,p,a,o)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&fo(i,p!==null?p.cachePool:null),p!==null?ap(i,p):qc(),lp(i);else return o=i.lanes=536870912,ig(t,i,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(fo(i,p.cachePool),ap(i,p),mi(),i.memoizedState=null):(t!==null&&fo(i,null),qc(),mi());return rn(t,i,h,a),i.child}function Ya(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function ig(t,i,a,o,h){var p=Dc();return p=p===null?null:{parent:Ht._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},t!==null&&fo(i,null),qc(),lp(i),t!==null&&As(t,i,o,!0),i.childLanes=h,null}function To(t,i){return i=Oo({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function sg(t,i,a){return ts(i,t.child,null,a),t=To(i,i.pendingProps),t.flags|=2,On(i),i.memoizedState=null,t}function Pv(t,i,a){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(rt){if(o.mode==="hidden")return t=To(i,o),i.lanes=536870912,Ya(null,t);if(Ic(i),(t=jt)?(t=yy(t,Kn),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ai!==null?{id:pr,overflow:gr}:null,retryLane:536870912,hydrationErrors:null},a=Im(t),a.return=i,i.child=a,tn=i,jt=null)):t=null,t===null)throw oi(i);return i.lanes=536870912,null}return To(i,o)}var p=t.memoizedState;if(p!==null){var x=p.dehydrated;if(Ic(i),h)if(i.flags&256)i.flags&=-257,i=sg(t,i,a);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(s(558));else if(Ft||As(t,i,a,!1),h=(a&t.childLanes)!==0,Ft||h){if(o=Et,o!==null&&(x=ii(o,a),x!==0&&x!==p.retryLane))throw p.retryLane=x,Vi(t,x),_n(o,t,x),cf;Po(),i=sg(t,i,a)}else t=p.treeContext,jt=Zn(x.nextSibling),tn=i,rt=!0,li=null,Kn=!1,t!==null&&Ym(i,t),i=To(i,o),i.flags|=4096;return i}return t=Rr(t.child,{mode:o.mode,children:o.children}),t.ref=i.ref,i.child=t,t.return=i,t}function jo(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 ff(t,i,a,o,h){return Qi(i),a=$c(t,i,a,o,void 0,h),o=Yc(),t!==null&&!Ft?(Gc(t,i,h),Br(t,i,h)):(rt&&o&&kc(i),i.flags|=1,rn(t,i,a,h),i.child)}function ag(t,i,a,o,h,p){return Qi(i),i.updateQueue=null,a=up(i,o,a,h),op(t),o=Yc(),t!==null&&!Ft?(Gc(t,i,p),Br(t,i,p)):(rt&&o&&kc(i),i.flags|=1,rn(t,i,a,p),i.child)}function lg(t,i,a,o,h){if(Qi(i),i.stateNode===null){var p=_s,x=a.contextType;typeof x=="object"&&x!==null&&(p=nn(x)),p=new a(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=of,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},Lc(i),x=a.contextType,p.context=typeof x=="object"&&x!==null?nn(x):_s,p.state=i.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(lf(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&&of.enqueueReplaceState(p,p.state,null),qa(i,o,p,h),Pa(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(t===null){p=i.stateNode;var S=i.memoizedProps,H=rs(a,S);p.props=H;var te=p.context,ce=a.contextType;x=_s,typeof ce=="object"&&ce!==null&&(x=nn(ce));var ge=a.getDerivedStateFromProps;ce=typeof ge=="function"||typeof p.getSnapshotBeforeUpdate=="function",S=i.pendingProps!==S,ce||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(S||te!==x)&&Vp(i,p,o,x),ci=!1;var ne=i.memoizedState;p.state=ne,qa(i,o,p,h),Pa(),te=i.memoizedState,S||ne!==te||ci?(typeof ge=="function"&&(lf(i,a,ge,o),te=i.memoizedState),(H=ci||Gp(i,a,H,o,ne,te,x))?(ce||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(i.flags|=4194308)):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=o,i.memoizedState=te),p.props=o,p.state=te,p.context=x,o=H):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,Uc(t,i),x=i.memoizedProps,ce=rs(a,x),p.props=ce,ge=i.pendingProps,ne=p.context,te=a.contextType,H=_s,typeof te=="object"&&te!==null&&(H=nn(te)),S=a.getDerivedStateFromProps,(te=typeof S=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(x!==ge||ne!==H)&&Vp(i,p,o,H),ci=!1,ne=i.memoizedState,p.state=ne,qa(i,o,p,h),Pa();var se=i.memoizedState;x!==ge||ne!==se||ci||t!==null&&t.dependencies!==null&&uo(t.dependencies)?(typeof S=="function"&&(lf(i,a,S,o),se=i.memoizedState),(ce=ci||Gp(i,a,ce,o,ne,se,H)||t!==null&&t.dependencies!==null&&uo(t.dependencies))?(te||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,se,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,se,H)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||x===t.memoizedProps&&ne===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===t.memoizedProps&&ne===t.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=se),p.props=o,p.state=se,p.context=H,o=ce):(typeof p.componentDidUpdate!="function"||x===t.memoizedProps&&ne===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===t.memoizedProps&&ne===t.memoizedState||(i.flags|=1024),o=!1)}return p=o,jo(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=ts(i,t.child,null,h),i.child=ts(i,null,a,h)):rn(t,i,a,h),i.memoizedState=p.state,t=i.child):t=Br(t,i,h),t}function og(t,i,a,o){return Xi(),i.flags|=256,rn(t,i,a,o),i.child}var hf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function df(t){return{baseLanes:t,cachePool:Qm()}}function mf(t,i,a){return t=t!==null?t.childLanes&~a:0,i&&(t|=Rn),t}function ug(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:(Bt.current&2)!==0),x&&(h=!0,i.flags&=-129),x=(i.flags&32)!==0,i.flags&=-33,t===null){if(rt){if(h?di(i):mi(),(t=jt)?(t=yy(t,Kn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ai!==null?{id:pr,overflow:gr}:null,retryLane:536870912,hydrationErrors:null},a=Im(t),a.return=i,i.child=a,tn=i,jt=null)):t=null,t===null)throw oi(i);return Kf(t)?i.lanes=32:i.lanes=536870912,null}var S=o.children;return o=o.fallback,h?(mi(),h=i.mode,S=Oo({mode:"hidden",children:S},h),o=Ji(o,h,a,null),S.return=i,o.return=i,S.sibling=o,i.child=S,o=i.child,o.memoizedState=df(a),o.childLanes=mf(t,x,a),i.memoizedState=hf,Ya(null,o)):(di(i),pf(i,S))}var H=t.memoizedState;if(H!==null&&(S=H.dehydrated,S!==null)){if(p)i.flags&256?(di(i),i.flags&=-257,i=gf(t,i,a)):i.memoizedState!==null?(mi(),i.child=t.child,i.flags|=128,i=null):(mi(),S=o.fallback,h=i.mode,o=Oo({mode:"visible",children:o.children},h),S=Ji(S,h,a,null),S.flags|=2,o.return=i,S.return=i,o.sibling=S,i.child=o,ts(i,t.child,null,a),o=i.child,o.memoizedState=df(a),o.childLanes=mf(t,x,a),i.memoizedState=hf,i=Ya(null,o));else if(di(i),Kf(S)){if(x=S.nextSibling&&S.nextSibling.dataset,x)var te=x.dgst;x=te,o=Error(s(419)),o.stack="",o.digest=x,Ma({value:o,source:null,stack:null}),i=gf(t,i,a)}else if(Ft||As(t,i,a,!1),x=(a&t.childLanes)!==0,Ft||x){if(x=Et,x!==null&&(o=ii(x,a),o!==0&&o!==H.retryLane))throw H.retryLane=o,Vi(t,o),_n(x,t,o),cf;Xf(S)||Po(),i=gf(t,i,a)}else Xf(S)?(i.flags|=192,i.child=t.child,i=null):(t=H.treeContext,jt=Zn(S.nextSibling),tn=i,rt=!0,li=null,Kn=!1,t!==null&&Ym(i,t),i=pf(i,o.children),i.flags|=4096);return i}return h?(mi(),S=o.fallback,h=i.mode,H=t.child,te=H.sibling,o=Rr(H,{mode:"hidden",children:o.children}),o.subtreeFlags=H.subtreeFlags&65011712,te!==null?S=Rr(te,S):(S=Ji(S,h,a,null),S.flags|=2),S.return=i,o.return=i,o.sibling=S,i.child=o,Ya(null,o),o=i.child,S=t.child.memoizedState,S===null?S=df(a):(h=S.cachePool,h!==null?(H=Ht._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=Qm(),S={baseLanes:S.baseLanes|a,cachePool:h}),o.memoizedState=S,o.childLanes=mf(t,x,a),i.memoizedState=hf,Ya(t.child,o)):(di(i),a=t.child,t=a.sibling,a=Rr(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 pf(t,i){return i=Oo({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function Oo(t,i){return t=Tn(22,t,null,i),t.lanes=0,t}function gf(t,i,a){return ts(i,t.child,null,a),t=pf(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function cg(t,i,a){t.lanes|=i;var o=t.alternate;o!==null&&(o.lanes|=i),Oc(t.return,i,a)}function yf(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 fg(t,i,a){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var x=Bt.current,S=(x&2)!==0;if(S?(x=x&1|2,i.flags|=128):x&=1,A(Bt,x),rn(t,i,o,a),o=rt?Ra:0,!S&&t!==null&&(t.flags&128)!==0)e:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&cg(t,a,i);else if(t.tag===19)cg(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&&bo(t)===null&&(h=a),a=a.sibling;a=h,a===null?(h=i.child,i.child=null):(h=a.sibling,a.sibling=null),yf(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&&bo(t)===null){i.child=h;break}t=h.sibling,h.sibling=a,a=h,h=t}yf(i,!0,a,null,p,o);break;case"together":yf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Br(t,i,a){if(t!==null&&(i.dependencies=t.dependencies),yi|=i.lanes,(a&i.childLanes)===0)if(t!==null){if(As(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=Rr(t,t.pendingProps),i.child=a,a.return=i;t.sibling!==null;)t=t.sibling,a=a.sibling=Rr(t,t.pendingProps),a.return=i;a.sibling=null}return i.child}function bf(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&uo(t)))}function qv(t,i,a){switch(i.tag){case 3:ze(i,i.stateNode.containerInfo),ui(i,Ht,t.memoizedState.cache),Xi();break;case 27:case 5:Le(i);break;case 4:ze(i,i.stateNode.containerInfo);break;case 10:ui(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Ic(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(di(i),i.flags|=128,null):(a&i.child.childLanes)!==0?ug(t,i,a):(di(i),t=Br(t,i,a),t!==null?t.sibling:null);di(i);break;case 19:var h=(t.flags&128)!==0;if(o=(a&i.childLanes)!==0,o||(As(t,i,a,!1),o=(a&i.childLanes)!==0),h){if(o)return fg(t,i,a);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),A(Bt,Bt.current),o)break;return null;case 22:return i.lanes=0,rg(t,i,a,i.pendingProps);case 24:ui(i,Ht,t.memoizedState.cache)}return Br(t,i,a)}function hg(t,i,a){if(t!==null)if(t.memoizedProps!==i.pendingProps)Ft=!0;else{if(!bf(t,a)&&(i.flags&128)===0)return Ft=!1,qv(t,i,a);Ft=(t.flags&131072)!==0}else Ft=!1,rt&&(i.flags&1048576)!==0&&$m(i,Ra,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(t=Wi(i.elementType),i.type=t,typeof t=="function")Sc(t)?(o=rs(t,o),i.tag=1,i=lg(null,i,t,o,a)):(i.tag=0,i=ff(null,i,t,o,a));else{if(t!=null){var h=t.$$typeof;if(h===ae){i.tag=11,i=eg(null,i,t,o,a);break e}else if(h===K){i.tag=14,i=tg(null,i,t,o,a);break e}}throw i=re(t)||t,Error(s(306,i,""))}}return i;case 0:return ff(t,i,i.type,i.pendingProps,a);case 1:return o=i.type,h=rs(o,i.pendingProps),lg(t,i,o,h,a);case 3:e:{if(ze(i,i.stateNode.containerInfo),t===null)throw Error(s(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,Uc(t,i),qa(i,o,null,a);var x=i.memoizedState;if(o=x.cache,ui(i,Ht,o),o!==p.cache&&Nc(i,[Ht],a,!0),Pa(),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=og(t,i,o,a);break e}else if(o!==h){h=Vn(Error(s(424)),i),Ma(h),i=og(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(jt=Zn(t.firstChild),tn=i,rt=!0,li=null,Kn=!0,a=rp(i,null,o,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Xi(),o===h){i=Br(t,i,a);break e}rn(t,i,o,a)}i=i.child}return i;case 26:return jo(t,i),t===null?(a=_y(i.type,null,i.pendingProps,null))?i.memoizedState=a:rt||(a=i.type,t=i.pendingProps,o=Go(Se.current).createElement(a),o[_t]=i,o[zt]=t,sn(o,a,t),F(o),i.stateNode=o):i.memoizedState=_y(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return Le(i),t===null&&rt&&(o=i.stateNode=vy(i.type,i.pendingProps,Se.current),tn=i,Kn=!0,h=jt,Si(i.type)?(Qf=h,jt=Zn(o.firstChild)):jt=h),rn(t,i,i.pendingProps.children,a),jo(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&&rt&&((h=o=jt)&&(o=gw(o,i.type,i.pendingProps,Kn),o!==null?(i.stateNode=o,tn=i,jt=Zn(o.firstChild),Kn=!1,h=!0):h=!1),h||oi(i)),Le(i),h=i.type,p=i.pendingProps,x=t!==null?t.memoizedProps:null,o=p.children,Gf(h,p)?o=null:x!==null&&Gf(h,x)&&(i.flags|=32),i.memoizedState!==null&&(h=$c(t,i,Nv,null,null,a),al._currentValue=h),jo(t,i),rn(t,i,o,a),i.child;case 6:return t===null&&rt&&((t=a=jt)&&(a=yw(a,i.pendingProps,Kn),a!==null?(i.stateNode=a,tn=i,jt=null,t=!0):t=!1),t||oi(i)),null;case 13:return ug(t,i,a);case 4:return ze(i,i.stateNode.containerInfo),o=i.pendingProps,t===null?i.child=ts(i,null,o,a):rn(t,i,o,a),i.child;case 11:return eg(t,i,i.type,i.pendingProps,a);case 7:return rn(t,i,i.pendingProps,a),i.child;case 8:return rn(t,i,i.pendingProps.children,a),i.child;case 12:return rn(t,i,i.pendingProps.children,a),i.child;case 10:return o=i.pendingProps,ui(i,i.type,o.value),rn(t,i,o.children,a),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,Qi(i),h=nn(h),o=o(h),i.flags|=1,rn(t,i,o,a),i.child;case 14:return tg(t,i,i.type,i.pendingProps,a);case 15:return ng(t,i,i.type,i.pendingProps,a);case 19:return fg(t,i,a);case 31:return Pv(t,i,a);case 22:return rg(t,i,a,i.pendingProps);case 24:return Qi(i),o=nn(Ht),t===null?(h=Dc(),h===null&&(h=Et,p=Rc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),i.memoizedState={parent:o,cache:h},Lc(i),ui(i,Ht,h)):((t.lanes&a)!==0&&(Uc(t,i),qa(i,null,null,a),Pa()),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),ui(i,Ht,o)):(o=p.cache,ui(i,Ht,o),o!==h.cache&&Nc(i,[Ht],a,!0))),rn(t,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function Pr(t){t.flags|=4}function xf(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(Pg())t.flags|=8192;else throw es=mo,zc}else t.flags&=-16777217}function dg(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Ty(i))if(Pg())t.flags|=8192;else throw es=mo,zc}function No(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?ds():536870912,t.lanes|=i,Ps|=i)}function Ga(t,i){if(!rt)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 Ot(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 Hv(t,i,a){var o=i.pendingProps;switch(Cc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(i),null;case 1:return Ot(i),null;case 3:return a=i.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),zr(Ht),ue(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Cs(i)?Pr(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Tc())),Ot(i),null;case 26:var h=i.type,p=i.memoizedState;return t===null?(Pr(i),p!==null?(Ot(i),dg(i,p)):(Ot(i),xf(i,h,null,o,a))):p?p!==t.memoizedState?(Pr(i),Ot(i),dg(i,p)):(Ot(i),i.flags&=-16777217):(t=t.memoizedProps,t!==o&&Pr(i),Ot(i),xf(i,h,t,o,a)),null;case 27:if(We(i),a=Se.current,h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Pr(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Ot(i),null}t=xe.current,Cs(i)?Gm(i):(t=vy(h,o,a),i.stateNode=t,Pr(i))}return Ot(i),null;case 5:if(We(i),h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Pr(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Ot(i),null}if(p=xe.current,Cs(i))Gm(i);else{var x=Go(Se.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[_t]=i,p[zt]=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(sn(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&&Pr(i)}}return Ot(i),xf(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,a),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&Pr(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(s(166));if(t=Se.current,Cs(i)){if(t=i.stateNode,a=i.memoizedProps,o=null,h=tn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[_t]=i,t=!!(t.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||uy(t.nodeValue,a)),t||oi(i,!0)}else t=Go(t).createTextNode(o),t[_t]=i,i.stateNode=t}return Ot(i),null;case 31:if(a=i.memoizedState,t===null||t.memoizedState!==null){if(o=Cs(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[_t]=i}else Xi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ot(i),t=!1}else a=Tc(),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 Ot(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Cs(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[_t]=i}else Xi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ot(i),h=!1}else h=Tc(),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),No(i,i.updateQueue),Ot(i),null);case 4:return ue(),t===null&&Hf(i.stateNode.containerInfo),Ot(i),null;case 10:return zr(i.type),Ot(i),null;case 19:if(Z(Bt),o=i.memoizedState,o===null)return Ot(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Ga(o,!1);else{if(Ut!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(p=bo(t),p!==null){for(i.flags|=128,Ga(o,!1),t=p.updateQueue,i.updateQueue=t,No(i,t),i.subtreeFlags=0,t=a,a=i.child;a!==null;)Hm(a,t),a=a.sibling;return A(Bt,Bt.current&1|2),rt&&Mr(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&&Ct()>Lo&&(i.flags|=128,h=!0,Ga(o,!1),i.lanes=4194304)}else{if(!h)if(t=bo(p),t!==null){if(i.flags|=128,h=!0,t=t.updateQueue,i.updateQueue=t,No(i,t),Ga(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!rt)return Ot(i),null}else 2*Ct()-o.renderingStartTime>Lo&&a!==536870912&&(i.flags|=128,h=!0,Ga(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=Ct(),t.sibling=null,a=Bt.current,A(Bt,h?a&1|2:a&1),rt&&Mr(i,o.treeForkCount),t):(Ot(i),null);case 22:case 23:return On(i),Hc(),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&&(Ot(i),i.subtreeFlags&6&&(i.flags|=8192)):Ot(i),a=i.updateQueue,a!==null&&No(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&&Z(Zi),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),zr(Ht),Ot(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function Iv(t,i){switch(Cc(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return zr(Ht),ue(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return We(i),null;case 31:if(i.memoizedState!==null){if(On(i),i.alternate===null)throw Error(s(340));Xi()}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));Xi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return Z(Bt),null;case 4:return ue(),null;case 10:return zr(i.type),null;case 22:case 23:return On(i),Hc(),t!==null&&Z(Zi),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return zr(Ht),null;case 25:return null;default:return null}}function mg(t,i){switch(Cc(i),i.tag){case 3:zr(Ht),ue();break;case 26:case 27:case 5:We(i);break;case 4:ue();break;case 31:i.memoizedState!==null&&On(i);break;case 13:On(i);break;case 19:Z(Bt);break;case 10:zr(i.type);break;case 22:case 23:On(i),Hc(),t!==null&&Z(Zi);break;case 24:zr(Ht)}}function Va(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){pt(i,i.return,S)}}function pi(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 H=a,te=S;try{te()}catch(ce){pt(h,H,ce)}}}o=o.next}while(o!==p)}}catch(ce){pt(i,i.return,ce)}}function pg(t){var i=t.updateQueue;if(i!==null){var a=t.stateNode;try{sp(i,a)}catch(o){pt(t,t.return,o)}}}function gg(t,i,a){a.props=rs(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(o){pt(t,i,o)}}function Ja(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){pt(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){pt(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){pt(t,i,h)}else a.current=null}function yg(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){pt(t,t.return,h)}}function vf(t,i,a){try{var o=t.stateNode;cw(o,t.type,a,i),o[zt]=i}catch(h){pt(t,t.return,h)}}function bg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Si(t.type)||t.tag===4}function wf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||bg(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&&Si(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 Sf(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&&Si(t.type)&&(a=t.stateNode,i=null),t=t.child,t!==null))for(Sf(t,i,a),t=t.sibling;t!==null;)Sf(t,i,a),t=t.sibling}function Ro(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&&Si(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Ro(t,i,a),t=t.sibling;t!==null;)Ro(t,i,a),t=t.sibling}function xg(t){var i=t.stateNode,a=t.memoizedProps;try{for(var o=t.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);sn(i,o,a),i[_t]=t,i[zt]=a}catch(p){pt(t,t.return,p)}}var qr=!1,$t=!1,_f=!1,vg=typeof WeakSet=="function"?WeakSet:Set,Qt=null;function Fv(t,i){if(t=t.containerInfo,$f=Wo,t=Rm(t),pc(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,H=-1,te=0,ce=0,ge=t,ne=null;t:for(;;){for(var se;ge!==a||h!==0&&ge.nodeType!==3||(S=x+h),ge!==p||o!==0&&ge.nodeType!==3||(H=x+o),ge.nodeType===3&&(x+=ge.nodeValue.length),(se=ge.firstChild)!==null;)ne=ge,ge=se;for(;;){if(ge===t)break t;if(ne===a&&++te===h&&(S=x),ne===p&&++ce===o&&(H=x),(se=ge.nextSibling)!==null)break;ge=ne,ne=ge.parentNode}ge=se}a=S===-1||H===-1?null:{start:S,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Yf={focusedElem:t,selectionRange:a},Wo=!1,Qt=i;Qt!==null;)if(i=Qt,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,Qt=t;else for(;Qt!==null;){switch(i=Qt,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 Ne=rs(a.type,h);t=o.getSnapshotBeforeUpdate(Ne,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(Be){pt(a,a.return,Be)}}break;case 3:if((t&1024)!==0){if(t=i.stateNode.containerInfo,a=t.nodeType,a===9)Jf(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Jf(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,Qt=t;break}Qt=i.return}}function wg(t,i,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:Ir(t,a),o&4&&Va(5,a);break;case 1:if(Ir(t,a),o&4)if(t=a.stateNode,i===null)try{t.componentDidMount()}catch(x){pt(a,a.return,x)}else{var h=rs(a.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(h,i,t.__reactInternalSnapshotBeforeUpdate)}catch(x){pt(a,a.return,x)}}o&64&&pg(a),o&512&&Ja(a,a.return);break;case 3:if(Ir(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{sp(t,i)}catch(x){pt(a,a.return,x)}}break;case 27:i===null&&o&4&&xg(a);case 26:case 5:Ir(t,a),i===null&&o&4&&yg(a),o&512&&Ja(a,a.return);break;case 12:Ir(t,a);break;case 31:Ir(t,a),o&4&&Eg(t,a);break;case 13:Ir(t,a),o&4&&kg(t,a),o&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=Zv.bind(null,a),bw(t,a))));break;case 22:if(o=a.memoizedState!==null||qr,!o){i=i!==null&&i.memoizedState!==null||$t,h=qr;var p=$t;qr=o,($t=i)&&!p?Fr(t,a,(a.subtreeFlags&8772)!==0):Ir(t,a),qr=h,$t=p}break;case 30:break;default:Ir(t,a)}}function Sg(t){var i=t.alternate;i!==null&&(t.alternate=null,Sg(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&ms(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 Nt=null,xn=!1;function Hr(t,i,a){for(a=a.child;a!==null;)_g(t,i,a),a=a.sibling}function _g(t,i,a){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(en,a)}catch{}switch(a.tag){case 26:$t||yr(a,i),Hr(t,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:$t||yr(a,i);var o=Nt,h=xn;Si(a.type)&&(Nt=a.stateNode,xn=!1),Hr(t,i,a),rl(a.stateNode),Nt=o,xn=h;break;case 5:$t||yr(a,i);case 6:if(o=Nt,h=xn,Nt=null,Hr(t,i,a),Nt=o,xn=h,Nt!==null)if(xn)try{(Nt.nodeType===9?Nt.body:Nt.nodeName==="HTML"?Nt.ownerDocument.body:Nt).removeChild(a.stateNode)}catch(p){pt(a,i,p)}else try{Nt.removeChild(a.stateNode)}catch(p){pt(a,i,p)}break;case 18:Nt!==null&&(xn?(t=Nt,py(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),Vs(t)):py(Nt,a.stateNode));break;case 4:o=Nt,h=xn,Nt=a.stateNode.containerInfo,xn=!0,Hr(t,i,a),Nt=o,xn=h;break;case 0:case 11:case 14:case 15:pi(2,a,i),$t||pi(4,a,i),Hr(t,i,a);break;case 1:$t||(yr(a,i),o=a.stateNode,typeof o.componentWillUnmount=="function"&&gg(a,i,o)),Hr(t,i,a);break;case 21:Hr(t,i,a);break;case 22:$t=(o=$t)||a.memoizedState!==null,Hr(t,i,a),$t=o;break;default:Hr(t,i,a)}}function Eg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Vs(t)}catch(a){pt(i,i.return,a)}}}function kg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Vs(t)}catch(a){pt(i,i.return,a)}}function $v(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new vg),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new vg),i;default:throw Error(s(435,t.tag))}}function Mo(t,i){var a=$v(t);i.forEach(function(o){if(!a.has(o)){a.add(o);var h=Wv.bind(null,t,o);o.then(h,h)}})}function vn(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(Si(S.type)){Nt=S.stateNode,xn=!1;break e}break;case 5:Nt=S.stateNode,xn=!1;break e;case 3:case 4:Nt=S.stateNode.containerInfo,xn=!0;break e}S=S.return}if(Nt===null)throw Error(s(160));_g(p,x,h),Nt=null,xn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Cg(i,t),i=i.sibling}var or=null;function Cg(t,i){var a=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:vn(i,t),wn(t),o&4&&(pi(3,t,t.return),Va(3,t),pi(5,t,t.return));break;case 1:vn(i,t),wn(t),o&512&&($t||a===null||yr(a,a.return)),o&64&&qr&&(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(vn(i,t),wn(t),o&512&&($t||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[Jt]||p[_t]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),sn(p,o,a),p[_t]=t,F(p),o=p;break e;case"link":var x=Cy("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),sn(p,o,a),h.head.appendChild(p);break;case"meta":if(x=Cy("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),sn(p,o,a),h.head.appendChild(p);break;default:throw Error(s(468,o))}p[_t]=t,F(p),o=p}t.stateNode=o}else Ay(h,t.type,t.stateNode);else t.stateNode=ky(h,o,t.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?Ay(h,t.type,t.stateNode):ky(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&vf(t,t.memoizedProps,a.memoizedProps)}break;case 27:vn(i,t),wn(t),o&512&&($t||a===null||yr(a,a.return)),a!==null&&o&4&&vf(t,t.memoizedProps,a.memoizedProps);break;case 5:if(vn(i,t),wn(t),o&512&&($t||a===null||yr(a,a.return)),t.flags&32){h=t.stateNode;try{gs(h,"")}catch(Ne){pt(t,t.return,Ne)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,vf(t,h,a!==null?a.memoizedProps:h)),o&1024&&(_f=!0);break;case 6:if(vn(i,t),wn(t),o&4){if(t.stateNode===null)throw Error(s(162));o=t.memoizedProps,a=t.stateNode;try{a.nodeValue=o}catch(Ne){pt(t,t.return,Ne)}}break;case 3:if(Xo=null,h=or,or=Vo(i.containerInfo),vn(i,t),or=h,wn(t),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Vs(i.containerInfo)}catch(Ne){pt(t,t.return,Ne)}_f&&(_f=!1,Ag(t));break;case 4:o=or,or=Vo(t.stateNode.containerInfo),vn(i,t),wn(t),or=o;break;case 12:vn(i,t),wn(t);break;case 31:vn(i,t),wn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Mo(t,o)));break;case 13:vn(i,t),wn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(zo=Ct()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Mo(t,o)));break;case 22:h=t.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,te=qr,ce=$t;if(qr=te||h,$t=ce||H,vn(i,t),$t=ce,qr=te,wn(t),o&8192)e:for(i=t.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||H||qr||$t||is(t)),a=null,i=t;;){if(i.tag===5||i.tag===26){if(a===null){H=a=i;try{if(p=H.stateNode,h)x=p.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{S=H.stateNode;var ge=H.memoizedProps.style,ne=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;S.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ne){pt(H,H.return,Ne)}}}else if(i.tag===6){if(a===null){H=i;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(Ne){pt(H,H.return,Ne)}}}else if(i.tag===18){if(a===null){H=i;try{var se=H.stateNode;h?gy(se,!0):gy(H.stateNode,!1)}catch(Ne){pt(H,H.return,Ne)}}}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,Mo(t,a))));break;case 19:vn(i,t),wn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Mo(t,o)));break;case 30:break;case 21:break;default:vn(i,t),wn(t)}}function wn(t){var i=t.flags;if(i&2){try{for(var a,o=t.return;o!==null;){if(bg(o)){a=o;break}o=o.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var h=a.stateNode,p=wf(t);Ro(t,p,h);break;case 5:var x=a.stateNode;a.flags&32&&(gs(x,""),a.flags&=-33);var S=wf(t);Ro(t,S,x);break;case 3:case 4:var H=a.stateNode.containerInfo,te=wf(t);Sf(t,te,H);break;default:throw Error(s(161))}}catch(ce){pt(t,t.return,ce)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function Ag(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;Ag(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),t=t.sibling}}function Ir(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)wg(t,i.alternate,i),i=i.sibling}function is(t){for(t=t.child;t!==null;){var i=t;switch(i.tag){case 0:case 11:case 14:case 15:pi(4,i,i.return),is(i);break;case 1:yr(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&gg(i,i.return,a),is(i);break;case 27:rl(i.stateNode);case 26:case 5:yr(i,i.return),is(i);break;case 22:i.memoizedState===null&&is(i);break;case 30:is(i);break;default:is(i)}t=t.sibling}}function Fr(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:Fr(h,p,a),Va(4,p);break;case 1:if(Fr(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(te){pt(o,o.return,te)}if(o=p,h=o.updateQueue,h!==null){var S=o.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)ip(H[h],S)}catch(te){pt(o,o.return,te)}}a&&x&64&&pg(p),Ja(p,p.return);break;case 27:xg(p);case 26:case 5:Fr(h,p,a),a&&o===null&&x&4&&yg(p),Ja(p,p.return);break;case 12:Fr(h,p,a);break;case 31:Fr(h,p,a),a&&x&4&&Eg(h,p);break;case 13:Fr(h,p,a),a&&x&4&&kg(h,p);break;case 22:p.memoizedState===null&&Fr(h,p,a),Ja(p,p.return);break;case 30:break;default:Fr(h,p,a)}i=i.sibling}}function Ef(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&&Da(a))}function kf(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Da(t))}function ur(t,i,a,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Tg(t,i,a,o),i=i.sibling}function Tg(t,i,a,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:ur(t,i,a,o),h&2048&&Va(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&&Da(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(H){pt(i,i.return,H)}}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):Xa(t,i):p._visibility&2?ur(t,i,a,o):(p._visibility|=2,Ls(t,i,a,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Ef(x,i);break;case 24:ur(t,i,a,o),h&2048&&kf(i.alternate,i);break;default:ur(t,i,a,o)}}function Ls(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,H=o,te=x.flags;switch(x.tag){case 0:case 11:case 15:Ls(p,x,S,H,h),Va(8,x);break;case 23:break;case 22:var ce=x.stateNode;x.memoizedState!==null?ce._visibility&2?Ls(p,x,S,H,h):Xa(p,x):(ce._visibility|=2,Ls(p,x,S,H,h)),h&&te&2048&&Ef(x.alternate,x);break;case 24:Ls(p,x,S,H,h),h&&te&2048&&kf(x.alternate,x);break;default:Ls(p,x,S,H,h)}i=i.sibling}}function Xa(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:Xa(a,o),h&2048&&Ef(o.alternate,o);break;case 24:Xa(a,o),h&2048&&kf(o.alternate,o);break;default:Xa(a,o)}i=i.sibling}}var Ka=8192;function Us(t,i,a){if(t.subtreeFlags&Ka)for(t=t.child;t!==null;)jg(t,i,a),t=t.sibling}function jg(t,i,a){switch(t.tag){case 26:Us(t,i,a),t.flags&Ka&&t.memoizedState!==null&&Ow(a,or,t.memoizedState,t.memoizedProps);break;case 5:Us(t,i,a);break;case 3:case 4:var o=or;or=Vo(t.stateNode.containerInfo),Us(t,i,a),or=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=Ka,Ka=16777216,Us(t,i,a),Ka=o):Us(t,i,a));break;default:Us(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 Qa(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];Qt=o,Rg(o,t)}Og(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ng(t),t=t.sibling}function Ng(t){switch(t.tag){case 0:case 11:case 15:Qa(t),t.flags&2048&&pi(9,t,t.return);break;case 3:Qa(t);break;case 12:Qa(t);break;case 22:var i=t.stateNode;t.memoizedState!==null&&i._visibility&2&&(t.return===null||t.return.tag!==13)?(i._visibility&=-3,Do(t)):Qa(t);break;default:Qa(t)}}function Do(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];Qt=o,Rg(o,t)}Og(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:pi(8,i,i.return),Do(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,Do(i));break;default:Do(i)}t=t.sibling}}function Rg(t,i){for(;Qt!==null;){var a=Qt;switch(a.tag){case 0:case 11:case 15:pi(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:Da(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,Qt=o;else e:for(a=t;Qt!==null;){o=Qt;var h=o.sibling,p=o.return;if(Sg(o),o===a){Qt=null;break e}if(h!==null){h.return=p,Qt=h;break e}Qt=p}}}var Yv={getCacheForType:function(t){var i=nn(Ht),a=i.data.get(t);return a===void 0&&(a=t(),i.data.set(t,a)),a},cacheSignal:function(){return nn(Ht).controller.signal}},Gv=typeof WeakMap=="function"?WeakMap:Map,ft=0,Et=null,Ke=null,et=0,mt=0,Nn=null,gi=!1,Bs=!1,Cf=!1,$r=0,Ut=0,yi=0,ss=0,Af=0,Rn=0,Ps=0,Za=null,Sn=null,Tf=!1,zo=0,Mg=0,Lo=1/0,Uo=null,bi=null,Xt=0,xi=null,qs=null,Yr=0,jf=0,Of=null,Dg=null,Wa=0,Nf=null;function Mn(){return(ft&2)!==0&&et!==0?et&-et:I.T!==null?Uf():wa()}function zg(){if(Rn===0)if((et&536870912)===0||rt){var t=Ar;Ar<<=1,(Ar&3932160)===0&&(Ar=262144),Rn=t}else Rn=536870912;return t=jn.current,t!==null&&(t.flags|=32),Rn}function _n(t,i,a){(t===Et&&(mt===2||mt===9)||t.cancelPendingCommit!==null)&&(Hs(t,0),vi(t,et,Rn,!1)),sr(t,a),((ft&2)===0||t!==Et)&&(t===Et&&((ft&2)===0&&(ss|=a),Ut===4&&vi(t,et,Rn,!1)),br(t))}function Lg(t,i,a){if((ft&6)!==0)throw Error(s(327));var o=!a&&(i&127)===0&&(i&t.expiredLanes)===0||qi(t,i),h=o?Xv(t,i):Mf(t,i,!0),p=o;do{if(h===0){Bs&&!o&&vi(t,i,0,!1);break}else{if(a=t.current.alternate,p&&!Vv(a)){h=Mf(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=Za;var H=S.current.memoizedState.isDehydrated;if(H&&(Hs(S,x).flags|=256),x=Mf(S,x,!1),x!==2){if(Cf&&!H){S.errorRecoveryDisabledLanes|=p,ss|=p,h=4;break e}p=Sn,Sn=h,p!==null&&(Sn===null?Sn=p:Sn.push.apply(Sn,p))}h=x}if(p=!1,h!==2)continue}}if(h===1){Hs(t,0),vi(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:vi(o,i,Rn,!gi);break e;case 2:Sn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=zo+300-Ct(),10<h)){if(vi(o,i,Rn,!gi),Pi(o,0,!0)!==0)break e;Yr=i,o.timeoutHandle=dy(Ug.bind(null,o,a,Sn,Uo,Tf,i,Rn,ss,Ps,gi,p,"Throttled",-0,0),h);break e}Ug(o,a,Sn,Uo,Tf,i,Rn,ss,Ps,gi,p,null,-0,0)}}break}while(!0);br(t)}function Ug(t,i,a,o,h,p,x,S,H,te,ce,ge,ne,se){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},jg(i,p,ge);var Ne=(p&62914560)===p?zo-Ct():(p&4194048)===p?Mg-Ct():0;if(Ne=Nw(ge,Ne),Ne!==null){Yr=p,t.cancelPendingCommit=Ne(Yg.bind(null,t,i,p,a,o,h,x,S,H,ce,ge,null,ne,se)),vi(t,p,x,!te);return}}Yg(t,i,p,a,o,h,x,S,H)}function Vv(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(!An(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 vi(t,i,a,o){i&=~Af,i&=~ss,t.suspendedLanes|=i,t.pingedLanes&=~i,o&&(t.warmLanes|=i),o=t.expirationTimes;for(var h=i;0<h;){var p=31-ht(h),x=1<<p;o[p]=-1,h&=~x}a!==0&&ri(t,a,i)}function Bo(){return(ft&6)===0?(el(0),!1):!0}function Rf(){if(Ke!==null){if(mt===0)var t=Ke.return;else t=Ke,Dr=Ki=null,Vc(t),Ns=null,La=0,t=Ke;for(;t!==null;)mg(t.alternate,t),t=t.return;Ke=null}}function Hs(t,i){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,dw(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Yr=0,Rf(),Et=t,Ke=a=Rr(t.current,null),et=i,mt=0,Nn=null,gi=!1,Bs=qi(t,i),Cf=!1,Ps=Rn=Af=ss=yi=Ut=0,Sn=Za=null,Tf=!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-ht(o),p=1<<h;i|=t[h],o&=~p}return $r=i,io(),a}function Bg(t,i){Ye=null,I.H=$a,i===Os||i===ho?(i=ep(),mt=3):i===zc?(i=ep(),mt=4):mt=i===cf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Nn=i,Ke===null&&(Ut=1,Ao(t,Vn(i,t.current)))}function Pg(){var t=jn.current;return t===null?!0:(et&4194048)===et?Qn===null:(et&62914560)===et||(et&536870912)!==0?t===Qn:!1}function qg(){var t=I.H;return I.H=$a,t===null?$a:t}function Hg(){var t=I.A;return I.A=Yv,t}function Po(){Ut=4,gi||(et&4194048)!==et&&jn.current!==null||(Bs=!0),(yi&134217727)===0&&(ss&134217727)===0||Et===null||vi(Et,et,Rn,!1)}function Mf(t,i,a){var o=ft;ft|=2;var h=qg(),p=Hg();(Et!==t||et!==i)&&(Uo=null,Hs(t,i)),i=!1;var x=Ut;e:do try{if(mt!==0&&Ke!==null){var S=Ke,H=Nn;switch(mt){case 8:Rf(),x=6;break e;case 3:case 2:case 9:case 6:jn.current===null&&(i=!0);var te=mt;if(mt=0,Nn=null,Is(t,S,H,te),a&&Bs){x=0;break e}break;default:te=mt,mt=0,Nn=null,Is(t,S,H,te)}}Jv(),x=Ut;break}catch(ce){Bg(t,ce)}while(!0);return i&&t.shellSuspendCounter++,Dr=Ki=null,ft=o,I.H=h,I.A=p,Ke===null&&(Et=null,et=0,io()),x}function Jv(){for(;Ke!==null;)Ig(Ke)}function Xv(t,i){var a=ft;ft|=2;var o=qg(),h=Hg();Et!==t||et!==i?(Uo=null,Lo=Ct()+500,Hs(t,i)):Bs=qi(t,i);e:do try{if(mt!==0&&Ke!==null){i=Ke;var p=Nn;t:switch(mt){case 1:mt=0,Nn=null,Is(t,i,p,1);break;case 2:case 9:if(Zm(p)){mt=0,Nn=null,Fg(i);break}i=function(){mt!==2&&mt!==9||Et!==t||(mt=7),br(t)},p.then(i,i);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:Zm(p)?(mt=0,Nn=null,Fg(i)):(mt=0,Nn=null,Is(t,i,p,7));break;case 5:var x=null;switch(Ke.tag){case 26:x=Ke.memoizedState;case 5:case 27:var S=Ke;if(x?Ty(x):S.stateNode.complete){mt=0,Nn=null;var H=S.sibling;if(H!==null)Ke=H;else{var te=S.return;te!==null?(Ke=te,qo(te)):Ke=null}break t}}mt=0,Nn=null,Is(t,i,p,5);break;case 6:mt=0,Nn=null,Is(t,i,p,6);break;case 8:Rf(),Ut=6;break e;default:throw Error(s(462))}}Kv();break}catch(ce){Bg(t,ce)}while(!0);return Dr=Ki=null,I.H=o,I.A=h,ft=a,Ke!==null?0:(Et=null,et=0,io(),Ut)}function Kv(){for(;Ke!==null&&!Gt();)Ig(Ke)}function Ig(t){var i=hg(t.alternate,t,$r);t.memoizedProps=t.pendingProps,i===null?qo(t):Ke=i}function Fg(t){var i=t,a=i.alternate;switch(i.tag){case 15:case 0:i=ag(a,i,i.pendingProps,i.type,void 0,et);break;case 11:i=ag(a,i,i.pendingProps,i.type.render,i.ref,et);break;case 5:Vc(i);default:mg(a,i),i=Ke=Hm(i,$r),i=hg(a,i,$r)}t.memoizedProps=t.pendingProps,i===null?qo(t):Ke=i}function Is(t,i,a,o){Dr=Ki=null,Vc(i),Ns=null,La=0;var h=i.return;try{if(Bv(t,h,i,a,et)){Ut=1,Ao(t,Vn(a,t.current)),Ke=null;return}}catch(p){if(h!==null)throw Ke=h,p;Ut=1,Ao(t,Vn(a,t.current)),Ke=null;return}i.flags&32768?(rt||o===1?t=!0:Bs||(et&536870912)!==0?t=!1:(gi=t=!0,(o===2||o===9||o===3||o===6)&&(o=jn.current,o!==null&&o.tag===13&&(o.flags|=16384))),$g(i,t)):qo(i)}function qo(t){var i=t;do{if((i.flags&32768)!==0){$g(i,gi);return}t=i.return;var a=Hv(i.alternate,i,$r);if(a!==null){Ke=a;return}if(i=i.sibling,i!==null){Ke=i;return}Ke=i=t}while(i!==null);Ut===0&&(Ut=5)}function $g(t,i){do{var a=Iv(t.alternate,t);if(a!==null){a.flags&=32767,Ke=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(t=t.sibling,t!==null)){Ke=t;return}Ke=t=a}while(t!==null);Ut=6,Ke=null}function Yg(t,i,a,o,h,p,x,S,H){t.cancelPendingCommit=null;do Ho();while(Xt!==0);if((ft&6)!==0)throw Error(s(327));if(i!==null){if(i===t.current)throw Error(s(177));if(p=i.lanes|i.childLanes,p|=vc,ni(t,a,p,x,S,H),t===Et&&(Ke=Et=null,et=0),qs=i,xi=t,Yr=a,jf=p,Of=h,Dg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,ew(qe,function(){return Kg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=I.T,I.T=null,h=oe.p,oe.p=2,x=ft,ft|=4;try{Fv(t,i,a)}finally{ft=x,oe.p=h,I.T=o}}Xt=1,Gg(),Vg(),Jg()}}function Gg(){if(Xt===1){Xt=0;var t=xi,i=qs,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=I.T,I.T=null;var o=oe.p;oe.p=2;var h=ft;ft|=4;try{Cg(i,t);var p=Yf,x=Rm(t.containerInfo),S=p.focusedElem,H=p.selectionRange;if(x!==S&&S&&S.ownerDocument&&Nm(S.ownerDocument.documentElement,S)){if(H!==null&&pc(S)){var te=H.start,ce=H.end;if(ce===void 0&&(ce=te),"selectionStart"in S)S.selectionStart=te,S.selectionEnd=Math.min(ce,S.value.length);else{var ge=S.ownerDocument||document,ne=ge&&ge.defaultView||window;if(ne.getSelection){var se=ne.getSelection(),Ne=S.textContent.length,Be=Math.min(H.start,Ne),bt=H.end===void 0?Be:Math.min(H.end,Ne);!se.extend&&Be>bt&&(x=bt,bt=Be,Be=x);var X=Om(S,Be),V=Om(S,bt);if(X&&V&&(se.rangeCount!==1||se.anchorNode!==X.node||se.anchorOffset!==X.offset||se.focusNode!==V.node||se.focusOffset!==V.offset)){var ee=ge.createRange();ee.setStart(X.node,X.offset),se.removeAllRanges(),Be>bt?(se.addRange(ee),se.extend(V.node,V.offset)):(ee.setEnd(V.node,V.offset),se.addRange(ee))}}}}for(ge=[],se=S;se=se.parentNode;)se.nodeType===1&&ge.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<ge.length;S++){var de=ge[S];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}Wo=!!$f,Yf=$f=null}finally{ft=h,oe.p=o,I.T=a}}t.current=i,Xt=2}}function Vg(){if(Xt===2){Xt=0;var t=xi,i=qs,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=I.T,I.T=null;var o=oe.p;oe.p=2;var h=ft;ft|=4;try{wg(t,i.alternate,i)}finally{ft=h,oe.p=o,I.T=a}}Xt=3}}function Jg(){if(Xt===4||Xt===3){Xt=0,Hn();var t=xi,i=qs,a=Yr,o=Dg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Xt=5:(Xt=0,qs=xi=null,Xg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(bi=null),Ii(a),i=i.stateNode,St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(en,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=I.T,h=oe.p,oe.p=2,I.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{I.T=i,oe.p=h}}(Yr&3)!==0&&Ho(),br(t),h=t.pendingLanes,(a&261930)!==0&&(h&42)!==0?t===Nf?Wa++:(Wa=0,Nf=t):Wa=0,el(0)}}function Xg(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,Da(i)))}function Ho(){return Gg(),Vg(),Jg(),Kg()}function Kg(){if(Xt!==5)return!1;var t=xi,i=jf;jf=0;var a=Ii(Yr),o=I.T,h=oe.p;try{oe.p=32>a?32:a,I.T=null,a=Of,Of=null;var p=xi,x=Yr;if(Xt=0,qs=xi=null,Yr=0,(ft&6)!==0)throw Error(s(331));var S=ft;if(ft|=4,Ng(p.current),Tg(p,p.current,x,a),ft=S,el(0,!1),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(en,p)}catch{}return!0}finally{oe.p=h,I.T=o,Xg(t,i)}}function Qg(t,i,a){i=Vn(a,i),i=uf(t.stateNode,i,2),t=hi(t,i,2),t!==null&&(sr(t,2),br(t))}function pt(t,i,a){if(t.tag===3)Qg(t,t,a);else for(;i!==null;){if(i.tag===3){Qg(i,t,a);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(bi===null||!bi.has(o))){t=Vn(a,t),a=Zp(2),o=hi(i,a,2),o!==null&&(Wp(a,o,i,t),sr(o,2),br(o));break}}i=i.return}}function Df(t,i,a){var o=t.pingCache;if(o===null){o=t.pingCache=new Gv;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)||(Cf=!0,h.add(a),t=Qv.bind(null,t,i,a),i.then(t,t))}function Qv(t,i,a){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,Et===t&&(et&a)===a&&(Ut===4||Ut===3&&(et&62914560)===et&&300>Ct()-zo?(ft&2)===0&&Hs(t,0):Af|=a,Ps===et&&(Ps=0)),br(t)}function Zg(t,i){i===0&&(i=ds()),t=Vi(t,i),t!==null&&(sr(t,i),br(t))}function Zv(t){var i=t.memoizedState,a=0;i!==null&&(a=i.retryLane),Zg(t,a)}function Wv(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),Zg(t,a)}function ew(t,i){return Pe(t,i)}var Io=null,Fs=null,zf=!1,Fo=!1,Lf=!1,wi=0;function br(t){t!==Fs&&t.next===null&&(Fs===null?Io=Fs=t:Fs=Fs.next=t),Fo=!0,zf||(zf=!0,nw())}function el(t,i){if(!Lf&&Fo){Lf=!0;do for(var a=!1,o=Io;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-ht(42|t)+1)-1,p&=h&~(x&~S),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,ny(o,p))}else p=et,p=Pi(o,o===Et?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||qi(o,p)||(a=!0,ny(o,p));o=o.next}while(a);Lf=!1}}function tw(){Wg()}function Wg(){Fo=zf=!1;var t=0;wi!==0&&hw()&&(t=wi);for(var i=Ct(),a=null,o=Io;o!==null;){var h=o.next,p=ey(o,i);p===0?(o.next=null,a===null?Io=h:a.next=h,h===null&&(Fs=a)):(a=o,(t!==0||(p&3)!==0)&&(Fo=!0)),o=h}Xt!==0&&Xt!==5||el(t),wi!==0&&(wi=0)}function ey(t,i){for(var a=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var x=31-ht(p),S=1<<x,H=h[x];H===-1?((S&a)===0||(S&o)!==0)&&(h[x]=va(S,i)):H<=i&&(t.expiredLanes|=S),p&=~S}if(i=Et,a=et,a=Pi(t,t===i?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,a===0||t===i&&(mt===2||mt===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&$e(o),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||qi(t,a)){if(i=a&-a,i===t.callbackPriority)return i;switch(o!==null&&$e(o),Ii(a)){case 2:case 8:a=_e;break;case 32:a=qe;break;case 268435456:a=ot;break;default:a=qe}return o=ty.bind(null,t),a=Pe(a,o),t.callbackPriority=i,t.callbackNode=a,i}return o!==null&&o!==null&&$e(o),t.callbackPriority=2,t.callbackNode=null,2}function ty(t,i){if(Xt!==0&&Xt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(Ho()&&t.callbackNode!==a)return null;var o=et;return o=Pi(t,t===Et?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(Lg(t,o,i),ey(t,Ct()),t.callbackNode!=null&&t.callbackNode===a?ty.bind(null,t):null)}function ny(t,i){if(Ho())return null;Lg(t,i,!0)}function nw(){mw(function(){(ft&6)!==0?Pe(fe,tw):Wg()})}function Uf(){if(wi===0){var t=Ts;t===0&&(t=Wr,Wr<<=1,(Wr&261888)===0&&(Wr=256)),wi=t}return wi}function ry(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Kl(""+t)}function iy(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 rw(t,i,a,o,h){if(i==="submit"&&a&&a.stateNode===h){var p=ry((h[zt]||null).action),x=o.submitter;x&&(i=(i=x[zt]||null)?ry(i.formAction):x.getAttribute("formAction"),i!==null&&(p=i,x=null));var S=new eo("action","action",null,o,h);t.push({event:S,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(wi!==0){var H=x?iy(h,x):new FormData(h);nf(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(S.preventDefault(),H=x?iy(h,x):new FormData(h),nf(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var Bf=0;Bf<xc.length;Bf++){var Pf=xc[Bf],iw=Pf.toLowerCase(),sw=Pf[0].toUpperCase()+Pf.slice(1);lr(iw,"on"+sw)}lr(zm,"onAnimationEnd"),lr(Lm,"onAnimationIteration"),lr(Um,"onAnimationStart"),lr("dblclick","onDoubleClick"),lr("focusin","onFocus"),lr("focusout","onBlur"),lr(wv,"onTransitionRun"),lr(Sv,"onTransitionStart"),lr(_v,"onTransitionCancel"),lr(Bm,"onTransitionEnd"),ie("onMouseEnter",["mouseout","mouseover"]),ie("onMouseLeave",["mouseout","mouseover"]),ie("onPointerEnter",["pointerout","pointerover"]),ie("onPointerLeave",["pointerout","pointerover"]),be("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),be("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),be("onBeforeInput",["compositionend","keypress","textInput","paste"]),be("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var tl="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(" "),aw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(tl));function sy(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],H=S.instance,te=S.currentTarget;if(S=S.listener,H!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=te;try{p(h)}catch(ce){ro(ce)}h.currentTarget=null,p=H}else for(x=0;x<o.length;x++){if(S=o[x],H=S.instance,te=S.currentTarget,S=S.listener,H!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=te;try{p(h)}catch(ce){ro(ce)}h.currentTarget=null,p=H}}}}function Qe(t,i){var a=i[Fi];a===void 0&&(a=i[Fi]=new Set);var o=t+"__bubble";a.has(o)||(ay(i,t,2,!1),a.add(o))}function qf(t,i,a){var o=0;i&&(o|=4),ay(a,t,o,i)}var $o="_reactListening"+Math.random().toString(36).slice(2);function Hf(t){if(!t[$o]){t[$o]=!0,Q.forEach(function(a){a!=="selectionchange"&&(aw.has(a)||qf(a,!1,t),qf(a,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[$o]||(i[$o]=!0,qf("selectionchange",!1,i))}}function ay(t,i,a,o){switch(zy(i)){case 2:var h=Dw;break;case 8:h=zw;break;default:h=nh}a=h.bind(null,i,a,t),h=void 0,!ac||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 If(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 H=x.tag;if((H===3||H===4)&&x.stateNode.containerInfo===h)return;x=x.return}for(;S!==null;){if(x=E(S),x===null)return;if(H=x.tag,H===5||H===6||H===26||H===27){o=p=x;continue e}S=S.parentNode}}o=o.return}fm(function(){var te=p,ce=ic(a),ge=[];e:{var ne=Pm.get(t);if(ne!==void 0){var se=eo,Ne=t;switch(t){case"keypress":if(Zl(a)===0)break e;case"keydown":case"keyup":se=W1;break;case"focusin":Ne="focus",se=cc;break;case"focusout":Ne="blur",se=cc;break;case"beforeblur":case"afterblur":se=cc;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":se=mm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=H1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=nv;break;case zm:case Lm:case Um:se=$1;break;case Bm:se=iv;break;case"scroll":case"scrollend":se=P1;break;case"wheel":se=av;break;case"copy":case"cut":case"paste":se=G1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=gm;break;case"toggle":case"beforetoggle":se=ov}var Be=(i&4)!==0,bt=!Be&&(t==="scroll"||t==="scrollend"),X=Be?ne!==null?ne+"Capture":null:ne;Be=[];for(var V=te,ee;V!==null;){var de=V;if(ee=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||ee===null||X===null||(de=_a(V,X),de!=null&&Be.push(nl(V,de,ee))),bt)break;V=V.return}0<Be.length&&(ne=new se(ne,Ne,null,a,ce),ge.push({event:ne,listeners:Be}))}}if((i&7)===0){e:{if(ne=t==="mouseover"||t==="pointerover",se=t==="mouseout"||t==="pointerout",ne&&a!==rc&&(Ne=a.relatedTarget||a.fromElement)&&(E(Ne)||Ne[Cn]))break e;if((se||ne)&&(ne=ce.window===ce?ce:(ne=ce.ownerDocument)?ne.defaultView||ne.parentWindow:window,se?(Ne=a.relatedTarget||a.toElement,se=te,Ne=Ne?E(Ne):null,Ne!==null&&(bt=u(Ne),Be=Ne.tag,Ne!==bt||Be!==5&&Be!==27&&Be!==6)&&(Ne=null)):(se=null,Ne=te),se!==Ne)){if(Be=mm,de="onMouseLeave",X="onMouseEnter",V="mouse",(t==="pointerout"||t==="pointerover")&&(Be=gm,de="onPointerLeave",X="onPointerEnter",V="pointer"),bt=se==null?ne:T(se),ee=Ne==null?ne:T(Ne),ne=new Be(de,V+"leave",se,a,ce),ne.target=bt,ne.relatedTarget=ee,de=null,E(ce)===te&&(Be=new Be(X,V+"enter",Ne,a,ce),Be.target=ee,Be.relatedTarget=bt,de=Be),bt=de,se&&Ne)t:{for(Be=lw,X=se,V=Ne,ee=0,de=X;de;de=Be(de))ee++;de=0;for(var De=V;De;De=Be(De))de++;for(;0<ee-de;)X=Be(X),ee--;for(;0<de-ee;)V=Be(V),de--;for(;ee--;){if(X===V||V!==null&&X===V.alternate){Be=X;break t}X=Be(X),V=Be(V)}Be=null}else Be=null;se!==null&&ly(ge,ne,se,Be,!1),Ne!==null&&bt!==null&&ly(ge,bt,Ne,Be,!0)}}e:{if(ne=te?T(te):window,se=ne.nodeName&&ne.nodeName.toLowerCase(),se==="select"||se==="input"&&ne.type==="file")var ut=Em;else if(Sm(ne))if(km)ut=bv;else{ut=gv;var Re=pv}else se=ne.nodeName,!se||se.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&nc(te.elementType)&&(ut=Em):ut=yv;if(ut&&(ut=ut(t,te))){_m(ge,ut,a,ce);break e}Re&&Re(t,ne,te),t==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&tc(ne,"number",ne.value)}switch(Re=te?T(te):window,t){case"focusin":(Sm(Re)||Re.contentEditable==="true")&&(vs=Re,gc=te,Na=null);break;case"focusout":Na=gc=vs=null;break;case"mousedown":yc=!0;break;case"contextmenu":case"mouseup":case"dragend":yc=!1,Mm(ge,a,ce);break;case"selectionchange":if(vv)break;case"keydown":case"keyup":Mm(ge,a,ce)}var Ge;if(hc)e:{switch(t){case"compositionstart":var tt="onCompositionStart";break e;case"compositionend":tt="onCompositionEnd";break e;case"compositionupdate":tt="onCompositionUpdate";break e}tt=void 0}else xs?vm(t,a)&&(tt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(tt="onCompositionStart");tt&&(ym&&a.locale!=="ko"&&(xs||tt!=="onCompositionStart"?tt==="onCompositionEnd"&&xs&&(Ge=hm()):(si=ce,lc="value"in si?si.value:si.textContent,xs=!0)),Re=Yo(te,tt),0<Re.length&&(tt=new pm(tt,t,null,a,ce),ge.push({event:tt,listeners:Re}),Ge?tt.data=Ge:(Ge=wm(a),Ge!==null&&(tt.data=Ge)))),(Ge=cv?fv(t,a):hv(t,a))&&(tt=Yo(te,"onBeforeInput"),0<tt.length&&(Re=new pm("onBeforeInput","beforeinput",null,a,ce),ge.push({event:Re,listeners:tt}),Re.data=Ge)),rw(ge,t,te,a,ce)}sy(ge,i)})}function nl(t,i,a){return{instance:t,listener:i,currentTarget:a}}function Yo(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=_a(t,a),h!=null&&o.unshift(nl(t,h,p)),h=_a(t,i),h!=null&&o.push(nl(t,h,p))),t.tag===3)return o;t=t.return}return[]}function lw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function ly(t,i,a,o,h){for(var p=i._reactName,x=[];a!==null&&a!==o;){var S=a,H=S.alternate,te=S.stateNode;if(S=S.tag,H!==null&&H===o)break;S!==5&&S!==26&&S!==27||te===null||(H=te,h?(te=_a(a,p),te!=null&&x.unshift(nl(a,te,H))):h||(te=_a(a,p),te!=null&&x.push(nl(a,te,H)))),a=a.return}x.length!==0&&t.push({event:i,listeners:x})}var ow=/\r\n?/g,uw=/\u0000|\uFFFD/g;function oy(t){return(typeof t=="string"?t:""+t).replace(ow,`
49
+ `).replace(uw,"")}function uy(t,i){return i=oy(i),oy(t)===i}function yt(t,i,a,o,h,p){switch(a){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||gs(t,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&gs(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":um(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=Kl(""+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"&&yt(t,i,"name",h.name,h,null),yt(t,i,"formEncType",h.formEncType,h,null),yt(t,i,"formMethod",h.formMethod,h,null),yt(t,i,"formTarget",h.formTarget,h,null)):(yt(t,i,"encType",h.encType,h,null),yt(t,i,"method",h.method,h,null),yt(t,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(a);break}o=Kl(""+o),t.setAttribute(a,o);break;case"onClick":o!=null&&(t.onclick=Or);break;case"onScroll":o!=null&&Qe("scroll",t);break;case"onScrollEnd":o!=null&&Qe("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=Kl(""+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":Qe("beforetoggle",t),Qe("toggle",t),an(t,"popover",o);break;case"xlinkActuate":jr(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":jr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":jr(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":jr(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":jr(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":jr(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":jr(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":jr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":jr(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":an(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=U1.get(a)||a,an(t,a,o))}}function Ff(t,i,a,o,h,p){switch(a){case"style":um(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"?gs(t,o):(typeof o=="number"||typeof o=="bigint")&&gs(t,""+o);break;case"onScroll":o!=null&&Qe("scroll",t);break;case"onScrollEnd":o!=null&&Qe("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[zt]||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,""):an(t,a,o)}}}function sn(t,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",t),Qe("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:yt(t,i,p,x,a,null)}}h&&yt(t,i,"srcSet",a.srcSet,a,null),o&&yt(t,i,"src",a.src,a,null);return;case"input":Qe("invalid",t);var S=p=x=h=null,H=null,te=null;for(o in a)if(a.hasOwnProperty(o)){var ce=a[o];if(ce!=null)switch(o){case"name":h=ce;break;case"type":x=ce;break;case"checked":H=ce;break;case"defaultChecked":te=ce;break;case"value":p=ce;break;case"defaultValue":S=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,i));break;default:yt(t,i,o,ce,a,null)}}sm(t,p,S,H,te,x,h,!1);return;case"select":Qe("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:yt(t,i,h,S,a,null)}i=p,a=x,t.multiple=!!o,i!=null?ps(t,!!o,i,!1):a!=null&&ps(t,!!o,a,!0);return;case"textarea":Qe("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:yt(t,i,x,S,a,null)}lm(t,o,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:yt(t,i,H,o,a,null)}return;case"dialog":Qe("beforetoggle",t),Qe("toggle",t),Qe("cancel",t),Qe("close",t);break;case"iframe":case"object":Qe("load",t);break;case"video":case"audio":for(o=0;o<tl.length;o++)Qe(tl[o],t);break;case"image":Qe("error",t),Qe("load",t);break;case"details":Qe("toggle",t);break;case"embed":case"source":case"link":Qe("error",t),Qe("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(te in a)if(a.hasOwnProperty(te)&&(o=a[te],o!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:yt(t,i,te,o,a,null)}return;default:if(nc(i)){for(ce in a)a.hasOwnProperty(ce)&&(o=a[ce],o!==void 0&&Ff(t,i,ce,o,a,void 0));return}}for(S in a)a.hasOwnProperty(S)&&(o=a[S],o!=null&&yt(t,i,S,o,a,null))}function cw(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,H=null,te=null,ce=null;for(se in a){var ge=a[se];if(a.hasOwnProperty(se)&&ge!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":H=ge;default:o.hasOwnProperty(se)||yt(t,i,se,null,o,ge)}}for(var ne in o){var se=o[ne];if(ge=a[ne],o.hasOwnProperty(ne)&&(se!=null||ge!=null))switch(ne){case"type":p=se;break;case"name":h=se;break;case"checked":te=se;break;case"defaultChecked":ce=se;break;case"value":x=se;break;case"defaultValue":S=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(s(137,i));break;default:se!==ge&&yt(t,i,ne,se,o,ge)}}ec(t,x,S,H,te,ce,p,h);return;case"select":se=x=S=ne=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":se=H;default:o.hasOwnProperty(p)||yt(t,i,p,null,o,H)}for(h in o)if(p=o[h],H=a[h],o.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":ne=p;break;case"defaultValue":S=p;break;case"multiple":x=p;default:p!==H&&yt(t,i,h,p,o,H)}i=S,a=x,o=se,ne!=null?ps(t,!!a,ne,!1):!!o!=!!a&&(i!=null?ps(t,!!a,i,!0):ps(t,!!a,a?[]:"",!1));return;case"textarea":se=ne=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:yt(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":ne=h;break;case"defaultValue":se=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&yt(t,i,x,h,o,p)}am(t,ne,se);return;case"option":for(var Ne in a)if(ne=a[Ne],a.hasOwnProperty(Ne)&&ne!=null&&!o.hasOwnProperty(Ne))switch(Ne){case"selected":t.selected=!1;break;default:yt(t,i,Ne,null,o,ne)}for(H in o)if(ne=o[H],se=a[H],o.hasOwnProperty(H)&&ne!==se&&(ne!=null||se!=null))switch(H){case"selected":t.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:yt(t,i,H,ne,o,se)}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 Be in a)ne=a[Be],a.hasOwnProperty(Be)&&ne!=null&&!o.hasOwnProperty(Be)&&yt(t,i,Be,null,o,ne);for(te in o)if(ne=o[te],se=a[te],o.hasOwnProperty(te)&&ne!==se&&(ne!=null||se!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(s(137,i));break;default:yt(t,i,te,ne,o,se)}return;default:if(nc(i)){for(var bt in a)ne=a[bt],a.hasOwnProperty(bt)&&ne!==void 0&&!o.hasOwnProperty(bt)&&Ff(t,i,bt,void 0,o,ne);for(ce in o)ne=o[ce],se=a[ce],!o.hasOwnProperty(ce)||ne===se||ne===void 0&&se===void 0||Ff(t,i,ce,ne,o,se);return}}for(var X in a)ne=a[X],a.hasOwnProperty(X)&&ne!=null&&!o.hasOwnProperty(X)&&yt(t,i,X,null,o,ne);for(ge in o)ne=o[ge],se=a[ge],!o.hasOwnProperty(ge)||ne===se||ne==null&&se==null||yt(t,i,ge,ne,o,se)}function cy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function fw(){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&&cy(x)){for(x=0,S=h.responseEnd,o+=1;o<a.length;o++){var H=a[o],te=H.startTime;if(te>S)break;var ce=H.transferSize,ge=H.initiatorType;ce&&cy(ge)&&(H=H.responseEnd,x+=ce*(H<S?1:(S-te)/(H-te)))}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 $f=null,Yf=null;function Go(t){return t.nodeType===9?t:t.ownerDocument}function fy(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 hy(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 Gf(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 Vf=null;function hw(){var t=window.event;return t&&t.type==="popstate"?t===Vf?!1:(Vf=t,!0):(Vf=null,!1)}var dy=typeof setTimeout=="function"?setTimeout:void 0,dw=typeof clearTimeout=="function"?clearTimeout:void 0,my=typeof Promise=="function"?Promise:void 0,mw=typeof queueMicrotask=="function"?queueMicrotask:typeof my<"u"?function(t){return my.resolve(null).then(t).catch(pw)}:dy;function pw(t){setTimeout(function(){throw t})}function Si(t){return t==="head"}function py(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),Vs(i);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")rl(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,rl(a);for(var p=a.firstChild;p;){var x=p.nextSibling,S=p.nodeName;p[Jt]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=x}}else a==="body"&&rl(t.ownerDocument.body);a=h}while(a);Vs(i)}function gy(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 Jf(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":Jf(a),ms(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function gw(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[Jt])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=Zn(t.nextSibling),t===null)break}return null}function yw(t,i,a){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Zn(t.nextSibling),t===null))return null;return t}function yy(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Zn(t.nextSibling),t===null))return null;return t}function Xf(t){return t.data==="$?"||t.data==="$~"}function Kf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function bw(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 Zn(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 Qf=null;function by(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(i===0)return Zn(t.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}t=t.nextSibling}return null}function xy(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 vy(t,i,a){switch(i=Go(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 rl(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);ms(t)}var Wn=new Map,wy=new Set;function Vo(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Gr=oe.d;oe.d={f:xw,r:vw,D:ww,C:Sw,L:_w,m:Ew,X:Cw,S:kw,M:Aw};function xw(){var t=Gr.f(),i=Bo();return t||i}function vw(t){var i=j(t);i!==null&&i.tag===5&&i.type==="form"?Bp(i):Gr.r(t)}var $s=typeof document>"u"?null:document;function Sy(t,i,a){var o=$s;if(o&&typeof i=="string"&&i){var h=Yn(i);h='link[rel="'+t+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),wy.has(h)||(wy.add(h),t={rel:t,crossOrigin:a,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),sn(i,"link",t),F(i),o.head.appendChild(i)))}}function ww(t){Gr.D(t),Sy("dns-prefetch",t,null)}function Sw(t,i){Gr.C(t,i),Sy("preconnect",t,i)}function _w(t,i,a){Gr.L(t,i,a);var o=$s;if(o&&t&&i){var h='link[rel="preload"][as="'+Yn(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Yn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Yn(a.imageSizes)+'"]')):h+='[href="'+Yn(t)+'"]';var p=h;switch(i){case"style":p=Ys(t);break;case"script":p=Gs(t)}Wn.has(p)||(t=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:t,as:i},a),Wn.set(p,t),o.querySelector(h)!==null||i==="style"&&o.querySelector(il(p))||i==="script"&&o.querySelector(sl(p))||(i=o.createElement("link"),sn(i,"link",t),F(i),o.head.appendChild(i)))}}function Ew(t,i){Gr.m(t,i);var a=$s;if(a&&t){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Yn(o)+'"][href="'+Yn(t)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Gs(t)}if(!Wn.has(p)&&(t=g({rel:"modulepreload",href:t},i),Wn.set(p,t),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(sl(p)))return}o=a.createElement("link"),sn(o,"link",t),F(o),a.head.appendChild(o)}}}function kw(t,i,a){Gr.S(t,i,a);var o=$s;if(o&&t){var h=z(o).hoistableStyles,p=Ys(t);i=i||"default";var x=h.get(p);if(!x){var S={loading:0,preload:null};if(x=o.querySelector(il(p)))S.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":i},a),(a=Wn.get(p))&&Zf(t,a);var H=x=o.createElement("link");F(H),sn(H,"link",t),H._p=new Promise(function(te,ce){H.onload=te,H.onerror=ce}),H.addEventListener("load",function(){S.loading|=1}),H.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Jo(x,i,o)}x={type:"stylesheet",instance:x,count:1,state:S},h.set(p,x)}}}function Cw(t,i){Gr.X(t,i);var a=$s;if(a&&t){var o=z(a).hoistableScripts,h=Gs(t),p=o.get(h);p||(p=a.querySelector(sl(h)),p||(t=g({src:t,async:!0},i),(i=Wn.get(h))&&Wf(t,i),p=a.createElement("script"),F(p),sn(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Aw(t,i){Gr.M(t,i);var a=$s;if(a&&t){var o=z(a).hoistableScripts,h=Gs(t),p=o.get(h);p||(p=a.querySelector(sl(h)),p||(t=g({src:t,async:!0,type:"module"},i),(i=Wn.get(h))&&Wf(t,i),p=a.createElement("script"),F(p),sn(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function _y(t,i,a,o){var h=(h=Se.current)?Vo(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=Ys(a.href),a=z(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=Ys(a.href);var p=z(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(il(t)))&&!p._p&&(x.instance=p,x.state.loading=5),Wn.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},Wn.set(t,a),p||Tw(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=Gs(a),a=z(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 Ys(t){return'href="'+Yn(t)+'"'}function il(t){return'link[rel="stylesheet"]['+t+"]"}function Ey(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function Tw(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}),sn(i,"link",a),F(i),t.head.appendChild(i))}function Gs(t){return'[src="'+Yn(t)+'"]'}function sl(t){return"script[async]"+t}function ky(t,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+Yn(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),sn(o,"style",h),Jo(o,a.precedence,t),i.instance=o;case"stylesheet":h=Ys(a.href);var p=t.querySelector(il(h));if(p)return i.state.loading|=4,i.instance=p,F(p),p;o=Ey(a),(h=Wn.get(h))&&Zf(o,h),p=(t.ownerDocument||t).createElement("link"),F(p);var x=p;return x._p=new Promise(function(S,H){x.onload=S,x.onerror=H}),sn(p,"link",o),i.state.loading|=4,Jo(p,a.precedence,t),i.instance=p;case"script":return p=Gs(a.src),(h=t.querySelector(sl(p)))?(i.instance=h,F(h),h):(o=a,(h=Wn.get(p))&&(o=g({},a),Wf(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),F(h),sn(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,Jo(o,a.precedence,t));return i.instance}function Jo(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 Zf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function Wf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.integrity==null&&(t.integrity=i.integrity)}var Xo=null;function Cy(t,i,a){if(Xo===null){var o=new Map,h=Xo=new Map;h.set(a,o)}else h=Xo,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[Jt]||p[_t]||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 Ay(t,i,a){t=t.ownerDocument||t,t.head.insertBefore(a,i==="title"?t.querySelector("head > title"):null)}function jw(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 Ty(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Ow(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=Ys(o.href),p=i.querySelector(il(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=Ko.bind(t),i.then(t,t)),a.state.loading|=4,a.instance=p,F(p);return}p=i.ownerDocument||i,o=Ey(o),(h=Wn.get(h))&&Zf(o,h),p=p.createElement("link"),F(p);var x=p;x._p=new Promise(function(S,H){x.onload=S,x.onerror=H}),sn(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=Ko.bind(t),i.addEventListener("load",a),i.addEventListener("error",a))}}var eh=0;function Nw(t,i){return t.stylesheets&&t.count===0&&Zo(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var o=setTimeout(function(){if(t.stylesheets&&Zo(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+i);0<t.imgBytes&&eh===0&&(eh=62500*fw());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Zo(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>eh?50:800)+i);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function Ko(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zo(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Qo=null;function Zo(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Qo=new Map,i.forEach(Rw,t),Qo=null,Ko.call(t))}function Rw(t,i){if(!(i.state.loading&4)){var a=Qo.get(t);if(a)var o=a.get(null);else{a=new Map,Qo.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=Ko.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 al={$$typeof:q,Provider:null,Consumer:null,_currentValue:ye,_currentValue2:ye,_threadCount:0};function Mw(t,i,a,o,h,p,x,S,H){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=ti(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ti(0),this.hiddenUpdates=ti(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function jy(t,i,a,o,h,p,x,S,H,te,ce,ge){return t=new Mw(t,i,a,x,H,te,ce,ge,S),i=1,p===!0&&(i|=24),p=Tn(3,null,null,i),t.current=p,p.stateNode=t,i=Rc(),i.refCount++,t.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:i},Lc(p),t}function Oy(t){return t?(t=_s,t):_s}function Ny(t,i,a,o,h,p){h=Oy(h),o.context===null?o.context=h:o.pendingContext=h,o=fi(i),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=hi(t,o,i),a!==null&&(_n(a,t,i),Ba(a,t,i))}function Ry(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<i?a:i}}function th(t,i){Ry(t,i),(t=t.alternate)&&Ry(t,i)}function My(t){if(t.tag===13||t.tag===31){var i=Vi(t,67108864);i!==null&&_n(i,t,67108864),th(t,67108864)}}function Dy(t){if(t.tag===13||t.tag===31){var i=Mn();i=Tr(i);var a=Vi(t,i);a!==null&&_n(a,t,i),th(t,i)}}var Wo=!0;function Dw(t,i,a,o){var h=I.T;I.T=null;var p=oe.p;try{oe.p=2,nh(t,i,a,o)}finally{oe.p=p,I.T=h}}function zw(t,i,a,o){var h=I.T;I.T=null;var p=oe.p;try{oe.p=8,nh(t,i,a,o)}finally{oe.p=p,I.T=h}}function nh(t,i,a,o){if(Wo){var h=rh(o);if(h===null)If(t,i,o,eu,a),Ly(t,o);else if(Uw(h,t,i,a,o))o.stopPropagation();else if(Ly(t,o),i&4&&-1<Lw.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 H=1<<31-ht(x);S.entanglements[1]|=H,x&=~H}br(p),(ft&6)===0&&(Lo=Ct()+500,el(0))}}break;case 31:case 13:S=Vi(p,2),S!==null&&_n(S,p,2),Bo(),th(p,2)}if(p=rh(o),p===null&&If(t,i,o,eu,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else If(t,i,o,null,a)}}function rh(t){return t=ic(t),ih(t)}var eu=null;function ih(t){if(eu=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 eu=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(xa()){case fe:return 2;case _e:return 8;case qe:case Je:return 32;case ot:return 268435456;default:return 32}default:return 32}}var sh=!1,_i=null,Ei=null,ki=null,ll=new Map,ol=new Map,Ci=[],Lw="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 Ly(t,i){switch(t){case"focusin":case"focusout":_i=null;break;case"dragenter":case"dragleave":Ei=null;break;case"mouseover":case"mouseout":ki=null;break;case"pointerover":case"pointerout":ll.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":ol.delete(i.pointerId)}}function ul(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&&My(i)),t):(t.eventSystemFlags|=o,i=t.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),t)}function Uw(t,i,a,o,h){switch(i){case"focusin":return _i=ul(_i,t,i,a,o,h),!0;case"dragenter":return Ei=ul(Ei,t,i,a,o,h),!0;case"mouseover":return ki=ul(ki,t,i,a,o,h),!0;case"pointerover":var p=h.pointerId;return ll.set(p,ul(ll.get(p)||null,t,i,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,ol.set(p,ul(ol.get(p)||null,t,i,a,o,h)),!0}return!1}function Uy(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,Gl(t.priority,function(){Dy(a)});return}}else if(i===31){if(i=f(a),i!==null){t.blockedOn=i,Gl(t.priority,function(){Dy(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 tu(t){if(t.blockedOn!==null)return!1;for(var i=t.targetContainers;0<i.length;){var a=rh(t.nativeEvent);if(a===null){a=t.nativeEvent;var o=new a.constructor(a.type,a);rc=o,a.target.dispatchEvent(o),rc=null}else return i=j(a),i!==null&&My(i),t.blockedOn=a,!1;i.shift()}return!0}function By(t,i,a){tu(t)&&a.delete(i)}function Bw(){sh=!1,_i!==null&&tu(_i)&&(_i=null),Ei!==null&&tu(Ei)&&(Ei=null),ki!==null&&tu(ki)&&(ki=null),ll.forEach(By),ol.forEach(By)}function nu(t,i){t.blockedOn===i&&(t.blockedOn=null,sh||(sh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Bw)))}var ru=null;function Py(t){ru!==t&&(ru=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ru===t&&(ru=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(ih(o||a)===null)continue;break}var p=j(a);p!==null&&(t.splice(i,3),i-=3,nf(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function Vs(t){function i(H){return nu(H,t)}_i!==null&&nu(_i,t),Ei!==null&&nu(Ei,t),ki!==null&&nu(ki,t),ll.forEach(i),ol.forEach(i);for(var a=0;a<Ci.length;a++){var o=Ci[a];o.blockedOn===t&&(o.blockedOn=null)}for(;0<Ci.length&&(a=Ci[0],a.blockedOn===null);)Uy(a),a.blockedOn===null&&Ci.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[zt]||null;if(typeof p=="function")x||Py(a);else if(x){var S=null;if(p&&p.hasAttribute("formAction")){if(h=p,x=p[zt]||null)S=x.formAction;else if(ih(h)!==null)continue}else S=x.action;typeof S=="function"?a[o+1]=S:(a.splice(o,3),o-=3),Py(a)}}}function qy(){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 ah(t){this._internalRoot=t}iu.prototype.render=ah.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(s(409));var a=i.current,o=Mn();Ny(a,o,t,i,null,null)},iu.prototype.unmount=ah.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;Ny(t.current,2,null,t,null,null),Bo(),i[Cn]=null}};function iu(t){this._internalRoot=t}iu.prototype.unstable_scheduleHydration=function(t){if(t){var i=wa();t={blockedOn:null,target:t,priority:i};for(var a=0;a<Ci.length&&i!==0&&i<Ci[a].priority;a++);Ci.splice(a,0,t),a===0&&Uy(t)}};var Hy=n.version;if(Hy!=="19.2.4")throw Error(s(527,Hy,"19.2.4"));oe.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 Pw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!su.isDisabled&&su.supportsFiber)try{en=su.inject(Pw),St=su}catch{}}return fl.createRoot=function(t,i){if(!l(t))throw Error(s(299));var a=!1,o="",h=Jp,p=Xp,x=Kp;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=jy(t,1,!1,null,null,a,o,null,h,p,x,qy),t[Cn]=i.current,Hf(t),new ah(i)},fl.hydrateRoot=function(t,i,a){if(!l(t))throw Error(s(299));var o=!1,h="",p=Jp,x=Xp,S=Kp,H=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),i=jy(t,1,!0,i,a??null,o,h,H,p,x,S,qy),i.context=Oy(null),a=i.current,o=Mn(),o=Tr(o),h=fi(o),h.callback=null,hi(a,h,o),a=o,i.current.lanes=a,sr(i,a),br(i),t[Cn]=i.current,Hf(t),new iu(i)},fl.version="19.2.4",fl}var Qy;function Kw(){if(Qy)return uh.exports;Qy=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(),uh.exports=Xw(),uh.exports}var Qw=Kw();/**
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 Zy="popstate";function Wy(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Zw(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 Jh("",{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:Ol(l)}return eS(n,r,null,e)}function Dt(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 Ww(){return Math.random().toString(36).substring(2,10)}function e0(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 Jh(e,n,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?da(n):n,state:r,key:n&&n.key||s||Ww(),unstable_mask:l}}function Ol({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 da(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 eS(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(),R=U==null?null:U-d;d=U,m&&m({action:f,location:M.location,delta:R})}function b(U,R){f="PUSH";let P=Wy(U)?U:Jh(M.location,U,R);d=y()+1;let q=e0(P,d),ae=M.createHref(P.unstable_mask||P);try{c.pushState(q,"",ae)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;l.location.assign(ae)}u&&m&&m({action:f,location:M.location,delta:1})}function v(U,R){f="REPLACE";let P=Wy(U)?U:Jh(M.location,U,R);d=y();let q=e0(P,d),ae=M.createHref(P.unstable_mask||P);c.replaceState(q,"",ae),u&&m&&m({action:f,location:M.location,delta:0})}function k(U){return tS(U)}let M={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(Zy,g),m=U,()=>{l.removeEventListener(Zy,g),m=null}},createHref(U){return n(l,U)},createURL:k,encodeLocation(U){let R=k(U);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:b,replace:v,go(U){return c.go(U)}};return M}function tS(e,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Dt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Ol(e);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function Mb(e,n,r="/"){return nS(e,n,r,!1)}function nS(e,n,r,s){let l=typeof n=="string"?da(n):n,u=Kr(l.pathname||"/",r);if(u==null)return null;let c=Db(e);rS(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let d=mS(u);f=hS(c[m],d,s)}return f}function Db(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;Dt(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&&(Dt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Db(c.children,n,b,g,m)),!(c.path==null&&!c.index)&&n.push({path:g,score:cS(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 zb(c.path))u(c,f,!0,d)}),n}function zb(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=zb(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 rS(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:fS(n.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var iS=/^:[\w-]+$/,sS=3,aS=2,lS=1,oS=10,uS=-2,t0=e=>e==="*";function cS(e,n){let r=e.split("/"),s=r.length;return r.some(t0)&&(s+=uS),n&&(s+=aS),r.filter(l=>!t0(l)).reduce((l,u)=>l+(iS.test(u)?sS:u===""?lS:oS),s)}function fS(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 hS(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=Su({path:m.relativePath,caseSensitive:m.caseSensitive,end:d},y),b=m.route;if(!g&&d&&r&&!s[s.length-1].route.index&&(g=Su({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:bS(Sr([u,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(u=Sr([u,g.pathnameBase]))}return c}function Su(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=dS(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 v=f[b];return g&&!v?d[y]=void 0:d[y]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:u,pathnameBase:c,pattern:e}}function dS(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 mS(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 Kr(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 pS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function gS(e,n="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?da(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=n0(r.substring(1),"/"):u=n0(r,n)):u=n,{pathname:u,search:xS(s),hash:vS(l)}}function n0(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 dh(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 yS(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Lb(e){let n=yS(e);return n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase)}function Ed(e,n,r,s=!1){let l;typeof e=="string"?l=da(e):(l={...e},Dt(!l.pathname||!l.pathname.includes("?"),dh("?","pathname","search",l)),Dt(!l.pathname||!l.pathname.includes("#"),dh("#","pathname","hash",l)),Dt(!l.search||!l.search.includes("#"),dh("#","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=gS(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,"/"),bS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),xS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,vS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,wS=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 SS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function _S(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Ub=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Bb(e,n){let r=e;if(typeof r!="string"||!pS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,l=!1;if(Ub)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=Kr(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 Pb=["POST","PUT","PATCH","DELETE"];new Set(Pb);var ES=["GET",...Pb];new Set(ES);var ma=D.createContext(null);ma.displayName="DataRouter";var qu=D.createContext(null);qu.displayName="DataRouterState";var kS=D.createContext(!1),qb=D.createContext({isTransitioning:!1});qb.displayName="ViewTransition";var CS=D.createContext(new Map);CS.displayName="Fetchers";var AS=D.createContext(null);AS.displayName="Await";var rr=D.createContext(null);rr.displayName="Navigation";var Ul=D.createContext(null);Ul.displayName="Location";var Er=D.createContext({outlet:null,matches:[],isDataRoute:!1});Er.displayName="Route";var kd=D.createContext(null);kd.displayName="RouteError";var Hb="REACT_ROUTER_ERROR",TS="REDIRECT",jS="ROUTE_ERROR_RESPONSE";function OS(e){if(e.startsWith(`${Hb}:${TS}:{`))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 NS(e){if(e.startsWith(`${Hb}:${jS}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new wS(n.status,n.statusText,n.data)}catch{}}function RS(e,{relative:n}={}){Dt(Bl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=D.useContext(rr),{hash:l,pathname:u,search:c}=Pl(e,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:Sr([r,u])),s.createHref({pathname:f,search:c,hash:l})}function Bl(){return D.useContext(Ul)!=null}function kr(){return Dt(Bl(),"useLocation() may be used only in the context of a <Router> component."),D.useContext(Ul).location}var Ib="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Fb(e){D.useContext(rr).static||D.useLayoutEffect(e)}function Li(){let{isDataRoute:e}=D.useContext(Er);return e?GS():MS()}function MS(){Dt(Bl(),"useNavigate() may be used only in the context of a <Router> component.");let e=D.useContext(ma),{basename:n,navigator:r}=D.useContext(rr),{matches:s}=D.useContext(Er),{pathname:l}=kr(),u=JSON.stringify(Lb(s)),c=D.useRef(!1);return Fb(()=>{c.current=!0}),D.useCallback((m,d={})=>{if(_r(c.current,Ib),!c.current)return;if(typeof m=="number"){r.go(m);return}let y=Ed(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])}D.createContext(null);function DS(){let{matches:e}=D.useContext(Er),n=e[e.length-1];return n?n.params:{}}function Pl(e,{relative:n}={}){let{matches:r}=D.useContext(Er),{pathname:s}=kr(),l=JSON.stringify(Lb(r));return D.useMemo(()=>Ed(e,JSON.parse(l),s,n==="path"),[e,l,s,n])}function zS(e,n){return $b(e,n)}function $b(e,n,r){var U;Dt(Bl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=D.useContext(rr),{matches:l}=D.useContext(Er),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",d=u&&u.route;{let R=d&&d.path||"";Gb(f,!d||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${R}">) 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="${R}"> to <Route path="${R==="/"?"*":`${R}/*`}">.`)}let y=kr(),g;if(n){let R=typeof n=="string"?da(n):n;Dt(m==="/"||((U=R.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 "${R.pathname}" was given in the \`location\` prop.`),g=R}else g=y;let b=g.pathname||"/",v=b;if(m!=="/"){let R=m.replace(/^\//,"").split("/");v="/"+b.replace(/^\//,"").split("/").slice(R.length).join("/")}let k=Mb(e,{pathname:v});_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 M=qS(k&&k.map(R=>Object.assign({},R,{params:Object.assign({},c,R.params),pathname:Sr([m,s.encodeLocation?s.encodeLocation(R.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?m:Sr([m,s.encodeLocation?s.encodeLocation(R.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),l,r);return n&&M?D.createElement(Ul.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},M):M}function LS(){let e=YS(),n=SS(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=D.createElement(D.Fragment,null,D.createElement("p",null,"💿 Hey developer 👋"),D.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",D.createElement("code",{style:u},"ErrorBoundary")," or"," ",D.createElement("code",{style:u},"errorElement")," prop on your route.")),D.createElement(D.Fragment,null,D.createElement("h2",null,"Unexpected Application Error!"),D.createElement("h3",{style:{fontStyle:"italic"}},n),r?D.createElement("pre",{style:l},r):null,c)}var US=D.createElement(LS,null),Yb=class extends D.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=NS(e.digest);r&&(e=r)}let n=e!==void 0?D.createElement(Er.Provider,{value:this.props.routeContext},D.createElement(kd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?D.createElement(BS,{error:e},n):n}};Yb.contextType=kS;var mh=new WeakMap;function BS({children:e,error:n}){let{basename:r}=D.useContext(rr);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let s=OS(n.digest);if(s){let l=mh.get(n);if(l)throw l;let u=Bb(s.location,r);if(Ub&&!mh.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 mh.set(n,c),c}return D.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function PS({routeContext:e,match:n,children:r}){let s=D.useContext(ma);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),D.createElement(Er.Provider,{value:e},r)}function qS(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);Dt(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:v}=s,k=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!v||v[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,v;m(y,{location:s.location,params:((v=(b=s.matches)==null?void 0:b[0])==null?void 0:v.params)??{},unstable_pattern:_S(s.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,b)=>{let v,k=!1,M=null,U=null;s&&(v=u&&g.route.id?u[g.route.id]:void 0,M=g.route.errorElement||US,c&&(f<0&&b===0?(Gb("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 R=n.concat(l.slice(0,b+1)),P=()=>{let q;return v?q=M:k?q=U:g.route.Component?q=D.createElement(g.route.Component,null):g.route.element?q=g.route.element:q=y,D.createElement(PS,{match:g,routeContext:{outlet:y,matches:R,isDataRoute:s!=null},children:q})};return s&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?D.createElement(Yb,{location:s.location,revalidation:s.revalidation,component:M,error:v,children:P(),routeContext:{outlet:null,matches:R,isDataRoute:!0},onError:d}):P()},null)}function Cd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function HS(e){let n=D.useContext(ma);return Dt(n,Cd(e)),n}function IS(e){let n=D.useContext(qu);return Dt(n,Cd(e)),n}function FS(e){let n=D.useContext(Er);return Dt(n,Cd(e)),n}function Ad(e){let n=FS(e),r=n.matches[n.matches.length-1];return Dt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function $S(){return Ad("useRouteId")}function YS(){var s;let e=D.useContext(kd),n=IS("useRouteError"),r=Ad("useRouteError");return e!==void 0?e:(s=n.errors)==null?void 0:s[r]}function GS(){let{router:e}=HS("useNavigate"),n=Ad("useNavigate"),r=D.useRef(!1);return Fb(()=>{r.current=!0}),D.useCallback(async(l,u={})=>{_r(r.current,Ib),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...u}))},[e,n])}var r0={};function Gb(e,n,r){!n&&!r0[e]&&(r0[e]=!0,_r(!1,r))}D.memo(VS);function VS({routes:e,future:n,state:r,isStatic:s,onError:l}){return $b(e,void 0,{state:r,isStatic:s,onError:l})}function ls(e){Dt(!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 JS({basename:e="/",children:n=null,location:r,navigationType:s="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Dt(!Bl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=D.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=da(r));let{pathname:d="/",search:y="",hash:g="",state:b=null,key:v="default",unstable_mask:k}=r,M=D.useMemo(()=>{let U=Kr(d,f);return U==null?null:{location:{pathname:U,search:y,hash:g,state:b,key:v,unstable_mask:k},navigationType:s}},[f,d,y,g,b,v,s,k]);return _r(M!=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.`),M==null?null:D.createElement(rr.Provider,{value:m},D.createElement(Ul.Provider,{children:n,value:M}))}function XS({children:e,location:n}){return zS(Xh(e),n)}function Xh(e,n=[]){let r=[];return D.Children.forEach(e,(s,l)=>{if(!D.isValidElement(s))return;let u=[...n,l];if(s.type===D.Fragment){r.push.apply(r,Xh(s.props.children,u));return}Dt(s.type===ls,`[${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>`),Dt(!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=Xh(s.props.children,u)),r.push(c)}),r}var yu="get",bu="application/x-www-form-urlencoded";function Hu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function KS(e){return Hu(e)&&e.tagName.toLowerCase()==="button"}function QS(e){return Hu(e)&&e.tagName.toLowerCase()==="form"}function ZS(e){return Hu(e)&&e.tagName.toLowerCase()==="input"}function WS(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function e_(e,n){return e.button===0&&(!n||n==="_self")&&!WS(e)}var au=null;function t_(){if(au===null)try{new FormData(document.createElement("form"),0),au=!1}catch{au=!0}return au}var n_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ph(e){return e!=null&&!n_.has(e)?(_r(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${bu}"`),null):e}function r_(e,n){let r,s,l,u,c;if(QS(e)){let f=e.getAttribute("action");s=f?Kr(f,n):null,r=e.getAttribute("method")||yu,l=ph(e.getAttribute("enctype"))||bu,u=new FormData(e)}else if(KS(e)||ZS(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?Kr(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||yu,l=ph(e.getAttribute("formenctype"))||ph(f.getAttribute("enctype"))||bu,u=new FormData(f,e),!t_()){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(Hu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=yu,s=null,l=bu,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 Td(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function i_(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&&Kr(l.pathname,n)==="/"?l.pathname=`${n.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function s_(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 a_(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 l_(e,n,r){let s=await Promise.all(e.map(async l=>{let u=n.routes[l.route.id];if(u){let c=await s_(u,r);return c.links?c.links():[]}return[]}));return f_(s.flat(1).filter(a_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function i0(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 o_(e,n,{includeHydrateFallback:r}={}){return u_(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 u_(e){return[...new Set(e)]}function c_(e){let n={},r=Object.keys(e).sort();for(let s of r)n[s]=e[s];return n}function f_(e,n){let r=new Set;return new Set(n),e.reduce((s,l)=>{let u=JSON.stringify(c_(l));return r.has(u)||(r.add(u),s.push({key:u,link:l})),s},[])}function Vb(){let e=D.useContext(ma);return Td(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function h_(){let e=D.useContext(qu);return Td(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var jd=D.createContext(void 0);jd.displayName="FrameworkContext";function Jb(){let e=D.useContext(jd);return Td(e,"You must render this element inside a <HydratedRouter> element"),e}function d_(e,n){let r=D.useContext(jd),[s,l]=D.useState(!1),[u,c]=D.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:y,onTouchStart:g}=n,b=D.useRef(null);D.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let M=R=>{R.forEach(P=>{c(P.isIntersecting)})},U=new IntersectionObserver(M,{threshold:.5});return b.current&&U.observe(b.current),()=>{U.disconnect()}}},[e]),D.useEffect(()=>{if(s){let M=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(M)}}},[s]);let v=()=>{l(!0)},k=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,b,{}]:[u,b,{onFocus:hl(f,v),onBlur:hl(m,k),onMouseEnter:hl(d,v),onMouseLeave:hl(y,k),onTouchStart:hl(g,v)}]:[!1,b,{}]}function hl(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function m_({page:e,...n}){let{router:r}=Vb(),s=D.useMemo(()=>Mb(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?D.createElement(g_,{page:e,matches:s,...n}):null}function p_(e){let{manifest:n,routeModules:r}=Jb(),[s,l]=D.useState([]);return D.useEffect(()=>{let u=!1;return l_(e,n,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,n,r]),s}function g_({page:e,matches:n,...r}){let s=kr(),{future:l,manifest:u,routeModules:c}=Jb(),{basename:f}=Vb(),{loaderData:m,matches:d}=h_(),y=D.useMemo(()=>i0(e,n,d,u,s,"data"),[e,n,d,u,s]),g=D.useMemo(()=>i0(e,n,d,u,s,"assets"),[e,n,d,u,s]),b=D.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let M=new Set,U=!1;if(n.forEach(P=>{var ae;let q=u.routes[P.route.id];!q||!q.hasLoader||(!y.some(B=>B.route.id===P.route.id)&&P.route.id in m&&((ae=c[P.route.id])!=null&&ae.shouldRevalidate)||q.hasClientLoader?U=!0:M.add(P.route.id))}),M.size===0)return[];let R=i_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return U&&M.size>0&&R.searchParams.set("_routes",n.filter(P=>M.has(P.route.id)).map(P=>P.route.id).join(",")),[R.pathname+R.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,s,u,y,n,e,c]),v=D.useMemo(()=>o_(g,u),[g,u]),k=p_(g);return D.createElement(D.Fragment,null,b.map(M=>D.createElement("link",{key:M,rel:"prefetch",as:"fetch",href:M,...r})),v.map(M=>D.createElement("link",{key:M,rel:"modulepreload",href:M,...r})),k.map(({key:M,link:U})=>D.createElement("link",{key:M,nonce:r.nonce,...U,crossOrigin:U.crossOrigin??r.crossOrigin})))}function y_(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var b_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{b_&&(window.__reactRouterVersion="7.13.1")}catch{}function x_({basename:e,children:n,unstable_useTransitions:r,window:s}){let l=D.useRef();l.current==null&&(l.current=Zw({window:s,v5Compat:!0}));let u=l.current,[c,f]=D.useState({action:u.action,location:u.location}),m=D.useCallback(d=>{r===!1?f(d):D.startTransition(()=>f(d))},[r]);return D.useLayoutEffect(()=>u.listen(m),[u,m]),D.createElement(JS,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var Xb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Kb=D.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:v,...k},M){let{basename:U,navigator:R,unstable_useTransitions:P}=D.useContext(rr),q=typeof y=="string"&&Xb.test(y),ae=Bb(y,U);y=ae.to;let B=RS(y,{relative:l}),L=kr(),K=null;if(f){let W=Ed(f,[],L.unstable_mask?L.unstable_mask.pathname:"/",!0);U!=="/"&&(W.pathname=W.pathname==="/"?U:Sr([U,W.pathname])),K=R.createHref(W)}let[Y,$,N]=d_(s,k),G=__(y,{replace:c,unstable_mask:f,state:m,target:d,preventScrollReset:g,relative:l,viewTransition:b,unstable_defaultShouldRevalidate:v,unstable_useTransitions:P});function J(W){n&&n(W),W.defaultPrevented||G(W)}let le=!(ae.isExternal||u),re=D.createElement("a",{...k,...N,href:(le?K:void 0)||ae.absoluteURL||B,onClick:le?J:n,ref:y_(M,$),target:d,"data-discover":!q&&r==="render"?"true":void 0});return Y&&!q?D.createElement(D.Fragment,null,re,D.createElement(m_,{page:B})):re});Kb.displayName="Link";var v_=D.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=Pl(c,{relative:d.relative}),b=kr(),v=D.useContext(qu),{navigator:k,basename:M}=D.useContext(rr),U=v!=null&&T_(g)&&f===!0,R=k.encodeLocation?k.encodeLocation(g).pathname:g.pathname,P=b.pathname,q=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(P=P.toLowerCase(),q=q?q.toLowerCase():null,R=R.toLowerCase()),q&&M&&(q=Kr(q,M)||q);const ae=R!=="/"&&R.endsWith("/")?R.length-1:R.length;let B=P===R||!l&&P.startsWith(R)&&P.charAt(ae)==="/",L=q!=null&&(q===R||!l&&q.startsWith(R)&&q.charAt(R.length)==="/"),K={isActive:B,isPending:L,isTransitioning:U},Y=B?n:void 0,$;typeof s=="function"?$=s(K):$=[s,B?"active":null,L?"pending":null,U?"transitioning":null].filter(Boolean).join(" ");let N=typeof u=="function"?u(K):u;return D.createElement(Kb,{...d,"aria-current":Y,className:$,ref:y,style:N,to:c,viewTransition:f},typeof m=="function"?m(K):m)});v_.displayName="NavLink";var w_=D.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:s,replace:l,state:u,method:c=yu,action:f,onSubmit:m,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b,...v},k)=>{let{unstable_useTransitions:M}=D.useContext(rr),U=C_(),R=A_(f,{relative:d}),P=c.toLowerCase()==="get"?"get":"post",q=typeof f=="string"&&Xb.test(f),ae=B=>{if(m&&m(B),B.defaultPrevented)return;B.preventDefault();let L=B.nativeEvent.submitter,K=(L==null?void 0:L.getAttribute("formmethod"))||c,Y=()=>U(L||B.currentTarget,{fetcherKey:n,method:K,navigate:r,replace:l,state:u,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b});M&&r!==!1?D.startTransition(()=>Y()):Y()};return D.createElement("form",{ref:k,method:P,action:R,onSubmit:s?m:ae,...v,"data-discover":!q&&e==="render"?"true":void 0})});w_.displayName="Form";function S_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Qb(e){let n=D.useContext(ma);return Dt(n,S_(e)),n}function __(e,{target:n,replace:r,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:d}={}){let y=Li(),g=kr(),b=Pl(e,{relative:c});return D.useCallback(v=>{if(e_(v,n)){v.preventDefault();let k=r!==void 0?r:Ol(g)===Ol(b),M=()=>y(e,{replace:k,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});d?D.startTransition(()=>M()):M()}},[g,y,b,r,s,l,n,e,u,c,f,m,d])}var E_=0,k_=()=>`__${String(++E_)}__`;function C_(){let{router:e}=Qb("useSubmit"),{basename:n}=D.useContext(rr),r=$S(),s=e.fetch,l=e.navigate;return D.useCallback(async(u,c={})=>{let{action:f,method:m,encType:d,formData:y,body:g}=r_(u,n);if(c.navigate===!1){let b=c.fetcherKey||k_();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 A_(e,{relative:n}={}){let{basename:r}=D.useContext(rr),s=D.useContext(Er);Dt(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),u={...Pl(e||".",{relative:n})},c=kr();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])),Ol(u)}function T_(e,{relative:n}={}){let r=D.useContext(qb);Dt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Qb("useViewTransitionState"),l=Pl(e,{relative:n});if(!r.isTransitioning)return!1;let u=Kr(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=Kr(r.nextLocation.pathname,s)||r.nextLocation.pathname;return Su(l.pathname,c)!=null||Su(l.pathname,u)!=null}var _u=Rb();const Zb=D.createContext(null),Wb="palmier_paired_hosts",Kh="palmier_active_host";function gh(){try{const e=localStorage.getItem(Wb);if(e)return JSON.parse(e)}catch{}return[]}function j_(e){localStorage.setItem(Wb,JSON.stringify(e))}function O_(){return localStorage.getItem(Kh)}function N_(e){e?localStorage.setItem(Kh,e):localStorage.removeItem(Kh)}const R_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function M_({children:e}){const[n,r]=D.useState(gh),[s,l]=D.useState(()=>{const y=O_(),g=gh();return y&&g.some(b=>b.hostId===y)?y:g.length>0?g[0].hostId:null});D.useEffect(()=>{if(!R_)return;const y="local";if(!gh().find(b=>b.hostId===y)){const b={hostId:y,clientToken:"",directUrl:window.location.origin};r(v=>[...v.filter(k=>k.hostId!==y),b]),l(y)}},[]),D.useEffect(()=>{j_(n)},[n]),D.useEffect(()=>{N_(s)},[s]);const u=D.useCallback(y=>{r(g=>[...g.filter(v=>v.hostId!==y.hostId),y]),l(y.hostId)},[]),c=D.useCallback(y=>{r(g=>g.filter(b=>b.hostId!==y)),l(g=>g!==y?g:null)},[]);D.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=D.useCallback((y,g)=>{r(b=>b.map(v=>v.hostId===y?{...v,name:g}:v))},[]),m=D.useCallback(y=>{l(y)},[]),d=D.useCallback(()=>n.find(y=>y.hostId===s)??null,[n,s]);return w.jsx(Zb.Provider,{value:{pairedHosts:n,activeHostId:s,addPairedHost:u,removePairedHost:c,renamePairedHost:f,setActiveHostId:m,getActiveHost:d},children:e})}function ql(){const e=D.useContext(Zb);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const qn=new Uint8Array(0),Ui=new TextEncoder,Un=new TextDecoder;function D_(...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 _l(...e){const n=[];for(let r=0;r<e.length;r++)n.push(Ui.encode(e[r]));return n.length===0?qn:n.length===1?n[0]:D_(...n)}function s0(e){return!e||e.length===0?"":Un.decode(e)}const a0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",l0=36,z_=0xcfd41b9100000,o0=33,L_=333,u0=22;function U_(e){for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*255)}function B_(e){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(e):U_(e)}class P_{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(u0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*z_),this.inc=Math.floor(Math.random()*(L_-o0)+o0)}setPre(){const n=new Uint8Array(12);B_(n);for(let r=0;r<12;r++){const s=n[r]%36;this.buf[r]=a0.charCodeAt(s)}}fillSeq(){let n=this.seq;for(let r=u0-1;r>=12;r--)this.buf[r]=a0.charCodeAt(n%l0),n=Math.floor(n/l0)}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 Mi=new P_;var Vr;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(Vr||(Vr={}));var ta;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(ta||(ta={}));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 q_(e){return typeof e.code=="string"}class ex{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 H_.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const H_=new ex;class je 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=ex.getMessage(r);return new je(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 El;(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"})(El||(El={}));const Eu="Nats-Service-Error",ku="Nats-Service-Error-Code";class Cu extends Error{constructor(r,s){super(s);C(this,"code");this.code=r}static isServiceError(r){return Cu.toServiceError(r)!==null}static toServiceError(r){var l,u;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(ku))||"";if(s!==""){const c=parseInt(s)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(Eu))||"";return new Cu(c,f.length?f:s)}return null}}function Xr(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}.${Mi.next()}`}const Qh="127.0.0.1";var Oi;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Oi||(Oi={}));function Iu(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 lu(e){return Un.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function oa(e,n=!0){const r=n?je.errorForCode(Ee.Timeout):null;let s,l;const u=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?je.errorForCode(Ee.Timeout):r)},e)});return Object.assign(u,s)}function pa(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 Mt(){let e={};const n=new Promise((r,s)=>{e={resolve:r,reject:s}});return Object.assign(n,e)}function tx(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 I_(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 I_(r>n?e[n]:e[r])}}}function Rt(e){return e*1e6}function Nd(e){return Math.floor(e/1e6)}function c0(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 je(`'${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 Qr(e=0,n=""){if(e===0&&n!==""||e>0&&n==="")throw new Error("setting status requires both code and description");return new Ni(e,n)}const yh="NATS/1.0";class Ni{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 Ni,l=Un.decode(n).split(`\r
61
+ `),u=l[0];if(u!==yh){let c=u.replace(yh,"").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=yh;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 je("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=c0(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=c0(n);s===zn.CanonicalMIME&&(n=l);const u=this.findKeys(n,s);n=u.length>0?u[0]:n;const c=Ni.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 Ni;for(const s in n)r.headers.set(s,n[s]);return r}}function Au(){return{encode(e){return Ui.encode(e)},decode(e){return Un.decode(e)}}}function hr(e){return{encode(n){try{return n===void 0&&(n=null),Ui.encode(JSON.stringify(n))}catch(r){throw je.errorForCode(Ee.BadJson,r)}},decode(n){try{return JSON.parse(Un.decode(n),e)}catch(r){throw je.errorForCode(Ee.BadJson,r)}}}}function nx(e){var n;return e&&e.data.length===0&&((n=e.headers)==null?void 0:n.code)===503?je.errorForCode(Ee.NoResponders):null}class Rd{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=Un.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Un.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=Ni.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=qn,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 Un.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(Rd,"jc");function na(e){return Fu("durable",e)}function dn(e){return Fu("stream",e)}function Fu(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 wl(e,n=""){if(n==="")throw Error(`${e} name required`);const r=F_(n);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function F_(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 Zh(e){if(e.data.length>0)return!1;const n=e.headers;return n?n.code>=100&&n.code<200:!1}function Wh(e){var n;return Zh(e)&&((n=e.headers)==null?void 0:n.description)==="Idle Heartbeat"}function $_(e,n,r){const s=Qr(e,n),l={hdr:1,sid:0,size:0},u=new Rd(l,qn,{});return u._headers=s,u._subject=r,u}function ra(e){if(e.data.length!==0)return null;const n=e.headers;return n?rx(n.code,n.description):null}var tr;(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"})(tr||(tr={}));function Y_(e){return e.code!==Ee.JetStream409?!1:[tr.MaxBatchExceeded,tr.MaxExpiresExceeded,tr.MaxBytesExceeded,tr.MaxMessageSizeExceeded,tr.PushConsumer,tr.IdleHeartbeatMissed,tr.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function rx(e,n=""){if(e<300)return null;switch(n=n.toLowerCase(),e){case 404:return new je(n,Ee.JetStream404NoMessages);case 408:return new je(n,Ee.JetStream408RequestTimeout);case 409:{const r=n.startsWith(tr.IdleHeartbeatMissed)?Ee.JetStreamIdleHeartBeat:Ee.JetStream409;return new je(n,r)}case 503:return je.errorForCode(Ee.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=Ee.Unknown),new je(n,`${e}`)}}class Wt{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=Mt(),this.yields=[],this.iterClosed=Mt(),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 je("unsupported iterator",Ee.ApiError);if(this.yielding)throw new je("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=Mt())}}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 Md{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 ed;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(ed||(ed={}));var Nl;(function(e){e.Old="old",e.New="new"})(Nl||(Nl={}));var td;(function(e){e.File="file",e.Memory="memory"})(td||(td={}));var qt;(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"})(qt||(qt={}));var Zt;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(Zt||(Zt={}));var ua;(function(e){e.Instant="instant",e.Original="original"})(ua||(ua={}));var Di;(function(e){e.None="none",e.S2="s2"})(Di||(Di={}));var Tu;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Tu||(Tu={}));function G_(e,n={}){return Object.assign({name:e,deliver_policy:qt.All,ack_policy:Zt.Explicit,ack_wait:Rt(30*1e3),replay_policy:ua.Instant},n)}var f0;(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"})(f0||(f0={}));var yn;(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"})(yn||(yn={}));var cr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(cr||(cr={}));var Ws;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(Ws||(Ws={}));var h0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(h0||(h0={}));const Ln="KV_";class V_{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=G_("",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?Zt.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 na(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=qt.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=qt.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=qt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=qt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=qt.Last,this}deliverNew(){return this.config.deliver_policy=qt.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=Zt.None,this}ackAll(){return this.config.ack_policy=Zt.All,this}ackExplicit(){return this.config.ack_policy=Zt.Explicit,this}ackWait(n){return this.config.ack_wait=Rt(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=ua.Instant,this}replayOriginal(){return this.config.replay_policy=ua.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=Rt(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=Rt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=Rt(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 Ri(e){return new V_(e)}function d0(e){return typeof e.getOpts=="function"}class J_{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 ia{static encode(n){return ia.toB64URLEncoding(J_.encode(n))}static decode(n,r=!1){return ia.decode(ia.fromB64URLEncoding(n),r)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class ca{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 Un.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 X_(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 K_=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},dl=K_.performance||{};dl.now||dl.mozNow||dl.msNow||dl.oNow||dl.webkitNow;var m0={versions:{}},Q_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Z_(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 bh,$u={exports:{}},p0={},g0=Z_(X_({__proto__:null,default:p0},[p0]));bh=$u,(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&&m0.versions&&m0.versions.node;l?r=Q_:s&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&bh.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 v=function(B,L){return function(K){return new P(L,!0).update(K)[B]()}},k=function(B){var L=v("hex",B);l&&(L=M(L,B)),L.create=function(){return new P(B)},L.update=function($){return L.create().update($)};for(var K=0;K<g.length;++K){var Y=g[K];L[Y]=v(Y,B)}return L},M=function(B,L){var K,Y=g0,$=g0.Buffer,N=L?"sha224":"sha256";return K=$.from&&!r.JS_SHA256_NO_BUFFER_FROM?$.from:function(G){return new $(G)},function(G){if(typeof G=="string")return Y.createHash(N).update(G,"utf8").digest("hex");if(G==null)throw new Error(e);return G.constructor===ArrayBuffer&&(G=new Uint8Array(G)),Array.isArray(G)||ArrayBuffer.isView(G)||G.constructor===$?Y.createHash(N).update(K(G)).digest("hex"):B(G)}},U=function(B,L){return function(K,Y){return new q(K,L,!0).update(Y)[B]()}},R=function(B){var L=U("hex",B);L.create=function($){return new q($,B)},L.update=function($,N){return L.create($).update(N)};for(var K=0;K<g.length;++K){var Y=g[K];L[Y]=U(Y,B)}return L};function P(B,L){L?(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 q(B,L,K){var Y,$=typeof B;if($==="string"){var N,G=[],J=B.length,le=0;for(Y=0;Y<J;++Y)(N=B.charCodeAt(Y))<128?G[le++]=N:N<2048?(G[le++]=192|N>>>6,G[le++]=128|63&N):N<55296||N>=57344?(G[le++]=224|N>>>12,G[le++]=128|N>>>6&63,G[le++]=128|63&N):(N=65536+((1023&N)<<10|1023&B.charCodeAt(++Y)),G[le++]=240|N>>>18,G[le++]=128|N>>>12&63,G[le++]=128|N>>>6&63,G[le++]=128|63&N);B=G}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 P(L,!0).update(B).array());var re=[],W=[];for(Y=0;Y<64;++Y){var I=B[Y]||0;re[Y]=92^I,W[Y]=54^I}P.call(this,L,K),this.update(W),this.oKeyPad=re,this.inner=!0,this.sharedMemory=K}P.prototype.update=function(B){if(!this.finalized){var L,K=typeof B;if(K!=="string"){if(K!=="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);L=!0}for(var Y,$,N=0,G=B.length,J=this.blocks;N<G;){if(this.hashed&&(this.hashed=!1,J[0]=this.block,this.block=J[16]=J[1]=J[2]=J[3]=J[4]=J[5]=J[6]=J[7]=J[8]=J[9]=J[10]=J[11]=J[12]=J[13]=J[14]=J[15]=0),L)for($=this.start;N<G&&$<64;++N)J[$>>>2]|=B[N]<<d[3&$++];else for($=this.start;N<G&&$<64;++N)(Y=B.charCodeAt(N))<128?J[$>>>2]|=Y<<d[3&$++]:Y<2048?(J[$>>>2]|=(192|Y>>>6)<<d[3&$++],J[$>>>2]|=(128|63&Y)<<d[3&$++]):Y<55296||Y>=57344?(J[$>>>2]|=(224|Y>>>12)<<d[3&$++],J[$>>>2]|=(128|Y>>>6&63)<<d[3&$++],J[$>>>2]|=(128|63&Y)<<d[3&$++]):(Y=65536+((1023&Y)<<10|1023&B.charCodeAt(++N)),J[$>>>2]|=(240|Y>>>18)<<d[3&$++],J[$>>>2]|=(128|Y>>>12&63)<<d[3&$++],J[$>>>2]|=(128|Y>>>6&63)<<d[3&$++],J[$>>>2]|=(128|63&Y)<<d[3&$++]);this.lastByteIndex=$,this.bytes+=$-this.start,$>=64?(this.block=J[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}},P.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var B=this.blocks,L=this.lastByteIndex;B[16]=this.block,B[L>>>2]|=m[3&L],this.block=B[16],L>=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()}},P.prototype.hash=function(){var B,L,K,Y,$,N,G,J,le,re=this.h0,W=this.h1,I=this.h2,oe=this.h3,ye=this.h4,ke=this.h5,_=this.h6,O=this.h7,Z=this.blocks;for(B=16;B<64;++B)L=(($=Z[B-15])>>>7|$<<25)^($>>>18|$<<14)^$>>>3,K=(($=Z[B-2])>>>17|$<<15)^($>>>19|$<<13)^$>>>10,Z[B]=Z[B-16]+L+Z[B-7]+K|0;for(le=W&I,B=0;B<64;B+=4)this.first?(this.is224?(N=300032,O=($=Z[0]-1413257819)-150054599|0,oe=$+24177077|0):(N=704751109,O=($=Z[0]-210244248)-1521486534|0,oe=$+143694565|0),this.first=!1):(L=(re>>>2|re<<30)^(re>>>13|re<<19)^(re>>>22|re<<10),Y=(N=re&W)^re&I^le,O=oe+($=O+(K=(ye>>>6|ye<<26)^(ye>>>11|ye<<21)^(ye>>>25|ye<<7))+(ye&ke^~ye&_)+y[B]+Z[B])|0,oe=$+(L+Y)|0),L=(oe>>>2|oe<<30)^(oe>>>13|oe<<19)^(oe>>>22|oe<<10),Y=(G=oe&re)^oe&W^N,_=I+($=_+(K=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7))+(O&ye^~O&ke)+y[B+1]+Z[B+1])|0,L=((I=$+(L+Y)|0)>>>2|I<<30)^(I>>>13|I<<19)^(I>>>22|I<<10),Y=(J=I&oe)^I&re^G,ke=W+($=ke+(K=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&O^~_&ye)+y[B+2]+Z[B+2])|0,L=((W=$+(L+Y)|0)>>>2|W<<30)^(W>>>13|W<<19)^(W>>>22|W<<10),Y=(le=W&I)^W&oe^J,ye=re+($=ye+(K=(ke>>>6|ke<<26)^(ke>>>11|ke<<21)^(ke>>>25|ke<<7))+(ke&_^~ke&O)+y[B+3]+Z[B+3])|0,re=$+(L+Y)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+re|0,this.h1=this.h1+W|0,this.h2=this.h2+I|0,this.h3=this.h3+oe|0,this.h4=this.h4+ye|0,this.h5=this.h5+ke|0,this.h6=this.h6+_|0,this.h7=this.h7+O|0},P.prototype.hex=function(){this.finalize();var B=this.h0,L=this.h1,K=this.h2,Y=this.h3,$=this.h4,N=this.h5,G=this.h6,J=this.h7,le=f[B>>>28&15]+f[B>>>24&15]+f[B>>>20&15]+f[B>>>16&15]+f[B>>>12&15]+f[B>>>8&15]+f[B>>>4&15]+f[15&B]+f[L>>>28&15]+f[L>>>24&15]+f[L>>>20&15]+f[L>>>16&15]+f[L>>>12&15]+f[L>>>8&15]+f[L>>>4&15]+f[15&L]+f[K>>>28&15]+f[K>>>24&15]+f[K>>>20&15]+f[K>>>16&15]+f[K>>>12&15]+f[K>>>8&15]+f[K>>>4&15]+f[15&K]+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[N>>>28&15]+f[N>>>24&15]+f[N>>>20&15]+f[N>>>16&15]+f[N>>>12&15]+f[N>>>8&15]+f[N>>>4&15]+f[15&N]+f[G>>>28&15]+f[G>>>24&15]+f[G>>>20&15]+f[G>>>16&15]+f[G>>>12&15]+f[G>>>8&15]+f[G>>>4&15]+f[15&G];return this.is224||(le+=f[J>>>28&15]+f[J>>>24&15]+f[J>>>20&15]+f[J>>>16&15]+f[J>>>12&15]+f[J>>>8&15]+f[J>>>4&15]+f[15&J]),le},P.prototype.toString=P.prototype.hex,P.prototype.digest=function(){this.finalize();var B=this.h0,L=this.h1,K=this.h2,Y=this.h3,$=this.h4,N=this.h5,G=this.h6,J=this.h7,le=[B>>>24&255,B>>>16&255,B>>>8&255,255&B,L>>>24&255,L>>>16&255,L>>>8&255,255&L,K>>>24&255,K>>>16&255,K>>>8&255,255&K,Y>>>24&255,Y>>>16&255,Y>>>8&255,255&Y,$>>>24&255,$>>>16&255,$>>>8&255,255&$,N>>>24&255,N>>>16&255,N>>>8&255,255&N,G>>>24&255,G>>>16&255,G>>>8&255,255&G];return this.is224||le.push(J>>>24&255,J>>>16&255,J>>>8&255,255&J),le},P.prototype.array=P.prototype.digest,P.prototype.arrayBuffer=function(){this.finalize();var B=new ArrayBuffer(this.is224?28:32),L=new DataView(B);return L.setUint32(0,this.h0),L.setUint32(4,this.h1),L.setUint32(8,this.h2),L.setUint32(12,this.h3),L.setUint32(16,this.h4),L.setUint32(20,this.h5),L.setUint32(24,this.h6),this.is224||L.setUint32(28,this.h7),B},q.prototype=new P,q.prototype.finalize=function(){if(P.prototype.finalize.call(this),this.inner){this.inner=!1;var B=this.array();P.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(B),P.prototype.finalize.call(this)}};var ae=k();ae.sha256=ae,ae.sha224=k(!0),ae.sha256.hmac=R(),ae.sha224.hmac=R(!0),u?bh.exports=ae:(r.sha256=ae.sha256,r.sha224=ae.sha224)})();$u.exports;$u.exports.sha224;var y0=$u.exports.sha256;function nd(e){return i2(e)}function W_(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 e2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function t2(e){return W_(e)?"hex":e2(e)?"b64":""}function n2(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 r2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))}function i2(e){switch(t2(e)){case"hex":return n2(e);case"b64":return r2(e)}return null}function s2(e,n){const r=typeof e=="string"?nd(e):e,s=typeof n=="string"?nd(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 ix{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=Mi.next(),s&&(this.ctx=new Error)}}class a2 extends ix{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=Mt(),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 sx extends ix{constructor(r,s,l={timeout:1e3},u=!0){super(r,s,u);C(this,"deferred");C(this,"timer");this.deferred=Mt(),this.timer=oa(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||je.errorForCode(Ee.Cancelled))}}const l2="$JS.API";function o2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Iu({apiPrefix:l2,timeout:5e3},e)}class Hl{constructor(n,r){C(this,"nc");C(this,"opts");C(this,"prefix");C(this,"timeout");C(this,"jc");this.nc=n,this.opts=o2(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=qn;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 pa(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=rx(s.error.code,s.error.description);if(l!==null)throw l.api_error=s.error,l}return r}}class Sl{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 os(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 rd(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 lt;(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"})(lt||(lt={}));class u2{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=os(n)),this.server=n,this.set(lt.JS_KV,"2.6.2"),this.set(lt.JS_OBJECTSTORE,"2.6.3"),this.set(lt.JS_PULL_MAX_BYTES,"2.8.3"),this.set(lt.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(lt.JS_ALLOW_DIRECT,"2.9.0"),this.set(lt.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(lt.JS_SIMPLIFICATION,"2.9.4"),this.set(lt.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(lt.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(lt.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(lt.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(lt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(lt.JS_STREAM_COMPRESSION,"2.10.0"),this.set(lt.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(lt.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:rd(this.server,os(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=os(n)),rd(this.server,n)>=0}}class ju extends Hl{constructor(n,r){super(n,r)}async add(n,r,s=Tu.Create){if(dn(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&&na(l.config.durable_name);const u=this.nc;let{min:c,ok:f}=u.features.get(lt.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{Fu("name",m)}catch(b){const v=b.message,k=v.indexOf("cannot contain");throw k!==-1?new Error(`consumer 'name' ${v.substring(k)}`):b}let d,y="";if(Array.isArray(r.filter_subjects)){const{min:b,ok:v}=u.features.get(lt.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${b}`);f=!1}if(r.metadata){const{min:b,ok:v}=u.features.get(lt.JS_STREAM_CONSUMER_METADATA);if(!v)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),Tu.Update)}async info(n,r){return dn(n),na(r),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${r}`)}async delete(n,r){return dn(n),na(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${r}`)).success}list(n){dn(n);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${n}`;return new Sl(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 Js(e,n,r=!1){if(r===!0&&!e)throw je.errorForCode(Ee.ApiError,new Error(`${n} is not a function`));if(e&&typeof e!="function")throw je.errorForCode(Ee.ApiError,new Error(`${n} is not a function`))}class c2 extends Wt{constructor(r,s,l){super();C(this,"sub");C(this,"adapter");C(this,"subIterDone");Js(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&Js(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(Js(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(Js(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(Js(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&Js(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,b)=>{const[v,k]=this.adapter(g,b);if(v){y(v,null);return}const{ingest:M}=this.ingestionFilterFn?this.ingestionFilterFn(k,this):{ingest:!0};M&&(!this.protocolFilterFn||this.protocolFilterFn(k))&&(y(v,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=Mt(),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 Bn;function f2(e){Bn=e}function ax(){return Bn!==void 0&&Bn.defaultPort!==void 0?Bn.defaultPort:4222}function xh(){return Bn!==void 0&&Bn.urlParseFn?Bn.urlParseFn:void 0}function h2(){if(!Bn||typeof Bn.factory!="function")throw new Error("transport fn is not set");return Bn.factory()}function id(){return Bn!==void 0&&Bn.dnsResolveFn?Bn.dnsResolveFn:void 0}const xu=`\r
71
+ `,Ou=ca.fromAscii(xu),d2=new Uint8Array(Ou)[0],m2=new Uint8Array(Ou)[1];function p2(e){for(let n=0;n<e.length;n++){const r=n+1;if(e.byteLength>r&&e[n]===d2&&e[r]===m2)return r+1}return 0}function g2(e){const n=p2(e);if(n>0){const s=new Uint8Array(e).slice(0,n);return Un.decode(s)}return""}const y2=4,lx=48,b2=65,x2=97;function v2(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 sd(e){return w2(e)!==void 0}function w2(e){for(let n=0;n<e.length;n++)switch(e[n]){case".":return ox(e);case":":return S2(e)}}function ox(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}=_2(e);if(!u||s>255)return;e=e.substring(l),n[r]=s}return v2(n[0],n[1],n[2],n[3])}function S2(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}=E2(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&s!=12||s+4>16)return;const f=ox(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+=y2;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 _2(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)-lx),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 E2(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)-lx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)n*=16,n+=e.charCodeAt(r)-x2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)n*=16,n+=e.charCodeAt(r)-b2+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 k2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function ad(e){return!k2(e)}function C2(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 A2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=C2(e),ad(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const n=ad(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 kl{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=A2(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(sd(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}://${ad(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new kl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return n.randomize&&tx(r),this.resolves=r,r}}class T2{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=xh();n&&(n.forEach(l=>{l=s?s(l):l,this.servers.push(new kl(l))}),this.randomize&&(this.servers=tx(this.servers))),this.servers.length===0&&this.addServer(`${Qh}:${ax()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();sd(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=xh();n=s?s(n):n;const l=new kl(n,r);sd(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=xh(),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 kl(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 j2{constructor(){C(this,"baseInbox");C(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${Xr(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=nx(r)),l.resolver(n,r))}}}close(){const n=je.errorForCode(Ee.Timeout);this.reqs.forEach(r=>{r.resolver(n,{})})}}class O2{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:ta.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=Mt();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 N2 extends Error{constructor(n){super(n),this.name="AssertionError"}}function R2(e,n="Assertion failed."){if(!e)throw new N2(n)}const b0=32*1024,vh=2**32-2;function ou(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 wh{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){R2(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=ou(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 ou(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)ou(this._buf.subarray(this._off),this._buf);else{if(l+n>vh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+n,vh));ou(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+n,vh)),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(b0);for(;;){const l=this.capacity-this.length<b0,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 mn;(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"})(mn||(mn={}));function x0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const M2=48;class v0{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=x0();break;case Ae.H:case Ae.h:this.state=Ce.OP_H,this.hdr=0,this.ma=x0();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:mn.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:mn.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:mn.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:mn.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:mn.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:mn.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:mn.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 wh(n.subarray(this.as,r-this.drop))),this.state===Ce.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new wh(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 wh(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}: ${Un.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]-M2)}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]),v=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 M(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],z=E[j+4]<<24|E[j+5]<<16|E[j+6]<<8|E[j+7];return new n(T,z)}function R(E,j,T){var z;for(z=0;z<4;z++)E[j+z]=T&255,T>>>=8}function P(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 q(E,j,T,z,F){var Q,pe=0;for(Q=0;Q<F;Q++)pe|=E[j+Q]^T[z+Q];return(1&pe-1>>>8)-1}function ae(E,j,T,z){return q(E,j,T,z,16)}function B(E,j,T,z){return q(E,j,T,z,32)}function L(E,j,T,z,F){var Q=new Uint32Array(16),pe=new Uint32Array(16),be=new Uint32Array(16),ie=new Uint32Array(4),me,Oe,Xe;for(me=0;me<4;me++)pe[5*me]=M(z,4*me),pe[1+me]=M(T,4*me),pe[6+me]=M(j,4*me),pe[11+me]=M(T,16+4*me);for(me=0;me<16;me++)be[me]=pe[me];for(me=0;me<20;me++){for(Oe=0;Oe<4;Oe++){for(Xe=0;Xe<4;Xe++)ie[Xe]=pe[(5*Oe+4*Xe)%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),Xe=0;Xe<4;Xe++)Q[4*Oe+(Oe+Xe)%4]=ie[Xe]}for(Xe=0;Xe<16;Xe++)pe[Xe]=Q[Xe]}if(F){for(me=0;me<16;me++)pe[me]=pe[me]+be[me]|0;for(me=0;me<4;me++)pe[5*me]=pe[5*me]-M(z,4*me)|0,pe[6+me]=pe[6+me]-M(j,4*me)|0;for(me=0;me<4;me++)R(E,4*me,pe[5*me]),R(E,16+4*me,pe[6+me])}else for(me=0;me<16;me++)R(E,4*me,pe[me]+be[me]|0)}function K(E,j,T,z){return L(E,j,T,z,!1),0}function Y(E,j,T,z){return L(E,j,T,z,!0),0}var $=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function N(E,j,T,z,F,Q,pe){var be=new Uint8Array(16),ie=new Uint8Array(64),me,Oe;if(!F)return 0;for(Oe=0;Oe<16;Oe++)be[Oe]=0;for(Oe=0;Oe<8;Oe++)be[Oe]=Q[Oe];for(;F>=64;){for(K(ie,be,pe,$),Oe=0;Oe<64;Oe++)E[j+Oe]=(T?T[z+Oe]:0)^ie[Oe];for(me=1,Oe=8;Oe<16;Oe++)me=me+(be[Oe]&255)|0,be[Oe]=me&255,me>>>=8;F-=64,j+=64,T&&(z+=64)}if(F>0)for(K(ie,be,pe,$),Oe=0;Oe<F;Oe++)E[j+Oe]=(T?T[z+Oe]:0)^ie[Oe];return 0}function G(E,j,T,z,F){return N(E,j,null,0,T,z,F)}function J(E,j,T,z,F){var Q=new Uint8Array(32);return Y(Q,z,F,$),G(E,j,T,z.subarray(16),Q)}function le(E,j,T,z,F,Q,pe){var be=new Uint8Array(32);return Y(be,Q,pe,$),N(E,j,T,z,F,Q.subarray(16),be)}function re(E,j){var T,z=0;for(T=0;T<17;T++)z=z+(E[T]+j[T]|0)|0,E[T]=z&255,z>>>=8}var W=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function I(E,j,T,z,F,Q){var pe,be,ie,me,Oe=new Uint32Array(17),Xe=new Uint32Array(17),Tt=new Uint32Array(17),an=new Uint32Array(17),ar=new Uint32Array(17);for(ie=0;ie<17;ie++)Xe[ie]=Tt[ie]=0;for(ie=0;ie<16;ie++)Xe[ie]=Q[ie];for(Xe[3]&=15,Xe[4]&=252,Xe[7]&=15,Xe[8]&=252,Xe[11]&=15,Xe[12]&=252,Xe[15]&=15;F>0;){for(ie=0;ie<17;ie++)an[ie]=0;for(ie=0;ie<16&&ie<F;++ie)an[ie]=T[z+ie];for(an[ie]=1,z+=ie,F-=ie,re(Tt,an),be=0;be<17;be++)for(Oe[be]=0,ie=0;ie<17;ie++)Oe[be]=Oe[be]+Tt[ie]*(ie<=be?Xe[be-ie]:320*Xe[be+17-ie]|0)|0|0;for(be=0;be<17;be++)Tt[be]=Oe[be];for(me=0,ie=0;ie<16;ie++)me=me+Tt[ie]|0,Tt[ie]=me&255,me>>>=8;for(me=me+Tt[16]|0,Tt[16]=me&3,me=5*(me>>>2)|0,ie=0;ie<16;ie++)me=me+Tt[ie]|0,Tt[ie]=me&255,me>>>=8;me=me+Tt[16]|0,Tt[16]=me}for(ie=0;ie<17;ie++)ar[ie]=Tt[ie];for(re(Tt,W),pe=-(Tt[16]>>>7)|0,ie=0;ie<17;ie++)Tt[ie]^=pe&(ar[ie]^Tt[ie]);for(ie=0;ie<16;ie++)an[ie]=Q[ie+16];for(an[16]=0,re(Tt,an),ie=0;ie<16;ie++)E[j+ie]=Tt[ie];return 0}function oe(E,j,T,z,F,Q){var pe=new Uint8Array(16);return I(pe,0,T,z,F,Q),ae(E,j,pe,0)}function ye(E,j,T,z,F){var Q;if(T<32)return-1;for(le(E,0,j,0,T,z,F),I(E,16,E,32,T-32,E),Q=0;Q<16;Q++)E[Q]=0;return 0}function ke(E,j,T,z,F){var Q,pe=new Uint8Array(32);if(T<32||(J(pe,0,32,z,F),oe(j,16,j,32,T-32,pe)!==0))return-1;for(le(E,0,j,0,T,z,F),Q=0;Q<32;Q++)E[Q]=0;return 0}function _(E,j){var T;for(T=0;T<16;T++)E[T]=j[T]|0}function O(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 Z(E,j,T){for(var z,F=~(T-1),Q=0;Q<16;Q++)z=F&(E[Q]^j[Q]),E[Q]^=z,j[Q]^=z}function A(E,j){var T,z,F,Q=r(),pe=r();for(T=0;T<16;T++)pe[T]=j[T];for(O(pe),O(pe),O(pe),z=0;z<2;z++){for(Q[0]=pe[0]-65517,T=1;T<15;T++)Q[T]=pe[T]-65535-(Q[T-1]>>16&1),Q[T-1]&=65535;Q[15]=pe[15]-32767-(Q[14]>>16&1),F=Q[15]>>16&1,Q[14]&=65535,Z(pe,Q,1-F)}for(T=0;T<16;T++)E[2*T]=pe[T]&255,E[2*T+1]=pe[T]>>8}function xe(E,j){var T=new Uint8Array(32),z=new Uint8Array(32);return A(T,E),A(z,j),B(T,0,z,0)}function he(E){var j=new Uint8Array(32);return A(j,E),j[0]&1}function Se(E,j){var T;for(T=0;T<16;T++)E[T]=j[2*T]+(j[2*T+1]<<8);E[15]&=32767}function Te(E,j,T){var z;for(z=0;z<16;z++)E[z]=j[z]+T[z]|0}function ze(E,j,T){var z;for(z=0;z<16;z++)E[z]=j[z]-T[z]|0}function ue(E,j,T){var z,F,Q=new Float64Array(31);for(z=0;z<31;z++)Q[z]=0;for(z=0;z<16;z++)for(F=0;F<16;F++)Q[z+F]+=j[z]*T[F];for(z=0;z<15;z++)Q[z]+=38*Q[z+16];for(z=0;z<16;z++)E[z]=Q[z];O(E),O(E)}function Le(E,j){ue(E,j,j)}function We(E,j){var T=r(),z;for(z=0;z<16;z++)T[z]=j[z];for(z=253;z>=0;z--)Le(T,T),z!==2&&z!==4&&ue(T,T,j);for(z=0;z<16;z++)E[z]=T[z]}function wt(E,j){var T=r(),z;for(z=0;z<16;z++)T[z]=j[z];for(z=250;z>=0;z--)Le(T,T),z!==1&&ue(T,T,j);for(z=0;z<16;z++)E[z]=T[z]}function Ie(E,j,T){var z=new Uint8Array(32),F=new Float64Array(80),Q,pe,be=r(),ie=r(),me=r(),Oe=r(),Xe=r(),Tt=r();for(pe=0;pe<31;pe++)z[pe]=j[pe];for(z[31]=j[31]&127|64,z[0]&=248,Se(F,T),pe=0;pe<16;pe++)ie[pe]=F[pe],Oe[pe]=be[pe]=me[pe]=0;for(be[0]=Oe[0]=1,pe=254;pe>=0;--pe)Q=z[pe>>>3]>>>(pe&7)&1,Z(be,ie,Q),Z(me,Oe,Q),Te(Xe,be,me),ze(be,be,me),Te(me,ie,Oe),ze(ie,ie,Oe),Le(Oe,Xe),Le(Tt,be),ue(be,me,be),ue(me,ie,Xe),Te(Xe,be,me),ze(be,be,me),Le(ie,be),ze(me,Oe,Tt),ue(be,me,m),Te(be,be,Oe),ue(me,me,be),ue(be,Oe,Tt),ue(Oe,ie,F),Le(ie,Xe),Z(be,ie,Q),Z(me,Oe,Q);for(pe=0;pe<16;pe++)F[pe+16]=be[pe],F[pe+32]=me[pe],F[pe+48]=ie[pe],F[pe+64]=Oe[pe];var an=F.subarray(32),ar=F.subarray(16);return We(an,an),ue(ar,ar,an),A(E,ar),0}function it(E,j){return Ie(E,j,u)}function nt(E,j){return s(j,32),it(E,j)}function He(E,j,T){var z=new Uint8Array(32);return Ie(z,T,j),Y(E,l,z,$)}var at=ye,we=ke;function Me(E,j,T,z,F,Q){var pe=new Uint8Array(32);return He(pe,F,Q),at(E,j,T,z,pe)}function Pe(E,j,T,z,F,Q){var pe=new Uint8Array(32);return He(pe,F,Q),we(E,j,T,z,pe)}function $e(){var E=0,j=0,T=0,z=0,F=65535,Q,pe,be;for(be=0;be<arguments.length;be++)Q=arguments[be].lo,pe=arguments[be].hi,E+=Q&F,j+=Q>>>16,T+=pe&F,z+=pe>>>16;return j+=E>>>16,T+=j>>>16,z+=T>>>16,new n(T&F|z<<16,E&F|j<<16)}function Gt(E,j){return new n(E.hi>>>j,E.lo>>>j|E.hi<<32-j)}function Hn(){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 Ct(E,j){var T,z,F=32-j;return j<32?(T=E.hi>>>j|E.lo<<F,z=E.lo>>>j|E.hi<<F):j<64&&(T=E.lo>>>j|E.hi<<F,z=E.hi>>>j|E.lo<<F),new n(T,z)}function xa(E,j,T){var z=E.hi&j.hi^~E.hi&T.hi,F=E.lo&j.lo^~E.lo&T.lo;return new n(z,F)}function fe(E,j,T){var z=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(z,F)}function _e(E){return Hn(Ct(E,28),Ct(E,34),Ct(E,39))}function qe(E){return Hn(Ct(E,14),Ct(E,18),Ct(E,41))}function Je(E){return Hn(Ct(E,1),Ct(E,8),Gt(E,7))}function ot(E){return Hn(Ct(E,19),Ct(E,61),Gt(E,6))}var cn=[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 In(E,j,T){var z=[],F=[],Q=[],pe=[],be,ie,me;for(ie=0;ie<8;ie++)z[ie]=Q[ie]=U(E,8*ie);for(var Oe=0;T>=128;){for(ie=0;ie<16;ie++)pe[ie]=U(j,8*ie+Oe);for(ie=0;ie<80;ie++){for(me=0;me<8;me++)F[me]=Q[me];for(be=$e(Q[7],qe(Q[4]),xa(Q[4],Q[5],Q[6]),cn[ie],pe[ie%16]),F[7]=$e(be,_e(Q[0]),fe(Q[0],Q[1],Q[2])),F[3]=$e(F[3],be),me=0;me<8;me++)Q[(me+1)%8]=F[me];if(ie%16===15)for(me=0;me<16;me++)pe[me]=$e(pe[me],pe[(me+9)%16],Je(pe[(me+1)%16]),ot(pe[(me+14)%16]))}for(ie=0;ie<8;ie++)Q[ie]=$e(Q[ie],z[ie]),z[ie]=Q[ie];Oe+=128,T-=128}for(ie=0;ie<8;ie++)P(E,8*ie,z[ie]);return T}var en=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 St(E,j,T){var z=new Uint8Array(64),F=new Uint8Array(256),Q,pe=T;for(Q=0;Q<64;Q++)z[Q]=en[Q];for(In(z,j,T),T%=128,Q=0;Q<256;Q++)F[Q]=0;for(Q=0;Q<T;Q++)F[Q]=j[pe-T+Q];for(F[T]=128,T=256-128*(T<112?1:0),F[T-9]=0,P(F,T-8,new n(pe/536870912|0,pe<<3)),In(z,F,T),Q=0;Q<64;Q++)E[Q]=z[Q];return 0}function Vt(E,j){var T=r(),z=r(),F=r(),Q=r(),pe=r(),be=r(),ie=r(),me=r(),Oe=r();ze(T,E[1],E[0]),ze(Oe,j[1],j[0]),ue(T,T,Oe),Te(z,E[0],E[1]),Te(Oe,j[0],j[1]),ue(z,z,Oe),ue(F,E[3],j[3]),ue(F,F,y),ue(Q,E[2],j[2]),Te(Q,Q,Q),ze(pe,z,T),ze(be,Q,F),Te(ie,Q,F),Te(me,z,T),ue(E[0],pe,be),ue(E[1],me,ie),ue(E[2],ie,be),ue(E[3],pe,me)}function ht(E,j,T){var z;for(z=0;z<4;z++)Z(E[z],j[z],T)}function Fn(E,j){var T=r(),z=r(),F=r();We(F,j[2]),ue(T,j[0],F),ue(z,j[1],F),A(E,z),E[31]^=he(T)<<7}function fn(E,j,T){var z,F;for(_(E[0],c),_(E[1],f),_(E[2],f),_(E[3],c),F=255;F>=0;--F)z=T[F/8|0]>>(F&7)&1,ht(E,j,z),Vt(j,E),Vt(E,E),ht(E,j,z)}function hs(E,j){var T=[r(),r(),r(),r()];_(T[0],g),_(T[1],b),_(T[2],f),ue(T[3],g,b),fn(E,T,j)}function Wr(E,j,T){var z=new Uint8Array(64),F=[r(),r(),r(),r()],Q;for(T||s(j,32),St(z,j,32),z[0]&=248,z[31]&=127,z[31]|=64,hs(F,z),Fn(E,F),Q=0;Q<32;Q++)j[Q+32]=E[Q];return 0}var Ar=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 ei(E,j){var T,z,F,Q;for(z=63;z>=32;--z){for(T=0,F=z-32,Q=z-12;F<Q;++F)j[F]+=T-16*j[z]*Ar[F-(z-32)],T=Math.floor((j[F]+128)/256),j[F]-=T*256;j[F]+=T,j[z]=0}for(T=0,F=0;F<32;F++)j[F]+=T-(j[31]>>4)*Ar[F],T=j[F]>>8,j[F]&=255;for(F=0;F<32;F++)j[F]-=T*Ar[F];for(z=0;z<32;z++)j[z+1]+=j[z]>>8,E[z]=j[z]&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;ei(E,j)}function Pi(E,j,T,z){var F=new Uint8Array(64),Q=new Uint8Array(64),pe=new Uint8Array(64),be,ie,me=new Float64Array(64),Oe=[r(),r(),r(),r()];St(F,z,32),F[0]&=248,F[31]&=127,F[31]|=64;var Xe=T+64;for(be=0;be<T;be++)E[64+be]=j[be];for(be=0;be<32;be++)E[32+be]=F[32+be];for(St(pe,E.subarray(32),T+32),ir(pe),hs(Oe,pe),Fn(E,Oe),be=32;be<64;be++)E[be]=z[be];for(St(Q,E,T+64),ir(Q),be=0;be<64;be++)me[be]=0;for(be=0;be<32;be++)me[be]=pe[be];for(be=0;be<32;be++)for(ie=0;ie<32;ie++)me[be+ie]+=Q[be]*F[ie];return ei(E.subarray(32),me),Xe}function qi(E,j){var T=r(),z=r(),F=r(),Q=r(),pe=r(),be=r(),ie=r();return _(E[2],f),Se(E[1],j),Le(F,E[1]),ue(Q,F,d),ze(F,F,E[2]),Te(Q,E[2],Q),Le(pe,Q),Le(be,pe),ue(ie,be,pe),ue(T,ie,F),ue(T,T,Q),wt(T,T),ue(T,T,F),ue(T,T,Q),ue(T,T,Q),ue(E[0],T,Q),Le(z,E[0]),ue(z,z,Q),xe(z,F)&&ue(E[0],E[0],v),Le(z,E[0]),ue(z,z,Q),xe(z,F)?-1:(he(E[0])===j[31]>>7&&ze(E[0],c,E[0]),ue(E[3],E[0],E[1]),0)}function va(E,j,T,z){var F,Q=new Uint8Array(32),pe=new Uint8Array(64),be=[r(),r(),r(),r()],ie=[r(),r(),r(),r()];if(T<64||qi(ie,z))return-1;for(F=0;F<T;F++)E[F]=j[F];for(F=0;F<32;F++)E[F+32]=z[F];if(St(pe,E,T),ir(pe),fn(be,ie,pe),hs(ie,j.subarray(32)),Vt(be,ie),Fn(Q,be),T-=64,B(j,0,Q,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 ds=32,ti=24,sr=32,ni=16,ri=32,Hi=32,ii=32,Tr=32,Ii=32,wa=ti,Gl=sr,mr=ni,_t=64,zt=32,Cn=64,Fi=32,Sa=64;e.lowlevel={crypto_core_hsalsa20:Y,crypto_stream_xor:le,crypto_stream:J,crypto_stream_salsa20_xor:N,crypto_stream_salsa20:G,crypto_onetimeauth:I,crypto_onetimeauth_verify:oe,crypto_verify_16:ae,crypto_verify_32:B,crypto_secretbox:ye,crypto_secretbox_open:ke,crypto_scalarmult:Ie,crypto_scalarmult_base:it,crypto_box_beforenm:He,crypto_box_afternm:at,crypto_box:Me,crypto_box_open:Pe,crypto_box_keypair:nt,crypto_hash:St,crypto_sign:Pi,crypto_sign_keypair:Wr,crypto_sign_open:va,crypto_secretbox_KEYBYTES:ds,crypto_secretbox_NONCEBYTES:ti,crypto_secretbox_ZEROBYTES:sr,crypto_secretbox_BOXZEROBYTES:ni,crypto_scalarmult_BYTES:ri,crypto_scalarmult_SCALARBYTES:Hi,crypto_box_PUBLICKEYBYTES:ii,crypto_box_SECRETKEYBYTES:Tr,crypto_box_BEFORENMBYTES:Ii,crypto_box_NONCEBYTES:wa,crypto_box_ZEROBYTES:Gl,crypto_box_BOXZEROBYTES:mr,crypto_sign_BYTES:_t,crypto_sign_PUBLICKEYBYTES:zt,crypto_sign_SECRETKEYBYTES:Cn,crypto_sign_SEEDBYTES:Fi,crypto_hash_BYTES:Sa,gf:r,D:d,L:Ar,pack25519:A,unpack25519:Se,M:ue,A:Te,S:Le,Z:ze,pow2523:wt,add:Vt,set25519:_,modL:ei,scalarmult:fn,scalarbase:hs};function Vl(E,j){if(E.length!==ds)throw new Error("bad key size");if(j.length!==ti)throw new Error("bad nonce size")}function Jl(E,j){if(E.length!==ii)throw new Error("bad public key size");if(j.length!==Tr)throw new Error("bad secret key size")}function Jt(){for(var E=0;E<arguments.length;E++)if(!(arguments[E]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ms(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){Jt(E,j,T),Vl(T,j);for(var z=new Uint8Array(sr+E.length),F=new Uint8Array(z.length),Q=0;Q<E.length;Q++)z[Q+sr]=E[Q];return ye(F,z,z.length,j,T),F.subarray(ni)},e.secretbox.open=function(E,j,T){Jt(E,j,T),Vl(T,j);for(var z=new Uint8Array(ni+E.length),F=new Uint8Array(z.length),Q=0;Q<E.length;Q++)z[Q+ni]=E[Q];return z.length<32||ke(F,z,z.length,j,T)!==0?null:F.subarray(sr)},e.secretbox.keyLength=ds,e.secretbox.nonceLength=ti,e.secretbox.overheadLength=ni,e.scalarMult=function(E,j){if(Jt(E,j),E.length!==Hi)throw new Error("bad n size");if(j.length!==ri)throw new Error("bad p size");var T=new Uint8Array(ri);return Ie(T,E,j),T},e.scalarMult.base=function(E){if(Jt(E),E.length!==Hi)throw new Error("bad n size");var j=new Uint8Array(ri);return it(j,E),j},e.scalarMult.scalarLength=Hi,e.scalarMult.groupElementLength=ri,e.box=function(E,j,T,z){var F=e.box.before(T,z);return e.secretbox(E,j,F)},e.box.before=function(E,j){Jt(E,j),Jl(E,j);var T=new Uint8Array(Ii);return He(T,E,j),T},e.box.after=e.secretbox,e.box.open=function(E,j,T,z){var F=e.box.before(T,z);return e.secretbox.open(E,j,F)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var E=new Uint8Array(ii),j=new Uint8Array(Tr);return nt(E,j),{publicKey:E,secretKey:j}},e.box.keyPair.fromSecretKey=function(E){if(Jt(E),E.length!==Tr)throw new Error("bad secret key size");var j=new Uint8Array(ii);return it(j,E),{publicKey:j,secretKey:new Uint8Array(E)}},e.box.publicKeyLength=ii,e.box.secretKeyLength=Tr,e.box.sharedKeyLength=Ii,e.box.nonceLength=wa,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(E,j){if(Jt(E,j),j.length!==Cn)throw new Error("bad secret key size");var T=new Uint8Array(_t+E.length);return Pi(T,E,E.length,j),T},e.sign.open=function(E,j){if(Jt(E,j),j.length!==zt)throw new Error("bad public key size");var T=new Uint8Array(E.length),z=va(T,E,E.length,j);if(z<0)return null;for(var F=new Uint8Array(z),Q=0;Q<F.length;Q++)F[Q]=T[Q];return F},e.sign.detached=function(E,j){for(var T=e.sign(E,j),z=new Uint8Array(_t),F=0;F<z.length;F++)z[F]=T[F];return z},e.sign.detached.verify=function(E,j,T){if(Jt(E,j,T),j.length!==_t)throw new Error("bad signature size");if(T.length!==zt)throw new Error("bad public key size");var z=new Uint8Array(_t+E.length),F=new Uint8Array(_t+E.length),Q;for(Q=0;Q<_t;Q++)z[Q]=j[Q];for(Q=0;Q<E.length;Q++)z[Q+_t]=E[Q];return va(F,z,z.length,T)>=0},e.sign.keyPair=function(){var E=new Uint8Array(zt),j=new Uint8Array(Cn);return Wr(E,j),{publicKey:E,secretKey:j}},e.sign.keyPair.fromSecretKey=function(E){if(Jt(E),E.length!==Cn)throw new Error("bad secret key size");for(var j=new Uint8Array(zt),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(Jt(E),E.length!==Fi)throw new Error("bad seed size");for(var j=new Uint8Array(zt),T=new Uint8Array(Cn),z=0;z<32;z++)T[z]=E[z];return Wr(j,T,!0),{publicKey:j,secretKey:T}},e.sign.publicKeyLength=zt,e.sign.secretKeyLength=Cn,e.sign.seedLength=Fi,e.sign.signatureLength=_t,e.hash=function(E){Jt(E);var j=new Uint8Array(Sa);return St(j,E,E.length),j},e.hash.hashLength=Sa,e.verify=function(E,j){return Jt(E,j),E.length===0||j.length===0||E.length!==j.length?!1:q(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,z){var F,Q=new Uint8Array(z);for(F=0;F<z;F+=j)E.getRandomValues(Q.subarray(F,F+Math.min(z-F,j)));for(F=0;F<z;F++)T[F]=Q[F];ms(Q)})}else typeof require<"u"&&(E=require("crypto"),E&&E.randomBytes&&e.setPRNG(function(T,z){var F,Q=E.randomBytes(z);for(F=0;F<z;F++)T[F]=Q[F];ms(Q)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const uu=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,D2={fromSeed:uu.sign.keyPair.fromSeed,sign:uu.sign.detached,verify:uu.sign.detached.verify,randomBytes:uu.randomBytes};let ux;function z2(e){ux=e}function ji(){return ux}const L2=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 Nu{static checksum(n){let r=0;for(let s=0;s<n.byteLength;s++){let l=n[s];r=r<<8&65535^L2[(r>>8^l)&255]}return r}static validate(n,r){return Nu.checksum(n)==r}}const Sh="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class w0{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++]=Sh.charAt(m).charCodeAt(0),r-=5}if(r>0){let f=s<<5-r&31;u[c++]=Sh.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=Sh.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 vt 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 U2(){return Yu(xt.Operator)}function B2(){return Yu(xt.Account)}function P2(){return Yu(xt.User)}var dt;(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"})(dt||(dt={}));var xt;(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"})(xt||(xt={}));class ea{static isValidPublicPrefix(n){return n==xt.Server||n==xt.Operator||n==xt.Cluster||n==xt.Account||n==xt.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 xt.Seed:return xt.Seed;case xt.Private:return xt.Private;case xt.Operator:return xt.Operator;case xt.Server:return xt.Server;case xt.Cluster:return xt.Cluster;case xt.Account:return xt.Account;case xt.User:return xt.User;default:return-1}}}class pn{static encode(n,r){if(!r||!(r instanceof Uint8Array))throw new vt(dt.SerializationError);if(!ea.isValidPrefix(n))throw new vt(dt.InvalidPrefixByte);return pn._encode(!1,n,r)}static encodeSeed(n,r){if(!r)throw new vt(dt.ApiError);if(!ea.isValidPublicPrefix(n))throw new vt(dt.InvalidPrefixByte);if(r.byteLength!==32)throw new vt(dt.InvalidSeedLen);return pn._encode(!0,n,r)}static decode(n,r){if(!ea.isValidPrefix(n))throw new vt(dt.InvalidPrefixByte);const s=pn._decode(r);if(s[0]!==n)throw new vt(dt.InvalidPrefixByte);return s.slice(1)}static decodeSeed(n){const r=pn._decode(n),s=pn._decodePrefix(r);if(s[0]!=xt.Seed)throw new vt(dt.InvalidSeed);if(!ea.isValidPublicPrefix(s[1]))throw new vt(dt.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=pn._encodePrefix(xt.Seed,r);m.set(g)}else m[0]=r;m.set(s,l);const d=Nu.checksum(m.slice(0,f));return new DataView(m.buffer).setUint16(f,d,!0),w0.encode(m)}static _decode(n){if(n.byteLength<4)throw new vt(dt.InvalidEncoding);let r;try{r=w0.decode(n)}catch(f){throw new vt(dt.InvalidEncoding,f)}const s=r.byteLength-2,u=new DataView(r.buffer).getUint16(s,!0),c=r.slice(0,s);if(!Nu.validate(c,u))throw new vt(dt.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 cx{constructor(n){C(this,"seed");this.seed=n}getRawSeed(){if(!this.seed)throw new vt(dt.ClearedPair);return pn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new vt(dt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new vt(dt.ClearedPair);const n=pn.decodeSeed(this.seed),r=ji().fromSeed(this.getRawSeed()),s=pn.encode(n.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new vt(dt.ClearedPair);const n=ji().fromSeed(this.getRawSeed());return pn.encode(xt.Private,n.secretKey)}sign(n){if(!this.seed)throw new vt(dt.ClearedPair);const r=ji().fromSeed(this.getRawSeed());return ji().sign(n,r.secretKey)}verify(n,r){if(!this.seed)throw new vt(dt.ClearedPair);const s=ji().fromSeed(this.getRawSeed());return ji().verify(n,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Yu(e){const n=ji().randomBytes(32);let r=pn.encodeSeed(e,new Uint8Array(n));return new cx(r)}class q2{constructor(n){C(this,"publicKey");this.publicKey=n}getPublicKey(){if(!this.publicKey)throw new vt(dt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new vt(dt.PublicKeyOnly):new vt(dt.ClearedPair)}getSeed(){throw this.publicKey?new vt(dt.PublicKeyOnly):new vt(dt.ClearedPair)}sign(n){throw this.publicKey?new vt(dt.CannotSign):new vt(dt.ClearedPair)}verify(n,r){if(!this.publicKey)throw new vt(dt.ClearedPair);let s=pn._decode(this.publicKey);return ji().verify(n,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function H2(e){const n=new TextEncoder().encode(e),r=pn._decode(n),s=ea.parsePrefix(r[0]);if(ea.isValidPublicPrefix(s))return new q2(n);throw new vt(dt.InvalidPublicKey)}function I2(e){return pn.decodeSeed(e),new cx(e)}function F2(e){return btoa(String.fromCharCode(...e))}function $2(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}z2(D2);const S0={createAccount:B2,createOperator:U2,createPair:Yu,createUser:P2,fromPublic:H2,fromSeed:I2,NKeysError:vt,NKeysErrorCode:dt,Prefix:xt,decode:$2,encode:F2};function Y2(e){return n=>{let r={};return e.forEach(s=>{const l=s(n)||{};r=Object.assign(r,l)}),r}}function G2(){return()=>{}}function V2(e,n){return()=>{const r=typeof e=="function"?e():e,s=typeof n=="function"?n():n;return{user:r,pass:s}}}function J2(e){return()=>({auth_token:typeof e=="function"?e():e})}function X2(e){return n=>{const r=typeof e=="function"?e():e,s=r?S0.fromSeed(r):void 0,l=s?s.getPublicKey():"",u=Ui.encode(n||""),c=s!==void 0&&n?s.sign(u):void 0,f=c?S0.encode(c):"";return{nkey:l,sig:f}}}function fx(e,n){return r=>{const s=typeof e=="function"?e():e,l=X2(n),{nkey:u,sig:c}=l(r);return{jwt:s,nkey:u,sig:c}}}const hx=120*1e3,K2=2,dx=2*1e3;function Q2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:hx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:dx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function Z2(e){const n=[];return typeof e.authenticator=="function"&&n.push(e.authenticator),Array.isArray(e.authenticator)&&n.push(...e.authenticator),e.token&&n.push(J2(e.token)),e.user&&n.push(V2(e.user,e.pass)),n.length===0?G2():Y2(n)}function W2(e){const n=`${Qh}:${ax()}`;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 je("port and servers options are mutually exclusive",Ee.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${Qh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[n]);const r=Iu(Q2(),e);if(r.authenticator=Z2(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new je(`${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{Xr(r.inboxPrefix)}catch(s){throw new je(s.message,Ee.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof id()=="function"),r.resolve&&typeof id()!="function")throw new je("'resolve' is not supported on this client",Ee.InvalidOption);return r}function eE(e,n){const{proto:r,tls_required:s,tls_available:l}=e;if((r===void 0||r<1)&&n.noEcho)throw new je("noEcho",Ee.ServerOptionNotAvailable);const u=s||l||!1;if(n.tls&&!u)throw new je("tls",Ee.ServerOptionNotAvailable)}const tE=1024*32,nE=/^INFO\s+([^\r\n]+)\r\n/i,rE=_l(`PONG\r
72
+ `),_0=_l(`PING\r
73
+ `);class iE{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):{})||{};Iu(this,l)}}class mx extends Wt{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");Iu(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Mt();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=oa(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(je.errorForCode(Ee.ConnectionClosed)):this.isClosed()?Promise.reject(je.errorForCode(Ee.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Mt()).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 sE{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 Ru{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=tE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=r,this.subscriptions=new sE,this.muxSubscriptions=new j2,this.outbound=new ca,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new u2({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new T2(s,{randomize:!n.noRandomize}),this.closed=Mt(),this.parser=new v0(this),this.heartbeats=new O2(this,this.options.pingInterval||hx,this.options.maxPingOut||K2)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const r=je.errorForCode(Ee.Disconnect);r.stack="",n.forEach(s=>{s.reject(r)}),this.parser=new v0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(r=>{r.push(n)})}status(){const n=new Wt;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=Mt();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=r=>{n.reject(r)},this.transport=h2(),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:ta.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:ta.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:Vr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:Vr.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=oa(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:id(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of s)try{l=null,this.dispatchStatus({type:ta.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():dx;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw n||(this.lastError?this.lastError:je.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 pa(s)}}static async connect(n,r){const s=new Ru(n,r);return await s.dialLoop(),s}static toError(n){const r=n?n.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new je(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 je(n,Ee.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new je(n,Ee.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new je(n,Ee.AccountExpired):r.indexOf("authentication timeout")!==-1?new je(n,Ee.AuthenticationTimeout):new je(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 Rd(n,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(n){const r=s0(n),s=Ru.toError(r),l={type:Vr.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(rE)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const r=JSON.parse(s0(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(os(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new iE({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(_l(`CONNECT ${m}${xu}`)),this.transport.send(_0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:Vr.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:Vr.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case mn.MSG:{const{msg:r,data:s}=n;this.processMsg(r,s);break}case mn.OK:break;case mn.ERR:this.processError(n.data);break;case mn.PING:this.processPing();break;case mn.PONG:this.processPong();break;case mn.INFO:this.processInfo(n.data);break}}sendCommand(n,...r){const s=this.outbound.length();let l;typeof n=="string"?l=_l(n):l=n,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,r=qn,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Ui.encode(r);else throw je.errorForCode(Ee.BadPayload);let u=l.length;s=s||{},s.reply=s.reply||"";let c=qn,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new je("headers",Ee.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw je.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=Mt()),this.pongs.push(n),this.outbound.fill(_0),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}${xu}`):n.push(`SUB ${s.subject} ${s.sid}${xu}`)}),n.length&&this.transport.send(_l(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 mx(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 aE="$SRV";class E0{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||Qr(),(u=l.headers)==null||u.set(ku,`${n}`),(c=l.headers)==null||c.set(Eu,r),this.msg.respond(s,l)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Rl{constructor(n,r="",s=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&oE("service group",r);let l="";if(n instanceof Il)this.srv=n,l="";else if(n instanceof Rl){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;wl("endpoint",n);let{subject:l,handler:u,metadata:c,queue:f}=s;l=l||n,f=f||this.queue,lE("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 Rl(this,n,r)}}function lE(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 oE(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 Il{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"),wl("name",this.config.name),wl("queue",this.config.queue),os(this.config.version),this._id=Mi.next(),this.internal=[],this._done=Mt(),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??aE;return r===""&&s===""?`${u}.${n}`:(wl("control subject name",r),s!==""?(wl("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=Qr();if(n instanceof Cu){const s=n;r.set(Eu,s.message),r.set(ku,`${s.code}`)}else r.set(Eu,n.message),r.set(ku,"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 uE(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 E0(y))}catch(b){f.stats.countError(b),y==null||y.respond(qn,{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:El.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:El.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=Il.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:El.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 Rl(this,n,r)}addEndpoint(n,r){return new Rl(this).addEndpoint(n,r)}_addEndpoint(n){const r=new Wt;r.noIterator=typeof n.handler=="function",r.noIterator||(n.handler=(l,u)=>{l?this.stop(l).catch():r.push(new E0(u))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(n,!1);return s.qi=r,this.handlers.push(s),r}}class uE{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+=Rt(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=Rt(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 cE{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 Wt,u=hr(),c=Il.controlSubject(n,r,s,this.prefix),f=await this.nc.requestMany(c,qn,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 px(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function fE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:px(),storage:td.File}}const Mu="KV-Operation",k0="$KV",hE=/^[-/=.\w]+$/,dE=/^[-/=.>*\w]+$/,mE=/^[-\w]+$/;function pE(e){if(e.startsWith(".")||e.endsWith(".")||!hE.test(e))throw new Error(`invalid key: ${e}`)}function gE(e){if(e.startsWith(".")||e.endsWith(".")||!dE.test(e))throw new Error(`invalid key: ${e}`)}function yE(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 vu(e){if(!mE.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 Ml{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",pE);C(this,"validateSearchKey",gE);C(this,"hasWildcards",yE);vu(n),this.js=r,this.jsm=s,this.bucket=n,this.prefix=k0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,r,s={}){vu(r);const l=await n.jetstreamManager(),u=new Ml(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}};vu(r);const c=new Ml(r,n,l);return u.config.name=s.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=s.codec||px(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(n={}){const r=Object.assign(fE(),n);this.codec=r.codec;const s={};this.stream=s.name=n.streamName??this.bucketName(),s.retention=ed.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(Ln)||(g.name=`${Ln}${g.name}`),s.mirror=g,s.mirror_direct=!0}else if(n.sources){const g=n.sources.map(b=>{const v=Object.assign({},b),k=v.name.startsWith(Ln)?v.name.substring(Ln.length):v.name;return v.name.startsWith(Ln)||(v.name=`${Ln}${v.name}`),!b.external&&k!==this.bucket&&(v.subject_transforms=[{src:`$KV.${k}.>`,dest:`$KV.${this.bucket}.>`}]),v});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?Di.S2:Di.None);const u=this.js.nc,c=u.getServerVersion(),f=c?rd(c,os("2.7.2"))>=0:!1;s.discard=f?Nl.New:Nl.Old;const{ok:m,min:d}=u.features.get(lt.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=Rt(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(Ln)&&(s=s.substring(Ln.length)),r.external&&r.external.api!==""){const l=r.name.substring(Ln.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Ln}${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}`:`${k0}.${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(yn.MessageSizeHdr)||"";return s!==""?parseInt(s,10):n.length}smToEntry(n){return new RE(this.bucket,this.prefixLen,n)}jmToEntry(n){const r=this.decodeKey(n.subject.substring(this.prefixLen));return new ME(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=Qr();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=Mt(),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=Qr();u.set(Mu,r),r==="PURGE"&&u.set(yn.RollupHdr,yn.RollupValueSubject),s!=null&&s.previousSeq&&u.set(vr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),qn,{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=qt.LastPerSubject;r===cr.AllHistory&&(c=qt.All),r===cr.UpdatesOnly&&(c=qt.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:Zt.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:Rt(5*1e3)},s)}remove(n){return this.purge(n)}async history(n={}){const r=n.key??">",s=new Wt,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=Ri(f);d.bindStream(this.stream),d.orderedConsumer(),d.callback((g,b)=>{if(g){s.stop(g);return}if(b){const v=this.jmToEntry(b);s.push(v),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(v){s.stop(v)}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(lt.JS_NEW_CONSUMER_CREATE_API);return s}async watch(n={}){const r=n.key??">",s=new Wt,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=Ri(d);this.canSetWatcherName()&&g.consumerName(Mi.next()),g.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&g.startSequence(n.resumeFromRevision),g.orderedConsumer(),g.callback((v,k)=>{if(v){s.stop(v);return}if(k){const M=this.jmToEntry(k);if(c&&M.operation==="DEL")return;s.push(M),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:v}}=b,k=v.num_pending+v.delivered.consumer_seq;if(k===0||s.received>=k)try{f()}catch(M){s.stop(M)}finally{f=void 0}else m=k}return s._data=b,s.iterClosed.then(()=>{b.unsubscribe()}),b.closed.then(()=>{s.stop()}).catch(v=>{s.stop(v)}),s}async keys(n=">"){const r=new Wt,s=this._buildCC(n,cr.LastValue,{headers_only:!0}),l=Array.isArray(n)?">":s.filter_subject,u=Ri(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(Mu);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 gx(l,r)}}class gx{constructor(n,r=""){C(this,"si");C(this,"cluster");this.si=n,this.cluster=r}get bucket(){return this.si.config.name.startsWith(Ln)?this.si.config.name.substring(Ln.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 Nd(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!==Di.None:!1}}const Dd="OBJ_",C0="SHA-256=";function bE(e){return vu(e),`${Dd}${e}`}function xE(e){return e.startsWith(Dd)?e.substring(4):e}class ld{constructor(n){C(this,"si");C(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return xE(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!==Di.None:!1}}function cu(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 er;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(er||(er={}));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 sa;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(sa||(sa={}));const A0=Uint8Array.of(43,65,67,75),vE=Uint8Array.of(45,78,65,75),ml=Uint8Array.of(43,87,80,73),wE=Uint8Array.of(43,78,88,84),SE=Uint8Array.of(43,84,69,82,77),_E=Uint8Array.of(32);function Dl(e,n=5e3){return new qE(e,n)}class _h extends Wt{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=Xr(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,v,k;if(m){this.stop(m);return}if((g=this.monitor)==null||g.work(),d.subject===this.inbox){if(Wh(d))return;const M=(b=d.headers)==null?void 0:b.code,U=((k=(v=d.headers)==null?void 0:v.description)==null?void 0:k.toLowerCase())||"unknown",{msgsLeft:R,bytesLeft:P}=this.parseDiscard(d.headers);if(R>0||P>0)this.pending.msgs-=R,this.pending.bytes-=P,this.pending.requests--,this.notify(sa.Discard,{msgsLeft:R,bytesLeft:P});else if(M===400){this.stop(new je(U,`${M}`));return}else if(M===409&&U==="consumer deleted"){if(this.notify(wr.ConsumerDeleted,`${M} ${U}`),!this.refilling||this.abortOnMissingResource){const q=new je(U,`${M}`);this.stop(q);return}}else if(M===503){if(this.notify(wr.NoResponders,`${M} No Responders`),!this.refilling||this.abortOnMissingResource){const q=new je("no responders",`${M}`);this.stop(q);return}}else this.notify(sa.DebugEvent,`${M} ${U}`)}else this._push(Dl(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 M=this.pullOptions();this.pull(M)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Md(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 Vr.Disconnect:(d=this.monitor)==null||d.cancel();break;case Vr.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=pa(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(sa.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=Rt(this.opts.idle_heartbeat),u=Rt(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(yn.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(yn.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 Wt;return this.listeners.push(r),Promise.resolve(r)}}class EE extends Wt{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 Wt;return this.listeners.push(r),Promise.resolve(r)}}class od{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 _h(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const r=new _h(this,n,!1),s=Math.round(r.opts.expires*1.05),l=oa(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=Mt(),s=n;s.max_messages=1;const l=new _h(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=oa(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 kE{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=Mi.next(),typeof s.name_prefix=="string"&&(Fu("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=er.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:qt.StartSequence,opt_start_seq:n,ack_policy:Zt.None,inactive_threshold:Rt(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||qt.StartSequence,(this.consumerOpts.deliver_policy===qt.LastPerSubject||this.consumerOpts.deliver_policy===qt.New||this.consumerOpts.deliver_policy===qt.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===qt.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=qt.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=Rt(this.consumerOpts.inactive_threshold))),s}async resetConsumer(n=0){var c,f,m,d,y;Mi.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===er.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 pa(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===er.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 EE),this.consumer=new od(this.api,this.currentConsumer);const u=n;u.callback=this.internalHandler(this.serial);let c=null;this.type===er.Fetch&&s?c=await this.consumer.fetch(n):this.type===er.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(sa.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===er.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===er.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=n;return s&&(this.userCallback=s),this.type=er.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===er.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=er.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=Mt();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 ud{constructor(n){C(this,"api");C(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(lt.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 od(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 od(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 kE(this.api,n,r))).catch(u=>Promise.reject(u))}}class Gu{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 Gu(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 ud(new ju(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new ud(new ju(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 Hl{constructor(n,r){super(n,r)}checkStreamConfigVersions(n){const r=this.nc;if(n.metadata){const{min:l,ok:u}=r.features.get(lt.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(lt.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(lt.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(lt.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(lt.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(lt.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),dn(n.name),n.mirror=cu(n.mirror),n.sources=(l=n.sources)==null?void 0:l.map(cu);const s=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(s),s}async delete(n){return dn(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),dn(n);const s=await this.info(n),l=Object.assign(s.config,r);l.mirror=cu(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(cu);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,l);return this._fixInfo(c),c}async info(n,r){dn(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 v=await this._request(s,y);c=v.total,d.push(v);const k=Object.getOwnPropertyNames(v.state.subjects).length;if(m+=k,k<f)break}let b={};for(let v=0;v<d.length;v++)u=d[v],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 Sl(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 dn(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,r)}async deleteMessage(n,r,s=!0){dn(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){dn(n);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,r);return new yx(l)}find(n){return this.findStream(n)}listKvs(){const n=s=>{var m;const u=s.streams.filter(d=>d.config.name.startsWith(Ln));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 gx(d,c))},r=`${this.prefix}.STREAM.LIST`;return new Sl(r,n,this)}listObjectStores(){const n=s=>{const u=s.streams.filter(f=>f.config.name.startsWith(Dd));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new ld(f))},r=`${this.prefix}.STREAM.LIST`;return new Sl(r,n,this)}names(n=""){const r=n!=null&&n.length?{subject:n}:{},s=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new Sl(l,s,this,r)}async get(n){const r=await this.info(n);return Promise.resolve(new Gu(this,r))}}class CE extends Hl{constructor(n,r){super(n,r)}async getMessage(n,r){dn(n);let s=r;const{last_by_subj:l}=s;l&&(s=null);const u=s?this.jc.encode(s):qn,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=ra(m);if(d)return Promise.reject(d);const y=new cd(m);return Promise.resolve(y)}async getBatch(n,r){dn(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 Wt,f=await this.nc.requestMany(l,u,{strategy:fr.SentinelMsg});return(async()=>{var g,b,v;let m=!1,d=!1,y;for await(const k of f){if(!m){m=!0;const M=((g=k.headers)==null?void 0:g.code)||0;if(M!==0&&M<200||M>299){y=(b=k.headers)==null?void 0:b.description.toLowerCase();break}if(((v=k.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){d=!0;break}}if(k.data.length===0)break;c.push(new cd(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 cd{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(Ws.Subject)}get seq(){const n=this.header.last(Ws.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Ws.TimeStamp)}get stream(){return this.header.last(Ws.Stream)}json(n){return hr(n).decode(this.data)}string(){return Un.decode(this.data)}}C(cd,"jc");class AE extends Hl{constructor(r,s){super(r,s);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new zd(r,s),this.consumers=new ju(r,s),this.direct=new CE(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new Wt;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 yx{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):qn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Ni.decode(n)}else this._header=Qr();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 Un.decode(this.data)}}C(yx,"jc");class TE{constructor(n){C(this,"api");this.api=n}get(n){return this.api.info(n).then(r=>new Gu(this.api,r))}}class Eh{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=Ni.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 T0(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 jE(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Cl{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 Eh(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 ld(n)))}async status(n){const r=await this._si(n);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new ld(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 v=Mi.next(),k=this._chunkSubject(v),M=this._metaSubject(g),U=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},T0(n)),R=Mt(),P=[],q=new ca;try{const B=r?r.getReader():null,L=y0.create();for(;;){const{done:K,value:Y}=B?await B.read():{done:!0,value:void 0};if(K){if(q.size()>0){const J=q.drain();L.update(J),U.chunks++,U.size+=J.length,P.push(this.js.publish(k,J,{timeout:u}))}await Promise.all(P),P.length=0,U.mtime=new Date().toISOString();const $=ia.encode(L.digest());U.digest=`${C0}${$}`,U.deleted=!1;const N=Qr();typeof c=="number"&&N.set(vr.ExpectedLastSubjectSequenceHdr,`${c}`),N.set(yn.RollupHdr,yn.RollupValueSubject);const G=await this.js.publish(M,hr().encode(U),{headers:N,timeout:u});if(U.revision=G.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}R.resolve(new Eh(U));break}if(Y)for(q.fill(Y);q.size()>d;){U.chunks++,U.size+=d;const $=q.drain(n.options.max_chunk_size);L.update($),P.push(this.js.publish(k,$,{timeout:u}))}}}catch(B){await this.jsm.streams.purge(this.stream,{filter:k}),R.reject(B)}return R}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 ca,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 Cl.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(C0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=nd(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Mt(),u={info:new Eh(r),error:l};if(r.size===0)return u.data=jE(),l.resolve(null),Promise.resolve(u);let c;const f=Ri();f.orderedConsumer();const m=y0.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&&(s2(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 Cl))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=Qr();return l.set(yn.RollupHdr,yn.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,T0(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 Wt,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=Ri();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.${ia.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=bE(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=Nl.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?Di.S2:Di.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 Cl(r,l,n);return await u.init(s),Promise.resolve(u)}}class OE{constructor(n){C(this,"js");this.js=n}kv(n,r={}){const s=this.js,{ok:l,min:u}=s.nc.features.get(lt.JS_KV);return l?r.bindOnly?Ml.bind(this.js,n,r):Ml.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(lt.JS_OBJECTSTORE);return l?Cl.create(this.js,n,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class Ld extends Hl{constructor(r,s){super(r,s);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new ju(r,s),this.streamAPI=new zd(r,s),this.consumers=new ud(this.consumerAPI),this.streams=new TE(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 OE(this)}async publish(r,s=qn,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||Qr();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(v){if(v.code==="503"&&b+1<m)await pa(d);else throw v}const g=this.parseJsResponse(y);if(g.stream==="")throw je.errorForCode(Ee.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){dn(r),na(s);let u=this.timeout;l>u&&(u=l),l=l<0?0:Rt(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=ra(f);if(m)throw m;return Dl(f,this.timeout)}fetch(r,s,l={}){dn(r),na(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 P=this.nc.features.get(lt.JS_PULL_MAX_BYTES);if(!P.ok)throw new Error(`max_bytes is only supported on servers ${P.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=Rt(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=Rt(b),l.delay_heartbeat===!0&&(y.idle_heartbeat=Rt(b*4)));const v=new Wt,k=y.batch;let M=0;v.protocolFilterFn=(P,q=!1)=>Wh(P.msg)?(d==null||d.work(),!1):!0,v.dispatchedFn=P=>{if(P){if(c&&(f+=P.data.length),M++,u&&P.info.pending===0)return;(v.getPending()===1&&P.info.pending===0||k===M||m>0&&f>=m)&&v.stop()}};const U=Xr(this.nc.options.inboxPrefix),R=this.nc.subscribe(U,{max:l.batch,callback:(P,q)=>{P===null&&(P=ra(q)),P!==null?(u&&(u.cancel(),u=null),q_(P)?v.stop(xx(P)===null?void 0:P):v.stop(P)):(d==null||d.work(),v.received++,v.push(Dl(q,this.timeout)))}});return g&&(u=oa(g),u.catch(()=>{R.isClosed()||(R.drain().catch(()=>{}),u=null),d&&d.cancel()})),(async()=>{try{b&&(d=new Md(b,P=>(v.push(()=>{v.err=new je(`${tr.IdleHeartbeatMissed}: ${P}`,Ee.JetStreamIdleHeartBeat)}),!0)))}catch{}await R.closed,u!==null&&(u.cancel(),u=null),d&&d.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(y),{reply:U}),v}async pullSubscribe(r,s=Ri()){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===Zt.None||u===Zt.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new DE(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(m){throw f.unsubscribe(),m}return f}async subscribe(r,s=Ri()){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 bx(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=Ri()){const l=d0(s)?s.getOpts():s;if(l.isBind=d0(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!==Zt.NotSet&&l.config.ack_policy!==Zt.None)throw new je("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 je("ordered consumer: durable_name cannot be set",Ee.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new je("ordered consumer: deliver_subject cannot be set",Ee.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new je("ordered consumer: max_deliver cannot be set",Ee.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new je("ordered consumer: deliver_group cannot be set",Ee.ApiError);l.config.deliver_subject=Xr(this.nc.options.inboxPrefix),l.config.ack_policy=Zt.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||Rt(5e3),l.config.ack_wait=Rt(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===Zt.NotSet&&(l.config.ack_policy=Zt.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||Xr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=zE(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Ld.ingestionFn(r.ordered),s.protocolFilterFn=(l,u=!1)=>{const c=l;return Zh(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==Zt.None&&(s.dispatchedFn=BE),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:qt.All,ack_policy:Zt.Explicit,ack_wait:Rt(30*1e3),replay_policy:ua.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(ra(c.msg)||(m=u.monitor)==null||m.work(),Wh(c.msg)){const d=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:d,protocol:!0}}else if(Zh(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(s):!0,protocol:!1}}}}class Ud{constructor(n){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=W2(n),this.listeners=[]}static connect(n={}){return new Promise((r,s)=>{const l=new Ud(n);Ru.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 je.errorForCode(Ee.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw je.errorForCode(Ee.ConnectionDraining);if(n=n||"",n.length===0)throw je.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 mx(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=qn,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 je("timeout",Ee.InvalidOption));const u=new Wt;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(Xr(this.options.inboxPrefix),{callback:(k,M)=>{var U,R;if(((U=M==null?void 0:M.data)==null?void 0:U.length)===0&&((R=M==null?void 0:M.headers)==null?void 0:R.status)===Ee.NoResponders&&(k=je.errorForCode(Ee.NoResponders)),k){m&&(k.stack+=`
82
+
83
+ ${m}`),g(k);return}f(null,M),s.strategy===fr.Count&&(d--,d===0&&g()),s.strategy===fr.JitterTimer&&(v(),b=setTimeout(()=>{g()},300)),s.strategy===fr.SentinelMsg&&M&&M.data.length===0&&g()}});y.requestSubject=n,y.closed.then(()=>{c()}).catch(k=>{u.stop(k)});const g=k=>{k&&u.push(()=>{throw k}),v(),y.drain().then(()=>{c()}).catch(M=>{c()})};u.iterClosed.then(()=>{v(),y==null||y.unsubscribe()}).catch(k=>{v(),y==null||y.unsubscribe()});try{this.publish(n,r,{reply:y.getSubject()})}catch(k){g(k)}let b=setTimeout(()=>{g()},s.maxWait);const v=()=>{b&&clearTimeout(b)}}else{const m=s;m.callback=f,u.iterClosed.then(()=>{d.cancel()}).catch(y=>{d.cancel(y)});const d=new a2(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 je("timeout",Ee.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new je("reply can only be used with noMux",Ee.InvalidOption));if(s.noMux){const u=s.reply?s.reply:Xr(this.options.inboxPrefix),c=Mt(),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=nx(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 sx(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(je.errorForCode(Ee.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(je.errorForCode(Ee.ConnectionClosed)):this.isDraining()?Promise.reject(je.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 Wt;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 AE(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 Ld(this,n)}getServerVersion(){const n=this.info;return n?os(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw je.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 NE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(je.errorForCode(Ee.ConnectionClosed)):this.isDraining()?Promise.reject(je.errorForCode(Ee.ConnectionDraining)):this.protocol.reconnect()}}class NE{constructor(n){C(this,"nc");this.nc=n}add(n){try{return new Il(this.nc,n).start()}catch(r){return Promise.reject(r)}}client(n,r){return new cE(this.nc,n,r)}}class RE{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(Mu)||"PUT"}get length(){const n=this.sm.header.get(yn.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class ME{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(Nd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Mu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const n=((r=this.sm.headers)==null?void 0:r.get(yn.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class bx extends c2{constructor(r,s,l){super(r.nc,s,l);C(this,"js");C(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const s=Xr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const u=this.info;u.config.name=Mi.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=qt.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 je(`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(Nd(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,v;const m=$_(409,`${tr.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),(v=this.monitor)==null||v.restart(),!1}return!u.noIterator};this.monitor=new Md(r,c,l)}_checkHbOrderConsumer(r){const s=r.headers.get(yn.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(yn.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 DE extends bx{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(lt.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=Rt(f));let m=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(m=n.idle_heartbeat,c.idle_heartbeat=Rt(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 zE(e,n){return e?UE(n):LE(n)}function LE(e){return(n,r)=>n?[n,null]:(n=ra(r),n?[n,null]:[null,Dl(r,e)])}function UE(e){return(n,r)=>{if(n)return[n,null];const s=ra(r);return s!==null?[xx(s),null]:[null,Dl(r,e)]}}function xx(e){if(e!==null)switch(e.code){case Ee.JetStream404NoMessages:case Ee.JetStream408RequestTimeout:return null;case Ee.JetStream409:return Y_(e)?e:null;default:return e}return null}function BE(e){e&&e.ack()}function PE(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 qE{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=PE(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]===ml[0]&&n[1]===ml[1]&&n[2]===ml[2]&&n[3]===ml[3]}async ackAck(n){var s;n=n||{},n.timeout=n.timeout||this.timeout;const r=Mt();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 sx(u.muxSubscriptions,this.msg.reply,{timeout:n.timeout},c);u.request(f);try{u.publish(this.msg.reply,A0,{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(A0)}nak(n){let r=vE;n&&(r=Au().encode(`-NAK ${JSON.stringify({delay:Rt(n)})}`)),this.doAck(r)}working(){this.doAck(ml)}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=Rt(r.expires));const l=hr().encode(s),u=ca.concat(wE,_E,l),c=n?{reply:n}:void 0;this.msg.respond(u,c)}term(n=""){let r=SE;(n==null?void 0:n.length)>0&&(r=Au().encode(`+TERM ${n}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const HE="1.30.3",IE="nats.ws";class FE{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=HE,this.lang=IE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Mt(),this.closedNotification=Mt()}async connect(n,r){const s=Mt();if(r.tls)return s.reject(new je("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=ca.concat(...this.yields),f=g2(c);if(f!==""){const m=nE.exec(f);if(!m){r.debug&&console.error("!!!",lu(c)),s.reject(new Error("unexpected response from server"));return}try{const d=JSON.parse(m[1]);eE(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 je(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 pa(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(`> ${lu(n[r])}`),yield n[r];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=Mt())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${lu(n)}`);return}catch(r){this.options.debug&&console.error(`!!! ${lu(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 $E(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 vx(e={}){return f2({defaultPort:443,urlParseFn:$E,factory:()=>new FE}),Ud.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var fa;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(fa||(fa={}));class kh extends Error{constructor(n,r,s){super(n),this.message=n,this.code=r,this.data=s}}const YE=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"},GE=e=>{const n=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>n!==null?n.name:YE(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(v=>v.name===g)},m=g=>e.console.error(g),d=new Map,y=(g,b={})=>{const v=d.get(g);if(v)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),v.proxy;const k=l(),M=f(g);let U;const R=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),P=(Y,$)=>{var N,G;if(M){const J=M==null?void 0:M.methods.find(le=>$===le.name);if(J)return J.rtype==="promise"?le=>r.nativePromise(g,$.toString(),le):(le,re)=>r.nativeCallback(g,$.toString(),le,re);if(Y)return(N=Y[$])===null||N===void 0?void 0:N.bind(Y)}else{if(Y)return(G=Y[$])===null||G===void 0?void 0:G.bind(Y);throw new kh(`"${g}" plugin is not implemented on ${k}`,fa.Unimplemented)}},q=Y=>{let $;const N=(...G)=>{const J=R().then(le=>{const re=P(le,Y);if(re){const W=re(...G);return $=W==null?void 0:W.remove,W}else throw new kh(`"${g}.${Y}()" is not implemented on ${k}`,fa.Unimplemented)});return Y==="addListener"&&(J.remove=async()=>$()),J};return N.toString=()=>`${Y.toString()}() { [capacitor code] }`,Object.defineProperty(N,"name",{value:Y,writable:!1,configurable:!1}),N},ae=q("addListener"),B=q("removeListener"),L=(Y,$)=>{const N=ae({eventName:Y},$),G=async()=>{const le=await N;B({eventName:Y,callbackId:le},$)},J=new Promise(le=>N.then(()=>le({remove:G})));return J.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await G()},J},K=new Proxy({},{get(Y,$){switch($){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return M?L:ae;case"removeListener":return B;default:return q($)}}});return s[g]=K,d.set(g,{name:g,proxy:K,platforms:new Set([...Object.keys(b),...M?[k]:[]])}),K};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=m,r.isNativePlatform=u,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=kh,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},VE=e=>e.Capacitor=GE(e),zi=VE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ga=zi.registerPlugin;class Bd{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 zi.Exception(n,fa.Unimplemented)}unavailable(n="not available"){return new zi.Exception(n,fa.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 j0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),O0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class JE extends Bd{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=j0(n.key),s=j0(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)}}}ga("CapacitorCookies",{web:()=>new JE});const XE=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)}),KE=(e={})=>{const n=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[n[c]],l),{})},QE=(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,ZE=(e,n={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},n),l=KE(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 WE extends Bd{async request(n){const r=ZE(n,n.webFetchExtra),s=QE(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 XE(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"}))}}ga("CapacitorHttp",{web:()=>new WE});var N0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(N0||(N0={}));var R0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(R0||(R0={}));class ek extends Bd{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")}}ga("SystemBars",{web:()=>new ek});const Du=zi.isNativePlatform()?"https://app.palmier.me":"";async function wx(e,n,r,s){const l=`${Du}${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 tk(e,n,r){return wx("POST",e,n)}function nk(e,n){return wx("GET",e,void 0)}const Sx=D.createContext({connected:!1,mode:"disconnected",nc:null,request(){return Promise.reject(new Error("No host connection"))},subscribeEvents(){return()=>{}},activeHost:null,unauthorized:!1}),rk=2e3,Ch=6e3;function ik({children:e}){const{getActiveHost:n}=ql(),r=n(),[s,l]=D.useState(null),[u,c]=D.useState(!1),f=D.useRef(null),[m,d]=D.useState(!1),[y,g]=D.useState(!1),b=D.useRef(Au()),v=D.useRef(new Set),k=D.useRef(0),M=r!=null&&!!r.directUrl,U=r?M?m?"direct":"disconnected":u?"nats":"disconnected":"disconnected",R=U!=="disconnected";D.useEffect(()=>{g(!1)},[r==null?void 0:r.hostId,r==null?void 0:r.clientToken]),D.useEffect(()=>{if(M){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 L=await fetch(`${Du}/api/nats-credentials/${r.hostId}`);if(!L.ok){console.error("[NATS] Failed to fetch credentials");return}const K=await L.json();if(!K.natsWsUrl){console.warn("[NATS] No WebSocket URL configured");return}if(ae)return;console.log("[NATS] Connecting to",K.natsWsUrl);const Y=await vx({servers:K.natsWsUrl,authenticator:fx(K.natsJwt,new TextEncoder().encode(K.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(L){console.error("[NATS] Connection failed:",L),ae||c(!1)}}return B(),()=>{ae=!0,f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1))}},[M,r]),D.useEffect(()=>{if(!r||!M){d(!1);return}const ae=new AbortController;async function B(){var $;const K=new AbortController,Y=setTimeout(()=>K.abort(),rk);ae.signal.addEventListener("abort",()=>K.abort());try{const N=await fetch(`${r.directUrl}/events`,{headers:{Authorization:`Bearer ${r.clientToken}`},signal:K.signal});return clearTimeout(Y),N.ok?(($=N.body)==null?void 0:$.getReader())??null:null}catch{return clearTimeout(Y),null}}async function L(K){d(!0),console.log("[HOST] SSE connected to",r.directUrl),k.current=Date.now();function Y(){setTimeout(()=>{ae.signal.aborted||Date.now()-k.current<Ch||(console.log("[HOST] Heartbeat timeout — no data for",Ch/1e3,"s"),ae.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},Ch)}Y();const $=new TextDecoder;let N="";try{for(;;){const{done:G,value:J}=await K.read();if(G)break;N+=$.decode(J,{stream:!0}),k.current=Date.now(),Y();const le=N.split(`
88
+ `);N=le.pop()??"";for(const re of le)if(re.startsWith("data: ")){const W=re.slice(6);try{const I=JSON.parse(W);if(I.task_id&&I.event_type){const oe=`host-event.${r.hostId}.${I.task_id}`;for(const ye of v.current)ye({subject:oe,data:b.current.encode(W)})}}catch{}}}}catch{}}return(async()=>{const K=await B();K&&await L(K)})(),()=>{ae.abort(),d(!1)}},[r,M]);const P=D.useCallback(async(ae,B,L)=>{if(!r)throw new Error("No active host");function K(le){le&&typeof le=="object"&&le.error==="Unauthorized"&&g(!0)}if(M){console.log(`[HOST/HTTP] → ${ae}`,B??"");const le=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:L!=null&&L.timeout?AbortSignal.timeout(L.timeout):void 0});if(le.status===401)throw g(!0),new Error("Unauthorized");const re=await le.json();return K(re),console.log(`[HOST/HTTP] ← ${ae}`,re),re}if(!f.current)throw new Error("Not connected");const Y=`host.${r.hostId}.rpc.${ae}`,$={...B??{},clientToken:r.clientToken},N=b.current.encode(JSON.stringify($));console.log(`[HOST/NATS] → ${ae}`,B??"");const G=await f.current.request(Y,N,{timeout:(L==null?void 0:L.timeout)??1e4}),J=JSON.parse(b.current.decode(G.data));return K(J),console.log(`[HOST/NATS] ← ${ae}`,J),J},[r,M]),q=D.useCallback((ae,B)=>{if(M)return v.current.add(B),()=>{v.current.delete(B)};if(f.current){const L=f.current.subscribe(`host-event.${ae}.>`);let K=!1;return(async()=>{try{for await(const Y of L){if(K)break;B({subject:Y.subject,data:Y.data})}}catch{}})(),()=>{K=!0,L.unsubscribe()}}return()=>{}},[r,M]);return w.jsx(Sx.Provider,{value:{connected:R,mode:U,nc:s,request:P,subscribeEvents:q,activeHost:r,unauthorized:y},children:e})}function Vu(){return D.useContext(Sx)}const Kt=zi.isNativePlatform()?ga("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 _x={};function sk(e){for(const n of e)_x[n.key]=n.label}function fd(e){return _x[e]??e}const ak=()=>window.matchMedia("(max-width: 600px)").matches;function lk({task:e,lastEvent:n,onEdit:r,onDelete:s,onViewRun:l}){var le;const{request:u}=Vu(),[c,f]=D.useState(!1),[m,d]=D.useState(!1),[y,g]=D.useState(!1),b=D.useRef(null),v=(n==null?void 0:n.running_state)==="started",k=(((le=e.schedule_values)==null?void 0:le.length)??0)>0,M=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",R=!!e.schedule_enabled&&!!e.schedule_type&&(k||M)?v?"var(--color-success)":(n==null?void 0:n.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";D.useEffect(()=>{if(!m)return;function re(W){b.current&&!b.current.contains(W.target)&&d(!1)}return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[m]);function P(){ak()?g(!0):d(re=>!re)}function q(){d(!1),g(!1)}async function ae(){if(q(),!!confirm("Abort this task?")){f(!0);try{await u("task.abort",{id:e.id})}catch(re){console.error("Abort failed:",re)}finally{f(!1)}}}async function B(){q();try{const re=await u("task.run",{id:e.id});l(e.id,re.run_id)}catch(re){console.error("Run failed:",re)}}async function L(){if(q(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),s(e.id)}catch(re){console.error("Delete failed:",re)}}const K={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function Y(re,W){if(re==="specific_times"){const xe=new Date(W);return{kind:"specific_times",detail:isNaN(xe.getTime())?W:`${xe.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})} at ${xe.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}}const I=W.split(" ");if(I.length!==5)return{kind:"unknown",detail:W};const[oe,ye,ke,,_]=I,O=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(ye==="*")return{kind:"hourly",detail:""};const Z=new Date;Z.setHours(Number(ye),Number(oe),0,0);const A=Z.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return _!=="*"?{kind:"weekly",detail:`${O[Number(_)]??_} at ${A}`}:ke!=="*"?{kind:"monthly",detail:`day ${ke} at ${A}`}:{kind:"daily",detail:A}}function $(re,W){const I=Y(re,W);return I.kind==="hourly"?"Every hour":I.kind==="specific_times"?`Once on ${I.detail}`:`${I.kind.charAt(0).toUpperCase()+I.kind.slice(1)}: ${I.detail}`}function N(re,W){if(!re)return"";if(re==="on_new_notification")return"On new push notification";if(re==="on_new_sms")return"On new SMS";if(!W||W.length===0)return"";if(W.length===1)return $(re,W[0]);const I=W.map(ye=>Y(re,ye));if(new Set(I.map(ye=>ye.kind)).size===1){const ye=I[0].kind;if(ye==="hourly")return"Every hour";const ke=I.map(_=>_.detail);return`${ye.charAt(0).toUpperCase()+ye.slice(1)}: ${ke.join(", ")}`}return W.map(ye=>$(re,ye)).join(", ")}const G=N(e.schedule_type,e.schedule_values),J=w.jsxs(w.Fragment,{children:[w.jsxs("button",{onClick:()=>{q(),r(e)},children:[w.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),w.jsxs("button",{onClick:()=>{q(),l(e.id)},children:[w.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),v?w.jsxs("button",{className:"menu-item-danger",onClick:ae,disabled:c,children:[w.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):w.jsxs(w.Fragment,{children:[w.jsxs("button",{onClick:B,children:[w.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),w.jsxs("button",{className:"menu-item-danger",onClick:L,children:[w.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"task-card",onClick:()=>l(e.id,"latest"),children:[w.jsxs("div",{className:"task-card-header",children:[w.jsxs("div",{className:"task-card-title-row",children:[v?w.jsx("span",{className:"status-spinner",children:w.jsx("span",{})}):w.jsx("span",{className:"status-dot",style:{backgroundColor:R}}),w.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),w.jsx("div",{className:"task-card-actions",onClick:re=>re.stopPropagation(),children:w.jsxs("div",{className:"task-card-menu",ref:b,children:[w.jsx("button",{className:"task-card-menu-btn",onClick:P,"aria-label":"Task actions",children:"⋮"}),m&&w.jsx("div",{className:"task-card-menu-dropdown",children:J})]})})]}),w.jsxs("div",{className:"task-card-meta",children:[e.agent&&w.jsx("span",{className:"task-card-agent",children:fd(e.agent)}),n&&K[n.running_state]&&w.jsxs("span",{className:"task-card-last-event",children:[K[n.running_state]," ",zu(n.time_stamp)]}),e.schedule_type&&(k||M)&&w.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?G:"Schedule disabled"})]})]}),y&&_u.createPortal(w.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>g(!1),children:w.jsxs("div",{className:"bottom-sheet",onClick:re=>re.stopPropagation(),children:[w.jsx("div",{className:"bottom-sheet-handle"}),w.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),w.jsx("div",{className:"bottom-sheet-actions",children:J})]})}),document.body)]})}function ok({permissions:e}){return w.jsxs("div",{className:"plan-dialog",children:[w.jsx("h2",{children:"Granted Permissions"}),w.jsx("div",{className:"plan-dialog-scroll",children:e&&e.length>0?w.jsx("div",{className:"permissions-section",children:w.jsx("ul",{className:"permissions-list",children:e.map((n,r)=>w.jsxs("li",{className:"permission-item",children:[w.jsx("span",{className:"permission-tool",children:n.name}),w.jsx("span",{className:"permission-desc",children:n.description})]},r))})}):w.jsx("p",{className:"plan-empty",children:"No permissions have been granted for this task."})}),w.jsx("div",{className:"plan-dialog-actions",children:w.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const Qs=[];function uk(){const e=Qs.pop();e&&(e.pushed.current=!1,e.close())}let M0=!1;function ck(){M0||(M0=!0,window.addEventListener("popstate",uk))}function fk(e,n){const r=D.useRef(!1),s=D.useRef(n);s.current=n;const l=D.useCallback(()=>s.current(),[]),u=D.useRef({close:l,pushed:r});u.current.close=l,D.useEffect(()=>{if(e&&!r.current)ck(),history.pushState({modal:!0},""),Qs.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=Qs.indexOf(u.current);c!==-1&&Qs.splice(c,1),history.back()}},[e,l]),D.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=Qs.indexOf(c);f!==-1&&Qs.splice(f,1),history.back()}}},[])}const hk=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dk=["specific_times","hourly","daily","weekly","monthly"];function fu(e){return dk.includes(e)}function mk(e){return e==="on_new_notification"||e==="on_new_sms"}function Jr(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function pk(e){const n=e.split(" ");if(n.length!==5)return Jr();const[r,s,l,,u]=n;if(s==="*")return Jr("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...Jr("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...Jr("monthly"),time:c,dayOfMonth:l}:{...Jr("daily"),time:c}}function Ex(e,n){if(e==="specific_times"){const[r,s]=n.split("T");return{...Jr("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return pk(n)}function gk(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 yk(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:gk(e)}function Ah(e){return e==="specific_times"?"specific_times":e==="on_new_notification"?"on_new_notification":e==="on_new_sms"?"on_new_sms":"crons"}function Th(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?Ex(n,r).schedule:"ondemand"}function bk({initial:e,agents:n,hostPlatform:r,onSaved:s,onRun:l,onCancel:u}){var at;const{request:c}=Vu(),f=()=>{var Pe;const we=localStorage.getItem("palmier:lastAgent"),Me=n.map($e=>$e.key);return we&&Me.includes(we)?we:((Pe=n[0])==null?void 0:Pe.key)??""},[m,d]=D.useState((e==null?void 0:e.user_prompt)??""),[y,g]=D.useState((e==null?void 0:e.agent)??f()),b=!!((at=e==null?void 0:e.permissions)!=null&&at.length),[v,k]=D.useState(!1),M=D.useCallback(()=>k(!1),[]);fk(v,M);const[U,R]=D.useState(null),[P,q]=D.useState(()=>Th(e)),[ae,B]=D.useState(()=>{const we=e==null?void 0:e.schedule_type,Me=e==null?void 0:e.schedule_values;if(Me&&(we==="crons"||we==="specific_times"))return Me.map($e=>Ex(we,$e));const Pe=Th(e);return fu(Pe)?[Jr(Pe)]:[]}),[L,K]=D.useState((e==null?void 0:e.requires_confirmation)??!1),[Y,$]=D.useState((e==null?void 0:e.schedule_enabled)??!0),[N,G]=D.useState((e==null?void 0:e.yolo_mode)??!1),[J,le]=D.useState((e==null?void 0:e.foreground_mode)??!1),[re,W]=D.useState((e==null?void 0:e.command)??""),[I,oe]=D.useState(!1),ye=D.useRef(null),ke=fu(P),_=P==="command",O=mk(P),Z=n.find(we=>we.key===y),A=!!(Z!=null&&Z.supportsYolo);D.useEffect(()=>{!A&&N&&G(!1)},[A,N]);const xe=!!e,he=Th(e),Se=!xe||m!==((e==null?void 0:e.user_prompt)??"")||y!==((e==null?void 0:e.agent)??"")||P!==he||L!==((e==null?void 0:e.requires_confirmation)??!1)||Y!==((e==null?void 0:e.schedule_enabled)??!0)||N!==((e==null?void 0:e.yolo_mode)??!1)||J!==((e==null?void 0:e.foreground_mode)??!1)||_&&re!==((e==null?void 0:e.command)??"")||ke&&(JSON.stringify(Ie())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Ah(P)!==((e==null?void 0:e.schedule_type)??void 0))||O&&P!==(e==null?void 0:e.schedule_type),Te=ke&&ae.some(we=>we.schedule==="specific_times"&&(!we.onceDate||new Date(`${we.onceDate}T${we.onceTime}`)<=new Date)),ze=Se&&!!m.trim()&&!Te&&(!_||!!re.trim())&&(!ke||ae.length>0);function ue(we,Me){B(Pe=>Pe.map(($e,Gt)=>Gt===we?{...$e,...Me}:$e))}function Le(we){B(Me=>Me.filter((Pe,$e)=>$e!==we))}function We(){fu(P)&&B(we=>[...we,we.length>0?{...we[we.length-1]}:Jr(P)])}function wt(we){q(we),fu(we)?B([Jr(we)]):(B([]),K(!1)),we==="command"?setTimeout(()=>{var Me;return(Me=ye.current)==null?void 0:Me.focus()},0):W("")}function Ie(){return ae.flatMap(we=>{const Me=yk(we);return Me?[Me]:[]})}function it(){return N?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 nt(){oe(!0),R(null);try{const we=ke?Ie():[],Me=ke||O?Ah(P):null,Pe={user_prompt:m,agent:y,schedule_type:Me,schedule_values:we.length>0?we:null,schedule_enabled:P!=="ondemand"&&Y,requires_confirmation:ke?L:!1,yolo_mode:N,foreground_mode:J,command:_?re:""};xe&&(Pe.id=e.id);const Gt=await c(xe?"task.update":"task.create",Pe,{timeout:45e3});if(Gt.error){R(Gt.error);return}if(xe||localStorage.setItem("palmier:lastAgent",y),_&&!xe){s(Gt);try{const Hn=await c("task.run",{id:Gt.id});Hn.run_id?l(Gt.id,Hn.run_id):Hn.error||l(Gt.id)}catch{}return}s(Gt)}catch(we){R(we instanceof Error?we.message:String(we))}finally{oe(!1)}}const He=xe?"Save":_?"Run":(ke||O)&&Y?"Schedule":"Save";return w.jsx("div",{className:"task-form-overlay",children:w.jsx("div",{className:"task-form",children:v?w.jsx(ok,{permissions:e==null?void 0:e.permissions}):w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"task-form-header",children:w.jsx("h2",{children:e?"Edit Task":"New Task"})}),U&&w.jsx("div",{className:"form-error",children:U}),w.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:m,onChange:we=>d(we.target.value),placeholder:_?"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:I}),w.jsxs("div",{className:"plan-actions",children:[w.jsxs("div",{className:"agent-picker-section-inline",children:[w.jsx("span",{className:"agent-picker-label",children:"Run with"}),w.jsx("select",{className:"form-select form-select-sm",value:y,onChange:we=>g(we.target.value),disabled:I,children:n.map(we=>w.jsx("option",{value:we.key,children:we.label},we.key))})]}),A&&w.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[w.jsx("input",{type:"checkbox",checked:N,onChange:we=>G(we.target.checked),disabled:I}),"Yolo"]}),A&&N&&w.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),b&&w.jsx("div",{className:"granted-permissions-row",children:w.jsx("button",{className:"btn btn-link",onClick:()=>k(!0),children:"Granted Permissions"})})]}),w.jsx("div",{className:"toggles-group",children:w.jsxs("div",{className:"schedule-section",children:[w.jsx("h3",{className:"schedule-section-title",children:"Schedule"}),w.jsxs("select",{className:"form-select",value:P,onChange:we=>wt(we.target.value),disabled:I,children:[w.jsx("option",{value:"ondemand",children:"On Demand"}),w.jsx("option",{value:"specific_times",children:"Specific Times"}),w.jsx("option",{value:"hourly",children:"Hourly"}),w.jsx("option",{value:"daily",children:"Daily"}),w.jsx("option",{value:"weekly",children:"Weekly"}),w.jsx("option",{value:"monthly",children:"Monthly"}),w.jsx("option",{value:"on_new_notification",children:"On New Push Notification"}),w.jsx("option",{value:"on_new_sms",children:"On New SMS"}),w.jsx("option",{value:"command",children:"Command-triggered"})]}),O&&w.jsx("div",{className:"schedule-reactive",children:w.jsxs("p",{className:"command-help-text",children:[P==="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 ",P==="on_new_notification"?"notification":"SMS","”."]})}),_&&w.jsxs("div",{className:"schedule-reactive",children:[w.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."}),w.jsx("input",{ref:ye,className:"form-input form-input-mono",type:"text",value:re,onChange:we=>W(we.target.value),placeholder:"gws gmail +watch --project my-project",disabled:I})]}),ke&&P!=="hourly"&&w.jsxs(w.Fragment,{children:[ae.map((we,Me)=>w.jsxs("div",{className:"trigger-row-card",children:[w.jsxs("div",{className:"trigger-row-content",children:[P==="daily"&&w.jsx("input",{className:"form-input",type:"time",value:we.time,onChange:Pe=>ue(Me,{time:Pe.target.value})}),P==="weekly"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("select",{className:"form-select",value:we.dayOfWeek,onChange:Pe=>ue(Me,{dayOfWeek:Pe.target.value}),children:hk.map((Pe,$e)=>w.jsx("option",{value:String($e),children:Pe},$e))}),w.jsx("input",{className:"form-input",type:"time",value:we.time,onChange:Pe=>ue(Me,{time:Pe.target.value})})]}),P==="monthly"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("select",{className:"form-select",value:we.dayOfMonth,onChange:Pe=>ue(Me,{dayOfMonth:Pe.target.value}),children:Array.from({length:28},(Pe,$e)=>$e+1).map(Pe=>w.jsxs("option",{value:String(Pe),children:["Day ",Pe]},Pe))}),w.jsx("input",{className:"form-input",type:"time",value:we.time,onChange:Pe=>ue(Me,{time:Pe.target.value})})]}),P==="specific_times"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("input",{className:"form-input",type:"date",value:we.onceDate,min:new Date().toISOString().split("T")[0],onChange:Pe=>ue(Me,{onceDate:Pe.target.value})}),w.jsx("input",{className:"form-input",type:"time",value:we.onceTime,min:we.onceDate===new Date().toISOString().split("T")[0]?new Date().toTimeString().slice(0,5):void 0,onChange:Pe=>ue(Me,{onceTime:Pe.target.value})})]})]}),ae.length>1&&w.jsx("button",{className:"trigger-remove-btn",onClick:()=>Le(Me),title:"Remove trigger",children:"×"})]},Me)),w.jsx("button",{className:"trigger-add-btn",onClick:We,children:"+ Add"})]}),r==="win32"&&w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:J,onChange:we=>le(we.target.checked),disabled:I}),"Run in the foreground (host must login to Windows)"]}),ke&&w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:L,onChange:we=>K(we.target.checked),disabled:I}),"Confirm before each run"]}),P!=="ondemand"&&w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:Y,onChange:we=>$(we.target.checked),disabled:I}),"Enabled"]})]})}),!N&&Z&&!Z.supportsPermissions&&w.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",Z.label,". The task may fail if required permissions are not pre-configured."]}),w.jsxs("div",{className:"form-actions",children:[w.jsxs("button",{className:"btn btn-primary",onClick:()=>it()&&nt(),disabled:!ze||I,children:[I&&w.jsx("span",{className:"btn-spinner"}),He]}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>{Se&&m.trim()&&!confirm("You have unsaved changes. Discard?")||u()},style:{marginLeft:"auto"},children:"Cancel"})]})]})})})}function kx({pullDistance:e,refreshing:n,threshold:r}){const s=e>0||n,l=e>=r;return w.jsx("div",{className:"pull-to-refresh",style:{transform:`translateY(${e}px)`,opacity:s?Math.min(1,e/30):0},"aria-hidden":!s,children:w.jsx("div",{className:"pull-to-refresh-badge",children:n?w.jsx("div",{className:"spinner"}):w.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:[w.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),w.jsx("polyline",{points:"19 12 12 19 5 12"})]})})})}function Cx({onRefresh:e,threshold:n=70,maxPull:r=110,enabled:s=!0}){const[l,u]=D.useState(0),[c,f]=D.useState(!1),m=D.useRef(null),d=D.useRef(!1),y=D.useRef(0),g=D.useRef(!1),b=D.useRef(e);return D.useEffect(()=>{b.current=e}),D.useEffect(()=>{if(!s)return;const v=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 R=U.touches[0].clientY-m.current;if(R<=0){d.current=!1,y.current=0,u(0);return}d.current=!0;const P=Math.min(r,R*.5);y.current=P,u(P),U.cancelable&&U.preventDefault()},M=()=>{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",v,{passive:!0}),window.addEventListener("touchmove",k,{passive:!1}),window.addEventListener("touchend",M,{passive:!0}),window.addEventListener("touchcancel",M,{passive:!0}),()=>{window.removeEventListener("touchstart",v),window.removeEventListener("touchmove",k),window.removeEventListener("touchend",M),window.removeEventListener("touchcancel",M)}},[s,n,r]),{pullDistance:l,refreshing:c,threshold:n}}function xk({connected:e,hostId:n,request:r,subscribeEvents:s,agents:l,hostPlatform:u,onViewRun:c}){const[f,m]=D.useState([]),[d,y]=D.useState(!1),[g,b]=D.useState(null),[v,k]=D.useState(new Map),[M,U]=D.useState(!1),[R,P]=D.useState(void 0),q=D.useCallback(()=>{U(!1),P(void 0)},[]),ae=D.useCallback(async()=>{if(e){y(!0),b(null);try{const $=(await r("task.list")).tasks??[],N=new Map;for(const G of $)G.status&&N.set(G.id,G.status);k(N),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]);D.useEffect(()=>{e?ae():(m([]),y(!1))},[e,n,ae]);const B=Cx({onRefresh:ae,enabled:e});D.useEffect(()=>!e||!n?void 0:s(n,async $=>{const N=$.subject.split(".");if(N.length<3)return;const G=N.slice(2).join(".");let J={};try{J=JSON.parse(new TextDecoder().decode($.data))}catch{return}const le=J.event_type;if(!(le!=="running-state"&&le!=="permission-resolved"))try{const re=await r("task.status",{id:G},{timeout:5e3});if(re.error)return;k(W=>{const I=new Map(W);return I.set(G,re),I})}catch{}}),[e,n,s,r]);function L(Y){m($=>{const N=$.findIndex(G=>G.id===Y.id);if(N>=0){const G=[...$];return G[N]=Y,G}return[Y,...$]}),U(!1),P(void 0)}function K(Y){m($=>$.filter(N=>N.id!==Y)),k($=>{const N=new Map($);return N.delete(Y),N})}return w.jsxs(w.Fragment,{children:[w.jsx(kx,{pullDistance:B.pullDistance,refreshing:B.refreshing,threshold:B.threshold}),g&&w.jsxs("div",{className:"form-error",children:[g,g.toLowerCase().includes("failed to fetch")&&w.jsxs(w.Fragment,{children:[" ",w.jsx("a",{href:"#",onClick:Y=>{Y.preventDefault(),window.location.reload()},children:"Reload"})]})]}),d&&!f.length?w.jsx("div",{className:"task-list",children:[0,1,2].map(Y=>w.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[w.jsx("div",{className:"task-card-header",children:w.jsxs("div",{className:"task-card-title-row",children:[w.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),w.jsx("div",{className:"skeleton-line",style:{width:`${60+Y*12}%`}})]})}),w.jsxs("div",{className:"task-card-meta",children:[w.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},Y))}):f.length===0?w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{className:"empty-state-text",children:"No tasks yet"}),w.jsx("p",{className:"empty-state-hint",children:"Tap the + button to create your first task."})]}):w.jsx("div",{className:"task-list",children:f.map(Y=>w.jsx(lk,{task:Y,lastEvent:v.get(Y.id),onEdit:async $=>{try{const N=await r("task.get",{id:$.id});P(N.error?$:N)}catch{P($)}U(!0)},onDelete:K,onViewRun:c},Y.id))}),w.jsx("button",{className:"fab",onClick:()=>{P(void 0),U(!0)},"aria-label":"New task",title:"New task",children:w.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),w.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),M&&w.jsx(bk,{initial:R,agents:l,hostPlatform:u,onSaved:L,onRun:c,onCancel:q})]})}let aa=null;function D0(e){aa&&(e.preventDefault(),e.returnValue="")}function jh(e){const n=!!aa;aa=e;const r=!!aa;r&&!n?window.addEventListener("beforeunload",D0):!r&&n&&window.removeEventListener("beforeunload",D0)}function us(){return aa?window.confirm(aa):!0}function vk(){const e=Li(),r=kr().pathname.startsWith("/tasks"),s=!r;function l(u){us()&&e(u)}return w.jsxs(w.Fragment,{children:[w.jsxs("button",{className:`tab-btn ${s?"tab-btn-active":""}`,onClick:()=>l("/"),children:[w.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:w.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),w.jsxs("button",{className:`tab-btn ${r?"tab-btn-active":""}`,onClick:()=>l("/tasks"),children:[w.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:[w.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),w.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}const wk="modulepreload",Sk=function(e){return"/"+e},z0={},Ax=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=Sk(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":wk,y||(b.as="script"),b.crossOrigin="",b.href=d,m&&b.setAttribute("nonce",m),document.head.appendChild(b),y)return new Promise((v,k)=>{b.addEventListener("load",v),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)})},_k=ga("App",{web:()=>Ax(()=>import("./web-DOyOiwsW.js"),[]).then(e=>new e.AppWeb)});function Tx(e){const[n,r]=D.useState(()=>window.matchMedia(e).matches);return D.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 L0=!!window.__PALMIER_SERVE__,hu=zi.isNativePlatform(),Oh=[{capability:"location",label:"Location Access",permission:"location",enableMethod:"device.location.enable",disableMethod:"device.location.disable",enableParams:e=>({fcmToken:e}),disableParams:()=>({})},{capability:"notifications",label:"Notification Access",permission:"notificationListener"},{capability:"sms",label:"SMS Access",permission:"sms"},{capability:"contacts",label:"Contacts Access",permission:"contacts"},{capability:"calendar",label:"Calendar Access",permission:"calendar"},{capability:"dnd",label:"Do Not Disturb Control",permission:"dnd"},{capability:"alert",label:"Alert Access",needsFullScreenIntent:!0},{capability:"battery",label:"Battery Access"},{capability:"send-email",label:"Email Drafting",needsFullScreenIntent:!0}];function U0({daemonVersion:e,capabilityTokens:n,activeClientToken:r,request:s,onCapabilityTokensChange:l}){var xe;const{pairedHosts:u,activeHostId:c,setActiveHostId:f,removePairedHost:m,renamePairedHost:d}=ql(),y=Li(),g=Tx("(min-width: 768px)"),[b,v]=D.useState(!1),[k,M]=D.useState(!1),[U,R]=D.useState(null),[P,q]=D.useState(""),[ae,B]=D.useState(null),[L,K]=D.useState(null),[Y,$]=D.useState(null);D.useEffect(()=>{if(!hu||!Kt){$(new Set);return}Kt.getSupportedPermissions().then(({types:he})=>$(new Set(he))).catch(()=>$(new Set))},[]);function N(he){return!!(r&&(n==null?void 0:n[he])===r)}function G(he){return Y?Y.size===0?!0:!(he.permission&&!Y.has(he.permission)||he.needsFullScreenIntent&&!Y.has("fullScreenIntent")):!1}function J(he,Se){const Te={};for(const[ze,ue]of Object.entries(n??{}))Te[ze]=ue??null;Te[he]=Se?r??null:null,l==null||l(Te)}D.useEffect(()=>{if(!hu||!Kt||!s||!N("location"))return;function Se(){Kt.checkPermission({type:"location"}).then(({granted:ze})=>{ze||s("device.location.disable").then(()=>{J("location",!1)}).catch(()=>{})})}Se();const Te=_k.addListener("resume",Se);return()=>{Te.then(ze=>ze.remove())}},[n,r]),D.useEffect(()=>{if(!hu||!Kt)return;const he=Oh.map(Se=>Se.capability).filter(Se=>(n==null?void 0:n[Se])===r);Kt.setEnabledCapabilities({capabilities:he}).catch(()=>{})},[n,r]);async function le(he){var Te,ze;if(!s)return;const Se=N(he.capability);K(he.capability);try{if(Se){const Ie=he.disableMethod??"device.capability.disable",it=((Te=he.disableParams)==null?void 0:Te.call(he))??{capability:he.capability};await s(Ie,it),J(he.capability,!1);return}if(Kt&&he.permission){const Ie=await Kt.checkPermission({type:he.permission});if(!Ie.supported){console.warn(`Native build does not support permission '${he.permission}'`);return}if(!Ie.granted&&!(await Kt.requestPermission({type:he.permission})).granted)return}if(Kt&&he.needsFullScreenIntent){const Ie=await Kt.checkPermission({type:"fullScreenIntent"});if(!Ie.supported){console.warn("Native build does not support fullScreenIntent");return}if(!Ie.granted&&!(await Kt.requestPermission({type:"fullScreenIntent"})).granted)return}if(!Kt)return;const{token:ue}=await Kt.getFcmToken();if(!ue){console.warn("No FCM token available");return}const Le=Oh.map(Ie=>Ie.capability).filter(Ie=>Ie===he.capability||(n==null?void 0:n[Ie])===r);await Kt.setEnabledCapabilities({capabilities:Le});const We=he.enableMethod??"device.capability.enable",wt=((ze=he.enableParams)==null?void 0:ze.call(he,ue))??{capability:he.capability,fcmToken:ue};await s(We,wt),J(he.capability,!0)}catch(ue){console.error(`Failed to toggle ${he.capability}:`,ue)}finally{K(null)}}const re=D.useRef(null),W=D.useRef(null),I=D.useCallback(()=>{M(!0)},[]);function oe(){k&&(v(!1),M(!1))}function ye(){M(!1),v(!0)}function ke(he,Se){R(he),q(Se)}function _(){U&&P.trim()&&d(U,P.trim()),R(null),q("")}function O(){R(null),q("")}D.useEffect(()=>{U&&W.current&&(W.current.focus(),W.current.select())},[U]),D.useEffect(()=>{if(!b||k)return;function he(Se){Se.key==="Escape"&&I()}return document.addEventListener("keydown",he),()=>{document.removeEventListener("keydown",he)}},[b,k,I]);const Z=w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"drawer-header",children:[w.jsx("span",{className:"drawer-title",children:"Palmier"}),!g&&w.jsx("button",{className:"drawer-close-btn",onClick:I,"aria-label":"Close menu",children:w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:w.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),!L0&&u.length>0&&w.jsxs("div",{className:"drawer-section",children:[w.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),w.jsx("div",{className:"host-picker-inline",children:w.jsx("div",{className:"host-picker-list",role:"listbox",children:u.map(he=>{const Se=he.hostId===c,Te=U===he.hostId,ze=he.name||he.hostId.slice(0,8);return w.jsx("div",{className:"host-picker-item-wrapper",children:w.jsxs("div",{className:`host-picker-item ${Se?"host-picker-item-active":""}`,onClick:()=>{if(!Te&&!Se){if(!us())return;f(he.hostId),g||I()}},role:"option","aria-selected":Se,children:[Te?w.jsx("input",{ref:W,className:"form-input host-picker-rename-input",type:"text",value:P,onChange:ue=>q(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"&&_(),ue.key==="Escape"&&O()},onBlur:_,onClick:ue=>ue.stopPropagation()}):w.jsx("span",{className:"host-picker-item-name",children:ze}),w.jsxs("div",{className:"host-picker-item-actions",children:[Se&&!Te&&w.jsx("button",{className:"host-picker-edit-btn",onClick:ue=>{ue.stopPropagation(),ke(he.hostId,ze)},"aria-label":"Rename host",children:w.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:w.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"})})}),!Se&&w.jsx("button",{className:"host-picker-delete-btn",onClick:ue=>{ue.stopPropagation(),B(he.hostId)},"aria-label":`Unpair ${ze}`,children:w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:w.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"})})})]})]})},he.hostId)})})})]}),!L0&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-divider"}),w.jsx("div",{className:"drawer-section",children:w.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{us()&&(y("/pair"),g||I())},children:"Pair New Host"})})]}),hu&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-divider"}),w.jsx("div",{className:"drawer-section",children:Oh.filter(G).map(he=>{const Se=N(he.capability);return w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:he.label}),w.jsx("button",{className:`toggle-switch ${Se?"toggle-switch-on":""}`,onClick:()=>le(he),disabled:L===he.capability,role:"switch","aria-checked":Se,children:w.jsx("span",{className:"toggle-switch-thumb"})})]},he.capability)})})]}),w.jsxs("div",{className:"drawer-footer",children:[e&&w.jsxs("div",{className:"drawer-version",children:["Palmier v",e]}),w.jsxs("div",{className:"drawer-legal",children:[w.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),w.jsx("span",{className:"drawer-legal-sep",children:"·"}),w.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),A=ae&&_u.createPortal(w.jsx("div",{className:"confirm-modal-overlay",onClick:()=>B(null),children:w.jsxs("div",{className:"confirm-modal",onClick:he=>he.stopPropagation(),children:[w.jsx("h2",{className:"confirm-modal-title",children:"Delete host?"}),w.jsxs("p",{className:"confirm-modal-message",children:['"',((xe=u.find(he=>he.hostId===ae))==null?void 0:xe.name)||ae.slice(0,8),'" will be unpaired from this device.']}),w.jsxs("div",{className:"confirm-modal-actions",children:[w.jsx("button",{className:"btn btn-secondary",onClick:()=>B(null),children:"Cancel"}),w.jsx("button",{className:"btn btn-danger",onClick:()=>{m(ae),B(null)},children:"Delete"})]})]})}),document.body);return g?w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:re,children:Z}),A]}):w.jsxs(w.Fragment,{children:[w.jsx("button",{className:"hamburger-btn",onClick:ye,"aria-label":"Open menu",children:w.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:w.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),b&&_u.createPortal(w.jsx("div",{className:`drawer-overlay ${k?"drawer-overlay-closing":""}`,onClick:I,onAnimationEnd:oe,children:w.jsx("div",{className:`drawer-panel ${k?"drawer-panel-closing":""}`,ref:re,onClick:he=>he.stopPropagation(),children:Z})}),document.body),A]})}function B0(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 Ek({agents:e,onStarted:n}){const{request:r}=Vu(),[s,l]=D.useState(""),[u,c]=D.useState(()=>B0(e)),[f,m]=D.useState(!1),[d,y]=D.useState(!1),[g,b]=D.useState(null);D.useEffect(()=>{e.length&&(e.find(q=>q.key===u)||c(B0(e)))},[e,u]),D.useEffect(()=>{const q=s.trim().length>0;return jh(q?"Your session draft will be lost. Continue?":null),()=>jh(null)},[s]);const v=e.find(q=>q.key===u),k=!!(v!=null&&v.supportsYolo);D.useEffect(()=>{!k&&f&&m(!1)},[k,f]);const M=!!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 R(){if(!(!M||!U())){y(!0),b(null);try{const q=await r("task.run_oneoff",{user_prompt:s,agent:u,yolo_mode:f});if(q.error){b(q.error);return}localStorage.setItem("palmier:lastAgent",u),l(""),jh(null),q.task_id&&n(q.task_id,q.run_id)}catch(q){b(q instanceof Error?q.message:String(q))}finally{y(!1)}}}function P(q){q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&(q.preventDefault(),R())}return w.jsxs("div",{className:"session-composer",children:[g&&w.jsx("div",{className:"form-error",children:g}),w.jsx("textarea",{className:"session-composer-textarea",value:s,onChange:q=>l(q.target.value),onKeyDown:P,placeholder:"What can I do for you?",rows:3,disabled:d}),w.jsxs("div",{className:"session-composer-controls",children:[w.jsxs("div",{className:"agent-picker-section-inline",children:[w.jsx("span",{className:"agent-picker-label",children:"Run with"}),w.jsx("select",{className:"form-select form-select-sm",value:u,onChange:q=>c(q.target.value),disabled:d||!e.length,children:e.map(q=>w.jsx("option",{value:q.key,children:q.label},q.key))})]}),k&&w.jsxs("label",{className:"session-composer-yolo",children:[w.jsx("input",{type:"checkbox",checked:f,onChange:q=>m(q.target.checked),disabled:d}),"Yolo"]}),w.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:R,disabled:!M,"aria-label":"Run session",title:"Run session",children:d?w.jsx("span",{className:"btn-spinner"}):w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),w.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),k&&f&&w.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const kk=10;function Ck({connected:e,hostId:n,request:r,subscribeEvents:s,agents:l,filterTaskId:u,onClearFilter:c}){const[f,m]=D.useState([]),[d,y]=D.useState(0),[g,b]=D.useState(!1),[v,k]=D.useState(!1),M=Li(),U=D.useRef(null),R=D.useCallback(G=>{const J={offset:G,limit:kk};return u&&(J.task_id=u),J},[u]),P=D.useCallback(async(G,J)=>{if(e){J?k(!0):b(!0);try{const le=await r("taskrun.list",R(G)),re=le.entries??[];y(le.total??0),m(J?W=>{const I=new Set(W.map(ye=>`${ye.task_id}:${ye.run_id}`)),oe=re.filter(ye=>!I.has(`${ye.task_id}:${ye.run_id}`));return[...W,...oe]}:re)}catch(le){le instanceof Error&&le.message==="Not connected"||console.error("Failed to load runs:",le)}finally{b(!1),k(!1)}}},[e,r,R]);D.useEffect(()=>{e?(m([]),y(0),P(0,!1)):(m([]),y(0))},[e,n,P,u]);const q=Cx({onRefresh:()=>P(0,!1),enabled:e});D.useEffect(()=>!e||!n?void 0:s(n,async J=>{try{const le=JSON.parse(new TextDecoder().decode(J.data));if(le.event_type==="running-state"&&le.running_state&&["monitoring","started","finished","failed","aborted"].includes(le.running_state)){const re=await r("taskrun.list",R(0)),W=re.entries??[];y(re.total??0),m(I=>{const oe=new Map(W.map(O=>[`${O.task_id}:${O.run_id}`,O])),ye=I.map(O=>{const Z=`${O.task_id}:${O.run_id}`;return oe.get(Z)??O}),ke=new Set(ye.map(O=>`${O.task_id}:${O.run_id}`));return[...W.filter(O=>!ke.has(`${O.task_id}:${O.run_id}`)),...ye]})}}catch{}}),[e,n,s,r]),D.useEffect(()=>{const G=U.current;if(!G)return;const J=new IntersectionObserver(le=>{le[0].isIntersecting&&!v&&f.length<d&&P(f.length,!0)},{threshold:.1});return J.observe(G),()=>J.disconnect()},[f.length,d,v,P]);function ae(G,J){if(!G||!J)return"";const le=Math.round((J-G)/1e3);if(le<60)return`${le}s`;const re=Math.floor(le/60),W=le%60;return`${re}m ${W}s`}const B={monitoring:"Monitoring",started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function L(G,J){us()&&M(`/runs/${G}/${encodeURIComponent(J)}`)}const K=!u&&w.jsx(Ek,{agents:l,onStarted:(G,J)=>{M(J?`/runs/${encodeURIComponent(G)}/${encodeURIComponent(J)}`:`/runs/${encodeURIComponent(G)}`)}}),Y=w.jsx(kx,{pullDistance:q.pullDistance,refreshing:q.refreshing,threshold:q.threshold}),$=u&&c&&w.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:w.jsxs("span",{className:"sessions-filter-chip",children:["Filtered by task",w.jsx("button",{onClick:c,"aria-label":"Clear filter",children:"×"})]})});function N(G){if(G==="failed")return"var(--color-error)";if(G==="aborted")return"var(--color-warning, #d97706)"}return g&&f.length===0&&e?w.jsxs(w.Fragment,{children:[Y,K,w.jsx("div",{className:"task-list",children:[0,1,2].map(G=>w.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[w.jsx("div",{className:"task-card-header",children:w.jsx("div",{className:"task-card-title-row",children:w.jsx("div",{className:"skeleton-line",style:{width:`${70+G*10}%`}})})}),w.jsx("div",{className:"task-card-meta",children:w.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},G))})]}):!e||g&&f.length===0?w.jsxs(w.Fragment,{children:[Y,K,w.jsx("div",{className:"sessions-view",children:w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{className:"empty-state-text",children:"Sessions"}),w.jsx("p",{className:"empty-state-hint",children:"Your sessions will appear here"})]})})]}):f.length===0?w.jsxs(w.Fragment,{children:[Y,K,$,w.jsx("div",{className:"sessions-view",children:w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),w.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."})]})})]}):w.jsxs(w.Fragment,{children:[Y,K,$,w.jsxs("div",{className:"task-list",children:[f.map((G,J)=>w.jsxs("div",{className:"sessions-card",onClick:()=>!G.error&&L(G.task_id,G.run_id),children:[w.jsxs("div",{className:"sessions-card-body",children:[w.jsx("h3",{className:"sessions-card-name",children:G.task_name||G.task_id}),w.jsxs("div",{className:"sessions-card-meta",children:[G.running_state==="started"?w.jsx("span",{className:"status-spinner","aria-label":"Running",children:w.jsx("span",{})}):w.jsx("span",{style:{color:N(G.running_state)},children:B[G.running_state??""]??G.running_state}),G.end_time&&w.jsx("span",{children:zu(G.end_time)}),G.start_time&&G.end_time&&w.jsx("span",{style:{color:"var(--color-muted)"},children:ae(G.start_time,G.end_time)}),G.error&&w.jsx("span",{style:{color:"var(--color-muted)"},children:G.error})]})]}),w.jsx("span",{className:"sessions-card-chevron",children:"›"})]},`${G.task_id}-${G.run_id}-${J}`)),w.jsx("div",{ref:U,style:{height:1}}),v&&w.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:w.jsx("div",{className:"spinner"})})]})]})}function Ak(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Tk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ok={};function P0(e,n){return(Ok.jsx?jk:Tk).test(e)}const Nk=/[ \t\n\f\r]/g;function Rk(e){return typeof e=="object"?e.type==="text"?q0(e.value):!1:q0(e)}function q0(e){return e.replace(Nk,"")===""}class Fl{constructor(n,r,s){this.normal=r,this.property=n,s&&(this.space=s)}}Fl.prototype.normal={};Fl.prototype.property={};Fl.prototype.space=void 0;function jx(e,n){const r={},s={};for(const l of e)Object.assign(r,l.property),Object.assign(s,l.normal);return new Fl(r,s,n)}function hd(e){return e.toLowerCase()}class kn{constructor(n,r){this.attribute=r,this.property=n}}kn.prototype.attribute="";kn.prototype.booleanish=!1;kn.prototype.boolean=!1;kn.prototype.commaOrSpaceSeparated=!1;kn.prototype.commaSeparated=!1;kn.prototype.defined=!1;kn.prototype.mustUseProperty=!1;kn.prototype.number=!1;kn.prototype.overloadedBoolean=!1;kn.prototype.property="";kn.prototype.spaceSeparated=!1;kn.prototype.space=void 0;let Mk=0;const Ve=fs(),Yt=fs(),dd=fs(),ve=fs(),At=fs(),la=fs(),Dn=fs();function fs(){return 2**++Mk}const md=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:Yt,commaOrSpaceSeparated:Dn,commaSeparated:la,number:ve,overloadedBoolean:dd,spaceSeparated:At},Symbol.toStringTag,{value:"Module"})),Nh=Object.keys(md);class Pd extends kn{constructor(n,r,s,l){let u=-1;if(super(n,r),H0(this,"space",l),typeof s=="number")for(;++u<Nh.length;){const c=Nh[u];H0(this,Nh[u],(s&md[c])===md[c])}}}Pd.prototype.defined=!0;function H0(e,n,r){r&&(e[n]=r)}function ya(e){const n={},r={};for(const[s,l]of Object.entries(e.properties)){const u=new Pd(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),n[s]=u,r[hd(s)]=s,r[hd(u.attribute)]=s}return new Fl(n,r,e.space)}const Ox=ya({properties:{ariaActiveDescendant:null,ariaAtomic:Yt,ariaAutoComplete:null,ariaBusy:Yt,ariaChecked:Yt,ariaColCount:ve,ariaColIndex:ve,ariaColSpan:ve,ariaControls:At,ariaCurrent:null,ariaDescribedBy:At,ariaDetails:null,ariaDisabled:Yt,ariaDropEffect:At,ariaErrorMessage:null,ariaExpanded:Yt,ariaFlowTo:At,ariaGrabbed:Yt,ariaHasPopup:null,ariaHidden:Yt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:At,ariaLevel:ve,ariaLive:null,ariaModal:Yt,ariaMultiLine:Yt,ariaMultiSelectable:Yt,ariaOrientation:null,ariaOwns:At,ariaPlaceholder:null,ariaPosInSet:ve,ariaPressed:Yt,ariaReadOnly:Yt,ariaRelevant:null,ariaRequired:Yt,ariaRoleDescription:At,ariaRowCount:ve,ariaRowIndex:ve,ariaRowSpan:ve,ariaSelected:Yt,ariaSetSize:ve,ariaSort:null,ariaValueMax:ve,ariaValueMin:ve,ariaValueNow:ve,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Nx(e,n){return n in e?e[n]:n}function Rx(e,n){return Nx(e,n.toLowerCase())}const Dk=ya({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:la,acceptCharset:At,accessKey:At,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:At,autoFocus:Ve,autoPlay:Ve,blocking:At,capture:null,charSet:null,checked:Ve,cite:null,className:At,cols:ve,colSpan:null,content:null,contentEditable:Yt,controls:Ve,controlsList:At,coords:ve|la,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:dd,draggable:Yt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:At,height:ve,hidden:dd,high:ve,href:null,hrefLang:null,htmlFor:At,httpEquiv:At,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:At,itemRef:At,itemScope:Ve,itemType:At,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:ve,manifest:null,max:null,maxLength:ve,media:null,method:null,min:null,minLength:ve,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,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:Ve,optimum:ve,pattern:null,ping:At,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:At,required:Ve,reversed:Ve,rows:ve,rowSpan:ve,sandbox:At,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shape:null,size:ve,sizes:null,slot:null,span:ve,spellCheck:Yt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ve,step:null,style:null,tabIndex:ve,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:Yt,width:ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:At,axis:null,background:null,bgColor:null,border:ve,borderColor:null,bottomMargin:ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:ve,leftMargin:ve,link:null,longDesc:null,lowSrc:null,marginHeight:ve,marginWidth:ve,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:ve,rules:null,scheme:null,scrolling:Yt,standby:null,summary:null,text:null,topMargin:ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ve,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ve,disableRemotePlayback:Ve,prefix:null,property:null,results:ve,security:null,unselectable:null},space:"html",transform:Rx}),zk=ya({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:Dn,accentHeight:ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ve,amplitude:ve,arabicForm:null,ascent:ve,attributeName:null,attributeType:null,azimuth:ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ve,by:null,calcMode:null,capHeight:ve,className:At,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:ve,diffuseConstant:ve,direction:null,display:null,dur:null,divisor:ve,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:ve,enableBackground:null,end:null,event:null,exponent:ve,externalResourcesRequired:null,fill:null,fillOpacity:ve,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:la,g2:la,glyphName:la,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ve,horizOriginX:ve,horizOriginY:ve,id:null,ideographic:ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ve,k:ve,k1:ve,k2:ve,k3:ve,k4:ve,kernelMatrix:Dn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ve,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:ve,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:ve,overlineThickness:ve,paintOrder:null,panose1:null,path:null,pathLength:ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:At,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ve,pointsAtY:ve,pointsAtZ:ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Dn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Dn,rev:Dn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Dn,requiredFeatures:Dn,requiredFonts:Dn,requiredFormats:Dn,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:ve,specularExponent:ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ve,strikethroughThickness:ve,string:null,stroke:null,strokeDashArray:Dn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ve,strokeOpacity:ve,strokeWidth:null,style:null,surfaceScale:ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Dn,tabIndex:ve,tableValues:null,target:null,targetX:ve,targetY:ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Dn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ve,underlineThickness:ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ve,values:null,vAlphabetic:ve,vMathematical:ve,vectorEffect:null,vHanging:ve,vIdeographic:ve,version:null,vertAdvY:ve,vertOriginX:ve,vertOriginY:ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Nx}),Mx=ya({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()}}),Dx=ya({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Rx}),zx=ya({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),Lk={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"},Uk=/[A-Z]/g,I0=/-[a-z]/g,Bk=/^data[-\w.:]+$/i;function Pk(e,n){const r=hd(n);let s=n,l=kn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Bk.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(I0,Hk);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!I0.test(u)){let c=u.replace(Uk,qk);c.charAt(0)!=="-"&&(c="-"+c),n="data"+c}}l=Pd}return new l(s,n)}function qk(e){return"-"+e.toLowerCase()}function Hk(e){return e.charAt(1).toUpperCase()}const Ik=jx([Ox,Dk,Mx,Dx,zx],"html"),qd=jx([Ox,zk,Mx,Dx,zx],"svg");function Fk(e){return e.join(" ").trim()}var Xs={},Rh,F0;function $k(){if(F0)return Rh;F0=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",v="declaration";function k(U,R){if(typeof U!="string")throw new TypeError("First argument must be a string");if(!U)return[];R=R||{};var P=1,q=1;function ae(re){var W=re.match(n);W&&(P+=W.length);var I=re.lastIndexOf(m);q=~I?re.length-I:q+re.length}function B(){var re={line:P,column:q};return function(W){return W.position=new L(re),$(),W}}function L(re){this.start=re,this.end={line:P,column:q},this.source=R.source}L.prototype.content=U;function K(re){var W=new Error(R.source+":"+P+":"+q+": "+re);if(W.reason=re,W.filename=R.source,W.line=P,W.column=q,W.source=U,!R.silent)throw W}function Y(re){var W=re.exec(U);if(W){var I=W[0];return ae(I),U=U.slice(I.length),W}}function $(){Y(r)}function N(re){var W;for(re=re||[];W=G();)W!==!1&&re.push(W);return re}function G(){var re=B();if(!(d!=U.charAt(0)||y!=U.charAt(1))){for(var W=2;g!=U.charAt(W)&&(y!=U.charAt(W)||d!=U.charAt(W+1));)++W;if(W+=2,g===U.charAt(W-1))return K("End of comment missing");var I=U.slice(2,W-2);return q+=2,ae(I),U=U.slice(W),q+=2,re({type:b,comment:I})}}function J(){var re=B(),W=Y(s);if(W){if(G(),!Y(l))return K("property missing ':'");var I=Y(u),oe=re({type:v,property:M(W[0].replace(e,g)),value:I?M(I[0].replace(e,g)):g});return Y(c),oe}}function le(){var re=[];N(re);for(var W;W=J();)W!==!1&&(re.push(W),N(re));return re}return $(),le()}function M(U){return U?U.replace(f,g):g}return Rh=k,Rh}var $0;function Yk(){if($0)return Xs;$0=1;var e=Xs&&Xs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Xs,"__esModule",{value:!0}),Xs.default=r;const n=e($k());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 Xs}var pl={},Y0;function Gk(){if(Y0)return pl;Y0=1,Object.defineProperty(pl,"__esModule",{value:!0}),pl.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 pl.camelCase=m,pl}var gl,G0;function Vk(){if(G0)return gl;G0=1;var e=gl&&gl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},n=e(Yk()),r=Gk();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,gl=s,gl}var Jk=Vk();const Xk=Nb(Jk),Lx=Ux("end"),Hd=Ux("start");function Ux(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 Kk(e){const n=Hd(e),r=Lx(e);if(n&&r)return{start:n,end:r}}function Al(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?V0(e.position):"start"in e||"end"in e?V0(e):"line"in e||"column"in e?pd(e):""}function pd(e){return J0(e&&e.line)+":"+J0(e&&e.column)}function V0(e){return pd(e&&e.start)+"-"+pd(e&&e.end)}function J0(e){return e&&typeof e=="number"?e:1}class un 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=Al(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}}un.prototype.file="";un.prototype.name="";un.prototype.reason="";un.prototype.message="";un.prototype.stack="";un.prototype.column=void 0;un.prototype.line=void 0;un.prototype.ancestors=void 0;un.prototype.cause=void 0;un.prototype.fatal=void 0;un.prototype.place=void 0;un.prototype.ruleId=void 0;un.prototype.source=void 0;const Id={}.hasOwnProperty,Qk=new Map,Zk=/[A-Z]/g,Wk=new Set(["table","tbody","thead","tfoot","tr"]),eC=new Set(["td","th"]),Bx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function tC(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=uC(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=oC(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"?qd:Ik,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=Px(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function Px(e,n,r){if(n.type==="element")return nC(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return rC(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return sC(e,n,r);if(n.type==="mdxjsEsm")return iC(e,n);if(n.type==="root")return aC(e,n,r);if(n.type==="text")return lC(e,n)}function nC(e,n,r){const s=e.schema;let l=s;n.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=qd,e.schema=l),e.ancestors.push(n);const u=Hx(e,n.tagName,!1),c=cC(e,n);let f=$d(e,n);return Wk.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!Rk(m):!0})),qx(e,c,u,n),Fd(c,f),e.ancestors.pop(),e.schema=s,e.create(n,u,c,r)}function rC(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)}zl(e,n.position)}function iC(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);zl(e,n.position)}function sC(e,n,r){const s=e.schema;let l=s;n.name==="svg"&&s.space==="html"&&(l=qd,e.schema=l),e.ancestors.push(n);const u=n.name===null?e.Fragment:Hx(e,n.name,!0),c=fC(e,n),f=$d(e,n);return qx(e,c,u,n),Fd(c,f),e.ancestors.pop(),e.schema=s,e.create(n,u,c,r)}function aC(e,n,r){const s={};return Fd(s,$d(e,n)),e.create(n,e.Fragment,s,r)}function lC(e,n){return n.value}function qx(e,n,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=s)}function Fd(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function oC(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 uC(e,n){return r;function r(s,l,u,c){const f=Array.isArray(u.children),m=Hd(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 cC(e,n){const r={};let s,l;for(l in n.properties)if(l!=="children"&&Id.call(n.properties,l)){const u=hC(e,l,n.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&eC.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 fC(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 zl(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 zl(e,n.position);else u=s.value===null?!0:s.value;r[l]=u}return r}function $d(e,n){const r=[];let s=-1;const l=e.passKeys?new Map:Qk;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=Px(e,u,c);f!==void 0&&r.push(f)}return r}function hC(e,n,r){const s=Pk(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?Ak(r):Fk(r)),s.property==="style"){let l=typeof r=="object"?r:dC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=mC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?Lk[s.property]||s.property:s.attribute,r]}}function dC(e,n){try{return Xk(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new un("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=Bx+"#cannot-parse-style-attribute",l}}function Hx(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=P0(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=P0(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(s.type==="Literal"){const l=s.value;return Id.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);zl(e)}function zl(e,n){const r=new un("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=Bx+"#cannot-handle-mdx-estrees-without-createevaluater",r}function mC(e){const n={};let r;for(r in e)Id.call(e,r)&&(n[pC(r)]=e[r]);return n}function pC(e){let n=e.replace(Zk,gC);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function gC(e){return"-"+e.toLowerCase()}const Mh={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"]},yC={};function Yd(e,n){const r=yC,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Ix(e,s,l)}function Ix(e,n,r){if(bC(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 X0(e.children,n,r)}return Array.isArray(e)?X0(e,n,r):""}function X0(e,n,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=Ix(e[l],n,r);return s.join("")}function bC(e){return!!(e&&typeof e=="object")}const K0=document.createElement("i");function Gd(e){const n="&"+e+";";K0.innerHTML=n;const r=K0.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function Pn(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 nr(e,n){return e.length>0?(Pn(e,e.length,0,n),e):n}const Q0={}.hasOwnProperty;function Fx(e){const n={};let r=-1;for(;++r<e.length;)xC(n,e[r]);return n}function xC(e,n){let r;for(r in n){const l=(Q0.call(e,r)?e[r]:void 0)||(e[r]={}),u=n[r];let c;if(u)for(c in u){Q0.call(l,c)||(l[c]=[]);const f=u[c];vC(l[c],Array.isArray(f)?f:f?[f]:[])}}}function vC(e,n){let r=-1;const s=[];for(;++r<n.length;)(n[r].add==="after"?e:s).push(n[r]);Pn(e,0,0,s)}function $x(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 gn=Bi(/[A-Za-z]/),on=Bi(/[\dA-Za-z]/),wC=Bi(/[#-'*+\--9=?A-Z^-~]/);function Lu(e){return e!==null&&(e<32||e===127)}const gd=Bi(/\d/),SC=Bi(/[\dA-Fa-f]/),_C=Bi(/[!-/:-@[-`{-~]/);function Ue(e){return e!==null&&e<-2}function kt(e){return e!==null&&(e<0||e===32)}function Ze(e){return e===-2||e===-1||e===32}const Ju=Bi(new RegExp("\\p{P}|\\p{S}","u")),cs=Bi(/\s/);function Bi(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function ba(e){const n=[];let r=-1,s=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&on(e.charCodeAt(r+1))&&on(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 st(e,n,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return Ze(m)?(e.enter(r),f(m)):n(m)}function f(m){return Ze(m)&&u++<l?(e.consume(m),f):(e.exit(r),n(m))}}const EC={tokenize:kC};function kC(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"),st(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 Ue(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const CC={tokenize:AC},Z0={tokenize:TC};function AC(e){const n=this,r=[];let s=0,l,u,c;return f;function f(q){if(s<r.length){const ae=r[s];return n.containerState=ae[1],e.attempt(ae[0].continuation,m,d)(q)}return d(q)}function m(q){if(s++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,l&&P();const ae=n.events.length;let B=ae,L;for(;B--;)if(n.events[B][0]==="exit"&&n.events[B][1].type==="chunkFlow"){L=n.events[B][1].end;break}R(s);let K=ae;for(;K<n.events.length;)n.events[K][1].end={...L},K++;return Pn(n.events,B+1,0,n.events.slice(ae)),n.events.length=K,d(q)}return f(q)}function d(q){if(s===r.length){if(!l)return b(q);if(l.currentConstruct&&l.currentConstruct.concrete)return k(q);n.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(Z0,y,g)(q)}function y(q){return l&&P(),R(s),b(q)}function g(q){return n.parser.lazy[n.now().line]=s!==r.length,c=n.now().offset,k(q)}function b(q){return n.containerState={},e.attempt(Z0,v,k)(q)}function v(q){return s++,r.push([n.currentConstruct,n.containerState]),b(q)}function k(q){if(q===null){l&&P(),R(0),e.consume(q);return}return l=l||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),M(q)}function M(q){if(q===null){U(e.exit("chunkFlow"),!0),R(0),e.consume(q);return}return Ue(q)?(e.consume(q),U(e.exit("chunkFlow")),s=0,n.interrupt=void 0,f):(e.consume(q),M)}function U(q,ae){const B=n.sliceStream(q);if(ae&&B.push(null),q.previous=u,u&&(u.next=q),u=q,l.defineSkip(q.start),l.write(B),n.parser.lazy[q.start.line]){let L=l.events.length;for(;L--;)if(l.events[L][1].start.offset<c&&(!l.events[L][1].end||l.events[L][1].end.offset>c))return;const K=n.events.length;let Y=K,$,N;for(;Y--;)if(n.events[Y][0]==="exit"&&n.events[Y][1].type==="chunkFlow"){if($){N=n.events[Y][1].end;break}$=!0}for(R(s),L=K;L<n.events.length;)n.events[L][1].end={...N},L++;Pn(n.events,Y+1,0,n.events.slice(K)),n.events.length=L}}function R(q){let ae=r.length;for(;ae-- >q;){const B=r[ae];n.containerState=B[1],B[0].exit.call(n,e)}r.length=q}function P(){l.write([null]),u=void 0,l=void 0,n.containerState._closeFlow=void 0}}function TC(e,n,r){return st(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ha(e){if(e===null||kt(e)||cs(e))return 1;if(Ju(e))return 2}function Xu(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 yd={name:"attention",resolveAll:jC,tokenize:OC};function jC(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};W0(g,-m),W0(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=nr(d,[["enter",e[s][1],n],["exit",e[s][1],n]])),d=nr(d,[["enter",l,n],["enter",c,n],["exit",c,n],["enter",u,n]]),d=nr(d,Xu(n.parser.constructs.insideSpan.null,e.slice(s+1,r),n)),d=nr(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=nr(d,[["enter",e[r][1],n],["exit",e[r][1],n]])):y=0,Pn(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 OC(e,n){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=ha(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=ha(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 W0(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const NC={name:"autolink",tokenize:RC};function RC(e,n,r){let s=0;return l;function l(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(v){return gn(v)?(e.consume(v),c):v===64?r(v):d(v)}function c(v){return v===43||v===45||v===46||on(v)?(s=1,f(v)):d(v)}function f(v){return v===58?(e.consume(v),s=0,m):(v===43||v===45||v===46||on(v))&&s++<32?(e.consume(v),f):(s=0,d(v))}function m(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),n):v===null||v===32||v===60||Lu(v)?r(v):(e.consume(v),m)}function d(v){return v===64?(e.consume(v),y):wC(v)?(e.consume(v),d):r(v)}function y(v){return on(v)?g(v):r(v)}function g(v){return v===46?(e.consume(v),s=0,y):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),n):b(v)}function b(v){if((v===45||on(v))&&s++<63){const k=v===45?b:g;return e.consume(v),k}return r(v)}}const $l={partial:!0,tokenize:MC};function MC(e,n,r){return s;function s(u){return Ze(u)?st(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Ue(u)?n(u):r(u)}}const Yx={continuation:{tokenize:zC},exit:LC,name:"blockQuote",tokenize:DC};function DC(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 Ze(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(c))}}function zC(e,n,r){const s=this;return l;function l(c){return Ze(c)?st(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(Yx,n,r)(c)}}function LC(e){e.exit("blockQuote")}const Gx={name:"characterEscape",tokenize:UC};function UC(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 _C(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(u)}}const Vx={name:"characterReference",tokenize:BC};function BC(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=on,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=SC,y):(e.enter("characterReferenceValue"),u=7,c=gd,y(g))}function y(g){if(g===59&&l){const b=e.exit("characterReferenceValue");return c===on&&!Gd(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 eb={partial:!0,tokenize:qC},tb={concrete:!0,name:"codeFenced",tokenize:PC};function PC(e,n,r){const s=this,l={partial:!0,tokenize:B};let u=0,c=0,f;return m;function m(L){return d(L)}function d(L){const K=s.events[s.events.length-1];return u=K&&K[1].type==="linePrefix"?K[2].sliceSerialize(K[1],!0).length:0,f=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(L)}function y(L){return L===f?(c++,e.consume(L),y):c<3?r(L):(e.exit("codeFencedFenceSequence"),Ze(L)?st(e,g,"whitespace")(L):g(L))}function g(L){return L===null||Ue(L)?(e.exit("codeFencedFence"),s.interrupt?n(L):e.check(eb,M,ae)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(L))}function b(L){return L===null||Ue(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(L)):Ze(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),st(e,v,"whitespace")(L)):L===96&&L===f?r(L):(e.consume(L),b)}function v(L){return L===null||Ue(L)?g(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(L))}function k(L){return L===null||Ue(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(L)):L===96&&L===f?r(L):(e.consume(L),k)}function M(L){return e.attempt(l,ae,U)(L)}function U(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),R}function R(L){return u>0&&Ze(L)?st(e,P,"linePrefix",u+1)(L):P(L)}function P(L){return L===null||Ue(L)?e.check(eb,M,ae)(L):(e.enter("codeFlowValue"),q(L))}function q(L){return L===null||Ue(L)?(e.exit("codeFlowValue"),P(L)):(e.consume(L),q)}function ae(L){return e.exit("codeFenced"),n(L)}function B(L,K,Y){let $=0;return N;function N(W){return L.enter("lineEnding"),L.consume(W),L.exit("lineEnding"),G}function G(W){return L.enter("codeFencedFence"),Ze(W)?st(L,J,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):J(W)}function J(W){return W===f?(L.enter("codeFencedFenceSequence"),le(W)):Y(W)}function le(W){return W===f?($++,L.consume(W),le):$>=c?(L.exit("codeFencedFenceSequence"),Ze(W)?st(L,re,"whitespace")(W):re(W)):Y(W)}function re(W){return W===null||Ue(W)?(L.exit("codeFencedFence"),K(W)):Y(W)}}}function qC(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 Dh={name:"codeIndented",tokenize:IC},HC={partial:!0,tokenize:FC};function IC(e,n,r){const s=this;return l;function l(d){return e.enter("codeIndented"),st(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):Ue(d)?e.attempt(HC,c,m)(d):(e.enter("codeFlowValue"),f(d))}function f(d){return d===null||Ue(d)?(e.exit("codeFlowValue"),c(d)):(e.consume(d),f)}function m(d){return e.exit("codeIndented"),n(d)}}function FC(e,n,r){const s=this;return l;function l(c){return s.parser.lazy[s.now().line]?r(c):Ue(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):st(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):Ue(c)?l(c):r(c)}}const $C={name:"codeText",previous:GC,resolve:YC,tokenize:VC};function YC(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 GC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function VC(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)):Ue(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||Ue(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 JC{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&&yl(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),yl(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),yl(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);yl(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);yl(this.left,r.reverse())}}}function yl(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 Jx(e){const n={};let r=-1,s,l,u,c,f,m,d;const y=new JC(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,XC(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 Pn(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!d}function XC(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,v=r,k=0,M=0;const U=[M];for(;v;){for(;e.get(++l)[1]!==v;);u.push(l),v._tokenizer||(y=s.sliceStream(v),v.next||y.push(null),g&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=v,v=v.next}for(v=r;++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&&(M=b+1,U.push(M),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(c.events=[],v?(v._tokenizer=void 0,v.previous=void 0):U.pop(),b=U.length;b--;){const R=f.slice(U[b],U[b+1]),P=u.pop();m.push([P,P+R.length-1]),e.splice(P,2,R)}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 KC={resolve:ZC,tokenize:WC},QC={partial:!0,tokenize:eA};function ZC(e){return Jx(e),e}function WC(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):Ue(f)?e.check(QC,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 eA(e,n,r){const s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),st(e,u,"linePrefix")}function u(c){if(c===null||Ue(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 Xx(e,n,r,s,l,u,c,f,m){const d=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(R){return R===60?(e.enter(s),e.enter(l),e.enter(u),e.consume(R),e.exit(u),b):R===null||R===32||R===41||Lu(R)?r(R):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),M(R))}function b(R){return R===62?(e.enter(u),e.consume(R),e.exit(u),e.exit(l),e.exit(s),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(R))}function v(R){return R===62?(e.exit("chunkString"),e.exit(f),b(R)):R===null||R===60||Ue(R)?r(R):(e.consume(R),R===92?k:v)}function k(R){return R===60||R===62||R===92?(e.consume(R),v):v(R)}function M(R){return!y&&(R===null||R===41||kt(R))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),n(R)):y<d&&R===40?(e.consume(R),y++,M):R===41?(e.consume(R),y--,M):R===null||R===32||R===40||Lu(R)?r(R):(e.consume(R),R===92?U:M)}function U(R){return R===40||R===41||R===92?(e.consume(R),M):M(R)}}function Kx(e,n,r,s,l,u){const c=this;let f=0,m;return d;function d(v){return e.enter(s),e.enter(l),e.consume(v),e.exit(l),e.enter(u),y}function y(v){return f>999||v===null||v===91||v===93&&!m||v===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(v):v===93?(e.exit(u),e.enter(l),e.consume(v),e.exit(l),e.exit(s),n):Ue(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Ue(v)||f++>999?(e.exit("chunkString"),y(v)):(e.consume(v),m||(m=!Ze(v)),v===92?b:g)}function b(v){return v===91||v===92||v===93?(e.consume(v),f++,g):g(v)}}function Qx(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):Ue(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),st(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===c||b===null||Ue(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 Tl(e,n){let r;return s;function s(l){return Ue(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):Ze(l)?st(e,s,r?"linePrefix":"lineSuffix")(l):n(l)}}const tA={name:"definition",tokenize:rA},nA={partial:!0,tokenize:iA};function rA(e,n,r){const s=this;let l;return u;function u(v){return e.enter("definition"),c(v)}function c(v){return Kx.call(s,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return l=dr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),m):r(v)}function m(v){return kt(v)?Tl(e,d)(v):d(v)}function d(v){return Xx(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function y(v){return e.attempt(nA,g,g)(v)}function g(v){return Ze(v)?st(e,b,"whitespace")(v):b(v)}function b(v){return v===null||Ue(v)?(e.exit("definition"),s.parser.defined.push(l),n(v)):r(v)}}function iA(e,n,r){return s;function s(f){return kt(f)?Tl(e,l)(f):r(f)}function l(f){return Qx(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return Ze(f)?st(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Ue(f)?n(f):r(f)}}const sA={name:"hardBreakEscape",tokenize:aA};function aA(e,n,r){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Ue(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const lA={name:"headingAtx",resolve:oA,tokenize:uA};function oA(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"},Pn(e,s,r-s+1,[["enter",l,n],["enter",u,n],["exit",u,n],["exit",l,n]])),e}function uA(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||kt(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||Ue(y)?(e.exit("atxHeading"),n(y)):Ze(y)?st(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||kt(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),d)}}const cA=["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"],nb=["pre","script","style","textarea"],fA={concrete:!0,name:"htmlFlow",resolveTo:mA,tokenize:pA},hA={partial:!0,tokenize:yA},dA={partial:!0,tokenize:gA};function mA(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 pA(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,M):A===63?(e.consume(A),l=3,s.interrupt?n:_):gn(A)?(e.consume(A),c=String.fromCharCode(A),U):r(A)}function b(A){return A===45?(e.consume(A),l=2,v):A===91?(e.consume(A),l=5,f=0,k):gn(A)?(e.consume(A),l=4,s.interrupt?n:_):r(A)}function v(A){return A===45?(e.consume(A),s.interrupt?n:_):r(A)}function k(A){const xe="CDATA[";return A===xe.charCodeAt(f++)?(e.consume(A),f===xe.length?s.interrupt?n:J:k):r(A)}function M(A){return gn(A)?(e.consume(A),c=String.fromCharCode(A),U):r(A)}function U(A){if(A===null||A===47||A===62||kt(A)){const xe=A===47,he=c.toLowerCase();return!xe&&!u&&nb.includes(he)?(l=1,s.interrupt?n(A):J(A)):cA.includes(c.toLowerCase())?(l=6,xe?(e.consume(A),R):s.interrupt?n(A):J(A)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(A):u?P(A):q(A))}return A===45||on(A)?(e.consume(A),c+=String.fromCharCode(A),U):r(A)}function R(A){return A===62?(e.consume(A),s.interrupt?n:J):r(A)}function P(A){return Ze(A)?(e.consume(A),P):N(A)}function q(A){return A===47?(e.consume(A),N):A===58||A===95||gn(A)?(e.consume(A),ae):Ze(A)?(e.consume(A),q):N(A)}function ae(A){return A===45||A===46||A===58||A===95||on(A)?(e.consume(A),ae):B(A)}function B(A){return A===61?(e.consume(A),L):Ze(A)?(e.consume(A),B):q(A)}function L(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),m=A,K):Ze(A)?(e.consume(A),L):Y(A)}function K(A){return A===m?(e.consume(A),m=null,$):A===null||Ue(A)?r(A):(e.consume(A),K)}function Y(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||kt(A)?B(A):(e.consume(A),Y)}function $(A){return A===47||A===62||Ze(A)?q(A):r(A)}function N(A){return A===62?(e.consume(A),G):r(A)}function G(A){return A===null||Ue(A)?J(A):Ze(A)?(e.consume(A),G):r(A)}function J(A){return A===45&&l===2?(e.consume(A),I):A===60&&l===1?(e.consume(A),oe):A===62&&l===4?(e.consume(A),O):A===63&&l===3?(e.consume(A),_):A===93&&l===5?(e.consume(A),ke):Ue(A)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(hA,Z,le)(A)):A===null||Ue(A)?(e.exit("htmlFlowData"),le(A)):(e.consume(A),J)}function le(A){return e.check(dA,re,Z)(A)}function re(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),W}function W(A){return A===null||Ue(A)?le(A):(e.enter("htmlFlowData"),J(A))}function I(A){return A===45?(e.consume(A),_):J(A)}function oe(A){return A===47?(e.consume(A),c="",ye):J(A)}function ye(A){if(A===62){const xe=c.toLowerCase();return nb.includes(xe)?(e.consume(A),O):J(A)}return gn(A)&&c.length<8?(e.consume(A),c+=String.fromCharCode(A),ye):J(A)}function ke(A){return A===93?(e.consume(A),_):J(A)}function _(A){return A===62?(e.consume(A),O):A===45&&l===2?(e.consume(A),_):J(A)}function O(A){return A===null||Ue(A)?(e.exit("htmlFlowData"),Z(A)):(e.consume(A),O)}function Z(A){return e.exit("htmlFlow"),n(A)}}function gA(e,n,r){const s=this;return l;function l(c){return Ue(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 yA(e,n,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt($l,n,r)}}const bA={name:"htmlText",tokenize:xA};function xA(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(_),q):gn(_)?(e.consume(_),Y):r(_)}function d(_){return _===45?(e.consume(_),y):_===91?(e.consume(_),u=0,k):gn(_)?(e.consume(_),P):r(_)}function y(_){return _===45?(e.consume(_),v):r(_)}function g(_){return _===null?r(_):_===45?(e.consume(_),b):Ue(_)?(c=g,oe(_)):(e.consume(_),g)}function b(_){return _===45?(e.consume(_),v):g(_)}function v(_){return _===62?I(_):_===45?b(_):g(_)}function k(_){const O="CDATA[";return _===O.charCodeAt(u++)?(e.consume(_),u===O.length?M:k):r(_)}function M(_){return _===null?r(_):_===93?(e.consume(_),U):Ue(_)?(c=M,oe(_)):(e.consume(_),M)}function U(_){return _===93?(e.consume(_),R):M(_)}function R(_){return _===62?I(_):_===93?(e.consume(_),R):M(_)}function P(_){return _===null||_===62?I(_):Ue(_)?(c=P,oe(_)):(e.consume(_),P)}function q(_){return _===null?r(_):_===63?(e.consume(_),ae):Ue(_)?(c=q,oe(_)):(e.consume(_),q)}function ae(_){return _===62?I(_):q(_)}function B(_){return gn(_)?(e.consume(_),L):r(_)}function L(_){return _===45||on(_)?(e.consume(_),L):K(_)}function K(_){return Ue(_)?(c=K,oe(_)):Ze(_)?(e.consume(_),K):I(_)}function Y(_){return _===45||on(_)?(e.consume(_),Y):_===47||_===62||kt(_)?$(_):r(_)}function $(_){return _===47?(e.consume(_),I):_===58||_===95||gn(_)?(e.consume(_),N):Ue(_)?(c=$,oe(_)):Ze(_)?(e.consume(_),$):I(_)}function N(_){return _===45||_===46||_===58||_===95||on(_)?(e.consume(_),N):G(_)}function G(_){return _===61?(e.consume(_),J):Ue(_)?(c=G,oe(_)):Ze(_)?(e.consume(_),G):$(_)}function J(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(e.consume(_),l=_,le):Ue(_)?(c=J,oe(_)):Ze(_)?(e.consume(_),J):(e.consume(_),re)}function le(_){return _===l?(e.consume(_),l=void 0,W):_===null?r(_):Ue(_)?(c=le,oe(_)):(e.consume(_),le)}function re(_){return _===null||_===34||_===39||_===60||_===61||_===96?r(_):_===47||_===62||kt(_)?$(_):(e.consume(_),re)}function W(_){return _===47||_===62||kt(_)?$(_):r(_)}function I(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),n):r(_)}function oe(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),ye}function ye(_){return Ze(_)?st(e,ke,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):ke(_)}function ke(_){return e.enter("htmlTextData"),c(_)}}const Vd={name:"labelEnd",resolveAll:_A,resolveTo:EA,tokenize:kA},vA={tokenize:CA},wA={tokenize:AA},SA={tokenize:TA};function _A(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&&Pn(e,0,e.length,r),e}function EA(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=nr(f,e.slice(u+1,u+s+3)),f=nr(f,[["enter",y,n]]),f=nr(f,Xu(n.parser.constructs.insideSpan.null,e.slice(u+s+4,c-3),n)),f=nr(f,[["exit",y,n],e[c-2],e[c-1],["exit",d,n]]),f=nr(f,e.slice(c+1)),f=nr(f,[["exit",m,n]]),Pn(e,u,e.length,f),e}function kA(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(vA,y,c?y:g)(b):b===91?e.attempt(wA,y,c?d:g)(b):c?y(b):g(b)}function d(b){return e.attempt(SA,y,g)(b)}function y(b){return n(b)}function g(b){return u._balanced=!0,r(b)}}function CA(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 kt(g)?Tl(e,u)(g):u(g)}function u(g){return g===41?y(g):Xx(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return kt(g)?Tl(e,m)(g):y(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?Qx(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function d(g){return kt(g)?Tl(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 AA(e,n,r){const s=this;return l;function l(f){return Kx.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 TA(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 jA={name:"labelStartImage",resolveAll:Vd.resolveAll,tokenize:OA};function OA(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 NA={name:"labelStartLink",resolveAll:Vd.resolveAll,tokenize:RA};function RA(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:MA};function MA(e,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),st(e,n,"linePrefix")}}const wu={name:"thematicBreak",tokenize:DA};function DA(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||Ue(d))?(e.exit("thematicBreak"),n(d)):r(d)}function m(d){return d===l?(e.consume(d),s++,m):(e.exit("thematicBreakSequence"),Ze(d)?st(e,f,"whitespace")(d):f(d))}}const En={continuation:{tokenize:BA},exit:qA,name:"list",tokenize:UA},zA={partial:!0,tokenize:HA},LA={partial:!0,tokenize:PA};function UA(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(v){const k=s.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!s.containerState.marker||v===s.containerState.marker:gd(v)){if(s.containerState.type||(s.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(wu,r,d)(v):d(v);if(!s.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(v)}return r(v)}function m(v){return gd(v)&&++c<10?(e.consume(v),m):(!s.interrupt||c<2)&&(s.containerState.marker?v===s.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),d(v)):r(v)}function d(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||v,e.check($l,s.interrupt?r:y,e.attempt(zA,b,g))}function y(v){return s.containerState.initialBlankLine=!0,u++,b(v)}function g(v){return Ze(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),b):r(v)}function b(v){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(v)}}function BA(e,n,r){const s=this;return s.containerState._closeFlow=void 0,e.check($l,l,u);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,st(e,n,"listItemIndent",s.containerState.size+1)(f)}function u(f){return s.containerState.furtherBlankLines||!Ze(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(LA,n,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,st(e,e.attempt(En,n,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function PA(e,n,r){const s=this;return st(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 qA(e){e.exit(this.containerState.type)}function HA(e,n,r){const s=this;return st(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!Ze(u)&&c&&c[1].type==="listItemPrefixWhitespace"?n(u):r(u)}}const rb={name:"setextUnderline",resolveTo:IA,tokenize:FA};function IA(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 FA(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"),Ze(d)?st(e,m,"lineSuffix")(d):m(d))}function m(d){return d===null||Ue(d)?(e.exit("setextHeadingLine"),n(d)):r(d)}}const $A={tokenize:YA};function YA(e){const n=this,r=e.attempt($l,s,e.attempt(this.parser.constructs.flowInitial,l,st(e,e.attempt(this.parser.constructs.flow,l,e.attempt(KC,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 GA={resolveAll:Wx()},VA=Zx("string"),JA=Zx("text");function Zx(e){return{resolveAll:Wx(e==="text"?XA: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 v=g[b];if(!v.previous||v.previous.call(s,s.previous))return!0}return!1}}}function Wx(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 XA(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 KA={42:En,43:En,45:En,48:En,49:En,50:En,51:En,52:En,53:En,54:En,55:En,56:En,57:En,62:Yx},QA={91:tA},ZA={[-2]:Dh,[-1]:Dh,32:Dh},WA={35:lA,42:wu,45:[rb,wu],60:fA,61:rb,95:wu,96:tb,126:tb},eT={38:Vx,92:Gx},tT={[-5]:zh,[-4]:zh,[-3]:zh,33:jA,38:Vx,42:yd,60:[NC,bA],91:NA,92:[sA,Gx],93:Vd,95:yd,96:$C},nT={null:[yd,GA]},rT={null:[42,95]},iT={null:[]},sT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:rT,contentInitial:QA,disable:iT,document:KA,flow:WA,flowInitial:ZA,insideSpan:nT,string:eT,text:tT},Symbol.toStringTag,{value:"Module"}));function aT(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:K(B),check:K(L),consume:P,enter:q,exit:ae,interrupt:K(L,{interrupt:!0})},d={code:null,containerState:{},defineSkip:M,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:v,write:g};let y=n.tokenize.call(d,m);return n.resolveAll&&u.push(n),d;function g(G){return c=nr(c,G),U(),c[c.length-1]!==null?[]:(Y(n,0),d.events=Xu(u,d.events,d),d.events)}function b(G,J){return oT(v(G),J)}function v(G){return lT(c,G)}function k(){const{_bufferIndex:G,_index:J,line:le,column:re,offset:W}=s;return{_bufferIndex:G,_index:J,line:le,column:re,offset:W}}function M(G){l[G.line]=G.column,N()}function U(){let G;for(;s._index<c.length;){const J=c[s._index];if(typeof J=="string")for(G=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===G&&s._bufferIndex<J.length;)R(J.charCodeAt(s._bufferIndex));else R(J)}}function R(G){y=y(G)}function P(G){Ue(G)?(s.line++,s.column=1,s.offset+=G===-3?2:1,N()):G!==-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=G}function q(G,J){const le=J||{};return le.type=G,le.start=k(),d.events.push(["enter",le,d]),f.push(le),le}function ae(G){const J=f.pop();return J.end=k(),d.events.push(["exit",J,d]),J}function B(G,J){Y(G,J.from)}function L(G,J){J.restore()}function K(G,J){return le;function le(re,W,I){let oe,ye,ke,_;return Array.isArray(re)?Z(re):"tokenize"in re?Z([re]):O(re);function O(Se){return Te;function Te(ze){const ue=ze!==null&&Se[ze],Le=ze!==null&&Se.null,We=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(Le)?Le:Le?[Le]:[]];return Z(We)(ze)}}function Z(Se){return oe=Se,ye=0,Se.length===0?I:A(Se[ye])}function A(Se){return Te;function Te(ze){return _=$(),ke=Se,Se.partial||(d.currentConstruct=Se),Se.name&&d.parser.constructs.disable.null.includes(Se.name)?he():Se.tokenize.call(J?Object.assign(Object.create(d),J):d,m,xe,he)(ze)}}function xe(Se){return G(ke,_),W}function he(Se){return _.restore(),++ye<oe.length?A(oe[ye]):I}}}function Y(G,J){G.resolveAll&&!u.includes(G)&&u.push(G),G.resolve&&Pn(d.events,J,d.events.length-J,G.resolve(d.events.slice(J),d)),G.resolveTo&&(d.events=G.resolveTo(d.events,d))}function $(){const G=k(),J=d.previous,le=d.currentConstruct,re=d.events.length,W=Array.from(f);return{from:re,restore:I};function I(){s=G,d.previous=J,d.currentConstruct=le,d.events.length=re,f=W,N()}}function N(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function lT(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 oT(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 uT(e){const s={constructs:Fx([sT,...(e||{}).extensions||[]]),content:l(EC),defined:[],document:l(CC),flow:l($A),lazy:{},string:l(VA),text:l(JA)};return s;function l(u){return c;function c(f){return aT(s,u,f)}}}function cT(e){for(;!Jx(e););return e}const ib=/[\0\t\n\r]/g;function fT(){let e=1,n="",r=!0,s;return l;function l(u,c,f){const m=[];let d,y,g,b,v;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(ib.lastIndex=g,d=ib.exec(u),b=d&&d.index!==void 0?d.index:u.length,v=u.charCodeAt(b),!d){n=u.slice(g);break}if(v===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),v){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 hT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function dT(e){return e.replace(hT,mT)}function mT(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return $x(r.slice(u?2:1),u?16:10)}return Gd(r)||e}const e1={}.hasOwnProperty;function pT(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),gT(r)(cT(uT(r).document().write(fT()(e,n,!0))))}function gT(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Me),autolinkProtocol:$,autolinkEmail:$,atxHeading:u(nt),blockQuote:u(Le),characterEscape:$,characterReference:$,codeFenced:u(We),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(We,c),codeText:u(wt,c),codeTextData:$,data:$,codeFlowValue:$,definition:u(Ie),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(it),hardBreakEscape:u(He),hardBreakTrailing:u(He),htmlFlow:u(at,c),htmlFlowData:$,htmlText:u(at,c),htmlTextData:$,image:u(we),label:c,link:u(Me),listItem:u($e),listItemValue:b,listOrdered:u(Pe,g),listUnordered:u(Pe),paragraph:u(Gt),reference:A,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(nt),strong:u(Hn),thematicBreak:u(xa)},exit:{atxHeading:m(),atxHeadingSequence:B,autolink:m(),autolinkEmail:ue,autolinkProtocol:ze,blockQuote:m(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:he,characterReferenceMarkerNumeric:he,characterReferenceValue:Se,characterReference:Te,codeFenced:m(U),codeFencedFence:M,codeFencedFenceInfo:v,codeFencedFenceMeta:k,codeFlowValue:N,codeIndented:m(R),codeText:m(W),codeTextData:N,data:N,definition:m(),definitionDestinationString:ae,definitionLabelString:P,definitionTitleString:q,emphasis:m(),hardBreakEscape:m(J),hardBreakTrailing:m(J),htmlFlow:m(le),htmlFlowData:N,htmlText:m(re),htmlTextData:N,image:m(oe),label:ke,labelText:ye,lineEnding:G,link:m(I),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:xe,resourceDestinationString:_,resourceTitleString:O,resource:Z,setextHeading:m(Y),setextHeadingLineSequence:K,setextHeadingText:L,strong:m(),thematicBreak:m()}};t1(n,(e||{}).mdastExtensions||[]);const r={};return s;function s(fe){let _e={type:"root",children:[]};const qe={stack:[_e],tokenStack:[],config:n,enter:f,exit:d,buffer:c,resume:y,data:r},Je=[];let ot=-1;for(;++ot<fe.length;)if(fe[ot][1].type==="listOrdered"||fe[ot][1].type==="listUnordered")if(fe[ot][0]==="enter")Je.push(ot);else{const cn=Je.pop();ot=l(fe,cn,ot)}for(ot=-1;++ot<fe.length;){const cn=n[fe[ot][0]];e1.call(cn,fe[ot][1].type)&&cn[fe[ot][1].type].call(Object.assign({sliceSerialize:fe[ot][2].sliceSerialize},qe),fe[ot][1])}if(qe.tokenStack.length>0){const cn=qe.tokenStack[qe.tokenStack.length-1];(cn[1]||sb).call(qe,void 0,cn[0])}for(_e.position={start:Ti(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:Ti(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},ot=-1;++ot<n.transforms.length;)_e=n.transforms[ot](_e)||_e;return _e}function l(fe,_e,qe){let Je=_e-1,ot=-1,cn=!1,In,en,St,Vt;for(;++Je<=qe;){const ht=fe[Je];switch(ht[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ht[0]==="enter"?ot++:ot--,Vt=void 0;break}case"lineEndingBlank":{ht[0]==="enter"&&(In&&!Vt&&!ot&&!St&&(St=Je),Vt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Vt=void 0}if(!ot&&ht[0]==="enter"&&ht[1].type==="listItemPrefix"||ot===-1&&ht[0]==="exit"&&(ht[1].type==="listUnordered"||ht[1].type==="listOrdered")){if(In){let Fn=Je;for(en=void 0;Fn--;){const fn=fe[Fn];if(fn[1].type==="lineEnding"||fn[1].type==="lineEndingBlank"){if(fn[0]==="exit")continue;en&&(fe[en][1].type="lineEndingBlank",cn=!0),fn[1].type="lineEnding",en=Fn}else if(!(fn[1].type==="linePrefix"||fn[1].type==="blockQuotePrefix"||fn[1].type==="blockQuotePrefixWhitespace"||fn[1].type==="blockQuoteMarker"||fn[1].type==="listItemIndent"))break}St&&(!en||St<en)&&(In._spread=!0),In.end=Object.assign({},en?fe[en][1].start:ht[1].end),fe.splice(en||Je,0,["exit",In,ht[2]]),Je++,qe++}if(ht[1].type==="listItemPrefix"){const Fn={type:"listItem",_spread:!1,start:Object.assign({},ht[1].start),end:void 0};In=Fn,fe.splice(Je,0,["enter",Fn,ht[2]]),Je++,qe++,St=void 0,Vt=!0}}}return fe[_e][1]._spread=cn,qe}function u(fe,_e){return qe;function qe(Je){f.call(this,fe(Je),Je),_e&&_e.call(this,Je)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(fe,_e,qe){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([_e,qe||void 0]),fe.position={start:Ti(_e.start),end:void 0}}function m(fe){return _e;function _e(qe){fe&&fe.call(this,qe),d.call(this,qe)}}function d(fe,_e){const qe=this.stack.pop(),Je=this.tokenStack.pop();if(Je)Je[0].type!==fe.type&&(_e?_e.call(this,fe,Je[0]):(Je[1]||sb).call(this,fe,Je[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Al({start:fe.start,end:fe.end})+"): it’s not open");qe.position.end=Ti(fe.end)}function y(){return Yd(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(fe){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function v(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=fe}function k(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=fe}function M(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function U(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function R(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe.replace(/(\r?\n|\r)$/g,"")}function P(fe){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.label=_e,qe.identifier=dr(this.sliceSerialize(fe)).toLowerCase()}function q(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.title=fe}function ae(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.url=fe}function B(fe){const _e=this.stack[this.stack.length-1];if(!_e.depth){const qe=this.sliceSerialize(fe).length;_e.depth=qe}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function K(fe){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function Y(){this.data.setextHeadingSlurpLineEnding=void 0}function $(fe){const qe=this.stack[this.stack.length-1].children;let Je=qe[qe.length-1];(!Je||Je.type!=="text")&&(Je=Ct(),Je.position={start:Ti(fe.start),end:void 0},qe.push(Je)),this.stack.push(Je)}function N(fe){const _e=this.stack.pop();_e.value+=this.sliceSerialize(fe),_e.position.end=Ti(fe.end)}function G(fe){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const qe=_e.children[_e.children.length-1];qe.position.end=Ti(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(_e.type)&&($.call(this,fe),N.call(this,fe))}function J(){this.data.atHardBreak=!0}function le(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe}function re(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe}function W(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe}function I(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=_e,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function oe(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=_e,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function ye(fe){const _e=this.sliceSerialize(fe),qe=this.stack[this.stack.length-2];qe.label=dT(_e),qe.identifier=dr(_e).toLowerCase()}function ke(){const fe=this.stack[this.stack.length-1],_e=this.resume(),qe=this.stack[this.stack.length-1];if(this.data.inReference=!0,qe.type==="link"){const Je=fe.children;qe.children=Je}else qe.alt=_e}function _(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.url=fe}function O(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.title=fe}function Z(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function xe(fe){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.label=_e,qe.identifier=dr(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function he(fe){this.data.characterReferenceType=fe.type}function Se(fe){const _e=this.sliceSerialize(fe),qe=this.data.characterReferenceType;let Je;qe?(Je=$x(_e,qe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Je=Gd(_e);const ot=this.stack[this.stack.length-1];ot.value+=Je}function Te(fe){const _e=this.stack.pop();_e.position.end=Ti(fe.end)}function ze(fe){N.call(this,fe);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(fe)}function ue(fe){N.call(this,fe);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(fe)}function Le(){return{type:"blockquote",children:[]}}function We(){return{type:"code",lang:null,meta:null,value:""}}function wt(){return{type:"inlineCode",value:""}}function Ie(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function it(){return{type:"emphasis",children:[]}}function nt(){return{type:"heading",depth:0,children:[]}}function He(){return{type:"break"}}function at(){return{type:"html",value:""}}function we(){return{type:"image",title:null,url:"",alt:null}}function Me(){return{type:"link",title:null,url:"",children:[]}}function Pe(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function $e(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function Gt(){return{type:"paragraph",children:[]}}function Hn(){return{type:"strong",children:[]}}function Ct(){return{type:"text",value:""}}function xa(){return{type:"thematicBreak"}}}function Ti(e){return{line:e.line,column:e.column,offset:e.offset}}function t1(e,n){let r=-1;for(;++r<n.length;){const s=n[r];Array.isArray(s)?t1(e,s):yT(e,s)}}function yT(e,n){let r;for(r in n)if(e1.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 sb(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Al({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Al({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Al({start:n.start,end:n.end})+") is still open")}function bT(e){const n=this;n.parser=r;function r(s){return pT(s,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function xT(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 vT(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
96
+ `}]}function wT(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 ST(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function _T(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ET(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(n.identifier).toUpperCase(),l=ba(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 kT(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 CT(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function n1(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 AT(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return n1(e,n);const l={src:ba(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 TT(e,n){const r={src:ba(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 jT(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 OT(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return n1(e,n);const l={href:ba(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 NT(e,n){const r={href:ba(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 RT(e,n,r){const s=e.all(n),l=r?MT(r):r1(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 MT(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=r1(r[s])}return n}function r1(e){const n=e.spread;return n??e.children.length>1}function DT(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 zT(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function LT(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function UT(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function BT(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=Hd(n.children[1]),m=Lx(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 PT(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={},v=c?c[m]:void 0;v&&(b.align=v);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 qT(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const ab=9,lb=32;function HT(e){const n=String(e),r=/\r?\n|\r/g;let s=r.exec(n),l=0;const u=[];for(;s;)u.push(ob(n.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=r.exec(n);return u.push(ob(n.slice(l),l>0,!1)),u.join("")}function ob(e,n,r){let s=0,l=e.length;if(n){let u=e.codePointAt(s);for(;u===ab||u===lb;)s++,u=e.codePointAt(s)}if(r){let u=e.codePointAt(l-1);for(;u===ab||u===lb;)l--,u=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function IT(e,n){const r={type:"text",value:HT(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function FT(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const $T={blockquote:xT,break:vT,code:wT,delete:ST,emphasis:_T,footnoteReference:ET,heading:kT,html:CT,imageReference:AT,image:TT,inlineCode:jT,linkReference:OT,link:NT,listItem:RT,list:DT,paragraph:zT,root:LT,strong:UT,table:BT,tableCell:qT,tableRow:PT,text:IT,thematicBreak:FT,toml:du,yaml:du,definition:du,footnoteDefinition:du};function du(){}const i1=-1,Ku=0,jl=1,Uu=2,Jd=3,Xd=4,Kd=5,Qd=6,s1=7,a1=8,ub=typeof self=="object"?self:globalThis,YT=(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 Ku:case i1:return r(c,l);case jl:{const f=r([],l);for(const m of c)f.push(s(m));return f}case Uu:{const f=r({},l);for(const[m,d]of c)f[s(m)]=s(d);return f}case Jd:return r(new Date(c),l);case Xd:{const{source:f,flags:m}=c;return r(new RegExp(f,m),l)}case Kd:{const f=r(new Map,l);for(const[m,d]of c)f.set(s(m),s(d));return f}case Qd:{const f=r(new Set,l);for(const m of c)f.add(s(m));return f}case s1:{const{name:f,message:m}=c;return r(new ub[f](m),l)}case a1: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 ub[u](c),l)};return s},cb=e=>YT(new Map,e)(0),Ks="",{toString:GT}={},{keys:VT}=Object,bl=e=>{const n=typeof e;if(n!=="object"||!e)return[Ku,n];const r=GT.call(e).slice(8,-1);switch(r){case"Array":return[jl,Ks];case"Object":return[Uu,Ks];case"Date":return[Jd,Ks];case"RegExp":return[Xd,Ks];case"Map":return[Kd,Ks];case"Set":return[Qd,Ks];case"DataView":return[jl,r]}return r.includes("Array")?[jl,r]:r.includes("Error")?[s1,r]:[Uu,r]},mu=([e,n])=>e===Ku&&(n==="function"||n==="symbol"),JT=(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]=bl(c);switch(f){case Ku:{let y=c;switch(m){case"bigint":f=a1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([i1],c)}return l([f,y],c)}case jl:{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 Uu:{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 VT(c))(e||!mu(bl(c[b])))&&y.push([u(b),u(c[b])]);return g}case Jd:return l([f,c.toISOString()],c);case Xd:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case Kd:{const y=[],g=l([f,y],c);for(const[b,v]of c)(e||!(mu(bl(b))||mu(bl(v))))&&y.push([u(b),u(v)]);return g}case Qd:{const y=[],g=l([f,y],c);for(const b of c)(e||!mu(bl(b)))&&y.push(u(b));return g}}const{message:d}=c;return l([f,{name:m,message:d}],c)};return u},fb=(e,{json:n,lossy:r}={})=>{const s=[];return JT(!(n||r),!!n,new Map,s)(e),s},Bu=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?cb(fb(e,n)):structuredClone(e):(e,n)=>cb(fb(e,n));function XT(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 KT(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function QT(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||XT,s=e.options.footnoteBackLabel||KT,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=ba(g.toLowerCase());let v=0;const k=[],M=e.footnoteCounts.get(g);for(;M!==void 0&&++v<=M;){k.length>0&&k.push({type:"text",value:" "});let P=typeof r=="string"?r:r(m,v);typeof P=="string"&&(P={type:"text",value:P}),k.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(m,v),className:["data-footnote-backref"]},children:Array.isArray(P)?P:[P]})}const U=y[y.length-1];if(U&&U.type==="element"&&U.tagName==="p"){const P=U.children[U.children.length-1];P&&P.type==="text"?P.value+=" ":U.children.push({type:"text",value:" "}),U.children.push(...k)}else y.push(...k);const R={type:"element",tagName:"li",properties:{id:n+"fn-"+b},children:e.wrap(y,!0)};e.patch(d,R),f.push(R)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Bu(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 Qu=(function(e){if(e==null)return tj;if(typeof e=="function")return Zu(e);if(typeof e=="object")return Array.isArray(e)?ZT(e):WT(e);if(typeof e=="string")return ej(e);throw new Error("Expected function, string, or object as test")});function ZT(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Qu(e[r]);return Zu(s);function s(...l){let u=-1;for(;++u<n.length;)if(n[u].apply(this,l))return!0;return!1}}function WT(e){const n=e;return Zu(r);function r(s){const l=s;let u;for(u in e)if(l[u]!==n[u])return!1;return!0}}function ej(e){return Zu(n);function n(r){return r&&r.type===e}}function Zu(e){return n;function n(r,s,l){return!!(nj(r)&&e.call(this,r,typeof s=="number"?s:void 0,l||void 0))}}function tj(){return!0}function nj(e){return e!==null&&typeof e=="object"&&"type"in e}const l1=[],rj=!0,bd=!1,ij="skip";function o1(e,n,r,s){let l;typeof n=="function"&&typeof r!="function"?(s=r,r=n):l=n;const u=Qu(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 v=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(v?"<"+v+">":""))+")"})}return b;function b(){let v=l1,k,M,U;if((!n||u(m,d,y[y.length-1]||void 0))&&(v=sj(r(m,y)),v[0]===bd))return v;if("children"in m&&m.children){const R=m;if(R.children&&v[0]!==ij)for(M=(s?R.children.length:-1)+c,U=y.concat(R);M>-1&&M<R.children.length;){const P=R.children[M];if(k=f(P,M,U)(),k[0]===bd)return k;M=typeof k[1]=="number"?k[1]:M+c}}return v}}}function sj(e){return Array.isArray(e)?e:typeof e=="number"?[rj,e]:e==null?l1:[e]}function Zd(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),o1(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 xd={}.hasOwnProperty,aj={};function lj(e,n){const r=n||aj,s=new Map,l=new Map,u=new Map,c={...$T,...r.handlers},f={all:d,applyData:uj,definitionById:s,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:oj,wrap:fj};return Zd(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,v=f.handlers[b];if(xd.call(f.handlers,b)&&v)return v(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in y){const{children:M,...U}=y,R=Bu(U);return R.children=f.all(y),R}return Bu(y)}return(f.options.unknownHandler||cj)(f,y,g)}function d(y){const g=[];if("children"in y){const b=y.children;let v=-1;for(;++v<b.length;){const k=f.one(b[v],y);if(k){if(v&&b[v-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=hb(k.value)),!Array.isArray(k)&&k.type==="element")){const M=k.children[0];M&&M.type==="text"&&(M.value=hb(M.value))}Array.isArray(k)?g.push(...k):g.push(k)}}}return g}}function oj(e,n){e.position&&(n.position=Kk(e))}function uj(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,Bu(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function cj(e,n){const r=n.data||{},s="value"in n&&!(xd.call(r,"hProperties")||xd.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 fj(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 hb(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function db(e,n){const r=lj(e,n),s=r.one(e,void 0),l=QT(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 hj(e,n){return e&&"run"in e?async function(r,s){const l=db(r,{file:s,...n});await e.run(l,s)}:function(r,s){return db(r,{file:s,...e||n})}}function mb(e){if(e)throw e}var Lh,pb;function dj(){if(pb)return Lh;pb=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 Lh=function m(){var d,y,g,b,v,k,M=arguments[0],U=1,R=arguments.length,P=!1;for(typeof M=="boolean"&&(P=M,M=arguments[1]||{},U=2),(M==null||typeof M!="object"&&typeof M!="function")&&(M={});U<R;++U)if(d=arguments[U],d!=null)for(y in d)g=f(M,y),b=f(d,y),M!==b&&(P&&b&&(u(b)||(v=l(b)))?(v?(v=!1,k=g&&l(g)?g:[]):k=g&&u(g)?g:{},c(M,{name:y,newValue:m(P,k,b)})):typeof b<"u"&&c(M,{name:y,newValue:b}));return M},Lh}var mj=dj();const Uh=Nb(mj);function vd(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 pj(){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?gj(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 gj(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:yj,dirname:bj,extname:xj,join:vj,sep:"/"};function yj(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Yl(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 bj(e){if(Yl(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 xj(e){Yl(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 vj(...e){let n=-1,r;for(;++n<e.length;)Yl(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":wj(r)}function wj(e){Yl(e);const n=e.codePointAt(0)===47;let r=Sj(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function Sj(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 Yl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const _j={cwd:Ej};function Ej(){return"/"}function wd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function kj(e){if(typeof e=="string")e=new URL(e);else if(!wd(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 Cj(e)}function Cj(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 Bh=["history","path","basename","stem","extname","dirname"];class u1{constructor(n){let r;n?wd(n)?r={path:n}:typeof n=="string"||Aj(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":_j.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Bh.length;){const u=Bh[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)Bh.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?xr.basename(this.path):void 0}set basename(n){qh(n,"basename"),Ph(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){gb(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(Ph(n,"extname"),gb(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){wd(n)&&(n=kj(n)),qh(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){qh(n,"stem"),Ph(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 un(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 Ph(e,n){if(e&&e.includes(xr.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+xr.sep+"`")}function qh(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function gb(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function Aj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Tj=(function(e){const s=this.constructor.prototype,l=s[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),jj={}.hasOwnProperty;class Wd extends Tj{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=pj()}copy(){const n=new Wd;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];n.use(...s)}return n.data(Uh(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(Fh("data",this.frozen),this.namespace[n]=r,this):jj.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Fh("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=pu(n),s=this.parser||this.Parser;return Hh("parse",s),s(String(r),r)}process(n,r){const s=this;return this.freeze(),Hh("process",this.parser||this.Parser),Ih("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=pu(n),m=s.parse(f);s.run(m,f,function(y,g,b){if(y||!g||!b)return d(y);const v=g,k=s.stringify(v,b);Rj(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(),Hh("processSync",this.parser||this.Parser),Ih("processSync",this.compiler||this.Compiler),this.process(n,l),bb("processSync","process",r),s;function l(u,c){r=!0,mb(u),s=c}}run(n,r,s){yb(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=pu(r);l.run(n,m,d);function d(y,g,b){const v=g||n;y?f(y):c?c(v):s(void 0,v,b)}}}runSync(n,r){let s=!1,l;return this.run(n,r,u),bb("runSync","run",s),l;function u(c,f){mb(c),l=f,s=!0}}stringify(n,r){this.freeze();const s=pu(r),l=this.compiler||this.Compiler;return Ih("stringify",l),yb(n),l(n,s)}use(n,...r){const s=this.attachers,l=this.namespace;if(Fh("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=Uh(!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[v,...k]=y;const M=s[b][1];vd(M)&&vd(v)&&(v=Uh(!0,M,v)),s[b]=[d,v,...k]}}}}const Oj=new Wd().freeze();function Hh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ih(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Fh(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 yb(e){if(!vd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function bb(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function pu(e){return Nj(e)?e:new u1(e)}function Nj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Rj(e){return typeof e=="string"||Mj(e)}function Mj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Dj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",xb=[],vb={allowDangerousHtml:!0},zj=/^(https?|ircs?|mailto|xmpp)$/i,Lj=[{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 wb(e){const n=Uj(e),r=Bj(e);return Pj(n.runSync(n.parse(r),r),e)}function Uj(e){const n=e.rehypePlugins||xb,r=e.remarkPlugins||xb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...vb}:vb;return Oj().use(bT).use(r).use(hj,s).use(n)}function Bj(e){const n=e.children||"",r=new u1;return typeof n=="string"&&(r.value=n),r}function Pj(e,n){const r=n.allowedElements,s=n.allowElement,l=n.components,u=n.disallowedElements,c=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||qj;for(const y of Lj)Object.hasOwn(n,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+Dj+y.id,void 0);return Zd(e,d),tC(e,{Fragment:w.Fragment,components:l,ignoreInvalidStyle:!0,jsx:w.jsx,jsxs:w.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 v;for(v in Mh)if(Object.hasOwn(Mh,v)&&Object.hasOwn(y.properties,v)){const k=y.properties[v],M=Mh[v];(M===null||M.includes(y.tagName))&&(y.properties[v]=m(String(k||""),v,y))}}if(y.type==="element"){let v=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!v&&s&&typeof g=="number"&&(v=!s(y,g,b)),v&&b&&typeof g=="number")return f&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function qj(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||zj.test(e.slice(0,n))?e:""}function Sb(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 Hj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function c1(e,n,r){const l=Qu((r||{}).ignore||[]),u=Ij(n);let c=-1;for(;++c<u.length;)o1(e,"text",f);function f(d,y){let g=-1,b;for(;++g<y.length;){const v=y[g],k=b?b.children:void 0;if(l(v,k?k.indexOf(v):void 0,b))return;b=v}if(b)return m(d,y)}function m(d,y){const g=y[y.length-1],b=u[c][0],v=u[c][1];let k=0;const U=g.children.indexOf(d);let R=!1,P=[];b.lastIndex=0;let q=b.exec(d.value);for(;q;){const ae=q.index,B={index:q.index,input:q.input,stack:[...y,d]};let L=v(...q,B);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?b.lastIndex=ae+1:(k!==ae&&P.push({type:"text",value:d.value.slice(k,ae)}),Array.isArray(L)?P.push(...L):L&&P.push(L),k=ae+q[0].length,R=!0),!b.global)break;q=b.exec(d.value)}return R?(k<d.value.length&&P.push({type:"text",value:d.value.slice(k)}),g.children.splice(U,1,...P)):P=[d],U+P.length}}function Ij(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([Fj(l[0]),$j(l[1])])}return n}function Fj(e){return typeof e=="string"?new RegExp(Hj(e),"g"):e}function $j(e){return typeof e=="function"?e:function(){return e}}const $h="phrasing",Yh=["autolink","link","image","label"];function Yj(){return{transforms:[Zj],enter:{literalAutolink:Vj,literalAutolinkEmail:Gh,literalAutolinkHttp:Gh,literalAutolinkWww:Gh},exit:{literalAutolink:Qj,literalAutolinkEmail:Kj,literalAutolinkHttp:Jj,literalAutolinkWww:Xj}}}function Gj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:$h,notInConstruct:Yh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:$h,notInConstruct:Yh},{character:":",before:"[ps]",after:"\\/",inConstruct:$h,notInConstruct:Yh}]}}function Vj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Gh(e){this.config.enter.autolinkProtocol.call(this,e)}function Jj(e){this.config.exit.autolinkProtocol.call(this,e)}function Xj(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 Kj(e){this.config.exit.autolinkEmail.call(this,e)}function Qj(e){this.exit(e)}function Zj(e){c1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Wj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),e3]],{ignore:["link","linkReference"]})}function Wj(e,n,r,s,l){let u="";if(!f1(l)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!t3(r)))return!1;const c=n3(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 e3(e,n,r,s){return!f1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function t3(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 n3(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=Sb(e,"(");let u=Sb(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 f1(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||cs(r)||Ju(r))&&(!n||r!==47)}h1.peek=f3;function r3(){this.buffer()}function i3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function s3(){this.buffer()}function a3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function l3(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 o3(e){this.exit(e)}function u3(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 c3(e){this.exit(e)}function f3(){return"["}function h1(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 h3(){return{enter:{gfmFootnoteCallString:r3,gfmFootnoteCall:i3,gfmFootnoteDefinitionLabelString:s3,gfmFootnoteDefinition:a3},exit:{gfmFootnoteCallString:l3,gfmFootnoteCall:o3,gfmFootnoteDefinitionLabelString:u3,gfmFootnoteDefinition:c3}}}function d3(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:h1},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?d1:m3))),d(),m}}function m3(e,n,r){return n===0?e:d1(e,n,r)}function d1(e,n,r){return(r?"":" ")+e}const p3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];m1.peek=v3;function g3(){return{canContainEols:["delete"],enter:{strikethrough:b3},exit:{strikethrough:x3}}}function y3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:p3}],handlers:{delete:m1}}}function b3(e){this.enter({type:"delete",children:[]},e)}function x3(e){this.exit(e)}function m1(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 v3(){return"~"}function w3(e){return e.length}function S3(e,n){const r=n||{},s=(r.align||[]).concat(),l=r.stringLength||w3,u=[],c=[],f=[],m=[];let d=0,y=-1;for(;++y<e.length;){const M=[],U=[];let R=-1;for(e[y].length>d&&(d=e[y].length);++R<e[y].length;){const P=_3(e[y][R]);if(r.alignDelimiters!==!1){const q=l(P);U[R]=q,(m[R]===void 0||q>m[R])&&(m[R]=q)}M.push(P)}c[y]=M,f[y]=U}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<d;)u[g]=_b(s[g]);else{const M=_b(s);for(;++g<d;)u[g]=M}g=-1;const b=[],v=[];for(;++g<d;){const M=u[g];let U="",R="";M===99?(U=":",R=":"):M===108?U=":":M===114&&(R=":");let P=r.alignDelimiters===!1?1:Math.max(1,m[g]-U.length-R.length);const q=U+"-".repeat(P)+R;r.alignDelimiters!==!1&&(P=U.length+P+R.length,P>m[g]&&(m[g]=P),v[g]=P),b[g]=q}c.splice(1,0,b),f.splice(1,0,v),y=-1;const k=[];for(;++y<c.length;){const M=c[y],U=f[y];g=-1;const R=[];for(;++g<d;){const P=M[g]||"";let q="",ae="";if(r.alignDelimiters!==!1){const B=m[g]-(U[g]||0),L=u[g];L===114?q=" ".repeat(B):L===99?B%2?(q=" ".repeat(B/2+.5),ae=" ".repeat(B/2-.5)):(q=" ".repeat(B/2),ae=q):ae=" ".repeat(B)}r.delimiterStart!==!1&&!g&&R.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&P==="")&&(r.delimiterStart!==!1||g)&&R.push(" "),r.alignDelimiters!==!1&&R.push(q),R.push(P),r.alignDelimiters!==!1&&R.push(ae),r.padding!==!1&&R.push(" "),(r.delimiterEnd!==!1||g!==d-1)&&R.push("|")}k.push(r.delimiterEnd===!1?R.join("").replace(/ +$/,""):R.join(""))}return k.join(`
107
+ `)}function _3(e){return e==null?"":String(e)}function _b(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 E3(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()),k3);return l(),c}function k3(e,n,r){return">"+(r?"":" ")+e}function C3(e,n){return Eb(e,n.inConstruct,!0)&&!Eb(e,n.notInConstruct,!1)}function Eb(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 kb(e,n,r,s){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
108
+ `&&C3(r.stack,r.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
109
+ `}function A3(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 T3(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 j3(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 O3(e,n,r,s){const l=j3(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(T3(e,r)){const g=r.enter("codeIndented"),b=r.indentLines(u,N3);return g(),b}const f=r.createTracker(s),m=l.repeat(Math.max(A3(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 N3(e,n,r){return(r?"":" ")+e}function em(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 R3(e,n,r,s){const l=em(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 M3(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 Ll(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Pu(e,n,r){const s=ha(e),l=ha(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}}p1.peek=D3;function p1(e,n,r,s){const l=M3(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=Pu(s.before.charCodeAt(s.before.length-1),d,l);y.inside&&(m=Ll(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=Pu(s.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Ll(g));const v=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+v}function D3(e,n,r){return r.options.emphasis||"*"}function z3(e,n){let r=!1;return Zd(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,bd}),!!((!e.depth||e.depth<3)&&Yd(e)&&(n.options.setext||r))}function L3(e,n,r,s){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(s);if(z3(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=Ll(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,r.options.closeAtx&&(d+=" "+c),m(),f(),d}g1.peek=U3;function g1(e){return e.value||""}function U3(){return"<"}y1.peek=B3;function y1(e,n,r,s){const l=em(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 B3(){return"!"}b1.peek=P3;function b1(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 P3(){return"!"}x1.peek=q3;function x1(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 q3(){return"`"}function v1(e,n){const r=Yd(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))}w1.peek=H3;function w1(e,n,r,s){const l=em(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(s);let f,m;if(v1(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 H3(e,n,r){return v1(e,r)?"<":"["}S1.peek=I3;function S1(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 I3(){return"["}function tm(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 F3(e){const n=tm(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 $3(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 _1(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 Y3(e,n,r,s){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?$3(r):tm(r);const f=e.ordered?c==="."?")":".":F3(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),_1(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 G3(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 V3(e,n,r,s){const l=G3(r);let u=r.bulletCurrent||tm(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,v){return b?(v?"":" ".repeat(c))+g:(v?u:u+" ".repeat(c-u.length))+g}}function J3(e,n,r,s){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,s);return u(),l(),c}const X3=Qu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function K3(e,n,r,s){return(e.children.some(function(c){return X3(c)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function Q3(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}E1.peek=Z3;function E1(e,n,r,s){const l=Q3(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=Pu(s.before.charCodeAt(s.before.length-1),d,l);y.inside&&(m=Ll(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=Pu(s.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Ll(g));const v=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+v}function Z3(e,n,r){return r.options.strong||"*"}function W3(e,n,r,s){return r.safe(e.value,s)}function eO(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 tO(e,n,r){const s=(_1(r)+(r.options.ruleSpaces?" ":"")).repeat(eO(r));return r.options.ruleSpaces?s.slice(0,-1):s}const k1={blockquote:E3,break:kb,code:O3,definition:R3,emphasis:p1,hardBreak:kb,heading:L3,html:g1,image:y1,imageReference:b1,inlineCode:x1,link:w1,linkReference:S1,list:Y3,listItem:V3,paragraph:J3,root:K3,strong:E1,text:W3,thematicBreak:tO};function nO(){return{enter:{table:rO,tableData:Cb,tableHeader:Cb,tableRow:sO},exit:{codeText:aO,table:iO,tableData:Vh,tableHeader:Vh,tableRow:Vh}}}function rO(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 iO(e){this.exit(e),this.data.inTable=void 0}function sO(e){this.enter({type:"tableRow",children:[]},e)}function Vh(e){this.exit(e)}function Cb(e){this.enter({type:"tableCell",children:[]},e)}function aO(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,lO));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function lO(e,n){return n==="|"?n:e}function oO(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(v,k,M,U){return d(y(v,M,U),v.align)}function f(v,k,M,U){const R=g(v,M,U),P=d([R]);return P.slice(0,P.indexOf(`
120
+ `))}function m(v,k,M,U){const R=M.enter("tableCell"),P=M.enter("phrasing"),q=M.containerPhrasing(v,{...U,before:u,after:u});return P(),R(),q}function d(v,k){return S3(v,{align:k,alignDelimiters:s,padding:r,stringLength:l})}function y(v,k,M){const U=v.children;let R=-1;const P=[],q=k.enter("table");for(;++R<U.length;)P[R]=g(U[R],k,M);return q(),P}function g(v,k,M){const U=v.children;let R=-1;const P=[],q=k.enter("tableRow");for(;++R<U.length;)P[R]=m(U[R],v,k,M);return q(),P}function b(v,k,M){let U=k1.inlineCode(v,k,M);return M.stack.includes("tableCell")&&(U=U.replace(/\|/g,"\\$&")),U}}function uO(){return{exit:{taskListCheckValueChecked:Ab,taskListCheckValueUnchecked:Ab,paragraph:fO}}}function cO(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:hO}}}function Ab(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function fO(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 hO(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=k1.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 dO(){return[Yj(),h3(),g3(),nO(),uO()]}function mO(e){return{extensions:[Gj(),d3(e),y3(),oO(e),cO()]}}const pO={tokenize:wO,partial:!0},C1={tokenize:SO,partial:!0},A1={tokenize:_O,partial:!0},T1={tokenize:EO,partial:!0},gO={tokenize:kO,partial:!0},j1={name:"wwwAutolink",tokenize:xO,previous:N1},O1={name:"protocolAutolink",tokenize:vO,previous:R1},Zr={name:"emailAutolink",tokenize:bO,previous:M1},Cr={};function yO(){return{text:Cr}}let as=48;for(;as<123;)Cr[as]=Zr,as++,as===58?as=65:as===91&&(as=97);Cr[43]=Zr;Cr[45]=Zr;Cr[46]=Zr;Cr[95]=Zr;Cr[72]=[Zr,O1];Cr[104]=[Zr,O1];Cr[87]=[Zr,j1];Cr[119]=[Zr,j1];function bO(e,n,r){const s=this;let l,u;return c;function c(g){return!Sd(g)||!M1.call(s,s.previous)||nm(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return Sd(g)?(e.consume(g),f):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(gO,y,d)(g):g===45||g===95||on(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&&gn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):r(g)}}function xO(e,n,r){const s=this;return l;function l(c){return c!==87&&c!==119||!N1.call(s,s.previous)||nm(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(pO,e.attempt(C1,e.attempt(A1,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(c)}}function vO(e,n,r){const s=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&R1.call(s,s.previous)&&!nm(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(gn(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||Lu(g)||kt(g)||cs(g)||Ju(g)?r(g):e.attempt(C1,e.attempt(A1,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function wO(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 SO(e,n,r){let s,l,u;return c;function c(d){return d===46||d===95?e.check(T1,m,f)(d):d===null||kt(d)||cs(d)||d!==45&&Ju(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 _O(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(T1,n,u)(c):c===null||kt(c)||cs(c)?n(c):(e.consume(c),l)}function u(c){return c===41&&s++,e.consume(c),l}}function EO(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||kt(f)||cs(f)?n(f):r(f)}function l(f){return f===null||f===40||f===91||kt(f)||cs(f)?n(f):s(f)}function u(f){return gn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):gn(f)?(e.consume(f),c):r(f)}}function kO(e,n,r){return s;function s(u){return e.consume(u),l}function l(u){return on(u)?r(u):n(u)}}function N1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||kt(e)}function R1(e){return!gn(e)}function M1(e){return!(e===47||Sd(e))}function Sd(e){return e===43||e===45||e===46||e===95||on(e)}function nm(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 CO={tokenize:DO,partial:!0};function AO(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:NO,continuation:{tokenize:RO},exit:MO}},text:{91:{name:"gfmFootnoteCall",tokenize:OO},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:TO,resolveTo:jO}}}}function TO(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 jO(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 OO(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||kt(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 kt(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 NO(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||kt(k))return r(k);if(k===93){e.exit("chunkString");const M=e.exit("gfmFootnoteDefinitionLabelString");return u=dr(s.sliceSerialize(M)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return kt(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),st(e,v,"gfmFootnoteDefinitionWhitespace")):r(k)}function v(k){return n(k)}}function RO(e,n,r){return e.check($l,n,e.attempt(CO,n,r))}function MO(e){e.exit("gfmFootnoteDefinition")}function DO(e,n,r){const s=this;return st(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 zO(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]],v=f.parser.constructs.insideSpan.null;v&&Pn(b,b.length,0,Xu(v,c.slice(d+1,m),f)),Pn(b,b.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",y,f]]),Pn(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"),v(k))}function v(k){const M=ha(d);if(k===126)return g>1?m(k):(c.consume(k),g++,v);if(g<2&&!r)return m(k);const U=c.exit("strikethroughSequenceTemporary"),R=ha(k);return U._open=!R||R===2&&!!M,U._close=!M||M===2&&!!R,f(k)}}}class LO{constructor(){this.map=[]}add(n,r,s){UO(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 UO(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 BO(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 PO(){return{flow:{null:{name:"table",tokenize:qO,resolveAll:HO}}}}function qO(e,n,r){const s=this;let l=0,u=0,c;return f;function f(N){let G=s.events.length-1;for(;G>-1;){const re=s.events[G][1].type;if(re==="lineEnding"||re==="linePrefix")G--;else break}const J=G>-1?s.events[G][1].type:null,le=J==="tableHead"||J==="tableRow"?L:m;return le===L&&s.parser.lazy[s.now().line]?r(N):le(N)}function m(N){return e.enter("tableHead"),e.enter("tableRow"),d(N)}function d(N){return N===124||(c=!0,u+=1),y(N)}function y(N){return N===null?r(N):Ue(N)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),v):r(N):Ze(N)?st(e,y,"whitespace")(N):(u+=1,c&&(c=!1,l+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(N)))}function g(N){return N===null||N===124||kt(N)?(e.exit("data"),y(N)):(e.consume(N),N===92?b:g)}function b(N){return N===92||N===124?(e.consume(N),g):g(N)}function v(N){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(N):(e.enter("tableDelimiterRow"),c=!1,Ze(N)?st(e,k,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):k(N))}function k(N){return N===45||N===58?U(N):N===124?(c=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),M):B(N)}function M(N){return Ze(N)?st(e,U,"whitespace")(N):U(N)}function U(N){return N===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),R):N===45?(u+=1,R(N)):N===null||Ue(N)?ae(N):B(N)}function R(N){return N===45?(e.enter("tableDelimiterFiller"),P(N)):B(N)}function P(N){return N===45?(e.consume(N),P):N===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),q):(e.exit("tableDelimiterFiller"),q(N))}function q(N){return Ze(N)?st(e,ae,"whitespace")(N):ae(N)}function ae(N){return N===124?k(N):N===null||Ue(N)?!c||l!==u?B(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(N)):B(N)}function B(N){return r(N)}function L(N){return e.enter("tableRow"),K(N)}function K(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),K):N===null||Ue(N)?(e.exit("tableRow"),n(N)):Ze(N)?st(e,K,"whitespace")(N):(e.enter("data"),Y(N))}function Y(N){return N===null||N===124||kt(N)?(e.exit("data"),K(N)):(e.consume(N),N===92?$:Y)}function $(N){return N===92||N===124?(e.consume(N),Y):Y(N)}}function HO(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 LO;for(;++r<e.length;){const v=e[r],k=v[1];v[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(Tb(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=gu(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=gu(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=gu(b,n,u,l,r,g)):c[1]!==0&&(g=gu(b,n,c,l,r,g)),l=0):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&Tb(b,n,m,d,y),b.consume(n.events),r=-1;++r<n.events.length;){const v=n.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=BO(n.events,r))}return e}function gu(e,n,r,s,l,u){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},Zs(n.events,r[0])),e.add(r[0],0,[["exit",u,n]]));const m=Zs(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=Zs(n.events,r[2]),y=Zs(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]],v=n.events[r[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const k=r[2]+1,M=r[3]-r[2]-1;e.add(k,M,[])}}e.add(r[3]+1,0,[["exit",g,n]])}return l!==void 0&&(u.end=Object.assign({},Zs(n.events,l)),e.add(l,0,[["exit",u,n]]),u=void 0),u}function Tb(e,n,r,s,l){const u=[],c=Zs(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 Zs(e,n){const r=e[n],s=r[0]==="enter"?"start":"end";return r[1][s]}const IO={name:"tasklistCheck",tokenize:$O};function FO(){return{text:{91:IO}}}function $O(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 kt(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 Ue(m)?n(m):Ze(m)?e.check({tokenize:YO},n,r)(m):r(m)}}function YO(e,n,r){return st(e,s,"whitespace");function s(l){return l===null?r(l):n(l)}}function GO(e){return Fx([yO(),AO(),zO(e),PO(),FO()])}const VO={};function jb(e){const n=this,r=e||VO,s=n.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(GO(r)),u.push(dO()),c.push(mO(r))}function JO(e){c1(e,[/\r?\n|\r/g,XO])}function XO(){return{type:"break"}}function Ob(){return function(e){JO(e)}}function KO({connected:e,hostId:n,request:r,subscribeEvents:s,taskId:l,runId:u}){const c=Li(),[f,m]=D.useState(!0),[d,y]=D.useState([]),[g,b]=D.useState(),[v,k]=D.useState(),M=g==="started"||g==="monitoring",U=g==="followup",R=g==="started"||g==="followup",[P,q]=D.useState(null),[ae,B]=D.useState(!1),[L,K]=D.useState(""),[Y,$]=D.useState(!1),N=D.useRef(null),G=D.useRef(null),J=D.useRef(null),[le,re]=D.useState(u==="latest"?void 0:u),W=u==="latest"&&le===null;D.useEffect(()=>{if(u!=="latest"){re(u);return}e&&(re(void 0),r("taskrun.list",{task_id:l,limit:1}).then(_=>{var O,Z;return re(((Z=(O=_.entries)==null?void 0:O[0])==null?void 0:Z.run_id)??null)}).catch(()=>re(null)))},[u,l,e,r]);async function I(){if(le)try{const _=await r("task.result",{id:l,run_id:le});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 oe(_){var O;if(le)try{const A=(O=(await r("task.reports",{id:l,run_id:le,report_files:[_]})).reports)==null?void 0:O[0];A!=null&&A.data_url?q({file:_,data_url:A.data_url}):q({file:_,content:(A==null?void 0:A.content)??"Report not found."})}catch{q({file:_,content:"Failed to load report."})}}D.useEffect(()=>{!e||!le||(m(!0),I())},[e,l,le]),D.useEffect(()=>!e||!n||!le?void 0:s(n,async O=>{try{const Z=JSON.parse(new TextDecoder().decode(O.data));if(Z.event_type!=="running-state"&&Z.event_type!=="result-updated"||O.subject.split(".").pop()!==l||Z.event_type==="result-updated"&&Z.run_id&&Z.run_id!==le)return;I()}catch{}}),[e,n,l,le,s,r]),D.useEffect(()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)},[d]),D.useEffect(()=>{f||W||!le||J.current!==le&&(J.current=le,requestAnimationFrame(()=>{var _;N.current&&(N.current.scrollTop=N.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"}),R||(_=G.current)==null||_.focus()}))},[f,W,le,R]);function ye(_){if(_==="input")return"User Input";if(_==="permission")return"Permission";if(_==="confirmation")return"Confirmation"}function ke(_){return _==="started"?"Task started":_==="finished"?"Task finished":_==="failed"?"Task failed":_==="error"?"Command failed":_==="aborted"?"Task aborted":_==="confirmation"?"Task confirmed":_==="stopped"?"Follow-up stopped":_??""}return w.jsxs("div",{className:"run-detail",children:[w.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),W?w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{className:"empty-state-text",children:"No runs yet"}),w.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?w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[w.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"chat-thread",ref:N,children:[d.map((_,O)=>{const Z=R&&_.role==="assistant"&&!d.slice(O+1).some(A=>A.role==="assistant"||A.role==="user");return _.role==="status"&&_.type==="monitoring"?null:_.role==="status"?w.jsxs("div",{className:`chat-status${_.type==="error"?" chat-status--error":""}`,children:[w.jsxs("div",{children:[ke(_.type),_.time>0&&w.jsx("span",{className:"chat-status-time",children:zu(_.time)})]}),_.content&&w.jsx("pre",{className:"chat-status-detail",children:_.content})]},O):w.jsxs("div",{className:`chat-message chat-message--${_.role}`,children:[_.role==="assistant"&&v&&w.jsx("div",{className:"chat-message-agent",children:fd(v)}),w.jsxs("div",{className:"chat-message-content",children:[w.jsx(wb,{remarkPlugins:[jb,Ob],children:_.content}),Z&&w.jsxs("div",{className:"chat-typing-indicator",children:[w.jsx("span",{}),w.jsx("span",{}),w.jsx("span",{})]})]}),_.attachments&&_.attachments.length>0&&w.jsx("div",{className:"chat-message-attachments",children:_.attachments.map(A=>w.jsx("button",{className:"chat-attachment-chip",onClick:()=>oe(A),children:A},A))}),w.jsxs("div",{className:"chat-message-meta",children:[ye(_.type)&&w.jsx("span",{className:"chat-message-type",children:ye(_.type)}),_.time>0&&w.jsx("span",{children:zu(_.time)})]})]},O)}),R&&(()=>{const _=d.filter(O=>O.role!=="status");return _.length===0||_[_.length-1].role!=="assistant"})()&&w.jsxs("div",{className:"chat-message chat-message--assistant",children:[v&&w.jsx("div",{className:"chat-message-agent",children:fd(v)}),w.jsxs("div",{className:"chat-typing-indicator",children:[w.jsx("span",{}),w.jsx("span",{}),w.jsx("span",{})]})]}),g==="monitoring"&&w.jsxs("div",{className:"chat-monitoring-indicator",children:[w.jsx("span",{className:"chat-monitoring-dot"}),"Monitoring command output"]})]}),M?w.jsx("div",{className:"chat-abort-bar",children:w.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?w.jsx("div",{className:"chat-input-bar",children:w.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:le})}catch(_){console.error("Stop failed:",_)}finally{B(!1)}},children:w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:w.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):w.jsxs("form",{className:"chat-input-bar",onSubmit:async _=>{_.preventDefault();const O=L.trim();if(!(!O||Y)){$(!0);try{await r("task.followup",{id:l,run_id:le,message:O}),K("")}catch(Z){console.error("Follow-up failed:",Z)}finally{$(!1)}}},children:[w.jsx("input",{ref:G,className:"chat-input",type:"text",placeholder:"Follow-up message",value:L,onChange:_=>K(_.target.value),disabled:Y}),w.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!L.trim()||Y,children:w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),w.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),P&&w.jsx("div",{className:"report-dialog-overlay",onClick:()=>q(null),children:w.jsxs("div",{className:"report-dialog",onClick:_=>_.stopPropagation(),children:[w.jsxs("div",{className:"report-dialog-header",children:[w.jsx("span",{className:"report-dialog-title",children:P.file}),w.jsx("button",{className:"report-dialog-close",onClick:()=>q(null),"aria-label":"Close",children:w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),w.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),w.jsx("div",{className:"report-dialog-body",children:P.data_url?w.jsx("img",{src:P.data_url,alt:P.file,style:{maxWidth:"100%",height:"auto"}}):w.jsx(wb,{remarkPlugins:[jb,Ob],components:{a:({..._})=>w.jsx("a",{..._,target:"_blank",rel:"noopener noreferrer"})},children:P.content??""})})]})})]})}function QO(){const{getActiveHost:e}=ql(),n=e(),r=D.useRef(null);D.useEffect(()=>{if(zi.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 nk("/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 tk("/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 ZO="0.8.0";function WO(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 xl(){var ze;const{pairedHosts:e,activeHostId:n,removePairedHost:r}=ql(),{connected:s,request:l,subscribeEvents:u,unauthorized:c}=Vu(),f=Li(),m=kr(),d=DS(),y=Tx("(min-width: 768px)"),g=m.pathname.startsWith("/tasks"),b=d.runId?void 0:d.taskId,v=!!(d.taskId&&d.runId),[k,M]=D.useState(!1),[U,R]=D.useState(!1),[P,q]=D.useState(null),[ae,B]=D.useState(null),[L,K]=D.useState({}),[Y,$]=D.useState([]),[N,G]=D.useState(),[J,le]=D.useState(new Map),[re,W]=D.useState(new Map),[I,oe]=D.useState(new Map),[ye,ke]=D.useState(new Map);QO(),D.useEffect(()=>{window.scrollTo(0,0)},[n]),D.useEffect(()=>{s&&l("host.info").then(ue=>{var nt,He,at,we,Me,Pe;$(ue.agents??[]),G(ue.host_platform),K(ue.capability_tokens??{}),sk(ue.agents??[]);const Le=ue.version??null;B(Le),M(!!Le&&WO(Le,ZO));const We=new Map,wt=new Map,Ie=new Map,it=new Map;for(const $e of ue.pending_prompts??[])if($e.type==="confirmation")We.set($e.key,{description:((nt=$e.meta)==null?void 0:nt.description)??"",sessionName:(He=$e.meta)==null?void 0:He.session_name});else if($e.type==="permission")wt.set($e.key,{permissions:$e.params??[],sessionName:(at=$e.meta)==null?void 0:at.session_name});else if($e.type==="input"){const Gt=$e.params??((we=$e.meta)==null?void 0:we.input_questions)??[];Ie.set($e.key,{questions:Gt,description:(Me=$e.meta)==null?void 0:Me.description,sessionName:(Pe=$e.meta)==null?void 0:Pe.session_name}),it.set($e.key,new Array(Gt.length).fill(""))}le(We),W(wt),oe(Ie),ke(it)}).catch(()=>{})},[s,n,l]),D.useEffect(()=>!s||!n?void 0:u(n,Le=>{const We=Le.subject.split(".");if(We.length<3)return;const wt=We.slice(2).join(".");let Ie={};try{Ie=JSON.parse(new TextDecoder().decode(Le.data))}catch{return}const it=Ie.event_type,nt=Ie.session_id;if(it==="input-request"&&nt){const He=Ie.input_questions,at=Ie.session_name,we=Ie.description;He!=null&&He.length&&(oe(Me=>{if(Me.has(nt))return Me;const Pe=new Map(Me);return Pe.set(nt,{questions:He,description:we,sessionName:at}),Pe}),ke(Me=>{if(Me.has(nt))return Me;const Pe=new Map(Me);return Pe.set(nt,new Array(He.length).fill("")),Pe}));return}if(it==="input-resolved"&&nt){oe(He=>{if(!He.has(nt))return He;const at=new Map(He);return at.delete(nt),at}),ke(He=>{const at=new Map(He);return at.delete(nt),at});return}if(it==="confirm-request"&&nt){const He=Ie.description,at=Ie.session_name;He&&le(we=>{if(we.has(nt))return we;const Me=new Map(we);return Me.set(nt,{description:He,sessionName:at}),Me});return}if(it==="confirm-resolved"&&nt){le(He=>{if(!He.has(nt))return He;const at=new Map(He);return at.delete(nt),at});return}if(it==="permission-request"){const He=Ie.required_permissions,at=Ie.session_name;He!=null&&He.length&&W(we=>{if(we.has(wt))return we;const Me=new Map(we);return Me.set(wt,{permissions:He,sessionName:at}),Me});return}if(it==="permission-resolved"){W(He=>{if(!He.has(wt))return He;const at=new Map(He);return at.delete(wt),at});return}}),[s,n,u]);async function _(ue,Le){try{await l("task.user_input",{id:ue,value:[Le]})}catch(We){console.error("[Dashboard] Failed to respond to confirmation:",We)}}async function O(ue,Le){try{await l("task.user_input",{id:ue,value:[Le]})}catch(We){console.error("[Dashboard] Failed to respond to permission request:",We)}}async function Z(ue,Le){try{await l("task.user_input",{id:ue,value:Le})}catch(We){console.error("[Dashboard] Failed to respond to input request:",We)}}function A(ue,Le){us()&&f(Le?`/runs/${encodeURIComponent(ue)}/${encodeURIComponent(Le)}`:`/runs/${encodeURIComponent(ue)}`)}async function xe(){R(!0),q(null);try{const ue=await l("host.update");if(ue.error){q(ue.error),R(!1);return}}catch{}setTimeout(()=>window.location.reload(),1e4)}const he=e.length>0,Se=he&&s&&n&&!c,Te=((ze=e.find(ue=>ue.hostId===n))==null?void 0:ze.clientToken)??null;return w.jsxs("div",{className:"dashboard",children:[y&&w.jsx(U0,{daemonVersion:ae,capabilityTokens:L,activeClientToken:Te,request:l,onCapabilityTokensChange:K}),w.jsxs("div",{className:"dashboard-content",children:[w.jsxs("div",{className:"tab-bar",children:[!y&&w.jsx(U0,{daemonVersion:ae,capabilityTokens:L,activeClientToken:Te,request:l,onCapabilityTokensChange:K}),w.jsx(vk,{})]}),w.jsx("main",{className:"dashboard-main",children:c?w.jsxs("div",{className:"revoked-state",children:[w.jsx("div",{className:"revoked-icon",children:w.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),w.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),w.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),w.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),w.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),w.jsx("div",{className:"revoked-command",children:w.jsx("code",{children:"palmier pair"})}),w.jsxs("div",{className:"revoked-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>{us()&&f("/pair")},children:"Re-pair Device"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>{n&&r(n)},children:"Remove Host"})]})]}):Se?w.jsxs(w.Fragment,{children:[g&&!v&&w.jsx(xk,{connected:s,hostId:n,request:l,subscribeEvents:u,agents:Y,hostPlatform:N,onViewRun:A}),v?w.jsx(KO,{connected:s,hostId:n,request:l,subscribeEvents:u,taskId:d.taskId,runId:decodeURIComponent(d.runId)}):g?null:w.jsx(Ck,{connected:s,hostId:n,request:l,subscribeEvents:u,agents:Y,filterTaskId:b,onClearFilter:()=>{us()&&f("/")}})]}):w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{children:he?"Connecting to host...":"No hosts paired yet."}),!he&&w.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Pair Host"})]})}),k&&!U&&!P&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Update Required"}),w.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."]}),w.jsx("div",{className:"confirm-modal-actions",children:w.jsx("button",{className:"btn btn-primary",onClick:xe,children:"Update Now"})})]})}),U&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),w.jsx("p",{className:"confirm-modal-message",children:"Installing update and restarting daemon. Please wait..."})]})}),P&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),w.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:P}),w.jsx("div",{className:"confirm-modal-actions",children:w.jsx("button",{className:"btn btn-secondary",onClick:()=>{q(null)},children:"Retry"})})]})})]}),_u.createPortal(w.jsxs(w.Fragment,{children:[[...J.entries()].map(([ue,{description:Le,sessionName:We}])=>w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),We&&w.jsx("p",{className:"confirm-modal-subtitle",children:We}),w.jsx("p",{className:"confirm-modal-message",children:Le}),w.jsxs("div",{className:"confirm-modal-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>_(ue,"confirmed"),children:"Confirm"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>_(ue,"aborted"),children:"Abort"})]})]})},ue)),[...re.entries()].map(([ue,{permissions:Le,sessionName:We}])=>w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal permission-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),w.jsx("p",{className:"confirm-modal-message",children:w.jsx("strong",{children:We||ue})}),w.jsx("div",{className:"permission-list",children:Le.map((wt,Ie)=>w.jsxs("div",{className:"permission-item",children:[w.jsx("span",{className:"permission-name",children:wt.name}),wt.description&&w.jsx("span",{className:"permission-desc",children:wt.description})]},Ie))}),w.jsxs("div",{className:"permission-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>O(ue,"granted"),children:"Allow Once"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>O(ue,"granted_all"),children:"Allow Always"})]}),w.jsx("button",{className:"permission-abort-link",onClick:()=>O(ue,"aborted"),children:"Deny & Abort Task"})]})},ue)),[...I.entries()].map(([ue,{questions:Le,description:We,sessionName:wt}])=>{const Ie=ye.get(ue)??new Array(Le.length).fill("");return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal input-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),wt&&w.jsx("p",{className:"confirm-modal-subtitle",children:wt}),We&&w.jsx("p",{className:"confirm-modal-message",children:We}),w.jsx("div",{className:"input-list",children:Le.map((it,nt)=>w.jsxs("div",{className:"input-item",children:[w.jsx("label",{className:"input-label",children:it}),w.jsx("input",{type:"text",className:"input-field",value:Ie[nt]??"",onChange:He=>{ke(at=>{const we=new Map(at),Me=[...we.get(ue)??[]];return Me[nt]=He.target.value,we.set(ue,Me),we})},autoFocus:nt===0})]},nt))}),w.jsx("div",{className:"input-actions",children:w.jsx("button",{className:"btn btn-primary",disabled:Ie.some(it=>!it.trim()),onClick:()=>Z(ue,Ie),children:"Submit"})}),w.jsx("button",{className:"permission-abort-link",onClick:()=>Z(ue,["aborted"]),children:"Cancel"})]})},ue)})]}),document.body)]})}const eN=ga("Preferences",{web:()=>Ax(()=>import("./web-D7Kq3Nvk.js"),[]).then(e=>new e.PreferencesWeb)}),vl=!!window.__PALMIER_SERVE__;function tN(){const[e,n]=D.useState(""),[r,s]=D.useState(!1),[l,u]=D.useState(null),{addPairedHost:c}=ql(),f=Li();async function m(){const d=e.trim().toUpperCase();if(!d){u("Enter a pairing code.");return}s(!0),u(null);try{let y;if(vl){const b=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,label:navigator.userAgent})});if(!b.ok){const v=await b.json().catch(()=>({error:"Connection failed"}));throw new Error(v.error||`HTTP ${b.status}`)}y=await b.json()}else{const b=await fetch(`${Du}/api/config`);if(!b.ok)throw new Error("Failed to fetch server config");const v=await b.json();if(!v.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const k=await vx({servers:v.natsWsUrl,authenticator:fx(v.natsJwt,new TextEncoder().encode(v.natsNkeySeed))}),M=Au(),U=`pair.${d}`,R=await k.request(U,M.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});y=JSON.parse(M.decode(R.data)),await k.close()}const g={hostId:y.hostId,clientToken:y.clientToken,directUrl:vl?window.location.origin:void 0};if(c(g),zi.isNativePlatform()&&Kt){await eN.set({key:"hostId",value:y.hostId});try{const{token:b}=await Kt.getFcmToken();await fetch(`${Du}/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 w.jsx("div",{className:"pair-page",children:w.jsxs("div",{className:"pair-card",children:[w.jsxs("div",{className:"pair-header",children:[w.jsx("h1",{className:"pair-title",children:vl?"Pair":"Pair with Host"}),w.jsx("p",{className:"pair-subtitle",children:vl?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!vl&&w.jsxs("div",{className:"pair-instructions",children:[w.jsxs("div",{className:"pair-instruction-block",children:[w.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),w.jsxs("ol",{className:"pair-steps",children:[w.jsxs("li",{children:["Install at least one agent CLI (e.g., ",w.jsx("a",{href:"https://www.palmier.me/agents",target:"_blank",rel:"noopener noreferrer",children:"Claude Code, Gemini CLI, Codex CLI"}),")"]}),w.jsxs("li",{children:["Install Palmier on your host machine:",w.jsx("code",{className:"pair-command",children:"npm install -g palmier"})]}),w.jsxs("li",{children:["Run the setup wizard:",w.jsx("code",{className:"pair-command",children:"palmier init"})]}),w.jsx("li",{children:"A pairing code will display automatically"})]})]}),w.jsx("div",{className:"pair-instruction-divider"}),w.jsxs("div",{className:"pair-instruction-block",children:[w.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),w.jsxs("ol",{className:"pair-steps",children:[w.jsxs("li",{children:["Run ",w.jsx("code",{children:"palmier pair"})," on the host machine"]}),w.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),w.jsxs("div",{className:"pair-form",children:[w.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",w.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&&w.jsx("p",{className:"pair-error",children:l}),w.jsxs("button",{className:"btn btn-primary btn-full",onClick:m,disabled:r||!e.trim(),children:[r&&w.jsx("span",{className:"btn-spinner"}),r?"Pairing...":"Pair"]}),w.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>f("/"),disabled:r,children:"Cancel"}),w.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",w.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",w.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function nN(){const e=Li();return D.useEffect(()=>{if(!Kt)return;const n=Kt.addListener("deepLink",({path:r})=>e(r));return()=>{n.then(r=>r.remove())}},[e]),null}function rN(){return w.jsx(M_,{children:w.jsxs(ik,{children:[w.jsx(nN,{}),w.jsxs(XS,{children:[w.jsx(ls,{path:"/",element:w.jsx(xl,{})}),w.jsx(ls,{path:"/tasks",element:w.jsx(xl,{})}),w.jsx(ls,{path:"/runs",element:w.jsx(xl,{})}),w.jsx(ls,{path:"/runs/:taskId",element:w.jsx(xl,{})}),w.jsx(ls,{path:"/runs/:taskId/:runId",element:w.jsx(xl,{})}),w.jsx(ls,{path:"/pair",element:w.jsx(tN,{})})]})]})})}Qw.createRoot(document.getElementById("root")).render(w.jsx(D.StrictMode,{children:w.jsx(x_,{children:w.jsx(rN,{})})}));export{Bd as W};