palmier 0.8.3 → 0.8.6

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 (41) hide show
  1. package/README.md +6 -4
  2. package/dist/commands/pair.js +2 -0
  3. package/dist/commands/serve.js +0 -4
  4. package/dist/platform/index.js +7 -3
  5. package/dist/platform/macos.d.ts +32 -0
  6. package/dist/platform/macos.js +298 -0
  7. package/dist/pwa/assets/index-BiAE5qeC.js +120 -0
  8. package/dist/pwa/assets/{index-B0F9mtid.css → index-UaZFu6XL.css} +1 -1
  9. package/dist/pwa/assets/{web-C6lkQj9J.js → web-DYwZE4qa.js} +1 -1
  10. package/dist/pwa/assets/{web-Z1623me-.js → web-nSzKzI8x.js} +1 -1
  11. package/dist/pwa/index.html +2 -2
  12. package/dist/pwa/service-worker.js +1 -1
  13. package/dist/rpc-handler.js +0 -4
  14. package/dist/transports/http-transport.js +1 -0
  15. package/package.json +1 -1
  16. package/palmier-server/pwa/src/App.css +191 -33
  17. package/palmier-server/pwa/src/App.tsx +2 -0
  18. package/palmier-server/pwa/src/components/CapabilityToggles.tsx +288 -0
  19. package/palmier-server/pwa/src/components/HostMenu.tsx +15 -312
  20. package/palmier-server/pwa/src/components/SessionComposer.tsx +11 -2
  21. package/palmier-server/pwa/src/components/SessionsView.tsx +3 -1
  22. package/palmier-server/pwa/src/components/TaskCard.tsx +1 -1
  23. package/palmier-server/pwa/src/components/TaskForm.tsx +126 -74
  24. package/palmier-server/pwa/src/components/TasksView.tsx +3 -1
  25. package/palmier-server/pwa/src/constants.ts +1 -1
  26. package/palmier-server/pwa/src/native/Device.ts +0 -2
  27. package/palmier-server/pwa/src/pages/Dashboard.tsx +2 -0
  28. package/palmier-server/pwa/src/pages/PairHost.tsx +3 -1
  29. package/palmier-server/pwa/src/pages/PairSetup.tsx +70 -0
  30. package/palmier-server/spec.md +3 -3
  31. package/src/commands/pair.ts +2 -0
  32. package/src/commands/serve.ts +0 -3
  33. package/src/platform/index.ts +4 -3
  34. package/src/platform/macos.ts +319 -0
  35. package/src/rpc-handler.ts +0 -5
  36. package/src/transports/http-transport.ts +1 -0
  37. package/test/macos-plist.test.ts +112 -0
  38. package/dist/app-registry.d.ts +0 -10
  39. package/dist/app-registry.js +0 -44
  40. package/dist/pwa/assets/index-SYs3mcdJ.js +0 -120
  41. package/src/app-registry.ts +0 -52
@@ -0,0 +1,120 @@
1
+ var Yw=Object.defineProperty;var Gw=(e,n,r)=>n in e?Yw(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var C=(e,n,r)=>Gw(e,typeof n!="symbol"?n+"":n,r);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function r(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(l){if(l.ep)return;l.ep=!0;const u=r(l);fetch(l.href,u)}})();function Db(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oh={exports:{}},dl={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Fy;function Vw(){if(Fy)return dl;Fy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(s,l,u){var c=null;if(u!==void 0&&(c=""+u),l.key!==void 0&&(c=""+l.key),"key"in l){u={};for(var f in l)f!=="key"&&(u[f]=l[f])}else u=l;return l=u.ref,{$$typeof:e,type:s,key:c,ref:l!==void 0?l:null,props:u}}return dl.Fragment=n,dl.jsx=r,dl.jsxs=r,dl}var $y;function Jw(){return $y||($y=1,oh.exports=Vw()),oh.exports}var b=Jw(),uh={exports:{}},Ie={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Yy;function Xw(){if(Yy)return Ie;Yy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function w(D){return D===null||typeof D!="object"?null:(D=x&&D[x]||D["@@iterator"],typeof D=="function"?D:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,P={};function z(D,ee,A){this.props=D,this.context=ee,this.refs=P,this.updater=A||E}z.prototype.isReactComponent={},z.prototype.setState=function(D,ee){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,ee,"setState")},z.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function I(){}I.prototype=z.prototype;function j(D,ee,A){this.props=D,this.context=ee,this.refs=P,this.updater=A||E}var K=j.prototype=new I;K.constructor=j,M(K,z.prototype),K.isPureReactComponent=!0;var B=Array.isArray;function R(){}var Y={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function F(D,ee,A){var ve=A.ref;return{$$typeof:e,type:D,key:ee,ref:ve!==void 0?ve:null,props:A}}function L(D,ee){return F(D.type,ee,D.props)}function W(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function Q(D){var ee={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(A){return ee[A]})}var oe=/\/+/g;function ae(D,ee){return typeof D=="object"&&D!==null&&D.key!=null?Q(""+D.key):ee.toString(36)}function G(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(R,R):(D.status="pending",D.then(function(ee){D.status==="pending"&&(D.status="fulfilled",D.value=ee)},function(ee){D.status==="pending"&&(D.status="rejected",D.reason=ee)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function H(D,ee,A,ve,Ae){var Te=typeof D;(Te==="undefined"||Te==="boolean")&&(D=null);var Me=!1;if(D===null)Me=!0;else switch(Te){case"bigint":case"string":case"number":Me=!0;break;case"object":switch(D.$$typeof){case e:case n:Me=!0;break;case y:return Me=D._init,H(Me(D._payload),ee,A,ve,Ae)}}if(Me)return Ae=Ae(D),Me=ve===""?"."+ae(D,0):ve,B(Ae)?(A="",Me!=null&&(A=Me.replace(oe,"$&/")+"/"),H(Ae,ee,A,"",function(De){return De})):Ae!=null&&(W(Ae)&&(Ae=L(Ae,A+(Ae.key==null||D&&D.key===Ae.key?"":(""+Ae.key).replace(oe,"$&/")+"/")+Me)),ee.push(Ae)),1;Me=0;var He=ve===""?".":ve+":";if(B(D))for(var be=0;be<D.length;be++)ve=D[be],Te=He+ae(ve,be),Me+=H(ve,ee,A,Te,Ae);else if(be=w(D),typeof be=="function")for(D=be.call(D),be=0;!(ve=D.next()).done;)ve=ve.value,Te=He+ae(ve,be++),Me+=H(ve,ee,A,Te,Ae);else if(Te==="object"){if(typeof D.then=="function")return H(G(D),ee,A,ve,Ae);throw ee=String(D),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.")}return Me}function X(D,ee,A){if(D==null)return D;var ve=[],Ae=0;return H(D,ve,"","",function(Te){return ee.call(A,Te,Ae++)}),ve}function ue(D){if(D._status===-1){var ee=D._result;ee=ee(),ee.then(function(A){(D._status===0||D._status===-1)&&(D._status=1,D._result=A)},function(A){(D._status===0||D._status===-1)&&(D._status=2,D._result=A)}),D._status===-1&&(D._status=0,D._result=ee)}if(D._status===1)return D._result.default;throw D._result}var _e=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ee=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(ee))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},_={map:X,forEach:function(D,ee,A){X(D,function(){ee.apply(this,arguments)},A)},count:function(D){var ee=0;return X(D,function(){ee++}),ee},toArray:function(D){return X(D,function(ee){return ee})||[]},only:function(D){if(!W(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ie.Activity=g,Ie.Children=_,Ie.Component=z,Ie.Fragment=r,Ie.Profiler=l,Ie.PureComponent=j,Ie.StrictMode=s,Ie.Suspense=m,Ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Y,Ie.__COMPILER_RUNTIME={__proto__:null,c:function(D){return Y.H.useMemoCache(D)}},Ie.cache=function(D){return function(){return D.apply(null,arguments)}},Ie.cacheSignal=function(){return null},Ie.cloneElement=function(D,ee,A){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var ve=M({},D.props),Ae=D.key;if(ee!=null)for(Te in ee.key!==void 0&&(Ae=""+ee.key),ee)!J.call(ee,Te)||Te==="key"||Te==="__self"||Te==="__source"||Te==="ref"&&ee.ref===void 0||(ve[Te]=ee[Te]);var Te=arguments.length-2;if(Te===1)ve.children=A;else if(1<Te){for(var Me=Array(Te),He=0;He<Te;He++)Me[He]=arguments[He+2];ve.children=Me}return F(D.type,Ae,ve)},Ie.createContext=function(D){return D={$$typeof:c,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:u,_context:D},D},Ie.createElement=function(D,ee,A){var ve,Ae={},Te=null;if(ee!=null)for(ve in ee.key!==void 0&&(Te=""+ee.key),ee)J.call(ee,ve)&&ve!=="key"&&ve!=="__self"&&ve!=="__source"&&(Ae[ve]=ee[ve]);var Me=arguments.length-2;if(Me===1)Ae.children=A;else if(1<Me){for(var He=Array(Me),be=0;be<Me;be++)He[be]=arguments[be+2];Ae.children=He}if(D&&D.defaultProps)for(ve in Me=D.defaultProps,Me)Ae[ve]===void 0&&(Ae[ve]=Me[ve]);return F(D,Te,Ae)},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(D){return{$$typeof:f,render:D}},Ie.isValidElement=W,Ie.lazy=function(D){return{$$typeof:y,_payload:{_status:-1,_result:D},_init:ue}},Ie.memo=function(D,ee){return{$$typeof:d,type:D,compare:ee===void 0?null:ee}},Ie.startTransition=function(D){var ee=Y.T,A={};Y.T=A;try{var ve=D(),Ae=Y.S;Ae!==null&&Ae(A,ve),typeof ve=="object"&&ve!==null&&typeof ve.then=="function"&&ve.then(R,_e)}catch(Te){_e(Te)}finally{ee!==null&&A.types!==null&&(ee.types=A.types),Y.T=ee}},Ie.unstable_useCacheRefresh=function(){return Y.H.useCacheRefresh()},Ie.use=function(D){return Y.H.use(D)},Ie.useActionState=function(D,ee,A){return Y.H.useActionState(D,ee,A)},Ie.useCallback=function(D,ee){return Y.H.useCallback(D,ee)},Ie.useContext=function(D){return Y.H.useContext(D)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(D,ee){return Y.H.useDeferredValue(D,ee)},Ie.useEffect=function(D,ee){return Y.H.useEffect(D,ee)},Ie.useEffectEvent=function(D){return Y.H.useEffectEvent(D)},Ie.useId=function(){return Y.H.useId()},Ie.useImperativeHandle=function(D,ee,A){return Y.H.useImperativeHandle(D,ee,A)},Ie.useInsertionEffect=function(D,ee){return Y.H.useInsertionEffect(D,ee)},Ie.useLayoutEffect=function(D,ee){return Y.H.useLayoutEffect(D,ee)},Ie.useMemo=function(D,ee){return Y.H.useMemo(D,ee)},Ie.useOptimistic=function(D,ee){return Y.H.useOptimistic(D,ee)},Ie.useReducer=function(D,ee,A){return Y.H.useReducer(D,ee,A)},Ie.useRef=function(D){return Y.H.useRef(D)},Ie.useState=function(D){return Y.H.useState(D)},Ie.useSyncExternalStore=function(D,ee,A){return Y.H.useSyncExternalStore(D,ee,A)},Ie.useTransition=function(){return Y.H.useTransition()},Ie.version="19.2.4",Ie}var Gy;function Ed(){return Gy||(Gy=1,uh.exports=Xw()),uh.exports}var N=Ed(),ch={exports:{}},ml={},fh={exports:{}},hh={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var Vy;function Kw(){return Vy||(Vy=1,(function(e){function n(H,X){var ue=H.length;H.push(X);e:for(;0<ue;){var _e=ue-1>>>1,_=H[_e];if(0<l(_,X))H[_e]=X,H[ue]=_,ue=_e;else break e}}function r(H){return H.length===0?null:H[0]}function s(H){if(H.length===0)return null;var X=H[0],ue=H.pop();if(ue!==X){H[0]=ue;e:for(var _e=0,_=H.length,D=_>>>1;_e<D;){var ee=2*(_e+1)-1,A=H[ee],ve=ee+1,Ae=H[ve];if(0>l(A,ue))ve<_&&0>l(Ae,A)?(H[_e]=Ae,H[ve]=ue,_e=ve):(H[_e]=A,H[ee]=ue,_e=ee);else if(ve<_&&0>l(Ae,ue))H[_e]=Ae,H[ve]=ue,_e=ve;else break e}}return X}function l(H,X){var ue=H.sortIndex-X.sortIndex;return ue!==0?ue:H.id-X.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,x=3,w=!1,E=!1,M=!1,P=!1,z=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function K(H){for(var X=r(d);X!==null;){if(X.callback===null)s(d);else if(X.startTime<=H)s(d),X.sortIndex=X.expirationTime,n(m,X);else break;X=r(d)}}function B(H){if(M=!1,K(H),!E)if(r(m)!==null)E=!0,R||(R=!0,Q());else{var X=r(d);X!==null&&G(B,X.startTime-H)}}var R=!1,Y=-1,J=5,F=-1;function L(){return P?!0:!(e.unstable_now()-F<J)}function W(){if(P=!1,R){var H=e.unstable_now();F=H;var X=!0;try{e:{E=!1,M&&(M=!1,I(Y),Y=-1),w=!0;var ue=x;try{t:{for(K(H),g=r(m);g!==null&&!(g.expirationTime>H&&L());){var _e=g.callback;if(typeof _e=="function"){g.callback=null,x=g.priorityLevel;var _=_e(g.expirationTime<=H);if(H=e.unstable_now(),typeof _=="function"){g.callback=_,K(H),X=!0;break t}g===r(m)&&s(m),K(H)}else s(m);g=r(m)}if(g!==null)X=!0;else{var D=r(d);D!==null&&G(B,D.startTime-H),X=!1}}break e}finally{g=null,x=ue,w=!1}X=void 0}}finally{X?Q():R=!1}}}var Q;if(typeof j=="function")Q=function(){j(W)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,ae=oe.port2;oe.port1.onmessage=W,Q=function(){ae.postMessage(null)}}else Q=function(){z(W,0)};function G(H,X){Y=z(function(){H(e.unstable_now())},X)}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(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(H){switch(x){case 1:case 2:case 3:var X=3;break;default:X=x}var ue=x;x=X;try{return H()}finally{x=ue}},e.unstable_requestPaint=function(){P=!0},e.unstable_runWithPriority=function(H,X){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var ue=x;x=H;try{return X()}finally{x=ue}},e.unstable_scheduleCallback=function(H,X,ue){var _e=e.unstable_now();switch(typeof ue=="object"&&ue!==null?(ue=ue.delay,ue=typeof ue=="number"&&0<ue?_e+ue:_e):ue=_e,H){case 1:var _=-1;break;case 2:_=250;break;case 5:_=1073741823;break;case 4:_=1e4;break;default:_=5e3}return _=ue+_,H={id:y++,callback:X,priorityLevel:H,startTime:ue,expirationTime:_,sortIndex:-1},ue>_e?(H.sortIndex=ue,n(d,H),r(m)===null&&H===r(d)&&(M?(I(Y),Y=-1):M=!0,G(B,ue-_e))):(H.sortIndex=_,n(m,H),E||w||(E=!0,R||(R=!0,Q()))),H},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(H){var X=x;return function(){var ue=x;x=X;try{return H.apply(this,arguments)}finally{x=ue}}}})(hh)),hh}var Jy;function Qw(){return Jy||(Jy=1,fh.exports=Kw()),fh.exports}var dh={exports:{}},un={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var Xy;function Zw(){if(Xy)return un;Xy=1;var e=Ed();function n(m){var d="https://react.dev/errors/"+m;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)d+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+m+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},l=Symbol.for("react.portal");function u(m,d,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:m,containerInfo:d,implementation:y}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,d){if(m==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return un.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,un.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)},un.flushSync=function(m){var d=c.T,y=s.p;try{if(c.T=null,s.p=2,m)return m()}finally{c.T=d,s.p=y,s.d.f()}},un.preconnect=function(m,d){typeof m=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,s.d.C(m,d))},un.prefetchDNS=function(m){typeof m=="string"&&s.d.D(m)},un.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,w=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;y==="style"?s.d.S(m,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:w}):y==="script"&&s.d.X(m,{crossOrigin:g,integrity:x,fetchPriority:w,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},un.preinitModule=function(m,d){if(typeof m=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var y=f(d.as,d.crossOrigin);s.d.M(m,{crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&s.d.M(m)},un.preload=function(m,d){if(typeof m=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin);s.d.L(m,y,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},un.preloadModule=function(m,d){if(typeof m=="string")if(d){var y=f(d.as,d.crossOrigin);s.d.m(m,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else s.d.m(m)},un.requestFormReset=function(m){s.d.r(m)},un.unstable_batchedUpdates=function(m,d){return m(d)},un.useFormState=function(m,d,y){return c.H.useFormState(m,d,y)},un.useFormStatus=function(){return c.H.useHostTransitionStatus()},un.version="19.2.4",un}var Ky;function Lb(){if(Ky)return dh.exports;Ky=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),dh.exports=Zw(),dh.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var Qy;function Ww(){if(Qy)return ml;Qy=1;var e=Qw(),n=Ed(),r=Lb();function s(t){var i="https://react.dev/errors/"+t;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)i+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var i=t,a=t;if(t.alternate)for(;i.return;)i=i.return;else{t=i;do i=t,(i.flags&4098)!==0&&(a=i.return),t=i.return;while(t)}return i.tag===3?a:null}function c(t){if(t.tag===13){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function f(t){if(t.tag===31){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function m(t){if(u(t)!==t)throw Error(s(188))}function d(t){var i=t.alternate;if(!i){if(i=u(t),i===null)throw Error(s(188));return i!==t?null:t}for(var a=t,o=i;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){a=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return m(h),t;if(p===o)return m(h),i;p=p.sibling}throw Error(s(188))}if(a.return!==o.return)a=h,o=p;else{for(var v=!1,S=h.child;S;){if(S===a){v=!0,a=h,o=p;break}if(S===o){v=!0,o=h,a=p;break}S=S.sibling}if(!v){for(S=p.child;S;){if(S===a){v=!0,a=p,o=h;break}if(S===o){v=!0,o=p,a=h;break}S=S.sibling}if(!v)throw Error(s(189))}}if(a.alternate!==o)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?t:i}function y(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t;for(t=t.child;t!==null;){if(i=y(t),i!==null)return i;t=t.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),j=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function Q(t){return t===null||typeof t!="object"?null:(t=W&&t[W]||t["@@iterator"],typeof t=="function"?t:null)}var oe=Symbol.for("react.client.reference");function ae(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===oe?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case M:return"Fragment";case z:return"Profiler";case P:return"StrictMode";case B:return"Suspense";case R:return"SuspenseList";case F:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case E:return"Portal";case j:return t.displayName||"Context";case I:return(t._context.displayName||"Context")+".Consumer";case K:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Y:return i=t.displayName||null,i!==null?i:ae(t.type)||"Memo";case J:i=t._payload,t=t._init;try{return ae(t(i))}catch{}}return null}var G=Array.isArray,H=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue={pending:!1,data:null,method:null,action:null},_e=[],_=-1;function D(t){return{current:t}}function ee(t){0>_||(t.current=_e[_],_e[_]=null,_--)}function A(t,i){_++,_e[_]=t.current,t.current=i}var ve=D(null),Ae=D(null),Te=D(null),Me=D(null);function He(t,i){switch(A(Te,i),A(Ae,t),A(ve,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?hy(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=hy(i),t=dy(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}ee(ve),A(ve,t)}function be(){ee(ve),ee(Ae),ee(Te)}function De(t){t.memoizedState!==null&&A(Me,t);var i=ve.current,a=dy(i,t.type);i!==a&&(A(Ae,t),A(ve,a))}function Ze(t){Ae.current===t&&(ee(ve),ee(Ae)),Me.current===t&&(ee(Me),ul._currentValue=ue)}var dt,lt;function ct(t){if(dt===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);dt=i&&i[1]||"",lt=-1<a.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+dt+t+lt}var Fe=!1;function Ue(t,i){if(!t||Fe)return"";Fe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(le){var ie=le}Reflect.construct(t,[],pe)}else{try{pe.call()}catch(le){ie=le}t.call(pe.prototype)}}else{try{throw Error()}catch(le){ie=le}(pe=t())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(le){if(le&&ie&&typeof le.stack=="string")return[le.stack,ie.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),v=p[0],S=p[1];if(v&&S){var q=v.split(`
44
+ `),re=S.split(`
45
+ `);for(h=o=0;o<q.length&&!q[o].includes("DetermineComponentFrameRoot");)o++;for(;h<re.length&&!re[h].includes("DetermineComponentFrameRoot");)h++;if(o===q.length||h===re.length)for(o=q.length-1,h=re.length-1;1<=o&&0<=h&&q[o]!==re[h];)h--;for(;1<=o&&0<=h;o--,h--)if(q[o]!==re[h]){if(o!==1||h!==1)do if(o--,h--,0>h||q[o]!==re[h]){var ce=`
46
+ `+q[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{Fe=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?ct(a):""}function tt(t,i){switch(t.tag){case 26:case 27:case 5:return ct(t.type);case 16:return ct("Lazy");case 13:return t.child!==i&&i!==null?ct("Suspense Fallback"):ct("Suspense");case 19:return ct("SuspenseList");case 0:case 15:return Ue(t.type,!1);case 11:return Ue(t.type.render,!1);case 1:return Ue(t.type,!0);case 31:return ct("Activity");default:return""}}function mt(t){try{var i="",a=null;do i+=tt(t,a),a=t,t=t.return;while(t);return i}catch(o){return`
47
+ Error generating stack: `+o.message+`
48
+ `+o.stack}}var st=Object.prototype.hasOwnProperty,Mt=e.unstable_scheduleCallback,yt=e.unstable_cancelCallback,$n=e.unstable_shouldYield,gr=e.unstable_requestPaint,vt=e.unstable_now,An=e.unstable_getCurrentPriorityLevel,fe=e.unstable_ImmediatePriority,we=e.unstable_UserBlockingPriority,Be=e.unstable_NormalPriority,$e=e.unstable_LowPriority,rt=e.unstable_IdlePriority,nn=e.log,bn=e.unstable_setDisableYieldValue,Yt=null,ge=null;function ze(t){if(typeof nn=="function"&&bn(t),ge&&typeof ge.setStrictMode=="function")try{ge.setStrictMode(Yt,t)}catch{}}var Se=Math.clz32?Math.clz32:Tn,ft=Math.log,pt=Math.LN2;function Tn(t){return t>>>=0,t===0?32:31-(ft(t)/pt|0)|0}var ri=256,Nr=262144,ii=4194304;function sr(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 Ii(t,i,a){var o=t.pendingLanes;if(o===0)return 0;var h=0,p=t.suspendedLanes,v=t.pingedLanes;t=t.warmLanes;var S=o&134217727;return S!==0?(o=S&~p,o!==0?h=sr(o):(v&=S,v!==0?h=sr(v):a||(a=S&~t,a!==0&&(h=sr(a))))):(S=o&~p,S!==0?h=sr(S):v!==0?h=sr(v):a||(a=o&~t,a!==0&&(h=sr(a)))),h===0?0:i!==0&&i!==h&&(i&p)===0&&(p=h&-h,a=i&-i,p>=a||p===32&&(a&4194048)!==0)?i:h}function Fi(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function _a(t,i){switch(t){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ps(){var t=ii;return ii<<=1,(ii&62914560)===0&&(ii=4194304),t}function si(t){for(var i=[],a=0;31>a;a++)i.push(t);return i}function ar(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function ai(t,i,a,o,h,p){var v=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var S=t.entanglements,q=t.expirationTimes,re=t.hiddenUpdates;for(a=v&~a;0<a;){var ce=31-Se(a),pe=1<<ce;S[ce]=0,q[ce]=-1;var ie=re[ce];if(ie!==null)for(re[ce]=null,ce=0;ce<ie.length;ce++){var le=ie[ce];le!==null&&(le.lane&=-536870913)}a&=~pe}o!==0&&li(t,o,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(v&~i))}function li(t,i,a){t.pendingLanes|=i,t.suspendedLanes&=~i;var o=31-Se(i);t.entangledLanes|=i,t.entanglements[o]=t.entanglements[o]|1073741824|a&261930}function $i(t,i){var a=t.entangledLanes|=i;for(t=t.entanglements;a;){var o=31-Se(a),h=1<<o;h&i|t[o]&i&&(t[o]|=i),a&=~h}}function oi(t,i){var a=i&-i;return a=(a&42)!==0?1:Or(a),(a&(t.suspendedLanes|i))!==0?0:a}function Or(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 Yi(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Ea(){var t=X.p;return t!==0?t:(t=window.event,t===void 0?32:zy(t.type))}function Xl(t,i){var a=X.p;try{return X.p=t,i()}finally{X.p=a}}var yr=Math.random().toString(36).slice(2),Ct="__reactFiber$"+yr,Pt="__reactProps$"+yr,jn="__reactContainer$"+yr,Gi="__reactEvents$"+yr,ka="__reactListeners$"+yr,Kl="__reactHandles$"+yr,Ql="__reactResources$"+yr,Qt="__reactMarker$"+yr;function gs(t){delete t[Ct],delete t[Pt],delete t[Gi],delete t[ka],delete t[Kl]}function k(t){var i=t[Ct];if(i)return i;for(var a=t.parentNode;a;){if(i=a[jn]||a[Ct]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(t=vy(t);t!==null;){if(a=t[Ct])return a;t=vy(t)}return i}t=a,a=t.parentNode}return null}function O(t){if(t=t[Ct]||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(s(33))}function U(t){var i=t[Ql];return i||(i=t[Ql]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function $(t){t[Qt]=!0}var te=new Set,me={};function ye(t,i){se(t,i),se(t+"Capture",i)}function se(t,i){for(me[t]=i,t=0;t<i.length;t++)te.add(i[t])}var de=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Ne={},Je={};function Nt(t){return st.call(Je,t)?!0:st.call(Ne,t)?!1:de.test(t)?Je[t]=!0:(Ne[t]=!0,!1)}function on(t,i,a){if(Nt(i))if(a===null)t.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(i);return}}t.setAttribute(i,""+a)}}function lr(t,i,a){if(a===null)t.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttribute(i,""+a)}}function Rr(t,i,a,o){if(o===null)t.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(i,a,""+o)}}function Yn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function im(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function B1(t,i,a){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,i);if(!t.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return h.call(this)},set:function(v){a=""+v,p.call(this,v)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(v){a=""+v},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function ec(t){if(!t._valueTracker){var i=im(t)?"checked":"value";t._valueTracker=B1(t,i,""+t[i])}}function sm(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var a=i.getValue(),o="";return t&&(o=im(t)?t.checked?"true":"false":t.value),t=o,t!==a?(i.setValue(t),!0):!1}function Zl(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 P1=/[\n"\\]/g;function Gn(t){return t.replace(P1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function tc(t,i,a,o,h,p,v,S){t.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?t.type=v:t.removeAttribute("type"),i!=null?v==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+Yn(i)):t.value!==""+Yn(i)&&(t.value=""+Yn(i)):v!=="submit"&&v!=="reset"||t.removeAttribute("value"),i!=null?nc(t,v,Yn(i)):a!=null?nc(t,v,Yn(a)):o!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.name=""+Yn(S):t.removeAttribute("name")}function am(t,i,a,o,h,p,v,S){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),i!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){ec(t);return}a=a!=null?""+Yn(a):"",i=i!=null?""+Yn(i):a,S||i===t.value||(t.value=i),t.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=S?t.checked:!!o,t.defaultChecked=!!o,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.name=v),ec(t)}function nc(t,i,a){i==="number"&&Zl(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function ys(t,i,a,o){if(t=t.options,i){i={};for(var h=0;h<a.length;h++)i["$"+a[h]]=!0;for(a=0;a<t.length;a++)h=i.hasOwnProperty("$"+t[a].value),t[a].selected!==h&&(t[a].selected=h),h&&o&&(t[a].defaultSelected=!0)}else{for(a=""+Yn(a),i=null,h=0;h<t.length;h++){if(t[h].value===a){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}i!==null||t[h].disabled||(i=t[h])}i!==null&&(i.selected=!0)}}function lm(t,i,a){if(i!=null&&(i=""+Yn(i),i!==t.value&&(t.value=i),a==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=a!=null?""+Yn(a):""}function om(t,i,a,o){if(i==null){if(o!=null){if(a!=null)throw Error(s(92));if(G(o)){if(1<o.length)throw Error(s(93));o=o[0]}a=o}a==null&&(a=""),i=a}a=Yn(i),t.defaultValue=a,o=t.textContent,o===a&&o!==""&&o!==null&&(t.value=o),ec(t)}function bs(t,i){if(i){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=i;return}}t.textContent=i}var q1=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function um(t,i,a){var o=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="":o?t.setProperty(i,a):typeof a!="number"||a===0||q1.has(i)?i==="float"?t.cssFloat=a:t[i]=(""+a).trim():t[i]=a+"px"}function cm(t,i,a){if(i!=null&&typeof i!="object")throw Error(s(62));if(t=t.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var h in i)o=i[h],i.hasOwnProperty(h)&&a[h]!==o&&um(t,h,o)}else for(var p in i)i.hasOwnProperty(p)&&um(t,p,i[p])}function rc(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var H1=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"]]),I1=/^[\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 Wl(t){return I1.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Mr(){}var ic=null;function sc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var xs=null,vs=null;function fm(t){var i=O(t);if(i&&(t=i.stateNode)){var a=t[Pt]||null;e:switch(t=i.stateNode,i.type){case"input":if(tc(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),i=a.name,a.type==="radio"&&i!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Gn(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var o=a[i];if(o!==t&&o.form===t.form){var h=o[Pt]||null;if(!h)throw Error(s(90));tc(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<a.length;i++)o=a[i],o.form===t.form&&sm(o)}break e;case"textarea":lm(t,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&ys(t,!!a.multiple,i,!1)}}}var ac=!1;function hm(t,i,a){if(ac)return t(i,a);ac=!0;try{var o=t(i);return o}finally{if(ac=!1,(xs!==null||vs!==null)&&(Ho(),xs&&(i=xs,t=vs,vs=xs=null,fm(i),t)))for(i=0;i<t.length;i++)fm(t[i])}}function Ca(t,i){var a=t.stateNode;if(a===null)return null;var o=a[Pt]||null;if(o===null)return null;a=o[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,i,typeof a));return a}var Dr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),lc=!1;if(Dr)try{var Aa={};Object.defineProperty(Aa,"passive",{get:function(){lc=!0}}),window.addEventListener("test",Aa,Aa),window.removeEventListener("test",Aa,Aa)}catch{lc=!1}var ui=null,oc=null,eo=null;function dm(){if(eo)return eo;var t,i=oc,a=i.length,o,h="value"in ui?ui.value:ui.textContent,p=h.length;for(t=0;t<a&&i[t]===h[t];t++);var v=a-t;for(o=1;o<=v&&i[a-o]===h[p-o];o++);return eo=h.slice(t,1<o?1-o:void 0)}function to(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 no(){return!0}function mm(){return!1}function xn(t){function i(a,o,h,p,v){this._reactName=a,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=v,this.currentTarget=null;for(var S in t)t.hasOwnProperty(S)&&(a=t[S],this[S]=a?a(p):p[S]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?no:mm,this.isPropagationStopped=mm,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=no)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=no)},persist:function(){},isPersistent:no}),i}var Vi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ro=xn(Vi),Ta=g({},Vi,{view:0,detail:0}),F1=xn(Ta),uc,cc,ja,io=g({},Ta,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ja&&(ja&&t.type==="mousemove"?(uc=t.screenX-ja.screenX,cc=t.screenY-ja.screenY):cc=uc=0,ja=t),uc)},movementY:function(t){return"movementY"in t?t.movementY:cc}}),pm=xn(io),$1=g({},io,{dataTransfer:0}),Y1=xn($1),G1=g({},Ta,{relatedTarget:0}),fc=xn(G1),V1=g({},Vi,{animationName:0,elapsedTime:0,pseudoElement:0}),J1=xn(V1),X1=g({},Vi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),K1=xn(X1),Q1=g({},Vi,{data:0}),gm=xn(Q1),Z1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},W1={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"},ev={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tv(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=ev[t])?!!i[t]:!1}function hc(){return tv}var nv=g({},Ta,{key:function(t){if(t.key){var i=Z1[t.key]||t.key;if(i!=="Unidentified")return i}return t.type==="keypress"?(t=to(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?W1[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hc,charCode:function(t){return t.type==="keypress"?to(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?to(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),rv=xn(nv),iv=g({},io,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ym=xn(iv),sv=g({},Ta,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hc}),av=xn(sv),lv=g({},Vi,{propertyName:0,elapsedTime:0,pseudoElement:0}),ov=xn(lv),uv=g({},io,{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}),cv=xn(uv),fv=g({},Vi,{newState:0,oldState:0}),hv=xn(fv),dv=[9,13,27,32],dc=Dr&&"CompositionEvent"in window,Na=null;Dr&&"documentMode"in document&&(Na=document.documentMode);var mv=Dr&&"TextEvent"in window&&!Na,bm=Dr&&(!dc||Na&&8<Na&&11>=Na),xm=" ",vm=!1;function wm(t,i){switch(t){case"keyup":return dv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ws=!1;function pv(t,i){switch(t){case"compositionend":return Sm(i);case"keypress":return i.which!==32?null:(vm=!0,xm);case"textInput":return t=i.data,t===xm&&vm?null:t;default:return null}}function gv(t,i){if(ws)return t==="compositionend"||!dc&&wm(t,i)?(t=dm(),eo=oc=ui=null,ws=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return bm&&i.locale!=="ko"?null:i.data;default:return null}}var yv={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function _m(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!yv[t.type]:i==="textarea"}function Em(t,i,a,o){xs?vs?vs.push(o):vs=[o]:xs=o,i=Jo(i,"onChange"),0<i.length&&(a=new ro("onChange","change",null,a,o),t.push({event:a,listeners:i}))}var Oa=null,Ra=null;function bv(t){ay(t,0)}function so(t){var i=T(t);if(sm(i))return t}function km(t,i){if(t==="change")return i}var Cm=!1;if(Dr){var mc;if(Dr){var pc="oninput"in document;if(!pc){var Am=document.createElement("div");Am.setAttribute("oninput","return;"),pc=typeof Am.oninput=="function"}mc=pc}else mc=!1;Cm=mc&&(!document.documentMode||9<document.documentMode)}function Tm(){Oa&&(Oa.detachEvent("onpropertychange",jm),Ra=Oa=null)}function jm(t){if(t.propertyName==="value"&&so(Ra)){var i=[];Em(i,Ra,t,sc(t)),hm(bv,i)}}function xv(t,i,a){t==="focusin"?(Tm(),Oa=i,Ra=a,Oa.attachEvent("onpropertychange",jm)):t==="focusout"&&Tm()}function vv(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return so(Ra)}function wv(t,i){if(t==="click")return so(i)}function Sv(t,i){if(t==="input"||t==="change")return so(i)}function _v(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var Nn=typeof Object.is=="function"?Object.is:_v;function Ma(t,i){if(Nn(t,i))return!0;if(typeof t!="object"||t===null||typeof i!="object"||i===null)return!1;var a=Object.keys(t),o=Object.keys(i);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var h=a[o];if(!st.call(i,h)||!Nn(t[h],i[h]))return!1}return!0}function Nm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Om(t,i){var a=Nm(t);t=0;for(var o;a;){if(a.nodeType===3){if(o=t+a.textContent.length,t<=i&&o>=i)return{node:a,offset:i-t};t=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Nm(a)}}function Rm(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Rm(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Mm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=Zl(t.document);i instanceof t.HTMLIFrameElement;){try{var a=typeof i.contentWindow.location.href=="string"}catch{a=!1}if(a)t=i.contentWindow;else break;i=Zl(t.document)}return i}function gc(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}var Ev=Dr&&"documentMode"in document&&11>=document.documentMode,Ss=null,yc=null,Da=null,bc=!1;function Dm(t,i,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;bc||Ss==null||Ss!==Zl(o)||(o=Ss,"selectionStart"in o&&gc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Da&&Ma(Da,o)||(Da=o,o=Jo(yc,"onSelect"),0<o.length&&(i=new ro("onSelect","select",null,i,a),t.push({event:i,listeners:o}),i.target=Ss)))}function Ji(t,i){var a={};return a[t.toLowerCase()]=i.toLowerCase(),a["Webkit"+t]="webkit"+i,a["Moz"+t]="moz"+i,a}var _s={animationend:Ji("Animation","AnimationEnd"),animationiteration:Ji("Animation","AnimationIteration"),animationstart:Ji("Animation","AnimationStart"),transitionrun:Ji("Transition","TransitionRun"),transitionstart:Ji("Transition","TransitionStart"),transitioncancel:Ji("Transition","TransitionCancel"),transitionend:Ji("Transition","TransitionEnd")},xc={},Lm={};Dr&&(Lm=document.createElement("div").style,"AnimationEvent"in window||(delete _s.animationend.animation,delete _s.animationiteration.animation,delete _s.animationstart.animation),"TransitionEvent"in window||delete _s.transitionend.transition);function Xi(t){if(xc[t])return xc[t];if(!_s[t])return t;var i=_s[t],a;for(a in i)if(i.hasOwnProperty(a)&&a in Lm)return xc[t]=i[a];return t}var zm=Xi("animationend"),Um=Xi("animationiteration"),Bm=Xi("animationstart"),kv=Xi("transitionrun"),Cv=Xi("transitionstart"),Av=Xi("transitioncancel"),Pm=Xi("transitionend"),qm=new Map,vc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");vc.push("scrollEnd");function or(t,i){qm.set(t,i),ye(i,[t])}var ao=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=[],Es=0,wc=0;function lo(){for(var t=Es,i=wc=Es=0;i<t;){var a=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 v=o.pending;v===null?h.next=h:(h.next=v.next,v.next=h),o.pending=h}p!==0&&Hm(a,h,p)}}function oo(t,i,a,o){Vn[Es++]=t,Vn[Es++]=i,Vn[Es++]=a,Vn[Es++]=o,wc|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function Sc(t,i,a,o){return oo(t,i,a,o),uo(t)}function Ki(t,i){return oo(t,null,null,i),uo(t)}function Hm(t,i,a){t.lanes|=a;var o=t.alternate;o!==null&&(o.lanes|=a);for(var h=!1,p=t.return;p!==null;)p.childLanes|=a,o=p.alternate,o!==null&&(o.childLanes|=a),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(h=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,h&&i!==null&&(h=31-Se(a),t=p.hiddenUpdates,o=t[h],o===null?t[h]=[i]:o.push(i),i.lane=a|536870912),p):null}function uo(t){if(50<nl)throw nl=0,Rf=null,Error(s(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var ks={};function Tv(t,i,a,o){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function On(t,i,a,o){return new Tv(t,i,a,o)}function _c(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Lr(t,i){var a=t.alternate;return a===null?(a=On(t.tag,i,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=i,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,i=t.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function Im(t,i){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=i,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,i=a.dependencies,t.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),t}function co(t,i,a,o,h,p){var v=0;if(o=t,typeof t=="function")_c(t)&&(v=1);else if(typeof t=="string")v=Mw(t,a,ve.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case F:return t=On(31,a,i,h),t.elementType=F,t.lanes=p,t;case M:return Qi(a.children,h,p,i);case P:v=8,h|=24;break;case z:return t=On(12,a,i,h|2),t.elementType=z,t.lanes=p,t;case B:return t=On(13,a,i,h),t.elementType=B,t.lanes=p,t;case R:return t=On(19,a,i,h),t.elementType=R,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case j:v=10;break e;case I:v=9;break e;case K:v=11;break e;case Y:v=14;break e;case J:v=16,o=null;break e}v=29,a=Error(s(130,t===null?"null":typeof t,"")),o=null}return i=On(v,a,i,h),i.elementType=t,i.type=o,i.lanes=p,i}function Qi(t,i,a,o){return t=On(7,t,o,i),t.lanes=a,t}function Ec(t,i,a){return t=On(6,t,null,i),t.lanes=a,t}function Fm(t){var i=On(18,null,null,0);return i.stateNode=t,i}function kc(t,i,a){return i=On(4,t.children!==null?t.children:[],t.key,i),i.lanes=a,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var $m=new WeakMap;function Jn(t,i){if(typeof t=="object"&&t!==null){var a=$m.get(t);return a!==void 0?a:(i={value:t,source:i,stack:mt(i)},$m.set(t,i),i)}return{value:t,source:i,stack:mt(i)}}var Cs=[],As=0,fo=null,La=0,Xn=[],Kn=0,ci=null,br=1,xr="";function zr(t,i){Cs[As++]=La,Cs[As++]=fo,fo=t,La=i}function Ym(t,i,a){Xn[Kn++]=br,Xn[Kn++]=xr,Xn[Kn++]=ci,ci=t;var o=br;t=xr;var h=32-Se(o)-1;o&=~(1<<h),a+=1;var p=32-Se(i)+h;if(30<p){var v=h-h%5;p=(o&(1<<v)-1).toString(32),o>>=v,h-=v,br=1<<32-Se(i)+h|a<<h|o,xr=p+t}else br=1<<p|a<<h|o,xr=t}function Cc(t){t.return!==null&&(zr(t,1),Ym(t,1,0))}function Ac(t){for(;t===fo;)fo=Cs[--As],Cs[As]=null,La=Cs[--As],Cs[As]=null;for(;t===ci;)ci=Xn[--Kn],Xn[Kn]=null,xr=Xn[--Kn],Xn[Kn]=null,br=Xn[--Kn],Xn[Kn]=null}function Gm(t,i){Xn[Kn++]=br,Xn[Kn++]=xr,Xn[Kn++]=ci,br=i.id,xr=i.overflow,ci=t}var rn=null,Ot=null,nt=!1,fi=null,Qn=!1,Tc=Error(s(519));function hi(t){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw za(Jn(i,t)),Tc}function Vm(t){var i=t.stateNode,a=t.type,o=t.memoizedProps;switch(i[Ct]=t,i[Pt]=o,a){case"dialog":Ke("cancel",i),Ke("close",i);break;case"iframe":case"object":case"embed":Ke("load",i);break;case"video":case"audio":for(a=0;a<il.length;a++)Ke(il[a],i);break;case"source":Ke("error",i);break;case"img":case"image":case"link":Ke("error",i),Ke("load",i);break;case"details":Ke("toggle",i);break;case"input":Ke("invalid",i),am(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Ke("invalid",i);break;case"textarea":Ke("invalid",i),om(i,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||o.suppressHydrationWarning===!0||cy(i.textContent,a)?(o.popover!=null&&(Ke("beforetoggle",i),Ke("toggle",i)),o.onScroll!=null&&Ke("scroll",i),o.onScrollEnd!=null&&Ke("scrollend",i),o.onClick!=null&&(i.onclick=Mr),i=!0):i=!1,i||hi(t,!0)}function Jm(t){for(rn=t.return;rn;)switch(rn.tag){case 5:case 31:case 13:Qn=!1;return;case 27:case 3:Qn=!0;return;default:rn=rn.return}}function Ts(t){if(t!==rn)return!1;if(!nt)return Jm(t),nt=!0,!1;var i=t.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Vf(t.type,t.memoizedProps)),a=!a),a&&Ot&&hi(t),Jm(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));Ot=xy(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));Ot=xy(t)}else i===27?(i=Ot,Ci(t.type)?(t=Zf,Zf=null,Ot=t):Ot=i):Ot=rn?Wn(t.stateNode.nextSibling):null;return!0}function Zi(){Ot=rn=null,nt=!1}function jc(){var t=fi;return t!==null&&(_n===null?_n=t:_n.push.apply(_n,t),fi=null),t}function za(t){fi===null?fi=[t]:fi.push(t)}var Nc=D(null),Wi=null,Ur=null;function di(t,i,a){A(Nc,i._currentValue),i._currentValue=a}function Br(t){t._currentValue=Nc.current,ee(Nc)}function Oc(t,i,a){for(;t!==null;){var o=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),t===a)break;t=t.return}}function Rc(t,i,a,o){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var p=h.dependencies;if(p!==null){var v=h.child;p=p.firstContext;e:for(;p!==null;){var S=p;p=h;for(var q=0;q<i.length;q++)if(S.context===i[q]){p.lanes|=a,S=p.alternate,S!==null&&(S.lanes|=a),Oc(p.return,a,t),o||(v=null);break e}p=S.next}}else if(h.tag===18){if(v=h.return,v===null)throw Error(s(341));v.lanes|=a,p=v.alternate,p!==null&&(p.lanes|=a),Oc(v,a,t),v=null}else v=h.child;if(v!==null)v.return=h;else for(v=h;v!==null;){if(v===t){v=null;break}if(h=v.sibling,h!==null){h.return=v.return,v=h;break}v=v.return}h=v}}function js(t,i,a,o){t=null;for(var h=i,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var v=h.alternate;if(v===null)throw Error(s(387));if(v=v.memoizedProps,v!==null){var S=h.type;Nn(h.pendingProps.value,v.value)||(t!==null?t.push(S):t=[S])}}else if(h===Me.current){if(v=h.alternate,v===null)throw Error(s(387));v.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(ul):t=[ul])}h=h.return}t!==null&&Rc(i,t,a,o),i.flags|=262144}function ho(t){for(t=t.firstContext;t!==null;){if(!Nn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function es(t){Wi=t,Ur=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function sn(t){return Xm(Wi,t)}function mo(t,i){return Wi===null&&es(t),Xm(t,i)}function Xm(t,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},Ur===null){if(t===null)throw Error(s(308));Ur=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else Ur=Ur.next=i;return a}var jv=typeof AbortController<"u"?AbortController:function(){var t=[],i=this.signal={aborted:!1,addEventListener:function(a,o){t.push(o)}};this.abort=function(){i.aborted=!0,t.forEach(function(a){return a()})}},Nv=e.unstable_scheduleCallback,Ov=e.unstable_NormalPriority,Gt={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mc(){return{controller:new jv,data:new Map,refCount:0}}function Ua(t){t.refCount--,t.refCount===0&&Nv(Ov,function(){t.controller.abort()})}var Ba=null,Dc=0,Ns=0,Os=null;function Rv(t,i){if(Ba===null){var a=Ba=[];Dc=0,Ns=Bf(),Os={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Dc++,i.then(Km,Km),i}function Km(){if(--Dc===0&&Ba!==null){Os!==null&&(Os.status="fulfilled");var t=Ba;Ba=null,Ns=0,Os=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function Mv(t,i){var a=[],o={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return t.then(function(){o.status="fulfilled",o.value=i;for(var h=0;h<a.length;h++)(0,a[h])(i)},function(h){for(o.status="rejected",o.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),o}var Qm=H.S;H.S=function(t,i){Dg=vt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Rv(t,i),Qm!==null&&Qm(t,i)};var ts=D(null);function Lc(){var t=ts.current;return t!==null?t:At.pooledCache}function po(t,i){i===null?A(ts,ts.current):A(ts,i.pool)}function Zm(){var t=Lc();return t===null?null:{parent:Gt._currentValue,pool:t}}var Rs=Error(s(460)),zc=Error(s(474)),go=Error(s(542)),yo={then:function(){}};function Wm(t){return t=t.status,t==="fulfilled"||t==="rejected"}function ep(t,i,a){switch(a=t[a],a===void 0?t.push(i):a!==i&&(i.then(Mr,Mr),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,np(t),t;default:if(typeof i.status=="string")i.then(Mr,Mr);else{if(t=At,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=i,t.status="pending",t.then(function(o){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=o}},function(o){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=o}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,np(t),t}throw rs=i,Rs}}function ns(t){try{var i=t._init;return i(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(rs=a,Rs):a}}var rs=null;function tp(){if(rs===null)throw Error(s(459));var t=rs;return rs=null,t}function np(t){if(t===Rs||t===go)throw Error(s(483))}var Ms=null,Pa=0;function bo(t){var i=Pa;return Pa+=1,Ms===null&&(Ms=[]),ep(Ms,t,i)}function qa(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function xo(t,i){throw i.$$typeof===x?Error(s(525)):(t=Object.prototype.toString.call(i),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)))}function rp(t){function i(Z,V){if(t){var ne=Z.deletions;ne===null?(Z.deletions=[V],Z.flags|=16):ne.push(V)}}function a(Z,V){if(!t)return null;for(;V!==null;)i(Z,V),V=V.sibling;return null}function o(Z){for(var V=new Map;Z!==null;)Z.key!==null?V.set(Z.key,Z):V.set(Z.index,Z),Z=Z.sibling;return V}function h(Z,V){return Z=Lr(Z,V),Z.index=0,Z.sibling=null,Z}function p(Z,V,ne){return Z.index=ne,t?(ne=Z.alternate,ne!==null?(ne=ne.index,ne<V?(Z.flags|=67108866,V):ne):(Z.flags|=67108866,V)):(Z.flags|=1048576,V)}function v(Z){return t&&Z.alternate===null&&(Z.flags|=67108866),Z}function S(Z,V,ne,he){return V===null||V.tag!==6?(V=Ec(ne,Z.mode,he),V.return=Z,V):(V=h(V,ne),V.return=Z,V)}function q(Z,V,ne,he){var Le=ne.type;return Le===M?ce(Z,V,ne.props.children,he,ne.key):V!==null&&(V.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===J&&ns(Le)===V.type)?(V=h(V,ne.props),qa(V,ne),V.return=Z,V):(V=co(ne.type,ne.key,ne.props,null,Z.mode,he),qa(V,ne),V.return=Z,V)}function re(Z,V,ne,he){return V===null||V.tag!==4||V.stateNode.containerInfo!==ne.containerInfo||V.stateNode.implementation!==ne.implementation?(V=kc(ne,Z.mode,he),V.return=Z,V):(V=h(V,ne.children||[]),V.return=Z,V)}function ce(Z,V,ne,he,Le){return V===null||V.tag!==7?(V=Qi(ne,Z.mode,he,Le),V.return=Z,V):(V=h(V,ne),V.return=Z,V)}function pe(Z,V,ne){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Ec(""+V,Z.mode,ne),V.return=Z,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case w:return ne=co(V.type,V.key,V.props,null,Z.mode,ne),qa(ne,V),ne.return=Z,ne;case E:return V=kc(V,Z.mode,ne),V.return=Z,V;case J:return V=ns(V),pe(Z,V,ne)}if(G(V)||Q(V))return V=Qi(V,Z.mode,ne,null),V.return=Z,V;if(typeof V.then=="function")return pe(Z,bo(V),ne);if(V.$$typeof===j)return pe(Z,mo(Z,V),ne);xo(Z,V)}return null}function ie(Z,V,ne,he){var Le=V!==null?V.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Le!==null?null:S(Z,V,""+ne,he);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case w:return ne.key===Le?q(Z,V,ne,he):null;case E:return ne.key===Le?re(Z,V,ne,he):null;case J:return ne=ns(ne),ie(Z,V,ne,he)}if(G(ne)||Q(ne))return Le!==null?null:ce(Z,V,ne,he,null);if(typeof ne.then=="function")return ie(Z,V,bo(ne),he);if(ne.$$typeof===j)return ie(Z,V,mo(Z,ne),he);xo(Z,ne)}return null}function le(Z,V,ne,he,Le){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return Z=Z.get(ne)||null,S(V,Z,""+he,Le);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case w:return Z=Z.get(he.key===null?ne:he.key)||null,q(V,Z,he,Le);case E:return Z=Z.get(he.key===null?ne:he.key)||null,re(V,Z,he,Le);case J:return he=ns(he),le(Z,V,ne,he,Le)}if(G(he)||Q(he))return Z=Z.get(ne)||null,ce(V,Z,he,Le,null);if(typeof he.then=="function")return le(Z,V,ne,bo(he),Le);if(he.$$typeof===j)return le(Z,V,ne,mo(V,he),Le);xo(V,he)}return null}function Oe(Z,V,ne,he){for(var Le=null,ot=null,Re=V,Ge=V=0,et=null;Re!==null&&Ge<ne.length;Ge++){Re.index>Ge?(et=Re,Re=null):et=Re.sibling;var ut=ie(Z,Re,ne[Ge],he);if(ut===null){Re===null&&(Re=et);break}t&&Re&&ut.alternate===null&&i(Z,Re),V=p(ut,V,Ge),ot===null?Le=ut:ot.sibling=ut,ot=ut,Re=et}if(Ge===ne.length)return a(Z,Re),nt&&zr(Z,Ge),Le;if(Re===null){for(;Ge<ne.length;Ge++)Re=pe(Z,ne[Ge],he),Re!==null&&(V=p(Re,V,Ge),ot===null?Le=Re:ot.sibling=Re,ot=Re);return nt&&zr(Z,Ge),Le}for(Re=o(Re);Ge<ne.length;Ge++)et=le(Re,Z,Ge,ne[Ge],he),et!==null&&(t&&et.alternate!==null&&Re.delete(et.key===null?Ge:et.key),V=p(et,V,Ge),ot===null?Le=et:ot.sibling=et,ot=et);return t&&Re.forEach(function(Oi){return i(Z,Oi)}),nt&&zr(Z,Ge),Le}function qe(Z,V,ne,he){if(ne==null)throw Error(s(151));for(var Le=null,ot=null,Re=V,Ge=V=0,et=null,ut=ne.next();Re!==null&&!ut.done;Ge++,ut=ne.next()){Re.index>Ge?(et=Re,Re=null):et=Re.sibling;var Oi=ie(Z,Re,ut.value,he);if(Oi===null){Re===null&&(Re=et);break}t&&Re&&Oi.alternate===null&&i(Z,Re),V=p(Oi,V,Ge),ot===null?Le=Oi:ot.sibling=Oi,ot=Oi,Re=et}if(ut.done)return a(Z,Re),nt&&zr(Z,Ge),Le;if(Re===null){for(;!ut.done;Ge++,ut=ne.next())ut=pe(Z,ut.value,he),ut!==null&&(V=p(ut,V,Ge),ot===null?Le=ut:ot.sibling=ut,ot=ut);return nt&&zr(Z,Ge),Le}for(Re=o(Re);!ut.done;Ge++,ut=ne.next())ut=le(Re,Z,Ge,ut.value,he),ut!==null&&(t&&ut.alternate!==null&&Re.delete(ut.key===null?Ge:ut.key),V=p(ut,V,Ge),ot===null?Le=ut:ot.sibling=ut,ot=ut);return t&&Re.forEach(function($w){return i(Z,$w)}),nt&&zr(Z,Ge),Le}function _t(Z,V,ne,he){if(typeof ne=="object"&&ne!==null&&ne.type===M&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case w:e:{for(var Le=ne.key;V!==null;){if(V.key===Le){if(Le=ne.type,Le===M){if(V.tag===7){a(Z,V.sibling),he=h(V,ne.props.children),he.return=Z,Z=he;break e}}else if(V.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===J&&ns(Le)===V.type){a(Z,V.sibling),he=h(V,ne.props),qa(he,ne),he.return=Z,Z=he;break e}a(Z,V);break}else i(Z,V);V=V.sibling}ne.type===M?(he=Qi(ne.props.children,Z.mode,he,ne.key),he.return=Z,Z=he):(he=co(ne.type,ne.key,ne.props,null,Z.mode,he),qa(he,ne),he.return=Z,Z=he)}return v(Z);case E:e:{for(Le=ne.key;V!==null;){if(V.key===Le)if(V.tag===4&&V.stateNode.containerInfo===ne.containerInfo&&V.stateNode.implementation===ne.implementation){a(Z,V.sibling),he=h(V,ne.children||[]),he.return=Z,Z=he;break e}else{a(Z,V);break}else i(Z,V);V=V.sibling}he=kc(ne,Z.mode,he),he.return=Z,Z=he}return v(Z);case J:return ne=ns(ne),_t(Z,V,ne,he)}if(G(ne))return Oe(Z,V,ne,he);if(Q(ne)){if(Le=Q(ne),typeof Le!="function")throw Error(s(150));return ne=Le.call(ne),qe(Z,V,ne,he)}if(typeof ne.then=="function")return _t(Z,V,bo(ne),he);if(ne.$$typeof===j)return _t(Z,V,mo(Z,ne),he);xo(Z,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,V!==null&&V.tag===6?(a(Z,V.sibling),he=h(V,ne),he.return=Z,Z=he):(a(Z,V),he=Ec(ne,Z.mode,he),he.return=Z,Z=he),v(Z)):a(Z,V)}return function(Z,V,ne,he){try{Pa=0;var Le=_t(Z,V,ne,he);return Ms=null,Le}catch(Re){if(Re===Rs||Re===go)throw Re;var ot=On(29,Re,null,Z.mode);return ot.lanes=he,ot.return=Z,ot}finally{}}}var is=rp(!0),ip=rp(!1),mi=!1;function Uc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bc(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function pi(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function gi(t,i,a){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(ht&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=uo(t),Hm(t,null,a),i}return oo(t,o,i,a),uo(t)}function Ha(t,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var o=i.lanes;o&=t.pendingLanes,a|=o,i.lanes=a,$i(t,a)}}function Pc(t,i){var a=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var v={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=v:p=p.next=v,a=a.next}while(a!==null);p===null?h=p=i:p=p.next=i}else h=p=i;a={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=i:t.next=i,a.lastBaseUpdate=i}var qc=!1;function Ia(){if(qc){var t=Os;if(t!==null)throw t}}function Fa(t,i,a,o){qc=!1;var h=t.updateQueue;mi=!1;var p=h.firstBaseUpdate,v=h.lastBaseUpdate,S=h.shared.pending;if(S!==null){h.shared.pending=null;var q=S,re=q.next;q.next=null,v===null?p=re:v.next=re,v=q;var ce=t.alternate;ce!==null&&(ce=ce.updateQueue,S=ce.lastBaseUpdate,S!==v&&(S===null?ce.firstBaseUpdate=re:S.next=re,ce.lastBaseUpdate=q))}if(p!==null){var pe=h.baseState;v=0,ce=re=q=null,S=p;do{var ie=S.lane&-536870913,le=ie!==S.lane;if(le?(We&ie)===ie:(o&ie)===ie){ie!==0&&ie===Ns&&(qc=!0),ce!==null&&(ce=ce.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Oe=t,qe=S;ie=i;var _t=a;switch(qe.tag){case 1:if(Oe=qe.payload,typeof Oe=="function"){pe=Oe.call(_t,pe,ie);break e}pe=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=qe.payload,ie=typeof Oe=="function"?Oe.call(_t,pe,ie):Oe,ie==null)break e;pe=g({},pe,ie);break e;case 2:mi=!0}}ie=S.callback,ie!==null&&(t.flags|=64,le&&(t.flags|=8192),le=h.callbacks,le===null?h.callbacks=[ie]:le.push(ie))}else le={lane:ie,tag:S.tag,payload:S.payload,callback:S.callback,next:null},ce===null?(re=ce=le,q=pe):ce=ce.next=le,v|=ie;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&&(q=pe),h.baseState=q,h.firstBaseUpdate=re,h.lastBaseUpdate=ce,p===null&&(h.shared.lanes=0),wi|=v,t.lanes=v,t.memoizedState=pe}}function sp(t,i){if(typeof t!="function")throw Error(s(191,t));t.call(i)}function ap(t,i){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)sp(a[t],i)}var Ds=D(null),vo=D(0);function lp(t,i){t=Vr,A(vo,t),A(Ds,i),Vr=t|i.baseLanes}function Hc(){A(vo,Vr),A(Ds,Ds.current)}function Ic(){Vr=vo.current,ee(Ds),ee(vo)}var Rn=D(null),Zn=null;function yi(t){var i=t.alternate;A(It,It.current&1),A(Rn,t),Zn===null&&(i===null||Ds.current!==null||i.memoizedState!==null)&&(Zn=t)}function Fc(t){A(It,It.current),A(Rn,t),Zn===null&&(Zn=t)}function op(t){t.tag===22?(A(It,It.current),A(Rn,t),Zn===null&&(Zn=t)):bi()}function bi(){A(It,It.current),A(Rn,Rn.current)}function Mn(t){ee(Rn),Zn===t&&(Zn=null),ee(It)}var It=D(0);function wo(t){for(var i=t;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Kf(a)||Qf(a)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Pr=0,Ye=null,wt=null,Vt=null,So=!1,Ls=!1,ss=!1,_o=0,$a=0,zs=null,Dv=0;function qt(){throw Error(s(321))}function $c(t,i){if(i===null)return!1;for(var a=0;a<i.length&&a<t.length;a++)if(!Nn(t[a],i[a]))return!1;return!0}function Yc(t,i,a,o,h,p){return Pr=p,Ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,H.H=t===null||t.memoizedState===null?Yp:lf,ss=!1,p=a(o,h),ss=!1,Ls&&(p=cp(i,a,o,h)),up(t),p}function up(t){H.H=Va;var i=wt!==null&&wt.next!==null;if(Pr=0,Vt=wt=Ye=null,So=!1,$a=0,zs=null,i)throw Error(s(300));t===null||Jt||(t=t.dependencies,t!==null&&ho(t)&&(Jt=!0))}function cp(t,i,a,o){Ye=t;var h=0;do{if(Ls&&(zs=null),$a=0,Ls=!1,25<=h)throw Error(s(301));if(h+=1,Vt=wt=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}H.H=Gp,p=i(a,o)}while(Ls);return p}function Lv(){var t=H.H,i=t.useState()[0];return i=typeof i.then=="function"?Ya(i):i,t=t.useState()[0],(wt!==null?wt.memoizedState:null)!==t&&(Ye.flags|=1024),i}function Gc(){var t=_o!==0;return _o=0,t}function Vc(t,i,a){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~a}function Jc(t){if(So){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}So=!1}Pr=0,Vt=wt=Ye=null,Ls=!1,$a=_o=0,zs=null}function hn(){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(wt===null){var t=Ye.alternate;t=t!==null?t.memoizedState:null}else t=wt.next;var i=Vt===null?Ye.memoizedState:Vt.next;if(i!==null)Vt=i,wt=t;else{if(t===null)throw Ye.alternate===null?Error(s(467)):Error(s(310));wt=t,t={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},Vt===null?Ye.memoizedState=Vt=t:Vt=Vt.next=t}return Vt}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ya(t){var i=$a;return $a+=1,zs===null&&(zs=[]),t=ep(zs,t,i),i=Ye,(Vt===null?i.memoizedState:Vt.next)===null&&(i=i.alternate,H.H=i===null||i.memoizedState===null?Yp:lf),t}function ko(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ya(t);if(t.$$typeof===j)return sn(t)}throw Error(s(438,String(t)))}function Xc(t){var i=null,a=Ye.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var o=Ye.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=Eo(),Ye.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(t),o=0;o<t;o++)a[o]=L;return i.index++,a}function qr(t,i){return typeof i=="function"?i(t):i}function Co(t){var i=Ft();return Kc(i,wt,t)}function Kc(t,i,a){var o=t.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=a;var h=t.baseQueue,p=o.pending;if(p!==null){if(h!==null){var v=h.next;h.next=p.next,p.next=v}i.baseQueue=h=p,o.pending=null}if(p=t.baseState,h===null)t.memoizedState=p;else{i=h.next;var S=v=null,q=null,re=i,ce=!1;do{var pe=re.lane&-536870913;if(pe!==re.lane?(We&pe)===pe:(Pr&pe)===pe){var ie=re.revertLane;if(ie===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),pe===Ns&&(ce=!0);else if((Pr&ie)===ie){re=re.next,ie===Ns&&(ce=!0);continue}else pe={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},q===null?(S=q=pe,v=p):q=q.next=pe,Ye.lanes|=ie,wi|=ie;pe=re.action,ss&&a(p,pe),p=re.hasEagerState?re.eagerState:a(p,pe)}else ie={lane:pe,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},q===null?(S=q=ie,v=p):q=q.next=ie,Ye.lanes|=pe,wi|=pe;re=re.next}while(re!==null&&re!==i);if(q===null?v=p:q.next=S,!Nn(p,t.memoizedState)&&(Jt=!0,ce&&(a=Os,a!==null)))throw a;t.memoizedState=p,t.baseState=v,t.baseQueue=q,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Qc(t){var i=Ft(),a=i.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var o=a.dispatch,h=a.pending,p=i.memoizedState;if(h!==null){a.pending=null;var v=h=h.next;do p=t(p,v.action),v=v.next;while(v!==h);Nn(p,i.memoizedState)||(Jt=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,o]}function fp(t,i,a){var o=Ye,h=Ft(),p=nt;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var v=!Nn((wt||h).memoizedState,a);if(v&&(h.memoizedState=a,Jt=!0),h=h.queue,ef(mp.bind(null,o,h,t),[t]),h.getSnapshot!==i||v||Vt!==null&&Vt.memoizedState.tag&1){if(o.flags|=2048,Us(9,{destroy:void 0},dp.bind(null,o,h,a,i),null),At===null)throw Error(s(349));p||(Pr&127)!==0||hp(o,i,a)}return a}function hp(t,i,a){t.flags|=16384,t={getSnapshot:i,value:a},i=Ye.updateQueue,i===null?(i=Eo(),Ye.updateQueue=i,i.stores=[t]):(a=i.stores,a===null?i.stores=[t]:a.push(t))}function dp(t,i,a,o){i.value=a,i.getSnapshot=o,pp(i)&&gp(t)}function mp(t,i,a){return a(function(){pp(i)&&gp(t)})}function pp(t){var i=t.getSnapshot;t=t.value;try{var a=i();return!Nn(t,a)}catch{return!0}}function gp(t){var i=Ki(t,2);i!==null&&En(i,t,2)}function Zc(t){var i=hn();if(typeof t=="function"){var a=t;if(t=a(),ss){ze(!0);try{a()}finally{ze(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qr,lastRenderedState:t},i}function yp(t,i,a,o){return t.baseState=a,Kc(t,wt,typeof o=="function"?o:qr)}function zv(t,i,a,o,h){if(jo(t))throw Error(s(485));if(t=i.action,t!==null){var p={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){p.listeners.push(v)}};H.T!==null?a(!0):p.isTransition=!1,o(p),a=i.pending,a===null?(p.next=i.pending=p,bp(i,p)):(p.next=a.next,i.pending=a.next=p)}}function bp(t,i){var a=i.action,o=i.payload,h=t.state;if(i.isTransition){var p=H.T,v={};H.T=v;try{var S=a(h,o),q=H.S;q!==null&&q(v,S),xp(t,i,S)}catch(re){Wc(t,i,re)}finally{p!==null&&v.types!==null&&(p.types=v.types),H.T=p}}else try{p=a(h,o),xp(t,i,p)}catch(re){Wc(t,i,re)}}function xp(t,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){vp(t,i,o)},function(o){return Wc(t,i,o)}):vp(t,i,a)}function vp(t,i,a){i.status="fulfilled",i.value=a,wp(i),t.state=a,i=t.pending,i!==null&&(a=i.next,a===i?t.pending=null:(a=a.next,i.next=a,bp(t,a)))}function Wc(t,i,a){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=a,wp(i),i=i.next;while(i!==o)}t.action=null}function wp(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function Sp(t,i){return i}function _p(t,i){if(nt){var a=At.formState;if(a!==null){e:{var o=Ye;if(nt){if(Ot){t:{for(var h=Ot,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){Ot=Wn(h.nextSibling),o=h.data==="F!";break e}}hi(o)}o=!1}o&&(i=a[0])}}return a=hn(),a.memoizedState=a.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sp,lastRenderedState:i},a.queue=o,a=Ip.bind(null,Ye,o),o.dispatch=a,o=Zc(!1),p=af.bind(null,Ye,!1,o.queue),o=hn(),h={state:i,dispatch:null,action:t,pending:null},o.queue=h,a=zv.bind(null,Ye,h,p,a),h.dispatch=a,o.memoizedState=t,[i,a,!1]}function Ep(t){var i=Ft();return kp(i,wt,t)}function kp(t,i,a){if(i=Kc(t,i,Sp)[0],t=Co(qr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Ya(i)}catch(v){throw v===Rs?go:v}else o=i;i=Ft();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(Ye.flags|=2048,Us(9,{destroy:void 0},Uv.bind(null,h,a),null)),[o,p,t]}function Uv(t,i){t.action=i}function Cp(t){var i=Ft(),a=wt;if(a!==null)return kp(i,a,t);Ft(),i=i.memoizedState,a=Ft();var o=a.queue.dispatch;return a.memoizedState=t,[i,o,!1]}function Us(t,i,a,o){return t={tag:t,create:a,deps:o,inst:i,next:null},i=Ye.updateQueue,i===null&&(i=Eo(),Ye.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=t.next=t:(o=a.next,a.next=t,t.next=o,i.lastEffect=t),t}function Ap(){return Ft().memoizedState}function Ao(t,i,a,o){var h=hn();Ye.flags|=t,h.memoizedState=Us(1|i,{destroy:void 0},a,o===void 0?null:o)}function To(t,i,a,o){var h=Ft();o=o===void 0?null:o;var p=h.memoizedState.inst;wt!==null&&o!==null&&$c(o,wt.memoizedState.deps)?h.memoizedState=Us(i,p,a,o):(Ye.flags|=t,h.memoizedState=Us(1|i,p,a,o))}function Tp(t,i){Ao(8390656,8,t,i)}function ef(t,i){To(2048,8,t,i)}function Bv(t){Ye.flags|=4;var i=Ye.updateQueue;if(i===null)i=Eo(),Ye.updateQueue=i,i.events=[t];else{var a=i.events;a===null?i.events=[t]:a.push(t)}}function jp(t){var i=Ft().memoizedState;return Bv({ref:i,nextImpl:t}),function(){if((ht&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function Np(t,i){return To(4,2,t,i)}function Op(t,i){return To(4,4,t,i)}function Rp(t,i){if(typeof i=="function"){t=t();var a=i(t);return function(){typeof a=="function"?a():i(null)}}if(i!=null)return t=t(),i.current=t,function(){i.current=null}}function Mp(t,i,a){a=a!=null?a.concat([t]):null,To(4,4,Rp.bind(null,i,t),a)}function tf(){}function Dp(t,i){var a=Ft();i=i===void 0?null:i;var o=a.memoizedState;return i!==null&&$c(i,o[1])?o[0]:(a.memoizedState=[t,i],t)}function Lp(t,i){var a=Ft();i=i===void 0?null:i;var o=a.memoizedState;if(i!==null&&$c(i,o[1]))return o[0];if(o=t(),ss){ze(!0);try{t()}finally{ze(!1)}}return a.memoizedState=[o,i],o}function nf(t,i,a){return a===void 0||(Pr&1073741824)!==0&&(We&261930)===0?t.memoizedState=i:(t.memoizedState=a,t=zg(),Ye.lanes|=t,wi|=t,a)}function zp(t,i,a,o){return Nn(a,i)?a:Ds.current!==null?(t=nf(t,a,o),Nn(t,i)||(Jt=!0),t):(Pr&42)===0||(Pr&1073741824)!==0&&(We&261930)===0?(Jt=!0,t.memoizedState=a):(t=zg(),Ye.lanes|=t,wi|=t,i)}function Up(t,i,a,o,h){var p=X.p;X.p=p!==0&&8>p?p:8;var v=H.T,S={};H.T=S,af(t,!1,i,a);try{var q=h(),re=H.S;if(re!==null&&re(S,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var ce=Mv(q,o);Ga(t,i,ce,zn(t))}else Ga(t,i,o,zn(t))}catch(pe){Ga(t,i,{then:function(){},status:"rejected",reason:pe},zn())}finally{X.p=p,v!==null&&S.types!==null&&(v.types=S.types),H.T=v}}function Pv(){}function rf(t,i,a,o){if(t.tag!==5)throw Error(s(476));var h=Bp(t).queue;Up(t,h,i,ue,a===null?Pv:function(){return Pp(t),a(o)})}function Bp(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:ue,baseState:ue,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qr,lastRenderedState:ue},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qr,lastRenderedState:a},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function Pp(t){var i=Bp(t);i.next===null&&(i=t.alternate.memoizedState),Ga(t,i.next.queue,{},zn())}function sf(){return sn(ul)}function qp(){return Ft().memoizedState}function Hp(){return Ft().memoizedState}function qv(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var a=zn();t=pi(a);var o=gi(i,t,a);o!==null&&(En(o,i,a),Ha(o,i,a)),i={cache:Mc()},t.payload=i;return}i=i.return}}function Hv(t,i,a){var o=zn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},jo(t)?Fp(i,a):(a=Sc(t,i,a,o),a!==null&&(En(a,t,o),$p(a,i,o)))}function Ip(t,i,a){var o=zn();Ga(t,i,a,o)}function Ga(t,i,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(jo(t))Fp(i,h);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var v=i.lastRenderedState,S=p(v,a);if(h.hasEagerState=!0,h.eagerState=S,Nn(S,v))return oo(t,i,h,0),At===null&&lo(),!1}catch{}finally{}if(a=Sc(t,i,h,o),a!==null)return En(a,t,o),$p(a,i,o),!0}return!1}function af(t,i,a,o){if(o={lane:2,revertLane:Bf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},jo(t)){if(i)throw Error(s(479))}else i=Sc(t,a,o,2),i!==null&&En(i,t,2)}function jo(t){var i=t.alternate;return t===Ye||i!==null&&i===Ye}function Fp(t,i){Ls=So=!0;var a=t.pending;a===null?i.next=i:(i.next=a.next,a.next=i),t.pending=i}function $p(t,i,a){if((a&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,a|=o,i.lanes=a,$i(t,a)}}var Va={readContext:sn,use:ko,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt};Va.useEffectEvent=qt;var Yp={readContext:sn,use:ko,useCallback:function(t,i){return hn().memoizedState=[t,i===void 0?null:i],t},useContext:sn,useEffect:Tp,useImperativeHandle:function(t,i,a){a=a!=null?a.concat([t]):null,Ao(4194308,4,Rp.bind(null,i,t),a)},useLayoutEffect:function(t,i){return Ao(4194308,4,t,i)},useInsertionEffect:function(t,i){Ao(4,2,t,i)},useMemo:function(t,i){var a=hn();i=i===void 0?null:i;var o=t();if(ss){ze(!0);try{t()}finally{ze(!1)}}return a.memoizedState=[o,i],o},useReducer:function(t,i,a){var o=hn();if(a!==void 0){var h=a(i);if(ss){ze(!0);try{a(i)}finally{ze(!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=Hv.bind(null,Ye,t),[o.memoizedState,t]},useRef:function(t){var i=hn();return t={current:t},i.memoizedState=t},useState:function(t){t=Zc(t);var i=t.queue,a=Ip.bind(null,Ye,i);return i.dispatch=a,[t.memoizedState,a]},useDebugValue:tf,useDeferredValue:function(t,i){var a=hn();return nf(a,t,i)},useTransition:function(){var t=Zc(!1);return t=Up.bind(null,Ye,t.queue,!0,!1),hn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,a){var o=Ye,h=hn();if(nt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),At===null)throw Error(s(349));(We&127)!==0||hp(o,i,a)}h.memoizedState=a;var p={value:a,getSnapshot:i};return h.queue=p,Tp(mp.bind(null,o,p,t),[t]),o.flags|=2048,Us(9,{destroy:void 0},dp.bind(null,o,p,a,i),null),a},useId:function(){var t=hn(),i=At.identifierPrefix;if(nt){var a=xr,o=br;a=(o&~(1<<32-Se(o)-1)).toString(32)+a,i="_"+i+"R_"+a,a=_o++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Dv++,i="_"+i+"r_"+a.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:sf,useFormState:_p,useActionState:_p,useOptimistic:function(t){var i=hn();i.memoizedState=i.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=af.bind(null,Ye,!0,a),a.dispatch=i,[t,i]},useMemoCache:Xc,useCacheRefresh:function(){return hn().memoizedState=qv.bind(null,Ye)},useEffectEvent:function(t){var i=hn(),a={impl:t};return i.memoizedState=a,function(){if((ht&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},lf={readContext:sn,use:ko,useCallback:Dp,useContext:sn,useEffect:ef,useImperativeHandle:Mp,useInsertionEffect:Np,useLayoutEffect:Op,useMemo:Lp,useReducer:Co,useRef:Ap,useState:function(){return Co(qr)},useDebugValue:tf,useDeferredValue:function(t,i){var a=Ft();return zp(a,wt.memoizedState,t,i)},useTransition:function(){var t=Co(qr)[0],i=Ft().memoizedState;return[typeof t=="boolean"?t:Ya(t),i]},useSyncExternalStore:fp,useId:qp,useHostTransitionStatus:sf,useFormState:Ep,useActionState:Ep,useOptimistic:function(t,i){var a=Ft();return yp(a,wt,t,i)},useMemoCache:Xc,useCacheRefresh:Hp};lf.useEffectEvent=jp;var Gp={readContext:sn,use:ko,useCallback:Dp,useContext:sn,useEffect:ef,useImperativeHandle:Mp,useInsertionEffect:Np,useLayoutEffect:Op,useMemo:Lp,useReducer:Qc,useRef:Ap,useState:function(){return Qc(qr)},useDebugValue:tf,useDeferredValue:function(t,i){var a=Ft();return wt===null?nf(a,t,i):zp(a,wt.memoizedState,t,i)},useTransition:function(){var t=Qc(qr)[0],i=Ft().memoizedState;return[typeof t=="boolean"?t:Ya(t),i]},useSyncExternalStore:fp,useId:qp,useHostTransitionStatus:sf,useFormState:Cp,useActionState:Cp,useOptimistic:function(t,i){var a=Ft();return wt!==null?yp(a,wt,t,i):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Xc,useCacheRefresh:Hp};Gp.useEffectEvent=jp;function of(t,i,a,o){i=t.memoizedState,a=a(o,i),a=a==null?i:g({},i,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var uf={enqueueSetState:function(t,i,a){t=t._reactInternals;var o=zn(),h=pi(o);h.payload=i,a!=null&&(h.callback=a),i=gi(t,h,o),i!==null&&(En(i,t,o),Ha(i,t,o))},enqueueReplaceState:function(t,i,a){t=t._reactInternals;var o=zn(),h=pi(o);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=gi(t,h,o),i!==null&&(En(i,t,o),Ha(i,t,o))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var a=zn(),o=pi(a);o.tag=2,i!=null&&(o.callback=i),i=gi(t,o,a),i!==null&&(En(i,t,a),Ha(i,t,a))}};function Vp(t,i,a,o,h,p,v){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,p,v):i.prototype&&i.prototype.isPureReactComponent?!Ma(a,o)||!Ma(h,p):!0}function Jp(t,i,a,o){t=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,o),i.state!==t&&uf.enqueueReplaceState(i,i.state,null)}function as(t,i){var a=i;if("ref"in i){a={};for(var o in i)o!=="ref"&&(a[o]=i[o])}if(t=t.defaultProps){a===i&&(a=g({},a));for(var h in t)a[h]===void 0&&(a[h]=t[h])}return a}function Xp(t){ao(t)}function Kp(t){console.error(t)}function Qp(t){ao(t)}function No(t,i){try{var a=t.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function Zp(t,i,a){try{var o=t.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function cf(t,i,a){return a=pi(a),a.tag=3,a.payload={element:null},a.callback=function(){No(t,i)},a}function Wp(t){return t=pi(t),t.tag=3,t}function eg(t,i,a,o){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;t.payload=function(){return h(p)},t.callback=function(){Zp(i,a,o)}}var v=a.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(t.callback=function(){Zp(i,a,o),typeof h!="function"&&(Si===null?Si=new Set([this]):Si.add(this));var S=o.stack;this.componentDidCatch(o.value,{componentStack:S!==null?S:""})})}function Iv(t,i,a,o,h){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=a.alternate,i!==null&&js(i,a,h,!0),a=Rn.current,a!==null){switch(a.tag){case 31:case 13:return Zn===null?Io():a.alternate===null&&Ht===0&&(Ht=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===yo?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([o]):i.add(o),Lf(t,o,h)),!1;case 22:return a.flags|=65536,o===yo?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([o]):a.add(o)),Lf(t,o,h)),!1}throw Error(s(435,a.tag))}return Lf(t,o,h),Io(),!1}if(nt)return i=Rn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==Tc&&(t=Error(s(422),{cause:o}),za(Jn(t,a)))):(o!==Tc&&(i=Error(s(423),{cause:o}),za(Jn(i,a))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=Jn(o,a),h=cf(t.stateNode,o,h),Pc(t,h),Ht!==4&&(Ht=2)),!1;var p=Error(s(520),{cause:o});if(p=Jn(p,a),tl===null?tl=[p]:tl.push(p),Ht!==4&&(Ht=2),i===null)return!0;o=Jn(o,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,t=h&-h,a.lanes|=t,t=cf(a.stateNode,o,t),Pc(a,t),!1;case 1:if(i=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Si===null||!Si.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=Wp(h),eg(h,t,a,o),Pc(a,h),!1}a=a.return}while(a!==null);return!1}var ff=Error(s(461)),Jt=!1;function an(t,i,a,o){i.child=t===null?ip(i,null,a,o):is(i,t.child,a,o)}function tg(t,i,a,o,h){a=a.render;var p=i.ref;if("ref"in o){var v={};for(var S in o)S!=="ref"&&(v[S]=o[S])}else v=o;return es(i),o=Yc(t,i,a,v,p,h),S=Gc(),t!==null&&!Jt?(Vc(t,i,h),Hr(t,i,h)):(nt&&S&&Cc(i),i.flags|=1,an(t,i,o,h),i.child)}function ng(t,i,a,o,h){if(t===null){var p=a.type;return typeof p=="function"&&!_c(p)&&p.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=p,rg(t,i,p,o,h)):(t=co(a.type,null,o,i,i.mode,h),t.ref=i.ref,t.return=i,i.child=t)}if(p=t.child,!xf(t,h)){var v=p.memoizedProps;if(a=a.compare,a=a!==null?a:Ma,a(v,o)&&t.ref===i.ref)return Hr(t,i,h)}return i.flags|=1,t=Lr(p,o),t.ref=i.ref,t.return=i,i.child=t}function rg(t,i,a,o,h){if(t!==null){var p=t.memoizedProps;if(Ma(p,o)&&t.ref===i.ref)if(Jt=!1,i.pendingProps=o=p,xf(t,h))(t.flags&131072)!==0&&(Jt=!0);else return i.lanes=t.lanes,Hr(t,i,h)}return hf(t,i,a,o,h)}function ig(t,i,a,o){var h=o.children,p=t!==null?t.memoizedState:null;if(t===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((i.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,t!==null){for(o=i.child=t.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,i.child=null;return sg(t,i,p,a,o)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&po(i,p!==null?p.cachePool:null),p!==null?lp(i,p):Hc(),op(i);else return o=i.lanes=536870912,sg(t,i,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(po(i,p.cachePool),lp(i,p),bi(),i.memoizedState=null):(t!==null&&po(i,null),Hc(),bi());return an(t,i,h,a),i.child}function Ja(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function sg(t,i,a,o,h){var p=Lc();return p=p===null?null:{parent:Gt._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},t!==null&&po(i,null),Hc(),op(i),t!==null&&js(t,i,o,!0),i.childLanes=h,null}function Oo(t,i){return i=Mo({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function ag(t,i,a){return is(i,t.child,null,a),t=Oo(i,i.pendingProps),t.flags|=2,Mn(i),i.memoizedState=null,t}function Fv(t,i,a){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(nt){if(o.mode==="hidden")return t=Oo(i,o),i.lanes=536870912,Ja(null,t);if(Fc(i),(t=Ot)?(t=by(t,Qn),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ci!==null?{id:br,overflow:xr}:null,retryLane:536870912,hydrationErrors:null},a=Fm(t),a.return=i,i.child=a,rn=i,Ot=null)):t=null,t===null)throw hi(i);return i.lanes=536870912,null}return Oo(i,o)}var p=t.memoizedState;if(p!==null){var v=p.dehydrated;if(Fc(i),h)if(i.flags&256)i.flags&=-257,i=ag(t,i,a);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(s(558));else if(Jt||js(t,i,a,!1),h=(a&t.childLanes)!==0,Jt||h){if(o=At,o!==null&&(v=oi(o,a),v!==0&&v!==p.retryLane))throw p.retryLane=v,Ki(t,v),En(o,t,v),ff;Io(),i=ag(t,i,a)}else t=p.treeContext,Ot=Wn(v.nextSibling),rn=i,nt=!0,fi=null,Qn=!1,t!==null&&Gm(i,t),i=Oo(i,o),i.flags|=4096;return i}return t=Lr(t.child,{mode:o.mode,children:o.children}),t.ref=i.ref,i.child=t,t.return=i,t}function Ro(t,i){var a=i.ref;if(a===null)t!==null&&t.ref!==null&&(i.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(t===null||t.ref!==a)&&(i.flags|=4194816)}}function hf(t,i,a,o,h){return es(i),a=Yc(t,i,a,o,void 0,h),o=Gc(),t!==null&&!Jt?(Vc(t,i,h),Hr(t,i,h)):(nt&&o&&Cc(i),i.flags|=1,an(t,i,a,h),i.child)}function lg(t,i,a,o,h,p){return es(i),i.updateQueue=null,a=cp(i,o,a,h),up(t),o=Gc(),t!==null&&!Jt?(Vc(t,i,p),Hr(t,i,p)):(nt&&o&&Cc(i),i.flags|=1,an(t,i,a,p),i.child)}function og(t,i,a,o,h){if(es(i),i.stateNode===null){var p=ks,v=a.contextType;typeof v=="object"&&v!==null&&(p=sn(v)),p=new a(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=uf,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},Uc(i),v=a.contextType,p.context=typeof v=="object"&&v!==null?sn(v):ks,p.state=i.memoizedState,v=a.getDerivedStateFromProps,typeof v=="function"&&(of(i,a,v,o),p.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(v=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),v!==p.state&&uf.enqueueReplaceState(p,p.state,null),Fa(i,o,p,h),Ia(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(t===null){p=i.stateNode;var S=i.memoizedProps,q=as(a,S);p.props=q;var re=p.context,ce=a.contextType;v=ks,typeof ce=="object"&&ce!==null&&(v=sn(ce));var pe=a.getDerivedStateFromProps;ce=typeof pe=="function"||typeof p.getSnapshotBeforeUpdate=="function",S=i.pendingProps!==S,ce||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(S||re!==v)&&Jp(i,p,o,v),mi=!1;var ie=i.memoizedState;p.state=ie,Fa(i,o,p,h),Ia(),re=i.memoizedState,S||ie!==re||mi?(typeof pe=="function"&&(of(i,a,pe,o),re=i.memoizedState),(q=mi||Vp(i,a,q,o,ie,re,v))?(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=re),p.props=o,p.state=re,p.context=v,o=q):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,Bc(t,i),v=i.memoizedProps,ce=as(a,v),p.props=ce,pe=i.pendingProps,ie=p.context,re=a.contextType,q=ks,typeof re=="object"&&re!==null&&(q=sn(re)),S=a.getDerivedStateFromProps,(re=typeof S=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==pe||ie!==q)&&Jp(i,p,o,q),mi=!1,ie=i.memoizedState,p.state=ie,Fa(i,o,p,h),Ia();var le=i.memoizedState;v!==pe||ie!==le||mi||t!==null&&t.dependencies!==null&&ho(t.dependencies)?(typeof S=="function"&&(of(i,a,S,o),le=i.memoizedState),(ce=mi||Vp(i,a,ce,o,ie,le,q)||t!==null&&t.dependencies!==null&&ho(t.dependencies))?(re||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,le,q),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,le,q)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||v===t.memoizedProps&&ie===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===t.memoizedProps&&ie===t.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=le),p.props=o,p.state=le,p.context=q,o=ce):(typeof p.componentDidUpdate!="function"||v===t.memoizedProps&&ie===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===t.memoizedProps&&ie===t.memoizedState||(i.flags|=1024),o=!1)}return p=o,Ro(t,i),o=(i.flags&128)!==0,p||o?(p=i.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,t!==null&&o?(i.child=is(i,t.child,null,h),i.child=is(i,null,a,h)):an(t,i,a,h),i.memoizedState=p.state,t=i.child):t=Hr(t,i,h),t}function ug(t,i,a,o){return Zi(),i.flags|=256,an(t,i,a,o),i.child}var df={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mf(t){return{baseLanes:t,cachePool:Zm()}}function pf(t,i,a){return t=t!==null?t.childLanes&~a:0,i&&(t|=Ln),t}function cg(t,i,a){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,v;if((v=p)||(v=t!==null&&t.memoizedState===null?!1:(It.current&2)!==0),v&&(h=!0,i.flags&=-129),v=(i.flags&32)!==0,i.flags&=-33,t===null){if(nt){if(h?yi(i):bi(),(t=Ot)?(t=by(t,Qn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ci!==null?{id:br,overflow:xr}:null,retryLane:536870912,hydrationErrors:null},a=Fm(t),a.return=i,i.child=a,rn=i,Ot=null)):t=null,t===null)throw hi(i);return Qf(t)?i.lanes=32:i.lanes=536870912,null}var S=o.children;return o=o.fallback,h?(bi(),h=i.mode,S=Mo({mode:"hidden",children:S},h),o=Qi(o,h,a,null),S.return=i,o.return=i,S.sibling=o,i.child=S,o=i.child,o.memoizedState=mf(a),o.childLanes=pf(t,v,a),i.memoizedState=df,Ja(null,o)):(yi(i),gf(i,S))}var q=t.memoizedState;if(q!==null&&(S=q.dehydrated,S!==null)){if(p)i.flags&256?(yi(i),i.flags&=-257,i=yf(t,i,a)):i.memoizedState!==null?(bi(),i.child=t.child,i.flags|=128,i=null):(bi(),S=o.fallback,h=i.mode,o=Mo({mode:"visible",children:o.children},h),S=Qi(S,h,a,null),S.flags|=2,o.return=i,S.return=i,o.sibling=S,i.child=o,is(i,t.child,null,a),o=i.child,o.memoizedState=mf(a),o.childLanes=pf(t,v,a),i.memoizedState=df,i=Ja(null,o));else if(yi(i),Qf(S)){if(v=S.nextSibling&&S.nextSibling.dataset,v)var re=v.dgst;v=re,o=Error(s(419)),o.stack="",o.digest=v,za({value:o,source:null,stack:null}),i=yf(t,i,a)}else if(Jt||js(t,i,a,!1),v=(a&t.childLanes)!==0,Jt||v){if(v=At,v!==null&&(o=oi(v,a),o!==0&&o!==q.retryLane))throw q.retryLane=o,Ki(t,o),En(v,t,o),ff;Kf(S)||Io(),i=yf(t,i,a)}else Kf(S)?(i.flags|=192,i.child=t.child,i=null):(t=q.treeContext,Ot=Wn(S.nextSibling),rn=i,nt=!0,fi=null,Qn=!1,t!==null&&Gm(i,t),i=gf(i,o.children),i.flags|=4096);return i}return h?(bi(),S=o.fallback,h=i.mode,q=t.child,re=q.sibling,o=Lr(q,{mode:"hidden",children:o.children}),o.subtreeFlags=q.subtreeFlags&65011712,re!==null?S=Lr(re,S):(S=Qi(S,h,a,null),S.flags|=2),S.return=i,o.return=i,o.sibling=S,i.child=o,Ja(null,o),o=i.child,S=t.child.memoizedState,S===null?S=mf(a):(h=S.cachePool,h!==null?(q=Gt._currentValue,h=h.parent!==q?{parent:q,pool:q}:h):h=Zm(),S={baseLanes:S.baseLanes|a,cachePool:h}),o.memoizedState=S,o.childLanes=pf(t,v,a),i.memoizedState=df,Ja(t.child,o)):(yi(i),a=t.child,t=a.sibling,a=Lr(a,{mode:"visible",children:o.children}),a.return=i,a.sibling=null,t!==null&&(v=i.deletions,v===null?(i.deletions=[t],i.flags|=16):v.push(t)),i.child=a,i.memoizedState=null,a)}function gf(t,i){return i=Mo({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function Mo(t,i){return t=On(22,t,null,i),t.lanes=0,t}function yf(t,i,a){return is(i,t.child,null,a),t=gf(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function fg(t,i,a){t.lanes|=i;var o=t.alternate;o!==null&&(o.lanes|=i),Oc(t.return,i,a)}function bf(t,i,a,o,h,p){var v=t.memoizedState;v===null?t.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:h,treeForkCount:p}:(v.isBackwards=i,v.rendering=null,v.renderingStartTime=0,v.last=o,v.tail=a,v.tailMode=h,v.treeForkCount=p)}function hg(t,i,a){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var v=It.current,S=(v&2)!==0;if(S?(v=v&1|2,i.flags|=128):v&=1,A(It,v),an(t,i,o,a),o=nt?La:0,!S&&t!==null&&(t.flags&128)!==0)e:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&fg(t,a,i);else if(t.tag===19)fg(t,a,i);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break e;for(;t.sibling===null;){if(t.return===null||t.return===i)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(a=i.child,h=null;a!==null;)t=a.alternate,t!==null&&wo(t)===null&&(h=a),a=a.sibling;a=h,a===null?(h=i.child,i.child=null):(h=a.sibling,a.sibling=null),bf(i,!1,h,a,p,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=i.child,i.child=null;h!==null;){if(t=h.alternate,t!==null&&wo(t)===null){i.child=h;break}t=h.sibling,h.sibling=a,a=h,h=t}bf(i,!0,a,null,p,o);break;case"together":bf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Hr(t,i,a){if(t!==null&&(i.dependencies=t.dependencies),wi|=i.lanes,(a&i.childLanes)===0)if(t!==null){if(js(t,i,a,!1),(a&i.childLanes)===0)return null}else return null;if(t!==null&&i.child!==t.child)throw Error(s(153));if(i.child!==null){for(t=i.child,a=Lr(t,t.pendingProps),i.child=a,a.return=i;t.sibling!==null;)t=t.sibling,a=a.sibling=Lr(t,t.pendingProps),a.return=i;a.sibling=null}return i.child}function xf(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&ho(t)))}function $v(t,i,a){switch(i.tag){case 3:He(i,i.stateNode.containerInfo),di(i,Gt,t.memoizedState.cache),Zi();break;case 27:case 5:De(i);break;case 4:He(i,i.stateNode.containerInfo);break;case 10:di(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Fc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(yi(i),i.flags|=128,null):(a&i.child.childLanes)!==0?cg(t,i,a):(yi(i),t=Hr(t,i,a),t!==null?t.sibling:null);yi(i);break;case 19:var h=(t.flags&128)!==0;if(o=(a&i.childLanes)!==0,o||(js(t,i,a,!1),o=(a&i.childLanes)!==0),h){if(o)return hg(t,i,a);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),A(It,It.current),o)break;return null;case 22:return i.lanes=0,ig(t,i,a,i.pendingProps);case 24:di(i,Gt,t.memoizedState.cache)}return Hr(t,i,a)}function dg(t,i,a){if(t!==null)if(t.memoizedProps!==i.pendingProps)Jt=!0;else{if(!xf(t,a)&&(i.flags&128)===0)return Jt=!1,$v(t,i,a);Jt=(t.flags&131072)!==0}else Jt=!1,nt&&(i.flags&1048576)!==0&&Ym(i,La,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(t=ns(i.elementType),i.type=t,typeof t=="function")_c(t)?(o=as(t,o),i.tag=1,i=og(null,i,t,o,a)):(i.tag=0,i=hf(null,i,t,o,a));else{if(t!=null){var h=t.$$typeof;if(h===K){i.tag=11,i=tg(null,i,t,o,a);break e}else if(h===Y){i.tag=14,i=ng(null,i,t,o,a);break e}}throw i=ae(t)||t,Error(s(306,i,""))}}return i;case 0:return hf(t,i,i.type,i.pendingProps,a);case 1:return o=i.type,h=as(o,i.pendingProps),og(t,i,o,h,a);case 3:e:{if(He(i,i.stateNode.containerInfo),t===null)throw Error(s(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,Bc(t,i),Fa(i,o,null,a);var v=i.memoizedState;if(o=v.cache,di(i,Gt,o),o!==p.cache&&Rc(i,[Gt],a,!0),Ia(),o=v.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:v.cache},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){i=ug(t,i,o,a);break e}else if(o!==h){h=Jn(Error(s(424)),i),za(h),i=ug(t,i,o,a);break e}else{switch(t=i.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Ot=Wn(t.firstChild),rn=i,nt=!0,fi=null,Qn=!0,a=ip(i,null,o,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Zi(),o===h){i=Hr(t,i,a);break e}an(t,i,o,a)}i=i.child}return i;case 26:return Ro(t,i),t===null?(a=Ey(i.type,null,i.pendingProps,null))?i.memoizedState=a:nt||(a=i.type,t=i.pendingProps,o=Xo(Te.current).createElement(a),o[Ct]=i,o[Pt]=t,ln(o,a,t),$(o),i.stateNode=o):i.memoizedState=Ey(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return De(i),t===null&&nt&&(o=i.stateNode=wy(i.type,i.pendingProps,Te.current),rn=i,Qn=!0,h=Ot,Ci(i.type)?(Zf=h,Ot=Wn(o.firstChild)):Ot=h),an(t,i,i.pendingProps.children,a),Ro(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&&nt&&((h=o=Ot)&&(o=vw(o,i.type,i.pendingProps,Qn),o!==null?(i.stateNode=o,rn=i,Ot=Wn(o.firstChild),Qn=!1,h=!0):h=!1),h||hi(i)),De(i),h=i.type,p=i.pendingProps,v=t!==null?t.memoizedProps:null,o=p.children,Vf(h,p)?o=null:v!==null&&Vf(h,v)&&(i.flags|=32),i.memoizedState!==null&&(h=Yc(t,i,Lv,null,null,a),ul._currentValue=h),Ro(t,i),an(t,i,o,a),i.child;case 6:return t===null&&nt&&((t=a=Ot)&&(a=ww(a,i.pendingProps,Qn),a!==null?(i.stateNode=a,rn=i,Ot=null,t=!0):t=!1),t||hi(i)),null;case 13:return cg(t,i,a);case 4:return He(i,i.stateNode.containerInfo),o=i.pendingProps,t===null?i.child=is(i,null,o,a):an(t,i,o,a),i.child;case 11:return tg(t,i,i.type,i.pendingProps,a);case 7:return an(t,i,i.pendingProps,a),i.child;case 8:return an(t,i,i.pendingProps.children,a),i.child;case 12:return an(t,i,i.pendingProps.children,a),i.child;case 10:return o=i.pendingProps,di(i,i.type,o.value),an(t,i,o.children,a),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,es(i),h=sn(h),o=o(h),i.flags|=1,an(t,i,o,a),i.child;case 14:return ng(t,i,i.type,i.pendingProps,a);case 15:return rg(t,i,i.type,i.pendingProps,a);case 19:return hg(t,i,a);case 31:return Fv(t,i,a);case 22:return ig(t,i,a,i.pendingProps);case 24:return es(i),o=sn(Gt),t===null?(h=Lc(),h===null&&(h=At,p=Mc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),i.memoizedState={parent:o,cache:h},Uc(i),di(i,Gt,h)):((t.lanes&a)!==0&&(Bc(t,i),Fa(i,null,null,a),Ia()),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),di(i,Gt,o)):(o=p.cache,di(i,Gt,o),o!==h.cache&&Rc(i,[Gt],a,!0))),an(t,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function Ir(t){t.flags|=4}function vf(t,i,a,o,h){if((i=(t.mode&32)!==0)&&(i=!1),i){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(qg())t.flags|=8192;else throw rs=yo,zc}else t.flags&=-16777217}function mg(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!jy(i))if(qg())t.flags|=8192;else throw rs=yo,zc}function Do(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?ps():536870912,t.lanes|=i,Hs|=i)}function Xa(t,i){if(!nt)switch(t.tailMode){case"hidden":i=t.tail;for(var a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?i||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function Rt(t){var i=t.alternate!==null&&t.alternate.child===t.child,a=0,o=0;if(i)for(var h=t.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=a,i}function Yv(t,i,a){var o=i.pendingProps;switch(Ac(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(i),null;case 1:return Rt(i),null;case 3:return a=i.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Br(Gt),be(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Ts(i)?Ir(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,jc())),Rt(i),null;case 26:var h=i.type,p=i.memoizedState;return t===null?(Ir(i),p!==null?(Rt(i),mg(i,p)):(Rt(i),vf(i,h,null,o,a))):p?p!==t.memoizedState?(Ir(i),Rt(i),mg(i,p)):(Rt(i),i.flags&=-16777217):(t=t.memoizedProps,t!==o&&Ir(i),Rt(i),vf(i,h,t,o,a)),null;case 27:if(Ze(i),a=Te.current,h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Ir(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Rt(i),null}t=ve.current,Ts(i)?Vm(i):(t=wy(h,o,a),i.stateNode=t,Ir(i))}return Rt(i),null;case 5:if(Ze(i),h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Ir(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Rt(i),null}if(p=ve.current,Ts(i))Vm(i);else{var v=Xo(Te.current);switch(p){case 1:p=v.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=v.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=v.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=v.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=v.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?v.createElement("select",{is:o.is}):v.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?v.createElement(h,{is:o.is}):v.createElement(h)}}p[Ct]=i,p[Pt]=o;e:for(v=i.child;v!==null;){if(v.tag===5||v.tag===6)p.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===i)break e;for(;v.sibling===null;){if(v.return===null||v.return===i)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}i.stateNode=p;e:switch(ln(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&&Ir(i)}}return Rt(i),vf(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,a),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&Ir(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(s(166));if(t=Te.current,Ts(i)){if(t=i.stateNode,a=i.memoizedProps,o=null,h=rn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[Ct]=i,t=!!(t.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||cy(t.nodeValue,a)),t||hi(i,!0)}else t=Xo(t).createTextNode(o),t[Ct]=i,i.stateNode=t}return Rt(i),null;case 31:if(a=i.memoizedState,t===null||t.memoizedState!==null){if(o=Ts(i),a!==null){if(t===null){if(!o)throw Error(s(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Ct]=i}else Zi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Rt(i),t=!1}else a=jc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return i.flags&256?(Mn(i),i):(Mn(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Rt(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Ts(i),o!==null&&o.dehydrated!==null){if(t===null){if(!h)throw Error(s(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(s(317));h[Ct]=i}else Zi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Rt(i),h=!1}else h=jc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Mn(i),i):(Mn(i),null)}return Mn(i),(i.flags&128)!==0?(i.lanes=a,i):(a=o!==null,t=t!==null&&t.memoizedState!==null,a&&(o=i.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),a!==t&&a&&(i.child.flags|=8192),Do(i,i.updateQueue),Rt(i),null);case 4:return be(),t===null&&If(i.stateNode.containerInfo),Rt(i),null;case 10:return Br(i.type),Rt(i),null;case 19:if(ee(It),o=i.memoizedState,o===null)return Rt(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Xa(o,!1);else{if(Ht!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(p=wo(t),p!==null){for(i.flags|=128,Xa(o,!1),t=p.updateQueue,i.updateQueue=t,Do(i,t),i.subtreeFlags=0,t=a,a=i.child;a!==null;)Im(a,t),a=a.sibling;return A(It,It.current&1|2),nt&&zr(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&&vt()>Po&&(i.flags|=128,h=!0,Xa(o,!1),i.lanes=4194304)}else{if(!h)if(t=wo(p),t!==null){if(i.flags|=128,h=!0,t=t.updateQueue,i.updateQueue=t,Do(i,t),Xa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!nt)return Rt(i),null}else 2*vt()-o.renderingStartTime>Po&&a!==536870912&&(i.flags|=128,h=!0,Xa(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=vt(),t.sibling=null,a=It.current,A(It,h?a&1|2:a&1),nt&&zr(i,o.treeForkCount),t):(Rt(i),null);case 22:case 23:return Mn(i),Ic(),o=i.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(a&536870912)!==0&&(i.flags&128)===0&&(Rt(i),i.subtreeFlags&6&&(i.flags|=8192)):Rt(i),a=i.updateQueue,a!==null&&Do(i,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==a&&(i.flags|=2048),t!==null&&ee(ts),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),Br(Gt),Rt(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function Gv(t,i){switch(Ac(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Br(Gt),be(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return Ze(i),null;case 31:if(i.memoizedState!==null){if(Mn(i),i.alternate===null)throw Error(s(340));Zi()}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(s(340));Zi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return ee(It),null;case 4:return be(),null;case 10:return Br(i.type),null;case 22:case 23:return Mn(i),Ic(),t!==null&&ee(ts),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return Br(Gt),null;case 25:return null;default:return null}}function pg(t,i){switch(Ac(i),i.tag){case 3:Br(Gt),be();break;case 26:case 27:case 5:Ze(i);break;case 4:be();break;case 31:i.memoizedState!==null&&Mn(i);break;case 13:Mn(i);break;case 19:ee(It);break;case 10:Br(i.type);break;case 22:case 23:Mn(i),Ic(),t!==null&&ee(ts);break;case 24:Br(Gt)}}function Ka(t,i){try{var a=i.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var h=o.next;a=h;do{if((a.tag&t)===t){o=void 0;var p=a.create,v=a.inst;o=p(),v.destroy=o}a=a.next}while(a!==h)}}catch(S){xt(i,i.return,S)}}function xi(t,i,a){try{var o=i.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&t)===t){var v=o.inst,S=v.destroy;if(S!==void 0){v.destroy=void 0,h=i;var q=a,re=S;try{re()}catch(ce){xt(h,q,ce)}}}o=o.next}while(o!==p)}}catch(ce){xt(i,i.return,ce)}}function gg(t){var i=t.updateQueue;if(i!==null){var a=t.stateNode;try{ap(i,a)}catch(o){xt(t,t.return,o)}}}function yg(t,i,a){a.props=as(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(o){xt(t,i,o)}}function Qa(t,i){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof a=="function"?t.refCleanup=a(o):a.current=o}}catch(h){xt(t,i,h)}}function vr(t,i){var a=t.ref,o=t.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){xt(t,i,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){xt(t,i,h)}else a.current=null}function bg(t){var i=t.type,a=t.memoizedProps,o=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(h){xt(t,t.return,h)}}function wf(t,i,a){try{var o=t.stateNode;mw(o,t.type,a,i),o[Pt]=i}catch(h){xt(t,t.return,h)}}function xg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ci(t.type)||t.tag===4}function Sf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||xg(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ci(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function _f(t,i,a){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,i):(i=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,i.appendChild(t),a=a._reactRootContainer,a!=null||i.onclick!==null||(i.onclick=Mr));else if(o!==4&&(o===27&&Ci(t.type)&&(a=t.stateNode,i=null),t=t.child,t!==null))for(_f(t,i,a),t=t.sibling;t!==null;)_f(t,i,a),t=t.sibling}function Lo(t,i,a){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?a.insertBefore(t,i):a.appendChild(t);else if(o!==4&&(o===27&&Ci(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Lo(t,i,a),t=t.sibling;t!==null;)Lo(t,i,a),t=t.sibling}function vg(t){var i=t.stateNode,a=t.memoizedProps;try{for(var o=t.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);ln(i,o,a),i[Ct]=t,i[Pt]=a}catch(p){xt(t,t.return,p)}}var Fr=!1,Xt=!1,Ef=!1,wg=typeof WeakSet=="function"?WeakSet:Set,Wt=null;function Vv(t,i){if(t=t.containerInfo,Yf=nu,t=Mm(t),gc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var v=0,S=-1,q=-1,re=0,ce=0,pe=t,ie=null;t:for(;;){for(var le;pe!==a||h!==0&&pe.nodeType!==3||(S=v+h),pe!==p||o!==0&&pe.nodeType!==3||(q=v+o),pe.nodeType===3&&(v+=pe.nodeValue.length),(le=pe.firstChild)!==null;)ie=pe,pe=le;for(;;){if(pe===t)break t;if(ie===a&&++re===h&&(S=v),ie===p&&++ce===o&&(q=v),(le=pe.nextSibling)!==null)break;pe=ie,ie=pe.parentNode}pe=le}a=S===-1||q===-1?null:{start:S,end:q}}else a=null}a=a||{start:0,end:0}}else a=null;for(Gf={focusedElem:t,selectionRange:a},nu=!1,Wt=i;Wt!==null;)if(i=Wt,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,Wt=t;else for(;Wt!==null;){switch(i=Wt,p=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)h=t[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,a=i,h=p.memoizedProps,p=p.memoizedState,o=a.stateNode;try{var Oe=as(a.type,h);t=o.getSnapshotBeforeUpdate(Oe,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(qe){xt(a,a.return,qe)}}break;case 3:if((t&1024)!==0){if(t=i.stateNode.containerInfo,a=t.nodeType,a===9)Xf(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Xf(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=i.sibling,t!==null){t.return=i.return,Wt=t;break}Wt=i.return}}function Sg(t,i,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:Yr(t,a),o&4&&Ka(5,a);break;case 1:if(Yr(t,a),o&4)if(t=a.stateNode,i===null)try{t.componentDidMount()}catch(v){xt(a,a.return,v)}else{var h=as(a.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(h,i,t.__reactInternalSnapshotBeforeUpdate)}catch(v){xt(a,a.return,v)}}o&64&&gg(a),o&512&&Qa(a,a.return);break;case 3:if(Yr(t,a),o&64&&(t=a.updateQueue,t!==null)){if(i=null,a.child!==null)switch(a.child.tag){case 27:case 5:i=a.child.stateNode;break;case 1:i=a.child.stateNode}try{ap(t,i)}catch(v){xt(a,a.return,v)}}break;case 27:i===null&&o&4&&vg(a);case 26:case 5:Yr(t,a),i===null&&o&4&&bg(a),o&512&&Qa(a,a.return);break;case 12:Yr(t,a);break;case 31:Yr(t,a),o&4&&kg(t,a);break;case 13:Yr(t,a),o&4&&Cg(t,a),o&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=nw.bind(null,a),Sw(t,a))));break;case 22:if(o=a.memoizedState!==null||Fr,!o){i=i!==null&&i.memoizedState!==null||Xt,h=Fr;var p=Xt;Fr=o,(Xt=i)&&!p?Gr(t,a,(a.subtreeFlags&8772)!==0):Yr(t,a),Fr=h,Xt=p}break;case 30:break;default:Yr(t,a)}}function _g(t){var i=t.alternate;i!==null&&(t.alternate=null,_g(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&gs(i)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Dt=null,vn=!1;function $r(t,i,a){for(a=a.child;a!==null;)Eg(t,i,a),a=a.sibling}function Eg(t,i,a){if(ge&&typeof ge.onCommitFiberUnmount=="function")try{ge.onCommitFiberUnmount(Yt,a)}catch{}switch(a.tag){case 26:Xt||vr(a,i),$r(t,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Xt||vr(a,i);var o=Dt,h=vn;Ci(a.type)&&(Dt=a.stateNode,vn=!1),$r(t,i,a),al(a.stateNode),Dt=o,vn=h;break;case 5:Xt||vr(a,i);case 6:if(o=Dt,h=vn,Dt=null,$r(t,i,a),Dt=o,vn=h,Dt!==null)if(vn)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(a.stateNode)}catch(p){xt(a,i,p)}else try{Dt.removeChild(a.stateNode)}catch(p){xt(a,i,p)}break;case 18:Dt!==null&&(vn?(t=Dt,gy(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),Xs(t)):gy(Dt,a.stateNode));break;case 4:o=Dt,h=vn,Dt=a.stateNode.containerInfo,vn=!0,$r(t,i,a),Dt=o,vn=h;break;case 0:case 11:case 14:case 15:xi(2,a,i),Xt||xi(4,a,i),$r(t,i,a);break;case 1:Xt||(vr(a,i),o=a.stateNode,typeof o.componentWillUnmount=="function"&&yg(a,i,o)),$r(t,i,a);break;case 21:$r(t,i,a);break;case 22:Xt=(o=Xt)||a.memoizedState!==null,$r(t,i,a),Xt=o;break;default:$r(t,i,a)}}function kg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Xs(t)}catch(a){xt(i,i.return,a)}}}function Cg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Xs(t)}catch(a){xt(i,i.return,a)}}function Jv(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new wg),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new wg),i;default:throw Error(s(435,t.tag))}}function zo(t,i){var a=Jv(t);i.forEach(function(o){if(!a.has(o)){a.add(o);var h=rw.bind(null,t,o);o.then(h,h)}})}function wn(t,i){var a=i.deletions;if(a!==null)for(var o=0;o<a.length;o++){var h=a[o],p=t,v=i,S=v;e:for(;S!==null;){switch(S.tag){case 27:if(Ci(S.type)){Dt=S.stateNode,vn=!1;break e}break;case 5:Dt=S.stateNode,vn=!1;break e;case 3:case 4:Dt=S.stateNode.containerInfo,vn=!0;break e}S=S.return}if(Dt===null)throw Error(s(160));Eg(p,v,h),Dt=null,vn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Ag(i,t),i=i.sibling}var ur=null;function Ag(t,i){var a=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:wn(i,t),Sn(t),o&4&&(xi(3,t,t.return),Ka(3,t),xi(5,t,t.return));break;case 1:wn(i,t),Sn(t),o&512&&(Xt||a===null||vr(a,a.return)),o&64&&Fr&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var h=ur;if(wn(i,t),Sn(t),o&512&&(Xt||a===null||vr(a,a.return)),o&4){var p=a!==null?a.memoizedState:null;if(o=t.memoizedState,a===null)if(o===null)if(t.stateNode===null){e:{o=t.type,a=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[Qt]||p[Ct]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),ln(p,o,a),p[Ct]=t,$(p),o=p;break e;case"link":var v=Ay("link","href",h).get(o+(a.href||""));if(v){for(var S=0;S<v.length;S++)if(p=v[S],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){v.splice(S,1);break t}}p=h.createElement(o),ln(p,o,a),h.head.appendChild(p);break;case"meta":if(v=Ay("meta","content",h).get(o+(a.content||""))){for(S=0;S<v.length;S++)if(p=v[S],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){v.splice(S,1);break t}}p=h.createElement(o),ln(p,o,a),h.head.appendChild(p);break;default:throw Error(s(468,o))}p[Ct]=t,$(p),o=p}t.stateNode=o}else Ty(h,t.type,t.stateNode);else t.stateNode=Cy(h,o,t.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?Ty(h,t.type,t.stateNode):Cy(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&wf(t,t.memoizedProps,a.memoizedProps)}break;case 27:wn(i,t),Sn(t),o&512&&(Xt||a===null||vr(a,a.return)),a!==null&&o&4&&wf(t,t.memoizedProps,a.memoizedProps);break;case 5:if(wn(i,t),Sn(t),o&512&&(Xt||a===null||vr(a,a.return)),t.flags&32){h=t.stateNode;try{bs(h,"")}catch(Oe){xt(t,t.return,Oe)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,wf(t,h,a!==null?a.memoizedProps:h)),o&1024&&(Ef=!0);break;case 6:if(wn(i,t),Sn(t),o&4){if(t.stateNode===null)throw Error(s(162));o=t.memoizedProps,a=t.stateNode;try{a.nodeValue=o}catch(Oe){xt(t,t.return,Oe)}}break;case 3:if(Zo=null,h=ur,ur=Ko(i.containerInfo),wn(i,t),ur=h,Sn(t),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Xs(i.containerInfo)}catch(Oe){xt(t,t.return,Oe)}Ef&&(Ef=!1,Tg(t));break;case 4:o=ur,ur=Ko(t.stateNode.containerInfo),wn(i,t),Sn(t),ur=o;break;case 12:wn(i,t),Sn(t);break;case 31:wn(i,t),Sn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,zo(t,o)));break;case 13:wn(i,t),Sn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Bo=vt()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,zo(t,o)));break;case 22:h=t.memoizedState!==null;var q=a!==null&&a.memoizedState!==null,re=Fr,ce=Xt;if(Fr=re||h,Xt=ce||q,wn(i,t),Xt=ce,Fr=re,Sn(t),o&8192)e:for(i=t.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||q||Fr||Xt||ls(t)),a=null,i=t;;){if(i.tag===5||i.tag===26){if(a===null){q=a=i;try{if(p=q.stateNode,h)v=p.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{S=q.stateNode;var pe=q.memoizedProps.style,ie=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;S.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(Oe){xt(q,q.return,Oe)}}}else if(i.tag===6){if(a===null){q=i;try{q.stateNode.nodeValue=h?"":q.memoizedProps}catch(Oe){xt(q,q.return,Oe)}}}else if(i.tag===18){if(a===null){q=i;try{var le=q.stateNode;h?yy(le,!0):yy(q.stateNode,!1)}catch(Oe){xt(q,q.return,Oe)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===t)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;a===i&&(a=null),i=i.return}a===i&&(a=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=t.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,zo(t,a))));break;case 19:wn(i,t),Sn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,zo(t,o)));break;case 30:break;case 21:break;default:wn(i,t),Sn(t)}}function Sn(t){var i=t.flags;if(i&2){try{for(var a,o=t.return;o!==null;){if(xg(o)){a=o;break}o=o.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var h=a.stateNode,p=Sf(t);Lo(t,p,h);break;case 5:var v=a.stateNode;a.flags&32&&(bs(v,""),a.flags&=-33);var S=Sf(t);Lo(t,S,v);break;case 3:case 4:var q=a.stateNode.containerInfo,re=Sf(t);_f(t,re,q);break;default:throw Error(s(161))}}catch(ce){xt(t,t.return,ce)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function Tg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;Tg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),t=t.sibling}}function Yr(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Sg(t,i.alternate,i),i=i.sibling}function ls(t){for(t=t.child;t!==null;){var i=t;switch(i.tag){case 0:case 11:case 14:case 15:xi(4,i,i.return),ls(i);break;case 1:vr(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&yg(i,i.return,a),ls(i);break;case 27:al(i.stateNode);case 26:case 5:vr(i,i.return),ls(i);break;case 22:i.memoizedState===null&&ls(i);break;case 30:ls(i);break;default:ls(i)}t=t.sibling}}function Gr(t,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,h=t,p=i,v=p.flags;switch(p.tag){case 0:case 11:case 15:Gr(h,p,a),Ka(4,p);break;case 1:if(Gr(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(re){xt(o,o.return,re)}if(o=p,h=o.updateQueue,h!==null){var S=o.stateNode;try{var q=h.shared.hiddenCallbacks;if(q!==null)for(h.shared.hiddenCallbacks=null,h=0;h<q.length;h++)sp(q[h],S)}catch(re){xt(o,o.return,re)}}a&&v&64&&gg(p),Qa(p,p.return);break;case 27:vg(p);case 26:case 5:Gr(h,p,a),a&&o===null&&v&4&&bg(p),Qa(p,p.return);break;case 12:Gr(h,p,a);break;case 31:Gr(h,p,a),a&&v&4&&kg(h,p);break;case 13:Gr(h,p,a),a&&v&4&&Cg(h,p);break;case 22:p.memoizedState===null&&Gr(h,p,a),Qa(p,p.return);break;case 30:break;default:Gr(h,p,a)}i=i.sibling}}function kf(t,i){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(t=i.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Ua(a))}function Cf(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Ua(t))}function cr(t,i,a,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)jg(t,i,a,o),i=i.sibling}function jg(t,i,a,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:cr(t,i,a,o),h&2048&&Ka(9,i);break;case 1:cr(t,i,a,o);break;case 3:cr(t,i,a,o),h&2048&&(t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Ua(t)));break;case 12:if(h&2048){cr(t,i,a,o),t=i.stateNode;try{var p=i.memoizedProps,v=p.id,S=p.onPostCommit;typeof S=="function"&&S(v,i.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(q){xt(i,i.return,q)}}else cr(t,i,a,o);break;case 31:cr(t,i,a,o);break;case 13:cr(t,i,a,o);break;case 23:break;case 22:p=i.stateNode,v=i.alternate,i.memoizedState!==null?p._visibility&2?cr(t,i,a,o):Za(t,i):p._visibility&2?cr(t,i,a,o):(p._visibility|=2,Bs(t,i,a,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&kf(v,i);break;case 24:cr(t,i,a,o),h&2048&&Cf(i.alternate,i);break;default:cr(t,i,a,o)}}function Bs(t,i,a,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=t,v=i,S=a,q=o,re=v.flags;switch(v.tag){case 0:case 11:case 15:Bs(p,v,S,q,h),Ka(8,v);break;case 23:break;case 22:var ce=v.stateNode;v.memoizedState!==null?ce._visibility&2?Bs(p,v,S,q,h):Za(p,v):(ce._visibility|=2,Bs(p,v,S,q,h)),h&&re&2048&&kf(v.alternate,v);break;case 24:Bs(p,v,S,q,h),h&&re&2048&&Cf(v.alternate,v);break;default:Bs(p,v,S,q,h)}i=i.sibling}}function Za(t,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=t,o=i,h=o.flags;switch(o.tag){case 22:Za(a,o),h&2048&&kf(o.alternate,o);break;case 24:Za(a,o),h&2048&&Cf(o.alternate,o);break;default:Za(a,o)}i=i.sibling}}var Wa=8192;function Ps(t,i,a){if(t.subtreeFlags&Wa)for(t=t.child;t!==null;)Ng(t,i,a),t=t.sibling}function Ng(t,i,a){switch(t.tag){case 26:Ps(t,i,a),t.flags&Wa&&t.memoizedState!==null&&Dw(a,ur,t.memoizedState,t.memoizedProps);break;case 5:Ps(t,i,a);break;case 3:case 4:var o=ur;ur=Ko(t.stateNode.containerInfo),Ps(t,i,a),ur=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=Wa,Wa=16777216,Ps(t,i,a),Wa=o):Ps(t,i,a));break;default:Ps(t,i,a)}}function Og(t){var i=t.alternate;if(i!==null&&(t=i.child,t!==null)){i.child=null;do i=t.sibling,t.sibling=null,t=i;while(t!==null)}}function el(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];Wt=o,Mg(o,t)}Og(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Rg(t),t=t.sibling}function Rg(t){switch(t.tag){case 0:case 11:case 15:el(t),t.flags&2048&&xi(9,t,t.return);break;case 3:el(t);break;case 12:el(t);break;case 22:var i=t.stateNode;t.memoizedState!==null&&i._visibility&2&&(t.return===null||t.return.tag!==13)?(i._visibility&=-3,Uo(t)):el(t);break;default:el(t)}}function Uo(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];Wt=o,Mg(o,t)}Og(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:xi(8,i,i.return),Uo(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,Uo(i));break;default:Uo(i)}t=t.sibling}}function Mg(t,i){for(;Wt!==null;){var a=Wt;switch(a.tag){case 0:case 11:case 15:xi(8,a,i);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Ua(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,Wt=o;else e:for(a=t;Wt!==null;){o=Wt;var h=o.sibling,p=o.return;if(_g(o),o===a){Wt=null;break e}if(h!==null){h.return=p,Wt=h;break e}Wt=p}}}var Xv={getCacheForType:function(t){var i=sn(Gt),a=i.data.get(t);return a===void 0&&(a=t(),i.data.set(t,a)),a},cacheSignal:function(){return sn(Gt).controller.signal}},Kv=typeof WeakMap=="function"?WeakMap:Map,ht=0,At=null,Xe=null,We=0,bt=0,Dn=null,vi=!1,qs=!1,Af=!1,Vr=0,Ht=0,wi=0,os=0,Tf=0,Ln=0,Hs=0,tl=null,_n=null,jf=!1,Bo=0,Dg=0,Po=1/0,qo=null,Si=null,Zt=0,_i=null,Is=null,Jr=0,Nf=0,Of=null,Lg=null,nl=0,Rf=null;function zn(){return(ht&2)!==0&&We!==0?We&-We:H.T!==null?Bf():Ea()}function zg(){if(Ln===0)if((We&536870912)===0||nt){var t=Nr;Nr<<=1,(Nr&3932160)===0&&(Nr=262144),Ln=t}else Ln=536870912;return t=Rn.current,t!==null&&(t.flags|=32),Ln}function En(t,i,a){(t===At&&(bt===2||bt===9)||t.cancelPendingCommit!==null)&&(Fs(t,0),Ei(t,We,Ln,!1)),ar(t,a),((ht&2)===0||t!==At)&&(t===At&&((ht&2)===0&&(os|=a),Ht===4&&Ei(t,We,Ln,!1)),wr(t))}function Ug(t,i,a){if((ht&6)!==0)throw Error(s(327));var o=!a&&(i&127)===0&&(i&t.expiredLanes)===0||Fi(t,i),h=o?Wv(t,i):Df(t,i,!0),p=o;do{if(h===0){qs&&!o&&Ei(t,i,0,!1);break}else{if(a=t.current.alternate,p&&!Qv(a)){h=Df(t,i,!1),p=!1;continue}if(h===2){if(p=i,t.errorRecoveryDisabledLanes&p)var v=0;else v=t.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){i=v;e:{var S=t;h=tl;var q=S.current.memoizedState.isDehydrated;if(q&&(Fs(S,v).flags|=256),v=Df(S,v,!1),v!==2){if(Af&&!q){S.errorRecoveryDisabledLanes|=p,os|=p,h=4;break e}p=_n,_n=h,p!==null&&(_n===null?_n=p:_n.push.apply(_n,p))}h=v}if(p=!1,h!==2)continue}}if(h===1){Fs(t,0),Ei(t,i,0,!0);break}e:{switch(o=t,p=h,p){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:Ei(o,i,Ln,!vi);break e;case 2:_n=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=Bo+300-vt(),10<h)){if(Ei(o,i,Ln,!vi),Ii(o,0,!0)!==0)break e;Jr=i,o.timeoutHandle=my(Bg.bind(null,o,a,_n,qo,jf,i,Ln,os,Hs,vi,p,"Throttled",-0,0),h);break e}Bg(o,a,_n,qo,jf,i,Ln,os,Hs,vi,p,null,-0,0)}}break}while(!0);wr(t)}function Bg(t,i,a,o,h,p,v,S,q,re,ce,pe,ie,le){if(t.timeoutHandle=-1,pe=i.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Mr},Ng(i,p,pe);var Oe=(p&62914560)===p?Bo-vt():(p&4194048)===p?Dg-vt():0;if(Oe=Lw(pe,Oe),Oe!==null){Jr=p,t.cancelPendingCommit=Oe(Gg.bind(null,t,i,p,a,o,h,v,S,q,ce,pe,null,ie,le)),Ei(t,p,v,!re);return}}Gg(t,i,p,a,o,h,v,S,q)}function Qv(t){for(var i=t;;){var a=i.tag;if((a===0||a===11||a===15)&&i.flags&16384&&(a=i.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var h=a[o],p=h.getSnapshot;h=h.value;try{if(!Nn(p(),h))return!1}catch{return!1}}if(a=i.child,i.subtreeFlags&16384&&a!==null)a.return=i,i=a;else{if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ei(t,i,a,o){i&=~Tf,i&=~os,t.suspendedLanes|=i,t.pingedLanes&=~i,o&&(t.warmLanes|=i),o=t.expirationTimes;for(var h=i;0<h;){var p=31-Se(h),v=1<<p;o[p]=-1,h&=~v}a!==0&&li(t,a,i)}function Ho(){return(ht&6)===0?(rl(0),!1):!0}function Mf(){if(Xe!==null){if(bt===0)var t=Xe.return;else t=Xe,Ur=Wi=null,Jc(t),Ms=null,Pa=0,t=Xe;for(;t!==null;)pg(t.alternate,t),t=t.return;Xe=null}}function Fs(t,i){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,yw(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Jr=0,Mf(),At=t,Xe=a=Lr(t.current,null),We=i,bt=0,Dn=null,vi=!1,qs=Fi(t,i),Af=!1,Hs=Ln=Tf=os=wi=Ht=0,_n=tl=null,jf=!1,(i&8)!==0&&(i|=i&32);var o=t.entangledLanes;if(o!==0)for(t=t.entanglements,o&=i;0<o;){var h=31-Se(o),p=1<<h;i|=t[h],o&=~p}return Vr=i,lo(),a}function Pg(t,i){Ye=null,H.H=Va,i===Rs||i===go?(i=tp(),bt=3):i===zc?(i=tp(),bt=4):bt=i===ff?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Dn=i,Xe===null&&(Ht=1,No(t,Jn(i,t.current)))}function qg(){var t=Rn.current;return t===null?!0:(We&4194048)===We?Zn===null:(We&62914560)===We||(We&536870912)!==0?t===Zn:!1}function Hg(){var t=H.H;return H.H=Va,t===null?Va:t}function Ig(){var t=H.A;return H.A=Xv,t}function Io(){Ht=4,vi||(We&4194048)!==We&&Rn.current!==null||(qs=!0),(wi&134217727)===0&&(os&134217727)===0||At===null||Ei(At,We,Ln,!1)}function Df(t,i,a){var o=ht;ht|=2;var h=Hg(),p=Ig();(At!==t||We!==i)&&(qo=null,Fs(t,i)),i=!1;var v=Ht;e:do try{if(bt!==0&&Xe!==null){var S=Xe,q=Dn;switch(bt){case 8:Mf(),v=6;break e;case 3:case 2:case 9:case 6:Rn.current===null&&(i=!0);var re=bt;if(bt=0,Dn=null,$s(t,S,q,re),a&&qs){v=0;break e}break;default:re=bt,bt=0,Dn=null,$s(t,S,q,re)}}Zv(),v=Ht;break}catch(ce){Pg(t,ce)}while(!0);return i&&t.shellSuspendCounter++,Ur=Wi=null,ht=o,H.H=h,H.A=p,Xe===null&&(At=null,We=0,lo()),v}function Zv(){for(;Xe!==null;)Fg(Xe)}function Wv(t,i){var a=ht;ht|=2;var o=Hg(),h=Ig();At!==t||We!==i?(qo=null,Po=vt()+500,Fs(t,i)):qs=Fi(t,i);e:do try{if(bt!==0&&Xe!==null){i=Xe;var p=Dn;t:switch(bt){case 1:bt=0,Dn=null,$s(t,i,p,1);break;case 2:case 9:if(Wm(p)){bt=0,Dn=null,$g(i);break}i=function(){bt!==2&&bt!==9||At!==t||(bt=7),wr(t)},p.then(i,i);break e;case 3:bt=7;break e;case 4:bt=5;break e;case 7:Wm(p)?(bt=0,Dn=null,$g(i)):(bt=0,Dn=null,$s(t,i,p,7));break;case 5:var v=null;switch(Xe.tag){case 26:v=Xe.memoizedState;case 5:case 27:var S=Xe;if(v?jy(v):S.stateNode.complete){bt=0,Dn=null;var q=S.sibling;if(q!==null)Xe=q;else{var re=S.return;re!==null?(Xe=re,Fo(re)):Xe=null}break t}}bt=0,Dn=null,$s(t,i,p,5);break;case 6:bt=0,Dn=null,$s(t,i,p,6);break;case 8:Mf(),Ht=6;break e;default:throw Error(s(462))}}ew();break}catch(ce){Pg(t,ce)}while(!0);return Ur=Wi=null,H.H=o,H.A=h,ht=a,Xe!==null?0:(At=null,We=0,lo(),Ht)}function ew(){for(;Xe!==null&&!$n();)Fg(Xe)}function Fg(t){var i=dg(t.alternate,t,Vr);t.memoizedProps=t.pendingProps,i===null?Fo(t):Xe=i}function $g(t){var i=t,a=i.alternate;switch(i.tag){case 15:case 0:i=lg(a,i,i.pendingProps,i.type,void 0,We);break;case 11:i=lg(a,i,i.pendingProps,i.type.render,i.ref,We);break;case 5:Jc(i);default:pg(a,i),i=Xe=Im(i,Vr),i=dg(a,i,Vr)}t.memoizedProps=t.pendingProps,i===null?Fo(t):Xe=i}function $s(t,i,a,o){Ur=Wi=null,Jc(i),Ms=null,Pa=0;var h=i.return;try{if(Iv(t,h,i,a,We)){Ht=1,No(t,Jn(a,t.current)),Xe=null;return}}catch(p){if(h!==null)throw Xe=h,p;Ht=1,No(t,Jn(a,t.current)),Xe=null;return}i.flags&32768?(nt||o===1?t=!0:qs||(We&536870912)!==0?t=!1:(vi=t=!0,(o===2||o===9||o===3||o===6)&&(o=Rn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Yg(i,t)):Fo(i)}function Fo(t){var i=t;do{if((i.flags&32768)!==0){Yg(i,vi);return}t=i.return;var a=Yv(i.alternate,i,Vr);if(a!==null){Xe=a;return}if(i=i.sibling,i!==null){Xe=i;return}Xe=i=t}while(i!==null);Ht===0&&(Ht=5)}function Yg(t,i){do{var a=Gv(t.alternate,t);if(a!==null){a.flags&=32767,Xe=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(t=t.sibling,t!==null)){Xe=t;return}Xe=t=a}while(t!==null);Ht=6,Xe=null}function Gg(t,i,a,o,h,p,v,S,q){t.cancelPendingCommit=null;do $o();while(Zt!==0);if((ht&6)!==0)throw Error(s(327));if(i!==null){if(i===t.current)throw Error(s(177));if(p=i.lanes|i.childLanes,p|=wc,ai(t,a,p,v,S,q),t===At&&(Xe=At=null,We=0),Is=i,_i=t,Jr=a,Nf=p,Of=h,Lg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,iw(Be,function(){return Qg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=H.T,H.T=null,h=X.p,X.p=2,v=ht,ht|=4;try{Vv(t,i,a)}finally{ht=v,X.p=h,H.T=o}}Zt=1,Vg(),Jg(),Xg()}}function Vg(){if(Zt===1){Zt=0;var t=_i,i=Is,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=H.T,H.T=null;var o=X.p;X.p=2;var h=ht;ht|=4;try{Ag(i,t);var p=Gf,v=Mm(t.containerInfo),S=p.focusedElem,q=p.selectionRange;if(v!==S&&S&&S.ownerDocument&&Rm(S.ownerDocument.documentElement,S)){if(q!==null&&gc(S)){var re=q.start,ce=q.end;if(ce===void 0&&(ce=re),"selectionStart"in S)S.selectionStart=re,S.selectionEnd=Math.min(ce,S.value.length);else{var pe=S.ownerDocument||document,ie=pe&&pe.defaultView||window;if(ie.getSelection){var le=ie.getSelection(),Oe=S.textContent.length,qe=Math.min(q.start,Oe),_t=q.end===void 0?qe:Math.min(q.end,Oe);!le.extend&&qe>_t&&(v=_t,_t=qe,qe=v);var Z=Om(S,qe),V=Om(S,_t);if(Z&&V&&(le.rangeCount!==1||le.anchorNode!==Z.node||le.anchorOffset!==Z.offset||le.focusNode!==V.node||le.focusOffset!==V.offset)){var ne=pe.createRange();ne.setStart(Z.node,Z.offset),le.removeAllRanges(),qe>_t?(le.addRange(ne),le.extend(V.node,V.offset)):(ne.setEnd(V.node,V.offset),le.addRange(ne))}}}}for(pe=[],le=S;le=le.parentNode;)le.nodeType===1&&pe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<pe.length;S++){var he=pe[S];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}nu=!!Yf,Gf=Yf=null}finally{ht=h,X.p=o,H.T=a}}t.current=i,Zt=2}}function Jg(){if(Zt===2){Zt=0;var t=_i,i=Is,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=H.T,H.T=null;var o=X.p;X.p=2;var h=ht;ht|=4;try{Sg(t,i.alternate,i)}finally{ht=h,X.p=o,H.T=a}}Zt=3}}function Xg(){if(Zt===4||Zt===3){Zt=0,gr();var t=_i,i=Is,a=Jr,o=Lg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Zt=5:(Zt=0,Is=_i=null,Kg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(Si=null),Yi(a),i=i.stateNode,ge&&typeof ge.onCommitFiberRoot=="function")try{ge.onCommitFiberRoot(Yt,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=H.T,h=X.p,X.p=2,H.T=null;try{for(var p=t.onRecoverableError,v=0;v<o.length;v++){var S=o[v];p(S.value,{componentStack:S.stack})}}finally{H.T=i,X.p=h}}(Jr&3)!==0&&$o(),wr(t),h=t.pendingLanes,(a&261930)!==0&&(h&42)!==0?t===Rf?nl++:(nl=0,Rf=t):nl=0,rl(0)}}function Kg(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,Ua(i)))}function $o(){return Vg(),Jg(),Xg(),Qg()}function Qg(){if(Zt!==5)return!1;var t=_i,i=Nf;Nf=0;var a=Yi(Jr),o=H.T,h=X.p;try{X.p=32>a?32:a,H.T=null,a=Of,Of=null;var p=_i,v=Jr;if(Zt=0,Is=_i=null,Jr=0,(ht&6)!==0)throw Error(s(331));var S=ht;if(ht|=4,Rg(p.current),jg(p,p.current,v,a),ht=S,rl(0,!1),ge&&typeof ge.onPostCommitFiberRoot=="function")try{ge.onPostCommitFiberRoot(Yt,p)}catch{}return!0}finally{X.p=h,H.T=o,Kg(t,i)}}function Zg(t,i,a){i=Jn(a,i),i=cf(t.stateNode,i,2),t=gi(t,i,2),t!==null&&(ar(t,2),wr(t))}function xt(t,i,a){if(t.tag===3)Zg(t,t,a);else for(;i!==null;){if(i.tag===3){Zg(i,t,a);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Si===null||!Si.has(o))){t=Jn(a,t),a=Wp(2),o=gi(i,a,2),o!==null&&(eg(a,o,i,t),ar(o,2),wr(o));break}}i=i.return}}function Lf(t,i,a){var o=t.pingCache;if(o===null){o=t.pingCache=new Kv;var h=new Set;o.set(i,h)}else h=o.get(i),h===void 0&&(h=new Set,o.set(i,h));h.has(a)||(Af=!0,h.add(a),t=tw.bind(null,t,i,a),i.then(t,t))}function tw(t,i,a){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,At===t&&(We&a)===a&&(Ht===4||Ht===3&&(We&62914560)===We&&300>vt()-Bo?(ht&2)===0&&Fs(t,0):Tf|=a,Hs===We&&(Hs=0)),wr(t)}function Wg(t,i){i===0&&(i=ps()),t=Ki(t,i),t!==null&&(ar(t,i),wr(t))}function nw(t){var i=t.memoizedState,a=0;i!==null&&(a=i.retryLane),Wg(t,a)}function rw(t,i){var a=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(a=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(i),Wg(t,a)}function iw(t,i){return Mt(t,i)}var Yo=null,Ys=null,zf=!1,Go=!1,Uf=!1,ki=0;function wr(t){t!==Ys&&t.next===null&&(Ys===null?Yo=Ys=t:Ys=Ys.next=t),Go=!0,zf||(zf=!0,aw())}function rl(t,i){if(!Uf&&Go){Uf=!0;do for(var a=!1,o=Yo;o!==null;){if(t!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var v=o.suspendedLanes,S=o.pingedLanes;p=(1<<31-Se(42|t)+1)-1,p&=h&~(v&~S),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,ry(o,p))}else p=We,p=Ii(o,o===At?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Fi(o,p)||(a=!0,ry(o,p));o=o.next}while(a);Uf=!1}}function sw(){ey()}function ey(){Go=zf=!1;var t=0;ki!==0&&gw()&&(t=ki);for(var i=vt(),a=null,o=Yo;o!==null;){var h=o.next,p=ty(o,i);p===0?(o.next=null,a===null?Yo=h:a.next=h,h===null&&(Ys=a)):(a=o,(t!==0||(p&3)!==0)&&(Go=!0)),o=h}Zt!==0&&Zt!==5||rl(t),ki!==0&&(ki=0)}function ty(t,i){for(var a=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var v=31-Se(p),S=1<<v,q=h[v];q===-1?((S&a)===0||(S&o)!==0)&&(h[v]=_a(S,i)):q<=i&&(t.expiredLanes|=S),p&=~S}if(i=At,a=We,a=Ii(t,t===i?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,a===0||t===i&&(bt===2||bt===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&yt(o),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Fi(t,a)){if(i=a&-a,i===t.callbackPriority)return i;switch(o!==null&&yt(o),Yi(a)){case 2:case 8:a=we;break;case 32:a=Be;break;case 268435456:a=rt;break;default:a=Be}return o=ny.bind(null,t),a=Mt(a,o),t.callbackPriority=i,t.callbackNode=a,i}return o!==null&&o!==null&&yt(o),t.callbackPriority=2,t.callbackNode=null,2}function ny(t,i){if(Zt!==0&&Zt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if($o()&&t.callbackNode!==a)return null;var o=We;return o=Ii(t,t===At?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(Ug(t,o,i),ty(t,vt()),t.callbackNode!=null&&t.callbackNode===a?ny.bind(null,t):null)}function ry(t,i){if($o())return null;Ug(t,i,!0)}function aw(){bw(function(){(ht&6)!==0?Mt(fe,sw):ey()})}function Bf(){if(ki===0){var t=Ns;t===0&&(t=ri,ri<<=1,(ri&261888)===0&&(ri=256)),ki=t}return ki}function iy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Wl(""+t)}function sy(t,i){var a=i.ownerDocument.createElement("input");return a.name=i.name,a.value=i.value,t.id&&a.setAttribute("form",t.id),i.parentNode.insertBefore(a,i),t=new FormData(t),a.parentNode.removeChild(a),t}function lw(t,i,a,o,h){if(i==="submit"&&a&&a.stateNode===h){var p=iy((h[Pt]||null).action),v=o.submitter;v&&(i=(i=v[Pt]||null)?iy(i.formAction):v.getAttribute("formAction"),i!==null&&(p=i,v=null));var S=new ro("action","action",null,o,h);t.push({event:S,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(ki!==0){var q=v?sy(h,v):new FormData(h);rf(a,{pending:!0,data:q,method:h.method,action:p},null,q)}}else typeof p=="function"&&(S.preventDefault(),q=v?sy(h,v):new FormData(h),rf(a,{pending:!0,data:q,method:h.method,action:p},p,q))},currentTarget:h}]})}}for(var Pf=0;Pf<vc.length;Pf++){var qf=vc[Pf],ow=qf.toLowerCase(),uw=qf[0].toUpperCase()+qf.slice(1);or(ow,"on"+uw)}or(zm,"onAnimationEnd"),or(Um,"onAnimationIteration"),or(Bm,"onAnimationStart"),or("dblclick","onDoubleClick"),or("focusin","onFocus"),or("focusout","onBlur"),or(kv,"onTransitionRun"),or(Cv,"onTransitionStart"),or(Av,"onTransitionCancel"),or(Pm,"onTransitionEnd"),se("onMouseEnter",["mouseout","mouseover"]),se("onMouseLeave",["mouseout","mouseover"]),se("onPointerEnter",["pointerout","pointerover"]),se("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 il="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(" "),cw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(il));function ay(t,i){i=(i&4)!==0;for(var a=0;a<t.length;a++){var o=t[a],h=o.event;o=o.listeners;e:{var p=void 0;if(i)for(var v=o.length-1;0<=v;v--){var S=o[v],q=S.instance,re=S.currentTarget;if(S=S.listener,q!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=re;try{p(h)}catch(ce){ao(ce)}h.currentTarget=null,p=q}else for(v=0;v<o.length;v++){if(S=o[v],q=S.instance,re=S.currentTarget,S=S.listener,q!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=re;try{p(h)}catch(ce){ao(ce)}h.currentTarget=null,p=q}}}}function Ke(t,i){var a=i[Gi];a===void 0&&(a=i[Gi]=new Set);var o=t+"__bubble";a.has(o)||(ly(i,t,2,!1),a.add(o))}function Hf(t,i,a){var o=0;i&&(o|=4),ly(a,t,o,i)}var Vo="_reactListening"+Math.random().toString(36).slice(2);function If(t){if(!t[Vo]){t[Vo]=!0,te.forEach(function(a){a!=="selectionchange"&&(cw.has(a)||Hf(a,!1,t),Hf(a,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[Vo]||(i[Vo]=!0,Hf("selectionchange",!1,i))}}function ly(t,i,a,o){switch(zy(i)){case 2:var h=Bw;break;case 8:h=Pw;break;default:h=rh}a=h.bind(null,i,a,t),h=void 0,!lc||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(i,a,{capture:!0,passive:h}):t.addEventListener(i,a,!0):h!==void 0?t.addEventListener(i,a,{passive:h}):t.addEventListener(i,a,!1)}function Ff(t,i,a,o,h){var p=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var v=o.tag;if(v===3||v===4){var S=o.stateNode.containerInfo;if(S===h)break;if(v===4)for(v=o.return;v!==null;){var q=v.tag;if((q===3||q===4)&&v.stateNode.containerInfo===h)return;v=v.return}for(;S!==null;){if(v=k(S),v===null)return;if(q=v.tag,q===5||q===6||q===26||q===27){o=p=v;continue e}S=S.parentNode}}o=o.return}hm(function(){var re=p,ce=sc(a),pe=[];e:{var ie=qm.get(t);if(ie!==void 0){var le=ro,Oe=t;switch(t){case"keypress":if(to(a)===0)break e;case"keydown":case"keyup":le=rv;break;case"focusin":Oe="focus",le=fc;break;case"focusout":Oe="blur",le=fc;break;case"beforeblur":case"afterblur":le=fc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=pm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Y1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=av;break;case zm:case Um:case Bm:le=J1;break;case Pm:le=ov;break;case"scroll":case"scrollend":le=F1;break;case"wheel":le=cv;break;case"copy":case"cut":case"paste":le=K1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=ym;break;case"toggle":case"beforetoggle":le=hv}var qe=(i&4)!==0,_t=!qe&&(t==="scroll"||t==="scrollend"),Z=qe?ie!==null?ie+"Capture":null:ie;qe=[];for(var V=re,ne;V!==null;){var he=V;if(ne=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ne===null||Z===null||(he=Ca(V,Z),he!=null&&qe.push(sl(V,he,ne))),_t)break;V=V.return}0<qe.length&&(ie=new le(ie,Oe,null,a,ce),pe.push({event:ie,listeners:qe}))}}if((i&7)===0){e:{if(ie=t==="mouseover"||t==="pointerover",le=t==="mouseout"||t==="pointerout",ie&&a!==ic&&(Oe=a.relatedTarget||a.fromElement)&&(k(Oe)||Oe[jn]))break e;if((le||ie)&&(ie=ce.window===ce?ce:(ie=ce.ownerDocument)?ie.defaultView||ie.parentWindow:window,le?(Oe=a.relatedTarget||a.toElement,le=re,Oe=Oe?k(Oe):null,Oe!==null&&(_t=u(Oe),qe=Oe.tag,Oe!==_t||qe!==5&&qe!==27&&qe!==6)&&(Oe=null)):(le=null,Oe=re),le!==Oe)){if(qe=pm,he="onMouseLeave",Z="onMouseEnter",V="mouse",(t==="pointerout"||t==="pointerover")&&(qe=ym,he="onPointerLeave",Z="onPointerEnter",V="pointer"),_t=le==null?ie:T(le),ne=Oe==null?ie:T(Oe),ie=new qe(he,V+"leave",le,a,ce),ie.target=_t,ie.relatedTarget=ne,he=null,k(ce)===re&&(qe=new qe(Z,V+"enter",Oe,a,ce),qe.target=ne,qe.relatedTarget=_t,he=qe),_t=he,le&&Oe)t:{for(qe=fw,Z=le,V=Oe,ne=0,he=Z;he;he=qe(he))ne++;he=0;for(var Le=V;Le;Le=qe(Le))he++;for(;0<ne-he;)Z=qe(Z),ne--;for(;0<he-ne;)V=qe(V),he--;for(;ne--;){if(Z===V||V!==null&&Z===V.alternate){qe=Z;break t}Z=qe(Z),V=qe(V)}qe=null}else qe=null;le!==null&&oy(pe,ie,le,qe,!1),Oe!==null&&_t!==null&&oy(pe,_t,Oe,qe,!0)}}e:{if(ie=re?T(re):window,le=ie.nodeName&&ie.nodeName.toLowerCase(),le==="select"||le==="input"&&ie.type==="file")var ot=km;else if(_m(ie))if(Cm)ot=Sv;else{ot=vv;var Re=xv}else le=ie.nodeName,!le||le.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?re&&rc(re.elementType)&&(ot=km):ot=wv;if(ot&&(ot=ot(t,re))){Em(pe,ot,a,ce);break e}Re&&Re(t,ie,re),t==="focusout"&&re&&ie.type==="number"&&re.memoizedProps.value!=null&&nc(ie,"number",ie.value)}switch(Re=re?T(re):window,t){case"focusin":(_m(Re)||Re.contentEditable==="true")&&(Ss=Re,yc=re,Da=null);break;case"focusout":Da=yc=Ss=null;break;case"mousedown":bc=!0;break;case"contextmenu":case"mouseup":case"dragend":bc=!1,Dm(pe,a,ce);break;case"selectionchange":if(Ev)break;case"keydown":case"keyup":Dm(pe,a,ce)}var Ge;if(dc)e:{switch(t){case"compositionstart":var et="onCompositionStart";break e;case"compositionend":et="onCompositionEnd";break e;case"compositionupdate":et="onCompositionUpdate";break e}et=void 0}else ws?wm(t,a)&&(et="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(et="onCompositionStart");et&&(bm&&a.locale!=="ko"&&(ws||et!=="onCompositionStart"?et==="onCompositionEnd"&&ws&&(Ge=dm()):(ui=ce,oc="value"in ui?ui.value:ui.textContent,ws=!0)),Re=Jo(re,et),0<Re.length&&(et=new gm(et,t,null,a,ce),pe.push({event:et,listeners:Re}),Ge?et.data=Ge:(Ge=Sm(a),Ge!==null&&(et.data=Ge)))),(Ge=mv?pv(t,a):gv(t,a))&&(et=Jo(re,"onBeforeInput"),0<et.length&&(Re=new gm("onBeforeInput","beforeinput",null,a,ce),pe.push({event:Re,listeners:et}),Re.data=Ge)),lw(pe,t,re,a,ce)}ay(pe,i)})}function sl(t,i,a){return{instance:t,listener:i,currentTarget:a}}function Jo(t,i){for(var a=i+"Capture",o=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=Ca(t,a),h!=null&&o.unshift(sl(t,h,p)),h=Ca(t,i),h!=null&&o.push(sl(t,h,p))),t.tag===3)return o;t=t.return}return[]}function fw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function oy(t,i,a,o,h){for(var p=i._reactName,v=[];a!==null&&a!==o;){var S=a,q=S.alternate,re=S.stateNode;if(S=S.tag,q!==null&&q===o)break;S!==5&&S!==26&&S!==27||re===null||(q=re,h?(re=Ca(a,p),re!=null&&v.unshift(sl(a,re,q))):h||(re=Ca(a,p),re!=null&&v.push(sl(a,re,q)))),a=a.return}v.length!==0&&t.push({event:i,listeners:v})}var hw=/\r\n?/g,dw=/\u0000|\uFFFD/g;function uy(t){return(typeof t=="string"?t:""+t).replace(hw,`
49
+ `).replace(dw,"")}function cy(t,i){return i=uy(i),uy(t)===i}function St(t,i,a,o,h,p){switch(a){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||bs(t,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&bs(t,""+o);break;case"className":lr(t,"class",o);break;case"tabIndex":lr(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":lr(t,a,o);break;case"style":cm(t,o,p);break;case"data":if(i!=="object"){lr(t,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||a!=="href")){t.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(a);break}o=Wl(""+o),t.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){t.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(a==="formAction"?(i!=="input"&&St(t,i,"name",h.name,h,null),St(t,i,"formEncType",h.formEncType,h,null),St(t,i,"formMethod",h.formMethod,h,null),St(t,i,"formTarget",h.formTarget,h,null)):(St(t,i,"encType",h.encType,h,null),St(t,i,"method",h.method,h,null),St(t,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(a);break}o=Wl(""+o),t.setAttribute(a,o);break;case"onClick":o!=null&&(t.onclick=Mr);break;case"onScroll":o!=null&&Ke("scroll",t);break;case"onScrollEnd":o!=null&&Ke("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){t.removeAttribute("xlink:href");break}a=Wl(""+o),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,""+o):t.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":o===!0?t.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,o):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(a,o):t.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(a):t.setAttribute(a,o);break;case"popover":Ke("beforetoggle",t),Ke("toggle",t),on(t,"popover",o);break;case"xlinkActuate":Rr(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Rr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Rr(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Rr(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Rr(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Rr(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Rr(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Rr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Rr(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":on(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=H1.get(a)||a,on(t,a,o))}}function $f(t,i,a,o,h,p){switch(a){case"style":cm(t,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"children":typeof o=="string"?bs(t,o):(typeof o=="number"||typeof o=="bigint")&&bs(t,""+o);break;case"onScroll":o!=null&&Ke("scroll",t);break;case"onScrollEnd":o!=null&&Ke("scrollend",t);break;case"onClick":o!=null&&(t.onclick=Mr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!me.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),i=a.slice(2,h?a.length-7:void 0),p=t[Pt]||null,p=p!=null?p[a]:null,typeof p=="function"&&t.removeEventListener(i,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(i,o,h);break e}a in t?t[a]=o:o===!0?t.setAttribute(a,""):on(t,a,o)}}}function ln(t,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ke("error",t),Ke("load",t);var o=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var v=a[p];if(v!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:St(t,i,p,v,a,null)}}h&&St(t,i,"srcSet",a.srcSet,a,null),o&&St(t,i,"src",a.src,a,null);return;case"input":Ke("invalid",t);var S=p=v=h=null,q=null,re=null;for(o in a)if(a.hasOwnProperty(o)){var ce=a[o];if(ce!=null)switch(o){case"name":h=ce;break;case"type":v=ce;break;case"checked":q=ce;break;case"defaultChecked":re=ce;break;case"value":p=ce;break;case"defaultValue":S=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,i));break;default:St(t,i,o,ce,a,null)}}am(t,p,S,q,re,v,h,!1);return;case"select":Ke("invalid",t),o=v=p=null;for(h in a)if(a.hasOwnProperty(h)&&(S=a[h],S!=null))switch(h){case"value":p=S;break;case"defaultValue":v=S;break;case"multiple":o=S;default:St(t,i,h,S,a,null)}i=p,a=v,t.multiple=!!o,i!=null?ys(t,!!o,i,!1):a!=null&&ys(t,!!o,a,!0);return;case"textarea":Ke("invalid",t),p=h=o=null;for(v in a)if(a.hasOwnProperty(v)&&(S=a[v],S!=null))switch(v){case"value":o=S;break;case"defaultValue":h=S;break;case"children":p=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(s(91));break;default:St(t,i,v,S,a,null)}om(t,o,h,p);return;case"option":for(q in a)if(a.hasOwnProperty(q)&&(o=a[q],o!=null))switch(q){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:St(t,i,q,o,a,null)}return;case"dialog":Ke("beforetoggle",t),Ke("toggle",t),Ke("cancel",t),Ke("close",t);break;case"iframe":case"object":Ke("load",t);break;case"video":case"audio":for(o=0;o<il.length;o++)Ke(il[o],t);break;case"image":Ke("error",t),Ke("load",t);break;case"details":Ke("toggle",t);break;case"embed":case"source":case"link":Ke("error",t),Ke("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(re in a)if(a.hasOwnProperty(re)&&(o=a[re],o!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:St(t,i,re,o,a,null)}return;default:if(rc(i)){for(ce in a)a.hasOwnProperty(ce)&&(o=a[ce],o!==void 0&&$f(t,i,ce,o,a,void 0));return}}for(S in a)a.hasOwnProperty(S)&&(o=a[S],o!=null&&St(t,i,S,o,a,null))}function mw(t,i,a,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,v=null,S=null,q=null,re=null,ce=null;for(le in a){var pe=a[le];if(a.hasOwnProperty(le)&&pe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":q=pe;default:o.hasOwnProperty(le)||St(t,i,le,null,o,pe)}}for(var ie in o){var le=o[ie];if(pe=a[ie],o.hasOwnProperty(ie)&&(le!=null||pe!=null))switch(ie){case"type":p=le;break;case"name":h=le;break;case"checked":re=le;break;case"defaultChecked":ce=le;break;case"value":v=le;break;case"defaultValue":S=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(s(137,i));break;default:le!==pe&&St(t,i,ie,le,o,pe)}}tc(t,v,S,q,re,ce,p,h);return;case"select":le=v=S=ie=null;for(p in a)if(q=a[p],a.hasOwnProperty(p)&&q!=null)switch(p){case"value":break;case"multiple":le=q;default:o.hasOwnProperty(p)||St(t,i,p,null,o,q)}for(h in o)if(p=o[h],q=a[h],o.hasOwnProperty(h)&&(p!=null||q!=null))switch(h){case"value":ie=p;break;case"defaultValue":S=p;break;case"multiple":v=p;default:p!==q&&St(t,i,h,p,o,q)}i=S,a=v,o=le,ie!=null?ys(t,!!a,ie,!1):!!o!=!!a&&(i!=null?ys(t,!!a,i,!0):ys(t,!!a,a?[]:"",!1));return;case"textarea":le=ie=null;for(S in a)if(h=a[S],a.hasOwnProperty(S)&&h!=null&&!o.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:St(t,i,S,null,o,h)}for(v in o)if(h=o[v],p=a[v],o.hasOwnProperty(v)&&(h!=null||p!=null))switch(v){case"value":ie=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&St(t,i,v,h,o,p)}lm(t,ie,le);return;case"option":for(var Oe in a)if(ie=a[Oe],a.hasOwnProperty(Oe)&&ie!=null&&!o.hasOwnProperty(Oe))switch(Oe){case"selected":t.selected=!1;break;default:St(t,i,Oe,null,o,ie)}for(q in o)if(ie=o[q],le=a[q],o.hasOwnProperty(q)&&ie!==le&&(ie!=null||le!=null))switch(q){case"selected":t.selected=ie&&typeof ie!="function"&&typeof ie!="symbol";break;default:St(t,i,q,ie,o,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var qe in a)ie=a[qe],a.hasOwnProperty(qe)&&ie!=null&&!o.hasOwnProperty(qe)&&St(t,i,qe,null,o,ie);for(re in o)if(ie=o[re],le=a[re],o.hasOwnProperty(re)&&ie!==le&&(ie!=null||le!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,i));break;default:St(t,i,re,ie,o,le)}return;default:if(rc(i)){for(var _t in a)ie=a[_t],a.hasOwnProperty(_t)&&ie!==void 0&&!o.hasOwnProperty(_t)&&$f(t,i,_t,void 0,o,ie);for(ce in o)ie=o[ce],le=a[ce],!o.hasOwnProperty(ce)||ie===le||ie===void 0&&le===void 0||$f(t,i,ce,ie,o,le);return}}for(var Z in a)ie=a[Z],a.hasOwnProperty(Z)&&ie!=null&&!o.hasOwnProperty(Z)&&St(t,i,Z,null,o,ie);for(pe in o)ie=o[pe],le=a[pe],!o.hasOwnProperty(pe)||ie===le||ie==null&&le==null||St(t,i,pe,ie,o,le)}function fy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function pw(){if(typeof performance.getEntriesByType=="function"){for(var t=0,i=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var h=a[o],p=h.transferSize,v=h.initiatorType,S=h.duration;if(p&&S&&fy(v)){for(v=0,S=h.responseEnd,o+=1;o<a.length;o++){var q=a[o],re=q.startTime;if(re>S)break;var ce=q.transferSize,pe=q.initiatorType;ce&&fy(pe)&&(q=q.responseEnd,v+=ce*(q<S?1:(S-re)/(q-re)))}if(--o,i+=8*(p+v)/(h.duration/1e3),t++,10<t)break}}if(0<t)return i/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Yf=null,Gf=null;function Xo(t){return t.nodeType===9?t:t.ownerDocument}function hy(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function dy(t,i){if(t===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&i==="foreignObject"?0:t}function Vf(t,i){return t==="textarea"||t==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Jf=null;function gw(){var t=window.event;return t&&t.type==="popstate"?t===Jf?!1:(Jf=t,!0):(Jf=null,!1)}var my=typeof setTimeout=="function"?setTimeout:void 0,yw=typeof clearTimeout=="function"?clearTimeout:void 0,py=typeof Promise=="function"?Promise:void 0,bw=typeof queueMicrotask=="function"?queueMicrotask:typeof py<"u"?function(t){return py.resolve(null).then(t).catch(xw)}:my;function xw(t){setTimeout(function(){throw t})}function Ci(t){return t==="head"}function gy(t,i){var a=i,o=0;do{var h=a.nextSibling;if(t.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(o===0){t.removeChild(h),Xs(i);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")al(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,al(a);for(var p=a.firstChild;p;){var v=p.nextSibling,S=p.nodeName;p[Qt]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=v}}else a==="body"&&al(t.ownerDocument.body);a=h}while(a);Xs(i)}function yy(t,i){var a=t;t=0;do{var o=a.nextSibling;if(a.nodeType===1?i?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(i?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=o}while(a)}function Xf(t){var i=t.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var a=i;switch(i=i.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Xf(a),gs(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function vw(t,i,a,o){for(;t.nodeType===1;){var h=a;if(t.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[Qt])switch(i){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(p=t.getAttribute("rel"),p==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(p!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(p=t.getAttribute("src"),(p!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(i==="input"&&t.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===p)return t}else return t;if(t=Wn(t.nextSibling),t===null)break}return null}function ww(t,i,a){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Wn(t.nextSibling),t===null))return null;return t}function by(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Wn(t.nextSibling),t===null))return null;return t}function Kf(t){return t.data==="$?"||t.data==="$~"}function Qf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Sw(t,i){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=i;else if(t.data!=="$?"||a.readyState!=="loading")i();else{var o=function(){i(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function 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 Zf=null;function xy(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(i===0)return Wn(t.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}t=t.nextSibling}return null}function vy(t){t=t.previousSibling;for(var i=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(i===0)return t;i--}else a!=="/$"&&a!=="/&"||i++}t=t.previousSibling}return null}function wy(t,i,a){switch(i=Xo(a),t){case"html":if(t=i.documentElement,!t)throw Error(s(452));return t;case"head":if(t=i.head,!t)throw Error(s(453));return t;case"body":if(t=i.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function al(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);gs(t)}var er=new Map,Sy=new Set;function Ko(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Xr=X.d;X.d={f:_w,r:Ew,D:kw,C:Cw,L:Aw,m:Tw,X:Nw,S:jw,M:Ow};function _w(){var t=Xr.f(),i=Ho();return t||i}function Ew(t){var i=O(t);i!==null&&i.tag===5&&i.type==="form"?Pp(i):Xr.r(t)}var Gs=typeof document>"u"?null:document;function _y(t,i,a){var o=Gs;if(o&&typeof i=="string"&&i){var h=Gn(i);h='link[rel="'+t+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Sy.has(h)||(Sy.add(h),t={rel:t,crossOrigin:a,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),ln(i,"link",t),$(i),o.head.appendChild(i)))}}function kw(t){Xr.D(t),_y("dns-prefetch",t,null)}function Cw(t,i){Xr.C(t,i),_y("preconnect",t,i)}function Aw(t,i,a){Xr.L(t,i,a);var o=Gs;if(o&&t&&i){var h='link[rel="preload"][as="'+Gn(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Gn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Gn(a.imageSizes)+'"]')):h+='[href="'+Gn(t)+'"]';var p=h;switch(i){case"style":p=Vs(t);break;case"script":p=Js(t)}er.has(p)||(t=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:t,as:i},a),er.set(p,t),o.querySelector(h)!==null||i==="style"&&o.querySelector(ll(p))||i==="script"&&o.querySelector(ol(p))||(i=o.createElement("link"),ln(i,"link",t),$(i),o.head.appendChild(i)))}}function Tw(t,i){Xr.m(t,i);var a=Gs;if(a&&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=Js(t)}if(!er.has(p)&&(t=g({rel:"modulepreload",href:t},i),er.set(p,t),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ol(p)))return}o=a.createElement("link"),ln(o,"link",t),$(o),a.head.appendChild(o)}}}function jw(t,i,a){Xr.S(t,i,a);var o=Gs;if(o&&t){var h=U(o).hoistableStyles,p=Vs(t);i=i||"default";var v=h.get(p);if(!v){var S={loading:0,preload:null};if(v=o.querySelector(ll(p)))S.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":i},a),(a=er.get(p))&&Wf(t,a);var q=v=o.createElement("link");$(q),ln(q,"link",t),q._p=new Promise(function(re,ce){q.onload=re,q.onerror=ce}),q.addEventListener("load",function(){S.loading|=1}),q.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Qo(v,i,o)}v={type:"stylesheet",instance:v,count:1,state:S},h.set(p,v)}}}function Nw(t,i){Xr.X(t,i);var a=Gs;if(a&&t){var o=U(a).hoistableScripts,h=Js(t),p=o.get(h);p||(p=a.querySelector(ol(h)),p||(t=g({src:t,async:!0},i),(i=er.get(h))&&eh(t,i),p=a.createElement("script"),$(p),ln(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Ow(t,i){Xr.M(t,i);var a=Gs;if(a&&t){var o=U(a).hoistableScripts,h=Js(t),p=o.get(h);p||(p=a.querySelector(ol(h)),p||(t=g({src:t,async:!0,type:"module"},i),(i=er.get(h))&&eh(t,i),p=a.createElement("script"),$(p),ln(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Ey(t,i,a,o){var h=(h=Te.current)?Ko(h):null;if(!h)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(i=Vs(a.href),a=U(h).hoistableStyles,o=a.get(i),o||(o={type:"style",instance:null,count:0,state:null},a.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=Vs(a.href);var p=U(h).hoistableStyles,v=p.get(t);if(v||(h=h.ownerDocument||h,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,v),(p=h.querySelector(ll(t)))&&!p._p&&(v.instance=p,v.state.loading=5),er.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},er.set(t,a),p||Rw(h,t,a,v.state))),i&&o===null)throw Error(s(528,""));return v}if(i&&o!==null)throw Error(s(529,""));return null;case"script":return i=a.async,a=a.src,typeof a=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Js(a),a=U(h).hoistableScripts,o=a.get(i),o||(o={type:"script",instance:null,count:0,state:null},a.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function Vs(t){return'href="'+Gn(t)+'"'}function ll(t){return'link[rel="stylesheet"]['+t+"]"}function ky(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function Rw(t,i,a,o){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=t.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),ln(i,"link",a),$(i),t.head.appendChild(i))}function Js(t){return'[src="'+Gn(t)+'"]'}function ol(t){return"script[async]"+t}function Cy(t,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+Gn(a.href)+'"]');if(o)return i.instance=o,$(o),o;var h=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),$(o),ln(o,"style",h),Qo(o,a.precedence,t),i.instance=o;case"stylesheet":h=Vs(a.href);var p=t.querySelector(ll(h));if(p)return i.state.loading|=4,i.instance=p,$(p),p;o=ky(a),(h=er.get(h))&&Wf(o,h),p=(t.ownerDocument||t).createElement("link"),$(p);var v=p;return v._p=new Promise(function(S,q){v.onload=S,v.onerror=q}),ln(p,"link",o),i.state.loading|=4,Qo(p,a.precedence,t),i.instance=p;case"script":return p=Js(a.src),(h=t.querySelector(ol(p)))?(i.instance=h,$(h),h):(o=a,(h=er.get(p))&&(o=g({},a),eh(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),$(h),ln(h,"link",o),t.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Qo(o,a.precedence,t));return i.instance}function Qo(t,i,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,v=0;v<o.length;v++){var S=o[v];if(S.dataset.precedence===i)p=S;else if(p!==h)break}p?p.parentNode.insertBefore(t,p.nextSibling):(i=a.nodeType===9?a.head:a,i.insertBefore(t,i.firstChild))}function Wf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function eh(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.integrity==null&&(t.integrity=i.integrity)}var Zo=null;function Ay(t,i,a){if(Zo===null){var o=new Map,h=Zo=new Map;h.set(a,o)}else h=Zo,o=h.get(a),o||(o=new Map,h.set(a,o));if(o.has(t))return o;for(o.set(t,null),a=a.getElementsByTagName(t),h=0;h<a.length;h++){var p=a[h];if(!(p[Qt]||p[Ct]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var v=p.getAttribute(i)||"";v=t+v;var S=o.get(v);S?S.push(p):o.set(v,[p])}}return o}function Ty(t,i,a){t=t.ownerDocument||t,t.head.insertBefore(a,i==="title"?t.querySelector("head > title"):null)}function Mw(t,i,a){if(a===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return t=i.disabled,typeof i.precedence=="string"&&t==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function jy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Dw(t,i,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=Vs(o.href),p=i.querySelector(ll(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=Wo.bind(t),i.then(t,t)),a.state.loading|=4,a.instance=p,$(p);return}p=i.ownerDocument||i,o=ky(o),(h=er.get(h))&&Wf(o,h),p=p.createElement("link"),$(p);var v=p;v._p=new Promise(function(S,q){v.onload=S,v.onerror=q}),ln(p,"link",o),a.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,i),(i=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=Wo.bind(t),i.addEventListener("load",a),i.addEventListener("error",a))}}var th=0;function Lw(t,i){return t.stylesheets&&t.count===0&&tu(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var o=setTimeout(function(){if(t.stylesheets&&tu(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+i);0<t.imgBytes&&th===0&&(th=62500*pw());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&tu(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>th?50:800)+i);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function Wo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var eu=null;function tu(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,eu=new Map,i.forEach(zw,t),eu=null,Wo.call(t))}function zw(t,i){if(!(i.state.loading&4)){var a=eu.get(t);if(a)var o=a.get(null);else{a=new Map,eu.set(t,a);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var v=h[p];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(a.set(v.dataset.precedence,v),o=v)}o&&a.set(null,o)}h=i.instance,v=h.getAttribute("data-precedence"),p=a.get(v)||o,p===o&&a.set(null,h),a.set(v,h),this.count++,o=Wo.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 ul={$$typeof:j,Provider:null,Consumer:null,_currentValue:ue,_currentValue2:ue,_threadCount:0};function Uw(t,i,a,o,h,p,v,S,q){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=si(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=si(0),this.hiddenUpdates=si(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function Ny(t,i,a,o,h,p,v,S,q,re,ce,pe){return t=new Uw(t,i,a,v,q,re,ce,pe,S),i=1,p===!0&&(i|=24),p=On(3,null,null,i),t.current=p,p.stateNode=t,i=Mc(),i.refCount++,t.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:i},Uc(p),t}function Oy(t){return t?(t=ks,t):ks}function Ry(t,i,a,o,h,p){h=Oy(h),o.context===null?o.context=h:o.pendingContext=h,o=pi(i),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=gi(t,o,i),a!==null&&(En(a,t,i),Ha(a,t,i))}function My(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<i?a:i}}function nh(t,i){My(t,i),(t=t.alternate)&&My(t,i)}function Dy(t){if(t.tag===13||t.tag===31){var i=Ki(t,67108864);i!==null&&En(i,t,67108864),nh(t,67108864)}}function Ly(t){if(t.tag===13||t.tag===31){var i=zn();i=Or(i);var a=Ki(t,i);a!==null&&En(a,t,i),nh(t,i)}}var nu=!0;function Bw(t,i,a,o){var h=H.T;H.T=null;var p=X.p;try{X.p=2,rh(t,i,a,o)}finally{X.p=p,H.T=h}}function Pw(t,i,a,o){var h=H.T;H.T=null;var p=X.p;try{X.p=8,rh(t,i,a,o)}finally{X.p=p,H.T=h}}function rh(t,i,a,o){if(nu){var h=ih(o);if(h===null)Ff(t,i,o,ru,a),Uy(t,o);else if(Hw(h,t,i,a,o))o.stopPropagation();else if(Uy(t,o),i&4&&-1<qw.indexOf(t)){for(;h!==null;){var p=O(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var v=sr(p.pendingLanes);if(v!==0){var S=p;for(S.pendingLanes|=2,S.entangledLanes|=2;v;){var q=1<<31-Se(v);S.entanglements[1]|=q,v&=~q}wr(p),(ht&6)===0&&(Po=vt()+500,rl(0))}}break;case 31:case 13:S=Ki(p,2),S!==null&&En(S,p,2),Ho(),nh(p,2)}if(p=ih(o),p===null&&Ff(t,i,o,ru,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else Ff(t,i,o,null,a)}}function ih(t){return t=sc(t),sh(t)}var ru=null;function sh(t){if(ru=null,t=k(t),t!==null){var i=u(t);if(i===null)t=null;else{var a=i.tag;if(a===13){if(t=c(i),t!==null)return t;t=null}else if(a===31){if(t=f(i),t!==null)return t;t=null}else if(a===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;t=null}else i!==t&&(t=null)}}return ru=t,null}function zy(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(An()){case fe:return 2;case we:return 8;case Be:case $e:return 32;case rt:return 268435456;default:return 32}default:return 32}}var ah=!1,Ai=null,Ti=null,ji=null,cl=new Map,fl=new Map,Ni=[],qw="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Uy(t,i){switch(t){case"focusin":case"focusout":Ai=null;break;case"dragenter":case"dragleave":Ti=null;break;case"mouseover":case"mouseout":ji=null;break;case"pointerover":case"pointerout":cl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":fl.delete(i.pointerId)}}function hl(t,i,a,o,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:i,domEventName:a,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=O(i),i!==null&&Dy(i)),t):(t.eventSystemFlags|=o,i=t.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),t)}function Hw(t,i,a,o,h){switch(i){case"focusin":return Ai=hl(Ai,t,i,a,o,h),!0;case"dragenter":return Ti=hl(Ti,t,i,a,o,h),!0;case"mouseover":return ji=hl(ji,t,i,a,o,h),!0;case"pointerover":var p=h.pointerId;return cl.set(p,hl(cl.get(p)||null,t,i,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,fl.set(p,hl(fl.get(p)||null,t,i,a,o,h)),!0}return!1}function By(t){var i=k(t.target);if(i!==null){var a=u(i);if(a!==null){if(i=a.tag,i===13){if(i=c(a),i!==null){t.blockedOn=i,Xl(t.priority,function(){Ly(a)});return}}else if(i===31){if(i=f(a),i!==null){t.blockedOn=i,Xl(t.priority,function(){Ly(a)});return}}else if(i===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function iu(t){if(t.blockedOn!==null)return!1;for(var i=t.targetContainers;0<i.length;){var a=ih(t.nativeEvent);if(a===null){a=t.nativeEvent;var o=new a.constructor(a.type,a);ic=o,a.target.dispatchEvent(o),ic=null}else return i=O(a),i!==null&&Dy(i),t.blockedOn=a,!1;i.shift()}return!0}function Py(t,i,a){iu(t)&&a.delete(i)}function Iw(){ah=!1,Ai!==null&&iu(Ai)&&(Ai=null),Ti!==null&&iu(Ti)&&(Ti=null),ji!==null&&iu(ji)&&(ji=null),cl.forEach(Py),fl.forEach(Py)}function su(t,i){t.blockedOn===i&&(t.blockedOn=null,ah||(ah=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Iw)))}var au=null;function qy(t){au!==t&&(au=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){au===t&&(au=null);for(var i=0;i<t.length;i+=3){var a=t[i],o=t[i+1],h=t[i+2];if(typeof o!="function"){if(sh(o||a)===null)continue;break}var p=O(a);p!==null&&(t.splice(i,3),i-=3,rf(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function Xs(t){function i(q){return su(q,t)}Ai!==null&&su(Ai,t),Ti!==null&&su(Ti,t),ji!==null&&su(ji,t),cl.forEach(i),fl.forEach(i);for(var a=0;a<Ni.length;a++){var o=Ni[a];o.blockedOn===t&&(o.blockedOn=null)}for(;0<Ni.length&&(a=Ni[0],a.blockedOn===null);)By(a),a.blockedOn===null&&Ni.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var h=a[o],p=a[o+1],v=h[Pt]||null;if(typeof p=="function")v||qy(a);else if(v){var S=null;if(p&&p.hasAttribute("formAction")){if(h=p,v=p[Pt]||null)S=v.formAction;else if(sh(h)!==null)continue}else S=v.action;typeof S=="function"?a[o+1]=S:(a.splice(o,3),o-=3),qy(a)}}}function Hy(){function t(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(v){return h=v})},focusReset:"manual",scroll:"manual"})}function i(){h!==null&&(h(),h=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function lh(t){this._internalRoot=t}lu.prototype.render=lh.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(s(409));var a=i.current,o=zn();Ry(a,o,t,i,null,null)},lu.prototype.unmount=lh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;Ry(t.current,2,null,t,null,null),Ho(),i[jn]=null}};function lu(t){this._internalRoot=t}lu.prototype.unstable_scheduleHydration=function(t){if(t){var i=Ea();t={blockedOn:null,target:t,priority:i};for(var a=0;a<Ni.length&&i!==0&&i<Ni[a].priority;a++);Ni.splice(a,0,t),a===0&&By(t)}};var Iy=n.version;if(Iy!=="19.2.4")throw Error(s(527,Iy,"19.2.4"));X.findDOMNode=function(t){var i=t._reactInternals;if(i===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=d(i),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var Fw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ou.isDisabled&&ou.supportsFiber)try{Yt=ou.inject(Fw),ge=ou}catch{}}return ml.createRoot=function(t,i){if(!l(t))throw Error(s(299));var a=!1,o="",h=Xp,p=Kp,v=Qp;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(v=i.onRecoverableError)),i=Ny(t,1,!1,null,null,a,o,null,h,p,v,Hy),t[jn]=i.current,If(t),new lh(i)},ml.hydrateRoot=function(t,i,a){if(!l(t))throw Error(s(299));var o=!1,h="",p=Xp,v=Kp,S=Qp,q=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError),a.formState!==void 0&&(q=a.formState)),i=Ny(t,1,!0,i,a??null,o,h,q,p,v,S,Hy),i.context=Oy(null),a=i.current,o=zn(),o=Or(o),h=pi(o),h.callback=null,gi(a,h,o),a=o,i.current.lanes=a,ar(i,a),wr(i),t[jn]=i.current,If(t),new lu(i)},ml.version="19.2.4",ml}var Zy;function eS(){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=Ww(),ch.exports}var tS=eS();/**
50
+ * react-router v7.13.1
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var Wy="popstate";function e0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function nS(e={}){function n(s,l){var d;let u=(d=l.state)==null?void 0:d.masked,{pathname:c,search:f,hash:m}=u||s.location;return Xh("",{pathname:c,search:f,hash:m},l.state&&l.state.usr||null,l.state&&l.state.key||"default",u?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,l){return typeof l=="string"?l:Ml(l)}return iS(n,r,null,e)}function Bt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Cr(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function rS(){return Math.random().toString(36).substring(2,10)}function t0(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Xh(e,n,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?ga(n):n,state:r,key:n&&n.key||s||rS(),unstable_mask:l}}function Ml({pathname:e="/",search:n="",hash:r=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function ga(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(n.search=e.substring(s),e=e.substring(0,s)),e&&(n.pathname=e)}return n}function iS(e,n,r,s={}){let{window:l=document.defaultView,v5Compat:u=!1}=s,c=l.history,f="POP",m=null,d=y();d==null&&(d=0,c.replaceState({...c.state,idx:d},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let P=y(),z=P==null?null:P-d;d=P,m&&m({action:f,location:M.location,delta:z})}function x(P,z){f="PUSH";let I=e0(P)?P:Xh(M.location,P,z);d=y()+1;let j=t0(I,d),K=M.createHref(I.unstable_mask||I);try{c.pushState(j,"",K)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;l.location.assign(K)}u&&m&&m({action:f,location:M.location,delta:1})}function w(P,z){f="REPLACE";let I=e0(P)?P:Xh(M.location,P,z);d=y();let j=t0(I,d),K=M.createHref(I.unstable_mask||I);c.replaceState(j,"",K),u&&m&&m({action:f,location:M.location,delta:0})}function E(P){return sS(P)}let M={get action(){return f},get location(){return e(l,c)},listen(P){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(Wy,g),m=P,()=>{l.removeEventListener(Wy,g),m=null}},createHref(P){return n(l,P)},createURL:E,encodeLocation(P){let z=E(P);return{pathname:z.pathname,search:z.search,hash:z.hash}},push:x,replace:w,go(P){return c.go(P)}};return M}function sS(e,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Bt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Ml(e);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function zb(e,n,r="/"){return aS(e,n,r,!1)}function aS(e,n,r,s){let l=typeof n=="string"?ga(n):n,u=Wr(l.pathname||"/",r);if(u==null)return null;let c=Ub(e);lS(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let d=bS(u);f=gS(c[m],d,s)}return f}function Ub(e,n=[],r=[],s="",l=!1){let u=(c,f,m=l,d)=>{let y={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(s)&&m)return;Bt(y.relativePath.startsWith(s),`Absolute route path "${y.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(s.length)}let g=kr([s,y.relativePath]),x=r.concat(y);c.children&&c.children.length>0&&(Bt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Ub(c.children,n,x,g,m)),!(c.path==null&&!c.index)&&n.push({path:g,score:mS(g,c.index),routesMeta:x})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))u(c,f);else for(let d of Bb(c.path))u(c,f,!0,d)}),n}function Bb(e){let n=e.split("/");if(n.length===0)return[];let[r,...s]=n,l=r.endsWith("?"),u=r.replace(/\?$/,"");if(s.length===0)return l?[u,""]:[u];let c=Bb(s.join("/")),f=[];return f.push(...c.map(m=>m===""?u:[u,m].join("/"))),l&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function lS(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:pS(n.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var oS=/^:[\w-]+$/,uS=3,cS=2,fS=1,hS=10,dS=-2,n0=e=>e==="*";function mS(e,n){let r=e.split("/"),s=r.length;return r.some(n0)&&(s+=dS),n&&(s+=cS),r.filter(l=>!n0(l)).reduce((l,u)=>l+(oS.test(u)?uS:u===""?fS:hS),s)}function pS(e,n){return e.length===n.length&&e.slice(0,-1).every((s,l)=>s===n[l])?e[e.length-1]-n[n.length-1]:0}function gS(e,n,r=!1){let{routesMeta:s}=e,l={},u="/",c=[];for(let f=0;f<s.length;++f){let m=s[f],d=f===s.length-1,y=u==="/"?n:n.slice(u.length)||"/",g=ku({path:m.relativePath,caseSensitive:m.caseSensitive,end:d},y),x=m.route;if(!g&&d&&r&&!s[s.length-1].route.index&&(g=ku({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:kr([u,g.pathname]),pathnameBase:SS(kr([u,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(u=kr([u,g.pathnameBase]))}return c}function ku(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=yS(e.path,e.caseSensitive,e.end),l=n.match(r);if(!l)return null;let u=l[0],c=u.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:s.reduce((d,{paramName:y,isOptional:g},x)=>{if(y==="*"){let E=f[x]||"";c=u.slice(0,u.length-E.length).replace(/(.)\/+$/,"$1")}const w=f[x];return g&&!w?d[y]=void 0:d[y]=(w||"").replace(/%2F/g,"/"),d},{}),pathname:u,pathnameBase:c,pattern:e}}function yS(e,n=!1,r=!0){Cr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,d,y)=>{if(s.push({paramName:f,isOptional:m!=null}),m){let g=y.charAt(d+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,n?void 0:"i"),s]}function bS(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Cr(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${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,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}var xS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function vS(e,n="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?ga(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=r0(r.substring(1),"/"):u=r0(r,n)):u=n,{pathname:u,search:_S(s),hash:ES(l)}}function r0(e,n){let r=n.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?r.length>1&&r.pop():l!=="."&&r.push(l)}),r.length>1?r.join("/"):"/"}function mh(e,n,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function wS(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Pb(e){let n=wS(e);return n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase)}function kd(e,n,r,s=!1){let l;typeof e=="string"?l=ga(e):(l={...e},Bt(!l.pathname||!l.pathname.includes("?"),mh("?","pathname","search",l)),Bt(!l.pathname||!l.pathname.includes("#"),mh("#","pathname","hash",l)),Bt(!l.search||!l.search.includes("#"),mh("#","search","hash",l)));let u=e===""||l.pathname==="",c=u?"/":l.pathname,f;if(c==null)f=r;else{let g=n.length-1;if(!s&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;l.pathname=x.join("/")}f=g>=0?n[g]:"/"}let m=vS(l,f),d=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(d||y)&&(m.pathname+="/"),m}var kr=e=>e.join("/").replace(/\/\/+/g,"/"),SS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),_S=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ES=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,kS=class{constructor(e,n,r,s=!1){this.status=e,this.statusText=n||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function CS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function AS(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var qb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Hb(e,n){let r=e;if(typeof r!="string"||!xS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,l=!1;if(qb)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=Wr(c.pathname,n);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{Cr(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:l,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ib=["POST","PUT","PATCH","DELETE"];new Set(Ib);var TS=["GET",...Ib];new Set(TS);var ya=N.createContext(null);ya.displayName="DataRouter";var Iu=N.createContext(null);Iu.displayName="DataRouterState";var jS=N.createContext(!1),Fb=N.createContext({isTransitioning:!1});Fb.displayName="ViewTransition";var NS=N.createContext(new Map);NS.displayName="Fetchers";var OS=N.createContext(null);OS.displayName="Await";var ir=N.createContext(null);ir.displayName="Navigation";var ql=N.createContext(null);ql.displayName="Location";var Ar=N.createContext({outlet:null,matches:[],isDataRoute:!1});Ar.displayName="Route";var Cd=N.createContext(null);Cd.displayName="RouteError";var $b="REACT_ROUTER_ERROR",RS="REDIRECT",MS="ROUTE_ERROR_RESPONSE";function DS(e){if(e.startsWith(`${$b}:${RS}:{`))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 LS(e){if(e.startsWith(`${$b}:${MS}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new kS(n.status,n.statusText,n.data)}catch{}}function zS(e,{relative:n}={}){Bt(Hl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=N.useContext(ir),{hash:l,pathname:u,search:c}=Il(e,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:kr([r,u])),s.createHref({pathname:f,search:c,hash:l})}function Hl(){return N.useContext(ql)!=null}function Tr(){return Bt(Hl(),"useLocation() may be used only in the context of a <Router> component."),N.useContext(ql).location}var Yb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Gb(e){N.useContext(ir).static||N.useLayoutEffect(e)}function ti(){let{isDataRoute:e}=N.useContext(Ar);return e?KS():US()}function US(){Bt(Hl(),"useNavigate() may be used only in the context of a <Router> component.");let e=N.useContext(ya),{basename:n,navigator:r}=N.useContext(ir),{matches:s}=N.useContext(Ar),{pathname:l}=Tr(),u=JSON.stringify(Pb(s)),c=N.useRef(!1);return Gb(()=>{c.current=!0}),N.useCallback((m,d={})=>{if(Cr(c.current,Yb),!c.current)return;if(typeof m=="number"){r.go(m);return}let y=kd(m,JSON.parse(u),l,d.relative==="path");e==null&&n!=="/"&&(y.pathname=y.pathname==="/"?n:kr([n,y.pathname])),(d.replace?r.replace:r.push)(y,d.state,d)},[n,r,u,l,e])}N.createContext(null);function BS(){let{matches:e}=N.useContext(Ar),n=e[e.length-1];return n?n.params:{}}function Il(e,{relative:n}={}){let{matches:r}=N.useContext(Ar),{pathname:s}=Tr(),l=JSON.stringify(Pb(r));return N.useMemo(()=>kd(e,JSON.parse(l),s,n==="path"),[e,l,s,n])}function PS(e,n){return Vb(e,n)}function Vb(e,n,r){var P;Bt(Hl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=N.useContext(ir),{matches:l}=N.useContext(Ar),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",d=u&&u.route;{let z=d&&d.path||"";Xb(f,!d||z.endsWith("*")||z.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${z}">) 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="${z}"> to <Route path="${z==="/"?"*":`${z}/*`}">.`)}let y=Tr(),g;if(n){let z=typeof n=="string"?ga(n):n;Bt(m==="/"||((P=z.pathname)==null?void 0:P.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 "${z.pathname}" was given in the \`location\` prop.`),g=z}else g=y;let x=g.pathname||"/",w=x;if(m!=="/"){let z=m.replace(/^\//,"").split("/");w="/"+x.replace(/^\//,"").split("/").slice(z.length).join("/")}let E=zb(e,{pathname:w});Cr(d||E!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Cr(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.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=$S(E&&E.map(z=>Object.assign({},z,{params:Object.assign({},c,z.params),pathname:kr([m,s.encodeLocation?s.encodeLocation(z.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:z.pathname]),pathnameBase:z.pathnameBase==="/"?m:kr([m,s.encodeLocation?s.encodeLocation(z.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:z.pathnameBase])})),l,r);return n&&M?N.createElement(ql.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},M):M}function qS(){let e=XS(),n=CS(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:s},u={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=N.createElement(N.Fragment,null,N.createElement("p",null,"💿 Hey developer 👋"),N.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",N.createElement("code",{style:u},"ErrorBoundary")," or"," ",N.createElement("code",{style:u},"errorElement")," prop on your route.")),N.createElement(N.Fragment,null,N.createElement("h2",null,"Unexpected Application Error!"),N.createElement("h3",{style:{fontStyle:"italic"}},n),r?N.createElement("pre",{style:l},r):null,c)}var HS=N.createElement(qS,null),Jb=class extends N.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=LS(e.digest);r&&(e=r)}let n=e!==void 0?N.createElement(Ar.Provider,{value:this.props.routeContext},N.createElement(Cd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?N.createElement(IS,{error:e},n):n}};Jb.contextType=jS;var ph=new WeakMap;function IS({children:e,error:n}){let{basename:r}=N.useContext(ir);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let s=DS(n.digest);if(s){let l=ph.get(n);if(l)throw l;let u=Hb(s.location,r);if(qb&&!ph.get(n))if(u.isExternal||s.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:s.replace}));throw ph.set(n,c),c}return N.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function FS({routeContext:e,match:n,children:r}){let s=N.useContext(ya);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),N.createElement(Ar.Provider,{value:e},r)}function $S(e,n=[],r){let s=r==null?void 0:r.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(n.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let l=e,u=s==null?void 0:s.errors;if(u!=null){let y=l.findIndex(g=>g.route.id&&(u==null?void 0:u[g.route.id])!==void 0);Bt(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),l=l.slice(0,Math.min(l.length,y+1))}let c=!1,f=-1;if(r&&s){c=s.renderFallback;for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=y),g.route.id){let{loaderData:x,errors:w}=s,E=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||E){r.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let m=r==null?void 0:r.onError,d=s&&m?(y,g)=>{var x,w;m(y,{location:s.location,params:((w=(x=s.matches)==null?void 0:x[0])==null?void 0:w.params)??{},unstable_pattern:AS(s.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,x)=>{let w,E=!1,M=null,P=null;s&&(w=u&&g.route.id?u[g.route.id]:void 0,M=g.route.errorElement||HS,c&&(f<0&&x===0?(Xb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,P=null):f===x&&(E=!0,P=g.route.hydrateFallbackElement||null)));let z=n.concat(l.slice(0,x+1)),I=()=>{let j;return w?j=M:E?j=P:g.route.Component?j=N.createElement(g.route.Component,null):g.route.element?j=g.route.element:j=y,N.createElement(FS,{match:g,routeContext:{outlet:y,matches:z,isDataRoute:s!=null},children:j})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?N.createElement(Jb,{location:s.location,revalidation:s.revalidation,component:M,error:w,children:I(),routeContext:{outlet:null,matches:z,isDataRoute:!0},onError:d}):I()},null)}function Ad(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function YS(e){let n=N.useContext(ya);return Bt(n,Ad(e)),n}function GS(e){let n=N.useContext(Iu);return Bt(n,Ad(e)),n}function VS(e){let n=N.useContext(Ar);return Bt(n,Ad(e)),n}function Td(e){let n=VS(e),r=n.matches[n.matches.length-1];return Bt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function JS(){return Td("useRouteId")}function XS(){var s;let e=N.useContext(Cd),n=GS("useRouteError"),r=Td("useRouteError");return e!==void 0?e:(s=n.errors)==null?void 0:s[r]}function KS(){let{router:e}=YS("useNavigate"),n=Td("useNavigate"),r=N.useRef(!1);return Gb(()=>{r.current=!0}),N.useCallback(async(l,u={})=>{Cr(r.current,Yb),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...u}))},[e,n])}var i0={};function Xb(e,n,r){!n&&!i0[e]&&(i0[e]=!0,Cr(!1,r))}N.memo(QS);function QS({routes:e,future:n,state:r,isStatic:s,onError:l}){return Vb(e,void 0,{state:r,isStatic:s,onError:l})}function Mi(e){Bt(!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 ZS({basename:e="/",children:n=null,location:r,navigationType:s="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Bt(!Hl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=N.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=ga(r));let{pathname:d="/",search:y="",hash:g="",state:x=null,key:w="default",unstable_mask:E}=r,M=N.useMemo(()=>{let P=Wr(d,f);return P==null?null:{location:{pathname:P,search:y,hash:g,state:x,key:w,unstable_mask:E},navigationType:s}},[f,d,y,g,x,w,s,E]);return Cr(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:N.createElement(ir.Provider,{value:m},N.createElement(ql.Provider,{children:n,value:M}))}function WS({children:e,location:n}){return PS(Kh(e),n)}function Kh(e,n=[]){let r=[];return N.Children.forEach(e,(s,l)=>{if(!N.isValidElement(s))return;let u=[...n,l];if(s.type===N.Fragment){r.push.apply(r,Kh(s.props.children,u));return}Bt(s.type===Mi,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Bt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||u.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=Kh(s.props.children,u)),r.push(c)}),r}var vu="get",wu="application/x-www-form-urlencoded";function Fu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function e_(e){return Fu(e)&&e.tagName.toLowerCase()==="button"}function t_(e){return Fu(e)&&e.tagName.toLowerCase()==="form"}function n_(e){return Fu(e)&&e.tagName.toLowerCase()==="input"}function r_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function i_(e,n){return e.button===0&&(!n||n==="_self")&&!r_(e)}var uu=null;function s_(){if(uu===null)try{new FormData(document.createElement("form"),0),uu=!1}catch{uu=!0}return uu}var a_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function gh(e){return e!=null&&!a_.has(e)?(Cr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${wu}"`),null):e}function l_(e,n){let r,s,l,u,c;if(t_(e)){let f=e.getAttribute("action");s=f?Wr(f,n):null,r=e.getAttribute("method")||vu,l=gh(e.getAttribute("enctype"))||wu,u=new FormData(e)}else if(e_(e)||n_(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(s=m?Wr(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||vu,l=gh(e.getAttribute("formenctype"))||gh(f.getAttribute("enctype"))||wu,u=new FormData(f,e),!s_()){let{name:d,type:y,value:g}=e;if(y==="image"){let x=d?`${d}.`:"";u.append(`${x}x`,"0"),u.append(`${x}y`,"0")}else d&&u.append(d,g)}}else{if(Fu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=vu,s=null,l=wu,c=e}return u&&l==="text/plain"&&(c=u,u=void 0),{action:s,method:r.toLowerCase(),encType:l,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function jd(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function o_(e,n,r,s){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${s}`:l.pathname=`${l.pathname}.${s}`:l.pathname==="/"?l.pathname=`_root.${s}`:n&&Wr(l.pathname,n)==="/"?l.pathname=`${n.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function u_(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 c_(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 f_(e,n,r){let s=await Promise.all(e.map(async l=>{let u=n.routes[l.route.id];if(u){let c=await u_(u,r);return c.links?c.links():[]}return[]}));return p_(s.flat(1).filter(c_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function s0(e,n,r,s,l,u){let c=(m,d)=>r[d]?m.route.id!==r[d].route.id:!0,f=(m,d)=>{var y;return r[d].pathname!==m.pathname||((y=r[d].route.path)==null?void 0:y.endsWith("*"))&&r[d].params["*"]!==m.params["*"]};return u==="assets"?n.filter((m,d)=>c(m,d)||f(m,d)):u==="data"?n.filter((m,d)=>{var g;let y=s.routes[m.route.id];if(!y||!y.hasLoader)return!1;if(c(m,d)||f(m,d))return!0;if(m.route.shouldRevalidate){let x=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 x=="boolean")return x}return!0}):[]}function h_(e,n,{includeHydrateFallback:r}={}){return d_(e.map(s=>{let l=n.routes[s.route.id];if(!l)return[];let u=[l.module];return l.clientActionModule&&(u=u.concat(l.clientActionModule)),l.clientLoaderModule&&(u=u.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(u=u.concat(l.hydrateFallbackModule)),l.imports&&(u=u.concat(l.imports)),u}).flat(1))}function d_(e){return[...new Set(e)]}function m_(e){let n={},r=Object.keys(e).sort();for(let s of r)n[s]=e[s];return n}function p_(e,n){let r=new Set;return new Set(n),e.reduce((s,l)=>{let u=JSON.stringify(m_(l));return r.has(u)||(r.add(u),s.push({key:u,link:l})),s},[])}function Kb(){let e=N.useContext(ya);return jd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function g_(){let e=N.useContext(Iu);return jd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Nd=N.createContext(void 0);Nd.displayName="FrameworkContext";function Qb(){let e=N.useContext(Nd);return jd(e,"You must render this element inside a <HydratedRouter> element"),e}function y_(e,n){let r=N.useContext(Nd),[s,l]=N.useState(!1),[u,c]=N.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:y,onTouchStart:g}=n,x=N.useRef(null);N.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let M=z=>{z.forEach(I=>{c(I.isIntersecting)})},P=new IntersectionObserver(M,{threshold:.5});return x.current&&P.observe(x.current),()=>{P.disconnect()}}},[e]),N.useEffect(()=>{if(s){let M=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(M)}}},[s]);let w=()=>{l(!0)},E=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,x,{}]:[u,x,{onFocus:pl(f,w),onBlur:pl(m,E),onMouseEnter:pl(d,w),onMouseLeave:pl(y,E),onTouchStart:pl(g,w)}]:[!1,x,{}]}function pl(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function b_({page:e,...n}){let{router:r}=Kb(),s=N.useMemo(()=>zb(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?N.createElement(v_,{page:e,matches:s,...n}):null}function x_(e){let{manifest:n,routeModules:r}=Qb(),[s,l]=N.useState([]);return N.useEffect(()=>{let u=!1;return f_(e,n,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,n,r]),s}function v_({page:e,matches:n,...r}){let s=Tr(),{future:l,manifest:u,routeModules:c}=Qb(),{basename:f}=Kb(),{loaderData:m,matches:d}=g_(),y=N.useMemo(()=>s0(e,n,d,u,s,"data"),[e,n,d,u,s]),g=N.useMemo(()=>s0(e,n,d,u,s,"assets"),[e,n,d,u,s]),x=N.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let M=new Set,P=!1;if(n.forEach(I=>{var K;let j=u.routes[I.route.id];!j||!j.hasLoader||(!y.some(B=>B.route.id===I.route.id)&&I.route.id in m&&((K=c[I.route.id])!=null&&K.shouldRevalidate)||j.hasClientLoader?P=!0:M.add(I.route.id))}),M.size===0)return[];let z=o_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return P&&M.size>0&&z.searchParams.set("_routes",n.filter(I=>M.has(I.route.id)).map(I=>I.route.id).join(",")),[z.pathname+z.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,s,u,y,n,e,c]),w=N.useMemo(()=>h_(g,u),[g,u]),E=x_(g);return N.createElement(N.Fragment,null,x.map(M=>N.createElement("link",{key:M,rel:"prefetch",as:"fetch",href:M,...r})),w.map(M=>N.createElement("link",{key:M,rel:"modulepreload",href:M,...r})),E.map(({key:M,link:P})=>N.createElement("link",{key:M,nonce:r.nonce,...P,crossOrigin:P.crossOrigin??r.crossOrigin})))}function w_(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var S_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{S_&&(window.__reactRouterVersion="7.13.1")}catch{}function __({basename:e,children:n,unstable_useTransitions:r,window:s}){let l=N.useRef();l.current==null&&(l.current=nS({window:s,v5Compat:!0}));let u=l.current,[c,f]=N.useState({action:u.action,location:u.location}),m=N.useCallback(d=>{r===!1?f(d):N.startTransition(()=>f(d))},[r]);return N.useLayoutEffect(()=>u.listen(m),[u,m]),N.createElement(ZS,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var Zb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Wb=N.forwardRef(function({onClick:n,discover:r="render",prefetch:s="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:m,target:d,to:y,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:w,...E},M){let{basename:P,navigator:z,unstable_useTransitions:I}=N.useContext(ir),j=typeof y=="string"&&Zb.test(y),K=Hb(y,P);y=K.to;let B=zS(y,{relative:l}),R=Tr(),Y=null;if(f){let G=kd(f,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);P!=="/"&&(G.pathname=G.pathname==="/"?P:kr([P,G.pathname])),Y=z.createHref(G)}let[J,F,L]=y_(s,E),W=A_(y,{replace:c,unstable_mask:f,state:m,target:d,preventScrollReset:g,relative:l,viewTransition:x,unstable_defaultShouldRevalidate:w,unstable_useTransitions:I});function Q(G){n&&n(G),G.defaultPrevented||W(G)}let oe=!(K.isExternal||u),ae=N.createElement("a",{...E,...L,href:(oe?Y:void 0)||K.absoluteURL||B,onClick:oe?Q:n,ref:w_(M,F),target:d,"data-discover":!j&&r==="render"?"true":void 0});return J&&!j?N.createElement(N.Fragment,null,ae,N.createElement(b_,{page:B})):ae});Wb.displayName="Link";var E_=N.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:s="",end:l=!1,style:u,to:c,viewTransition:f,children:m,...d},y){let g=Il(c,{relative:d.relative}),x=Tr(),w=N.useContext(Iu),{navigator:E,basename:M}=N.useContext(ir),P=w!=null&&R_(g)&&f===!0,z=E.encodeLocation?E.encodeLocation(g).pathname:g.pathname,I=x.pathname,j=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(I=I.toLowerCase(),j=j?j.toLowerCase():null,z=z.toLowerCase()),j&&M&&(j=Wr(j,M)||j);const K=z!=="/"&&z.endsWith("/")?z.length-1:z.length;let B=I===z||!l&&I.startsWith(z)&&I.charAt(K)==="/",R=j!=null&&(j===z||!l&&j.startsWith(z)&&j.charAt(z.length)==="/"),Y={isActive:B,isPending:R,isTransitioning:P},J=B?n:void 0,F;typeof s=="function"?F=s(Y):F=[s,B?"active":null,R?"pending":null,P?"transitioning":null].filter(Boolean).join(" ");let L=typeof u=="function"?u(Y):u;return N.createElement(Wb,{...d,"aria-current":J,className:F,ref:y,style:L,to:c,viewTransition:f},typeof m=="function"?m(Y):m)});E_.displayName="NavLink";var k_=N.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:s,replace:l,state:u,method:c=vu,action:f,onSubmit:m,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x,...w},E)=>{let{unstable_useTransitions:M}=N.useContext(ir),P=N_(),z=O_(f,{relative:d}),I=c.toLowerCase()==="get"?"get":"post",j=typeof f=="string"&&Zb.test(f),K=B=>{if(m&&m(B),B.defaultPrevented)return;B.preventDefault();let R=B.nativeEvent.submitter,Y=(R==null?void 0:R.getAttribute("formmethod"))||c,J=()=>P(R||B.currentTarget,{fetcherKey:n,method:Y,navigate:r,replace:l,state:u,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x});M&&r!==!1?N.startTransition(()=>J()):J()};return N.createElement("form",{ref:E,method:I,action:z,onSubmit:s?m:K,...w,"data-discover":!j&&e==="render"?"true":void 0})});k_.displayName="Form";function C_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ex(e){let n=N.useContext(ya);return Bt(n,C_(e)),n}function A_(e,{target:n,replace:r,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:d}={}){let y=ti(),g=Tr(),x=Il(e,{relative:c});return N.useCallback(w=>{if(i_(w,n)){w.preventDefault();let E=r!==void 0?r:Ml(g)===Ml(x),M=()=>y(e,{replace:E,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});d?N.startTransition(()=>M()):M()}},[g,y,x,r,s,l,n,e,u,c,f,m,d])}var T_=0,j_=()=>`__${String(++T_)}__`;function N_(){let{router:e}=ex("useSubmit"),{basename:n}=N.useContext(ir),r=JS(),s=e.fetch,l=e.navigate;return N.useCallback(async(u,c={})=>{let{action:f,method:m,encType:d,formData:y,body:g}=l_(u,n);if(c.navigate===!1){let x=c.fetcherKey||j_();await s(x,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,l,n,r])}function O_(e,{relative:n}={}){let{basename:r}=N.useContext(ir),s=N.useContext(Ar);Bt(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),u={...Il(e||".",{relative:n})},c=Tr();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:kr([r,u.pathname])),Ml(u)}function R_(e,{relative:n}={}){let r=N.useContext(Fb);Bt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=ex("useViewTransitionState"),l=Il(e,{relative:n});if(!r.isTransitioning)return!1;let u=Wr(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=Wr(r.nextLocation.pathname,s)||r.nextLocation.pathname;return ku(l.pathname,c)!=null||ku(l.pathname,u)!=null}var ca=Lb();const tx=N.createContext(null),nx="palmier_paired_hosts",Qh="palmier_active_host";function yh(){try{const e=localStorage.getItem(nx);if(e)return JSON.parse(e)}catch{}return[]}function M_(e){localStorage.setItem(nx,JSON.stringify(e))}function D_(){return localStorage.getItem(Qh)}function L_(e){e?localStorage.setItem(Qh,e):localStorage.removeItem(Qh)}const z_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function U_({children:e}){const[n,r]=N.useState(yh),[s,l]=N.useState(()=>{const y=D_(),g=yh();return y&&g.some(x=>x.hostId===y)?y:g.length>0?g[0].hostId:null});N.useEffect(()=>{if(!z_)return;const y="local";if(!yh().find(x=>x.hostId===y)){const x={hostId:y,clientToken:"",directUrl:window.location.origin};r(w=>[...w.filter(E=>E.hostId!==y),x]),l(y)}},[]),N.useEffect(()=>{M_(n)},[n]),N.useEffect(()=>{L_(s)},[s]);const u=N.useCallback(y=>{r(g=>[...g.filter(w=>w.hostId!==y.hostId),y]),l(y.hostId)},[]),c=N.useCallback(y=>{r(g=>g.filter(x=>x.hostId!==y)),l(g=>g!==y?g:null)},[]);N.useEffect(()=>{var y;s!==null&&!n.find(g=>g.hostId===s)?l(((y=n[0])==null?void 0:y.hostId)??null):s===null&&n.length>0&&l(n[0].hostId)},[n,s]);const f=N.useCallback((y,g)=>{r(x=>x.map(w=>w.hostId===y?{...w,name:g}:w))},[]),m=N.useCallback(y=>{l(y)},[]),d=N.useCallback(()=>n.find(y=>y.hostId===s)??null,[n,s]);return b.jsx(tx.Provider,{value:{pairedHosts:n,activeHostId:s,addPairedHost:u,removePairedHost:c,renamePairedHost:f,setActiveHostId:m,getActiveHost:d},children:e})}function ba(){const e=N.useContext(tx);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const Fn=new Uint8Array(0),qi=new TextEncoder,qn=new TextDecoder;function B_(...e){let n=0;for(let l=0;l<e.length;l++)n+=e[l].length;const r=new Uint8Array(n);let s=0;for(let l=0;l<e.length;l++)r.set(e[l],s),s+=e[l].length;return r}function Cl(...e){const n=[];for(let r=0;r<e.length;r++)n.push(qi.encode(e[r]));return n.length===0?Fn:n.length===1?n[0]:B_(...n)}function a0(e){return!e||e.length===0?"":qn.decode(e)}const l0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",o0=36,P_=0xcfd41b9100000,u0=33,q_=333,c0=22;function H_(e){for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*255)}function I_(e){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(e):H_(e)}class F_{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(c0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*P_),this.inc=Math.floor(Math.random()*(q_-u0)+u0)}setPre(){const n=new Uint8Array(12);I_(n);for(let r=0;r<12;r++){const s=n[r]%36;this.buf[r]=l0.charCodeAt(s)}}fillSeq(){let n=this.seq;for(let r=c0-1;r>=12;r--)this.buf[r]=l0.charCodeAt(n%o0),n=Math.floor(n/o0)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Bi=new F_;var Kr;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(Kr||(Kr={}));var ra;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(ra||(ra={}));var Ee;(function(e){e.ApiError="BAD API",e.BadAuthentication="BAD_AUTHENTICATION",e.BadCreds="BAD_CREDS",e.BadHeader="BAD_HEADER",e.BadJson="BAD_JSON",e.BadPayload="BAD_PAYLOAD",e.BadSubject="BAD_SUBJECT",e.Cancelled="CANCELLED",e.ConnectionClosed="CONNECTION_CLOSED",e.ConnectionDraining="CONNECTION_DRAINING",e.ConnectionRefused="CONNECTION_REFUSED",e.ConnectionTimeout="CONNECTION_TIMEOUT",e.Disconnect="DISCONNECT",e.InvalidOption="INVALID_OPTION",e.InvalidPayload="INVALID_PAYLOAD",e.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",e.NoResponders="503",e.NotFunction="NOT_FUNC",e.RequestError="REQUEST_ERROR",e.ServerOptionNotAvailable="SERVER_OPT_NA",e.SubClosed="SUB_CLOSED",e.SubDraining="SUB_DRAINING",e.Timeout="TIMEOUT",e.Tls="TLS",e.Unknown="UNKNOWN_ERROR",e.WssRequired="WSS_REQUIRED",e.JetStreamInvalidAck="JESTREAM_INVALID_ACK",e.JetStream404NoMessages="404",e.JetStream408RequestTimeout="408",e.JetStream409MaxAckPendingExceeded="409",e.JetStream409="409",e.JetStreamNotEnabled="503",e.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",e.AuthorizationViolation="AUTHORIZATION_VIOLATION",e.AuthenticationExpired="AUTHENTICATION_EXPIRED",e.ProtocolError="NATS_PROTOCOL_ERR",e.PermissionsViolation="PERMISSIONS_VIOLATION",e.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",e.AccountExpired="ACCOUNT_EXPIRED"})(Ee||(Ee={}));function $_(e){return typeof e.code=="string"}class rx{constructor(){C(this,"messages");this.messages=new Map,this.messages.set(Ee.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(Ee.BadJson,"Bad JSON"),this.messages.set(Ee.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return Y_.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const Y_=new rx;class je extends Error{constructor(r,s,l){super(r);C(this,"name");C(this,"message");C(this,"code");C(this,"permissionContext");C(this,"chainedError");C(this,"api_error");this.name="NatsError",this.message=r,this.code=s,this.chainedError=l}static errorForCode(r,s){const l=rx.getMessage(r);return new je(l,r,s)}isAuthError(){return this.code===Ee.AuthenticationExpired||this.code===Ee.AuthorizationViolation||this.code===Ee.AccountExpired}isAuthTimeout(){return this.code===Ee.AuthenticationTimeout}isPermissionError(){return this.code===Ee.PermissionsViolation}isProtocolError(){return this.code===Ee.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Bn;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(Bn||(Bn={}));var hr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(hr||(hr={}));var Al;(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"})(Al||(Al={}));const Cu="Nats-Service-Error",Au="Nats-Service-Error-Code";class Tu extends Error{constructor(r,s){super(s);C(this,"code");this.code=r}static isServiceError(r){return Tu.toServiceError(r)!==null}static toServiceError(r){var l,u;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(Au))||"";if(s!==""){const c=parseInt(s)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(Cu))||"";return new Tu(c,f.length?f:s)}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}.${Bi.next()}`}const Zh="127.0.0.1";var Li;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Li||(Li={}));function $u(e,...n){for(let r=0;r<n.length;r++){const s=n[r];Object.keys(s).forEach(function(l){e[l]=s[l]})}return e}function cu(e){return qn.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function fa(e,n=!0){const r=n?je.errorForCode(Ee.Timeout):null;let s,l;const u=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?je.errorForCode(Ee.Timeout):r)},e)});return Object.assign(u,s)}function xa(e=0){let n;const r=new Promise(s=>{const l=setTimeout(()=>{s()},e);n={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,n)}function zt(){let e={};const n=new Promise((r,s)=>{e={resolve:r,reject:s}});return Object.assign(n,e)}function ix(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 G_(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function Od(e=[0,250,250,500,500,3e3,5e3]){Array.isArray(e)||(e=[0,250,250,500,500,3e3,5e3]);const n=e.length-1;return{backoff(r){return G_(r>n?e[n]:e[r])}}}function Lt(e){return e*1e6}function Rd(e){return Math.floor(e/1e6)}function f0(e){let s=!0;const l=new Array(e.length);for(let u=0;u<e.length;u++){let c=e.charCodeAt(u);if(c===58||c<33||c>126)throw new je(`'${e[u]}' is not a valid character for a header key`,Ee.BadHeader);s&&97<=c&&c<=122?c-=32:!s&&65<=c&&c<=90&&(c+=32),l[u]=c,s=c==45}return String.fromCharCode(...l)}function ei(e=0,n=""){if(e===0&&n!==""||e>0&&n==="")throw new Error("setting status requires both code and description");return new zi(e,n)}const bh="NATS/1.0";class zi{constructor(n=0,r=""){C(this,"_code");C(this,"headers");C(this,"_description");this._code=n,this._description=r,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[r,s]of this.headers){const l=n.values(r);if(s.length!==l.length)return!1;const u=[...s].sort(),c=[...l].sort();for(let f=0;f<u.length;f++)if(u[f]!==c[f])return!1}return!0}return!1}static decode(n){const r=new zi,l=qn.decode(n).split(`\r
61
+ `),u=l[0];if(u!==bh){let c=u.replace(bh,"").trim();if(c.length>0){r._code=parseInt(c,10),isNaN(r._code)&&(r._code=0);const f=r._code.toString();c=c.replace(f,""),r._description=c.trim()}}return l.length>=1&&l.slice(1).map(c=>{if(c){const f=c.indexOf(":");if(f>-1){const m=c.slice(0,f),d=c.slice(f+1).trim();r.append(m,d)}}}),r}toString(){if(this.headers.size===0&&this._code===0)return"";let n=bh;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[r,s]of this.headers)for(let l=0;l<s.length;l++)n=`${n}\r
62
+ ${r}: ${s[l]}`;return`${n}\r
63
+ \r
64
+ `}encode(){return qi.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new je("invalid header value - \\r and \\n are not allowed.",Ee.BadHeader);return n.trim()}keys(){const n=[];for(const r of this.headers.keys())n.push(r);return n}findKeys(n,r=Bn.Exact){const s=this.keys();switch(r){case Bn.Exact:return s.filter(l=>l===n);case Bn.CanonicalMIME:return n=f0(n),s.filter(l=>l===n);default:{const l=n.toLowerCase();return s.filter(u=>l===u.toLowerCase())}}}get(n,r=Bn.Exact){const s=this.findKeys(n,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(n,r=Bn.Exact){const s=this.findKeys(n,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(n,r=Bn.Exact){return this.findKeys(n,r).length>0}set(n,r,s=Bn.Exact){this.delete(n,s),this.append(n,r,s)}append(n,r,s=Bn.Exact){const l=f0(n);s===Bn.CanonicalMIME&&(n=l);const u=this.findKeys(n,s);n=u.length>0?u[0]:n;const c=zi.validHeaderValue(r);let f=this.headers.get(n);f||(f=[],this.headers.set(n,f)),f.push(c)}values(n,r=Bn.Exact){const s=[];return this.findKeys(n,r).forEach(u=>{const c=this.headers.get(u);c&&s.push(...c)}),s}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 zi;for(const s in n)r.headers.set(s,n[s]);return r}}function ju(){return{encode(e){return qi.encode(e)},decode(e){return qn.decode(e)}}}function dr(e){return{encode(n){try{return n===void 0&&(n=null),qi.encode(JSON.stringify(n))}catch(r){throw je.errorForCode(Ee.BadJson,r)}},decode(n){try{return JSON.parse(qn.decode(n),e)}catch(r){throw je.errorForCode(Ee.BadJson,r)}}}}function sx(e){var n;return e&&e.data.length===0&&((n=e.headers)==null?void 0:n.code)===503?je.errorForCode(Ee.NoResponders):null}class Md{constructor(n,r,s){C(this,"_headers");C(this,"_msg");C(this,"_rdata");C(this,"_reply");C(this,"_subject");C(this,"publisher");this._msg=n,this._rdata=r,this.publisher=s}get subject(){return this._subject?this._subject:(this._subject=qn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=qn.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=zi.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,s=this._msg.size===-1?0:this._msg.size;return n+r+s}json(n){return dr(n).decode(this.data)}string(){return qn.decode(this.data)}requestInfo(){var r;const n=(r=this.headers)==null?void 0:r.get("Nats-Request-Info");return n?JSON.parse(n,function(s,l){return(s==="start"||s==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}C(Md,"jc");function ia(e){return Yu("durable",e)}function dn(e){return Yu("stream",e)}function Yu(e,n=""){if(n==="")throw Error(`${e} name required`);return[".","*",">","/","\\"," "," ",`
65
+ `,"\r"].forEach(s=>{if(n.indexOf(s)!==-1){switch(s){case`
66
+ `:s="\\n";break;case"\r":s="\\r";break;case" ":s="\\t";break}throw Error(`invalid ${e} name - ${e} name cannot contain '${s}'`)}}),""}function El(e,n=""){if(n==="")throw Error(`${e} name required`);const r=V_(n);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function V_(e=""){if(e==="")throw Error("name required");const n=/^[-\w]+$/g;if(e.match(n)===null){for(const s of e.split(""))if(s.match(n)===null)return`cannot contain '${s}'`}return""}function Wh(e){if(e.data.length>0)return!1;const n=e.headers;return n?n.code>=100&&n.code<200:!1}function ed(e){var n;return Wh(e)&&((n=e.headers)==null?void 0:n.description)==="Idle Heartbeat"}function J_(e,n,r){const s=ei(e,n),l={hdr:1,sid:0,size:0},u=new Md(l,Fn,{});return u._headers=s,u._subject=r,u}function sa(e){if(e.data.length!==0)return null;const n=e.headers;return n?ax(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 X_(e){return e.code!==Ee.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 ax(e,n=""){if(e<300)return null;switch(n=n.toLowerCase(),e){case 404:return new je(n,Ee.JetStream404NoMessages);case 408:return new je(n,Ee.JetStream408RequestTimeout);case 409:{const r=n.startsWith(nr.IdleHeartbeatMissed)?Ee.JetStreamIdleHeartBeat:Ee.JetStream409;return new je(n,r)}case 503:return je.errorForCode(Ee.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=Ee.Unknown),new je(n,`${e}`)}}class tn{constructor(){C(this,"inflight");C(this,"processed");C(this,"received");C(this,"noIterator");C(this,"iterClosed");C(this,"done");C(this,"signal");C(this,"yields");C(this,"filtered");C(this,"pendingFiltered");C(this,"ingestionFilterFn");C(this,"protocolFilterFn");C(this,"dispatchedFn");C(this,"ctx");C(this,"_data");C(this,"err");C(this,"time");C(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=zt(),this.yields=[],this.iterClosed=zt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:r,protocol:s}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};r&&(s&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new je("unsupported iterator",Ee.ApiError);if(this.yielding)throw new je("already yielding",Ee.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let r=0;r<n.length;r++){if(typeof n[r]=="function"){const l=n[r];try{l()}catch(u){throw u}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[r]):!0){this.processed++;const l=Date.now();yield n[r],this.time=Date.now()-l,this.dispatchedFn&&n[r]&&this.dispatchedFn(n[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=zt())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Dd{constructor(n,r,s={maxOut:2}){C(this,"interval");C(this,"maxOut");C(this,"cancelAfter");C(this,"timer");C(this,"autoCancelTimer");C(this,"last");C(this,"missed");C(this,"count");C(this,"callback");this.interval=n,this.maxOut=(s==null?void 0:s.maxOut)||2,this.cancelAfter=(s==null?void 0:s.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,r=0,s=2){this.interval=n,this.maxOut=s,this.cancelAfter=r,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var td;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(td||(td={}));var Dl;(function(e){e.Old="old",e.New="new"})(Dl||(Dl={}));var nd;(function(e){e.File="file",e.Memory="memory"})(nd||(nd={}));var $t;(function(e){e.All="all",e.Last="last",e.New="new",e.StartSequence="by_start_sequence",e.StartTime="by_start_time",e.LastPerSubject="last_per_subject"})($t||($t={}));var en;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(en||(en={}));var ha;(function(e){e.Instant="instant",e.Original="original"})(ha||(ha={}));var Pi;(function(e){e.None="none",e.S2="s2"})(Pi||(Pi={}));var Nu;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Nu||(Nu={}));function K_(e,n={}){return Object.assign({name:e,deliver_policy:$t.All,ack_policy:en.Explicit,ack_wait:Lt(30*1e3),replay_policy:ha.Instant},n)}var h0;(function(e){e.API="api_audit",e.StreamAction="stream_action",e.ConsumerAction="consumer_action",e.SnapshotCreate="snapshot_create",e.SnapshotComplete="snapshot_complete",e.RestoreCreate="restore_create",e.RestoreComplete="restore_complete",e.MaxDeliver="max_deliver",e.Terminated="terminated",e.Ack="consumer_ack",e.StreamLeaderElected="stream_leader_elected",e.StreamQuorumLost="stream_quorum_lost",e.ConsumerLeaderElected="consumer_leader_elected",e.ConsumerQuorumLost="consumer_quorum_lost"})(h0||(h0={}));var yn;(function(e){e.StreamSourceHdr="Nats-Stream-Source",e.LastConsumerSeqHdr="Nats-Last-Consumer",e.LastStreamSeqHdr="Nats-Last-Stream",e.ConsumerStalledHdr="Nats-Consumer-Stalled",e.MessageSizeHdr="Nats-Msg-Size",e.RollupHdr="Nats-Rollup",e.RollupValueSubject="sub",e.RollupValueAll="all",e.PendingMessagesHdr="Nats-Pending-Messages",e.PendingBytesHdr="Nats-Pending-Bytes"})(yn||(yn={}));var fr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(fr||(fr={}));var ta;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(ta||(ta={}));var d0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(d0||(d0={}));const Pn="KV_";class Q_{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=K_("",n||{})}getOpts(){var r;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((r=n.config.filter_subjects)==null||r.forEach(s=>{this.filterSubject(s)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?en.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return ia(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=$t.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=$t.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=$t.All,this}deliverLastPerSubject(){return this.config.deliver_policy=$t.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=$t.Last,this}deliverNew(){return this.config.deliver_policy=$t.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=en.None,this}ackAll(){return this.config.ack_policy=en.All,this}ackExplicit(){return this.config.ack_policy=en.Explicit,this}ackWait(n){return this.config.ack_wait=Lt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=ha.Instant,this}replayOriginal(){return this.config.replay_policy=ha.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=Lt(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=Lt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=Lt(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 Ui(e){return new Q_(e)}function m0(e){return typeof e.getOpts=="function"}class Z_{static encode(n){if(typeof n=="string")return btoa(n);const r=Array.from(n);return btoa(String.fromCharCode(...r))}static decode(n,r=!1){const s=atob(n);return r?Uint8Array.from(s,l=>l.charCodeAt(0)):s}}class aa{static encode(n){return aa.toB64URLEncoding(Z_.encode(n))}static decode(n,r=!1){return aa.decode(aa.fromB64URLEncoding(n),r)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class da{constructor(){C(this,"buffers");C(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let r=0;for(let u=0;u<n.length;u++)r+=n[u].length;const s=new Uint8Array(r);let l=0;for(let u=0;u<n.length;u++)s.set(n[u],l),l+=n[u].length;return s}static fromAscii(n){return n||(n=""),qi.encode(n)}static toAscii(n){return qn.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let r=0;for(let s=0;s<this.buffers.length;s++)n.set(this.buffers[s],r),r+=this.buffers[s].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const r=this.buffers.pop();if(r){const s=this.byteLength;(n===void 0||n>s)&&(n=s);const l=r.subarray(0,n);return s>n&&this.buffers.push(r.subarray(n)),this.byteLength=s-n,l}}return new Uint8Array(0)}fill(n,...r){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let s=0;s<r.length;s++)r[s]&&r[s].length&&(this.buffers.push(r[s]),this.byteLength+=r[s].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function W_(e,n){return n.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(s){if(s!=="default"&&!(s in e)){var l=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,l.get?l:{enumerable:!0,get:function(){return r[s]}})}})}),Object.freeze(e)}var e2=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},gl=e2.performance||{};gl.now||gl.mozNow||gl.msNow||gl.oNow||gl.webkitNow;var p0={versions:{}},t2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function n2(e){if(e.__esModule)return e;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var xh,Gu={exports:{}},g0={},y0=n2(W_({__proto__:null,default:g0},[g0]));xh=Gu,(function(){var e="input is invalid type",n=typeof window=="object",r=n?window:{};r.JS_SHA256_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&p0.versions&&p0.versions.node;l?r=t2:s&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&xh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),m=[-2147483648,8388608,32768,128],d=[24,16,8,0],y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],g=["hex","array","digest","arrayBuffer"],x=[];!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,R){return function(Y){return new I(R,!0).update(Y)[B]()}},E=function(B){var R=w("hex",B);l&&(R=M(R,B)),R.create=function(){return new I(B)},R.update=function(F){return R.create().update(F)};for(var Y=0;Y<g.length;++Y){var J=g[Y];R[J]=w(J,B)}return R},M=function(B,R){var Y,J=y0,F=y0.Buffer,L=R?"sha224":"sha256";return Y=F.from&&!r.JS_SHA256_NO_BUFFER_FROM?F.from:function(W){return new F(W)},function(W){if(typeof W=="string")return J.createHash(L).update(W,"utf8").digest("hex");if(W==null)throw new Error(e);return W.constructor===ArrayBuffer&&(W=new Uint8Array(W)),Array.isArray(W)||ArrayBuffer.isView(W)||W.constructor===F?J.createHash(L).update(Y(W)).digest("hex"):B(W)}},P=function(B,R){return function(Y,J){return new j(Y,R,!0).update(J)[B]()}},z=function(B){var R=P("hex",B);R.create=function(F){return new j(F,B)},R.update=function(F,L){return R.create(F).update(L)};for(var Y=0;Y<g.length;++Y){var J=g[Y];R[J]=P(J,B)}return R};function I(B,R){R?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],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 j(B,R,Y){var J,F=typeof B;if(F==="string"){var L,W=[],Q=B.length,oe=0;for(J=0;J<Q;++J)(L=B.charCodeAt(J))<128?W[oe++]=L:L<2048?(W[oe++]=192|L>>>6,W[oe++]=128|63&L):L<55296||L>=57344?(W[oe++]=224|L>>>12,W[oe++]=128|L>>>6&63,W[oe++]=128|63&L):(L=65536+((1023&L)<<10|1023&B.charCodeAt(++J)),W[oe++]=240|L>>>18,W[oe++]=128|L>>>12&63,W[oe++]=128|L>>>6&63,W[oe++]=128|63&L);B=W}else{if(F!=="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 I(R,!0).update(B).array());var ae=[],G=[];for(J=0;J<64;++J){var H=B[J]||0;ae[J]=92^H,G[J]=54^H}I.call(this,R,Y),this.update(G),this.oKeyPad=ae,this.inner=!0,this.sharedMemory=Y}I.prototype.update=function(B){if(!this.finalized){var R,Y=typeof B;if(Y!=="string"){if(Y!=="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);R=!0}for(var J,F,L=0,W=B.length,Q=this.blocks;L<W;){if(this.hashed&&(this.hashed=!1,Q[0]=this.block,this.block=Q[16]=Q[1]=Q[2]=Q[3]=Q[4]=Q[5]=Q[6]=Q[7]=Q[8]=Q[9]=Q[10]=Q[11]=Q[12]=Q[13]=Q[14]=Q[15]=0),R)for(F=this.start;L<W&&F<64;++L)Q[F>>>2]|=B[L]<<d[3&F++];else for(F=this.start;L<W&&F<64;++L)(J=B.charCodeAt(L))<128?Q[F>>>2]|=J<<d[3&F++]:J<2048?(Q[F>>>2]|=(192|J>>>6)<<d[3&F++],Q[F>>>2]|=(128|63&J)<<d[3&F++]):J<55296||J>=57344?(Q[F>>>2]|=(224|J>>>12)<<d[3&F++],Q[F>>>2]|=(128|J>>>6&63)<<d[3&F++],Q[F>>>2]|=(128|63&J)<<d[3&F++]):(J=65536+((1023&J)<<10|1023&B.charCodeAt(++L)),Q[F>>>2]|=(240|J>>>18)<<d[3&F++],Q[F>>>2]|=(128|J>>>12&63)<<d[3&F++],Q[F>>>2]|=(128|J>>>6&63)<<d[3&F++],Q[F>>>2]|=(128|63&J)<<d[3&F++]);this.lastByteIndex=F,this.bytes+=F-this.start,F>=64?(this.block=Q[16],this.start=F-64,this.hash(),this.hashed=!0):this.start=F}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},I.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var B=this.blocks,R=this.lastByteIndex;B[16]=this.block,B[R>>>2]|=m[3&R],this.block=B[16],R>=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()}},I.prototype.hash=function(){var B,R,Y,J,F,L,W,Q,oe,ae=this.h0,G=this.h1,H=this.h2,X=this.h3,ue=this.h4,_e=this.h5,_=this.h6,D=this.h7,ee=this.blocks;for(B=16;B<64;++B)R=((F=ee[B-15])>>>7|F<<25)^(F>>>18|F<<14)^F>>>3,Y=((F=ee[B-2])>>>17|F<<15)^(F>>>19|F<<13)^F>>>10,ee[B]=ee[B-16]+R+ee[B-7]+Y|0;for(oe=G&H,B=0;B<64;B+=4)this.first?(this.is224?(L=300032,D=(F=ee[0]-1413257819)-150054599|0,X=F+24177077|0):(L=704751109,D=(F=ee[0]-210244248)-1521486534|0,X=F+143694565|0),this.first=!1):(R=(ae>>>2|ae<<30)^(ae>>>13|ae<<19)^(ae>>>22|ae<<10),J=(L=ae&G)^ae&H^oe,D=X+(F=D+(Y=(ue>>>6|ue<<26)^(ue>>>11|ue<<21)^(ue>>>25|ue<<7))+(ue&_e^~ue&_)+y[B]+ee[B])|0,X=F+(R+J)|0),R=(X>>>2|X<<30)^(X>>>13|X<<19)^(X>>>22|X<<10),J=(W=X&ae)^X&G^L,_=H+(F=_+(Y=(D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&ue^~D&_e)+y[B+1]+ee[B+1])|0,R=((H=F+(R+J)|0)>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),J=(Q=H&X)^H&ae^W,_e=G+(F=_e+(Y=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&D^~_&ue)+y[B+2]+ee[B+2])|0,R=((G=F+(R+J)|0)>>>2|G<<30)^(G>>>13|G<<19)^(G>>>22|G<<10),J=(oe=G&H)^G&X^Q,ue=ae+(F=ue+(Y=(_e>>>6|_e<<26)^(_e>>>11|_e<<21)^(_e>>>25|_e<<7))+(_e&_^~_e&D)+y[B+3]+ee[B+3])|0,ae=F+(R+J)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+ae|0,this.h1=this.h1+G|0,this.h2=this.h2+H|0,this.h3=this.h3+X|0,this.h4=this.h4+ue|0,this.h5=this.h5+_e|0,this.h6=this.h6+_|0,this.h7=this.h7+D|0},I.prototype.hex=function(){this.finalize();var B=this.h0,R=this.h1,Y=this.h2,J=this.h3,F=this.h4,L=this.h5,W=this.h6,Q=this.h7,oe=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[R>>>28&15]+f[R>>>24&15]+f[R>>>20&15]+f[R>>>16&15]+f[R>>>12&15]+f[R>>>8&15]+f[R>>>4&15]+f[15&R]+f[Y>>>28&15]+f[Y>>>24&15]+f[Y>>>20&15]+f[Y>>>16&15]+f[Y>>>12&15]+f[Y>>>8&15]+f[Y>>>4&15]+f[15&Y]+f[J>>>28&15]+f[J>>>24&15]+f[J>>>20&15]+f[J>>>16&15]+f[J>>>12&15]+f[J>>>8&15]+f[J>>>4&15]+f[15&J]+f[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[L>>>28&15]+f[L>>>24&15]+f[L>>>20&15]+f[L>>>16&15]+f[L>>>12&15]+f[L>>>8&15]+f[L>>>4&15]+f[15&L]+f[W>>>28&15]+f[W>>>24&15]+f[W>>>20&15]+f[W>>>16&15]+f[W>>>12&15]+f[W>>>8&15]+f[W>>>4&15]+f[15&W];return this.is224||(oe+=f[Q>>>28&15]+f[Q>>>24&15]+f[Q>>>20&15]+f[Q>>>16&15]+f[Q>>>12&15]+f[Q>>>8&15]+f[Q>>>4&15]+f[15&Q]),oe},I.prototype.toString=I.prototype.hex,I.prototype.digest=function(){this.finalize();var B=this.h0,R=this.h1,Y=this.h2,J=this.h3,F=this.h4,L=this.h5,W=this.h6,Q=this.h7,oe=[B>>>24&255,B>>>16&255,B>>>8&255,255&B,R>>>24&255,R>>>16&255,R>>>8&255,255&R,Y>>>24&255,Y>>>16&255,Y>>>8&255,255&Y,J>>>24&255,J>>>16&255,J>>>8&255,255&J,F>>>24&255,F>>>16&255,F>>>8&255,255&F,L>>>24&255,L>>>16&255,L>>>8&255,255&L,W>>>24&255,W>>>16&255,W>>>8&255,255&W];return this.is224||oe.push(Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q),oe},I.prototype.array=I.prototype.digest,I.prototype.arrayBuffer=function(){this.finalize();var B=new ArrayBuffer(this.is224?28:32),R=new DataView(B);return R.setUint32(0,this.h0),R.setUint32(4,this.h1),R.setUint32(8,this.h2),R.setUint32(12,this.h3),R.setUint32(16,this.h4),R.setUint32(20,this.h5),R.setUint32(24,this.h6),this.is224||R.setUint32(28,this.h7),B},j.prototype=new I,j.prototype.finalize=function(){if(I.prototype.finalize.call(this),this.inner){this.inner=!1;var B=this.array();I.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(B),I.prototype.finalize.call(this)}};var K=E();K.sha256=K,K.sha224=E(!0),K.sha256.hmac=z(),K.sha224.hmac=z(!0),u?xh.exports=K:(r.sha256=K.sha256,r.sha224=K.sha224)})();Gu.exports;Gu.exports.sha224;var b0=Gu.exports.sha256;function rd(e){return o2(e)}function r2(e){if(!/^[0-9A-Fa-f]+$/.test(e))return!1;const r=/^[0-9A-F]+$/.test(e),s=/^[0-9a-f]+$/.test(e);return r||s?e.length%2===0:!1}function i2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function s2(e){return r2(e)?"hex":i2(e)?"b64":""}function a2(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 l2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))}function o2(e){switch(s2(e)){case"hex":return a2(e);case"b64":return l2(e)}return null}function u2(e,n){const r=typeof e=="string"?rd(e):e,s=typeof n=="string"?rd(n):n;if(r===null||s===null||r.length!==s.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==s[l])return!1;return!0}class lx{constructor(n,r,s=!0){C(this,"token");C(this,"received");C(this,"ctx");C(this,"requestSubject");C(this,"mux");this.mux=n,this.requestSubject=r,this.received=0,this.token=Bi.next(),s&&(this.ctx=new Error)}}class c2 extends lx{constructor(r,s,l={maxWait:1e3}){super(r,s);C(this,"callback");C(this,"done");C(this,"timer");C(this,"max");C(this,"opts");if(this.opts=l,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1,this.done=zt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(r){r&&this.callback(r,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(r,s){r?(this.ctx&&(r.stack+=`
67
+
68
+ ${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===hr.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===hr.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===hr.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class ox extends lx{constructor(r,s,l={timeout:1e3},u=!0){super(r,s,u);C(this,"deferred");C(this,"timer");this.deferred=zt(),this.timer=fa(l.timeout,u)}resolver(r,s){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
69
+
70
+ ${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(s),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||je.errorForCode(Ee.Cancelled))}}const f2="$JS.API";function h2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),$u({apiPrefix:f2,timeout:5e3},e)}class Fl{constructor(n,r){C(this,"nc");C(this,"opts");C(this,"prefix");C(this,"timeout");C(this,"jc");this.nc=n,this.opts=h2(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=dr()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,r=null,s){s=s||{},s.timeout=this.timeout;let l=Fn;r&&(l=this.jc.encode(r));let{retries:u}=s;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=Od();for(let f=0;f<u;f++)try{const m=await this.nc.request(n,l,s);return this.parseJsResponse(m)}catch(m){const d=m;if((d.code==="503"||d.code===Ee.Timeout)&&f+1<u)await xa(c.backoff(f));else throw m}}async findStream(n){const r={subject:n},l=await this._request(`${this.prefix}.STREAM.NAMES`,r);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const r=this.jc.decode(n.data),s=r;if(s.error){const l=ax(s.error.code,s.error.description);if(l!==null)throw l.api_error=s.error,l}return r}}class kl{constructor(n,r,s,l){C(this,"err");C(this,"offset");C(this,"pageInfo");C(this,"subject");C(this,"jsm");C(this,"filter");C(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=s,this.offset=0,this.pageInfo={},this.filter=r,this.payload=l||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const r=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=r;const s=this.countResponse(r);return s===0?[]:(this.offset+=s,this.filter(r))}catch(r){throw this.err=r,r}}countResponse(n){var r,s,l;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((r=n.streams)==null?void 0:r.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((s=n.consumers)==null?void 0:s.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((l=n.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const r of n)yield r;n=await this.next()}}}function fs(e=""){const n=e.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${e}' is not a semver value`)}function id(e,n){return e.major<n.major?-1:e.major>n.major?1:e.minor<n.minor?-1:e.minor>n.minor?1:e.micro<n.micro?-1:e.micro>n.micro?1:0}var at;(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"})(at||(at={}));class d2{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=fs(n)),this.server=n,this.set(at.JS_KV,"2.6.2"),this.set(at.JS_OBJECTSTORE,"2.6.3"),this.set(at.JS_PULL_MAX_BYTES,"2.8.3"),this.set(at.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(at.JS_ALLOW_DIRECT,"2.9.0"),this.set(at.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(at.JS_SIMPLIFICATION,"2.9.4"),this.set(at.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(at.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(at.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(at.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(at.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(at.JS_STREAM_COMPRESSION,"2.10.0"),this.set(at.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(at.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(r=>{this.features.delete(r)})}set(n,r){this.features.set(n,{min:r,ok:id(this.server,fs(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=fs(n)),id(this.server,n)>=0}}class Ou extends Fl{constructor(n,r){super(n,r)}async add(n,r,s=Nu.Create){if(dn(n),r.deliver_group&&r.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(r.deliver_group&&r.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=r,l.stream_name=n,l.action=s,l.config.durable_name&&ia(l.config.durable_name);const u=this.nc;let{min:c,ok:f}=u.features.get(at.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{Yu("name",m)}catch(x){const w=x.message,E=w.indexOf("cannot contain");throw E!==-1?new Error(`consumer 'name' ${w.substring(E)}`):x}let d,y="";if(Array.isArray(r.filter_subjects)){const{min:x,ok:w}=u.features.get(at.JS_MULTIPLE_CONSUMER_FILTER);if(!w)throw new Error(`consumer 'filter_subjects' requires server ${x}`);f=!1}if(r.metadata){const{min:x,ok:w}=u.features.get(at.JS_STREAM_CONSUMER_METADATA);if(!w)throw new Error(`consumer 'metadata' requires server ${x}`)}if(f&&(y=r.name??r.durable_name??""),y!==""){let x=r.filter_subject??void 0;x===">"&&(x=void 0),d=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${y}.${x}`:`${this.prefix}.CONSUMER.CREATE.${n}.${y}`}else d=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(d,l)}async update(n,r,s){const l=await this.info(n,r),u=s;return this.add(n,Object.assign(l.config,u),Nu.Update)}async info(n,r){return dn(n),ia(r),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${r}`)}async delete(n,r){return dn(n),ia(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${r}`)).success}list(n){dn(n);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${n}`;return new kl(s,r,this)}pause(n,r,s){const l=`${this.prefix}.CONSUMER.PAUSE.${n}.${r}`,u={pause_until:s.toISOString()};return this._request(l,u)}resume(n,r){return this.pause(n,r,new Date(0))}}function Ks(e,n,r=!1){if(r===!0&&!e)throw je.errorForCode(Ee.ApiError,new Error(`${n} is not a function`));if(e&&typeof e!="function")throw je.errorForCode(Ee.ApiError,new Error(`${n} is not a function`))}class m2 extends tn{constructor(r,s,l){super();C(this,"sub");C(this,"adapter");C(this,"subIterDone");Ks(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&Ks(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(Ks(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(Ks(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(Ks(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&Ks(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,x)=>{const[w,E]=this.adapter(g,x);if(w){y(w,null);return}const{ingest:M}=this.ingestionFilterFn?this.ingestionFilterFn(E,this):{ingest:!0};M&&(!this.protocolFilterFn||this.protocolFilterFn(E))&&(y(w,E),this.dispatchedFn&&E&&this.dispatchedFn(E))}}const{max:c,queue:f,timeout:m}=l,d={queue:f,timeout:m,callback:u};c&&c>0&&(d.max=c),this.sub=r.subscribe(s,d),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=zt(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async y=>{await y.closed,this.stop()})(this.sub).then().catch()}unsubscribe(r){this.sub.unsubscribe(r)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(r,s){this.sub.cancelTimeout();const[l,u]=this.adapter(r,s);l&&this.stop(l),u&&this.push(u)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let Hn;function p2(e){Hn=e}function ux(){return Hn!==void 0&&Hn.defaultPort!==void 0?Hn.defaultPort:4222}function vh(){return Hn!==void 0&&Hn.urlParseFn?Hn.urlParseFn:void 0}function g2(){if(!Hn||typeof Hn.factory!="function")throw new Error("transport fn is not set");return Hn.factory()}function sd(){return Hn!==void 0&&Hn.dnsResolveFn?Hn.dnsResolveFn:void 0}const Su=`\r
71
+ `,Ru=da.fromAscii(Su),y2=new Uint8Array(Ru)[0],b2=new Uint8Array(Ru)[1];function x2(e){for(let n=0;n<e.length;n++){const r=n+1;if(e.byteLength>r&&e[n]===y2&&e[r]===b2)return r+1}return 0}function v2(e){const n=x2(e);if(n>0){const s=new Uint8Array(e).slice(0,n);return qn.decode(s)}return""}const w2=4,cx=48,S2=65,_2=97;function E2(e,n,r,s){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((c,f)=>{l[f]=c}),l[12]=e,l[13]=n,l[14]=r,l[15]=s,l}function ad(e){return k2(e)!==void 0}function k2(e){for(let n=0;n<e.length;n++)switch(e[n]){case".":return fx(e);case":":return C2(e)}}function fx(e){const n=new Uint8Array(4);for(let r=0;r<4;r++){if(e.length===0)return;if(r>0){if(e[0]!==".")return;e=e.substring(1)}const{n:s,c:l,ok:u}=A2(e);if(!u||s>255)return;e=e.substring(l),n[r]=s}return E2(n[0],n[1],n[2],n[3])}function C2(e){const n=new Uint8Array(16);let r=-1;if(e.length>=2&&e[0]===":"&&e[1]===":"&&(r=0,e=e.substring(2),e.length===0))return n;let s=0;for(;s<16;){const{n:l,c:u,ok:c}=T2(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&s!=12||s+4>16)return;const f=fx(e);if(f===void 0)return;n[s]=f[12],n[s+1]=f[13],n[s+2]=f[14],n[s+3]=f[15],e="",s+=w2;break}if(n[s]=l>>8,n[s+1]=l,s+=2,e=e.substring(u),e.length===0)break;if(e[0]!==":"||e.length==1)return;if(e=e.substring(1),e[0]===":"){if(r>=0)return;if(r=s,e=e.substring(1),e.length===0)break}}if(e.length===0){if(s<16){if(r<0)return;const l=16-s;for(let u=s-1;u>=r;u--)n[u+l]=n[u];for(let u=r+l-1;u>=r;u--)n[u]=0}else if(r>=0)return;return n}}function A2(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)-cx),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 T2(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)-cx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)n*=16,n+=e.charCodeAt(r)-_2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)n*=16,n+=e.charCodeAt(r)-S2+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 j2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function ld(e){return!j2(e)}function N2(e){const n="::FFFF:",r=e.toUpperCase().indexOf(n);if(r!==-1&&e.indexOf(".")!==-1){let s=e.substring(r+n.length);return s=s.replace("[",""),s.replace("]","")}return e}function O2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=N2(e),ld(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const n=ld(e)?e.match(/(]:)(\d+)/):e.match(/(:)(\d+)/),r=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,s=r===80?"https":"http",l=new URL(`${s}://${e}`);l.port=`${r}`;let u=l.hostname;return u.charAt(0)==="["&&(u=u.substring(1,u.length-1)),{listen:l.host,hostname:u,port:r}}class Tl{constructor(n,r=!1){C(this,"src");C(this,"listen");C(this,"hostname");C(this,"port");C(this,"didConnect");C(this,"reconnects");C(this,"lastConnect");C(this,"gossiped");C(this,"tlsName");C(this,"resolves");this.src=n,this.tlsName="";const s=O2(n);this.listen=s.listen,this.hostname=s.hostname,this.port=s.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=r}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const r=[];if(ad(this.hostname))return[this];{const s=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${s.join(",")}`);for(const l of s){const u=this.port===80?"https":"http",c=new URL(`${u}://${ld(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new Tl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return n.randomize&&ix(r),this.resolves=r,r}}class R2{constructor(n=[],r={}){C(this,"firstSelect");C(this,"servers");C(this,"currentServer");C(this,"tlsName");C(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const s=vh();n&&(n.forEach(l=>{l=s?s(l):l,this.servers.push(new Tl(l))}),this.randomize&&(this.servers=ix(this.servers))),this.servers.length===0&&this.addServer(`${Zh}:${ux()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();ad(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,r=!1){const s=vh();n=s?s(n):n;const l=new Tl(n,r);ad(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const r=this.servers.indexOf(n);this.servers.splice(r,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,r){const s=[];let l=[];const u=vh(),c=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(m=>{m=u?u(m,r):m;const d=new Tl(m,!0);c.set(m,d)});const f=[];return this.servers.forEach((m,d)=>{const y=m.listen;m.gossiped&&this.currentServer.listen!==y&&c.get(y)===void 0&&f.push(d),c.delete(y)}),f.reverse(),f.forEach(m=>{const d=this.servers.splice(m,1);l=l.concat(d[0].listen)}),c.forEach((m,d)=>{this.servers.push(m),s.push(d)}),{added:s,deleted:l}}}class M2{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 s=r.permissionContext;if(s.operation==="publish"){const l=this.all().find(u=>u.requestSubject===s.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(n,r)=>{const s=this.getToken(r);if(s){const l=this.get(s);l&&(n===null&&r.headers&&(n=sx(r)),l.resolver(n,r))}}}close(){const n=je.errorForCode(Ee.Timeout);this.reqs.forEach(r=>{r.resolver(n,{})})}}class D2{constructor(n,r,s){C(this,"ph");C(this,"interval");C(this,"maxOut");C(this,"timer");C(this,"pendings");this.ph=n,this.interval=r,this.maxOut=s,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:ra.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=zt();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 L2 extends Error{constructor(n){super(n),this.name="AssertionError"}}function z2(e,n="Assertion failed."){if(!e)throw new L2(n)}const x0=32*1024,wh=2**32-2;function fu(e,n,r=0){const s=n.byteLength-r;return e.byteLength>s&&(e=e.subarray(0,s)),n.set(e,r),e.byteLength}class Sh{constructor(n){C(this,"_buf");C(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const r=this._buf.byteLength;return n<=this.capacity-r?(this._reslice(r+n),r):-1}_reslice(n){z2(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=fu(this._buf.subarray(this._off),n);return this._off+=r,r}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(qi.encode(n))}write(n){const r=this._grow(n.byteLength);return fu(n,this._buf,r)}_grow(n){const r=this.length;r===0&&this._off!==0&&this.reset();const s=this._tryGrowByReslice(n);if(s>=0)return s;const l=this.capacity;if(n<=Math.floor(l/2)-r)fu(this._buf.subarray(this._off),this._buf);else{if(l+n>wh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+n,wh));fu(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+n,wh)),r}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const r=this._grow(n);this._reslice(r)}readFrom(n){let r=0;const s=new Uint8Array(x0);for(;;){const l=this.capacity-this.length<x0,u=l?s:new Uint8Array(this._buf.buffer,this.length),c=n.read(u);if(c===null)return r;l?this.write(u.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var mn;(function(e){e[e.OK=0]="OK",e[e.ERR=1]="ERR",e[e.MSG=2]="MSG",e[e.INFO=3]="INFO",e[e.PING=4]="PING",e[e.PONG=5]="PONG"})(mn||(mn={}));function v0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const U2=48;class w0{constructor(n){C(this,"dispatcher");C(this,"state");C(this,"as");C(this,"drop");C(this,"hdr");C(this,"ma");C(this,"argBuf");C(this,"msgBuf");this.dispatcher=n,this.state=ke.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let r;for(r=0;r<n.length;r++){const s=n[r];switch(this.state){case ke.OP_START:switch(s){case Ce.M:case Ce.m:this.state=ke.OP_M,this.hdr=-1,this.ma=v0();break;case Ce.H:case Ce.h:this.state=ke.OP_H,this.hdr=0,this.ma=v0();break;case Ce.P:case Ce.p:this.state=ke.OP_P;break;case Ce.PLUS:this.state=ke.OP_PLUS;break;case Ce.MINUS:this.state=ke.OP_MINUS;break;case Ce.I:case Ce.i:this.state=ke.OP_I;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_H:switch(s){case Ce.M:case Ce.m:this.state=ke.OP_M;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_M:switch(s){case Ce.S:case Ce.s:this.state=ke.OP_MS;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MS:switch(s){case Ce.G:case Ce.g:this.state=ke.OP_MSG;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MSG:switch(s){case Ce.SPACE:case Ce.TAB:this.state=ke.OP_MSG_SPC;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MSG_SPC:switch(s){case Ce.SPACE:case Ce.TAB:continue;default:this.state=ke.MSG_ARG,this.as=r}break;case ke.MSG_ARG:switch(s){case Ce.CR:this.drop=1;break;case Ce.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=ke.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case ke.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:mn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ke.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const u=n.length-r;u<l&&(l=u),l>0?(this.msgBuf.write(n.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(s)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:mn.MSG,msg:this.ma,data:n.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ke.MSG_END);break;case ke.MSG_END:switch(s){case Ce.NL:this.drop=0,this.as=r+1,this.state=ke.OP_START;break;default:continue}break;case ke.OP_PLUS:switch(s){case Ce.O:case Ce.o:this.state=ke.OP_PLUS_O;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PLUS_O:switch(s){case Ce.K:case Ce.k:this.state=ke.OP_PLUS_OK;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PLUS_OK:switch(s){case Ce.NL:this.dispatcher.push({kind:mn.OK}),this.drop=0,this.state=ke.OP_START;break}break;case ke.OP_MINUS:switch(s){case Ce.E:case Ce.e:this.state=ke.OP_MINUS_E;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MINUS_E:switch(s){case Ce.R:case Ce.r:this.state=ke.OP_MINUS_ER;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MINUS_ER:switch(s){case Ce.R:case Ce.r:this.state=ke.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MINUS_ERR:switch(s){case Ce.SPACE:case Ce.TAB:this.state=ke.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MINUS_ERR_SPC:switch(s){case Ce.SPACE:case Ce.TAB:continue;default:this.state=ke.MINUS_ERR_ARG,this.as=r}break;case ke.MINUS_ERR_ARG:switch(s){case Ce.CR:this.drop=1;break;case Ce.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=n.subarray(this.as,r-this.drop),this.dispatcher.push({kind:mn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=ke.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case ke.OP_P:switch(s){case Ce.I:case Ce.i:this.state=ke.OP_PI;break;case Ce.O:case Ce.o:this.state=ke.OP_PO;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PO:switch(s){case Ce.N:case Ce.n:this.state=ke.OP_PON;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PON:switch(s){case Ce.G:case Ce.g:this.state=ke.OP_PONG;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PONG:switch(s){case Ce.NL:this.dispatcher.push({kind:mn.PONG}),this.drop=0,this.state=ke.OP_START;break}break;case ke.OP_PI:switch(s){case Ce.N:case Ce.n:this.state=ke.OP_PIN;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PIN:switch(s){case Ce.G:case Ce.g:this.state=ke.OP_PING;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PING:switch(s){case Ce.NL:this.dispatcher.push({kind:mn.PING}),this.drop=0,this.state=ke.OP_START;break}break;case ke.OP_I:switch(s){case Ce.N:case Ce.n:this.state=ke.OP_IN;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_IN:switch(s){case Ce.F:case Ce.f:this.state=ke.OP_INF;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_INF:switch(s){case Ce.O:case Ce.o:this.state=ke.OP_INFO;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_INFO:switch(s){case Ce.SPACE:case Ce.TAB:this.state=ke.OP_INFO_SPC;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_INFO_SPC:switch(s){case Ce.SPACE:case Ce.TAB:continue;default:this.state=ke.INFO_ARG,this.as=r}break;case ke.INFO_ARG:switch(s){case Ce.CR:this.drop=1;break;case Ce.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=n.subarray(this.as,r-this.drop),this.dispatcher.push({kind:mn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=ke.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(n.subarray(r))}}(this.state===ke.MSG_ARG||this.state===ke.MINUS_ERR_ARG||this.state===ke.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Sh(n.subarray(this.as,r-this.drop))),this.state===ke.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Sh(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,s=new Uint8Array(n+r);s.set(this.ma.subject),this.ma.reply&&s.set(this.ma.reply,n),this.argBuf=new Sh(s),this.ma.subject=s.subarray(0,n),this.ma.reply&&(this.ma.reply=s.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const r=[];let s=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Ce.SPACE:case Ce.TAB:case Ce.CR:case Ce.NL:s>=0&&(r.push(n.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(n.subarray(s)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${qn.decode(n)}`)}processHeaderMsgArgs(n){const r=[];let s=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Ce.SPACE:case Ce.TAB:case Ce.CR:case Ce.NL:s>=0&&(r.push(n.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(n.subarray(s)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let r=0;for(let s=0;s<n.length;s++){if(n[s]<48||n[s]>57)return-1;r=r*10+(n[s]-U2)}return r}}var ke;(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"})(ke||(ke={}));var Ce;(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"})(Ce||(Ce={}));(function(e){var n=function(k,O){this.hi=k|0,this.lo=O|0},r=function(k){var O,T=new Float64Array(16);if(k)for(O=0;O<k.length;O++)T[O]=k[O];return T},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),u=new Uint8Array(32);u[0]=9;var c=r(),f=r([1]),m=r([56129,1]),d=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=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 E(k,O){return k<<O|k>>>32-O}function M(k,O){var T=k[O+3]&255;return T=T<<8|k[O+2]&255,T=T<<8|k[O+1]&255,T<<8|k[O+0]&255}function P(k,O){var T=k[O]<<24|k[O+1]<<16|k[O+2]<<8|k[O+3],U=k[O+4]<<24|k[O+5]<<16|k[O+6]<<8|k[O+7];return new n(T,U)}function z(k,O,T){var U;for(U=0;U<4;U++)k[O+U]=T&255,T>>>=8}function I(k,O,T){k[O]=T.hi>>24&255,k[O+1]=T.hi>>16&255,k[O+2]=T.hi>>8&255,k[O+3]=T.hi&255,k[O+4]=T.lo>>24&255,k[O+5]=T.lo>>16&255,k[O+6]=T.lo>>8&255,k[O+7]=T.lo&255}function j(k,O,T,U,$){var te,me=0;for(te=0;te<$;te++)me|=k[O+te]^T[U+te];return(1&me-1>>>8)-1}function K(k,O,T,U){return j(k,O,T,U,16)}function B(k,O,T,U){return j(k,O,T,U,32)}function R(k,O,T,U,$){var te=new Uint32Array(16),me=new Uint32Array(16),ye=new Uint32Array(16),se=new Uint32Array(4),de,Ne,Je;for(de=0;de<4;de++)me[5*de]=M(U,4*de),me[1+de]=M(T,4*de),me[6+de]=M(O,4*de),me[11+de]=M(T,16+4*de);for(de=0;de<16;de++)ye[de]=me[de];for(de=0;de<20;de++){for(Ne=0;Ne<4;Ne++){for(Je=0;Je<4;Je++)se[Je]=me[(5*Ne+4*Je)%16];for(se[1]^=E(se[0]+se[3]|0,7),se[2]^=E(se[1]+se[0]|0,9),se[3]^=E(se[2]+se[1]|0,13),se[0]^=E(se[3]+se[2]|0,18),Je=0;Je<4;Je++)te[4*Ne+(Ne+Je)%4]=se[Je]}for(Je=0;Je<16;Je++)me[Je]=te[Je]}if($){for(de=0;de<16;de++)me[de]=me[de]+ye[de]|0;for(de=0;de<4;de++)me[5*de]=me[5*de]-M(U,4*de)|0,me[6+de]=me[6+de]-M(O,4*de)|0;for(de=0;de<4;de++)z(k,4*de,me[5*de]),z(k,16+4*de,me[6+de])}else for(de=0;de<16;de++)z(k,4*de,me[de]+ye[de]|0)}function Y(k,O,T,U){return R(k,O,T,U,!1),0}function J(k,O,T,U){return R(k,O,T,U,!0),0}var F=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function L(k,O,T,U,$,te,me){var ye=new Uint8Array(16),se=new Uint8Array(64),de,Ne;if(!$)return 0;for(Ne=0;Ne<16;Ne++)ye[Ne]=0;for(Ne=0;Ne<8;Ne++)ye[Ne]=te[Ne];for(;$>=64;){for(Y(se,ye,me,F),Ne=0;Ne<64;Ne++)k[O+Ne]=(T?T[U+Ne]:0)^se[Ne];for(de=1,Ne=8;Ne<16;Ne++)de=de+(ye[Ne]&255)|0,ye[Ne]=de&255,de>>>=8;$-=64,O+=64,T&&(U+=64)}if($>0)for(Y(se,ye,me,F),Ne=0;Ne<$;Ne++)k[O+Ne]=(T?T[U+Ne]:0)^se[Ne];return 0}function W(k,O,T,U,$){return L(k,O,null,0,T,U,$)}function Q(k,O,T,U,$){var te=new Uint8Array(32);return J(te,U,$,F),W(k,O,T,U.subarray(16),te)}function oe(k,O,T,U,$,te,me){var ye=new Uint8Array(32);return J(ye,te,me,F),L(k,O,T,U,$,te.subarray(16),ye)}function ae(k,O){var T,U=0;for(T=0;T<17;T++)U=U+(k[T]+O[T]|0)|0,k[T]=U&255,U>>>=8}var G=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function H(k,O,T,U,$,te){var me,ye,se,de,Ne=new Uint32Array(17),Je=new Uint32Array(17),Nt=new Uint32Array(17),on=new Uint32Array(17),lr=new Uint32Array(17);for(se=0;se<17;se++)Je[se]=Nt[se]=0;for(se=0;se<16;se++)Je[se]=te[se];for(Je[3]&=15,Je[4]&=252,Je[7]&=15,Je[8]&=252,Je[11]&=15,Je[12]&=252,Je[15]&=15;$>0;){for(se=0;se<17;se++)on[se]=0;for(se=0;se<16&&se<$;++se)on[se]=T[U+se];for(on[se]=1,U+=se,$-=se,ae(Nt,on),ye=0;ye<17;ye++)for(Ne[ye]=0,se=0;se<17;se++)Ne[ye]=Ne[ye]+Nt[se]*(se<=ye?Je[ye-se]:320*Je[ye+17-se]|0)|0|0;for(ye=0;ye<17;ye++)Nt[ye]=Ne[ye];for(de=0,se=0;se<16;se++)de=de+Nt[se]|0,Nt[se]=de&255,de>>>=8;for(de=de+Nt[16]|0,Nt[16]=de&3,de=5*(de>>>2)|0,se=0;se<16;se++)de=de+Nt[se]|0,Nt[se]=de&255,de>>>=8;de=de+Nt[16]|0,Nt[16]=de}for(se=0;se<17;se++)lr[se]=Nt[se];for(ae(Nt,G),me=-(Nt[16]>>>7)|0,se=0;se<17;se++)Nt[se]^=me&(lr[se]^Nt[se]);for(se=0;se<16;se++)on[se]=te[se+16];for(on[16]=0,ae(Nt,on),se=0;se<16;se++)k[O+se]=Nt[se];return 0}function X(k,O,T,U,$,te){var me=new Uint8Array(16);return H(me,0,T,U,$,te),K(k,O,me,0)}function ue(k,O,T,U,$){var te;if(T<32)return-1;for(oe(k,0,O,0,T,U,$),H(k,16,k,32,T-32,k),te=0;te<16;te++)k[te]=0;return 0}function _e(k,O,T,U,$){var te,me=new Uint8Array(32);if(T<32||(Q(me,0,32,U,$),X(O,16,O,32,T-32,me)!==0))return-1;for(oe(k,0,O,0,T,U,$),te=0;te<32;te++)k[te]=0;return 0}function _(k,O){var T;for(T=0;T<16;T++)k[T]=O[T]|0}function D(k){var O,T;for(T=0;T<16;T++)k[T]+=65536,O=Math.floor(k[T]/65536),k[(T+1)*(T<15?1:0)]+=O-1+37*(O-1)*(T===15?1:0),k[T]-=O*65536}function ee(k,O,T){for(var U,$=~(T-1),te=0;te<16;te++)U=$&(k[te]^O[te]),k[te]^=U,O[te]^=U}function A(k,O){var T,U,$,te=r(),me=r();for(T=0;T<16;T++)me[T]=O[T];for(D(me),D(me),D(me),U=0;U<2;U++){for(te[0]=me[0]-65517,T=1;T<15;T++)te[T]=me[T]-65535-(te[T-1]>>16&1),te[T-1]&=65535;te[15]=me[15]-32767-(te[14]>>16&1),$=te[15]>>16&1,te[14]&=65535,ee(me,te,1-$)}for(T=0;T<16;T++)k[2*T]=me[T]&255,k[2*T+1]=me[T]>>8}function ve(k,O){var T=new Uint8Array(32),U=new Uint8Array(32);return A(T,k),A(U,O),B(T,0,U,0)}function Ae(k){var O=new Uint8Array(32);return A(O,k),O[0]&1}function Te(k,O){var T;for(T=0;T<16;T++)k[T]=O[2*T]+(O[2*T+1]<<8);k[15]&=32767}function Me(k,O,T){var U;for(U=0;U<16;U++)k[U]=O[U]+T[U]|0}function He(k,O,T){var U;for(U=0;U<16;U++)k[U]=O[U]-T[U]|0}function be(k,O,T){var U,$,te=new Float64Array(31);for(U=0;U<31;U++)te[U]=0;for(U=0;U<16;U++)for($=0;$<16;$++)te[U+$]+=O[U]*T[$];for(U=0;U<15;U++)te[U]+=38*te[U+16];for(U=0;U<16;U++)k[U]=te[U];D(k),D(k)}function De(k,O){be(k,O,O)}function Ze(k,O){var T=r(),U;for(U=0;U<16;U++)T[U]=O[U];for(U=253;U>=0;U--)De(T,T),U!==2&&U!==4&&be(T,T,O);for(U=0;U<16;U++)k[U]=T[U]}function dt(k,O){var T=r(),U;for(U=0;U<16;U++)T[U]=O[U];for(U=250;U>=0;U--)De(T,T),U!==1&&be(T,T,O);for(U=0;U<16;U++)k[U]=T[U]}function lt(k,O,T){var U=new Uint8Array(32),$=new Float64Array(80),te,me,ye=r(),se=r(),de=r(),Ne=r(),Je=r(),Nt=r();for(me=0;me<31;me++)U[me]=O[me];for(U[31]=O[31]&127|64,U[0]&=248,Te($,T),me=0;me<16;me++)se[me]=$[me],Ne[me]=ye[me]=de[me]=0;for(ye[0]=Ne[0]=1,me=254;me>=0;--me)te=U[me>>>3]>>>(me&7)&1,ee(ye,se,te),ee(de,Ne,te),Me(Je,ye,de),He(ye,ye,de),Me(de,se,Ne),He(se,se,Ne),De(Ne,Je),De(Nt,ye),be(ye,de,ye),be(de,se,Je),Me(Je,ye,de),He(ye,ye,de),De(se,ye),He(de,Ne,Nt),be(ye,de,m),Me(ye,ye,Ne),be(de,de,ye),be(ye,Ne,Nt),be(Ne,se,$),De(se,Je),ee(ye,se,te),ee(de,Ne,te);for(me=0;me<16;me++)$[me+16]=ye[me],$[me+32]=de[me],$[me+48]=se[me],$[me+64]=Ne[me];var on=$.subarray(32),lr=$.subarray(16);return Ze(on,on),be(lr,lr,on),A(k,lr),0}function ct(k,O){return lt(k,O,u)}function Fe(k,O){return s(O,32),ct(k,O)}function Ue(k,O,T){var U=new Uint8Array(32);return lt(U,T,O),J(k,l,U,F)}var tt=ue,mt=_e;function st(k,O,T,U,$,te){var me=new Uint8Array(32);return Ue(me,$,te),tt(k,O,T,U,me)}function Mt(k,O,T,U,$,te){var me=new Uint8Array(32);return Ue(me,$,te),mt(k,O,T,U,me)}function yt(){var k=0,O=0,T=0,U=0,$=65535,te,me,ye;for(ye=0;ye<arguments.length;ye++)te=arguments[ye].lo,me=arguments[ye].hi,k+=te&$,O+=te>>>16,T+=me&$,U+=me>>>16;return O+=k>>>16,T+=O>>>16,U+=T>>>16,new n(T&$|U<<16,k&$|O<<16)}function $n(k,O){return new n(k.hi>>>O,k.lo>>>O|k.hi<<32-O)}function gr(){var k=0,O=0,T;for(T=0;T<arguments.length;T++)k^=arguments[T].lo,O^=arguments[T].hi;return new n(O,k)}function vt(k,O){var T,U,$=32-O;return O<32?(T=k.hi>>>O|k.lo<<$,U=k.lo>>>O|k.hi<<$):O<64&&(T=k.lo>>>O|k.hi<<$,U=k.hi>>>O|k.lo<<$),new n(T,U)}function An(k,O,T){var U=k.hi&O.hi^~k.hi&T.hi,$=k.lo&O.lo^~k.lo&T.lo;return new n(U,$)}function fe(k,O,T){var U=k.hi&O.hi^k.hi&T.hi^O.hi&T.hi,$=k.lo&O.lo^k.lo&T.lo^O.lo&T.lo;return new n(U,$)}function we(k){return gr(vt(k,28),vt(k,34),vt(k,39))}function Be(k){return gr(vt(k,14),vt(k,18),vt(k,41))}function $e(k){return gr(vt(k,1),vt(k,8),$n(k,7))}function rt(k){return gr(vt(k,19),vt(k,61),$n(k,6))}var nn=[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 bn(k,O,T){var U=[],$=[],te=[],me=[],ye,se,de;for(se=0;se<8;se++)U[se]=te[se]=P(k,8*se);for(var Ne=0;T>=128;){for(se=0;se<16;se++)me[se]=P(O,8*se+Ne);for(se=0;se<80;se++){for(de=0;de<8;de++)$[de]=te[de];for(ye=yt(te[7],Be(te[4]),An(te[4],te[5],te[6]),nn[se],me[se%16]),$[7]=yt(ye,we(te[0]),fe(te[0],te[1],te[2])),$[3]=yt($[3],ye),de=0;de<8;de++)te[(de+1)%8]=$[de];if(se%16===15)for(de=0;de<16;de++)me[de]=yt(me[de],me[(de+9)%16],$e(me[(de+1)%16]),rt(me[(de+14)%16]))}for(se=0;se<8;se++)te[se]=yt(te[se],U[se]),U[se]=te[se];Ne+=128,T-=128}for(se=0;se<8;se++)I(k,8*se,U[se]);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 ge(k,O,T){var U=new Uint8Array(64),$=new Uint8Array(256),te,me=T;for(te=0;te<64;te++)U[te]=Yt[te];for(bn(U,O,T),T%=128,te=0;te<256;te++)$[te]=0;for(te=0;te<T;te++)$[te]=O[me-T+te];for($[T]=128,T=256-128*(T<112?1:0),$[T-9]=0,I($,T-8,new n(me/536870912|0,me<<3)),bn(U,$,T),te=0;te<64;te++)k[te]=U[te];return 0}function ze(k,O){var T=r(),U=r(),$=r(),te=r(),me=r(),ye=r(),se=r(),de=r(),Ne=r();He(T,k[1],k[0]),He(Ne,O[1],O[0]),be(T,T,Ne),Me(U,k[0],k[1]),Me(Ne,O[0],O[1]),be(U,U,Ne),be($,k[3],O[3]),be($,$,y),be(te,k[2],O[2]),Me(te,te,te),He(me,U,T),He(ye,te,$),Me(se,te,$),Me(de,U,T),be(k[0],me,ye),be(k[1],de,se),be(k[2],se,ye),be(k[3],me,de)}function Se(k,O,T){var U;for(U=0;U<4;U++)ee(k[U],O[U],T)}function ft(k,O){var T=r(),U=r(),$=r();Ze($,O[2]),be(T,O[0],$),be(U,O[1],$),A(k,U),k[31]^=Ae(T)<<7}function pt(k,O,T){var U,$;for(_(k[0],c),_(k[1],f),_(k[2],f),_(k[3],c),$=255;$>=0;--$)U=T[$/8|0]>>($&7)&1,Se(k,O,U),ze(O,k),ze(k,k),Se(k,O,U)}function Tn(k,O){var T=[r(),r(),r(),r()];_(T[0],g),_(T[1],x),_(T[2],f),be(T[3],g,x),pt(k,T,O)}function ri(k,O,T){var U=new Uint8Array(64),$=[r(),r(),r(),r()],te;for(T||s(O,32),ge(U,O,32),U[0]&=248,U[31]&=127,U[31]|=64,Tn($,U),ft(k,$),te=0;te<32;te++)O[te+32]=k[te];return 0}var Nr=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 ii(k,O){var T,U,$,te;for(U=63;U>=32;--U){for(T=0,$=U-32,te=U-12;$<te;++$)O[$]+=T-16*O[U]*Nr[$-(U-32)],T=Math.floor((O[$]+128)/256),O[$]-=T*256;O[$]+=T,O[U]=0}for(T=0,$=0;$<32;$++)O[$]+=T-(O[31]>>4)*Nr[$],T=O[$]>>8,O[$]&=255;for($=0;$<32;$++)O[$]-=T*Nr[$];for(U=0;U<32;U++)O[U+1]+=O[U]>>8,k[U]=O[U]&255}function sr(k){var O=new Float64Array(64),T;for(T=0;T<64;T++)O[T]=k[T];for(T=0;T<64;T++)k[T]=0;ii(k,O)}function Ii(k,O,T,U){var $=new Uint8Array(64),te=new Uint8Array(64),me=new Uint8Array(64),ye,se,de=new Float64Array(64),Ne=[r(),r(),r(),r()];ge($,U,32),$[0]&=248,$[31]&=127,$[31]|=64;var Je=T+64;for(ye=0;ye<T;ye++)k[64+ye]=O[ye];for(ye=0;ye<32;ye++)k[32+ye]=$[32+ye];for(ge(me,k.subarray(32),T+32),sr(me),Tn(Ne,me),ft(k,Ne),ye=32;ye<64;ye++)k[ye]=U[ye];for(ge(te,k,T+64),sr(te),ye=0;ye<64;ye++)de[ye]=0;for(ye=0;ye<32;ye++)de[ye]=me[ye];for(ye=0;ye<32;ye++)for(se=0;se<32;se++)de[ye+se]+=te[ye]*$[se];return ii(k.subarray(32),de),Je}function Fi(k,O){var T=r(),U=r(),$=r(),te=r(),me=r(),ye=r(),se=r();return _(k[2],f),Te(k[1],O),De($,k[1]),be(te,$,d),He($,$,k[2]),Me(te,k[2],te),De(me,te),De(ye,me),be(se,ye,me),be(T,se,$),be(T,T,te),dt(T,T),be(T,T,$),be(T,T,te),be(T,T,te),be(k[0],T,te),De(U,k[0]),be(U,U,te),ve(U,$)&&be(k[0],k[0],w),De(U,k[0]),be(U,U,te),ve(U,$)?-1:(Ae(k[0])===O[31]>>7&&He(k[0],c,k[0]),be(k[3],k[0],k[1]),0)}function _a(k,O,T,U){var $,te=new Uint8Array(32),me=new Uint8Array(64),ye=[r(),r(),r(),r()],se=[r(),r(),r(),r()];if(T<64||Fi(se,U))return-1;for($=0;$<T;$++)k[$]=O[$];for($=0;$<32;$++)k[$+32]=U[$];if(ge(me,k,T),sr(me),pt(ye,se,me),Tn(se,O.subarray(32)),ze(ye,se),ft(te,ye),T-=64,B(O,0,te,0)){for($=0;$<T;$++)k[$]=0;return-1}for($=0;$<T;$++)k[$]=O[$+64];return T}var ps=32,si=24,ar=32,ai=16,li=32,$i=32,oi=32,Or=32,Yi=32,Ea=si,Xl=ar,yr=ai,Ct=64,Pt=32,jn=64,Gi=32,ka=64;e.lowlevel={crypto_core_hsalsa20:J,crypto_stream_xor:oe,crypto_stream:Q,crypto_stream_salsa20_xor:L,crypto_stream_salsa20:W,crypto_onetimeauth:H,crypto_onetimeauth_verify:X,crypto_verify_16:K,crypto_verify_32:B,crypto_secretbox:ue,crypto_secretbox_open:_e,crypto_scalarmult:lt,crypto_scalarmult_base:ct,crypto_box_beforenm:Ue,crypto_box_afternm:tt,crypto_box:st,crypto_box_open:Mt,crypto_box_keypair:Fe,crypto_hash:ge,crypto_sign:Ii,crypto_sign_keypair:ri,crypto_sign_open:_a,crypto_secretbox_KEYBYTES:ps,crypto_secretbox_NONCEBYTES:si,crypto_secretbox_ZEROBYTES:ar,crypto_secretbox_BOXZEROBYTES:ai,crypto_scalarmult_BYTES:li,crypto_scalarmult_SCALARBYTES:$i,crypto_box_PUBLICKEYBYTES:oi,crypto_box_SECRETKEYBYTES:Or,crypto_box_BEFORENMBYTES:Yi,crypto_box_NONCEBYTES:Ea,crypto_box_ZEROBYTES:Xl,crypto_box_BOXZEROBYTES:yr,crypto_sign_BYTES:Ct,crypto_sign_PUBLICKEYBYTES:Pt,crypto_sign_SECRETKEYBYTES:jn,crypto_sign_SEEDBYTES:Gi,crypto_hash_BYTES:ka,gf:r,D:d,L:Nr,pack25519:A,unpack25519:Te,M:be,A:Me,S:De,Z:He,pow2523:dt,add:ze,set25519:_,modL:ii,scalarmult:pt,scalarbase:Tn};function Kl(k,O){if(k.length!==ps)throw new Error("bad key size");if(O.length!==si)throw new Error("bad nonce size")}function Ql(k,O){if(k.length!==oi)throw new Error("bad public key size");if(O.length!==Or)throw new Error("bad secret key size")}function Qt(){for(var k=0;k<arguments.length;k++)if(!(arguments[k]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function gs(k){for(var O=0;O<k.length;O++)k[O]=0}e.randomBytes=function(k){var O=new Uint8Array(k);return s(O,k),O},e.secretbox=function(k,O,T){Qt(k,O,T),Kl(T,O);for(var U=new Uint8Array(ar+k.length),$=new Uint8Array(U.length),te=0;te<k.length;te++)U[te+ar]=k[te];return ue($,U,U.length,O,T),$.subarray(ai)},e.secretbox.open=function(k,O,T){Qt(k,O,T),Kl(T,O);for(var U=new Uint8Array(ai+k.length),$=new Uint8Array(U.length),te=0;te<k.length;te++)U[te+ai]=k[te];return U.length<32||_e($,U,U.length,O,T)!==0?null:$.subarray(ar)},e.secretbox.keyLength=ps,e.secretbox.nonceLength=si,e.secretbox.overheadLength=ai,e.scalarMult=function(k,O){if(Qt(k,O),k.length!==$i)throw new Error("bad n size");if(O.length!==li)throw new Error("bad p size");var T=new Uint8Array(li);return lt(T,k,O),T},e.scalarMult.base=function(k){if(Qt(k),k.length!==$i)throw new Error("bad n size");var O=new Uint8Array(li);return ct(O,k),O},e.scalarMult.scalarLength=$i,e.scalarMult.groupElementLength=li,e.box=function(k,O,T,U){var $=e.box.before(T,U);return e.secretbox(k,O,$)},e.box.before=function(k,O){Qt(k,O),Ql(k,O);var T=new Uint8Array(Yi);return Ue(T,k,O),T},e.box.after=e.secretbox,e.box.open=function(k,O,T,U){var $=e.box.before(T,U);return e.secretbox.open(k,O,$)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var k=new Uint8Array(oi),O=new Uint8Array(Or);return Fe(k,O),{publicKey:k,secretKey:O}},e.box.keyPair.fromSecretKey=function(k){if(Qt(k),k.length!==Or)throw new Error("bad secret key size");var O=new Uint8Array(oi);return ct(O,k),{publicKey:O,secretKey:new Uint8Array(k)}},e.box.publicKeyLength=oi,e.box.secretKeyLength=Or,e.box.sharedKeyLength=Yi,e.box.nonceLength=Ea,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(k,O){if(Qt(k,O),O.length!==jn)throw new Error("bad secret key size");var T=new Uint8Array(Ct+k.length);return Ii(T,k,k.length,O),T},e.sign.open=function(k,O){if(Qt(k,O),O.length!==Pt)throw new Error("bad public key size");var T=new Uint8Array(k.length),U=_a(T,k,k.length,O);if(U<0)return null;for(var $=new Uint8Array(U),te=0;te<$.length;te++)$[te]=T[te];return $},e.sign.detached=function(k,O){for(var T=e.sign(k,O),U=new Uint8Array(Ct),$=0;$<U.length;$++)U[$]=T[$];return U},e.sign.detached.verify=function(k,O,T){if(Qt(k,O,T),O.length!==Ct)throw new Error("bad signature size");if(T.length!==Pt)throw new Error("bad public key size");var U=new Uint8Array(Ct+k.length),$=new Uint8Array(Ct+k.length),te;for(te=0;te<Ct;te++)U[te]=O[te];for(te=0;te<k.length;te++)U[te+Ct]=k[te];return _a($,U,U.length,T)>=0},e.sign.keyPair=function(){var k=new Uint8Array(Pt),O=new Uint8Array(jn);return ri(k,O),{publicKey:k,secretKey:O}},e.sign.keyPair.fromSecretKey=function(k){if(Qt(k),k.length!==jn)throw new Error("bad secret key size");for(var O=new Uint8Array(Pt),T=0;T<O.length;T++)O[T]=k[32+T];return{publicKey:O,secretKey:new Uint8Array(k)}},e.sign.keyPair.fromSeed=function(k){if(Qt(k),k.length!==Gi)throw new Error("bad seed size");for(var O=new Uint8Array(Pt),T=new Uint8Array(jn),U=0;U<32;U++)T[U]=k[U];return ri(O,T,!0),{publicKey:O,secretKey:T}},e.sign.publicKeyLength=Pt,e.sign.secretKeyLength=jn,e.sign.seedLength=Gi,e.sign.signatureLength=Ct,e.hash=function(k){Qt(k);var O=new Uint8Array(ka);return ge(O,k,k.length),O},e.hash.hashLength=ka,e.verify=function(k,O){return Qt(k,O),k.length===0||O.length===0||k.length!==O.length?!1:j(k,0,O,0,k.length)===0},e.setPRNG=function(k){s=k},(function(){var k=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(k&&k.getRandomValues){var O=65536;e.setPRNG(function(T,U){var $,te=new Uint8Array(U);for($=0;$<U;$+=O)k.getRandomValues(te.subarray($,$+Math.min(U-$,O)));for($=0;$<U;$++)T[$]=te[$];gs(te)})}else typeof require<"u"&&(k=require("crypto"),k&&k.randomBytes&&e.setPRNG(function(T,U){var $,te=k.randomBytes(U);for($=0;$<U;$++)T[$]=te[$];gs(te)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const hu=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,B2={fromSeed:hu.sign.keyPair.fromSeed,sign:hu.sign.detached,verify:hu.sign.detached.verify,randomBytes:hu.randomBytes};let hx;function P2(e){hx=e}function Di(){return hx}const q2=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 Mu{static checksum(n){let r=0;for(let s=0;s<n.byteLength;s++){let l=n[s];r=r<<8&65535^q2[(r>>8^l)&255]}return r}static validate(n,r){return Mu.checksum(n)==r}}const _h="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class S0{static encode(n){let r=0,s=0,l=new Uint8Array(n),u=new Uint8Array(n.byteLength*2),c=0;for(let f=0;f<l.byteLength;f++)for(s=s<<8|l[f],r+=8;r>=5;){let m=s>>>r-5&31;u[c++]=_h.charAt(m).charCodeAt(0),r-=5}if(r>0){let f=s<<5-r&31;u[c++]=_h.charAt(f).charCodeAt(0)}return u.slice(0,c)}static decode(n){let r=0,s=0,l=0,u=new Uint8Array(n),c=new Uint8Array(u.byteLength*5/8|0);for(let f=0;f<u.byteLength;f++){let m=String.fromCharCode(u[f]),d=_h.indexOf(m);if(d===-1)throw new Error("Illegal Base32 character: "+u[f]);s=s<<5|d,r+=5,r>=8&&(c[l++]=s>>>r-8&255,r-=8)}return c.slice(0,l)}}class kt extends Error{constructor(r,s){super(r);C(this,"name");C(this,"code");C(this,"chainedError");this.name="NKeysError",this.code=r,this.chainedError=s}}function H2(){return Vu(Et.Operator)}function I2(){return Vu(Et.Account)}function F2(){return Vu(Et.User)}var gt;(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"})(gt||(gt={}));var Et;(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"})(Et||(Et={}));class na{static isValidPublicPrefix(n){return n==Et.Server||n==Et.Operator||n==Et.Cluster||n==Et.Account||n==Et.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 Et.Seed:return Et.Seed;case Et.Private:return Et.Private;case Et.Operator:return Et.Operator;case Et.Server:return Et.Server;case Et.Cluster:return Et.Cluster;case Et.Account:return Et.Account;case Et.User:return Et.User;default:return-1}}}class pn{static encode(n,r){if(!r||!(r instanceof Uint8Array))throw new kt(gt.SerializationError);if(!na.isValidPrefix(n))throw new kt(gt.InvalidPrefixByte);return pn._encode(!1,n,r)}static encodeSeed(n,r){if(!r)throw new kt(gt.ApiError);if(!na.isValidPublicPrefix(n))throw new kt(gt.InvalidPrefixByte);if(r.byteLength!==32)throw new kt(gt.InvalidSeedLen);return pn._encode(!0,n,r)}static decode(n,r){if(!na.isValidPrefix(n))throw new kt(gt.InvalidPrefixByte);const s=pn._decode(r);if(s[0]!==n)throw new kt(gt.InvalidPrefixByte);return s.slice(1)}static decodeSeed(n){const r=pn._decode(n),s=pn._decodePrefix(r);if(s[0]!=Et.Seed)throw new kt(gt.InvalidSeed);if(!na.isValidPublicPrefix(s[1]))throw new kt(gt.InvalidPrefixByte);return{buf:r.slice(2),prefix:s[1]}}static _encode(n,r,s){const l=n?2:1,u=s.byteLength,c=l+u+2,f=l+u,m=new Uint8Array(c);if(n){const g=pn._encodePrefix(Et.Seed,r);m.set(g)}else m[0]=r;m.set(s,l);const d=Mu.checksum(m.slice(0,f));return new DataView(m.buffer).setUint16(f,d,!0),S0.encode(m)}static _decode(n){if(n.byteLength<4)throw new kt(gt.InvalidEncoding);let r;try{r=S0.decode(n)}catch(f){throw new kt(gt.InvalidEncoding,f)}const s=r.byteLength-2,u=new DataView(r.buffer).getUint16(s,!0),c=r.slice(0,s);if(!Mu.validate(c,u))throw new kt(gt.InvalidChecksum);return c}static _encodePrefix(n,r){const s=n|r>>5,l=(r&31)<<3;return new Uint8Array([s,l])}static _decodePrefix(n){const r=n[0]&248,s=(n[0]&7)<<5|(n[1]&248)>>3;return new Uint8Array([r,s])}}class dx{constructor(n){C(this,"seed");this.seed=n}getRawSeed(){if(!this.seed)throw new kt(gt.ClearedPair);return pn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new kt(gt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new kt(gt.ClearedPair);const n=pn.decodeSeed(this.seed),r=Di().fromSeed(this.getRawSeed()),s=pn.encode(n.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new kt(gt.ClearedPair);const n=Di().fromSeed(this.getRawSeed());return pn.encode(Et.Private,n.secretKey)}sign(n){if(!this.seed)throw new kt(gt.ClearedPair);const r=Di().fromSeed(this.getRawSeed());return Di().sign(n,r.secretKey)}verify(n,r){if(!this.seed)throw new kt(gt.ClearedPair);const s=Di().fromSeed(this.getRawSeed());return Di().verify(n,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Vu(e){const n=Di().randomBytes(32);let r=pn.encodeSeed(e,new Uint8Array(n));return new dx(r)}class $2{constructor(n){C(this,"publicKey");this.publicKey=n}getPublicKey(){if(!this.publicKey)throw new kt(gt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new kt(gt.PublicKeyOnly):new kt(gt.ClearedPair)}getSeed(){throw this.publicKey?new kt(gt.PublicKeyOnly):new kt(gt.ClearedPair)}sign(n){throw this.publicKey?new kt(gt.CannotSign):new kt(gt.ClearedPair)}verify(n,r){if(!this.publicKey)throw new kt(gt.ClearedPair);let s=pn._decode(this.publicKey);return Di().verify(n,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function Y2(e){const n=new TextEncoder().encode(e),r=pn._decode(n),s=na.parsePrefix(r[0]);if(na.isValidPublicPrefix(s))return new $2(n);throw new kt(gt.InvalidPublicKey)}function G2(e){return pn.decodeSeed(e),new dx(e)}function V2(e){return btoa(String.fromCharCode(...e))}function J2(e){const n=atob(e),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r}P2(B2);const _0={createAccount:I2,createOperator:H2,createPair:Vu,createUser:F2,fromPublic:Y2,fromSeed:G2,NKeysError:kt,NKeysErrorCode:gt,Prefix:Et,decode:J2,encode:V2};function X2(e){return n=>{let r={};return e.forEach(s=>{const l=s(n)||{};r=Object.assign(r,l)}),r}}function K2(){return()=>{}}function Q2(e,n){return()=>{const r=typeof e=="function"?e():e,s=typeof n=="function"?n():n;return{user:r,pass:s}}}function Z2(e){return()=>({auth_token:typeof e=="function"?e():e})}function W2(e){return n=>{const r=typeof e=="function"?e():e,s=r?_0.fromSeed(r):void 0,l=s?s.getPublicKey():"",u=qi.encode(n||""),c=s!==void 0&&n?s.sign(u):void 0,f=c?_0.encode(c):"";return{nkey:l,sig:f}}}function mx(e,n){return r=>{const s=typeof e=="function"?e():e,l=W2(n),{nkey:u,sig:c}=l(r);return{jwt:s,nkey:u,sig:c}}}const px=120*1e3,eE=2,gx=2*1e3;function tE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:px,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:gx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function nE(e){const n=[];return typeof e.authenticator=="function"&&n.push(e.authenticator),Array.isArray(e.authenticator)&&n.push(...e.authenticator),e.token&&n.push(Z2(e.token)),e.user&&n.push(Q2(e.user,e.pass)),n.length===0?K2():X2(n)}function rE(e){const n=`${Zh}:${ux()}`;if(e=e||{servers:[n]},e.servers=e.servers||[],typeof e.servers=="string"&&(e.servers=[e.servers]),e.servers.length>0&&e.port)throw new je("port and servers options are mutually exclusive",Ee.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${Zh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[n]);const r=$u(tE(),e);if(r.authenticator=nE(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new je(`${s} option should be a function`,Ee.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let s=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return s&&(s++,s=Math.floor(Math.random()*s)),r.reconnectTimeWait+s}),r.inboxPrefix)try{Zr(r.inboxPrefix)}catch(s){throw new je(s.message,Ee.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",Ee.InvalidOption);return r}function iE(e,n){const{proto:r,tls_required:s,tls_available:l}=e;if((r===void 0||r<1)&&n.noEcho)throw new je("noEcho",Ee.ServerOptionNotAvailable);const u=s||l||!1;if(n.tls&&!u)throw new je("tls",Ee.ServerOptionNotAvailable)}const sE=1024*32,aE=/^INFO\s+([^\r\n]+)\r\n/i,lE=Cl(`PONG\r
72
+ `),E0=Cl(`PING\r
73
+ `);class oE{constructor(n,r,s){C(this,"echo");C(this,"no_responders");C(this,"protocol");C(this,"verbose");C(this,"pedantic");C(this,"jwt");C(this,"nkey");C(this,"sig");C(this,"user");C(this,"pass");C(this,"auth_token");C(this,"tls_required");C(this,"name");C(this,"lang");C(this,"version");C(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=r.noEcho?!1:void 0,this.verbose=r.verbose,this.pedantic=r.pedantic,this.tls_required=r.tls?!0:void 0,this.name=r.name;const l=(r&&typeof r.authenticator=="function"?r.authenticator(s):{})||{};$u(this,l)}}class yx extends tn{constructor(r,s,l={}){var c;super();C(this,"sid");C(this,"queue");C(this,"draining");C(this,"max");C(this,"subject");C(this,"drained");C(this,"protocol");C(this,"timer");C(this,"info");C(this,"cleanupFn");C(this,"closed");C(this,"requestSubject");$u(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=zt();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=fa(l.timeout,u),this.timer.then(()=>{this.timer=void 0}).catch(f=>{this.stop(f),this.noIterator&&this.callback(f,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const s=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),u=r.protocolFilterFn?r.protocolFilterFn:()=>!0,c=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(f,m)=>{const{ingest:d}=l(m);d&&u(m)&&(s(f,m),c(m))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,s){this.cancelTimeout(),r?this.stop(r):this.push(s)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(je.errorForCode(Ee.ConnectionClosed)):this.isClosed()?Promise.reject(je.errorForCode(Ee.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(zt()).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 uE{constructor(){C(this,"mux");C(this,"subs");C(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const r=n.permissionContext,s=this.all();let l;if(r.operation==="subscription"&&(l=s.find(u=>u.subject===r.subject&&u.queue===r.queue)),r.operation==="publish"&&(l=s.find(u=>u.requestSubject===r.subject)),l)return l.callback(n,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Du{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=sE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=r,this.subscriptions=new uE,this.muxSubscriptions=new M2,this.outbound=new da,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new d2({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new R2(s,{randomize:!n.noRandomize}),this.closed=zt(),this.parser=new w0(this),this.heartbeats=new D2(this,this.options.pingInterval||px,this.options.maxPingOut||eE)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const r=je.errorForCode(Ee.Disconnect);r.stack="",n.forEach(s=>{s.reject(r)}),this.parser=new w0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(r=>{r.push(n)})}status(){const n=new tn;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=zt();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=r=>{n.reject(r)},this.transport=g2(),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:ra.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:ra.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:Kr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:Kr.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===Ee.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(n)}async dial(n){const r=this.prepare();let s;try{s=fa(this.options.timeout||2e4);const l=this.transport.connect(n,this.options);await Promise.race([l,s]),(async()=>{try{for await(const u of this.transport)this.parser.parse(u)}catch(u){console.log("reader closed",u)}})().then()}catch(l){r.reject(l)}try{await Promise.race([s,r]),s&&s.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw s&&s.cancel(),await this.transport.close(l),l}}async _doDial(n){const{resolve:r}=this.options,s=await n.resolve({fn:sd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of s)try{l=null,this.dispatchStatus({type:ra.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():gx;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw n||(this.lastError?this.lastError:je.errorForCode(Ee.ConnectionRefused));const u=Date.now();if(l.lastConnect===0||l.lastConnect+r<=u){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(c){if(n=c,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const f=this.options.maxReconnectAttempts||0;f!==-1&&l.reconnects>=f&&this.servers.removeCurrentServer()}}else s=Math.min(s,l.lastConnect+r-u),await xa(s)}}static async connect(n,r){const s=new Du(n,r);return await s.dialLoop(),s}static toError(n){const r=n?n.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new je(n,Ee.PermissionsViolation),l=n.match(/(Publish|Subscription) to "(\S+)"/);if(l){s.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const u=n.match(/using queue "(\S+)"/);u&&(s.permissionContext.queue=u[1])}return s}else return r.indexOf("authorization violation")!==-1?new je(n,Ee.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new je(n,Ee.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new je(n,Ee.AccountExpired):r.indexOf("authentication timeout")!==-1?new je(n,Ee.AuthenticationTimeout):new je(n,Ee.ProtocolError)}processMsg(n,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const s=this.subscriptions.get(n.sid);s&&(s.received+=1,s.callback&&s.callback(null,new Md(n,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(n){const r=a0(n),s=Du.toError(r),l={type:Kr.Error,data:s.code};if(s.isPermissionError()){let u=!1;if(s.permissionContext){l.permissionContext=s.permissionContext;const c=this.subscriptions.getMux();u=(c==null?void 0:c.subject)===s.permissionContext.subject}this.subscriptions.handleError(s),this.muxSubscriptions.handleError(u,s),u&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(s)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(lE)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const r=JSON.parse(a0(n));this.info=r;const s=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(fs(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new oE({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(Cl(`CONNECT ${m}${Su}`)),this.transport.send(E0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:Kr.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:Kr.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case mn.MSG:{const{msg:r,data:s}=n;this.processMsg(r,s);break}case mn.OK:break;case mn.ERR:this.processError(n.data);break;case mn.PING:this.processPing();break;case mn.PONG:this.processPong();break;case mn.INFO:this.processInfo(n.data);break}}sendCommand(n,...r){const s=this.outbound.length();let l;typeof n=="string"?l=Cl(n):l=n,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,r=Fn,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=qi.encode(r);else throw je.errorForCode(Ee.BadPayload);let u=l.length;s=s||{},s.reply=s.reply||"";let c=Fn,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new je("headers",Ee.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw je.errorForCode(Ee.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let m;s.headers?(s.reply?m=`HPUB ${n} ${s.reply} ${f} ${u}\r
74
+ `:m=`HPUB ${n} ${f} ${u}\r
75
+ `,this.sendCommand(m,c,l,Ru)):(s.reply?m=`PUB ${n} ${s.reply} ${u}\r
76
+ `:m=`PUB ${n} ${u}\r
77
+ `,this.sendCommand(m,l,Ru))}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=zt()),this.pongs.push(n),this.outbound.fill(E0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(r=>{const s=r;s.queue?n.push(`SUB ${s.subject} ${s.queue} ${s.sid}${Su}`):n.push(`SUB ${s.subject} ${s.sid}${Su}`)}),n.length&&this.transport.send(Cl(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(r=>{r.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),r=[];return n.forEach(s=>{r.push(s.drain())}),Promise.all(r).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const r=this.muxSubscriptions.init(this.options.inboxPrefix),s=new yx(this,`${r}*`);s.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(s),this.subscribe(s)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const cE="$SRV";class k0{constructor(n){C(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,r){return this.msg.respond(n,r)}respondError(n,r,s,l){var u,c;return l=l||{},l.headers=l.headers||ei(),(u=l.headers)==null||u.set(Au,`${n}`),(c=l.headers)==null||c.set(Cu,r),this.msg.respond(s,l)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Ll{constructor(n,r="",s=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&hE("service group",r);let l="";if(n instanceof $l)this.srv=n,l="";else if(n instanceof Ll){const u=n;this.srv=u.srv,s===""&&u.queue!==""&&(s=u.queue),l=u.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=s}calcSubject(n,r=""){return r===""?n:n!==""?`${n}.${r}`:r}addEndpoint(n="",r){r=r||{subject:n};const s=typeof r=="function"?{handler:r,subject:n}:r;El("endpoint",n);let{subject:l,handler:u,metadata:c,queue:f}=s;l=l||n,f=f||this.queue,fE("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 Ll(this,n,r)}}function fE(e,n){if(n==="")throw new Error(`${e} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);const r=n.split(".");r.forEach((s,l)=>{if(s===">"&&l!==r.length-1)throw new Error(`${e} cannot have internal '>': '${n}'`)})}function hE(e,n){if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);n.split(".").forEach(s=>{if(s===">")throw new Error(`${e} name cannot contain internal '>': '${n}'`)})}class $l{constructor(n,r={name:"",version:""}){C(this,"nc");C(this,"_id");C(this,"config");C(this,"handlers");C(this,"internal");C(this,"_stopped");C(this,"_done");C(this,"started");this.nc=n,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),El("name",this.config.name),El("queue",this.config.queue),fs(this.config.version),this._id=Bi.next(),this.internal=[],this._done=zt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(s=>{this.close(s).catch()})}static controlSubject(n,r="",s="",l){const u=l??cE;return r===""&&s===""?`${u}.${n}`:(El("control subject name",r),s!==""?(El("control subject id",s),`${u}.${n}.${r}.${s}`):`${u}.${n}.${r}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const r=ei();if(n instanceof Tu){const s=n;r.set(Cu,s.message),r.set(Au,`${s.code}`)}else r.set(Cu,n.message),r.set(Au,"500");return r}setupHandler(n,r=!1){const s=r?"":n.queue?n.queue:this.config.queue,{name:l,subject:u,handler:c}=n,f=n;f.internal=r,r&&this.internal.push(f),f.stats=new dE(l,u,s),f.queue=s;const m=c?(d,y)=>{if(d){this.close(d);return}const g=Date.now();try{c(d,new k0(y))}catch(x){f.stats.countError(x),y==null||y.respond(Fn,{headers:this.errorToHeader(x)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(u,{callback:m,queue:s}),f.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(d=>{if(!this._stopped){const y=new Error(`required subscription ${n.subject} errored: ${d.message}`);y.stack=d.stack,this.close(y).catch()}}),f}info(){return{type:Al.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:r,metadata:s,name:l,queue:u}=n;return{subject:r,metadata:s,name:l,queue_group:u}})}async stats(){const n=[];for(const r of this.handlers){if(typeof this.config.statsHandler=="function")try{r.stats.data=await this.config.statsHandler(r)}catch(s){r.stats.countError(s)}n.push(r.stats.stats(r.qi))}return{type:Al.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,r){const s=`${n}`.toUpperCase();this._doAddInternalHandler(`${s}-all`,n,r),this._doAddInternalHandler(`${s}-kind`,n,r,this.name),this._doAddInternalHandler(`${s}`,n,r,this.name,this.id)}_doAddInternalHandler(n,r,s,l="",u=""){const c={};c.name=n,c.subject=$l.controlSubject(r,l,u),c.handler=s,this.setupHandler(c,!0)}start(){const n=dr(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(m=>(f==null||f.respond(n.encode(m)),Promise.resolve())),s=(c,f)=>c?(this.close(c),Promise.reject(c)):(f==null||f.respond(n.encode(this.info())),Promise.resolve()),l=n.encode(this.ping()),u=(c,f)=>c?(this.close(c).then().catch(),Promise.reject(c)):(f.respond(l),Promise.resolve());return this.addInternalHandler(Li.PING,u),this.addInternalHandler(Li.STATS,r),this.addInternalHandler(Li.INFO,s),this.handlers.forEach(c=>{const{subject:f}=c;typeof f=="string"&&c.handler!==null&&this.setupHandler(c)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let r=[];return this.nc.isClosed()||(r=this.handlers.concat(this.internal).map(s=>s.sub.drain())),Promise.allSettled(r).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Al.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 Ll(this,n,r)}addEndpoint(n,r){return new Ll(this).addEndpoint(n,r)}_addEndpoint(n){const r=new tn;r.noIterator=typeof n.handler=="function",r.noIterator||(n.handler=(l,u)=>{l?this.stop(l).catch():r.push(new k0(u))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(n,!1);return s.qi=r,this.handlers.push(s),r}}class dE{constructor(n,r,s=""){C(this,"name");C(this,"subject");C(this,"average_processing_time");C(this,"num_requests");C(this,"processing_time");C(this,"num_errors");C(this,"last_error");C(this,"data");C(this,"metadata");C(this,"queue");this.name=n,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=s}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const r=n;r&&(r.time=0,r.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=Lt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:r,average_processing_time:s,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue:d}=this;return{name:n,subject:r,average_processing_time:s,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue_group:d}}stats(n){const r=n;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=Lt(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 mE{constructor(n,r={strategy:hr.JitterTimer,maxWait:2e3},s){C(this,"nc");C(this,"prefix");C(this,"opts");this.nc=n,this.prefix=s,this.opts=r}ping(n="",r=""){return this.q(Li.PING,n,r)}stats(n="",r=""){return this.q(Li.STATS,n,r)}info(n="",r=""){return this.q(Li.INFO,n,r)}async q(n,r="",s=""){const l=new tn,u=dr(),c=$l.controlSubject(n,r,s,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 bx(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function pE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:bx(),storage:nd.File}}const Lu="KV-Operation",C0="$KV",gE=/^[-/=.\w]+$/,yE=/^[-/=.>*\w]+$/,bE=/^[-\w]+$/;function xE(e){if(e.startsWith(".")||e.endsWith(".")||!gE.test(e))throw new Error(`invalid key: ${e}`)}function vE(e){if(e.startsWith(".")||e.endsWith(".")||!yE.test(e))throw new Error(`invalid key: ${e}`)}function wE(e){if(e.startsWith(".")||e.endsWith("."))throw new Error(`invalid key: ${e}`);const n=e.split(".");let r=!1;for(let s=0;s<n.length;s++)switch(n[s]){case"*":r=!0;break;case">":if(s!==n.length-1)throw new Error(`invalid key: ${e}`);r=!0;break}return r}function _u(e){if(!bE.test(e))throw new Error(`invalid bucket name: ${e}`)}var _r;(function(e){e.MsgIdHdr="Nats-Msg-Id",e.ExpectedStreamHdr="Nats-Expected-Stream",e.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",e.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",e.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(_r||(_r={}));class zl{constructor(n,r,s){C(this,"js");C(this,"jsm");C(this,"stream");C(this,"bucket");C(this,"direct");C(this,"codec");C(this,"prefix");C(this,"editPrefix");C(this,"useJsPrefix");C(this,"_prefixLen");C(this,"validateKey",xE);C(this,"validateSearchKey",vE);C(this,"hasWildcards",wE);_u(n),this.js=r,this.jsm=s,this.bucket=n,this.prefix=C0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,r,s={}){_u(r);const l=await n.jetstreamManager(),u=new zl(r,n,l);return await u.init(s),u}static async bind(n,r,s={}){const l=await n.jetstreamManager(),u={config:{allow_direct:s.allow_direct}};_u(r);const c=new zl(r,n,l);return u.config.name=s.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=s.codec||bx(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(n={}){const r=Object.assign(pE(),n);this.codec=r.codec;const s={};this.stream=s.name=n.streamName??this.bucketName(),s.retention=td.Limits,s.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(s.max_bytes=r.max_bytes),s.max_msg_size=r.maxValueSize,s.storage=r.storage;const l=n.placementCluster??"";if(l&&(n.placement={},n.placement.cluster=l,n.placement.tags=[]),n.placement&&(s.placement=n.placement),n.republish&&(s.republish=n.republish),n.description&&(s.description=n.description),n.mirror){const g=Object.assign({},n.mirror);g.name.startsWith(Pn)||(g.name=`${Pn}${g.name}`),s.mirror=g,s.mirror_direct=!0}else if(n.sources){const g=n.sources.map(x=>{const w=Object.assign({},x),E=w.name.startsWith(Pn)?w.name.substring(Pn.length):w.name;return w.name.startsWith(Pn)||(w.name=`${Pn}${w.name}`),!x.external&&E!==this.bucket&&(w.subject_transforms=[{src:`$KV.${E}.>`,dest:`$KV.${this.bucket}.>`}]),w});s.sources=g,s.subjects=[this.subjectForBucket()]}else s.subjects=[this.subjectForBucket()];n.metadata&&(s.metadata=n.metadata),typeof n.compression=="boolean"&&(s.compression=n.compression?Pi.S2:Pi.None);const u=this.js.nc,c=u.getServerVersion(),f=c?id(c,fs("2.7.2"))>=0:!1;s.discard=f?Dl.New:Dl.Old;const{ok:m,min:d}=u.features.get(at.JS_ALLOW_DIRECT);if(!m&&n.allow_direct===!0){const g=c?`${c.major}.${c.minor}.${c.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${g} - requires ${d}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:m,s.allow_direct=n.allow_direct,this.direct=s.allow_direct,s.num_replicas=r.replicas,r.ttl&&(s.max_age=Lt(r.ttl)),s.allow_rollup_hdrs=!0;let y;try{y=await this.jsm.streams.info(s.name),!y.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(g){if(g.message==="stream not found")y=await this.jsm.streams.add(s);else throw g}this.initializePrefixes(y)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=n.config;if(r){let s=r.name;if(s.startsWith(Pn)&&(s=s.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.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Pn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,r=!1){const s=[];return r?(this.useJsPrefix&&s.push(this.js.apiPrefix),this.editPrefix!==""?s.push(this.editPrefix):s.push(this.prefix)):this.prefix&&s.push(this.prefix),s.push(n),s.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${C0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const r=[];for(const s of n.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.encode(s));break}return r.join(".")}decodeKey(n){const r=[];for(const s of n.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.decode(s));break}return r.join(".")}close(){return Promise.resolve()}dataLen(n,r){const s=r&&r.get(yn.MessageSizeHdr)||"";return s!==""?parseInt(s,10):n.length}smToEntry(n){return new zE(this.bucket,this.prefixLen,n)}jmToEntry(n){const r=this.decodeKey(n.subject.substring(this.prefixLen));return new UE(this.bucket,r,n)}async create(n,r){var u;let s;try{const c=await this.put(n,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(s=c,((u=c==null?void 0:c.api_error)==null?void 0:u.err_code)!==10071)return Promise.reject(c)}let l=0;try{const c=await this.get(n);return(c==null?void 0:c.operation)==="DEL"||(c==null?void 0:c.operation)==="PURGE"?(l=c!==null?c.revision:0,this.update(n,r,l)):Promise.reject(s)}catch(c){return Promise.reject(c)}}update(n,r,s){if(s<=0)throw new Error("version must be greater than 0");return this.put(n,r,{previousSeq:s})}async put(n,r,s={}){var c,f;const l=this.encodeKey(n);this.validateKey(l);const u={};if(s.previousSeq!==void 0){const m=ei();u.headers=m,m.set(_r.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,u)).seq}catch(m){const d=m;return d.isJetStreamError()?(d.message=(c=d.api_error)==null?void 0:c.description,d.code=`${(f=d.api_error)==null?void 0:f.code}`,Promise.reject(d)):Promise.reject(m)}}async get(n,r){const s=this.encodeKey(n);this.validateKey(s);let l={last_by_subj:this.subjectForKey(s)};r&&r.revision>0&&(l={seq:r.revision});let u;try{this.direct?u=await this.jsm.direct.getMessage(this.bucketName(),l):u=await this.jsm.streams.getMessage(this.bucketName(),l);const c=this.smToEntry(u);return c.key!==s?null:c}catch(c){if(c.code===Ee.JetStream404NoMessages)return null;throw c}}purge(n,r){return this._deleteOrPurge(n,"PURGE",r)}delete(n,r){return this._deleteOrPurge(n,"DEL",r)}async purgeDeletes(n=1800*1e3){const r=zt(),s=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const m of l)(m.operation==="DEL"||m.operation==="PURGE")&&s.push(m)})().then(),await r,l.stop();const u=Date.now()-n,c=s.map(m=>{const d=this.subjectForKey(m.key);return m.created.getTime()>=u?this.jsm.streams.purge(this.stream,{filter:d,keep:1}):this.jsm.streams.purge(this.stream,{filter:d,keep:0})}),f=await Promise.all(c);return f.unshift({success:!0,purged:0}),f.reduce((m,d)=>(m.purged+=d.purged,m))}async _deleteOrPurge(n,r,s){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,r,s);const l=await this.keys(n),u=[];for await(const c of l)u.push(this._doDeleteOrPurge(c,r)),u.length===100&&(await Promise.all(u),u.length=0);u.length>0&&await Promise.all(u)}async _doDeleteOrPurge(n,r,s){const l=this.encodeKey(n);this.validateKey(l);const u=ei();u.set(Lu,r),r==="PURGE"&&u.set(yn.RollupHdr,yn.RollupValueSubject),s!=null&&s.previousSeq&&u.set(_r.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),Fn,{headers:u})}_buildCC(n,r,s={}){let u=(Array.isArray(n)?n:[n]).map(m=>{const d=this.encodeKey(m);return this.validateSearchKey(m),this.fullKeyName(d)}),c=$t.LastPerSubject;r===fr.AllHistory&&(c=$t.All),r===fr.UpdatesOnly&&(c=$t.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:en.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:Lt(5*1e3)},s)}remove(n){return this.purge(n)}async history(n={}){const r=n.key??">",s=new tn,l={};l.headers_only=n.headers_only||!1;let u;u=()=>{s.stop()};let c=0;const f=this._buildCC(r,fr.AllHistory,l),m=f.filter_subject,d=Ui(f);d.bindStream(this.stream),d.orderedConsumer(),d.callback((g,x)=>{if(g){s.stop(g);return}if(x){const w=this.jmToEntry(x);s.push(w),s.received++,(u&&c>0&&s.received>=c||x.info.pending===0)&&(s.push(u),u=void 0)}});const y=await this.js.subscribe(m,d);if(u){const{info:{last:g}}=y,x=g.num_pending+g.delivered.consumer_seq;if(x===0||s.received>=x)try{u()}catch(w){s.stop(w)}finally{u=void 0}else c=x}return s._data=y,s.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{s.stop()}).catch(g=>{s.stop(g)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(at.JS_NEW_CONSUMER_CREATE_API);return s}async watch(n={}){const r=n.key??">",s=new tn,l={};l.headers_only=n.headers_only||!1;let u=fr.LastValue;n.include===fr.AllHistory?u=fr.AllHistory:n.include===fr.UpdatesOnly&&(u=fr.UpdatesOnly);const c=n.ignoreDeletes===!0;let f=n.initializedFn,m=0;const d=this._buildCC(r,u,l),y=d.filter_subject,g=Ui(d);this.canSetWatcherName()&&g.consumerName(Bi.next()),g.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&g.startSequence(n.resumeFromRevision),g.orderedConsumer(),g.callback((w,E)=>{if(w){s.stop(w);return}if(E){const M=this.jmToEntry(E);if(c&&M.operation==="DEL")return;s.push(M),s.received++,f&&(m>0&&s.received>=m||E.info.pending===0)&&(s.push(f),f=void 0)}});const x=await this.js.subscribe(y,g);if(f){const{info:{last:w}}=x,E=w.num_pending+w.delivered.consumer_seq;if(E===0||s.received>=E)try{f()}catch(M){s.stop(M)}finally{f=void 0}else m=E}return s._data=x,s.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{s.stop()}).catch(w=>{s.stop(w)}),s}async keys(n=">"){const r=new tn,s=this._buildCC(n,fr.LastValue,{headers_only:!0}),l=Array.isArray(n)?">":s.filter_subject,u=Ui(s);u.bindStream(this.stream),u.orderedConsumer();const c=await this.js.subscribe(l,u);return(async()=>{var m;for await(const d of c){const y=(m=d.headers)==null?void 0:m.get(Lu);if(y!=="DEL"&&y!=="PURGE"){const g=this.decodeKey(d.subject.substring(this.prefixLen));r.push(g)}d.info.pending===0&&c.unsubscribe()}})().then(()=>{r.stop()}).catch(m=>{r.stop(m)}),c.info.last.num_pending===0&&c.unsubscribe(),r}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var u;const r=((u=this.js.nc.info)==null?void 0:u.cluster)??"",s=this.bucketName(),l=await this.jsm.streams.info(s);return new xx(l,r)}}class xx{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 Rd(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Pi.None:!1}}const Ld="OBJ_",A0="SHA-256=";function SE(e){return _u(e),`${Ld}${e}`}function _E(e){return e.startsWith(Ld)?e.substring(4):e}class od{constructor(n){C(this,"si");C(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return _E(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!==Pi.None:!1}}function du(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 Er;(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"})(Er||(Er={}));var la;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(la||(la={}));const T0=Uint8Array.of(43,65,67,75),EE=Uint8Array.of(45,78,65,75),yl=Uint8Array.of(43,87,80,73),kE=Uint8Array.of(43,78,88,84),CE=Uint8Array.of(43,84,69,82,77),AE=Uint8Array.of(32);function Ul(e,n=5e3){return new $E(e,n)}class Eh extends tn{constructor(r,s,l=!1){super();C(this,"consumer");C(this,"opts");C(this,"sub");C(this,"monitor");C(this,"pending");C(this,"inbox");C(this,"refilling");C(this,"pong");C(this,"callback");C(this,"timeout");C(this,"cleanupHandler");C(this,"listeners");C(this,"statusIterator");C(this,"forOrderedConsumer");C(this,"resetHandler");C(this,"abortOnMissingResource");C(this,"bind");C(this,"inBackOff");this.consumer=r;const u=s;this.opts=this.parseOptions(s,l),this.callback=u.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=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:s,idle_heartbeat:l,threshold_bytes:u,threshold_messages:c}=this.opts;this.closed().then(m=>{if(this.cleanupHandler)try{this.cleanupHandler(m)}catch{}});const{sub:f}=this;f&&f.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(m,d)=>{var g,x,w,E;if(m){this.stop(m);return}if((g=this.monitor)==null||g.work(),d.subject===this.inbox){if(ed(d))return;const M=(x=d.headers)==null?void 0:x.code,P=((E=(w=d.headers)==null?void 0:w.description)==null?void 0:E.toLowerCase())||"unknown",{msgsLeft:z,bytesLeft:I}=this.parseDiscard(d.headers);if(z>0||I>0)this.pending.msgs-=z,this.pending.bytes-=I,this.pending.requests--,this.notify(la.Discard,{msgsLeft:z,bytesLeft:I});else if(M===400){this.stop(new je(P,`${M}`));return}else if(M===409&&P==="consumer deleted"){if(this.notify(Er.ConsumerDeleted,`${M} ${P}`),!this.refilling||this.abortOnMissingResource){const j=new je(P,`${M}`);this.stop(j);return}}else if(M===503){if(this.notify(Er.NoResponders,`${M} No Responders`),!this.refilling||this.abortOnMissingResource){const j=new je("no responders",`${M}`);this.stop(j);return}}else this.notify(la.DebugEvent,`${M} ${P}`)}else this._push(Ul(d,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=d.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=c||s&&this.pending.bytes<=u){const M=this.pullOptions();this.pull(M)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Dd(l,m=>(this.notify(Er.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 Kr.Disconnect:(d=this.monitor)==null||d.cancel();break;case Kr.Reconnect:this.resetPending().then(g=>{var x;g&&((x=this.monitor)==null||x.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const s=typeof r=="function"?r:null;try{s?s():this.callback(r)}catch(l){this.stop(l)}}}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let r=0,s=0;const l=Od([this.opts.expires]);let u=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,r=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(c){if(c.message==="stream not found"){if(s++,this.notify(Er.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(Er.ConsumerNotFound,r),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(c),!1;if(this.forOrderedConsumer)return!1}else r=0,s=0;this.inBackOff=!0;const f=l.backoff(u),m=xa(f);await Promise.race([m,this.consumer.api.nc.closed()]),m.cancel(),u++}}}pull(r){this.pending.bytes+=r.max_bytes??0,this.pending.msgs+=r.batch??0,this.pending.requests++;const s=this.consumer.api.nc;this._push(()=>{s.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(r),{reply:this.inbox}),this.notify(la.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=Lt(this.opts.idle_heartbeat),u=Lt(this.opts.expires);return{batch:r,max_bytes:s,idle_heartbeat:l,expires:u}}parseDiscard(r){const s={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(yn.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(yn.PendingBytesHdr);return u&&(s.bytesLeft=parseInt(u)),s}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,s;(r=this.monitor)==null||r.cancel(),this.monitor=null,(s=this.timeout)==null||s.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var s,l;this.done||((s=this.sub)==null||s.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(u=>{u.stop()})}))}parseOptions(r,s=!1){const l=r||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,s){const u=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||u;const c=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||c}return l}status(){const r=new tn;return this.listeners.push(r),Promise.resolve(r)}}class TE extends tn{constructor(){super();C(this,"src");C(this,"listeners");this.listeners=[]}setSource(r){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=r,this.src.setCleanupHandler(s=>{this.stop(s||void 0)}),(async()=>{const s=await this.src.status();for await(const l of s)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}stop(r){var s;this.done||((s=this.src)==null||s.stop(r),super.stop(r),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const r=new tn;return this.listeners.push(r),Promise.resolve(r)}}class ud{constructor(n,r){C(this,"api");C(this,"_info");C(this,"stream");C(this,"name");this.api=n,this._info=r,this.stream=r.stream_name,this.name=r.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new Eh(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const r=new Eh(this,n,!1),s=Math.round(r.opts.expires*1.05),l=fa(s);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(n={expires:3e4}){const r=zt(),s=n;s.max_messages=1;const l=new Eh(this,s,!1),u=Math.round(l.opts.expires*1.05);u>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===Er.HeartbeatsMissed&&f.data>=2){r.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const f of l){r.resolve(f);break}})().catch(()=>{});const c=fa(u);return l.closed().then(f=>{f?r.reject(f):r.resolve(null)}).catch(f=>{r.reject(f)}).finally(()=>{c.cancel()}),c.catch(f=>{r.resolve(null),l.close().catch()}),l.trackTimeout(c),r}delete(){const{stream_name:n,name:r}=this._info;return this.api.delete(n,r)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:r,name:s}=this._info;return this.api.info(r,s).then(l=>(this._info=l,this._info))}}class jE{constructor(n,r,s={}){C(this,"api");C(this,"consumerOpts");C(this,"consumer");C(this,"opts");C(this,"cursor");C(this,"stream");C(this,"namePrefix");C(this,"serial");C(this,"currentConsumer");C(this,"userCallback");C(this,"iter");C(this,"type");C(this,"startSeq");C(this,"maxInitialReset");this.api=n,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Bi.next(),typeof s.name_prefix=="string"&&(Yu("name_prefix",s.name_prefix),this.namePrefix=s.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=tr.Unset,this.consumerOpts=s,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const r=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const s={name:r,deliver_policy:$t.StartSequence,opt_start_seq:n,ack_policy:en.None,inactive_threshold:Lt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(s.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(s.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(s.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(s.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(s.deliver_policy=this.consumerOpts.deliver_policy||$t.StartSequence,(this.consumerOpts.deliver_policy===$t.LastPerSubject||this.consumerOpts.deliver_policy===$t.New||this.consumerOpts.deliver_policy===$t.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===$t.LastPerSubject&&typeof s.filter_subjects>"u"&&typeof s.filter_subject>"u"&&(s.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete s.opt_start_seq,s.deliver_policy=$t.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=Lt(this.consumerOpts.inactive_threshold))),s}async resetConsumer(n=0){var c,f,m,d,y;Bi.next();const r=this.serial===0;(c=this.consumer)==null||c.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const s=this.getConsumerOpts(n);s.max_deliver=1,s.mem_storage=!0;const l=Od([((f=this.opts)==null?void 0:f.expires)||3e4]);let u;for(let g=0;;g++)try{u=await this.api.add(this.stream,s),(m=this.iter)==null||m.notify(Er.OrderedConsumerRecreated,u.name);break}catch(x){if(x.message==="stream not found"&&((d=this.iter)==null||d.notify(Er.StreamNotFound,g),this.type===tr.Fetch||this.opts.abort_on_missing_resource===!0))return(y=this.iter)==null||y.stop(x),Promise.reject(x);if(r&&g>=this.maxInitialReset)throw x;await xa(l.backoff(g+1))}return u}internalHandler(n){return r=>{var l;if(this.serial!==n)return;const s=r.info.deliverySequence;if(s!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=s,this.cursor.stream_seq=r.info.streamSequence,this.userCallback?this.userCallback(r):(l=this.iter)==null||l.push(r)}}async reset(n={max_messages:100,expires:3e4},r){var m,d;r=r||{};const s=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===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||s)&&(this.iter=new TE),this.consumer=new ud(this.api,this.currentConsumer);const u=n;u.callback=this.internalHandler(this.serial);let c=null;this.type===tr.Fetch&&s?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(la.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:s}=n;return s&&(this.userCallback=s),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:s}=n;return s&&(this.userCallback=s),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 s=zt();return r.callback=u=>{this.userCallback=null,s.resolve(u)},(await this.fetch(r)).iterClosed.then(u=>{u&&s.reject(u),s.resolve(null)}).catch(u=>{s.reject(u)}),s}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class cd{constructor(n){C(this,"api");C(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(at.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new ud(this.api,n)}async get(n,r={}){return typeof r=="object"?this.ordered(n,r):(await this.checkVersion(),this.api.info(n,r).then(s=>s.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new ud(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(n,r){await this.checkVersion();const s=this.api;return new zd(s.nc,s.opts).info(n).then(u=>Promise.resolve(new jE(this.api,n,r))).catch(u=>Promise.reject(u))}}class Ju{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 Ju(this.api,n)}else return this}info(n=!1,r){return n?Promise.resolve(this._info):this.api.info(this.name,r).then(s=>(this._info=s,this._info))}getConsumerFromInfo(n){return new cd(new Ou(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new cd(new Ou(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,r){return this.api.deleteMessage(this.name,n,r)}}class zd extends Fl{constructor(n,r){super(n,r)}checkStreamConfigVersions(n){const r=this.nc;if(n.metadata){const{min:l,ok:u}=r.features.get(at.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(at.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(at.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(at.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(at.JS_DEFAULT_CONSUMER_LIMITS);if(!u)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function s(l,u){var f;if((((f=u==null?void 0:u.subject_transforms)==null?void 0:f.length)||0)>0){const{min:m,ok:d}=r.features.get(at.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!d)throw new Error(`${l} 'subject_transforms' requires server ${m}`)}}n.sources&&n.sources.forEach(l=>{s("stream sources",l)}),n.mirror&&s("stream mirror",n.mirror)}async add(n={}){var l;this.checkStreamConfigVersions(n),dn(n.name),n.mirror=du(n.mirror),n.sources=(l=n.sources)==null?void 0:l.map(du);const s=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(s),s}async delete(n){return dn(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,r={}){var f;if(typeof n=="object"){const m=n;n=m.name,r=m,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(r),dn(n);const s=await this.info(n),l=Object.assign(s.config,r);l.mirror=du(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(du);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,l);return this._fixInfo(c),c}async info(n,r){dn(n);const s=`${this.prefix}.STREAM.INFO.${n}`;let u=await this._request(s,r),{total:c,limit:f}=u,m=u.state.subjects?Object.getOwnPropertyNames(u.state.subjects).length:1;if(c&&c>m){const d=[u],y=r||{};let g=0;for(;c>m;){g++,y.offset=f*g;const w=await this._request(s,y);c=w.total,d.push(w);const E=Object.getOwnPropertyNames(w.state.subjects).length;if(m+=E,E<f)break}let x={};for(let w=0;w<d.length;w++)u=d[w],u.state.subjects&&(x=Object.assign(x,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=x}return this._fixInfo(u),u}list(n=""){const r=n!=null&&n.length?{subject:n}:{},s=u=>{const c=u;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new kl(l,s,this,r)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,r){if(r){const{keep:l,seq:u}=r;if(typeof l=="number"&&typeof u=="number")throw new Error("can specify one of keep or seq")}return dn(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,r)}async deleteMessage(n,r,s=!0){dn(n);const l={seq:r};return s||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,l)).success}async getMessage(n,r){dn(n);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,r);return new vx(l)}find(n){return this.findStream(n)}listKvs(){const n=s=>{var m;const u=s.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 xx(d,c))},r=`${this.prefix}.STREAM.LIST`;return new kl(r,n,this)}listObjectStores(){const n=s=>{const u=s.streams.filter(f=>f.config.name.startsWith(Ld));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new od(f))},r=`${this.prefix}.STREAM.LIST`;return new kl(r,n,this)}names(n=""){const r=n!=null&&n.length?{subject:n}:{},s=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new kl(l,s,this,r)}async get(n){const r=await this.info(n);return Promise.resolve(new Ju(this,r))}}class NE extends Fl{constructor(n,r){super(n,r)}async getMessage(n,r){dn(n);let s=r;const{last_by_subj:l}=s;l&&(s=null);const u=s?this.jc.encode(s):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=sa(m);if(d)return Promise.reject(d);const y=new fd(m);return Promise.resolve(y)}async getBatch(n,r){dn(n);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(r.multi_last)||r.multi_last.length===0)return Promise.reject("multi_last is required");const u=JSON.stringify(r,(m,d)=>m==="up_to_time"&&d instanceof Date?d.toISOString():d),c=new tn,f=await this.nc.requestMany(l,u,{strategy:hr.SentinelMsg});return(async()=>{var g,x,w;let m=!1,d=!1,y;for await(const E of f){if(!m){m=!0;const M=((g=E.headers)==null?void 0:g.code)||0;if(M!==0&&M<200||M>299){y=(x=E.headers)==null?void 0:x.description.toLowerCase();break}if(((w=E.headers)==null?void 0:w.get("Nats-Num-Pending"))===""){d=!0;break}}if(E.data.length===0)break;c.push(new fd(E))}c.push(()=>{if(d)throw new Error("batch direct get not supported by the server");if(y)throw new Error(`bad request: ${y}`);c.stop()})})(),Promise.resolve(c)}}class fd{constructor(n){C(this,"data");C(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(ta.Subject)}get seq(){const n=this.header.last(ta.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(ta.TimeStamp)}get stream(){return this.header.last(ta.Stream)}json(n){return dr(n).decode(this.data)}string(){return qn.decode(this.data)}}C(fd,"jc");class OE extends Fl{constructor(r,s){super(r,s);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new zd(r,s),this.consumers=new Ou(r,s),this.direct=new NE(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new tn;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(s,l)=>{if(s)throw s;try{const u=this.parseJsResponse(l),c=u.type.split("."),f=c[c.length-1];r.push({kind:f,data:u})}catch(u){r.stop(u)}}}),r}}class vx{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=zi.decode(n)}else this._header=ei();return this._header}_parse(n){const r=atob(n),s=r.length,l=new Uint8Array(s);for(let u=0;u<s;u++)l[u]=r.charCodeAt(u);return l}json(n){return dr(n).decode(this.data)}string(){return qn.decode(this.data)}}C(vx,"jc");class RE{constructor(n){C(this,"api");this.api=n}get(n){return this.api.info(n).then(r=>new Ju(this.api,r))}}class kh{constructor(n){C(this,"info");C(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=zi.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,r;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((r=this.info.options)==null?void 0:r.link)!==null}}function j0(e){const n={name:e.name,description:e.description??"",options:e.options,metadata:e.metadata};if(e.headers){const r=e.headers;n.headers=r.toRecord()}return n}function ME(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class jl{constructor(n,r,s){C(this,"jsm");C(this,"js");C(this,"stream");C(this,"name");this.name=n,this.jsm=r,this.js=s}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const r=await this.rawInfo(n);return r?new kh(r):null}async list(){const n=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const s of r){if(s===null)break;n.push(s)}return Promise.resolve(n)}async rawInfo(n){const{name:r,error:s}=this._checkNotEmpty(n);if(s)return Promise.reject(s);const l=this._metaSubject(r);try{const u=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=dr().decode(u.data);return f.revision=u.seq,f}catch(u){return u.code==="404"?null:Promise.reject(u)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(r){return r.code==="404"?null:Promise.reject(r)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new od(n)))}async status(n){const r=await this._si(n);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new od(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,r,s){var K;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout:u,previousRevision:c}=s,f=this.js.nc.info,m=(f==null?void 0:f.max_payload)||1024;n=n||{},n.options=n.options||{};let d=((K=n.options)==null?void 0:K.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:x}=this._checkNotEmpty(n.name);if(x)return Promise.reject(x);const w=Bi.next(),E=this._chunkSubject(w),M=this._metaSubject(g),P=Object.assign({bucket:this.name,nuid:w,size:0,chunks:0},j0(n)),z=zt(),I=[],j=new da;try{const B=r?r.getReader():null,R=b0.create();for(;;){const{done:Y,value:J}=B?await B.read():{done:!0,value:void 0};if(Y){if(j.size()>0){const Q=j.drain();R.update(Q),P.chunks++,P.size+=Q.length,I.push(this.js.publish(E,Q,{timeout:u}))}await Promise.all(I),I.length=0,P.mtime=new Date().toISOString();const F=aa.encode(R.digest());P.digest=`${A0}${F}`,P.deleted=!1;const L=ei();typeof c=="number"&&L.set(_r.ExpectedLastSubjectSequenceHdr,`${c}`),L.set(yn.RollupHdr,yn.RollupValueSubject);const W=await this.js.publish(M,dr().encode(P),{headers:L,timeout:u});if(P.revision=W.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}z.resolve(new kh(P));break}if(J)for(j.fill(J);j.size()>d;){P.chunks++,P.size+=d;const F=j.drain(n.options.max_chunk_size);R.update(F),I.push(this.js.publish(E,F,{timeout:u}))}}}catch(B){await this.jsm.streams.purge(this.stream,{filter:E}),z.reject(B)}return z}putBlob(n,r,s){function l(u){return new ReadableStream({pull(c){c.enqueue(u),c.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(n,l(r),s)}put(n,r,s){var l;return(l=n==null?void 0:n.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,r,s)}async getBlob(n){async function r(u){const c=new da,f=u.getReader();for(;;){const{done:m,value:d}=await f.read();if(m)return c.drain();d&&d.length&&c.fill(d)}}const s=await this.get(n);if(s===null)return Promise.resolve(null);const l=await Promise.all([s.error,r(s.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(n){const r=await this.rawInfo(n);if(r===null||r.deleted)return Promise.resolve(null);if(r.options&&r.options.link){const g=r.options.link.name||"";if(g==="")throw new Error("link is a bucket");return(r.options.link.bucket!==this.name?await jl.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(A0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=rd(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=zt(),u={info:new kh(r),error:l};if(r.size===0)return u.data=ME(),l.resolve(null),Promise.resolve(u);let c;const f=Ui();f.orderedConsumer();const m=b0.create(),d=`$O.${this.name}.C.${r.nuid}`,y=await this.js.subscribe(d,f);return(async()=>{for await(const g of y)g.data.length>0&&(m.update(g.data),c.enqueue(g.data)),g.info.pending===0&&(u2(s,m.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),y.unsubscribe())})().then(()=>{l.resolve()}).catch(g=>{c.error(g),l.reject(g)}),u.data=new ReadableStream({start(g){c=g},cancel(){y.unsubscribe()}}),u}linkStore(n,r){if(!(r instanceof jl))return Promise.reject("bucket required");const s=r,{name:l,error:u}=this._checkNotEmpty(n);if(u)return Promise.reject(u);const c={name:l,options:{link:{bucket:s.name}}};return this._put(c,null)}async link(n,r){const{name:s,error:l}=this._checkNotEmpty(n);if(l)return Promise.reject(l);if(r.deleted)return Promise.reject(new Error("src object is deleted"));if(r.isLink())return Promise.reject(new Error("src object is a link"));const u=await this.rawInfo(n);if(u!==null&&!u.deleted)return Promise.reject(new Error("an object already exists with that name"));const c={bucket:r.bucket,name:r.name},f={name:s,bucket:r.bucket,options:{link:c}};await this.js.publish(this._metaSubject(n),JSON.stringify(f));const m=await this.info(n);return Promise.resolve(m)}async delete(n){const r=await this.rawInfo(n);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const s=dr(),l=ei();return l.set(yn.RollupHdr,yn.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),s.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(n,r={}){const s=await this.rawInfo(n);if(s===null)return Promise.reject(new Error("object not found"));if(s.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??s.name;const{name:l,error:u}=this._checkNotEmpty(r.name);if(u)return Promise.reject(u);if(n!==r.name){const m=await this.info(r.name);if(m&&!m.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const c=Object.assign({},s,j0(r)),f=await this.js.publish(this._metaSubject(c.name),JSON.stringify(c));return n!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(f)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let r=!1;const s=new tn,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(m){m.code==="404"?(s.push(null),r=!0):s.stop(m)}const u=dr(),c=Ui();c.orderedConsumer(),n.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((m,d)=>{var y;if(m){s.stop(m);return}if(d!==null){const g=u.decode(d.data);g.deleted&&n.ignoreDeletes===!0||s.push(g),((y=d.info)==null?void 0:y.pending)===0&&!r&&(r=!0,s.push(null))}});const f=await this.js.subscribe(l,c);return s._data=f,s.iterClosed.then(()=>{f.unsubscribe()}),f.closed.then(()=>{s.stop()}).catch(m=>{s.stop(m)}),s}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${aa.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=SE(this.name)}catch(l){return Promise.reject(l)}const r=(n==null?void 0:n.ttl)||0;delete n.ttl;const s=Object.assign({max_age:r},n);s.name=this.stream,s.num_replicas=n.replicas??1,s.allow_direct=!0,s.allow_rollup_hdrs=!0,s.discard=Dl.New,s.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(s.placement=n.placement),n.metadata&&(s.metadata=n.metadata),typeof n.compression=="boolean"&&(s.compression=n.compression?Pi.S2:Pi.None);try{await this.jsm.streams.info(s.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(s)}}static async create(n,r,s={}){const l=await n.jetstreamManager(),u=new jl(r,l,n);return await u.init(s),Promise.resolve(u)}}class DE{constructor(n){C(this,"js");this.js=n}kv(n,r={}){const s=this.js,{ok:l,min:u}=s.nc.features.get(at.JS_KV);return l?r.bindOnly?zl.bind(this.js,n,r):zl.create(this.js,n,r):Promise.reject(new Error(`kv is only supported on servers ${u} or better`))}os(n,r={}){var c;if(typeof((c=crypto==null?void 0:crypto.subtle)==null?void 0:c.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const s=this.js,{ok:l,min:u}=s.nc.features.get(at.JS_OBJECTSTORE);return l?jl.create(this.js,n,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class Ud extends Fl{constructor(r,s){super(r,s);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new Ou(r,s),this.streamAPI=new zd(r,s),this.consumers=new cd(this.consumerAPI),this.streams=new RE(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const s=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(s)}get apiPrefix(){return this.prefix}get views(){return new DE(this)}async publish(r,s=Fn,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||ei();l&&(l.msgID&&u.set(_r.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(_r.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(_r.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(_r.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(_r.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 x=0;x<m;x++)try{y=await this.nc.request(r,s,f);break}catch(w){if(w.code==="503"&&x+1<m)await xa(d);else throw w}const g=this.parseJsResponse(y);if(g.stream==="")throw je.errorForCode(Ee.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){dn(r),ia(s);let u=this.timeout;l>u&&(u=l),l=l<0?0:Lt(l);const c={batch:1,no_wait:l===0,expires:l},f=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(c),{noMux:!0,timeout:u}),m=sa(f);if(m)throw m;return Ul(f,this.timeout)}fetch(r,s,l={}){dn(r),ia(s);let u=null;const c=(l.max_bytes??0)>0;let f=0;const m=c?l.max_bytes:0;let d=null;const y={};if(y.batch=l.batch||1,m){const I=this.nc.features.get(at.JS_PULL_MAX_BYTES);if(!I.ok)throw new Error(`max_bytes is only supported on servers ${I.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=Lt(g)),g===0&&y.no_wait===!1)throw new Error("expires or no_wait is required");const x=l.idle_heartbeat||0;x&&(y.idle_heartbeat=Lt(x),l.delay_heartbeat===!0&&(y.idle_heartbeat=Lt(x*4)));const w=new tn,E=y.batch;let M=0;w.protocolFilterFn=(I,j=!1)=>ed(I.msg)?(d==null||d.work(),!1):!0,w.dispatchedFn=I=>{if(I){if(c&&(f+=I.data.length),M++,u&&I.info.pending===0)return;(w.getPending()===1&&I.info.pending===0||E===M||m>0&&f>=m)&&w.stop()}};const P=Zr(this.nc.options.inboxPrefix),z=this.nc.subscribe(P,{max:l.batch,callback:(I,j)=>{I===null&&(I=sa(j)),I!==null?(u&&(u.cancel(),u=null),$_(I)?w.stop(Sx(I)===null?void 0:I):w.stop(I)):(d==null||d.work(),w.received++,w.push(Ul(j,this.timeout)))}});return g&&(u=fa(g),u.catch(()=>{z.isClosed()||(z.drain().catch(()=>{}),u=null),d&&d.cancel()})),(async()=>{try{x&&(d=new Dd(x,I=>(w.push(()=>{w.err=new je(`${nr.IdleHeartbeatMissed}: ${I}`,Ee.JetStreamIdleHeartBeat)}),!0)))}catch{}await z.closed,u!==null&&(u.cancel(),u=null),d&&d.cancel(),w.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(y),{reply:P}),w}async pullSubscribe(r,s=Ui()){const l=await this._processOptions(r,s);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const u=l.config.ack_policy;if(u===en.None||u===en.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new BE(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(m){throw f.unsubscribe(),m}return f}async subscribe(r,s=Ui()){const l=await this._processOptions(r,s);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const u=this._buildTypedSubscriptionOpts(l),c=new wx(this,l.deliver,u);c.info=l;try{await this._maybeCreateConsumer(l)}catch(f){throw c.unsubscribe(),f}return c._maybeSetupHbMonitoring(),c}async _processOptions(r,s=Ui()){const l=m0(s)?s.getOpts():s;if(l.isBind=m0(s)?s.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==en.NotSet&&l.config.ack_policy!==en.None)throw new je("ordered consumer: ack_policy can only be set to 'none'",Ee.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new je("ordered consumer: durable_name cannot be set",Ee.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new je("ordered consumer: deliver_subject cannot be set",Ee.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new je("ordered consumer: max_deliver cannot be set",Ee.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new je("ordered consumer: deliver_group cannot be set",Ee.ApiError);l.config.deliver_subject=Zr(this.nc.options.inboxPrefix),l.config.ack_policy=en.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||Lt(5e3),l.config.ack_wait=Lt(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===en.NotSet&&(l.config.ack_policy=en.All),l.api=this,l.config=l.config||{},l.stream=l.stream?l.stream:await this.findStream(r),l.attached=!1,l.config.durable_name)try{const u=await this.consumerAPI.info(l.stream,l.config.durable_name);if(u){if(u.config.filter_subject&&u.config.filter_subject!==r)throw new Error("subject does not match consumer");const c=l.config.deliver_group??"";if(c===""&&u.push_bound===!0)throw new Error("duplicate subscription");const f=u.config.deliver_group??"";if(c!==f)throw f===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${f}'`);l.last=u,l.config=u.config,l.attached=!0,l.config.durable_name||(l.name=u.name)}}catch(u){if(u.code!=="404")throw u}return!l.attached&&l.config.filter_subject===void 0&&l.config.filter_subjects===void 0&&(l.config.filter_subject=r),l.deliver=l.config.deliver_subject||Zr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=PE(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Ud.ingestionFn(r.ordered),s.protocolFilterFn=(l,u=!1)=>{const c=l;return Wh(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==en.None&&(s.dispatchedFn=IE),r.callbackFn&&(s.callback=r.callbackFn),s.max=r.max||0,s.queue=r.queue,s}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:$t.All,ack_policy:en.Explicit,ack_wait:Lt(30*1e3),replay_policy:ha.Instant},r.config);const s=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(s.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=s.name,r.config=s.config,r.last=s}static ingestionFn(r){return(s,l)=>{var m;const u=l;if(!s)return{ingest:!1,protocol:!1};const c=s;if(sa(c.msg)||(m=u.monitor)==null||m.work(),ed(c.msg)){const d=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:d,protocol:!0}}else if(Wh(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(s):!0,protocol:!1}}}}class Bd{constructor(n){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=rE(n),this.listeners=[]}static connect(n={}){return new Promise((r,s)=>{const l=new Bd(n);Du.connect(l.options,l).then(u=>{l.protocol=u,(async function(){for await(const c of u.status())l.listeners.forEach(f=>{f.push(c)})})(),r(l)}).catch(u=>{s(u)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,r,s){if(this.isClosed())throw je.errorForCode(Ee.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw je.errorForCode(Ee.ConnectionDraining);if(n=n||"",n.length===0)throw je.errorForCode(Ee.BadSubject)}publish(n,r,s){this._check(n,!1,!0),this.protocol.publish(n,r,s)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,r={}){this._check(n,!0,!1);const s=new yx(this.protocol,n,r);return this.protocol.subscribe(s),s}_resub(n,r,s){this._check(r,!0,!1);const l=n;l.max=s,s&&(l.max=s+l.received),this.protocol.resub(l,r)}requestMany(n,r=Fn,s={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(m){return Promise.reject(m)}if(s.strategy=s.strategy||hr.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new je("timeout",Ee.InvalidOption));const u=new tn;function c(m){u.push(()=>{u.stop(m)})}function f(m,d){m||d===null?c(m===null?void 0:m):u.push(d)}if(s.noMux){const m=l?new Error().stack:null;let d=typeof s.maxMessages=="number"&&s.maxMessages>0?s.maxMessages:-1;const y=this.subscribe(Zr(this.options.inboxPrefix),{callback:(E,M)=>{var P,z;if(((P=M==null?void 0:M.data)==null?void 0:P.length)===0&&((z=M==null?void 0:M.headers)==null?void 0:z.status)===Ee.NoResponders&&(E=je.errorForCode(Ee.NoResponders)),E){m&&(E.stack+=`
82
+
83
+ ${m}`),g(E);return}f(null,M),s.strategy===hr.Count&&(d--,d===0&&g()),s.strategy===hr.JitterTimer&&(w(),x=setTimeout(()=>{g()},300)),s.strategy===hr.SentinelMsg&&M&&M.data.length===0&&g()}});y.requestSubject=n,y.closed.then(()=>{c()}).catch(E=>{u.stop(E)});const g=E=>{E&&u.push(()=>{throw E}),w(),y.drain().then(()=>{c()}).catch(M=>{c()})};u.iterClosed.then(()=>{w(),y==null||y.unsubscribe()}).catch(E=>{w(),y==null||y.unsubscribe()});try{this.publish(n,r,{reply:y.getSubject()})}catch(E){g(E)}let x=setTimeout(()=>{g()},s.maxWait);const w=()=>{x&&clearTimeout(x)}}else{const m=s;m.callback=f,u.iterClosed.then(()=>{d.cancel()}).catch(y=>{d.cancel(y)});const d=new c2(this.protocol.muxSubscriptions,n,m);this.protocol.request(d);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${d.token}`,headers:s.headers})}catch(y){d.cancel(y)}}return Promise.resolve(u)}request(n,r,s={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(u){return Promise.reject(u)}const l=!this.protocol.options.noAsyncTraces;if(s.timeout=s.timeout||1e3,s.timeout<1)return Promise.reject(new je("timeout",Ee.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new je("reply can only be used with noMux",Ee.InvalidOption));if(s.noMux){const u=s.reply?s.reply:Zr(this.options.inboxPrefix),c=zt(),f=l?new Error:null,m=this.subscribe(u,{max:1,timeout:s.timeout,callback:(d,y)=>{d?(f&&d.code!==Ee.Timeout&&(d.stack+=`
84
+
85
+ ${f.stack}`),m.unsubscribe(),c.reject(d)):(d=sx(y),d?(f&&(d.stack+=`
86
+
87
+ ${f.stack}`),c.reject(d)):c.resolve(y))}});return m.requestSubject=n,this.protocol.publish(n,r,{reply:u,headers:s.headers}),c}else{const u=new ox(this.protocol.muxSubscriptions,n,s,l);this.protocol.request(u);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:s.headers})}catch(f){u.cancel(f)}const c=Promise.race([u.timer,u.deferred]);return c.catch(()=>{u.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(je.errorForCode(Ee.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(je.errorForCode(Ee.ConnectionClosed)):this.isDraining()?Promise.reject(je.errorForCode(Ee.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new tn;return n.iterClosed.then(()=>{const r=this.listeners.indexOf(n);this.listeners.splice(r,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((r,s)=>r==="time"?new Date(Date.parse(s)):s)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const r=new OE(this,n);if(n.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===Ee.NoResponders&&(l.code=Ee.JetStreamNotEnabled),l}return r}jetstream(n={}){return new Ud(this,n)}getServerVersion(){const n=this.info;return n?fs(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw je.errorForCode(Ee.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new LE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(je.errorForCode(Ee.ConnectionClosed)):this.isDraining()?Promise.reject(je.errorForCode(Ee.ConnectionDraining)):this.protocol.reconnect()}}class LE{constructor(n){C(this,"nc");this.nc=n}add(n){try{return new $l(this.nc,n).start()}catch(r){return Promise.reject(r)}}client(n,r){return new mE(this.nc,n,r)}}class zE{constructor(n,r,s){C(this,"bucket");C(this,"sm");C(this,"prefixLen");this.bucket=n,this.prefixLen=r,this.sm=s}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Lu)||"PUT"}get length(){const n=this.sm.header.get(yn.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class UE{constructor(n,r,s){C(this,"bucket");C(this,"key");C(this,"sm");this.bucket=n,this.key=r,this.sm=s}get value(){return this.sm.data}get created(){return new Date(Rd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Lu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const n=((r=this.sm.headers)==null?void 0:r.get(yn.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class wx extends m2{constructor(r,s,l){super(r.nc,s,l);C(this,"js");C(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const s=Zr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const u=this.info;u.config.name=Bi.next(),u.ordered_consumer_sequence.delivery_seq=0,u.flow_control.heartbeat_count=0,u.flow_control.fc_count=0,u.flow_control.consumer_restarts++,u.deliver=s,u.config.deliver_subject=s,u.config.deliver_policy=$t.StartSequence,u.config.opt_start_seq=r;const c={};c.stream_name=this.info.stream,c.config=u.config;const f=`${u.api.prefix}.CONSUMER.CREATE.${u.stream}`;this.js._request(f,c,{retries:-1}).then(m=>{const d=m,y=this.sub.info;y.last=d,this.info.config=d.config,this.info.name=d.name}).catch(m=>{const d=new je(`unable to recreate ordered consumer ${u.stream} at seq ${r}`,Ee.RequestError,m);this.sub.callback(d,{})})}_maybeSetupHbMonitoring(){var s,l;const r=((l=(s=this.info)==null?void 0:s.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(Rd(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const u=this.sub,c=f=>{var y,g,x,w;const m=J_(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 E=((x=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(E+1),(w=this.monitor)==null||w.restart(),!1}return!u.noIterator};this.monitor=new Dd(r,c,l)}_checkHbOrderConsumer(r){const s=r.headers.get(yn.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(yn.LastConsumerSeqHdr),10),u=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==u.delivery_seq&&this._resetOrderedConsumer(u.stream_seq+1),!1}_checkOrderedConsumer(r){const s=this.info.ordered_consumer_sequence,l=r.info.streamSequence,u=r.info.deliverySequence;return u!=s.delivery_seq+1?(this._resetOrderedConsumer(s.stream_seq+1),!1):(s.delivery_seq=u,s.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${s}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${s}`,u=await r.api._request(l);return r.last=u,u}}class BE extends wx{constructor(n,r,s){super(n,r,s)}pull(n={batch:1}){const{stream:r,config:s,name:l}=this.sub.info,u=s.durable_name??l,c={};if(c.batch=n.batch||1,c.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const d=this.js.nc.features.get(at.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=Lt(f));let m=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(m=n.idle_heartbeat,c.idle_heartbeat=Lt(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 PE(e,n){return e?HE(n):qE(n)}function qE(e){return(n,r)=>n?[n,null]:(n=sa(r),n?[n,null]:[null,Ul(r,e)])}function HE(e){return(n,r)=>{if(n)return[n,null];const s=sa(r);return s!==null?[Sx(s),null]:[null,Ul(r,e)]}}function Sx(e){if(e!==null)switch(e.code){case Ee.JetStream404NoMessages:case Ee.JetStream408RequestTimeout:return null;case Ee.JetStream409:return X_(e)?e:null;default:return e}return null}function IE(e){e&&e.ack()}function FE(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 $E{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=FE(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]===yl[0]&&n[1]===yl[1]&&n[2]===yl[2]&&n[3]===yl[3]}async ackAck(n){var s;n=n||{},n.timeout=n.timeout||this.timeout;const r=zt();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const u=this.msg.publisher,c=!((s=u.options)!=null&&s.noAsyncTraces),f=new ox(u.muxSubscriptions,this.msg.reply,{timeout:n.timeout},c);u.request(f);try{u.publish(this.msg.reply,T0,{reply:`${u.muxSubscriptions.baseInbox}${f.token}`})}catch(m){f.cancel(m)}try{await Promise.race([f.timer,f.deferred]),r.resolve(!0)}catch(m){f.cancel(m),r.reject(m)}}else r.resolve(!1);return r}ack(){this.doAck(T0)}nak(n){let r=EE;n&&(r=ju().encode(`-NAK ${JSON.stringify({delay:Lt(n)})}`)),this.doAck(r)}working(){this.doAck(yl)}next(n,r={batch:1}){const s={};s.batch=r.batch||1,s.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(s.expires=Lt(r.expires));const l=dr().encode(s),u=da.concat(kE,AE,l),c=n?{reply:n}:void 0;this.msg.respond(u,c)}term(n=""){let r=CE;(n==null?void 0:n.length)>0&&(r=ju().encode(`+TERM ${n}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const YE="1.30.3",GE="nats.ws";class VE{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=YE,this.lang=GE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=zt(),this.closedNotification=zt()}async connect(n,r){const s=zt();if(r.tls)return s.reject(new je("tls",Ee.InvalidOption)),s;this.options=r;const l=n.src;if(r.wsFactory){const{socket:u,encrypted:c}=await r.wsFactory(n.src,r);this.socket=u,this.encrypted=c}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=u=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(u.data)),this.peeked){this.signal.resolve();return}const c=da.concat(...this.yields),f=v2(c);if(f!==""){const m=aE.exec(f);if(!m){r.debug&&console.error("!!!",cu(c)),s.reject(new Error("unexpected response from server"));return}try{const d=JSON.parse(m[1]);iE(d,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(d){s.reject(d);return}}},this.socket.onclose=u=>{if(this.isDiscarded())return;this.socketClosed=!0;let c;this.done||(u.wasClean||(c=new Error(u.reason)),this._closed(c))},this.socket.onerror=u=>{if(this.isDiscarded())return;const c=u,f=new je(c.message,Ee.Unknown,new Error(c.error));s.reject(f)},s}disconnect(){this._closed(void 0,!0)}async _closed(n,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await xa(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(`> ${cu(n[r])}`),yield n[r];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=zt())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${cu(n)}`);return}catch(r){this.options.debug&&console.error(`!!! ${cu(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 JE(e,n){/^(.*:\/\/)(.*)/.test(e)||(typeof n=="boolean"?e=`${n===!0?"https":"http"}://${e}`:e=`https://${e}`);let s=new URL(e);const l=s.protocol.toLowerCase();l==="ws:"&&(n=!1),l==="wss:"&&(n=!0),l!=="https:"&&l!=="http"&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2"),s=new URL(`http://${e}`));let u,c;const f=s.hostname,m=s.pathname,d=s.search||"";switch(l){case"http:":case"ws:":case"nats:":c=s.port||"80",u="ws:";break;case"https:":case"wss:":case"tls:":c=s.port||"443",u="wss:";break;default:c=s.port||n===!0?"443":"80",u=n===!0?"wss:":"ws:";break}return`${u}//${f}:${c}${m}${d}`}function _x(e={}){return p2({defaultPort:443,urlParseFn:JE,factory:()=>new VE}),Bd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var ma;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(ma||(ma={}));class Ch extends Error{constructor(n,r,s){super(n),this.message=n,this.code=r,this.data=s}}const XE=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"},KE=e=>{const n=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>n!==null?n.name:XE(e),u=()=>l()!=="web",c=g=>{const x=d.get(g);return!!(x!=null&&x.platforms.has(l())||f(g))},f=g=>{var x;return(x=r.PluginHeaders)===null||x===void 0?void 0:x.find(w=>w.name===g)},m=g=>e.console.error(g),d=new Map,y=(g,x={})=>{const w=d.get(g);if(w)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),w.proxy;const E=l(),M=f(g);let P;const z=async()=>(!P&&E in x?P=typeof x[E]=="function"?P=await x[E]():P=x[E]:n!==null&&!P&&"web"in x&&(P=typeof x.web=="function"?P=await x.web():P=x.web),P),I=(J,F)=>{var L,W;if(M){const Q=M==null?void 0:M.methods.find(oe=>F===oe.name);if(Q)return Q.rtype==="promise"?oe=>r.nativePromise(g,F.toString(),oe):(oe,ae)=>r.nativeCallback(g,F.toString(),oe,ae);if(J)return(L=J[F])===null||L===void 0?void 0:L.bind(J)}else{if(J)return(W=J[F])===null||W===void 0?void 0:W.bind(J);throw new Ch(`"${g}" plugin is not implemented on ${E}`,ma.Unimplemented)}},j=J=>{let F;const L=(...W)=>{const Q=z().then(oe=>{const ae=I(oe,J);if(ae){const G=ae(...W);return F=G==null?void 0:G.remove,G}else throw new Ch(`"${g}.${J}()" is not implemented on ${E}`,ma.Unimplemented)});return J==="addListener"&&(Q.remove=async()=>F()),Q};return L.toString=()=>`${J.toString()}() { [capacitor code] }`,Object.defineProperty(L,"name",{value:J,writable:!1,configurable:!1}),L},K=j("addListener"),B=j("removeListener"),R=(J,F)=>{const L=K({eventName:J},F),W=async()=>{const oe=await L;B({eventName:J,callbackId:oe},F)},Q=new Promise(oe=>L.then(()=>oe({remove:W})));return Q.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await W()},Q},Y=new Proxy({},{get(J,F){switch(F){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return M?R:K;case"removeListener":return B;default:return j(F)}}});return s[g]=Y,d.set(g,{name:g,proxy:Y,platforms:new Set([...Object.keys(x),...M?[E]:[]])}),Y};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=m,r.isNativePlatform=u,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=Ch,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},QE=e=>e.Capacitor=KE(e),pr=QE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),va=pr.registerPlugin;class Pd{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(n,r){let s=!1;this.listeners[n]||(this.listeners[n]=[],s=!0),this.listeners[n].push(r);const u=this.windowListeners[n];u&&!u.registered&&this.addWindowListener(u),s&&this.sendRetainedArgumentsForEvent(n);const c=async()=>this.removeListener(n,r);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const n in this.windowListeners)this.removeWindowListener(this.windowListeners[n]);this.windowListeners={}}notifyListeners(n,r,s){const l=this.listeners[n];if(!l){if(s){let u=this.retainedEventArguments[n];u||(u=[]),u.push(r),this.retainedEventArguments[n]=u}return}l.forEach(u=>u(r))}hasListeners(n){var r;return!!(!((r=this.listeners[n])===null||r===void 0)&&r.length)}registerWindowListener(n,r){this.windowListeners[r]={registered:!1,windowEventName:n,pluginEventName:r,handler:s=>{this.notifyListeners(r,s)}}}unimplemented(n="not implemented"){return new pr.Exception(n,ma.Unimplemented)}unavailable(n="not available"){return new pr.Exception(n,ma.Unavailable)}async removeListener(n,r){const s=this.listeners[n];if(!s)return;const l=s.indexOf(r);this.listeners[n].splice(l,1),this.listeners[n].length||this.removeWindowListener(this.windowListeners[n])}addWindowListener(n){window.addEventListener(n.windowEventName,n.handler),n.registered=!0}removeWindowListener(n){n&&(window.removeEventListener(n.windowEventName,n.handler),n.registered=!1)}sendRetainedArgumentsForEvent(n){const r=this.retainedEventArguments[n];r&&(delete this.retainedEventArguments[n],r.forEach(s=>{this.notifyListeners(n,s)}))}}const N0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),O0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class ZE extends Pd{async getCookies(){const n=document.cookie,r={};return n.split(";").forEach(s=>{if(s.length<=0)return;let[l,u]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=O0(l).trim(),u=O0(u).trim(),r[l]=u}),r}async setCookie(n){try{const r=N0(n.key),s=N0(n.value),l=n.expires?`; expires=${n.expires.replace("expires=","")}`:"",u=(n.path||"/").replace("path=",""),c=n.url!=null&&n.url.length>0?`domain=${n.url}`:"";document.cookie=`${r}=${s||""}${l}; path=${u}; ${c};`}catch(r){return Promise.reject(r)}}async deleteCookie(n){try{document.cookie=`${n.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const n=document.cookie.split(";")||[];for(const r of n)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(n){return Promise.reject(n)}}async clearAllCookies(){try{await this.clearCookies()}catch(n){return Promise.reject(n)}}}va("CapacitorCookies",{web:()=>new ZE});const WE=async e=>new Promise((n,r)=>{const s=new FileReader;s.onload=()=>{const l=s.result;n(l.indexOf(",")>=0?l.split(",")[1]:l)},s.onerror=l=>r(l),s.readAsDataURL(e)}),ek=(e={})=>{const n=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[n[c]],l),{})},tk=(e,n=!0)=>e?Object.entries(e).reduce((s,l)=>{const[u,c]=l;let f,m;return Array.isArray(c)?(m="",c.forEach(d=>{f=n?encodeURIComponent(d):d,m+=`${u}=${f}&`}),m.slice(0,-1)):(f=n?encodeURIComponent(c):c,m=`${u}=${f}`),`${s}&${m}`},"").substr(1):null,nk=(e,n={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},n),l=ek(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 rk extends Pd{async request(n){const r=nk(n,n.webFetchExtra),s=tk(n.params,n.shouldEncodeUrlParams),l=s?`${n.url}?${s}`:n.url,u=await fetch(l,r),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?n:{};c.includes("application/json")&&(f="json");let m,d;switch(f){case"arraybuffer":case"blob":d=await u.blob(),m=await WE(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,x)=>{y[x]=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"}))}}va("CapacitorHttp",{web:()=>new rk});var R0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(R0||(R0={}));var M0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(M0||(M0={}));class ik extends Pd{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}va("SystemBars",{web:()=>new ik});const zu=pr.isNativePlatform()?"https://app.palmier.me":"";async function Ex(e,n,r,s){const l=`${zu}${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 sk(e,n,r){return Ex("POST",e,n)}function ak(e,n){return Ex("GET",e,void 0)}const kx=N.createContext({connected:!1,mode:"disconnected",nc:null,request(){return Promise.reject(new Error("No host connection"))},subscribeEvents(){return()=>{}},activeHost:null,unauthorized:!1}),lk=2e3,Ah=6e3;function ok({children:e}){const{getActiveHost:n}=ba(),r=n(),[s,l]=N.useState(null),[u,c]=N.useState(!1),f=N.useRef(null),[m,d]=N.useState(!1),[y,g]=N.useState(!1),x=N.useRef(ju()),w=N.useRef(new Set),E=N.useRef(0),M=r!=null&&!!r.directUrl,P=r?M?m?"direct":"disconnected":u?"nats":"disconnected":"disconnected",z=P!=="disconnected";N.useEffect(()=>{g(!1)},[r==null?void 0:r.hostId,r==null?void 0:r.clientToken]),N.useEffect(()=>{if(M){f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1));return}if(!r)return;let K=!1;async function B(){try{const R=await fetch(`${zu}/api/nats-credentials/${r.hostId}`);if(!R.ok){console.error("[NATS] Failed to fetch credentials");return}const Y=await R.json();if(!Y.natsWsUrl){console.warn("[NATS] No WebSocket URL configured");return}if(K)return;console.log("[NATS] Connecting to",Y.natsWsUrl);const J=await _x({servers:Y.natsWsUrl,authenticator:mx(Y.natsJwt,new TextEncoder().encode(Y.natsNkeySeed))});if(K){J.close().catch(()=>{});return}console.log("[NATS] Connected"),f.current=J,l(J),c(!0),J.closed().then(()=>{console.log("[NATS] Connection closed"),K||(l(null),c(!1),f.current=null)})}catch(R){console.error("[NATS] Connection failed:",R),K||c(!1)}}return B(),()=>{K=!0,f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1))}},[M,r]),N.useEffect(()=>{if(!r||!M){d(!1);return}const K=new AbortController;async function B(){var F;const Y=new AbortController,J=setTimeout(()=>Y.abort(),lk);K.signal.addEventListener("abort",()=>Y.abort());try{const L=await fetch(`${r.directUrl}/events`,{headers:{Authorization:`Bearer ${r.clientToken}`},signal:Y.signal});return clearTimeout(J),L.ok?((F=L.body)==null?void 0:F.getReader())??null:null}catch{return clearTimeout(J),null}}async function R(Y){d(!0),console.log("[HOST] SSE connected to",r.directUrl),E.current=Date.now();function J(){setTimeout(()=>{K.signal.aborted||Date.now()-E.current<Ah||(console.log("[HOST] Heartbeat timeout — no data for",Ah/1e3,"s"),K.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},Ah)}J();const F=new TextDecoder;let L="";try{for(;;){const{done:W,value:Q}=await Y.read();if(W)break;L+=F.decode(Q,{stream:!0}),E.current=Date.now(),J();const oe=L.split(`
88
+ `);L=oe.pop()??"";for(const ae of oe)if(ae.startsWith("data: ")){const G=ae.slice(6);try{const H=JSON.parse(G);if(H.task_id&&H.event_type){const X=`host-event.${r.hostId}.${H.task_id}`;for(const ue of w.current)ue({subject:X,data:x.current.encode(G)})}}catch{}}}}catch{}}return(async()=>{const Y=await B();Y&&await R(Y)})(),()=>{K.abort(),d(!1)}},[r,M]);const I=N.useCallback(async(K,B,R)=>{if(!r)throw new Error("No active host");function Y(oe){oe&&typeof oe=="object"&&oe.error==="Unauthorized"&&g(!0)}if(M){console.log(`[HOST/HTTP] → ${K}`,B??"");const oe=await fetch(`${r.directUrl}/rpc/${K}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.clientToken}`},body:B!=null?JSON.stringify(B):void 0,signal:R!=null&&R.timeout?AbortSignal.timeout(R.timeout):void 0});if(oe.status===401)throw g(!0),new Error("Unauthorized");const ae=await oe.json();return Y(ae),console.log(`[HOST/HTTP] ← ${K}`,ae),ae}if(!f.current)throw new Error("Not connected");const J=`host.${r.hostId}.rpc.${K}`,F={...B??{},clientToken:r.clientToken},L=x.current.encode(JSON.stringify(F));console.log(`[HOST/NATS] → ${K}`,B??"");const W=await f.current.request(J,L,{timeout:(R==null?void 0:R.timeout)??1e4}),Q=JSON.parse(x.current.decode(W.data));return Y(Q),console.log(`[HOST/NATS] ← ${K}`,Q),Q},[r,M]),j=N.useCallback((K,B)=>{if(M)return w.current.add(B),()=>{w.current.delete(B)};if(f.current){const R=f.current.subscribe(`host-event.${K}.>`);let Y=!1;return(async()=>{try{for await(const J of R){if(Y)break;B({subject:J.subject,data:J.data})}}catch{}})(),()=>{Y=!0,R.unsubscribe()}}return()=>{}},[r,M]);return b.jsx(kx.Provider,{value:{connected:z,mode:P,nc:s,request:I,subscribeEvents:j,activeHost:r,unauthorized:y},children:e})}function Yl(){return N.useContext(kx)}const Ut=pr.isNativePlatform()?va("Device"):null;function Uu(e){const n=new Date(e),r=new Date,s=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return n.toDateString()===r.toDateString()?s:`${n.toLocaleDateString(void 0,{month:"short",day:"numeric"})} ${s}`}const Cx={};function uk(e){for(const n of e)Cx[n.key]=n.label}function hd(e){return Cx[e]??e}const ck=()=>window.matchMedia("(max-width: 600px)").matches;function fk({task:e,lastEvent:n,onEdit:r,onDelete:s,onViewRun:l}){var oe;const{request:u}=Yl(),[c,f]=N.useState(!1),[m,d]=N.useState(!1),[y,g]=N.useState(!1),x=N.useRef(null),w=(n==null?void 0:n.running_state)==="started",E=(((oe=e.schedule_values)==null?void 0:oe.length)??0)>0,M=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",z=!!e.schedule_enabled&&!!e.schedule_type&&(E||M)?w?"var(--color-success)":(n==null?void 0:n.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";N.useEffect(()=>{if(!m)return;function ae(G){x.current&&!x.current.contains(G.target)&&d(!1)}return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[m]);function I(){ck()?g(!0):d(ae=>!ae)}function j(){d(!1),g(!1)}async function K(){if(j(),!!confirm("Abort this task?")){f(!0);try{await u("task.abort",{id:e.id})}catch(ae){console.error("Abort failed:",ae)}finally{f(!1)}}}async function B(){j();try{const ae=await u("task.run",{id:e.id});l(e.id,ae.run_id)}catch(ae){console.error("Run failed:",ae)}}async function R(){if(j(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),s(e.id)}catch(ae){console.error("Delete failed:",ae)}}const Y={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function J(ae,G){if(ae==="specific_times"){const ve=new Date(G);return{kind:"specific_times",detail:isNaN(ve.getTime())?G:`${ve.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})} at ${ve.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}}const H=G.split(" ");if(H.length!==5)return{kind:"unknown",detail:G};const[X,ue,_e,,_]=H,D=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(ue==="*")return{kind:"hourly",detail:""};const ee=new Date;ee.setHours(Number(ue),Number(X),0,0);const A=ee.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return _!=="*"?{kind:"weekly",detail:`${D[Number(_)]??_} at ${A}`}:_e!=="*"?{kind:"monthly",detail:`day ${_e} at ${A}`}:{kind:"daily",detail:A}}function F(ae,G){const H=J(ae,G);return H.kind==="hourly"?"Every hour":H.kind==="specific_times"?`Once on ${H.detail}`:`${H.kind.charAt(0).toUpperCase()+H.kind.slice(1)}: ${H.detail}`}function L(ae,G){if(!ae)return"";if(ae==="on_new_notification")return"On new notification";if(ae==="on_new_sms")return"On new SMS";if(!G||G.length===0)return"";if(G.length===1)return F(ae,G[0]);const H=G.map(ue=>J(ae,ue));if(new Set(H.map(ue=>ue.kind)).size===1){const ue=H[0].kind;if(ue==="hourly")return"Every hour";const _e=H.map(_=>_.detail);return`${ue.charAt(0).toUpperCase()+ue.slice(1)}: ${_e.join(", ")}`}return G.map(ue=>F(ae,ue)).join(", ")}const W=L(e.schedule_type,e.schedule_values),Q=b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:()=>{j(),r(e)},children:[b.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),b.jsxs("button",{onClick:()=>{j(),l(e.id)},children:[b.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),w?b.jsxs("button",{className:"menu-item-danger",onClick:K,disabled:c,children:[b.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:B,children:[b.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),b.jsxs("button",{className:"menu-item-danger",onClick:R,children:[b.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"task-card",onClick:()=>l(e.id,"latest"),children:[b.jsxs("div",{className:"task-card-header",children:[b.jsxs("div",{className:"task-card-title-row",children:[w?b.jsx("span",{className:"status-spinner",children:b.jsx("span",{})}):b.jsx("span",{className:"status-dot",style:{backgroundColor:z}}),b.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),b.jsx("div",{className:"task-card-actions",onClick:ae=>ae.stopPropagation(),children:b.jsxs("div",{className:"task-card-menu",ref:x,children:[b.jsx("button",{className:"task-card-menu-btn",onClick:I,"aria-label":"Task actions",children:"⋮"}),m&&b.jsx("div",{className:"task-card-menu-dropdown",children:Q})]})})]}),b.jsxs("div",{className:"task-card-meta",children:[e.agent&&b.jsx("span",{className:"task-card-agent",children:hd(e.agent)}),n&&Y[n.running_state]&&b.jsxs("span",{className:"task-card-last-event",children:[Y[n.running_state]," ",Uu(n.time_stamp)]}),e.schedule_type&&(E||M)&&b.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?W:"Schedule disabled"})]})]}),y&&ca.createPortal(b.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>g(!1),children:b.jsxs("div",{className:"bottom-sheet",onClick:ae=>ae.stopPropagation(),children:[b.jsx("div",{className:"bottom-sheet-handle"}),b.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),b.jsx("div",{className:"bottom-sheet-actions",children:Q})]})}),document.body)]})}function hk({permissions:e}){return b.jsxs("div",{className:"plan-dialog",children:[b.jsx("h2",{children:"Granted Permissions"}),b.jsx("div",{className:"plan-dialog-scroll",children:e&&e.length>0?b.jsx("div",{className:"permissions-section",children:b.jsx("ul",{className:"permissions-list",children:e.map((n,r)=>b.jsxs("li",{className:"permission-item",children:[b.jsx("span",{className:"permission-tool",children:n.name}),b.jsx("span",{className:"permission-desc",children:n.description})]},r))})}):b.jsx("p",{className:"plan-empty",children:"No permissions have been granted for this task."})}),b.jsx("div",{className:"plan-dialog-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const Ws=[];function dk(){const e=Ws.pop();e&&(e.pushed.current=!1,e.close())}let D0=!1;function mk(){D0||(D0=!0,window.addEventListener("popstate",dk))}function L0(e,n){const r=N.useRef(!1),s=N.useRef(n);s.current=n;const l=N.useCallback(()=>s.current(),[]),u=N.useRef({close:l,pushed:r});u.current.close=l,N.useEffect(()=>{if(e&&!r.current)mk(),history.pushState({modal:!0},""),Ws.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=Ws.indexOf(u.current);c!==-1&&Ws.splice(c,1),history.back()}},[e,l]),N.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=Ws.indexOf(c);f!==-1&&Ws.splice(f,1),history.back()}}},[])}const pk=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],gk=["specific_times","hourly","daily","weekly","monthly"];function mu(e){return gk.includes(e)}function yk(e){return e==="on_new_notification"||e==="on_new_sms"}function Qr(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function bk(e){const n=e.split(" ");if(n.length!==5)return Qr();const[r,s,l,,u]=n;if(s==="*")return Qr("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...Qr("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...Qr("monthly"),time:c,dayOfMonth:l}:{...Qr("daily"),time:c}}function Ax(e,n){if(e==="specific_times"){const[r,s]=n.split("T");return{...Qr("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return bk(n)}function xk(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 vk(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:xk(e)}function Th(e){return e==="specific_times"?"specific_times":e==="on_new_notification"?"on_new_notification":e==="on_new_sms"?"on_new_sms":"crons"}function jh(e){var s;if(!e)return"daily";if(e.command)return"command";const n=e.schedule_type;if(n==="on_new_notification"||n==="on_new_sms")return n;if(n!=="crons"&&n!=="specific_times")return"ondemand";const r=(s=e.schedule_values)==null?void 0:s[0];return r?Ax(n,r).schedule:"ondemand"}function wk({initial:e,agents:n,hostPlatform:r,isNotificationListener:s,onSaved:l,onRun:u,onCancel:c}){var Yt;const{request:f}=Yl(),m=()=>{var Se;const ge=localStorage.getItem("palmier:lastAgent"),ze=n.map(ft=>ft.key);return ge&&ze.includes(ge)?ge:((Se=n[0])==null?void 0:Se.key)??""},[d,y]=N.useState((e==null?void 0:e.user_prompt)??""),[g,x]=N.useState((e==null?void 0:e.agent)??m()),w=!!((Yt=e==null?void 0:e.permissions)!=null&&Yt.length),[E,M]=N.useState(!1),P=N.useCallback(()=>M(!1),[]);L0(E,P);const[z,I]=N.useState(null),[j,K]=N.useState(()=>jh(e)),[B,R]=N.useState(()=>{const ge=e==null?void 0:e.schedule_type,ze=e==null?void 0:e.schedule_values;if(ze&&(ge==="crons"||ge==="specific_times"))return ze.map(ft=>Ax(ge,ft));const Se=jh(e);return mu(Se)?[Qr(Se)]:[]}),[Y,J]=N.useState((e==null?void 0:e.requires_confirmation)??!1),[F,L]=N.useState((e==null?void 0:e.schedule_enabled)??!0),[W,Q]=N.useState((e==null?void 0:e.yolo_mode)??!1),[oe,ae]=N.useState((e==null?void 0:e.foreground_mode)??!1),[G,H]=N.useState((e==null?void 0:e.command)??""),[X,ue]=N.useState(!1),_e=(e==null?void 0:e.schedule_type)==="on_new_notification"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[_,D]=N.useState(_e),[ee,A]=N.useState([]),[ve,Ae]=N.useState(!1),[Te,Me]=N.useState(!1),[He,be]=N.useState(""),De=N.useCallback(()=>Me(!1),[]);L0(Te,De),N.useEffect(()=>{if(j!=="on_new_notification"||!s||!pr.isNativePlatform()||!Ut)return;let ge=!1;return Ae(!0),Ut.getInstalledApps().then(({apps:ze})=>{if(ge)return;const Se="com.palmier.app",ft=ze.filter(pt=>pt.packageName!==Se).sort((pt,Tn)=>(pt.appName||pt.packageName).localeCompare(Tn.appName||Tn.packageName));A(ft)}).catch(()=>{}).finally(()=>{ge||Ae(!1)}),()=>{ge=!0}},[j,s]);const Ze=(e==null?void 0:e.schedule_type)==="on_new_sms"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[dt,lt]=N.useState(Ze),ct=N.useRef(null),Fe=mu(j),Ue=j==="command",tt=yk(j),mt=n.find(ge=>ge.key===g),st=!!(mt!=null&&mt.supportsYolo);N.useEffect(()=>{!st&&W&&Q(!1)},[st,W]);const Mt=!!e,yt=jh(e),$n=!Mt||d!==((e==null?void 0:e.user_prompt)??"")||g!==((e==null?void 0:e.agent)??"")||j!==yt||Y!==((e==null?void 0:e.requires_confirmation)??!1)||F!==((e==null?void 0:e.schedule_enabled)??!0)||W!==((e==null?void 0:e.yolo_mode)??!1)||oe!==((e==null?void 0:e.foreground_mode)??!1)||Ue&&G!==((e==null?void 0:e.command)??"")||Fe&&(JSON.stringify($e())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Th(j)!==((e==null?void 0:e.schedule_type)??void 0))||tt&&j!==(e==null?void 0:e.schedule_type)||j==="on_new_notification"&&_.trim()!==_e.trim()||j==="on_new_sms"&&dt.trim()!==Ze.trim(),gr=Fe&&B.some(ge=>ge.schedule==="specific_times"&&(!ge.onceDate||new Date(`${ge.onceDate}T${ge.onceTime}`)<=new Date)),vt=$n&&!!d.trim()&&!gr&&(!Ue||!!G.trim())&&(!Fe||B.length>0);function An(ge,ze){R(Se=>Se.map((ft,pt)=>pt===ge?{...ft,...ze}:ft))}function fe(ge){R(ze=>ze.filter((Se,ft)=>ft!==ge))}function we(){mu(j)&&R(ge=>[...ge,ge.length>0?{...ge[ge.length-1]}:Qr(j)])}function Be(ge){K(ge),mu(ge)?R([Qr(ge)]):(R([]),J(!1)),ge==="command"?setTimeout(()=>{var ze;return(ze=ct.current)==null?void 0:ze.focus()},0):H(""),ge!=="on_new_notification"&&D(_e),ge!=="on_new_sms"&&lt(Ze)}function $e(){return B.flatMap(ge=>{const ze=vk(ge);return ze?[ze]:[]})}function rt(){return W?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 nn(){ue(!0),I(null);try{const ge=Fe?$e():j==="on_new_notification"&&_.trim()?[_.trim()]:j==="on_new_sms"&&dt.trim()?[dt.trim()]:[],ze=Fe||tt?Th(j):null,Se={user_prompt:d,agent:g,schedule_type:ze,schedule_values:ge.length>0?ge:null,schedule_enabled:j!=="ondemand"&&F,requires_confirmation:Fe?Y:!1,yolo_mode:W,foreground_mode:oe,command:Ue?G:""};Mt&&(Se.id=e.id);const pt=await f(Mt?"task.update":"task.create",Se,{timeout:45e3});if(pt.error){I(pt.error);return}if(Mt||localStorage.setItem("palmier:lastAgent",g),Ue&&!Mt){l(pt);try{const Tn=await f("task.run",{id:pt.id});Tn.run_id?u(pt.id,Tn.run_id):Tn.error||u(pt.id)}catch{}return}l(pt)}catch(ge){I(ge instanceof Error?ge.message:String(ge))}finally{ue(!1)}}const bn=Mt?"Save":Ue?"Run":(Fe||tt)&&F?"Schedule":"Save";return b.jsxs("div",{className:"task-form-overlay",children:[b.jsx("div",{className:"task-form",children:E?b.jsx(hk,{permissions:e==null?void 0:e.permissions}):b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"task-form-header",children:b.jsx("h2",{children:e?"Edit Task":"New Task"})}),z&&b.jsx("div",{className:"form-error",children:z}),b.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:d,onChange:ge=>y(ge.target.value),placeholder:Ue?"If the input email contains an event, create a calendar entry for it.":"Research today's top AI news and write a summary.",rows:4,disabled:X}),b.jsxs("div",{className:"plan-actions",children:[b.jsxs("div",{className:"agent-picker-section-inline",children:[b.jsx("span",{className:"agent-picker-label",children:"Run with"}),b.jsx("select",{className:"form-select form-select-sm",value:g,onChange:ge=>x(ge.target.value),disabled:X,children:n.map(ge=>b.jsx("option",{value:ge.key,children:ge.label},ge.key))})]}),st&&b.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[b.jsx("input",{type:"checkbox",checked:W,onChange:ge=>Q(ge.target.checked),disabled:X}),"Yolo"]}),st&&W&&b.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),w&&b.jsx("div",{className:"granted-permissions-row",children:b.jsx("button",{className:"btn btn-link",onClick:()=>M(!0),children:"Granted Permissions"})})]}),b.jsx("div",{className:"toggles-group",children:b.jsxs("div",{className:"schedule-section",children:[b.jsx("h3",{className:"schedule-section-title",children:"Schedule"}),b.jsxs("select",{className:"form-select",value:j,onChange:ge=>Be(ge.target.value),disabled:X,children:[b.jsx("option",{value:"ondemand",children:"On Demand"}),b.jsx("option",{value:"specific_times",children:"Specific Times"}),b.jsx("option",{value:"hourly",children:"Hourly"}),b.jsx("option",{value:"daily",children:"Daily"}),b.jsx("option",{value:"weekly",children:"Weekly"}),b.jsx("option",{value:"monthly",children:"Monthly"}),b.jsx("option",{value:"on_new_notification",children:"On New Notification"}),b.jsx("option",{value:"on_new_sms",children:"On New SMS"}),b.jsx("option",{value:"command",children:"Command-triggered"})]}),tt&&b.jsxs("div",{className:"schedule-reactive",children:[b.jsxs("p",{className:"command-help-text",children:[j==="on_new_notification"?"Runs each time a new push notification arrives on the paired Android device.":"Runs each time a new SMS arrives on the paired Android device."," ","The triggering payload is spliced into your task prompt — reference it as “the new ",j==="on_new_notification"?"notification":"SMS","”."]}),j==="on_new_notification"&&(()=>{const ge=ee.find(Se=>Se.packageName===_),ze=(ge==null?void 0:ge.appName)||_;return b.jsxs(b.Fragment,{children:[s?_.trim()?b.jsxs("div",{className:"app-filter-selected",children:[b.jsx("span",{className:"app-filter-selected-name",children:ze}),(ge==null?void 0:ge.appName)&&b.jsx("span",{className:"app-filter-selected-pkg",children:ge.packageName}),b.jsx("button",{type:"button",className:"app-filter-selected-clear",onClick:()=>D(""),"aria-label":"Clear app filter",disabled:X,children:"✕"})]}):b.jsx("button",{type:"button",className:"btn btn-link app-filter-trigger",onClick:()=>{be(""),Me(!0)},disabled:X,children:"Select app"}):b.jsx("input",{className:"form-input",type:"text",value:_,onChange:Se=>D(Se.target.value),placeholder:"App (optional), e.g. com.google.android.gm",disabled:X}),b.jsx("p",{className:"command-help-text app-filter-help",children:_.trim()?`Only notifications from ${ze} will trigger this task.`:"Every notification from your device triggers this task."})]})})(),j==="on_new_sms"&&b.jsxs(b.Fragment,{children:[b.jsx("input",{className:"form-input",type:"text",value:dt,onChange:ge=>lt(ge.target.value),placeholder:"From (optional), e.g. +1 555-1234)",disabled:X}),b.jsx("p",{className:"command-help-text app-filter-help",children:dt.trim()?`Only SMS from ${dt.trim()} will trigger this task. Formatting (spaces, dashes, parens) is ignored.`:"Every SMS that arrives on your device triggers this task."})]})]}),Ue&&b.jsxs("div",{className:"schedule-reactive",children:[b.jsx("p",{className:"command-help-text",children:"Runs a command and invokes the task for each line of output. Use “the input” in your task description to reference each line."}),b.jsx("input",{ref:ct,className:"form-input form-input-mono",type:"text",value:G,onChange:ge=>H(ge.target.value),placeholder:"gws gmail +watch --project my-project",disabled:X})]}),Fe&&j!=="hourly"&&b.jsxs(b.Fragment,{children:[B.map((ge,ze)=>b.jsxs("div",{className:"trigger-row-card",children:[b.jsxs("div",{className:"trigger-row-content",children:[j==="daily"&&b.jsx("input",{className:"form-input",type:"time",value:ge.time,onChange:Se=>An(ze,{time:Se.target.value})}),j==="weekly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:ge.dayOfWeek,onChange:Se=>An(ze,{dayOfWeek:Se.target.value}),children:pk.map((Se,ft)=>b.jsx("option",{value:String(ft),children:Se},ft))}),b.jsx("input",{className:"form-input",type:"time",value:ge.time,onChange:Se=>An(ze,{time:Se.target.value})})]}),j==="monthly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:ge.dayOfMonth,onChange:Se=>An(ze,{dayOfMonth:Se.target.value}),children:Array.from({length:28},(Se,ft)=>ft+1).map(Se=>b.jsxs("option",{value:String(Se),children:["Day ",Se]},Se))}),b.jsx("input",{className:"form-input",type:"time",value:ge.time,onChange:Se=>An(ze,{time:Se.target.value})})]}),j==="specific_times"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("input",{className:"form-input",type:"date",value:ge.onceDate,min:new Date().toISOString().split("T")[0],onChange:Se=>An(ze,{onceDate:Se.target.value})}),b.jsx("input",{className:"form-input",type:"time",value:ge.onceTime,min:ge.onceDate===new Date().toISOString().split("T")[0]?new Date().toTimeString().slice(0,5):void 0,onChange:Se=>An(ze,{onceTime:Se.target.value})})]})]}),B.length>1&&b.jsx("button",{className:"trigger-remove-btn",onClick:()=>fe(ze),title:"Remove trigger",children:"×"})]},ze)),b.jsx("button",{className:"trigger-add-btn",onClick:we,children:"+ Add"})]}),r==="win32"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:oe,onChange:ge=>ae(ge.target.checked),disabled:X}),"Run in the foreground (host must login to Windows)"]}),Fe&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:Y,onChange:ge=>J(ge.target.checked),disabled:X}),"Confirm before each run"]}),j!=="ondemand"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:F,onChange:ge=>L(ge.target.checked),disabled:X}),"Enabled"]})]})}),!W&&mt&&!mt.supportsPermissions&&b.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",mt.label,". The task may fail if required permissions are not pre-configured."]}),b.jsxs("div",{className:"form-actions",children:[b.jsxs("button",{className:"btn btn-primary",onClick:()=>rt()&&nn(),disabled:!vt||X,children:[X&&b.jsx("span",{className:"btn-spinner"}),bn]}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{$n&&d.trim()&&!confirm("You have unsaved changes. Discard?")||c()},style:{marginLeft:"auto"},children:"Cancel"})]})]})}),Te&&(()=>{const ge=He.trim().toLowerCase(),ze=ge?ee.filter(Se=>Se.packageName.toLowerCase().includes(ge)||Se.appName.toLowerCase().includes(ge)):ee;return b.jsx("div",{className:"app-filter-overlay",onClick:De,children:b.jsxs("div",{className:"app-filter-dialog",onClick:Se=>Se.stopPropagation(),children:[b.jsxs("div",{className:"app-filter-header",children:[b.jsx("h2",{children:"Select app"}),b.jsx("button",{className:"app-filter-close",onClick:De,"aria-label":"Close",children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:b.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),b.jsx("input",{className:"form-input app-filter-search",type:"text",value:He,onChange:Se=>be(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&He.trim()&&(D(He.trim()),De())},placeholder:"Search or type a package name",autoFocus:!0}),b.jsxs("ul",{className:"app-filter-list",children:[ve&&ee.length===0?Array.from({length:6}).map((Se,ft)=>b.jsx("li",{className:"app-filter-row app-filter-skeleton",children:b.jsx("div",{className:"app-filter-skeleton-bar"})},`sk-${ft}`)):ze.length===0&&!He.trim()?b.jsx("li",{className:"app-filter-empty",children:"No apps"}):ze.map(Se=>b.jsx("li",{className:"app-filter-row",onClick:()=>{D(Se.packageName),De()},children:b.jsxs("div",{className:"app-filter-row-labels",children:[b.jsx("div",{className:"app-filter-row-name",children:Se.appName||Se.packageName}),Se.appName&&b.jsx("div",{className:"app-filter-row-pkg",children:Se.packageName})]})},Se.packageName)),He.trim()&&b.jsx("li",{className:"app-filter-row",onClick:()=>{D(He.trim()),De()},children:b.jsx("div",{className:"app-filter-row-labels",children:b.jsx("div",{className:"app-filter-row-name",children:He.trim()})})})]})]})})})()]})}function Tx({pullDistance:e,refreshing:n,threshold:r}){const s=e>0||n,l=e>=r;return b.jsx("div",{className:"pull-to-refresh",style:{transform:`translateY(${e}px)`,opacity:s?Math.min(1,e/30):0},"aria-hidden":!s,children:b.jsx("div",{className:"pull-to-refresh-badge",children:n?b.jsx("div",{className:"spinner"}):b.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s"},children:[b.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),b.jsx("polyline",{points:"19 12 12 19 5 12"})]})})})}function jx({onRefresh:e,threshold:n=70,maxPull:r=110,enabled:s=!0}){const[l,u]=N.useState(0),[c,f]=N.useState(!1),m=N.useRef(null),d=N.useRef(!1),y=N.useRef(0),g=N.useRef(!1),x=N.useRef(e);return N.useEffect(()=>{x.current=e}),N.useEffect(()=>{if(!s)return;const w=P=>{if(g.current||window.scrollY>0){m.current=null;return}m.current=P.touches[0].clientY,d.current=!1,y.current=0},E=P=>{if(g.current||m.current==null)return;const z=P.touches[0].clientY-m.current;if(z<=0){d.current=!1,y.current=0,u(0);return}d.current=!0;const I=Math.min(r,z*.5);y.current=I,u(I),P.cancelable&&P.preventDefault()},M=()=>{if(!d.current){m.current=null,u(0);return}const P=y.current;m.current=null,d.current=!1,y.current=0,P>=n?(g.current=!0,f(!0),u(n),Promise.resolve(x.current()).catch(()=>{}).finally(()=>{g.current=!1,f(!1),u(0)})):u(0)};return window.addEventListener("touchstart",w,{passive:!0}),window.addEventListener("touchmove",E,{passive:!1}),window.addEventListener("touchend",M,{passive:!0}),window.addEventListener("touchcancel",M,{passive:!0}),()=>{window.removeEventListener("touchstart",w),window.removeEventListener("touchmove",E),window.removeEventListener("touchend",M),window.removeEventListener("touchcancel",M)}},[s,n,r]),{pullDistance:l,refreshing:c,threshold:n}}function Sk({connected:e,hostId:n,request:r,subscribeEvents:s,agents:l,hostPlatform:u,isNotificationListener:c,onViewRun:f}){const[m,d]=N.useState([]),[y,g]=N.useState(!1),[x,w]=N.useState(null),[E,M]=N.useState(new Map),[P,z]=N.useState(!1),[I,j]=N.useState(void 0),K=N.useCallback(()=>{z(!1),j(void 0)},[]),B=N.useCallback(async()=>{if(e){g(!0),w(null);try{const L=(await r("task.list")).tasks??[],W=new Map;for(const Q of L)Q.status&&W.set(Q.id,Q.status);M(W),d(L)}catch(F){const L=F instanceof Error?F.message:String(F);L==="Not connected"||L.includes("503")||L.toLowerCase().includes("no responders")?w(null):w(L),d([])}finally{g(!1)}}},[e,n,r]);N.useEffect(()=>{e?B():(d([]),g(!1))},[e,n,B]);const R=jx({onRefresh:B,enabled:e});N.useEffect(()=>!e||!n?void 0:s(n,async L=>{const W=L.subject.split(".");if(W.length<3)return;const Q=W.slice(2).join(".");let oe={};try{oe=JSON.parse(new TextDecoder().decode(L.data))}catch{return}const ae=oe.event_type;if(!(ae!=="running-state"&&ae!=="permission-resolved"))try{const G=await r("task.status",{id:Q},{timeout:5e3});if(G.error)return;M(H=>{const X=new Map(H);return X.set(Q,G),X})}catch{}}),[e,n,s,r]);function Y(F){d(L=>{const W=L.findIndex(Q=>Q.id===F.id);if(W>=0){const Q=[...L];return Q[W]=F,Q}return[F,...L]}),z(!1),j(void 0)}function J(F){d(L=>L.filter(W=>W.id!==F)),M(L=>{const W=new Map(L);return W.delete(F),W})}return b.jsxs(b.Fragment,{children:[b.jsx(Tx,{pullDistance:R.pullDistance,refreshing:R.refreshing,threshold:R.threshold}),x&&b.jsxs("div",{className:"form-error",children:[x,x.toLowerCase().includes("failed to fetch")&&b.jsxs(b.Fragment,{children:[" ",b.jsx("a",{href:"#",onClick:F=>{F.preventDefault(),window.location.reload()},children:"Reload"})]})]}),y&&!m.length?b.jsx("div",{className:"task-list",children:[0,1,2].map(F=>b.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[b.jsx("div",{className:"task-card-header",children:b.jsxs("div",{className:"task-card-title-row",children:[b.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),b.jsx("div",{className:"skeleton-line",style:{width:`${60+F*12}%`}})]})}),b.jsxs("div",{className:"task-card-meta",children:[b.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},F))}):m.length===0?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No tasks yet"}),b.jsx("p",{className:"empty-state-hint",children:"Tap the + button to create your first task."})]}):b.jsx("div",{className:"task-list",children:m.map(F=>b.jsx(fk,{task:F,lastEvent:E.get(F.id),onEdit:async L=>{try{const W=await r("task.get",{id:L.id});j(W.error?L:W)}catch{j(L)}z(!0)},onDelete:J,onViewRun:f},F.id))}),b.jsx("button",{className:"fab",onClick:()=>{j(void 0),z(!0)},"aria-label":"New task",title:"New task",children:b.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),b.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),P&&b.jsx(wk,{initial:I,agents:l,hostPlatform:u,isNotificationListener:c,onSaved:Y,onRun:f,onCancel:K})]})}let oa=null;function z0(e){oa&&(e.preventDefault(),e.returnValue="")}function Nh(e){const n=!!oa;oa=e;const r=!!oa;r&&!n?window.addEventListener("beforeunload",z0):!r&&n&&window.removeEventListener("beforeunload",z0)}function hs(){return oa?window.confirm(oa):!0}function _k(){const e=ti(),r=Tr().pathname.startsWith("/tasks"),s=!r;function l(u){hs()&&e(u)}return b.jsxs(b.Fragment,{children:[b.jsxs("button",{className:`tab-btn ${s?"tab-btn-active":""}`,onClick:()=>l("/"),children:[b.jsx("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),b.jsxs("button",{className:`tab-btn ${r?"tab-btn-active":""}`,onClick:()=>l("/tasks"),children:[b.jsxs("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),b.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}function Nx(e){const[n,r]=N.useState(()=>window.matchMedia(e).matches);return N.useEffect(()=>{const s=window.matchMedia(e),l=u=>r(u.matches);return s.addEventListener("change",l),r(s.matches),()=>s.removeEventListener("change",l)},[e]),n}const Ek="modulepreload",kk=function(e){return"/"+e},U0={},Ox=function(n,r,s){let l=Promise.resolve();if(r&&r.length>0){let c=function(d){return Promise.all(d.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=c(r.map(d=>{if(d=kk(d),d in U0)return;U0[d]=!0;const y=d.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const x=document.createElement("link");if(x.rel=y?"stylesheet":Ek,y||(x.as="script"),x.crossOrigin="",x.href=d,m&&x.setAttribute("nonce",m),document.head.appendChild(x),y)return new Promise((w,E)=>{x.addEventListener("load",w),x.addEventListener("error",()=>E(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)})},Ck=va("App",{web:()=>Ox(()=>import("./web-nSzKzI8x.js"),[]).then(e=>new e.AppWeb)}),pu=pr.isNativePlatform(),Ak=["Device","Data","Messaging"],Oh=[{capability:"sms-read",label:"Read SMS",group:"Messaging",permission:"smsRead"},{capability:"sms-send",label:"Send SMS",group:"Messaging",permission:"smsSend"},{capability:"send-email",label:"Send Email",group:"Messaging",permission:"postNotifications"},{capability:"notifications",label:"Read Notifications",group:"Data",permission:"notificationListener"},{capability:"contacts",label:"Manage Contacts",group:"Data",permission:"contacts"},{capability:"calendar",label:"Manage Calendar",group:"Data",permission:"calendar"},{capability:"location",label:"Get Location",group:"Device",permission:"location",enableMethod:"device.location.enable",disableMethod:"device.location.disable",enableParams:e=>({fcmToken:e}),disableParams:()=>({})},{capability:"battery",label:"Read Battery Status",group:"Device"},{capability:"dnd",label:"Set Ringer Mode",group:"Device",permission:"dnd"},{capability:"alarm",label:"Trigger Alarms",group:"Device",needsFullScreenIntent:!0}];function Rx({capabilityTokens:e,activeClientToken:n,request:r,onCapabilityTokensChange:s}){const[l,u]=N.useState(null),[c,f]=N.useState(null),[m,d]=N.useState(null),[y,g]=N.useState(null);N.useEffect(()=>{if(!pu||!Ut){g(new Set);return}Ut.getSupportedPermissions().then(({types:j})=>g(new Set(j))).catch(()=>g(new Set))},[]);function x(j){return!!(n&&(e==null?void 0:e[j])===n)}function w(j){return y?y.size===0?!0:!(j.permission&&!y.has(j.permission)||j.needsFullScreenIntent&&!y.has("fullScreenIntent")):!1}function E(j,K){const B={};for(const[R,Y]of Object.entries(e??{}))B[R]=Y??null;B[j]=K?n??null:null,s(B)}N.useEffect(()=>{if(!pu||!Ut||!x("location"))return;function K(){Ut.checkPermission({type:"location"}).then(({granted:R})=>{R||r("device.location.disable").then(()=>{E("location",!1)}).catch(()=>{})})}K();const B=Ck.addListener("resume",K);return()=>{B.then(R=>R.remove())}},[e,n]),N.useEffect(()=>{if(!pu||!Ut)return;const j=Oh.map(K=>K.capability).filter(K=>(e==null?void 0:e[K])===n);Ut.setEnabledCapabilities({capabilities:j}).catch(()=>{})},[e,n]);async function M(j,K=!1){var Y,J;const B=x(j.capability);if(B&&!K){d(j);return}if(!B&&!!(e!=null&&e[j.capability])&&e[j.capability]!==n&&!K){f(j);return}u(j.capability);try{if(B){const oe=j.disableMethod??"device.capability.disable",ae=((Y=j.disableParams)==null?void 0:Y.call(j))??{capability:j.capability};await r(oe,ae),E(j.capability,!1);return}if(Ut&&j.capability==="send-email")try{const oe=await Ut.hasEmailClient();if(oe.supported&&!oe.available){alert("No email app is installed on this device. Install one (e.g. Gmail) before enabling Sending Email.");return}}catch{}if(Ut&&j.permission){const oe=await Ut.checkPermission({type:j.permission});if(!oe.supported){console.warn(`Native build does not support permission '${j.permission}'`);return}if(!oe.granted&&!(await Ut.requestPermission({type:j.permission})).granted)return}if(Ut&&j.needsFullScreenIntent){const oe=await Ut.checkPermission({type:"fullScreenIntent"});if(!oe.supported){console.warn("Native build does not support fullScreenIntent");return}if(!oe.granted&&!(await Ut.requestPermission({type:"fullScreenIntent"})).granted)return}if(!Ut)return;const{token:F}=await Ut.getFcmToken();if(!F){console.warn("No FCM token available");return}const L=Oh.map(oe=>oe.capability).filter(oe=>oe===j.capability||(e==null?void 0:e[oe])===n);await Ut.setEnabledCapabilities({capabilities:L});const W=j.enableMethod??"device.capability.enable",Q=((J=j.enableParams)==null?void 0:J.call(j,F))??{capability:j.capability,fcmToken:F};await r(W,Q),E(j.capability,!0)}catch(F){console.error(`Failed to toggle ${j.capability}:`,F)}finally{u(null)}}const P=Ak.map(j=>({group:j,items:Oh.filter(K=>K.group===j&&w(K))})).filter(j=>j.items.length>0);if(!pu||P.length===0)return null;const z=c&&ca.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>f(null),children:b.jsxs("div",{className:"confirm-modal",onClick:j=>j.stopPropagation(),children:[b.jsxs("h2",{className:"confirm-modal-title",children:["Switch ",c.label," to this device?"]}),b.jsxs("p",{className:"confirm-modal-message",children:[c.label," is currently enabled on another device. Switching will make this device the one the host uses for ",c.label,", and it will be disabled on the other device."]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-primary",onClick:()=>{const j=c;f(null),M(j,!0)},children:"Switch"})]})]})}),document.body),I=m&&ca.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>d(null),children:b.jsxs("div",{className:"confirm-modal",onClick:j=>j.stopPropagation(),children:[b.jsxs("h2",{className:"confirm-modal-title",children:["Disable ",m.label,"?"]}),b.jsxs("p",{className:"confirm-modal-message",children:["Agents running on the host will no longer be able to use ",m.label," until it is re-enabled on a device."]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>d(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:()=>{const j=m;d(null),M(j,!0)},children:"Disable"})]})]})}),document.body);return b.jsxs(b.Fragment,{children:[P.map(({group:j,items:K},B)=>b.jsx("div",{className:B>0?"drawer-toggle-group drawer-toggle-group-divided":"drawer-toggle-group",children:K.map(R=>{const Y=x(R.capability);return b.jsxs("label",{className:"drawer-toggle",children:[b.jsx("span",{className:"drawer-toggle-label",children:R.label}),b.jsx("button",{className:`toggle-switch ${Y?"toggle-switch-on":""}`,onClick:()=>M(R),disabled:l===R.capability,role:"switch","aria-checked":Y,children:b.jsx("span",{className:"toggle-switch-thumb"})})]},R.capability)})},j)),z,I]})}const B0=!!window.__PALMIER_SERVE__,Tk=pr.isNativePlatform();function P0({daemonVersion:e,capabilityTokens:n,activeClientToken:r,request:s,onCapabilityTokensChange:l}){var H;const{pairedHosts:u,activeHostId:c,setActiveHostId:f,removePairedHost:m,renamePairedHost:d}=ba(),y=ti(),g=Nx("(min-width: 768px)"),[x,w]=N.useState(!1),[E,M]=N.useState(!1),[P,z]=N.useState(null),[I,j]=N.useState(""),[K,B]=N.useState(null),R=N.useRef(null),Y=N.useRef(null),J=N.useCallback(()=>{M(!0)},[]);function F(){E&&(w(!1),M(!1))}function L(){M(!1),w(!0)}function W(X,ue){z(X),j(ue)}function Q(){P&&I.trim()&&d(P,I.trim()),z(null),j("")}function oe(){z(null),j("")}N.useEffect(()=>{P&&Y.current&&(Y.current.focus(),Y.current.select())},[P]),N.useEffect(()=>{if(!x||E)return;function X(ue){ue.key==="Escape"&&J()}return document.addEventListener("keydown",X),()=>{document.removeEventListener("keydown",X)}},[x,E,J]);const ae=b.jsxs(b.Fragment,{children:[!g&&b.jsx("button",{className:"drawer-close-btn",onClick:J,"aria-label":"Close menu",children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:b.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),!B0&&u.length>0&&b.jsxs("div",{className:"drawer-section",children:[b.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),b.jsx("div",{className:"host-picker-inline",children:b.jsx("div",{className:"host-picker-list",role:"listbox",children:u.map(X=>{const ue=X.hostId===c,_e=P===X.hostId,_=X.name||X.hostId.slice(0,8);return b.jsx("div",{className:"host-picker-item-wrapper",children:b.jsxs("div",{className:`host-picker-item ${ue?"host-picker-item-active":""}`,onClick:()=>{if(!_e&&!ue){if(!hs())return;f(X.hostId),g||J()}},role:"option","aria-selected":ue,children:[_e?b.jsx("input",{ref:Y,className:"form-input host-picker-rename-input",type:"text",value:I,onChange:D=>j(D.target.value),onKeyDown:D=>{D.key==="Enter"&&Q(),D.key==="Escape"&&oe()},onBlur:Q,onClick:D=>D.stopPropagation()}):b.jsx("span",{className:"host-picker-item-name",children:_}),b.jsxs("div",{className:"host-picker-item-actions",children:[ue&&!_e&&b.jsx("button",{className:"host-picker-edit-btn",onClick:D=>{D.stopPropagation(),W(X.hostId,_)},"aria-label":"Rename host",children:b.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:b.jsx("path",{d:"M9.5 1.5L11.5 3.5M1.5 11.5L2 9L9 2L11 4L4 11L1.5 11.5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),!ue&&b.jsx("button",{className:"host-picker-delete-btn",onClick:D=>{D.stopPropagation(),B(X.hostId)},"aria-label":`Unpair ${_}`,children:b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:b.jsx("path",{d:"M4 5.5V11C4 11.2761 4.22386 11.5 4.5 11.5H9.5C9.77614 11.5 10 11.2761 10 11V5.5M3 4H11M5.5 4V3C5.5 2.72386 5.72386 2.5 6 2.5H8C8.27614 2.5 8.5 2.72386 8.5 3V4M6.5 6.5V9.5M7.5 6.5V9.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})},X.hostId)})})})]}),!B0&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-divider"}),b.jsx("div",{className:"drawer-section",children:b.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{hs()&&(y("/pair"),g||J())},children:"Pair New Host"})})]}),Tk&&s&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-divider"}),b.jsxs("div",{className:"drawer-section",children:[b.jsx("h3",{className:"drawer-section-label",children:"Host capabilities on this device"}),b.jsx(Rx,{capabilityTokens:n,activeClientToken:r,request:s,onCapabilityTokensChange:X=>l==null?void 0:l(X)})]})]}),b.jsxs("div",{className:"drawer-footer",children:[e&&b.jsxs("div",{className:"drawer-version",children:["Palmier v",e]}),b.jsxs("div",{className:"drawer-legal",children:[b.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),b.jsx("span",{className:"drawer-legal-sep",children:"·"}),b.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),G=K&&ca.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>B(null),children:b.jsxs("div",{className:"confirm-modal",onClick:X=>X.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Delete host?"}),b.jsxs("p",{className:"confirm-modal-message",children:['"',((H=u.find(X=>X.hostId===K))==null?void 0:H.name)||K.slice(0,8),'" will be unpaired from this device.']}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>B(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:()=>{m(K),B(null)},children:"Delete"})]})]})}),document.body);return g?b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:R,children:ae}),G]}):b.jsxs(b.Fragment,{children:[b.jsx("button",{className:"hamburger-btn",onClick:L,"aria-label":"Open menu",children:b.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:b.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),x&&ca.createPortal(b.jsx("div",{className:`drawer-overlay ${E?"drawer-overlay-closing":""}`,onClick:J,onAnimationEnd:F,children:b.jsx("div",{className:`drawer-panel ${E?"drawer-panel-closing":""}`,ref:R,onClick:X=>X.stopPropagation(),children:ae})}),document.body),G]})}function q0(e){var s;const n=localStorage.getItem("palmier:lastAgent"),r=e.map(l=>l.key);return n&&r.includes(n)?n:((s=e[0])==null?void 0:s.key)??""}function jk({agents:e,hostPlatform:n,onStarted:r}){const{request:s}=Yl(),[l,u]=N.useState(""),[c,f]=N.useState(()=>q0(e)),[m,d]=N.useState(!1),[y,g]=N.useState(!1),[x,w]=N.useState(null);N.useEffect(()=>{e.length&&(e.find(K=>K.key===c)||f(q0(e)))},[e,c]),N.useEffect(()=>{const K=l.trim().length>0;return Nh(K?"Your session draft will be lost. Continue?":null),()=>Nh(null)},[l]);const E=e.find(K=>K.key===c),M=!!(E!=null&&E.supportsYolo);N.useEffect(()=>{!M&&m&&d(!1)},[M,m]);const P=!!l.trim()&&!!c&&!y;function z(){return m?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 I(){if(!(!P||!z())){g(!0),w(null);try{const K=await s("task.run_oneoff",{user_prompt:l,agent:c,yolo_mode:m,...n==="win32"?{foreground_mode:!0}:{}});if(K.error){w(K.error);return}localStorage.setItem("palmier:lastAgent",c),u(""),Nh(null),K.task_id&&r(K.task_id,K.run_id)}catch(K){w(K instanceof Error?K.message:String(K))}finally{g(!1)}}}function j(K){K.key==="Enter"&&(K.metaKey||K.ctrlKey)&&(K.preventDefault(),I())}return b.jsxs("div",{className:"session-composer",children:[x&&b.jsx("div",{className:"form-error",children:x}),b.jsx("textarea",{className:"session-composer-textarea",value:l,onChange:K=>u(K.target.value),onKeyDown:j,placeholder:"What can I do for you?",rows:3,disabled:y}),b.jsxs("div",{className:"session-composer-controls",children:[b.jsxs("div",{className:"agent-picker-section-inline",children:[b.jsx("span",{className:"agent-picker-label",children:"Run with"}),b.jsx("select",{className:"form-select form-select-sm",value:c,onChange:K=>f(K.target.value),disabled:y||!e.length,children:e.map(K=>b.jsx("option",{value:K.key,children:K.label},K.key))})]}),M&&b.jsxs("label",{className:"session-composer-yolo",children:[b.jsx("input",{type:"checkbox",checked:m,onChange:K=>d(K.target.checked),disabled:y}),"Yolo"]}),b.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:I,disabled:!P,"aria-label":"Run session",title:"Run session",children:y?b.jsx("span",{className:"btn-spinner"}):b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),b.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),M&&m&&b.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const us=88,H0=6;function Nk({id:e,revealedId:n,setRevealedId:r,onDelete:s,onClick:l,children:u,actionLabel:c="Delete"}){const f=n===e,[m,d]=N.useState(0),[y,g]=N.useState(!1),x=N.useRef(0),w=N.useRef(0),E=N.useRef(null),M=N.useRef(0),P=N.useRef(!1),z=N.useRef(null);N.useEffect(()=>{f||d(0)},[f]),N.useEffect(()=>{if(!f)return;function Y(J){var F;(F=z.current)!=null&&F.contains(J.target)||r(null)}return document.addEventListener("pointerdown",Y),()=>document.removeEventListener("pointerdown",Y)},[f,r]);function I(Y){Y.button!==void 0&&Y.button!==0||(x.current=Y.clientX,w.current=Y.clientY,E.current=null,M.current=f?-us:0,P.current=!1)}function j(Y){if(Y.pointerType==="mouse"&&Y.buttons===0)return;const J=Y.clientX-x.current,F=Y.clientY-w.current;if(E.current===null){if(Math.abs(J)<H0&&Math.abs(F)<H0)return;if(E.current=Math.abs(J)>Math.abs(F)?"x":"y",E.current==="x")try{Y.currentTarget.setPointerCapture(Y.pointerId)}catch{}}if(E.current!=="x")return;P.current=!0,y||g(!0);let L=M.current+J;L>0&&(L=L/4),L<-us&&(L=-us+(L+us)/4),d(L)}function K(){if(E.current!=="x"){g(!1);return}E.current=null,g(!1),m<=-44?(d(-us),r(e)):(d(0),f&&r(null))}function B(Y){if(P.current){P.current=!1,Y.stopPropagation(),Y.preventDefault();return}f&&(Y.stopPropagation(),Y.preventDefault(),r(null))}const R=m!==0?m:f?-us:0;return b.jsxs("div",{ref:z,className:"swipe-row",children:[b.jsx("button",{type:"button",className:"swipe-row-action",style:{width:us},onClick:Y=>{Y.stopPropagation(),s()},tabIndex:f?0:-1,"aria-hidden":!f,children:c}),b.jsx("div",{className:`swipe-row-content ${y?"swipe-row-content-dragging":""}`,style:{transform:`translateX(${R}px)`},onPointerDown:I,onPointerMove:j,onPointerUp:K,onPointerCancel:K,onClickCapture:B,onClick:l,children:u})]})}const Ok=10;function Rk({connected:e,hostId:n,request:r,subscribeEvents:s,agents:l,hostPlatform:u,filterTaskId:c,onClearFilter:f}){const[m,d]=N.useState([]),[y,g]=N.useState(0),[x,w]=N.useState(!1),[E,M]=N.useState(!1),[P,z]=N.useState(null),I=ti();async function j(G){const H=`${G.task_id}:${G.run_id}`;d(X=>X.filter(ue=>`${ue.task_id}:${ue.run_id}`!==H)),g(X=>Math.max(0,X-1)),z(null);try{await r("taskrun.delete",{task_id:G.task_id,run_id:G.run_id})}catch(X){console.error("Failed to delete run:",X),d(ue=>[G,...ue]),g(ue=>ue+1)}}const K=N.useRef(null),B=N.useCallback(G=>{const H={offset:G,limit:Ok};return c&&(H.task_id=c),H},[c]),R=N.useCallback(async(G,H)=>{if(e){H?M(!0):w(!0);try{const X=await r("taskrun.list",B(G)),ue=X.entries??[];g(X.total??0),d(H?_e=>{const _=new Set(_e.map(ee=>`${ee.task_id}:${ee.run_id}`)),D=ue.filter(ee=>!_.has(`${ee.task_id}:${ee.run_id}`));return[..._e,...D]}:ue)}catch(X){X instanceof Error&&X.message==="Not connected"||console.error("Failed to load runs:",X)}finally{w(!1),M(!1)}}},[e,r,B]);N.useEffect(()=>{e?(d([]),g(0),R(0,!1)):(d([]),g(0))},[e,n,R,c]);const Y=jx({onRefresh:()=>R(0,!1),enabled:e});N.useEffect(()=>!e||!n?void 0:s(n,async H=>{try{const X=JSON.parse(new TextDecoder().decode(H.data));if(X.event_type==="running-state"&&X.running_state&&["monitoring","started","finished","failed","aborted"].includes(X.running_state)){const ue=await r("taskrun.list",B(0)),_e=ue.entries??[];g(ue.total??0),d(_=>{const D=new Map(_e.map(Ae=>[`${Ae.task_id}:${Ae.run_id}`,Ae])),ee=_.map(Ae=>{const Te=`${Ae.task_id}:${Ae.run_id}`;return D.get(Te)??Ae}),A=new Set(ee.map(Ae=>`${Ae.task_id}:${Ae.run_id}`));return[..._e.filter(Ae=>!A.has(`${Ae.task_id}:${Ae.run_id}`)),...ee]})}}catch{}}),[e,n,s,r]),N.useEffect(()=>{const G=K.current;if(!G)return;const H=new IntersectionObserver(X=>{X[0].isIntersecting&&!E&&m.length<y&&R(m.length,!0)},{threshold:.1});return H.observe(G),()=>H.disconnect()},[m.length,y,E,R]);function J(G,H){if(!G||!H)return"";const X=Math.round((H-G)/1e3);if(X<60)return`${X}s`;const ue=Math.floor(X/60),_e=X%60;return`${ue}m ${_e}s`}const F={monitoring:"Monitoring",started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function L(G,H){hs()&&I(`/runs/${G}/${encodeURIComponent(H)}`)}const W=!c&&b.jsx(jk,{agents:l,hostPlatform:u,onStarted:(G,H)=>{I(H?`/runs/${encodeURIComponent(G)}/${encodeURIComponent(H)}`:`/runs/${encodeURIComponent(G)}`)}}),Q=b.jsx(Tx,{pullDistance:Y.pullDistance,refreshing:Y.refreshing,threshold:Y.threshold}),oe=c&&f&&b.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:b.jsxs("span",{className:"sessions-filter-chip",children:["Filtered by task",b.jsx("button",{onClick:f,"aria-label":"Clear filter",children:"×"})]})});function ae(G){if(G==="failed")return"var(--color-error)";if(G==="aborted")return"var(--color-warning, #d97706)"}return x&&m.length===0&&e?b.jsxs(b.Fragment,{children:[Q,W,b.jsx("div",{className:"task-list",children:[0,1,2].map(G=>b.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[b.jsx("div",{className:"task-card-header",children:b.jsx("div",{className:"task-card-title-row",children:b.jsx("div",{className:"skeleton-line",style:{width:`${70+G*10}%`}})})}),b.jsx("div",{className:"task-card-meta",children:b.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},G))})]}):!e||x&&m.length===0?b.jsxs(b.Fragment,{children:[Q,W,b.jsx("div",{className:"sessions-view",children:b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"Sessions"}),b.jsx("p",{className:"empty-state-hint",children:"Your sessions will appear here"})]})})]}):m.length===0?b.jsxs(b.Fragment,{children:[Q,W,oe,b.jsx("div",{className:"sessions-view",children:b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),b.jsx("p",{className:"empty-state-hint",children:c?"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger.":"Your sessions will appear here."})]})})]}):b.jsxs(b.Fragment,{children:[Q,W,oe,b.jsxs("div",{className:"task-list",children:[m.map((G,H)=>{const X=`${G.task_id}:${G.run_id}`;return b.jsx(Nk,{id:X,revealedId:P,setRevealedId:z,onDelete:()=>j(G),onClick:()=>!G.error&&L(G.task_id,G.run_id),children:b.jsxs("div",{className:"sessions-card",children:[b.jsxs("div",{className:"sessions-card-body",children:[b.jsx("h3",{className:"sessions-card-name",children:G.task_name||G.task_id}),b.jsxs("div",{className:"sessions-card-meta",children:[G.running_state==="started"?b.jsx("span",{className:"status-spinner","aria-label":"Running",children:b.jsx("span",{})}):b.jsx("span",{style:{color:ae(G.running_state)},children:F[G.running_state??""]??G.running_state}),G.end_time&&b.jsx("span",{children:Uu(G.end_time)}),G.start_time&&G.end_time&&b.jsx("span",{style:{color:"var(--color-muted)"},children:J(G.start_time,G.end_time)}),G.error&&b.jsx("span",{style:{color:"var(--color-muted)"},children:G.error})]})]}),b.jsx("span",{className:"sessions-card-chevron",children:"›"})]})},`${X}-${H}`)}),b.jsx("div",{ref:K,style:{height:1}}),E&&b.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:b.jsx("div",{className:"spinner"})})]})]})}function Mk(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Dk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Lk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zk={};function I0(e,n){return(zk.jsx?Lk:Dk).test(e)}const Uk=/[ \t\n\f\r]/g;function Bk(e){return typeof e=="object"?e.type==="text"?F0(e.value):!1:F0(e)}function F0(e){return e.replace(Uk,"")===""}class Gl{constructor(n,r,s){this.normal=r,this.property=n,s&&(this.space=s)}}Gl.prototype.normal={};Gl.prototype.property={};Gl.prototype.space=void 0;function Mx(e,n){const r={},s={};for(const l of e)Object.assign(r,l.property),Object.assign(s,l.normal);return new Gl(r,s,n)}function dd(e){return e.toLowerCase()}class Cn{constructor(n,r){this.attribute=r,this.property=n}}Cn.prototype.attribute="";Cn.prototype.booleanish=!1;Cn.prototype.boolean=!1;Cn.prototype.commaOrSpaceSeparated=!1;Cn.prototype.commaSeparated=!1;Cn.prototype.defined=!1;Cn.prototype.mustUseProperty=!1;Cn.prototype.number=!1;Cn.prototype.overloadedBoolean=!1;Cn.prototype.property="";Cn.prototype.spaceSeparated=!1;Cn.prototype.space=void 0;let Pk=0;const Ve=ms(),Kt=ms(),md=ms(),xe=ms(),jt=ms(),ua=ms(),Un=ms();function ms(){return 2**++Pk}const pd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:Kt,commaOrSpaceSeparated:Un,commaSeparated:ua,number:xe,overloadedBoolean:md,spaceSeparated:jt},Symbol.toStringTag,{value:"Module"})),Rh=Object.keys(pd);class qd extends Cn{constructor(n,r,s,l){let u=-1;if(super(n,r),$0(this,"space",l),typeof s=="number")for(;++u<Rh.length;){const c=Rh[u];$0(this,Rh[u],(s&pd[c])===pd[c])}}}qd.prototype.defined=!0;function $0(e,n,r){r&&(e[n]=r)}function wa(e){const n={},r={};for(const[s,l]of Object.entries(e.properties)){const u=new qd(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),n[s]=u,r[dd(s)]=s,r[dd(u.attribute)]=s}return new Gl(n,r,e.space)}const Dx=wa({properties:{ariaActiveDescendant:null,ariaAtomic:Kt,ariaAutoComplete:null,ariaBusy:Kt,ariaChecked:Kt,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:jt,ariaCurrent:null,ariaDescribedBy:jt,ariaDetails:null,ariaDisabled:Kt,ariaDropEffect:jt,ariaErrorMessage:null,ariaExpanded:Kt,ariaFlowTo:jt,ariaGrabbed:Kt,ariaHasPopup:null,ariaHidden:Kt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:jt,ariaLevel:xe,ariaLive:null,ariaModal:Kt,ariaMultiLine:Kt,ariaMultiSelectable:Kt,ariaOrientation:null,ariaOwns:jt,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:Kt,ariaReadOnly:Kt,ariaRelevant:null,ariaRequired:Kt,ariaRoleDescription:jt,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:Kt,ariaSetSize:xe,ariaSort:null,ariaValueMax:xe,ariaValueMin:xe,ariaValueNow:xe,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Lx(e,n){return n in e?e[n]:n}function zx(e,n){return Lx(e,n.toLowerCase())}const qk=wa({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ua,acceptCharset:jt,accessKey:jt,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:jt,autoFocus:Ve,autoPlay:Ve,blocking:jt,capture:null,charSet:null,checked:Ve,cite:null,className:jt,cols:xe,colSpan:null,content:null,contentEditable:Kt,controls:Ve,controlsList:jt,coords:xe|ua,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:md,draggable:Kt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:jt,height:xe,hidden:md,high:xe,href:null,hrefLang:null,htmlFor:jt,httpEquiv:jt,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:jt,itemRef:jt,itemScope:Ve,itemType:jt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ve,optimum:xe,pattern:null,ping:jt,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:jt,required:Ve,reversed:Ve,rows:xe,rowSpan:xe,sandbox:jt,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:Kt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xe,step:null,style:null,tabIndex:xe,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:Kt,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:jt,axis:null,background:null,bgColor:null,border:xe,borderColor:null,bottomMargin:xe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:Kt,standby:null,summary:null,text:null,topMargin:xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ve,disableRemotePlayback:Ve,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:zx}),Hk=wa({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:xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xe,amplitude:xe,arabicForm:null,ascent:xe,attributeName:null,attributeType:null,azimuth:xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xe,by:null,calcMode:null,capHeight:xe,className:jt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:xe,diffuseConstant:xe,direction:null,display:null,dur:null,divisor:xe,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:xe,enableBackground:null,end:null,event:null,exponent:xe,externalResourcesRequired:null,fill:null,fillOpacity:xe,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:ua,g2:ua,glyphName:ua,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xe,horizOriginX:xe,horizOriginY:xe,id:null,ideographic:xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xe,k:xe,k1:xe,k2:xe,k3:xe,k4:xe,kernelMatrix:Un,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xe,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:xe,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:xe,overlineThickness:xe,paintOrder:null,panose1:null,path:null,pathLength:xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:jt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,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:xe,specularExponent:xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xe,strikethroughThickness:xe,string:null,stroke:null,strokeDashArray:Un,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xe,strokeOpacity:xe,strokeWidth:null,style:null,surfaceScale:xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Un,tabIndex:xe,tableValues:null,target:null,targetX:xe,targetY:xe,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:xe,underlineThickness:xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xe,values:null,vAlphabetic:xe,vMathematical:xe,vectorEffect:null,vHanging:xe,vIdeographic:xe,version:null,vertAdvY:xe,vertOriginX:xe,vertOriginY:xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Lx}),Ux=wa({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()}}),Bx=wa({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zx}),Px=wa({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),Ik={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"},Fk=/[A-Z]/g,Y0=/-[a-z]/g,$k=/^data[-\w.:]+$/i;function Yk(e,n){const r=dd(n);let s=n,l=Cn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&$k.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(Y0,Vk);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!Y0.test(u)){let c=u.replace(Fk,Gk);c.charAt(0)!=="-"&&(c="-"+c),n="data"+c}}l=qd}return new l(s,n)}function Gk(e){return"-"+e.toLowerCase()}function Vk(e){return e.charAt(1).toUpperCase()}const Jk=Mx([Dx,qk,Ux,Bx,Px],"html"),Hd=Mx([Dx,Hk,Ux,Bx,Px],"svg");function Xk(e){return e.join(" ").trim()}var Qs={},Mh,G0;function Kk(){if(G0)return Mh;G0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
93
+ `,d="/",y="*",g="",x="comment",w="declaration";function E(P,z){if(typeof P!="string")throw new TypeError("First argument must be a string");if(!P)return[];z=z||{};var I=1,j=1;function K(ae){var G=ae.match(n);G&&(I+=G.length);var H=ae.lastIndexOf(m);j=~H?ae.length-H:j+ae.length}function B(){var ae={line:I,column:j};return function(G){return G.position=new R(ae),F(),G}}function R(ae){this.start=ae,this.end={line:I,column:j},this.source=z.source}R.prototype.content=P;function Y(ae){var G=new Error(z.source+":"+I+":"+j+": "+ae);if(G.reason=ae,G.filename=z.source,G.line=I,G.column=j,G.source=P,!z.silent)throw G}function J(ae){var G=ae.exec(P);if(G){var H=G[0];return K(H),P=P.slice(H.length),G}}function F(){J(r)}function L(ae){var G;for(ae=ae||[];G=W();)G!==!1&&ae.push(G);return ae}function W(){var ae=B();if(!(d!=P.charAt(0)||y!=P.charAt(1))){for(var G=2;g!=P.charAt(G)&&(y!=P.charAt(G)||d!=P.charAt(G+1));)++G;if(G+=2,g===P.charAt(G-1))return Y("End of comment missing");var H=P.slice(2,G-2);return j+=2,K(H),P=P.slice(G),j+=2,ae({type:x,comment:H})}}function Q(){var ae=B(),G=J(s);if(G){if(W(),!J(l))return Y("property missing ':'");var H=J(u),X=ae({type:w,property:M(G[0].replace(e,g)),value:H?M(H[0].replace(e,g)):g});return J(c),X}}function oe(){var ae=[];L(ae);for(var G;G=Q();)G!==!1&&(ae.push(G),L(ae));return ae}return F(),oe()}function M(P){return P?P.replace(f,g):g}return Mh=E,Mh}var V0;function Qk(){if(V0)return Qs;V0=1;var e=Qs&&Qs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.default=r;const n=e(Kk());function r(s,l){let u=null;if(!s||typeof s!="string")return u;const c=(0,n.default)(s),f=typeof l=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:d,value:y}=m;f?l(d,y,m):y&&(u=u||{},u[d]=y)}),u}return Qs}var bl={},J0;function Zk(){if(J0)return bl;J0=1,Object.defineProperty(bl,"__esModule",{value:!0}),bl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(d){return!d||r.test(d)||e.test(d)},c=function(d,y){return y.toUpperCase()},f=function(d,y){return"".concat(y,"-")},m=function(d,y){return y===void 0&&(y={}),u(d)?d:(d=d.toLowerCase(),y.reactCompat?d=d.replace(l,f):d=d.replace(s,f),d.replace(n,c))};return bl.camelCase=m,bl}var xl,X0;function Wk(){if(X0)return xl;X0=1;var e=xl&&xl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},n=e(Qk()),r=Zk();function s(l,u){var c={};return!l||typeof l!="string"||(0,n.default)(l,function(f,m){f&&m&&(c[(0,r.camelCase)(f,u)]=m)}),c}return s.default=s,xl=s,xl}var eC=Wk();const tC=Db(eC),qx=Hx("end"),Id=Hx("start");function Hx(e){return n;function n(r){const s=r&&r.position&&r.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function nC(e){const n=Id(e),r=qx(e);if(n&&r)return{start:n,end:r}}function Nl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?K0(e.position):"start"in e||"end"in e?K0(e):"line"in e||"column"in e?gd(e):""}function gd(e){return Q0(e&&e.line)+":"+Q0(e&&e.column)}function K0(e){return gd(e&&e.start)+"-"+gd(e&&e.end)}function Q0(e){return e&&typeof e=="number"?e:1}class fn extends Error{constructor(n,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let l="",u={},c=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof n=="string"?l=n:!u.cause&&n&&(c=!0,l=n.message,u.cause=n),!u.ruleId&&!u.source&&typeof s=="string"){const m=s.indexOf(":");m===-1?u.ruleId=s:(u.source=s.slice(0,m),u.ruleId=s.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=Nl(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}}fn.prototype.file="";fn.prototype.name="";fn.prototype.reason="";fn.prototype.message="";fn.prototype.stack="";fn.prototype.column=void 0;fn.prototype.line=void 0;fn.prototype.ancestors=void 0;fn.prototype.cause=void 0;fn.prototype.fatal=void 0;fn.prototype.place=void 0;fn.prototype.ruleId=void 0;fn.prototype.source=void 0;const Fd={}.hasOwnProperty,rC=new Map,iC=/[A-Z]/g,sC=new Set(["table","tbody","thead","tfoot","tr"]),aC=new Set(["td","th"]),Ix="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function lC(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let s;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=pC(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=mC(r,n.jsx,n.jsxs)}const l={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:s,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Hd:Jk,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=Fx(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function Fx(e,n,r){if(n.type==="element")return oC(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return uC(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return fC(e,n,r);if(n.type==="mdxjsEsm")return cC(e,n);if(n.type==="root")return hC(e,n,r);if(n.type==="text")return dC(e,n)}function oC(e,n,r){const s=e.schema;let l=s;n.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Hd,e.schema=l),e.ancestors.push(n);const u=Yx(e,n.tagName,!1),c=gC(e,n);let f=Yd(e,n);return sC.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!Bk(m):!0})),$x(e,c,u,n),$d(c,f),e.ancestors.pop(),e.schema=s,e.create(n,u,c,r)}function uC(e,n){if(n.data&&n.data.estree&&e.evaluater){const s=n.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Bl(e,n.position)}function cC(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Bl(e,n.position)}function fC(e,n,r){const s=e.schema;let l=s;n.name==="svg"&&s.space==="html"&&(l=Hd,e.schema=l),e.ancestors.push(n);const u=n.name===null?e.Fragment:Yx(e,n.name,!0),c=yC(e,n),f=Yd(e,n);return $x(e,c,u,n),$d(c,f),e.ancestors.pop(),e.schema=s,e.create(n,u,c,r)}function hC(e,n,r){const s={};return $d(s,Yd(e,n)),e.create(n,e.Fragment,s,r)}function dC(e,n){return n.value}function $x(e,n,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=s)}function $d(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function mC(e,n,r){return s;function s(l,u,c,f){const d=Array.isArray(c.children)?r:n;return f?d(u,c,f):d(u,c)}}function pC(e,n){return r;function r(s,l,u,c){const f=Array.isArray(u.children),m=Id(s);return n(l,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function gC(e,n){const r={};let s,l;for(l in n.properties)if(l!=="children"&&Fd.call(n.properties,l)){const u=bC(e,l,n.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&aC.has(n.tagName)?s=f:r[c]=f}}if(s){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function yC(e,n){const r={};for(const s of n.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else Bl(e,n.position);else{const l=s.name;let u;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else Bl(e,n.position);else u=s.value===null?!0:s.value;r[l]=u}return r}function Yd(e,n){const r=[];let s=-1;const l=e.passKeys?new Map:rC;for(;++s<n.children.length;){const u=n.children[s];let c;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const d=l.get(m)||0;c=m+"-"+d,l.set(m,d+1)}}const f=Fx(e,u,c);f!==void 0&&r.push(f)}return r}function bC(e,n,r){const s=Yk(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?Mk(r):Xk(r)),s.property==="style"){let l=typeof r=="object"?r:xC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=vC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?Ik[s.property]||s.property:s.attribute,r]}}function xC(e,n){try{return tC(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new fn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Ix+"#cannot-parse-style-attribute",l}}function Yx(e,n,r){let s;if(!r)s={type:"Literal",value:n};else if(n.includes(".")){const l=n.split(".");let u=-1,c;for(;++u<l.length;){const f=I0(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}s=c}else s=I0(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(s.type==="Literal"){const l=s.value;return Fd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);Bl(e)}function Bl(e,n){const r=new fn("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=Ix+"#cannot-handle-mdx-estrees-without-createevaluater",r}function vC(e){const n={};let r;for(r in e)Fd.call(e,r)&&(n[wC(r)]=e[r]);return n}function wC(e){let n=e.replace(iC,SC);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function SC(e){return"-"+e.toLowerCase()}const Dh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},_C={};function Gd(e,n){const r=_C,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Gx(e,s,l)}function Gx(e,n,r){if(EC(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 Z0(e.children,n,r)}return Array.isArray(e)?Z0(e,n,r):""}function Z0(e,n,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=Gx(e[l],n,r);return s.join("")}function EC(e){return!!(e&&typeof e=="object")}const W0=document.createElement("i");function Vd(e){const n="&"+e+";";W0.innerHTML=n;const r=W0.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function In(e,n,r,s){const l=e.length;let u=0,c;if(n<0?n=-n>l?0:l+n:n=n>l?l:n,r=r>0?r:0,s.length<1e4)c=Array.from(s),c.unshift(n,r),e.splice(...c);else for(r&&e.splice(n,r);u<s.length;)c=s.slice(u,u+1e4),c.unshift(n,0),e.splice(...c),u+=1e4,n+=1e4}function rr(e,n){return e.length>0?(In(e,e.length,0,n),e):n}const eb={}.hasOwnProperty;function Vx(e){const n={};let r=-1;for(;++r<e.length;)kC(n,e[r]);return n}function kC(e,n){let r;for(r in n){const l=(eb.call(e,r)?e[r]:void 0)||(e[r]={}),u=n[r];let c;if(u)for(c in u){eb.call(l,c)||(l[c]=[]);const f=u[c];CC(l[c],Array.isArray(f)?f:f?[f]:[])}}}function CC(e,n){let r=-1;const s=[];for(;++r<n.length;)(n[r].add==="after"?e:s).push(n[r]);In(e,0,0,s)}function Jx(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 mr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const gn=Hi(/[A-Za-z]/),cn=Hi(/[\dA-Za-z]/),AC=Hi(/[#-'*+\--9=?A-Z^-~]/);function Bu(e){return e!==null&&(e<32||e===127)}const yd=Hi(/\d/),TC=Hi(/[\dA-Fa-f]/),jC=Hi(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function Tt(e){return e!==null&&(e<0||e===32)}function Qe(e){return e===-2||e===-1||e===32}const Xu=Hi(new RegExp("\\p{P}|\\p{S}","u")),ds=Hi(/\s/);function Hi(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Sa(e){const n=[];let r=-1,s=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&cn(e.charCodeAt(r+1))&&cn(e.charCodeAt(r+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(r+1);u<56320&&f>56319&&f<57344?(c=String.fromCharCode(u,f),l=1):c="�"}else c=String.fromCharCode(u);c&&(n.push(e.slice(s,r),encodeURIComponent(c)),s=r+l+1,c=""),l&&(r+=l,l=0)}return n.join("")+e.slice(s)}function it(e,n,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return Qe(m)?(e.enter(r),f(m)):n(m)}function f(m){return Qe(m)&&u++<l?(e.consume(m),f):(e.exit(r),n(m))}}const NC={tokenize:OC};function OC(e){const n=e.attempt(this.parser.constructs.contentInitial,s,l);let r;return n;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),it(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 RC={tokenize:MC},tb={tokenize:DC};function MC(e){const n=this,r=[];let s=0,l,u,c;return f;function f(j){if(s<r.length){const K=r[s];return n.containerState=K[1],e.attempt(K[0].continuation,m,d)(j)}return d(j)}function m(j){if(s++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,l&&I();const K=n.events.length;let B=K,R;for(;B--;)if(n.events[B][0]==="exit"&&n.events[B][1].type==="chunkFlow"){R=n.events[B][1].end;break}z(s);let Y=K;for(;Y<n.events.length;)n.events[Y][1].end={...R},Y++;return In(n.events,B+1,0,n.events.slice(K)),n.events.length=Y,d(j)}return f(j)}function d(j){if(s===r.length){if(!l)return x(j);if(l.currentConstruct&&l.currentConstruct.concrete)return E(j);n.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(tb,y,g)(j)}function y(j){return l&&I(),z(s),x(j)}function g(j){return n.parser.lazy[n.now().line]=s!==r.length,c=n.now().offset,E(j)}function x(j){return n.containerState={},e.attempt(tb,w,E)(j)}function w(j){return s++,r.push([n.currentConstruct,n.containerState]),x(j)}function E(j){if(j===null){l&&I(),z(0),e.consume(j);return}return l=l||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),M(j)}function M(j){if(j===null){P(e.exit("chunkFlow"),!0),z(0),e.consume(j);return}return Pe(j)?(e.consume(j),P(e.exit("chunkFlow")),s=0,n.interrupt=void 0,f):(e.consume(j),M)}function P(j,K){const B=n.sliceStream(j);if(K&&B.push(null),j.previous=u,u&&(u.next=j),u=j,l.defineSkip(j.start),l.write(B),n.parser.lazy[j.start.line]){let R=l.events.length;for(;R--;)if(l.events[R][1].start.offset<c&&(!l.events[R][1].end||l.events[R][1].end.offset>c))return;const Y=n.events.length;let J=Y,F,L;for(;J--;)if(n.events[J][0]==="exit"&&n.events[J][1].type==="chunkFlow"){if(F){L=n.events[J][1].end;break}F=!0}for(z(s),R=Y;R<n.events.length;)n.events[R][1].end={...L},R++;In(n.events,J+1,0,n.events.slice(Y)),n.events.length=R}}function z(j){let K=r.length;for(;K-- >j;){const B=r[K];n.containerState=B[1],B[0].exit.call(n,e)}r.length=j}function I(){l.write([null]),u=void 0,l=void 0,n.containerState._closeFlow=void 0}}function DC(e,n,r){return it(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function pa(e){if(e===null||Tt(e)||ds(e))return 1;if(Xu(e))return 2}function Ku(e,n,r){const s=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!s.includes(u)&&(n=u(n,r),s.push(u))}return n}const bd={name:"attention",resolveAll:LC,tokenize:zC};function LC(e,n){let r=-1,s,l,u,c,f,m,d,y;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(s=r;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&n.sliceSerialize(e[s][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[s][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[s][1].end.offset-e[s][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[s][1].end},x={...e[r][1].start};nb(g,-m),nb(x,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:x},u={type:m>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[r][1].start={...f.end},d=[],e[s][1].end.offset-e[s][1].start.offset&&(d=rr(d,[["enter",e[s][1],n],["exit",e[s][1],n]])),d=rr(d,[["enter",l,n],["enter",c,n],["exit",c,n],["enter",u,n]]),d=rr(d,Ku(n.parser.constructs.insideSpan.null,e.slice(s+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,s-1,r-s+3,d),r=s+d.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function zC(e,n){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=pa(s);let u;return c;function c(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const d=e.exit("attentionSequence"),y=pa(m),g=!y||y===2&&l||r.includes(m),x=!l||l===2&&y||r.includes(s);return d._open=!!(u===42?g:g&&(l||!x)),d._close=!!(u===42?x:x&&(y||!g)),n(m)}}function nb(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const UC={name:"autolink",tokenize:BC};function BC(e,n,r){let s=0;return l;function l(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(w){return gn(w)?(e.consume(w),c):w===64?r(w):d(w)}function c(w){return w===43||w===45||w===46||cn(w)?(s=1,f(w)):d(w)}function f(w){return w===58?(e.consume(w),s=0,m):(w===43||w===45||w===46||cn(w))&&s++<32?(e.consume(w),f):(s=0,d(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):w===null||w===32||w===60||Bu(w)?r(w):(e.consume(w),m)}function d(w){return w===64?(e.consume(w),y):AC(w)?(e.consume(w),d):r(w)}function y(w){return cn(w)?g(w):r(w)}function g(w){return w===46?(e.consume(w),s=0,y):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):x(w)}function x(w){if((w===45||cn(w))&&s++<63){const E=w===45?x:g;return e.consume(w),E}return r(w)}}const Vl={partial:!0,tokenize:PC};function PC(e,n,r){return s;function s(u){return Qe(u)?it(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Pe(u)?n(u):r(u)}}const Xx={continuation:{tokenize:HC},exit:IC,name:"blockQuote",tokenize:qC};function qC(e,n,r){const s=this;return l;function l(c){if(c===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return r(c)}function u(c){return Qe(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 s=this;return l;function l(c){return Qe(c)?it(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(Xx,n,r)(c)}}function IC(e){e.exit("blockQuote")}const Kx={name:"characterEscape",tokenize:FC};function FC(e,n,r){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return jC(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(u)}}const Qx={name:"characterReference",tokenize:$C};function $C(e,n,r){const s=this;let l=0,u,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),u=31,c=cn,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=TC,y):(e.enter("characterReferenceValue"),u=7,c=yd,y(g))}function y(g){if(g===59&&l){const x=e.exit("characterReferenceValue");return c===cn&&!Vd(s.sliceSerialize(x))?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 rb={partial:!0,tokenize:GC},ib={concrete:!0,name:"codeFenced",tokenize:YC};function YC(e,n,r){const s=this,l={partial:!0,tokenize:B};let u=0,c=0,f;return m;function m(R){return d(R)}function d(R){const Y=s.events[s.events.length-1];return u=Y&&Y[1].type==="linePrefix"?Y[2].sliceSerialize(Y[1],!0).length:0,f=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(R)}function y(R){return R===f?(c++,e.consume(R),y):c<3?r(R):(e.exit("codeFencedFenceSequence"),Qe(R)?it(e,g,"whitespace")(R):g(R))}function g(R){return R===null||Pe(R)?(e.exit("codeFencedFence"),s.interrupt?n(R):e.check(rb,M,K)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(R))}function x(R){return R===null||Pe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):Qe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),it(e,w,"whitespace")(R)):R===96&&R===f?r(R):(e.consume(R),x)}function w(R){return R===null||Pe(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),E(R))}function E(R){return R===null||Pe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===f?r(R):(e.consume(R),E)}function M(R){return e.attempt(l,K,P)(R)}function P(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),z}function z(R){return u>0&&Qe(R)?it(e,I,"linePrefix",u+1)(R):I(R)}function I(R){return R===null||Pe(R)?e.check(rb,M,K)(R):(e.enter("codeFlowValue"),j(R))}function j(R){return R===null||Pe(R)?(e.exit("codeFlowValue"),I(R)):(e.consume(R),j)}function K(R){return e.exit("codeFenced"),n(R)}function B(R,Y,J){let F=0;return L;function L(G){return R.enter("lineEnding"),R.consume(G),R.exit("lineEnding"),W}function W(G){return R.enter("codeFencedFence"),Qe(G)?it(R,Q,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):Q(G)}function Q(G){return G===f?(R.enter("codeFencedFenceSequence"),oe(G)):J(G)}function oe(G){return G===f?(F++,R.consume(G),oe):F>=c?(R.exit("codeFencedFenceSequence"),Qe(G)?it(R,ae,"whitespace")(G):ae(G)):J(G)}function ae(G){return G===null||Pe(G)?(R.exit("codeFencedFence"),Y(G)):J(G)}}}function GC(e,n,r){const s=this;return l;function l(c){return c===null?r(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return s.parser.lazy[s.now().line]?r(c):n(c)}}const Lh={name:"codeIndented",tokenize:JC},VC={partial:!0,tokenize:XC};function JC(e,n,r){const s=this;return l;function l(d){return e.enter("codeIndented"),it(e,u,"linePrefix",5)(d)}function u(d){const y=s.events[s.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?c(d):r(d)}function c(d){return d===null?m(d):Pe(d)?e.attempt(VC,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 XC(e,n,r){const s=this;return l;function l(c){return s.parser.lazy[s.now().line]?r(c):Pe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):it(e,u,"linePrefix",5)(c)}function u(c){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):Pe(c)?l(c):r(c)}}const KC={name:"codeText",previous:ZC,resolve:QC,tokenize:WC};function QC(e){let n=e.length-4,r=3,s,l;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(s=r;++s<n;)if(e[s][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(s=r-1,n++;++s<=n;)l===void 0?s!==n&&e[s][1].type!=="lineEnding"&&(l=s):(s===n||e[s][1].type==="lineEnding")&&(e[l][1].type="codeTextData",s!==l+2&&(e[l][1].end=e[s-1][1].end,e.splice(l+2,s-l-2),n-=s-l-2,s=l+2),l=void 0);return e}function ZC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function WC(e,n,r){let s=0,l,u;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),s++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(u=e.enter("codeTextSequence"),l=0,y(g)):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===s?(e.exit("codeTextSequence"),e.exit("codeText"),n(g)):(u.type="codeTextData",d(g))}}class eA{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const s=r??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(n,s):n>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(n,r,s){const l=r||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&vl(this.left,s),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),vl(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),vl(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);vl(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);vl(this.left,r.reverse())}}}function vl(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 Zx(e){const n={};let r=-1,s,l,u,c,f,m,d;const y=new eA(e);for(;++r<y.length;){for(;r in n;)r=n[r];if(s=y.get(r),r&&s[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(m=s[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(n,tA(y,r)),r=n[r],d=!0);else if(s[1]._container){for(u=r,l=void 0;u--;)if(c=y.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(y.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(s[1].end={...y.get(l)[1].start},f=y.slice(l,r),f.unshift(s),y.splice(l,r-l+1,f))}}return In(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!d}function tA(e,n){const r=e.get(n)[1],s=e.get(n)[2];let l=n-1;const u=[];let c=r._tokenizer;c||(c=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],d={};let y,g,x=-1,w=r,E=0,M=0;const P=[M];for(;w;){for(;e.get(++l)[1]!==w;);u.push(l),w._tokenizer||(y=s.sliceStream(w),w.next||y.push(null),g&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=w,w=w.next}for(w=r;++x<f.length;)f[x][0]==="exit"&&f[x-1][0]==="enter"&&f[x][1].type===f[x-1][1].type&&f[x][1].start.line!==f[x][1].end.line&&(M=x+1,P.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):P.pop(),x=P.length;x--;){const z=f.slice(P[x],P[x+1]),I=u.pop();m.push([I,I+z.length-1]),e.splice(I,2,z)}for(m.reverse(),x=-1;++x<m.length;)d[E+m[x][0]]=E+m[x][1],E+=m[x][1]-m[x][0]-1;return d}const nA={resolve:iA,tokenize:sA},rA={partial:!0,tokenize:aA};function iA(e){return Zx(e),e}function sA(e,n){let r;return s;function s(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?u(f):Pe(f)?e.check(rA,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 s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),it(e,u,"linePrefix")}function u(c){if(c===null||Pe(c))return r(c);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):e.interrupt(s.parser.constructs.flow,r,n)(c)}}function Wx(e,n,r,s,l,u,c,f,m){const d=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(z){return z===60?(e.enter(s),e.enter(l),e.enter(u),e.consume(z),e.exit(u),x):z===null||z===32||z===41||Bu(z)?r(z):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),M(z))}function x(z){return z===62?(e.enter(u),e.consume(z),e.exit(u),e.exit(l),e.exit(s),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(z))}function w(z){return z===62?(e.exit("chunkString"),e.exit(f),x(z)):z===null||z===60||Pe(z)?r(z):(e.consume(z),z===92?E:w)}function E(z){return z===60||z===62||z===92?(e.consume(z),w):w(z)}function M(z){return!y&&(z===null||z===41||Tt(z))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),n(z)):y<d&&z===40?(e.consume(z),y++,M):z===41?(e.consume(z),y--,M):z===null||z===32||z===40||Bu(z)?r(z):(e.consume(z),z===92?P:M)}function P(z){return z===40||z===41||z===92?(e.consume(z),M):M(z)}}function e1(e,n,r,s,l,u){const c=this;let f=0,m;return d;function d(w){return e.enter(s),e.enter(l),e.consume(w),e.exit(l),e.enter(u),y}function y(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(w):w===93?(e.exit(u),e.enter(l),e.consume(w),e.exit(l),e.exit(s),n):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=!Qe(w)),w===92?x:g)}function x(w){return w===91||w===92||w===93?(e.consume(w),f++,g):g(w)}}function t1(e,n,r,s,l,u){let c;return f;function f(x){return x===34||x===39||x===40?(e.enter(s),e.enter(l),e.consume(x),e.exit(l),c=x===40?41:x,m):r(x)}function m(x){return x===c?(e.enter(l),e.consume(x),e.exit(l),e.exit(s),n):(e.enter(u),d(x))}function d(x){return x===c?(e.exit(u),m(c)):x===null?r(x):Pe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),it(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===c||x===null||Pe(x)?(e.exit("chunkString"),d(x)):(e.consume(x),x===92?g:y)}function g(x){return x===c||x===92?(e.consume(x),y):y(x)}}function Ol(e,n){let r;return s;function s(l){return Pe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):Qe(l)?it(e,s,r?"linePrefix":"lineSuffix")(l):n(l)}}const lA={name:"definition",tokenize:uA},oA={partial:!0,tokenize:cA};function uA(e,n,r){const s=this;let l;return u;function u(w){return e.enter("definition"),c(w)}function c(w){return e1.call(s,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return l=mr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):r(w)}function m(w){return Tt(w)?Ol(e,d)(w):d(w)}function d(w){return Wx(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function y(w){return e.attempt(oA,g,g)(w)}function g(w){return Qe(w)?it(e,x,"whitespace")(w):x(w)}function x(w){return w===null||Pe(w)?(e.exit("definition"),s.parser.defined.push(l),n(w)):r(w)}}function cA(e,n,r){return s;function s(f){return Tt(f)?Ol(e,l)(f):r(f)}function l(f){return t1(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return Qe(f)?it(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Pe(f)?n(f):r(f)}}const fA={name:"hardBreakEscape",tokenize:hA};function hA(e,n,r){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Pe(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const dA={name:"headingAtx",resolve:mA,tokenize:pA};function mA(e,n){let r=e.length-2,s=3,l,u;return e[s][1].type==="whitespace"&&(s+=2),r-2>s&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&e[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(l={type:"atxHeadingText",start:e[s][1].start,end:e[r][1].end},u={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},In(e,s,r-s+1,[["enter",l,n],["enter",u,n],["exit",u,n],["exit",l,n]])),e}function pA(e,n,r){let s=0;return l;function l(y){return e.enter("atxHeading"),u(y)}function u(y){return e.enter("atxHeadingSequence"),c(y)}function c(y){return y===35&&s++<6?(e.consume(y),c):y===null||Tt(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||Pe(y)?(e.exit("atxHeading"),n(y)):Qe(y)?it(e,f,"whitespace")(y):(e.enter("atxHeadingText"),d(y))}function m(y){return y===35?(e.consume(y),m):(e.exit("atxHeadingSequence"),f(y))}function d(y){return y===null||y===35||Tt(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),d)}}const gA=["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"],sb=["pre","script","style","textarea"],yA={concrete:!0,name:"htmlFlow",resolveTo:vA,tokenize:wA},bA={partial:!0,tokenize:_A},xA={partial:!0,tokenize:SA};function vA(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 wA(e,n,r){const s=this;let l,u,c,f,m;return d;function d(A){return y(A)}function y(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),g}function g(A){return A===33?(e.consume(A),x):A===47?(e.consume(A),u=!0,M):A===63?(e.consume(A),l=3,s.interrupt?n:_):gn(A)?(e.consume(A),c=String.fromCharCode(A),P):r(A)}function x(A){return A===45?(e.consume(A),l=2,w):A===91?(e.consume(A),l=5,f=0,E):gn(A)?(e.consume(A),l=4,s.interrupt?n:_):r(A)}function w(A){return A===45?(e.consume(A),s.interrupt?n:_):r(A)}function E(A){const ve="CDATA[";return A===ve.charCodeAt(f++)?(e.consume(A),f===ve.length?s.interrupt?n:Q:E):r(A)}function M(A){return gn(A)?(e.consume(A),c=String.fromCharCode(A),P):r(A)}function P(A){if(A===null||A===47||A===62||Tt(A)){const ve=A===47,Ae=c.toLowerCase();return!ve&&!u&&sb.includes(Ae)?(l=1,s.interrupt?n(A):Q(A)):gA.includes(c.toLowerCase())?(l=6,ve?(e.consume(A),z):s.interrupt?n(A):Q(A)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(A):u?I(A):j(A))}return A===45||cn(A)?(e.consume(A),c+=String.fromCharCode(A),P):r(A)}function z(A){return A===62?(e.consume(A),s.interrupt?n:Q):r(A)}function I(A){return Qe(A)?(e.consume(A),I):L(A)}function j(A){return A===47?(e.consume(A),L):A===58||A===95||gn(A)?(e.consume(A),K):Qe(A)?(e.consume(A),j):L(A)}function K(A){return A===45||A===46||A===58||A===95||cn(A)?(e.consume(A),K):B(A)}function B(A){return A===61?(e.consume(A),R):Qe(A)?(e.consume(A),B):j(A)}function R(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),m=A,Y):Qe(A)?(e.consume(A),R):J(A)}function Y(A){return A===m?(e.consume(A),m=null,F):A===null||Pe(A)?r(A):(e.consume(A),Y)}function J(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Tt(A)?B(A):(e.consume(A),J)}function F(A){return A===47||A===62||Qe(A)?j(A):r(A)}function L(A){return A===62?(e.consume(A),W):r(A)}function W(A){return A===null||Pe(A)?Q(A):Qe(A)?(e.consume(A),W):r(A)}function Q(A){return A===45&&l===2?(e.consume(A),H):A===60&&l===1?(e.consume(A),X):A===62&&l===4?(e.consume(A),D):A===63&&l===3?(e.consume(A),_):A===93&&l===5?(e.consume(A),_e):Pe(A)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(bA,ee,oe)(A)):A===null||Pe(A)?(e.exit("htmlFlowData"),oe(A)):(e.consume(A),Q)}function oe(A){return e.check(xA,ae,ee)(A)}function ae(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),G}function G(A){return A===null||Pe(A)?oe(A):(e.enter("htmlFlowData"),Q(A))}function H(A){return A===45?(e.consume(A),_):Q(A)}function X(A){return A===47?(e.consume(A),c="",ue):Q(A)}function ue(A){if(A===62){const ve=c.toLowerCase();return sb.includes(ve)?(e.consume(A),D):Q(A)}return gn(A)&&c.length<8?(e.consume(A),c+=String.fromCharCode(A),ue):Q(A)}function _e(A){return A===93?(e.consume(A),_):Q(A)}function _(A){return A===62?(e.consume(A),D):A===45&&l===2?(e.consume(A),_):Q(A)}function D(A){return A===null||Pe(A)?(e.exit("htmlFlowData"),ee(A)):(e.consume(A),D)}function ee(A){return e.exit("htmlFlow"),n(A)}}function SA(e,n,r){const s=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 s.parser.lazy[s.now().line]?r(c):n(c)}}function _A(e,n,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Vl,n,r)}}const EA={name:"htmlText",tokenize:kA};function kA(e,n,r){const s=this;let l,u,c;return f;function f(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),m}function m(_){return _===33?(e.consume(_),d):_===47?(e.consume(_),B):_===63?(e.consume(_),j):gn(_)?(e.consume(_),J):r(_)}function d(_){return _===45?(e.consume(_),y):_===91?(e.consume(_),u=0,E):gn(_)?(e.consume(_),I):r(_)}function y(_){return _===45?(e.consume(_),w):r(_)}function g(_){return _===null?r(_):_===45?(e.consume(_),x):Pe(_)?(c=g,X(_)):(e.consume(_),g)}function x(_){return _===45?(e.consume(_),w):g(_)}function w(_){return _===62?H(_):_===45?x(_):g(_)}function E(_){const D="CDATA[";return _===D.charCodeAt(u++)?(e.consume(_),u===D.length?M:E):r(_)}function M(_){return _===null?r(_):_===93?(e.consume(_),P):Pe(_)?(c=M,X(_)):(e.consume(_),M)}function P(_){return _===93?(e.consume(_),z):M(_)}function z(_){return _===62?H(_):_===93?(e.consume(_),z):M(_)}function I(_){return _===null||_===62?H(_):Pe(_)?(c=I,X(_)):(e.consume(_),I)}function j(_){return _===null?r(_):_===63?(e.consume(_),K):Pe(_)?(c=j,X(_)):(e.consume(_),j)}function K(_){return _===62?H(_):j(_)}function B(_){return gn(_)?(e.consume(_),R):r(_)}function R(_){return _===45||cn(_)?(e.consume(_),R):Y(_)}function Y(_){return Pe(_)?(c=Y,X(_)):Qe(_)?(e.consume(_),Y):H(_)}function J(_){return _===45||cn(_)?(e.consume(_),J):_===47||_===62||Tt(_)?F(_):r(_)}function F(_){return _===47?(e.consume(_),H):_===58||_===95||gn(_)?(e.consume(_),L):Pe(_)?(c=F,X(_)):Qe(_)?(e.consume(_),F):H(_)}function L(_){return _===45||_===46||_===58||_===95||cn(_)?(e.consume(_),L):W(_)}function W(_){return _===61?(e.consume(_),Q):Pe(_)?(c=W,X(_)):Qe(_)?(e.consume(_),W):F(_)}function Q(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(e.consume(_),l=_,oe):Pe(_)?(c=Q,X(_)):Qe(_)?(e.consume(_),Q):(e.consume(_),ae)}function oe(_){return _===l?(e.consume(_),l=void 0,G):_===null?r(_):Pe(_)?(c=oe,X(_)):(e.consume(_),oe)}function ae(_){return _===null||_===34||_===39||_===60||_===61||_===96?r(_):_===47||_===62||Tt(_)?F(_):(e.consume(_),ae)}function G(_){return _===47||_===62||Tt(_)?F(_):r(_)}function H(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),n):r(_)}function X(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),ue}function ue(_){return Qe(_)?it(e,_e,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):_e(_)}function _e(_){return e.enter("htmlTextData"),c(_)}}const Jd={name:"labelEnd",resolveAll:jA,resolveTo:NA,tokenize:OA},CA={tokenize:RA},AA={tokenize:MA},TA={tokenize:DA};function jA(e){let n=-1;const r=[];for(;++n<e.length;){const s=e[n][1];if(r.push(e[n]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const l=s.type==="labelImage"?4:2;s.type="data",n+=l}}return e.length!==r.length&&In(e,0,e.length,r),e}function NA(e,n){let r=e.length,s=0,l,u,c,f;for(;r--;)if(l=e[r][1],u){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[r][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(c){if(e[r][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(u=r,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(c=r);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},y={type:"labelText",start:{...e[u+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,n],["enter",d,n]],f=rr(f,e.slice(u+1,u+s+3)),f=rr(f,[["enter",y,n]]),f=rr(f,Ku(n.parser.constructs.insideSpan.null,e.slice(u+s+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 OA(e,n,r){const s=this;let l=s.events.length,u,c;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){u=s.events[l][1];break}return f;function f(x){return u?u._inactive?g(x):(c=s.parser.defined.includes(mr(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),m):r(x)}function m(x){return x===40?e.attempt(CA,y,c?y:g)(x):x===91?e.attempt(AA,y,c?d:g)(x):c?y(x):g(x)}function d(x){return e.attempt(TA,y,g)(x)}function y(x){return n(x)}function g(x){return u._balanced=!0,r(x)}}function RA(e,n,r){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return Tt(g)?Ol(e,u)(g):u(g)}function u(g){return g===41?y(g):Wx(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Tt(g)?Ol(e,m)(g):y(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?t1(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function d(g){return Tt(g)?Ol(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 MA(e,n,r){const s=this;return l;function l(f){return e1.call(s,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return s.parser.defined.includes(mr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function c(f){return r(f)}}function DA(e,n,r){return s;function s(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),l}function l(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),n):r(u)}}const LA={name:"labelStartImage",resolveAll:Jd.resolveAll,tokenize:zA};function zA(e,n,r){const s=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):r(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(f):n(f)}}const UA={name:"labelStartLink",resolveAll:Jd.resolveAll,tokenize:BA};function BA(e,n,r){const s=this;return l;function l(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(c):n(c)}}const zh={name:"lineEnding",tokenize:PA};function PA(e,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),it(e,n,"linePrefix")}}const Eu={name:"thematicBreak",tokenize:qA};function qA(e,n,r){let s=0,l;return u;function u(d){return e.enter("thematicBreak"),c(d)}function c(d){return l=d,f(d)}function f(d){return d===l?(e.enter("thematicBreakSequence"),m(d)):s>=3&&(d===null||Pe(d))?(e.exit("thematicBreak"),n(d)):r(d)}function m(d){return d===l?(e.consume(d),s++,m):(e.exit("thematicBreakSequence"),Qe(d)?it(e,f,"whitespace")(d):f(d))}}const kn={continuation:{tokenize:$A},exit:GA,name:"list",tokenize:FA},HA={partial:!0,tokenize:VA},IA={partial:!0,tokenize:YA};function FA(e,n,r){const s=this,l=s.events[s.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return f;function f(w){const E=s.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!s.containerState.marker||w===s.containerState.marker:yd(w)){if(s.containerState.type||(s.containerState.type=E,e.enter(E,{_container:!0})),E==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Eu,r,d)(w):d(w);if(!s.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return r(w)}function m(w){return yd(w)&&++c<10?(e.consume(w),m):(!s.interrupt||c<2)&&(s.containerState.marker?w===s.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),d(w)):r(w)}function d(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||w,e.check(Vl,s.interrupt?r:y,e.attempt(HA,x,g))}function y(w){return s.containerState.initialBlankLine=!0,u++,x(w)}function g(w){return Qe(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),x):r(w)}function x(w){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(w)}}function $A(e,n,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Vl,l,u);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,it(e,n,"listItemIndent",s.containerState.size+1)(f)}function u(f){return s.containerState.furtherBlankLines||!Qe(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(IA,n,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,it(e,e.attempt(kn,n,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function YA(e,n,r){const s=this;return it(e,l,"listItemIndent",s.containerState.size+1);function l(u){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?n(u):r(u)}}function GA(e){e.exit(this.containerState.type)}function VA(e,n,r){const s=this;return it(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const c=s.events[s.events.length-1];return!Qe(u)&&c&&c[1].type==="listItemPrefixWhitespace"?n(u):r(u)}}const ab={name:"setextUnderline",resolveTo:JA,tokenize:XA};function JA(e,n){let r=e.length,s,l,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){s=r;break}e[r][1].type==="paragraph"&&(l=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",u?(e.splice(l,0,["enter",c,n]),e.splice(u+1,0,["exit",e[s][1],n]),e[s][1].end={...e[u][1].end}):e[s][1]=c,e.push(["exit",c,n]),e}function XA(e,n,r){const s=this;let l;return u;function u(d){let y=s.events.length,g;for(;y--;)if(s.events[y][1].type!=="lineEnding"&&s.events[y][1].type!=="linePrefix"&&s.events[y][1].type!=="content"){g=s.events[y][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),l=d,c(d)):r(d)}function c(d){return e.enter("setextHeadingLineSequence"),f(d)}function f(d){return d===l?(e.consume(d),f):(e.exit("setextHeadingLineSequence"),Qe(d)?it(e,m,"lineSuffix")(d):m(d))}function m(d){return d===null||Pe(d)?(e.exit("setextHeadingLine"),n(d)):r(d)}}const KA={tokenize:QA};function QA(e){const n=this,r=e.attempt(Vl,s,e.attempt(this.parser.constructs.flowInitial,l,it(e,e.attempt(this.parser.constructs.flow,l,e.attempt(nA,l)),"linePrefix")));return r;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const ZA={resolveAll:r1()},WA=n1("string"),eT=n1("text");function n1(e){return{resolveAll:r1(e==="text"?tT:void 0),tokenize:n};function n(r){const s=this,l=this.parser.constructs[e],u=r.attempt(l,c,f);return c;function c(y){return d(y)?u(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),m}function m(y){return d(y)?(r.exit("data"),u(y)):(r.consume(y),m)}function d(y){if(y===null)return!0;const g=l[y];let x=-1;if(g)for(;++x<g.length;){const w=g[x];if(!w.previous||w.previous.call(s,s.previous))return!0}return!1}}}function r1(e){return n;function n(r,s){let l=-1,u;for(;++l<=r.length;)u===void 0?r[l]&&r[l][1].type==="data"&&(u=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==u+2&&(r[u][1].end=r[l-1][1].end,r.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(r,s):r}}function tT(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const s=e[r-1][1],l=n.sliceStream(s);let u=l.length,c=-1,f=0,m;for(;u--;){const d=l[u];if(typeof d=="string"){for(c=d.length;d.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(d===-2)m=!0,f++;else if(d!==-1){u++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(f=0),f){const d={type:r===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:s.start._bufferIndex+c,_index:s.start._index+u,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...d.start},s.start.offset===s.end.offset?Object.assign(s,d):(e.splice(r,0,["enter",d,n],["exit",d,n]),r+=2)}r++}return e}const nT={42:kn,43:kn,45:kn,48:kn,49:kn,50:kn,51:kn,52:kn,53:kn,54:kn,55:kn,56:kn,57:kn,62:Xx},rT={91:lA},iT={[-2]:Lh,[-1]:Lh,32:Lh},sT={35:dA,42:Eu,45:[ab,Eu],60:yA,61:ab,95:Eu,96:ib,126:ib},aT={38:Qx,92:Kx},lT={[-5]:zh,[-4]:zh,[-3]:zh,33:LA,38:Qx,42:bd,60:[UC,EA],91:UA,92:[fA,Kx],93:Jd,95:bd,96:KC},oT={null:[bd,ZA]},uT={null:[42,95]},cT={null:[]},fT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:uT,contentInitial:rT,disable:cT,document:nT,flow:sT,flowInitial:iT,insideSpan:oT,string:aT,text:lT},Symbol.toStringTag,{value:"Module"}));function hT(e,n,r){let s={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const l={},u=[];let c=[],f=[];const m={attempt:Y(B),check:Y(R),consume:I,enter:j,exit:K,interrupt:Y(R,{interrupt:!0})},d={code:null,containerState:{},defineSkip:M,events:[],now:E,parser:e,previous:null,sliceSerialize:x,sliceStream:w,write:g};let y=n.tokenize.call(d,m);return n.resolveAll&&u.push(n),d;function g(W){return c=rr(c,W),P(),c[c.length-1]!==null?[]:(J(n,0),d.events=Ku(u,d.events,d),d.events)}function x(W,Q){return mT(w(W),Q)}function w(W){return dT(c,W)}function E(){const{_bufferIndex:W,_index:Q,line:oe,column:ae,offset:G}=s;return{_bufferIndex:W,_index:Q,line:oe,column:ae,offset:G}}function M(W){l[W.line]=W.column,L()}function P(){let W;for(;s._index<c.length;){const Q=c[s._index];if(typeof Q=="string")for(W=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===W&&s._bufferIndex<Q.length;)z(Q.charCodeAt(s._bufferIndex));else z(Q)}}function z(W){y=y(W)}function I(W){Pe(W)?(s.line++,s.column=1,s.offset+=W===-3?2:1,L()):W!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),d.previous=W}function j(W,Q){const oe=Q||{};return oe.type=W,oe.start=E(),d.events.push(["enter",oe,d]),f.push(oe),oe}function K(W){const Q=f.pop();return Q.end=E(),d.events.push(["exit",Q,d]),Q}function B(W,Q){J(W,Q.from)}function R(W,Q){Q.restore()}function Y(W,Q){return oe;function oe(ae,G,H){let X,ue,_e,_;return Array.isArray(ae)?ee(ae):"tokenize"in ae?ee([ae]):D(ae);function D(Te){return Me;function Me(He){const be=He!==null&&Te[He],De=He!==null&&Te.null,Ze=[...Array.isArray(be)?be:be?[be]:[],...Array.isArray(De)?De:De?[De]:[]];return ee(Ze)(He)}}function ee(Te){return X=Te,ue=0,Te.length===0?H:A(Te[ue])}function A(Te){return Me;function Me(He){return _=F(),_e=Te,Te.partial||(d.currentConstruct=Te),Te.name&&d.parser.constructs.disable.null.includes(Te.name)?Ae():Te.tokenize.call(Q?Object.assign(Object.create(d),Q):d,m,ve,Ae)(He)}}function ve(Te){return W(_e,_),G}function Ae(Te){return _.restore(),++ue<X.length?A(X[ue]):H}}}function J(W,Q){W.resolveAll&&!u.includes(W)&&u.push(W),W.resolve&&In(d.events,Q,d.events.length-Q,W.resolve(d.events.slice(Q),d)),W.resolveTo&&(d.events=W.resolveTo(d.events,d))}function F(){const W=E(),Q=d.previous,oe=d.currentConstruct,ae=d.events.length,G=Array.from(f);return{from:ae,restore:H};function H(){s=W,d.previous=Q,d.currentConstruct=oe,d.events.length=ae,f=G,L()}}function L(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function dT(e,n){const r=n.start._index,s=n.start._bufferIndex,l=n.end._index,u=n.end._bufferIndex;let c;if(r===l)c=[e[r].slice(s,u)];else{if(c=e.slice(r,l),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}u>0&&c.push(e[l].slice(0,u))}return c}function mT(e,n){let r=-1;const s=[];let l;for(;++r<e.length;){const u=e[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
94
+ `;break}case-3:{c=`\r
95
+ `;break}case-2:{c=n?" ":" ";break}case-1:{if(!n&&l)continue;c=" ";break}default:c=String.fromCharCode(u)}l=u===-2,s.push(c)}return s.join("")}function pT(e){const s={constructs:Vx([fT,...(e||{}).extensions||[]]),content:l(NC),defined:[],document:l(RC),flow:l(KA),lazy:{},string:l(WA),text:l(eT)};return s;function l(u){return c;function c(f){return hT(s,u,f)}}}function gT(e){for(;!Zx(e););return e}const lb=/[\0\t\n\r]/g;function yT(){let e=1,n="",r=!0,s;return l;function l(u,c,f){const m=[];let d,y,g,x,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(lb.lastIndex=g,d=lb.exec(u),x=d&&d.index!==void 0?d.index:u.length,w=u.charCodeAt(x),!d){n=u.slice(g);break}if(w===10&&g===x&&s)m.push(-3),s=void 0;else switch(s&&(m.push(-5),s=void 0),g<x&&(m.push(u.slice(g,x)),e+=x-g),w){case 0:{m.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,m.push(-2);e++<y;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:s=!0,e=1}g=x+1}return f&&(s&&m.push(-5),n&&m.push(n),m.push(null)),m}}const bT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function xT(e){return e.replace(bT,vT)}function vT(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return Jx(r.slice(u?2:1),u?16:10)}return Vd(r)||e}const i1={}.hasOwnProperty;function wT(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),ST(r)(gT(pT(r).document().write(yT()(e,n,!0))))}function ST(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(st),autolinkProtocol:F,autolinkEmail:F,atxHeading:u(Fe),blockQuote:u(De),characterEscape:F,characterReference:F,codeFenced:u(Ze),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(Ze,c),codeText:u(dt,c),codeTextData:F,data:F,codeFlowValue:F,definition:u(lt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(ct),hardBreakEscape:u(Ue),hardBreakTrailing:u(Ue),htmlFlow:u(tt,c),htmlFlowData:F,htmlText:u(tt,c),htmlTextData:F,image:u(mt),label:c,link:u(st),listItem:u(yt),listItemValue:x,listOrdered:u(Mt,g),listUnordered:u(Mt),paragraph:u($n),reference:A,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(Fe),strong:u(gr),thematicBreak:u(An)},exit:{atxHeading:m(),atxHeadingSequence:B,autolink:m(),autolinkEmail:be,autolinkProtocol:He,blockQuote:m(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:Ae,characterReferenceMarkerNumeric:Ae,characterReferenceValue:Te,characterReference:Me,codeFenced:m(P),codeFencedFence:M,codeFencedFenceInfo:w,codeFencedFenceMeta:E,codeFlowValue:L,codeIndented:m(z),codeText:m(G),codeTextData:L,data:L,definition:m(),definitionDestinationString:K,definitionLabelString:I,definitionTitleString:j,emphasis:m(),hardBreakEscape:m(Q),hardBreakTrailing:m(Q),htmlFlow:m(oe),htmlFlowData:L,htmlText:m(ae),htmlTextData:L,image:m(X),label:_e,labelText:ue,lineEnding:W,link:m(H),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:ve,resourceDestinationString:_,resourceTitleString:D,resource:ee,setextHeading:m(J),setextHeadingLineSequence:Y,setextHeadingText:R,strong:m(),thematicBreak:m()}};s1(n,(e||{}).mdastExtensions||[]);const r={};return s;function s(fe){let we={type:"root",children:[]};const Be={stack:[we],tokenStack:[],config:n,enter:f,exit:d,buffer:c,resume:y,data:r},$e=[];let rt=-1;for(;++rt<fe.length;)if(fe[rt][1].type==="listOrdered"||fe[rt][1].type==="listUnordered")if(fe[rt][0]==="enter")$e.push(rt);else{const nn=$e.pop();rt=l(fe,nn,rt)}for(rt=-1;++rt<fe.length;){const nn=n[fe[rt][0]];i1.call(nn,fe[rt][1].type)&&nn[fe[rt][1].type].call(Object.assign({sliceSerialize:fe[rt][2].sliceSerialize},Be),fe[rt][1])}if(Be.tokenStack.length>0){const nn=Be.tokenStack[Be.tokenStack.length-1];(nn[1]||ob).call(Be,void 0,nn[0])}for(we.position={start:Ri(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:Ri(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},rt=-1;++rt<n.transforms.length;)we=n.transforms[rt](we)||we;return we}function l(fe,we,Be){let $e=we-1,rt=-1,nn=!1,bn,Yt,ge,ze;for(;++$e<=Be;){const Se=fe[$e];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?rt++:rt--,ze=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(bn&&!ze&&!rt&&!ge&&(ge=$e),ze=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ze=void 0}if(!rt&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||rt===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(bn){let ft=$e;for(Yt=void 0;ft--;){const pt=fe[ft];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;Yt&&(fe[Yt][1].type="lineEndingBlank",nn=!0),pt[1].type="lineEnding",Yt=ft}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}ge&&(!Yt||ge<Yt)&&(bn._spread=!0),bn.end=Object.assign({},Yt?fe[Yt][1].start:Se[1].end),fe.splice(Yt||$e,0,["exit",bn,Se[2]]),$e++,Be++}if(Se[1].type==="listItemPrefix"){const ft={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};bn=ft,fe.splice($e,0,["enter",ft,Se[2]]),$e++,Be++,ge=void 0,ze=!0}}}return fe[we][1]._spread=nn,Be}function u(fe,we){return Be;function Be($e){f.call(this,fe($e),$e),we&&we.call(this,$e)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(fe,we,Be){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([we,Be||void 0]),fe.position={start:Ri(we.start),end:void 0}}function m(fe){return we;function we(Be){fe&&fe.call(this,Be),d.call(this,Be)}}function d(fe,we){const Be=this.stack.pop(),$e=this.tokenStack.pop();if($e)$e[0].type!==fe.type&&(we?we.call(this,fe,$e[0]):($e[1]||ob).call(this,fe,$e[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Nl({start:fe.start,end:fe.end})+"): it’s not open");Be.position.end=Ri(fe.end)}function y(){return Gd(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(fe){if(this.data.expectingFirstListItemValue){const we=this.stack[this.stack.length-2];we.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function w(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.lang=fe}function E(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.meta=fe}function M(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function P(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function z(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe.replace(/(\r?\n|\r)$/g,"")}function I(fe){const we=this.resume(),Be=this.stack[this.stack.length-1];Be.label=we,Be.identifier=mr(this.sliceSerialize(fe)).toLowerCase()}function j(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.title=fe}function K(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.url=fe}function B(fe){const we=this.stack[this.stack.length-1];if(!we.depth){const Be=this.sliceSerialize(fe).length;we.depth=Be}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function Y(fe){const we=this.stack[this.stack.length-1];we.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function J(){this.data.setextHeadingSlurpLineEnding=void 0}function F(fe){const Be=this.stack[this.stack.length-1].children;let $e=Be[Be.length-1];(!$e||$e.type!=="text")&&($e=vt(),$e.position={start:Ri(fe.start),end:void 0},Be.push($e)),this.stack.push($e)}function L(fe){const we=this.stack.pop();we.value+=this.sliceSerialize(fe),we.position.end=Ri(fe.end)}function W(fe){const we=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Be=we.children[we.children.length-1];Be.position.end=Ri(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(we.type)&&(F.call(this,fe),L.call(this,fe))}function Q(){this.data.atHardBreak=!0}function oe(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe}function ae(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe}function G(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe}function H(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=we,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function X(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=we,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function ue(fe){const we=this.sliceSerialize(fe),Be=this.stack[this.stack.length-2];Be.label=xT(we),Be.identifier=mr(we).toLowerCase()}function _e(){const fe=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 $e=fe.children;Be.children=$e}else Be.alt=we}function _(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.url=fe}function D(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.title=fe}function ee(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ve(fe){const we=this.resume(),Be=this.stack[this.stack.length-1];Be.label=we,Be.identifier=mr(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function Ae(fe){this.data.characterReferenceType=fe.type}function Te(fe){const we=this.sliceSerialize(fe),Be=this.data.characterReferenceType;let $e;Be?($e=Jx(we,Be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):$e=Vd(we);const rt=this.stack[this.stack.length-1];rt.value+=$e}function Me(fe){const we=this.stack.pop();we.position.end=Ri(fe.end)}function He(fe){L.call(this,fe);const we=this.stack[this.stack.length-1];we.url=this.sliceSerialize(fe)}function be(fe){L.call(this,fe);const we=this.stack[this.stack.length-1];we.url="mailto:"+this.sliceSerialize(fe)}function De(){return{type:"blockquote",children:[]}}function Ze(){return{type:"code",lang:null,meta:null,value:""}}function dt(){return{type:"inlineCode",value:""}}function lt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ct(){return{type:"emphasis",children:[]}}function Fe(){return{type:"heading",depth:0,children:[]}}function Ue(){return{type:"break"}}function tt(){return{type:"html",value:""}}function mt(){return{type:"image",title:null,url:"",alt:null}}function st(){return{type:"link",title:null,url:"",children:[]}}function Mt(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function yt(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function $n(){return{type:"paragraph",children:[]}}function gr(){return{type:"strong",children:[]}}function vt(){return{type:"text",value:""}}function An(){return{type:"thematicBreak"}}}function Ri(e){return{line:e.line,column:e.column,offset:e.offset}}function s1(e,n){let r=-1;for(;++r<n.length;){const s=n[r];Array.isArray(s)?s1(e,s):_T(e,s)}}function _T(e,n){let r;for(r in n)if(i1.call(n,r))switch(r){case"canContainEols":{const s=n[r];s&&e[r].push(...s);break}case"transforms":{const s=n[r];s&&e[r].push(...s);break}case"enter":case"exit":{const s=n[r];s&&Object.assign(e[r],s);break}}}function ob(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Nl({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Nl({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Nl({start:n.start,end:n.end})+") is still open")}function ET(e){const n=this;n.parser=r;function r(s){return wT(s,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function kT(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 CT(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
96
+ `}]}function AT(e,n){const r=n.value?n.value+`
97
+ `:"",s={},l=n.lang?n.lang.split(/\s+/):[];l.length>0&&(s.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return n.meta&&(u.data={meta:n.meta}),e.patch(n,u),u=e.applyData(n,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(n,u),u}function TT(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function jT(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function NT(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(n.identifier).toUpperCase(),l=Sa(s.toLowerCase()),u=e.footnoteOrder.indexOf(s);let c,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=u+1,f+=1,e.footnoteCounts.set(s,f);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+l,id:r+"fnref-"+l+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(n,m);const d={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(n,d),e.applyData(n,d)}function OT(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 RT(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function a1(e,n){const r=n.referenceType;let s="]";if(r==="collapsed"?s+="[]":r==="full"&&(s+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+s}];const l=e.all(n),u=l[0];u&&u.type==="text"?u.value="["+u.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=s:l.push({type:"text",value:s}),l}function MT(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return a1(e,n);const l={src:Sa(s.url||""),alt:n.alt};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(n,u),e.applyData(n,u)}function DT(e,n){const r={src:Sa(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,s),e.applyData(n,s)}function LT(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const s={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,s),e.applyData(n,s)}function zT(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return a1(e,n);const l={href:Sa(s.url||"")};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"a",properties:l,children:e.all(n)};return e.patch(n,u),e.applyData(n,u)}function UT(e,n){const r={href:Sa(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const s={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function BT(e,n,r){const s=e.all(n),l=r?PT(r):l1(n),u={},c=[];if(typeof n.checked=="boolean"){const y=s[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const y=s[f];(l||f!==0||y.type!=="element"||y.tagName!=="p")&&c.push({type:"text",value:`
98
+ `}),y.type==="element"&&y.tagName==="p"&&!l?c.push(...y.children):c.push(y)}const m=s[s.length-1];m&&(l||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
99
+ `});const d={type:"element",tagName:"li",properties:u,children:c};return e.patch(n,d),e.applyData(n,d)}function PT(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let s=-1;for(;!n&&++s<r.length;)n=l1(r[s])}return n}function l1(e){const n=e.spread;return n??e.children.length>1}function qT(e,n){const r={},s=e.all(n);let l=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++l<s.length;){const c=s[l];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(n,u),e.applyData(n,u)}function HT(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function IT(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function FT(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function $T(e,n){const r=e.all(n),s=r.shift(),l=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(n.children[0],c),l.push(c)}if(r.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=Id(n.children[1]),m=qx(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 YT(e,n,r){const s=r?r.children:void 0,u=(s?s.indexOf(n):1)===0?"th":"td",c=r&&r.type==="table"?r.align:void 0,f=c?c.length:n.children.length;let m=-1;const d=[];for(;++m<f;){const g=n.children[m],x={},w=c?c[m]:void 0;w&&(x.align=w);let E={type:"element",tagName:u,properties:x,children:[]};g&&(E.children=e.all(g),e.patch(g,E),E=e.applyData(g,E)),d.push(E)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(n,y),e.applyData(n,y)}function GT(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const ub=9,cb=32;function VT(e){const n=String(e),r=/\r?\n|\r/g;let s=r.exec(n),l=0;const u=[];for(;s;)u.push(fb(n.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=r.exec(n);return u.push(fb(n.slice(l),l>0,!1)),u.join("")}function fb(e,n,r){let s=0,l=e.length;if(n){let u=e.codePointAt(s);for(;u===ub||u===cb;)s++,u=e.codePointAt(s)}if(r){let u=e.codePointAt(l-1);for(;u===ub||u===cb;)l--,u=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function JT(e,n){const r={type:"text",value:VT(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function XT(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const KT={blockquote:kT,break:CT,code:AT,delete:TT,emphasis:jT,footnoteReference:NT,heading:OT,html:RT,imageReference:MT,image:DT,inlineCode:LT,linkReference:zT,link:UT,listItem:BT,list:qT,paragraph:HT,root:IT,strong:FT,table:$T,tableCell:GT,tableRow:YT,text:JT,thematicBreak:XT,toml:gu,yaml:gu,definition:gu,footnoteDefinition:gu};function gu(){}const o1=-1,Qu=0,Rl=1,Pu=2,Xd=3,Kd=4,Qd=5,Zd=6,u1=7,c1=8,hb=typeof self=="object"?self:globalThis,QT=(e,n)=>{const r=(l,u)=>(e.set(u,l),l),s=l=>{if(e.has(l))return e.get(l);const[u,c]=n[l];switch(u){case Qu:case o1:return r(c,l);case Rl:{const f=r([],l);for(const m of c)f.push(s(m));return f}case Pu:{const f=r({},l);for(const[m,d]of c)f[s(m)]=s(d);return f}case Xd:return r(new Date(c),l);case Kd:{const{source:f,flags:m}=c;return r(new RegExp(f,m),l)}case Qd:{const f=r(new Map,l);for(const[m,d]of c)f.set(s(m),s(d));return f}case Zd:{const f=r(new Set,l);for(const m of c)f.add(s(m));return f}case u1:{const{name:f,message:m}=c;return r(new hb[f](m),l)}case c1: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 hb[u](c),l)};return s},db=e=>QT(new Map,e)(0),Zs="",{toString:ZT}={},{keys:WT}=Object,wl=e=>{const n=typeof e;if(n!=="object"||!e)return[Qu,n];const r=ZT.call(e).slice(8,-1);switch(r){case"Array":return[Rl,Zs];case"Object":return[Pu,Zs];case"Date":return[Xd,Zs];case"RegExp":return[Kd,Zs];case"Map":return[Qd,Zs];case"Set":return[Zd,Zs];case"DataView":return[Rl,r]}return r.includes("Array")?[Rl,r]:r.includes("Error")?[u1,r]:[Pu,r]},yu=([e,n])=>e===Qu&&(n==="function"||n==="symbol"),ej=(e,n,r,s)=>{const l=(c,f)=>{const m=s.push(c)-1;return r.set(f,m),m},u=c=>{if(r.has(c))return r.get(c);let[f,m]=wl(c);switch(f){case Qu:{let y=c;switch(m){case"bigint":f=c1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([o1],c)}return l([f,y],c)}case Rl:{if(m){let x=c;return m==="DataView"?x=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(x=new Uint8Array(c)),l([m,[...x]],c)}const y=[],g=l([f,y],c);for(const x of c)y.push(u(x));return g}case Pu:{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 x of WT(c))(e||!yu(wl(c[x])))&&y.push([u(x),u(c[x])]);return g}case Xd:return l([f,c.toISOString()],c);case Kd:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case Qd:{const y=[],g=l([f,y],c);for(const[x,w]of c)(e||!(yu(wl(x))||yu(wl(w))))&&y.push([u(x),u(w)]);return g}case Zd:{const y=[],g=l([f,y],c);for(const x of c)(e||!yu(wl(x)))&&y.push(u(x));return g}}const{message:d}=c;return l([f,{name:m,message:d}],c)};return u},mb=(e,{json:n,lossy:r}={})=>{const s=[];return ej(!(n||r),!!n,new Map,s)(e),s},qu=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?db(mb(e,n)):structuredClone(e):(e,n)=>db(mb(e,n));function tj(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 nj(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function rj(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||tj,s=e.options.footnoteBackLabel||nj,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(),x=Sa(g.toLowerCase());let w=0;const E=[],M=e.footnoteCounts.get(g);for(;M!==void 0&&++w<=M;){E.length>0&&E.push({type:"text",value:" "});let I=typeof r=="string"?r:r(m,w);typeof I=="string"&&(I={type:"text",value:I}),E.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+x+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(m,w),className:["data-footnote-backref"]},children:Array.isArray(I)?I:[I]})}const P=y[y.length-1];if(P&&P.type==="element"&&P.tagName==="p"){const I=P.children[P.children.length-1];I&&I.type==="text"?I.value+=" ":P.children.push({type:"text",value:" "}),P.children.push(...E)}else y.push(...E);const z={type:"element",tagName:"li",properties:{id:n+"fn-"+x},children:e.wrap(y,!0)};e.patch(d,z),f.push(z)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...qu(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
100
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
101
+ `}]}}const Zu=(function(e){if(e==null)return lj;if(typeof e=="function")return Wu(e);if(typeof e=="object")return Array.isArray(e)?ij(e):sj(e);if(typeof e=="string")return aj(e);throw new Error("Expected function, string, or object as test")});function ij(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Zu(e[r]);return Wu(s);function s(...l){let u=-1;for(;++u<n.length;)if(n[u].apply(this,l))return!0;return!1}}function sj(e){const n=e;return Wu(r);function r(s){const l=s;let u;for(u in e)if(l[u]!==n[u])return!1;return!0}}function aj(e){return Wu(n);function n(r){return r&&r.type===e}}function Wu(e){return n;function n(r,s,l){return!!(oj(r)&&e.call(this,r,typeof s=="number"?s:void 0,l||void 0))}}function lj(){return!0}function oj(e){return e!==null&&typeof e=="object"&&"type"in e}const f1=[],uj=!0,xd=!1,cj="skip";function h1(e,n,r,s){let l;typeof n=="function"&&typeof r!="function"?(s=r,r=n):l=n;const u=Zu(l),c=s?-1:1;f(e,void 0,[])();function f(m,d,y){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const w=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return x;function x(){let w=f1,E,M,P;if((!n||u(m,d,y[y.length-1]||void 0))&&(w=fj(r(m,y)),w[0]===xd))return w;if("children"in m&&m.children){const z=m;if(z.children&&w[0]!==cj)for(M=(s?z.children.length:-1)+c,P=y.concat(z);M>-1&&M<z.children.length;){const I=z.children[M];if(E=f(I,M,P)(),E[0]===xd)return E;M=typeof E[1]=="number"?E[1]:M+c}}return w}}}function fj(e){return Array.isArray(e)?e:typeof e=="number"?[uj,e]:e==null?f1:[e]}function Wd(e,n,r,s){let l,u,c;typeof n=="function"&&typeof r!="function"?(u=void 0,c=n,l=r):(u=n,c=r,l=s),h1(e,u,f,l);function f(m,d){const y=d[d.length-1],g=y?y.children.indexOf(m):void 0;return c(m,g,y)}}const vd={}.hasOwnProperty,hj={};function dj(e,n){const r=n||hj,s=new Map,l=new Map,u=new Map,c={...KT,...r.handlers},f={all:d,applyData:pj,definitionById:s,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:mj,wrap:yj};return Wd(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?s:l,x=String(y.identifier).toUpperCase();g.has(x)||g.set(x,y)}}),f;function m(y,g){const x=y.type,w=f.handlers[x];if(vd.call(f.handlers,x)&&w)return w(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in y){const{children:M,...P}=y,z=qu(P);return z.children=f.all(y),z}return qu(y)}return(f.options.unknownHandler||gj)(f,y,g)}function d(y){const g=[];if("children"in y){const x=y.children;let w=-1;for(;++w<x.length;){const E=f.one(x[w],y);if(E){if(w&&x[w-1].type==="break"&&(!Array.isArray(E)&&E.type==="text"&&(E.value=pb(E.value)),!Array.isArray(E)&&E.type==="element")){const M=E.children[0];M&&M.type==="text"&&(M.value=pb(M.value))}Array.isArray(E)?g.push(...E):g.push(E)}}}return g}}function mj(e,n){e.position&&(n.position=nC(e))}function pj(e,n){let r=n;if(e&&e.data){const s=e.data.hName,l=e.data.hChildren,u=e.data.hProperties;if(typeof s=="string")if(r.type==="element")r.tagName=s;else{const c="children"in r?r.children:[r];r={type:"element",tagName:s,properties:{},children:c}}r.type==="element"&&u&&Object.assign(r.properties,qu(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function gj(e,n){const r=n.data||{},s="value"in n&&!(vd.call(r,"hProperties")||vd.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function yj(e,n){const r=[];let s=-1;for(n&&r.push({type:"text",value:`
102
+ `});++s<e.length;)s&&r.push({type:"text",value:`
103
+ `}),r.push(e[s]);return n&&e.length>0&&r.push({type:"text",value:`
104
+ `}),r}function pb(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function gb(e,n){const r=dj(e,n),s=r.one(e,void 0),l=rj(r),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
105
+ `},l),u}function bj(e,n){return e&&"run"in e?async function(r,s){const l=gb(r,{file:s,...n});await e.run(l,s)}:function(r,s){return gb(r,{file:s,...e||n})}}function yb(e){if(e)throw e}var Uh,bb;function xj(){if(bb)return Uh;bb=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(d){return typeof Array.isArray=="function"?Array.isArray(d):n.call(d)==="[object Array]"},u=function(d){if(!d||n.call(d)!=="[object Object]")return!1;var y=e.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!y&&!g)return!1;var x;for(x in d);return typeof x>"u"||e.call(d,x)},c=function(d,y){r&&y.name==="__proto__"?r(d,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):d[y.name]=y.newValue},f=function(d,y){if(y==="__proto__")if(e.call(d,y)){if(s)return s(d,y).value}else return;return d[y]};return Uh=function m(){var d,y,g,x,w,E,M=arguments[0],P=1,z=arguments.length,I=!1;for(typeof M=="boolean"&&(I=M,M=arguments[1]||{},P=2),(M==null||typeof M!="object"&&typeof M!="function")&&(M={});P<z;++P)if(d=arguments[P],d!=null)for(y in d)g=f(M,y),x=f(d,y),M!==x&&(I&&x&&(u(x)||(w=l(x)))?(w?(w=!1,E=g&&l(g)?g:[]):E=g&&u(g)?g:{},c(M,{name:y,newValue:m(I,E,x)})):typeof x<"u"&&c(M,{name:y,newValue:x}));return M},Uh}var vj=xj();const Bh=Db(vj);function wd(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function wj(){const e=[],n={run:r,use:s};return n;function r(...l){let u=-1;const c=l.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...l);function f(m,...d){const y=e[++u];let g=-1;if(m){c(m);return}for(;++g<l.length;)(d[g]===null||d[g]===void 0)&&(d[g]=l[g]);l=d,y?Sj(y,f)(...d):c(null,...d)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),n}}function Sj(e,n){let r;return s;function s(...c){const f=e.length>c.length;let m;f&&c.push(l);try{m=e.apply(this,c)}catch(d){const y=d;if(f&&r)throw y;return l(y)}f||(m&&m.then&&typeof m.then=="function"?m.then(u,l):m instanceof Error?l(m):u(m))}function l(c,...f){r||(r=!0,n(c,...f))}function u(c){l(null,c)}}const Sr={basename:_j,dirname:Ej,extname:kj,join:Cj,sep:"/"};function _j(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Jl(e);let r=0,s=-1,l=e.length,u;if(n===void 0||n.length===0||n.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else s<0&&(u=!0,s=l+1);return s<0?"":e.slice(r,s)}if(n===e)return"";let c=-1,f=n.length-1;for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else c<0&&(u=!0,c=l+1),f>-1&&(e.codePointAt(l)===n.codePointAt(f--)?f<0&&(s=l):(f=-1,s=c));return r===s?s=c:s<0&&(s=e.length),e.slice(r,s)}function Ej(e){if(Jl(e),e.length===0)return".";let n=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){n=r;break}}else s||(s=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function kj(e){Jl(e);let n=e.length,r=-1,s=0,l=-1,u=0,c;for(;n--;){const f=e.codePointAt(n);if(f===47){if(c){s=n+1;break}continue}r<0&&(c=!0,r=n+1),f===46?l<0?l=n:u!==1&&(u=1):l>-1&&(u=-1)}return l<0||r<0||u===0||u===1&&l===r-1&&l===s+1?"":e.slice(l,r)}function Cj(...e){let n=-1,r;for(;++n<e.length;)Jl(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":Aj(r)}function Aj(e){Jl(e);const n=e.codePointAt(0)===47;let r=Tj(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function Tj(e,n){let r="",s=0,l=-1,u=0,c=-1,f,m;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(l===c-1||u===1))if(l!==c-1&&u===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",s=0):(r=r.slice(0,m),s=r.length-1-r.lastIndexOf("/")),l=c,u=0;continue}}else if(r.length>0){r="",s=0,l=c,u=0;continue}}n&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+e.slice(l+1,c):r=e.slice(l+1,c),s=c-l-1;l=c,u=0}else f===46&&u>-1?u++:u=-1}return r}function Jl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const jj={cwd:Nj};function Nj(){return"/"}function Sd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Oj(e){if(typeof e=="string")e=new URL(e);else if(!Sd(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return Rj(e)}function Rj(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const s=n.codePointAt(r+2);if(s===70||s===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(n)}const Ph=["history","path","basename","stem","extname","dirname"];class d1{constructor(n){let r;n?Sd(n)?r={path:n}:typeof n=="string"||Mj(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":jj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Ph.length;){const u=Ph[s];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let l;for(l in r)Ph.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?Sr.basename(this.path):void 0}set basename(n){Hh(n,"basename"),qh(n,"basename"),this.path=Sr.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?Sr.dirname(this.path):void 0}set dirname(n){xb(this.basename,"dirname"),this.path=Sr.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?Sr.extname(this.path):void 0}set extname(n){if(qh(n,"extname"),xb(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=Sr.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Sd(n)&&(n=Oj(n)),Hh(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?Sr.basename(this.path,this.extname):void 0}set stem(n){Hh(n,"stem"),qh(n,"stem"),this.path=Sr.join(this.dirname||"",n+(this.extname||""))}fail(n,r,s){const l=this.message(n,r,s);throw l.fatal=!0,l}info(n,r,s){const l=this.message(n,r,s);return l.fatal=void 0,l}message(n,r,s){const l=new fn(n,r,s);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function qh(e,n){if(e&&e.includes(Sr.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+Sr.sep+"`")}function Hh(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function xb(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function Mj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Dj=(function(e){const s=this.constructor.prototype,l=s[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),Lj={}.hasOwnProperty;class em extends Dj{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=wj()}copy(){const n=new em;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];n.use(...s)}return n.data(Bh(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?($h("data",this.frozen),this.namespace[n]=r,this):Lj.call(this.namespace,n)&&this.namespace[n]||void 0:n?($h("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const l=r.call(n,...s);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=bu(n),s=this.parser||this.Parser;return Ih("parse",s),s(String(r),r)}process(n,r){const s=this;return this.freeze(),Ih("process",this.parser||this.Parser),Fh("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=bu(n),m=s.parse(f);s.run(m,f,function(y,g,x){if(y||!g||!x)return d(y);const w=g,E=s.stringify(w,x);Bj(E)?x.value=E:x.result=E,d(y,x)});function d(y,g){y||!g?c(y):u?u(g):r(void 0,g)}}}processSync(n){let r=!1,s;return this.freeze(),Ih("processSync",this.parser||this.Parser),Fh("processSync",this.compiler||this.Compiler),this.process(n,l),wb("processSync","process",r),s;function l(u,c){r=!0,yb(u),s=c}}run(n,r,s){vb(n),this.freeze();const l=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?u(void 0,s):new Promise(u);function u(c,f){const m=bu(r);l.run(n,m,d);function d(y,g,x){const w=g||n;y?f(y):c?c(w):s(void 0,w,x)}}}runSync(n,r){let s=!1,l;return this.run(n,r,u),wb("runSync","run",s),l;function u(c,f){yb(c),l=f,s=!0}}stringify(n,r){this.freeze();const s=bu(r),l=this.compiler||this.Compiler;return Fh("stringify",l),vb(n),l(n,s)}use(n,...r){const s=this.attachers,l=this.namespace;if($h("use",this.frozen),n!=null)if(typeof n=="function")m(n,r);else if(typeof n=="object")Array.isArray(n)?f(n):c(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function u(d){if(typeof d=="function")m(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[y,...g]=d;m(y,g)}else c(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function c(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(d.plugins),d.settings&&(l.settings=Bh(!0,l.settings,d.settings))}function f(d){let y=-1;if(d!=null)if(Array.isArray(d))for(;++y<d.length;){const g=d[y];u(g)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function m(d,y){let g=-1,x=-1;for(;++g<s.length;)if(s[g][0]===d){x=g;break}if(x===-1)s.push([d,...y]);else if(y.length>0){let[w,...E]=y;const M=s[x][1];wd(M)&&wd(w)&&(w=Bh(!0,M,w)),s[x]=[d,w,...E]}}}}const zj=new em().freeze();function Ih(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Fh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $h(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function vb(e){if(!wd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function wb(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function bu(e){return Uj(e)?e:new d1(e)}function Uj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Bj(e){return typeof e=="string"||Pj(e)}function Pj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Sb=[],_b={allowDangerousHtml:!0},Hj=/^(https?|ircs?|mailto|xmpp)$/i,Ij=[{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 Eb(e){const n=Fj(e),r=$j(e);return Yj(n.runSync(n.parse(r),r),e)}function Fj(e){const n=e.rehypePlugins||Sb,r=e.remarkPlugins||Sb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,..._b}:_b;return zj().use(ET).use(r).use(bj,s).use(n)}function $j(e){const n=e.children||"",r=new d1;return typeof n=="string"&&(r.value=n),r}function Yj(e,n){const r=n.allowedElements,s=n.allowElement,l=n.components,u=n.disallowedElements,c=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||Gj;for(const y of Ij)Object.hasOwn(n,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+qj+y.id,void 0);return Wd(e,d),lC(e,{Fragment:b.Fragment,components:l,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0});function d(y,g,x){if(y.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let w;for(w in Dh)if(Object.hasOwn(Dh,w)&&Object.hasOwn(y.properties,w)){const E=y.properties[w],M=Dh[w];(M===null||M.includes(y.tagName))&&(y.properties[w]=m(String(E||""),w,y))}}if(y.type==="element"){let w=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!w&&s&&typeof g=="number"&&(w=!s(y,g,x)),w&&x&&typeof g=="number")return f&&y.children?x.children.splice(g,1,...y.children):x.children.splice(g,1),g}}}function Gj(e){const n=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),l=e.indexOf("/");return n===-1||l!==-1&&n>l||r!==-1&&n>r||s!==-1&&n>s||Hj.test(e.slice(0,n))?e:""}function kb(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let s=0,l=r.indexOf(n);for(;l!==-1;)s++,l=r.indexOf(n,l+n.length);return s}function Vj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function m1(e,n,r){const l=Zu((r||{}).ignore||[]),u=Jj(n);let c=-1;for(;++c<u.length;)h1(e,"text",f);function f(d,y){let g=-1,x;for(;++g<y.length;){const w=y[g],E=x?x.children:void 0;if(l(w,E?E.indexOf(w):void 0,x))return;x=w}if(x)return m(d,y)}function m(d,y){const g=y[y.length-1],x=u[c][0],w=u[c][1];let E=0;const P=g.children.indexOf(d);let z=!1,I=[];x.lastIndex=0;let j=x.exec(d.value);for(;j;){const K=j.index,B={index:j.index,input:j.input,stack:[...y,d]};let R=w(...j,B);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?x.lastIndex=K+1:(E!==K&&I.push({type:"text",value:d.value.slice(E,K)}),Array.isArray(R)?I.push(...R):R&&I.push(R),E=K+j[0].length,z=!0),!x.global)break;j=x.exec(d.value)}return z?(E<d.value.length&&I.push({type:"text",value:d.value.slice(E)}),g.children.splice(P,1,...I)):I=[d],P+I.length}}function Jj(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<r.length;){const l=r[s];n.push([Xj(l[0]),Kj(l[1])])}return n}function Xj(e){return typeof e=="string"?new RegExp(Vj(e),"g"):e}function Kj(e){return typeof e=="function"?e:function(){return e}}const Yh="phrasing",Gh=["autolink","link","image","label"];function Qj(){return{transforms:[iN],enter:{literalAutolink:Wj,literalAutolinkEmail:Vh,literalAutolinkHttp:Vh,literalAutolinkWww:Vh},exit:{literalAutolink:rN,literalAutolinkEmail:nN,literalAutolinkHttp:eN,literalAutolinkWww:tN}}}function Zj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Yh,notInConstruct:Gh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Yh,notInConstruct:Gh},{character:":",before:"[ps]",after:"\\/",inConstruct:Yh,notInConstruct:Gh}]}}function Wj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Vh(e){this.config.enter.autolinkProtocol.call(this,e)}function eN(e){this.config.exit.autolinkProtocol.call(this,e)}function tN(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 nN(e){this.config.exit.autolinkEmail.call(this,e)}function rN(e){this.exit(e)}function iN(e){m1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,sN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),aN]],{ignore:["link","linkReference"]})}function sN(e,n,r,s,l){let u="";if(!p1(l)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!lN(r)))return!1;const c=oN(r+s);if(!c[0])return!1;const f={type:"link",title:null,url:u+n+c[0],children:[{type:"text",value:n+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function aN(e,n,r,s){return!p1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function lN(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 oN(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],s=r.indexOf(")");const l=kb(e,"(");let u=kb(e,")");for(;s!==-1&&l>u;)e+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),u++;return[e,r]}function p1(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ds(r)||Xu(r))&&(!n||r!==47)}g1.peek=yN;function uN(){this.buffer()}function cN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function fN(){this.buffer()}function hN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function dN(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=mr(this.sliceSerialize(e)).toLowerCase(),r.label=n}function mN(e){this.exit(e)}function pN(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=mr(this.sliceSerialize(e)).toLowerCase(),r.label=n}function gN(e){this.exit(e)}function yN(){return"["}function g1(e,n,r,s){const l=r.createTracker(s);let u=l.move("[^");const c=r.enter("footnoteReference"),f=r.enter("reference");return u+=l.move(r.safe(r.associationId(e),{after:"]",before:u})),f(),c(),u+=l.move("]"),u}function bN(){return{enter:{gfmFootnoteCallString:uN,gfmFootnoteCall:cN,gfmFootnoteDefinitionLabelString:fN,gfmFootnoteDefinition:hN},exit:{gfmFootnoteCallString:dN,gfmFootnoteCall:mN,gfmFootnoteDefinitionLabelString:pN,gfmFootnoteDefinition:gN}}}function xN(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:g1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,l,u,c){const f=u.createTracker(c);let m=f.move("[^");const d=u.enter("footnoteDefinition"),y=u.enter("label");return m+=f.move(u.safe(u.associationId(s),{before:m,after:"]"})),y(),m+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),m+=f.move((n?`
106
+ `:" ")+u.indentLines(u.containerFlow(s,f.current()),n?y1:vN))),d(),m}}function vN(e,n,r){return n===0?e:y1(e,n,r)}function y1(e,n,r){return(r?"":" ")+e}const wN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];b1.peek=CN;function SN(){return{canContainEols:["delete"],enter:{strikethrough:EN},exit:{strikethrough:kN}}}function _N(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:wN}],handlers:{delete:b1}}}function EN(e){this.enter({type:"delete",children:[]},e)}function kN(e){this.exit(e)}function b1(e,n,r,s){const l=r.createTracker(s),u=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),u(),c}function CN(){return"~"}function AN(e){return e.length}function TN(e,n){const r=n||{},s=(r.align||[]).concat(),l=r.stringLength||AN,u=[],c=[],f=[],m=[];let d=0,y=-1;for(;++y<e.length;){const M=[],P=[];let z=-1;for(e[y].length>d&&(d=e[y].length);++z<e[y].length;){const I=jN(e[y][z]);if(r.alignDelimiters!==!1){const j=l(I);P[z]=j,(m[z]===void 0||j>m[z])&&(m[z]=j)}M.push(I)}c[y]=M,f[y]=P}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<d;)u[g]=Cb(s[g]);else{const M=Cb(s);for(;++g<d;)u[g]=M}g=-1;const x=[],w=[];for(;++g<d;){const M=u[g];let P="",z="";M===99?(P=":",z=":"):M===108?P=":":M===114&&(z=":");let I=r.alignDelimiters===!1?1:Math.max(1,m[g]-P.length-z.length);const j=P+"-".repeat(I)+z;r.alignDelimiters!==!1&&(I=P.length+I+z.length,I>m[g]&&(m[g]=I),w[g]=I),x[g]=j}c.splice(1,0,x),f.splice(1,0,w),y=-1;const E=[];for(;++y<c.length;){const M=c[y],P=f[y];g=-1;const z=[];for(;++g<d;){const I=M[g]||"";let j="",K="";if(r.alignDelimiters!==!1){const B=m[g]-(P[g]||0),R=u[g];R===114?j=" ".repeat(B):R===99?B%2?(j=" ".repeat(B/2+.5),K=" ".repeat(B/2-.5)):(j=" ".repeat(B/2),K=j):K=" ".repeat(B)}r.delimiterStart!==!1&&!g&&z.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&I==="")&&(r.delimiterStart!==!1||g)&&z.push(" "),r.alignDelimiters!==!1&&z.push(j),z.push(I),r.alignDelimiters!==!1&&z.push(K),r.padding!==!1&&z.push(" "),(r.delimiterEnd!==!1||g!==d-1)&&z.push("|")}E.push(r.delimiterEnd===!1?z.join("").replace(/ +$/,""):z.join(""))}return E.join(`
107
+ `)}function jN(e){return e==null?"":String(e)}function Cb(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 NN(e,n,r,s){const l=r.enter("blockquote"),u=r.createTracker(s);u.move("> "),u.shift(2);const c=r.indentLines(r.containerFlow(e,u.current()),ON);return l(),c}function ON(e,n,r){return">"+(r?"":" ")+e}function RN(e,n){return Ab(e,n.inConstruct,!0)&&!Ab(e,n.notInConstruct,!1)}function Ab(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let s=-1;for(;++s<n.length;)if(e.includes(n[s]))return!0;return!1}function Tb(e,n,r,s){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
108
+ `&&RN(r.stack,r.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
109
+ `}function MN(e,n){const r=String(e);let s=r.indexOf(n),l=s,u=0,c=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===l?++u>c&&(c=u):u=1,l=s+n.length,s=r.indexOf(n,l);return c}function DN(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 LN(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 zN(e,n,r,s){const l=LN(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(DN(e,r)){const g=r.enter("codeIndented"),x=r.indentLines(u,UN);return g(),x}const f=r.createTracker(s),m=l.repeat(Math.max(MN(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 UN(e,n,r){return(r?"":" ")+e}function tm(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function BN(e,n,r,s){const l=tm(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const m=r.createTracker(s);let d=m.move("[");return d+=m.move(r.safe(r.associationId(e),{before:d,after:"]",...m.current()})),d+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":`
113
+ `,...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),c(),d}function PN(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 Pl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Hu(e,n,r){const s=pa(e),l=pa(n);return s===void 0?l===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}x1.peek=qN;function x1(e,n,r,s){const l=PN(r),u=r.enter("emphasis"),c=r.createTracker(s),f=c.move(l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Hu(s.before.charCodeAt(s.before.length-1),d,l);y.inside&&(m=Pl(d)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Hu(s.after.charCodeAt(0),g,l);x.inside&&(m=m.slice(0,-1)+Pl(g));const w=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+m+w}function qN(e,n,r){return r.options.emphasis||"*"}function HN(e,n){let r=!1;return Wd(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,xd}),!!((!e.depth||e.depth<3)&&Gd(e)&&(n.options.setext||r))}function IN(e,n,r,s){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(s);if(HN(e,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),x=r.containerPhrasing(e,{...u.current(),before:`
114
+ `,after:`
115
+ `});return g(),y(),x+`
116
+ `+(l===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.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=Pl(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,r.options.closeAtx&&(d+=" "+c),m(),f(),d}v1.peek=FN;function v1(e){return e.value||""}function FN(){return"<"}w1.peek=$N;function w1(e,n,r,s){const l=tm(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("image");let f=r.enter("label");const m=r.createTracker(s);let d=m.move("![");return d+=m.move(r.safe(e.alt,{before:d,after:"]",...m.current()})),d+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),d+=m.move(")"),c(),d}function $N(){return"!"}S1.peek=YN;function S1(e,n,r,s){const l=e.referenceType,u=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(s);let m=f.move("![");const d=r.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function YN(){return"!"}_1.peek=GN;function _1(e,n,r){let s=e.value||"",l="`",u=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(s);)l+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++u<r.unsafe.length;){const c=r.unsafe[u],f=r.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(s);){let d=m.index;s.charCodeAt(d)===10&&s.charCodeAt(d-1)===13&&d--,s=s.slice(0,d)+" "+s.slice(m.index+1)}}return l+s+l}function GN(){return"`"}function E1(e,n){const r=Gd(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}k1.peek=VN;function k1(e,n,r,s){const l=tm(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(s);let f,m;if(E1(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 VN(e,n,r){return E1(e,r)?"<":"["}C1.peek=JN;function C1(e,n,r,s){const l=e.referenceType,u=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(s);let m=f.move("[");const d=r.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function JN(){return"["}function nm(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function XN(e){const n=nm(e),r=e.options.bulletOther;if(!r)return n==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+r+"`) to be different");return r}function KN(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 A1(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 QN(e,n,r,s){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?KN(r):nm(r);const f=e.ordered?c==="."?")":".":XN(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),A1(r)===c&&y){let g=-1;for(;++g<e.children.length;){const x=e.children[g];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),r.bulletCurrent=c;const d=r.containerFlow(e,s);return r.bulletLastUsed=c,r.bulletCurrent=u,l(),d}function ZN(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 WN(e,n,r,s){const l=ZN(r);let u=r.bulletCurrent||nm(r);n&&n.type==="list"&&n.ordered&&(u=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+u);let c=u.length+1;(l==="tab"||l==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=r.createTracker(s);f.move(u+" ".repeat(c-u.length)),f.shift(c);const m=r.enter("listItem"),d=r.indentLines(r.containerFlow(e,f.current()),y);return m(),d;function y(g,x,w){return x?(w?"":" ".repeat(c))+g:(w?u:u+" ".repeat(c-u.length))+g}}function e3(e,n,r,s){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,s);return u(),l(),c}const t3=Zu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function n3(e,n,r,s){return(e.children.some(function(c){return t3(c)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function r3(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}T1.peek=i3;function T1(e,n,r,s){const l=r3(r),u=r.enter("strong"),c=r.createTracker(s),f=c.move(l+l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Hu(s.before.charCodeAt(s.before.length-1),d,l);y.inside&&(m=Pl(d)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Hu(s.after.charCodeAt(0),g,l);x.inside&&(m=m.slice(0,-1)+Pl(g));const w=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+m+w}function i3(e,n,r){return r.options.strong||"*"}function s3(e,n,r,s){return r.safe(e.value,s)}function a3(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 l3(e,n,r){const s=(A1(r)+(r.options.ruleSpaces?" ":"")).repeat(a3(r));return r.options.ruleSpaces?s.slice(0,-1):s}const j1={blockquote:NN,break:Tb,code:zN,definition:BN,emphasis:x1,hardBreak:Tb,heading:IN,html:v1,image:w1,imageReference:S1,inlineCode:_1,link:k1,linkReference:C1,list:QN,listItem:WN,paragraph:e3,root:n3,strong:T1,text:s3,thematicBreak:l3};function o3(){return{enter:{table:u3,tableData:jb,tableHeader:jb,tableRow:f3},exit:{codeText:h3,table:c3,tableData:Jh,tableHeader:Jh,tableRow:Jh}}}function u3(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 c3(e){this.exit(e),this.data.inTable=void 0}function f3(e){this.enter({type:"tableRow",children:[]},e)}function Jh(e){this.exit(e)}function jb(e){this.enter({type:"tableCell",children:[]},e)}function h3(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,d3));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function d3(e,n){return n==="|"?n:e}function m3(e){const n=e||{},r=n.tableCellPadding,s=n.tablePipeAlign,l=n.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
119
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:m,tableRow:f}};function c(w,E,M,P){return d(y(w,M,P),w.align)}function f(w,E,M,P){const z=g(w,M,P),I=d([z]);return I.slice(0,I.indexOf(`
120
+ `))}function m(w,E,M,P){const z=M.enter("tableCell"),I=M.enter("phrasing"),j=M.containerPhrasing(w,{...P,before:u,after:u});return I(),z(),j}function d(w,E){return TN(w,{align:E,alignDelimiters:s,padding:r,stringLength:l})}function y(w,E,M){const P=w.children;let z=-1;const I=[],j=E.enter("table");for(;++z<P.length;)I[z]=g(P[z],E,M);return j(),I}function g(w,E,M){const P=w.children;let z=-1;const I=[],j=E.enter("tableRow");for(;++z<P.length;)I[z]=m(P[z],w,E,M);return j(),I}function x(w,E,M){let P=j1.inlineCode(w,E,M);return M.stack.includes("tableCell")&&(P=P.replace(/\|/g,"\\$&")),P}}function p3(){return{exit:{taskListCheckValueChecked:Nb,taskListCheckValueUnchecked:Nb,paragraph:y3}}}function g3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:b3}}}function Nb(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function y3(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const s=r.children[0];if(s&&s.type==="text"){const l=n.children;let u=-1,c;for(;++u<l.length;){const f=l[u];if(f.type==="paragraph"){c=f;break}}c===r&&(s.value=s.value.slice(1),s.value.length===0?r.children.shift():r.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,r.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function b3(e,n,r,s){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(s);u&&f.move(c);let m=j1.listItem(e,n,r,{...s,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),m;function d(y){return y+c}}function x3(){return[Qj(),bN(),SN(),o3(),p3()]}function v3(e){return{extensions:[Zj(),xN(e),_N(),m3(e),g3()]}}const w3={tokenize:A3,partial:!0},N1={tokenize:T3,partial:!0},O1={tokenize:j3,partial:!0},R1={tokenize:N3,partial:!0},S3={tokenize:O3,partial:!0},M1={name:"wwwAutolink",tokenize:k3,previous:L1},D1={name:"protocolAutolink",tokenize:C3,previous:z1},ni={name:"emailAutolink",tokenize:E3,previous:U1},jr={};function _3(){return{text:jr}}let cs=48;for(;cs<123;)jr[cs]=ni,cs++,cs===58?cs=65:cs===91&&(cs=97);jr[43]=ni;jr[45]=ni;jr[46]=ni;jr[95]=ni;jr[72]=[ni,D1];jr[104]=[ni,D1];jr[87]=[ni,M1];jr[119]=[ni,M1];function E3(e,n,r){const s=this;let l,u;return c;function c(g){return!_d(g)||!U1.call(s,s.previous)||rm(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return _d(g)?(e.consume(g),f):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(S3,y,d)(g):g===45||g===95||cn(g)?(u=!0,e.consume(g),m):y(g)}function d(g){return e.consume(g),l=!0,m}function y(g){return u&&l&&gn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):r(g)}}function k3(e,n,r){const s=this;return l;function l(c){return c!==87&&c!==119||!L1.call(s,s.previous)||rm(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(w3,e.attempt(N1,e.attempt(O1,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(c)}}function C3(e,n,r){const s=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&z1.call(s,s.previous)&&!rm(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(gn(g)&&l.length<5)return l+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const x=l.toLowerCase();if(x==="http"||x==="https")return e.consume(g),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||Bu(g)||Tt(g)||ds(g)||Xu(g)?r(g):e.attempt(N1,e.attempt(O1,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function A3(e,n,r){let s=0;return l;function l(c){return(c===87||c===119)&&s<3?(s++,e.consume(c),l):c===46&&s===3?(e.consume(c),u):r(c)}function u(c){return c===null?r(c):n(c)}}function T3(e,n,r){let s,l,u;return c;function c(d){return d===46||d===95?e.check(R1,m,f)(d):d===null||Tt(d)||ds(d)||d!==45&&Xu(d)?m(d):(u=!0,e.consume(d),c)}function f(d){return d===95?s=!0:(l=s,s=void 0),e.consume(d),c}function m(d){return l||s||!u?r(d):n(d)}}function j3(e,n){let r=0,s=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&s<r?u(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(R1,n,u)(c):c===null||Tt(c)||ds(c)?n(c):(e.consume(c),l)}function u(c){return c===41&&s++,e.consume(c),l}}function N3(e,n,r){return s;function s(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),s):f===38?(e.consume(f),u):f===93?(e.consume(f),l):f===60||f===null||Tt(f)||ds(f)?n(f):r(f)}function l(f){return f===null||f===40||f===91||Tt(f)||ds(f)?n(f):s(f)}function u(f){return gn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):gn(f)?(e.consume(f),c):r(f)}}function O3(e,n,r){return s;function s(u){return e.consume(u),l}function l(u){return cn(u)?r(u):n(u)}}function L1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function z1(e){return!gn(e)}function U1(e){return!(e===47||_d(e))}function _d(e){return e===43||e===45||e===46||e===95||cn(e)}function rm(e){let n=e.length,r=!1;for(;n--;){const s=e[n][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){r=!0;break}if(s._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const R3={tokenize:q3,partial:!0};function M3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:U3,continuation:{tokenize:B3},exit:P3}},text:{91:{name:"gfmFootnoteCall",tokenize:z3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:D3,resolveTo:L3}}}}function D3(e,n,r){const s=this;let l=s.events.length;const u=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;l--;){const m=s.events[l][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return r(m);const d=mr(s.sliceSerialize({start:c.end,end:s.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function L3(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[r+1],e[r+2],["enter",s,n],e[r+3],e[r+4],["enter",l,n],["exit",l,n],["enter",u,n],["enter",c,n],["exit",c,n],["exit",u,n],e[e.length-2],e[e.length-1],["exit",s,n]];return e.splice(r,e.length-r+1,...f),e}function z3(e,n,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(g){if(u>999||g===93&&!c||g===null||g===91||Tt(g))return r(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return l.includes(mr(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(g)}return Tt(g)||(c=!0),u++,e.consume(g),g===92?y:d}function y(g){return g===91||g===92||g===93?(e.consume(g),u++,d):d(g)}}function U3(e,n,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(E){return E===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):r(E)}function y(E){if(c>999||E===93&&!f||E===null||E===91||Tt(E))return r(E);if(E===93){e.exit("chunkString");const M=e.exit("gfmFootnoteDefinitionLabelString");return u=mr(s.sliceSerialize(M)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Tt(E)||(f=!0),c++,e.consume(E),E===92?g:y}function g(E){return E===91||E===92||E===93?(e.consume(E),c++,y):y(E)}function x(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),l.includes(u)||l.push(u),it(e,w,"gfmFootnoteDefinitionWhitespace")):r(E)}function w(E){return n(E)}}function B3(e,n,r){return e.check(Vl,n,e.attempt(R3,n,r))}function P3(e){e.exit("gfmFootnoteDefinition")}function q3(e,n,r){const s=this;return it(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?n(u):r(u)}}function H3(e){let r=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,resolveAll:l};return r==null&&(r=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function l(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let d=m;for(;d--;)if(c[d][0]==="exit"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[d][1].end.offset-c[d][1].start.offset){c[m][1].type="strikethroughSequence",c[d][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[d][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[d][1].end),end:Object.assign({},c[m][1].start)},x=[["enter",y,f],["enter",c[d][1],f],["exit",c[d][1],f],["enter",g,f]],w=f.parser.constructs.insideSpan.null;w&&In(x,x.length,0,Ku(w,c.slice(d+1,m),f)),In(x,x.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,x),m=d+x.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 x;function x(E){return d===126&&y[y.length-1][1].type!=="characterEscape"?m(E):(c.enter("strikethroughSequenceTemporary"),w(E))}function w(E){const M=pa(d);if(E===126)return g>1?m(E):(c.consume(E),g++,w);if(g<2&&!r)return m(E);const P=c.exit("strikethroughSequenceTemporary"),z=pa(E);return P._open=!z||z===2&&!!M,P._close=!M||M===2&&!!z,f(E)}}}class I3{constructor(){this.map=[]}add(n,r,s){F3(this,n,r,s)}consume(n){if(this.map.sort(function(u,c){return u[0]-c[0]}),this.map.length===0)return;let r=this.map.length;const s=[];for(;r>0;)r-=1,s.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];s.push(n.slice()),n.length=0;let l=s.pop();for(;l;){for(const u of l)n.push(u);l=s.pop()}this.map.length=0}}function F3(e,n,r,s){let l=0;if(!(r===0&&s.length===0)){for(;l<e.map.length;){if(e.map[l][0]===n){e.map[l][1]+=r,e.map[l][2].push(...s);return}l+=1}e.map.push([n,r,s])}}function $3(e,n){let r=!1;const s=[];for(;n<e.length;){const l=e[n];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&s.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const u=s.length-1;s[u]=s[u]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return s}function Y3(){return{flow:{null:{name:"table",tokenize:G3,resolveAll:V3}}}}function G3(e,n,r){const s=this;let l=0,u=0,c;return f;function f(L){let W=s.events.length-1;for(;W>-1;){const ae=s.events[W][1].type;if(ae==="lineEnding"||ae==="linePrefix")W--;else break}const Q=W>-1?s.events[W][1].type:null,oe=Q==="tableHead"||Q==="tableRow"?R:m;return oe===R&&s.parser.lazy[s.now().line]?r(L):oe(L)}function m(L){return e.enter("tableHead"),e.enter("tableRow"),d(L)}function d(L){return L===124||(c=!0,u+=1),y(L)}function y(L){return L===null?r(L):Pe(L)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),w):r(L):Qe(L)?it(e,y,"whitespace")(L):(u+=1,c&&(c=!1,l+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(L)))}function g(L){return L===null||L===124||Tt(L)?(e.exit("data"),y(L)):(e.consume(L),L===92?x:g)}function x(L){return L===92||L===124?(e.consume(L),g):g(L)}function w(L){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(L):(e.enter("tableDelimiterRow"),c=!1,Qe(L)?it(e,E,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):E(L))}function E(L){return L===45||L===58?P(L):L===124?(c=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),M):B(L)}function M(L){return Qe(L)?it(e,P,"whitespace")(L):P(L)}function P(L){return L===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),z):L===45?(u+=1,z(L)):L===null||Pe(L)?K(L):B(L)}function z(L){return L===45?(e.enter("tableDelimiterFiller"),I(L)):B(L)}function I(L){return L===45?(e.consume(L),I):L===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),j):(e.exit("tableDelimiterFiller"),j(L))}function j(L){return Qe(L)?it(e,K,"whitespace")(L):K(L)}function K(L){return L===124?E(L):L===null||Pe(L)?!c||l!==u?B(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(L)):B(L)}function B(L){return r(L)}function R(L){return e.enter("tableRow"),Y(L)}function Y(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),Y):L===null||Pe(L)?(e.exit("tableRow"),n(L)):Qe(L)?it(e,Y,"whitespace")(L):(e.enter("data"),J(L))}function J(L){return L===null||L===124||Tt(L)?(e.exit("data"),Y(L)):(e.consume(L),L===92?F:J)}function F(L){return L===92||L===124?(e.consume(L),J):J(L)}}function V3(e,n){let r=-1,s=!0,l=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,d,y,g;const x=new I3;for(;++r<e.length;){const w=e[r],E=w[1];w[0]==="enter"?E.type==="tableHead"?(f=!1,m!==0&&(Ob(x,n,m,d,y),y=void 0,m=0),d={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},x.add(r,0,[["enter",d,n]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(s=!0,g=void 0,u=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,y={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},x.add(r,0,[["enter",y,n]])),l=E.type==="tableDelimiterRow"?2:y?3:1):l&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=xu(x,n,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):E.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(c[0]=c[1],g=xu(x,n,u,l,void 0,g)),u=c,c=[u[1],r,0,0])):E.type==="tableHead"?(f=!0,m=r):E.type==="tableRow"||E.type==="tableDelimiterRow"?(m=r,u[1]!==0?(c[0]=c[1],g=xu(x,n,u,l,r,g)):c[1]!==0&&(g=xu(x,n,c,l,r,g)),l=0):l&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&Ob(x,n,m,d,y),x.consume(n.events),r=-1;++r<n.events.length;){const w=n.events[r];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=$3(n.events,r))}return e}function xu(e,n,r,s,l,u){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},ea(n.events,r[0])),e.add(r[0],0,[["exit",u,n]]));const m=ea(n.events,r[1]);if(u={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",u,n]]),r[2]!==0){const d=ea(n.events,r[2]),y=ea(n.events,r[3]),g={type:f,start:Object.assign({},d),end:Object.assign({},y)};if(e.add(r[2],0,[["enter",g,n]]),s!==2){const x=n.events[r[2]],w=n.events[r[3]];if(x[1].end=Object.assign({},w[1].end),x[1].type="chunkText",x[1].contentType="text",r[3]>r[2]+1){const E=r[2]+1,M=r[3]-r[2]-1;e.add(E,M,[])}}e.add(r[3]+1,0,[["exit",g,n]])}return l!==void 0&&(u.end=Object.assign({},ea(n.events,l)),e.add(l,0,[["exit",u,n]]),u=void 0),u}function Ob(e,n,r,s,l){const u=[],c=ea(n.events,r);l&&(l.end=Object.assign({},c),u.push(["exit",l,n])),s.end=Object.assign({},c),u.push(["exit",s,n]),e.add(r+1,0,u)}function ea(e,n){const r=e[n],s=r[0]==="enter"?"start":"end";return r[1][s]}const J3={name:"tasklistCheck",tokenize:K3};function X3(){return{text:{91:J3}}}function K3(e,n,r){const s=this;return l;function l(m){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return Tt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):r(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(m)}function f(m){return Pe(m)?n(m):Qe(m)?e.check({tokenize:Q3},n,r)(m):r(m)}}function Q3(e,n,r){return it(e,s,"whitespace");function s(l){return l===null?r(l):n(l)}}function Z3(e){return Vx([_3(),M3(),H3(e),Y3(),X3()])}const W3={};function Rb(e){const n=this,r=e||W3,s=n.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(Z3(r)),u.push(x3()),c.push(v3(r))}function eO(e){m1(e,[/\r?\n|\r/g,tO])}function tO(){return{type:"break"}}function Mb(){return function(e){eO(e)}}function nO({connected:e,hostId:n,request:r,subscribeEvents:s,taskId:l,runId:u}){const c=ti(),[f,m]=N.useState(!0),[d,y]=N.useState([]),[g,x]=N.useState(),[w,E]=N.useState(),M=g==="started"||g==="monitoring",P=g==="followup",z=g==="started"||g==="followup",[I,j]=N.useState(null),[K,B]=N.useState(!1),[R,Y]=N.useState(""),[J,F]=N.useState(!1),L=N.useRef(null),W=N.useRef(null),Q=N.useRef(null),[oe,ae]=N.useState(u==="latest"?void 0:u),G=u==="latest"&&oe===null;N.useEffect(()=>{if(u!=="latest"){ae(u);return}e&&(ae(void 0),r("taskrun.list",{task_id:l,limit:1}).then(_=>{var D,ee;return ae(((ee=(D=_.entries)==null?void 0:D[0])==null?void 0:ee.run_id)??null)}).catch(()=>ae(null)))},[u,l,e,r]);async function H(){if(oe)try{const _=await r("task.result",{id:l,run_id:oe});if(_.error){console.error("No result:",_.error),c("/runs",{replace:!0});return}y(_.messages??[]),x(_.running_state),E(_.agent)}catch(_){console.error("Failed to load result:",_),c("/runs",{replace:!0})}finally{m(!1)}}async function X(_){var D;if(oe)try{const A=(D=(await r("task.reports",{id:l,run_id:oe,report_files:[_]})).reports)==null?void 0:D[0];A!=null&&A.data_url?j({file:_,data_url:A.data_url}):j({file:_,content:(A==null?void 0:A.content)??"Report not found."})}catch{j({file:_,content:"Failed to load report."})}}N.useEffect(()=>{!e||!oe||(m(!0),H())},[e,l,oe]),N.useEffect(()=>!e||!n||!oe?void 0:s(n,async D=>{try{const ee=JSON.parse(new TextDecoder().decode(D.data));if(ee.event_type!=="running-state"&&ee.event_type!=="result-updated"||D.subject.split(".").pop()!==l||ee.event_type==="result-updated"&&ee.run_id&&ee.run_id!==oe)return;H()}catch{}}),[e,n,l,oe,s,r]),N.useEffect(()=>{L.current&&(L.current.scrollTop=L.current.scrollHeight)},[d]),N.useEffect(()=>{f||G||!oe||Q.current!==oe&&(Q.current=oe,requestAnimationFrame(()=>{L.current&&(L.current.scrollTop=L.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"})}))},[f,G,oe]);function ue(_){if(_==="input")return"User Input";if(_==="permission")return"Permission";if(_==="confirmation")return"Confirmation"}function _e(_){return _==="started"?"Task started":_==="finished"?"Task finished":_==="failed"?"Task failed":_==="error"?"Command failed":_==="aborted"?"Task aborted":_==="confirmation"?"Task confirmed":_==="stopped"?"Follow-up stopped":_??""}return b.jsxs("div",{className:"run-detail",children:[b.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),G?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No runs yet"}),b.jsx("p",{className:"empty-state-hint",children:"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger."})]}):f?b.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[b.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"chat-thread",ref:L,children:[d.map((_,D)=>{const ee=z&&_.role==="assistant"&&!d.slice(D+1).some(A=>A.role==="assistant"||A.role==="user");return _.role==="status"&&_.type==="monitoring"?null:_.role==="status"?b.jsxs("div",{className:`chat-status${_.type==="error"?" chat-status--error":""}`,children:[b.jsxs("div",{children:[_e(_.type),_.time>0&&b.jsx("span",{className:"chat-status-time",children:Uu(_.time)})]}),_.content&&b.jsx("pre",{className:"chat-status-detail",children:_.content})]},D):b.jsxs("div",{className:`chat-message chat-message--${_.role}`,children:[_.role==="assistant"&&w&&b.jsx("div",{className:"chat-message-agent",children:hd(w)}),b.jsxs("div",{className:"chat-message-content",children:[b.jsx(Eb,{remarkPlugins:[Rb,Mb],children:_.content}),ee&&b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]}),_.attachments&&_.attachments.length>0&&b.jsx("div",{className:"chat-message-attachments",children:_.attachments.map(A=>b.jsx("button",{className:"chat-attachment-chip",onClick:()=>X(A),children:A},A))}),b.jsxs("div",{className:"chat-message-meta",children:[ue(_.type)&&b.jsx("span",{className:"chat-message-type",children:ue(_.type)}),_.time>0&&b.jsx("span",{children:Uu(_.time)})]})]},D)}),z&&(()=>{const _=d.filter(D=>D.role!=="status");return _.length===0||_[_.length-1].role!=="assistant"})()&&b.jsxs("div",{className:"chat-message chat-message--assistant",children:[w&&b.jsx("div",{className:"chat-message-agent",children:hd(w)}),b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]}),g==="monitoring"&&b.jsxs("div",{className:"chat-monitoring-indicator",children:[b.jsx("span",{className:"chat-monitoring-dot"}),"Monitoring command output"]})]}),M?b.jsx("div",{className:"chat-abort-bar",children:b.jsx("button",{className:"btn btn-secondary chat-abort-btn",disabled:K,onClick:async()=>{if(confirm("Abort this task?")){B(!0);try{await r("task.abort",{id:l})}catch(_){console.error("Abort failed:",_)}finally{B(!1)}}},children:K?"Aborting...":"Abort Task"})}):P?b.jsx("div",{className:"chat-input-bar",children:b.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:K,onClick:async()=>{B(!0);try{await r("task.stop_followup",{id:l,run_id:oe})}catch(_){console.error("Stop failed:",_)}finally{B(!1)}},children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:b.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):b.jsxs("form",{className:"chat-input-bar",onSubmit:async _=>{_.preventDefault();const D=R.trim();if(!(!D||J)){F(!0);try{await r("task.followup",{id:l,run_id:oe,message:D}),Y("")}catch(ee){console.error("Follow-up failed:",ee)}finally{F(!1)}}},children:[b.jsx("input",{ref:W,className:"chat-input",type:"text",placeholder:"Follow-up message",value:R,onChange:_=>Y(_.target.value),disabled:J}),b.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!R.trim()||J,children:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),b.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),I&&b.jsx("div",{className:"report-dialog-overlay",onClick:()=>j(null),children:b.jsxs("div",{className:"report-dialog",onClick:_=>_.stopPropagation(),children:[b.jsxs("div",{className:"report-dialog-header",children:[b.jsx("span",{className:"report-dialog-title",children:I.file}),b.jsx("button",{className:"report-dialog-close",onClick:()=>j(null),"aria-label":"Close",children:b.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),b.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),b.jsx("div",{className:"report-dialog-body",children:I.data_url?b.jsx("img",{src:I.data_url,alt:I.file,style:{maxWidth:"100%",height:"auto"}}):b.jsx(Eb,{remarkPlugins:[Rb,Mb],components:{a:({..._})=>b.jsx("a",{..._,target:"_blank",rel:"noopener noreferrer"})},children:I.content??""})})]})})]})}function rO(){const{getActiveHost:e}=ba(),n=e(),r=N.useRef(null);N.useEffect(()=>{if(pr.isNativePlatform()||!n||n.directUrl||r.current===n.hostId)return;async function s(){var l;try{if(!("serviceWorker"in navigator)||!("PushManager"in window)){console.warn("[Push] Push notifications not supported");return}const u=await navigator.serviceWorker.ready;(l=u.active)==null||l.postMessage({type:"set-host-id",hostId:n.hostId});let c=await u.pushManager.getSubscription();if(!c){const{publicKey:m}=await ak("/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 sk("/api/push/subscribe",{hostId:n.hostId,endpoint:f.endpoint,keys:{p256dh:f.keys.p256dh,auth:f.keys.auth}}),r.current=n.hostId}catch(u){console.error("[Push] Subscription failed:",u)}}s()},[n])}const iO="0.8.5";function sO(e,n){if(e.includes("-"))return!1;const r=e.split(".").map(Number),s=n.split(".").map(Number);for(let l=0;l<3;l++){if((r[l]??0)<(s[l]??0))return!0;if((r[l]??0)>(s[l]??0))return!1}return!1}function Sl(){var He;const{pairedHosts:e,activeHostId:n,removePairedHost:r}=ba(),{connected:s,request:l,subscribeEvents:u,unauthorized:c}=Yl(),f=ti(),m=Tr(),d=BS(),y=Nx("(min-width: 768px)"),g=m.pathname.startsWith("/tasks"),x=d.runId?void 0:d.taskId,w=!!(d.taskId&&d.runId),[E,M]=N.useState(!1),[P,z]=N.useState(!1),[I,j]=N.useState(null),[K,B]=N.useState(null),[R,Y]=N.useState({}),[J,F]=N.useState([]),[L,W]=N.useState(),[Q,oe]=N.useState(new Map),[ae,G]=N.useState(new Map),[H,X]=N.useState(new Map),[ue,_e]=N.useState(new Map);rO(),N.useEffect(()=>{window.scrollTo(0,0)},[n]),N.useEffect(()=>{s&&l("host.info").then(be=>{var Fe,Ue,tt,mt,st,Mt;F(be.agents??[]),W(be.host_platform),Y(be.capability_tokens??{}),uk(be.agents??[]);const De=be.version??null;B(De),M(!!De&&sO(De,iO));const Ze=new Map,dt=new Map,lt=new Map,ct=new Map;for(const yt of be.pending_prompts??[])if(yt.type==="confirmation")Ze.set(yt.key,{description:((Fe=yt.meta)==null?void 0:Fe.description)??"",sessionName:(Ue=yt.meta)==null?void 0:Ue.session_name});else if(yt.type==="permission")dt.set(yt.key,{permissions:yt.params??[],sessionName:(tt=yt.meta)==null?void 0:tt.session_name});else if(yt.type==="input"){const $n=yt.params??((mt=yt.meta)==null?void 0:mt.input_questions)??[];lt.set(yt.key,{questions:$n,description:(st=yt.meta)==null?void 0:st.description,sessionName:(Mt=yt.meta)==null?void 0:Mt.session_name}),ct.set(yt.key,new Array($n.length).fill(""))}oe(Ze),G(dt),X(lt),_e(ct)}).catch(()=>{})},[s,n,l]),N.useEffect(()=>!s||!n?void 0:u(n,De=>{const Ze=De.subject.split(".");if(Ze.length<3)return;const dt=Ze.slice(2).join(".");let lt={};try{lt=JSON.parse(new TextDecoder().decode(De.data))}catch{return}const ct=lt.event_type,Fe=lt.session_id;if(ct==="input-request"&&Fe){const Ue=lt.input_questions,tt=lt.session_name,mt=lt.description;Ue!=null&&Ue.length&&(X(st=>{if(st.has(Fe))return st;const Mt=new Map(st);return Mt.set(Fe,{questions:Ue,description:mt,sessionName:tt}),Mt}),_e(st=>{if(st.has(Fe))return st;const Mt=new Map(st);return Mt.set(Fe,new Array(Ue.length).fill("")),Mt}));return}if(ct==="input-resolved"&&Fe){X(Ue=>{if(!Ue.has(Fe))return Ue;const tt=new Map(Ue);return tt.delete(Fe),tt}),_e(Ue=>{const tt=new Map(Ue);return tt.delete(Fe),tt});return}if(ct==="confirm-request"&&Fe){const Ue=lt.description,tt=lt.session_name;Ue&&oe(mt=>{if(mt.has(Fe))return mt;const st=new Map(mt);return st.set(Fe,{description:Ue,sessionName:tt}),st});return}if(ct==="confirm-resolved"&&Fe){oe(Ue=>{if(!Ue.has(Fe))return Ue;const tt=new Map(Ue);return tt.delete(Fe),tt});return}if(ct==="permission-request"){const Ue=lt.required_permissions,tt=lt.session_name;Ue!=null&&Ue.length&&G(mt=>{if(mt.has(dt))return mt;const st=new Map(mt);return st.set(dt,{permissions:Ue,sessionName:tt}),st});return}if(ct==="permission-resolved"){G(Ue=>{if(!Ue.has(dt))return Ue;const tt=new Map(Ue);return tt.delete(dt),tt});return}}),[s,n,u]);async function _(be,De){try{await l("task.user_input",{id:be,value:[De]})}catch(Ze){console.error("[Dashboard] Failed to respond to confirmation:",Ze)}}async function D(be,De){try{await l("task.user_input",{id:be,value:[De]})}catch(Ze){console.error("[Dashboard] Failed to respond to permission request:",Ze)}}async function ee(be,De){try{await l("task.user_input",{id:be,value:De})}catch(Ze){console.error("[Dashboard] Failed to respond to input request:",Ze)}}function A(be,De){hs()&&f(De?`/runs/${encodeURIComponent(be)}/${encodeURIComponent(De)}`:`/runs/${encodeURIComponent(be)}`)}async function ve(){z(!0),j(null);try{const be=await l("host.update");if(be.error){j(be.error),z(!1);return}}catch{}setTimeout(()=>window.location.reload(),15e3)}const Ae=e.length>0,Te=Ae&&s&&n&&!c,Me=((He=e.find(be=>be.hostId===n))==null?void 0:He.clientToken)??null;return b.jsxs("div",{className:"dashboard",children:[y&&b.jsx(P0,{daemonVersion:K,capabilityTokens:R,activeClientToken:Me,request:l,onCapabilityTokensChange:Y}),b.jsxs("div",{className:"dashboard-content",children:[b.jsxs("header",{className:"app-header",children:[b.jsxs("div",{className:"app-title-bar",children:[!y&&b.jsx(P0,{daemonVersion:K,capabilityTokens:R,activeClientToken:Me,request:l,onCapabilityTokensChange:Y}),b.jsx("h1",{className:"app-title",children:"Palmier"})]}),b.jsx("div",{className:"tab-bar",children:b.jsx(_k,{})})]}),b.jsx("main",{className:"dashboard-main",children:c?b.jsxs("div",{className:"revoked-state",children:[b.jsx("div",{className:"revoked-icon",children:b.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),b.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),b.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),b.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),b.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),b.jsx("div",{className:"revoked-command",children:b.jsx("code",{children:"palmier pair"})}),b.jsxs("div",{className:"revoked-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>{hs()&&f("/pair")},children:"Re-pair Device"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{n&&r(n)},children:"Remove Host"})]})]}):Te?b.jsxs(b.Fragment,{children:[g&&!w&&b.jsx(Sk,{connected:s,hostId:n,request:l,subscribeEvents:u,agents:J,hostPlatform:L,isNotificationListener:!!Me&&R.notifications===Me,onViewRun:A}),w?b.jsx(nO,{connected:s,hostId:n,request:l,subscribeEvents:u,taskId:d.taskId,runId:decodeURIComponent(d.runId)}):g?null:b.jsx(Rk,{connected:s,hostId:n,request:l,subscribeEvents:u,agents:J,hostPlatform:L,filterTaskId:x,onClearFilter:()=>{hs()&&f("/")}})]}):b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{children:Ae?"Connecting to host...":"No host computer paired yet."}),!Ae&&b.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Pair Host"})]})}),E&&!P&&!I&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Update Required"}),b.jsxs("p",{className:"confirm-modal-message",children:["Your Palmier host",K?` (v${K})`:""," is too old for this version of the app. Please update to continue."]}),b.jsx("div",{className:"confirm-modal-actions",children:b.jsx("button",{className:"btn btn-primary",onClick:ve,children:"Update Now"})})]})}),P&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),b.jsx("p",{className:"confirm-modal-message",children:"Installing update and restarting daemon. Please wait..."})]})}),I&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),b.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:I}),b.jsx("div",{className:"confirm-modal-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>{j(null)},children:"Retry"})})]})})]}),ca.createPortal(b.jsxs(b.Fragment,{children:[[...Q.entries()].map(([be,{description:De,sessionName:Ze}])=>b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),Ze&&b.jsx("p",{className:"confirm-modal-subtitle",children:Ze}),b.jsx("p",{className:"confirm-modal-message",children:De}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>_(be,"confirmed"),children:"Confirm"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>_(be,"aborted"),children:"Abort"})]})]})},be)),[...ae.entries()].map(([be,{permissions:De,sessionName:Ze}])=>b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal permission-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),b.jsx("p",{className:"confirm-modal-message",children:b.jsx("strong",{children:Ze||be})}),b.jsx("div",{className:"permission-list",children:De.map((dt,lt)=>b.jsxs("div",{className:"permission-item",children:[b.jsx("span",{className:"permission-name",children:dt.name}),dt.description&&b.jsx("span",{className:"permission-desc",children:dt.description})]},lt))}),b.jsxs("div",{className:"permission-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>D(be,"granted"),children:"Allow Once"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>D(be,"granted_all"),children:"Allow Always"})]}),b.jsx("button",{className:"permission-abort-link",onClick:()=>D(be,"aborted"),children:"Deny & Abort Task"})]})},be)),[...H.entries()].map(([be,{questions:De,description:Ze,sessionName:dt}])=>{const lt=ue.get(be)??new Array(De.length).fill("");return b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal input-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),dt&&b.jsx("p",{className:"confirm-modal-subtitle",children:dt}),Ze&&b.jsx("p",{className:"confirm-modal-message",children:Ze}),b.jsx("div",{className:"input-list",children:De.map((ct,Fe)=>b.jsxs("div",{className:"input-item",children:[b.jsx("label",{className:"input-label",children:ct}),b.jsx("input",{type:"text",className:"input-field",value:lt[Fe]??"",onChange:Ue=>{_e(tt=>{const mt=new Map(tt),st=[...mt.get(be)??[]];return st[Fe]=Ue.target.value,mt.set(be,st),mt})},autoFocus:Fe===0})]},Fe))}),b.jsx("div",{className:"input-actions",children:b.jsx("button",{className:"btn btn-primary",disabled:lt.some(ct=>!ct.trim()),onClick:()=>ee(be,lt),children:"Submit"})}),b.jsx("button",{className:"permission-abort-link",onClick:()=>ee(be,["aborted"]),children:"Cancel"})]})},be)})]}),document.body)]})}const aO=va("Preferences",{web:()=>Ox(()=>import("./web-DYwZE4qa.js"),[]).then(e=>new e.PreferencesWeb)}),_l=!!window.__PALMIER_SERVE__;function lO(){const[e,n]=N.useState(""),[r,s]=N.useState(!1),[l,u]=N.useState(null),{addPairedHost:c}=ba(),f=ti();async function m(){const d=e.trim().toUpperCase();if(!d){u("Enter a pairing code.");return}s(!0),u(null);try{let y;if(_l){const x=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,label:navigator.userAgent})});if(!x.ok){const w=await x.json().catch(()=>({error:"Connection failed"}));throw new Error(w.error||`HTTP ${x.status}`)}y=await x.json()}else{const x=await fetch(`${zu}/api/config`);if(!x.ok)throw new Error("Failed to fetch server config");const w=await x.json();if(!w.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const E=await _x({servers:w.natsWsUrl,authenticator:mx(w.natsJwt,new TextEncoder().encode(w.natsNkeySeed))}),M=ju(),P=`pair.${d}`,z=await E.request(P,M.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});y=JSON.parse(M.decode(z.data)),await E.close()}const g={hostId:y.hostId,clientToken:y.clientToken,directUrl:_l?window.location.origin:void 0,...y.hostName?{name:y.hostName}:{}};if(c(g),pr.isNativePlatform()&&Ut){await aO.set({key:"hostId",value:y.hostId});try{const{token:x}=await Ut.getFcmToken();await fetch(`${zu}/api/fcm/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hostId:y.hostId,fcmToken:x})})}catch(x){console.warn("FCM token registration failed:",x)}}f(pr.isNativePlatform()?"/pair/setup":"/")}catch(y){const g=y instanceof Error?y.message:String(y);g.includes("timeout")||g.includes("TIMEOUT")||g.includes("503")||g.toLowerCase().includes("no responders")?u("Code not found or expired. Check the code and try again."):u(g)}finally{s(!1)}}return b.jsx("div",{className:"pair-page",children:b.jsxs("div",{className:"pair-card",children:[b.jsxs("div",{className:"pair-header",children:[b.jsx("h1",{className:"pair-title",children:_l?"Pair":"Pair with Host"}),b.jsx("p",{className:"pair-subtitle",children:_l?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!_l&&b.jsxs("div",{className:"pair-instructions",children:[b.jsxs("div",{className:"pair-instruction-block",children:[b.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),b.jsxs("ol",{className:"pair-steps",children:[b.jsxs("li",{children:["Install at least one agent CLI (e.g., ",b.jsx("a",{href:"https://www.palmier.me/agents",target:"_blank",rel:"noopener noreferrer",children:"Claude Code, Gemini CLI, Codex CLI"}),")"]}),b.jsxs("li",{children:["Install Palmier on your host machine:",b.jsx("code",{className:"pair-command",children:"npm install -g palmier"})]}),b.jsxs("li",{children:["Run the setup wizard:",b.jsx("code",{className:"pair-command",children:"palmier init"})]}),b.jsx("li",{children:"A pairing code will display automatically"})]})]}),b.jsx("div",{className:"pair-instruction-divider"}),b.jsxs("div",{className:"pair-instruction-block",children:[b.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),b.jsxs("ol",{className:"pair-steps",children:[b.jsxs("li",{children:["Run ",b.jsx("code",{children:"palmier pair"})," on the host machine"]}),b.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),b.jsxs("div",{className:"pair-form",children:[b.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",b.jsx("input",{id:"pair-code",type:"text",maxLength:6,value:e,onChange:d=>n(d.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:r})]}),l&&b.jsx("p",{className:"pair-error",children:l}),b.jsxs("button",{className:"btn btn-primary btn-full",onClick:m,disabled:r||!e.trim(),children:[r&&b.jsx("span",{className:"btn-spinner"}),r?"Pairing...":"Pair"]}),b.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>f("/"),disabled:r,children:"Cancel"}),b.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",b.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",b.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function oO(){const e=ti(),{connected:n,request:r}=Yl(),{getActiveHost:s}=ba(),l=s(),u=(l==null?void 0:l.clientToken)??null,[c,f]=N.useState({}),[m,d]=N.useState(!1);return N.useEffect(()=>{l||e("/",{replace:!0})},[l,e]),N.useEffect(()=>{if(!n||!l)return;let y=!1;return r("host.info").then(g=>{y||(f(g.capability_tokens??{}),d(!0))}).catch(()=>{y||d(!0)}),()=>{y=!0}},[n,l,r]),b.jsx("div",{className:"pair-setup",children:b.jsxs("div",{className:"pair-setup-inner",children:[b.jsx("h1",{className:"pair-setup-title",children:"What capabilities of this device do you want your host computer to have?"}),b.jsx("p",{className:"pair-setup-description",children:"You can change these later from the menu."}),m?b.jsx(Rx,{capabilityTokens:c,activeClientToken:u,request:r,onCapabilityTokensChange:f}):b.jsx("div",{className:"pair-setup-loading",children:"Connecting to host…"}),b.jsx("div",{className:"pair-setup-actions",children:b.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>e("/",{replace:!0}),children:"Finish"})})]})})}function uO(){const e=ti();return N.useEffect(()=>{if(!Ut)return;const n=Ut.addListener("deepLink",({path:r})=>e(r));return()=>{n.then(r=>r.remove())}},[e]),null}function cO(){return b.jsx(U_,{children:b.jsxs(ok,{children:[b.jsx(uO,{}),b.jsxs(WS,{children:[b.jsx(Mi,{path:"/",element:b.jsx(Sl,{})}),b.jsx(Mi,{path:"/tasks",element:b.jsx(Sl,{})}),b.jsx(Mi,{path:"/runs",element:b.jsx(Sl,{})}),b.jsx(Mi,{path:"/runs/:taskId",element:b.jsx(Sl,{})}),b.jsx(Mi,{path:"/runs/:taskId/:runId",element:b.jsx(Sl,{})}),b.jsx(Mi,{path:"/pair",element:b.jsx(lO,{})}),b.jsx(Mi,{path:"/pair/setup",element:b.jsx(oO,{})})]})]})})}tS.createRoot(document.getElementById("root")).render(b.jsx(N.StrictMode,{children:b.jsx(__,{children:b.jsx(cO,{})})}));export{Pd as W};