palmier 0.7.8 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +1 -1
  2. package/dist/commands/run.js +55 -0
  3. package/dist/commands/serve.js +22 -2
  4. package/dist/event-queues.d.ts +36 -0
  5. package/dist/event-queues.js +53 -0
  6. package/dist/mcp-tools.d.ts +2 -0
  7. package/dist/mcp-tools.js +4 -2
  8. package/dist/platform/linux.js +11 -8
  9. package/dist/platform/windows.d.ts +5 -6
  10. package/dist/platform/windows.js +19 -13
  11. package/dist/pwa/assets/index-FP1Mipr6.js +120 -0
  12. package/dist/pwa/assets/index-bLTn8zBj.css +1 -0
  13. package/dist/pwa/assets/{web-BNr628AV.js → web-BpM3fNCn.js} +1 -1
  14. package/dist/pwa/assets/{web-DyQPewAi.js → web-CF-N8Di6.js} +1 -1
  15. package/dist/pwa/index.html +2 -2
  16. package/dist/pwa/service-worker.js +1 -1
  17. package/dist/rpc-handler.js +25 -9
  18. package/dist/task.js +1 -1
  19. package/dist/transports/http-transport.js +18 -5
  20. package/dist/types.d.ts +10 -6
  21. package/package.json +1 -1
  22. package/palmier-server/README.md +3 -3
  23. package/palmier-server/pwa/src/App.css +117 -36
  24. package/palmier-server/pwa/src/components/PullToRefreshIndicator.tsx +46 -0
  25. package/palmier-server/pwa/src/components/RunDetailView.tsx +58 -15
  26. package/palmier-server/pwa/src/components/SessionComposer.tsx +20 -10
  27. package/palmier-server/pwa/src/components/{RunsView.tsx → SessionsView.tsx} +33 -25
  28. package/palmier-server/pwa/src/components/TaskCard.tsx +33 -35
  29. package/palmier-server/pwa/src/components/TaskForm.tsx +274 -293
  30. package/palmier-server/pwa/src/components/{TaskListView.tsx → TasksView.tsx} +20 -13
  31. package/palmier-server/pwa/src/contexts/HostStoreContext.tsx +16 -8
  32. package/palmier-server/pwa/src/hooks/usePullToRefresh.ts +102 -0
  33. package/palmier-server/pwa/src/pages/Dashboard.tsx +9 -26
  34. package/palmier-server/pwa/src/types.ts +5 -9
  35. package/palmier-server/spec.md +23 -23
  36. package/src/commands/run.ts +61 -0
  37. package/src/commands/serve.ts +22 -2
  38. package/src/event-queues.ts +56 -0
  39. package/src/mcp-tools.ts +6 -2
  40. package/src/platform/linux.ts +10 -8
  41. package/src/platform/windows.ts +19 -13
  42. package/src/rpc-handler.ts +28 -11
  43. package/src/task.ts +1 -1
  44. package/src/transports/http-transport.ts +17 -5
  45. package/src/types.ts +10 -7
  46. package/dist/pwa/assets/index-8cTctVnD.js +0 -120
  47. package/dist/pwa/assets/index-CSUkBBsQ.css +0 -1
@@ -0,0 +1,120 @@
1
+ var Vw=Object.defineProperty;var Jw=(e,n,r)=>n in e?Vw(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var C=(e,n,r)=>Jw(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"]'))a(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"&&a(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 a(l){if(l.ep)return;l.ep=!0;const u=r(l);fetch(l.href,u)}})();function Ub(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ah={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 Yy;function Xw(){if(Yy)return cl;Yy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(a,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:a,key:c,ref:l!==void 0?l:null,props:u}}return cl.Fragment=n,cl.jsx=r,cl.jsxs=r,cl}var Gy;function Kw(){return Gy||(Gy=1,ah.exports=Xw()),ah.exports}var v=Kw(),sh={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 Vy;function Qw(){if(Vy)return Fe;Vy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function w(N){return N===null||typeof N!="object"?null:(N=b&&N[b]||N["@@iterator"],typeof N=="function"?N:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,U={};function O(N,Z,A){this.props=N,this.context=Z,this.refs=U,this.updater=A||k}O.prototype.isReactComponent={},O.prototype.setState=function(N,Z){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,Z,"setState")},O.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function P(){}P.prototype=O.prototype;function q(N,Z,A){this.props=N,this.context=Z,this.refs=U,this.updater=A||k}var oe=q.prototype=new P;oe.constructor=q,M(oe,O.prototype),oe.isPureReactComponent=!0;var B=Array.isArray;function z(){}var K={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function $(N,Z,A){var ve=A.ref;return{$$typeof:e,type:N,key:Z,ref:ve!==void 0?ve:null,props:A}}function D(N,Z){return $(N.type,Z,N.props)}function Y(N){return typeof N=="object"&&N!==null&&N.$$typeof===e}function J(N){var Z={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(A){return Z[A]})}var W=/\/+/g;function se(N,Z){return typeof N=="object"&&N!==null&&N.key!=null?J(""+N.key):Z.toString(36)}function ne(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(z,z):(N.status="pending",N.then(function(Z){N.status==="pending"&&(N.status="fulfilled",N.value=Z)},function(Z){N.status==="pending"&&(N.status="rejected",N.reason=Z)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function V(N,Z,A,ve,Ne){var Te=typeof N;(Te==="undefined"||Te==="boolean")&&(N=null);var Le=!1;if(N===null)Le=!0;else switch(Te){case"bigint":case"string":case"number":Le=!0;break;case"object":switch(N.$$typeof){case e:case n:Le=!0;break;case y:return Le=N._init,V(Le(N._payload),Z,A,ve,Ne)}}if(Le)return Ne=Ne(N),Le=ve===""?"."+se(N,0):ve,B(Ne)?(A="",Le!=null&&(A=Le.replace(W,"$&/")+"/"),V(Ne,Z,A,"",function(ze){return ze})):Ne!=null&&(Y(Ne)&&(Ne=D(Ne,A+(Ne.key==null||N&&N.key===Ne.key?"":(""+Ne.key).replace(W,"$&/")+"/")+Le)),Z.push(Ne)),1;Le=0;var Ie=ve===""?".":ve+":";if(B(N))for(var ge=0;ge<N.length;ge++)ve=N[ge],Te=Ie+se(ve,ge),Le+=V(ve,Z,A,Te,Ne);else if(ge=w(N),typeof ge=="function")for(N=ge.call(N),ge=0;!(ve=N.next()).done;)ve=ve.value,Te=Ie+se(ve,ge++),Le+=V(ve,Z,A,Te,Ne);else if(Te==="object"){if(typeof N.then=="function")return V(ne(N),Z,A,ve,Ne);throw Z=String(N),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return Le}function ie(N,Z,A){if(N==null)return N;var ve=[],Ne=0;return V(N,ve,"","",function(Te){return Z.call(A,Te,Ne++)}),ve}function pe(N){if(N._status===-1){var Z=N._result;Z=Z(),Z.then(function(A){(N._status===0||N._status===-1)&&(N._status=1,N._result=A)},function(A){(N._status===0||N._status===-1)&&(N._status=2,N._result=A)}),N._status===-1&&(N._status=0,N._result=Z)}if(N._status===1)return N._result.default;throw N._result}var Ee=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},E={map:ie,forEach:function(N,Z,A){ie(N,function(){Z.apply(this,arguments)},A)},count:function(N){var Z=0;return ie(N,function(){Z++}),Z},toArray:function(N){return ie(N,function(Z){return Z})||[]},only:function(N){if(!Y(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return Fe.Activity=g,Fe.Children=E,Fe.Component=O,Fe.Fragment=r,Fe.Profiler=l,Fe.PureComponent=q,Fe.StrictMode=a,Fe.Suspense=m,Fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=K,Fe.__COMPILER_RUNTIME={__proto__:null,c:function(N){return K.H.useMemoCache(N)}},Fe.cache=function(N){return function(){return N.apply(null,arguments)}},Fe.cacheSignal=function(){return null},Fe.cloneElement=function(N,Z,A){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var ve=M({},N.props),Ne=N.key;if(Z!=null)for(Te in Z.key!==void 0&&(Ne=""+Z.key),Z)!F.call(Z,Te)||Te==="key"||Te==="__self"||Te==="__source"||Te==="ref"&&Z.ref===void 0||(ve[Te]=Z[Te]);var Te=arguments.length-2;if(Te===1)ve.children=A;else if(1<Te){for(var Le=Array(Te),Ie=0;Ie<Te;Ie++)Le[Ie]=arguments[Ie+2];ve.children=Le}return $(N.type,Ne,ve)},Fe.createContext=function(N){return N={$$typeof:c,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:u,_context:N},N},Fe.createElement=function(N,Z,A){var ve,Ne={},Te=null;if(Z!=null)for(ve in Z.key!==void 0&&(Te=""+Z.key),Z)F.call(Z,ve)&&ve!=="key"&&ve!=="__self"&&ve!=="__source"&&(Ne[ve]=Z[ve]);var Le=arguments.length-2;if(Le===1)Ne.children=A;else if(1<Le){for(var Ie=Array(Le),ge=0;ge<Le;ge++)Ie[ge]=arguments[ge+2];Ne.children=Ie}if(N&&N.defaultProps)for(ve in Le=N.defaultProps,Le)Ne[ve]===void 0&&(Ne[ve]=Le[ve]);return $(N,Te,Ne)},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(N){return{$$typeof:f,render:N}},Fe.isValidElement=Y,Fe.lazy=function(N){return{$$typeof:y,_payload:{_status:-1,_result:N},_init:pe}},Fe.memo=function(N,Z){return{$$typeof:d,type:N,compare:Z===void 0?null:Z}},Fe.startTransition=function(N){var Z=K.T,A={};K.T=A;try{var ve=N(),Ne=K.S;Ne!==null&&Ne(A,ve),typeof ve=="object"&&ve!==null&&typeof ve.then=="function"&&ve.then(z,Ee)}catch(Te){Ee(Te)}finally{Z!==null&&A.types!==null&&(Z.types=A.types),K.T=Z}},Fe.unstable_useCacheRefresh=function(){return K.H.useCacheRefresh()},Fe.use=function(N){return K.H.use(N)},Fe.useActionState=function(N,Z,A){return K.H.useActionState(N,Z,A)},Fe.useCallback=function(N,Z){return K.H.useCallback(N,Z)},Fe.useContext=function(N){return K.H.useContext(N)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(N,Z){return K.H.useDeferredValue(N,Z)},Fe.useEffect=function(N,Z){return K.H.useEffect(N,Z)},Fe.useEffectEvent=function(N){return K.H.useEffectEvent(N)},Fe.useId=function(){return K.H.useId()},Fe.useImperativeHandle=function(N,Z,A){return K.H.useImperativeHandle(N,Z,A)},Fe.useInsertionEffect=function(N,Z){return K.H.useInsertionEffect(N,Z)},Fe.useLayoutEffect=function(N,Z){return K.H.useLayoutEffect(N,Z)},Fe.useMemo=function(N,Z){return K.H.useMemo(N,Z)},Fe.useOptimistic=function(N,Z){return K.H.useOptimistic(N,Z)},Fe.useReducer=function(N,Z,A){return K.H.useReducer(N,Z,A)},Fe.useRef=function(N){return K.H.useRef(N)},Fe.useState=function(N){return K.H.useState(N)},Fe.useSyncExternalStore=function(N,Z,A){return K.H.useSyncExternalStore(N,Z,A)},Fe.useTransition=function(){return K.H.useTransition()},Fe.version="19.2.4",Fe}var Jy;function kd(){return Jy||(Jy=1,sh.exports=Qw()),sh.exports}var R=kd(),lh={exports:{}},fl={},oh={exports:{}},uh={};/**
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 Xy;function Zw(){return Xy||(Xy=1,(function(e){function n(V,ie){var pe=V.length;V.push(ie);e:for(;0<pe;){var Ee=pe-1>>>1,E=V[Ee];if(0<l(E,ie))V[Ee]=ie,V[pe]=E,pe=Ee;else break e}}function r(V){return V.length===0?null:V[0]}function a(V){if(V.length===0)return null;var ie=V[0],pe=V.pop();if(pe!==ie){V[0]=pe;e:for(var Ee=0,E=V.length,N=E>>>1;Ee<N;){var Z=2*(Ee+1)-1,A=V[Z],ve=Z+1,Ne=V[ve];if(0>l(A,pe))ve<E&&0>l(Ne,A)?(V[Ee]=Ne,V[ve]=pe,Ee=ve):(V[Ee]=A,V[Z]=pe,Ee=Z);else if(ve<E&&0>l(Ne,pe))V[Ee]=Ne,V[ve]=pe,Ee=ve;else break e}}return ie}function l(V,ie){var pe=V.sortIndex-ie.sortIndex;return pe!==0?pe:V.id-ie.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],d=[],y=1,g=null,b=3,w=!1,k=!1,M=!1,U=!1,O=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function oe(V){for(var ie=r(d);ie!==null;){if(ie.callback===null)a(d);else if(ie.startTime<=V)a(d),ie.sortIndex=ie.expirationTime,n(m,ie);else break;ie=r(d)}}function B(V){if(M=!1,oe(V),!k)if(r(m)!==null)k=!0,z||(z=!0,J());else{var ie=r(d);ie!==null&&ne(B,ie.startTime-V)}}var z=!1,K=-1,F=5,$=-1;function D(){return U?!0:!(e.unstable_now()-$<F)}function Y(){if(U=!1,z){var V=e.unstable_now();$=V;var ie=!0;try{e:{k=!1,M&&(M=!1,P(K),K=-1),w=!0;var pe=b;try{t:{for(oe(V),g=r(m);g!==null&&!(g.expirationTime>V&&D());){var Ee=g.callback;if(typeof Ee=="function"){g.callback=null,b=g.priorityLevel;var E=Ee(g.expirationTime<=V);if(V=e.unstable_now(),typeof E=="function"){g.callback=E,oe(V),ie=!0;break t}g===r(m)&&a(m),oe(V)}else a(m);g=r(m)}if(g!==null)ie=!0;else{var N=r(d);N!==null&&ne(B,N.startTime-V),ie=!1}}break e}finally{g=null,b=pe,w=!1}ie=void 0}}finally{ie?J():z=!1}}}var J;if(typeof q=="function")J=function(){q(Y)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,se=W.port2;W.port1.onmessage=Y,J=function(){se.postMessage(null)}}else J=function(){O(Y,0)};function ne(V,ie){K=O(function(){V(e.unstable_now())},ie)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(V){switch(b){case 1:case 2:case 3:var ie=3;break;default:ie=b}var pe=b;b=ie;try{return V()}finally{b=pe}},e.unstable_requestPaint=function(){U=!0},e.unstable_runWithPriority=function(V,ie){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var pe=b;b=V;try{return ie()}finally{b=pe}},e.unstable_scheduleCallback=function(V,ie,pe){var Ee=e.unstable_now();switch(typeof pe=="object"&&pe!==null?(pe=pe.delay,pe=typeof pe=="number"&&0<pe?Ee+pe:Ee):pe=Ee,V){case 1:var E=-1;break;case 2:E=250;break;case 5:E=1073741823;break;case 4:E=1e4;break;default:E=5e3}return E=pe+E,V={id:y++,callback:ie,priorityLevel:V,startTime:pe,expirationTime:E,sortIndex:-1},pe>Ee?(V.sortIndex=pe,n(d,V),r(m)===null&&V===r(d)&&(M?(P(K),K=-1):M=!0,ne(B,pe-Ee))):(V.sortIndex=E,n(m,V),k||w||(k=!0,z||(z=!0,J()))),V},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(V){var ie=b;return function(){var pe=b;b=ie;try{return V.apply(this,arguments)}finally{b=pe}}}})(uh)),uh}var Ky;function Ww(){return Ky||(Ky=1,oh.exports=Zw()),oh.exports}var ch={exports:{}},cn={};/**
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 Qy;function eS(){if(Qy)return cn;Qy=1;var e=kd();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 a={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 cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,cn.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)},cn.flushSync=function(m){var d=c.T,y=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=d,a.p=y,a.d.f()}},cn.preconnect=function(m,d){typeof m=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,a.d.C(m,d))},cn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},cn.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,w=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;y==="style"?a.d.S(m,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:w}):y==="script"&&a.d.X(m,{crossOrigin:g,integrity:b,fetchPriority:w,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},cn.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);a.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&&a.d.M(m)},cn.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);a.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})}},cn.preloadModule=function(m,d){if(typeof m=="string")if(d){var y=f(d.as,d.crossOrigin);a.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 a.d.m(m)},cn.requestFormReset=function(m){a.d.r(m)},cn.unstable_batchedUpdates=function(m,d){return m(d)},cn.useFormState=function(m,d,y){return c.H.useFormState(m,d,y)},cn.useFormStatus=function(){return c.H.useHostTransitionStatus()},cn.version="19.2.4",cn}var Zy;function Bb(){if(Zy)return ch.exports;Zy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),ch.exports=eS(),ch.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 Wy;function tS(){if(Wy)return fl;Wy=1;var e=Ww(),n=kd(),r=Bb();function a(t){var i="https://react.dev/errors/"+t;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)i+="&args[]="+encodeURIComponent(arguments[s])}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,s=t;if(t.alternate)for(;i.return;)i=i.return;else{t=i;do i=t,(i.flags&4098)!==0&&(s=i.return),t=i.return;while(t)}return i.tag===3?s: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(a(188))}function d(t){var i=t.alternate;if(!i){if(i=u(t),i===null)throw Error(a(188));return i!==t?null:t}for(var s=t,o=i;;){var h=s.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){s=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===s)return m(h),t;if(p===o)return m(h),i;p=p.sibling}throw Error(a(188))}if(s.return!==o.return)s=h,o=p;else{for(var x=!1,S=h.child;S;){if(S===s){x=!0,s=h,o=p;break}if(S===o){x=!0,o=h,s=p;break}S=S.sibling}if(!x){for(S=p.child;S;){if(S===s){x=!0,s=p,o=h;break}if(S===o){x=!0,o=p,s=h;break}S=S.sibling}if(!x)throw Error(a(189))}}if(s.alternate!==o)throw Error(a(190))}if(s.tag!==3)throw Error(a(188));return s.stateNode.current===s?t:i}function y(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t;for(t=t.child;t!==null;){if(i=y(t),i!==null)return i;t=t.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),q=Symbol.for("react.context"),oe=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function J(t){return t===null||typeof t!="object"?null:(t=Y&&t[Y]||t["@@iterator"],typeof t=="function"?t:null)}var W=Symbol.for("react.client.reference");function se(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===W?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case M:return"Fragment";case O:return"Profiler";case U:return"StrictMode";case B:return"Suspense";case z:return"SuspenseList";case $:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case q:return t.displayName||"Context";case P:return(t._context.displayName||"Context")+".Consumer";case oe: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:se(t.type)||"Memo";case F:i=t._payload,t=t._init;try{return se(t(i))}catch{}}return null}var ne=Array.isArray,V=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},Ee=[],E=-1;function N(t){return{current:t}}function Z(t){0>E||(t.current=Ee[E],Ee[E]=null,E--)}function A(t,i){E++,Ee[E]=t.current,t.current=i}var ve=N(null),Ne=N(null),Te=N(null),Le=N(null);function Ie(t,i){switch(A(Te,i),A(Ne,t),A(ve,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?my(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=my(i),t=py(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Z(ve),A(ve,t)}function ge(){Z(ve),Z(Ne),Z(Te)}function ze(t){t.memoizedState!==null&&A(Le,t);var i=ve.current,s=py(i,t.type);i!==s&&(A(Ne,t),A(ve,s))}function Ke(t){Ne.current===t&&(Z(ve),Z(Ne)),Le.current===t&&(Z(Le),sl._currentValue=pe)}var pt,it;function He(t){if(pt===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);pt=i&&i[1]||"",it=-1<s.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+pt+t+it}var xe=!1;function ke(t,i){if(!t||xe)return"";xe=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(le){var re=le}Reflect.construct(t,[],me)}else{try{me.call()}catch(le){re=le}t.call(me.prototype)}}else{try{throw Error()}catch(le){re=le}(me=t())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(le){if(le&&re&&typeof le.stack=="string")return[le.stack,re.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),x=p[0],S=p[1];if(x&&S){var 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{xe=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?He(s):""}function Me(t,i){switch(t.tag){case 26:case 27:case 5:return He(t.type);case 16:return He("Lazy");case 13:return t.child!==i&&i!==null?He("Suspense Fallback"):He("Suspense");case 19:return He("SuspenseList");case 0:case 15:return ke(t.type,!1);case 11:return ke(t.type.render,!1);case 1:return ke(t.type,!0);case 31:return He("Activity");default:return""}}function Qe(t){try{var i="",s=null;do i+=Me(t,s),s=t,t=t.return;while(t);return i}catch(o){return`
47
+ Error generating stack: `+o.message+`
48
+ `+o.stack}}var Xe=Object.prototype.hasOwnProperty,Rt=e.unstable_scheduleCallback,gt=e.unstable_cancelCallback,sr=e.unstable_shouldYield,yr=e.unstable_requestPaint,xt=e.unstable_now,ni=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,we=e.unstable_UserBlockingPriority,Be=e.unstable_NormalPriority,Ge=e.unstable_LowPriority,st=e.unstable_IdlePriority,Wt=e.log,xn=e.unstable_setDisableYieldValue,Yt=null,dt=null;function Ut(t){if(typeof Wt=="function"&&xn(t),dt&&typeof dt.setStrictMode=="function")try{dt.setStrictMode(Yt,t)}catch{}}var be=Math.clz32?Math.clz32:$n,$e=Math.log,ut=Math.LN2;function $n(t){return t>>>=0,t===0?32:31-($e(t)/ut|0)|0}var qt=256,Or=262144,ri=4194304;function lr(t){var i=t&42;if(i!==0)return i;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function qi(t,i,s){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=lr(o):(x&=S,x!==0?h=lr(x):s||(s=S&~t,s!==0&&(h=lr(s))))):(S=o&~p,S!==0?h=lr(S):x!==0?h=lr(x):s||(s=o&~t,s!==0&&(h=lr(s)))),h===0?0:i!==0&&i!==h&&(i&p)===0&&(p=h&-h,s=i&-i,p>=s||p===32&&(s&4194048)!==0)?i:h}function Ii(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function vs(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 pa(){var t=ri;return ri<<=1,(ri&62914560)===0&&(ri=4194304),t}function ii(t){for(var i=[],s=0;31>s;s++)i.push(t);return i}function or(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function ai(t,i,s,o,h,p){var x=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var S=t.entanglements,H=t.expirationTimes,te=t.hiddenUpdates;for(s=x&~s;0<s;){var ce=31-be(s),me=1<<ce;S[ce]=0,H[ce]=-1;var re=te[ce];if(re!==null)for(te[ce]=null,ce=0;ce<re.length;ce++){var le=re[ce];le!==null&&(le.lane&=-536870913)}s&=~me}o!==0&&si(t,o,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(x&~i))}function si(t,i,s){t.pendingLanes|=i,t.suspendedLanes&=~i;var o=31-be(i);t.entangledLanes|=i,t.entanglements[o]=t.entanglements[o]|1073741824|s&261930}function Fi(t,i){var s=t.entangledLanes|=i;for(t=t.entanglements;s;){var o=31-be(s),h=1<<o;h&i|t[o]&i&&(t[o]|=i),s&=~h}}function li(t,i){var s=i&-i;return s=(s&42)!==0?1:Rr(s),(s&(t.suspendedLanes|i))!==0?0:s}function Rr(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 $i(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function ws(){var t=ie.p;return t!==0?t:(t=window.event,t===void 0?32:By(t.type))}function Gl(t,i){var s=ie.p;try{return ie.p=t,i()}finally{ie.p=s}}var br=Math.random().toString(36).slice(2),kt="__reactFiber$"+br,Bt="__reactProps$"+br,jn="__reactContainer$"+br,Yi="__reactEvents$"+br,Ss="__reactListeners$"+br,Vl="__reactHandles$"+br,Jl="__reactResources$"+br,Qt="__reactMarker$"+br;function ga(t){delete t[kt],delete t[Bt],delete t[Yi],delete t[Ss],delete t[Vl]}function _(t){var i=t[kt];if(i)return i;for(var s=t.parentNode;s;){if(i=s[jn]||s[kt]){if(s=i.alternate,i.child!==null||s!==null&&s.child!==null)for(t=Sy(t);t!==null;){if(s=t[kt])return s;t=Sy(t)}return i}t=s,s=t.parentNode}return null}function j(t){if(t=t[kt]||t[jn]){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(a(33))}function L(t){var i=t[Jl];return i||(i=t[Jl]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function I(t){t[Qt]=!0}var Q=new Set,de={};function ye(t,i){ae(t,i),ae(t+"Capture",i)}function ae(t,i){for(de[t]=i,t=0;t<i.length;t++)Q.add(i[t])}var he=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={},Ze={};function jt(t){return Xe.call(Ze,t)?!0:Xe.call(Oe,t)?!1:he.test(t)?Ze[t]=!0:(Oe[t]=!0,!1)}function un(t,i,s){if(jt(i))if(s===null)t.removeAttribute(i);else{switch(typeof s){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,""+s)}}function ur(t,i,s){if(s===null)t.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttribute(i,""+s)}}function Mr(t,i,s,o){if(o===null)t.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(i,s,""+o)}}function Yn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function sm(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function H1(t,i,s){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){s=""+x,p.call(this,x)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return s},setValue:function(x){s=""+x},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function Qu(t){if(!t._valueTracker){var i=sm(t)?"checked":"value";t._valueTracker=H1(t,i,""+t[i])}}function lm(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var s=i.getValue(),o="";return t&&(o=sm(t)?t.checked?"true":"false":t.value),t=o,t!==s?(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 q1=/[\n"\\]/g;function Gn(t){return t.replace(q1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Zu(t,i,s,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=""+Yn(i)):t.value!==""+Yn(i)&&(t.value=""+Yn(i)):x!=="submit"&&x!=="reset"||t.removeAttribute("value"),i!=null?Wu(t,x,Yn(i)):s!=null?Wu(t,x,Yn(s)):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=""+Yn(S):t.removeAttribute("name")}function om(t,i,s,o,h,p,x,S){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),i!=null||s!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){Qu(t);return}s=s!=null?""+Yn(s):"",i=i!=null?""+Yn(i):s,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),Qu(t)}function Wu(t,i,s){i==="number"&&Xl(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function ya(t,i,s,o){if(t=t.options,i){i={};for(var h=0;h<s.length;h++)i["$"+s[h]]=!0;for(s=0;s<t.length;s++)h=i.hasOwnProperty("$"+t[s].value),t[s].selected!==h&&(t[s].selected=h),h&&o&&(t[s].defaultSelected=!0)}else{for(s=""+Yn(s),i=null,h=0;h<t.length;h++){if(t[h].value===s){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}i!==null||t[h].disabled||(i=t[h])}i!==null&&(i.selected=!0)}}function um(t,i,s){if(i!=null&&(i=""+Yn(i),i!==t.value&&(t.value=i),s==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=s!=null?""+Yn(s):""}function cm(t,i,s,o){if(i==null){if(o!=null){if(s!=null)throw Error(a(92));if(ne(o)){if(1<o.length)throw Error(a(93));o=o[0]}s=o}s==null&&(s=""),i=s}s=Yn(i),t.defaultValue=s,o=t.textContent,o===s&&o!==""&&o!==null&&(t.value=o),Qu(t)}function ba(t,i){if(i){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=i;return}}t.textContent=i}var I1=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 fm(t,i,s){var o=i.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?o?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="":o?t.setProperty(i,s):typeof s!="number"||s===0||I1.has(i)?i==="float"?t.cssFloat=s:t[i]=(""+s).trim():t[i]=s+"px"}function hm(t,i,s){if(i!=null&&typeof i!="object")throw Error(a(62));if(t=t.style,s!=null){for(var o in s)!s.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)&&s[h]!==o&&fm(t,h,o)}else for(var p in i)i.hasOwnProperty(p)&&fm(t,p,i[p])}function ec(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 F1=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"]]),$1=/^[\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 $1.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Dr(){}var tc=null;function nc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var xa=null,va=null;function dm(t){var i=j(t);if(i&&(t=i.stateNode)){var s=t[Bt]||null;e:switch(t=i.stateNode,i.type){case"input":if(Zu(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),i=s.name,s.type==="radio"&&i!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Gn(""+i)+'"][type="radio"]'),i=0;i<s.length;i++){var o=s[i];if(o!==t&&o.form===t.form){var h=o[Bt]||null;if(!h)throw Error(a(90));Zu(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<s.length;i++)o=s[i],o.form===t.form&&lm(o)}break e;case"textarea":um(t,s.value,s.defaultValue);break e;case"select":i=s.value,i!=null&&ya(t,!!s.multiple,i,!1)}}}var rc=!1;function mm(t,i,s){if(rc)return t(i,s);rc=!0;try{var o=t(i);return o}finally{if(rc=!1,(xa!==null||va!==null)&&(Bo(),xa&&(i=xa,t=va,va=xa=null,dm(i),t)))for(i=0;i<t.length;i++)dm(t[i])}}function _s(t,i){var s=t.stateNode;if(s===null)return null;var o=s[Bt]||null;if(o===null)return null;s=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(s&&typeof s!="function")throw Error(a(231,i,typeof s));return s}var Lr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ic=!1;if(Lr)try{var Es={};Object.defineProperty(Es,"passive",{get:function(){ic=!0}}),window.addEventListener("test",Es,Es),window.removeEventListener("test",Es,Es)}catch{ic=!1}var oi=null,ac=null,Ql=null;function pm(){if(Ql)return Ql;var t,i=ac,s=i.length,o,h="value"in oi?oi.value:oi.textContent,p=h.length;for(t=0;t<s&&i[t]===h[t];t++);var x=s-t;for(o=1;o<=x&&i[s-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 gm(){return!1}function vn(t){function i(s,o,h,p,x){this._reactName=s,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=x,this.currentTarget=null;for(var S in t)t.hasOwnProperty(S)&&(s=t[S],this[S]=s?s(p):p[S]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Wl:gm,this.isPropagationStopped=gm,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Wl)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Wl)},persist:function(){},isPersistent:Wl}),i}var Gi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eo=vn(Gi),ks=g({},Gi,{view:0,detail:0}),Y1=vn(ks),sc,lc,Cs,to=g({},ks,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:uc,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!==Cs&&(Cs&&t.type==="mousemove"?(sc=t.screenX-Cs.screenX,lc=t.screenY-Cs.screenY):lc=sc=0,Cs=t),sc)},movementY:function(t){return"movementY"in t?t.movementY:lc}}),ym=vn(to),G1=g({},to,{dataTransfer:0}),V1=vn(G1),J1=g({},ks,{relatedTarget:0}),oc=vn(J1),X1=g({},Gi,{animationName:0,elapsedTime:0,pseudoElement:0}),K1=vn(X1),Q1=g({},Gi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Z1=vn(Q1),W1=g({},Gi,{data:0}),bm=vn(W1),ev={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tv={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"},nv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rv(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=nv[t])?!!i[t]:!1}function uc(){return rv}var iv=g({},ks,{key:function(t){if(t.key){var i=ev[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"?tv[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:uc,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}}),av=vn(iv),sv=g({},to,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),xm=vn(sv),lv=g({},ks,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:uc}),ov=vn(lv),uv=g({},Gi,{propertyName:0,elapsedTime:0,pseudoElement:0}),cv=vn(uv),fv=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}),hv=vn(fv),dv=g({},Gi,{newState:0,oldState:0}),mv=vn(dv),pv=[9,13,27,32],cc=Lr&&"CompositionEvent"in window,As=null;Lr&&"documentMode"in document&&(As=document.documentMode);var gv=Lr&&"TextEvent"in window&&!As,vm=Lr&&(!cc||As&&8<As&&11>=As),wm=" ",Sm=!1;function _m(t,i){switch(t){case"keyup":return pv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Em(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var wa=!1;function yv(t,i){switch(t){case"compositionend":return Em(i);case"keypress":return i.which!==32?null:(Sm=!0,wm);case"textInput":return t=i.data,t===wm&&Sm?null:t;default:return null}}function bv(t,i){if(wa)return t==="compositionend"||!cc&&_m(t,i)?(t=pm(),Ql=ac=oi=null,wa=!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 vm&&i.locale!=="ko"?null:i.data;default:return null}}var xv={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 km(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!xv[t.type]:i==="textarea"}function Cm(t,i,s,o){xa?va?va.push(o):va=[o]:xa=o,i=Yo(i,"onChange"),0<i.length&&(s=new eo("onChange","change",null,s,o),t.push({event:s,listeners:i}))}var Ts=null,js=null;function vv(t){oy(t,0)}function no(t){var i=T(t);if(lm(i))return t}function Am(t,i){if(t==="change")return i}var Tm=!1;if(Lr){var fc;if(Lr){var hc="oninput"in document;if(!hc){var jm=document.createElement("div");jm.setAttribute("oninput","return;"),hc=typeof jm.oninput=="function"}fc=hc}else fc=!1;Tm=fc&&(!document.documentMode||9<document.documentMode)}function Nm(){Ts&&(Ts.detachEvent("onpropertychange",Om),js=Ts=null)}function Om(t){if(t.propertyName==="value"&&no(js)){var i=[];Cm(i,js,t,nc(t)),mm(vv,i)}}function wv(t,i,s){t==="focusin"?(Nm(),Ts=i,js=s,Ts.attachEvent("onpropertychange",Om)):t==="focusout"&&Nm()}function Sv(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return no(js)}function _v(t,i){if(t==="click")return no(i)}function Ev(t,i){if(t==="input"||t==="change")return no(i)}function kv(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var Nn=typeof Object.is=="function"?Object.is:kv;function Ns(t,i){if(Nn(t,i))return!0;if(typeof t!="object"||t===null||typeof i!="object"||i===null)return!1;var s=Object.keys(t),o=Object.keys(i);if(s.length!==o.length)return!1;for(o=0;o<s.length;o++){var h=s[o];if(!Xe.call(i,h)||!Nn(t[h],i[h]))return!1}return!0}function Rm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Mm(t,i){var s=Rm(t);t=0;for(var o;s;){if(s.nodeType===3){if(o=t+s.textContent.length,t<=i&&o>=i)return{node:s,offset:i-t};t=o}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Rm(s)}}function Dm(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Dm(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Lm(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 s=typeof i.contentWindow.location.href=="string"}catch{s=!1}if(s)t=i.contentWindow;else break;i=Xl(t.document)}return i}function dc(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 Cv=Lr&&"documentMode"in document&&11>=document.documentMode,Sa=null,mc=null,Os=null,pc=!1;function zm(t,i,s){var o=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;pc||Sa==null||Sa!==Xl(o)||(o=Sa,"selectionStart"in o&&dc(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}),Os&&Ns(Os,o)||(Os=o,o=Yo(mc,"onSelect"),0<o.length&&(i=new eo("onSelect","select",null,i,s),t.push({event:i,listeners:o}),i.target=Sa)))}function Vi(t,i){var s={};return s[t.toLowerCase()]=i.toLowerCase(),s["Webkit"+t]="webkit"+i,s["Moz"+t]="moz"+i,s}var _a={animationend:Vi("Animation","AnimationEnd"),animationiteration:Vi("Animation","AnimationIteration"),animationstart:Vi("Animation","AnimationStart"),transitionrun:Vi("Transition","TransitionRun"),transitionstart:Vi("Transition","TransitionStart"),transitioncancel:Vi("Transition","TransitionCancel"),transitionend:Vi("Transition","TransitionEnd")},gc={},Um={};Lr&&(Um=document.createElement("div").style,"AnimationEvent"in window||(delete _a.animationend.animation,delete _a.animationiteration.animation,delete _a.animationstart.animation),"TransitionEvent"in window||delete _a.transitionend.transition);function Ji(t){if(gc[t])return gc[t];if(!_a[t])return t;var i=_a[t],s;for(s in i)if(i.hasOwnProperty(s)&&s in Um)return gc[t]=i[s];return t}var Bm=Ji("animationend"),Pm=Ji("animationiteration"),Hm=Ji("animationstart"),Av=Ji("transitionrun"),Tv=Ji("transitionstart"),jv=Ji("transitioncancel"),qm=Ji("transitionend"),Im=new Map,yc="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(" ");yc.push("scrollEnd");function cr(t,i){Im.set(t,i),ye(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)},Vn=[],Ea=0,bc=0;function io(){for(var t=Ea,i=bc=Ea=0;i<t;){var s=Vn[i];Vn[i++]=null;var o=Vn[i];Vn[i++]=null;var h=Vn[i];Vn[i++]=null;var p=Vn[i];if(Vn[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&&Fm(s,h,p)}}function ao(t,i,s,o){Vn[Ea++]=t,Vn[Ea++]=i,Vn[Ea++]=s,Vn[Ea++]=o,bc|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function xc(t,i,s,o){return ao(t,i,s,o),so(t)}function Xi(t,i){return ao(t,null,null,i),so(t)}function Fm(t,i,s){t.lanes|=s;var o=t.alternate;o!==null&&(o.lanes|=s);for(var h=!1,p=t.return;p!==null;)p.childLanes|=s,o=p.alternate,o!==null&&(o.childLanes|=s),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-be(s),t=p.hiddenUpdates,o=t[h],o===null?t[h]=[i]:o.push(i),i.lane=s|536870912),p):null}function so(t){if(50<Ws)throw Ws=0,jf=null,Error(a(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var ka={};function Nv(t,i,s,o){this.tag=t,this.key=s,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 On(t,i,s,o){return new Nv(t,i,s,o)}function vc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function zr(t,i){var s=t.alternate;return s===null?(s=On(t.tag,i,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=i,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&65011712,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,i=t.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function $m(t,i){t.flags&=65011714;var s=t.alternate;return s===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=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,i=s.dependencies,t.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),t}function lo(t,i,s,o,h,p){var x=0;if(o=t,typeof t=="function")vc(t)&&(x=1);else if(typeof t=="string")x=Lw(t,s,ve.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case $:return t=On(31,s,i,h),t.elementType=$,t.lanes=p,t;case M:return Ki(s.children,h,p,i);case U:x=8,h|=24;break;case O:return t=On(12,s,i,h|2),t.elementType=O,t.lanes=p,t;case B:return t=On(13,s,i,h),t.elementType=B,t.lanes=p,t;case z:return t=On(19,s,i,h),t.elementType=z,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 oe:x=11;break e;case K:x=14;break e;case F:x=16,o=null;break e}x=29,s=Error(a(130,t===null?"null":typeof t,"")),o=null}return i=On(x,s,i,h),i.elementType=t,i.type=o,i.lanes=p,i}function Ki(t,i,s,o){return t=On(7,t,o,i),t.lanes=s,t}function wc(t,i,s){return t=On(6,t,null,i),t.lanes=s,t}function Ym(t){var i=On(18,null,null,0);return i.stateNode=t,i}function Sc(t,i,s){return i=On(4,t.children!==null?t.children:[],t.key,i),i.lanes=s,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var Gm=new WeakMap;function Jn(t,i){if(typeof t=="object"&&t!==null){var s=Gm.get(t);return s!==void 0?s:(i={value:t,source:i,stack:Qe(i)},Gm.set(t,i),i)}return{value:t,source:i,stack:Qe(i)}}var Ca=[],Aa=0,oo=null,Rs=0,Xn=[],Kn=0,ui=null,xr=1,vr="";function Ur(t,i){Ca[Aa++]=Rs,Ca[Aa++]=oo,oo=t,Rs=i}function Vm(t,i,s){Xn[Kn++]=xr,Xn[Kn++]=vr,Xn[Kn++]=ui,ui=t;var o=xr;t=vr;var h=32-be(o)-1;o&=~(1<<h),s+=1;var p=32-be(i)+h;if(30<p){var x=h-h%5;p=(o&(1<<x)-1).toString(32),o>>=x,h-=x,xr=1<<32-be(i)+h|s<<h|o,vr=p+t}else xr=1<<p|s<<h|o,vr=t}function _c(t){t.return!==null&&(Ur(t,1),Vm(t,1,0))}function Ec(t){for(;t===oo;)oo=Ca[--Aa],Ca[Aa]=null,Rs=Ca[--Aa],Ca[Aa]=null;for(;t===ui;)ui=Xn[--Kn],Xn[Kn]=null,vr=Xn[--Kn],Xn[Kn]=null,xr=Xn[--Kn],Xn[Kn]=null}function Jm(t,i){Xn[Kn++]=xr,Xn[Kn++]=vr,Xn[Kn++]=ui,xr=i.id,vr=i.overflow,ui=t}var an=null,Nt=null,at=!1,ci=null,Qn=!1,kc=Error(a(519));function fi(t){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ms(Jn(i,t)),kc}function Xm(t){var i=t.stateNode,s=t.type,o=t.memoizedProps;switch(i[kt]=t,i[Bt]=o,s){case"dialog":et("cancel",i),et("close",i);break;case"iframe":case"object":case"embed":et("load",i);break;case"video":case"audio":for(s=0;s<tl.length;s++)et(tl[s],i);break;case"source":et("error",i);break;case"img":case"image":case"link":et("error",i),et("load",i);break;case"details":et("toggle",i);break;case"input":et("invalid",i),om(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":et("invalid",i);break;case"textarea":et("invalid",i),cm(i,o.value,o.defaultValue,o.children)}s=o.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||i.textContent===""+s||o.suppressHydrationWarning===!0||hy(i.textContent,s)?(o.popover!=null&&(et("beforetoggle",i),et("toggle",i)),o.onScroll!=null&&et("scroll",i),o.onScrollEnd!=null&&et("scrollend",i),o.onClick!=null&&(i.onclick=Dr),i=!0):i=!1,i||fi(t,!0)}function Km(t){for(an=t.return;an;)switch(an.tag){case 5:case 31:case 13:Qn=!1;return;case 27:case 3:Qn=!0;return;default:an=an.return}}function Ta(t){if(t!==an)return!1;if(!at)return Km(t),at=!0,!1;var i=t.tag,s;if((s=i!==3&&i!==27)&&((s=i===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||$f(t.type,t.memoizedProps)),s=!s),s&&Nt&&fi(t),Km(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));Nt=wy(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));Nt=wy(t)}else i===27?(i=Nt,ki(t.type)?(t=Xf,Xf=null,Nt=t):Nt=i):Nt=an?Wn(t.stateNode.nextSibling):null;return!0}function Qi(){Nt=an=null,at=!1}function Cc(){var t=ci;return t!==null&&(En===null?En=t:En.push.apply(En,t),ci=null),t}function Ms(t){ci===null?ci=[t]:ci.push(t)}var Ac=N(null),Zi=null,Br=null;function hi(t,i,s){A(Ac,i._currentValue),i._currentValue=s}function Pr(t){t._currentValue=Ac.current,Z(Ac)}function Tc(t,i,s){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===s)break;t=t.return}}function jc(t,i,s,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|=s,S=p.alternate,S!==null&&(S.lanes|=s),Tc(p.return,s,t),o||(x=null);break e}p=S.next}}else if(h.tag===18){if(x=h.return,x===null)throw Error(a(341));x.lanes|=s,p=x.alternate,p!==null&&(p.lanes|=s),Tc(x,s,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 ja(t,i,s,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(a(387));if(x=x.memoizedProps,x!==null){var S=h.type;Nn(h.pendingProps.value,x.value)||(t!==null?t.push(S):t=[S])}}else if(h===Le.current){if(x=h.alternate,x===null)throw Error(a(387));x.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(sl):t=[sl])}h=h.return}t!==null&&jc(i,t,s,o),i.flags|=262144}function uo(t){for(t=t.firstContext;t!==null;){if(!Nn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Wi(t){Zi=t,Br=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function sn(t){return Qm(Zi,t)}function co(t,i){return Zi===null&&Wi(t),Qm(t,i)}function Qm(t,i){var s=i._currentValue;if(i={context:i,memoizedValue:s,next:null},Br===null){if(t===null)throw Error(a(308));Br=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else Br=Br.next=i;return s}var Ov=typeof AbortController<"u"?AbortController:function(){var t=[],i=this.signal={aborted:!1,addEventListener:function(s,o){t.push(o)}};this.abort=function(){i.aborted=!0,t.forEach(function(s){return s()})}},Rv=e.unstable_scheduleCallback,Mv=e.unstable_NormalPriority,Gt={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Nc(){return{controller:new Ov,data:new Map,refCount:0}}function Ds(t){t.refCount--,t.refCount===0&&Rv(Mv,function(){t.controller.abort()})}var Ls=null,Oc=0,Na=0,Oa=null;function Dv(t,i){if(Ls===null){var s=Ls=[];Oc=0,Na=Lf(),Oa={status:"pending",value:void 0,then:function(o){s.push(o)}}}return Oc++,i.then(Zm,Zm),i}function Zm(){if(--Oc===0&&Ls!==null){Oa!==null&&(Oa.status="fulfilled");var t=Ls;Ls=null,Na=0,Oa=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function Lv(t,i){var s=[],o={status:"pending",value:null,reason:null,then:function(h){s.push(h)}};return t.then(function(){o.status="fulfilled",o.value=i;for(var h=0;h<s.length;h++)(0,s[h])(i)},function(h){for(o.status="rejected",o.reason=h,h=0;h<s.length;h++)(0,s[h])(void 0)}),o}var Wm=V.S;V.S=function(t,i){zg=xt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Dv(t,i),Wm!==null&&Wm(t,i)};var ea=N(null);function Rc(){var t=ea.current;return t!==null?t:Ct.pooledCache}function fo(t,i){i===null?A(ea,ea.current):A(ea,i.pool)}function ep(){var t=Rc();return t===null?null:{parent:Gt._currentValue,pool:t}}var Ra=Error(a(460)),Mc=Error(a(474)),ho=Error(a(542)),mo={then:function(){}};function tp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function np(t,i,s){switch(s=t[s],s===void 0?t.push(i):s!==i&&(i.then(Dr,Dr),i=s),i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,ip(t),t;default:if(typeof i.status=="string")i.then(Dr,Dr);else{if(t=Ct,t!==null&&100<t.shellSuspendCounter)throw Error(a(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,ip(t),t}throw na=i,Ra}}function ta(t){try{var i=t._init;return i(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(na=s,Ra):s}}var na=null;function rp(){if(na===null)throw Error(a(459));var t=na;return na=null,t}function ip(t){if(t===Ra||t===ho)throw Error(a(483))}var Ma=null,zs=0;function po(t){var i=zs;return zs+=1,Ma===null&&(Ma=[]),np(Ma,t,i)}function Us(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function go(t,i){throw i.$$typeof===b?Error(a(525)):(t=Object.prototype.toString.call(i),Error(a(31,t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)))}function ap(t){function i(X,G){if(t){var ee=X.deletions;ee===null?(X.deletions=[G],X.flags|=16):ee.push(G)}}function s(X,G){if(!t)return null;for(;G!==null;)i(X,G),G=G.sibling;return null}function o(X){for(var G=new Map;X!==null;)X.key!==null?G.set(X.key,X):G.set(X.index,X),X=X.sibling;return G}function h(X,G){return X=zr(X,G),X.index=0,X.sibling=null,X}function p(X,G,ee){return X.index=ee,t?(ee=X.alternate,ee!==null?(ee=ee.index,ee<G?(X.flags|=67108866,G):ee):(X.flags|=67108866,G)):(X.flags|=1048576,G)}function x(X){return t&&X.alternate===null&&(X.flags|=67108866),X}function S(X,G,ee,fe){return G===null||G.tag!==6?(G=wc(ee,X.mode,fe),G.return=X,G):(G=h(G,ee),G.return=X,G)}function H(X,G,ee,fe){var Ue=ee.type;return Ue===M?ce(X,G,ee.props.children,fe,ee.key):G!==null&&(G.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===F&&ta(Ue)===G.type)?(G=h(G,ee.props),Us(G,ee),G.return=X,G):(G=lo(ee.type,ee.key,ee.props,null,X.mode,fe),Us(G,ee),G.return=X,G)}function te(X,G,ee,fe){return G===null||G.tag!==4||G.stateNode.containerInfo!==ee.containerInfo||G.stateNode.implementation!==ee.implementation?(G=Sc(ee,X.mode,fe),G.return=X,G):(G=h(G,ee.children||[]),G.return=X,G)}function ce(X,G,ee,fe,Ue){return G===null||G.tag!==7?(G=Ki(ee,X.mode,fe,Ue),G.return=X,G):(G=h(G,ee),G.return=X,G)}function me(X,G,ee){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=wc(""+G,X.mode,ee),G.return=X,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return ee=lo(G.type,G.key,G.props,null,X.mode,ee),Us(ee,G),ee.return=X,ee;case k:return G=Sc(G,X.mode,ee),G.return=X,G;case F:return G=ta(G),me(X,G,ee)}if(ne(G)||J(G))return G=Ki(G,X.mode,ee,null),G.return=X,G;if(typeof G.then=="function")return me(X,po(G),ee);if(G.$$typeof===q)return me(X,co(X,G),ee);go(X,G)}return null}function re(X,G,ee,fe){var Ue=G!==null?G.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Ue!==null?null:S(X,G,""+ee,fe);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case w:return ee.key===Ue?H(X,G,ee,fe):null;case k:return ee.key===Ue?te(X,G,ee,fe):null;case F:return ee=ta(ee),re(X,G,ee,fe)}if(ne(ee)||J(ee))return Ue!==null?null:ce(X,G,ee,fe,null);if(typeof ee.then=="function")return re(X,G,po(ee),fe);if(ee.$$typeof===q)return re(X,G,co(X,ee),fe);go(X,ee)}return null}function le(X,G,ee,fe,Ue){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return X=X.get(ee)||null,S(G,X,""+fe,Ue);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case w:return X=X.get(fe.key===null?ee:fe.key)||null,H(G,X,fe,Ue);case k:return X=X.get(fe.key===null?ee:fe.key)||null,te(G,X,fe,Ue);case F:return fe=ta(fe),le(X,G,ee,fe,Ue)}if(ne(fe)||J(fe))return X=X.get(ee)||null,ce(G,X,fe,Ue,null);if(typeof fe.then=="function")return le(X,G,ee,po(fe),Ue);if(fe.$$typeof===q)return le(X,G,ee,co(G,fe),Ue);go(G,fe)}return null}function Re(X,G,ee,fe){for(var Ue=null,ct=null,De=G,Ve=G=0,rt=null;De!==null&&Ve<ee.length;Ve++){De.index>Ve?(rt=De,De=null):rt=De.sibling;var ft=re(X,De,ee[Ve],fe);if(ft===null){De===null&&(De=rt);break}t&&De&&ft.alternate===null&&i(X,De),G=p(ft,G,Ve),ct===null?Ue=ft:ct.sibling=ft,ct=ft,De=rt}if(Ve===ee.length)return s(X,De),at&&Ur(X,Ve),Ue;if(De===null){for(;Ve<ee.length;Ve++)De=me(X,ee[Ve],fe),De!==null&&(G=p(De,G,Ve),ct===null?Ue=De:ct.sibling=De,ct=De);return at&&Ur(X,Ve),Ue}for(De=o(De);Ve<ee.length;Ve++)rt=le(De,X,Ve,ee[Ve],fe),rt!==null&&(t&&rt.alternate!==null&&De.delete(rt.key===null?Ve:rt.key),G=p(rt,G,Ve),ct===null?Ue=rt:ct.sibling=rt,ct=rt);return t&&De.forEach(function(Ni){return i(X,Ni)}),at&&Ur(X,Ve),Ue}function qe(X,G,ee,fe){if(ee==null)throw Error(a(151));for(var Ue=null,ct=null,De=G,Ve=G=0,rt=null,ft=ee.next();De!==null&&!ft.done;Ve++,ft=ee.next()){De.index>Ve?(rt=De,De=null):rt=De.sibling;var Ni=re(X,De,ft.value,fe);if(Ni===null){De===null&&(De=rt);break}t&&De&&Ni.alternate===null&&i(X,De),G=p(Ni,G,Ve),ct===null?Ue=Ni:ct.sibling=Ni,ct=Ni,De=rt}if(ft.done)return s(X,De),at&&Ur(X,Ve),Ue;if(De===null){for(;!ft.done;Ve++,ft=ee.next())ft=me(X,ft.value,fe),ft!==null&&(G=p(ft,G,Ve),ct===null?Ue=ft:ct.sibling=ft,ct=ft);return at&&Ur(X,Ve),Ue}for(De=o(De);!ft.done;Ve++,ft=ee.next())ft=le(De,X,Ve,ft.value,fe),ft!==null&&(t&&ft.alternate!==null&&De.delete(ft.key===null?Ve:ft.key),G=p(ft,G,Ve),ct===null?Ue=ft:ct.sibling=ft,ct=ft);return t&&De.forEach(function(Gw){return i(X,Gw)}),at&&Ur(X,Ve),Ue}function St(X,G,ee,fe){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 w:e:{for(var Ue=ee.key;G!==null;){if(G.key===Ue){if(Ue=ee.type,Ue===M){if(G.tag===7){s(X,G.sibling),fe=h(G,ee.props.children),fe.return=X,X=fe;break e}}else if(G.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===F&&ta(Ue)===G.type){s(X,G.sibling),fe=h(G,ee.props),Us(fe,ee),fe.return=X,X=fe;break e}s(X,G);break}else i(X,G);G=G.sibling}ee.type===M?(fe=Ki(ee.props.children,X.mode,fe,ee.key),fe.return=X,X=fe):(fe=lo(ee.type,ee.key,ee.props,null,X.mode,fe),Us(fe,ee),fe.return=X,X=fe)}return x(X);case k:e:{for(Ue=ee.key;G!==null;){if(G.key===Ue)if(G.tag===4&&G.stateNode.containerInfo===ee.containerInfo&&G.stateNode.implementation===ee.implementation){s(X,G.sibling),fe=h(G,ee.children||[]),fe.return=X,X=fe;break e}else{s(X,G);break}else i(X,G);G=G.sibling}fe=Sc(ee,X.mode,fe),fe.return=X,X=fe}return x(X);case F:return ee=ta(ee),St(X,G,ee,fe)}if(ne(ee))return Re(X,G,ee,fe);if(J(ee)){if(Ue=J(ee),typeof Ue!="function")throw Error(a(150));return ee=Ue.call(ee),qe(X,G,ee,fe)}if(typeof ee.then=="function")return St(X,G,po(ee),fe);if(ee.$$typeof===q)return St(X,G,co(X,ee),fe);go(X,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,G!==null&&G.tag===6?(s(X,G.sibling),fe=h(G,ee),fe.return=X,X=fe):(s(X,G),fe=wc(ee,X.mode,fe),fe.return=X,X=fe),x(X)):s(X,G)}return function(X,G,ee,fe){try{zs=0;var Ue=St(X,G,ee,fe);return Ma=null,Ue}catch(De){if(De===Ra||De===ho)throw De;var ct=On(29,De,null,X.mode);return ct.lanes=fe,ct.return=X,ct}finally{}}}var ra=ap(!0),sp=ap(!1),di=!1;function Dc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Lc(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 mi(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function pi(t,i,s){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(ht&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=so(t),Fm(t,null,s),i}return ao(t,o,i,s),so(t)}function Bs(t,i,s){if(i=i.updateQueue,i!==null&&(i=i.shared,(s&4194048)!==0)){var o=i.lanes;o&=t.pendingLanes,s|=o,i.lanes=s,Fi(t,s)}}function zc(t,i){var s=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,s===o)){var h=null,p=null;if(s=s.firstBaseUpdate,s!==null){do{var x={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};p===null?h=p=x:p=p.next=x,s=s.next}while(s!==null);p===null?h=p=i:p=p.next=i}else h=p=i;s={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=i:t.next=i,s.lastBaseUpdate=i}var Uc=!1;function Ps(){if(Uc){var t=Oa;if(t!==null)throw t}}function Hs(t,i,s,o){Uc=!1;var h=t.updateQueue;di=!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 me=h.baseState;x=0,ce=te=H=null,S=p;do{var re=S.lane&-536870913,le=re!==S.lane;if(le?(nt&re)===re:(o&re)===re){re!==0&&re===Na&&(Uc=!0),ce!==null&&(ce=ce.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Re=t,qe=S;re=i;var St=s;switch(qe.tag){case 1:if(Re=qe.payload,typeof Re=="function"){me=Re.call(St,me,re);break e}me=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=qe.payload,re=typeof Re=="function"?Re.call(St,me,re):Re,re==null)break e;me=g({},me,re);break e;case 2:di=!0}}re=S.callback,re!==null&&(t.flags|=64,le&&(t.flags|=8192),le=h.callbacks,le===null?h.callbacks=[re]:le.push(re))}else le={lane:re,tag:S.tag,payload:S.payload,callback:S.callback,next:null},ce===null?(te=ce=le,H=me):ce=ce.next=le,x|=re;if(S=S.next,S===null){if(S=h.shared.pending,S===null)break;le=S,S=le.next,le.next=null,h.lastBaseUpdate=le,h.shared.pending=null}}while(!0);ce===null&&(H=me),h.baseState=H,h.firstBaseUpdate=te,h.lastBaseUpdate=ce,p===null&&(h.shared.lanes=0),vi|=x,t.lanes=x,t.memoizedState=me}}function lp(t,i){if(typeof t!="function")throw Error(a(191,t));t.call(i)}function op(t,i){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)lp(s[t],i)}var Da=N(null),yo=N(0);function up(t,i){t=Jr,A(yo,t),A(Da,i),Jr=t|i.baseLanes}function Bc(){A(yo,Jr),A(Da,Da.current)}function Pc(){Jr=yo.current,Z(Da),Z(yo)}var Rn=N(null),Zn=null;function gi(t){var i=t.alternate;A(It,It.current&1),A(Rn,t),Zn===null&&(i===null||Da.current!==null||i.memoizedState!==null)&&(Zn=t)}function Hc(t){A(It,It.current),A(Rn,t),Zn===null&&(Zn=t)}function cp(t){t.tag===22?(A(It,It.current),A(Rn,t),Zn===null&&(Zn=t)):yi()}function yi(){A(It,It.current),A(Rn,Rn.current)}function Mn(t){Z(Rn),Zn===t&&(Zn=null),Z(It)}var It=N(0);function bo(t){for(var i=t;i!==null;){if(i.tag===13){var s=i.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Vf(s)||Jf(s)))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 Hr=0,Ye=null,vt=null,Vt=null,xo=!1,La=!1,ia=!1,vo=0,qs=0,za=null,zv=0;function Pt(){throw Error(a(321))}function qc(t,i){if(i===null)return!1;for(var s=0;s<i.length&&s<t.length;s++)if(!Nn(t[s],i[s]))return!1;return!0}function Ic(t,i,s,o,h,p){return Hr=p,Ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,V.H=t===null||t.memoizedState===null?Vp:rf,ia=!1,p=s(o,h),ia=!1,La&&(p=hp(i,s,o,h)),fp(t),p}function fp(t){V.H=$s;var i=vt!==null&&vt.next!==null;if(Hr=0,Vt=vt=Ye=null,xo=!1,qs=0,za=null,i)throw Error(a(300));t===null||Jt||(t=t.dependencies,t!==null&&uo(t)&&(Jt=!0))}function hp(t,i,s,o){Ye=t;var h=0;do{if(La&&(za=null),qs=0,La=!1,25<=h)throw Error(a(301));if(h+=1,Vt=vt=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}V.H=Jp,p=i(s,o)}while(La);return p}function Uv(){var t=V.H,i=t.useState()[0];return i=typeof i.then=="function"?Is(i):i,t=t.useState()[0],(vt!==null?vt.memoizedState:null)!==t&&(Ye.flags|=1024),i}function Fc(){var t=vo!==0;return vo=0,t}function $c(t,i,s){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~s}function Yc(t){if(xo){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}xo=!1}Hr=0,Vt=vt=Ye=null,La=!1,qs=vo=0,za=null}function dn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?Ye.memoizedState=Vt=t:Vt=Vt.next=t,Vt}function Ft(){if(vt===null){var t=Ye.alternate;t=t!==null?t.memoizedState:null}else t=vt.next;var i=Vt===null?Ye.memoizedState:Vt.next;if(i!==null)Vt=i,vt=t;else{if(t===null)throw Ye.alternate===null?Error(a(467)):Error(a(310));vt=t,t={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},Vt===null?Ye.memoizedState=Vt=t:Vt=Vt.next=t}return Vt}function wo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Is(t){var i=qs;return qs+=1,za===null&&(za=[]),t=np(za,t,i),i=Ye,(Vt===null?i.memoizedState:Vt.next)===null&&(i=i.alternate,V.H=i===null||i.memoizedState===null?Vp:rf),t}function So(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Is(t);if(t.$$typeof===q)return sn(t)}throw Error(a(438,String(t)))}function Gc(t){var i=null,s=Ye.updateQueue;if(s!==null&&(i=s.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}),s===null&&(s=wo(),Ye.updateQueue=s),s.memoCache=i,s=i.data[i.index],s===void 0)for(s=i.data[i.index]=Array(t),o=0;o<t;o++)s[o]=D;return i.index++,s}function qr(t,i){return typeof i=="function"?i(t):i}function _o(t){var i=Ft();return Vc(i,vt,t)}function Vc(t,i,s){var o=t.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=s;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 me=te.lane&-536870913;if(me!==te.lane?(nt&me)===me:(Hr&me)===me){var re=te.revertLane;if(re===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),me===Na&&(ce=!0);else if((Hr&re)===re){te=te.next,re===Na&&(ce=!0);continue}else me={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},H===null?(S=H=me,x=p):H=H.next=me,Ye.lanes|=re,vi|=re;me=te.action,ia&&s(p,me),p=te.hasEagerState?te.eagerState:s(p,me)}else re={lane:me,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},H===null?(S=H=re,x=p):H=H.next=re,Ye.lanes|=me,vi|=me;te=te.next}while(te!==null&&te!==i);if(H===null?x=p:H.next=S,!Nn(p,t.memoizedState)&&(Jt=!0,ce&&(s=Oa,s!==null)))throw s;t.memoizedState=p,t.baseState=x,t.baseQueue=H,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Jc(t){var i=Ft(),s=i.queue;if(s===null)throw Error(a(311));s.lastRenderedReducer=t;var o=s.dispatch,h=s.pending,p=i.memoizedState;if(h!==null){s.pending=null;var x=h=h.next;do p=t(p,x.action),x=x.next;while(x!==h);Nn(p,i.memoizedState)||(Jt=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),s.lastRenderedState=p}return[p,o]}function dp(t,i,s){var o=Ye,h=Ft(),p=at;if(p){if(s===void 0)throw Error(a(407));s=s()}else s=i();var x=!Nn((vt||h).memoizedState,s);if(x&&(h.memoizedState=s,Jt=!0),h=h.queue,Qc(gp.bind(null,o,h,t),[t]),h.getSnapshot!==i||x||Vt!==null&&Vt.memoizedState.tag&1){if(o.flags|=2048,Ua(9,{destroy:void 0},pp.bind(null,o,h,s,i),null),Ct===null)throw Error(a(349));p||(Hr&127)!==0||mp(o,i,s)}return s}function mp(t,i,s){t.flags|=16384,t={getSnapshot:i,value:s},i=Ye.updateQueue,i===null?(i=wo(),Ye.updateQueue=i,i.stores=[t]):(s=i.stores,s===null?i.stores=[t]:s.push(t))}function pp(t,i,s,o){i.value=s,i.getSnapshot=o,yp(i)&&bp(t)}function gp(t,i,s){return s(function(){yp(i)&&bp(t)})}function yp(t){var i=t.getSnapshot;t=t.value;try{var s=i();return!Nn(t,s)}catch{return!0}}function bp(t){var i=Xi(t,2);i!==null&&kn(i,t,2)}function Xc(t){var i=dn();if(typeof t=="function"){var s=t;if(t=s(),ia){Ut(!0);try{s()}finally{Ut(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qr,lastRenderedState:t},i}function xp(t,i,s,o){return t.baseState=s,Vc(t,vt,typeof o=="function"?o:qr)}function Bv(t,i,s,o,h){if(Co(t))throw Error(a(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)}};V.T!==null?s(!0):p.isTransition=!1,o(p),s=i.pending,s===null?(p.next=i.pending=p,vp(i,p)):(p.next=s.next,i.pending=s.next=p)}}function vp(t,i){var s=i.action,o=i.payload,h=t.state;if(i.isTransition){var p=V.T,x={};V.T=x;try{var S=s(h,o),H=V.S;H!==null&&H(x,S),wp(t,i,S)}catch(te){Kc(t,i,te)}finally{p!==null&&x.types!==null&&(p.types=x.types),V.T=p}}else try{p=s(h,o),wp(t,i,p)}catch(te){Kc(t,i,te)}}function wp(t,i,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(o){Sp(t,i,o)},function(o){return Kc(t,i,o)}):Sp(t,i,s)}function Sp(t,i,s){i.status="fulfilled",i.value=s,_p(i),t.state=s,i=t.pending,i!==null&&(s=i.next,s===i?t.pending=null:(s=s.next,i.next=s,vp(t,s)))}function Kc(t,i,s){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=s,_p(i),i=i.next;while(i!==o)}t.action=null}function _p(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function Ep(t,i){return i}function kp(t,i){if(at){var s=Ct.formState;if(s!==null){e:{var o=Ye;if(at){if(Nt){t:{for(var h=Nt,p=Qn;h.nodeType!==8;){if(!p){h=null;break t}if(h=Wn(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Nt=Wn(h.nextSibling),o=h.data==="F!";break e}}fi(o)}o=!1}o&&(i=s[0])}}return s=dn(),s.memoizedState=s.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ep,lastRenderedState:i},s.queue=o,s=$p.bind(null,Ye,o),o.dispatch=s,o=Xc(!1),p=nf.bind(null,Ye,!1,o.queue),o=dn(),h={state:i,dispatch:null,action:t,pending:null},o.queue=h,s=Bv.bind(null,Ye,h,p,s),h.dispatch=s,o.memoizedState=t,[i,s,!1]}function Cp(t){var i=Ft();return Ap(i,vt,t)}function Ap(t,i,s){if(i=Vc(t,i,Ep)[0],t=_o(qr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Is(i)}catch(x){throw x===Ra?ho:x}else o=i;i=Ft();var h=i.queue,p=h.dispatch;return s!==i.memoizedState&&(Ye.flags|=2048,Ua(9,{destroy:void 0},Pv.bind(null,h,s),null)),[o,p,t]}function Pv(t,i){t.action=i}function Tp(t){var i=Ft(),s=vt;if(s!==null)return Ap(i,s,t);Ft(),i=i.memoizedState,s=Ft();var o=s.queue.dispatch;return s.memoizedState=t,[i,o,!1]}function Ua(t,i,s,o){return t={tag:t,create:s,deps:o,inst:i,next:null},i=Ye.updateQueue,i===null&&(i=wo(),Ye.updateQueue=i),s=i.lastEffect,s===null?i.lastEffect=t.next=t:(o=s.next,s.next=t,t.next=o,i.lastEffect=t),t}function jp(){return Ft().memoizedState}function Eo(t,i,s,o){var h=dn();Ye.flags|=t,h.memoizedState=Ua(1|i,{destroy:void 0},s,o===void 0?null:o)}function ko(t,i,s,o){var h=Ft();o=o===void 0?null:o;var p=h.memoizedState.inst;vt!==null&&o!==null&&qc(o,vt.memoizedState.deps)?h.memoizedState=Ua(i,p,s,o):(Ye.flags|=t,h.memoizedState=Ua(1|i,p,s,o))}function Np(t,i){Eo(8390656,8,t,i)}function Qc(t,i){ko(2048,8,t,i)}function Hv(t){Ye.flags|=4;var i=Ye.updateQueue;if(i===null)i=wo(),Ye.updateQueue=i,i.events=[t];else{var s=i.events;s===null?i.events=[t]:s.push(t)}}function Op(t){var i=Ft().memoizedState;return Hv({ref:i,nextImpl:t}),function(){if((ht&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function Rp(t,i){return ko(4,2,t,i)}function Mp(t,i){return ko(4,4,t,i)}function Dp(t,i){if(typeof i=="function"){t=t();var s=i(t);return function(){typeof s=="function"?s():i(null)}}if(i!=null)return t=t(),i.current=t,function(){i.current=null}}function Lp(t,i,s){s=s!=null?s.concat([t]):null,ko(4,4,Dp.bind(null,i,t),s)}function Zc(){}function zp(t,i){var s=Ft();i=i===void 0?null:i;var o=s.memoizedState;return i!==null&&qc(i,o[1])?o[0]:(s.memoizedState=[t,i],t)}function Up(t,i){var s=Ft();i=i===void 0?null:i;var o=s.memoizedState;if(i!==null&&qc(i,o[1]))return o[0];if(o=t(),ia){Ut(!0);try{t()}finally{Ut(!1)}}return s.memoizedState=[o,i],o}function Wc(t,i,s){return s===void 0||(Hr&1073741824)!==0&&(nt&261930)===0?t.memoizedState=i:(t.memoizedState=s,t=Bg(),Ye.lanes|=t,vi|=t,s)}function Bp(t,i,s,o){return Nn(s,i)?s:Da.current!==null?(t=Wc(t,s,o),Nn(t,i)||(Jt=!0),t):(Hr&42)===0||(Hr&1073741824)!==0&&(nt&261930)===0?(Jt=!0,t.memoizedState=s):(t=Bg(),Ye.lanes|=t,vi|=t,i)}function Pp(t,i,s,o,h){var p=ie.p;ie.p=p!==0&&8>p?p:8;var x=V.T,S={};V.T=S,nf(t,!1,i,s);try{var H=h(),te=V.S;if(te!==null&&te(S,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ce=Lv(H,o);Fs(t,i,ce,zn(t))}else Fs(t,i,o,zn(t))}catch(me){Fs(t,i,{then:function(){},status:"rejected",reason:me},zn())}finally{ie.p=p,x!==null&&S.types!==null&&(x.types=S.types),V.T=x}}function qv(){}function ef(t,i,s,o){if(t.tag!==5)throw Error(a(476));var h=Hp(t).queue;Pp(t,h,i,pe,s===null?qv:function(){return qp(t),s(o)})}function Hp(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:pe,baseState:pe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qr,lastRenderedState:pe},next:null};var s={};return i.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qr,lastRenderedState:s},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function qp(t){var i=Hp(t);i.next===null&&(i=t.alternate.memoizedState),Fs(t,i.next.queue,{},zn())}function tf(){return sn(sl)}function Ip(){return Ft().memoizedState}function Fp(){return Ft().memoizedState}function Iv(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var s=zn();t=mi(s);var o=pi(i,t,s);o!==null&&(kn(o,i,s),Bs(o,i,s)),i={cache:Nc()},t.payload=i;return}i=i.return}}function Fv(t,i,s){var o=zn();s={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Co(t)?Yp(i,s):(s=xc(t,i,s,o),s!==null&&(kn(s,t,o),Gp(s,i,o)))}function $p(t,i,s){var o=zn();Fs(t,i,s,o)}function Fs(t,i,s,o){var h={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Co(t))Yp(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,s);if(h.hasEagerState=!0,h.eagerState=S,Nn(S,x))return ao(t,i,h,0),Ct===null&&io(),!1}catch{}finally{}if(s=xc(t,i,h,o),s!==null)return kn(s,t,o),Gp(s,i,o),!0}return!1}function nf(t,i,s,o){if(o={lane:2,revertLane:Lf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Co(t)){if(i)throw Error(a(479))}else i=xc(t,s,o,2),i!==null&&kn(i,t,2)}function Co(t){var i=t.alternate;return t===Ye||i!==null&&i===Ye}function Yp(t,i){La=xo=!0;var s=t.pending;s===null?i.next=i:(i.next=s.next,s.next=i),t.pending=i}function Gp(t,i,s){if((s&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,s|=o,i.lanes=s,Fi(t,s)}}var $s={readContext:sn,use:So,useCallback:Pt,useContext:Pt,useEffect:Pt,useImperativeHandle:Pt,useLayoutEffect:Pt,useInsertionEffect:Pt,useMemo:Pt,useReducer:Pt,useRef:Pt,useState:Pt,useDebugValue:Pt,useDeferredValue:Pt,useTransition:Pt,useSyncExternalStore:Pt,useId:Pt,useHostTransitionStatus:Pt,useFormState:Pt,useActionState:Pt,useOptimistic:Pt,useMemoCache:Pt,useCacheRefresh:Pt};$s.useEffectEvent=Pt;var Vp={readContext:sn,use:So,useCallback:function(t,i){return dn().memoizedState=[t,i===void 0?null:i],t},useContext:sn,useEffect:Np,useImperativeHandle:function(t,i,s){s=s!=null?s.concat([t]):null,Eo(4194308,4,Dp.bind(null,i,t),s)},useLayoutEffect:function(t,i){return Eo(4194308,4,t,i)},useInsertionEffect:function(t,i){Eo(4,2,t,i)},useMemo:function(t,i){var s=dn();i=i===void 0?null:i;var o=t();if(ia){Ut(!0);try{t()}finally{Ut(!1)}}return s.memoizedState=[o,i],o},useReducer:function(t,i,s){var o=dn();if(s!==void 0){var h=s(i);if(ia){Ut(!0);try{s(i)}finally{Ut(!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=Fv.bind(null,Ye,t),[o.memoizedState,t]},useRef:function(t){var i=dn();return t={current:t},i.memoizedState=t},useState:function(t){t=Xc(t);var i=t.queue,s=$p.bind(null,Ye,i);return i.dispatch=s,[t.memoizedState,s]},useDebugValue:Zc,useDeferredValue:function(t,i){var s=dn();return Wc(s,t,i)},useTransition:function(){var t=Xc(!1);return t=Pp.bind(null,Ye,t.queue,!0,!1),dn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,s){var o=Ye,h=dn();if(at){if(s===void 0)throw Error(a(407));s=s()}else{if(s=i(),Ct===null)throw Error(a(349));(nt&127)!==0||mp(o,i,s)}h.memoizedState=s;var p={value:s,getSnapshot:i};return h.queue=p,Np(gp.bind(null,o,p,t),[t]),o.flags|=2048,Ua(9,{destroy:void 0},pp.bind(null,o,p,s,i),null),s},useId:function(){var t=dn(),i=Ct.identifierPrefix;if(at){var s=vr,o=xr;s=(o&~(1<<32-be(o)-1)).toString(32)+s,i="_"+i+"R_"+s,s=vo++,0<s&&(i+="H"+s.toString(32)),i+="_"}else s=zv++,i="_"+i+"r_"+s.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:tf,useFormState:kp,useActionState:kp,useOptimistic:function(t){var i=dn();i.memoizedState=i.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=s,i=nf.bind(null,Ye,!0,s),s.dispatch=i,[t,i]},useMemoCache:Gc,useCacheRefresh:function(){return dn().memoizedState=Iv.bind(null,Ye)},useEffectEvent:function(t){var i=dn(),s={impl:t};return i.memoizedState=s,function(){if((ht&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}},rf={readContext:sn,use:So,useCallback:zp,useContext:sn,useEffect:Qc,useImperativeHandle:Lp,useInsertionEffect:Rp,useLayoutEffect:Mp,useMemo:Up,useReducer:_o,useRef:jp,useState:function(){return _o(qr)},useDebugValue:Zc,useDeferredValue:function(t,i){var s=Ft();return Bp(s,vt.memoizedState,t,i)},useTransition:function(){var t=_o(qr)[0],i=Ft().memoizedState;return[typeof t=="boolean"?t:Is(t),i]},useSyncExternalStore:dp,useId:Ip,useHostTransitionStatus:tf,useFormState:Cp,useActionState:Cp,useOptimistic:function(t,i){var s=Ft();return xp(s,vt,t,i)},useMemoCache:Gc,useCacheRefresh:Fp};rf.useEffectEvent=Op;var Jp={readContext:sn,use:So,useCallback:zp,useContext:sn,useEffect:Qc,useImperativeHandle:Lp,useInsertionEffect:Rp,useLayoutEffect:Mp,useMemo:Up,useReducer:Jc,useRef:jp,useState:function(){return Jc(qr)},useDebugValue:Zc,useDeferredValue:function(t,i){var s=Ft();return vt===null?Wc(s,t,i):Bp(s,vt.memoizedState,t,i)},useTransition:function(){var t=Jc(qr)[0],i=Ft().memoizedState;return[typeof t=="boolean"?t:Is(t),i]},useSyncExternalStore:dp,useId:Ip,useHostTransitionStatus:tf,useFormState:Tp,useActionState:Tp,useOptimistic:function(t,i){var s=Ft();return vt!==null?xp(s,vt,t,i):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:Gc,useCacheRefresh:Fp};Jp.useEffectEvent=Op;function af(t,i,s,o){i=t.memoizedState,s=s(o,i),s=s==null?i:g({},i,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var sf={enqueueSetState:function(t,i,s){t=t._reactInternals;var o=zn(),h=mi(o);h.payload=i,s!=null&&(h.callback=s),i=pi(t,h,o),i!==null&&(kn(i,t,o),Bs(i,t,o))},enqueueReplaceState:function(t,i,s){t=t._reactInternals;var o=zn(),h=mi(o);h.tag=1,h.payload=i,s!=null&&(h.callback=s),i=pi(t,h,o),i!==null&&(kn(i,t,o),Bs(i,t,o))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var s=zn(),o=mi(s);o.tag=2,i!=null&&(o.callback=i),i=pi(t,o,s),i!==null&&(kn(i,t,s),Bs(i,t,s))}};function Xp(t,i,s,o,h,p,x){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,p,x):i.prototype&&i.prototype.isPureReactComponent?!Ns(s,o)||!Ns(h,p):!0}function Kp(t,i,s,o){t=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(s,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(s,o),i.state!==t&&sf.enqueueReplaceState(i,i.state,null)}function aa(t,i){var s=i;if("ref"in i){s={};for(var o in i)o!=="ref"&&(s[o]=i[o])}if(t=t.defaultProps){s===i&&(s=g({},s));for(var h in t)s[h]===void 0&&(s[h]=t[h])}return s}function Qp(t){ro(t)}function Zp(t){console.error(t)}function Wp(t){ro(t)}function Ao(t,i){try{var s=t.onUncaughtError;s(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function eg(t,i,s){try{var o=t.onCaughtError;o(s.value,{componentStack:s.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function lf(t,i,s){return s=mi(s),s.tag=3,s.payload={element:null},s.callback=function(){Ao(t,i)},s}function tg(t){return t=mi(t),t.tag=3,t}function ng(t,i,s,o){var h=s.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;t.payload=function(){return h(p)},t.callback=function(){eg(i,s,o)}}var x=s.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(t.callback=function(){eg(i,s,o),typeof h!="function"&&(wi===null?wi=new Set([this]):wi.add(this));var S=o.stack;this.componentDidCatch(o.value,{componentStack:S!==null?S:""})})}function $v(t,i,s,o,h){if(s.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=s.alternate,i!==null&&ja(i,s,h,!0),s=Rn.current,s!==null){switch(s.tag){case 31:case 13:return Zn===null?Po():s.alternate===null&&Ht===0&&(Ht=3),s.flags&=-257,s.flags|=65536,s.lanes=h,o===mo?s.flags|=16384:(i=s.updateQueue,i===null?s.updateQueue=new Set([o]):i.add(o),Rf(t,o,h)),!1;case 22:return s.flags|=65536,o===mo?s.flags|=16384:(i=s.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},s.updateQueue=i):(s=i.retryQueue,s===null?i.retryQueue=new Set([o]):s.add(o)),Rf(t,o,h)),!1}throw Error(a(435,s.tag))}return Rf(t,o,h),Po(),!1}if(at)return i=Rn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==kc&&(t=Error(a(422),{cause:o}),Ms(Jn(t,s)))):(o!==kc&&(i=Error(a(423),{cause:o}),Ms(Jn(i,s))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=Jn(o,s),h=lf(t.stateNode,o,h),zc(t,h),Ht!==4&&(Ht=2)),!1;var p=Error(a(520),{cause:o});if(p=Jn(p,s),Zs===null?Zs=[p]:Zs.push(p),Ht!==4&&(Ht=2),i===null)return!0;o=Jn(o,s),s=i;do{switch(s.tag){case 3:return s.flags|=65536,t=h&-h,s.lanes|=t,t=lf(s.stateNode,o,t),zc(s,t),!1;case 1:if(i=s.type,p=s.stateNode,(s.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(wi===null||!wi.has(p))))return s.flags|=65536,h&=-h,s.lanes|=h,h=tg(h),ng(h,t,s,o),zc(s,h),!1}s=s.return}while(s!==null);return!1}var of=Error(a(461)),Jt=!1;function ln(t,i,s,o){i.child=t===null?sp(i,null,s,o):ra(i,t.child,s,o)}function rg(t,i,s,o,h){s=s.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 Wi(i),o=Ic(t,i,s,x,p,h),S=Fc(),t!==null&&!Jt?($c(t,i,h),Ir(t,i,h)):(at&&S&&_c(i),i.flags|=1,ln(t,i,o,h),i.child)}function ig(t,i,s,o,h){if(t===null){var p=s.type;return typeof p=="function"&&!vc(p)&&p.defaultProps===void 0&&s.compare===null?(i.tag=15,i.type=p,ag(t,i,p,o,h)):(t=lo(s.type,null,o,i,i.mode,h),t.ref=i.ref,t.return=i,i.child=t)}if(p=t.child,!gf(t,h)){var x=p.memoizedProps;if(s=s.compare,s=s!==null?s:Ns,s(x,o)&&t.ref===i.ref)return Ir(t,i,h)}return i.flags|=1,t=zr(p,o),t.ref=i.ref,t.return=i,i.child=t}function ag(t,i,s,o,h){if(t!==null){var p=t.memoizedProps;if(Ns(p,o)&&t.ref===i.ref)if(Jt=!1,i.pendingProps=o=p,gf(t,h))(t.flags&131072)!==0&&(Jt=!0);else return i.lanes=t.lanes,Ir(t,i,h)}return uf(t,i,s,o,h)}function sg(t,i,s,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|s:s,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 lg(t,i,p,s,o)}if((s&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&fo(i,p!==null?p.cachePool:null),p!==null?up(i,p):Bc(),cp(i);else return o=i.lanes=536870912,lg(t,i,p!==null?p.baseLanes|s:s,s,o)}else p!==null?(fo(i,p.cachePool),up(i,p),yi(),i.memoizedState=null):(t!==null&&fo(i,null),Bc(),yi());return ln(t,i,h,s),i.child}function Ys(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function lg(t,i,s,o,h){var p=Rc();return p=p===null?null:{parent:Gt._currentValue,pool:p},i.memoizedState={baseLanes:s,cachePool:p},t!==null&&fo(i,null),Bc(),cp(i),t!==null&&ja(t,i,o,!0),i.childLanes=h,null}function To(t,i){return i=No({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function og(t,i,s){return ra(i,t.child,null,s),t=To(i,i.pendingProps),t.flags|=2,Mn(i),i.memoizedState=null,t}function Yv(t,i,s){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(at){if(o.mode==="hidden")return t=To(i,o),i.lanes=536870912,Ys(null,t);if(Hc(i),(t=Nt)?(t=vy(t,Qn),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ui!==null?{id:xr,overflow:vr}:null,retryLane:536870912,hydrationErrors:null},s=Ym(t),s.return=i,i.child=s,an=i,Nt=null)):t=null,t===null)throw fi(i);return i.lanes=536870912,null}return To(i,o)}var p=t.memoizedState;if(p!==null){var x=p.dehydrated;if(Hc(i),h)if(i.flags&256)i.flags&=-257,i=og(t,i,s);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(a(558));else if(Jt||ja(t,i,s,!1),h=(s&t.childLanes)!==0,Jt||h){if(o=Ct,o!==null&&(x=li(o,s),x!==0&&x!==p.retryLane))throw p.retryLane=x,Xi(t,x),kn(o,t,x),of;Po(),i=og(t,i,s)}else t=p.treeContext,Nt=Wn(x.nextSibling),an=i,at=!0,ci=null,Qn=!1,t!==null&&Jm(i,t),i=To(i,o),i.flags|=4096;return i}return t=zr(t.child,{mode:o.mode,children:o.children}),t.ref=i.ref,i.child=t,t.return=i,t}function jo(t,i){var s=i.ref;if(s===null)t!==null&&t.ref!==null&&(i.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(a(284));(t===null||t.ref!==s)&&(i.flags|=4194816)}}function uf(t,i,s,o,h){return Wi(i),s=Ic(t,i,s,o,void 0,h),o=Fc(),t!==null&&!Jt?($c(t,i,h),Ir(t,i,h)):(at&&o&&_c(i),i.flags|=1,ln(t,i,s,h),i.child)}function ug(t,i,s,o,h,p){return Wi(i),i.updateQueue=null,s=hp(i,o,s,h),fp(t),o=Fc(),t!==null&&!Jt?($c(t,i,p),Ir(t,i,p)):(at&&o&&_c(i),i.flags|=1,ln(t,i,s,p),i.child)}function cg(t,i,s,o,h){if(Wi(i),i.stateNode===null){var p=ka,x=s.contextType;typeof x=="object"&&x!==null&&(p=sn(x)),p=new s(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=sf,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},Dc(i),x=s.contextType,p.context=typeof x=="object"&&x!==null?sn(x):ka,p.state=i.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(af(i,s,x,o),p.state=i.memoizedState),typeof s.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&&sf.enqueueReplaceState(p,p.state,null),Hs(i,o,p,h),Ps(),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=aa(s,S);p.props=H;var te=p.context,ce=s.contextType;x=ka,typeof ce=="object"&&ce!==null&&(x=sn(ce));var me=s.getDerivedStateFromProps;ce=typeof me=="function"||typeof p.getSnapshotBeforeUpdate=="function",S=i.pendingProps!==S,ce||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(S||te!==x)&&Kp(i,p,o,x),di=!1;var re=i.memoizedState;p.state=re,Hs(i,o,p,h),Ps(),te=i.memoizedState,S||re!==te||di?(typeof me=="function"&&(af(i,s,me,o),te=i.memoizedState),(H=di||Xp(i,s,H,o,re,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,Lc(t,i),x=i.memoizedProps,ce=aa(s,x),p.props=ce,me=i.pendingProps,re=p.context,te=s.contextType,H=ka,typeof te=="object"&&te!==null&&(H=sn(te)),S=s.getDerivedStateFromProps,(te=typeof S=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(x!==me||re!==H)&&Kp(i,p,o,H),di=!1,re=i.memoizedState,p.state=re,Hs(i,o,p,h),Ps();var le=i.memoizedState;x!==me||re!==le||di||t!==null&&t.dependencies!==null&&uo(t.dependencies)?(typeof S=="function"&&(af(i,s,S,o),le=i.memoizedState),(ce=di||Xp(i,s,ce,o,re,le,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,le,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,le,H)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||x===t.memoizedProps&&re===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===t.memoizedProps&&re===t.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=le),p.props=o,p.state=le,p.context=H,o=ce):(typeof p.componentDidUpdate!="function"||x===t.memoizedProps&&re===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===t.memoizedProps&&re===t.memoizedState||(i.flags|=1024),o=!1)}return p=o,jo(t,i),o=(i.flags&128)!==0,p||o?(p=i.stateNode,s=o&&typeof s.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,t!==null&&o?(i.child=ra(i,t.child,null,h),i.child=ra(i,null,s,h)):ln(t,i,s,h),i.memoizedState=p.state,t=i.child):t=Ir(t,i,h),t}function fg(t,i,s,o){return Qi(),i.flags|=256,ln(t,i,s,o),i.child}var cf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ff(t){return{baseLanes:t,cachePool:ep()}}function hf(t,i,s){return t=t!==null?t.childLanes&~s:0,i&&(t|=Ln),t}function hg(t,i,s){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,x;if((x=p)||(x=t!==null&&t.memoizedState===null?!1:(It.current&2)!==0),x&&(h=!0,i.flags&=-129),x=(i.flags&32)!==0,i.flags&=-33,t===null){if(at){if(h?gi(i):yi(),(t=Nt)?(t=vy(t,Qn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ui!==null?{id:xr,overflow:vr}:null,retryLane:536870912,hydrationErrors:null},s=Ym(t),s.return=i,i.child=s,an=i,Nt=null)):t=null,t===null)throw fi(i);return Jf(t)?i.lanes=32:i.lanes=536870912,null}var S=o.children;return o=o.fallback,h?(yi(),h=i.mode,S=No({mode:"hidden",children:S},h),o=Ki(o,h,s,null),S.return=i,o.return=i,S.sibling=o,i.child=S,o=i.child,o.memoizedState=ff(s),o.childLanes=hf(t,x,s),i.memoizedState=cf,Ys(null,o)):(gi(i),df(i,S))}var H=t.memoizedState;if(H!==null&&(S=H.dehydrated,S!==null)){if(p)i.flags&256?(gi(i),i.flags&=-257,i=mf(t,i,s)):i.memoizedState!==null?(yi(),i.child=t.child,i.flags|=128,i=null):(yi(),S=o.fallback,h=i.mode,o=No({mode:"visible",children:o.children},h),S=Ki(S,h,s,null),S.flags|=2,o.return=i,S.return=i,o.sibling=S,i.child=o,ra(i,t.child,null,s),o=i.child,o.memoizedState=ff(s),o.childLanes=hf(t,x,s),i.memoizedState=cf,i=Ys(null,o));else if(gi(i),Jf(S)){if(x=S.nextSibling&&S.nextSibling.dataset,x)var te=x.dgst;x=te,o=Error(a(419)),o.stack="",o.digest=x,Ms({value:o,source:null,stack:null}),i=mf(t,i,s)}else if(Jt||ja(t,i,s,!1),x=(s&t.childLanes)!==0,Jt||x){if(x=Ct,x!==null&&(o=li(x,s),o!==0&&o!==H.retryLane))throw H.retryLane=o,Xi(t,o),kn(x,t,o),of;Vf(S)||Po(),i=mf(t,i,s)}else Vf(S)?(i.flags|=192,i.child=t.child,i=null):(t=H.treeContext,Nt=Wn(S.nextSibling),an=i,at=!0,ci=null,Qn=!1,t!==null&&Jm(i,t),i=df(i,o.children),i.flags|=4096);return i}return h?(yi(),S=o.fallback,h=i.mode,H=t.child,te=H.sibling,o=zr(H,{mode:"hidden",children:o.children}),o.subtreeFlags=H.subtreeFlags&65011712,te!==null?S=zr(te,S):(S=Ki(S,h,s,null),S.flags|=2),S.return=i,o.return=i,o.sibling=S,i.child=o,Ys(null,o),o=i.child,S=t.child.memoizedState,S===null?S=ff(s):(h=S.cachePool,h!==null?(H=Gt._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=ep(),S={baseLanes:S.baseLanes|s,cachePool:h}),o.memoizedState=S,o.childLanes=hf(t,x,s),i.memoizedState=cf,Ys(t.child,o)):(gi(i),s=t.child,t=s.sibling,s=zr(s,{mode:"visible",children:o.children}),s.return=i,s.sibling=null,t!==null&&(x=i.deletions,x===null?(i.deletions=[t],i.flags|=16):x.push(t)),i.child=s,i.memoizedState=null,s)}function df(t,i){return i=No({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function No(t,i){return t=On(22,t,null,i),t.lanes=0,t}function mf(t,i,s){return ra(i,t.child,null,s),t=df(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function dg(t,i,s){t.lanes|=i;var o=t.alternate;o!==null&&(o.lanes|=i),Tc(t.return,i,s)}function pf(t,i,s,o,h,p){var x=t.memoizedState;x===null?t.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:s,tailMode:h,treeForkCount:p}:(x.isBackwards=i,x.rendering=null,x.renderingStartTime=0,x.last=o,x.tail=s,x.tailMode=h,x.treeForkCount=p)}function mg(t,i,s){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var x=It.current,S=(x&2)!==0;if(S?(x=x&1|2,i.flags|=128):x&=1,A(It,x),ln(t,i,o,s),o=at?Rs:0,!S&&t!==null&&(t.flags&128)!==0)e:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&dg(t,s,i);else if(t.tag===19)dg(t,s,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(s=i.child,h=null;s!==null;)t=s.alternate,t!==null&&bo(t)===null&&(h=s),s=s.sibling;s=h,s===null?(h=i.child,i.child=null):(h=s.sibling,s.sibling=null),pf(i,!1,h,s,p,o);break;case"backwards":case"unstable_legacy-backwards":for(s=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=s,s=h,h=t}pf(i,!0,s,null,p,o);break;case"together":pf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Ir(t,i,s){if(t!==null&&(i.dependencies=t.dependencies),vi|=i.lanes,(s&i.childLanes)===0)if(t!==null){if(ja(t,i,s,!1),(s&i.childLanes)===0)return null}else return null;if(t!==null&&i.child!==t.child)throw Error(a(153));if(i.child!==null){for(t=i.child,s=zr(t,t.pendingProps),i.child=s,s.return=i;t.sibling!==null;)t=t.sibling,s=s.sibling=zr(t,t.pendingProps),s.return=i;s.sibling=null}return i.child}function gf(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&uo(t)))}function Gv(t,i,s){switch(i.tag){case 3:Ie(i,i.stateNode.containerInfo),hi(i,Gt,t.memoizedState.cache),Qi();break;case 27:case 5:ze(i);break;case 4:Ie(i,i.stateNode.containerInfo);break;case 10:hi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Hc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(gi(i),i.flags|=128,null):(s&i.child.childLanes)!==0?hg(t,i,s):(gi(i),t=Ir(t,i,s),t!==null?t.sibling:null);gi(i);break;case 19:var h=(t.flags&128)!==0;if(o=(s&i.childLanes)!==0,o||(ja(t,i,s,!1),o=(s&i.childLanes)!==0),h){if(o)return mg(t,i,s);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),A(It,It.current),o)break;return null;case 22:return i.lanes=0,sg(t,i,s,i.pendingProps);case 24:hi(i,Gt,t.memoizedState.cache)}return Ir(t,i,s)}function pg(t,i,s){if(t!==null)if(t.memoizedProps!==i.pendingProps)Jt=!0;else{if(!gf(t,s)&&(i.flags&128)===0)return Jt=!1,Gv(t,i,s);Jt=(t.flags&131072)!==0}else Jt=!1,at&&(i.flags&1048576)!==0&&Vm(i,Rs,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(t=ta(i.elementType),i.type=t,typeof t=="function")vc(t)?(o=aa(t,o),i.tag=1,i=cg(null,i,t,o,s)):(i.tag=0,i=uf(null,i,t,o,s));else{if(t!=null){var h=t.$$typeof;if(h===oe){i.tag=11,i=rg(null,i,t,o,s);break e}else if(h===K){i.tag=14,i=ig(null,i,t,o,s);break e}}throw i=se(t)||t,Error(a(306,i,""))}}return i;case 0:return uf(t,i,i.type,i.pendingProps,s);case 1:return o=i.type,h=aa(o,i.pendingProps),cg(t,i,o,h,s);case 3:e:{if(Ie(i,i.stateNode.containerInfo),t===null)throw Error(a(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,Lc(t,i),Hs(i,o,null,s);var x=i.memoizedState;if(o=x.cache,hi(i,Gt,o),o!==p.cache&&jc(i,[Gt],s,!0),Ps(),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=fg(t,i,o,s);break e}else if(o!==h){h=Jn(Error(a(424)),i),Ms(h),i=fg(t,i,o,s);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(Nt=Wn(t.firstChild),an=i,at=!0,ci=null,Qn=!0,s=sp(i,null,o,s),i.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(Qi(),o===h){i=Ir(t,i,s);break e}ln(t,i,o,s)}i=i.child}return i;case 26:return jo(t,i),t===null?(s=Cy(i.type,null,i.pendingProps,null))?i.memoizedState=s:at||(s=i.type,t=i.pendingProps,o=Go(Te.current).createElement(s),o[kt]=i,o[Bt]=t,on(o,s,t),I(o),i.stateNode=o):i.memoizedState=Cy(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return ze(i),t===null&&at&&(o=i.stateNode=_y(i.type,i.pendingProps,Te.current),an=i,Qn=!0,h=Nt,ki(i.type)?(Xf=h,Nt=Wn(o.firstChild)):Nt=h),ln(t,i,i.pendingProps.children,s),jo(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&&at&&((h=o=Nt)&&(o=Sw(o,i.type,i.pendingProps,Qn),o!==null?(i.stateNode=o,an=i,Nt=Wn(o.firstChild),Qn=!1,h=!0):h=!1),h||fi(i)),ze(i),h=i.type,p=i.pendingProps,x=t!==null?t.memoizedProps:null,o=p.children,$f(h,p)?o=null:x!==null&&$f(h,x)&&(i.flags|=32),i.memoizedState!==null&&(h=Ic(t,i,Uv,null,null,s),sl._currentValue=h),jo(t,i),ln(t,i,o,s),i.child;case 6:return t===null&&at&&((t=s=Nt)&&(s=_w(s,i.pendingProps,Qn),s!==null?(i.stateNode=s,an=i,Nt=null,t=!0):t=!1),t||fi(i)),null;case 13:return hg(t,i,s);case 4:return Ie(i,i.stateNode.containerInfo),o=i.pendingProps,t===null?i.child=ra(i,null,o,s):ln(t,i,o,s),i.child;case 11:return rg(t,i,i.type,i.pendingProps,s);case 7:return ln(t,i,i.pendingProps,s),i.child;case 8:return ln(t,i,i.pendingProps.children,s),i.child;case 12:return ln(t,i,i.pendingProps.children,s),i.child;case 10:return o=i.pendingProps,hi(i,i.type,o.value),ln(t,i,o.children,s),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,Wi(i),h=sn(h),o=o(h),i.flags|=1,ln(t,i,o,s),i.child;case 14:return ig(t,i,i.type,i.pendingProps,s);case 15:return ag(t,i,i.type,i.pendingProps,s);case 19:return mg(t,i,s);case 31:return Yv(t,i,s);case 22:return sg(t,i,s,i.pendingProps);case 24:return Wi(i),o=sn(Gt),t===null?(h=Rc(),h===null&&(h=Ct,p=Nc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=s),h=p),i.memoizedState={parent:o,cache:h},Dc(i),hi(i,Gt,h)):((t.lanes&s)!==0&&(Lc(t,i),Hs(i,null,null,s),Ps()),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),hi(i,Gt,o)):(o=p.cache,hi(i,Gt,o),o!==h.cache&&jc(i,[Gt],s,!0))),ln(t,i,i.pendingProps.children,s),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Fr(t){t.flags|=4}function yf(t,i,s,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(Ig())t.flags|=8192;else throw na=mo,Mc}else t.flags&=-16777217}function gg(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Oy(i))if(Ig())t.flags|=8192;else throw na=mo,Mc}function Oo(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?pa():536870912,t.lanes|=i,qa|=i)}function Gs(t,i){if(!at)switch(t.tailMode){case"hidden":i=t.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.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,s=0,o=0;if(i)for(var h=t.child;h!==null;)s|=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;)s|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=s,i}function Vv(t,i,s){var o=i.pendingProps;switch(Ec(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 s=i.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Pr(Gt),ge(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(Ta(i)?Fr(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Cc())),Ot(i),null;case 26:var h=i.type,p=i.memoizedState;return t===null?(Fr(i),p!==null?(Ot(i),gg(i,p)):(Ot(i),yf(i,h,null,o,s))):p?p!==t.memoizedState?(Fr(i),Ot(i),gg(i,p)):(Ot(i),i.flags&=-16777217):(t=t.memoizedProps,t!==o&&Fr(i),Ot(i),yf(i,h,t,o,s)),null;case 27:if(Ke(i),s=Te.current,h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Fr(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Ot(i),null}t=ve.current,Ta(i)?Xm(i):(t=_y(h,o,s),i.stateNode=t,Fr(i))}return Ot(i),null;case 5:if(Ke(i),h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Fr(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Ot(i),null}if(p=ve.current,Ta(i))Xm(i);else{var x=Go(Te.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[kt]=i,p[Bt]=o;e:for(x=i.child;x!==null;){if(x.tag===5||x.tag===6)p.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===i)break e;for(;x.sibling===null;){if(x.return===null||x.return===i)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}i.stateNode=p;e:switch(on(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&&Fr(i)}}return Ot(i),yf(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,s),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&Fr(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(a(166));if(t=Te.current,Ta(i)){if(t=i.stateNode,s=i.memoizedProps,o=null,h=an,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[kt]=i,t=!!(t.nodeValue===s||o!==null&&o.suppressHydrationWarning===!0||hy(t.nodeValue,s)),t||fi(i,!0)}else t=Go(t).createTextNode(o),t[kt]=i,i.stateNode=t}return Ot(i),null;case 31:if(s=i.memoizedState,t===null||t.memoizedState!==null){if(o=Ta(i),s!==null){if(t===null){if(!o)throw Error(a(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(557));t[kt]=i}else Qi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ot(i),t=!1}else s=Cc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return i.flags&256?(Mn(i),i):(Mn(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Ot(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Ta(i),o!==null&&o.dehydrated!==null){if(t===null){if(!h)throw Error(a(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(a(317));h[kt]=i}else Qi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ot(i),h=!1}else h=Cc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Mn(i),i):(Mn(i),null)}return Mn(i),(i.flags&128)!==0?(i.lanes=s,i):(s=o!==null,t=t!==null&&t.memoizedState!==null,s&&(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)),s!==t&&s&&(i.child.flags|=8192),Oo(i,i.updateQueue),Ot(i),null);case 4:return ge(),t===null&&Pf(i.stateNode.containerInfo),Ot(i),null;case 10:return Pr(i.type),Ot(i),null;case 19:if(Z(It),o=i.memoizedState,o===null)return Ot(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Gs(o,!1);else{if(Ht!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(p=bo(t),p!==null){for(i.flags|=128,Gs(o,!1),t=p.updateQueue,i.updateQueue=t,Oo(i,t),i.subtreeFlags=0,t=s,s=i.child;s!==null;)$m(s,t),s=s.sibling;return A(It,It.current&1|2),at&&Ur(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&&xt()>zo&&(i.flags|=128,h=!0,Gs(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,Oo(i,t),Gs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!at)return Ot(i),null}else 2*xt()-o.renderingStartTime>zo&&s!==536870912&&(i.flags|=128,h=!0,Gs(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=xt(),t.sibling=null,s=It.current,A(It,h?s&1|2:s&1),at&&Ur(i,o.treeForkCount),t):(Ot(i),null);case 22:case 23:return Mn(i),Pc(),o=i.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(s&536870912)!==0&&(i.flags&128)===0&&(Ot(i),i.subtreeFlags&6&&(i.flags|=8192)):Ot(i),s=i.updateQueue,s!==null&&Oo(i,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==s&&(i.flags|=2048),t!==null&&Z(ea),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),i.memoizedState.cache!==s&&(i.flags|=2048),Pr(Gt),Ot(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function Jv(t,i){switch(Ec(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Pr(Gt),ge(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return Ke(i),null;case 31:if(i.memoizedState!==null){if(Mn(i),i.alternate===null)throw Error(a(340));Qi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(Mn(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Qi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return Z(It),null;case 4:return ge(),null;case 10:return Pr(i.type),null;case 22:case 23:return Mn(i),Pc(),t!==null&&Z(ea),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return Pr(Gt),null;case 25:return null;default:return null}}function yg(t,i){switch(Ec(i),i.tag){case 3:Pr(Gt),ge();break;case 26:case 27:case 5:Ke(i);break;case 4:ge();break;case 31:i.memoizedState!==null&&Mn(i);break;case 13:Mn(i);break;case 19:Z(It);break;case 10:Pr(i.type);break;case 22:case 23:Mn(i),Pc(),t!==null&&Z(ea);break;case 24:Pr(Gt)}}function Vs(t,i){try{var s=i.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var h=o.next;s=h;do{if((s.tag&t)===t){o=void 0;var p=s.create,x=s.inst;o=p(),x.destroy=o}s=s.next}while(s!==h)}}catch(S){bt(i,i.return,S)}}function bi(t,i,s){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=s,te=S;try{te()}catch(ce){bt(h,H,ce)}}}o=o.next}while(o!==p)}}catch(ce){bt(i,i.return,ce)}}function bg(t){var i=t.updateQueue;if(i!==null){var s=t.stateNode;try{op(i,s)}catch(o){bt(t,t.return,o)}}}function xg(t,i,s){s.props=aa(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(o){bt(t,i,o)}}function Js(t,i){try{var s=t.ref;if(s!==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 s=="function"?t.refCleanup=s(o):s.current=o}}catch(h){bt(t,i,h)}}function wr(t,i){var s=t.ref,o=t.refCleanup;if(s!==null)if(typeof o=="function")try{o()}catch(h){bt(t,i,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(h){bt(t,i,h)}else s.current=null}function vg(t){var i=t.type,s=t.memoizedProps,o=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":s.autoFocus&&o.focus();break e;case"img":s.src?o.src=s.src:s.srcSet&&(o.srcset=s.srcSet)}}catch(h){bt(t,t.return,h)}}function bf(t,i,s){try{var o=t.stateNode;gw(o,t.type,s,i),o[Bt]=i}catch(h){bt(t,t.return,h)}}function wg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ki(t.type)||t.tag===4}function xf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||wg(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&&ki(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 vf(t,i,s){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,i):(i=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,i.appendChild(t),s=s._reactRootContainer,s!=null||i.onclick!==null||(i.onclick=Dr));else if(o!==4&&(o===27&&ki(t.type)&&(s=t.stateNode,i=null),t=t.child,t!==null))for(vf(t,i,s),t=t.sibling;t!==null;)vf(t,i,s),t=t.sibling}function Ro(t,i,s){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?s.insertBefore(t,i):s.appendChild(t);else if(o!==4&&(o===27&&ki(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(Ro(t,i,s),t=t.sibling;t!==null;)Ro(t,i,s),t=t.sibling}function Sg(t){var i=t.stateNode,s=t.memoizedProps;try{for(var o=t.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);on(i,o,s),i[kt]=t,i[Bt]=s}catch(p){bt(t,t.return,p)}}var $r=!1,Xt=!1,wf=!1,_g=typeof WeakSet=="function"?WeakSet:Set,en=null;function Xv(t,i){if(t=t.containerInfo,If=Wo,t=Lm(t),dc(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var o=s.getSelection&&s.getSelection();if(o&&o.rangeCount!==0){s=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{s.nodeType,p.nodeType}catch{s=null;break e}var x=0,S=-1,H=-1,te=0,ce=0,me=t,re=null;t:for(;;){for(var le;me!==s||h!==0&&me.nodeType!==3||(S=x+h),me!==p||o!==0&&me.nodeType!==3||(H=x+o),me.nodeType===3&&(x+=me.nodeValue.length),(le=me.firstChild)!==null;)re=me,me=le;for(;;){if(me===t)break t;if(re===s&&++te===h&&(S=x),re===p&&++ce===o&&(H=x),(le=me.nextSibling)!==null)break;me=re,re=me.parentNode}me=le}s=S===-1||H===-1?null:{start:S,end:H}}else s=null}s=s||{start:0,end:0}}else s=null;for(Ff={focusedElem:t,selectionRange:s},Wo=!1,en=i;en!==null;)if(i=en,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,en=t;else for(;en!==null;){switch(i=en,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(s=0;s<t.length;s++)h=t[s],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,s=i,h=p.memoizedProps,p=p.memoizedState,o=s.stateNode;try{var Re=aa(s.type,h);t=o.getSnapshotBeforeUpdate(Re,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(qe){bt(s,s.return,qe)}}break;case 3:if((t&1024)!==0){if(t=i.stateNode.containerInfo,s=t.nodeType,s===9)Gf(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Gf(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(a(163))}if(t=i.sibling,t!==null){t.return=i.return,en=t;break}en=i.return}}function Eg(t,i,s){var o=s.flags;switch(s.tag){case 0:case 11:case 15:Gr(t,s),o&4&&Vs(5,s);break;case 1:if(Gr(t,s),o&4)if(t=s.stateNode,i===null)try{t.componentDidMount()}catch(x){bt(s,s.return,x)}else{var h=aa(s.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(h,i,t.__reactInternalSnapshotBeforeUpdate)}catch(x){bt(s,s.return,x)}}o&64&&bg(s),o&512&&Js(s,s.return);break;case 3:if(Gr(t,s),o&64&&(t=s.updateQueue,t!==null)){if(i=null,s.child!==null)switch(s.child.tag){case 27:case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}try{op(t,i)}catch(x){bt(s,s.return,x)}}break;case 27:i===null&&o&4&&Sg(s);case 26:case 5:Gr(t,s),i===null&&o&4&&vg(s),o&512&&Js(s,s.return);break;case 12:Gr(t,s);break;case 31:Gr(t,s),o&4&&Ag(t,s);break;case 13:Gr(t,s),o&4&&Tg(t,s),o&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=iw.bind(null,s),Ew(t,s))));break;case 22:if(o=s.memoizedState!==null||$r,!o){i=i!==null&&i.memoizedState!==null||Xt,h=$r;var p=Xt;$r=o,(Xt=i)&&!p?Vr(t,s,(s.subtreeFlags&8772)!==0):Gr(t,s),$r=h,Xt=p}break;case 30:break;default:Gr(t,s)}}function kg(t){var i=t.alternate;i!==null&&(t.alternate=null,kg(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&ga(i)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Mt=null,wn=!1;function Yr(t,i,s){for(s=s.child;s!==null;)Cg(t,i,s),s=s.sibling}function Cg(t,i,s){if(dt&&typeof dt.onCommitFiberUnmount=="function")try{dt.onCommitFiberUnmount(Yt,s)}catch{}switch(s.tag){case 26:Xt||wr(s,i),Yr(t,i,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Xt||wr(s,i);var o=Mt,h=wn;ki(s.type)&&(Mt=s.stateNode,wn=!1),Yr(t,i,s),rl(s.stateNode),Mt=o,wn=h;break;case 5:Xt||wr(s,i);case 6:if(o=Mt,h=wn,Mt=null,Yr(t,i,s),Mt=o,wn=h,Mt!==null)if(wn)try{(Mt.nodeType===9?Mt.body:Mt.nodeName==="HTML"?Mt.ownerDocument.body:Mt).removeChild(s.stateNode)}catch(p){bt(s,i,p)}else try{Mt.removeChild(s.stateNode)}catch(p){bt(s,i,p)}break;case 18:Mt!==null&&(wn?(t=Mt,by(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),Xa(t)):by(Mt,s.stateNode));break;case 4:o=Mt,h=wn,Mt=s.stateNode.containerInfo,wn=!0,Yr(t,i,s),Mt=o,wn=h;break;case 0:case 11:case 14:case 15:bi(2,s,i),Xt||bi(4,s,i),Yr(t,i,s);break;case 1:Xt||(wr(s,i),o=s.stateNode,typeof o.componentWillUnmount=="function"&&xg(s,i,o)),Yr(t,i,s);break;case 21:Yr(t,i,s);break;case 22:Xt=(o=Xt)||s.memoizedState!==null,Yr(t,i,s),Xt=o;break;default:Yr(t,i,s)}}function Ag(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Xa(t)}catch(s){bt(i,i.return,s)}}}function Tg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Xa(t)}catch(s){bt(i,i.return,s)}}function Kv(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new _g),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new _g),i;default:throw Error(a(435,t.tag))}}function Mo(t,i){var s=Kv(t);i.forEach(function(o){if(!s.has(o)){s.add(o);var h=aw.bind(null,t,o);o.then(h,h)}})}function Sn(t,i){var s=i.deletions;if(s!==null)for(var o=0;o<s.length;o++){var h=s[o],p=t,x=i,S=x;e:for(;S!==null;){switch(S.tag){case 27:if(ki(S.type)){Mt=S.stateNode,wn=!1;break e}break;case 5:Mt=S.stateNode,wn=!1;break e;case 3:case 4:Mt=S.stateNode.containerInfo,wn=!0;break e}S=S.return}if(Mt===null)throw Error(a(160));Cg(p,x,h),Mt=null,wn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)jg(i,t),i=i.sibling}var fr=null;function jg(t,i){var s=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Sn(i,t),_n(t),o&4&&(bi(3,t,t.return),Vs(3,t),bi(5,t,t.return));break;case 1:Sn(i,t),_n(t),o&512&&(Xt||s===null||wr(s,s.return)),o&64&&$r&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?o:s.concat(o))));break;case 26:var h=fr;if(Sn(i,t),_n(t),o&512&&(Xt||s===null||wr(s,s.return)),o&4){var p=s!==null?s.memoizedState:null;if(o=t.memoizedState,s===null)if(o===null)if(t.stateNode===null){e:{o=t.type,s=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[Qt]||p[kt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),on(p,o,s),p[kt]=t,I(p),o=p;break e;case"link":var x=jy("link","href",h).get(o+(s.href||""));if(x){for(var S=0;S<x.length;S++)if(p=x[S],p.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&p.getAttribute("rel")===(s.rel==null?null:s.rel)&&p.getAttribute("title")===(s.title==null?null:s.title)&&p.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){x.splice(S,1);break t}}p=h.createElement(o),on(p,o,s),h.head.appendChild(p);break;case"meta":if(x=jy("meta","content",h).get(o+(s.content||""))){for(S=0;S<x.length;S++)if(p=x[S],p.getAttribute("content")===(s.content==null?null:""+s.content)&&p.getAttribute("name")===(s.name==null?null:s.name)&&p.getAttribute("property")===(s.property==null?null:s.property)&&p.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&p.getAttribute("charset")===(s.charSet==null?null:s.charSet)){x.splice(S,1);break t}}p=h.createElement(o),on(p,o,s),h.head.appendChild(p);break;default:throw Error(a(468,o))}p[kt]=t,I(p),o=p}t.stateNode=o}else Ny(h,t.type,t.stateNode);else t.stateNode=Ty(h,o,t.memoizedProps);else p!==o?(p===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):p.count--,o===null?Ny(h,t.type,t.stateNode):Ty(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&bf(t,t.memoizedProps,s.memoizedProps)}break;case 27:Sn(i,t),_n(t),o&512&&(Xt||s===null||wr(s,s.return)),s!==null&&o&4&&bf(t,t.memoizedProps,s.memoizedProps);break;case 5:if(Sn(i,t),_n(t),o&512&&(Xt||s===null||wr(s,s.return)),t.flags&32){h=t.stateNode;try{ba(h,"")}catch(Re){bt(t,t.return,Re)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,bf(t,h,s!==null?s.memoizedProps:h)),o&1024&&(wf=!0);break;case 6:if(Sn(i,t),_n(t),o&4){if(t.stateNode===null)throw Error(a(162));o=t.memoizedProps,s=t.stateNode;try{s.nodeValue=o}catch(Re){bt(t,t.return,Re)}}break;case 3:if(Xo=null,h=fr,fr=Vo(i.containerInfo),Sn(i,t),fr=h,_n(t),o&4&&s!==null&&s.memoizedState.isDehydrated)try{Xa(i.containerInfo)}catch(Re){bt(t,t.return,Re)}wf&&(wf=!1,Ng(t));break;case 4:o=fr,fr=Vo(t.stateNode.containerInfo),Sn(i,t),_n(t),fr=o;break;case 12:Sn(i,t),_n(t);break;case 31:Sn(i,t),_n(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Mo(t,o)));break;case 13:Sn(i,t),_n(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Lo=xt()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Mo(t,o)));break;case 22:h=t.memoizedState!==null;var H=s!==null&&s.memoizedState!==null,te=$r,ce=Xt;if($r=te||h,Xt=ce||H,Sn(i,t),Xt=ce,$r=te,_n(t),o&8192)e:for(i=t.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(s===null||H||$r||Xt||sa(t)),s=null,i=t;;){if(i.tag===5||i.tag===26){if(s===null){H=s=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 me=H.memoizedProps.style,re=me!=null&&me.hasOwnProperty("display")?me.display:null;S.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(Re){bt(H,H.return,Re)}}}else if(i.tag===6){if(s===null){H=i;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(Re){bt(H,H.return,Re)}}}else if(i.tag===18){if(s===null){H=i;try{var le=H.stateNode;h?xy(le,!0):xy(H.stateNode,!1)}catch(Re){bt(H,H.return,Re)}}}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;s===i&&(s=null),i=i.return}s===i&&(s=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=t.updateQueue,o!==null&&(s=o.retryQueue,s!==null&&(o.retryQueue=null,Mo(t,s))));break;case 19:Sn(i,t),_n(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Mo(t,o)));break;case 30:break;case 21:break;default:Sn(i,t),_n(t)}}function _n(t){var i=t.flags;if(i&2){try{for(var s,o=t.return;o!==null;){if(wg(o)){s=o;break}o=o.return}if(s==null)throw Error(a(160));switch(s.tag){case 27:var h=s.stateNode,p=xf(t);Ro(t,p,h);break;case 5:var x=s.stateNode;s.flags&32&&(ba(x,""),s.flags&=-33);var S=xf(t);Ro(t,S,x);break;case 3:case 4:var H=s.stateNode.containerInfo,te=xf(t);vf(t,te,H);break;default:throw Error(a(161))}}catch(ce){bt(t,t.return,ce)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function Ng(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;Ng(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),t=t.sibling}}function Gr(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Eg(t,i.alternate,i),i=i.sibling}function sa(t){for(t=t.child;t!==null;){var i=t;switch(i.tag){case 0:case 11:case 14:case 15:bi(4,i,i.return),sa(i);break;case 1:wr(i,i.return);var s=i.stateNode;typeof s.componentWillUnmount=="function"&&xg(i,i.return,s),sa(i);break;case 27:rl(i.stateNode);case 26:case 5:wr(i,i.return),sa(i);break;case 22:i.memoizedState===null&&sa(i);break;case 30:sa(i);break;default:sa(i)}t=t.sibling}}function Vr(t,i,s){for(s=s&&(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:Vr(h,p,s),Vs(4,p);break;case 1:if(Vr(h,p,s),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(te){bt(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++)lp(H[h],S)}catch(te){bt(o,o.return,te)}}s&&x&64&&bg(p),Js(p,p.return);break;case 27:Sg(p);case 26:case 5:Vr(h,p,s),s&&o===null&&x&4&&vg(p),Js(p,p.return);break;case 12:Vr(h,p,s);break;case 31:Vr(h,p,s),s&&x&4&&Ag(h,p);break;case 13:Vr(h,p,s),s&&x&4&&Tg(h,p);break;case 22:p.memoizedState===null&&Vr(h,p,s),Js(p,p.return);break;case 30:break;default:Vr(h,p,s)}i=i.sibling}}function Sf(t,i){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(t=i.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&Ds(s))}function _f(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Ds(t))}function hr(t,i,s,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Og(t,i,s,o),i=i.sibling}function Og(t,i,s,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:hr(t,i,s,o),h&2048&&Vs(9,i);break;case 1:hr(t,i,s,o);break;case 3:hr(t,i,s,o),h&2048&&(t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Ds(t)));break;case 12:if(h&2048){hr(t,i,s,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){bt(i,i.return,H)}}else hr(t,i,s,o);break;case 31:hr(t,i,s,o);break;case 13:hr(t,i,s,o);break;case 23:break;case 22:p=i.stateNode,x=i.alternate,i.memoizedState!==null?p._visibility&2?hr(t,i,s,o):Xs(t,i):p._visibility&2?hr(t,i,s,o):(p._visibility|=2,Ba(t,i,s,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Sf(x,i);break;case 24:hr(t,i,s,o),h&2048&&_f(i.alternate,i);break;default:hr(t,i,s,o)}}function Ba(t,i,s,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=t,x=i,S=s,H=o,te=x.flags;switch(x.tag){case 0:case 11:case 15:Ba(p,x,S,H,h),Vs(8,x);break;case 23:break;case 22:var ce=x.stateNode;x.memoizedState!==null?ce._visibility&2?Ba(p,x,S,H,h):Xs(p,x):(ce._visibility|=2,Ba(p,x,S,H,h)),h&&te&2048&&Sf(x.alternate,x);break;case 24:Ba(p,x,S,H,h),h&&te&2048&&_f(x.alternate,x);break;default:Ba(p,x,S,H,h)}i=i.sibling}}function Xs(t,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var s=t,o=i,h=o.flags;switch(o.tag){case 22:Xs(s,o),h&2048&&Sf(o.alternate,o);break;case 24:Xs(s,o),h&2048&&_f(o.alternate,o);break;default:Xs(s,o)}i=i.sibling}}var Ks=8192;function Pa(t,i,s){if(t.subtreeFlags&Ks)for(t=t.child;t!==null;)Rg(t,i,s),t=t.sibling}function Rg(t,i,s){switch(t.tag){case 26:Pa(t,i,s),t.flags&Ks&&t.memoizedState!==null&&zw(s,fr,t.memoizedState,t.memoizedProps);break;case 5:Pa(t,i,s);break;case 3:case 4:var o=fr;fr=Vo(t.stateNode.containerInfo),Pa(t,i,s),fr=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=Ks,Ks=16777216,Pa(t,i,s),Ks=o):Pa(t,i,s));break;default:Pa(t,i,s)}}function Mg(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 Qs(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var o=i[s];en=o,Lg(o,t)}Mg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Dg(t),t=t.sibling}function Dg(t){switch(t.tag){case 0:case 11:case 15:Qs(t),t.flags&2048&&bi(9,t,t.return);break;case 3:Qs(t);break;case 12:Qs(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)):Qs(t);break;default:Qs(t)}}function Do(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var o=i[s];en=o,Lg(o,t)}Mg(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:bi(8,i,i.return),Do(i);break;case 22:s=i.stateNode,s._visibility&2&&(s._visibility&=-3,Do(i));break;default:Do(i)}t=t.sibling}}function Lg(t,i){for(;en!==null;){var s=en;switch(s.tag){case 0:case 11:case 15:bi(8,s,i);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var o=s.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Ds(s.memoizedState.cache)}if(o=s.child,o!==null)o.return=s,en=o;else e:for(s=t;en!==null;){o=en;var h=o.sibling,p=o.return;if(kg(o),o===s){en=null;break e}if(h!==null){h.return=p,en=h;break e}en=p}}}var Qv={getCacheForType:function(t){var i=sn(Gt),s=i.data.get(t);return s===void 0&&(s=t(),i.data.set(t,s)),s},cacheSignal:function(){return sn(Gt).controller.signal}},Zv=typeof WeakMap=="function"?WeakMap:Map,ht=0,Ct=null,We=null,nt=0,yt=0,Dn=null,xi=!1,Ha=!1,Ef=!1,Jr=0,Ht=0,vi=0,la=0,kf=0,Ln=0,qa=0,Zs=null,En=null,Cf=!1,Lo=0,zg=0,zo=1/0,Uo=null,wi=null,Zt=0,Si=null,Ia=null,Xr=0,Af=0,Tf=null,Ug=null,Ws=0,jf=null;function zn(){return(ht&2)!==0&&nt!==0?nt&-nt:V.T!==null?Lf():ws()}function Bg(){if(Ln===0)if((nt&536870912)===0||at){var t=Or;Or<<=1,(Or&3932160)===0&&(Or=262144),Ln=t}else Ln=536870912;return t=Rn.current,t!==null&&(t.flags|=32),Ln}function kn(t,i,s){(t===Ct&&(yt===2||yt===9)||t.cancelPendingCommit!==null)&&(Fa(t,0),_i(t,nt,Ln,!1)),or(t,s),((ht&2)===0||t!==Ct)&&(t===Ct&&((ht&2)===0&&(la|=s),Ht===4&&_i(t,nt,Ln,!1)),Sr(t))}function Pg(t,i,s){if((ht&6)!==0)throw Error(a(327));var o=!s&&(i&127)===0&&(i&t.expiredLanes)===0||Ii(t,i),h=o?tw(t,i):Of(t,i,!0),p=o;do{if(h===0){Ha&&!o&&_i(t,i,0,!1);break}else{if(s=t.current.alternate,p&&!Wv(s)){h=Of(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=Zs;var H=S.current.memoizedState.isDehydrated;if(H&&(Fa(S,x).flags|=256),x=Of(S,x,!1),x!==2){if(Ef&&!H){S.errorRecoveryDisabledLanes|=p,la|=p,h=4;break e}p=En,En=h,p!==null&&(En===null?En=p:En.push.apply(En,p))}h=x}if(p=!1,h!==2)continue}}if(h===1){Fa(t,0),_i(t,i,0,!0);break}e:{switch(o=t,p=h,p){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:_i(o,i,Ln,!xi);break e;case 2:En=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(h=Lo+300-xt(),10<h)){if(_i(o,i,Ln,!xi),qi(o,0,!0)!==0)break e;Xr=i,o.timeoutHandle=gy(Hg.bind(null,o,s,En,Uo,Cf,i,Ln,la,qa,xi,p,"Throttled",-0,0),h);break e}Hg(o,s,En,Uo,Cf,i,Ln,la,qa,xi,p,null,-0,0)}}break}while(!0);Sr(t)}function Hg(t,i,s,o,h,p,x,S,H,te,ce,me,re,le){if(t.timeoutHandle=-1,me=i.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Dr},Rg(i,p,me);var Re=(p&62914560)===p?Lo-xt():(p&4194048)===p?zg-xt():0;if(Re=Uw(me,Re),Re!==null){Xr=p,t.cancelPendingCommit=Re(Jg.bind(null,t,i,p,s,o,h,x,S,H,ce,me,null,re,le)),_i(t,p,x,!te);return}}Jg(t,i,p,s,o,h,x,S,H)}function Wv(t){for(var i=t;;){var s=i.tag;if((s===0||s===11||s===15)&&i.flags&16384&&(s=i.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var o=0;o<s.length;o++){var h=s[o],p=h.getSnapshot;h=h.value;try{if(!Nn(p(),h))return!1}catch{return!1}}if(s=i.child,i.subtreeFlags&16384&&s!==null)s.return=i,i=s;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 _i(t,i,s,o){i&=~kf,i&=~la,t.suspendedLanes|=i,t.pingedLanes&=~i,o&&(t.warmLanes|=i),o=t.expirationTimes;for(var h=i;0<h;){var p=31-be(h),x=1<<p;o[p]=-1,h&=~x}s!==0&&si(t,s,i)}function Bo(){return(ht&6)===0?(el(0),!1):!0}function Nf(){if(We!==null){if(yt===0)var t=We.return;else t=We,Br=Zi=null,Yc(t),Ma=null,zs=0,t=We;for(;t!==null;)yg(t.alternate,t),t=t.return;We=null}}function Fa(t,i){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,xw(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),Xr=0,Nf(),Ct=t,We=s=zr(t.current,null),nt=i,yt=0,Dn=null,xi=!1,Ha=Ii(t,i),Ef=!1,qa=Ln=kf=la=vi=Ht=0,En=Zs=null,Cf=!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-be(o),p=1<<h;i|=t[h],o&=~p}return Jr=i,io(),s}function qg(t,i){Ye=null,V.H=$s,i===Ra||i===ho?(i=rp(),yt=3):i===Mc?(i=rp(),yt=4):yt=i===of?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Dn=i,We===null&&(Ht=1,Ao(t,Jn(i,t.current)))}function Ig(){var t=Rn.current;return t===null?!0:(nt&4194048)===nt?Zn===null:(nt&62914560)===nt||(nt&536870912)!==0?t===Zn:!1}function Fg(){var t=V.H;return V.H=$s,t===null?$s:t}function $g(){var t=V.A;return V.A=Qv,t}function Po(){Ht=4,xi||(nt&4194048)!==nt&&Rn.current!==null||(Ha=!0),(vi&134217727)===0&&(la&134217727)===0||Ct===null||_i(Ct,nt,Ln,!1)}function Of(t,i,s){var o=ht;ht|=2;var h=Fg(),p=$g();(Ct!==t||nt!==i)&&(Uo=null,Fa(t,i)),i=!1;var x=Ht;e:do try{if(yt!==0&&We!==null){var S=We,H=Dn;switch(yt){case 8:Nf(),x=6;break e;case 3:case 2:case 9:case 6:Rn.current===null&&(i=!0);var te=yt;if(yt=0,Dn=null,$a(t,S,H,te),s&&Ha){x=0;break e}break;default:te=yt,yt=0,Dn=null,$a(t,S,H,te)}}ew(),x=Ht;break}catch(ce){qg(t,ce)}while(!0);return i&&t.shellSuspendCounter++,Br=Zi=null,ht=o,V.H=h,V.A=p,We===null&&(Ct=null,nt=0,io()),x}function ew(){for(;We!==null;)Yg(We)}function tw(t,i){var s=ht;ht|=2;var o=Fg(),h=$g();Ct!==t||nt!==i?(Uo=null,zo=xt()+500,Fa(t,i)):Ha=Ii(t,i);e:do try{if(yt!==0&&We!==null){i=We;var p=Dn;t:switch(yt){case 1:yt=0,Dn=null,$a(t,i,p,1);break;case 2:case 9:if(tp(p)){yt=0,Dn=null,Gg(i);break}i=function(){yt!==2&&yt!==9||Ct!==t||(yt=7),Sr(t)},p.then(i,i);break e;case 3:yt=7;break e;case 4:yt=5;break e;case 7:tp(p)?(yt=0,Dn=null,Gg(i)):(yt=0,Dn=null,$a(t,i,p,7));break;case 5:var x=null;switch(We.tag){case 26:x=We.memoizedState;case 5:case 27:var S=We;if(x?Oy(x):S.stateNode.complete){yt=0,Dn=null;var H=S.sibling;if(H!==null)We=H;else{var te=S.return;te!==null?(We=te,Ho(te)):We=null}break t}}yt=0,Dn=null,$a(t,i,p,5);break;case 6:yt=0,Dn=null,$a(t,i,p,6);break;case 8:Nf(),Ht=6;break e;default:throw Error(a(462))}}nw();break}catch(ce){qg(t,ce)}while(!0);return Br=Zi=null,V.H=o,V.A=h,ht=s,We!==null?0:(Ct=null,nt=0,io(),Ht)}function nw(){for(;We!==null&&!sr();)Yg(We)}function Yg(t){var i=pg(t.alternate,t,Jr);t.memoizedProps=t.pendingProps,i===null?Ho(t):We=i}function Gg(t){var i=t,s=i.alternate;switch(i.tag){case 15:case 0:i=ug(s,i,i.pendingProps,i.type,void 0,nt);break;case 11:i=ug(s,i,i.pendingProps,i.type.render,i.ref,nt);break;case 5:Yc(i);default:yg(s,i),i=We=$m(i,Jr),i=pg(s,i,Jr)}t.memoizedProps=t.pendingProps,i===null?Ho(t):We=i}function $a(t,i,s,o){Br=Zi=null,Yc(i),Ma=null,zs=0;var h=i.return;try{if($v(t,h,i,s,nt)){Ht=1,Ao(t,Jn(s,t.current)),We=null;return}}catch(p){if(h!==null)throw We=h,p;Ht=1,Ao(t,Jn(s,t.current)),We=null;return}i.flags&32768?(at||o===1?t=!0:Ha||(nt&536870912)!==0?t=!1:(xi=t=!0,(o===2||o===9||o===3||o===6)&&(o=Rn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Vg(i,t)):Ho(i)}function Ho(t){var i=t;do{if((i.flags&32768)!==0){Vg(i,xi);return}t=i.return;var s=Vv(i.alternate,i,Jr);if(s!==null){We=s;return}if(i=i.sibling,i!==null){We=i;return}We=i=t}while(i!==null);Ht===0&&(Ht=5)}function Vg(t,i){do{var s=Jv(t.alternate,t);if(s!==null){s.flags&=32767,We=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!i&&(t=t.sibling,t!==null)){We=t;return}We=t=s}while(t!==null);Ht=6,We=null}function Jg(t,i,s,o,h,p,x,S,H){t.cancelPendingCommit=null;do qo();while(Zt!==0);if((ht&6)!==0)throw Error(a(327));if(i!==null){if(i===t.current)throw Error(a(177));if(p=i.lanes|i.childLanes,p|=bc,ai(t,s,p,x,S,H),t===Ct&&(We=Ct=null,nt=0),Ia=i,Si=t,Xr=s,Af=p,Tf=h,Ug=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,sw(Be,function(){return Wg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=V.T,V.T=null,h=ie.p,ie.p=2,x=ht,ht|=4;try{Xv(t,i,s)}finally{ht=x,ie.p=h,V.T=o}}Zt=1,Xg(),Kg(),Qg()}}function Xg(){if(Zt===1){Zt=0;var t=Si,i=Ia,s=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||s){s=V.T,V.T=null;var o=ie.p;ie.p=2;var h=ht;ht|=4;try{jg(i,t);var p=Ff,x=Lm(t.containerInfo),S=p.focusedElem,H=p.selectionRange;if(x!==S&&S&&S.ownerDocument&&Dm(S.ownerDocument.documentElement,S)){if(H!==null&&dc(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 me=S.ownerDocument||document,re=me&&me.defaultView||window;if(re.getSelection){var le=re.getSelection(),Re=S.textContent.length,qe=Math.min(H.start,Re),St=H.end===void 0?qe:Math.min(H.end,Re);!le.extend&&qe>St&&(x=St,St=qe,qe=x);var X=Mm(S,qe),G=Mm(S,St);if(X&&G&&(le.rangeCount!==1||le.anchorNode!==X.node||le.anchorOffset!==X.offset||le.focusNode!==G.node||le.focusOffset!==G.offset)){var ee=me.createRange();ee.setStart(X.node,X.offset),le.removeAllRanges(),qe>St?(le.addRange(ee),le.extend(G.node,G.offset)):(ee.setEnd(G.node,G.offset),le.addRange(ee))}}}}for(me=[],le=S;le=le.parentNode;)le.nodeType===1&&me.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<me.length;S++){var fe=me[S];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}Wo=!!If,Ff=If=null}finally{ht=h,ie.p=o,V.T=s}}t.current=i,Zt=2}}function Kg(){if(Zt===2){Zt=0;var t=Si,i=Ia,s=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||s){s=V.T,V.T=null;var o=ie.p;ie.p=2;var h=ht;ht|=4;try{Eg(t,i.alternate,i)}finally{ht=h,ie.p=o,V.T=s}}Zt=3}}function Qg(){if(Zt===4||Zt===3){Zt=0,yr();var t=Si,i=Ia,s=Xr,o=Ug;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Zt=5:(Zt=0,Ia=Si=null,Zg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(wi=null),$i(s),i=i.stateNode,dt&&typeof dt.onCommitFiberRoot=="function")try{dt.onCommitFiberRoot(Yt,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=V.T,h=ie.p,ie.p=2,V.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{V.T=i,ie.p=h}}(Xr&3)!==0&&qo(),Sr(t),h=t.pendingLanes,(s&261930)!==0&&(h&42)!==0?t===jf?Ws++:(Ws=0,jf=t):Ws=0,el(0)}}function Zg(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,Ds(i)))}function qo(){return Xg(),Kg(),Qg(),Wg()}function Wg(){if(Zt!==5)return!1;var t=Si,i=Af;Af=0;var s=$i(Xr),o=V.T,h=ie.p;try{ie.p=32>s?32:s,V.T=null,s=Tf,Tf=null;var p=Si,x=Xr;if(Zt=0,Ia=Si=null,Xr=0,(ht&6)!==0)throw Error(a(331));var S=ht;if(ht|=4,Dg(p.current),Og(p,p.current,x,s),ht=S,el(0,!1),dt&&typeof dt.onPostCommitFiberRoot=="function")try{dt.onPostCommitFiberRoot(Yt,p)}catch{}return!0}finally{ie.p=h,V.T=o,Zg(t,i)}}function ey(t,i,s){i=Jn(s,i),i=lf(t.stateNode,i,2),t=pi(t,i,2),t!==null&&(or(t,2),Sr(t))}function bt(t,i,s){if(t.tag===3)ey(t,t,s);else for(;i!==null;){if(i.tag===3){ey(i,t,s);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(wi===null||!wi.has(o))){t=Jn(s,t),s=tg(2),o=pi(i,s,2),o!==null&&(ng(s,o,i,t),or(o,2),Sr(o));break}}i=i.return}}function Rf(t,i,s){var o=t.pingCache;if(o===null){o=t.pingCache=new Zv;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(s)||(Ef=!0,h.add(s),t=rw.bind(null,t,i,s),i.then(t,t))}function rw(t,i,s){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,Ct===t&&(nt&s)===s&&(Ht===4||Ht===3&&(nt&62914560)===nt&&300>xt()-Lo?(ht&2)===0&&Fa(t,0):kf|=s,qa===nt&&(qa=0)),Sr(t)}function ty(t,i){i===0&&(i=pa()),t=Xi(t,i),t!==null&&(or(t,i),Sr(t))}function iw(t){var i=t.memoizedState,s=0;i!==null&&(s=i.retryLane),ty(t,s)}function aw(t,i){var s=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(s=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(a(314))}o!==null&&o.delete(i),ty(t,s)}function sw(t,i){return Rt(t,i)}var Io=null,Ya=null,Mf=!1,Fo=!1,Df=!1,Ei=0;function Sr(t){t!==Ya&&t.next===null&&(Ya===null?Io=Ya=t:Ya=Ya.next=t),Fo=!0,Mf||(Mf=!0,ow())}function el(t,i){if(!Df&&Fo){Df=!0;do for(var s=!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-be(42|t)+1)-1,p&=h&~(x&~S),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(s=!0,ay(o,p))}else p=nt,p=qi(o,o===Ct?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Ii(o,p)||(s=!0,ay(o,p));o=o.next}while(s);Df=!1}}function lw(){ny()}function ny(){Fo=Mf=!1;var t=0;Ei!==0&&bw()&&(t=Ei);for(var i=xt(),s=null,o=Io;o!==null;){var h=o.next,p=ry(o,i);p===0?(o.next=null,s===null?Io=h:s.next=h,h===null&&(Ya=s)):(s=o,(t!==0||(p&3)!==0)&&(Fo=!0)),o=h}Zt!==0&&Zt!==5||el(t),Ei!==0&&(Ei=0)}function ry(t,i){for(var s=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var x=31-be(p),S=1<<x,H=h[x];H===-1?((S&s)===0||(S&o)!==0)&&(h[x]=vs(S,i)):H<=i&&(t.expiredLanes|=S),p&=~S}if(i=Ct,s=nt,s=qi(t,t===i?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,s===0||t===i&&(yt===2||yt===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&gt(o),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||Ii(t,s)){if(i=s&-s,i===t.callbackPriority)return i;switch(o!==null&&gt(o),$i(s)){case 2:case 8:s=we;break;case 32:s=Be;break;case 268435456:s=st;break;default:s=Be}return o=iy.bind(null,t),s=Rt(s,o),t.callbackPriority=i,t.callbackNode=s,i}return o!==null&&o!==null&&gt(o),t.callbackPriority=2,t.callbackNode=null,2}function iy(t,i){if(Zt!==0&&Zt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(qo()&&t.callbackNode!==s)return null;var o=nt;return o=qi(t,t===Ct?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(Pg(t,o,i),ry(t,xt()),t.callbackNode!=null&&t.callbackNode===s?iy.bind(null,t):null)}function ay(t,i){if(qo())return null;Pg(t,i,!0)}function ow(){vw(function(){(ht&6)!==0?Rt(ue,lw):ny()})}function Lf(){if(Ei===0){var t=Na;t===0&&(t=qt,qt<<=1,(qt&261888)===0&&(qt=256)),Ei=t}return Ei}function sy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Kl(""+t)}function ly(t,i){var s=i.ownerDocument.createElement("input");return s.name=i.name,s.value=i.value,t.id&&s.setAttribute("form",t.id),i.parentNode.insertBefore(s,i),t=new FormData(t),s.parentNode.removeChild(s),t}function uw(t,i,s,o,h){if(i==="submit"&&s&&s.stateNode===h){var p=sy((h[Bt]||null).action),x=o.submitter;x&&(i=(i=x[Bt]||null)?sy(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(Ei!==0){var H=x?ly(h,x):new FormData(h);ef(s,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(S.preventDefault(),H=x?ly(h,x):new FormData(h),ef(s,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var zf=0;zf<yc.length;zf++){var Uf=yc[zf],cw=Uf.toLowerCase(),fw=Uf[0].toUpperCase()+Uf.slice(1);cr(cw,"on"+fw)}cr(Bm,"onAnimationEnd"),cr(Pm,"onAnimationIteration"),cr(Hm,"onAnimationStart"),cr("dblclick","onDoubleClick"),cr("focusin","onFocus"),cr("focusout","onBlur"),cr(Av,"onTransitionRun"),cr(Tv,"onTransitionStart"),cr(jv,"onTransitionCancel"),cr(qm,"onTransitionEnd"),ae("onMouseEnter",["mouseout","mouseover"]),ae("onMouseLeave",["mouseout","mouseover"]),ae("onPointerEnter",["pointerout","pointerover"]),ae("onPointerLeave",["pointerout","pointerover"]),ye("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ye("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ye("onBeforeInput",["compositionend","keypress","textInput","paste"]),ye("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ye("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ye("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(" "),hw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(tl));function oy(t,i){i=(i&4)!==0;for(var s=0;s<t.length;s++){var o=t[s],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 et(t,i){var s=i[Yi];s===void 0&&(s=i[Yi]=new Set);var o=t+"__bubble";s.has(o)||(uy(i,t,2,!1),s.add(o))}function Bf(t,i,s){var o=0;i&&(o|=4),uy(s,t,o,i)}var $o="_reactListening"+Math.random().toString(36).slice(2);function Pf(t){if(!t[$o]){t[$o]=!0,Q.forEach(function(s){s!=="selectionchange"&&(hw.has(s)||Bf(s,!1,t),Bf(s,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[$o]||(i[$o]=!0,Bf("selectionchange",!1,i))}}function uy(t,i,s,o){switch(By(i)){case 2:var h=Hw;break;case 8:h=qw;break;default:h=eh}s=h.bind(null,i,s,t),h=void 0,!ic||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(i,s,{capture:!0,passive:h}):t.addEventListener(i,s,!0):h!==void 0?t.addEventListener(i,s,{passive:h}):t.addEventListener(i,s,!1)}function Hf(t,i,s,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=_(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}mm(function(){var te=p,ce=nc(s),me=[];e:{var re=Im.get(t);if(re!==void 0){var le=eo,Re=t;switch(t){case"keypress":if(Zl(s)===0)break e;case"keydown":case"keyup":le=av;break;case"focusin":Re="focus",le=oc;break;case"focusout":Re="blur",le=oc;break;case"beforeblur":case"afterblur":le=oc;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=ym;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=V1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=ov;break;case Bm:case Pm:case Hm:le=K1;break;case qm:le=cv;break;case"scroll":case"scrollend":le=Y1;break;case"wheel":le=hv;break;case"copy":case"cut":case"paste":le=Z1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=xm;break;case"toggle":case"beforetoggle":le=mv}var qe=(i&4)!==0,St=!qe&&(t==="scroll"||t==="scrollend"),X=qe?re!==null?re+"Capture":null:re;qe=[];for(var G=te,ee;G!==null;){var fe=G;if(ee=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||ee===null||X===null||(fe=_s(G,X),fe!=null&&qe.push(nl(G,fe,ee))),St)break;G=G.return}0<qe.length&&(re=new le(re,Re,null,s,ce),me.push({event:re,listeners:qe}))}}if((i&7)===0){e:{if(re=t==="mouseover"||t==="pointerover",le=t==="mouseout"||t==="pointerout",re&&s!==tc&&(Re=s.relatedTarget||s.fromElement)&&(_(Re)||Re[jn]))break e;if((le||re)&&(re=ce.window===ce?ce:(re=ce.ownerDocument)?re.defaultView||re.parentWindow:window,le?(Re=s.relatedTarget||s.toElement,le=te,Re=Re?_(Re):null,Re!==null&&(St=u(Re),qe=Re.tag,Re!==St||qe!==5&&qe!==27&&qe!==6)&&(Re=null)):(le=null,Re=te),le!==Re)){if(qe=ym,fe="onMouseLeave",X="onMouseEnter",G="mouse",(t==="pointerout"||t==="pointerover")&&(qe=xm,fe="onPointerLeave",X="onPointerEnter",G="pointer"),St=le==null?re:T(le),ee=Re==null?re:T(Re),re=new qe(fe,G+"leave",le,s,ce),re.target=St,re.relatedTarget=ee,fe=null,_(ce)===te&&(qe=new qe(X,G+"enter",Re,s,ce),qe.target=ee,qe.relatedTarget=St,fe=qe),St=fe,le&&Re)t:{for(qe=dw,X=le,G=Re,ee=0,fe=X;fe;fe=qe(fe))ee++;fe=0;for(var Ue=G;Ue;Ue=qe(Ue))fe++;for(;0<ee-fe;)X=qe(X),ee--;for(;0<fe-ee;)G=qe(G),fe--;for(;ee--;){if(X===G||G!==null&&X===G.alternate){qe=X;break t}X=qe(X),G=qe(G)}qe=null}else qe=null;le!==null&&cy(me,re,le,qe,!1),Re!==null&&St!==null&&cy(me,St,Re,qe,!0)}}e:{if(re=te?T(te):window,le=re.nodeName&&re.nodeName.toLowerCase(),le==="select"||le==="input"&&re.type==="file")var ct=Am;else if(km(re))if(Tm)ct=Ev;else{ct=Sv;var De=wv}else le=re.nodeName,!le||le.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?te&&ec(te.elementType)&&(ct=Am):ct=_v;if(ct&&(ct=ct(t,te))){Cm(me,ct,s,ce);break e}De&&De(t,re,te),t==="focusout"&&te&&re.type==="number"&&te.memoizedProps.value!=null&&Wu(re,"number",re.value)}switch(De=te?T(te):window,t){case"focusin":(km(De)||De.contentEditable==="true")&&(Sa=De,mc=te,Os=null);break;case"focusout":Os=mc=Sa=null;break;case"mousedown":pc=!0;break;case"contextmenu":case"mouseup":case"dragend":pc=!1,zm(me,s,ce);break;case"selectionchange":if(Cv)break;case"keydown":case"keyup":zm(me,s,ce)}var Ve;if(cc)e:{switch(t){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else wa?_m(t,s)&&(rt="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(rt="onCompositionStart");rt&&(vm&&s.locale!=="ko"&&(wa||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&wa&&(Ve=pm()):(oi=ce,ac="value"in oi?oi.value:oi.textContent,wa=!0)),De=Yo(te,rt),0<De.length&&(rt=new bm(rt,t,null,s,ce),me.push({event:rt,listeners:De}),Ve?rt.data=Ve:(Ve=Em(s),Ve!==null&&(rt.data=Ve)))),(Ve=gv?yv(t,s):bv(t,s))&&(rt=Yo(te,"onBeforeInput"),0<rt.length&&(De=new bm("onBeforeInput","beforeinput",null,s,ce),me.push({event:De,listeners:rt}),De.data=Ve)),uw(me,t,te,s,ce)}oy(me,i)})}function nl(t,i,s){return{instance:t,listener:i,currentTarget:s}}function Yo(t,i){for(var s=i+"Capture",o=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=_s(t,s),h!=null&&o.unshift(nl(t,h,p)),h=_s(t,i),h!=null&&o.push(nl(t,h,p))),t.tag===3)return o;t=t.return}return[]}function dw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function cy(t,i,s,o,h){for(var p=i._reactName,x=[];s!==null&&s!==o;){var S=s,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=_s(s,p),te!=null&&x.unshift(nl(s,te,H))):h||(te=_s(s,p),te!=null&&x.push(nl(s,te,H)))),s=s.return}x.length!==0&&t.push({event:i,listeners:x})}var mw=/\r\n?/g,pw=/\u0000|\uFFFD/g;function fy(t){return(typeof t=="string"?t:""+t).replace(mw,`
49
+ `).replace(pw,"")}function hy(t,i){return i=fy(i),fy(t)===i}function wt(t,i,s,o,h,p){switch(s){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||ba(t,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&ba(t,""+o);break;case"className":ur(t,"class",o);break;case"tabIndex":ur(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":ur(t,s,o);break;case"style":hm(t,o,p);break;case"data":if(i!=="object"){ur(t,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||s!=="href")){t.removeAttribute(s);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(s);break}o=Kl(""+o),t.setAttribute(s,o);break;case"action":case"formAction":if(typeof o=="function"){t.setAttribute(s,"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"&&(s==="formAction"?(i!=="input"&&wt(t,i,"name",h.name,h,null),wt(t,i,"formEncType",h.formEncType,h,null),wt(t,i,"formMethod",h.formMethod,h,null),wt(t,i,"formTarget",h.formTarget,h,null)):(wt(t,i,"encType",h.encType,h,null),wt(t,i,"method",h.method,h,null),wt(t,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(s);break}o=Kl(""+o),t.setAttribute(s,o);break;case"onClick":o!=null&&(t.onclick=Dr);break;case"onScroll":o!=null&&et("scroll",t);break;case"onScrollEnd":o!=null&&et("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(s=o.__html,s!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=s}}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}s=Kl(""+o),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);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(s,""+o):t.removeAttribute(s);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(s,""):t.removeAttribute(s);break;case"capture":case"download":o===!0?t.setAttribute(s,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(s,o):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(s,o):t.removeAttribute(s);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(s):t.setAttribute(s,o);break;case"popover":et("beforetoggle",t),et("toggle",t),un(t,"popover",o);break;case"xlinkActuate":Mr(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Mr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Mr(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Mr(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Mr(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Mr(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Mr(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Mr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Mr(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":un(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=F1.get(s)||s,un(t,s,o))}}function qf(t,i,s,o,h,p){switch(s){case"style":hm(t,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(s=o.__html,s!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=s}}break;case"children":typeof o=="string"?ba(t,o):(typeof o=="number"||typeof o=="bigint")&&ba(t,""+o);break;case"onScroll":o!=null&&et("scroll",t);break;case"onScrollEnd":o!=null&&et("scrollend",t);break;case"onClick":o!=null&&(t.onclick=Dr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!de.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(h=s.endsWith("Capture"),i=s.slice(2,h?s.length-7:void 0),p=t[Bt]||null,p=p!=null?p[s]:null,typeof p=="function"&&t.removeEventListener(i,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(i,o,h);break e}s in t?t[s]=o:o===!0?t.setAttribute(s,""):un(t,s,o)}}}function on(t,i,s){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",t),et("load",t);var o=!1,h=!1,p;for(p in s)if(s.hasOwnProperty(p)){var x=s[p];if(x!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:wt(t,i,p,x,s,null)}}h&&wt(t,i,"srcSet",s.srcSet,s,null),o&&wt(t,i,"src",s.src,s,null);return;case"input":et("invalid",t);var S=p=x=h=null,H=null,te=null;for(o in s)if(s.hasOwnProperty(o)){var ce=s[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(a(137,i));break;default:wt(t,i,o,ce,s,null)}}om(t,p,S,H,te,x,h,!1);return;case"select":et("invalid",t),o=x=p=null;for(h in s)if(s.hasOwnProperty(h)&&(S=s[h],S!=null))switch(h){case"value":p=S;break;case"defaultValue":x=S;break;case"multiple":o=S;default:wt(t,i,h,S,s,null)}i=p,s=x,t.multiple=!!o,i!=null?ya(t,!!o,i,!1):s!=null&&ya(t,!!o,s,!0);return;case"textarea":et("invalid",t),p=h=o=null;for(x in s)if(s.hasOwnProperty(x)&&(S=s[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(a(91));break;default:wt(t,i,x,S,s,null)}cm(t,o,h,p);return;case"option":for(H in s)if(s.hasOwnProperty(H)&&(o=s[H],o!=null))switch(H){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:wt(t,i,H,o,s,null)}return;case"dialog":et("beforetoggle",t),et("toggle",t),et("cancel",t),et("close",t);break;case"iframe":case"object":et("load",t);break;case"video":case"audio":for(o=0;o<tl.length;o++)et(tl[o],t);break;case"image":et("error",t),et("load",t);break;case"details":et("toggle",t);break;case"embed":case"source":case"link":et("error",t),et("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 s)if(s.hasOwnProperty(te)&&(o=s[te],o!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:wt(t,i,te,o,s,null)}return;default:if(ec(i)){for(ce in s)s.hasOwnProperty(ce)&&(o=s[ce],o!==void 0&&qf(t,i,ce,o,s,void 0));return}}for(S in s)s.hasOwnProperty(S)&&(o=s[S],o!=null&&wt(t,i,S,o,s,null))}function gw(t,i,s,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(le in s){var me=s[le];if(s.hasOwnProperty(le)&&me!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":H=me;default:o.hasOwnProperty(le)||wt(t,i,le,null,o,me)}}for(var re in o){var le=o[re];if(me=s[re],o.hasOwnProperty(re)&&(le!=null||me!=null))switch(re){case"type":p=le;break;case"name":h=le;break;case"checked":te=le;break;case"defaultChecked":ce=le;break;case"value":x=le;break;case"defaultValue":S=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(a(137,i));break;default:le!==me&&wt(t,i,re,le,o,me)}}Zu(t,x,S,H,te,ce,p,h);return;case"select":le=x=S=re=null;for(p in s)if(H=s[p],s.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":le=H;default:o.hasOwnProperty(p)||wt(t,i,p,null,o,H)}for(h in o)if(p=o[h],H=s[h],o.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":re=p;break;case"defaultValue":S=p;break;case"multiple":x=p;default:p!==H&&wt(t,i,h,p,o,H)}i=S,s=x,o=le,re!=null?ya(t,!!s,re,!1):!!o!=!!s&&(i!=null?ya(t,!!s,i,!0):ya(t,!!s,s?[]:"",!1));return;case"textarea":le=re=null;for(S in s)if(h=s[S],s.hasOwnProperty(S)&&h!=null&&!o.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:wt(t,i,S,null,o,h)}for(x in o)if(h=o[x],p=s[x],o.hasOwnProperty(x)&&(h!=null||p!=null))switch(x){case"value":re=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(a(91));break;default:h!==p&&wt(t,i,x,h,o,p)}um(t,re,le);return;case"option":for(var Re in s)if(re=s[Re],s.hasOwnProperty(Re)&&re!=null&&!o.hasOwnProperty(Re))switch(Re){case"selected":t.selected=!1;break;default:wt(t,i,Re,null,o,re)}for(H in o)if(re=o[H],le=s[H],o.hasOwnProperty(H)&&re!==le&&(re!=null||le!=null))switch(H){case"selected":t.selected=re&&typeof re!="function"&&typeof re!="symbol";break;default:wt(t,i,H,re,o,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var qe in s)re=s[qe],s.hasOwnProperty(qe)&&re!=null&&!o.hasOwnProperty(qe)&&wt(t,i,qe,null,o,re);for(te in o)if(re=o[te],le=s[te],o.hasOwnProperty(te)&&re!==le&&(re!=null||le!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(a(137,i));break;default:wt(t,i,te,re,o,le)}return;default:if(ec(i)){for(var St in s)re=s[St],s.hasOwnProperty(St)&&re!==void 0&&!o.hasOwnProperty(St)&&qf(t,i,St,void 0,o,re);for(ce in o)re=o[ce],le=s[ce],!o.hasOwnProperty(ce)||re===le||re===void 0&&le===void 0||qf(t,i,ce,re,o,le);return}}for(var X in s)re=s[X],s.hasOwnProperty(X)&&re!=null&&!o.hasOwnProperty(X)&&wt(t,i,X,null,o,re);for(me in o)re=o[me],le=s[me],!o.hasOwnProperty(me)||re===le||re==null&&le==null||wt(t,i,me,re,o,le)}function dy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function yw(){if(typeof performance.getEntriesByType=="function"){for(var t=0,i=0,s=performance.getEntriesByType("resource"),o=0;o<s.length;o++){var h=s[o],p=h.transferSize,x=h.initiatorType,S=h.duration;if(p&&S&&dy(x)){for(x=0,S=h.responseEnd,o+=1;o<s.length;o++){var H=s[o],te=H.startTime;if(te>S)break;var ce=H.transferSize,me=H.initiatorType;ce&&dy(me)&&(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 If=null,Ff=null;function Go(t){return t.nodeType===9?t:t.ownerDocument}function my(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 py(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 $f(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 Yf=null;function bw(){var t=window.event;return t&&t.type==="popstate"?t===Yf?!1:(Yf=t,!0):(Yf=null,!1)}var gy=typeof setTimeout=="function"?setTimeout:void 0,xw=typeof clearTimeout=="function"?clearTimeout:void 0,yy=typeof Promise=="function"?Promise:void 0,vw=typeof queueMicrotask=="function"?queueMicrotask:typeof yy<"u"?function(t){return yy.resolve(null).then(t).catch(ww)}:gy;function ww(t){setTimeout(function(){throw t})}function ki(t){return t==="head"}function by(t,i){var s=i,o=0;do{var h=s.nextSibling;if(t.removeChild(s),h&&h.nodeType===8)if(s=h.data,s==="/$"||s==="/&"){if(o===0){t.removeChild(h),Xa(i);return}o--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")o++;else if(s==="html")rl(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,rl(s);for(var p=s.firstChild;p;){var x=p.nextSibling,S=p.nodeName;p[Qt]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&p.rel.toLowerCase()==="stylesheet"||s.removeChild(p),p=x}}else s==="body"&&rl(t.ownerDocument.body);s=h}while(s);Xa(i)}function xy(t,i){var s=t;t=0;do{var o=s.nextSibling;if(s.nodeType===1?i?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(i?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),o&&o.nodeType===8)if(s=o.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=o}while(s)}function Gf(t){var i=t.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var s=i;switch(i=i.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Gf(s),ga(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function Sw(t,i,s,o){for(;t.nodeType===1;){var h=s;if(t.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[Qt])switch(i){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(p=t.getAttribute("rel"),p==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(p!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(p=t.getAttribute("src"),(p!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(i==="input"&&t.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===p)return t}else return t;if(t=Wn(t.nextSibling),t===null)break}return null}function _w(t,i,s){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=Wn(t.nextSibling),t===null))return null;return t}function vy(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Wn(t.nextSibling),t===null))return null;return t}function Vf(t){return t.data==="$?"||t.data==="$~"}function Jf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Ew(t,i){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=i;else if(t.data!=="$?"||s.readyState!=="loading")i();else{var o=function(){i(),s.removeEventListener("DOMContentLoaded",o)};s.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function Wn(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 Xf=null;function wy(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(i===0)return Wn(t.nextSibling);i--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||i++}t=t.nextSibling}return null}function Sy(t){t=t.previousSibling;for(var i=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(i===0)return t;i--}else s!=="/$"&&s!=="/&"||i++}t=t.previousSibling}return null}function _y(t,i,s){switch(i=Go(s),t){case"html":if(t=i.documentElement,!t)throw Error(a(452));return t;case"head":if(t=i.head,!t)throw Error(a(453));return t;case"body":if(t=i.body,!t)throw Error(a(454));return t;default:throw Error(a(451))}}function rl(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);ga(t)}var er=new Map,Ey=new Set;function Vo(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Kr=ie.d;ie.d={f:kw,r:Cw,D:Aw,C:Tw,L:jw,m:Nw,X:Rw,S:Ow,M:Mw};function kw(){var t=Kr.f(),i=Bo();return t||i}function Cw(t){var i=j(t);i!==null&&i.tag===5&&i.type==="form"?qp(i):Kr.r(t)}var Ga=typeof document>"u"?null:document;function ky(t,i,s){var o=Ga;if(o&&typeof i=="string"&&i){var h=Gn(i);h='link[rel="'+t+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),Ey.has(h)||(Ey.add(h),t={rel:t,crossOrigin:s,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),on(i,"link",t),I(i),o.head.appendChild(i)))}}function Aw(t){Kr.D(t),ky("dns-prefetch",t,null)}function Tw(t,i){Kr.C(t,i),ky("preconnect",t,i)}function jw(t,i,s){Kr.L(t,i,s);var o=Ga;if(o&&t&&i){var h='link[rel="preload"][as="'+Gn(i)+'"]';i==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+Gn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+Gn(s.imageSizes)+'"]')):h+='[href="'+Gn(t)+'"]';var p=h;switch(i){case"style":p=Va(t);break;case"script":p=Ja(t)}er.has(p)||(t=g({rel:"preload",href:i==="image"&&s&&s.imageSrcSet?void 0:t,as:i},s),er.set(p,t),o.querySelector(h)!==null||i==="style"&&o.querySelector(il(p))||i==="script"&&o.querySelector(al(p))||(i=o.createElement("link"),on(i,"link",t),I(i),o.head.appendChild(i)))}}function Nw(t,i){Kr.m(t,i);var s=Ga;if(s&&t){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Gn(o)+'"][href="'+Gn(t)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Ja(t)}if(!er.has(p)&&(t=g({rel:"modulepreload",href:t},i),er.set(p,t),s.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(al(p)))return}o=s.createElement("link"),on(o,"link",t),I(o),s.head.appendChild(o)}}}function Ow(t,i,s){Kr.S(t,i,s);var o=Ga;if(o&&t){var h=L(o).hoistableStyles,p=Va(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},s),(s=er.get(p))&&Kf(t,s);var H=x=o.createElement("link");I(H),on(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 Rw(t,i){Kr.X(t,i);var s=Ga;if(s&&t){var o=L(s).hoistableScripts,h=Ja(t),p=o.get(h);p||(p=s.querySelector(al(h)),p||(t=g({src:t,async:!0},i),(i=er.get(h))&&Qf(t,i),p=s.createElement("script"),I(p),on(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Mw(t,i){Kr.M(t,i);var s=Ga;if(s&&t){var o=L(s).hoistableScripts,h=Ja(t),p=o.get(h);p||(p=s.querySelector(al(h)),p||(t=g({src:t,async:!0,type:"module"},i),(i=er.get(h))&&Qf(t,i),p=s.createElement("script"),I(p),on(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Cy(t,i,s,o){var h=(h=Te.current)?Vo(h):null;if(!h)throw Error(a(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(i=Va(s.href),s=L(h).hoistableStyles,o=s.get(i),o||(o={type:"style",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=Va(s.href);var p=L(h).hoistableStyles,x=p.get(t);if(x||(h=h.ownerDocument||h,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,x),(p=h.querySelector(il(t)))&&!p._p&&(x.instance=p,x.state.loading=5),er.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},er.set(t,s),p||Dw(h,t,s,x.state))),i&&o===null)throw Error(a(528,""));return x}if(i&&o!==null)throw Error(a(529,""));return null;case"script":return i=s.async,s=s.src,typeof s=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Ja(s),s=L(h).hoistableScripts,o=s.get(i),o||(o={type:"script",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,t))}}function Va(t){return'href="'+Gn(t)+'"'}function il(t){return'link[rel="stylesheet"]['+t+"]"}function Ay(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function Dw(t,i,s,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}),on(i,"link",s),I(i),t.head.appendChild(i))}function Ja(t){return'[src="'+Gn(t)+'"]'}function al(t){return"script[async]"+t}function Ty(t,i,s){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+Gn(s.href)+'"]');if(o)return i.instance=o,I(o),o;var h=g({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),I(o),on(o,"style",h),Jo(o,s.precedence,t),i.instance=o;case"stylesheet":h=Va(s.href);var p=t.querySelector(il(h));if(p)return i.state.loading|=4,i.instance=p,I(p),p;o=Ay(s),(h=er.get(h))&&Kf(o,h),p=(t.ownerDocument||t).createElement("link"),I(p);var x=p;return x._p=new Promise(function(S,H){x.onload=S,x.onerror=H}),on(p,"link",o),i.state.loading|=4,Jo(p,s.precedence,t),i.instance=p;case"script":return p=Ja(s.src),(h=t.querySelector(al(p)))?(i.instance=h,I(h),h):(o=s,(h=er.get(p))&&(o=g({},s),Qf(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),I(h),on(h,"link",o),t.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Jo(o,s.precedence,t));return i.instance}function Jo(t,i,s){for(var o=s.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=s.nodeType===9?s.head:s,i.insertBefore(t,i.firstChild))}function Kf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function Qf(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 jy(t,i,s){if(Xo===null){var o=new Map,h=Xo=new Map;h.set(s,o)}else h=Xo,o=h.get(s),o||(o=new Map,h.set(s,o));if(o.has(t))return o;for(o.set(t,null),s=s.getElementsByTagName(t),h=0;h<s.length;h++){var p=s[h];if(!(p[Qt]||p[kt]||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 Ny(t,i,s){t=t.ownerDocument||t,t.head.insertBefore(s,i==="title"?t.querySelector("head > title"):null)}function Lw(t,i,s){if(s===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 Oy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function zw(t,i,s,o){if(s.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var h=Va(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)),s.state.loading|=4,s.instance=p,I(p);return}p=i.ownerDocument||i,o=Ay(o),(h=er.get(h))&&Kf(o,h),p=p.createElement("link"),I(p);var x=p;x._p=new Promise(function(S,H){x.onload=S,x.onerror=H}),on(p,"link",o),s.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=Ko.bind(t),i.addEventListener("load",s),i.addEventListener("error",s))}}var Zf=0;function Uw(t,i){return t.stylesheets&&t.count===0&&Zo(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){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&&Zf===0&&(Zf=62500*yw());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>Zf?50:800)+i);return t.unsuspend=s,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(Bw,t),Qo=null,Ko.call(t))}function Bw(t,i){if(!(i.state.loading&4)){var s=Qo.get(t);if(s)var o=s.get(null);else{s=new Map,Qo.set(t,s);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")&&(s.set(x.dataset.precedence,x),o=x)}o&&s.set(null,o)}h=i.instance,x=h.getAttribute("data-precedence"),p=s.get(x)||o,p===o&&s.set(null,h),s.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 sl={$$typeof:q,Provider:null,Consumer:null,_currentValue:pe,_currentValue2:pe,_threadCount:0};function Pw(t,i,s,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=ii(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ii(0),this.hiddenUpdates=ii(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 Ry(t,i,s,o,h,p,x,S,H,te,ce,me){return t=new Pw(t,i,s,x,H,te,ce,me,S),i=1,p===!0&&(i|=24),p=On(3,null,null,i),t.current=p,p.stateNode=t,i=Nc(),i.refCount++,t.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:s,cache:i},Dc(p),t}function My(t){return t?(t=ka,t):ka}function Dy(t,i,s,o,h,p){h=My(h),o.context===null?o.context=h:o.pendingContext=h,o=mi(i),o.payload={element:s},p=p===void 0?null:p,p!==null&&(o.callback=p),s=pi(t,o,i),s!==null&&(kn(s,t,i),Bs(s,t,i))}function Ly(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<i?s:i}}function Wf(t,i){Ly(t,i),(t=t.alternate)&&Ly(t,i)}function zy(t){if(t.tag===13||t.tag===31){var i=Xi(t,67108864);i!==null&&kn(i,t,67108864),Wf(t,67108864)}}function Uy(t){if(t.tag===13||t.tag===31){var i=zn();i=Rr(i);var s=Xi(t,i);s!==null&&kn(s,t,i),Wf(t,i)}}var Wo=!0;function Hw(t,i,s,o){var h=V.T;V.T=null;var p=ie.p;try{ie.p=2,eh(t,i,s,o)}finally{ie.p=p,V.T=h}}function qw(t,i,s,o){var h=V.T;V.T=null;var p=ie.p;try{ie.p=8,eh(t,i,s,o)}finally{ie.p=p,V.T=h}}function eh(t,i,s,o){if(Wo){var h=th(o);if(h===null)Hf(t,i,o,eu,s),Py(t,o);else if(Fw(h,t,i,s,o))o.stopPropagation();else if(Py(t,o),i&4&&-1<Iw.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=lr(p.pendingLanes);if(x!==0){var S=p;for(S.pendingLanes|=2,S.entangledLanes|=2;x;){var H=1<<31-be(x);S.entanglements[1]|=H,x&=~H}Sr(p),(ht&6)===0&&(zo=xt()+500,el(0))}}break;case 31:case 13:S=Xi(p,2),S!==null&&kn(S,p,2),Bo(),Wf(p,2)}if(p=th(o),p===null&&Hf(t,i,o,eu,s),p===h)break;h=p}h!==null&&o.stopPropagation()}else Hf(t,i,o,null,s)}}function th(t){return t=nc(t),nh(t)}var eu=null;function nh(t){if(eu=null,t=_(t),t!==null){var i=u(t);if(i===null)t=null;else{var s=i.tag;if(s===13){if(t=c(i),t!==null)return t;t=null}else if(s===31){if(t=f(i),t!==null)return t;t=null}else if(s===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 By(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(ni()){case ue:return 2;case we:return 8;case Be:case Ge:return 32;case st:return 268435456;default:return 32}default:return 32}}var rh=!1,Ci=null,Ai=null,Ti=null,ll=new Map,ol=new Map,ji=[],Iw="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 Py(t,i){switch(t){case"focusin":case"focusout":Ci=null;break;case"dragenter":case"dragleave":Ai=null;break;case"mouseover":case"mouseout":Ti=null;break;case"pointerover":case"pointerout":ll.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":ol.delete(i.pointerId)}}function ul(t,i,s,o,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:i,domEventName:s,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=j(i),i!==null&&zy(i)),t):(t.eventSystemFlags|=o,i=t.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),t)}function Fw(t,i,s,o,h){switch(i){case"focusin":return Ci=ul(Ci,t,i,s,o,h),!0;case"dragenter":return Ai=ul(Ai,t,i,s,o,h),!0;case"mouseover":return Ti=ul(Ti,t,i,s,o,h),!0;case"pointerover":var p=h.pointerId;return ll.set(p,ul(ll.get(p)||null,t,i,s,o,h)),!0;case"gotpointercapture":return p=h.pointerId,ol.set(p,ul(ol.get(p)||null,t,i,s,o,h)),!0}return!1}function Hy(t){var i=_(t.target);if(i!==null){var s=u(i);if(s!==null){if(i=s.tag,i===13){if(i=c(s),i!==null){t.blockedOn=i,Gl(t.priority,function(){Uy(s)});return}}else if(i===31){if(i=f(s),i!==null){t.blockedOn=i,Gl(t.priority,function(){Uy(s)});return}}else if(i===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.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 s=th(t.nativeEvent);if(s===null){s=t.nativeEvent;var o=new s.constructor(s.type,s);tc=o,s.target.dispatchEvent(o),tc=null}else return i=j(s),i!==null&&zy(i),t.blockedOn=s,!1;i.shift()}return!0}function qy(t,i,s){tu(t)&&s.delete(i)}function $w(){rh=!1,Ci!==null&&tu(Ci)&&(Ci=null),Ai!==null&&tu(Ai)&&(Ai=null),Ti!==null&&tu(Ti)&&(Ti=null),ll.forEach(qy),ol.forEach(qy)}function nu(t,i){t.blockedOn===i&&(t.blockedOn=null,rh||(rh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,$w)))}var ru=null;function Iy(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 s=t[i],o=t[i+1],h=t[i+2];if(typeof o!="function"){if(nh(o||s)===null)continue;break}var p=j(s);p!==null&&(t.splice(i,3),i-=3,ef(p,{pending:!0,data:h,method:s.method,action:o},o,h))}}))}function Xa(t){function i(H){return nu(H,t)}Ci!==null&&nu(Ci,t),Ai!==null&&nu(Ai,t),Ti!==null&&nu(Ti,t),ll.forEach(i),ol.forEach(i);for(var s=0;s<ji.length;s++){var o=ji[s];o.blockedOn===t&&(o.blockedOn=null)}for(;0<ji.length&&(s=ji[0],s.blockedOn===null);)Hy(s),s.blockedOn===null&&ji.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(o=0;o<s.length;o+=3){var h=s[o],p=s[o+1],x=h[Bt]||null;if(typeof p=="function")x||Iy(s);else if(x){var S=null;if(p&&p.hasAttribute("formAction")){if(h=p,x=p[Bt]||null)S=x.formAction;else if(nh(h)!==null)continue}else S=x.action;typeof S=="function"?s[o+1]=S:(s.splice(o,3),o-=3),Iy(s)}}}function Fy(){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(s,20)}function s(){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(s,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function ih(t){this._internalRoot=t}iu.prototype.render=ih.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(a(409));var s=i.current,o=zn();Dy(s,o,t,i,null,null)},iu.prototype.unmount=ih.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;Dy(t.current,2,null,t,null,null),Bo(),i[jn]=null}};function iu(t){this._internalRoot=t}iu.prototype.unstable_scheduleHydration=function(t){if(t){var i=ws();t={blockedOn:null,target:t,priority:i};for(var s=0;s<ji.length&&i!==0&&i<ji[s].priority;s++);ji.splice(s,0,t),s===0&&Hy(t)}};var $y=n.version;if($y!=="19.2.4")throw Error(a(527,$y,"19.2.4"));ie.findDOMNode=function(t){var i=t._reactInternals;if(i===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=d(i),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var Yw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var au=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!au.isDisabled&&au.supportsFiber)try{Yt=au.inject(Yw),dt=au}catch{}}return fl.createRoot=function(t,i){if(!l(t))throw Error(a(299));var s=!1,o="",h=Qp,p=Zp,x=Wp;return i!=null&&(i.unstable_strictMode===!0&&(s=!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=Ry(t,1,!1,null,null,s,o,null,h,p,x,Fy),t[jn]=i.current,Pf(t),new ih(i)},fl.hydrateRoot=function(t,i,s){if(!l(t))throw Error(a(299));var o=!1,h="",p=Qp,x=Zp,S=Wp,H=null;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(h=s.identifierPrefix),s.onUncaughtError!==void 0&&(p=s.onUncaughtError),s.onCaughtError!==void 0&&(x=s.onCaughtError),s.onRecoverableError!==void 0&&(S=s.onRecoverableError),s.formState!==void 0&&(H=s.formState)),i=Ry(t,1,!0,i,s??null,o,h,H,p,x,S,Fy),i.context=My(null),s=i.current,o=zn(),o=Rr(o),h=mi(o),h.callback=null,pi(s,h,o),s=o,i.current.lanes=s,or(i,s),Sr(i),t[jn]=i.current,Pf(t),new iu(i)},fl.version="19.2.4",fl}var e0;function nS(){if(e0)return lh.exports;e0=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(),lh.exports=tS(),lh.exports}var rS=nS();/**
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 t0="popstate";function n0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function iS(e={}){function n(a,l){var d;let u=(d=l.state)==null?void 0:d.masked,{pathname:c,search:f,hash:m}=u||a.location;return Kh("",{pathname:c,search:f,hash:m},l.state&&l.state.usr||null,l.state&&l.state.key||"default",u?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,l){return typeof l=="string"?l:Nl(l)}return sS(n,r,null,e)}function zt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Ar(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function aS(){return Math.random().toString(36).substring(2,10)}function r0(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 Kh(e,n,r=null,a,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?ps(n):n,state:r,key:n&&n.key||a||aS(),unstable_mask:l}}function Nl({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 ps(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(n.search=e.substring(a),e=e.substring(0,a)),e&&(n.pathname=e)}return n}function sS(e,n,r,a={}){let{window:l=document.defaultView,v5Compat:u=!1}=a,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(),O=U==null?null:U-d;d=U,m&&m({action:f,location:M.location,delta:O})}function b(U,O){f="PUSH";let P=n0(U)?U:Kh(M.location,U,O);d=y()+1;let q=r0(P,d),oe=M.createHref(P.unstable_mask||P);try{c.pushState(q,"",oe)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;l.location.assign(oe)}u&&m&&m({action:f,location:M.location,delta:1})}function w(U,O){f="REPLACE";let P=n0(U)?U:Kh(M.location,U,O);d=y();let q=r0(P,d),oe=M.createHref(P.unstable_mask||P);c.replaceState(q,"",oe),u&&m&&m({action:f,location:M.location,delta:0})}function k(U){return lS(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(t0,g),m=U,()=>{l.removeEventListener(t0,g),m=null}},createHref(U){return n(l,U)},createURL:k,encodeLocation(U){let O=k(U);return{pathname:O.pathname,search:O.search,hash:O.hash}},push:b,replace:w,go(U){return c.go(U)}};return M}function lS(e,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),zt(r,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:Nl(e);return a=a.replace(/ $/,"%20"),!n&&a.startsWith("//")&&(a=r+a),new URL(a,r)}function Pb(e,n,r="/"){return oS(e,n,r,!1)}function oS(e,n,r,a){let l=typeof n=="string"?ps(n):n,u=Wr(l.pathname||"/",r);if(u==null)return null;let c=Hb(e);uS(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let d=vS(u);f=bS(c[m],d,a)}return f}function Hb(e,n=[],r=[],a="",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(a)&&m)return;zt(y.relativePath.startsWith(a),`Absolute route path "${y.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(a.length)}let g=Cr([a,y.relativePath]),b=r.concat(y);c.children&&c.children.length>0&&(zt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Hb(c.children,n,b,g,m)),!(c.path==null&&!c.index)&&n.push({path:g,score:gS(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 qb(c.path))u(c,f,!0,d)}),n}function qb(e){let n=e.split("/");if(n.length===0)return[];let[r,...a]=n,l=r.endsWith("?"),u=r.replace(/\?$/,"");if(a.length===0)return l?[u,""]:[u];let c=qb(a.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 uS(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:yS(n.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var cS=/^:[\w-]+$/,fS=3,hS=2,dS=1,mS=10,pS=-2,i0=e=>e==="*";function gS(e,n){let r=e.split("/"),a=r.length;return r.some(i0)&&(a+=pS),n&&(a+=hS),r.filter(l=>!i0(l)).reduce((l,u)=>l+(cS.test(u)?fS:u===""?dS:mS),a)}function yS(e,n){return e.length===n.length&&e.slice(0,-1).every((a,l)=>a===n[l])?e[e.length-1]-n[n.length-1]:0}function bS(e,n,r=!1){let{routesMeta:a}=e,l={},u="/",c=[];for(let f=0;f<a.length;++f){let m=a[f],d=f===a.length-1,y=u==="/"?n:n.slice(u.length)||"/",g=wu({path:m.relativePath,caseSensitive:m.caseSensitive,end:d},y),b=m.route;if(!g&&d&&r&&!a[a.length-1].route.index&&(g=wu({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:Cr([u,g.pathname]),pathnameBase:ES(Cr([u,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(u=Cr([u,g.pathnameBase]))}return c}function wu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=xS(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:a.reduce((d,{paramName:y,isOptional:g},b)=>{if(y==="*"){let k=f[b]||"";c=u.slice(0,u.length-k.length).replace(/(.)\/+$/,"$1")}const w=f[b];return g&&!w?d[y]=void 0:d[y]=(w||"").replace(/%2F/g,"/"),d},{}),pathname:u,pathnameBase:c,pattern:e}}function xS(e,n=!1,r=!0){Ar(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 a=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,d,y)=>{if(a.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("*")?(a.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,n?void 0:"i"),a]}function vS(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Ar(!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 Wr(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}var wS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function SS(e,n="/"){let{pathname:r,search:a="",hash:l=""}=typeof e=="string"?ps(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=a0(r.substring(1),"/"):u=a0(r,n)):u=n,{pathname:u,search:kS(a),hash:CS(l)}}function a0(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 fh(e,n,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(a)}]. 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 _S(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Ib(e){let n=_S(e);return n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase)}function Cd(e,n,r,a=!1){let l;typeof e=="string"?l=ps(e):(l={...e},zt(!l.pathname||!l.pathname.includes("?"),fh("?","pathname","search",l)),zt(!l.pathname||!l.pathname.includes("#"),fh("#","pathname","hash",l)),zt(!l.search||!l.search.includes("#"),fh("#","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(!a&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),g-=1;l.pathname=b.join("/")}f=g>=0?n[g]:"/"}let m=SS(l,f),d=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(d||y)&&(m.pathname+="/"),m}var Cr=e=>e.join("/").replace(/\/\/+/g,"/"),ES=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),kS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,CS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,AS=class{constructor(e,n,r,a=!1){this.status=e,this.statusText=n||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function TS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function jS(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Fb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $b(e,n){let r=e;if(typeof r!="string"||!wS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,l=!1;if(Fb)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=Wr(c.pathname,n);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{Ar(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:l,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Yb=["POST","PUT","PATCH","DELETE"];new Set(Yb);var NS=["GET",...Yb];new Set(NS);var gs=R.createContext(null);gs.displayName="DataRouter";var Bu=R.createContext(null);Bu.displayName="DataRouterState";var OS=R.createContext(!1),Gb=R.createContext({isTransitioning:!1});Gb.displayName="ViewTransition";var RS=R.createContext(new Map);RS.displayName="Fetchers";var MS=R.createContext(null);MS.displayName="Await";var ir=R.createContext(null);ir.displayName="Navigation";var Ul=R.createContext(null);Ul.displayName="Location";var Tr=R.createContext({outlet:null,matches:[],isDataRoute:!1});Tr.displayName="Route";var Ad=R.createContext(null);Ad.displayName="RouteError";var Vb="REACT_ROUTER_ERROR",DS="REDIRECT",LS="ROUTE_ERROR_RESPONSE";function zS(e){if(e.startsWith(`${Vb}:${DS}:{`))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 US(e){if(e.startsWith(`${Vb}:${LS}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new AS(n.status,n.statusText,n.data)}catch{}}function BS(e,{relative:n}={}){zt(Bl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=R.useContext(ir),{hash:l,pathname:u,search:c}=Pl(e,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:Cr([r,u])),a.createHref({pathname:f,search:c,hash:l})}function Bl(){return R.useContext(Ul)!=null}function jr(){return zt(Bl(),"useLocation() may be used only in the context of a <Router> component."),R.useContext(Ul).location}var Jb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Xb(e){R.useContext(ir).static||R.useLayoutEffect(e)}function da(){let{isDataRoute:e}=R.useContext(Tr);return e?ZS():PS()}function PS(){zt(Bl(),"useNavigate() may be used only in the context of a <Router> component.");let e=R.useContext(gs),{basename:n,navigator:r}=R.useContext(ir),{matches:a}=R.useContext(Tr),{pathname:l}=jr(),u=JSON.stringify(Ib(a)),c=R.useRef(!1);return Xb(()=>{c.current=!0}),R.useCallback((m,d={})=>{if(Ar(c.current,Jb),!c.current)return;if(typeof m=="number"){r.go(m);return}let y=Cd(m,JSON.parse(u),l,d.relative==="path");e==null&&n!=="/"&&(y.pathname=y.pathname==="/"?n:Cr([n,y.pathname])),(d.replace?r.replace:r.push)(y,d.state,d)},[n,r,u,l,e])}R.createContext(null);function HS(){let{matches:e}=R.useContext(Tr),n=e[e.length-1];return n?n.params:{}}function Pl(e,{relative:n}={}){let{matches:r}=R.useContext(Tr),{pathname:a}=jr(),l=JSON.stringify(Ib(r));return R.useMemo(()=>Cd(e,JSON.parse(l),a,n==="path"),[e,l,a,n])}function qS(e,n){return Kb(e,n)}function Kb(e,n,r){var U;zt(Bl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=R.useContext(ir),{matches:l}=R.useContext(Tr),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",d=u&&u.route;{let O=d&&d.path||"";Zb(f,!d||O.endsWith("*")||O.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${O}">) 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="${O}"> to <Route path="${O==="/"?"*":`${O}/*`}">.`)}let y=jr(),g;if(n){let O=typeof n=="string"?ps(n):n;zt(m==="/"||((U=O.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 "${O.pathname}" was given in the \`location\` prop.`),g=O}else g=y;let b=g.pathname||"/",w=b;if(m!=="/"){let O=m.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(O.length).join("/")}let k=Pb(e,{pathname:w});Ar(d||k!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Ar(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=GS(k&&k.map(O=>Object.assign({},O,{params:Object.assign({},c,O.params),pathname:Cr([m,a.encodeLocation?a.encodeLocation(O.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathname]),pathnameBase:O.pathnameBase==="/"?m:Cr([m,a.encodeLocation?a.encodeLocation(O.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathnameBase])})),l,r);return n&&M?R.createElement(Ul.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},M):M}function IS(){let e=QS(),n=TS(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:a},u={padding:"2px 4px",backgroundColor:a},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=R.createElement(R.Fragment,null,R.createElement("p",null,"💿 Hey developer 👋"),R.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",R.createElement("code",{style:u},"ErrorBoundary")," or"," ",R.createElement("code",{style:u},"errorElement")," prop on your route.")),R.createElement(R.Fragment,null,R.createElement("h2",null,"Unexpected Application Error!"),R.createElement("h3",{style:{fontStyle:"italic"}},n),r?R.createElement("pre",{style:l},r):null,c)}var FS=R.createElement(IS,null),Qb=class extends R.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=US(e.digest);r&&(e=r)}let n=e!==void 0?R.createElement(Tr.Provider,{value:this.props.routeContext},R.createElement(Ad.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?R.createElement($S,{error:e},n):n}};Qb.contextType=OS;var hh=new WeakMap;function $S({children:e,error:n}){let{basename:r}=R.useContext(ir);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let a=zS(n.digest);if(a){let l=hh.get(n);if(l)throw l;let u=$b(a.location,r);if(Fb&&!hh.get(n))if(u.isExternal||a.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:a.replace}));throw hh.set(n,c),c}return R.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function YS({routeContext:e,match:n,children:r}){let a=R.useContext(gs);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),R.createElement(Tr.Provider,{value:e},r)}function GS(e,n=[],r){let a=r==null?void 0:r.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(n.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let l=e,u=a==null?void 0:a.errors;if(u!=null){let y=l.findIndex(g=>g.route.id&&(u==null?void 0:u[g.route.id])!==void 0);zt(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&&a){c=a.renderFallback;for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=y),g.route.id){let{loaderData:b,errors:w}=a,k=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||k){r.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let m=r==null?void 0:r.onError,d=a&&m?(y,g)=>{var b,w;m(y,{location:a.location,params:((w=(b=a.matches)==null?void 0:b[0])==null?void 0:w.params)??{},unstable_pattern:jS(a.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,b)=>{let w,k=!1,M=null,U=null;a&&(w=u&&g.route.id?u[g.route.id]:void 0,M=g.route.errorElement||FS,c&&(f<0&&b===0?(Zb("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 O=n.concat(l.slice(0,b+1)),P=()=>{let q;return w?q=M:k?q=U:g.route.Component?q=R.createElement(g.route.Component,null):g.route.element?q=g.route.element:q=y,R.createElement(YS,{match:g,routeContext:{outlet:y,matches:O,isDataRoute:a!=null},children:q})};return a&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?R.createElement(Qb,{location:a.location,revalidation:a.revalidation,component:M,error:w,children:P(),routeContext:{outlet:null,matches:O,isDataRoute:!0},onError:d}):P()},null)}function Td(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function VS(e){let n=R.useContext(gs);return zt(n,Td(e)),n}function JS(e){let n=R.useContext(Bu);return zt(n,Td(e)),n}function XS(e){let n=R.useContext(Tr);return zt(n,Td(e)),n}function jd(e){let n=XS(e),r=n.matches[n.matches.length-1];return zt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function KS(){return jd("useRouteId")}function QS(){var a;let e=R.useContext(Ad),n=JS("useRouteError"),r=jd("useRouteError");return e!==void 0?e:(a=n.errors)==null?void 0:a[r]}function ZS(){let{router:e}=VS("useNavigate"),n=jd("useNavigate"),r=R.useRef(!1);return Xb(()=>{r.current=!0}),R.useCallback(async(l,u={})=>{Ar(r.current,Jb),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...u}))},[e,n])}var s0={};function Zb(e,n,r){!n&&!s0[e]&&(s0[e]=!0,Ar(!1,r))}R.memo(WS);function WS({routes:e,future:n,state:r,isStatic:a,onError:l}){return Kb(e,void 0,{state:r,isStatic:a,onError:l})}function ua(e){zt(!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 e_({basename:e="/",children:n=null,location:r,navigationType:a="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){zt(!Bl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=R.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=ps(r));let{pathname:d="/",search:y="",hash:g="",state:b=null,key:w="default",unstable_mask:k}=r,M=R.useMemo(()=>{let U=Wr(d,f);return U==null?null:{location:{pathname:U,search:y,hash:g,state:b,key:w,unstable_mask:k},navigationType:a}},[f,d,y,g,b,w,a,k]);return Ar(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:R.createElement(ir.Provider,{value:m},R.createElement(Ul.Provider,{children:n,value:M}))}function t_({children:e,location:n}){return qS(Qh(e),n)}function Qh(e,n=[]){let r=[];return R.Children.forEach(e,(a,l)=>{if(!R.isValidElement(a))return;let u=[...n,l];if(a.type===R.Fragment){r.push.apply(r,Qh(a.props.children,u));return}zt(a.type===ua,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),zt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let c={id:a.props.id||u.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(c.children=Qh(a.props.children,u)),r.push(c)}),r}var gu="get",yu="application/x-www-form-urlencoded";function Pu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function n_(e){return Pu(e)&&e.tagName.toLowerCase()==="button"}function r_(e){return Pu(e)&&e.tagName.toLowerCase()==="form"}function i_(e){return Pu(e)&&e.tagName.toLowerCase()==="input"}function a_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function s_(e,n){return e.button===0&&(!n||n==="_self")&&!a_(e)}var su=null;function l_(){if(su===null)try{new FormData(document.createElement("form"),0),su=!1}catch{su=!0}return su}var o_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function dh(e){return e!=null&&!o_.has(e)?(Ar(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yu}"`),null):e}function u_(e,n){let r,a,l,u,c;if(r_(e)){let f=e.getAttribute("action");a=f?Wr(f,n):null,r=e.getAttribute("method")||gu,l=dh(e.getAttribute("enctype"))||yu,u=new FormData(e)}else if(n_(e)||i_(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(a=m?Wr(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||gu,l=dh(e.getAttribute("formenctype"))||dh(f.getAttribute("enctype"))||yu,u=new FormData(f,e),!l_()){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(Pu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=gu,a=null,l=yu,c=e}return u&&l==="text/plain"&&(c=u,u=void 0),{action:a,method:r.toLowerCase(),encType:l,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Nd(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function c_(e,n,r,a){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}_.${a}`:l.pathname=`${l.pathname}.${a}`:l.pathname==="/"?l.pathname=`_root.${a}`:n&&Wr(l.pathname,n)==="/"?l.pathname=`${n.replace(/\/$/,"")}/_root.${a}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${a}`,l}async function f_(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 h_(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 d_(e,n,r){let a=await Promise.all(e.map(async l=>{let u=n.routes[l.route.id];if(u){let c=await f_(u,r);return c.links?c.links():[]}return[]}));return y_(a.flat(1).filter(h_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function l0(e,n,r,a,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=a.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 m_(e,n,{includeHydrateFallback:r}={}){return p_(e.map(a=>{let l=n.routes[a.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 p_(e){return[...new Set(e)]}function g_(e){let n={},r=Object.keys(e).sort();for(let a of r)n[a]=e[a];return n}function y_(e,n){let r=new Set;return new Set(n),e.reduce((a,l)=>{let u=JSON.stringify(g_(l));return r.has(u)||(r.add(u),a.push({key:u,link:l})),a},[])}function Wb(){let e=R.useContext(gs);return Nd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function b_(){let e=R.useContext(Bu);return Nd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Od=R.createContext(void 0);Od.displayName="FrameworkContext";function ex(){let e=R.useContext(Od);return Nd(e,"You must render this element inside a <HydratedRouter> element"),e}function x_(e,n){let r=R.useContext(Od),[a,l]=R.useState(!1),[u,c]=R.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:y,onTouchStart:g}=n,b=R.useRef(null);R.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let M=O=>{O.forEach(P=>{c(P.isIntersecting)})},U=new IntersectionObserver(M,{threshold:.5});return b.current&&U.observe(b.current),()=>{U.disconnect()}}},[e]),R.useEffect(()=>{if(a){let M=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(M)}}},[a]);let w=()=>{l(!0)},k=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,b,{}]:[u,b,{onFocus:hl(f,w),onBlur:hl(m,k),onMouseEnter:hl(d,w),onMouseLeave:hl(y,k),onTouchStart:hl(g,w)}]:[!1,b,{}]}function hl(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function v_({page:e,...n}){let{router:r}=Wb(),a=R.useMemo(()=>Pb(r.routes,e,r.basename),[r.routes,e,r.basename]);return a?R.createElement(S_,{page:e,matches:a,...n}):null}function w_(e){let{manifest:n,routeModules:r}=ex(),[a,l]=R.useState([]);return R.useEffect(()=>{let u=!1;return d_(e,n,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,n,r]),a}function S_({page:e,matches:n,...r}){let a=jr(),{future:l,manifest:u,routeModules:c}=ex(),{basename:f}=Wb(),{loaderData:m,matches:d}=b_(),y=R.useMemo(()=>l0(e,n,d,u,a,"data"),[e,n,d,u,a]),g=R.useMemo(()=>l0(e,n,d,u,a,"assets"),[e,n,d,u,a]),b=R.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let M=new Set,U=!1;if(n.forEach(P=>{var oe;let q=u.routes[P.route.id];!q||!q.hasLoader||(!y.some(B=>B.route.id===P.route.id)&&P.route.id in m&&((oe=c[P.route.id])!=null&&oe.shouldRevalidate)||q.hasClientLoader?U=!0:M.add(P.route.id))}),M.size===0)return[];let O=c_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return U&&M.size>0&&O.searchParams.set("_routes",n.filter(P=>M.has(P.route.id)).map(P=>P.route.id).join(",")),[O.pathname+O.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,a,u,y,n,e,c]),w=R.useMemo(()=>m_(g,u),[g,u]),k=w_(g);return R.createElement(R.Fragment,null,b.map(M=>R.createElement("link",{key:M,rel:"prefetch",as:"fetch",href:M,...r})),w.map(M=>R.createElement("link",{key:M,rel:"modulepreload",href:M,...r})),k.map(({key:M,link:U})=>R.createElement("link",{key:M,nonce:r.nonce,...U,crossOrigin:U.crossOrigin??r.crossOrigin})))}function __(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var E_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{E_&&(window.__reactRouterVersion="7.13.1")}catch{}function k_({basename:e,children:n,unstable_useTransitions:r,window:a}){let l=R.useRef();l.current==null&&(l.current=iS({window:a,v5Compat:!0}));let u=l.current,[c,f]=R.useState({action:u.action,location:u.location}),m=R.useCallback(d=>{r===!1?f(d):R.startTransition(()=>f(d))},[r]);return R.useLayoutEffect(()=>u.listen(m),[u,m]),R.createElement(e_,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var tx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,nx=R.forwardRef(function({onClick:n,discover:r="render",prefetch:a="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:m,target:d,to:y,preventScrollReset:g,viewTransition:b,unstable_defaultShouldRevalidate:w,...k},M){let{basename:U,navigator:O,unstable_useTransitions:P}=R.useContext(ir),q=typeof y=="string"&&tx.test(y),oe=$b(y,U);y=oe.to;let B=BS(y,{relative:l}),z=jr(),K=null;if(f){let ne=Cd(f,[],z.unstable_mask?z.unstable_mask.pathname:"/",!0);U!=="/"&&(ne.pathname=ne.pathname==="/"?U:Cr([U,ne.pathname])),K=O.createHref(ne)}let[F,$,D]=x_(a,k),Y=j_(y,{replace:c,unstable_mask:f,state:m,target:d,preventScrollReset:g,relative:l,viewTransition:b,unstable_defaultShouldRevalidate:w,unstable_useTransitions:P});function J(ne){n&&n(ne),ne.defaultPrevented||Y(ne)}let W=!(oe.isExternal||u),se=R.createElement("a",{...k,...D,href:(W?K:void 0)||oe.absoluteURL||B,onClick:W?J:n,ref:__(M,$),target:d,"data-discover":!q&&r==="render"?"true":void 0});return F&&!q?R.createElement(R.Fragment,null,se,R.createElement(v_,{page:B})):se});nx.displayName="Link";var C_=R.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:a="",end:l=!1,style:u,to:c,viewTransition:f,children:m,...d},y){let g=Pl(c,{relative:d.relative}),b=jr(),w=R.useContext(Bu),{navigator:k,basename:M}=R.useContext(ir),U=w!=null&&D_(g)&&f===!0,O=k.encodeLocation?k.encodeLocation(g).pathname:g.pathname,P=b.pathname,q=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(P=P.toLowerCase(),q=q?q.toLowerCase():null,O=O.toLowerCase()),q&&M&&(q=Wr(q,M)||q);const oe=O!=="/"&&O.endsWith("/")?O.length-1:O.length;let B=P===O||!l&&P.startsWith(O)&&P.charAt(oe)==="/",z=q!=null&&(q===O||!l&&q.startsWith(O)&&q.charAt(O.length)==="/"),K={isActive:B,isPending:z,isTransitioning:U},F=B?n:void 0,$;typeof a=="function"?$=a(K):$=[a,B?"active":null,z?"pending":null,U?"transitioning":null].filter(Boolean).join(" ");let D=typeof u=="function"?u(K):u;return R.createElement(nx,{...d,"aria-current":F,className:$,ref:y,style:D,to:c,viewTransition:f},typeof m=="function"?m(K):m)});C_.displayName="NavLink";var A_=R.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:a,replace:l,state:u,method:c=gu,action:f,onSubmit:m,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b,...w},k)=>{let{unstable_useTransitions:M}=R.useContext(ir),U=R_(),O=M_(f,{relative:d}),P=c.toLowerCase()==="get"?"get":"post",q=typeof f=="string"&&tx.test(f),oe=B=>{if(m&&m(B),B.defaultPrevented)return;B.preventDefault();let z=B.nativeEvent.submitter,K=(z==null?void 0:z.getAttribute("formmethod"))||c,F=()=>U(z||B.currentTarget,{fetcherKey:n,method:K,navigate:r,replace:l,state:u,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b});M&&r!==!1?R.startTransition(()=>F()):F()};return R.createElement("form",{ref:k,method:P,action:O,onSubmit:a?m:oe,...w,"data-discover":!q&&e==="render"?"true":void 0})});A_.displayName="Form";function T_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function rx(e){let n=R.useContext(gs);return zt(n,T_(e)),n}function j_(e,{target:n,replace:r,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:d}={}){let y=da(),g=jr(),b=Pl(e,{relative:c});return R.useCallback(w=>{if(s_(w,n)){w.preventDefault();let k=r!==void 0?r:Nl(g)===Nl(b),M=()=>y(e,{replace:k,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});d?R.startTransition(()=>M()):M()}},[g,y,b,r,a,l,n,e,u,c,f,m,d])}var N_=0,O_=()=>`__${String(++N_)}__`;function R_(){let{router:e}=rx("useSubmit"),{basename:n}=R.useContext(ir),r=KS(),a=e.fetch,l=e.navigate;return R.useCallback(async(u,c={})=>{let{action:f,method:m,encType:d,formData:y,body:g}=u_(u,n);if(c.navigate===!1){let b=c.fetcherKey||O_();await a(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})},[a,l,n,r])}function M_(e,{relative:n}={}){let{basename:r}=R.useContext(ir),a=R.useContext(Tr);zt(a,"useFormAction must be used inside a RouteContext");let[l]=a.matches.slice(-1),u={...Pl(e||".",{relative:n})},c=jr();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:Cr([r,u.pathname])),Nl(u)}function D_(e,{relative:n}={}){let r=R.useContext(Gb);zt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=rx("useViewTransitionState"),l=Pl(e,{relative:n});if(!r.isTransitioning)return!1;let u=Wr(r.currentLocation.pathname,a)||r.currentLocation.pathname,c=Wr(r.nextLocation.pathname,a)||r.nextLocation.pathname;return wu(l.pathname,c)!=null||wu(l.pathname,u)!=null}var Su=Bb();const ix=R.createContext(null),ax="palmier_paired_hosts",Zh="palmier_active_host";function mh(){try{const e=localStorage.getItem(ax);if(e)return JSON.parse(e)}catch{}return[]}function L_(e){localStorage.setItem(ax,JSON.stringify(e))}function z_(){return localStorage.getItem(Zh)}function U_(e){e?localStorage.setItem(Zh,e):localStorage.removeItem(Zh)}const B_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function P_({children:e}){const[n,r]=R.useState(mh),[a,l]=R.useState(()=>{const y=z_(),g=mh();return y&&g.some(b=>b.hostId===y)?y:g.length>0?g[0].hostId:null});R.useEffect(()=>{if(!B_)return;const y="local";if(!mh().find(b=>b.hostId===y)){const b={hostId:y,clientToken:"",directUrl:window.location.origin};r(w=>[...w.filter(k=>k.hostId!==y),b]),l(y)}},[]),R.useEffect(()=>{L_(n)},[n]),R.useEffect(()=>{U_(a)},[a]);const u=R.useCallback(y=>{r(g=>[...g.filter(w=>w.hostId!==y.hostId),y]),l(y.hostId)},[]),c=R.useCallback(y=>{r(g=>g.filter(b=>b.hostId!==y)),l(g=>g!==y?g:null)},[]);R.useEffect(()=>{var y;a!==null&&!n.find(g=>g.hostId===a)?l(((y=n[0])==null?void 0:y.hostId)??null):a===null&&n.length>0&&l(n[0].hostId)},[n,a]);const f=R.useCallback((y,g)=>{r(b=>b.map(w=>w.hostId===y?{...w,name:g}:w))},[]),m=R.useCallback(y=>{l(y)},[]),d=R.useCallback(()=>n.find(y=>y.hostId===a)??null,[n,a]);return v.jsx(ix.Provider,{value:{pairedHosts:n,activeHostId:a,addPairedHost:u,removePairedHost:c,renamePairedHost:f,setActiveHostId:m,getActiveHost:d},children:e})}function Hl(){const e=R.useContext(ix);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const Fn=new Uint8Array(0),Pi=new TextEncoder,Hn=new TextDecoder;function H_(...e){let n=0;for(let l=0;l<e.length;l++)n+=e[l].length;const r=new Uint8Array(n);let a=0;for(let l=0;l<e.length;l++)r.set(e[l],a),a+=e[l].length;return r}function _l(...e){const n=[];for(let r=0;r<e.length;r++)n.push(Pi.encode(e[r]));return n.length===0?Fn:n.length===1?n[0]:H_(...n)}function o0(e){return!e||e.length===0?"":Hn.decode(e)}const u0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",c0=36,q_=0xcfd41b9100000,f0=33,I_=333,h0=22;function F_(e){for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*255)}function $_(e){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(e):F_(e)}class Y_{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(h0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*q_),this.inc=Math.floor(Math.random()*(I_-f0)+f0)}setPre(){const n=new Uint8Array(12);$_(n);for(let r=0;r<12;r++){const a=n[r]%36;this.buf[r]=u0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let r=h0-1;r>=12;r--)this.buf[r]=u0.charCodeAt(n%c0),n=Math.floor(n/c0)}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 Ui=new Y_;var Qr;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(Qr||(Qr={}));var rs;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(rs||(rs={}));var _e;(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"})(_e||(_e={}));function G_(e){return typeof e.code=="string"}class sx{constructor(){C(this,"messages");this.messages=new Map,this.messages.set(_e.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(_e.BadJson,"Bad JSON"),this.messages.set(_e.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return V_.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const V_=new sx;class je extends Error{constructor(r,a,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=a,this.chainedError=l}static errorForCode(r,a){const l=sx.getMessage(r);return new je(l,r,a)}isAuthError(){return this.code===_e.AuthenticationExpired||this.code===_e.AuthorizationViolation||this.code===_e.AccountExpired}isAuthTimeout(){return this.code===_e.AuthenticationTimeout}isPermissionError(){return this.code===_e.PermissionsViolation}isProtocolError(){return this.code===_e.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Bn;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(Bn||(Bn={}));var mr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(mr||(mr={}));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 _u="Nats-Service-Error",Eu="Nats-Service-Error-Code";class ku extends Error{constructor(r,a){super(a);C(this,"code");this.code=r}static isServiceError(r){return ku.toServiceError(r)!==null}static toServiceError(r){var l,u;const a=((l=r==null?void 0:r.headers)==null?void 0:l.get(Eu))||"";if(a!==""){const c=parseInt(a)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(_u))||"";return new ku(c,f.length?f:a)}return null}}function Zr(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}.${Ui.next()}`}const Wh="127.0.0.1";var Di;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Di||(Di={}));function Hu(e,...n){for(let r=0;r<n.length;r++){const a=n[r];Object.keys(a).forEach(function(l){e[l]=a[l]})}return e}function lu(e){return Hn.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function cs(e,n=!0){const r=n?je.errorForCode(_e.Timeout):null;let a,l;const u=new Promise((c,f)=>{a={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?je.errorForCode(_e.Timeout):r)},e)});return Object.assign(u,a)}function ys(e=0){let n;const r=new Promise(a=>{const l=setTimeout(()=>{a()},e);n={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,n)}function Lt(){let e={};const n=new Promise((r,a)=>{e={resolve:r,reject:a}});return Object.assign(n,e)}function lx(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 J_(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function Rd(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 J_(r>n?e[n]:e[r])}}}function Dt(e){return e*1e6}function Md(e){return Math.floor(e/1e6)}function d0(e){let a=!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`,_e.BadHeader);a&&97<=c&&c<=122?c-=32:!a&&65<=c&&c<=90&&(c+=32),l[u]=c,a=c==45}return String.fromCharCode(...l)}function ei(e=0,n=""){if(e===0&&n!==""||e>0&&n==="")throw new Error("setting status requires both code and description");return new Li(e,n)}const ph="NATS/1.0";class Li{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,a]of this.headers){const l=n.values(r);if(a.length!==l.length)return!1;const u=[...a].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 Li,l=Hn.decode(n).split(`\r
61
+ `),u=l[0];if(u!==ph){let c=u.replace(ph,"").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=ph;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[r,a]of this.headers)for(let l=0;l<a.length;l++)n=`${n}\r
62
+ ${r}: ${a[l]}`;return`${n}\r
63
+ \r
64
+ `}encode(){return Pi.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new je("invalid header value - \\r and \\n are not allowed.",_e.BadHeader);return n.trim()}keys(){const n=[];for(const r of this.headers.keys())n.push(r);return n}findKeys(n,r=Bn.Exact){const a=this.keys();switch(r){case Bn.Exact:return a.filter(l=>l===n);case Bn.CanonicalMIME:return n=d0(n),a.filter(l=>l===n);default:{const l=n.toLowerCase();return a.filter(u=>l===u.toLowerCase())}}}get(n,r=Bn.Exact){const a=this.findKeys(n,r);if(a.length){const l=this.headers.get(a[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(n,r=Bn.Exact){const a=this.findKeys(n,r);if(a.length){const l=this.headers.get(a[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(n,r=Bn.Exact){return this.findKeys(n,r).length>0}set(n,r,a=Bn.Exact){this.delete(n,a),this.append(n,r,a)}append(n,r,a=Bn.Exact){const l=d0(n);a===Bn.CanonicalMIME&&(n=l);const u=this.findKeys(n,a);n=u.length>0?u[0]:n;const c=Li.validHeaderValue(r);let f=this.headers.get(n);f||(f=[],this.headers.set(n,f)),f.push(c)}values(n,r=Bn.Exact){const a=[];return this.findKeys(n,r).forEach(u=>{const c=this.headers.get(u);c&&a.push(...c)}),a}delete(n,r=Bn.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 Li;for(const a in n)r.headers.set(a,n[a]);return r}}function Cu(){return{encode(e){return Pi.encode(e)},decode(e){return Hn.decode(e)}}}function pr(e){return{encode(n){try{return n===void 0&&(n=null),Pi.encode(JSON.stringify(n))}catch(r){throw je.errorForCode(_e.BadJson,r)}},decode(n){try{return JSON.parse(Hn.decode(n),e)}catch(r){throw je.errorForCode(_e.BadJson,r)}}}}function ox(e){var n;return e&&e.data.length===0&&((n=e.headers)==null?void 0:n.code)===503?je.errorForCode(_e.NoResponders):null}class Dd{constructor(n,r,a){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=a}get subject(){return this._subject?this._subject:(this._subject=Hn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Hn.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=Li.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=Fn,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,a=this._msg.size===-1?0:this._msg.size;return n+r+a}json(n){return pr(n).decode(this.data)}string(){return Hn.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(a,l){return(a==="start"||a==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}C(Dd,"jc");function is(e){return qu("durable",e)}function mn(e){return qu("stream",e)}function qu(e,n=""){if(n==="")throw Error(`${e} name required`);return[".","*",">","/","\\"," "," ",`
65
+ `,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
66
+ `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${e} name - ${e} name cannot contain '${a}'`)}}),""}function wl(e,n=""){if(n==="")throw Error(`${e} name required`);const r=X_(n);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function X_(e=""){if(e==="")throw Error("name required");const n=/^[-\w]+$/g;if(e.match(n)===null){for(const a of e.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function ed(e){if(e.data.length>0)return!1;const n=e.headers;return n?n.code>=100&&n.code<200:!1}function td(e){var n;return ed(e)&&((n=e.headers)==null?void 0:n.description)==="Idle Heartbeat"}function K_(e,n,r){const a=ei(e,n),l={hdr:1,sid:0,size:0},u=new Dd(l,Fn,{});return u._headers=a,u._subject=r,u}function as(e){if(e.data.length!==0)return null;const n=e.headers;return n?ux(n.code,n.description):null}var nr;(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"})(nr||(nr={}));function Q_(e){return e.code!==_e.JetStream409?!1:[nr.MaxBatchExceeded,nr.MaxExpiresExceeded,nr.MaxBytesExceeded,nr.MaxMessageSizeExceeded,nr.PushConsumer,nr.IdleHeartbeatMissed,nr.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function ux(e,n=""){if(e<300)return null;switch(n=n.toLowerCase(),e){case 404:return new je(n,_e.JetStream404NoMessages);case 408:return new je(n,_e.JetStream408RequestTimeout);case 409:{const r=n.startsWith(nr.IdleHeartbeatMissed)?_e.JetStreamIdleHeartBeat:_e.JetStream409;return new je(n,r)}case 503:return je.errorForCode(_e.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=_e.Unknown),new je(n,`${e}`)}}class rn{constructor(){C(this,"inflight");C(this,"processed");C(this,"received");C(this,"noIterator");C(this,"iterClosed");C(this,"done");C(this,"signal");C(this,"yields");C(this,"filtered");C(this,"pendingFiltered");C(this,"ingestionFilterFn");C(this,"protocolFilterFn");C(this,"dispatchedFn");C(this,"ctx");C(this,"_data");C(this,"err");C(this,"time");C(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=Lt(),this.yields=[],this.iterClosed=Lt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:r,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};r&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new je("unsupported iterator",_e.ApiError);if(this.yielding)throw new je("already yielding",_e.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let r=0;r<n.length;r++){if(typeof n[r]=="function"){const l=n[r];try{l()}catch(u){throw u}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[r]):!0){this.processed++;const l=Date.now();yield n[r],this.time=Date.now()-l,this.dispatchedFn&&n[r]&&this.dispatchedFn(n[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=Lt())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Ld{constructor(n,r,a={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=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.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,a=2){this.interval=n,this.maxOut=a,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 nd;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(nd||(nd={}));var Ol;(function(e){e.Old="old",e.New="new"})(Ol||(Ol={}));var rd;(function(e){e.File="file",e.Memory="memory"})(rd||(rd={}));var $t;(function(e){e.All="all",e.Last="last",e.New="new",e.StartSequence="by_start_sequence",e.StartTime="by_start_time",e.LastPerSubject="last_per_subject"})($t||($t={}));var nn;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(nn||(nn={}));var fs;(function(e){e.Instant="instant",e.Original="original"})(fs||(fs={}));var Bi;(function(e){e.None="none",e.S2="s2"})(Bi||(Bi={}));var Au;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Au||(Au={}));function Z_(e,n={}){return Object.assign({name:e,deliver_policy:$t.All,ack_policy:nn.Explicit,ack_wait:Dt(30*1e3),replay_policy:fs.Instant},n)}var m0;(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"})(m0||(m0={}));var bn;(function(e){e.StreamSourceHdr="Nats-Stream-Source",e.LastConsumerSeqHdr="Nats-Last-Consumer",e.LastStreamSeqHdr="Nats-Last-Stream",e.ConsumerStalledHdr="Nats-Consumer-Stalled",e.MessageSizeHdr="Nats-Msg-Size",e.RollupHdr="Nats-Rollup",e.RollupValueSubject="sub",e.RollupValueAll="all",e.PendingMessagesHdr="Nats-Pending-Messages",e.PendingBytesHdr="Nats-Pending-Bytes"})(bn||(bn={}));var dr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(dr||(dr={}));var ts;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(ts||(ts={}));var p0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(p0||(p0={}));const Pn="KV_";class W_{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=Z_("",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(a=>{this.filterSubject(a)}),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?nn.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 is(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=$t.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=$t.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=$t.All,this}deliverLastPerSubject(){return this.config.deliver_policy=$t.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=$t.Last,this}deliverNew(){return this.config.deliver_policy=$t.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=nn.None,this}ackAll(){return this.config.ack_policy=nn.All,this}ackExplicit(){return this.config.ack_policy=nn.Explicit,this}ackWait(n){return this.config.ack_wait=Dt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=fs.Instant,this}replayOriginal(){return this.config.replay_policy=fs.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=Dt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,r){return this.stream=n,this.config.durable_name=r,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=Dt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=Dt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function zi(e){return new W_(e)}function g0(e){return typeof e.getOpts=="function"}class e2{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 a=atob(n);return r?Uint8Array.from(a,l=>l.charCodeAt(0)):a}}class ss{static encode(n){return ss.toB64URLEncoding(e2.encode(n))}static decode(n,r=!1){return ss.decode(ss.fromB64URLEncoding(n),r)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class hs{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 a=new Uint8Array(r);let l=0;for(let u=0;u<n.length;u++)a.set(n[u],l),l+=n[u].length;return a}static fromAscii(n){return n||(n=""),Pi.encode(n)}static toAscii(n){return Hn.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 a=0;a<this.buffers.length;a++)n.set(this.buffers[a],r),r+=this.buffers[a].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 a=this.byteLength;(n===void 0||n>a)&&(n=a);const l=r.subarray(0,n);return a>n&&this.buffers.push(r.subarray(n)),this.byteLength=a-n,l}}return new Uint8Array(0)}fill(n,...r){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<r.length;a++)r[a]&&r[a].length&&(this.buffers.push(r[a]),this.byteLength+=r[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function t2(e,n){return n.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(a){if(a!=="default"&&!(a in e)){var l=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(e,a,l.get?l:{enumerable:!0,get:function(){return r[a]}})}})}),Object.freeze(e)}var n2=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},dl=n2.performance||{};dl.now||dl.mozNow||dl.msNow||dl.oNow||dl.webkitNow;var y0={versions:{}},r2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function i2(e){if(e.__esModule)return e;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var gh,Iu={exports:{}},b0={},x0=i2(t2({__proto__:null,default:b0},[b0]));gh=Iu,(function(){var e="input is invalid type",n=typeof window=="object",r=n?window:{};r.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&y0.versions&&y0.versions.node;l?r=r2:a&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&gh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),m=[-2147483648,8388608,32768,128],d=[24,16,8,0],y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],g=["hex","array","digest","arrayBuffer"],b=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(B){return Object.prototype.toString.call(B)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(B){return typeof B=="object"&&B.buffer&&B.buffer.constructor===ArrayBuffer});var w=function(B,z){return function(K){return new P(z,!0).update(K)[B]()}},k=function(B){var z=w("hex",B);l&&(z=M(z,B)),z.create=function(){return new P(B)},z.update=function($){return z.create().update($)};for(var K=0;K<g.length;++K){var F=g[K];z[F]=w(F,B)}return z},M=function(B,z){var K,F=x0,$=x0.Buffer,D=z?"sha224":"sha256";return K=$.from&&!r.JS_SHA256_NO_BUFFER_FROM?$.from:function(Y){return new $(Y)},function(Y){if(typeof Y=="string")return F.createHash(D).update(Y,"utf8").digest("hex");if(Y==null)throw new Error(e);return Y.constructor===ArrayBuffer&&(Y=new Uint8Array(Y)),Array.isArray(Y)||ArrayBuffer.isView(Y)||Y.constructor===$?F.createHash(D).update(K(Y)).digest("hex"):B(Y)}},U=function(B,z){return function(K,F){return new q(K,z,!0).update(F)[B]()}},O=function(B){var z=U("hex",B);z.create=function($){return new q($,B)},z.update=function($,D){return z.create($).update(D)};for(var K=0;K<g.length;++K){var F=g[K];z[F]=U(F,B)}return z};function P(B,z){z?(b[0]=b[16]=b[1]=b[2]=b[3]=b[4]=b[5]=b[6]=b[7]=b[8]=b[9]=b[10]=b[11]=b[12]=b[13]=b[14]=b[15]=0,this.blocks=b):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],B?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=B}function q(B,z,K){var F,$=typeof B;if($==="string"){var D,Y=[],J=B.length,W=0;for(F=0;F<J;++F)(D=B.charCodeAt(F))<128?Y[W++]=D:D<2048?(Y[W++]=192|D>>>6,Y[W++]=128|63&D):D<55296||D>=57344?(Y[W++]=224|D>>>12,Y[W++]=128|D>>>6&63,Y[W++]=128|63&D):(D=65536+((1023&D)<<10|1023&B.charCodeAt(++F)),Y[W++]=240|D>>>18,Y[W++]=128|D>>>12&63,Y[W++]=128|D>>>6&63,Y[W++]=128|63&D);B=Y}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(z,!0).update(B).array());var se=[],ne=[];for(F=0;F<64;++F){var V=B[F]||0;se[F]=92^V,ne[F]=54^V}P.call(this,z,K),this.update(ne),this.oKeyPad=se,this.inner=!0,this.sharedMemory=K}P.prototype.update=function(B){if(!this.finalized){var z,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);z=!0}for(var F,$,D=0,Y=B.length,J=this.blocks;D<Y;){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),z)for($=this.start;D<Y&&$<64;++D)J[$>>>2]|=B[D]<<d[3&$++];else for($=this.start;D<Y&&$<64;++D)(F=B.charCodeAt(D))<128?J[$>>>2]|=F<<d[3&$++]:F<2048?(J[$>>>2]|=(192|F>>>6)<<d[3&$++],J[$>>>2]|=(128|63&F)<<d[3&$++]):F<55296||F>=57344?(J[$>>>2]|=(224|F>>>12)<<d[3&$++],J[$>>>2]|=(128|F>>>6&63)<<d[3&$++],J[$>>>2]|=(128|63&F)<<d[3&$++]):(F=65536+((1023&F)<<10|1023&B.charCodeAt(++D)),J[$>>>2]|=(240|F>>>18)<<d[3&$++],J[$>>>2]|=(128|F>>>12&63)<<d[3&$++],J[$>>>2]|=(128|F>>>6&63)<<d[3&$++],J[$>>>2]|=(128|63&F)<<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,z=this.lastByteIndex;B[16]=this.block,B[z>>>2]|=m[3&z],this.block=B[16],z>=56&&(this.hashed||this.hash(),B[0]=this.block,B[16]=B[1]=B[2]=B[3]=B[4]=B[5]=B[6]=B[7]=B[8]=B[9]=B[10]=B[11]=B[12]=B[13]=B[14]=B[15]=0),B[14]=this.hBytes<<3|this.bytes>>>29,B[15]=this.bytes<<3,this.hash()}},P.prototype.hash=function(){var B,z,K,F,$,D,Y,J,W,se=this.h0,ne=this.h1,V=this.h2,ie=this.h3,pe=this.h4,Ee=this.h5,E=this.h6,N=this.h7,Z=this.blocks;for(B=16;B<64;++B)z=(($=Z[B-15])>>>7|$<<25)^($>>>18|$<<14)^$>>>3,K=(($=Z[B-2])>>>17|$<<15)^($>>>19|$<<13)^$>>>10,Z[B]=Z[B-16]+z+Z[B-7]+K|0;for(W=ne&V,B=0;B<64;B+=4)this.first?(this.is224?(D=300032,N=($=Z[0]-1413257819)-150054599|0,ie=$+24177077|0):(D=704751109,N=($=Z[0]-210244248)-1521486534|0,ie=$+143694565|0),this.first=!1):(z=(se>>>2|se<<30)^(se>>>13|se<<19)^(se>>>22|se<<10),F=(D=se&ne)^se&V^W,N=ie+($=N+(K=(pe>>>6|pe<<26)^(pe>>>11|pe<<21)^(pe>>>25|pe<<7))+(pe&Ee^~pe&E)+y[B]+Z[B])|0,ie=$+(z+F)|0),z=(ie>>>2|ie<<30)^(ie>>>13|ie<<19)^(ie>>>22|ie<<10),F=(Y=ie&se)^ie&ne^D,E=V+($=E+(K=(N>>>6|N<<26)^(N>>>11|N<<21)^(N>>>25|N<<7))+(N&pe^~N&Ee)+y[B+1]+Z[B+1])|0,z=((V=$+(z+F)|0)>>>2|V<<30)^(V>>>13|V<<19)^(V>>>22|V<<10),F=(J=V&ie)^V&se^Y,Ee=ne+($=Ee+(K=(E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7))+(E&N^~E&pe)+y[B+2]+Z[B+2])|0,z=((ne=$+(z+F)|0)>>>2|ne<<30)^(ne>>>13|ne<<19)^(ne>>>22|ne<<10),F=(W=ne&V)^ne&ie^J,pe=se+($=pe+(K=(Ee>>>6|Ee<<26)^(Ee>>>11|Ee<<21)^(Ee>>>25|Ee<<7))+(Ee&E^~Ee&N)+y[B+3]+Z[B+3])|0,se=$+(z+F)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+se|0,this.h1=this.h1+ne|0,this.h2=this.h2+V|0,this.h3=this.h3+ie|0,this.h4=this.h4+pe|0,this.h5=this.h5+Ee|0,this.h6=this.h6+E|0,this.h7=this.h7+N|0},P.prototype.hex=function(){this.finalize();var B=this.h0,z=this.h1,K=this.h2,F=this.h3,$=this.h4,D=this.h5,Y=this.h6,J=this.h7,W=f[B>>>28&15]+f[B>>>24&15]+f[B>>>20&15]+f[B>>>16&15]+f[B>>>12&15]+f[B>>>8&15]+f[B>>>4&15]+f[15&B]+f[z>>>28&15]+f[z>>>24&15]+f[z>>>20&15]+f[z>>>16&15]+f[z>>>12&15]+f[z>>>8&15]+f[z>>>4&15]+f[15&z]+f[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[F>>>28&15]+f[F>>>24&15]+f[F>>>20&15]+f[F>>>16&15]+f[F>>>12&15]+f[F>>>8&15]+f[F>>>4&15]+f[15&F]+f[$>>>28&15]+f[$>>>24&15]+f[$>>>20&15]+f[$>>>16&15]+f[$>>>12&15]+f[$>>>8&15]+f[$>>>4&15]+f[15&$]+f[D>>>28&15]+f[D>>>24&15]+f[D>>>20&15]+f[D>>>16&15]+f[D>>>12&15]+f[D>>>8&15]+f[D>>>4&15]+f[15&D]+f[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];return this.is224||(W+=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]),W},P.prototype.toString=P.prototype.hex,P.prototype.digest=function(){this.finalize();var B=this.h0,z=this.h1,K=this.h2,F=this.h3,$=this.h4,D=this.h5,Y=this.h6,J=this.h7,W=[B>>>24&255,B>>>16&255,B>>>8&255,255&B,z>>>24&255,z>>>16&255,z>>>8&255,255&z,K>>>24&255,K>>>16&255,K>>>8&255,255&K,F>>>24&255,F>>>16&255,F>>>8&255,255&F,$>>>24&255,$>>>16&255,$>>>8&255,255&$,D>>>24&255,D>>>16&255,D>>>8&255,255&D,Y>>>24&255,Y>>>16&255,Y>>>8&255,255&Y];return this.is224||W.push(J>>>24&255,J>>>16&255,J>>>8&255,255&J),W},P.prototype.array=P.prototype.digest,P.prototype.arrayBuffer=function(){this.finalize();var B=new ArrayBuffer(this.is224?28:32),z=new DataView(B);return z.setUint32(0,this.h0),z.setUint32(4,this.h1),z.setUint32(8,this.h2),z.setUint32(12,this.h3),z.setUint32(16,this.h4),z.setUint32(20,this.h5),z.setUint32(24,this.h6),this.is224||z.setUint32(28,this.h7),B},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 oe=k();oe.sha256=oe,oe.sha224=k(!0),oe.sha256.hmac=O(),oe.sha224.hmac=O(!0),u?gh.exports=oe:(r.sha256=oe.sha256,r.sha224=oe.sha224)})();Iu.exports;Iu.exports.sha224;var v0=Iu.exports.sha256;function id(e){return c2(e)}function a2(e){if(!/^[0-9A-Fa-f]+$/.test(e))return!1;const r=/^[0-9A-F]+$/.test(e),a=/^[0-9a-f]+$/.test(e);return r||a?e.length%2===0:!1}function s2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function l2(e){return a2(e)?"hex":s2(e)?"b64":""}function o2(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 u2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))}function c2(e){switch(l2(e)){case"hex":return o2(e);case"b64":return u2(e)}return null}function f2(e,n){const r=typeof e=="string"?id(e):e,a=typeof n=="string"?id(n):n;if(r===null||a===null||r.length!==a.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==a[l])return!1;return!0}class cx{constructor(n,r,a=!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=Ui.next(),a&&(this.ctx=new Error)}}class h2 extends cx{constructor(r,a,l={maxWait:1e3}){super(r,a);C(this,"callback");C(this,"done");C(this,"timer");C(this,"max");C(this,"opts");if(this.opts=l,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1,this.done=Lt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(r){r&&this.callback(r,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(r,a){r?(this.ctx&&(r.stack+=`
67
+
68
+ ${this.ctx.stack}`),this.cancel(r)):(this.callback(null,a),this.opts.strategy===mr.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===mr.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===mr.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class fx extends cx{constructor(r,a,l={timeout:1e3},u=!0){super(r,a,u);C(this,"deferred");C(this,"timer");this.deferred=Lt(),this.timer=cs(l.timeout,u)}resolver(r,a){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
69
+
70
+ ${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(a),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||je.errorForCode(_e.Cancelled))}}const d2="$JS.API";function m2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Hu({apiPrefix:d2,timeout:5e3},e)}class ql{constructor(n,r){C(this,"nc");C(this,"opts");C(this,"prefix");C(this,"timeout");C(this,"jc");this.nc=n,this.opts=m2(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=pr()}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,a){a=a||{},a.timeout=this.timeout;let l=Fn;r&&(l=this.jc.encode(r));let{retries:u}=a;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=Rd();for(let f=0;f<u;f++)try{const m=await this.nc.request(n,l,a);return this.parseJsResponse(m)}catch(m){const d=m;if((d.code==="503"||d.code===_e.Timeout)&&f+1<u)await ys(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),a=r;if(a.error){const l=ux(a.error.code,a.error.description);if(l!==null)throw l.api_error=a.error,l}return r}}class Sl{constructor(n,r,a,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=a,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 a=this.countResponse(r);return a===0?[]:(this.offset+=a,this.filter(r))}catch(r){throw this.err=r,r}}countResponse(n){var r,a,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((a=n.consumers)==null?void 0:a.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 ca(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 ad(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 ot;(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"})(ot||(ot={}));class p2{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=ca(n)),this.server=n,this.set(ot.JS_KV,"2.6.2"),this.set(ot.JS_OBJECTSTORE,"2.6.3"),this.set(ot.JS_PULL_MAX_BYTES,"2.8.3"),this.set(ot.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(ot.JS_ALLOW_DIRECT,"2.9.0"),this.set(ot.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(ot.JS_SIMPLIFICATION,"2.9.4"),this.set(ot.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(ot.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(ot.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(ot.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(ot.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(ot.JS_STREAM_COMPRESSION,"2.10.0"),this.set(ot.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(ot.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:ad(this.server,ca(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=ca(n)),ad(this.server,n)>=0}}class Tu extends ql{constructor(n,r){super(n,r)}async add(n,r,a=Au.Create){if(mn(n),r.deliver_group&&r.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(r.deliver_group&&r.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=r,l.stream_name=n,l.action=a,l.config.durable_name&&is(l.config.durable_name);const u=this.nc;let{min:c,ok:f}=u.features.get(ot.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{qu("name",m)}catch(b){const w=b.message,k=w.indexOf("cannot contain");throw k!==-1?new Error(`consumer 'name' ${w.substring(k)}`):b}let d,y="";if(Array.isArray(r.filter_subjects)){const{min:b,ok:w}=u.features.get(ot.JS_MULTIPLE_CONSUMER_FILTER);if(!w)throw new Error(`consumer 'filter_subjects' requires server ${b}`);f=!1}if(r.metadata){const{min:b,ok:w}=u.features.get(ot.JS_STREAM_CONSUMER_METADATA);if(!w)throw new Error(`consumer 'metadata' requires server ${b}`)}if(f&&(y=r.name??r.durable_name??""),y!==""){let b=r.filter_subject??void 0;b===">"&&(b=void 0),d=b!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${y}.${b}`:`${this.prefix}.CONSUMER.CREATE.${n}.${y}`}else d=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(d,l)}async update(n,r,a){const l=await this.info(n,r),u=a;return this.add(n,Object.assign(l.config,u),Au.Update)}async info(n,r){return mn(n),is(r),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${r}`)}async delete(n,r){return mn(n),is(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${r}`)).success}list(n){mn(n);const r=l=>l.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Sl(a,r,this)}pause(n,r,a){const l=`${this.prefix}.CONSUMER.PAUSE.${n}.${r}`,u={pause_until:a.toISOString()};return this._request(l,u)}resume(n,r){return this.pause(n,r,new Date(0))}}function Ka(e,n,r=!1){if(r===!0&&!e)throw je.errorForCode(_e.ApiError,new Error(`${n} is not a function`));if(e&&typeof e!="function")throw je.errorForCode(_e.ApiError,new Error(`${n} is not a function`))}class g2 extends rn{constructor(r,a,l){super();C(this,"sub");C(this,"adapter");C(this,"subIterDone");Ka(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&Ka(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(Ka(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(Ka(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(Ka(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&Ka(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,b)=>{const[w,k]=this.adapter(g,b);if(w){y(w,null);return}const{ingest:M}=this.ingestionFilterFn?this.ingestionFilterFn(k,this):{ingest:!0};M&&(!this.protocolFilterFn||this.protocolFilterFn(k))&&(y(w,k),this.dispatchedFn&&k&&this.dispatchedFn(k))}}const{max:c,queue:f,timeout:m}=l,d={queue:f,timeout:m,callback:u};c&&c>0&&(d.max=c),this.sub=r.subscribe(a,d),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=Lt(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async y=>{await y.closed,this.stop()})(this.sub).then().catch()}unsubscribe(r){this.sub.unsubscribe(r)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(r,a){this.sub.cancelTimeout();const[l,u]=this.adapter(r,a);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 qn;function y2(e){qn=e}function hx(){return qn!==void 0&&qn.defaultPort!==void 0?qn.defaultPort:4222}function yh(){return qn!==void 0&&qn.urlParseFn?qn.urlParseFn:void 0}function b2(){if(!qn||typeof qn.factory!="function")throw new Error("transport fn is not set");return qn.factory()}function sd(){return qn!==void 0&&qn.dnsResolveFn?qn.dnsResolveFn:void 0}const bu=`\r
71
+ `,ju=hs.fromAscii(bu),x2=new Uint8Array(ju)[0],v2=new Uint8Array(ju)[1];function w2(e){for(let n=0;n<e.length;n++){const r=n+1;if(e.byteLength>r&&e[n]===x2&&e[r]===v2)return r+1}return 0}function S2(e){const n=w2(e);if(n>0){const a=new Uint8Array(e).slice(0,n);return Hn.decode(a)}return""}const _2=4,dx=48,E2=65,k2=97;function C2(e,n,r,a){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]=a,l}function ld(e){return A2(e)!==void 0}function A2(e){for(let n=0;n<e.length;n++)switch(e[n]){case".":return mx(e);case":":return T2(e)}}function mx(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:a,c:l,ok:u}=j2(e);if(!u||a>255)return;e=e.substring(l),n[r]=a}return C2(n[0],n[1],n[2],n[3])}function T2(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 a=0;for(;a<16;){const{n:l,c:u,ok:c}=N2(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&a!=12||a+4>16)return;const f=mx(e);if(f===void 0)return;n[a]=f[12],n[a+1]=f[13],n[a+2]=f[14],n[a+3]=f[15],e="",a+=_2;break}if(n[a]=l>>8,n[a+1]=l,a+=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=a,e=e.substring(1),e.length===0)break}}if(e.length===0){if(a<16){if(r<0)return;const l=16-a;for(let u=a-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 j2(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)-dx),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 N2(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)-dx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)n*=16,n+=e.charCodeAt(r)-k2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)n*=16,n+=e.charCodeAt(r)-E2+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 O2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function od(e){return!O2(e)}function R2(e){const n="::FFFF:",r=e.toUpperCase().indexOf(n);if(r!==-1&&e.indexOf(".")!==-1){let a=e.substring(r+n.length);return a=a.replace("[",""),a.replace("]","")}return e}function M2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=R2(e),od(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const n=od(e)?e.match(/(]:)(\d+)/):e.match(/(:)(\d+)/),r=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=r===80?"https":"http",l=new URL(`${a}://${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 a=M2(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.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(ld(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const l of a){const u=this.port===80?"https":"http",c=new URL(`${u}://${od(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new kl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return n.randomize&&lx(r),this.resolves=r,r}}class D2{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 a=yh();n&&(n.forEach(l=>{l=a?a(l):l,this.servers.push(new kl(l))}),this.randomize&&(this.servers=lx(this.servers))),this.servers.length===0&&this.addServer(`${Wh}:${hx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();ld(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 a=yh();n=a?a(n):n;const l=new kl(n,r);ld(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 a=[];let l=[];const u=yh(),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),a.push(d)}),{added:a,deleted:l}}}class L2{constructor(){C(this,"baseInbox");C(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${Zr(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 a=r.permissionContext;if(a.operation==="publish"){const l=this.all().find(u=>u.requestSubject===a.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(n,r)=>{const a=this.getToken(r);if(a){const l=this.get(a);l&&(n===null&&r.headers&&(n=ox(r)),l.resolver(n,r))}}}close(){const n=je.errorForCode(_e.Timeout);this.reqs.forEach(r=>{r.resolver(n,{})})}}class z2{constructor(n,r,a){C(this,"ph");C(this,"interval");C(this,"maxOut");C(this,"timer");C(this,"pendings");this.ph=n,this.interval=r,this.maxOut=a,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:rs.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=Lt();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class U2 extends Error{constructor(n){super(n),this.name="AssertionError"}}function B2(e,n="Assertion failed."){if(!e)throw new U2(n)}const w0=32*1024,bh=2**32-2;function ou(e,n,r=0){const a=n.byteLength-r;return e.byteLength>a&&(e=e.subarray(0,a)),n.set(e,r),e.byteLength}class xh{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){B2(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(Pi.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 a=this._tryGrowByReslice(n);if(a>=0)return a;const l=this.capacity;if(n<=Math.floor(l/2)-r)ou(this._buf.subarray(this._off),this._buf);else{if(l+n>bh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+n,bh));ou(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+n,bh)),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 a=new Uint8Array(w0);for(;;){const l=this.capacity-this.length<w0,u=l?a:new Uint8Array(this._buf.buffer,this.length),c=n.read(u);if(c===null)return r;l?this.write(u.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var pn;(function(e){e[e.OK=0]="OK",e[e.ERR=1]="ERR",e[e.MSG=2]="MSG",e[e.INFO=3]="INFO",e[e.PING=4]="PING",e[e.PONG=5]="PONG"})(pn||(pn={}));function S0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const P2=48;class _0{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 a=n[r];switch(this.state){case Ce.OP_START:switch(a){case Ae.M:case Ae.m:this.state=Ce.OP_M,this.hdr=-1,this.ma=S0();break;case Ae.H:case Ae.h:this.state=Ce.OP_H,this.hdr=0,this.ma=S0();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(a){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(a){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(a){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(a){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(a){case Ae.SPACE:case Ae.TAB:continue;default:this.state=Ce.MSG_ARG,this.as=r}break;case Ce.MSG_ARG:switch(a){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(a)}break;case Ce.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:pn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ce.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const u=n.length-r;u<l&&(l=u),l>0?(this.msgBuf.write(n.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(a)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:pn.MSG,msg:this.ma,data:n.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ce.MSG_END);break;case Ce.MSG_END:switch(a){case Ae.NL:this.drop=0,this.as=r+1,this.state=Ce.OP_START;break;default:continue}break;case Ce.OP_PLUS:switch(a){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(a){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(a){case Ae.NL:this.dispatcher.push({kind:pn.OK}),this.drop=0,this.state=Ce.OP_START;break}break;case Ce.OP_MINUS:switch(a){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(a){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(a){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(a){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(a){case Ae.SPACE:case Ae.TAB:continue;default:this.state=Ce.MINUS_ERR_ARG,this.as=r}break;case Ce.MINUS_ERR_ARG:switch(a){case Ae.CR:this.drop=1;break;case Ae.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=n.subarray(this.as,r-this.drop),this.dispatcher.push({kind:pn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=Ce.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case Ce.OP_P:switch(a){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(a){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(a){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(a){case Ae.NL:this.dispatcher.push({kind:pn.PONG}),this.drop=0,this.state=Ce.OP_START;break}break;case Ce.OP_PI:switch(a){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(a){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(a){case Ae.NL:this.dispatcher.push({kind:pn.PING}),this.drop=0,this.state=Ce.OP_START;break}break;case Ce.OP_I:switch(a){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(a){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(a){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(a){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(a){case Ae.SPACE:case Ae.TAB:continue;default:this.state=Ce.INFO_ARG,this.as=r}break;case Ce.INFO_ARG:switch(a){case Ae.CR:this.drop=1;break;case Ae.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=n.subarray(this.as,r-this.drop),this.dispatcher.push({kind:pn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=Ce.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}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 xh(n.subarray(this.as,r-this.drop))),this.state===Ce.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new xh(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+r);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new xh(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Ae.SPACE:case Ae.TAB:case Ae.CR:case Ae.NL:a>=0&&(r.push(n.subarray(a,l)),a=-1);break;default:a<0&&(a=l)}switch(a>=0&&r.push(n.subarray(a)),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}: ${Hn.decode(n)}`)}processHeaderMsgArgs(n){const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Ae.SPACE:case Ae.TAB:case Ae.CR:case Ae.NL:a>=0&&(r.push(n.subarray(a,l)),a=-1);break;default:a<0&&(a=l)}switch(a>=0&&r.push(n.subarray(a)),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 a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;r=r*10+(n[a]-P2)}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(_,j){this.hi=_|0,this.lo=j|0},r=function(_){var j,T=new Float64Array(16);if(_)for(j=0;j<_.length;j++)T[j]=_[j];return T},a=function(){throw new Error("no PRNG")},l=new Uint8Array(16),u=new Uint8Array(32);u[0]=9;var c=r(),f=r([1]),m=r([56129,1]),d=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),b=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),w=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function k(_,j){return _<<j|_>>>32-j}function M(_,j){var T=_[j+3]&255;return T=T<<8|_[j+2]&255,T=T<<8|_[j+1]&255,T<<8|_[j+0]&255}function U(_,j){var T=_[j]<<24|_[j+1]<<16|_[j+2]<<8|_[j+3],L=_[j+4]<<24|_[j+5]<<16|_[j+6]<<8|_[j+7];return new n(T,L)}function O(_,j,T){var L;for(L=0;L<4;L++)_[j+L]=T&255,T>>>=8}function P(_,j,T){_[j]=T.hi>>24&255,_[j+1]=T.hi>>16&255,_[j+2]=T.hi>>8&255,_[j+3]=T.hi&255,_[j+4]=T.lo>>24&255,_[j+5]=T.lo>>16&255,_[j+6]=T.lo>>8&255,_[j+7]=T.lo&255}function q(_,j,T,L,I){var Q,de=0;for(Q=0;Q<I;Q++)de|=_[j+Q]^T[L+Q];return(1&de-1>>>8)-1}function oe(_,j,T,L){return q(_,j,T,L,16)}function B(_,j,T,L){return q(_,j,T,L,32)}function z(_,j,T,L,I){var Q=new Uint32Array(16),de=new Uint32Array(16),ye=new Uint32Array(16),ae=new Uint32Array(4),he,Oe,Ze;for(he=0;he<4;he++)de[5*he]=M(L,4*he),de[1+he]=M(T,4*he),de[6+he]=M(j,4*he),de[11+he]=M(T,16+4*he);for(he=0;he<16;he++)ye[he]=de[he];for(he=0;he<20;he++){for(Oe=0;Oe<4;Oe++){for(Ze=0;Ze<4;Ze++)ae[Ze]=de[(5*Oe+4*Ze)%16];for(ae[1]^=k(ae[0]+ae[3]|0,7),ae[2]^=k(ae[1]+ae[0]|0,9),ae[3]^=k(ae[2]+ae[1]|0,13),ae[0]^=k(ae[3]+ae[2]|0,18),Ze=0;Ze<4;Ze++)Q[4*Oe+(Oe+Ze)%4]=ae[Ze]}for(Ze=0;Ze<16;Ze++)de[Ze]=Q[Ze]}if(I){for(he=0;he<16;he++)de[he]=de[he]+ye[he]|0;for(he=0;he<4;he++)de[5*he]=de[5*he]-M(L,4*he)|0,de[6+he]=de[6+he]-M(j,4*he)|0;for(he=0;he<4;he++)O(_,4*he,de[5*he]),O(_,16+4*he,de[6+he])}else for(he=0;he<16;he++)O(_,4*he,de[he]+ye[he]|0)}function K(_,j,T,L){return z(_,j,T,L,!1),0}function F(_,j,T,L){return z(_,j,T,L,!0),0}var $=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function D(_,j,T,L,I,Q,de){var ye=new Uint8Array(16),ae=new Uint8Array(64),he,Oe;if(!I)return 0;for(Oe=0;Oe<16;Oe++)ye[Oe]=0;for(Oe=0;Oe<8;Oe++)ye[Oe]=Q[Oe];for(;I>=64;){for(K(ae,ye,de,$),Oe=0;Oe<64;Oe++)_[j+Oe]=(T?T[L+Oe]:0)^ae[Oe];for(he=1,Oe=8;Oe<16;Oe++)he=he+(ye[Oe]&255)|0,ye[Oe]=he&255,he>>>=8;I-=64,j+=64,T&&(L+=64)}if(I>0)for(K(ae,ye,de,$),Oe=0;Oe<I;Oe++)_[j+Oe]=(T?T[L+Oe]:0)^ae[Oe];return 0}function Y(_,j,T,L,I){return D(_,j,null,0,T,L,I)}function J(_,j,T,L,I){var Q=new Uint8Array(32);return F(Q,L,I,$),Y(_,j,T,L.subarray(16),Q)}function W(_,j,T,L,I,Q,de){var ye=new Uint8Array(32);return F(ye,Q,de,$),D(_,j,T,L,I,Q.subarray(16),ye)}function se(_,j){var T,L=0;for(T=0;T<17;T++)L=L+(_[T]+j[T]|0)|0,_[T]=L&255,L>>>=8}var ne=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function V(_,j,T,L,I,Q){var de,ye,ae,he,Oe=new Uint32Array(17),Ze=new Uint32Array(17),jt=new Uint32Array(17),un=new Uint32Array(17),ur=new Uint32Array(17);for(ae=0;ae<17;ae++)Ze[ae]=jt[ae]=0;for(ae=0;ae<16;ae++)Ze[ae]=Q[ae];for(Ze[3]&=15,Ze[4]&=252,Ze[7]&=15,Ze[8]&=252,Ze[11]&=15,Ze[12]&=252,Ze[15]&=15;I>0;){for(ae=0;ae<17;ae++)un[ae]=0;for(ae=0;ae<16&&ae<I;++ae)un[ae]=T[L+ae];for(un[ae]=1,L+=ae,I-=ae,se(jt,un),ye=0;ye<17;ye++)for(Oe[ye]=0,ae=0;ae<17;ae++)Oe[ye]=Oe[ye]+jt[ae]*(ae<=ye?Ze[ye-ae]:320*Ze[ye+17-ae]|0)|0|0;for(ye=0;ye<17;ye++)jt[ye]=Oe[ye];for(he=0,ae=0;ae<16;ae++)he=he+jt[ae]|0,jt[ae]=he&255,he>>>=8;for(he=he+jt[16]|0,jt[16]=he&3,he=5*(he>>>2)|0,ae=0;ae<16;ae++)he=he+jt[ae]|0,jt[ae]=he&255,he>>>=8;he=he+jt[16]|0,jt[16]=he}for(ae=0;ae<17;ae++)ur[ae]=jt[ae];for(se(jt,ne),de=-(jt[16]>>>7)|0,ae=0;ae<17;ae++)jt[ae]^=de&(ur[ae]^jt[ae]);for(ae=0;ae<16;ae++)un[ae]=Q[ae+16];for(un[16]=0,se(jt,un),ae=0;ae<16;ae++)_[j+ae]=jt[ae];return 0}function ie(_,j,T,L,I,Q){var de=new Uint8Array(16);return V(de,0,T,L,I,Q),oe(_,j,de,0)}function pe(_,j,T,L,I){var Q;if(T<32)return-1;for(W(_,0,j,0,T,L,I),V(_,16,_,32,T-32,_),Q=0;Q<16;Q++)_[Q]=0;return 0}function Ee(_,j,T,L,I){var Q,de=new Uint8Array(32);if(T<32||(J(de,0,32,L,I),ie(j,16,j,32,T-32,de)!==0))return-1;for(W(_,0,j,0,T,L,I),Q=0;Q<32;Q++)_[Q]=0;return 0}function E(_,j){var T;for(T=0;T<16;T++)_[T]=j[T]|0}function N(_){var j,T;for(T=0;T<16;T++)_[T]+=65536,j=Math.floor(_[T]/65536),_[(T+1)*(T<15?1:0)]+=j-1+37*(j-1)*(T===15?1:0),_[T]-=j*65536}function Z(_,j,T){for(var L,I=~(T-1),Q=0;Q<16;Q++)L=I&(_[Q]^j[Q]),_[Q]^=L,j[Q]^=L}function A(_,j){var T,L,I,Q=r(),de=r();for(T=0;T<16;T++)de[T]=j[T];for(N(de),N(de),N(de),L=0;L<2;L++){for(Q[0]=de[0]-65517,T=1;T<15;T++)Q[T]=de[T]-65535-(Q[T-1]>>16&1),Q[T-1]&=65535;Q[15]=de[15]-32767-(Q[14]>>16&1),I=Q[15]>>16&1,Q[14]&=65535,Z(de,Q,1-I)}for(T=0;T<16;T++)_[2*T]=de[T]&255,_[2*T+1]=de[T]>>8}function ve(_,j){var T=new Uint8Array(32),L=new Uint8Array(32);return A(T,_),A(L,j),B(T,0,L,0)}function Ne(_){var j=new Uint8Array(32);return A(j,_),j[0]&1}function Te(_,j){var T;for(T=0;T<16;T++)_[T]=j[2*T]+(j[2*T+1]<<8);_[15]&=32767}function Le(_,j,T){var L;for(L=0;L<16;L++)_[L]=j[L]+T[L]|0}function Ie(_,j,T){var L;for(L=0;L<16;L++)_[L]=j[L]-T[L]|0}function ge(_,j,T){var L,I,Q=new Float64Array(31);for(L=0;L<31;L++)Q[L]=0;for(L=0;L<16;L++)for(I=0;I<16;I++)Q[L+I]+=j[L]*T[I];for(L=0;L<15;L++)Q[L]+=38*Q[L+16];for(L=0;L<16;L++)_[L]=Q[L];N(_),N(_)}function ze(_,j){ge(_,j,j)}function Ke(_,j){var T=r(),L;for(L=0;L<16;L++)T[L]=j[L];for(L=253;L>=0;L--)ze(T,T),L!==2&&L!==4&&ge(T,T,j);for(L=0;L<16;L++)_[L]=T[L]}function pt(_,j){var T=r(),L;for(L=0;L<16;L++)T[L]=j[L];for(L=250;L>=0;L--)ze(T,T),L!==1&&ge(T,T,j);for(L=0;L<16;L++)_[L]=T[L]}function it(_,j,T){var L=new Uint8Array(32),I=new Float64Array(80),Q,de,ye=r(),ae=r(),he=r(),Oe=r(),Ze=r(),jt=r();for(de=0;de<31;de++)L[de]=j[de];for(L[31]=j[31]&127|64,L[0]&=248,Te(I,T),de=0;de<16;de++)ae[de]=I[de],Oe[de]=ye[de]=he[de]=0;for(ye[0]=Oe[0]=1,de=254;de>=0;--de)Q=L[de>>>3]>>>(de&7)&1,Z(ye,ae,Q),Z(he,Oe,Q),Le(Ze,ye,he),Ie(ye,ye,he),Le(he,ae,Oe),Ie(ae,ae,Oe),ze(Oe,Ze),ze(jt,ye),ge(ye,he,ye),ge(he,ae,Ze),Le(Ze,ye,he),Ie(ye,ye,he),ze(ae,ye),Ie(he,Oe,jt),ge(ye,he,m),Le(ye,ye,Oe),ge(he,he,ye),ge(ye,Oe,jt),ge(Oe,ae,I),ze(ae,Ze),Z(ye,ae,Q),Z(he,Oe,Q);for(de=0;de<16;de++)I[de+16]=ye[de],I[de+32]=he[de],I[de+48]=ae[de],I[de+64]=Oe[de];var un=I.subarray(32),ur=I.subarray(16);return Ke(un,un),ge(ur,ur,un),A(_,ur),0}function He(_,j){return it(_,j,u)}function xe(_,j){return a(j,32),He(_,j)}function ke(_,j,T){var L=new Uint8Array(32);return it(L,T,j),F(_,l,L,$)}var Me=pe,Qe=Ee;function Xe(_,j,T,L,I,Q){var de=new Uint8Array(32);return ke(de,I,Q),Me(_,j,T,L,de)}function Rt(_,j,T,L,I,Q){var de=new Uint8Array(32);return ke(de,I,Q),Qe(_,j,T,L,de)}function gt(){var _=0,j=0,T=0,L=0,I=65535,Q,de,ye;for(ye=0;ye<arguments.length;ye++)Q=arguments[ye].lo,de=arguments[ye].hi,_+=Q&I,j+=Q>>>16,T+=de&I,L+=de>>>16;return j+=_>>>16,T+=j>>>16,L+=T>>>16,new n(T&I|L<<16,_&I|j<<16)}function sr(_,j){return new n(_.hi>>>j,_.lo>>>j|_.hi<<32-j)}function yr(){var _=0,j=0,T;for(T=0;T<arguments.length;T++)_^=arguments[T].lo,j^=arguments[T].hi;return new n(j,_)}function xt(_,j){var T,L,I=32-j;return j<32?(T=_.hi>>>j|_.lo<<I,L=_.lo>>>j|_.hi<<I):j<64&&(T=_.lo>>>j|_.hi<<I,L=_.hi>>>j|_.lo<<I),new n(T,L)}function ni(_,j,T){var L=_.hi&j.hi^~_.hi&T.hi,I=_.lo&j.lo^~_.lo&T.lo;return new n(L,I)}function ue(_,j,T){var L=_.hi&j.hi^_.hi&T.hi^j.hi&T.hi,I=_.lo&j.lo^_.lo&T.lo^j.lo&T.lo;return new n(L,I)}function we(_){return yr(xt(_,28),xt(_,34),xt(_,39))}function Be(_){return yr(xt(_,14),xt(_,18),xt(_,41))}function Ge(_){return yr(xt(_,1),xt(_,8),sr(_,7))}function st(_){return yr(xt(_,19),xt(_,61),sr(_,6))}var Wt=[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 xn(_,j,T){var L=[],I=[],Q=[],de=[],ye,ae,he;for(ae=0;ae<8;ae++)L[ae]=Q[ae]=U(_,8*ae);for(var Oe=0;T>=128;){for(ae=0;ae<16;ae++)de[ae]=U(j,8*ae+Oe);for(ae=0;ae<80;ae++){for(he=0;he<8;he++)I[he]=Q[he];for(ye=gt(Q[7],Be(Q[4]),ni(Q[4],Q[5],Q[6]),Wt[ae],de[ae%16]),I[7]=gt(ye,we(Q[0]),ue(Q[0],Q[1],Q[2])),I[3]=gt(I[3],ye),he=0;he<8;he++)Q[(he+1)%8]=I[he];if(ae%16===15)for(he=0;he<16;he++)de[he]=gt(de[he],de[(he+9)%16],Ge(de[(he+1)%16]),st(de[(he+14)%16]))}for(ae=0;ae<8;ae++)Q[ae]=gt(Q[ae],L[ae]),L[ae]=Q[ae];Oe+=128,T-=128}for(ae=0;ae<8;ae++)P(_,8*ae,L[ae]);return T}var Yt=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 dt(_,j,T){var L=new Uint8Array(64),I=new Uint8Array(256),Q,de=T;for(Q=0;Q<64;Q++)L[Q]=Yt[Q];for(xn(L,j,T),T%=128,Q=0;Q<256;Q++)I[Q]=0;for(Q=0;Q<T;Q++)I[Q]=j[de-T+Q];for(I[T]=128,T=256-128*(T<112?1:0),I[T-9]=0,P(I,T-8,new n(de/536870912|0,de<<3)),xn(L,I,T),Q=0;Q<64;Q++)_[Q]=L[Q];return 0}function Ut(_,j){var T=r(),L=r(),I=r(),Q=r(),de=r(),ye=r(),ae=r(),he=r(),Oe=r();Ie(T,_[1],_[0]),Ie(Oe,j[1],j[0]),ge(T,T,Oe),Le(L,_[0],_[1]),Le(Oe,j[0],j[1]),ge(L,L,Oe),ge(I,_[3],j[3]),ge(I,I,y),ge(Q,_[2],j[2]),Le(Q,Q,Q),Ie(de,L,T),Ie(ye,Q,I),Le(ae,Q,I),Le(he,L,T),ge(_[0],de,ye),ge(_[1],he,ae),ge(_[2],ae,ye),ge(_[3],de,he)}function be(_,j,T){var L;for(L=0;L<4;L++)Z(_[L],j[L],T)}function $e(_,j){var T=r(),L=r(),I=r();Ke(I,j[2]),ge(T,j[0],I),ge(L,j[1],I),A(_,L),_[31]^=Ne(T)<<7}function ut(_,j,T){var L,I;for(E(_[0],c),E(_[1],f),E(_[2],f),E(_[3],c),I=255;I>=0;--I)L=T[I/8|0]>>(I&7)&1,be(_,j,L),Ut(j,_),Ut(_,_),be(_,j,L)}function $n(_,j){var T=[r(),r(),r(),r()];E(T[0],g),E(T[1],b),E(T[2],f),ge(T[3],g,b),ut(_,T,j)}function qt(_,j,T){var L=new Uint8Array(64),I=[r(),r(),r(),r()],Q;for(T||a(j,32),dt(L,j,32),L[0]&=248,L[31]&=127,L[31]|=64,$n(I,L),$e(_,I),Q=0;Q<32;Q++)j[Q+32]=_[Q];return 0}var Or=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 ri(_,j){var T,L,I,Q;for(L=63;L>=32;--L){for(T=0,I=L-32,Q=L-12;I<Q;++I)j[I]+=T-16*j[L]*Or[I-(L-32)],T=Math.floor((j[I]+128)/256),j[I]-=T*256;j[I]+=T,j[L]=0}for(T=0,I=0;I<32;I++)j[I]+=T-(j[31]>>4)*Or[I],T=j[I]>>8,j[I]&=255;for(I=0;I<32;I++)j[I]-=T*Or[I];for(L=0;L<32;L++)j[L+1]+=j[L]>>8,_[L]=j[L]&255}function lr(_){var j=new Float64Array(64),T;for(T=0;T<64;T++)j[T]=_[T];for(T=0;T<64;T++)_[T]=0;ri(_,j)}function qi(_,j,T,L){var I=new Uint8Array(64),Q=new Uint8Array(64),de=new Uint8Array(64),ye,ae,he=new Float64Array(64),Oe=[r(),r(),r(),r()];dt(I,L,32),I[0]&=248,I[31]&=127,I[31]|=64;var Ze=T+64;for(ye=0;ye<T;ye++)_[64+ye]=j[ye];for(ye=0;ye<32;ye++)_[32+ye]=I[32+ye];for(dt(de,_.subarray(32),T+32),lr(de),$n(Oe,de),$e(_,Oe),ye=32;ye<64;ye++)_[ye]=L[ye];for(dt(Q,_,T+64),lr(Q),ye=0;ye<64;ye++)he[ye]=0;for(ye=0;ye<32;ye++)he[ye]=de[ye];for(ye=0;ye<32;ye++)for(ae=0;ae<32;ae++)he[ye+ae]+=Q[ye]*I[ae];return ri(_.subarray(32),he),Ze}function Ii(_,j){var T=r(),L=r(),I=r(),Q=r(),de=r(),ye=r(),ae=r();return E(_[2],f),Te(_[1],j),ze(I,_[1]),ge(Q,I,d),Ie(I,I,_[2]),Le(Q,_[2],Q),ze(de,Q),ze(ye,de),ge(ae,ye,de),ge(T,ae,I),ge(T,T,Q),pt(T,T),ge(T,T,I),ge(T,T,Q),ge(T,T,Q),ge(_[0],T,Q),ze(L,_[0]),ge(L,L,Q),ve(L,I)&&ge(_[0],_[0],w),ze(L,_[0]),ge(L,L,Q),ve(L,I)?-1:(Ne(_[0])===j[31]>>7&&Ie(_[0],c,_[0]),ge(_[3],_[0],_[1]),0)}function vs(_,j,T,L){var I,Q=new Uint8Array(32),de=new Uint8Array(64),ye=[r(),r(),r(),r()],ae=[r(),r(),r(),r()];if(T<64||Ii(ae,L))return-1;for(I=0;I<T;I++)_[I]=j[I];for(I=0;I<32;I++)_[I+32]=L[I];if(dt(de,_,T),lr(de),ut(ye,ae,de),$n(ae,j.subarray(32)),Ut(ye,ae),$e(Q,ye),T-=64,B(j,0,Q,0)){for(I=0;I<T;I++)_[I]=0;return-1}for(I=0;I<T;I++)_[I]=j[I+64];return T}var pa=32,ii=24,or=32,ai=16,si=32,Fi=32,li=32,Rr=32,$i=32,ws=ii,Gl=or,br=ai,kt=64,Bt=32,jn=64,Yi=32,Ss=64;e.lowlevel={crypto_core_hsalsa20:F,crypto_stream_xor:W,crypto_stream:J,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:Y,crypto_onetimeauth:V,crypto_onetimeauth_verify:ie,crypto_verify_16:oe,crypto_verify_32:B,crypto_secretbox:pe,crypto_secretbox_open:Ee,crypto_scalarmult:it,crypto_scalarmult_base:He,crypto_box_beforenm:ke,crypto_box_afternm:Me,crypto_box:Xe,crypto_box_open:Rt,crypto_box_keypair:xe,crypto_hash:dt,crypto_sign:qi,crypto_sign_keypair:qt,crypto_sign_open:vs,crypto_secretbox_KEYBYTES:pa,crypto_secretbox_NONCEBYTES:ii,crypto_secretbox_ZEROBYTES:or,crypto_secretbox_BOXZEROBYTES:ai,crypto_scalarmult_BYTES:si,crypto_scalarmult_SCALARBYTES:Fi,crypto_box_PUBLICKEYBYTES:li,crypto_box_SECRETKEYBYTES:Rr,crypto_box_BEFORENMBYTES:$i,crypto_box_NONCEBYTES:ws,crypto_box_ZEROBYTES:Gl,crypto_box_BOXZEROBYTES:br,crypto_sign_BYTES:kt,crypto_sign_PUBLICKEYBYTES:Bt,crypto_sign_SECRETKEYBYTES:jn,crypto_sign_SEEDBYTES:Yi,crypto_hash_BYTES:Ss,gf:r,D:d,L:Or,pack25519:A,unpack25519:Te,M:ge,A:Le,S:ze,Z:Ie,pow2523:pt,add:Ut,set25519:E,modL:ri,scalarmult:ut,scalarbase:$n};function Vl(_,j){if(_.length!==pa)throw new Error("bad key size");if(j.length!==ii)throw new Error("bad nonce size")}function Jl(_,j){if(_.length!==li)throw new Error("bad public key size");if(j.length!==Rr)throw new Error("bad secret key size")}function Qt(){for(var _=0;_<arguments.length;_++)if(!(arguments[_]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ga(_){for(var j=0;j<_.length;j++)_[j]=0}e.randomBytes=function(_){var j=new Uint8Array(_);return a(j,_),j},e.secretbox=function(_,j,T){Qt(_,j,T),Vl(T,j);for(var L=new Uint8Array(or+_.length),I=new Uint8Array(L.length),Q=0;Q<_.length;Q++)L[Q+or]=_[Q];return pe(I,L,L.length,j,T),I.subarray(ai)},e.secretbox.open=function(_,j,T){Qt(_,j,T),Vl(T,j);for(var L=new Uint8Array(ai+_.length),I=new Uint8Array(L.length),Q=0;Q<_.length;Q++)L[Q+ai]=_[Q];return L.length<32||Ee(I,L,L.length,j,T)!==0?null:I.subarray(or)},e.secretbox.keyLength=pa,e.secretbox.nonceLength=ii,e.secretbox.overheadLength=ai,e.scalarMult=function(_,j){if(Qt(_,j),_.length!==Fi)throw new Error("bad n size");if(j.length!==si)throw new Error("bad p size");var T=new Uint8Array(si);return it(T,_,j),T},e.scalarMult.base=function(_){if(Qt(_),_.length!==Fi)throw new Error("bad n size");var j=new Uint8Array(si);return He(j,_),j},e.scalarMult.scalarLength=Fi,e.scalarMult.groupElementLength=si,e.box=function(_,j,T,L){var I=e.box.before(T,L);return e.secretbox(_,j,I)},e.box.before=function(_,j){Qt(_,j),Jl(_,j);var T=new Uint8Array($i);return ke(T,_,j),T},e.box.after=e.secretbox,e.box.open=function(_,j,T,L){var I=e.box.before(T,L);return e.secretbox.open(_,j,I)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var _=new Uint8Array(li),j=new Uint8Array(Rr);return xe(_,j),{publicKey:_,secretKey:j}},e.box.keyPair.fromSecretKey=function(_){if(Qt(_),_.length!==Rr)throw new Error("bad secret key size");var j=new Uint8Array(li);return He(j,_),{publicKey:j,secretKey:new Uint8Array(_)}},e.box.publicKeyLength=li,e.box.secretKeyLength=Rr,e.box.sharedKeyLength=$i,e.box.nonceLength=ws,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(_,j){if(Qt(_,j),j.length!==jn)throw new Error("bad secret key size");var T=new Uint8Array(kt+_.length);return qi(T,_,_.length,j),T},e.sign.open=function(_,j){if(Qt(_,j),j.length!==Bt)throw new Error("bad public key size");var T=new Uint8Array(_.length),L=vs(T,_,_.length,j);if(L<0)return null;for(var I=new Uint8Array(L),Q=0;Q<I.length;Q++)I[Q]=T[Q];return I},e.sign.detached=function(_,j){for(var T=e.sign(_,j),L=new Uint8Array(kt),I=0;I<L.length;I++)L[I]=T[I];return L},e.sign.detached.verify=function(_,j,T){if(Qt(_,j,T),j.length!==kt)throw new Error("bad signature size");if(T.length!==Bt)throw new Error("bad public key size");var L=new Uint8Array(kt+_.length),I=new Uint8Array(kt+_.length),Q;for(Q=0;Q<kt;Q++)L[Q]=j[Q];for(Q=0;Q<_.length;Q++)L[Q+kt]=_[Q];return vs(I,L,L.length,T)>=0},e.sign.keyPair=function(){var _=new Uint8Array(Bt),j=new Uint8Array(jn);return qt(_,j),{publicKey:_,secretKey:j}},e.sign.keyPair.fromSecretKey=function(_){if(Qt(_),_.length!==jn)throw new Error("bad secret key size");for(var j=new Uint8Array(Bt),T=0;T<j.length;T++)j[T]=_[32+T];return{publicKey:j,secretKey:new Uint8Array(_)}},e.sign.keyPair.fromSeed=function(_){if(Qt(_),_.length!==Yi)throw new Error("bad seed size");for(var j=new Uint8Array(Bt),T=new Uint8Array(jn),L=0;L<32;L++)T[L]=_[L];return qt(j,T,!0),{publicKey:j,secretKey:T}},e.sign.publicKeyLength=Bt,e.sign.secretKeyLength=jn,e.sign.seedLength=Yi,e.sign.signatureLength=kt,e.hash=function(_){Qt(_);var j=new Uint8Array(Ss);return dt(j,_,_.length),j},e.hash.hashLength=Ss,e.verify=function(_,j){return Qt(_,j),_.length===0||j.length===0||_.length!==j.length?!1:q(_,0,j,0,_.length)===0},e.setPRNG=function(_){a=_},(function(){var _=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(_&&_.getRandomValues){var j=65536;e.setPRNG(function(T,L){var I,Q=new Uint8Array(L);for(I=0;I<L;I+=j)_.getRandomValues(Q.subarray(I,I+Math.min(L-I,j)));for(I=0;I<L;I++)T[I]=Q[I];ga(Q)})}else typeof require<"u"&&(_=require("crypto"),_&&_.randomBytes&&e.setPRNG(function(T,L){var I,Q=_.randomBytes(L);for(I=0;I<L;I++)T[I]=Q[I];ga(Q)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const uu=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,H2={fromSeed:uu.sign.keyPair.fromSeed,sign:uu.sign.detached,verify:uu.sign.detached.verify,randomBytes:uu.randomBytes};let px;function q2(e){px=e}function Ri(){return px}const I2=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 a=0;a<n.byteLength;a++){let l=n[a];r=r<<8&65535^I2[(r>>8^l)&255]}return r}static validate(n,r){return Nu.checksum(n)==r}}const vh="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class E0{static encode(n){let r=0,a=0,l=new Uint8Array(n),u=new Uint8Array(n.byteLength*2),c=0;for(let f=0;f<l.byteLength;f++)for(a=a<<8|l[f],r+=8;r>=5;){let m=a>>>r-5&31;u[c++]=vh.charAt(m).charCodeAt(0),r-=5}if(r>0){let f=a<<5-r&31;u[c++]=vh.charAt(f).charCodeAt(0)}return u.slice(0,c)}static decode(n){let r=0,a=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=vh.indexOf(m);if(d===-1)throw new Error("Illegal Base32 character: "+u[f]);a=a<<5|d,r+=5,r>=8&&(c[l++]=a>>>r-8&255,r-=8)}return c.slice(0,l)}}class Et extends Error{constructor(r,a){super(r);C(this,"name");C(this,"code");C(this,"chainedError");this.name="NKeysError",this.code=r,this.chainedError=a}}function F2(){return Fu(_t.Operator)}function $2(){return Fu(_t.Account)}function Y2(){return Fu(_t.User)}var mt;(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"})(mt||(mt={}));var _t;(function(e){e[e.Seed=144]="Seed",e[e.Private=120]="Private",e[e.Operator=112]="Operator",e[e.Server=104]="Server",e[e.Cluster=16]="Cluster",e[e.Account=0]="Account",e[e.User=160]="User"})(_t||(_t={}));class ns{static isValidPublicPrefix(n){return n==_t.Server||n==_t.Operator||n==_t.Cluster||n==_t.Account||n==_t.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 _t.Seed:return _t.Seed;case _t.Private:return _t.Private;case _t.Operator:return _t.Operator;case _t.Server:return _t.Server;case _t.Cluster:return _t.Cluster;case _t.Account:return _t.Account;case _t.User:return _t.User;default:return-1}}}class gn{static encode(n,r){if(!r||!(r instanceof Uint8Array))throw new Et(mt.SerializationError);if(!ns.isValidPrefix(n))throw new Et(mt.InvalidPrefixByte);return gn._encode(!1,n,r)}static encodeSeed(n,r){if(!r)throw new Et(mt.ApiError);if(!ns.isValidPublicPrefix(n))throw new Et(mt.InvalidPrefixByte);if(r.byteLength!==32)throw new Et(mt.InvalidSeedLen);return gn._encode(!0,n,r)}static decode(n,r){if(!ns.isValidPrefix(n))throw new Et(mt.InvalidPrefixByte);const a=gn._decode(r);if(a[0]!==n)throw new Et(mt.InvalidPrefixByte);return a.slice(1)}static decodeSeed(n){const r=gn._decode(n),a=gn._decodePrefix(r);if(a[0]!=_t.Seed)throw new Et(mt.InvalidSeed);if(!ns.isValidPublicPrefix(a[1]))throw new Et(mt.InvalidPrefixByte);return{buf:r.slice(2),prefix:a[1]}}static _encode(n,r,a){const l=n?2:1,u=a.byteLength,c=l+u+2,f=l+u,m=new Uint8Array(c);if(n){const g=gn._encodePrefix(_t.Seed,r);m.set(g)}else m[0]=r;m.set(a,l);const d=Nu.checksum(m.slice(0,f));return new DataView(m.buffer).setUint16(f,d,!0),E0.encode(m)}static _decode(n){if(n.byteLength<4)throw new Et(mt.InvalidEncoding);let r;try{r=E0.decode(n)}catch(f){throw new Et(mt.InvalidEncoding,f)}const a=r.byteLength-2,u=new DataView(r.buffer).getUint16(a,!0),c=r.slice(0,a);if(!Nu.validate(c,u))throw new Et(mt.InvalidChecksum);return c}static _encodePrefix(n,r){const a=n|r>>5,l=(r&31)<<3;return new Uint8Array([a,l])}static _decodePrefix(n){const r=n[0]&248,a=(n[0]&7)<<5|(n[1]&248)>>3;return new Uint8Array([r,a])}}class gx{constructor(n){C(this,"seed");this.seed=n}getRawSeed(){if(!this.seed)throw new Et(mt.ClearedPair);return gn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Et(mt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Et(mt.ClearedPair);const n=gn.decodeSeed(this.seed),r=Ri().fromSeed(this.getRawSeed()),a=gn.encode(n.prefix,r.publicKey);return new TextDecoder().decode(a)}getPrivateKey(){if(!this.seed)throw new Et(mt.ClearedPair);const n=Ri().fromSeed(this.getRawSeed());return gn.encode(_t.Private,n.secretKey)}sign(n){if(!this.seed)throw new Et(mt.ClearedPair);const r=Ri().fromSeed(this.getRawSeed());return Ri().sign(n,r.secretKey)}verify(n,r){if(!this.seed)throw new Et(mt.ClearedPair);const a=Ri().fromSeed(this.getRawSeed());return Ri().verify(n,r,a.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Fu(e){const n=Ri().randomBytes(32);let r=gn.encodeSeed(e,new Uint8Array(n));return new gx(r)}class G2{constructor(n){C(this,"publicKey");this.publicKey=n}getPublicKey(){if(!this.publicKey)throw new Et(mt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Et(mt.PublicKeyOnly):new Et(mt.ClearedPair)}getSeed(){throw this.publicKey?new Et(mt.PublicKeyOnly):new Et(mt.ClearedPair)}sign(n){throw this.publicKey?new Et(mt.CannotSign):new Et(mt.ClearedPair)}verify(n,r){if(!this.publicKey)throw new Et(mt.ClearedPair);let a=gn._decode(this.publicKey);return Ri().verify(n,r,a.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function V2(e){const n=new TextEncoder().encode(e),r=gn._decode(n),a=ns.parsePrefix(r[0]);if(ns.isValidPublicPrefix(a))return new G2(n);throw new Et(mt.InvalidPublicKey)}function J2(e){return gn.decodeSeed(e),new gx(e)}function X2(e){return btoa(String.fromCharCode(...e))}function K2(e){const n=atob(e),r=new Uint8Array(n.length);for(let a=0;a<n.length;a++)r[a]=n.charCodeAt(a);return r}q2(H2);const k0={createAccount:$2,createOperator:F2,createPair:Fu,createUser:Y2,fromPublic:V2,fromSeed:J2,NKeysError:Et,NKeysErrorCode:mt,Prefix:_t,decode:K2,encode:X2};function Q2(e){return n=>{let r={};return e.forEach(a=>{const l=a(n)||{};r=Object.assign(r,l)}),r}}function Z2(){return()=>{}}function W2(e,n){return()=>{const r=typeof e=="function"?e():e,a=typeof n=="function"?n():n;return{user:r,pass:a}}}function eE(e){return()=>({auth_token:typeof e=="function"?e():e})}function tE(e){return n=>{const r=typeof e=="function"?e():e,a=r?k0.fromSeed(r):void 0,l=a?a.getPublicKey():"",u=Pi.encode(n||""),c=a!==void 0&&n?a.sign(u):void 0,f=c?k0.encode(c):"";return{nkey:l,sig:f}}}function yx(e,n){return r=>{const a=typeof e=="function"?e():e,l=tE(n),{nkey:u,sig:c}=l(r);return{jwt:a,nkey:u,sig:c}}}const bx=120*1e3,nE=2,xx=2*1e3;function rE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:bx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:xx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function iE(e){const n=[];return typeof e.authenticator=="function"&&n.push(e.authenticator),Array.isArray(e.authenticator)&&n.push(...e.authenticator),e.token&&n.push(eE(e.token)),e.user&&n.push(W2(e.user,e.pass)),n.length===0?Z2():Q2(n)}function aE(e){const n=`${Wh}:${hx()}`;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",_e.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${Wh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[n]);const r=Hu(rE(),e);if(r.authenticator=iE(r),["reconnectDelayHandler","authenticator"].forEach(a=>{if(r[a]&&typeof r[a]!="function")throw new je(`${a} option should be a function`,_e.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let a=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),r.reconnectTimeWait+a}),r.inboxPrefix)try{Zr(r.inboxPrefix)}catch(a){throw new je(a.message,_e.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof sd()=="function"),r.resolve&&typeof sd()!="function")throw new je("'resolve' is not supported on this client",_e.InvalidOption);return r}function sE(e,n){const{proto:r,tls_required:a,tls_available:l}=e;if((r===void 0||r<1)&&n.noEcho)throw new je("noEcho",_e.ServerOptionNotAvailable);const u=a||l||!1;if(n.tls&&!u)throw new je("tls",_e.ServerOptionNotAvailable)}const lE=1024*32,oE=/^INFO\s+([^\r\n]+)\r\n/i,uE=_l(`PONG\r
72
+ `),C0=_l(`PING\r
73
+ `);class cE{constructor(n,r,a){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(a):{})||{};Hu(this,l)}}class vx extends rn{constructor(r,a,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");Hu(this,l),this.protocol=r,this.subject=a,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Lt();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=cs(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 a=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)&&(a(f,m),c(m))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,a){this.cancelTimeout(),r?this.stop(r):this.push(a)}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(_e.ConnectionClosed)):this.isClosed()?Promise.reject(je.errorForCode(_e.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Lt()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class fE{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,a=this.all();let l;if(r.operation==="subscription"&&(l=a.find(u=>u.subject===r.subject&&u.queue===r.queue)),r.operation==="publish"&&(l=a.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 Ou{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=lE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=r,this.subscriptions=new fE,this.muxSubscriptions=new L2,this.outbound=new hs,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new p2({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new D2(a,{randomize:!n.noRandomize}),this.closed=Lt(),this.parser=new _0(this),this.heartbeats=new z2(this,this.options.pingInterval||bx,this.options.maxPingOut||nE)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const r=je.errorForCode(_e.Disconnect);r.stack="",n.forEach(a=>{a.reject(r)}),this.parser=new _0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(r=>{r.push(n)})}status(){const n=new rn;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=Lt();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=r=>{n.reject(r)},this.transport=b2(),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:rs.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:rs.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:Qr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:Qr.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===_e.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(n)}async dial(n){const r=this.prepare();let a;try{a=cs(this.options.timeout||2e4);const l=this.transport.connect(n,this.options);await Promise.race([l,a]),(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([a,r]),a&&a.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 a&&a.cancel(),await this.transport.close(l),l}}async _doDial(n){const{resolve:r}=this.options,a=await n.resolve({fn:sd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of a)try{l=null,this.dispatchStatus({type:rs.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():xx;let a=r;const l=this.selectServer();if(!l||this.abortReconnect)throw n||(this.lastError?this.lastError:je.errorForCode(_e.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 a=Math.min(a,l.lastConnect+r-u),await ys(a)}}static async connect(n,r){const a=new Ou(n,r);return await a.dialLoop(),a}static toError(n){const r=n?n.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const a=new je(n,_e.PermissionsViolation),l=n.match(/(Publish|Subscription) to "(\S+)"/);if(l){a.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const u=n.match(/using queue "(\S+)"/);u&&(a.permissionContext.queue=u[1])}return a}else return r.indexOf("authorization violation")!==-1?new je(n,_e.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new je(n,_e.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new je(n,_e.AccountExpired):r.indexOf("authentication timeout")!==-1?new je(n,_e.AuthenticationTimeout):new je(n,_e.ProtocolError)}processMsg(n,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new Dd(n,r,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const r=o0(n),a=Ou.toError(r),l={type:Qr.Error,data:a.code};if(a.isPermissionError()){let u=!1;if(a.permissionContext){l.permissionContext=a.permissionContext;const c=this.subscriptions.getMux();u=(c==null?void 0:c.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(u,a),u&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(a)}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(uE)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const r=JSON.parse(o0(n));this.info=r;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(ca(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new cE({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}${bu}`)),this.transport.send(C0)}catch(f){this._close(f)}}a&&this.dispatchStatus({type:Qr.Update,data:a}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:Qr.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case pn.MSG:{const{msg:r,data:a}=n;this.processMsg(r,a);break}case pn.OK:break;case pn.ERR:this.processError(n.data);break;case pn.PING:this.processPing();break;case pn.PONG:this.processPong();break;case pn.INFO:this.processInfo(n.data);break}}sendCommand(n,...r){const a=this.outbound.length();let l;typeof n=="string"?l=_l(n):l=n,this.outbound.fill(l,...r),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,r=Fn,a){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Pi.encode(r);else throw je.errorForCode(_e.BadPayload);let u=l.length;a=a||{},a.reply=a.reply||"";let c=Fn,f=0;if(a.headers){if(this.info&&!this.info.headers)throw new je("headers",_e.ServerOptionNotAvailable);c=a.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw je.errorForCode(_e.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let m;a.headers?(a.reply?m=`HPUB ${n} ${a.reply} ${f} ${u}\r
74
+ `:m=`HPUB ${n} ${f} ${u}\r
75
+ `,this.sendCommand(m,c,l,ju)):(a.reply?m=`PUB ${n} ${a.reply} ${u}\r
76
+ `:m=`PUB ${n} ${u}\r
77
+ `,this.sendCommand(m,l,ju))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
78
+ `):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
79
+ `)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,r){this.unsub(n,r),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,r){!n||this.isClosed()||(r?this.sendCommand(`UNSUB ${n.sid} ${r}\r
80
+ `):this.sendCommand(`UNSUB ${n.sid}\r
81
+ `),n.max=r)}resub(n,r){!n||this.isClosed()||(this.unsub(n),n.subject=r,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=Lt()),this.pongs.push(n),this.outbound.fill(C0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(r=>{const a=r;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${bu}`):n.push(`SUB ${a.subject} ${a.sid}${bu}`)}),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(a=>{r.push(a.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),a=new vx(this,`${r}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const hE="$SRV";class A0{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,a,l){var u,c;return l=l||{},l.headers=l.headers||ei(),(u=l.headers)==null||u.set(Eu,`${n}`),(c=l.headers)==null||c.set(_u,r),this.msg.respond(a,l)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Rl{constructor(n,r="",a=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&mE("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,a===""&&u.queue!==""&&(a=u.queue),l=u.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=a}calcSubject(n,r=""){return r===""?n:n!==""?`${n}.${r}`:r}addEndpoint(n="",r){r=r||{subject:n};const a=typeof r=="function"?{handler:r,subject:n}:r;wl("endpoint",n);let{subject:l,handler:u,metadata:c,queue:f}=a;l=l||n,f=f||this.queue,dE("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 dE(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((a,l)=>{if(a===">"&&l!==r.length-1)throw new Error(`${e} cannot have internal '>': '${n}'`)})}function mE(e,n){if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")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),ca(this.config.version),this._id=Ui.next(),this.internal=[],this._done=Lt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,r="",a="",l){const u=l??hE;return r===""&&a===""?`${u}.${n}`:(wl("control subject name",r),a!==""?(wl("control subject id",a),`${u}.${n}.${r}.${a}`):`${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=ei();if(n instanceof ku){const a=n;r.set(_u,a.message),r.set(Eu,`${a.code}`)}else r.set(_u,n.message),r.set(Eu,"500");return r}setupHandler(n,r=!1){const a=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 pE(l,u,a),f.queue=a;const m=c?(d,y)=>{if(d){this.close(d);return}const g=Date.now();try{c(d,new A0(y))}catch(b){f.stats.countError(b),y==null||y.respond(Fn,{headers:this.errorToHeader(b)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(u,{callback:m,queue:a}),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:a,name:l,queue:u}=n;return{subject:r,metadata:a,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(a){r.stats.countError(a)}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 a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,r),this._doAddInternalHandler(`${a}-kind`,n,r,this.name),this._doAddInternalHandler(`${a}`,n,r,this.name,this.id)}_doAddInternalHandler(n,r,a,l="",u=""){const c={};c.name=n,c.subject=Il.controlSubject(r,l,u),c.handler=a,this.setupHandler(c,!0)}start(){const n=pr(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(m=>(f==null||f.respond(n.encode(m)),Promise.resolve())),a=(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(Di.PING,u),this.addInternalHandler(Di.STATS,r),this.addInternalHandler(Di.INFO,a),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(a=>a.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 rn;r.noIterator=typeof n.handler=="function",r.noIterator||(n.handler=(l,u)=>{l?this.stop(l).catch():r.push(new A0(u))},r.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=r,this.handlers.push(a),r}}class pE{constructor(n,r,a=""){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=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const r=n;r&&(r.time=0,r.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=Dt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:r,average_processing_time:a,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:a,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue_group:d}}stats(n){const r=n;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=Dt(r.time),this.num_requests=r.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class gE{constructor(n,r={strategy:mr.JitterTimer,maxWait:2e3},a){C(this,"nc");C(this,"prefix");C(this,"opts");this.nc=n,this.prefix=a,this.opts=r}ping(n="",r=""){return this.q(Di.PING,n,r)}stats(n="",r=""){return this.q(Di.STATS,n,r)}info(n="",r=""){return this.q(Di.INFO,n,r)}async q(n,r="",a=""){const l=new rn,u=pr(),c=Il.controlSubject(n,r,a,this.prefix),f=await this.nc.requestMany(c,Fn,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 wx(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function yE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:wx(),storage:rd.File}}const Ru="KV-Operation",T0="$KV",bE=/^[-/=.\w]+$/,xE=/^[-/=.>*\w]+$/,vE=/^[-\w]+$/;function wE(e){if(e.startsWith(".")||e.endsWith(".")||!bE.test(e))throw new Error(`invalid key: ${e}`)}function SE(e){if(e.startsWith(".")||e.endsWith(".")||!xE.test(e))throw new Error(`invalid key: ${e}`)}function _E(e){if(e.startsWith(".")||e.endsWith("."))throw new Error(`invalid key: ${e}`);const n=e.split(".");let r=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":r=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${e}`);r=!0;break}return r}function xu(e){if(!vE.test(e))throw new Error(`invalid bucket name: ${e}`)}var Er;(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"})(Er||(Er={}));class Ml{constructor(n,r,a){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",wE);C(this,"validateSearchKey",SE);C(this,"hasWildcards",_E);xu(n),this.js=r,this.jsm=a,this.bucket=n,this.prefix=T0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,r,a={}){xu(r);const l=await n.jetstreamManager(),u=new Ml(r,n,l);return await u.init(a),u}static async bind(n,r,a={}){const l=await n.jetstreamManager(),u={config:{allow_direct:a.allow_direct}};xu(r);const c=new Ml(r,n,l);return u.config.name=a.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=a.codec||wx(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(n={}){const r=Object.assign(yE(),n);this.codec=r.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=nd.Limits,a.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(a.max_bytes=r.max_bytes),a.max_msg_size=r.maxValueSize,a.storage=r.storage;const l=n.placementCluster??"";if(l&&(n.placement={},n.placement.cluster=l,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const g=Object.assign({},n.mirror);g.name.startsWith(Pn)||(g.name=`${Pn}${g.name}`),a.mirror=g,a.mirror_direct=!0}else if(n.sources){const g=n.sources.map(b=>{const w=Object.assign({},b),k=w.name.startsWith(Pn)?w.name.substring(Pn.length):w.name;return w.name.startsWith(Pn)||(w.name=`${Pn}${w.name}`),!b.external&&k!==this.bucket&&(w.subject_transforms=[{src:`$KV.${k}.>`,dest:`$KV.${this.bucket}.>`}]),w});a.sources=g,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Bi.S2:Bi.None);const u=this.js.nc,c=u.getServerVersion(),f=c?ad(c,ca("2.7.2"))>=0:!1;a.discard=f?Ol.New:Ol.Old;const{ok:m,min:d}=u.features.get(ot.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,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=r.replicas,r.ttl&&(a.max_age=Dt(r.ttl)),a.allow_rollup_hdrs=!0;let y;try{y=await this.jsm.streams.info(a.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(a);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 a=r.name;if(a.startsWith(Pn)&&(a=a.substring(Pn.length)),r.external&&r.external.api!==""){const l=r.name.substring(Pn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Pn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,r=!1){const a=[];return r?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${T0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const r=[];for(const a of n.split("."))switch(a){case">":case"*":r.push(a);break;default:r.push(this.codec.key.encode(a));break}return r.join(".")}decodeKey(n){const r=[];for(const a of n.split("."))switch(a){case">":case"*":r.push(a);break;default:r.push(this.codec.key.decode(a));break}return r.join(".")}close(){return Promise.resolve()}dataLen(n,r){const a=r&&r.get(bn.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new BE(this.bucket,this.prefixLen,n)}jmToEntry(n){const r=this.decodeKey(n.subject.substring(this.prefixLen));return new PE(this.bucket,r,n)}async create(n,r){var u;let a;try{const c=await this.put(n,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(a=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(a)}catch(c){return Promise.reject(c)}}update(n,r,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,r,{previousSeq:a})}async put(n,r,a={}){var c,f;const l=this.encodeKey(n);this.validateKey(l);const u={};if(a.previousSeq!==void 0){const m=ei();u.headers=m,m.set(Er.ExpectedLastSubjectSequenceHdr,`${a.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 a=this.encodeKey(n);this.validateKey(a);let l={last_by_subj:this.subjectForKey(a)};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!==a?null:c}catch(c){if(c.code===_e.JetStream404NoMessages)return null;throw c}}purge(n,r){return this._deleteOrPurge(n,"PURGE",r)}delete(n,r){return this._deleteOrPurge(n,"DEL",r)}async purgeDeletes(n=1800*1e3){const r=Lt(),a=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const m of l)(m.operation==="DEL"||m.operation==="PURGE")&&a.push(m)})().then(),await r,l.stop();const u=Date.now()-n,c=a.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,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,r,a);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,a){const l=this.encodeKey(n);this.validateKey(l);const u=ei();u.set(Ru,r),r==="PURGE"&&u.set(bn.RollupHdr,bn.RollupValueSubject),a!=null&&a.previousSeq&&u.set(Er.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),Fn,{headers:u})}_buildCC(n,r,a={}){let u=(Array.isArray(n)?n:[n]).map(m=>{const d=this.encodeKey(m);return this.validateSearchKey(m),this.fullKeyName(d)}),c=$t.LastPerSubject;r===dr.AllHistory&&(c=$t.All),r===dr.UpdatesOnly&&(c=$t.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:nn.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:Dt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const r=n.key??">",a=new rn,l={};l.headers_only=n.headers_only||!1;let u;u=()=>{a.stop()};let c=0;const f=this._buildCC(r,dr.AllHistory,l),m=f.filter_subject,d=zi(f);d.bindStream(this.stream),d.orderedConsumer(),d.callback((g,b)=>{if(g){a.stop(g);return}if(b){const w=this.jmToEntry(b);a.push(w),a.received++,(u&&c>0&&a.received>=c||b.info.pending===0)&&(a.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||a.received>=b)try{u()}catch(w){a.stop(w)}finally{u=void 0}else c=b}return a._data=y,a.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}canSetWatcherName(){const r=this.js.nc,{ok:a}=r.features.get(ot.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const r=n.key??">",a=new rn,l={};l.headers_only=n.headers_only||!1;let u=dr.LastValue;n.include===dr.AllHistory?u=dr.AllHistory:n.include===dr.UpdatesOnly&&(u=dr.UpdatesOnly);const c=n.ignoreDeletes===!0;let f=n.initializedFn,m=0;const d=this._buildCC(r,u,l),y=d.filter_subject,g=zi(d);this.canSetWatcherName()&&g.consumerName(Ui.next()),g.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&g.startSequence(n.resumeFromRevision),g.orderedConsumer(),g.callback((w,k)=>{if(w){a.stop(w);return}if(k){const M=this.jmToEntry(k);if(c&&M.operation==="DEL")return;a.push(M),a.received++,f&&(m>0&&a.received>=m||k.info.pending===0)&&(a.push(f),f=void 0)}});const b=await this.js.subscribe(y,g);if(f){const{info:{last:w}}=b,k=w.num_pending+w.delivered.consumer_seq;if(k===0||a.received>=k)try{f()}catch(M){a.stop(M)}finally{f=void 0}else m=k}return a._data=b,a.iterClosed.then(()=>{b.unsubscribe()}),b.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}async keys(n=">"){const r=new rn,a=this._buildCC(n,dr.LastValue,{headers_only:!0}),l=Array.isArray(n)?">":a.filter_subject,u=zi(a);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(Ru);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)??"",a=this.bucketName(),l=await this.jsm.streams.info(a);return new Sx(l,r)}}class Sx{constructor(n,r=""){C(this,"si");C(this,"cluster");this.si=n,this.cluster=r}get bucket(){return this.si.config.name.startsWith(Pn)?this.si.config.name.substring(Pn.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 Md(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!==Bi.None:!1}}const zd="OBJ_",j0="SHA-256=";function EE(e){return xu(e),`${zd}${e}`}function kE(e){return e.startsWith(zd)?e.substring(4):e}class ud{constructor(n){C(this,"si");C(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return kE(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!==Bi.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 tr;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(tr||(tr={}));var kr;(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"})(kr||(kr={}));var ls;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(ls||(ls={}));const N0=Uint8Array.of(43,65,67,75),CE=Uint8Array.of(45,78,65,75),ml=Uint8Array.of(43,87,80,73),AE=Uint8Array.of(43,78,88,84),TE=Uint8Array.of(43,84,69,82,77),jE=Uint8Array.of(32);function Dl(e,n=5e3){return new GE(e,n)}class wh extends rn{constructor(r,a,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=a;this.opts=this.parseOptions(a,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=Zr(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:a,idle_heartbeat:l,threshold_bytes:u,threshold_messages:c}=this.opts;this.closed().then(m=>{if(this.cleanupHandler)try{this.cleanupHandler(m)}catch{}});const{sub:f}=this;f&&f.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(m,d)=>{var g,b,w,k;if(m){this.stop(m);return}if((g=this.monitor)==null||g.work(),d.subject===this.inbox){if(td(d))return;const M=(b=d.headers)==null?void 0:b.code,U=((k=(w=d.headers)==null?void 0:w.description)==null?void 0:k.toLowerCase())||"unknown",{msgsLeft:O,bytesLeft:P}=this.parseDiscard(d.headers);if(O>0||P>0)this.pending.msgs-=O,this.pending.bytes-=P,this.pending.requests--,this.notify(ls.Discard,{msgsLeft:O,bytesLeft:P});else if(M===400){this.stop(new je(U,`${M}`));return}else if(M===409&&U==="consumer deleted"){if(this.notify(kr.ConsumerDeleted,`${M} ${U}`),!this.refilling||this.abortOnMissingResource){const q=new je(U,`${M}`);this.stop(q);return}}else if(M===503){if(this.notify(kr.NoResponders,`${M} No Responders`),!this.refilling||this.abortOnMissingResource){const q=new je("no responders",`${M}`);this.stop(q);return}}else this.notify(ls.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||a&&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 Ld(l,m=>(this.notify(kr.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 Qr.Disconnect:(d=this.monitor)==null||d.cancel();break;case Qr.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 a=typeof r=="function"?r:null;try{a?a():this.callback(r)}catch(l){this.stop(l)}}}notify(r,a){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:a})})}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,a=0;const l=Rd([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(a++,this.notify(kr.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(kr.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,a=0;this.inBackOff=!0;const f=l.backoff(u),m=ys(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 a=this.consumer.api.nc;this._push(()=>{a.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(ls.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,l=Dt(this.opts.idle_heartbeat),u=Dt(this.opts.expires);return{batch:r,max_bytes:a,idle_heartbeat:l,expires:u}}parseDiscard(r){const a={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(bn.PendingMessagesHdr);l&&(a.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(bn.PendingBytesHdr);return u&&(a.bytesLeft=parseInt(u)),a}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,a;(r=this.monitor)==null||r.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var a,l;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(u=>{u.stop()})}))}parseOptions(r,a=!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,a){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 rn;return this.listeners.push(r),Promise.resolve(r)}}class NE extends rn{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(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const l of a)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,a){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:a})})}stop(r){var a;this.done||((a=this.src)==null||a.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 rn;return this.listeners.push(r),Promise.resolve(r)}}class cd{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 wh(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const r=new wh(this,n,!1),a=Math.round(r.opts.expires*1.05),l=cs(a);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(n={expires:3e4}){const r=Lt(),a=n;a.max_messages=1;const l=new wh(this,a,!1),u=Math.round(l.opts.expires*1.05);u>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===kr.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=cs(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:a}=this._info;return this.api.info(r,a).then(l=>(this._info=l,this._info))}}class OE{constructor(n,r,a={}){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=Ui.next(),typeof a.name_prefix=="string"&&(qu("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=tr.Unset,this.consumerOpts=a,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 a={name:r,deliver_policy:$t.StartSequence,opt_start_seq:n,ack_policy:nn.None,inactive_threshold:Dt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||$t.StartSequence,(this.consumerOpts.deliver_policy===$t.LastPerSubject||this.consumerOpts.deliver_policy===$t.New||this.consumerOpts.deliver_policy===$t.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===$t.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=$t.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=Dt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var c,f,m,d,y;Ui.next();const r=this.serial===0;(c=this.consumer)==null||c.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const l=Rd([((f=this.opts)==null?void 0:f.expires)||3e4]);let u;for(let g=0;;g++)try{u=await this.api.add(this.stream,a),(m=this.iter)==null||m.notify(kr.OrderedConsumerRecreated,u.name);break}catch(b){if(b.message==="stream not found"&&((d=this.iter)==null||d.notify(kr.StreamNotFound,g),this.type===tr.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 ys(l.backoff(g+1))}return u}internalHandler(n){return r=>{var l;if(this.serial!==n)return;const a=r.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,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 a=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===tr.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||a)&&(this.iter=new NE),this.consumer=new cd(this.api,this.currentConsumer);const u=n;u.callback=this.internalHandler(this.serial);let c=null;this.type===tr.Fetch&&a?c=await this.consumer.fetch(n):this.type===tr.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(ls.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===tr.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===tr.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=tr.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===tr.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:a}=n;return a&&(this.userCallback=a),this.type=tr.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 a=Lt();return r.callback=u=>{this.userCallback=null,a.resolve(u)},(await this.fetch(r)).iterClosed.then(u=>{u&&a.reject(u),a.resolve(null)}).catch(u=>{a.reject(u)}),a}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 fd{constructor(n){C(this,"api");C(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(ot.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 cd(this.api,n)}async get(n,r={}){return typeof r=="object"?this.ordered(n,r):(await this.checkVersion(),this.api.info(n,r).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new cd(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,r){await this.checkVersion();const a=this.api;return new Ud(a.nc,a.opts).info(n).then(u=>Promise.resolve(new OE(this.api,n,r))).catch(u=>Promise.reject(u))}}class $u{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 $u(this.api,n)}else return this}info(n=!1,r){return n?Promise.resolve(this._info):this.api.info(this.name,r).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new fd(new Tu(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new fd(new Tu(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 Ud extends ql{constructor(n,r){super(n,r)}checkStreamConfigVersions(n){const r=this.nc;if(n.metadata){const{min:l,ok:u}=r.features.get(ot.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(ot.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(ot.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(ot.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(ot.JS_DEFAULT_CONSUMER_LIMITS);if(!u)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function a(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(ot.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!d)throw new Error(`${l} 'subject_transforms' requires server ${m}`)}}n.sources&&n.sources.forEach(l=>{a("stream sources",l)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var l;this.checkStreamConfigVersions(n),mn(n.name),n.mirror=cu(n.mirror),n.sources=(l=n.sources)==null?void 0:l.map(cu);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return mn(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,r={}){var f;if(typeof n=="object"){const m=n;n=m.name,r=m,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(r),mn(n);const a=await this.info(n),l=Object.assign(a.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){mn(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let u=await this._request(a,r),{total:c,limit:f}=u,m=u.state.subjects?Object.getOwnPropertyNames(u.state.subjects).length:1;if(c&&c>m){const d=[u],y=r||{};let g=0;for(;c>m;){g++,y.offset=f*g;const w=await this._request(a,y);c=w.total,d.push(w);const k=Object.getOwnPropertyNames(w.state.subjects).length;if(m+=k,k<f)break}let b={};for(let w=0;w<d.length;w++)u=d[w],u.state.subjects&&(b=Object.assign(b,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=b}return this._fixInfo(u),u}list(n=""){const r=n!=null&&n.length?{subject:n}:{},a=u=>{const c=u;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new Sl(l,a,this,r)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,r){if(r){const{keep:l,seq:u}=r;if(typeof l=="number"&&typeof u=="number")throw new Error("can specify one of keep or seq")}return mn(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,r)}async deleteMessage(n,r,a=!0){mn(n);const l={seq:r};return a||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,l)).success}async getMessage(n,r){mn(n);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,r);return new _x(l)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var m;const u=a.streams.filter(d=>d.config.name.startsWith(Pn));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 Sx(d,c))},r=`${this.prefix}.STREAM.LIST`;return new Sl(r,n,this)}listObjectStores(){const n=a=>{const u=a.streams.filter(f=>f.config.name.startsWith(zd));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new ud(f))},r=`${this.prefix}.STREAM.LIST`;return new Sl(r,n,this)}names(n=""){const r=n!=null&&n.length?{subject:n}:{},a=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new Sl(l,a,this,r)}async get(n){const r=await this.info(n);return Promise.resolve(new $u(this,r))}}class RE extends ql{constructor(n,r){super(n,r)}async getMessage(n,r){mn(n);let a=r;const{last_by_subj:l}=a;l&&(a=null);const u=a?this.jc.encode(a):Fn,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=as(m);if(d)return Promise.reject(d);const y=new hd(m);return Promise.resolve(y)}async getBatch(n,r){mn(n);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(r.multi_last)||r.multi_last.length===0)return Promise.reject("multi_last is required");const u=JSON.stringify(r,(m,d)=>m==="up_to_time"&&d instanceof Date?d.toISOString():d),c=new rn,f=await this.nc.requestMany(l,u,{strategy:mr.SentinelMsg});return(async()=>{var g,b,w;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(((w=k.headers)==null?void 0:w.get("Nats-Num-Pending"))===""){d=!0;break}}if(k.data.length===0)break;c.push(new hd(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 hd{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(ts.Subject)}get seq(){const n=this.header.last(ts.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(ts.TimeStamp)}get stream(){return this.header.last(ts.Stream)}json(n){return pr(n).decode(this.data)}string(){return Hn.decode(this.data)}}C(hd,"jc");class ME extends ql{constructor(r,a){super(r,a);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new Ud(r,a),this.consumers=new Tu(r,a),this.direct=new RE(r,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new rn;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,l)=>{if(a)throw a;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 _x{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):Fn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Li.decode(n)}else this._header=ei();return this._header}_parse(n){const r=atob(n),a=r.length,l=new Uint8Array(a);for(let u=0;u<a;u++)l[u]=r.charCodeAt(u);return l}json(n){return pr(n).decode(this.data)}string(){return Hn.decode(this.data)}}C(_x,"jc");class DE{constructor(n){C(this,"api");this.api=n}get(n){return this.api.info(n).then(r=>new $u(this.api,r))}}class Sh{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=Li.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 O0(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 LE(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Cl{constructor(n,r,a){C(this,"jsm");C(this,"js");C(this,"stream");C(this,"name");this.name=n,this.jsm=r,this.js=a}_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 Sh(r):null}async list(){const n=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of r){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:r,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const l=this._metaSubject(r);try{const u=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=pr().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 ud(n)))}async status(n){const r=await this._si(n);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new ud(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,r,a){var oe;const l=this.js.getOptions();a=a||{timeout:l.timeout},a.timeout=a.timeout||l.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:u,previousRevision:c}=a,f=this.js.nc.info,m=(f==null?void 0:f.max_payload)||1024;n=n||{},n.options=n.options||{};let d=((oe=n.options)==null?void 0:oe.max_chunk_size)||128*1024;d=d>m?m:d,n.options.max_chunk_size=d;const y=await this.info(n.name),{name:g,error:b}=this._checkNotEmpty(n.name);if(b)return Promise.reject(b);const w=Ui.next(),k=this._chunkSubject(w),M=this._metaSubject(g),U=Object.assign({bucket:this.name,nuid:w,size:0,chunks:0},O0(n)),O=Lt(),P=[],q=new hs;try{const B=r?r.getReader():null,z=v0.create();for(;;){const{done:K,value:F}=B?await B.read():{done:!0,value:void 0};if(K){if(q.size()>0){const J=q.drain();z.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 $=ss.encode(z.digest());U.digest=`${j0}${$}`,U.deleted=!1;const D=ei();typeof c=="number"&&D.set(Er.ExpectedLastSubjectSequenceHdr,`${c}`),D.set(bn.RollupHdr,bn.RollupValueSubject);const Y=await this.js.publish(M,pr().encode(U),{headers:D,timeout:u});if(U.revision=Y.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}O.resolve(new Sh(U));break}if(F)for(q.fill(F);q.size()>d;){U.chunks++,U.size+=d;const $=q.drain(n.options.max_chunk_size);z.update($),P.push(this.js.publish(k,$,{timeout:u}))}}}catch(B){await this.jsm.streams.purge(this.stream,{filter:k}),O.reject(B)}return O}putBlob(n,r,a){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),a)}put(n,r,a){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,a)}async getBlob(n){async function r(u){const c=new hs,f=u.getReader();for(;;){const{done:m,value:d}=await f.read();if(m)return c.drain();d&&d.length&&c.fill(d)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const l=await Promise.all([a.error,r(a.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(j0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const a=id(r.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Lt(),u={info:new Sh(r),error:l};if(r.size===0)return u.data=LE(),l.resolve(null),Promise.resolve(u);let c;const f=zi();f.orderedConsumer();const m=v0.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&&(f2(a,m.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${a}`)),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 a=r,{name:l,error:u}=this._checkNotEmpty(n);if(u)return Promise.reject(u);const c={name:l,options:{link:{bucket:a.name}}};return this._put(c,null)}async link(n,r){const{name:a,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:a,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 a=pr(),l=ei();return l.set(bn.RollupHdr,bn.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),a.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(n,r={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??a.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({},a,O0(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 a=new rn,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(m){m.code==="404"?(a.push(null),r=!0):a.stop(m)}const u=pr(),c=zi();c.orderedConsumer(),n.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((m,d)=>{var y;if(m){a.stop(m);return}if(d!==null){const g=u.decode(d.data);g.deleted&&n.ignoreDeletes===!0||a.push(g),((y=d.info)==null?void 0:y.pending)===0&&!r&&(r=!0,a.push(null))}});const f=await this.js.subscribe(l,c);return a._data=f,a.iterClosed.then(()=>{f.unsubscribe()}),f.closed.then(()=>{a.stop()}).catch(m=>{a.stop(m)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${ss.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=EE(this.name)}catch(l){return Promise.reject(l)}const r=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:r},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=Ol.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Bi.S2:Bi.None);try{await this.jsm.streams.info(a.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,r,a={}){const l=await n.jetstreamManager(),u=new Cl(r,l,n);return await u.init(a),Promise.resolve(u)}}class zE{constructor(n){C(this,"js");this.js=n}kv(n,r={}){const a=this.js,{ok:l,min:u}=a.nc.features.get(ot.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 a=this.js,{ok:l,min:u}=a.nc.features.get(ot.JS_OBJECTSTORE);return l?Cl.create(this.js,n,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class Bd extends ql{constructor(r,a){super(r,a);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new Tu(r,a),this.streamAPI=new Ud(r,a),this.consumers=new fd(this.consumerAPI),this.streams=new DE(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new zE(this)}async publish(r,a=Fn,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||ei();l&&(l.msgID&&u.set(Er.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(Er.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(Er.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(Er.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(Er.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,a,f);break}catch(w){if(w.code==="503"&&b+1<m)await ys(d);else throw w}const g=this.parseJsResponse(y);if(g.stream==="")throw je.errorForCode(_e.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,a,l=0){mn(r),is(a);let u=this.timeout;l>u&&(u=l),l=l<0?0:Dt(l);const c={batch:1,no_wait:l===0,expires:l},f=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${a}`,this.jc.encode(c),{noMux:!0,timeout:u}),m=as(f);if(m)throw m;return Dl(f,this.timeout)}fetch(r,a,l={}){mn(r),is(a);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(ot.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=Dt(g)),g===0&&y.no_wait===!1)throw new Error("expires or no_wait is required");const b=l.idle_heartbeat||0;b&&(y.idle_heartbeat=Dt(b),l.delay_heartbeat===!0&&(y.idle_heartbeat=Dt(b*4)));const w=new rn,k=y.batch;let M=0;w.protocolFilterFn=(P,q=!1)=>td(P.msg)?(d==null||d.work(),!1):!0,w.dispatchedFn=P=>{if(P){if(c&&(f+=P.data.length),M++,u&&P.info.pending===0)return;(w.getPending()===1&&P.info.pending===0||k===M||m>0&&f>=m)&&w.stop()}};const U=Zr(this.nc.options.inboxPrefix),O=this.nc.subscribe(U,{max:l.batch,callback:(P,q)=>{P===null&&(P=as(q)),P!==null?(u&&(u.cancel(),u=null),G_(P)?w.stop(kx(P)===null?void 0:P):w.stop(P)):(d==null||d.work(),w.received++,w.push(Dl(q,this.timeout)))}});return g&&(u=cs(g),u.catch(()=>{O.isClosed()||(O.drain().catch(()=>{}),u=null),d&&d.cancel()})),(async()=>{try{b&&(d=new Ld(b,P=>(w.push(()=>{w.err=new je(`${nr.IdleHeartbeatMissed}: ${P}`,_e.JetStreamIdleHeartBeat)}),!0)))}catch{}await O.closed,u!==null&&(u.cancel(),u=null),d&&d.cancel(),w.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${a}`,this.jc.encode(y),{reply:U}),w}async pullSubscribe(r,a=zi()){const l=await this._processOptions(r,a);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===nn.None||u===nn.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new HE(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(m){throw f.unsubscribe(),m}return f}async subscribe(r,a=zi()){const l=await this._processOptions(r,a);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const u=this._buildTypedSubscriptionOpts(l),c=new Ex(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,a=zi()){const l=g0(a)?a.getOpts():a;if(l.isBind=g0(a)?a.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!==nn.NotSet&&l.config.ack_policy!==nn.None)throw new je("ordered consumer: ack_policy can only be set to 'none'",_e.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new je("ordered consumer: durable_name cannot be set",_e.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new je("ordered consumer: deliver_subject cannot be set",_e.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new je("ordered consumer: max_deliver cannot be set",_e.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new je("ordered consumer: deliver_group cannot be set",_e.ApiError);l.config.deliver_subject=Zr(this.nc.options.inboxPrefix),l.config.ack_policy=nn.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||Dt(5e3),l.config.ack_wait=Dt(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===nn.NotSet&&(l.config.ack_policy=nn.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||Zr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const a={};return a.adapter=qE(r.callbackFn===void 0,this.timeout),a.ingestionFilterFn=Bd.ingestionFn(r.ordered),a.protocolFilterFn=(l,u=!1)=>{const c=l;return ed(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==nn.None&&(a.dispatchedFn=$E),r.callbackFn&&(a.callback=r.callbackFn),a.max=r.max||0,a.queue=r.queue,a}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:$t.All,ack_policy:nn.Explicit,ack_wait:Dt(30*1e3),replay_policy:fs.Instant},r.config);const a=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=a.name,r.config=a.config,r.last=a}static ingestionFn(r){return(a,l)=>{var m;const u=l;if(!a)return{ingest:!1,protocol:!1};const c=a;if(as(c.msg)||(m=u.monitor)==null||m.work(),td(c.msg)){const d=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:d,protocol:!0}}else if(ed(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(a):!0,protocol:!1}}}}class Pd{constructor(n){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=aE(n),this.listeners=[]}static connect(n={}){return new Promise((r,a)=>{const l=new Pd(n);Ou.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=>{a(u)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,r,a){if(this.isClosed())throw je.errorForCode(_e.ConnectionClosed);if(r&&this.isDraining()||a&&this.protocol.noMorePublishing)throw je.errorForCode(_e.ConnectionDraining);if(n=n||"",n.length===0)throw je.errorForCode(_e.BadSubject)}publish(n,r,a){this._check(n,!1,!0),this.protocol.publish(n,r,a)}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 a=new vx(this.protocol,n,r);return this.protocol.subscribe(a),a}_resub(n,r,a){this._check(r,!0,!1);const l=n;l.max=a,a&&(l.max=a+l.received),this.protocol.resub(l,r)}requestMany(n,r=Fn,a={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(m){return Promise.reject(m)}if(a.strategy=a.strategy||mr.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new je("timeout",_e.InvalidOption));const u=new rn;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(a.noMux){const m=l?new Error().stack:null;let d=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const y=this.subscribe(Zr(this.options.inboxPrefix),{callback:(k,M)=>{var U,O;if(((U=M==null?void 0:M.data)==null?void 0:U.length)===0&&((O=M==null?void 0:M.headers)==null?void 0:O.status)===_e.NoResponders&&(k=je.errorForCode(_e.NoResponders)),k){m&&(k.stack+=`
82
+
83
+ ${m}`),g(k);return}f(null,M),a.strategy===mr.Count&&(d--,d===0&&g()),a.strategy===mr.JitterTimer&&(w(),b=setTimeout(()=>{g()},300)),a.strategy===mr.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}),w(),y.drain().then(()=>{c()}).catch(M=>{c()})};u.iterClosed.then(()=>{w(),y==null||y.unsubscribe()}).catch(k=>{w(),y==null||y.unsubscribe()});try{this.publish(n,r,{reply:y.getSubject()})}catch(k){g(k)}let b=setTimeout(()=>{g()},a.maxWait);const w=()=>{b&&clearTimeout(b)}}else{const m=a;m.callback=f,u.iterClosed.then(()=>{d.cancel()}).catch(y=>{d.cancel(y)});const d=new h2(this.protocol.muxSubscriptions,n,m);this.protocol.request(d);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${d.token}`,headers:a.headers})}catch(y){d.cancel(y)}}return Promise.resolve(u)}request(n,r,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(u){return Promise.reject(u)}const l=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new je("timeout",_e.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new je("reply can only be used with noMux",_e.InvalidOption));if(a.noMux){const u=a.reply?a.reply:Zr(this.options.inboxPrefix),c=Lt(),f=l?new Error:null,m=this.subscribe(u,{max:1,timeout:a.timeout,callback:(d,y)=>{d?(f&&d.code!==_e.Timeout&&(d.stack+=`
84
+
85
+ ${f.stack}`),m.unsubscribe(),c.reject(d)):(d=ox(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:a.headers}),c}else{const u=new fx(this.protocol.muxSubscriptions,n,a,l);this.protocol.request(u);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:a.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(_e.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(je.errorForCode(_e.ConnectionClosed)):this.isDraining()?Promise.reject(je.errorForCode(_e.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 rn;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,a)=>r==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const r=new ME(this,n);if(n.checkAPI!==!1)try{await r.getAccountInfo()}catch(a){const l=a;throw l.code===_e.NoResponders&&(l.code=_e.JetStreamNotEnabled),l}return r}jetstream(n={}){return new Bd(this,n)}getServerVersion(){const n=this.info;return n?ca(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw je.errorForCode(_e.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 UE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(je.errorForCode(_e.ConnectionClosed)):this.isDraining()?Promise.reject(je.errorForCode(_e.ConnectionDraining)):this.protocol.reconnect()}}class UE{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 gE(this.nc,n,r)}}class BE{constructor(n,r,a){C(this,"bucket");C(this,"sm");C(this,"prefixLen");this.bucket=n,this.prefixLen=r,this.sm=a}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(Ru)||"PUT"}get length(){const n=this.sm.header.get(bn.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class PE{constructor(n,r,a){C(this,"bucket");C(this,"key");C(this,"sm");this.bucket=n,this.key=r,this.sm=a}get value(){return this.sm.data}get created(){return new Date(Md(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Ru))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const n=((r=this.sm.headers)==null?void 0:r.get(bn.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Ex extends g2{constructor(r,a,l){super(r.nc,a,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 a=Zr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const u=this.info;u.config.name=Ui.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=a,u.config.deliver_subject=a,u.config.deliver_policy=$t.StartSequence,u.config.opt_start_seq=r;const c={};c.stream_name=this.info.stream,c.config=u.config;const f=`${u.api.prefix}.CONSUMER.CREATE.${u.stream}`;this.js._request(f,c,{retries:-1}).then(m=>{const d=m,y=this.sub.info;y.last=d,this.info.config=d.config,this.info.name=d.name}).catch(m=>{const d=new je(`unable to recreate ordered consumer ${u.stream} at seq ${r}`,_e.RequestError,m);this.sub.callback(d,{})})}_maybeSetupHbMonitoring(){var a,l;const r=((l=(a=this.info)==null?void 0:a.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(Md(r))}_setupHbMonitoring(r,a=0){const l={cancelAfter:0,maxOut:2};a&&(l.cancelAfter=a);const u=this.sub,c=f=>{var y,g,b,w;const m=K_(409,`${nr.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((y=this.info)==null?void 0:y.ordered))this.sub.callback(null,m);else{if(!this.js.nc.protocol.connected)return!1;const k=((b=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:b.stream_seq)||0;return this._resetOrderedConsumer(k+1),(w=this.monitor)==null||w.restart(),!1}return!u.noIterator};this.monitor=new Ld(r,c,l)}_checkHbOrderConsumer(r){const a=r.headers.get(bn.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const l=parseInt(r.headers.get(bn.LastConsumerSeqHdr),10),u=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==u.delivery_seq&&this._resetOrderedConsumer(u.stream_seq+1),!1}_checkOrderedConsumer(r){const a=this.info.ordered_consumer_sequence,l=r.info.streamSequence,u=r.info.deliverySequence;return u!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=u,a.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,a=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${a}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,a=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${a}`,u=await r.api._request(l);return r.last=u,u}}class HE extends Ex{constructor(n,r,a){super(n,r,a)}pull(n={batch:1}){const{stream:r,config:a,name:l}=this.sub.info,u=a.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(ot.JS_PULL_MAX_BYTES);if(!d.ok)throw new Error(`max_bytes is only supported on servers ${d.min} or better`);c.max_bytes=n.max_bytes}let f=0;n.expires&&n.expires>0&&(f=n.expires,c.expires=Dt(f));let m=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(m=n.idle_heartbeat,c.idle_heartbeat=Dt(m)),m&&f===0)throw new Error("idle_heartbeat requires expires");if(m>f)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),f&&m&&(this.monitor?this.monitor._change(m,f):this._setupHbMonitoring(m,f));const d=this.info.api,y=`${d.prefix}.CONSUMER.MSG.NEXT.${r}.${u}`,g=this.sub.subject;d.nc.publish(y,d.jc.encode(c),{reply:g})}}}function qE(e,n){return e?FE(n):IE(n)}function IE(e){return(n,r)=>n?[n,null]:(n=as(r),n?[n,null]:[null,Dl(r,e)])}function FE(e){return(n,r)=>{if(n)return[n,null];const a=as(r);return a!==null?[kx(a),null]:[null,Dl(r,e)]}}function kx(e){if(e!==null)switch(e.code){case _e.JetStream404NoMessages:case _e.JetStream408RequestTimeout:return null;case _e.JetStream409:return Q_(e)?e:null;default:return e}return null}function $E(e){e&&e.ack()}function YE(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 GE{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=YE(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 a;n=n||{},n.timeout=n.timeout||this.timeout;const r=Lt();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const u=this.msg.publisher,c=!((a=u.options)!=null&&a.noAsyncTraces),f=new fx(u.muxSubscriptions,this.msg.reply,{timeout:n.timeout},c);u.request(f);try{u.publish(this.msg.reply,N0,{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(N0)}nak(n){let r=CE;n&&(r=Cu().encode(`-NAK ${JSON.stringify({delay:Dt(n)})}`)),this.doAck(r)}working(){this.doAck(ml)}next(n,r={batch:1}){const a={};a.batch=r.batch||1,a.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(a.expires=Dt(r.expires));const l=pr().encode(a),u=hs.concat(AE,jE,l),c=n?{reply:n}:void 0;this.msg.respond(u,c)}term(n=""){let r=TE;(n==null?void 0:n.length)>0&&(r=Cu().encode(`+TERM ${n}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const VE="1.30.3",JE="nats.ws";class XE{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=VE,this.lang=JE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Lt(),this.closedNotification=Lt()}async connect(n,r){const a=Lt();if(r.tls)return a.reject(new je("tls",_e.InvalidOption)),a;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=hs.concat(...this.yields),f=S2(c);if(f!==""){const m=oE.exec(f);if(!m){r.debug&&console.error("!!!",lu(c)),a.reject(new Error("unexpected response from server"));return}try{const d=JSON.parse(m[1]);sE(d,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(d){a.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,_e.Unknown,new Error(c.error));a.reject(f)},a}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 ys(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=Lt())}}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 KE(e,n){/^(.*:\/\/)(.*)/.test(e)||(typeof n=="boolean"?e=`${n===!0?"https":"http"}://${e}`:e=`https://${e}`);let a=new URL(e);const l=a.protocol.toLowerCase();l==="ws:"&&(n=!1),l==="wss:"&&(n=!0),l!=="https:"&&l!=="http"&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${e}`));let u,c;const f=a.hostname,m=a.pathname,d=a.search||"";switch(l){case"http:":case"ws:":case"nats:":c=a.port||"80",u="ws:";break;case"https:":case"wss:":case"tls:":c=a.port||"443",u="wss:";break;default:c=a.port||n===!0?"443":"80",u=n===!0?"wss:":"ws:";break}return`${u}//${f}:${c}${m}${d}`}function Cx(e={}){return y2({defaultPort:443,urlParseFn:KE,factory:()=>new XE}),Pd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var ds;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(ds||(ds={}));class _h extends Error{constructor(n,r,a){super(n),this.message=n,this.code=r,this.data=a}}const QE=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"},ZE=e=>{const n=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},a=r.Plugins=r.Plugins||{},l=()=>n!==null?n.name:QE(e),u=()=>l()!=="web",c=g=>{const b=d.get(g);return!!(b!=null&&b.platforms.has(l())||f(g))},f=g=>{var b;return(b=r.PluginHeaders)===null||b===void 0?void 0:b.find(w=>w.name===g)},m=g=>e.console.error(g),d=new Map,y=(g,b={})=>{const w=d.get(g);if(w)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),w.proxy;const k=l(),M=f(g);let U;const O=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=(F,$)=>{var D,Y;if(M){const J=M==null?void 0:M.methods.find(W=>$===W.name);if(J)return J.rtype==="promise"?W=>r.nativePromise(g,$.toString(),W):(W,se)=>r.nativeCallback(g,$.toString(),W,se);if(F)return(D=F[$])===null||D===void 0?void 0:D.bind(F)}else{if(F)return(Y=F[$])===null||Y===void 0?void 0:Y.bind(F);throw new _h(`"${g}" plugin is not implemented on ${k}`,ds.Unimplemented)}},q=F=>{let $;const D=(...Y)=>{const J=O().then(W=>{const se=P(W,F);if(se){const ne=se(...Y);return $=ne==null?void 0:ne.remove,ne}else throw new _h(`"${g}.${F}()" is not implemented on ${k}`,ds.Unimplemented)});return F==="addListener"&&(J.remove=async()=>$()),J};return D.toString=()=>`${F.toString()}() { [capacitor code] }`,Object.defineProperty(D,"name",{value:F,writable:!1,configurable:!1}),D},oe=q("addListener"),B=q("removeListener"),z=(F,$)=>{const D=oe({eventName:F},$),Y=async()=>{const W=await D;B({eventName:F,callbackId:W},$)},J=new Promise(W=>D.then(()=>W({remove:Y})));return J.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await Y()},J},K=new Proxy({},{get(F,$){switch($){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return M?z:oe;case"removeListener":return B;default:return q($)}}});return a[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=_h,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},WE=e=>e.Capacitor=ZE(e),An=WE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ar=An.registerPlugin;class Hd{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(n,r){let a=!1;this.listeners[n]||(this.listeners[n]=[],a=!0),this.listeners[n].push(r);const u=this.windowListeners[n];u&&!u.registered&&this.addWindowListener(u),a&&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,a){const l=this.listeners[n];if(!l){if(a){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:a=>{this.notifyListeners(r,a)}}}unimplemented(n="not implemented"){return new An.Exception(n,ds.Unimplemented)}unavailable(n="not available"){return new An.Exception(n,ds.Unavailable)}async removeListener(n,r){const a=this.listeners[n];if(!a)return;const l=a.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(a=>{this.notifyListeners(n,a)}))}}const R0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),M0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class ek extends Hd{async getCookies(){const n=document.cookie,r={};return n.split(";").forEach(a=>{if(a.length<=0)return;let[l,u]=a.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=M0(l).trim(),u=M0(u).trim(),r[l]=u}),r}async setCookie(n){try{const r=R0(n.key),a=R0(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}=${a||""}${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)}}}ar("CapacitorCookies",{web:()=>new ek});const tk=async e=>new Promise((n,r)=>{const a=new FileReader;a.onload=()=>{const l=a.result;n(l.indexOf(",")>=0?l.split(",")[1]:l)},a.onerror=l=>r(l),a.readAsDataURL(e)}),nk=(e={})=>{const n=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[n[c]],l),{})},rk=(e,n=!0)=>e?Object.entries(e).reduce((a,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}`),`${a}&${m}`},"").substr(1):null,ik=(e,n={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},n),l=nk(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 ak extends Hd{async request(n){const r=ik(n,n.webFetchExtra),a=rk(n.params,n.shouldEncodeUrlParams),l=a?`${n.url}?${a}`: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 tk(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"}))}}ar("CapacitorHttp",{web:()=>new ak});var D0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(D0||(D0={}));var L0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(L0||(L0={}));class sk extends Hd{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")}}ar("SystemBars",{web:()=>new sk});const qd=An.isNativePlatform()?"https://app.palmier.me":"";async function Ax(e,n,r,a){const l=`${qd}${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 lk(e,n,r){return Ax("POST",e,n)}function ok(e,n){return Ax("GET",e,void 0)}const Tx=R.createContext({connected:!1,mode:"disconnected",nc:null,request(){return Promise.reject(new Error("No host connection"))},subscribeEvents(){return()=>{}},activeHost:null,unauthorized:!1}),uk=2e3,Eh=6e3;function ck({children:e}){const{getActiveHost:n}=Hl(),r=n(),[a,l]=R.useState(null),[u,c]=R.useState(!1),f=R.useRef(null),[m,d]=R.useState(!1),[y,g]=R.useState(!1),b=R.useRef(Cu()),w=R.useRef(new Set),k=R.useRef(0),M=r!=null&&!!r.directUrl,U=r?M?m?"direct":"disconnected":u?"nats":"disconnected":"disconnected",O=U!=="disconnected";R.useEffect(()=>{g(!1)},[r==null?void 0:r.hostId,r==null?void 0:r.clientToken]),R.useEffect(()=>{if(M){f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1));return}if(!r)return;let oe=!1;async function B(){try{const z=await fetch(`${qd}/api/nats-credentials/${r.hostId}`);if(!z.ok){console.error("[NATS] Failed to fetch credentials");return}const K=await z.json();if(!K.natsWsUrl){console.warn("[NATS] No WebSocket URL configured");return}if(oe)return;console.log("[NATS] Connecting to",K.natsWsUrl);const F=await Cx({servers:K.natsWsUrl,authenticator:yx(K.natsJwt,new TextEncoder().encode(K.natsNkeySeed))});if(oe){F.close().catch(()=>{});return}console.log("[NATS] Connected"),f.current=F,l(F),c(!0),F.closed().then(()=>{console.log("[NATS] Connection closed"),oe||(l(null),c(!1),f.current=null)})}catch(z){console.error("[NATS] Connection failed:",z),oe||c(!1)}}return B(),()=>{oe=!0,f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1))}},[M,r]),R.useEffect(()=>{if(!r||!M){d(!1);return}const oe=new AbortController;async function B(){var $;const K=new AbortController,F=setTimeout(()=>K.abort(),uk);oe.signal.addEventListener("abort",()=>K.abort());try{const D=await fetch(`${r.directUrl}/events`,{headers:{Authorization:`Bearer ${r.clientToken}`},signal:K.signal});return clearTimeout(F),D.ok?(($=D.body)==null?void 0:$.getReader())??null:null}catch{return clearTimeout(F),null}}async function z(K){d(!0),console.log("[HOST] SSE connected to",r.directUrl),k.current=Date.now();function F(){setTimeout(()=>{oe.signal.aborted||Date.now()-k.current<Eh||(console.log("[HOST] Heartbeat timeout — no data for",Eh/1e3,"s"),oe.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},Eh)}F();const $=new TextDecoder;let D="";try{for(;;){const{done:Y,value:J}=await K.read();if(Y)break;D+=$.decode(J,{stream:!0}),k.current=Date.now(),F();const W=D.split(`
88
+ `);D=W.pop()??"";for(const se of W)if(se.startsWith("data: ")){const ne=se.slice(6);try{const V=JSON.parse(ne);if(V.task_id&&V.event_type){const ie=`host-event.${r.hostId}.${V.task_id}`;for(const pe of w.current)pe({subject:ie,data:b.current.encode(ne)})}}catch{}}}}catch{}}return(async()=>{const K=await B();K&&await z(K)})(),()=>{oe.abort(),d(!1)}},[r,M]);const P=R.useCallback(async(oe,B,z)=>{if(!r)throw new Error("No active host");function K(W){W&&typeof W=="object"&&W.error==="Unauthorized"&&g(!0)}if(M){console.log(`[HOST/HTTP] → ${oe}`,B??"");const W=await fetch(`${r.directUrl}/rpc/${oe}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.clientToken}`},body:B!=null?JSON.stringify(B):void 0,signal:z!=null&&z.timeout?AbortSignal.timeout(z.timeout):void 0});if(W.status===401)throw g(!0),new Error("Unauthorized");const se=await W.json();return K(se),console.log(`[HOST/HTTP] ← ${oe}`,se),se}if(!f.current)throw new Error("Not connected");const F=`host.${r.hostId}.rpc.${oe}`,$={...B??{},clientToken:r.clientToken},D=b.current.encode(JSON.stringify($));console.log(`[HOST/NATS] → ${oe}`,B??"");const Y=await f.current.request(F,D,{timeout:(z==null?void 0:z.timeout)??1e4}),J=JSON.parse(b.current.decode(Y.data));return K(J),console.log(`[HOST/NATS] ← ${oe}`,J),J},[r,M]),q=R.useCallback((oe,B)=>{if(M)return w.current.add(B),()=>{w.current.delete(B)};if(f.current){const z=f.current.subscribe(`host-event.${oe}.>`);let K=!1;return(async()=>{try{for await(const F of z){if(K)break;B({subject:F.subject,data:F.data})}}catch{}})(),()=>{K=!0,z.unsubscribe()}}return()=>{}},[r,M]);return v.jsx(Tx.Provider,{value:{connected:O,mode:U,nc:a,request:P,subscribeEvents:q,activeHost:r,unauthorized:y},children:e})}function Yu(){return R.useContext(Tx)}function Mu(e){const n=new Date(e),r=new Date,a=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return n.toDateString()===r.toDateString()?a:`${n.toLocaleDateString(void 0,{month:"short",day:"numeric"})} ${a}`}const jx={};function fk(e){for(const n of e)jx[n.key]=n.label}function dd(e){return jx[e]??e}const hk=()=>window.matchMedia("(max-width: 600px)").matches;function dk({task:e,lastEvent:n,onEdit:r,onDelete:a,onViewRun:l}){var Y,J;const{request:u}=Yu(),[c,f]=R.useState(!1),[m,d]=R.useState(!1),[y,g]=R.useState(!1),b=R.useRef(null),w=(n==null?void 0:n.running_state)==="started",M=!!e.schedule_enabled&&!!e.schedule_type&&(((Y=e.schedule_values)==null?void 0:Y.length)??0)>0?w?"var(--color-success)":(n==null?void 0:n.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";R.useEffect(()=>{if(!m)return;function W(se){b.current&&!b.current.contains(se.target)&&d(!1)}return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[m]);function U(){hk()?g(!0):d(W=>!W)}function O(){d(!1),g(!1)}async function P(){if(O(),!!confirm("Abort this task?")){f(!0);try{await u("task.abort",{id:e.id})}catch(W){console.error("Abort failed:",W)}finally{f(!1)}}}async function q(){O();try{const W=await u("task.run",{id:e.id});l(e.id,W.run_id)}catch(W){console.error("Run failed:",W)}}async function oe(){if(O(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),a(e.id)}catch(W){console.error("Delete failed:",W)}}const B={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function z(W,se){if(W==="specific_times"){const A=new Date(se);return{kind:"specific_times",detail:isNaN(A.getTime())?se:`${A.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})} at ${A.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}}const ne=se.split(" ");if(ne.length!==5)return{kind:"unknown",detail:se};const[V,ie,pe,,Ee]=ne,E=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(ie==="*")return{kind:"hourly",detail:""};const N=new Date;N.setHours(Number(ie),Number(V),0,0);const Z=N.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return Ee!=="*"?{kind:"weekly",detail:`${E[Number(Ee)]??Ee} at ${Z}`}:pe!=="*"?{kind:"monthly",detail:`day ${pe} at ${Z}`}:{kind:"daily",detail:Z}}function K(W,se){const ne=z(W,se);return ne.kind==="hourly"?"Every hour":ne.kind==="specific_times"?`Once on ${ne.detail}`:`${ne.kind.charAt(0).toUpperCase()+ne.kind.slice(1)}: ${ne.detail}`}function F(W,se){if(!W||!se||se.length===0)return"";if(se.length===1)return K(W,se[0]);const ne=se.map(ie=>z(W,ie));if(new Set(ne.map(ie=>ie.kind)).size===1){const ie=ne[0].kind;if(ie==="hourly")return"Every hour";const pe=ne.map(Ee=>Ee.detail);return`${ie.charAt(0).toUpperCase()+ie.slice(1)}: ${pe.join(", ")}`}return se.map(ie=>K(W,ie)).join(", ")}const $=F(e.schedule_type,e.schedule_values),D=v.jsxs(v.Fragment,{children:[v.jsxs("button",{onClick:()=>{O(),r(e)},children:[v.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),v.jsxs("button",{onClick:()=>{O(),l(e.id)},children:[v.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),w?v.jsxs("button",{className:"menu-item-danger",onClick:P,disabled:c,children:[v.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):v.jsxs(v.Fragment,{children:[v.jsxs("button",{onClick:q,children:[v.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),v.jsxs("button",{className:"menu-item-danger",onClick:oe,children:[v.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"task-card",onClick:()=>l(e.id,"latest"),children:[v.jsxs("div",{className:"task-card-header",children:[v.jsxs("div",{className:"task-card-title-row",children:[w?v.jsx("span",{className:"status-spinner",children:v.jsx("span",{})}):v.jsx("span",{className:"status-dot",style:{backgroundColor:M}}),v.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),v.jsx("div",{className:"task-card-actions",onClick:W=>W.stopPropagation(),children:v.jsxs("div",{className:"task-card-menu",ref:b,children:[v.jsx("button",{className:"task-card-menu-btn",onClick:U,"aria-label":"Task actions",children:"⋮"}),m&&v.jsx("div",{className:"task-card-menu-dropdown",children:D})]})})]}),v.jsxs("div",{className:"task-card-meta",children:[e.agent&&v.jsx("span",{className:"task-card-agent",children:dd(e.agent)}),n&&B[n.running_state]&&v.jsxs("span",{className:"task-card-last-event",children:[B[n.running_state]," ",Mu(n.time_stamp)]}),e.schedule_type&&(((J=e.schedule_values)==null?void 0:J.length)??0)>0&&v.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?$:"Schedule disabled"})]})]}),y&&Su.createPortal(v.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>g(!1),children:v.jsxs("div",{className:"bottom-sheet",onClick:W=>W.stopPropagation(),children:[v.jsx("div",{className:"bottom-sheet-handle"}),v.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),v.jsx("div",{className:"bottom-sheet-actions",children:D})]})}),document.body)]})}function mk({permissions:e}){return v.jsxs("div",{className:"plan-dialog",children:[v.jsx("h2",{children:"Granted Permissions"}),v.jsx("div",{className:"plan-dialog-scroll",children:e&&e.length>0?v.jsx("div",{className:"permissions-section",children:v.jsx("ul",{className:"permissions-list",children:e.map((n,r)=>v.jsxs("li",{className:"permission-item",children:[v.jsx("span",{className:"permission-tool",children:n.name}),v.jsx("span",{className:"permission-desc",children:n.description})]},r))})}):v.jsx("p",{className:"plan-empty",children:"No permissions have been granted for this task."})}),v.jsx("div",{className:"plan-dialog-actions",children:v.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const Wa=[];function pk(){const e=Wa.pop();e&&(e.pushed.current=!1,e.close())}let z0=!1;function gk(){z0||(z0=!0,window.addEventListener("popstate",pk))}function yk(e,n){const r=R.useRef(!1),a=R.useRef(n);a.current=n;const l=R.useCallback(()=>a.current(),[]),u=R.useRef({close:l,pushed:r});u.current.close=l,R.useEffect(()=>{if(e&&!r.current)gk(),history.pushState({modal:!0},""),Wa.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=Wa.indexOf(u.current);c!==-1&&Wa.splice(c,1),history.back()}},[e,l]),R.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=Wa.indexOf(c);f!==-1&&Wa.splice(f,1),history.back()}}},[])}const bk=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],xk=["specific_times","hourly","daily","weekly","monthly"];function kh(e){return xk.includes(e)}function Mi(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function vk(e){const n=e.split(" ");if(n.length!==5)return Mi();const[r,a,l,,u]=n;if(a==="*")return Mi("hourly");const c=`${a.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...Mi("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...Mi("monthly"),time:c,dayOfMonth:l}:{...Mi("daily"),time:c}}function Nx(e,n){if(e==="specific_times"){const[r,a]=n.split("T");return{...Mi("specific_times"),onceDate:r??"",onceTime:(a??"09:00").slice(0,5)}}return vk(n)}function wk(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 Sk(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:wk(e)}function U0(e){return e==="specific_times"?"specific_times":"crons"}function B0(e){var a;if(e!=null&&e.command)return"command";const n=e==null?void 0:e.schedule_type,r=(a=e==null?void 0:e.schedule_values)==null?void 0:a[0];return!n||!r?"ondemand":Nx(n,r).schedule}function _k({initial:e,agents:n,hostPlatform:r,onSaved:a,onRun:l,onCancel:u}){var He;const{request:c}=Yu(),f=()=>{var Me;const xe=localStorage.getItem("palmier:lastAgent"),ke=n.map(Qe=>Qe.key);return xe&&ke.includes(xe)?xe:((Me=n[0])==null?void 0:Me.key)??""},[m,d]=R.useState((e==null?void 0:e.user_prompt)??""),[y,g]=R.useState((e==null?void 0:e.agent)??f()),b=!!((He=e==null?void 0:e.permissions)!=null&&He.length),[w,k]=R.useState(!1),M=R.useCallback(()=>k(!1),[]);yk(w,M);const[U,O]=R.useState(null),[P,q]=R.useState(()=>B0(e)),[oe,B]=R.useState(()=>{const xe=e==null?void 0:e.schedule_type,ke=e==null?void 0:e.schedule_values;return!xe||!ke?[]:ke.map(Me=>Nx(xe,Me))}),[z,K]=R.useState((e==null?void 0:e.requires_confirmation)??!1),[F,$]=R.useState((e==null?void 0:e.yolo_mode)??!1),[D,Y]=R.useState((e==null?void 0:e.foreground_mode)??!1),[J,W]=R.useState((e==null?void 0:e.command)??""),[se,ne]=R.useState(!1),V=R.useRef(null),ie=kh(P),pe=P==="command",Ee=n.find(xe=>xe.key===y),E=!!(Ee!=null&&Ee.supportsYolo);R.useEffect(()=>{!E&&F&&$(!1)},[E,F]);const N=!!e,Z=B0(e),A=!N||m!==((e==null?void 0:e.user_prompt)??"")||y!==((e==null?void 0:e.agent)??"")||P!==Z||z!==((e==null?void 0:e.requires_confirmation)??!1)||F!==((e==null?void 0:e.yolo_mode)??!1)||D!==((e==null?void 0:e.foreground_mode)??!1)||pe&&J!==((e==null?void 0:e.command)??"")||ie&&(JSON.stringify(ze())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||U0(P)!==((e==null?void 0:e.schedule_type)??void 0)),ve=ie&&oe.some(xe=>xe.schedule==="specific_times"&&(!xe.onceDate||new Date(`${xe.onceDate}T${xe.onceTime}`)<=new Date)),Ne=A&&!!m.trim()&&!ve&&(!pe||!!J.trim())&&(!ie||oe.length>0);function Te(xe,ke){B(Me=>Me.map((Qe,Xe)=>Xe===xe?{...Qe,...ke}:Qe))}function Le(xe){B(ke=>ke.filter((Me,Qe)=>Qe!==xe))}function Ie(){kh(P)&&B(xe=>[...xe,Mi(P)])}function ge(xe){q(xe),kh(xe)?B([Mi(xe)]):(B([]),K(!1)),xe==="command"?setTimeout(()=>{var ke;return(ke=V.current)==null?void 0:ke.focus()},0):W("")}function ze(){return oe.flatMap(xe=>{const ke=Sk(xe);return ke?[ke]:[]})}function Ke(){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.
89
+
90
+ Are you sure you want to continue?`):!0}async function pt(){ne(!0),O(null);try{const xe=ie?ze():[],ke=xe.length>0,Me={user_prompt:m,agent:y,schedule_type:ke?U0(P):null,schedule_values:ke?xe:null,schedule_enabled:ke,requires_confirmation:ke?z:!1,yolo_mode:F,foreground_mode:D,command:pe?J:""};N&&(Me.id=e.id);const Xe=await c(N?"task.update":"task.create",Me,{timeout:45e3});if(Xe.error){O(Xe.error);return}if(N||localStorage.setItem("palmier:lastAgent",y),pe&&!N){a(Xe);try{const Rt=await c("task.run",{id:Xe.id});Rt.run_id?l(Xe.id,Rt.run_id):Rt.error||l(Xe.id)}catch{}return}a(Xe)}catch(xe){O(xe instanceof Error?xe.message:String(xe))}finally{ne(!1)}}const it=N?"Save":pe?"Run":ie?"Schedule":"Save";return v.jsx("div",{className:"task-form-overlay",children:v.jsx("div",{className:"task-form",children:w?v.jsx(mk,{permissions:e==null?void 0:e.permissions}):v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"task-form-header",children:v.jsx("h2",{children:e?"Edit Task":"New Task"})}),U&&v.jsx("div",{className:"form-error",children:U}),v.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:m,onChange:xe=>d(xe.target.value),placeholder:pe?"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:se}),v.jsxs("div",{className:"plan-actions",children:[v.jsxs("div",{className:"agent-picker-section-inline",children:[v.jsx("span",{className:"agent-picker-label",children:"Run with"}),v.jsx("select",{className:"form-select form-select-sm",value:y,onChange:xe=>g(xe.target.value),disabled:se,children:n.map(xe=>v.jsx("option",{value:xe.key,children:xe.label},xe.key))})]}),E&&v.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[v.jsx("input",{type:"checkbox",checked:F,onChange:xe=>$(xe.target.checked),disabled:se}),"Yolo"]}),E&&F&&v.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),b&&v.jsx("div",{className:"granted-permissions-row",children:v.jsx("button",{className:"btn btn-link",onClick:()=>k(!0),children:"Granted Permissions"})})]}),v.jsxs("div",{className:"toggles-group",children:[r==="win32"&&v.jsxs("label",{className:"toggle-label",children:[v.jsx("input",{type:"checkbox",checked:D,onChange:xe=>Y(xe.target.checked),disabled:se}),"Run in the foreground (host must login to Windows)"]}),v.jsxs("div",{className:"schedule-section",children:[v.jsx("h3",{className:"schedule-section-title",children:"Schedule"}),v.jsxs("select",{className:"form-select",value:P,onChange:xe=>ge(xe.target.value),disabled:se,children:[v.jsx("option",{value:"ondemand",children:"On Demand"}),v.jsx("option",{value:"specific_times",children:"Specific Times"}),v.jsx("option",{value:"hourly",children:"Hourly"}),v.jsx("option",{value:"daily",children:"Daily"}),v.jsx("option",{value:"weekly",children:"Weekly"}),v.jsx("option",{value:"monthly",children:"Monthly"}),v.jsx("option",{value:"command",children:"Command-triggered"})]}),pe&&v.jsxs("div",{className:"schedule-reactive",children:[v.jsx("p",{className:"command-help-text",children:"Runs a command and invokes the task for each line of output. Use “the input” in your task description to reference each line."}),v.jsx("input",{ref:V,className:"form-input form-input-mono",type:"text",value:J,onChange:xe=>W(xe.target.value),placeholder:"gws gmail +watch --project my-project",disabled:se})]}),ie&&P!=="hourly"&&v.jsxs(v.Fragment,{children:[oe.map((xe,ke)=>v.jsxs("div",{className:"trigger-row-card",children:[v.jsxs("div",{className:"trigger-row-content",children:[P==="daily"&&v.jsx("input",{className:"form-input",type:"time",value:xe.time,onChange:Me=>Te(ke,{time:Me.target.value})}),P==="weekly"&&v.jsxs("div",{className:"trigger-row-top",children:[v.jsx("select",{className:"form-select",value:xe.dayOfWeek,onChange:Me=>Te(ke,{dayOfWeek:Me.target.value}),children:bk.map((Me,Qe)=>v.jsx("option",{value:String(Qe),children:Me},Qe))}),v.jsx("input",{className:"form-input",type:"time",value:xe.time,onChange:Me=>Te(ke,{time:Me.target.value})})]}),P==="monthly"&&v.jsxs("div",{className:"trigger-row-top",children:[v.jsx("select",{className:"form-select",value:xe.dayOfMonth,onChange:Me=>Te(ke,{dayOfMonth:Me.target.value}),children:Array.from({length:28},(Me,Qe)=>Qe+1).map(Me=>v.jsxs("option",{value:String(Me),children:["Day ",Me]},Me))}),v.jsx("input",{className:"form-input",type:"time",value:xe.time,onChange:Me=>Te(ke,{time:Me.target.value})})]}),P==="specific_times"&&v.jsxs("div",{className:"trigger-row-top",children:[v.jsx("input",{className:"form-input",type:"date",value:xe.onceDate,min:new Date().toISOString().split("T")[0],onChange:Me=>Te(ke,{onceDate:Me.target.value})}),v.jsx("input",{className:"form-input",type:"time",value:xe.onceTime,min:xe.onceDate===new Date().toISOString().split("T")[0]?new Date().toTimeString().slice(0,5):void 0,onChange:Me=>Te(ke,{onceTime:Me.target.value})})]})]}),oe.length>1&&v.jsx("button",{className:"trigger-remove-btn",onClick:()=>Le(ke),title:"Remove trigger",children:"×"})]},ke)),v.jsx("button",{className:"trigger-add-btn",onClick:Ie,children:"+ Add"})]}),ie&&v.jsxs("label",{className:"toggle-label",children:[v.jsx("input",{type:"checkbox",checked:z,onChange:xe=>K(xe.target.checked),disabled:se}),"Confirm before each run"]})]})]}),!F&&Ee&&!Ee.supportsPermissions&&v.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",Ee.label,". The task may fail if required permissions are not pre-configured."]}),v.jsxs("div",{className:"form-actions",children:[v.jsxs("button",{className:"btn btn-primary",onClick:()=>Ke()&&pt(),disabled:!Ne||se,children:[se&&v.jsx("span",{className:"btn-spinner"}),it]}),v.jsx("button",{className:"btn btn-secondary",onClick:()=>{A&&m.trim()&&!confirm("You have unsaved changes. Discard?")||u()},style:{marginLeft:"auto"},children:"Cancel"})]})]})})})}function Ox({pullDistance:e,refreshing:n,threshold:r}){const a=e>0||n,l=e>=r;return v.jsx("div",{className:"pull-to-refresh",style:{transform:`translateY(${e}px)`,opacity:a?Math.min(1,e/30):0},"aria-hidden":!a,children:v.jsx("div",{className:"pull-to-refresh-badge",children:n?v.jsx("div",{className:"spinner"}):v.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s"},children:[v.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),v.jsx("polyline",{points:"19 12 12 19 5 12"})]})})})}function Rx({onRefresh:e,threshold:n=70,maxPull:r=110,enabled:a=!0}){const[l,u]=R.useState(0),[c,f]=R.useState(!1),m=R.useRef(null),d=R.useRef(!1),y=R.useRef(0),g=R.useRef(!1),b=R.useRef(e);return R.useEffect(()=>{b.current=e}),R.useEffect(()=>{if(!a)return;const w=U=>{if(g.current||window.scrollY>0){m.current=null;return}m.current=U.touches[0].clientY,d.current=!1,y.current=0},k=U=>{if(g.current||m.current==null)return;const O=U.touches[0].clientY-m.current;if(O<=0){d.current=!1,y.current=0,u(0);return}d.current=!0;const P=Math.min(r,O*.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",w,{passive:!0}),window.addEventListener("touchmove",k,{passive:!1}),window.addEventListener("touchend",M,{passive:!0}),window.addEventListener("touchcancel",M,{passive:!0}),()=>{window.removeEventListener("touchstart",w),window.removeEventListener("touchmove",k),window.removeEventListener("touchend",M),window.removeEventListener("touchcancel",M)}},[a,n,r]),{pullDistance:l,refreshing:c,threshold:n}}function Ek({connected:e,hostId:n,request:r,subscribeEvents:a,agents:l,hostPlatform:u,onViewRun:c}){const[f,m]=R.useState([]),[d,y]=R.useState(!1),[g,b]=R.useState(null),[w,k]=R.useState(new Map),[M,U]=R.useState(!1),[O,P]=R.useState(void 0),q=R.useCallback(()=>{U(!1),P(void 0)},[]),oe=R.useCallback(async()=>{if(e){y(!0),b(null);try{const $=(await r("task.list")).tasks??[],D=new Map;for(const Y of $)Y.status&&D.set(Y.id,Y.status);k(D),m($)}catch(F){const $=F instanceof Error?F.message:String(F);$==="Not connected"||$.includes("503")||$.toLowerCase().includes("no responders")?b(null):b($),m([])}finally{y(!1)}}},[e,n,r]);R.useEffect(()=>{e?oe():(m([]),y(!1))},[e,n,oe]);const B=Rx({onRefresh:oe,enabled:e});R.useEffect(()=>!e||!n?void 0:a(n,async $=>{const D=$.subject.split(".");if(D.length<3)return;const Y=D.slice(2).join(".");let J={};try{J=JSON.parse(new TextDecoder().decode($.data))}catch{return}const W=J.event_type;if(!(W!=="running-state"&&W!=="permission-resolved"))try{const se=await r("task.status",{id:Y},{timeout:5e3});if(se.error)return;k(ne=>{const V=new Map(ne);return V.set(Y,se),V})}catch{}}),[e,n,a,r]);function z(F){m($=>{const D=$.findIndex(Y=>Y.id===F.id);if(D>=0){const Y=[...$];return Y[D]=F,Y}return[F,...$]}),U(!1),P(void 0)}function K(F){m($=>$.filter(D=>D.id!==F)),k($=>{const D=new Map($);return D.delete(F),D})}return v.jsxs(v.Fragment,{children:[v.jsx(Ox,{pullDistance:B.pullDistance,refreshing:B.refreshing,threshold:B.threshold}),g&&v.jsxs("div",{className:"form-error",children:[g,g.toLowerCase().includes("failed to fetch")&&v.jsxs(v.Fragment,{children:[" ",v.jsx("a",{href:"#",onClick:F=>{F.preventDefault(),window.location.reload()},children:"Reload"})]})]}),d&&!f.length?v.jsx("div",{className:"task-list",children:[0,1,2].map(F=>v.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[v.jsx("div",{className:"task-card-header",children:v.jsxs("div",{className:"task-card-title-row",children:[v.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),v.jsx("div",{className:"skeleton-line",style:{width:`${60+F*12}%`}})]})}),v.jsxs("div",{className:"task-card-meta",children:[v.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),v.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},F))}):v.jsx("div",{className:"task-list",children:f.map(F=>v.jsx(dk,{task:F,lastEvent:w.get(F.id),onEdit:async $=>{try{const D=await r("task.get",{id:$.id});P(D.error?$:D)}catch{P($)}U(!0)},onDelete:K,onViewRun:c},F.id))}),v.jsx("button",{className:"fab",onClick:()=>{P(void 0),U(!0)},"aria-label":"New task",title:"New task",children:v.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),v.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),M&&v.jsx(_k,{initial:O,agents:l,hostPlatform:u,onSaved:z,onRun:c,onCancel:q})]})}let os=null;function P0(e){os&&(e.preventDefault(),e.returnValue="")}function Ch(e){const n=!!os;os=e;const r=!!os;r&&!n?window.addEventListener("beforeunload",P0):!r&&n&&window.removeEventListener("beforeunload",P0)}function fa(){return os?window.confirm(os):!0}function kk(){const e=da(),r=jr().pathname.startsWith("/tasks"),a=!r;function l(u){fa()&&e(u)}return v.jsxs(v.Fragment,{children:[v.jsxs("button",{className:`tab-btn ${a?"tab-btn-active":""}`,onClick:()=>l("/"),children:[v.jsx("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:v.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),v.jsxs("button",{className:`tab-btn ${r?"tab-btn-active":""}`,onClick:()=>l("/tasks"),children:[v.jsxs("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),v.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}const Ck="modulepreload",Ak=function(e){return"/"+e},H0={},Mx=function(n,r,a){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=Ak(d),d in H0)return;H0[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":Ck,y||(b.as="script"),b.crossOrigin="",b.href=d,m&&b.setAttribute("nonce",m),document.head.appendChild(b),y)return new Promise((w,k)=>{b.addEventListener("load",w),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${d}`)))})}))}function u(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return l.then(c=>{for(const f of c||[])f.status==="rejected"&&u(f.reason);return n().catch(u)})},Tk=ar("App",{web:()=>Mx(()=>import("./web-BpM3fNCn.js"),[]).then(e=>new e.AppWeb)}),tn=ar("Preferences",{web:()=>Mx(()=>import("./web-CF-N8Di6.js"),[]).then(e=>new e.PreferencesWeb)});function Dx(e){const[n,r]=R.useState(()=>window.matchMedia(e).matches);return R.useEffect(()=>{const a=window.matchMedia(e),l=u=>r(u.matches);return a.addEventListener("change",l),r(a.matches),()=>a.removeEventListener("change",l)},[e]),n}const fu=An.isNativePlatform()?ar("LocationPermission"):null,Ah=An.isNativePlatform()?ar("NotificationListener"):null,Th=An.isNativePlatform()?ar("SmsPermission"):null,jh=An.isNativePlatform()?ar("ContactsPermission"):null,Nh=An.isNativePlatform()?ar("CalendarPermission"):null,Oh=An.isNativePlatform()?ar("DndAccess"):null,Rh=An.isNativePlatform()?ar("FullScreenIntent"):null,q0=!!window.__PALMIER_SERVE__,I0=An.isNativePlatform();function F0({daemonVersion:e,capabilityTokens:n,activeClientToken:r,request:a,onCapabilityTokensChange:l}){var Ut;const{pairedHosts:u,activeHostId:c,setActiveHostId:f,removePairedHost:m,renamePairedHost:d}=Hl(),y=da(),g=Dx("(min-width: 768px)"),[b,w]=R.useState(!1),[k,M]=R.useState(!1),[U,O]=R.useState(null),[P,q]=R.useState(""),[oe,B]=R.useState(null),[z,K]=R.useState(!1),[F,$]=R.useState(!1),[D,Y]=R.useState(!1),[J,W]=R.useState(!1),[se,ne]=R.useState(!1),[V,ie]=R.useState(!1),[pe,Ee]=R.useState(!1),[E,N]=R.useState(!1),[Z,A]=R.useState(!1);function ve(be){return!!(r&&(n==null?void 0:n[be])===r)}const Ne=ve("location"),Te=ve("notifications"),Le=ve("sms"),Ie=ve("contacts"),ge=ve("calendar"),ze=ve("dnd"),Ke=ve("alert"),pt=ve("battery"),it=ve("email");function He(be,$e){const ut={};for(const[$n,qt]of Object.entries(n??{}))ut[$n]=qt??null;ut[be]=$e?r??null:null,l==null||l(ut)}R.useEffect(()=>{if(!I0||!fu||!a)return;function be(){Ne&&fu.check().then(({fine:ut})=>{ut||a("device.location.disable").then(()=>{He("location",!1)}).catch(()=>{})})}be();const $e=Tk.addListener("resume",()=>{be()});return()=>{$e.then(ut=>ut.remove())}},[Ne,r]);async function xe(){if(!(!Ah||!a)){$(!0);try{if(Te)await tn.set({key:"notificationListenerEnabled",value:"false"}),await a("device.capability.disable",{capability:"notifications"}),He("notifications",!1);else{const{enabled:be}=await Ah.check();if(!be&&!(await Ah.request()).enabled)return;const{value:$e}=await tn.get({key:"fcmToken"});if(!$e){console.warn("No FCM token available");return}await tn.set({key:"notificationListenerEnabled",value:"true"}),await a("device.capability.enable",{capability:"notifications",fcmToken:$e}),He("notifications",!0)}}catch(be){console.error("Failed to toggle notification listener:",be)}finally{$(!1)}}}async function ke(){if(!(!Th||!a)){Y(!0);try{if(Le)await tn.set({key:"smsListenerEnabled",value:"false"}),await a("device.capability.disable",{capability:"sms"}),He("sms",!1);else{const{granted:be}=await Th.check();if(!be&&!(await Th.request()).granted)return;const{value:$e}=await tn.get({key:"fcmToken"});if(!$e){console.warn("No FCM token available");return}await tn.set({key:"smsListenerEnabled",value:"true"}),await a("device.capability.enable",{capability:"sms",fcmToken:$e}),He("sms",!0)}}catch(be){console.error("Failed to toggle SMS access:",be)}finally{Y(!1)}}}async function Me(){if(!(!jh||!a)){W(!0);try{if(Ie)await tn.set({key:"contactsAccessEnabled",value:"false"}),await a("device.capability.disable",{capability:"contacts"}),He("contacts",!1);else{const{granted:be}=await jh.check();if(!be&&!(await jh.request()).granted)return;const{value:$e}=await tn.get({key:"fcmToken"});if(!$e){console.warn("No FCM token available");return}await tn.set({key:"contactsAccessEnabled",value:"true"}),await a("device.capability.enable",{capability:"contacts",fcmToken:$e}),He("contacts",!0)}}catch(be){console.error("Failed to toggle contacts access:",be)}finally{W(!1)}}}async function Qe(){if(!(!Nh||!a)){ne(!0);try{if(ge)await tn.set({key:"calendarAccessEnabled",value:"false"}),await a("device.capability.disable",{capability:"calendar"}),He("calendar",!1);else{const{granted:be}=await Nh.check();if(!be&&!(await Nh.request()).granted)return;const{value:$e}=await tn.get({key:"fcmToken"});if(!$e){console.warn("No FCM token available");return}await tn.set({key:"calendarAccessEnabled",value:"true"}),await a("device.capability.enable",{capability:"calendar",fcmToken:$e}),He("calendar",!0)}}catch(be){console.error("Failed to toggle calendar access:",be)}finally{ne(!1)}}}async function Xe(){if(!(!Oh||!a)){ie(!0);try{if(ze)await a("device.capability.disable",{capability:"dnd"}),He("dnd",!1);else{const{enabled:be}=await Oh.check();if(!be&&!(await Oh.request()).enabled)return;const{value:$e}=await tn.get({key:"fcmToken"});if(!$e){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"dnd",fcmToken:$e}),He("dnd",!0)}}catch(be){console.error("Failed to toggle DND access:",be)}finally{ie(!1)}}}async function Rt(){if(!Rh)return!0;const{granted:be}=await Rh.check();return be?!0:(await Rh.request()).granted}async function gt(){if(a){Ee(!0);try{if(Ke)await a("device.capability.disable",{capability:"alert"}),He("alert",!1);else{if(!await Rt())return;const{value:be}=await tn.get({key:"fcmToken"});if(!be){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"alert",fcmToken:be}),He("alert",!0)}}catch(be){console.error("Failed to toggle alert access:",be)}finally{Ee(!1)}}}async function sr(){if(a){A(!0);try{if(it)await a("device.capability.disable",{capability:"email"}),He("email",!1);else{if(!await Rt())return;const{value:be}=await tn.get({key:"fcmToken"});if(!be){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"email",fcmToken:be}),He("email",!0)}}catch(be){console.error("Failed to toggle email access:",be)}finally{A(!1)}}}async function yr(){if(a){N(!0);try{if(pt)await a("device.capability.disable",{capability:"battery"}),He("battery",!1);else{const{value:be}=await tn.get({key:"fcmToken"});if(!be){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"battery",fcmToken:be}),He("battery",!0)}}catch(be){console.error("Failed to toggle battery access:",be)}finally{N(!1)}}}async function xt(){if(a){K(!0);try{if(Ne)await a("device.location.disable"),He("location",!1);else{if(fu&&!(await fu.request()).fine)return;const{value:be}=await tn.get({key:"fcmToken"});if(!be){console.warn("No FCM token available");return}await a("device.location.enable",{fcmToken:be}),He("location",!0)}}catch(be){console.error("Failed to toggle location:",be)}finally{K(!1)}}}const ni=R.useRef(null),ue=R.useRef(null),we=R.useCallback(()=>{M(!0)},[]);function Be(){k&&(w(!1),M(!1))}function Ge(){M(!1),w(!0)}function st(be,$e){O(be),q($e)}function Wt(){U&&P.trim()&&d(U,P.trim()),O(null),q("")}function xn(){O(null),q("")}R.useEffect(()=>{U&&ue.current&&(ue.current.focus(),ue.current.select())},[U]),R.useEffect(()=>{if(!b||k)return;function be($e){$e.key==="Escape"&&we()}return document.addEventListener("keydown",be),()=>{document.removeEventListener("keydown",be)}},[b,k,we]);const Yt=v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"drawer-header",children:[v.jsx("span",{className:"drawer-title",children:"Palmier"}),!g&&v.jsx("button",{className:"drawer-close-btn",onClick:we,"aria-label":"Close menu",children:v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),!q0&&u.length>0&&v.jsxs("div",{className:"drawer-section",children:[v.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),v.jsx("div",{className:"host-picker-inline",children:v.jsx("div",{className:"host-picker-list",role:"listbox",children:u.map(be=>{const $e=be.hostId===c,ut=U===be.hostId,$n=be.name||be.hostId.slice(0,8);return v.jsx("div",{className:"host-picker-item-wrapper",children:v.jsxs("div",{className:`host-picker-item ${$e?"host-picker-item-active":""}`,onClick:()=>{if(!ut&&!$e){if(!fa())return;f(be.hostId),g||we()}},role:"option","aria-selected":$e,children:[ut?v.jsx("input",{ref:ue,className:"form-input host-picker-rename-input",type:"text",value:P,onChange:qt=>q(qt.target.value),onKeyDown:qt=>{qt.key==="Enter"&&Wt(),qt.key==="Escape"&&xn()},onBlur:Wt,onClick:qt=>qt.stopPropagation()}):v.jsx("span",{className:"host-picker-item-name",children:$n}),v.jsxs("div",{className:"host-picker-item-actions",children:[$e&&!ut&&v.jsx("button",{className:"host-picker-edit-btn",onClick:qt=>{qt.stopPropagation(),st(be.hostId,$n)},"aria-label":"Rename host",children:v.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:v.jsx("path",{d:"M9.5 1.5L11.5 3.5M1.5 11.5L2 9L9 2L11 4L4 11L1.5 11.5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),!$e&&v.jsx("button",{className:"host-picker-delete-btn",onClick:qt=>{qt.stopPropagation(),B(be.hostId)},"aria-label":`Unpair ${$n}`,children:v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:v.jsx("path",{d:"M4 5.5V11C4 11.2761 4.22386 11.5 4.5 11.5H9.5C9.77614 11.5 10 11.2761 10 11V5.5M3 4H11M5.5 4V3C5.5 2.72386 5.72386 2.5 6 2.5H8C8.27614 2.5 8.5 2.72386 8.5 3V4M6.5 6.5V9.5M7.5 6.5V9.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})},be.hostId)})})})]}),!q0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"drawer-divider"}),v.jsx("div",{className:"drawer-section",children:v.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{fa()&&(y("/pair"),g||we())},children:"Pair New Host"})})]}),I0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"drawer-divider"}),v.jsxs("div",{className:"drawer-section",children:[v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Location Access"}),v.jsx("button",{className:`toggle-switch ${Ne?"toggle-switch-on":""}`,onClick:xt,disabled:z,role:"switch","aria-checked":Ne,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Notification Access"}),v.jsx("button",{className:`toggle-switch ${Te?"toggle-switch-on":""}`,onClick:xe,disabled:F,role:"switch","aria-checked":Te,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"SMS Access"}),v.jsx("button",{className:`toggle-switch ${Le?"toggle-switch-on":""}`,onClick:ke,disabled:D,role:"switch","aria-checked":Le,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Contacts Access"}),v.jsx("button",{className:`toggle-switch ${Ie?"toggle-switch-on":""}`,onClick:Me,disabled:J,role:"switch","aria-checked":Ie,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Calendar Access"}),v.jsx("button",{className:`toggle-switch ${ge?"toggle-switch-on":""}`,onClick:Qe,disabled:se,role:"switch","aria-checked":ge,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Do Not Disturb Control"}),v.jsx("button",{className:`toggle-switch ${ze?"toggle-switch-on":""}`,onClick:Xe,disabled:V,role:"switch","aria-checked":ze,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Alert Access"}),v.jsx("button",{className:`toggle-switch ${Ke?"toggle-switch-on":""}`,onClick:gt,disabled:pe,role:"switch","aria-checked":Ke,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Battery Access"}),v.jsx("button",{className:`toggle-switch ${pt?"toggle-switch-on":""}`,onClick:yr,disabled:E,role:"switch","aria-checked":pt,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Email Access"}),v.jsx("button",{className:`toggle-switch ${it?"toggle-switch-on":""}`,onClick:sr,disabled:Z,role:"switch","aria-checked":it,children:v.jsx("span",{className:"toggle-switch-thumb"})})]})]})]}),v.jsxs("div",{className:"drawer-footer",children:[e&&v.jsxs("div",{className:"drawer-version",children:["Palmier v",e]}),v.jsxs("div",{className:"drawer-legal",children:[v.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),v.jsx("span",{className:"drawer-legal-sep",children:"·"}),v.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),dt=oe&&Su.createPortal(v.jsx("div",{className:"confirm-modal-overlay",onClick:()=>B(null),children:v.jsxs("div",{className:"confirm-modal",onClick:be=>be.stopPropagation(),children:[v.jsx("h2",{className:"confirm-modal-title",children:"Delete host?"}),v.jsxs("p",{className:"confirm-modal-message",children:['"',((Ut=u.find(be=>be.hostId===oe))==null?void 0:Ut.name)||oe.slice(0,8),'" will be unpaired from this device.']}),v.jsxs("div",{className:"confirm-modal-actions",children:[v.jsx("button",{className:"btn btn-secondary",onClick:()=>B(null),children:"Cancel"}),v.jsx("button",{className:"btn btn-danger",onClick:()=>{m(oe),B(null)},children:"Delete"})]})]})}),document.body);return g?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:ni,children:Yt}),dt]}):v.jsxs(v.Fragment,{children:[v.jsx("button",{className:"hamburger-btn",onClick:Ge,"aria-label":"Open menu",children:v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:v.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),b&&Su.createPortal(v.jsx("div",{className:`drawer-overlay ${k?"drawer-overlay-closing":""}`,onClick:we,onAnimationEnd:Be,children:v.jsx("div",{className:`drawer-panel ${k?"drawer-panel-closing":""}`,ref:ni,onClick:be=>be.stopPropagation(),children:Yt})}),document.body),dt]})}function $0(e){var a;const n=localStorage.getItem("palmier:lastAgent"),r=e.map(l=>l.key);return n&&r.includes(n)?n:((a=e[0])==null?void 0:a.key)??""}function jk({agents:e,onStarted:n}){const{request:r}=Yu(),[a,l]=R.useState(""),[u,c]=R.useState(()=>$0(e)),[f,m]=R.useState(!1),[d,y]=R.useState(!1),[g,b]=R.useState(null);R.useEffect(()=>{e.length&&(e.find(q=>q.key===u)||c($0(e)))},[e,u]),R.useEffect(()=>{const q=a.trim().length>0;return Ch(q?"Your session draft will be lost. Continue?":null),()=>Ch(null)},[a]);const w=e.find(q=>q.key===u),k=!!(w!=null&&w.supportsYolo);R.useEffect(()=>{!k&&f&&m(!1)},[k,f]);const M=!!a.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 O(){if(!(!M||!U())){y(!0),b(null);try{const q=await r("task.run_oneoff",{user_prompt:a,agent:u,yolo_mode:f});if(q.error){b(q.error);return}localStorage.setItem("palmier:lastAgent",u),l(""),Ch(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(),O())}return v.jsxs("div",{className:"session-composer",children:[g&&v.jsx("div",{className:"form-error",children:g}),v.jsx("textarea",{className:"session-composer-textarea",value:a,onChange:q=>l(q.target.value),onKeyDown:P,placeholder:"What can I do for you?",rows:3,disabled:d}),v.jsxs("div",{className:"session-composer-controls",children:[v.jsxs("div",{className:"agent-picker-section-inline",children:[v.jsx("span",{className:"agent-picker-label",children:"Run with"}),v.jsx("select",{className:"form-select form-select-sm",value:u,onChange:q=>c(q.target.value),disabled:d||!e.length,children:e.map(q=>v.jsx("option",{value:q.key,children:q.label},q.key))})]}),k&&v.jsxs("label",{className:"session-composer-yolo",children:[v.jsx("input",{type:"checkbox",checked:f,onChange:q=>m(q.target.checked),disabled:d}),"Yolo"]}),v.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:O,disabled:!M,"aria-label":"Run session",title:"Run session",children:d?v.jsx("span",{className:"btn-spinner"}):v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),v.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),k&&f&&v.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const Nk=10;function Ok({connected:e,hostId:n,request:r,subscribeEvents:a,agents:l,filterTaskId:u,onClearFilter:c}){const[f,m]=R.useState([]),[d,y]=R.useState(0),[g,b]=R.useState(!1),[w,k]=R.useState(!1),M=da(),U=R.useRef(null),O=R.useCallback(Y=>{const J={offset:Y,limit:Nk};return u&&(J.task_id=u),J},[u]),P=R.useCallback(async(Y,J)=>{if(e){J?k(!0):b(!0);try{const W=await r("taskrun.list",O(Y)),se=W.entries??[];y(W.total??0),m(J?ne=>{const V=new Set(ne.map(pe=>`${pe.task_id}:${pe.run_id}`)),ie=se.filter(pe=>!V.has(`${pe.task_id}:${pe.run_id}`));return[...ne,...ie]}:se)}catch(W){W instanceof Error&&W.message==="Not connected"||console.error("Failed to load runs:",W)}finally{b(!1),k(!1)}}},[e,r,O]);R.useEffect(()=>{e?(m([]),y(0),P(0,!1)):(m([]),y(0))},[e,n,P,u]);const q=Rx({onRefresh:()=>P(0,!1),enabled:e});R.useEffect(()=>!e||!n?void 0:a(n,async J=>{try{const W=JSON.parse(new TextDecoder().decode(J.data));if(W.event_type==="running-state"&&W.running_state&&["monitoring","started","finished","failed","aborted"].includes(W.running_state)){const se=await r("taskrun.list",O(0)),ne=se.entries??[];y(se.total??0),m(V=>{const ie=new Map(ne.map(N=>[`${N.task_id}:${N.run_id}`,N])),pe=V.map(N=>{const Z=`${N.task_id}:${N.run_id}`;return ie.get(Z)??N}),Ee=new Set(pe.map(N=>`${N.task_id}:${N.run_id}`));return[...ne.filter(N=>!Ee.has(`${N.task_id}:${N.run_id}`)),...pe]})}}catch{}}),[e,n,a,r]),R.useEffect(()=>{const Y=U.current;if(!Y)return;const J=new IntersectionObserver(W=>{W[0].isIntersecting&&!w&&f.length<d&&P(f.length,!0)},{threshold:.1});return J.observe(Y),()=>J.disconnect()},[f.length,d,w,P]);function oe(Y,J){if(!Y||!J)return"";const W=Math.round((J-Y)/1e3);if(W<60)return`${W}s`;const se=Math.floor(W/60),ne=W%60;return`${se}m ${ne}s`}const B={monitoring:"Monitoring",started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function z(Y,J){fa()&&M(`/runs/${Y}/${encodeURIComponent(J)}`)}const K=!u&&v.jsx(jk,{agents:l,onStarted:(Y,J)=>{M(J?`/runs/${encodeURIComponent(Y)}/${encodeURIComponent(J)}`:`/runs/${encodeURIComponent(Y)}`)}}),F=v.jsx(Ox,{pullDistance:q.pullDistance,refreshing:q.refreshing,threshold:q.threshold}),$=u&&c&&v.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:v.jsxs("span",{className:"sessions-filter-chip",children:["Filtered by task",v.jsx("button",{onClick:c,"aria-label":"Clear filter",children:"×"})]})});function D(Y){if(Y==="failed")return"var(--color-error)";if(Y==="aborted")return"var(--color-warning, #d97706)"}return g&&f.length===0&&e?v.jsxs(v.Fragment,{children:[F,K,v.jsx("div",{className:"task-list",children:[0,1,2].map(Y=>v.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[v.jsx("div",{className:"task-card-header",children:v.jsx("div",{className:"task-card-title-row",children:v.jsx("div",{className:"skeleton-line",style:{width:`${70+Y*10}%`}})})}),v.jsx("div",{className:"task-card-meta",children:v.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},Y))})]}):!e||g&&f.length===0?v.jsxs(v.Fragment,{children:[F,K,v.jsx("div",{className:"sessions-view",children:v.jsxs("div",{className:"empty-state",children:[v.jsx("p",{className:"empty-state-text",children:"Sessions"}),v.jsx("p",{className:"empty-state-hint",children:"Your sessions will appear here"})]})})]}):f.length===0?v.jsxs(v.Fragment,{children:[F,K,$,v.jsx("div",{className:"sessions-view",children:v.jsxs("div",{className:"empty-state",children:[v.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),v.jsx("p",{className:"empty-state-hint",children:u?"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger.":"Your sessions will appear here."})]})})]}):v.jsxs(v.Fragment,{children:[F,K,$,v.jsxs("div",{className:"task-list",children:[f.map((Y,J)=>v.jsxs("div",{className:"sessions-card",onClick:()=>!Y.error&&z(Y.task_id,Y.run_id),children:[v.jsxs("div",{className:"sessions-card-body",children:[v.jsx("h3",{className:"sessions-card-name",children:Y.task_name||Y.task_id}),v.jsxs("div",{className:"sessions-card-meta",children:[v.jsx("span",{style:{color:D(Y.running_state)},children:B[Y.running_state??""]??Y.running_state}),Y.end_time&&v.jsx("span",{children:Mu(Y.end_time)}),Y.start_time&&Y.end_time&&v.jsx("span",{style:{color:"var(--color-muted)"},children:oe(Y.start_time,Y.end_time)}),Y.error&&v.jsx("span",{style:{color:"var(--color-muted)"},children:Y.error})]})]}),v.jsx("span",{className:"sessions-card-chevron",children:"›"})]},`${Y.task_id}-${Y.run_id}-${J}`)),v.jsx("div",{ref:U,style:{height:1}}),w&&v.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:v.jsx("div",{className:"spinner"})})]})]})}function Rk(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Mk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Lk={};function Y0(e,n){return(Lk.jsx?Dk:Mk).test(e)}const zk=/[ \t\n\f\r]/g;function Uk(e){return typeof e=="object"?e.type==="text"?G0(e.value):!1:G0(e)}function G0(e){return e.replace(zk,"")===""}class Fl{constructor(n,r,a){this.normal=r,this.property=n,a&&(this.space=a)}}Fl.prototype.normal={};Fl.prototype.property={};Fl.prototype.space=void 0;function Lx(e,n){const r={},a={};for(const l of e)Object.assign(r,l.property),Object.assign(a,l.normal);return new Fl(r,a,n)}function md(e){return e.toLowerCase()}class Tn{constructor(n,r){this.attribute=r,this.property=n}}Tn.prototype.attribute="";Tn.prototype.booleanish=!1;Tn.prototype.boolean=!1;Tn.prototype.commaOrSpaceSeparated=!1;Tn.prototype.commaSeparated=!1;Tn.prototype.defined=!1;Tn.prototype.mustUseProperty=!1;Tn.prototype.number=!1;Tn.prototype.overloadedBoolean=!1;Tn.prototype.property="";Tn.prototype.spaceSeparated=!1;Tn.prototype.space=void 0;let Bk=0;const Je=ma(),Kt=ma(),pd=ma(),Se=ma(),Tt=ma(),us=ma(),Un=ma();function ma(){return 2**++Bk}const gd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Je,booleanish:Kt,commaOrSpaceSeparated:Un,commaSeparated:us,number:Se,overloadedBoolean:pd,spaceSeparated:Tt},Symbol.toStringTag,{value:"Module"})),Mh=Object.keys(gd);class Id extends Tn{constructor(n,r,a,l){let u=-1;if(super(n,r),V0(this,"space",l),typeof a=="number")for(;++u<Mh.length;){const c=Mh[u];V0(this,Mh[u],(a&gd[c])===gd[c])}}}Id.prototype.defined=!0;function V0(e,n,r){r&&(e[n]=r)}function bs(e){const n={},r={};for(const[a,l]of Object.entries(e.properties)){const u=new Id(a,e.transform(e.attributes||{},a),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(u.mustUseProperty=!0),n[a]=u,r[md(a)]=a,r[md(u.attribute)]=a}return new Fl(n,r,e.space)}const zx=bs({properties:{ariaActiveDescendant:null,ariaAtomic:Kt,ariaAutoComplete:null,ariaBusy:Kt,ariaChecked:Kt,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Tt,ariaCurrent:null,ariaDescribedBy:Tt,ariaDetails:null,ariaDisabled:Kt,ariaDropEffect:Tt,ariaErrorMessage:null,ariaExpanded:Kt,ariaFlowTo:Tt,ariaGrabbed:Kt,ariaHasPopup:null,ariaHidden:Kt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Tt,ariaLevel:Se,ariaLive:null,ariaModal:Kt,ariaMultiLine:Kt,ariaMultiSelectable:Kt,ariaOrientation:null,ariaOwns:Tt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:Kt,ariaReadOnly:Kt,ariaRelevant:null,ariaRequired:Kt,ariaRoleDescription:Tt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:Kt,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Ux(e,n){return n in e?e[n]:n}function Bx(e,n){return Ux(e,n.toLowerCase())}const Pk=bs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:us,acceptCharset:Tt,accessKey:Tt,action:null,allow:null,allowFullScreen:Je,allowPaymentRequest:Je,allowUserMedia:Je,alt:null,as:null,async:Je,autoCapitalize:null,autoComplete:Tt,autoFocus:Je,autoPlay:Je,blocking:Tt,capture:null,charSet:null,checked:Je,cite:null,className:Tt,cols:Se,colSpan:null,content:null,contentEditable:Kt,controls:Je,controlsList:Tt,coords:Se|us,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Je,defer:Je,dir:null,dirName:null,disabled:Je,download:pd,draggable:Kt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Je,formTarget:null,headers:Tt,height:Se,hidden:pd,high:Se,href:null,hrefLang:null,htmlFor:Tt,httpEquiv:Tt,id:null,imageSizes:null,imageSrcSet:null,inert:Je,inputMode:null,integrity:null,is:null,isMap:Je,itemId:null,itemProp:Tt,itemRef:Tt,itemScope:Je,itemType:Tt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Je,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Je,muted:Je,name:null,nonce:null,noModule:Je,noValidate:Je,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:Je,optimum:Se,pattern:null,ping:Tt,placeholder:null,playsInline:Je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Je,referrerPolicy:null,rel:Tt,required:Je,reversed:Je,rows:Se,rowSpan:Se,sandbox:Tt,scope:null,scoped:Je,seamless:Je,selected:Je,shadowRootClonable:Je,shadowRootDelegatesFocus:Je,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:Kt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Je,useMap:null,value:Kt,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Tt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Je,declare:Je,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Je,noHref:Je,noShade:Je,noWrap:Je,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:Kt,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Je,disableRemotePlayback:Je,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:Bx}),Hk=bs({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:Un,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:Tt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:Je,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:us,g2:us,glyphName:us,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:Un,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Tt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Un,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Un,rev:Un,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Un,requiredFeatures:Un,requiredFonts:Un,requiredFormats:Un,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:Un,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Un,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Un,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ux}),Px=bs({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()}}),Hx=bs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Bx}),qx=bs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),qk={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Ik=/[A-Z]/g,J0=/-[a-z]/g,Fk=/^data[-\w.:]+$/i;function $k(e,n){const r=md(n);let a=n,l=Tn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Fk.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(J0,Gk);a="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!J0.test(u)){let c=u.replace(Ik,Yk);c.charAt(0)!=="-"&&(c="-"+c),n="data"+c}}l=Id}return new l(a,n)}function Yk(e){return"-"+e.toLowerCase()}function Gk(e){return e.charAt(1).toUpperCase()}const Vk=Lx([zx,Pk,Px,Hx,qx],"html"),Fd=Lx([zx,Hk,Px,Hx,qx],"svg");function Jk(e){return e.join(" ").trim()}var Qa={},Dh,X0;function Xk(){if(X0)return Dh;X0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
93
+ `,d="/",y="*",g="",b="comment",w="declaration";function k(U,O){if(typeof U!="string")throw new TypeError("First argument must be a string");if(!U)return[];O=O||{};var P=1,q=1;function oe(se){var ne=se.match(n);ne&&(P+=ne.length);var V=se.lastIndexOf(m);q=~V?se.length-V:q+se.length}function B(){var se={line:P,column:q};return function(ne){return ne.position=new z(se),$(),ne}}function z(se){this.start=se,this.end={line:P,column:q},this.source=O.source}z.prototype.content=U;function K(se){var ne=new Error(O.source+":"+P+":"+q+": "+se);if(ne.reason=se,ne.filename=O.source,ne.line=P,ne.column=q,ne.source=U,!O.silent)throw ne}function F(se){var ne=se.exec(U);if(ne){var V=ne[0];return oe(V),U=U.slice(V.length),ne}}function $(){F(r)}function D(se){var ne;for(se=se||[];ne=Y();)ne!==!1&&se.push(ne);return se}function Y(){var se=B();if(!(d!=U.charAt(0)||y!=U.charAt(1))){for(var ne=2;g!=U.charAt(ne)&&(y!=U.charAt(ne)||d!=U.charAt(ne+1));)++ne;if(ne+=2,g===U.charAt(ne-1))return K("End of comment missing");var V=U.slice(2,ne-2);return q+=2,oe(V),U=U.slice(ne),q+=2,se({type:b,comment:V})}}function J(){var se=B(),ne=F(a);if(ne){if(Y(),!F(l))return K("property missing ':'");var V=F(u),ie=se({type:w,property:M(ne[0].replace(e,g)),value:V?M(V[0].replace(e,g)):g});return F(c),ie}}function W(){var se=[];D(se);for(var ne;ne=J();)ne!==!1&&(se.push(ne),D(se));return se}return $(),W()}function M(U){return U?U.replace(f,g):g}return Dh=k,Dh}var K0;function Kk(){if(K0)return Qa;K0=1;var e=Qa&&Qa.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.default=r;const n=e(Xk());function r(a,l){let u=null;if(!a||typeof a!="string")return u;const c=(0,n.default)(a),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 Qa}var pl={},Q0;function Qk(){if(Q0)return pl;Q0=1,Object.defineProperty(pl,"__esModule",{value:!0}),pl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,a=/^-(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(a,f),d.replace(n,c))};return pl.camelCase=m,pl}var gl,Z0;function Zk(){if(Z0)return gl;Z0=1;var e=gl&&gl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},n=e(Kk()),r=Qk();function a(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 a.default=a,gl=a,gl}var Wk=Zk();const eC=Ub(Wk),Ix=Fx("end"),$d=Fx("start");function Fx(e){return n;function n(r){const a=r&&r.position&&r.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function tC(e){const n=$d(e),r=Ix(e);if(n&&r)return{start:n,end:r}}function Al(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?W0(e.position):"start"in e||"end"in e?W0(e):"line"in e||"column"in e?yd(e):""}function yd(e){return eb(e&&e.line)+":"+eb(e&&e.column)}function W0(e){return yd(e&&e.start)+"-"+yd(e&&e.end)}function eb(e){return e&&typeof e=="number"?e:1}class hn extends Error{constructor(n,r,a){super(),typeof r=="string"&&(a=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 a=="string"){const m=a.indexOf(":");m===-1?u.ruleId=a:(u.source=a.slice(0,m),u.ruleId=a.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}}hn.prototype.file="";hn.prototype.name="";hn.prototype.reason="";hn.prototype.message="";hn.prototype.stack="";hn.prototype.column=void 0;hn.prototype.line=void 0;hn.prototype.ancestors=void 0;hn.prototype.cause=void 0;hn.prototype.fatal=void 0;hn.prototype.place=void 0;hn.prototype.ruleId=void 0;hn.prototype.source=void 0;const Yd={}.hasOwnProperty,nC=new Map,rC=/[A-Z]/g,iC=new Set(["table","tbody","thead","tfoot","tr"]),aC=new Set(["td","th"]),$x="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function sC(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let a;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=mC(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");a=dC(r,n.jsx,n.jsxs)}const l={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:a,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"?Fd:Vk,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=Yx(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function Yx(e,n,r){if(n.type==="element")return lC(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return oC(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return cC(e,n,r);if(n.type==="mdxjsEsm")return uC(e,n);if(n.type==="root")return fC(e,n,r);if(n.type==="text")return hC(e,n)}function lC(e,n,r){const a=e.schema;let l=a;n.tagName.toLowerCase()==="svg"&&a.space==="html"&&(l=Fd,e.schema=l),e.ancestors.push(n);const u=Vx(e,n.tagName,!1),c=pC(e,n);let f=Vd(e,n);return iC.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!Uk(m):!0})),Gx(e,c,u,n),Gd(c,f),e.ancestors.pop(),e.schema=a,e.create(n,u,c,r)}function oC(e,n){if(n.data&&n.data.estree&&e.evaluater){const a=n.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}Ll(e,n.position)}function uC(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Ll(e,n.position)}function cC(e,n,r){const a=e.schema;let l=a;n.name==="svg"&&a.space==="html"&&(l=Fd,e.schema=l),e.ancestors.push(n);const u=n.name===null?e.Fragment:Vx(e,n.name,!0),c=gC(e,n),f=Vd(e,n);return Gx(e,c,u,n),Gd(c,f),e.ancestors.pop(),e.schema=a,e.create(n,u,c,r)}function fC(e,n,r){const a={};return Gd(a,Vd(e,n)),e.create(n,e.Fragment,a,r)}function hC(e,n){return n.value}function Gx(e,n,r,a){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=a)}function Gd(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function dC(e,n,r){return a;function a(l,u,c,f){const d=Array.isArray(c.children)?r:n;return f?d(u,c,f):d(u,c)}}function mC(e,n){return r;function r(a,l,u,c){const f=Array.isArray(u.children),m=$d(a);return n(l,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function pC(e,n){const r={};let a,l;for(l in n.properties)if(l!=="children"&&Yd.call(n.properties,l)){const u=yC(e,l,n.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&aC.has(n.tagName)?a=f:r[c]=f}}if(a){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return r}function gC(e,n){const r={};for(const a of n.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const u=a.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 Ll(e,n.position);else{const l=a.name;let u;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const f=a.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else Ll(e,n.position);else u=a.value===null?!0:a.value;r[l]=u}return r}function Vd(e,n){const r=[];let a=-1;const l=e.passKeys?new Map:nC;for(;++a<n.children.length;){const u=n.children[a];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=Yx(e,u,c);f!==void 0&&r.push(f)}return r}function yC(e,n,r){const a=$k(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=a.commaSeparated?Rk(r):Jk(r)),a.property==="style"){let l=typeof r=="object"?r:bC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=xC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&a.space?qk[a.property]||a.property:a.attribute,r]}}function bC(e,n){try{return eC(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,l=new hn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=$x+"#cannot-parse-style-attribute",l}}function Vx(e,n,r){let a;if(!r)a={type:"Literal",value:n};else if(n.includes(".")){const l=n.split(".");let u=-1,c;for(;++u<l.length;){const f=Y0(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}a=c}else a=Y0(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(a.type==="Literal"){const l=a.value;return Yd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(a);Ll(e)}function Ll(e,n){const r=new hn("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=$x+"#cannot-handle-mdx-estrees-without-createevaluater",r}function xC(e){const n={};let r;for(r in e)Yd.call(e,r)&&(n[vC(r)]=e[r]);return n}function vC(e){let n=e.replace(rC,wC);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function wC(e){return"-"+e.toLowerCase()}const Lh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},SC={};function Jd(e,n){const r=SC,a=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Jx(e,a,l)}function Jx(e,n,r){if(_C(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 tb(e.children,n,r)}return Array.isArray(e)?tb(e,n,r):""}function tb(e,n,r){const a=[];let l=-1;for(;++l<e.length;)a[l]=Jx(e[l],n,r);return a.join("")}function _C(e){return!!(e&&typeof e=="object")}const nb=document.createElement("i");function Xd(e){const n="&"+e+";";nb.innerHTML=n;const r=nb.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function In(e,n,r,a){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,a.length<1e4)c=Array.from(a),c.unshift(n,r),e.splice(...c);else for(r&&e.splice(n,r);u<a.length;)c=a.slice(u,u+1e4),c.unshift(n,0),e.splice(...c),u+=1e4,n+=1e4}function rr(e,n){return e.length>0?(In(e,e.length,0,n),e):n}const rb={}.hasOwnProperty;function Xx(e){const n={};let r=-1;for(;++r<e.length;)EC(n,e[r]);return n}function EC(e,n){let r;for(r in n){const l=(rb.call(e,r)?e[r]:void 0)||(e[r]={}),u=n[r];let c;if(u)for(c in u){rb.call(l,c)||(l[c]=[]);const f=u[c];kC(l[c],Array.isArray(f)?f:f?[f]:[])}}}function kC(e,n){let r=-1;const a=[];for(;++r<n.length;)(n[r].add==="after"?e:a).push(n[r]);In(e,0,0,a)}function Kx(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 gr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const yn=Hi(/[A-Za-z]/),fn=Hi(/[\dA-Za-z]/),CC=Hi(/[#-'*+\--9=?A-Z^-~]/);function Du(e){return e!==null&&(e<32||e===127)}const bd=Hi(/\d/),AC=Hi(/[\dA-Fa-f]/),TC=Hi(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function At(e){return e!==null&&(e<0||e===32)}function tt(e){return e===-2||e===-1||e===32}const Gu=Hi(new RegExp("\\p{P}|\\p{S}","u")),ha=Hi(/\s/);function Hi(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function xs(e){const n=[];let r=-1,a=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&fn(e.charCodeAt(r+1))&&fn(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(a,r),encodeURIComponent(c)),a=r+l+1,c=""),l&&(r+=l,l=0)}return n.join("")+e.slice(a)}function lt(e,n,r,a){const l=a?a-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return tt(m)?(e.enter(r),f(m)):n(m)}function f(m){return tt(m)&&u++<l?(e.consume(m),f):(e.exit(r),n(m))}}const jC={tokenize:NC};function NC(e){const n=e.attempt(this.parser.constructs.contentInitial,a,l);let r;return n;function a(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),lt(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 Pe(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const OC={tokenize:RC},ib={tokenize:MC};function RC(e){const n=this,r=[];let a=0,l,u,c;return f;function f(q){if(a<r.length){const oe=r[a];return n.containerState=oe[1],e.attempt(oe[0].continuation,m,d)(q)}return d(q)}function m(q){if(a++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,l&&P();const oe=n.events.length;let B=oe,z;for(;B--;)if(n.events[B][0]==="exit"&&n.events[B][1].type==="chunkFlow"){z=n.events[B][1].end;break}O(a);let K=oe;for(;K<n.events.length;)n.events[K][1].end={...z},K++;return In(n.events,B+1,0,n.events.slice(oe)),n.events.length=K,d(q)}return f(q)}function d(q){if(a===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(ib,y,g)(q)}function y(q){return l&&P(),O(a),b(q)}function g(q){return n.parser.lazy[n.now().line]=a!==r.length,c=n.now().offset,k(q)}function b(q){return n.containerState={},e.attempt(ib,w,k)(q)}function w(q){return a++,r.push([n.currentConstruct,n.containerState]),b(q)}function k(q){if(q===null){l&&P(),O(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),O(0),e.consume(q);return}return Pe(q)?(e.consume(q),U(e.exit("chunkFlow")),a=0,n.interrupt=void 0,f):(e.consume(q),M)}function U(q,oe){const B=n.sliceStream(q);if(oe&&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 z=l.events.length;for(;z--;)if(l.events[z][1].start.offset<c&&(!l.events[z][1].end||l.events[z][1].end.offset>c))return;const K=n.events.length;let F=K,$,D;for(;F--;)if(n.events[F][0]==="exit"&&n.events[F][1].type==="chunkFlow"){if($){D=n.events[F][1].end;break}$=!0}for(O(a),z=K;z<n.events.length;)n.events[z][1].end={...D},z++;In(n.events,F+1,0,n.events.slice(K)),n.events.length=z}}function O(q){let oe=r.length;for(;oe-- >q;){const B=r[oe];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 MC(e,n,r){return lt(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ms(e){if(e===null||At(e)||ha(e))return 1;if(Gu(e))return 2}function Vu(e,n,r){const a=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!a.includes(u)&&(n=u(n,r),a.push(u))}return n}const xd={name:"attention",resolveAll:DC,tokenize:LC};function DC(e,n){let r=-1,a,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(a=r;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&n.sliceSerialize(e[a][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[a][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[a][1].end},b={...e[r][1].start};ab(g,-m),ab(b,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:b},u={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[r][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[a][1].end={...c.start},e[r][1].start={...f.end},d=[],e[a][1].end.offset-e[a][1].start.offset&&(d=rr(d,[["enter",e[a][1],n],["exit",e[a][1],n]])),d=rr(d,[["enter",l,n],["enter",c,n],["exit",c,n],["enter",u,n]]),d=rr(d,Vu(n.parser.constructs.insideSpan.null,e.slice(a+1,r),n)),d=rr(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=rr(d,[["enter",e[r][1],n],["exit",e[r][1],n]])):y=0,In(e,a-1,r-a+3,d),r=a+d.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function LC(e,n){const r=this.parser.constructs.attentionMarkers.null,a=this.previous,l=ms(a);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=ms(m),g=!y||y===2&&l||r.includes(m),b=!l||l===2&&y||r.includes(a);return d._open=!!(u===42?g:g&&(l||!b)),d._close=!!(u===42?b:b&&(y||!g)),n(m)}}function ab(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const zC={name:"autolink",tokenize:UC};function UC(e,n,r){let a=0;return l;function l(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(w){return yn(w)?(e.consume(w),c):w===64?r(w):d(w)}function c(w){return w===43||w===45||w===46||fn(w)?(a=1,f(w)):d(w)}function f(w){return w===58?(e.consume(w),a=0,m):(w===43||w===45||w===46||fn(w))&&a++<32?(e.consume(w),f):(a=0,d(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):w===null||w===32||w===60||Du(w)?r(w):(e.consume(w),m)}function d(w){return w===64?(e.consume(w),y):CC(w)?(e.consume(w),d):r(w)}function y(w){return fn(w)?g(w):r(w)}function g(w){return w===46?(e.consume(w),a=0,y):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):b(w)}function b(w){if((w===45||fn(w))&&a++<63){const k=w===45?b:g;return e.consume(w),k}return r(w)}}const $l={partial:!0,tokenize:BC};function BC(e,n,r){return a;function a(u){return tt(u)?lt(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Pe(u)?n(u):r(u)}}const Qx={continuation:{tokenize:HC},exit:qC,name:"blockQuote",tokenize:PC};function PC(e,n,r){const a=this;return l;function l(c){if(c===62){const f=a.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 tt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(c))}}function HC(e,n,r){const a=this;return l;function l(c){return tt(c)?lt(e,u,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(Qx,n,r)(c)}}function qC(e){e.exit("blockQuote")}const Zx={name:"characterEscape",tokenize:IC};function IC(e,n,r){return a;function a(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return TC(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(u)}}const Wx={name:"characterReference",tokenize:FC};function FC(e,n,r){const a=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=fn,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=AC,y):(e.enter("characterReferenceValue"),u=7,c=bd,y(g))}function y(g){if(g===59&&l){const b=e.exit("characterReferenceValue");return c===fn&&!Xd(a.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 sb={partial:!0,tokenize:YC},lb={concrete:!0,name:"codeFenced",tokenize:$C};function $C(e,n,r){const a=this,l={partial:!0,tokenize:B};let u=0,c=0,f;return m;function m(z){return d(z)}function d(z){const K=a.events[a.events.length-1];return u=K&&K[1].type==="linePrefix"?K[2].sliceSerialize(K[1],!0).length:0,f=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(z)}function y(z){return z===f?(c++,e.consume(z),y):c<3?r(z):(e.exit("codeFencedFenceSequence"),tt(z)?lt(e,g,"whitespace")(z):g(z))}function g(z){return z===null||Pe(z)?(e.exit("codeFencedFence"),a.interrupt?n(z):e.check(sb,M,oe)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(z))}function b(z){return z===null||Pe(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(z)):tt(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),lt(e,w,"whitespace")(z)):z===96&&z===f?r(z):(e.consume(z),b)}function w(z){return z===null||Pe(z)?g(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(z))}function k(z){return z===null||Pe(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(z)):z===96&&z===f?r(z):(e.consume(z),k)}function M(z){return e.attempt(l,oe,U)(z)}function U(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),O}function O(z){return u>0&&tt(z)?lt(e,P,"linePrefix",u+1)(z):P(z)}function P(z){return z===null||Pe(z)?e.check(sb,M,oe)(z):(e.enter("codeFlowValue"),q(z))}function q(z){return z===null||Pe(z)?(e.exit("codeFlowValue"),P(z)):(e.consume(z),q)}function oe(z){return e.exit("codeFenced"),n(z)}function B(z,K,F){let $=0;return D;function D(ne){return z.enter("lineEnding"),z.consume(ne),z.exit("lineEnding"),Y}function Y(ne){return z.enter("codeFencedFence"),tt(ne)?lt(z,J,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ne):J(ne)}function J(ne){return ne===f?(z.enter("codeFencedFenceSequence"),W(ne)):F(ne)}function W(ne){return ne===f?($++,z.consume(ne),W):$>=c?(z.exit("codeFencedFenceSequence"),tt(ne)?lt(z,se,"whitespace")(ne):se(ne)):F(ne)}function se(ne){return ne===null||Pe(ne)?(z.exit("codeFencedFence"),K(ne)):F(ne)}}}function YC(e,n,r){const a=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 a.parser.lazy[a.now().line]?r(c):n(c)}}const zh={name:"codeIndented",tokenize:VC},GC={partial:!0,tokenize:JC};function VC(e,n,r){const a=this;return l;function l(d){return e.enter("codeIndented"),lt(e,u,"linePrefix",5)(d)}function u(d){const y=a.events[a.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):Pe(d)?e.attempt(GC,c,m)(d):(e.enter("codeFlowValue"),f(d))}function f(d){return d===null||Pe(d)?(e.exit("codeFlowValue"),c(d)):(e.consume(d),f)}function m(d){return e.exit("codeIndented"),n(d)}}function JC(e,n,r){const a=this;return l;function l(c){return a.parser.lazy[a.now().line]?r(c):Pe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):lt(e,u,"linePrefix",5)(c)}function u(c){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):Pe(c)?l(c):r(c)}}const XC={name:"codeText",previous:QC,resolve:KC,tokenize:ZC};function KC(e){let n=e.length-4,r=3,a,l;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(a=r;++a<n;)if(e[a][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(a=r-1,n++;++a<=n;)l===void 0?a!==n&&e[a][1].type!=="lineEnding"&&(l=a):(a===n||e[a][1].type==="lineEnding")&&(e[l][1].type="codeTextData",a!==l+2&&(e[l][1].end=e[a-1][1].end,e.splice(l+2,a-l-2),n-=a-l-2,a=l+2),l=void 0);return e}function QC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ZC(e,n,r){let a=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),a++,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)):Pe(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||Pe(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),d)}function y(g){return g===96?(e.consume(g),l++,y):l===a?(e.exit("codeTextSequence"),e.exit("codeText"),n(g)):(u.type="codeTextData",d(g))}}class WC{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 a=r??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(n,a):n>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(n,r,a){const l=r||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return a&&yl(this.left,a),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 e1(e){const n={};let r=-1,a,l,u,c,f,m,d;const y=new WC(e);for(;++r<y.length;){for(;r in n;)r=n[r];if(a=y.get(r),r&&a[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(m=a[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(a[0]==="enter")a[1].contentType&&(Object.assign(n,eA(y,r)),r=n[r],d=!0);else if(a[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&&(a[1].end={...y.get(l)[1].start},f=y.slice(l,r),f.unshift(a),y.splice(l,r-l+1,f))}}return In(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!d}function eA(e,n){const r=e.get(n)[1],a=e.get(n)[2];let l=n-1;const u=[];let c=r._tokenizer;c||(c=a.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],d={};let y,g,b=-1,w=r,k=0,M=0;const U=[M];for(;w;){for(;e.get(++l)[1]!==w;);u.push(l),w._tokenizer||(y=a.sliceStream(w),w.next||y.push(null),g&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=w,w=w.next}for(w=r;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(M=b+1,U.push(M),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(c.events=[],w?(w._tokenizer=void 0,w.previous=void 0):U.pop(),b=U.length;b--;){const O=f.slice(U[b],U[b+1]),P=u.pop();m.push([P,P+O.length-1]),e.splice(P,2,O)}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 tA={resolve:rA,tokenize:iA},nA={partial:!0,tokenize:aA};function rA(e){return e1(e),e}function iA(e,n){let r;return a;function a(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?u(f):Pe(f)?e.check(nA,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 aA(e,n,r){const a=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),lt(e,u,"linePrefix")}function u(c){if(c===null||Pe(c))return r(c);const f=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):e.interrupt(a.parser.constructs.flow,r,n)(c)}}function t1(e,n,r,a,l,u,c,f,m){const d=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(O){return O===60?(e.enter(a),e.enter(l),e.enter(u),e.consume(O),e.exit(u),b):O===null||O===32||O===41||Du(O)?r(O):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),M(O))}function b(O){return O===62?(e.enter(u),e.consume(O),e.exit(u),e.exit(l),e.exit(a),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(O))}function w(O){return O===62?(e.exit("chunkString"),e.exit(f),b(O)):O===null||O===60||Pe(O)?r(O):(e.consume(O),O===92?k:w)}function k(O){return O===60||O===62||O===92?(e.consume(O),w):w(O)}function M(O){return!y&&(O===null||O===41||At(O))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),n(O)):y<d&&O===40?(e.consume(O),y++,M):O===41?(e.consume(O),y--,M):O===null||O===32||O===40||Du(O)?r(O):(e.consume(O),O===92?U:M)}function U(O){return O===40||O===41||O===92?(e.consume(O),M):M(O)}}function n1(e,n,r,a,l,u){const c=this;let f=0,m;return d;function d(w){return e.enter(a),e.enter(l),e.consume(w),e.exit(l),e.enter(u),y}function y(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(w):w===93?(e.exit(u),e.enter(l),e.consume(w),e.exit(l),e.exit(a),n):Pe(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||w===91||w===93||Pe(w)||f++>999?(e.exit("chunkString"),y(w)):(e.consume(w),m||(m=!tt(w)),w===92?b:g)}function b(w){return w===91||w===92||w===93?(e.consume(w),f++,g):g(w)}}function r1(e,n,r,a,l,u){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(a),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(a),n):(e.enter(u),d(b))}function d(b){return b===c?(e.exit(u),m(c)):b===null?r(b):Pe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),lt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===c||b===null||Pe(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 a;function a(l){return Pe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,a):tt(l)?lt(e,a,r?"linePrefix":"lineSuffix")(l):n(l)}}const sA={name:"definition",tokenize:oA},lA={partial:!0,tokenize:uA};function oA(e,n,r){const a=this;let l;return u;function u(w){return e.enter("definition"),c(w)}function c(w){return n1.call(a,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return l=gr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):r(w)}function m(w){return At(w)?Tl(e,d)(w):d(w)}function d(w){return t1(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function y(w){return e.attempt(lA,g,g)(w)}function g(w){return tt(w)?lt(e,b,"whitespace")(w):b(w)}function b(w){return w===null||Pe(w)?(e.exit("definition"),a.parser.defined.push(l),n(w)):r(w)}}function uA(e,n,r){return a;function a(f){return At(f)?Tl(e,l)(f):r(f)}function l(f){return r1(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return tt(f)?lt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Pe(f)?n(f):r(f)}}const cA={name:"hardBreakEscape",tokenize:fA};function fA(e,n,r){return a;function a(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Pe(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const hA={name:"headingAtx",resolve:dA,tokenize:mA};function dA(e,n){let r=e.length-2,a=3,l,u;return e[a][1].type==="whitespace"&&(a+=2),r-2>a&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(a===r-1||r-4>a&&e[r-2][1].type==="whitespace")&&(r-=a+1===r?2:4),r>a&&(l={type:"atxHeadingText",start:e[a][1].start,end:e[r][1].end},u={type:"chunkText",start:e[a][1].start,end:e[r][1].end,contentType:"text"},In(e,a,r-a+1,[["enter",l,n],["enter",u,n],["exit",u,n],["exit",l,n]])),e}function mA(e,n,r){let a=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&&a++<6?(e.consume(y),c):y===null||At(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||Pe(y)?(e.exit("atxHeading"),n(y)):tt(y)?lt(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||At(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),d)}}const pA=["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"],ob=["pre","script","style","textarea"],gA={concrete:!0,name:"htmlFlow",resolveTo:xA,tokenize:vA},yA={partial:!0,tokenize:SA},bA={partial:!0,tokenize:wA};function xA(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 vA(e,n,r){const a=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,a.interrupt?n:E):yn(A)?(e.consume(A),c=String.fromCharCode(A),U):r(A)}function b(A){return A===45?(e.consume(A),l=2,w):A===91?(e.consume(A),l=5,f=0,k):yn(A)?(e.consume(A),l=4,a.interrupt?n:E):r(A)}function w(A){return A===45?(e.consume(A),a.interrupt?n:E):r(A)}function k(A){const ve="CDATA[";return A===ve.charCodeAt(f++)?(e.consume(A),f===ve.length?a.interrupt?n:J:k):r(A)}function M(A){return yn(A)?(e.consume(A),c=String.fromCharCode(A),U):r(A)}function U(A){if(A===null||A===47||A===62||At(A)){const ve=A===47,Ne=c.toLowerCase();return!ve&&!u&&ob.includes(Ne)?(l=1,a.interrupt?n(A):J(A)):pA.includes(c.toLowerCase())?(l=6,ve?(e.consume(A),O):a.interrupt?n(A):J(A)):(l=7,a.interrupt&&!a.parser.lazy[a.now().line]?r(A):u?P(A):q(A))}return A===45||fn(A)?(e.consume(A),c+=String.fromCharCode(A),U):r(A)}function O(A){return A===62?(e.consume(A),a.interrupt?n:J):r(A)}function P(A){return tt(A)?(e.consume(A),P):D(A)}function q(A){return A===47?(e.consume(A),D):A===58||A===95||yn(A)?(e.consume(A),oe):tt(A)?(e.consume(A),q):D(A)}function oe(A){return A===45||A===46||A===58||A===95||fn(A)?(e.consume(A),oe):B(A)}function B(A){return A===61?(e.consume(A),z):tt(A)?(e.consume(A),B):q(A)}function z(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),m=A,K):tt(A)?(e.consume(A),z):F(A)}function K(A){return A===m?(e.consume(A),m=null,$):A===null||Pe(A)?r(A):(e.consume(A),K)}function F(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||At(A)?B(A):(e.consume(A),F)}function $(A){return A===47||A===62||tt(A)?q(A):r(A)}function D(A){return A===62?(e.consume(A),Y):r(A)}function Y(A){return A===null||Pe(A)?J(A):tt(A)?(e.consume(A),Y):r(A)}function J(A){return A===45&&l===2?(e.consume(A),V):A===60&&l===1?(e.consume(A),ie):A===62&&l===4?(e.consume(A),N):A===63&&l===3?(e.consume(A),E):A===93&&l===5?(e.consume(A),Ee):Pe(A)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(yA,Z,W)(A)):A===null||Pe(A)?(e.exit("htmlFlowData"),W(A)):(e.consume(A),J)}function W(A){return e.check(bA,se,Z)(A)}function se(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),ne}function ne(A){return A===null||Pe(A)?W(A):(e.enter("htmlFlowData"),J(A))}function V(A){return A===45?(e.consume(A),E):J(A)}function ie(A){return A===47?(e.consume(A),c="",pe):J(A)}function pe(A){if(A===62){const ve=c.toLowerCase();return ob.includes(ve)?(e.consume(A),N):J(A)}return yn(A)&&c.length<8?(e.consume(A),c+=String.fromCharCode(A),pe):J(A)}function Ee(A){return A===93?(e.consume(A),E):J(A)}function E(A){return A===62?(e.consume(A),N):A===45&&l===2?(e.consume(A),E):J(A)}function N(A){return A===null||Pe(A)?(e.exit("htmlFlowData"),Z(A)):(e.consume(A),N)}function Z(A){return e.exit("htmlFlow"),n(A)}}function wA(e,n,r){const a=this;return l;function l(c){return Pe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return a.parser.lazy[a.now().line]?r(c):n(c)}}function SA(e,n,r){return a;function a(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt($l,n,r)}}const _A={name:"htmlText",tokenize:EA};function EA(e,n,r){const a=this;let l,u,c;return f;function f(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),m}function m(E){return E===33?(e.consume(E),d):E===47?(e.consume(E),B):E===63?(e.consume(E),q):yn(E)?(e.consume(E),F):r(E)}function d(E){return E===45?(e.consume(E),y):E===91?(e.consume(E),u=0,k):yn(E)?(e.consume(E),P):r(E)}function y(E){return E===45?(e.consume(E),w):r(E)}function g(E){return E===null?r(E):E===45?(e.consume(E),b):Pe(E)?(c=g,ie(E)):(e.consume(E),g)}function b(E){return E===45?(e.consume(E),w):g(E)}function w(E){return E===62?V(E):E===45?b(E):g(E)}function k(E){const N="CDATA[";return E===N.charCodeAt(u++)?(e.consume(E),u===N.length?M:k):r(E)}function M(E){return E===null?r(E):E===93?(e.consume(E),U):Pe(E)?(c=M,ie(E)):(e.consume(E),M)}function U(E){return E===93?(e.consume(E),O):M(E)}function O(E){return E===62?V(E):E===93?(e.consume(E),O):M(E)}function P(E){return E===null||E===62?V(E):Pe(E)?(c=P,ie(E)):(e.consume(E),P)}function q(E){return E===null?r(E):E===63?(e.consume(E),oe):Pe(E)?(c=q,ie(E)):(e.consume(E),q)}function oe(E){return E===62?V(E):q(E)}function B(E){return yn(E)?(e.consume(E),z):r(E)}function z(E){return E===45||fn(E)?(e.consume(E),z):K(E)}function K(E){return Pe(E)?(c=K,ie(E)):tt(E)?(e.consume(E),K):V(E)}function F(E){return E===45||fn(E)?(e.consume(E),F):E===47||E===62||At(E)?$(E):r(E)}function $(E){return E===47?(e.consume(E),V):E===58||E===95||yn(E)?(e.consume(E),D):Pe(E)?(c=$,ie(E)):tt(E)?(e.consume(E),$):V(E)}function D(E){return E===45||E===46||E===58||E===95||fn(E)?(e.consume(E),D):Y(E)}function Y(E){return E===61?(e.consume(E),J):Pe(E)?(c=Y,ie(E)):tt(E)?(e.consume(E),Y):$(E)}function J(E){return E===null||E===60||E===61||E===62||E===96?r(E):E===34||E===39?(e.consume(E),l=E,W):Pe(E)?(c=J,ie(E)):tt(E)?(e.consume(E),J):(e.consume(E),se)}function W(E){return E===l?(e.consume(E),l=void 0,ne):E===null?r(E):Pe(E)?(c=W,ie(E)):(e.consume(E),W)}function se(E){return E===null||E===34||E===39||E===60||E===61||E===96?r(E):E===47||E===62||At(E)?$(E):(e.consume(E),se)}function ne(E){return E===47||E===62||At(E)?$(E):r(E)}function V(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),n):r(E)}function ie(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),pe}function pe(E){return tt(E)?lt(e,Ee,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):Ee(E)}function Ee(E){return e.enter("htmlTextData"),c(E)}}const Kd={name:"labelEnd",resolveAll:TA,resolveTo:jA,tokenize:NA},kA={tokenize:OA},CA={tokenize:RA},AA={tokenize:MA};function TA(e){let n=-1;const r=[];for(;++n<e.length;){const a=e[n][1];if(r.push(e[n]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const l=a.type==="labelImage"?4:2;a.type="data",n+=l}}return e.length!==r.length&&In(e,0,e.length,r),e}function jA(e,n){let r=e.length,a=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")){a=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+a+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,n],["enter",d,n]],f=rr(f,e.slice(u+1,u+a+3)),f=rr(f,[["enter",y,n]]),f=rr(f,Vu(n.parser.constructs.insideSpan.null,e.slice(u+a+4,c-3),n)),f=rr(f,[["exit",y,n],e[c-2],e[c-1],["exit",d,n]]),f=rr(f,e.slice(c+1)),f=rr(f,[["exit",m,n]]),In(e,u,e.length,f),e}function NA(e,n,r){const a=this;let l=a.events.length,u,c;for(;l--;)if((a.events[l][1].type==="labelImage"||a.events[l][1].type==="labelLink")&&!a.events[l][1]._balanced){u=a.events[l][1];break}return f;function f(b){return u?u._inactive?g(b):(c=a.parser.defined.includes(gr(a.sliceSerialize({start:u.end,end:a.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(kA,y,c?y:g)(b):b===91?e.attempt(CA,y,c?d:g)(b):c?y(b):g(b)}function d(b){return e.attempt(AA,y,g)(b)}function y(b){return n(b)}function g(b){return u._balanced=!0,r(b)}}function OA(e,n,r){return a;function a(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return At(g)?Tl(e,u)(g):u(g)}function u(g){return g===41?y(g):t1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return At(g)?Tl(e,m)(g):y(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?r1(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function d(g){return At(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 RA(e,n,r){const a=this;return l;function l(f){return n1.call(a,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return a.parser.defined.includes(gr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function c(f){return r(f)}}function MA(e,n,r){return a;function a(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 DA={name:"labelStartImage",resolveAll:Kd.resolveAll,tokenize:LA};function LA(e,n,r){const a=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 a.parser.constructs?r(f):n(f)}}const zA={name:"labelStartLink",resolveAll:Kd.resolveAll,tokenize:UA};function UA(e,n,r){const a=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 a.parser.constructs?r(c):n(c)}}const Uh={name:"lineEnding",tokenize:BA};function BA(e,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),lt(e,n,"linePrefix")}}const vu={name:"thematicBreak",tokenize:PA};function PA(e,n,r){let a=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)):a>=3&&(d===null||Pe(d))?(e.exit("thematicBreak"),n(d)):r(d)}function m(d){return d===l?(e.consume(d),a++,m):(e.exit("thematicBreakSequence"),tt(d)?lt(e,f,"whitespace")(d):f(d))}}const Cn={continuation:{tokenize:FA},exit:YA,name:"list",tokenize:IA},HA={partial:!0,tokenize:GA},qA={partial:!0,tokenize:$A};function IA(e,n,r){const a=this,l=a.events[a.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return f;function f(w){const k=a.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||w===a.containerState.marker:bd(w)){if(a.containerState.type||(a.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(vu,r,d)(w):d(w);if(!a.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return r(w)}function m(w){return bd(w)&&++c<10?(e.consume(w),m):(!a.interrupt||c<2)&&(a.containerState.marker?w===a.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),d(w)):r(w)}function d(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||w,e.check($l,a.interrupt?r:y,e.attempt(HA,b,g))}function y(w){return a.containerState.initialBlankLine=!0,u++,b(w)}function g(w){return tt(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),b):r(w)}function b(w){return a.containerState.size=u+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(w)}}function FA(e,n,r){const a=this;return a.containerState._closeFlow=void 0,e.check($l,l,u);function l(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,lt(e,n,"listItemIndent",a.containerState.size+1)(f)}function u(f){return a.containerState.furtherBlankLines||!tt(f)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(f)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(qA,n,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,lt(e,e.attempt(Cn,n,r),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function $A(e,n,r){const a=this;return lt(e,l,"listItemIndent",a.containerState.size+1);function l(u){const c=a.events[a.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===a.containerState.size?n(u):r(u)}}function YA(e){e.exit(this.containerState.type)}function GA(e,n,r){const a=this;return lt(e,l,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const c=a.events[a.events.length-1];return!tt(u)&&c&&c[1].type==="listItemPrefixWhitespace"?n(u):r(u)}}const ub={name:"setextUnderline",resolveTo:VA,tokenize:JA};function VA(e,n){let r=e.length,a,l,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){a=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[a][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[a][1],n]),e[a][1].end={...e[u][1].end}):e[a][1]=c,e.push(["exit",c,n]),e}function JA(e,n,r){const a=this;let l;return u;function u(d){let y=a.events.length,g;for(;y--;)if(a.events[y][1].type!=="lineEnding"&&a.events[y][1].type!=="linePrefix"&&a.events[y][1].type!=="content"){g=a.events[y][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.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"),tt(d)?lt(e,m,"lineSuffix")(d):m(d))}function m(d){return d===null||Pe(d)?(e.exit("setextHeadingLine"),n(d)):r(d)}}const XA={tokenize:KA};function KA(e){const n=this,r=e.attempt($l,a,e.attempt(this.parser.constructs.flowInitial,l,lt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(tA,l)),"linePrefix")));return r;function a(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 QA={resolveAll:a1()},ZA=i1("string"),WA=i1("text");function i1(e){return{resolveAll:a1(e==="text"?eT:void 0),tokenize:n};function n(r){const a=this,l=this.parser.constructs[e],u=r.attempt(l,c,f);return c;function c(y){return d(y)?u(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),m}function m(y){return d(y)?(r.exit("data"),u(y)):(r.consume(y),m)}function d(y){if(y===null)return!0;const g=l[y];let b=-1;if(g)for(;++b<g.length;){const w=g[b];if(!w.previous||w.previous.call(a,a.previous))return!0}return!1}}}function a1(e){return n;function n(r,a){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,a):r}}function eT(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 a=e[r-1][1],l=n.sliceStream(a);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:a.start._bufferIndex+c,_index:a.start._index+u,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...d.start},a.start.offset===a.end.offset?Object.assign(a,d):(e.splice(r,0,["enter",d,n],["exit",d,n]),r+=2)}r++}return e}const tT={42:Cn,43:Cn,45:Cn,48:Cn,49:Cn,50:Cn,51:Cn,52:Cn,53:Cn,54:Cn,55:Cn,56:Cn,57:Cn,62:Qx},nT={91:sA},rT={[-2]:zh,[-1]:zh,32:zh},iT={35:hA,42:vu,45:[ub,vu],60:gA,61:ub,95:vu,96:lb,126:lb},aT={38:Wx,92:Zx},sT={[-5]:Uh,[-4]:Uh,[-3]:Uh,33:DA,38:Wx,42:xd,60:[zC,_A],91:zA,92:[cA,Zx],93:Kd,95:xd,96:XC},lT={null:[xd,QA]},oT={null:[42,95]},uT={null:[]},cT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:oT,contentInitial:nT,disable:uT,document:tT,flow:iT,flowInitial:rT,insideSpan:lT,string:aT,text:sT},Symbol.toStringTag,{value:"Module"}));function fT(e,n,r){let a={_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(z),consume:P,enter:q,exit:oe,interrupt:K(z,{interrupt:!0})},d={code:null,containerState:{},defineSkip:M,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:w,write:g};let y=n.tokenize.call(d,m);return n.resolveAll&&u.push(n),d;function g(Y){return c=rr(c,Y),U(),c[c.length-1]!==null?[]:(F(n,0),d.events=Vu(u,d.events,d),d.events)}function b(Y,J){return dT(w(Y),J)}function w(Y){return hT(c,Y)}function k(){const{_bufferIndex:Y,_index:J,line:W,column:se,offset:ne}=a;return{_bufferIndex:Y,_index:J,line:W,column:se,offset:ne}}function M(Y){l[Y.line]=Y.column,D()}function U(){let Y;for(;a._index<c.length;){const J=c[a._index];if(typeof J=="string")for(Y=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===Y&&a._bufferIndex<J.length;)O(J.charCodeAt(a._bufferIndex));else O(J)}}function O(Y){y=y(Y)}function P(Y){Pe(Y)?(a.line++,a.column=1,a.offset+=Y===-3?2:1,D()):Y!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===c[a._index].length&&(a._bufferIndex=-1,a._index++)),d.previous=Y}function q(Y,J){const W=J||{};return W.type=Y,W.start=k(),d.events.push(["enter",W,d]),f.push(W),W}function oe(Y){const J=f.pop();return J.end=k(),d.events.push(["exit",J,d]),J}function B(Y,J){F(Y,J.from)}function z(Y,J){J.restore()}function K(Y,J){return W;function W(se,ne,V){let ie,pe,Ee,E;return Array.isArray(se)?Z(se):"tokenize"in se?Z([se]):N(se);function N(Te){return Le;function Le(Ie){const ge=Ie!==null&&Te[Ie],ze=Ie!==null&&Te.null,Ke=[...Array.isArray(ge)?ge:ge?[ge]:[],...Array.isArray(ze)?ze:ze?[ze]:[]];return Z(Ke)(Ie)}}function Z(Te){return ie=Te,pe=0,Te.length===0?V:A(Te[pe])}function A(Te){return Le;function Le(Ie){return E=$(),Ee=Te,Te.partial||(d.currentConstruct=Te),Te.name&&d.parser.constructs.disable.null.includes(Te.name)?Ne():Te.tokenize.call(J?Object.assign(Object.create(d),J):d,m,ve,Ne)(Ie)}}function ve(Te){return Y(Ee,E),ne}function Ne(Te){return E.restore(),++pe<ie.length?A(ie[pe]):V}}}function F(Y,J){Y.resolveAll&&!u.includes(Y)&&u.push(Y),Y.resolve&&In(d.events,J,d.events.length-J,Y.resolve(d.events.slice(J),d)),Y.resolveTo&&(d.events=Y.resolveTo(d.events,d))}function $(){const Y=k(),J=d.previous,W=d.currentConstruct,se=d.events.length,ne=Array.from(f);return{from:se,restore:V};function V(){a=Y,d.previous=J,d.currentConstruct=W,d.events.length=se,f=ne,D()}}function D(){a.line in l&&a.column<2&&(a.column=l[a.line],a.offset+=l[a.line]-1)}}function hT(e,n){const r=n.start._index,a=n.start._bufferIndex,l=n.end._index,u=n.end._bufferIndex;let c;if(r===l)c=[e[r].slice(a,u)];else{if(c=e.slice(r,l),a>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(a):c.shift()}u>0&&c.push(e[l].slice(0,u))}return c}function dT(e,n){let r=-1;const a=[];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,a.push(c)}return a.join("")}function mT(e){const a={constructs:Xx([cT,...(e||{}).extensions||[]]),content:l(jC),defined:[],document:l(OC),flow:l(XA),lazy:{},string:l(ZA),text:l(WA)};return a;function l(u){return c;function c(f){return fT(a,u,f)}}}function pT(e){for(;!e1(e););return e}const cb=/[\0\t\n\r]/g;function gT(){let e=1,n="",r=!0,a;return l;function l(u,c,f){const m=[];let d,y,g,b,w;for(u=n+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),g=0,n="",r&&(u.charCodeAt(0)===65279&&g++,r=void 0);g<u.length;){if(cb.lastIndex=g,d=cb.exec(u),b=d&&d.index!==void 0?d.index:u.length,w=u.charCodeAt(b),!d){n=u.slice(g);break}if(w===10&&g===b&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<b&&(m.push(u.slice(g,b)),e+=b-g),w){case 0:{m.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,m.push(-2);e++<y;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}g=b+1}return f&&(a&&m.push(-5),n&&m.push(n),m.push(null)),m}}const yT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function bT(e){return e.replace(yT,xT)}function xT(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return Kx(r.slice(u?2:1),u?16:10)}return Xd(r)||e}const s1={}.hasOwnProperty;function vT(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),wT(r)(pT(mT(r).document().write(gT()(e,n,!0))))}function wT(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Xe),autolinkProtocol:$,autolinkEmail:$,atxHeading:u(xe),blockQuote:u(ze),characterEscape:$,characterReference:$,codeFenced:u(Ke),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(Ke,c),codeText:u(pt,c),codeTextData:$,data:$,codeFlowValue:$,definition:u(it),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(He),hardBreakEscape:u(ke),hardBreakTrailing:u(ke),htmlFlow:u(Me,c),htmlFlowData:$,htmlText:u(Me,c),htmlTextData:$,image:u(Qe),label:c,link:u(Xe),listItem:u(gt),listItemValue:b,listOrdered:u(Rt,g),listUnordered:u(Rt),paragraph:u(sr),reference:A,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(xe),strong:u(yr),thematicBreak:u(ni)},exit:{atxHeading:m(),atxHeadingSequence:B,autolink:m(),autolinkEmail:ge,autolinkProtocol:Ie,blockQuote:m(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Ne,characterReferenceMarkerNumeric:Ne,characterReferenceValue:Te,characterReference:Le,codeFenced:m(U),codeFencedFence:M,codeFencedFenceInfo:w,codeFencedFenceMeta:k,codeFlowValue:D,codeIndented:m(O),codeText:m(ne),codeTextData:D,data:D,definition:m(),definitionDestinationString:oe,definitionLabelString:P,definitionTitleString:q,emphasis:m(),hardBreakEscape:m(J),hardBreakTrailing:m(J),htmlFlow:m(W),htmlFlowData:D,htmlText:m(se),htmlTextData:D,image:m(ie),label:Ee,labelText:pe,lineEnding:Y,link:m(V),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:ve,resourceDestinationString:E,resourceTitleString:N,resource:Z,setextHeading:m(F),setextHeadingLineSequence:K,setextHeadingText:z,strong:m(),thematicBreak:m()}};l1(n,(e||{}).mdastExtensions||[]);const r={};return a;function a(ue){let we={type:"root",children:[]};const Be={stack:[we],tokenStack:[],config:n,enter:f,exit:d,buffer:c,resume:y,data:r},Ge=[];let st=-1;for(;++st<ue.length;)if(ue[st][1].type==="listOrdered"||ue[st][1].type==="listUnordered")if(ue[st][0]==="enter")Ge.push(st);else{const Wt=Ge.pop();st=l(ue,Wt,st)}for(st=-1;++st<ue.length;){const Wt=n[ue[st][0]];s1.call(Wt,ue[st][1].type)&&Wt[ue[st][1].type].call(Object.assign({sliceSerialize:ue[st][2].sliceSerialize},Be),ue[st][1])}if(Be.tokenStack.length>0){const Wt=Be.tokenStack[Be.tokenStack.length-1];(Wt[1]||fb).call(Be,void 0,Wt[0])}for(we.position={start:Oi(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Oi(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},st=-1;++st<n.transforms.length;)we=n.transforms[st](we)||we;return we}function l(ue,we,Be){let Ge=we-1,st=-1,Wt=!1,xn,Yt,dt,Ut;for(;++Ge<=Be;){const be=ue[Ge];switch(be[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{be[0]==="enter"?st++:st--,Ut=void 0;break}case"lineEndingBlank":{be[0]==="enter"&&(xn&&!Ut&&!st&&!dt&&(dt=Ge),Ut=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ut=void 0}if(!st&&be[0]==="enter"&&be[1].type==="listItemPrefix"||st===-1&&be[0]==="exit"&&(be[1].type==="listUnordered"||be[1].type==="listOrdered")){if(xn){let $e=Ge;for(Yt=void 0;$e--;){const ut=ue[$e];if(ut[1].type==="lineEnding"||ut[1].type==="lineEndingBlank"){if(ut[0]==="exit")continue;Yt&&(ue[Yt][1].type="lineEndingBlank",Wt=!0),ut[1].type="lineEnding",Yt=$e}else if(!(ut[1].type==="linePrefix"||ut[1].type==="blockQuotePrefix"||ut[1].type==="blockQuotePrefixWhitespace"||ut[1].type==="blockQuoteMarker"||ut[1].type==="listItemIndent"))break}dt&&(!Yt||dt<Yt)&&(xn._spread=!0),xn.end=Object.assign({},Yt?ue[Yt][1].start:be[1].end),ue.splice(Yt||Ge,0,["exit",xn,be[2]]),Ge++,Be++}if(be[1].type==="listItemPrefix"){const $e={type:"listItem",_spread:!1,start:Object.assign({},be[1].start),end:void 0};xn=$e,ue.splice(Ge,0,["enter",$e,be[2]]),Ge++,Be++,dt=void 0,Ut=!0}}}return ue[we][1]._spread=Wt,Be}function u(ue,we){return Be;function Be(Ge){f.call(this,ue(Ge),Ge),we&&we.call(this,Ge)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ue,we,Be){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([we,Be||void 0]),ue.position={start:Oi(we.start),end:void 0}}function m(ue){return we;function we(Be){ue&&ue.call(this,Be),d.call(this,Be)}}function d(ue,we){const Be=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==ue.type&&(we?we.call(this,ue,Ge[0]):(Ge[1]||fb).call(this,ue,Ge[0]));else throw new Error("Cannot close `"+ue.type+"` ("+Al({start:ue.start,end:ue.end})+"): it’s not open");Be.position.end=Oi(ue.end)}function y(){return Jd(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(ue){if(this.data.expectingFirstListItemValue){const we=this.stack[this.stack.length-2];we.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function w(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.lang=ue}function k(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.meta=ue}function M(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function U(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function O(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue.replace(/(\r?\n|\r)$/g,"")}function P(ue){const we=this.resume(),Be=this.stack[this.stack.length-1];Be.label=we,Be.identifier=gr(this.sliceSerialize(ue)).toLowerCase()}function q(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.title=ue}function oe(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.url=ue}function B(ue){const we=this.stack[this.stack.length-1];if(!we.depth){const Be=this.sliceSerialize(ue).length;we.depth=Be}}function z(){this.data.setextHeadingSlurpLineEnding=!0}function K(ue){const we=this.stack[this.stack.length-1];we.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function $(ue){const Be=this.stack[this.stack.length-1].children;let Ge=Be[Be.length-1];(!Ge||Ge.type!=="text")&&(Ge=xt(),Ge.position={start:Oi(ue.start),end:void 0},Be.push(Ge)),this.stack.push(Ge)}function D(ue){const we=this.stack.pop();we.value+=this.sliceSerialize(ue),we.position.end=Oi(ue.end)}function Y(ue){const we=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Be=we.children[we.children.length-1];Be.position.end=Oi(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(we.type)&&($.call(this,ue),D.call(this,ue))}function J(){this.data.atHardBreak=!0}function W(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue}function se(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue}function ne(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.value=ue}function V(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=we,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function ie(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=we,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function pe(ue){const we=this.sliceSerialize(ue),Be=this.stack[this.stack.length-2];Be.label=bT(we),Be.identifier=gr(we).toLowerCase()}function Ee(){const ue=this.stack[this.stack.length-1],we=this.resume(),Be=this.stack[this.stack.length-1];if(this.data.inReference=!0,Be.type==="link"){const Ge=ue.children;Be.children=Ge}else Be.alt=we}function E(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.url=ue}function N(){const ue=this.resume(),we=this.stack[this.stack.length-1];we.title=ue}function Z(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ve(ue){const we=this.resume(),Be=this.stack[this.stack.length-1];Be.label=we,Be.identifier=gr(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function Ne(ue){this.data.characterReferenceType=ue.type}function Te(ue){const we=this.sliceSerialize(ue),Be=this.data.characterReferenceType;let Ge;Be?(Ge=Kx(we,Be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=Xd(we);const st=this.stack[this.stack.length-1];st.value+=Ge}function Le(ue){const we=this.stack.pop();we.position.end=Oi(ue.end)}function Ie(ue){D.call(this,ue);const we=this.stack[this.stack.length-1];we.url=this.sliceSerialize(ue)}function ge(ue){D.call(this,ue);const we=this.stack[this.stack.length-1];we.url="mailto:"+this.sliceSerialize(ue)}function ze(){return{type:"blockquote",children:[]}}function Ke(){return{type:"code",lang:null,meta:null,value:""}}function pt(){return{type:"inlineCode",value:""}}function it(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function He(){return{type:"emphasis",children:[]}}function xe(){return{type:"heading",depth:0,children:[]}}function ke(){return{type:"break"}}function Me(){return{type:"html",value:""}}function Qe(){return{type:"image",title:null,url:"",alt:null}}function Xe(){return{type:"link",title:null,url:"",children:[]}}function Rt(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function gt(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function sr(){return{type:"paragraph",children:[]}}function yr(){return{type:"strong",children:[]}}function xt(){return{type:"text",value:""}}function ni(){return{type:"thematicBreak"}}}function Oi(e){return{line:e.line,column:e.column,offset:e.offset}}function l1(e,n){let r=-1;for(;++r<n.length;){const a=n[r];Array.isArray(a)?l1(e,a):ST(e,a)}}function ST(e,n){let r;for(r in n)if(s1.call(n,r))switch(r){case"canContainEols":{const a=n[r];a&&e[r].push(...a);break}case"transforms":{const a=n[r];a&&e[r].push(...a);break}case"enter":case"exit":{const a=n[r];a&&Object.assign(e[r],a);break}}}function fb(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 _T(e){const n=this;n.parser=r;function r(a){return vT(a,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function ET(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 kT(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
96
+ `}]}function CT(e,n){const r=n.value?n.value+`
97
+ `:"",a={},l=n.lang?n.lang.split(/\s+/):[];l.length>0&&(a.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:a,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 AT(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function TT(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function jT(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(n.identifier).toUpperCase(),l=xs(a.toLowerCase()),u=e.footnoteOrder.indexOf(a);let c,f=e.footnoteCounts.get(a);f===void 0?(f=0,e.footnoteOrder.push(a),c=e.footnoteOrder.length):c=u+1,f+=1,e.footnoteCounts.set(a,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 NT(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 OT(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function o1(e,n){const r=n.referenceType;let a="]";if(r==="collapsed"?a+="[]":r==="full"&&(a+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+a}];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+=a:l.push({type:"text",value:a}),l}function RT(e,n){const r=String(n.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return o1(e,n);const l={src:xs(a.url||""),alt:n.alt};a.title!==null&&a.title!==void 0&&(l.title=a.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(n,u),e.applyData(n,u)}function MT(e,n){const r={src:xs(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 a={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,a),e.applyData(n,a)}function DT(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const a={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,a),e.applyData(n,a)}function LT(e,n){const r=String(n.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return o1(e,n);const l={href:xs(a.url||"")};a.title!==null&&a.title!==void 0&&(l.title=a.title);const u={type:"element",tagName:"a",properties:l,children:e.all(n)};return e.patch(n,u),e.applyData(n,u)}function zT(e,n){const r={href:xs(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const a={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function UT(e,n,r){const a=e.all(n),l=r?BT(r):u1(n),u={},c=[];if(typeof n.checked=="boolean"){const y=a[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},a.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<a.length;){const y=a[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=a[a.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 BT(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let a=-1;for(;!n&&++a<r.length;)n=u1(r[a])}return n}function u1(e){const n=e.spread;return n??e.children.length>1}function PT(e,n){const r={},a=e.all(n);let l=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++l<a.length;){const c=a[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(a,!0)};return e.patch(n,u),e.applyData(n,u)}function HT(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function qT(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function IT(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function FT(e,n){const r=e.all(n),a=r.shift(),l=[];if(a){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!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=$d(n.children[1]),m=Ix(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 $T(e,n,r){const a=r?r.children:void 0,u=(a?a.indexOf(n):1)===0?"th":"td",c=r&&r.type==="table"?r.align:void 0,f=c?c.length:n.children.length;let m=-1;const d=[];for(;++m<f;){const g=n.children[m],b={},w=c?c[m]:void 0;w&&(b.align=w);let k={type:"element",tagName:u,properties:b,children:[]};g&&(k.children=e.all(g),e.patch(g,k),k=e.applyData(g,k)),d.push(k)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(n,y),e.applyData(n,y)}function YT(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const hb=9,db=32;function GT(e){const n=String(e),r=/\r?\n|\r/g;let a=r.exec(n),l=0;const u=[];for(;a;)u.push(mb(n.slice(l,a.index),l>0,!0),a[0]),l=a.index+a[0].length,a=r.exec(n);return u.push(mb(n.slice(l),l>0,!1)),u.join("")}function mb(e,n,r){let a=0,l=e.length;if(n){let u=e.codePointAt(a);for(;u===hb||u===db;)a++,u=e.codePointAt(a)}if(r){let u=e.codePointAt(l-1);for(;u===hb||u===db;)l--,u=e.codePointAt(l-1)}return l>a?e.slice(a,l):""}function VT(e,n){const r={type:"text",value:GT(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function JT(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const XT={blockquote:ET,break:kT,code:CT,delete:AT,emphasis:TT,footnoteReference:jT,heading:NT,html:OT,imageReference:RT,image:MT,inlineCode:DT,linkReference:LT,link:zT,listItem:UT,list:PT,paragraph:HT,root:qT,strong:IT,table:FT,tableCell:YT,tableRow:$T,text:VT,thematicBreak:JT,toml:hu,yaml:hu,definition:hu,footnoteDefinition:hu};function hu(){}const c1=-1,Ju=0,jl=1,Lu=2,Qd=3,Zd=4,Wd=5,em=6,f1=7,h1=8,pb=typeof self=="object"?self:globalThis,KT=(e,n)=>{const r=(l,u)=>(e.set(u,l),l),a=l=>{if(e.has(l))return e.get(l);const[u,c]=n[l];switch(u){case Ju:case c1:return r(c,l);case jl:{const f=r([],l);for(const m of c)f.push(a(m));return f}case Lu:{const f=r({},l);for(const[m,d]of c)f[a(m)]=a(d);return f}case Qd:return r(new Date(c),l);case Zd:{const{source:f,flags:m}=c;return r(new RegExp(f,m),l)}case Wd:{const f=r(new Map,l);for(const[m,d]of c)f.set(a(m),a(d));return f}case em:{const f=r(new Set,l);for(const m of c)f.add(a(m));return f}case f1:{const{name:f,message:m}=c;return r(new pb[f](m),l)}case h1: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 pb[u](c),l)};return a},gb=e=>KT(new Map,e)(0),Za="",{toString:QT}={},{keys:ZT}=Object,bl=e=>{const n=typeof e;if(n!=="object"||!e)return[Ju,n];const r=QT.call(e).slice(8,-1);switch(r){case"Array":return[jl,Za];case"Object":return[Lu,Za];case"Date":return[Qd,Za];case"RegExp":return[Zd,Za];case"Map":return[Wd,Za];case"Set":return[em,Za];case"DataView":return[jl,r]}return r.includes("Array")?[jl,r]:r.includes("Error")?[f1,r]:[Lu,r]},du=([e,n])=>e===Ju&&(n==="function"||n==="symbol"),WT=(e,n,r,a)=>{const l=(c,f)=>{const m=a.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 Ju:{let y=c;switch(m){case"bigint":f=h1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([c1],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 Lu:{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 ZT(c))(e||!du(bl(c[b])))&&y.push([u(b),u(c[b])]);return g}case Qd:return l([f,c.toISOString()],c);case Zd:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case Wd:{const y=[],g=l([f,y],c);for(const[b,w]of c)(e||!(du(bl(b))||du(bl(w))))&&y.push([u(b),u(w)]);return g}case em:{const y=[],g=l([f,y],c);for(const b of c)(e||!du(bl(b)))&&y.push(u(b));return g}}const{message:d}=c;return l([f,{name:m,message:d}],c)};return u},yb=(e,{json:n,lossy:r}={})=>{const a=[];return WT(!(n||r),!!n,new Map,a)(e),a},zu=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?gb(yb(e,n)):structuredClone(e):(e,n)=>gb(yb(e,n));function ej(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 tj(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function nj(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||ej,a=e.options.footnoteBackLabel||tj,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=xs(g.toLowerCase());let w=0;const k=[],M=e.footnoteCounts.get(g);for(;M!==void 0&&++w<=M;){k.length>0&&k.push({type:"text",value:" "});let P=typeof r=="string"?r:r(m,w);typeof P=="string"&&(P={type:"text",value:P}),k.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+b+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,w),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 O={type:"element",tagName:"li",properties:{id:n+"fn-"+b},children:e.wrap(y,!0)};e.patch(d,O),f.push(O)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...zu(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 Xu=(function(e){if(e==null)return sj;if(typeof e=="function")return Ku(e);if(typeof e=="object")return Array.isArray(e)?rj(e):ij(e);if(typeof e=="string")return aj(e);throw new Error("Expected function, string, or object as test")});function rj(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Xu(e[r]);return Ku(a);function a(...l){let u=-1;for(;++u<n.length;)if(n[u].apply(this,l))return!0;return!1}}function ij(e){const n=e;return Ku(r);function r(a){const l=a;let u;for(u in e)if(l[u]!==n[u])return!1;return!0}}function aj(e){return Ku(n);function n(r){return r&&r.type===e}}function Ku(e){return n;function n(r,a,l){return!!(lj(r)&&e.call(this,r,typeof a=="number"?a:void 0,l||void 0))}}function sj(){return!0}function lj(e){return e!==null&&typeof e=="object"&&"type"in e}const d1=[],oj=!0,vd=!1,uj="skip";function m1(e,n,r,a){let l;typeof n=="function"&&typeof r!="function"?(a=r,r=n):l=n;const u=Xu(l),c=a?-1:1;f(e,void 0,[])();function f(m,d,y){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const w=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return b;function b(){let w=d1,k,M,U;if((!n||u(m,d,y[y.length-1]||void 0))&&(w=cj(r(m,y)),w[0]===vd))return w;if("children"in m&&m.children){const O=m;if(O.children&&w[0]!==uj)for(M=(a?O.children.length:-1)+c,U=y.concat(O);M>-1&&M<O.children.length;){const P=O.children[M];if(k=f(P,M,U)(),k[0]===vd)return k;M=typeof k[1]=="number"?k[1]:M+c}}return w}}}function cj(e){return Array.isArray(e)?e:typeof e=="number"?[oj,e]:e==null?d1:[e]}function tm(e,n,r,a){let l,u,c;typeof n=="function"&&typeof r!="function"?(u=void 0,c=n,l=r):(u=n,c=r,l=a),m1(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 wd={}.hasOwnProperty,fj={};function hj(e,n){const r=n||fj,a=new Map,l=new Map,u=new Map,c={...XT,...r.handlers},f={all:d,applyData:mj,definitionById:a,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:dj,wrap:gj};return tm(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?a:l,b=String(y.identifier).toUpperCase();g.has(b)||g.set(b,y)}}),f;function m(y,g){const b=y.type,w=f.handlers[b];if(wd.call(f.handlers,b)&&w)return w(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in y){const{children:M,...U}=y,O=zu(U);return O.children=f.all(y),O}return zu(y)}return(f.options.unknownHandler||pj)(f,y,g)}function d(y){const g=[];if("children"in y){const b=y.children;let w=-1;for(;++w<b.length;){const k=f.one(b[w],y);if(k){if(w&&b[w-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=bb(k.value)),!Array.isArray(k)&&k.type==="element")){const M=k.children[0];M&&M.type==="text"&&(M.value=bb(M.value))}Array.isArray(k)?g.push(...k):g.push(k)}}}return g}}function dj(e,n){e.position&&(n.position=tC(e))}function mj(e,n){let r=n;if(e&&e.data){const a=e.data.hName,l=e.data.hChildren,u=e.data.hProperties;if(typeof a=="string")if(r.type==="element")r.tagName=a;else{const c="children"in r?r.children:[r];r={type:"element",tagName:a,properties:{},children:c}}r.type==="element"&&u&&Object.assign(r.properties,zu(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function pj(e,n){const r=n.data||{},a="value"in n&&!(wd.call(r,"hProperties")||wd.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function gj(e,n){const r=[];let a=-1;for(n&&r.push({type:"text",value:`
102
+ `});++a<e.length;)a&&r.push({type:"text",value:`
103
+ `}),r.push(e[a]);return n&&e.length>0&&r.push({type:"text",value:`
104
+ `}),r}function bb(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function xb(e,n){const r=hj(e,n),a=r.one(e,void 0),l=nj(r),u=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
105
+ `},l),u}function yj(e,n){return e&&"run"in e?async function(r,a){const l=xb(r,{file:a,...n});await e.run(l,a)}:function(r,a){return xb(r,{file:a,...e||n})}}function vb(e){if(e)throw e}var Bh,wb;function bj(){if(wb)return Bh;wb=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,a=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(a)return a(d,y).value}else return;return d[y]};return Bh=function m(){var d,y,g,b,w,k,M=arguments[0],U=1,O=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<O;++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)||(w=l(b)))?(w?(w=!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},Bh}var xj=bj();const Ph=Ub(xj);function Sd(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 vj(){const e=[],n={run:r,use:a};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?wj(y,f)(...d):c(null,...d)}}function a(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),n}}function wj(e,n){let r;return a;function a(...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 _r={basename:Sj,dirname:_j,extname:Ej,join:kj,sep:"/"};function Sj(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Yl(e);let r=0,a=-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 a<0&&(u=!0,a=l+1);return a<0?"":e.slice(r,a)}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&&(a=l):(f=-1,a=c));return r===a?a=c:a<0&&(a=e.length),e.slice(r,a)}function _j(e){if(Yl(e),e.length===0)return".";let n=-1,r=e.length,a;for(;--r;)if(e.codePointAt(r)===47){if(a){n=r;break}}else a||(a=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function Ej(e){Yl(e);let n=e.length,r=-1,a=0,l=-1,u=0,c;for(;n--;){const f=e.codePointAt(n);if(f===47){if(c){a=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===a+1?"":e.slice(l,r)}function kj(...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?".":Cj(r)}function Cj(e){Yl(e);const n=e.codePointAt(0)===47;let r=Aj(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function Aj(e,n){let r="",a=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||a!==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="",a=0):(r=r.slice(0,m),a=r.length-1-r.lastIndexOf("/")),l=c,u=0;continue}}else if(r.length>0){r="",a=0,l=c,u=0;continue}}n&&(r=r.length>0?r+"/..":"..",a=2)}else r.length>0?r+="/"+e.slice(l+1,c):r=e.slice(l+1,c),a=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 Tj={cwd:jj};function jj(){return"/"}function _d(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Nj(e){if(typeof e=="string")e=new URL(e);else if(!_d(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 Oj(e)}function Oj(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const a=n.codePointAt(r+2);if(a===70||a===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 Hh=["history","path","basename","stem","extname","dirname"];class p1{constructor(n){let r;n?_d(n)?r={path:n}:typeof n=="string"||Rj(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":Tj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Hh.length;){const u=Hh[a];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let l;for(l in r)Hh.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?_r.basename(this.path):void 0}set basename(n){Ih(n,"basename"),qh(n,"basename"),this.path=_r.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?_r.dirname(this.path):void 0}set dirname(n){Sb(this.basename,"dirname"),this.path=_r.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?_r.extname(this.path):void 0}set extname(n){if(qh(n,"extname"),Sb(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=_r.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){_d(n)&&(n=Nj(n)),Ih(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?_r.basename(this.path,this.extname):void 0}set stem(n){Ih(n,"stem"),qh(n,"stem"),this.path=_r.join(this.dirname||"",n+(this.extname||""))}fail(n,r,a){const l=this.message(n,r,a);throw l.fatal=!0,l}info(n,r,a){const l=this.message(n,r,a);return l.fatal=void 0,l}message(n,r,a){const l=new hn(n,r,a);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function qh(e,n){if(e&&e.includes(_r.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+_r.sep+"`")}function Ih(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function Sb(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function Rj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Mj=(function(e){const a=this.constructor.prototype,l=a[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,a),u}),Dj={}.hasOwnProperty;class nm extends Mj{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=vj()}copy(){const n=new nm;let r=-1;for(;++r<this.attachers.length;){const a=this.attachers[r];n.use(...a)}return n.data(Ph(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(Yh("data",this.frozen),this.namespace[n]=r,this):Dj.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Yh("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,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const l=r.call(n,...a);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=mu(n),a=this.parser||this.Parser;return Fh("parse",a),a(String(r),r)}process(n,r){const a=this;return this.freeze(),Fh("process",this.parser||this.Parser),$h("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=mu(n),m=a.parse(f);a.run(m,f,function(y,g,b){if(y||!g||!b)return d(y);const w=g,k=a.stringify(w,b);Uj(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,a;return this.freeze(),Fh("processSync",this.parser||this.Parser),$h("processSync",this.compiler||this.Compiler),this.process(n,l),Eb("processSync","process",r),a;function l(u,c){r=!0,vb(u),a=c}}run(n,r,a){_b(n),this.freeze();const l=this.transformers;return!a&&typeof r=="function"&&(a=r,r=void 0),a?u(void 0,a):new Promise(u);function u(c,f){const m=mu(r);l.run(n,m,d);function d(y,g,b){const w=g||n;y?f(y):c?c(w):a(void 0,w,b)}}}runSync(n,r){let a=!1,l;return this.run(n,r,u),Eb("runSync","run",a),l;function u(c,f){vb(c),l=f,a=!0}}stringify(n,r){this.freeze();const a=mu(r),l=this.compiler||this.Compiler;return $h("stringify",l),_b(n),l(n,a)}use(n,...r){const a=this.attachers,l=this.namespace;if(Yh("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=Ph(!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<a.length;)if(a[g][0]===d){b=g;break}if(b===-1)a.push([d,...y]);else if(y.length>0){let[w,...k]=y;const M=a[b][1];Sd(M)&&Sd(w)&&(w=Ph(!0,M,w)),a[b]=[d,w,...k]}}}}const Lj=new nm().freeze();function Fh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $h(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yh(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 _b(e){if(!Sd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Eb(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function mu(e){return zj(e)?e:new p1(e)}function zj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Uj(e){return typeof e=="string"||Bj(e)}function Bj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Pj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",kb=[],Cb={allowDangerousHtml:!0},Hj=/^(https?|ircs?|mailto|xmpp)$/i,qj=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ab(e){const n=Ij(e),r=Fj(e);return $j(n.runSync(n.parse(r),r),e)}function Ij(e){const n=e.rehypePlugins||kb,r=e.remarkPlugins||kb,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Cb}:Cb;return Lj().use(_T).use(r).use(yj,a).use(n)}function Fj(e){const n=e.children||"",r=new p1;return typeof n=="string"&&(r.value=n),r}function $j(e,n){const r=n.allowedElements,a=n.allowElement,l=n.components,u=n.disallowedElements,c=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||Yj;for(const y of qj)Object.hasOwn(n,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+Pj+y.id,void 0);return tm(e,d),sC(e,{Fragment:v.Fragment,components:l,ignoreInvalidStyle:!0,jsx:v.jsx,jsxs:v.jsxs,passKeys:!0,passNode:!0});function d(y,g,b){if(y.type==="raw"&&b&&typeof g=="number")return c?b.children.splice(g,1):b.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let w;for(w in Lh)if(Object.hasOwn(Lh,w)&&Object.hasOwn(y.properties,w)){const k=y.properties[w],M=Lh[w];(M===null||M.includes(y.tagName))&&(y.properties[w]=m(String(k||""),w,y))}}if(y.type==="element"){let w=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!w&&a&&typeof g=="number"&&(w=!a(y,g,b)),w&&b&&typeof g=="number")return f&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function Yj(e){const n=e.indexOf(":"),r=e.indexOf("?"),a=e.indexOf("#"),l=e.indexOf("/");return n===-1||l!==-1&&n>l||r!==-1&&n>r||a!==-1&&n>a||Hj.test(e.slice(0,n))?e:""}function Tb(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let a=0,l=r.indexOf(n);for(;l!==-1;)a++,l=r.indexOf(n,l+n.length);return a}function Gj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function g1(e,n,r){const l=Xu((r||{}).ignore||[]),u=Vj(n);let c=-1;for(;++c<u.length;)m1(e,"text",f);function f(d,y){let g=-1,b;for(;++g<y.length;){const w=y[g],k=b?b.children:void 0;if(l(w,k?k.indexOf(w):void 0,b))return;b=w}if(b)return m(d,y)}function m(d,y){const g=y[y.length-1],b=u[c][0],w=u[c][1];let k=0;const U=g.children.indexOf(d);let O=!1,P=[];b.lastIndex=0;let q=b.exec(d.value);for(;q;){const oe=q.index,B={index:q.index,input:q.input,stack:[...y,d]};let z=w(...q,B);if(typeof z=="string"&&(z=z.length>0?{type:"text",value:z}:void 0),z===!1?b.lastIndex=oe+1:(k!==oe&&P.push({type:"text",value:d.value.slice(k,oe)}),Array.isArray(z)?P.push(...z):z&&P.push(z),k=oe+q[0].length,O=!0),!b.global)break;q=b.exec(d.value)}return O?(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 Vj(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 a=-1;for(;++a<r.length;){const l=r[a];n.push([Jj(l[0]),Xj(l[1])])}return n}function Jj(e){return typeof e=="string"?new RegExp(Gj(e),"g"):e}function Xj(e){return typeof e=="function"?e:function(){return e}}const Gh="phrasing",Vh=["autolink","link","image","label"];function Kj(){return{transforms:[r3],enter:{literalAutolink:Zj,literalAutolinkEmail:Jh,literalAutolinkHttp:Jh,literalAutolinkWww:Jh},exit:{literalAutolink:n3,literalAutolinkEmail:t3,literalAutolinkHttp:Wj,literalAutolinkWww:e3}}}function Qj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Gh,notInConstruct:Vh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Gh,notInConstruct:Vh},{character:":",before:"[ps]",after:"\\/",inConstruct:Gh,notInConstruct:Vh}]}}function Zj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Jh(e){this.config.enter.autolinkProtocol.call(this,e)}function Wj(e){this.config.exit.autolinkProtocol.call(this,e)}function e3(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 t3(e){this.config.exit.autolinkEmail.call(this,e)}function n3(e){this.exit(e)}function r3(e){g1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,i3],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),a3]],{ignore:["link","linkReference"]})}function i3(e,n,r,a,l){let u="";if(!y1(l)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!s3(r)))return!1;const c=l3(r+a);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 a3(e,n,r,a){return!y1(a,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function s3(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 l3(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],a=r.indexOf(")");const l=Tb(e,"(");let u=Tb(e,")");for(;a!==-1&&l>u;)e+=r.slice(0,a+1),r=r.slice(a+1),a=r.indexOf(")"),u++;return[e,r]}function y1(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ha(r)||Gu(r))&&(!n||r!==47)}b1.peek=g3;function o3(){this.buffer()}function u3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function c3(){this.buffer()}function f3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function h3(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=gr(this.sliceSerialize(e)).toLowerCase(),r.label=n}function d3(e){this.exit(e)}function m3(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=gr(this.sliceSerialize(e)).toLowerCase(),r.label=n}function p3(e){this.exit(e)}function g3(){return"["}function b1(e,n,r,a){const l=r.createTracker(a);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 y3(){return{enter:{gfmFootnoteCallString:o3,gfmFootnoteCall:u3,gfmFootnoteDefinitionLabelString:c3,gfmFootnoteDefinition:f3},exit:{gfmFootnoteCallString:h3,gfmFootnoteCall:d3,gfmFootnoteDefinitionLabelString:m3,gfmFootnoteDefinition:p3}}}function b3(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:b1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(a,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(a),{before:m,after:"]"})),y(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((n?`
106
+ `:" ")+u.indentLines(u.containerFlow(a,f.current()),n?x1:x3))),d(),m}}function x3(e,n,r){return n===0?e:x1(e,n,r)}function x1(e,n,r){return(r?"":" ")+e}const v3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];v1.peek=k3;function w3(){return{canContainEols:["delete"],enter:{strikethrough:_3},exit:{strikethrough:E3}}}function S3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:v3}],handlers:{delete:v1}}}function _3(e){this.enter({type:"delete",children:[]},e)}function E3(e){this.exit(e)}function v1(e,n,r,a){const l=r.createTracker(a),u=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),u(),c}function k3(){return"~"}function C3(e){return e.length}function A3(e,n){const r=n||{},a=(r.align||[]).concat(),l=r.stringLength||C3,u=[],c=[],f=[],m=[];let d=0,y=-1;for(;++y<e.length;){const M=[],U=[];let O=-1;for(e[y].length>d&&(d=e[y].length);++O<e[y].length;){const P=T3(e[y][O]);if(r.alignDelimiters!==!1){const q=l(P);U[O]=q,(m[O]===void 0||q>m[O])&&(m[O]=q)}M.push(P)}c[y]=M,f[y]=U}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<d;)u[g]=jb(a[g]);else{const M=jb(a);for(;++g<d;)u[g]=M}g=-1;const b=[],w=[];for(;++g<d;){const M=u[g];let U="",O="";M===99?(U=":",O=":"):M===108?U=":":M===114&&(O=":");let P=r.alignDelimiters===!1?1:Math.max(1,m[g]-U.length-O.length);const q=U+"-".repeat(P)+O;r.alignDelimiters!==!1&&(P=U.length+P+O.length,P>m[g]&&(m[g]=P),w[g]=P),b[g]=q}c.splice(1,0,b),f.splice(1,0,w),y=-1;const k=[];for(;++y<c.length;){const M=c[y],U=f[y];g=-1;const O=[];for(;++g<d;){const P=M[g]||"";let q="",oe="";if(r.alignDelimiters!==!1){const B=m[g]-(U[g]||0),z=u[g];z===114?q=" ".repeat(B):z===99?B%2?(q=" ".repeat(B/2+.5),oe=" ".repeat(B/2-.5)):(q=" ".repeat(B/2),oe=q):oe=" ".repeat(B)}r.delimiterStart!==!1&&!g&&O.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&P==="")&&(r.delimiterStart!==!1||g)&&O.push(" "),r.alignDelimiters!==!1&&O.push(q),O.push(P),r.alignDelimiters!==!1&&O.push(oe),r.padding!==!1&&O.push(" "),(r.delimiterEnd!==!1||g!==d-1)&&O.push("|")}k.push(r.delimiterEnd===!1?O.join("").replace(/ +$/,""):O.join(""))}return k.join(`
107
+ `)}function T3(e){return e==null?"":String(e)}function jb(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 j3(e,n,r,a){const l=r.enter("blockquote"),u=r.createTracker(a);u.move("> "),u.shift(2);const c=r.indentLines(r.containerFlow(e,u.current()),N3);return l(),c}function N3(e,n,r){return">"+(r?"":" ")+e}function O3(e,n){return Nb(e,n.inConstruct,!0)&&!Nb(e,n.notInConstruct,!1)}function Nb(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let a=-1;for(;++a<n.length;)if(e.includes(n[a]))return!0;return!1}function Ob(e,n,r,a){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
108
+ `&&O3(r.stack,r.unsafe[l]))return/[ \t]/.test(a.before)?"":" ";return`\\
109
+ `}function R3(e,n){const r=String(e);let a=r.indexOf(n),l=a,u=0,c=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===l?++u>c&&(c=u):u=1,l=a+n.length,a=r.indexOf(n,l);return c}function M3(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 D3(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 L3(e,n,r,a){const l=D3(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(M3(e,r)){const g=r.enter("codeIndented"),b=r.indentLines(u,z3);return g(),b}const f=r.createTracker(a),m=l.repeat(Math.max(R3(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 z3(e,n,r){return(r?"":" ")+e}function rm(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 U3(e,n,r,a){const l=rm(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const m=r.createTracker(a);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 B3(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 zl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Uu(e,n,r){const a=ms(e),l=ms(n);return a===void 0?l===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===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}}w1.peek=P3;function w1(e,n,r,a){const l=B3(r),u=r.enter("emphasis"),c=r.createTracker(a),f=c.move(l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Uu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=zl(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=Uu(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+zl(g));const w=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+w}function P3(e,n,r){return r.options.emphasis||"*"}function H3(e,n){let r=!1;return tm(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return r=!0,vd}),!!((!e.depth||e.depth<3)&&Jd(e)&&(n.options.setext||r))}function q3(e,n,r,a){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(a);if(H3(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=zl(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,r.options.closeAtx&&(d+=" "+c),m(),f(),d}S1.peek=I3;function S1(e){return e.value||""}function I3(){return"<"}_1.peek=F3;function _1(e,n,r,a){const l=rm(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("image");let f=r.enter("label");const m=r.createTracker(a);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 F3(){return"!"}E1.peek=$3;function E1(e,n,r,a){const l=e.referenceType,u=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(a);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 $3(){return"!"}k1.peek=Y3;function k1(e,n,r){let a=e.value||"",l="`",u=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(a);)l+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++u<r.unsafe.length;){const c=r.unsafe[u],f=r.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(a);){let d=m.index;a.charCodeAt(d)===10&&a.charCodeAt(d-1)===13&&d--,a=a.slice(0,d)+" "+a.slice(m.index+1)}}return l+a+l}function Y3(){return"`"}function C1(e,n){const r=Jd(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))}A1.peek=G3;function A1(e,n,r,a){const l=rm(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(a);let f,m;if(C1(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 G3(e,n,r){return C1(e,r)?"<":"["}T1.peek=V3;function T1(e,n,r,a){const l=e.referenceType,u=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(a);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 V3(){return"["}function im(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 J3(e){const n=im(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 X3(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 j1(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 K3(e,n,r,a){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?X3(r):im(r);const f=e.ordered?c==="."?")":".":J3(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),j1(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,a);return r.bulletLastUsed=c,r.bulletCurrent=u,l(),d}function Q3(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 Z3(e,n,r,a){const l=Q3(r);let u=r.bulletCurrent||im(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(a);f.move(u+" ".repeat(c-u.length)),f.shift(c);const m=r.enter("listItem"),d=r.indentLines(r.containerFlow(e,f.current()),y);return m(),d;function y(g,b,w){return b?(w?"":" ".repeat(c))+g:(w?u:u+" ".repeat(c-u.length))+g}}function W3(e,n,r,a){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,a);return u(),l(),c}const eN=Xu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function tN(e,n,r,a){return(e.children.some(function(c){return eN(c)})?r.containerPhrasing:r.containerFlow).call(r,e,a)}function nN(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}N1.peek=rN;function N1(e,n,r,a){const l=nN(r),u=r.enter("strong"),c=r.createTracker(a),f=c.move(l+l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Uu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=zl(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=Uu(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+zl(g));const w=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+w}function rN(e,n,r){return r.options.strong||"*"}function iN(e,n,r,a){return r.safe(e.value,a)}function aN(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 sN(e,n,r){const a=(j1(r)+(r.options.ruleSpaces?" ":"")).repeat(aN(r));return r.options.ruleSpaces?a.slice(0,-1):a}const O1={blockquote:j3,break:Ob,code:L3,definition:U3,emphasis:w1,hardBreak:Ob,heading:q3,html:S1,image:_1,imageReference:E1,inlineCode:k1,link:A1,linkReference:T1,list:K3,listItem:Z3,paragraph:W3,root:tN,strong:N1,text:iN,thematicBreak:sN};function lN(){return{enter:{table:oN,tableData:Rb,tableHeader:Rb,tableRow:cN},exit:{codeText:fN,table:uN,tableData:Xh,tableHeader:Xh,tableRow:Xh}}}function oN(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 uN(e){this.exit(e),this.data.inTable=void 0}function cN(e){this.enter({type:"tableRow",children:[]},e)}function Xh(e){this.exit(e)}function Rb(e){this.enter({type:"tableCell",children:[]},e)}function fN(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,hN));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function hN(e,n){return n==="|"?n:e}function dN(e){const n=e||{},r=n.tableCellPadding,a=n.tablePipeAlign,l=n.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
119
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:m,tableRow:f}};function c(w,k,M,U){return d(y(w,M,U),w.align)}function f(w,k,M,U){const O=g(w,M,U),P=d([O]);return P.slice(0,P.indexOf(`
120
+ `))}function m(w,k,M,U){const O=M.enter("tableCell"),P=M.enter("phrasing"),q=M.containerPhrasing(w,{...U,before:u,after:u});return P(),O(),q}function d(w,k){return A3(w,{align:k,alignDelimiters:a,padding:r,stringLength:l})}function y(w,k,M){const U=w.children;let O=-1;const P=[],q=k.enter("table");for(;++O<U.length;)P[O]=g(U[O],k,M);return q(),P}function g(w,k,M){const U=w.children;let O=-1;const P=[],q=k.enter("tableRow");for(;++O<U.length;)P[O]=m(U[O],w,k,M);return q(),P}function b(w,k,M){let U=O1.inlineCode(w,k,M);return M.stack.includes("tableCell")&&(U=U.replace(/\|/g,"\\$&")),U}}function mN(){return{exit:{taskListCheckValueChecked:Mb,taskListCheckValueUnchecked:Mb,paragraph:gN}}}function pN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:yN}}}function Mb(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function gN(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 a=r.children[0];if(a&&a.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&&(a.value=a.value.slice(1),a.value.length===0?r.children.shift():r.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,r.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function yN(e,n,r,a){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(a);u&&f.move(c);let m=O1.listItem(e,n,r,{...a,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),m;function d(y){return y+c}}function bN(){return[Kj(),y3(),w3(),lN(),mN()]}function xN(e){return{extensions:[Qj(),b3(e),S3(),dN(e),pN()]}}const vN={tokenize:CN,partial:!0},R1={tokenize:AN,partial:!0},M1={tokenize:TN,partial:!0},D1={tokenize:jN,partial:!0},wN={tokenize:NN,partial:!0},L1={name:"wwwAutolink",tokenize:EN,previous:U1},z1={name:"protocolAutolink",tokenize:kN,previous:B1},ti={name:"emailAutolink",tokenize:_N,previous:P1},Nr={};function SN(){return{text:Nr}}let oa=48;for(;oa<123;)Nr[oa]=ti,oa++,oa===58?oa=65:oa===91&&(oa=97);Nr[43]=ti;Nr[45]=ti;Nr[46]=ti;Nr[95]=ti;Nr[72]=[ti,z1];Nr[104]=[ti,z1];Nr[87]=[ti,L1];Nr[119]=[ti,L1];function _N(e,n,r){const a=this;let l,u;return c;function c(g){return!Ed(g)||!P1.call(a,a.previous)||am(a.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return Ed(g)?(e.consume(g),f):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(wN,y,d)(g):g===45||g===95||fn(g)?(u=!0,e.consume(g),m):y(g)}function d(g){return e.consume(g),l=!0,m}function y(g){return u&&l&&yn(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):r(g)}}function EN(e,n,r){const a=this;return l;function l(c){return c!==87&&c!==119||!U1.call(a,a.previous)||am(a.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(vN,e.attempt(R1,e.attempt(M1,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(c)}}function kN(e,n,r){const a=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&B1.call(a,a.previous)&&!am(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(yn(g)&&l.length<5)return l+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const b=l.toLowerCase();if(b==="http"||b==="https")return e.consume(g),m}return r(g)}function m(g){return g===47?(e.consume(g),u?d:(u=!0,m)):r(g)}function d(g){return g===null||Du(g)||At(g)||ha(g)||Gu(g)?r(g):e.attempt(R1,e.attempt(M1,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function CN(e,n,r){let a=0;return l;function l(c){return(c===87||c===119)&&a<3?(a++,e.consume(c),l):c===46&&a===3?(e.consume(c),u):r(c)}function u(c){return c===null?r(c):n(c)}}function AN(e,n,r){let a,l,u;return c;function c(d){return d===46||d===95?e.check(D1,m,f)(d):d===null||At(d)||ha(d)||d!==45&&Gu(d)?m(d):(u=!0,e.consume(d),c)}function f(d){return d===95?a=!0:(l=a,a=void 0),e.consume(d),c}function m(d){return l||a||!u?r(d):n(d)}}function TN(e,n){let r=0,a=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&a<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(D1,n,u)(c):c===null||At(c)||ha(c)?n(c):(e.consume(c),l)}function u(c){return c===41&&a++,e.consume(c),l}}function jN(e,n,r){return a;function a(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),a):f===38?(e.consume(f),u):f===93?(e.consume(f),l):f===60||f===null||At(f)||ha(f)?n(f):r(f)}function l(f){return f===null||f===40||f===91||At(f)||ha(f)?n(f):a(f)}function u(f){return yn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),a):yn(f)?(e.consume(f),c):r(f)}}function NN(e,n,r){return a;function a(u){return e.consume(u),l}function l(u){return fn(u)?r(u):n(u)}}function U1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||At(e)}function B1(e){return!yn(e)}function P1(e){return!(e===47||Ed(e))}function Ed(e){return e===43||e===45||e===46||e===95||fn(e)}function am(e){let n=e.length,r=!1;for(;n--;){const a=e[n][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){r=!0;break}if(a._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const ON={tokenize:PN,partial:!0};function RN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:zN,continuation:{tokenize:UN},exit:BN}},text:{91:{name:"gfmFootnoteCall",tokenize:LN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:MN,resolveTo:DN}}}}function MN(e,n,r){const a=this;let l=a.events.length;const u=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;l--;){const m=a.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=gr(a.sliceSerialize({start:c.end,end:a.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 DN(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 a={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",a,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",a,n]];return e.splice(r,e.length-r+1,...f),e}function LN(e,n,r){const a=this,l=a.parser.gfmFootnotes||(a.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||At(g))return r(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return l.includes(gr(a.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(g)}return At(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 zN(e,n,r){const a=this,l=a.parser.gfmFootnotes||(a.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||At(k))return r(k);if(k===93){e.exit("chunkString");const M=e.exit("gfmFootnoteDefinitionLabelString");return u=gr(a.sliceSerialize(M)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return At(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),lt(e,w,"gfmFootnoteDefinitionWhitespace")):r(k)}function w(k){return n(k)}}function UN(e,n,r){return e.check($l,n,e.attempt(ON,n,r))}function BN(e){e.exit("gfmFootnoteDefinition")}function PN(e,n,r){const a=this;return lt(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?n(u):r(u)}}function HN(e){let r=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:u,resolveAll:l};return r==null&&(r=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function l(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let d=m;for(;d--;)if(c[d][0]==="exit"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[d][1].end.offset-c[d][1].start.offset){c[m][1].type="strikethroughSequence",c[d][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[d][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[d][1].end),end:Object.assign({},c[m][1].start)},b=[["enter",y,f],["enter",c[d][1],f],["exit",c[d][1],f],["enter",g,f]],w=f.parser.constructs.insideSpan.null;w&&In(b,b.length,0,Vu(w,c.slice(d+1,m),f)),In(b,b.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",y,f]]),In(c,d-1,m-d+3,b),m=d+b.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,f,m){const d=this.previous,y=this.events;let g=0;return b;function b(k){return d===126&&y[y.length-1][1].type!=="characterEscape"?m(k):(c.enter("strikethroughSequenceTemporary"),w(k))}function w(k){const M=ms(d);if(k===126)return g>1?m(k):(c.consume(k),g++,w);if(g<2&&!r)return m(k);const U=c.exit("strikethroughSequenceTemporary"),O=ms(k);return U._open=!O||O===2&&!!M,U._close=!M||M===2&&!!O,f(k)}}}class qN{constructor(){this.map=[]}add(n,r,a){IN(this,n,r,a)}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 a=[];for(;r>0;)r-=1,a.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];a.push(n.slice()),n.length=0;let l=a.pop();for(;l;){for(const u of l)n.push(u);l=a.pop()}this.map.length=0}}function IN(e,n,r,a){let l=0;if(!(r===0&&a.length===0)){for(;l<e.map.length;){if(e.map[l][0]===n){e.map[l][1]+=r,e.map[l][2].push(...a);return}l+=1}e.map.push([n,r,a])}}function FN(e,n){let r=!1;const a=[];for(;n<e.length;){const l=e[n];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&a.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const u=a.length-1;a[u]=a[u]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return a}function $N(){return{flow:{null:{name:"table",tokenize:YN,resolveAll:GN}}}}function YN(e,n,r){const a=this;let l=0,u=0,c;return f;function f(D){let Y=a.events.length-1;for(;Y>-1;){const se=a.events[Y][1].type;if(se==="lineEnding"||se==="linePrefix")Y--;else break}const J=Y>-1?a.events[Y][1].type:null,W=J==="tableHead"||J==="tableRow"?z:m;return W===z&&a.parser.lazy[a.now().line]?r(D):W(D)}function m(D){return e.enter("tableHead"),e.enter("tableRow"),d(D)}function d(D){return D===124||(c=!0,u+=1),y(D)}function y(D){return D===null?r(D):Pe(D)?u>1?(u=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),w):r(D):tt(D)?lt(e,y,"whitespace")(D):(u+=1,c&&(c=!1,l+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(D)))}function g(D){return D===null||D===124||At(D)?(e.exit("data"),y(D)):(e.consume(D),D===92?b:g)}function b(D){return D===92||D===124?(e.consume(D),g):g(D)}function w(D){return a.interrupt=!1,a.parser.lazy[a.now().line]?r(D):(e.enter("tableDelimiterRow"),c=!1,tt(D)?lt(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):k(D))}function k(D){return D===45||D===58?U(D):D===124?(c=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),M):B(D)}function M(D){return tt(D)?lt(e,U,"whitespace")(D):U(D)}function U(D){return D===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),O):D===45?(u+=1,O(D)):D===null||Pe(D)?oe(D):B(D)}function O(D){return D===45?(e.enter("tableDelimiterFiller"),P(D)):B(D)}function P(D){return D===45?(e.consume(D),P):D===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),q):(e.exit("tableDelimiterFiller"),q(D))}function q(D){return tt(D)?lt(e,oe,"whitespace")(D):oe(D)}function oe(D){return D===124?k(D):D===null||Pe(D)?!c||l!==u?B(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(D)):B(D)}function B(D){return r(D)}function z(D){return e.enter("tableRow"),K(D)}function K(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),K):D===null||Pe(D)?(e.exit("tableRow"),n(D)):tt(D)?lt(e,K,"whitespace")(D):(e.enter("data"),F(D))}function F(D){return D===null||D===124||At(D)?(e.exit("data"),K(D)):(e.consume(D),D===92?$:F)}function $(D){return D===92||D===124?(e.consume(D),F):F(D)}}function GN(e,n){let r=-1,a=!0,l=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,d,y,g;const b=new qN;for(;++r<e.length;){const w=e[r],k=w[1];w[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(Db(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"?(a=!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")?(a=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=pu(b,n,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):k.type==="tableCellDivider"&&(a?a=!1:(u[1]!==0&&(c[0]=c[1],g=pu(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=pu(b,n,u,l,r,g)):c[1]!==0&&(g=pu(b,n,c,l,r,g)),l=0):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&Db(b,n,m,d,y),b.consume(n.events),r=-1;++r<n.events.length;){const w=n.events[r];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=FN(n.events,r))}return e}function pu(e,n,r,a,l,u){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},es(n.events,r[0])),e.add(r[0],0,[["exit",u,n]]));const m=es(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=es(n.events,r[2]),y=es(n.events,r[3]),g={type:f,start:Object.assign({},d),end:Object.assign({},y)};if(e.add(r[2],0,[["enter",g,n]]),a!==2){const b=n.events[r[2]],w=n.events[r[3]];if(b[1].end=Object.assign({},w[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const k=r[2]+1,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({},es(n.events,l)),e.add(l,0,[["exit",u,n]]),u=void 0),u}function Db(e,n,r,a,l){const u=[],c=es(n.events,r);l&&(l.end=Object.assign({},c),u.push(["exit",l,n])),a.end=Object.assign({},c),u.push(["exit",a,n]),e.add(r+1,0,u)}function es(e,n){const r=e[n],a=r[0]==="enter"?"start":"end";return r[1][a]}const VN={name:"tasklistCheck",tokenize:XN};function JN(){return{text:{91:VN}}}function XN(e,n,r){const a=this;return l;function l(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return At(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 Pe(m)?n(m):tt(m)?e.check({tokenize:KN},n,r)(m):r(m)}}function KN(e,n,r){return lt(e,a,"whitespace");function a(l){return l===null?r(l):n(l)}}function QN(e){return Xx([SN(),RN(),HN(e),$N(),JN()])}const ZN={};function Lb(e){const n=this,r=e||ZN,a=n.data(),l=a.micromarkExtensions||(a.micromarkExtensions=[]),u=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);l.push(QN(r)),u.push(bN()),c.push(xN(r))}function WN(e){g1(e,[/\r?\n|\r/g,eO])}function eO(){return{type:"break"}}function zb(){return function(e){WN(e)}}function tO({connected:e,hostId:n,request:r,subscribeEvents:a,taskId:l,runId:u}){const c=da(),[f,m]=R.useState(!0),[d,y]=R.useState([]),[g,b]=R.useState(),[w,k]=R.useState(),M=g==="started"||g==="monitoring",U=g==="followup",O=g==="started"||g==="followup",[P,q]=R.useState(null),[oe,B]=R.useState(!1),[z,K]=R.useState(""),[F,$]=R.useState(!1),D=R.useRef(null),Y=R.useRef(null),J=R.useRef(null),[W,se]=R.useState(u==="latest"?void 0:u),ne=u==="latest"&&W===null;R.useEffect(()=>{if(u!=="latest"){se(u);return}e&&(se(void 0),r("taskrun.list",{task_id:l,limit:1}).then(E=>{var N,Z;return se(((Z=(N=E.entries)==null?void 0:N[0])==null?void 0:Z.run_id)??null)}).catch(()=>se(null)))},[u,l,e,r]);async function V(){if(W)try{const E=await r("task.result",{id:l,run_id:W});if(E.error){console.error("No result:",E.error),c("/runs",{replace:!0});return}y(E.messages??[]),b(E.running_state),k(E.agent)}catch(E){console.error("Failed to load result:",E),c("/runs",{replace:!0})}finally{m(!1)}}async function ie(E){var N;if(W)try{const A=(N=(await r("task.reports",{id:l,run_id:W,report_files:[E]})).reports)==null?void 0:N[0];A!=null&&A.data_url?q({file:E,data_url:A.data_url}):q({file:E,content:(A==null?void 0:A.content)??"Report not found."})}catch{q({file:E,content:"Failed to load report."})}}R.useEffect(()=>{!e||!W||(m(!0),V())},[e,l,W]),R.useEffect(()=>!e||!n||!W?void 0:a(n,async N=>{try{const Z=JSON.parse(new TextDecoder().decode(N.data));if(Z.event_type!=="running-state"&&Z.event_type!=="result-updated"||N.subject.split(".").pop()!==l||Z.event_type==="result-updated"&&Z.run_id&&Z.run_id!==W)return;V()}catch{}}),[e,n,l,W,a,r]),R.useEffect(()=>{D.current&&(D.current.scrollTop=D.current.scrollHeight)},[d]),R.useEffect(()=>{f||ne||!W||J.current!==W&&(J.current=W,requestAnimationFrame(()=>{var E;D.current&&(D.current.scrollTop=D.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"}),O||(E=Y.current)==null||E.focus()}))},[f,ne,W,O]);function pe(E){if(E==="input")return"User Input";if(E==="permission")return"Permission";if(E==="confirmation")return"Confirmation"}function Ee(E){return E==="started"?"Task started":E==="finished"?"Task finished":E==="failed"?"Task failed":E==="error"?"Command failed":E==="aborted"?"Task aborted":E==="confirmation"?"Task confirmed":E==="stopped"?"Follow-up stopped":E??""}return v.jsxs("div",{className:"run-detail",children:[v.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:v.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),ne?v.jsxs("div",{className:"empty-state",children:[v.jsx("p",{className:"empty-state-text",children:"No runs yet"}),v.jsx("p",{className:"empty-state-hint",children:"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger."})]}):f?v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[v.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),v.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),v.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"chat-thread",ref:D,children:[d.map((E,N)=>{const Z=O&&E.role==="assistant"&&!d.slice(N+1).some(A=>A.role==="assistant"||A.role==="user");return E.role==="status"&&E.type==="monitoring"?null:E.role==="status"?v.jsxs("div",{className:`chat-status${E.type==="error"?" chat-status--error":""}`,children:[v.jsxs("div",{children:[Ee(E.type),E.time>0&&v.jsx("span",{className:"chat-status-time",children:Mu(E.time)})]}),E.content&&v.jsx("pre",{className:"chat-status-detail",children:E.content})]},N):v.jsxs("div",{className:`chat-message chat-message--${E.role}`,children:[E.role==="assistant"&&w&&v.jsx("div",{className:"chat-message-agent",children:dd(w)}),v.jsxs("div",{className:"chat-message-content",children:[v.jsx(Ab,{remarkPlugins:[Lb,zb],children:E.content}),Z&&v.jsxs("div",{className:"chat-typing-indicator",children:[v.jsx("span",{}),v.jsx("span",{}),v.jsx("span",{})]})]}),E.attachments&&E.attachments.length>0&&v.jsx("div",{className:"chat-message-attachments",children:E.attachments.map(A=>v.jsx("button",{className:"chat-attachment-chip",onClick:()=>ie(A),children:A},A))}),v.jsxs("div",{className:"chat-message-meta",children:[pe(E.type)&&v.jsx("span",{className:"chat-message-type",children:pe(E.type)}),E.time>0&&v.jsx("span",{children:Mu(E.time)})]})]},N)}),O&&(()=>{const E=d.filter(N=>N.role!=="status");return E.length===0||E[E.length-1].role!=="assistant"})()&&v.jsxs("div",{className:"chat-message chat-message--assistant",children:[w&&v.jsx("div",{className:"chat-message-agent",children:dd(w)}),v.jsxs("div",{className:"chat-typing-indicator",children:[v.jsx("span",{}),v.jsx("span",{}),v.jsx("span",{})]})]}),g==="monitoring"&&v.jsxs("div",{className:"chat-monitoring-indicator",children:[v.jsx("span",{className:"chat-monitoring-dot"}),"Monitoring command output"]})]}),M?v.jsx("div",{className:"chat-abort-bar",children:v.jsx("button",{className:"btn btn-secondary chat-abort-btn",disabled:oe,onClick:async()=>{if(confirm("Abort this task?")){B(!0);try{await r("task.abort",{id:l})}catch(E){console.error("Abort failed:",E)}finally{B(!1)}}},children:oe?"Aborting...":"Abort Task"})}):U?v.jsx("div",{className:"chat-input-bar",children:v.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:oe,onClick:async()=>{B(!0);try{await r("task.stop_followup",{id:l,run_id:W})}catch(E){console.error("Stop failed:",E)}finally{B(!1)}},children:v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:v.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):v.jsxs("form",{className:"chat-input-bar",onSubmit:async E=>{E.preventDefault();const N=z.trim();if(!(!N||F)){$(!0);try{await r("task.followup",{id:l,run_id:W,message:N}),K("")}catch(Z){console.error("Follow-up failed:",Z)}finally{$(!1)}}},children:[v.jsx("input",{ref:Y,className:"chat-input",type:"text",placeholder:"Follow-up message",value:z,onChange:E=>K(E.target.value),disabled:F}),v.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!z.trim()||F,children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),v.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),P&&v.jsx("div",{className:"report-dialog-overlay",onClick:()=>q(null),children:v.jsxs("div",{className:"report-dialog",onClick:E=>E.stopPropagation(),children:[v.jsxs("div",{className:"report-dialog-header",children:[v.jsx("span",{className:"report-dialog-title",children:P.file}),v.jsx("button",{className:"report-dialog-close",onClick:()=>q(null),"aria-label":"Close",children:v.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),v.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),v.jsx("div",{className:"report-dialog-body",children:P.data_url?v.jsx("img",{src:P.data_url,alt:P.file,style:{maxWidth:"100%",height:"auto"}}):v.jsx(Ab,{remarkPlugins:[Lb,zb],components:{a:({...E})=>v.jsx("a",{...E,target:"_blank",rel:"noopener noreferrer"})},children:P.content??""})})]})})]})}function nO(){const{getActiveHost:e}=Hl(),n=e(),r=R.useRef(null);R.useEffect(()=>{if(An.isNativePlatform()||!n||n.directUrl||r.current===n.hostId)return;async function a(){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 ok("/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 lk("/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)}}a()},[n])}const rO="0.7.8";function iO(e,n){if(e.includes("-"))return!1;const r=e.split(".").map(Number),a=n.split(".").map(Number);for(let l=0;l<3;l++){if((r[l]??0)<(a[l]??0))return!0;if((r[l]??0)>(a[l]??0))return!1}return!1}function xl(){var Ie;const{pairedHosts:e,activeHostId:n,removePairedHost:r}=Hl(),{connected:a,request:l,subscribeEvents:u,unauthorized:c}=Yu(),f=da(),m=jr(),d=HS(),y=Dx("(min-width: 768px)"),g=m.pathname.startsWith("/tasks"),b=d.runId?void 0:d.taskId,w=!!(d.taskId&&d.runId),[k,M]=R.useState(!1),[U,O]=R.useState(!1),[P,q]=R.useState(null),[oe,B]=R.useState(null),[z,K]=R.useState({}),[F,$]=R.useState([]),[D,Y]=R.useState(),[J,W]=R.useState(new Map),[se,ne]=R.useState(new Map),[V,ie]=R.useState(new Map),[pe,Ee]=R.useState(new Map);nO(),R.useEffect(()=>{window.scrollTo(0,0)},[n]),R.useEffect(()=>{a&&l("host.info").then(ge=>{var xe,ke,Me,Qe,Xe,Rt;$(ge.agents??[]),Y(ge.host_platform),K(ge.capability_tokens??{}),fk(ge.agents??[]);const ze=ge.version??null;B(ze),M(!!ze&&iO(ze,rO));const Ke=new Map,pt=new Map,it=new Map,He=new Map;for(const gt of ge.pending_prompts??[])if(gt.type==="confirmation")Ke.set(gt.key,{description:((xe=gt.meta)==null?void 0:xe.description)??"",sessionName:(ke=gt.meta)==null?void 0:ke.session_name});else if(gt.type==="permission")pt.set(gt.key,{permissions:gt.params??[],sessionName:(Me=gt.meta)==null?void 0:Me.session_name});else if(gt.type==="input"){const sr=gt.params??((Qe=gt.meta)==null?void 0:Qe.input_questions)??[];it.set(gt.key,{questions:sr,description:(Xe=gt.meta)==null?void 0:Xe.description,sessionName:(Rt=gt.meta)==null?void 0:Rt.session_name}),He.set(gt.key,new Array(sr.length).fill(""))}W(Ke),ne(pt),ie(it),Ee(He)}).catch(()=>{})},[a,n,l]),R.useEffect(()=>!a||!n?void 0:u(n,ze=>{const Ke=ze.subject.split(".");if(Ke.length<3)return;const pt=Ke.slice(2).join(".");let it={};try{it=JSON.parse(new TextDecoder().decode(ze.data))}catch{return}const He=it.event_type,xe=it.session_id;if(He==="input-request"&&xe){const ke=it.input_questions,Me=it.session_name,Qe=it.description;ke!=null&&ke.length&&(ie(Xe=>{if(Xe.has(xe))return Xe;const Rt=new Map(Xe);return Rt.set(xe,{questions:ke,description:Qe,sessionName:Me}),Rt}),Ee(Xe=>{if(Xe.has(xe))return Xe;const Rt=new Map(Xe);return Rt.set(xe,new Array(ke.length).fill("")),Rt}));return}if(He==="input-resolved"&&xe){ie(ke=>{if(!ke.has(xe))return ke;const Me=new Map(ke);return Me.delete(xe),Me}),Ee(ke=>{const Me=new Map(ke);return Me.delete(xe),Me});return}if(He==="confirm-request"&&xe){const ke=it.description,Me=it.session_name;ke&&W(Qe=>{if(Qe.has(xe))return Qe;const Xe=new Map(Qe);return Xe.set(xe,{description:ke,sessionName:Me}),Xe});return}if(He==="confirm-resolved"&&xe){W(ke=>{if(!ke.has(xe))return ke;const Me=new Map(ke);return Me.delete(xe),Me});return}if(He==="permission-request"){const ke=it.required_permissions,Me=it.session_name;ke!=null&&ke.length&&ne(Qe=>{if(Qe.has(pt))return Qe;const Xe=new Map(Qe);return Xe.set(pt,{permissions:ke,sessionName:Me}),Xe});return}if(He==="permission-resolved"){ne(ke=>{if(!ke.has(pt))return ke;const Me=new Map(ke);return Me.delete(pt),Me});return}}),[a,n,u]);async function E(ge,ze){try{await l("task.user_input",{id:ge,value:[ze]})}catch(Ke){console.error("[Dashboard] Failed to respond to confirmation:",Ke)}}async function N(ge,ze){try{await l("task.user_input",{id:ge,value:[ze]})}catch(Ke){console.error("[Dashboard] Failed to respond to permission request:",Ke)}}async function Z(ge,ze){try{await l("task.user_input",{id:ge,value:ze})}catch(Ke){console.error("[Dashboard] Failed to respond to input request:",Ke)}}function A(ge,ze){fa()&&f(ze?`/runs/${encodeURIComponent(ge)}/${encodeURIComponent(ze)}`:`/runs/${encodeURIComponent(ge)}`)}async function ve(){O(!0),q(null);try{const ge=await l("host.update");if(ge.error){q(ge.error),O(!1);return}}catch{}setTimeout(()=>window.location.reload(),1e4)}const Ne=e.length>0,Te=Ne&&a&&n&&!c,Le=((Ie=e.find(ge=>ge.hostId===n))==null?void 0:Ie.clientToken)??null;return v.jsxs("div",{className:"dashboard",children:[y&&v.jsx(F0,{daemonVersion:oe,capabilityTokens:z,activeClientToken:Le,request:l,onCapabilityTokensChange:K}),v.jsxs("div",{className:"dashboard-content",children:[v.jsxs("div",{className:"tab-bar",children:[!y&&v.jsx(F0,{daemonVersion:oe,capabilityTokens:z,activeClientToken:Le,request:l,onCapabilityTokensChange:K}),v.jsx(kk,{})]}),v.jsx("main",{className:"dashboard-main",children:c?v.jsxs("div",{className:"revoked-state",children:[v.jsx("div",{className:"revoked-icon",children:v.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),v.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),v.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),v.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),v.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),v.jsx("div",{className:"revoked-command",children:v.jsx("code",{children:"palmier pair"})}),v.jsxs("div",{className:"revoked-actions",children:[v.jsx("button",{className:"btn btn-primary",onClick:()=>{fa()&&f("/pair")},children:"Re-pair Device"}),v.jsx("button",{className:"btn btn-secondary",onClick:()=>{n&&r(n)},children:"Remove Host"})]})]}):Te?v.jsxs(v.Fragment,{children:[g&&!w&&v.jsx(Ek,{connected:a,hostId:n,request:l,subscribeEvents:u,agents:F,hostPlatform:D,onViewRun:A}),w?v.jsx(tO,{connected:a,hostId:n,request:l,subscribeEvents:u,taskId:d.taskId,runId:decodeURIComponent(d.runId)}):g?null:v.jsx(Ok,{connected:a,hostId:n,request:l,subscribeEvents:u,agents:F,filterTaskId:b,onClearFilter:()=>{fa()&&f("/")}})]}):v.jsxs("div",{className:"empty-state",children:[v.jsx("p",{children:Ne?"Connecting to host...":"No hosts paired yet."}),!Ne&&v.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Pair Host"})]})}),k&&!U&&!P&&v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Update Required"}),v.jsxs("p",{className:"confirm-modal-message",children:["Your Palmier host",oe?` (v${oe})`:""," is too old for this version of the app. Please update to continue."]}),v.jsx("div",{className:"confirm-modal-actions",children:v.jsx("button",{className:"btn btn-primary",onClick:ve,children:"Update Now"})})]})}),U&&v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),v.jsx("p",{className:"confirm-modal-message",children:"Installing update and restarting daemon. Please wait..."})]})}),P&&v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),v.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:P}),v.jsx("div",{className:"confirm-modal-actions",children:v.jsx("button",{className:"btn btn-secondary",onClick:()=>{q(null)},children:"Retry"})})]})})]}),Su.createPortal(v.jsxs(v.Fragment,{children:[[...J.entries()].map(([ge,{description:ze,sessionName:Ke}])=>v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),Ke&&v.jsx("p",{className:"confirm-modal-subtitle",children:Ke}),v.jsx("p",{className:"confirm-modal-message",children:ze}),v.jsxs("div",{className:"confirm-modal-actions",children:[v.jsx("button",{className:"btn btn-primary",onClick:()=>E(ge,"confirmed"),children:"Confirm"}),v.jsx("button",{className:"btn btn-secondary",onClick:()=>E(ge,"aborted"),children:"Abort"})]})]})},ge)),[...se.entries()].map(([ge,{permissions:ze,sessionName:Ke}])=>v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal permission-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),v.jsx("p",{className:"confirm-modal-message",children:v.jsx("strong",{children:Ke||ge})}),v.jsx("div",{className:"permission-list",children:ze.map((pt,it)=>v.jsxs("div",{className:"permission-item",children:[v.jsx("span",{className:"permission-name",children:pt.name}),pt.description&&v.jsx("span",{className:"permission-desc",children:pt.description})]},it))}),v.jsxs("div",{className:"permission-actions",children:[v.jsx("button",{className:"btn btn-primary",onClick:()=>N(ge,"granted"),children:"Allow Once"}),v.jsx("button",{className:"btn btn-secondary",onClick:()=>N(ge,"granted_all"),children:"Allow Always"})]}),v.jsx("button",{className:"permission-abort-link",onClick:()=>N(ge,"aborted"),children:"Deny & Abort Task"})]})},ge)),[...V.entries()].map(([ge,{questions:ze,description:Ke,sessionName:pt}])=>{const it=pe.get(ge)??new Array(ze.length).fill("");return v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal input-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),pt&&v.jsx("p",{className:"confirm-modal-subtitle",children:pt}),Ke&&v.jsx("p",{className:"confirm-modal-message",children:Ke}),v.jsx("div",{className:"input-list",children:ze.map((He,xe)=>v.jsxs("div",{className:"input-item",children:[v.jsx("label",{className:"input-label",children:He}),v.jsx("input",{type:"text",className:"input-field",value:it[xe]??"",onChange:ke=>{Ee(Me=>{const Qe=new Map(Me),Xe=[...Qe.get(ge)??[]];return Xe[xe]=ke.target.value,Qe.set(ge,Xe),Qe})},autoFocus:xe===0})]},xe))}),v.jsx("div",{className:"input-actions",children:v.jsx("button",{className:"btn btn-primary",disabled:it.some(He=>!He.trim()),onClick:()=>Z(ge,it),children:"Submit"})}),v.jsx("button",{className:"permission-abort-link",onClick:()=>Z(ge,["aborted"]),children:"Cancel"})]})},ge)})]}),document.body)]})}const vl=!!window.__PALMIER_SERVE__;function aO(){const[e,n]=R.useState(""),[r,a]=R.useState(!1),[l,u]=R.useState(null),{addPairedHost:c}=Hl(),f=da();async function m(){const d=e.trim().toUpperCase();if(!d){u("Enter a pairing code.");return}a(!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 w=await b.json().catch(()=>({error:"Connection failed"}));throw new Error(w.error||`HTTP ${b.status}`)}y=await b.json()}else{const b=await fetch(`${qd}/api/config`);if(!b.ok)throw new Error("Failed to fetch server config");const w=await b.json();if(!w.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const k=await Cx({servers:w.natsWsUrl,authenticator:yx(w.natsJwt,new TextEncoder().encode(w.natsNkeySeed))}),M=Cu(),U=`pair.${d}`,O=await k.request(U,M.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});y=JSON.parse(M.decode(O.data)),await k.close()}const g={hostId:y.hostId,clientToken:y.clientToken,directUrl:vl?window.location.origin:void 0};c(g),An.isNativePlatform()&&await tn.set({key:"hostId",value:y.hostId}),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{a(!1)}}return v.jsx("div",{className:"pair-page",children:v.jsxs("div",{className:"pair-card",children:[v.jsxs("div",{className:"pair-header",children:[v.jsx("h1",{className:"pair-title",children:vl?"Pair":"Pair with Host"}),v.jsx("p",{className:"pair-subtitle",children:vl?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!vl&&v.jsxs("div",{className:"pair-instructions",children:[v.jsxs("div",{className:"pair-instruction-block",children:[v.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),v.jsxs("ol",{className:"pair-steps",children:[v.jsxs("li",{children:["Install at least one agent CLI (e.g., ",v.jsx("a",{href:"https://www.palmier.me/agents",target:"_blank",rel:"noopener noreferrer",children:"Claude Code, Gemini CLI, Codex CLI"}),")"]}),v.jsxs("li",{children:["Install Palmier on your host machine:",v.jsx("code",{className:"pair-command",children:"npm install -g palmier"})]}),v.jsxs("li",{children:["Run the setup wizard:",v.jsx("code",{className:"pair-command",children:"palmier init"})]}),v.jsx("li",{children:"A pairing code will display automatically"})]})]}),v.jsx("div",{className:"pair-instruction-divider"}),v.jsxs("div",{className:"pair-instruction-block",children:[v.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),v.jsxs("ol",{className:"pair-steps",children:[v.jsxs("li",{children:["Run ",v.jsx("code",{children:"palmier pair"})," on the host machine"]}),v.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),v.jsxs("div",{className:"pair-form",children:[v.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",v.jsx("input",{id:"pair-code",type:"text",maxLength:6,value:e,onChange:d=>n(d.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:r})]}),l&&v.jsx("p",{className:"pair-error",children:l}),v.jsxs("button",{className:"btn btn-primary btn-full",onClick:m,disabled:r||!e.trim(),children:[r&&v.jsx("span",{className:"btn-spinner"}),r?"Pairing...":"Pair"]}),v.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>f("/"),disabled:r,children:"Cancel"}),v.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",v.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",v.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function sO(){return v.jsx(P_,{children:v.jsx(ck,{children:v.jsxs(t_,{children:[v.jsx(ua,{path:"/",element:v.jsx(xl,{})}),v.jsx(ua,{path:"/tasks",element:v.jsx(xl,{})}),v.jsx(ua,{path:"/runs",element:v.jsx(xl,{})}),v.jsx(ua,{path:"/runs/:taskId",element:v.jsx(xl,{})}),v.jsx(ua,{path:"/runs/:taskId/:runId",element:v.jsx(xl,{})}),v.jsx(ua,{path:"/pair",element:v.jsx(aO,{})})]})})})}rS.createRoot(document.getElementById("root")).render(v.jsx(R.StrictMode,{children:v.jsx(k_,{children:v.jsx(sO,{})})}));export{Hd as W};