palmier 0.6.8 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +9 -2
  2. package/dist/agents/agent.d.ts +2 -2
  3. package/dist/agents/aider.d.ts +1 -1
  4. package/dist/agents/aider.js +2 -5
  5. package/dist/agents/claude.d.ts +1 -1
  6. package/dist/agents/claude.js +2 -5
  7. package/dist/agents/cline.d.ts +1 -1
  8. package/dist/agents/cline.js +2 -5
  9. package/dist/agents/codex.d.ts +1 -1
  10. package/dist/agents/codex.js +2 -5
  11. package/dist/agents/copilot.d.ts +1 -1
  12. package/dist/agents/copilot.js +2 -5
  13. package/dist/agents/cursor.d.ts +1 -1
  14. package/dist/agents/cursor.js +2 -5
  15. package/dist/agents/deepagents.d.ts +1 -1
  16. package/dist/agents/deepagents.js +2 -5
  17. package/dist/agents/droid.d.ts +1 -1
  18. package/dist/agents/droid.js +2 -5
  19. package/dist/agents/gemini.d.ts +1 -1
  20. package/dist/agents/gemini.js +2 -5
  21. package/dist/agents/goose.d.ts +1 -1
  22. package/dist/agents/goose.js +2 -5
  23. package/dist/agents/hermes.d.ts +1 -1
  24. package/dist/agents/hermes.js +2 -5
  25. package/dist/agents/kimi.d.ts +1 -1
  26. package/dist/agents/kimi.js +2 -5
  27. package/dist/agents/kiro.d.ts +1 -1
  28. package/dist/agents/kiro.js +2 -5
  29. package/dist/agents/openclaw.d.ts +1 -1
  30. package/dist/agents/openclaw.js +2 -5
  31. package/dist/agents/opencode.d.ts +1 -1
  32. package/dist/agents/opencode.js +2 -5
  33. package/dist/agents/qoder.d.ts +1 -1
  34. package/dist/agents/qoder.js +2 -5
  35. package/dist/agents/qwen.d.ts +1 -1
  36. package/dist/agents/qwen.js +2 -5
  37. package/dist/agents/shared-prompt.js +1 -1
  38. package/dist/commands/run.js +1 -2
  39. package/dist/commands/serve.js +16 -0
  40. package/dist/mcp-handler.d.ts +3 -0
  41. package/dist/mcp-handler.js +59 -3
  42. package/dist/mcp-tools.d.ts +16 -1
  43. package/dist/mcp-tools.js +24 -2
  44. package/dist/notification-store.d.ts +13 -0
  45. package/dist/notification-store.js +19 -0
  46. package/dist/pwa/assets/{index-C8vJwUNi.js → index-DLxrL0hR.js} +42 -42
  47. package/dist/pwa/assets/{web-NxTETXZK.js → web-CBI458eN.js} +1 -1
  48. package/dist/pwa/assets/{web-6UChJFov.js → web-HDs03L2B.js} +1 -1
  49. package/dist/pwa/index.html +1 -1
  50. package/dist/pwa/service-worker.js +1 -1
  51. package/dist/rpc-handler.js +27 -67
  52. package/dist/task.js +2 -3
  53. package/dist/transports/http-transport.js +51 -3
  54. package/dist/types.d.ts +0 -1
  55. package/package.json +2 -2
  56. package/palmier-server/README.md +1 -1
  57. package/palmier-server/pwa/src/components/PlanDialog.tsx +5 -12
  58. package/palmier-server/pwa/src/components/TaskForm.tsx +6 -15
  59. package/palmier-server/pwa/src/constants.ts +1 -1
  60. package/palmier-server/pwa/src/types.ts +0 -1
  61. package/palmier-server/server/src/index.ts +2 -0
  62. package/palmier-server/server/src/routes/device.ts +32 -0
  63. package/palmier-server/spec.md +13 -12
  64. package/src/agents/agent.ts +2 -2
  65. package/src/agents/aider.ts +2 -5
  66. package/src/agents/claude.ts +2 -5
  67. package/src/agents/cline.ts +2 -5
  68. package/src/agents/codex.ts +2 -5
  69. package/src/agents/copilot.ts +2 -5
  70. package/src/agents/cursor.ts +2 -5
  71. package/src/agents/deepagents.ts +2 -5
  72. package/src/agents/droid.ts +2 -5
  73. package/src/agents/gemini.ts +2 -5
  74. package/src/agents/goose.ts +2 -5
  75. package/src/agents/hermes.ts +2 -5
  76. package/src/agents/kimi.ts +2 -5
  77. package/src/agents/kiro.ts +2 -5
  78. package/src/agents/openclaw.ts +2 -5
  79. package/src/agents/opencode.ts +2 -5
  80. package/src/agents/qoder.ts +2 -5
  81. package/src/agents/qwen.ts +2 -5
  82. package/src/agents/shared-prompt.ts +1 -1
  83. package/src/commands/run.ts +1 -2
  84. package/src/commands/serve.ts +16 -1
  85. package/src/mcp-handler.ts +68 -3
  86. package/src/mcp-tools.ts +48 -2
  87. package/src/notification-store.ts +30 -0
  88. package/src/rpc-handler.ts +29 -71
  89. package/src/task.ts +2 -3
  90. package/src/transports/http-transport.ts +49 -3
  91. package/src/types.ts +0 -1
  92. package/test/agent-instructions.test.ts +117 -19
  93. package/test/agent-output-parsing.test.ts +1 -0
  94. package/test/notification-store.test.ts +57 -0
  95. package/test/task-parsing.test.ts +3 -3
  96. package/dist/commands/plan-generation.md +0 -22
  97. package/src/commands/plan-generation.md +0 -22
  98. package/test/fixtures/agent-instructions-snapshot.md +0 -58
@@ -6,7 +6,7 @@ var vw=Object.defineProperty;var xw=(e,n,r)=>n in e?vw(e,n,{enumerable:!0,config
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Cy;function ww(){if(Cy)return tl;Cy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(a,l,u){var c=null;if(u!==void 0&&(c=""+u),l.key!==void 0&&(c=""+l.key),"key"in l){u={};for(var f in l)f!=="key"&&(u[f]=l[f])}else u=l;return l=u.ref,{$$typeof:e,type:a,key:c,ref:l!==void 0?l:null,props:u}}return tl.Fragment=n,tl.jsx=r,tl.jsxs=r,tl}var Ty;function Sw(){return Ty||(Ty=1,Vf.exports=ww()),Vf.exports}var w=Sw(),Jf={exports:{}},Fe={};/**
9
+ */var ky;function ww(){if(ky)return tl;ky=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(a,l,u){var c=null;if(u!==void 0&&(c=""+u),l.key!==void 0&&(c=""+l.key),"key"in l){u={};for(var f in l)f!=="key"&&(u[f]=l[f])}else u=l;return l=u.ref,{$$typeof:e,type:a,key:c,ref:l!==void 0?l:null,props:u}}return tl.Fragment=n,tl.jsx=r,tl.jsxs=r,tl}var Ay;function Sw(){return Ay||(Ay=1,Vf.exports=ww()),Vf.exports}var w=Sw(),Jf={exports:{}},Fe={};/**
10
10
  * @license React
11
11
  * react.production.js
12
12
  *
@@ -14,7 +14,7 @@ var vw=Object.defineProperty;var xw=(e,n,r)=>n in e?vw(e,n,{enumerable:!0,config
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var jy;function _w(){if(jy)return Fe;jy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function x(M){return M===null||typeof M!="object"?null:(M=b&&M[b]||M["@@iterator"],typeof M=="function"?M:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,B={};function D(M,W,S){this.props=M,this.context=W,this.refs=B,this.updater=S||k}D.prototype.isReactComponent={},D.prototype.setState=function(M,W){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,W,"setState")},D.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function $(){}$.prototype=D.prototype;function V(M,W,S){this.props=M,this.context=W,this.refs=B,this.updater=S||k}var se=V.prototype=new $;se.constructor=V,L(se,D.prototype),se.isPureReactComponent=!0;var N=Array.isArray;function R(){}var G={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function Y(M,W,S){var he=S.ref;return{$$typeof:e,type:M,key:W,ref:he!==void 0?he:null,props:S}}function T(M,W){return Y(M.type,W,M.props)}function X(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function K(M){var W={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(S){return W[S]})}var ye=/\/+/g;function ue(M,W){return typeof M=="object"&&M!==null&&M.key!=null?K(""+M.key):W.toString(36)}function q(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(R,R):(M.status="pending",M.then(function(W){M.status==="pending"&&(M.status="fulfilled",M.value=W)},function(W){M.status==="pending"&&(M.status="rejected",M.reason=W)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function I(M,W,S,he,fe){var ve=typeof M;(ve==="undefined"||ve==="boolean")&&(M=null);var Te=!1;if(M===null)Te=!0;else switch(ve){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(M.$$typeof){case e:case n:Te=!0;break;case y:return Te=M._init,I(Te(M._payload),W,S,he,fe)}}if(Te)return fe=fe(M),Te=he===""?"."+ue(M,0):he,N(fe)?(S="",Te!=null&&(S=Te.replace(ye,"$&/")+"/"),I(fe,W,S,"",function(Me){return Me})):fe!=null&&(X(fe)&&(fe=T(fe,S+(fe.key==null||M&&M.key===fe.key?"":(""+fe.key).replace(ye,"$&/")+"/")+Te)),W.push(fe)),1;Te=0;var ze=he===""?".":he+":";if(N(M))for(var ke=0;ke<M.length;ke++)he=M[ke],ve=ze+ue(he,ke),Te+=I(he,W,S,ve,fe);else if(ke=x(M),typeof ke=="function")for(M=ke.call(M),ke=0;!(he=M.next()).done;)he=he.value,ve=ze+ue(he,ke++),Te+=I(he,W,S,ve,fe);else if(ve==="object"){if(typeof M.then=="function")return I(q(M),W,S,he,fe);throw W=String(M),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return Te}function ae(M,W,S){if(M==null)return M;var he=[],fe=0;return I(M,he,"","",function(ve){return W.call(S,ve,fe++)}),he}function ge(M){if(M._status===-1){var W=M._result;W=W(),W.then(function(S){(M._status===0||M._status===-1)&&(M._status=1,M._result=S)},function(S){(M._status===0||M._status===-1)&&(M._status=2,M._result=S)}),M._status===-1&&(M._status=0,M._result=W)}if(M._status===1)return M._result.default;throw M._result}var _e=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},O={map:ae,forEach:function(M,W,S){ae(M,function(){W.apply(this,arguments)},S)},count:function(M){var W=0;return ae(M,function(){W++}),W},toArray:function(M){return ae(M,function(W){return W})||[]},only:function(M){if(!X(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return Fe.Activity=g,Fe.Children=O,Fe.Component=D,Fe.Fragment=r,Fe.Profiler=l,Fe.PureComponent=V,Fe.StrictMode=a,Fe.Suspense=m,Fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=G,Fe.__COMPILER_RUNTIME={__proto__:null,c:function(M){return G.H.useMemoCache(M)}},Fe.cache=function(M){return function(){return M.apply(null,arguments)}},Fe.cacheSignal=function(){return null},Fe.cloneElement=function(M,W,S){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var he=L({},M.props),fe=M.key;if(W!=null)for(ve in W.key!==void 0&&(fe=""+W.key),W)!J.call(W,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&W.ref===void 0||(he[ve]=W[ve]);var ve=arguments.length-2;if(ve===1)he.children=S;else if(1<ve){for(var Te=Array(ve),ze=0;ze<ve;ze++)Te[ze]=arguments[ze+2];he.children=Te}return Y(M.type,fe,he)},Fe.createContext=function(M){return M={$$typeof:c,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:u,_context:M},M},Fe.createElement=function(M,W,S){var he,fe={},ve=null;if(W!=null)for(he in W.key!==void 0&&(ve=""+W.key),W)J.call(W,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(fe[he]=W[he]);var Te=arguments.length-2;if(Te===1)fe.children=S;else if(1<Te){for(var ze=Array(Te),ke=0;ke<Te;ke++)ze[ke]=arguments[ke+2];fe.children=ze}if(M&&M.defaultProps)for(he in Te=M.defaultProps,Te)fe[he]===void 0&&(fe[he]=Te[he]);return Y(M,ve,fe)},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(M){return{$$typeof:f,render:M}},Fe.isValidElement=X,Fe.lazy=function(M){return{$$typeof:y,_payload:{_status:-1,_result:M},_init:ge}},Fe.memo=function(M,W){return{$$typeof:d,type:M,compare:W===void 0?null:W}},Fe.startTransition=function(M){var W=G.T,S={};G.T=S;try{var he=M(),fe=G.S;fe!==null&&fe(S,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(R,_e)}catch(ve){_e(ve)}finally{W!==null&&S.types!==null&&(W.types=S.types),G.T=W}},Fe.unstable_useCacheRefresh=function(){return G.H.useCacheRefresh()},Fe.use=function(M){return G.H.use(M)},Fe.useActionState=function(M,W,S){return G.H.useActionState(M,W,S)},Fe.useCallback=function(M,W){return G.H.useCallback(M,W)},Fe.useContext=function(M){return G.H.useContext(M)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(M,W){return G.H.useDeferredValue(M,W)},Fe.useEffect=function(M,W){return G.H.useEffect(M,W)},Fe.useEffectEvent=function(M){return G.H.useEffectEvent(M)},Fe.useId=function(){return G.H.useId()},Fe.useImperativeHandle=function(M,W,S){return G.H.useImperativeHandle(M,W,S)},Fe.useInsertionEffect=function(M,W){return G.H.useInsertionEffect(M,W)},Fe.useLayoutEffect=function(M,W){return G.H.useLayoutEffect(M,W)},Fe.useMemo=function(M,W){return G.H.useMemo(M,W)},Fe.useOptimistic=function(M,W){return G.H.useOptimistic(M,W)},Fe.useReducer=function(M,W,S){return G.H.useReducer(M,W,S)},Fe.useRef=function(M){return G.H.useRef(M)},Fe.useState=function(M){return G.H.useState(M)},Fe.useSyncExternalStore=function(M,W,S){return G.H.useSyncExternalStore(M,W,S)},Fe.useTransition=function(){return G.H.useTransition()},Fe.version="19.2.4",Fe}var Oy;function sd(){return Oy||(Oy=1,Jf.exports=_w()),Jf.exports}var U=sd(),Xf={exports:{}},nl={},Qf={exports:{}},Kf={};/**
17
+ */var Cy;function _w(){if(Cy)return Fe;Cy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function x(M){return M===null||typeof M!="object"?null:(M=b&&M[b]||M["@@iterator"],typeof M=="function"?M:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,B={};function D(M,W,_){this.props=M,this.context=W,this.refs=B,this.updater=_||k}D.prototype.isReactComponent={},D.prototype.setState=function(M,W){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,W,"setState")},D.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function F(){}F.prototype=D.prototype;function G(M,W,_){this.props=M,this.context=W,this.refs=B,this.updater=_||k}var se=G.prototype=new F;se.constructor=G,L(se,D.prototype),se.isPureReactComponent=!0;var R=Array.isArray;function O(){}var V={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function Y(M,W,_){var de=_.ref;return{$$typeof:e,type:M,key:W,ref:de!==void 0?de:null,props:_}}function j(M,W){return Y(M.type,W,M.props)}function K(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function Q(M){var W={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(_){return W[_]})}var ye=/\/+/g;function he(M,W){return typeof M=="object"&&M!==null&&M.key!=null?Q(""+M.key):W.toString(36)}function q(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(O,O):(M.status="pending",M.then(function(W){M.status==="pending"&&(M.status="fulfilled",M.value=W)},function(W){M.status==="pending"&&(M.status="rejected",M.reason=W)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function H(M,W,_,de,ue){var xe=typeof M;(xe==="undefined"||xe==="boolean")&&(M=null);var Te=!1;if(M===null)Te=!0;else switch(xe){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(M.$$typeof){case e:case n:Te=!0;break;case y:return Te=M._init,H(Te(M._payload),W,_,de,ue)}}if(Te)return ue=ue(M),Te=de===""?"."+he(M,0):de,R(ue)?(_="",Te!=null&&(_=Te.replace(ye,"$&/")+"/"),H(ue,W,_,"",function(ze){return ze})):ue!=null&&(K(ue)&&(ue=j(ue,_+(ue.key==null||M&&M.key===ue.key?"":(""+ue.key).replace(ye,"$&/")+"/")+Te)),W.push(ue)),1;Te=0;var Me=de===""?".":de+":";if(R(M))for(var ke=0;ke<M.length;ke++)de=M[ke],xe=Me+he(de,ke),Te+=H(de,W,_,xe,ue);else if(ke=x(M),typeof ke=="function")for(M=ke.call(M),ke=0;!(de=M.next()).done;)de=de.value,xe=Me+he(de,ke++),Te+=H(de,W,_,xe,ue);else if(xe==="object"){if(typeof M.then=="function")return H(q(M),W,_,de,ue);throw W=String(M),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return Te}function ie(M,W,_){if(M==null)return M;var de=[],ue=0;return H(M,de,"","",function(xe){return W.call(_,xe,ue++)}),de}function ge(M){if(M._status===-1){var W=M._result;W=W(),W.then(function(_){(M._status===0||M._status===-1)&&(M._status=1,M._result=_)},function(_){(M._status===0||M._status===-1)&&(M._status=2,M._result=_)}),M._status===-1&&(M._status=0,M._result=W)}if(M._status===1)return M._result.default;throw M._result}var Se=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},N={map:ie,forEach:function(M,W,_){ie(M,function(){W.apply(this,arguments)},_)},count:function(M){var W=0;return ie(M,function(){W++}),W},toArray:function(M){return ie(M,function(W){return W})||[]},only:function(M){if(!K(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return Fe.Activity=g,Fe.Children=N,Fe.Component=D,Fe.Fragment=r,Fe.Profiler=l,Fe.PureComponent=G,Fe.StrictMode=a,Fe.Suspense=m,Fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,Fe.__COMPILER_RUNTIME={__proto__:null,c:function(M){return V.H.useMemoCache(M)}},Fe.cache=function(M){return function(){return M.apply(null,arguments)}},Fe.cacheSignal=function(){return null},Fe.cloneElement=function(M,W,_){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var de=L({},M.props),ue=M.key;if(W!=null)for(xe in W.key!==void 0&&(ue=""+W.key),W)!J.call(W,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&W.ref===void 0||(de[xe]=W[xe]);var xe=arguments.length-2;if(xe===1)de.children=_;else if(1<xe){for(var Te=Array(xe),Me=0;Me<xe;Me++)Te[Me]=arguments[Me+2];de.children=Te}return Y(M.type,ue,de)},Fe.createContext=function(M){return M={$$typeof:c,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:u,_context:M},M},Fe.createElement=function(M,W,_){var de,ue={},xe=null;if(W!=null)for(de in W.key!==void 0&&(xe=""+W.key),W)J.call(W,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(ue[de]=W[de]);var Te=arguments.length-2;if(Te===1)ue.children=_;else if(1<Te){for(var Me=Array(Te),ke=0;ke<Te;ke++)Me[ke]=arguments[ke+2];ue.children=Me}if(M&&M.defaultProps)for(de in Te=M.defaultProps,Te)ue[de]===void 0&&(ue[de]=Te[de]);return Y(M,xe,ue)},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(M){return{$$typeof:f,render:M}},Fe.isValidElement=K,Fe.lazy=function(M){return{$$typeof:y,_payload:{_status:-1,_result:M},_init:ge}},Fe.memo=function(M,W){return{$$typeof:d,type:M,compare:W===void 0?null:W}},Fe.startTransition=function(M){var W=V.T,_={};V.T=_;try{var de=M(),ue=V.S;ue!==null&&ue(_,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(O,Se)}catch(xe){Se(xe)}finally{W!==null&&_.types!==null&&(W.types=_.types),V.T=W}},Fe.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},Fe.use=function(M){return V.H.use(M)},Fe.useActionState=function(M,W,_){return V.H.useActionState(M,W,_)},Fe.useCallback=function(M,W){return V.H.useCallback(M,W)},Fe.useContext=function(M){return V.H.useContext(M)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(M,W){return V.H.useDeferredValue(M,W)},Fe.useEffect=function(M,W){return V.H.useEffect(M,W)},Fe.useEffectEvent=function(M){return V.H.useEffectEvent(M)},Fe.useId=function(){return V.H.useId()},Fe.useImperativeHandle=function(M,W,_){return V.H.useImperativeHandle(M,W,_)},Fe.useInsertionEffect=function(M,W){return V.H.useInsertionEffect(M,W)},Fe.useLayoutEffect=function(M,W){return V.H.useLayoutEffect(M,W)},Fe.useMemo=function(M,W){return V.H.useMemo(M,W)},Fe.useOptimistic=function(M,W){return V.H.useOptimistic(M,W)},Fe.useReducer=function(M,W,_){return V.H.useReducer(M,W,_)},Fe.useRef=function(M){return V.H.useRef(M)},Fe.useState=function(M){return V.H.useState(M)},Fe.useSyncExternalStore=function(M,W,_){return V.H.useSyncExternalStore(M,W,_)},Fe.useTransition=function(){return V.H.useTransition()},Fe.version="19.2.4",Fe}var Ty;function id(){return Ty||(Ty=1,Jf.exports=_w()),Jf.exports}var U=id(),Xf={exports:{}},nl={},Qf={exports:{}},Kf={};/**
18
18
  * @license React
19
19
  * scheduler.production.js
20
20
  *
@@ -22,7 +22,7 @@ var vw=Object.defineProperty;var xw=(e,n,r)=>n in e?vw(e,n,{enumerable:!0,config
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var Ny;function Ew(){return Ny||(Ny=1,(function(e){function n(I,ae){var ge=I.length;I.push(ae);e:for(;0<ge;){var _e=ge-1>>>1,O=I[_e];if(0<l(O,ae))I[_e]=ae,I[ge]=O,ge=_e;else break e}}function r(I){return I.length===0?null:I[0]}function a(I){if(I.length===0)return null;var ae=I[0],ge=I.pop();if(ge!==ae){I[0]=ge;e:for(var _e=0,O=I.length,M=O>>>1;_e<M;){var W=2*(_e+1)-1,S=I[W],he=W+1,fe=I[he];if(0>l(S,ge))he<O&&0>l(fe,S)?(I[_e]=fe,I[he]=ge,_e=he):(I[_e]=S,I[W]=ge,_e=W);else if(he<O&&0>l(fe,ge))I[_e]=fe,I[he]=ge,_e=he;else break e}}return ae}function l(I,ae){var ge=I.sortIndex-ae.sortIndex;return ge!==0?ge:I.id-ae.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],d=[],y=1,g=null,b=3,x=!1,k=!1,L=!1,B=!1,D=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,V=typeof setImmediate<"u"?setImmediate:null;function se(I){for(var ae=r(d);ae!==null;){if(ae.callback===null)a(d);else if(ae.startTime<=I)a(d),ae.sortIndex=ae.expirationTime,n(m,ae);else break;ae=r(d)}}function N(I){if(L=!1,se(I),!k)if(r(m)!==null)k=!0,R||(R=!0,K());else{var ae=r(d);ae!==null&&q(N,ae.startTime-I)}}var R=!1,G=-1,J=5,Y=-1;function T(){return B?!0:!(e.unstable_now()-Y<J)}function X(){if(B=!1,R){var I=e.unstable_now();Y=I;var ae=!0;try{e:{k=!1,L&&(L=!1,$(G),G=-1),x=!0;var ge=b;try{t:{for(se(I),g=r(m);g!==null&&!(g.expirationTime>I&&T());){var _e=g.callback;if(typeof _e=="function"){g.callback=null,b=g.priorityLevel;var O=_e(g.expirationTime<=I);if(I=e.unstable_now(),typeof O=="function"){g.callback=O,se(I),ae=!0;break t}g===r(m)&&a(m),se(I)}else a(m);g=r(m)}if(g!==null)ae=!0;else{var M=r(d);M!==null&&q(N,M.startTime-I),ae=!1}}break e}finally{g=null,b=ge,x=!1}ae=void 0}}finally{ae?K():R=!1}}}var K;if(typeof V=="function")K=function(){V(X)};else if(typeof MessageChannel<"u"){var ye=new MessageChannel,ue=ye.port2;ye.port1.onmessage=X,K=function(){ue.postMessage(null)}}else K=function(){D(X,0)};function q(I,ae){G=D(function(){I(e.unstable_now())},ae)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(I){switch(b){case 1:case 2:case 3:var ae=3;break;default:ae=b}var ge=b;b=ae;try{return I()}finally{b=ge}},e.unstable_requestPaint=function(){B=!0},e.unstable_runWithPriority=function(I,ae){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var ge=b;b=I;try{return ae()}finally{b=ge}},e.unstable_scheduleCallback=function(I,ae,ge){var _e=e.unstable_now();switch(typeof ge=="object"&&ge!==null?(ge=ge.delay,ge=typeof ge=="number"&&0<ge?_e+ge:_e):ge=_e,I){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=ge+O,I={id:y++,callback:ae,priorityLevel:I,startTime:ge,expirationTime:O,sortIndex:-1},ge>_e?(I.sortIndex=ge,n(d,I),r(m)===null&&I===r(d)&&(L?($(G),G=-1):L=!0,q(N,ge-_e))):(I.sortIndex=O,n(m,I),k||x||(k=!0,R||(R=!0,K()))),I},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(I){var ae=b;return function(){var ge=b;b=ae;try{return I.apply(this,arguments)}finally{b=ge}}}})(Kf)),Kf}var Ry;function kw(){return Ry||(Ry=1,Qf.exports=Ew()),Qf.exports}var Zf={exports:{}},en={};/**
25
+ */var Oy;function Ew(){return Oy||(Oy=1,(function(e){function n(H,ie){var ge=H.length;H.push(ie);e:for(;0<ge;){var Se=ge-1>>>1,N=H[Se];if(0<l(N,ie))H[Se]=ie,H[ge]=N,ge=Se;else break e}}function r(H){return H.length===0?null:H[0]}function a(H){if(H.length===0)return null;var ie=H[0],ge=H.pop();if(ge!==ie){H[0]=ge;e:for(var Se=0,N=H.length,M=N>>>1;Se<M;){var W=2*(Se+1)-1,_=H[W],de=W+1,ue=H[de];if(0>l(_,ge))de<N&&0>l(ue,_)?(H[Se]=ue,H[de]=ge,Se=de):(H[Se]=_,H[W]=ge,Se=W);else if(de<N&&0>l(ue,ge))H[Se]=ue,H[de]=ge,Se=de;else break e}}return ie}function l(H,ie){var ge=H.sortIndex-ie.sortIndex;return ge!==0?ge:H.id-ie.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],d=[],y=1,g=null,b=3,x=!1,k=!1,L=!1,B=!1,D=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,G=typeof setImmediate<"u"?setImmediate:null;function se(H){for(var ie=r(d);ie!==null;){if(ie.callback===null)a(d);else if(ie.startTime<=H)a(d),ie.sortIndex=ie.expirationTime,n(m,ie);else break;ie=r(d)}}function R(H){if(L=!1,se(H),!k)if(r(m)!==null)k=!0,O||(O=!0,Q());else{var ie=r(d);ie!==null&&q(R,ie.startTime-H)}}var O=!1,V=-1,J=5,Y=-1;function j(){return B?!0:!(e.unstable_now()-Y<J)}function K(){if(B=!1,O){var H=e.unstable_now();Y=H;var ie=!0;try{e:{k=!1,L&&(L=!1,F(V),V=-1),x=!0;var ge=b;try{t:{for(se(H),g=r(m);g!==null&&!(g.expirationTime>H&&j());){var Se=g.callback;if(typeof Se=="function"){g.callback=null,b=g.priorityLevel;var N=Se(g.expirationTime<=H);if(H=e.unstable_now(),typeof N=="function"){g.callback=N,se(H),ie=!0;break t}g===r(m)&&a(m),se(H)}else a(m);g=r(m)}if(g!==null)ie=!0;else{var M=r(d);M!==null&&q(R,M.startTime-H),ie=!1}}break e}finally{g=null,b=ge,x=!1}ie=void 0}}finally{ie?Q():O=!1}}}var Q;if(typeof G=="function")Q=function(){G(K)};else if(typeof MessageChannel<"u"){var ye=new MessageChannel,he=ye.port2;ye.port1.onmessage=K,Q=function(){he.postMessage(null)}}else Q=function(){D(K,0)};function q(H,ie){V=D(function(){H(e.unstable_now())},ie)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(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 b},e.unstable_next=function(H){switch(b){case 1:case 2:case 3:var ie=3;break;default:ie=b}var ge=b;b=ie;try{return H()}finally{b=ge}},e.unstable_requestPaint=function(){B=!0},e.unstable_runWithPriority=function(H,ie){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var ge=b;b=H;try{return ie()}finally{b=ge}},e.unstable_scheduleCallback=function(H,ie,ge){var Se=e.unstable_now();switch(typeof ge=="object"&&ge!==null?(ge=ge.delay,ge=typeof ge=="number"&&0<ge?Se+ge:Se):ge=Se,H){case 1:var N=-1;break;case 2:N=250;break;case 5:N=1073741823;break;case 4:N=1e4;break;default:N=5e3}return N=ge+N,H={id:y++,callback:ie,priorityLevel:H,startTime:ge,expirationTime:N,sortIndex:-1},ge>Se?(H.sortIndex=ge,n(d,H),r(m)===null&&H===r(d)&&(L?(F(V),V=-1):L=!0,q(R,ge-Se))):(H.sortIndex=N,n(m,H),k||x||(k=!0,O||(O=!0,Q()))),H},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(H){var ie=b;return function(){var ge=b;b=ie;try{return H.apply(this,arguments)}finally{b=ge}}}})(Kf)),Kf}var jy;function kw(){return jy||(jy=1,Qf.exports=Ew()),Qf.exports}var Zf={exports:{}},Zt={};/**
26
26
  * @license React
27
27
  * react-dom.production.js
28
28
  *
@@ -30,7 +30,7 @@ var vw=Object.defineProperty;var xw=(e,n,r)=>n in e?vw(e,n,{enumerable:!0,config
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var My;function Aw(){if(My)return en;My=1;var e=sd();function n(m){var d="https://react.dev/errors/"+m;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)d+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+m+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},l=Symbol.for("react.portal");function u(m,d,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:m,containerInfo:d,implementation:y}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,d){if(m==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return en.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,en.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)},en.flushSync=function(m){var d=c.T,y=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=d,a.p=y,a.d.f()}},en.preconnect=function(m,d){typeof m=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,a.d.C(m,d))},en.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},en.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,x=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;y==="style"?a.d.S(m,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:x}):y==="script"&&a.d.X(m,{crossOrigin:g,integrity:b,fetchPriority:x,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},en.preinitModule=function(m,d){if(typeof m=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var y=f(d.as,d.crossOrigin);a.d.M(m,{crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&a.d.M(m)},en.preload=function(m,d){if(typeof m=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin);a.d.L(m,y,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},en.preloadModule=function(m,d){if(typeof m=="string")if(d){var y=f(d.as,d.crossOrigin);a.d.m(m,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else a.d.m(m)},en.requestFormReset=function(m){a.d.r(m)},en.unstable_batchedUpdates=function(m,d){return m(d)},en.useFormState=function(m,d,y){return c.H.useFormState(m,d,y)},en.useFormStatus=function(){return c.H.useHostTransitionStatus()},en.version="19.2.4",en}var Dy;function pb(){if(Dy)return Zf.exports;Dy=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(),Zf.exports=Aw(),Zf.exports}/**
33
+ */var Ny;function Aw(){if(Ny)return Zt;Ny=1;var e=id();function n(m){var d="https://react.dev/errors/"+m;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)d+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+m+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},l=Symbol.for("react.portal");function u(m,d,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:m,containerInfo:d,implementation:y}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,d){if(m==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Zt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Zt.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)},Zt.flushSync=function(m){var d=c.T,y=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=d,a.p=y,a.d.f()}},Zt.preconnect=function(m,d){typeof m=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,a.d.C(m,d))},Zt.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Zt.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,x=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;y==="style"?a.d.S(m,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:x}):y==="script"&&a.d.X(m,{crossOrigin:g,integrity:b,fetchPriority:x,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Zt.preinitModule=function(m,d){if(typeof m=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var y=f(d.as,d.crossOrigin);a.d.M(m,{crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&a.d.M(m)},Zt.preload=function(m,d){if(typeof m=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin);a.d.L(m,y,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Zt.preloadModule=function(m,d){if(typeof m=="string")if(d){var y=f(d.as,d.crossOrigin);a.d.m(m,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else a.d.m(m)},Zt.requestFormReset=function(m){a.d.r(m)},Zt.unstable_batchedUpdates=function(m,d){return m(d)},Zt.useFormState=function(m,d,y){return c.H.useFormState(m,d,y)},Zt.useFormStatus=function(){return c.H.useHostTransitionStatus()},Zt.version="19.2.4",Zt}var Ry;function pb(){if(Ry)return Zf.exports;Ry=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(),Zf.exports=Aw(),Zf.exports}/**
34
34
  * @license React
35
35
  * react-dom-client.production.js
36
36
  *
@@ -38,15 +38,15 @@ var vw=Object.defineProperty;var xw=(e,n,r)=>n in e?vw(e,n,{enumerable:!0,config
38
38
  *
39
39
  * This source code is licensed under the MIT license found in the
40
40
  * LICENSE file in the root directory of this source tree.
41
- */var zy;function Cw(){if(zy)return nl;zy=1;var e=kw(),n=sd(),r=pb();function a(t){var i="https://react.dev/errors/"+t;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)i+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+t+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var i=t,s=t;if(t.alternate)for(;i.return;)i=i.return;else{t=i;do i=t,(i.flags&4098)!==0&&(s=i.return),t=i.return;while(t)}return i.tag===3?s:null}function c(t){if(t.tag===13){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function f(t){if(t.tag===31){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function m(t){if(u(t)!==t)throw Error(a(188))}function d(t){var i=t.alternate;if(!i){if(i=u(t),i===null)throw Error(a(188));return i!==t?null:t}for(var s=t,o=i;;){var h=s.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){s=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===s)return m(h),t;if(p===o)return m(h),i;p=p.sibling}throw Error(a(188))}if(s.return!==o.return)s=h,o=p;else{for(var v=!1,_=h.child;_;){if(_===s){v=!0,s=h,o=p;break}if(_===o){v=!0,o=h,s=p;break}_=_.sibling}if(!v){for(_=p.child;_;){if(_===s){v=!0,s=p,o=h;break}if(_===o){v=!0,o=p,s=h;break}_=_.sibling}if(!v)throw Error(a(189))}}if(s.alternate!==o)throw Error(a(190))}if(s.tag!==3)throw Error(a(188));return s.stateNode.current===s?t:i}function y(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t;for(t=t.child;t!==null;){if(i=y(t),i!==null)return i;t=t.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),V=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),T=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function K(t){return t===null||typeof t!="object"?null:(t=X&&t[X]||t["@@iterator"],typeof t=="function"?t:null)}var ye=Symbol.for("react.client.reference");function ue(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ye?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case L:return"Fragment";case D:return"Profiler";case B:return"StrictMode";case N:return"Suspense";case R:return"SuspenseList";case Y:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case V:return t.displayName||"Context";case $:return(t._context.displayName||"Context")+".Consumer";case se:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case G:return i=t.displayName||null,i!==null?i:ue(t.type)||"Memo";case J:i=t._payload,t=t._init;try{return ue(t(i))}catch{}}return null}var q=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ge={pending:!1,data:null,method:null,action:null},_e=[],O=-1;function M(t){return{current:t}}function W(t){0>O||(t.current=_e[O],_e[O]=null,O--)}function S(t,i){O++,_e[O]=t.current,t.current=i}var he=M(null),fe=M(null),ve=M(null),Te=M(null);function ze(t,i){switch(S(ve,i),S(fe,t),S(he,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?Qg(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=Qg(i),t=Kg(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}W(he),S(he,t)}function ke(){W(he),W(fe),W(ve)}function Me(t){t.memoizedState!==null&&S(Te,t);var i=he.current,s=Kg(i,t.type);i!==s&&(S(fe,t),S(he,s))}function wt(t){fe.current===t&&(W(he),W(fe)),Te.current===t&&(W(Te),Ks._currentValue=ge)}var He,qe;function nt(t){if(He===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);He=i&&i[1]||"",qe=-1<s.stack.indexOf(`
41
+ */var My;function Cw(){if(My)return nl;My=1;var e=kw(),n=id(),r=pb();function a(t){var i="https://react.dev/errors/"+t;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)i+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+t+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var i=t,s=t;if(t.alternate)for(;i.return;)i=i.return;else{t=i;do i=t,(i.flags&4098)!==0&&(s=i.return),t=i.return;while(t)}return i.tag===3?s:null}function c(t){if(t.tag===13){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function f(t){if(t.tag===31){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function m(t){if(u(t)!==t)throw Error(a(188))}function d(t){var i=t.alternate;if(!i){if(i=u(t),i===null)throw Error(a(188));return i!==t?null:t}for(var s=t,o=i;;){var h=s.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){s=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===s)return m(h),t;if(p===o)return m(h),i;p=p.sibling}throw Error(a(188))}if(s.return!==o.return)s=h,o=p;else{for(var v=!1,S=h.child;S;){if(S===s){v=!0,s=h,o=p;break}if(S===o){v=!0,o=h,s=p;break}S=S.sibling}if(!v){for(S=p.child;S;){if(S===s){v=!0,s=p,o=h;break}if(S===o){v=!0,o=p,s=h;break}S=S.sibling}if(!v)throw Error(a(189))}}if(s.alternate!==o)throw Error(a(190))}if(s.tag!==3)throw Error(a(188));return s.stateNode.current===s?t:i}function y(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t;for(t=t.child;t!==null;){if(i=y(t),i!==null)return i;t=t.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),G=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),j=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function Q(t){return t===null||typeof t!="object"?null:(t=K&&t[K]||t["@@iterator"],typeof t=="function"?t:null)}var ye=Symbol.for("react.client.reference");function he(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ye?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case L:return"Fragment";case D:return"Profiler";case B:return"StrictMode";case R:return"Suspense";case O:return"SuspenseList";case Y:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case G:return t.displayName||"Context";case F:return(t._context.displayName||"Context")+".Consumer";case se:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case V:return i=t.displayName||null,i!==null?i:he(t.type)||"Memo";case J:i=t._payload,t=t._init;try{return he(t(i))}catch{}}return null}var q=Array.isArray,H=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ge={pending:!1,data:null,method:null,action:null},Se=[],N=-1;function M(t){return{current:t}}function W(t){0>N||(t.current=Se[N],Se[N]=null,N--)}function _(t,i){N++,Se[N]=t.current,t.current=i}var de=M(null),ue=M(null),xe=M(null),Te=M(null);function Me(t,i){switch(_(xe,i),_(ue,t),_(de,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?Jg(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=Jg(i),t=Xg(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}W(de),_(de,t)}function ke(){W(de),W(ue),W(xe)}function ze(t){t.memoizedState!==null&&_(Te,t);var i=de.current,s=Xg(i,t.type);i!==s&&(_(ue,t),_(de,s))}function ft(t){ue.current===t&&(W(de),W(ue)),Te.current===t&&(W(Te),Ks._currentValue=ge)}var He,qe;function nt(t){if(He===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);He=i&&i[1]||"",qe=-1<s.stack.indexOf(`
42
42
  at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+He+t+qe}var ft=!1;function Mt(t,i){if(!t||ft)return"";ft=!0;var s=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(ie){var ne=ie}Reflect.construct(t,[],pe)}else{try{pe.call()}catch(ie){ne=ie}t.call(pe.prototype)}}else{try{throw Error()}catch(ie){ne=ie}(pe=t())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(ie){if(ie&&ne&&typeof ie.stack=="string")return[ie.stack,ne.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),v=p[0],_=p[1];if(v&&_){var P=v.split(`
44
- `),te=_.split(`
43
+ `+He+t+qe}var ve=!1;function Le(t,i){if(!t||ve)return"";ve=!0;var s=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(ae){var ne=ae}Reflect.construct(t,[],pe)}else{try{pe.call()}catch(ae){ne=ae}t.call(pe.prototype)}}else{try{throw Error()}catch(ae){ne=ae}(pe=t())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(ae){if(ae&&ne&&typeof ae.stack=="string")return[ae.stack,ne.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),v=p[0],S=p[1];if(v&&S){var P=v.split(`
44
+ `),te=S.split(`
45
45
  `);for(h=o=0;o<P.length&&!P[o].includes("DetermineComponentFrameRoot");)o++;for(;h<te.length&&!te[h].includes("DetermineComponentFrameRoot");)h++;if(o===P.length||h===te.length)for(o=P.length-1,h=te.length-1;1<=o&&0<=h&&P[o]!==te[h];)h--;for(;1<=o&&0<=h;o--,h--)if(P[o]!==te[h]){if(o!==1||h!==1)do if(o--,h--,0>h||P[o]!==te[h]){var le=`
46
- `+P[o].replace(" at new "," at ");return t.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",t.displayName)),le}while(1<=o&&0<=h);break}}}finally{ft=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?nt(s):""}function xr(t,i){switch(t.tag){case 26:case 27:case 5:return nt(t.type);case 16:return nt("Lazy");case 13:return t.child!==i&&i!==null?nt("Suspense Fallback"):nt("Suspense");case 19:return nt("SuspenseList");case 0:case 15:return Mt(t.type,!1);case 11:return Mt(t.type.render,!1);case 1:return Mt(t.type,!0);case 31:return nt("Activity");default:return""}}function wr(t){try{var i="",s=null;do i+=xr(t,s),s=t,t=t.return;while(t);return i}catch(o){return`
46
+ `+P[o].replace(" at new "," at ");return t.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",t.displayName)),le}while(1<=o&&0<=h);break}}}finally{ve=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?nt(s):""}function Ie(t,i){switch(t.tag){case 26:case 27:case 5:return nt(t.type);case 16:return nt("Lazy");case 13:return t.child!==i&&i!==null?nt("Suspense Fallback"):nt("Suspense");case 19:return nt("SuspenseList");case 0:case 15:return Le(t.type,!1);case 11:return Le(t.type.render,!1);case 1:return Le(t.type,!0);case 31:return nt("Activity");default:return""}}function Tt(t){try{var i="",s=null;do i+=Ie(t,s),s=t,t=t.return;while(t);return i}catch(o){return`
47
47
  Error generating stack: `+o.message+`
48
- `+o.stack}}var Ee=Object.prototype.hasOwnProperty,Ie=e.unstable_scheduleCallback,Be=e.unstable_cancelCallback,jt=e.unstable_shouldYield,Dn=e.unstable_requestPaint,vt=e.unstable_now,cs=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,we=e.unstable_UserBlockingPriority,Pe=e.unstable_NormalPriority,Ve=e.unstable_LowPriority,it=e.unstable_IdlePriority,rn=e.log,zn=e.unstable_setDisableYieldValue,Jt=null,pt=null;function It(t){if(typeof rn=="function"&&zn(t),pt&&typeof pt.setStrictMode=="function")try{pt.setStrictMode(Jt,t)}catch{}}var ot=Math.clz32?Math.clz32:ia,Ln=Math.log,an=Math.LN2;function ia(t){return t>>>=0,t===0?32:31-(Ln(t)/an|0)|0}var Vr=256,Sr=262144,Jr=4194304;function Kn(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 Ni(t,i,s){var o=t.pendingLanes;if(o===0)return 0;var h=0,p=t.suspendedLanes,v=t.pingedLanes;t=t.warmLanes;var _=o&134217727;return _!==0?(o=_&~p,o!==0?h=Kn(o):(v&=_,v!==0?h=Kn(v):s||(s=_&~t,s!==0&&(h=Kn(s))))):(_=o&~p,_!==0?h=Kn(_):v!==0?h=Kn(v):s||(s=o&~t,s!==0&&(h=Kn(s)))),h===0?0:i!==0&&i!==h&&(i&p)===0&&(p=h&-h,s=i&-i,p>=s||p===32&&(s&4194048)!==0)?i:h}function Ri(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function fs(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 aa(){var t=Jr;return Jr<<=1,(Jr&62914560)===0&&(Jr=4194304),t}function Xr(t){for(var i=[],s=0;31>s;s++)i.push(t);return i}function Zn(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Qr(t,i,s,o,h,p){var v=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var _=t.entanglements,P=t.expirationTimes,te=t.hiddenUpdates;for(s=v&~s;0<s;){var le=31-ot(s),pe=1<<le;_[le]=0,P[le]=-1;var ne=te[le];if(ne!==null)for(te[le]=null,le=0;le<ne.length;le++){var ie=ne[le];ie!==null&&(ie.lane&=-536870913)}s&=~pe}o!==0&&Kr(t,o,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(v&~i))}function Kr(t,i,s){t.pendingLanes|=i,t.suspendedLanes&=~i;var o=31-ot(i);t.entangledLanes|=i,t.entanglements[o]=t.entanglements[o]|1073741824|s&261930}function Mi(t,i){var s=t.entangledLanes|=i;for(t=t.entanglements;s;){var o=31-ot(s),h=1<<o;h&i|t[o]&i&&(t[o]|=i),s&=~h}}function Zr(t,i){var s=i&-i;return s=(s&42)!==0?1:_r(s),(s&(t.suspendedLanes|i))!==0?0:s}function _r(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 Di(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function hs(){var t=ae.p;return t!==0?t:(t=window.event,t===void 0?32:xy(t.type))}function Ll(t,i){var s=ae.p;try{return ae.p=t,i()}finally{ae.p=s}}var lr=Math.random().toString(36).slice(2),gt="__reactFiber$"+lr,Ot="__reactProps$"+lr,vn="__reactContainer$"+lr,zi="__reactEvents$"+lr,ds="__reactListeners$"+lr,Ul="__reactHandles$"+lr,Bl="__reactResources$"+lr,Ft="__reactMarker$"+lr;function sa(t){delete t[gt],delete t[Ot],delete t[zi],delete t[ds],delete t[Ul]}function E(t){var i=t[gt];if(i)return i;for(var s=t.parentNode;s;){if(i=s[vn]||s[gt]){if(s=i.alternate,i.child!==null||s!==null&&s.child!==null)for(t=iy(t);t!==null;){if(s=t[gt])return s;t=iy(t)}return i}t=s,s=t.parentNode}return null}function j(t){if(t=t[gt]||t[vn]){var i=t.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return t}return null}function C(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t.stateNode;throw Error(a(33))}function z(t){var i=t[Bl];return i||(i=t[Bl]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function H(t){t[Ft]=!0}var Z=new Set,me={};function be(t,i){re(t,i),re(t+"Capture",i)}function re(t,i){for(me[t]=i,t=0;t<i.length;t++)Z.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]*$"),Oe={},Je={};function St(t){return Ee.call(Je,t)?!0:Ee.call(Oe,t)?!1:de.test(t)?Je[t]=!0:(Oe[t]=!0,!1)}function Wt(t,i,s){if(St(i))if(s===null)t.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":t.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(i);return}}t.setAttribute(i,""+s)}}function Wn(t,i,s){if(s===null)t.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttribute(i,""+s)}}function Er(t,i,s,o){if(o===null)t.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(i,s,""+o)}}function Un(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Id(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function hv(t,i,s){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,i);if(!t.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return h.call(this)},set:function(v){s=""+v,p.call(this,v)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return s},setValue:function(v){s=""+v},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function Pu(t){if(!t._valueTracker){var i=Id(t)?"checked":"value";t._valueTracker=hv(t,i,""+t[i])}}function Fd(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var s=i.getValue(),o="";return t&&(o=Id(t)?t.checked?"true":"false":t.value),t=o,t!==s?(i.setValue(t),!0):!1}function Pl(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 dv=/[\n"\\]/g;function Bn(t){return t.replace(dv,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function qu(t,i,s,o,h,p,v,_){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=""+Un(i)):t.value!==""+Un(i)&&(t.value=""+Un(i)):v!=="submit"&&v!=="reset"||t.removeAttribute("value"),i!=null?Hu(t,v,Un(i)):s!=null?Hu(t,v,Un(s)):o!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?t.name=""+Un(_):t.removeAttribute("name")}function $d(t,i,s,o,h,p,v,_){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),i!=null||s!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){Pu(t);return}s=s!=null?""+Un(s):"",i=i!=null?""+Un(i):s,_||i===t.value||(t.value=i),t.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=_?t.checked:!!o,t.defaultChecked=!!o,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.name=v),Pu(t)}function Hu(t,i,s){i==="number"&&Pl(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function la(t,i,s,o){if(t=t.options,i){i={};for(var h=0;h<s.length;h++)i["$"+s[h]]=!0;for(s=0;s<t.length;s++)h=i.hasOwnProperty("$"+t[s].value),t[s].selected!==h&&(t[s].selected=h),h&&o&&(t[s].defaultSelected=!0)}else{for(s=""+Un(s),i=null,h=0;h<t.length;h++){if(t[h].value===s){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}i!==null||t[h].disabled||(i=t[h])}i!==null&&(i.selected=!0)}}function Gd(t,i,s){if(i!=null&&(i=""+Un(i),i!==t.value&&(t.value=i),s==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=s!=null?""+Un(s):""}function Yd(t,i,s,o){if(i==null){if(o!=null){if(s!=null)throw Error(a(92));if(q(o)){if(1<o.length)throw Error(a(93));o=o[0]}s=o}s==null&&(s=""),i=s}s=Un(i),t.defaultValue=s,o=t.textContent,o===s&&o!==""&&o!==null&&(t.value=o),Pu(t)}function oa(t,i){if(i){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=i;return}}t.textContent=i}var mv=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 Vd(t,i,s){var o=i.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?o?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="":o?t.setProperty(i,s):typeof s!="number"||s===0||mv.has(i)?i==="float"?t.cssFloat=s:t[i]=(""+s).trim():t[i]=s+"px"}function Jd(t,i,s){if(i!=null&&typeof i!="object")throw Error(a(62));if(t=t.style,s!=null){for(var o in s)!s.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var h in i)o=i[h],i.hasOwnProperty(h)&&s[h]!==o&&Vd(t,h,o)}else for(var p in i)i.hasOwnProperty(p)&&Vd(t,p,i[p])}function Iu(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 pv=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"]]),gv=/^[\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 ql(t){return gv.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function kr(){}var Fu=null;function $u(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ua=null,ca=null;function Xd(t){var i=j(t);if(i&&(t=i.stateNode)){var s=t[Ot]||null;e:switch(t=i.stateNode,i.type){case"input":if(qu(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),i=s.name,s.type==="radio"&&i!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Bn(""+i)+'"][type="radio"]'),i=0;i<s.length;i++){var o=s[i];if(o!==t&&o.form===t.form){var h=o[Ot]||null;if(!h)throw Error(a(90));qu(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<s.length;i++)o=s[i],o.form===t.form&&Fd(o)}break e;case"textarea":Gd(t,s.value,s.defaultValue);break e;case"select":i=s.value,i!=null&&la(t,!!s.multiple,i,!1)}}}var Gu=!1;function Qd(t,i,s){if(Gu)return t(i,s);Gu=!0;try{var o=t(i);return o}finally{if(Gu=!1,(ua!==null||ca!==null)&&(To(),ua&&(i=ua,t=ca,ca=ua=null,Xd(i),t)))for(i=0;i<t.length;i++)Xd(t[i])}}function ms(t,i){var s=t.stateNode;if(s===null)return null;var o=s[Ot]||null;if(o===null)return null;s=o[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(a(231,i,typeof s));return s}var Ar=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yu=!1;if(Ar)try{var ps={};Object.defineProperty(ps,"passive",{get:function(){Yu=!0}}),window.addEventListener("test",ps,ps),window.removeEventListener("test",ps,ps)}catch{Yu=!1}var Wr=null,Vu=null,Hl=null;function Kd(){if(Hl)return Hl;var t,i=Vu,s=i.length,o,h="value"in Wr?Wr.value:Wr.textContent,p=h.length;for(t=0;t<s&&i[t]===h[t];t++);var v=s-t;for(o=1;o<=v&&i[s-o]===h[p-o];o++);return Hl=h.slice(t,1<o?1-o:void 0)}function Il(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 Fl(){return!0}function Zd(){return!1}function fn(t){function i(s,o,h,p,v){this._reactName=s,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=v,this.currentTarget=null;for(var _ in t)t.hasOwnProperty(_)&&(s=t[_],this[_]=s?s(p):p[_]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Fl:Zd,this.isPropagationStopped=Zd,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Fl)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Fl)},persist:function(){},isPersistent:Fl}),i}var Li={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$l=fn(Li),gs=g({},Li,{view:0,detail:0}),yv=fn(gs),Ju,Xu,ys,Gl=g({},gs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ku,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!==ys&&(ys&&t.type==="mousemove"?(Ju=t.screenX-ys.screenX,Xu=t.screenY-ys.screenY):Xu=Ju=0,ys=t),Ju)},movementY:function(t){return"movementY"in t?t.movementY:Xu}}),Wd=fn(Gl),bv=g({},Gl,{dataTransfer:0}),vv=fn(bv),xv=g({},gs,{relatedTarget:0}),Qu=fn(xv),wv=g({},Li,{animationName:0,elapsedTime:0,pseudoElement:0}),Sv=fn(wv),_v=g({},Li,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Ev=fn(_v),kv=g({},Li,{data:0}),em=fn(kv),Av={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Cv={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Tv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jv(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=Tv[t])?!!i[t]:!1}function Ku(){return jv}var Ov=g({},gs,{key:function(t){if(t.key){var i=Av[t.key]||t.key;if(i!=="Unidentified")return i}return t.type==="keypress"?(t=Il(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Cv[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ku,charCode:function(t){return t.type==="keypress"?Il(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Il(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Nv=fn(Ov),Rv=g({},Gl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tm=fn(Rv),Mv=g({},gs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ku}),Dv=fn(Mv),zv=g({},Li,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lv=fn(zv),Uv=g({},Gl,{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}),Bv=fn(Uv),Pv=g({},Li,{newState:0,oldState:0}),qv=fn(Pv),Hv=[9,13,27,32],Zu=Ar&&"CompositionEvent"in window,bs=null;Ar&&"documentMode"in document&&(bs=document.documentMode);var Iv=Ar&&"TextEvent"in window&&!bs,nm=Ar&&(!Zu||bs&&8<bs&&11>=bs),rm=" ",im=!1;function am(t,i){switch(t){case"keyup":return Hv.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 fa=!1;function Fv(t,i){switch(t){case"compositionend":return sm(i);case"keypress":return i.which!==32?null:(im=!0,rm);case"textInput":return t=i.data,t===rm&&im?null:t;default:return null}}function $v(t,i){if(fa)return t==="compositionend"||!Zu&&am(t,i)?(t=Kd(),Hl=Vu=Wr=null,fa=!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 nm&&i.locale!=="ko"?null:i.data;default:return null}}var Gv={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 lm(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!Gv[t.type]:i==="textarea"}function om(t,i,s,o){ua?ca?ca.push(o):ca=[o]:ua=o,i=zo(i,"onChange"),0<i.length&&(s=new $l("onChange","change",null,s,o),t.push({event:s,listeners:i}))}var vs=null,xs=null;function Yv(t){$g(t,0)}function Yl(t){var i=C(t);if(Fd(i))return t}function um(t,i){if(t==="change")return i}var cm=!1;if(Ar){var Wu;if(Ar){var ec="oninput"in document;if(!ec){var fm=document.createElement("div");fm.setAttribute("oninput","return;"),ec=typeof fm.oninput=="function"}Wu=ec}else Wu=!1;cm=Wu&&(!document.documentMode||9<document.documentMode)}function hm(){vs&&(vs.detachEvent("onpropertychange",dm),xs=vs=null)}function dm(t){if(t.propertyName==="value"&&Yl(xs)){var i=[];om(i,xs,t,$u(t)),Qd(Yv,i)}}function Vv(t,i,s){t==="focusin"?(hm(),vs=i,xs=s,vs.attachEvent("onpropertychange",dm)):t==="focusout"&&hm()}function Jv(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Yl(xs)}function Xv(t,i){if(t==="click")return Yl(i)}function Qv(t,i){if(t==="input"||t==="change")return Yl(i)}function Kv(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var xn=typeof Object.is=="function"?Object.is:Kv;function ws(t,i){if(xn(t,i))return!0;if(typeof t!="object"||t===null||typeof i!="object"||i===null)return!1;var s=Object.keys(t),o=Object.keys(i);if(s.length!==o.length)return!1;for(o=0;o<s.length;o++){var h=s[o];if(!Ee.call(i,h)||!xn(t[h],i[h]))return!1}return!0}function mm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function pm(t,i){var s=mm(t);t=0;for(var o;s;){if(s.nodeType===3){if(o=t+s.textContent.length,t<=i&&o>=i)return{node:s,offset:i-t};t=o}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=mm(s)}}function gm(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?gm(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function ym(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=Pl(t.document);i instanceof t.HTMLIFrameElement;){try{var s=typeof i.contentWindow.location.href=="string"}catch{s=!1}if(s)t=i.contentWindow;else break;i=Pl(t.document)}return i}function tc(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 Zv=Ar&&"documentMode"in document&&11>=document.documentMode,ha=null,nc=null,Ss=null,rc=!1;function bm(t,i,s){var o=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;rc||ha==null||ha!==Pl(o)||(o=ha,"selectionStart"in o&&tc(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}),Ss&&ws(Ss,o)||(Ss=o,o=zo(nc,"onSelect"),0<o.length&&(i=new $l("onSelect","select",null,i,s),t.push({event:i,listeners:o}),i.target=ha)))}function Ui(t,i){var s={};return s[t.toLowerCase()]=i.toLowerCase(),s["Webkit"+t]="webkit"+i,s["Moz"+t]="moz"+i,s}var da={animationend:Ui("Animation","AnimationEnd"),animationiteration:Ui("Animation","AnimationIteration"),animationstart:Ui("Animation","AnimationStart"),transitionrun:Ui("Transition","TransitionRun"),transitionstart:Ui("Transition","TransitionStart"),transitioncancel:Ui("Transition","TransitionCancel"),transitionend:Ui("Transition","TransitionEnd")},ic={},vm={};Ar&&(vm=document.createElement("div").style,"AnimationEvent"in window||(delete da.animationend.animation,delete da.animationiteration.animation,delete da.animationstart.animation),"TransitionEvent"in window||delete da.transitionend.transition);function Bi(t){if(ic[t])return ic[t];if(!da[t])return t;var i=da[t],s;for(s in i)if(i.hasOwnProperty(s)&&s in vm)return ic[t]=i[s];return t}var xm=Bi("animationend"),wm=Bi("animationiteration"),Sm=Bi("animationstart"),Wv=Bi("transitionrun"),ex=Bi("transitionstart"),tx=Bi("transitioncancel"),_m=Bi("transitionend"),Em=new Map,ac="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(" ");ac.push("scrollEnd");function er(t,i){Em.set(t,i),be(i,[t])}var Vl=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)},Pn=[],ma=0,sc=0;function Jl(){for(var t=ma,i=sc=ma=0;i<t;){var s=Pn[i];Pn[i++]=null;var o=Pn[i];Pn[i++]=null;var h=Pn[i];Pn[i++]=null;var p=Pn[i];if(Pn[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&&km(s,h,p)}}function Xl(t,i,s,o){Pn[ma++]=t,Pn[ma++]=i,Pn[ma++]=s,Pn[ma++]=o,sc|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function lc(t,i,s,o){return Xl(t,i,s,o),Ql(t)}function Pi(t,i){return Xl(t,null,null,i),Ql(t)}function km(t,i,s){t.lanes|=s;var o=t.alternate;o!==null&&(o.lanes|=s);for(var h=!1,p=t.return;p!==null;)p.childLanes|=s,o=p.alternate,o!==null&&(o.childLanes|=s),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(h=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,h&&i!==null&&(h=31-ot(s),t=p.hiddenUpdates,o=t[h],o===null?t[h]=[i]:o.push(i),i.lane=s|536870912),p):null}function Ql(t){if(50<$s)throw $s=0,yf=null,Error(a(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var pa={};function nx(t,i,s,o){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wn(t,i,s,o){return new nx(t,i,s,o)}function oc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Cr(t,i){var s=t.alternate;return s===null?(s=wn(t.tag,i,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=i,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&65011712,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,i=t.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function Am(t,i){t.flags&=65011714;var s=t.alternate;return s===null?(t.childLanes=0,t.lanes=i,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,i=s.dependencies,t.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),t}function Kl(t,i,s,o,h,p){var v=0;if(o=t,typeof t=="function")oc(t)&&(v=1);else if(typeof t=="string")v=lw(t,s,he.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case Y:return t=wn(31,s,i,h),t.elementType=Y,t.lanes=p,t;case L:return qi(s.children,h,p,i);case B:v=8,h|=24;break;case D:return t=wn(12,s,i,h|2),t.elementType=D,t.lanes=p,t;case N:return t=wn(13,s,i,h),t.elementType=N,t.lanes=p,t;case R:return t=wn(19,s,i,h),t.elementType=R,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case V:v=10;break e;case $:v=9;break e;case se:v=11;break e;case G:v=14;break e;case J:v=16,o=null;break e}v=29,s=Error(a(130,t===null?"null":typeof t,"")),o=null}return i=wn(v,s,i,h),i.elementType=t,i.type=o,i.lanes=p,i}function qi(t,i,s,o){return t=wn(7,t,o,i),t.lanes=s,t}function uc(t,i,s){return t=wn(6,t,null,i),t.lanes=s,t}function Cm(t){var i=wn(18,null,null,0);return i.stateNode=t,i}function cc(t,i,s){return i=wn(4,t.children!==null?t.children:[],t.key,i),i.lanes=s,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var Tm=new WeakMap;function qn(t,i){if(typeof t=="object"&&t!==null){var s=Tm.get(t);return s!==void 0?s:(i={value:t,source:i,stack:wr(i)},Tm.set(t,i),i)}return{value:t,source:i,stack:wr(i)}}var ga=[],ya=0,Zl=null,_s=0,Hn=[],In=0,ei=null,or=1,ur="";function Tr(t,i){ga[ya++]=_s,ga[ya++]=Zl,Zl=t,_s=i}function jm(t,i,s){Hn[In++]=or,Hn[In++]=ur,Hn[In++]=ei,ei=t;var o=or;t=ur;var h=32-ot(o)-1;o&=~(1<<h),s+=1;var p=32-ot(i)+h;if(30<p){var v=h-h%5;p=(o&(1<<v)-1).toString(32),o>>=v,h-=v,or=1<<32-ot(i)+h|s<<h|o,ur=p+t}else or=1<<p|s<<h|o,ur=t}function fc(t){t.return!==null&&(Tr(t,1),jm(t,1,0))}function hc(t){for(;t===Zl;)Zl=ga[--ya],ga[ya]=null,_s=ga[--ya],ga[ya]=null;for(;t===ei;)ei=Hn[--In],Hn[In]=null,ur=Hn[--In],Hn[In]=null,or=Hn[--In],Hn[In]=null}function Om(t,i){Hn[In++]=or,Hn[In++]=ur,Hn[In++]=ei,or=i.id,ur=i.overflow,ei=t}var Xt=null,_t=null,et=!1,ti=null,Fn=!1,dc=Error(a(519));function ni(t){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Es(qn(i,t)),dc}function Nm(t){var i=t.stateNode,s=t.type,o=t.memoizedProps;switch(i[gt]=t,i[Ot]=o,s){case"dialog":Qe("cancel",i),Qe("close",i);break;case"iframe":case"object":case"embed":Qe("load",i);break;case"video":case"audio":for(s=0;s<Ys.length;s++)Qe(Ys[s],i);break;case"source":Qe("error",i);break;case"img":case"image":case"link":Qe("error",i),Qe("load",i);break;case"details":Qe("toggle",i);break;case"input":Qe("invalid",i),$d(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Qe("invalid",i);break;case"textarea":Qe("invalid",i),Yd(i,o.value,o.defaultValue,o.children)}s=o.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||i.textContent===""+s||o.suppressHydrationWarning===!0||Jg(i.textContent,s)?(o.popover!=null&&(Qe("beforetoggle",i),Qe("toggle",i)),o.onScroll!=null&&Qe("scroll",i),o.onScrollEnd!=null&&Qe("scrollend",i),o.onClick!=null&&(i.onclick=kr),i=!0):i=!1,i||ni(t,!0)}function Rm(t){for(Xt=t.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:Fn=!1;return;case 27:case 3:Fn=!0;return;default:Xt=Xt.return}}function ba(t){if(t!==Xt)return!1;if(!et)return Rm(t),et=!0,!1;var i=t.tag,s;if((s=i!==3&&i!==27)&&((s=i===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||Rf(t.type,t.memoizedProps)),s=!s),s&&_t&&ni(t),Rm(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));_t=ry(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));_t=ry(t)}else i===27?(i=_t,gi(t.type)?(t=Uf,Uf=null,_t=t):_t=i):_t=Xt?Gn(t.stateNode.nextSibling):null;return!0}function Hi(){_t=Xt=null,et=!1}function mc(){var t=ti;return t!==null&&(pn===null?pn=t:pn.push.apply(pn,t),ti=null),t}function Es(t){ti===null?ti=[t]:ti.push(t)}var pc=M(null),Ii=null,jr=null;function ri(t,i,s){S(pc,i._currentValue),i._currentValue=s}function Or(t){t._currentValue=pc.current,W(pc)}function gc(t,i,s){for(;t!==null;){var o=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),t===s)break;t=t.return}}function yc(t,i,s,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 _=p;p=h;for(var P=0;P<i.length;P++)if(_.context===i[P]){p.lanes|=s,_=p.alternate,_!==null&&(_.lanes|=s),gc(p.return,s,t),o||(v=null);break e}p=_.next}}else if(h.tag===18){if(v=h.return,v===null)throw Error(a(341));v.lanes|=s,p=v.alternate,p!==null&&(p.lanes|=s),gc(v,s,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 va(t,i,s,o){t=null;for(var h=i,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var v=h.alternate;if(v===null)throw Error(a(387));if(v=v.memoizedProps,v!==null){var _=h.type;xn(h.pendingProps.value,v.value)||(t!==null?t.push(_):t=[_])}}else if(h===Te.current){if(v=h.alternate,v===null)throw Error(a(387));v.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(Ks):t=[Ks])}h=h.return}t!==null&&yc(i,t,s,o),i.flags|=262144}function Wl(t){for(t=t.firstContext;t!==null;){if(!xn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Fi(t){Ii=t,jr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Qt(t){return Mm(Ii,t)}function eo(t,i){return Ii===null&&Fi(t),Mm(t,i)}function Mm(t,i){var s=i._currentValue;if(i={context:i,memoizedValue:s,next:null},jr===null){if(t===null)throw Error(a(308));jr=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else jr=jr.next=i;return s}var rx=typeof AbortController<"u"?AbortController:function(){var t=[],i=this.signal={aborted:!1,addEventListener:function(s,o){t.push(o)}};this.abort=function(){i.aborted=!0,t.forEach(function(s){return s()})}},ix=e.unstable_scheduleCallback,ax=e.unstable_NormalPriority,Ut={$$typeof:V,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bc(){return{controller:new rx,data:new Map,refCount:0}}function ks(t){t.refCount--,t.refCount===0&&ix(ax,function(){t.controller.abort()})}var As=null,vc=0,xa=0,wa=null;function sx(t,i){if(As===null){var s=As=[];vc=0,xa=_f(),wa={status:"pending",value:void 0,then:function(o){s.push(o)}}}return vc++,i.then(Dm,Dm),i}function Dm(){if(--vc===0&&As!==null){wa!==null&&(wa.status="fulfilled");var t=As;As=null,xa=0,wa=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function lx(t,i){var s=[],o={status:"pending",value:null,reason:null,then:function(h){s.push(h)}};return t.then(function(){o.status="fulfilled",o.value=i;for(var h=0;h<s.length;h++)(0,s[h])(i)},function(h){for(o.status="rejected",o.reason=h,h=0;h<s.length;h++)(0,s[h])(void 0)}),o}var zm=I.S;I.S=function(t,i){bg=vt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&sx(t,i),zm!==null&&zm(t,i)};var $i=M(null);function xc(){var t=$i.current;return t!==null?t:yt.pooledCache}function to(t,i){i===null?S($i,$i.current):S($i,i.pool)}function Lm(){var t=xc();return t===null?null:{parent:Ut._currentValue,pool:t}}var Sa=Error(a(460)),wc=Error(a(474)),no=Error(a(542)),ro={then:function(){}};function Um(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Bm(t,i,s){switch(s=t[s],s===void 0?t.push(i):s!==i&&(i.then(kr,kr),i=s),i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,qm(t),t;default:if(typeof i.status=="string")i.then(kr,kr);else{if(t=yt,t!==null&&100<t.shellSuspendCounter)throw Error(a(482));t=i,t.status="pending",t.then(function(o){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=o}},function(o){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=o}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,qm(t),t}throw Yi=i,Sa}}function Gi(t){try{var i=t._init;return i(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Yi=s,Sa):s}}var Yi=null;function Pm(){if(Yi===null)throw Error(a(459));var t=Yi;return Yi=null,t}function qm(t){if(t===Sa||t===no)throw Error(a(483))}var _a=null,Cs=0;function io(t){var i=Cs;return Cs+=1,_a===null&&(_a=[]),Bm(_a,t,i)}function Ts(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function ao(t,i){throw i.$$typeof===b?Error(a(525)):(t=Object.prototype.toString.call(i),Error(a(31,t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)))}function Hm(t){function i(Q,F){if(t){var ee=Q.deletions;ee===null?(Q.deletions=[F],Q.flags|=16):ee.push(F)}}function s(Q,F){if(!t)return null;for(;F!==null;)i(Q,F),F=F.sibling;return null}function o(Q){for(var F=new Map;Q!==null;)Q.key!==null?F.set(Q.key,Q):F.set(Q.index,Q),Q=Q.sibling;return F}function h(Q,F){return Q=Cr(Q,F),Q.index=0,Q.sibling=null,Q}function p(Q,F,ee){return Q.index=ee,t?(ee=Q.alternate,ee!==null?(ee=ee.index,ee<F?(Q.flags|=67108866,F):ee):(Q.flags|=67108866,F)):(Q.flags|=1048576,F)}function v(Q){return t&&Q.alternate===null&&(Q.flags|=67108866),Q}function _(Q,F,ee,ce){return F===null||F.tag!==6?(F=uc(ee,Q.mode,ce),F.return=Q,F):(F=h(F,ee),F.return=Q,F)}function P(Q,F,ee,ce){var De=ee.type;return De===L?le(Q,F,ee.props.children,ce,ee.key):F!==null&&(F.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===J&&Gi(De)===F.type)?(F=h(F,ee.props),Ts(F,ee),F.return=Q,F):(F=Kl(ee.type,ee.key,ee.props,null,Q.mode,ce),Ts(F,ee),F.return=Q,F)}function te(Q,F,ee,ce){return F===null||F.tag!==4||F.stateNode.containerInfo!==ee.containerInfo||F.stateNode.implementation!==ee.implementation?(F=cc(ee,Q.mode,ce),F.return=Q,F):(F=h(F,ee.children||[]),F.return=Q,F)}function le(Q,F,ee,ce,De){return F===null||F.tag!==7?(F=qi(ee,Q.mode,ce,De),F.return=Q,F):(F=h(F,ee),F.return=Q,F)}function pe(Q,F,ee){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return F=uc(""+F,Q.mode,ee),F.return=Q,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case x:return ee=Kl(F.type,F.key,F.props,null,Q.mode,ee),Ts(ee,F),ee.return=Q,ee;case k:return F=cc(F,Q.mode,ee),F.return=Q,F;case J:return F=Gi(F),pe(Q,F,ee)}if(q(F)||K(F))return F=qi(F,Q.mode,ee,null),F.return=Q,F;if(typeof F.then=="function")return pe(Q,io(F),ee);if(F.$$typeof===V)return pe(Q,eo(Q,F),ee);ao(Q,F)}return null}function ne(Q,F,ee,ce){var De=F!==null?F.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return De!==null?null:_(Q,F,""+ee,ce);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case x:return ee.key===De?P(Q,F,ee,ce):null;case k:return ee.key===De?te(Q,F,ee,ce):null;case J:return ee=Gi(ee),ne(Q,F,ee,ce)}if(q(ee)||K(ee))return De!==null?null:le(Q,F,ee,ce,null);if(typeof ee.then=="function")return ne(Q,F,io(ee),ce);if(ee.$$typeof===V)return ne(Q,F,eo(Q,ee),ce);ao(Q,ee)}return null}function ie(Q,F,ee,ce,De){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return Q=Q.get(ee)||null,_(F,Q,""+ce,De);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case x:return Q=Q.get(ce.key===null?ee:ce.key)||null,P(F,Q,ce,De);case k:return Q=Q.get(ce.key===null?ee:ce.key)||null,te(F,Q,ce,De);case J:return ce=Gi(ce),ie(Q,F,ee,ce,De)}if(q(ce)||K(ce))return Q=Q.get(ee)||null,le(F,Q,ce,De,null);if(typeof ce.then=="function")return ie(Q,F,ee,io(ce),De);if(ce.$$typeof===V)return ie(Q,F,ee,eo(F,ce),De);ao(F,ce)}return null}function Ne(Q,F,ee,ce){for(var De=null,at=null,Re=F,Ge=F=0,We=null;Re!==null&&Ge<ee.length;Ge++){Re.index>Ge?(We=Re,Re=null):We=Re.sibling;var st=ne(Q,Re,ee[Ge],ce);if(st===null){Re===null&&(Re=We);break}t&&Re&&st.alternate===null&&i(Q,Re),F=p(st,F,Ge),at===null?De=st:at.sibling=st,at=st,Re=We}if(Ge===ee.length)return s(Q,Re),et&&Tr(Q,Ge),De;if(Re===null){for(;Ge<ee.length;Ge++)Re=pe(Q,ee[Ge],ce),Re!==null&&(F=p(Re,F,Ge),at===null?De=Re:at.sibling=Re,at=Re);return et&&Tr(Q,Ge),De}for(Re=o(Re);Ge<ee.length;Ge++)We=ie(Re,Q,Ge,ee[Ge],ce),We!==null&&(t&&We.alternate!==null&&Re.delete(We.key===null?Ge:We.key),F=p(We,F,Ge),at===null?De=We:at.sibling=We,at=We);return t&&Re.forEach(function(wi){return i(Q,wi)}),et&&Tr(Q,Ge),De}function Ue(Q,F,ee,ce){if(ee==null)throw Error(a(151));for(var De=null,at=null,Re=F,Ge=F=0,We=null,st=ee.next();Re!==null&&!st.done;Ge++,st=ee.next()){Re.index>Ge?(We=Re,Re=null):We=Re.sibling;var wi=ne(Q,Re,st.value,ce);if(wi===null){Re===null&&(Re=We);break}t&&Re&&wi.alternate===null&&i(Q,Re),F=p(wi,F,Ge),at===null?De=wi:at.sibling=wi,at=wi,Re=We}if(st.done)return s(Q,Re),et&&Tr(Q,Ge),De;if(Re===null){for(;!st.done;Ge++,st=ee.next())st=pe(Q,st.value,ce),st!==null&&(F=p(st,F,Ge),at===null?De=st:at.sibling=st,at=st);return et&&Tr(Q,Ge),De}for(Re=o(Re);!st.done;Ge++,st=ee.next())st=ie(Re,Q,Ge,st.value,ce),st!==null&&(t&&st.alternate!==null&&Re.delete(st.key===null?Ge:st.key),F=p(st,F,Ge),at===null?De=st:at.sibling=st,at=st);return t&&Re.forEach(function(bw){return i(Q,bw)}),et&&Tr(Q,Ge),De}function mt(Q,F,ee,ce){if(typeof ee=="object"&&ee!==null&&ee.type===L&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case x:e:{for(var De=ee.key;F!==null;){if(F.key===De){if(De=ee.type,De===L){if(F.tag===7){s(Q,F.sibling),ce=h(F,ee.props.children),ce.return=Q,Q=ce;break e}}else if(F.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===J&&Gi(De)===F.type){s(Q,F.sibling),ce=h(F,ee.props),Ts(ce,ee),ce.return=Q,Q=ce;break e}s(Q,F);break}else i(Q,F);F=F.sibling}ee.type===L?(ce=qi(ee.props.children,Q.mode,ce,ee.key),ce.return=Q,Q=ce):(ce=Kl(ee.type,ee.key,ee.props,null,Q.mode,ce),Ts(ce,ee),ce.return=Q,Q=ce)}return v(Q);case k:e:{for(De=ee.key;F!==null;){if(F.key===De)if(F.tag===4&&F.stateNode.containerInfo===ee.containerInfo&&F.stateNode.implementation===ee.implementation){s(Q,F.sibling),ce=h(F,ee.children||[]),ce.return=Q,Q=ce;break e}else{s(Q,F);break}else i(Q,F);F=F.sibling}ce=cc(ee,Q.mode,ce),ce.return=Q,Q=ce}return v(Q);case J:return ee=Gi(ee),mt(Q,F,ee,ce)}if(q(ee))return Ne(Q,F,ee,ce);if(K(ee)){if(De=K(ee),typeof De!="function")throw Error(a(150));return ee=De.call(ee),Ue(Q,F,ee,ce)}if(typeof ee.then=="function")return mt(Q,F,io(ee),ce);if(ee.$$typeof===V)return mt(Q,F,eo(Q,ee),ce);ao(Q,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,F!==null&&F.tag===6?(s(Q,F.sibling),ce=h(F,ee),ce.return=Q,Q=ce):(s(Q,F),ce=uc(ee,Q.mode,ce),ce.return=Q,Q=ce),v(Q)):s(Q,F)}return function(Q,F,ee,ce){try{Cs=0;var De=mt(Q,F,ee,ce);return _a=null,De}catch(Re){if(Re===Sa||Re===no)throw Re;var at=wn(29,Re,null,Q.mode);return at.lanes=ce,at.return=Q,at}finally{}}}var Vi=Hm(!0),Im=Hm(!1),ii=!1;function Sc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _c(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 ai(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function si(t,i,s){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(lt&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=Ql(t),km(t,null,s),i}return Xl(t,o,i,s),Ql(t)}function js(t,i,s){if(i=i.updateQueue,i!==null&&(i=i.shared,(s&4194048)!==0)){var o=i.lanes;o&=t.pendingLanes,s|=o,i.lanes=s,Mi(t,s)}}function Ec(t,i){var s=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,s===o)){var h=null,p=null;if(s=s.firstBaseUpdate,s!==null){do{var v={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};p===null?h=p=v:p=p.next=v,s=s.next}while(s!==null);p===null?h=p=i:p=p.next=i}else h=p=i;s={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=i:t.next=i,s.lastBaseUpdate=i}var kc=!1;function Os(){if(kc){var t=wa;if(t!==null)throw t}}function Ns(t,i,s,o){kc=!1;var h=t.updateQueue;ii=!1;var p=h.firstBaseUpdate,v=h.lastBaseUpdate,_=h.shared.pending;if(_!==null){h.shared.pending=null;var P=_,te=P.next;P.next=null,v===null?p=te:v.next=te,v=P;var le=t.alternate;le!==null&&(le=le.updateQueue,_=le.lastBaseUpdate,_!==v&&(_===null?le.firstBaseUpdate=te:_.next=te,le.lastBaseUpdate=P))}if(p!==null){var pe=h.baseState;v=0,le=te=P=null,_=p;do{var ne=_.lane&-536870913,ie=ne!==_.lane;if(ie?(Ze&ne)===ne:(o&ne)===ne){ne!==0&&ne===xa&&(kc=!0),le!==null&&(le=le.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Ne=t,Ue=_;ne=i;var mt=s;switch(Ue.tag){case 1:if(Ne=Ue.payload,typeof Ne=="function"){pe=Ne.call(mt,pe,ne);break e}pe=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Ue.payload,ne=typeof Ne=="function"?Ne.call(mt,pe,ne):Ne,ne==null)break e;pe=g({},pe,ne);break e;case 2:ii=!0}}ne=_.callback,ne!==null&&(t.flags|=64,ie&&(t.flags|=8192),ie=h.callbacks,ie===null?h.callbacks=[ne]:ie.push(ne))}else ie={lane:ne,tag:_.tag,payload:_.payload,callback:_.callback,next:null},le===null?(te=le=ie,P=pe):le=le.next=ie,v|=ne;if(_=_.next,_===null){if(_=h.shared.pending,_===null)break;ie=_,_=ie.next,ie.next=null,h.lastBaseUpdate=ie,h.shared.pending=null}}while(!0);le===null&&(P=pe),h.baseState=P,h.firstBaseUpdate=te,h.lastBaseUpdate=le,p===null&&(h.shared.lanes=0),fi|=v,t.lanes=v,t.memoizedState=pe}}function Fm(t,i){if(typeof t!="function")throw Error(a(191,t));t.call(i)}function $m(t,i){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)Fm(s[t],i)}var Ea=M(null),so=M(0);function Gm(t,i){t=Pr,S(so,t),S(Ea,i),Pr=t|i.baseLanes}function Ac(){S(so,Pr),S(Ea,Ea.current)}function Cc(){Pr=so.current,W(Ea),W(so)}var Sn=M(null),$n=null;function li(t){var i=t.alternate;S(Dt,Dt.current&1),S(Sn,t),$n===null&&(i===null||Ea.current!==null||i.memoizedState!==null)&&($n=t)}function Tc(t){S(Dt,Dt.current),S(Sn,t),$n===null&&($n=t)}function Ym(t){t.tag===22?(S(Dt,Dt.current),S(Sn,t),$n===null&&($n=t)):oi()}function oi(){S(Dt,Dt.current),S(Sn,Sn.current)}function _n(t){W(Sn),$n===t&&($n=null),W(Dt)}var Dt=M(0);function lo(t){for(var i=t;i!==null;){if(i.tag===13){var s=i.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||zf(s)||Lf(s)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Nr=0,$e=null,ht=null,Bt=null,oo=!1,ka=!1,Ji=!1,uo=0,Rs=0,Aa=null,ox=0;function Nt(){throw Error(a(321))}function jc(t,i){if(i===null)return!1;for(var s=0;s<i.length&&s<t.length;s++)if(!xn(t[s],i[s]))return!1;return!0}function Oc(t,i,s,o,h,p){return Nr=p,$e=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,I.H=t===null||t.memoizedState===null?jp:Gc,Ji=!1,p=s(o,h),Ji=!1,ka&&(p=Jm(i,s,o,h)),Vm(t),p}function Vm(t){I.H=zs;var i=ht!==null&&ht.next!==null;if(Nr=0,Bt=ht=$e=null,oo=!1,Rs=0,Aa=null,i)throw Error(a(300));t===null||Pt||(t=t.dependencies,t!==null&&Wl(t)&&(Pt=!0))}function Jm(t,i,s,o){$e=t;var h=0;do{if(ka&&(Aa=null),Rs=0,ka=!1,25<=h)throw Error(a(301));if(h+=1,Bt=ht=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}I.H=Op,p=i(s,o)}while(ka);return p}function ux(){var t=I.H,i=t.useState()[0];return i=typeof i.then=="function"?Ms(i):i,t=t.useState()[0],(ht!==null?ht.memoizedState:null)!==t&&($e.flags|=1024),i}function Nc(){var t=uo!==0;return uo=0,t}function Rc(t,i,s){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~s}function Mc(t){if(oo){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}oo=!1}Nr=0,Bt=ht=$e=null,ka=!1,Rs=uo=0,Aa=null}function sn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?$e.memoizedState=Bt=t:Bt=Bt.next=t,Bt}function zt(){if(ht===null){var t=$e.alternate;t=t!==null?t.memoizedState:null}else t=ht.next;var i=Bt===null?$e.memoizedState:Bt.next;if(i!==null)Bt=i,ht=t;else{if(t===null)throw $e.alternate===null?Error(a(467)):Error(a(310));ht=t,t={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},Bt===null?$e.memoizedState=Bt=t:Bt=Bt.next=t}return Bt}function co(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ms(t){var i=Rs;return Rs+=1,Aa===null&&(Aa=[]),t=Bm(Aa,t,i),i=$e,(Bt===null?i.memoizedState:Bt.next)===null&&(i=i.alternate,I.H=i===null||i.memoizedState===null?jp:Gc),t}function fo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ms(t);if(t.$$typeof===V)return Qt(t)}throw Error(a(438,String(t)))}function Dc(t){var i=null,s=$e.updateQueue;if(s!==null&&(i=s.memoCache),i==null){var o=$e.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),s===null&&(s=co(),$e.updateQueue=s),s.memoCache=i,s=i.data[i.index],s===void 0)for(s=i.data[i.index]=Array(t),o=0;o<t;o++)s[o]=T;return i.index++,s}function Rr(t,i){return typeof i=="function"?i(t):i}function ho(t){var i=zt();return zc(i,ht,t)}function zc(t,i,s){var o=t.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=s;var h=t.baseQueue,p=o.pending;if(p!==null){if(h!==null){var 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 _=v=null,P=null,te=i,le=!1;do{var pe=te.lane&-536870913;if(pe!==te.lane?(Ze&pe)===pe:(Nr&pe)===pe){var ne=te.revertLane;if(ne===0)P!==null&&(P=P.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),pe===xa&&(le=!0);else if((Nr&ne)===ne){te=te.next,ne===xa&&(le=!0);continue}else pe={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},P===null?(_=P=pe,v=p):P=P.next=pe,$e.lanes|=ne,fi|=ne;pe=te.action,Ji&&s(p,pe),p=te.hasEagerState?te.eagerState:s(p,pe)}else ne={lane:pe,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},P===null?(_=P=ne,v=p):P=P.next=ne,$e.lanes|=pe,fi|=pe;te=te.next}while(te!==null&&te!==i);if(P===null?v=p:P.next=_,!xn(p,t.memoizedState)&&(Pt=!0,le&&(s=wa,s!==null)))throw s;t.memoizedState=p,t.baseState=v,t.baseQueue=P,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Lc(t){var i=zt(),s=i.queue;if(s===null)throw Error(a(311));s.lastRenderedReducer=t;var o=s.dispatch,h=s.pending,p=i.memoizedState;if(h!==null){s.pending=null;var v=h=h.next;do p=t(p,v.action),v=v.next;while(v!==h);xn(p,i.memoizedState)||(Pt=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),s.lastRenderedState=p}return[p,o]}function Xm(t,i,s){var o=$e,h=zt(),p=et;if(p){if(s===void 0)throw Error(a(407));s=s()}else s=i();var v=!xn((ht||h).memoizedState,s);if(v&&(h.memoizedState=s,Pt=!0),h=h.queue,Pc(Zm.bind(null,o,h,t),[t]),h.getSnapshot!==i||v||Bt!==null&&Bt.memoizedState.tag&1){if(o.flags|=2048,Ca(9,{destroy:void 0},Km.bind(null,o,h,s,i),null),yt===null)throw Error(a(349));p||(Nr&127)!==0||Qm(o,i,s)}return s}function Qm(t,i,s){t.flags|=16384,t={getSnapshot:i,value:s},i=$e.updateQueue,i===null?(i=co(),$e.updateQueue=i,i.stores=[t]):(s=i.stores,s===null?i.stores=[t]:s.push(t))}function Km(t,i,s,o){i.value=s,i.getSnapshot=o,Wm(i)&&ep(t)}function Zm(t,i,s){return s(function(){Wm(i)&&ep(t)})}function Wm(t){var i=t.getSnapshot;t=t.value;try{var s=i();return!xn(t,s)}catch{return!0}}function ep(t){var i=Pi(t,2);i!==null&&gn(i,t,2)}function Uc(t){var i=sn();if(typeof t=="function"){var s=t;if(t=s(),Ji){It(!0);try{s()}finally{It(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rr,lastRenderedState:t},i}function tp(t,i,s,o){return t.baseState=s,zc(t,ht,typeof o=="function"?o:Rr)}function cx(t,i,s,o,h){if(go(t))throw Error(a(485));if(t=i.action,t!==null){var p={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){p.listeners.push(v)}};I.T!==null?s(!0):p.isTransition=!1,o(p),s=i.pending,s===null?(p.next=i.pending=p,np(i,p)):(p.next=s.next,i.pending=s.next=p)}}function np(t,i){var s=i.action,o=i.payload,h=t.state;if(i.isTransition){var p=I.T,v={};I.T=v;try{var _=s(h,o),P=I.S;P!==null&&P(v,_),rp(t,i,_)}catch(te){Bc(t,i,te)}finally{p!==null&&v.types!==null&&(p.types=v.types),I.T=p}}else try{p=s(h,o),rp(t,i,p)}catch(te){Bc(t,i,te)}}function rp(t,i,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(o){ip(t,i,o)},function(o){return Bc(t,i,o)}):ip(t,i,s)}function ip(t,i,s){i.status="fulfilled",i.value=s,ap(i),t.state=s,i=t.pending,i!==null&&(s=i.next,s===i?t.pending=null:(s=s.next,i.next=s,np(t,s)))}function Bc(t,i,s){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=s,ap(i),i=i.next;while(i!==o)}t.action=null}function ap(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function sp(t,i){return i}function lp(t,i){if(et){var s=yt.formState;if(s!==null){e:{var o=$e;if(et){if(_t){t:{for(var h=_t,p=Fn;h.nodeType!==8;){if(!p){h=null;break t}if(h=Gn(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){_t=Gn(h.nextSibling),o=h.data==="F!";break e}}ni(o)}o=!1}o&&(i=s[0])}}return s=sn(),s.memoizedState=s.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sp,lastRenderedState:i},s.queue=o,s=Ap.bind(null,$e,o),o.dispatch=s,o=Uc(!1),p=$c.bind(null,$e,!1,o.queue),o=sn(),h={state:i,dispatch:null,action:t,pending:null},o.queue=h,s=cx.bind(null,$e,h,p,s),h.dispatch=s,o.memoizedState=t,[i,s,!1]}function op(t){var i=zt();return up(i,ht,t)}function up(t,i,s){if(i=zc(t,i,sp)[0],t=ho(Rr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Ms(i)}catch(v){throw v===Sa?no:v}else o=i;i=zt();var h=i.queue,p=h.dispatch;return s!==i.memoizedState&&($e.flags|=2048,Ca(9,{destroy:void 0},fx.bind(null,h,s),null)),[o,p,t]}function fx(t,i){t.action=i}function cp(t){var i=zt(),s=ht;if(s!==null)return up(i,s,t);zt(),i=i.memoizedState,s=zt();var o=s.queue.dispatch;return s.memoizedState=t,[i,o,!1]}function Ca(t,i,s,o){return t={tag:t,create:s,deps:o,inst:i,next:null},i=$e.updateQueue,i===null&&(i=co(),$e.updateQueue=i),s=i.lastEffect,s===null?i.lastEffect=t.next=t:(o=s.next,s.next=t,t.next=o,i.lastEffect=t),t}function fp(){return zt().memoizedState}function mo(t,i,s,o){var h=sn();$e.flags|=t,h.memoizedState=Ca(1|i,{destroy:void 0},s,o===void 0?null:o)}function po(t,i,s,o){var h=zt();o=o===void 0?null:o;var p=h.memoizedState.inst;ht!==null&&o!==null&&jc(o,ht.memoizedState.deps)?h.memoizedState=Ca(i,p,s,o):($e.flags|=t,h.memoizedState=Ca(1|i,p,s,o))}function hp(t,i){mo(8390656,8,t,i)}function Pc(t,i){po(2048,8,t,i)}function hx(t){$e.flags|=4;var i=$e.updateQueue;if(i===null)i=co(),$e.updateQueue=i,i.events=[t];else{var s=i.events;s===null?i.events=[t]:s.push(t)}}function dp(t){var i=zt().memoizedState;return hx({ref:i,nextImpl:t}),function(){if((lt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function mp(t,i){return po(4,2,t,i)}function pp(t,i){return po(4,4,t,i)}function gp(t,i){if(typeof i=="function"){t=t();var s=i(t);return function(){typeof s=="function"?s():i(null)}}if(i!=null)return t=t(),i.current=t,function(){i.current=null}}function yp(t,i,s){s=s!=null?s.concat([t]):null,po(4,4,gp.bind(null,i,t),s)}function qc(){}function bp(t,i){var s=zt();i=i===void 0?null:i;var o=s.memoizedState;return i!==null&&jc(i,o[1])?o[0]:(s.memoizedState=[t,i],t)}function vp(t,i){var s=zt();i=i===void 0?null:i;var o=s.memoizedState;if(i!==null&&jc(i,o[1]))return o[0];if(o=t(),Ji){It(!0);try{t()}finally{It(!1)}}return s.memoizedState=[o,i],o}function Hc(t,i,s){return s===void 0||(Nr&1073741824)!==0&&(Ze&261930)===0?t.memoizedState=i:(t.memoizedState=s,t=xg(),$e.lanes|=t,fi|=t,s)}function xp(t,i,s,o){return xn(s,i)?s:Ea.current!==null?(t=Hc(t,s,o),xn(t,i)||(Pt=!0),t):(Nr&42)===0||(Nr&1073741824)!==0&&(Ze&261930)===0?(Pt=!0,t.memoizedState=s):(t=xg(),$e.lanes|=t,fi|=t,i)}function wp(t,i,s,o,h){var p=ae.p;ae.p=p!==0&&8>p?p:8;var v=I.T,_={};I.T=_,$c(t,!1,i,s);try{var P=h(),te=I.S;if(te!==null&&te(_,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var le=lx(P,o);Ds(t,i,le,An(t))}else Ds(t,i,o,An(t))}catch(pe){Ds(t,i,{then:function(){},status:"rejected",reason:pe},An())}finally{ae.p=p,v!==null&&_.types!==null&&(v.types=_.types),I.T=v}}function dx(){}function Ic(t,i,s,o){if(t.tag!==5)throw Error(a(476));var h=Sp(t).queue;wp(t,h,i,ge,s===null?dx:function(){return _p(t),s(o)})}function Sp(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:ge,baseState:ge,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rr,lastRenderedState:ge},next:null};var s={};return i.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rr,lastRenderedState:s},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function _p(t){var i=Sp(t);i.next===null&&(i=t.alternate.memoizedState),Ds(t,i.next.queue,{},An())}function Fc(){return Qt(Ks)}function Ep(){return zt().memoizedState}function kp(){return zt().memoizedState}function mx(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var s=An();t=ai(s);var o=si(i,t,s);o!==null&&(gn(o,i,s),js(o,i,s)),i={cache:bc()},t.payload=i;return}i=i.return}}function px(t,i,s){var o=An();s={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},go(t)?Cp(i,s):(s=lc(t,i,s,o),s!==null&&(gn(s,t,o),Tp(s,i,o)))}function Ap(t,i,s){var o=An();Ds(t,i,s,o)}function Ds(t,i,s,o){var h={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(go(t))Cp(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,_=p(v,s);if(h.hasEagerState=!0,h.eagerState=_,xn(_,v))return Xl(t,i,h,0),yt===null&&Jl(),!1}catch{}finally{}if(s=lc(t,i,h,o),s!==null)return gn(s,t,o),Tp(s,i,o),!0}return!1}function $c(t,i,s,o){if(o={lane:2,revertLane:_f(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},go(t)){if(i)throw Error(a(479))}else i=lc(t,s,o,2),i!==null&&gn(i,t,2)}function go(t){var i=t.alternate;return t===$e||i!==null&&i===$e}function Cp(t,i){ka=oo=!0;var s=t.pending;s===null?i.next=i:(i.next=s.next,s.next=i),t.pending=i}function Tp(t,i,s){if((s&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,s|=o,i.lanes=s,Mi(t,s)}}var zs={readContext:Qt,use:fo,useCallback:Nt,useContext:Nt,useEffect:Nt,useImperativeHandle:Nt,useLayoutEffect:Nt,useInsertionEffect:Nt,useMemo:Nt,useReducer:Nt,useRef:Nt,useState:Nt,useDebugValue:Nt,useDeferredValue:Nt,useTransition:Nt,useSyncExternalStore:Nt,useId:Nt,useHostTransitionStatus:Nt,useFormState:Nt,useActionState:Nt,useOptimistic:Nt,useMemoCache:Nt,useCacheRefresh:Nt};zs.useEffectEvent=Nt;var jp={readContext:Qt,use:fo,useCallback:function(t,i){return sn().memoizedState=[t,i===void 0?null:i],t},useContext:Qt,useEffect:hp,useImperativeHandle:function(t,i,s){s=s!=null?s.concat([t]):null,mo(4194308,4,gp.bind(null,i,t),s)},useLayoutEffect:function(t,i){return mo(4194308,4,t,i)},useInsertionEffect:function(t,i){mo(4,2,t,i)},useMemo:function(t,i){var s=sn();i=i===void 0?null:i;var o=t();if(Ji){It(!0);try{t()}finally{It(!1)}}return s.memoizedState=[o,i],o},useReducer:function(t,i,s){var o=sn();if(s!==void 0){var h=s(i);if(Ji){It(!0);try{s(i)}finally{It(!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=px.bind(null,$e,t),[o.memoizedState,t]},useRef:function(t){var i=sn();return t={current:t},i.memoizedState=t},useState:function(t){t=Uc(t);var i=t.queue,s=Ap.bind(null,$e,i);return i.dispatch=s,[t.memoizedState,s]},useDebugValue:qc,useDeferredValue:function(t,i){var s=sn();return Hc(s,t,i)},useTransition:function(){var t=Uc(!1);return t=wp.bind(null,$e,t.queue,!0,!1),sn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,s){var o=$e,h=sn();if(et){if(s===void 0)throw Error(a(407));s=s()}else{if(s=i(),yt===null)throw Error(a(349));(Ze&127)!==0||Qm(o,i,s)}h.memoizedState=s;var p={value:s,getSnapshot:i};return h.queue=p,hp(Zm.bind(null,o,p,t),[t]),o.flags|=2048,Ca(9,{destroy:void 0},Km.bind(null,o,p,s,i),null),s},useId:function(){var t=sn(),i=yt.identifierPrefix;if(et){var s=ur,o=or;s=(o&~(1<<32-ot(o)-1)).toString(32)+s,i="_"+i+"R_"+s,s=uo++,0<s&&(i+="H"+s.toString(32)),i+="_"}else s=ox++,i="_"+i+"r_"+s.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:Fc,useFormState:lp,useActionState:lp,useOptimistic:function(t){var i=sn();i.memoizedState=i.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=s,i=$c.bind(null,$e,!0,s),s.dispatch=i,[t,i]},useMemoCache:Dc,useCacheRefresh:function(){return sn().memoizedState=mx.bind(null,$e)},useEffectEvent:function(t){var i=sn(),s={impl:t};return i.memoizedState=s,function(){if((lt&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}},Gc={readContext:Qt,use:fo,useCallback:bp,useContext:Qt,useEffect:Pc,useImperativeHandle:yp,useInsertionEffect:mp,useLayoutEffect:pp,useMemo:vp,useReducer:ho,useRef:fp,useState:function(){return ho(Rr)},useDebugValue:qc,useDeferredValue:function(t,i){var s=zt();return xp(s,ht.memoizedState,t,i)},useTransition:function(){var t=ho(Rr)[0],i=zt().memoizedState;return[typeof t=="boolean"?t:Ms(t),i]},useSyncExternalStore:Xm,useId:Ep,useHostTransitionStatus:Fc,useFormState:op,useActionState:op,useOptimistic:function(t,i){var s=zt();return tp(s,ht,t,i)},useMemoCache:Dc,useCacheRefresh:kp};Gc.useEffectEvent=dp;var Op={readContext:Qt,use:fo,useCallback:bp,useContext:Qt,useEffect:Pc,useImperativeHandle:yp,useInsertionEffect:mp,useLayoutEffect:pp,useMemo:vp,useReducer:Lc,useRef:fp,useState:function(){return Lc(Rr)},useDebugValue:qc,useDeferredValue:function(t,i){var s=zt();return ht===null?Hc(s,t,i):xp(s,ht.memoizedState,t,i)},useTransition:function(){var t=Lc(Rr)[0],i=zt().memoizedState;return[typeof t=="boolean"?t:Ms(t),i]},useSyncExternalStore:Xm,useId:Ep,useHostTransitionStatus:Fc,useFormState:cp,useActionState:cp,useOptimistic:function(t,i){var s=zt();return ht!==null?tp(s,ht,t,i):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:Dc,useCacheRefresh:kp};Op.useEffectEvent=dp;function Yc(t,i,s,o){i=t.memoizedState,s=s(o,i),s=s==null?i:g({},i,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var Vc={enqueueSetState:function(t,i,s){t=t._reactInternals;var o=An(),h=ai(o);h.payload=i,s!=null&&(h.callback=s),i=si(t,h,o),i!==null&&(gn(i,t,o),js(i,t,o))},enqueueReplaceState:function(t,i,s){t=t._reactInternals;var o=An(),h=ai(o);h.tag=1,h.payload=i,s!=null&&(h.callback=s),i=si(t,h,o),i!==null&&(gn(i,t,o),js(i,t,o))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var s=An(),o=ai(s);o.tag=2,i!=null&&(o.callback=i),i=si(t,o,s),i!==null&&(gn(i,t,s),js(i,t,s))}};function Np(t,i,s,o,h,p,v){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,p,v):i.prototype&&i.prototype.isPureReactComponent?!ws(s,o)||!ws(h,p):!0}function Rp(t,i,s,o){t=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(s,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(s,o),i.state!==t&&Vc.enqueueReplaceState(i,i.state,null)}function Xi(t,i){var s=i;if("ref"in i){s={};for(var o in i)o!=="ref"&&(s[o]=i[o])}if(t=t.defaultProps){s===i&&(s=g({},s));for(var h in t)s[h]===void 0&&(s[h]=t[h])}return s}function Mp(t){Vl(t)}function Dp(t){console.error(t)}function zp(t){Vl(t)}function yo(t,i){try{var s=t.onUncaughtError;s(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function Lp(t,i,s){try{var o=t.onCaughtError;o(s.value,{componentStack:s.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Jc(t,i,s){return s=ai(s),s.tag=3,s.payload={element:null},s.callback=function(){yo(t,i)},s}function Up(t){return t=ai(t),t.tag=3,t}function Bp(t,i,s,o){var h=s.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;t.payload=function(){return h(p)},t.callback=function(){Lp(i,s,o)}}var v=s.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(t.callback=function(){Lp(i,s,o),typeof h!="function"&&(hi===null?hi=new Set([this]):hi.add(this));var _=o.stack;this.componentDidCatch(o.value,{componentStack:_!==null?_:""})})}function gx(t,i,s,o,h){if(s.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=s.alternate,i!==null&&va(i,s,h,!0),s=Sn.current,s!==null){switch(s.tag){case 31:case 13:return $n===null?jo():s.alternate===null&&Rt===0&&(Rt=3),s.flags&=-257,s.flags|=65536,s.lanes=h,o===ro?s.flags|=16384:(i=s.updateQueue,i===null?s.updateQueue=new Set([o]):i.add(o),xf(t,o,h)),!1;case 22:return s.flags|=65536,o===ro?s.flags|=16384:(i=s.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},s.updateQueue=i):(s=i.retryQueue,s===null?i.retryQueue=new Set([o]):s.add(o)),xf(t,o,h)),!1}throw Error(a(435,s.tag))}return xf(t,o,h),jo(),!1}if(et)return i=Sn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==dc&&(t=Error(a(422),{cause:o}),Es(qn(t,s)))):(o!==dc&&(i=Error(a(423),{cause:o}),Es(qn(i,s))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=qn(o,s),h=Jc(t.stateNode,o,h),Ec(t,h),Rt!==4&&(Rt=2)),!1;var p=Error(a(520),{cause:o});if(p=qn(p,s),Fs===null?Fs=[p]:Fs.push(p),Rt!==4&&(Rt=2),i===null)return!0;o=qn(o,s),s=i;do{switch(s.tag){case 3:return s.flags|=65536,t=h&-h,s.lanes|=t,t=Jc(s.stateNode,o,t),Ec(s,t),!1;case 1:if(i=s.type,p=s.stateNode,(s.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(hi===null||!hi.has(p))))return s.flags|=65536,h&=-h,s.lanes|=h,h=Up(h),Bp(h,t,s,o),Ec(s,h),!1}s=s.return}while(s!==null);return!1}var Xc=Error(a(461)),Pt=!1;function Kt(t,i,s,o){i.child=t===null?Im(i,null,s,o):Vi(i,t.child,s,o)}function Pp(t,i,s,o,h){s=s.render;var p=i.ref;if("ref"in o){var v={};for(var _ in o)_!=="ref"&&(v[_]=o[_])}else v=o;return Fi(i),o=Oc(t,i,s,v,p,h),_=Nc(),t!==null&&!Pt?(Rc(t,i,h),Mr(t,i,h)):(et&&_&&fc(i),i.flags|=1,Kt(t,i,o,h),i.child)}function qp(t,i,s,o,h){if(t===null){var p=s.type;return typeof p=="function"&&!oc(p)&&p.defaultProps===void 0&&s.compare===null?(i.tag=15,i.type=p,Hp(t,i,p,o,h)):(t=Kl(s.type,null,o,i,i.mode,h),t.ref=i.ref,t.return=i,i.child=t)}if(p=t.child,!rf(t,h)){var v=p.memoizedProps;if(s=s.compare,s=s!==null?s:ws,s(v,o)&&t.ref===i.ref)return Mr(t,i,h)}return i.flags|=1,t=Cr(p,o),t.ref=i.ref,t.return=i,i.child=t}function Hp(t,i,s,o,h){if(t!==null){var p=t.memoizedProps;if(ws(p,o)&&t.ref===i.ref)if(Pt=!1,i.pendingProps=o=p,rf(t,h))(t.flags&131072)!==0&&(Pt=!0);else return i.lanes=t.lanes,Mr(t,i,h)}return Qc(t,i,s,o,h)}function Ip(t,i,s,o){var h=o.children,p=t!==null?t.memoizedState:null;if(t===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((i.flags&128)!==0){if(p=p!==null?p.baseLanes|s:s,t!==null){for(o=i.child=t.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,i.child=null;return Fp(t,i,p,s,o)}if((s&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&to(i,p!==null?p.cachePool:null),p!==null?Gm(i,p):Ac(),Ym(i);else return o=i.lanes=536870912,Fp(t,i,p!==null?p.baseLanes|s:s,s,o)}else p!==null?(to(i,p.cachePool),Gm(i,p),oi(),i.memoizedState=null):(t!==null&&to(i,null),Ac(),oi());return Kt(t,i,h,s),i.child}function Ls(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function Fp(t,i,s,o,h){var p=xc();return p=p===null?null:{parent:Ut._currentValue,pool:p},i.memoizedState={baseLanes:s,cachePool:p},t!==null&&to(i,null),Ac(),Ym(i),t!==null&&va(t,i,o,!0),i.childLanes=h,null}function bo(t,i){return i=xo({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function $p(t,i,s){return Vi(i,t.child,null,s),t=bo(i,i.pendingProps),t.flags|=2,_n(i),i.memoizedState=null,t}function yx(t,i,s){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(et){if(o.mode==="hidden")return t=bo(i,o),i.lanes=536870912,Ls(null,t);if(Tc(i),(t=_t)?(t=ny(t,Fn),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ei!==null?{id:or,overflow:ur}:null,retryLane:536870912,hydrationErrors:null},s=Cm(t),s.return=i,i.child=s,Xt=i,_t=null)):t=null,t===null)throw ni(i);return i.lanes=536870912,null}return bo(i,o)}var p=t.memoizedState;if(p!==null){var v=p.dehydrated;if(Tc(i),h)if(i.flags&256)i.flags&=-257,i=$p(t,i,s);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(a(558));else if(Pt||va(t,i,s,!1),h=(s&t.childLanes)!==0,Pt||h){if(o=yt,o!==null&&(v=Zr(o,s),v!==0&&v!==p.retryLane))throw p.retryLane=v,Pi(t,v),gn(o,t,v),Xc;jo(),i=$p(t,i,s)}else t=p.treeContext,_t=Gn(v.nextSibling),Xt=i,et=!0,ti=null,Fn=!1,t!==null&&Om(i,t),i=bo(i,o),i.flags|=4096;return i}return t=Cr(t.child,{mode:o.mode,children:o.children}),t.ref=i.ref,i.child=t,t.return=i,t}function vo(t,i){var s=i.ref;if(s===null)t!==null&&t.ref!==null&&(i.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(a(284));(t===null||t.ref!==s)&&(i.flags|=4194816)}}function Qc(t,i,s,o,h){return Fi(i),s=Oc(t,i,s,o,void 0,h),o=Nc(),t!==null&&!Pt?(Rc(t,i,h),Mr(t,i,h)):(et&&o&&fc(i),i.flags|=1,Kt(t,i,s,h),i.child)}function Gp(t,i,s,o,h,p){return Fi(i),i.updateQueue=null,s=Jm(i,o,s,h),Vm(t),o=Nc(),t!==null&&!Pt?(Rc(t,i,p),Mr(t,i,p)):(et&&o&&fc(i),i.flags|=1,Kt(t,i,s,p),i.child)}function Yp(t,i,s,o,h){if(Fi(i),i.stateNode===null){var p=pa,v=s.contextType;typeof v=="object"&&v!==null&&(p=Qt(v)),p=new s(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Vc,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},Sc(i),v=s.contextType,p.context=typeof v=="object"&&v!==null?Qt(v):pa,p.state=i.memoizedState,v=s.getDerivedStateFromProps,typeof v=="function"&&(Yc(i,s,v,o),p.state=i.memoizedState),typeof s.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&&Vc.enqueueReplaceState(p,p.state,null),Ns(i,o,p,h),Os(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(t===null){p=i.stateNode;var _=i.memoizedProps,P=Xi(s,_);p.props=P;var te=p.context,le=s.contextType;v=pa,typeof le=="object"&&le!==null&&(v=Qt(le));var pe=s.getDerivedStateFromProps;le=typeof pe=="function"||typeof p.getSnapshotBeforeUpdate=="function",_=i.pendingProps!==_,le||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(_||te!==v)&&Rp(i,p,o,v),ii=!1;var ne=i.memoizedState;p.state=ne,Ns(i,o,p,h),Os(),te=i.memoizedState,_||ne!==te||ii?(typeof pe=="function"&&(Yc(i,s,pe,o),te=i.memoizedState),(P=ii||Np(i,s,P,o,ne,te,v))?(le||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(i.flags|=4194308)):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=o,i.memoizedState=te),p.props=o,p.state=te,p.context=v,o=P):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,_c(t,i),v=i.memoizedProps,le=Xi(s,v),p.props=le,pe=i.pendingProps,ne=p.context,te=s.contextType,P=pa,typeof te=="object"&&te!==null&&(P=Qt(te)),_=s.getDerivedStateFromProps,(te=typeof _=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==pe||ne!==P)&&Rp(i,p,o,P),ii=!1,ne=i.memoizedState,p.state=ne,Ns(i,o,p,h),Os();var ie=i.memoizedState;v!==pe||ne!==ie||ii||t!==null&&t.dependencies!==null&&Wl(t.dependencies)?(typeof _=="function"&&(Yc(i,s,_,o),ie=i.memoizedState),(le=ii||Np(i,s,le,o,ne,ie,P)||t!==null&&t.dependencies!==null&&Wl(t.dependencies))?(te||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,ie,P),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,ie,P)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||v===t.memoizedProps&&ne===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===t.memoizedProps&&ne===t.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=ie),p.props=o,p.state=ie,p.context=P,o=le):(typeof p.componentDidUpdate!="function"||v===t.memoizedProps&&ne===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===t.memoizedProps&&ne===t.memoizedState||(i.flags|=1024),o=!1)}return p=o,vo(t,i),o=(i.flags&128)!==0,p||o?(p=i.stateNode,s=o&&typeof s.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,t!==null&&o?(i.child=Vi(i,t.child,null,h),i.child=Vi(i,null,s,h)):Kt(t,i,s,h),i.memoizedState=p.state,t=i.child):t=Mr(t,i,h),t}function Vp(t,i,s,o){return Hi(),i.flags|=256,Kt(t,i,s,o),i.child}var Kc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zc(t){return{baseLanes:t,cachePool:Lm()}}function Wc(t,i,s){return t=t!==null?t.childLanes&~s:0,i&&(t|=kn),t}function Jp(t,i,s){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,v;if((v=p)||(v=t!==null&&t.memoizedState===null?!1:(Dt.current&2)!==0),v&&(h=!0,i.flags&=-129),v=(i.flags&32)!==0,i.flags&=-33,t===null){if(et){if(h?li(i):oi(),(t=_t)?(t=ny(t,Fn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ei!==null?{id:or,overflow:ur}:null,retryLane:536870912,hydrationErrors:null},s=Cm(t),s.return=i,i.child=s,Xt=i,_t=null)):t=null,t===null)throw ni(i);return Lf(t)?i.lanes=32:i.lanes=536870912,null}var _=o.children;return o=o.fallback,h?(oi(),h=i.mode,_=xo({mode:"hidden",children:_},h),o=qi(o,h,s,null),_.return=i,o.return=i,_.sibling=o,i.child=_,o=i.child,o.memoizedState=Zc(s),o.childLanes=Wc(t,v,s),i.memoizedState=Kc,Ls(null,o)):(li(i),ef(i,_))}var P=t.memoizedState;if(P!==null&&(_=P.dehydrated,_!==null)){if(p)i.flags&256?(li(i),i.flags&=-257,i=tf(t,i,s)):i.memoizedState!==null?(oi(),i.child=t.child,i.flags|=128,i=null):(oi(),_=o.fallback,h=i.mode,o=xo({mode:"visible",children:o.children},h),_=qi(_,h,s,null),_.flags|=2,o.return=i,_.return=i,o.sibling=_,i.child=o,Vi(i,t.child,null,s),o=i.child,o.memoizedState=Zc(s),o.childLanes=Wc(t,v,s),i.memoizedState=Kc,i=Ls(null,o));else if(li(i),Lf(_)){if(v=_.nextSibling&&_.nextSibling.dataset,v)var te=v.dgst;v=te,o=Error(a(419)),o.stack="",o.digest=v,Es({value:o,source:null,stack:null}),i=tf(t,i,s)}else if(Pt||va(t,i,s,!1),v=(s&t.childLanes)!==0,Pt||v){if(v=yt,v!==null&&(o=Zr(v,s),o!==0&&o!==P.retryLane))throw P.retryLane=o,Pi(t,o),gn(v,t,o),Xc;zf(_)||jo(),i=tf(t,i,s)}else zf(_)?(i.flags|=192,i.child=t.child,i=null):(t=P.treeContext,_t=Gn(_.nextSibling),Xt=i,et=!0,ti=null,Fn=!1,t!==null&&Om(i,t),i=ef(i,o.children),i.flags|=4096);return i}return h?(oi(),_=o.fallback,h=i.mode,P=t.child,te=P.sibling,o=Cr(P,{mode:"hidden",children:o.children}),o.subtreeFlags=P.subtreeFlags&65011712,te!==null?_=Cr(te,_):(_=qi(_,h,s,null),_.flags|=2),_.return=i,o.return=i,o.sibling=_,i.child=o,Ls(null,o),o=i.child,_=t.child.memoizedState,_===null?_=Zc(s):(h=_.cachePool,h!==null?(P=Ut._currentValue,h=h.parent!==P?{parent:P,pool:P}:h):h=Lm(),_={baseLanes:_.baseLanes|s,cachePool:h}),o.memoizedState=_,o.childLanes=Wc(t,v,s),i.memoizedState=Kc,Ls(t.child,o)):(li(i),s=t.child,t=s.sibling,s=Cr(s,{mode:"visible",children:o.children}),s.return=i,s.sibling=null,t!==null&&(v=i.deletions,v===null?(i.deletions=[t],i.flags|=16):v.push(t)),i.child=s,i.memoizedState=null,s)}function ef(t,i){return i=xo({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function xo(t,i){return t=wn(22,t,null,i),t.lanes=0,t}function tf(t,i,s){return Vi(i,t.child,null,s),t=ef(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function Xp(t,i,s){t.lanes|=i;var o=t.alternate;o!==null&&(o.lanes|=i),gc(t.return,i,s)}function nf(t,i,s,o,h,p){var v=t.memoizedState;v===null?t.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:s,tailMode:h,treeForkCount:p}:(v.isBackwards=i,v.rendering=null,v.renderingStartTime=0,v.last=o,v.tail=s,v.tailMode=h,v.treeForkCount=p)}function Qp(t,i,s){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var v=Dt.current,_=(v&2)!==0;if(_?(v=v&1|2,i.flags|=128):v&=1,S(Dt,v),Kt(t,i,o,s),o=et?_s:0,!_&&t!==null&&(t.flags&128)!==0)e:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Xp(t,s,i);else if(t.tag===19)Xp(t,s,i);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break e;for(;t.sibling===null;){if(t.return===null||t.return===i)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(s=i.child,h=null;s!==null;)t=s.alternate,t!==null&&lo(t)===null&&(h=s),s=s.sibling;s=h,s===null?(h=i.child,i.child=null):(h=s.sibling,s.sibling=null),nf(i,!1,h,s,p,o);break;case"backwards":case"unstable_legacy-backwards":for(s=null,h=i.child,i.child=null;h!==null;){if(t=h.alternate,t!==null&&lo(t)===null){i.child=h;break}t=h.sibling,h.sibling=s,s=h,h=t}nf(i,!0,s,null,p,o);break;case"together":nf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Mr(t,i,s){if(t!==null&&(i.dependencies=t.dependencies),fi|=i.lanes,(s&i.childLanes)===0)if(t!==null){if(va(t,i,s,!1),(s&i.childLanes)===0)return null}else return null;if(t!==null&&i.child!==t.child)throw Error(a(153));if(i.child!==null){for(t=i.child,s=Cr(t,t.pendingProps),i.child=s,s.return=i;t.sibling!==null;)t=t.sibling,s=s.sibling=Cr(t,t.pendingProps),s.return=i;s.sibling=null}return i.child}function rf(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&Wl(t)))}function bx(t,i,s){switch(i.tag){case 3:ze(i,i.stateNode.containerInfo),ri(i,Ut,t.memoizedState.cache),Hi();break;case 27:case 5:Me(i);break;case 4:ze(i,i.stateNode.containerInfo);break;case 10:ri(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Tc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(li(i),i.flags|=128,null):(s&i.child.childLanes)!==0?Jp(t,i,s):(li(i),t=Mr(t,i,s),t!==null?t.sibling:null);li(i);break;case 19:var h=(t.flags&128)!==0;if(o=(s&i.childLanes)!==0,o||(va(t,i,s,!1),o=(s&i.childLanes)!==0),h){if(o)return Qp(t,i,s);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),S(Dt,Dt.current),o)break;return null;case 22:return i.lanes=0,Ip(t,i,s,i.pendingProps);case 24:ri(i,Ut,t.memoizedState.cache)}return Mr(t,i,s)}function Kp(t,i,s){if(t!==null)if(t.memoizedProps!==i.pendingProps)Pt=!0;else{if(!rf(t,s)&&(i.flags&128)===0)return Pt=!1,bx(t,i,s);Pt=(t.flags&131072)!==0}else Pt=!1,et&&(i.flags&1048576)!==0&&jm(i,_s,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(t=Gi(i.elementType),i.type=t,typeof t=="function")oc(t)?(o=Xi(t,o),i.tag=1,i=Yp(null,i,t,o,s)):(i.tag=0,i=Qc(null,i,t,o,s));else{if(t!=null){var h=t.$$typeof;if(h===se){i.tag=11,i=Pp(null,i,t,o,s);break e}else if(h===G){i.tag=14,i=qp(null,i,t,o,s);break e}}throw i=ue(t)||t,Error(a(306,i,""))}}return i;case 0:return Qc(t,i,i.type,i.pendingProps,s);case 1:return o=i.type,h=Xi(o,i.pendingProps),Yp(t,i,o,h,s);case 3:e:{if(ze(i,i.stateNode.containerInfo),t===null)throw Error(a(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,_c(t,i),Ns(i,o,null,s);var v=i.memoizedState;if(o=v.cache,ri(i,Ut,o),o!==p.cache&&yc(i,[Ut],s,!0),Os(),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=Vp(t,i,o,s);break e}else if(o!==h){h=qn(Error(a(424)),i),Es(h),i=Vp(t,i,o,s);break e}else{switch(t=i.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(_t=Gn(t.firstChild),Xt=i,et=!0,ti=null,Fn=!0,s=Im(i,null,o,s),i.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(Hi(),o===h){i=Mr(t,i,s);break e}Kt(t,i,o,s)}i=i.child}return i;case 26:return vo(t,i),t===null?(s=oy(i.type,null,i.pendingProps,null))?i.memoizedState=s:et||(s=i.type,t=i.pendingProps,o=Lo(ve.current).createElement(s),o[gt]=i,o[Ot]=t,Zt(o,s,t),H(o),i.stateNode=o):i.memoizedState=oy(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return Me(i),t===null&&et&&(o=i.stateNode=ay(i.type,i.pendingProps,ve.current),Xt=i,Fn=!0,h=_t,gi(i.type)?(Uf=h,_t=Gn(o.firstChild)):_t=h),Kt(t,i,i.pendingProps.children,s),vo(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&&et&&((h=o=_t)&&(o=Jx(o,i.type,i.pendingProps,Fn),o!==null?(i.stateNode=o,Xt=i,_t=Gn(o.firstChild),Fn=!1,h=!0):h=!1),h||ni(i)),Me(i),h=i.type,p=i.pendingProps,v=t!==null?t.memoizedProps:null,o=p.children,Rf(h,p)?o=null:v!==null&&Rf(h,v)&&(i.flags|=32),i.memoizedState!==null&&(h=Oc(t,i,ux,null,null,s),Ks._currentValue=h),vo(t,i),Kt(t,i,o,s),i.child;case 6:return t===null&&et&&((t=s=_t)&&(s=Xx(s,i.pendingProps,Fn),s!==null?(i.stateNode=s,Xt=i,_t=null,t=!0):t=!1),t||ni(i)),null;case 13:return Jp(t,i,s);case 4:return ze(i,i.stateNode.containerInfo),o=i.pendingProps,t===null?i.child=Vi(i,null,o,s):Kt(t,i,o,s),i.child;case 11:return Pp(t,i,i.type,i.pendingProps,s);case 7:return Kt(t,i,i.pendingProps,s),i.child;case 8:return Kt(t,i,i.pendingProps.children,s),i.child;case 12:return Kt(t,i,i.pendingProps.children,s),i.child;case 10:return o=i.pendingProps,ri(i,i.type,o.value),Kt(t,i,o.children,s),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,Fi(i),h=Qt(h),o=o(h),i.flags|=1,Kt(t,i,o,s),i.child;case 14:return qp(t,i,i.type,i.pendingProps,s);case 15:return Hp(t,i,i.type,i.pendingProps,s);case 19:return Qp(t,i,s);case 31:return yx(t,i,s);case 22:return Ip(t,i,s,i.pendingProps);case 24:return Fi(i),o=Qt(Ut),t===null?(h=xc(),h===null&&(h=yt,p=bc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=s),h=p),i.memoizedState={parent:o,cache:h},Sc(i),ri(i,Ut,h)):((t.lanes&s)!==0&&(_c(t,i),Ns(i,null,null,s),Os()),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),ri(i,Ut,o)):(o=p.cache,ri(i,Ut,o),o!==h.cache&&yc(i,[Ut],s,!0))),Kt(t,i,i.pendingProps.children,s),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Dr(t){t.flags|=4}function af(t,i,s,o,h){if((i=(t.mode&32)!==0)&&(i=!1),i){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(Eg())t.flags|=8192;else throw Yi=ro,wc}else t.flags&=-16777217}function Zp(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!dy(i))if(Eg())t.flags|=8192;else throw Yi=ro,wc}function wo(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?aa():536870912,t.lanes|=i,Na|=i)}function Us(t,i){if(!et)switch(t.tailMode){case"hidden":i=t.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?i||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function Et(t){var i=t.alternate!==null&&t.alternate.child===t.child,s=0,o=0;if(i)for(var h=t.child;h!==null;)s|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)s|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=s,i}function vx(t,i,s){var o=i.pendingProps;switch(hc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Et(i),null;case 1:return Et(i),null;case 3:return s=i.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Or(Ut),ke(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(ba(i)?Dr(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,mc())),Et(i),null;case 26:var h=i.type,p=i.memoizedState;return t===null?(Dr(i),p!==null?(Et(i),Zp(i,p)):(Et(i),af(i,h,null,o,s))):p?p!==t.memoizedState?(Dr(i),Et(i),Zp(i,p)):(Et(i),i.flags&=-16777217):(t=t.memoizedProps,t!==o&&Dr(i),Et(i),af(i,h,t,o,s)),null;case 27:if(wt(i),s=ve.current,h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Dr(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Et(i),null}t=he.current,ba(i)?Nm(i):(t=ay(h,o,s),i.stateNode=t,Dr(i))}return Et(i),null;case 5:if(wt(i),h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Dr(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Et(i),null}if(p=he.current,ba(i))Nm(i);else{var v=Lo(ve.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[gt]=i,p[Ot]=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(Zt(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&&Dr(i)}}return Et(i),af(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,s),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&Dr(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(a(166));if(t=ve.current,ba(i)){if(t=i.stateNode,s=i.memoizedProps,o=null,h=Xt,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[gt]=i,t=!!(t.nodeValue===s||o!==null&&o.suppressHydrationWarning===!0||Jg(t.nodeValue,s)),t||ni(i,!0)}else t=Lo(t).createTextNode(o),t[gt]=i,i.stateNode=t}return Et(i),null;case 31:if(s=i.memoizedState,t===null||t.memoizedState!==null){if(o=ba(i),s!==null){if(t===null){if(!o)throw Error(a(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(557));t[gt]=i}else Hi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Et(i),t=!1}else s=mc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return i.flags&256?(_n(i),i):(_n(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Et(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=ba(i),o!==null&&o.dehydrated!==null){if(t===null){if(!h)throw Error(a(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(a(317));h[gt]=i}else Hi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Et(i),h=!1}else h=mc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(_n(i),i):(_n(i),null)}return _n(i),(i.flags&128)!==0?(i.lanes=s,i):(s=o!==null,t=t!==null&&t.memoizedState!==null,s&&(o=i.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),s!==t&&s&&(i.child.flags|=8192),wo(i,i.updateQueue),Et(i),null);case 4:return ke(),t===null&&Cf(i.stateNode.containerInfo),Et(i),null;case 10:return Or(i.type),Et(i),null;case 19:if(W(Dt),o=i.memoizedState,o===null)return Et(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Us(o,!1);else{if(Rt!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(p=lo(t),p!==null){for(i.flags|=128,Us(o,!1),t=p.updateQueue,i.updateQueue=t,wo(i,t),i.subtreeFlags=0,t=s,s=i.child;s!==null;)Am(s,t),s=s.sibling;return S(Dt,Dt.current&1|2),et&&Tr(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&&vt()>Ao&&(i.flags|=128,h=!0,Us(o,!1),i.lanes=4194304)}else{if(!h)if(t=lo(p),t!==null){if(i.flags|=128,h=!0,t=t.updateQueue,i.updateQueue=t,wo(i,t),Us(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!et)return Et(i),null}else 2*vt()-o.renderingStartTime>Ao&&s!==536870912&&(i.flags|=128,h=!0,Us(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,s=Dt.current,S(Dt,h?s&1|2:s&1),et&&Tr(i,o.treeForkCount),t):(Et(i),null);case 22:case 23:return _n(i),Cc(),o=i.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(s&536870912)!==0&&(i.flags&128)===0&&(Et(i),i.subtreeFlags&6&&(i.flags|=8192)):Et(i),s=i.updateQueue,s!==null&&wo(i,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==s&&(i.flags|=2048),t!==null&&W($i),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),i.memoizedState.cache!==s&&(i.flags|=2048),Or(Ut),Et(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function xx(t,i){switch(hc(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Or(Ut),ke(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return wt(i),null;case 31:if(i.memoizedState!==null){if(_n(i),i.alternate===null)throw Error(a(340));Hi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(_n(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Hi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return W(Dt),null;case 4:return ke(),null;case 10:return Or(i.type),null;case 22:case 23:return _n(i),Cc(),t!==null&&W($i),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return Or(Ut),null;case 25:return null;default:return null}}function Wp(t,i){switch(hc(i),i.tag){case 3:Or(Ut),ke();break;case 26:case 27:case 5:wt(i);break;case 4:ke();break;case 31:i.memoizedState!==null&&_n(i);break;case 13:_n(i);break;case 19:W(Dt);break;case 10:Or(i.type);break;case 22:case 23:_n(i),Cc(),t!==null&&W($i);break;case 24:Or(Ut)}}function Bs(t,i){try{var s=i.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var h=o.next;s=h;do{if((s.tag&t)===t){o=void 0;var p=s.create,v=s.inst;o=p(),v.destroy=o}s=s.next}while(s!==h)}}catch(_){ct(i,i.return,_)}}function ui(t,i,s){try{var o=i.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&t)===t){var v=o.inst,_=v.destroy;if(_!==void 0){v.destroy=void 0,h=i;var P=s,te=_;try{te()}catch(le){ct(h,P,le)}}}o=o.next}while(o!==p)}}catch(le){ct(i,i.return,le)}}function eg(t){var i=t.updateQueue;if(i!==null){var s=t.stateNode;try{$m(i,s)}catch(o){ct(t,t.return,o)}}}function tg(t,i,s){s.props=Xi(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(o){ct(t,i,o)}}function Ps(t,i){try{var s=t.ref;if(s!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof s=="function"?t.refCleanup=s(o):s.current=o}}catch(h){ct(t,i,h)}}function cr(t,i){var s=t.ref,o=t.refCleanup;if(s!==null)if(typeof o=="function")try{o()}catch(h){ct(t,i,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(h){ct(t,i,h)}else s.current=null}function ng(t){var i=t.type,s=t.memoizedProps,o=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":s.autoFocus&&o.focus();break e;case"img":s.src?o.src=s.src:s.srcSet&&(o.srcset=s.srcSet)}}catch(h){ct(t,t.return,h)}}function sf(t,i,s){try{var o=t.stateNode;Ix(o,t.type,s,i),o[Ot]=i}catch(h){ct(t,t.return,h)}}function rg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&gi(t.type)||t.tag===4}function lf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||rg(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&&gi(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 of(t,i,s){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,i):(i=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,i.appendChild(t),s=s._reactRootContainer,s!=null||i.onclick!==null||(i.onclick=kr));else if(o!==4&&(o===27&&gi(t.type)&&(s=t.stateNode,i=null),t=t.child,t!==null))for(of(t,i,s),t=t.sibling;t!==null;)of(t,i,s),t=t.sibling}function So(t,i,s){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?s.insertBefore(t,i):s.appendChild(t);else if(o!==4&&(o===27&&gi(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(So(t,i,s),t=t.sibling;t!==null;)So(t,i,s),t=t.sibling}function ig(t){var i=t.stateNode,s=t.memoizedProps;try{for(var o=t.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);Zt(i,o,s),i[gt]=t,i[Ot]=s}catch(p){ct(t,t.return,p)}}var zr=!1,qt=!1,uf=!1,ag=typeof WeakSet=="function"?WeakSet:Set,Gt=null;function wx(t,i){if(t=t.containerInfo,Of=Fo,t=ym(t),tc(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var o=s.getSelection&&s.getSelection();if(o&&o.rangeCount!==0){s=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{s.nodeType,p.nodeType}catch{s=null;break e}var v=0,_=-1,P=-1,te=0,le=0,pe=t,ne=null;t:for(;;){for(var ie;pe!==s||h!==0&&pe.nodeType!==3||(_=v+h),pe!==p||o!==0&&pe.nodeType!==3||(P=v+o),pe.nodeType===3&&(v+=pe.nodeValue.length),(ie=pe.firstChild)!==null;)ne=pe,pe=ie;for(;;){if(pe===t)break t;if(ne===s&&++te===h&&(_=v),ne===p&&++le===o&&(P=v),(ie=pe.nextSibling)!==null)break;pe=ne,ne=pe.parentNode}pe=ie}s=_===-1||P===-1?null:{start:_,end:P}}else s=null}s=s||{start:0,end:0}}else s=null;for(Nf={focusedElem:t,selectionRange:s},Fo=!1,Gt=i;Gt!==null;)if(i=Gt,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,Gt=t;else for(;Gt!==null;){switch(i=Gt,p=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(s=0;s<t.length;s++)h=t[s],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,s=i,h=p.memoizedProps,p=p.memoizedState,o=s.stateNode;try{var Ne=Xi(s.type,h);t=o.getSnapshotBeforeUpdate(Ne,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(Ue){ct(s,s.return,Ue)}}break;case 3:if((t&1024)!==0){if(t=i.stateNode.containerInfo,s=t.nodeType,s===9)Df(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Df(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(a(163))}if(t=i.sibling,t!==null){t.return=i.return,Gt=t;break}Gt=i.return}}function sg(t,i,s){var o=s.flags;switch(s.tag){case 0:case 11:case 15:Ur(t,s),o&4&&Bs(5,s);break;case 1:if(Ur(t,s),o&4)if(t=s.stateNode,i===null)try{t.componentDidMount()}catch(v){ct(s,s.return,v)}else{var h=Xi(s.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(h,i,t.__reactInternalSnapshotBeforeUpdate)}catch(v){ct(s,s.return,v)}}o&64&&eg(s),o&512&&Ps(s,s.return);break;case 3:if(Ur(t,s),o&64&&(t=s.updateQueue,t!==null)){if(i=null,s.child!==null)switch(s.child.tag){case 27:case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}try{$m(t,i)}catch(v){ct(s,s.return,v)}}break;case 27:i===null&&o&4&&ig(s);case 26:case 5:Ur(t,s),i===null&&o&4&&ng(s),o&512&&Ps(s,s.return);break;case 12:Ur(t,s);break;case 31:Ur(t,s),o&4&&ug(t,s);break;case 13:Ur(t,s),o&4&&cg(t,s),o&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=Ox.bind(null,s),Qx(t,s))));break;case 22:if(o=s.memoizedState!==null||zr,!o){i=i!==null&&i.memoizedState!==null||qt,h=zr;var p=qt;zr=o,(qt=i)&&!p?Br(t,s,(s.subtreeFlags&8772)!==0):Ur(t,s),zr=h,qt=p}break;case 30:break;default:Ur(t,s)}}function lg(t){var i=t.alternate;i!==null&&(t.alternate=null,lg(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&sa(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 kt=null,hn=!1;function Lr(t,i,s){for(s=s.child;s!==null;)og(t,i,s),s=s.sibling}function og(t,i,s){if(pt&&typeof pt.onCommitFiberUnmount=="function")try{pt.onCommitFiberUnmount(Jt,s)}catch{}switch(s.tag){case 26:qt||cr(s,i),Lr(t,i,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:qt||cr(s,i);var o=kt,h=hn;gi(s.type)&&(kt=s.stateNode,hn=!1),Lr(t,i,s),Js(s.stateNode),kt=o,hn=h;break;case 5:qt||cr(s,i);case 6:if(o=kt,h=hn,kt=null,Lr(t,i,s),kt=o,hn=h,kt!==null)if(hn)try{(kt.nodeType===9?kt.body:kt.nodeName==="HTML"?kt.ownerDocument.body:kt).removeChild(s.stateNode)}catch(p){ct(s,i,p)}else try{kt.removeChild(s.stateNode)}catch(p){ct(s,i,p)}break;case 18:kt!==null&&(hn?(t=kt,ey(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),Pa(t)):ey(kt,s.stateNode));break;case 4:o=kt,h=hn,kt=s.stateNode.containerInfo,hn=!0,Lr(t,i,s),kt=o,hn=h;break;case 0:case 11:case 14:case 15:ui(2,s,i),qt||ui(4,s,i),Lr(t,i,s);break;case 1:qt||(cr(s,i),o=s.stateNode,typeof o.componentWillUnmount=="function"&&tg(s,i,o)),Lr(t,i,s);break;case 21:Lr(t,i,s);break;case 22:qt=(o=qt)||s.memoizedState!==null,Lr(t,i,s),qt=o;break;default:Lr(t,i,s)}}function ug(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Pa(t)}catch(s){ct(i,i.return,s)}}}function cg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Pa(t)}catch(s){ct(i,i.return,s)}}function Sx(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new ag),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new ag),i;default:throw Error(a(435,t.tag))}}function _o(t,i){var s=Sx(t);i.forEach(function(o){if(!s.has(o)){s.add(o);var h=Nx.bind(null,t,o);o.then(h,h)}})}function dn(t,i){var s=i.deletions;if(s!==null)for(var o=0;o<s.length;o++){var h=s[o],p=t,v=i,_=v;e:for(;_!==null;){switch(_.tag){case 27:if(gi(_.type)){kt=_.stateNode,hn=!1;break e}break;case 5:kt=_.stateNode,hn=!1;break e;case 3:case 4:kt=_.stateNode.containerInfo,hn=!0;break e}_=_.return}if(kt===null)throw Error(a(160));og(p,v,h),kt=null,hn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)fg(i,t),i=i.sibling}var tr=null;function fg(t,i){var s=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:dn(i,t),mn(t),o&4&&(ui(3,t,t.return),Bs(3,t),ui(5,t,t.return));break;case 1:dn(i,t),mn(t),o&512&&(qt||s===null||cr(s,s.return)),o&64&&zr&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?o:s.concat(o))));break;case 26:var h=tr;if(dn(i,t),mn(t),o&512&&(qt||s===null||cr(s,s.return)),o&4){var p=s!==null?s.memoizedState:null;if(o=t.memoizedState,s===null)if(o===null)if(t.stateNode===null){e:{o=t.type,s=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[Ft]||p[gt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),Zt(p,o,s),p[gt]=t,H(p),o=p;break e;case"link":var v=fy("link","href",h).get(o+(s.href||""));if(v){for(var _=0;_<v.length;_++)if(p=v[_],p.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&p.getAttribute("rel")===(s.rel==null?null:s.rel)&&p.getAttribute("title")===(s.title==null?null:s.title)&&p.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){v.splice(_,1);break t}}p=h.createElement(o),Zt(p,o,s),h.head.appendChild(p);break;case"meta":if(v=fy("meta","content",h).get(o+(s.content||""))){for(_=0;_<v.length;_++)if(p=v[_],p.getAttribute("content")===(s.content==null?null:""+s.content)&&p.getAttribute("name")===(s.name==null?null:s.name)&&p.getAttribute("property")===(s.property==null?null:s.property)&&p.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&p.getAttribute("charset")===(s.charSet==null?null:s.charSet)){v.splice(_,1);break t}}p=h.createElement(o),Zt(p,o,s),h.head.appendChild(p);break;default:throw Error(a(468,o))}p[gt]=t,H(p),o=p}t.stateNode=o}else hy(h,t.type,t.stateNode);else t.stateNode=cy(h,o,t.memoizedProps);else p!==o?(p===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):p.count--,o===null?hy(h,t.type,t.stateNode):cy(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&sf(t,t.memoizedProps,s.memoizedProps)}break;case 27:dn(i,t),mn(t),o&512&&(qt||s===null||cr(s,s.return)),s!==null&&o&4&&sf(t,t.memoizedProps,s.memoizedProps);break;case 5:if(dn(i,t),mn(t),o&512&&(qt||s===null||cr(s,s.return)),t.flags&32){h=t.stateNode;try{oa(h,"")}catch(Ne){ct(t,t.return,Ne)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,sf(t,h,s!==null?s.memoizedProps:h)),o&1024&&(uf=!0);break;case 6:if(dn(i,t),mn(t),o&4){if(t.stateNode===null)throw Error(a(162));o=t.memoizedProps,s=t.stateNode;try{s.nodeValue=o}catch(Ne){ct(t,t.return,Ne)}}break;case 3:if(Po=null,h=tr,tr=Uo(i.containerInfo),dn(i,t),tr=h,mn(t),o&4&&s!==null&&s.memoizedState.isDehydrated)try{Pa(i.containerInfo)}catch(Ne){ct(t,t.return,Ne)}uf&&(uf=!1,hg(t));break;case 4:o=tr,tr=Uo(t.stateNode.containerInfo),dn(i,t),mn(t),tr=o;break;case 12:dn(i,t),mn(t);break;case 31:dn(i,t),mn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,_o(t,o)));break;case 13:dn(i,t),mn(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(ko=vt()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,_o(t,o)));break;case 22:h=t.memoizedState!==null;var P=s!==null&&s.memoizedState!==null,te=zr,le=qt;if(zr=te||h,qt=le||P,dn(i,t),qt=le,zr=te,mn(t),o&8192)e:for(i=t.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(s===null||P||zr||qt||Qi(t)),s=null,i=t;;){if(i.tag===5||i.tag===26){if(s===null){P=s=i;try{if(p=P.stateNode,h)v=p.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{_=P.stateNode;var pe=P.memoizedProps.style,ne=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;_.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ne){ct(P,P.return,Ne)}}}else if(i.tag===6){if(s===null){P=i;try{P.stateNode.nodeValue=h?"":P.memoizedProps}catch(Ne){ct(P,P.return,Ne)}}}else if(i.tag===18){if(s===null){P=i;try{var ie=P.stateNode;h?ty(ie,!0):ty(P.stateNode,!1)}catch(Ne){ct(P,P.return,Ne)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===t)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;s===i&&(s=null),i=i.return}s===i&&(s=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=t.updateQueue,o!==null&&(s=o.retryQueue,s!==null&&(o.retryQueue=null,_o(t,s))));break;case 19:dn(i,t),mn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,_o(t,o)));break;case 30:break;case 21:break;default:dn(i,t),mn(t)}}function mn(t){var i=t.flags;if(i&2){try{for(var s,o=t.return;o!==null;){if(rg(o)){s=o;break}o=o.return}if(s==null)throw Error(a(160));switch(s.tag){case 27:var h=s.stateNode,p=lf(t);So(t,p,h);break;case 5:var v=s.stateNode;s.flags&32&&(oa(v,""),s.flags&=-33);var _=lf(t);So(t,_,v);break;case 3:case 4:var P=s.stateNode.containerInfo,te=lf(t);of(t,te,P);break;default:throw Error(a(161))}}catch(le){ct(t,t.return,le)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function hg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;hg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),t=t.sibling}}function Ur(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)sg(t,i.alternate,i),i=i.sibling}function Qi(t){for(t=t.child;t!==null;){var i=t;switch(i.tag){case 0:case 11:case 14:case 15:ui(4,i,i.return),Qi(i);break;case 1:cr(i,i.return);var s=i.stateNode;typeof s.componentWillUnmount=="function"&&tg(i,i.return,s),Qi(i);break;case 27:Js(i.stateNode);case 26:case 5:cr(i,i.return),Qi(i);break;case 22:i.memoizedState===null&&Qi(i);break;case 30:Qi(i);break;default:Qi(i)}t=t.sibling}}function Br(t,i,s){for(s=s&&(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:Br(h,p,s),Bs(4,p);break;case 1:if(Br(h,p,s),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(te){ct(o,o.return,te)}if(o=p,h=o.updateQueue,h!==null){var _=o.stateNode;try{var P=h.shared.hiddenCallbacks;if(P!==null)for(h.shared.hiddenCallbacks=null,h=0;h<P.length;h++)Fm(P[h],_)}catch(te){ct(o,o.return,te)}}s&&v&64&&eg(p),Ps(p,p.return);break;case 27:ig(p);case 26:case 5:Br(h,p,s),s&&o===null&&v&4&&ng(p),Ps(p,p.return);break;case 12:Br(h,p,s);break;case 31:Br(h,p,s),s&&v&4&&ug(h,p);break;case 13:Br(h,p,s),s&&v&4&&cg(h,p);break;case 22:p.memoizedState===null&&Br(h,p,s),Ps(p,p.return);break;case 30:break;default:Br(h,p,s)}i=i.sibling}}function cf(t,i){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(t=i.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&ks(s))}function ff(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&ks(t))}function nr(t,i,s,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)dg(t,i,s,o),i=i.sibling}function dg(t,i,s,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:nr(t,i,s,o),h&2048&&Bs(9,i);break;case 1:nr(t,i,s,o);break;case 3:nr(t,i,s,o),h&2048&&(t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&ks(t)));break;case 12:if(h&2048){nr(t,i,s,o),t=i.stateNode;try{var p=i.memoizedProps,v=p.id,_=p.onPostCommit;typeof _=="function"&&_(v,i.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(P){ct(i,i.return,P)}}else nr(t,i,s,o);break;case 31:nr(t,i,s,o);break;case 13:nr(t,i,s,o);break;case 23:break;case 22:p=i.stateNode,v=i.alternate,i.memoizedState!==null?p._visibility&2?nr(t,i,s,o):qs(t,i):p._visibility&2?nr(t,i,s,o):(p._visibility|=2,Ta(t,i,s,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&cf(v,i);break;case 24:nr(t,i,s,o),h&2048&&ff(i.alternate,i);break;default:nr(t,i,s,o)}}function Ta(t,i,s,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=t,v=i,_=s,P=o,te=v.flags;switch(v.tag){case 0:case 11:case 15:Ta(p,v,_,P,h),Bs(8,v);break;case 23:break;case 22:var le=v.stateNode;v.memoizedState!==null?le._visibility&2?Ta(p,v,_,P,h):qs(p,v):(le._visibility|=2,Ta(p,v,_,P,h)),h&&te&2048&&cf(v.alternate,v);break;case 24:Ta(p,v,_,P,h),h&&te&2048&&ff(v.alternate,v);break;default:Ta(p,v,_,P,h)}i=i.sibling}}function qs(t,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var s=t,o=i,h=o.flags;switch(o.tag){case 22:qs(s,o),h&2048&&cf(o.alternate,o);break;case 24:qs(s,o),h&2048&&ff(o.alternate,o);break;default:qs(s,o)}i=i.sibling}}var Hs=8192;function ja(t,i,s){if(t.subtreeFlags&Hs)for(t=t.child;t!==null;)mg(t,i,s),t=t.sibling}function mg(t,i,s){switch(t.tag){case 26:ja(t,i,s),t.flags&Hs&&t.memoizedState!==null&&ow(s,tr,t.memoizedState,t.memoizedProps);break;case 5:ja(t,i,s);break;case 3:case 4:var o=tr;tr=Uo(t.stateNode.containerInfo),ja(t,i,s),tr=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=Hs,Hs=16777216,ja(t,i,s),Hs=o):ja(t,i,s));break;default:ja(t,i,s)}}function pg(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 Is(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var o=i[s];Gt=o,yg(o,t)}pg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)gg(t),t=t.sibling}function gg(t){switch(t.tag){case 0:case 11:case 15:Is(t),t.flags&2048&&ui(9,t,t.return);break;case 3:Is(t);break;case 12:Is(t);break;case 22:var i=t.stateNode;t.memoizedState!==null&&i._visibility&2&&(t.return===null||t.return.tag!==13)?(i._visibility&=-3,Eo(t)):Is(t);break;default:Is(t)}}function Eo(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var o=i[s];Gt=o,yg(o,t)}pg(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:ui(8,i,i.return),Eo(i);break;case 22:s=i.stateNode,s._visibility&2&&(s._visibility&=-3,Eo(i));break;default:Eo(i)}t=t.sibling}}function yg(t,i){for(;Gt!==null;){var s=Gt;switch(s.tag){case 0:case 11:case 15:ui(8,s,i);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var o=s.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:ks(s.memoizedState.cache)}if(o=s.child,o!==null)o.return=s,Gt=o;else e:for(s=t;Gt!==null;){o=Gt;var h=o.sibling,p=o.return;if(lg(o),o===s){Gt=null;break e}if(h!==null){h.return=p,Gt=h;break e}Gt=p}}}var _x={getCacheForType:function(t){var i=Qt(Ut),s=i.data.get(t);return s===void 0&&(s=t(),i.data.set(t,s)),s},cacheSignal:function(){return Qt(Ut).controller.signal}},Ex=typeof WeakMap=="function"?WeakMap:Map,lt=0,yt=null,Xe=null,Ze=0,ut=0,En=null,ci=!1,Oa=!1,hf=!1,Pr=0,Rt=0,fi=0,Ki=0,df=0,kn=0,Na=0,Fs=null,pn=null,mf=!1,ko=0,bg=0,Ao=1/0,Co=null,hi=null,$t=0,di=null,Ra=null,qr=0,pf=0,gf=null,vg=null,$s=0,yf=null;function An(){return(lt&2)!==0&&Ze!==0?Ze&-Ze:I.T!==null?_f():hs()}function xg(){if(kn===0)if((Ze&536870912)===0||et){var t=Sr;Sr<<=1,(Sr&3932160)===0&&(Sr=262144),kn=t}else kn=536870912;return t=Sn.current,t!==null&&(t.flags|=32),kn}function gn(t,i,s){(t===yt&&(ut===2||ut===9)||t.cancelPendingCommit!==null)&&(Ma(t,0),mi(t,Ze,kn,!1)),Zn(t,s),((lt&2)===0||t!==yt)&&(t===yt&&((lt&2)===0&&(Ki|=s),Rt===4&&mi(t,Ze,kn,!1)),fr(t))}function wg(t,i,s){if((lt&6)!==0)throw Error(a(327));var o=!s&&(i&127)===0&&(i&t.expiredLanes)===0||Ri(t,i),h=o?Cx(t,i):vf(t,i,!0),p=o;do{if(h===0){Oa&&!o&&mi(t,i,0,!1);break}else{if(s=t.current.alternate,p&&!kx(s)){h=vf(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 _=t;h=Fs;var P=_.current.memoizedState.isDehydrated;if(P&&(Ma(_,v).flags|=256),v=vf(_,v,!1),v!==2){if(hf&&!P){_.errorRecoveryDisabledLanes|=p,Ki|=p,h=4;break e}p=pn,pn=h,p!==null&&(pn===null?pn=p:pn.push.apply(pn,p))}h=v}if(p=!1,h!==2)continue}}if(h===1){Ma(t,0),mi(t,i,0,!0);break}e:{switch(o=t,p=h,p){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:mi(o,i,kn,!ci);break e;case 2:pn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(h=ko+300-vt(),10<h)){if(mi(o,i,kn,!ci),Ni(o,0,!0)!==0)break e;qr=i,o.timeoutHandle=Zg(Sg.bind(null,o,s,pn,Co,mf,i,kn,Ki,Na,ci,p,"Throttled",-0,0),h);break e}Sg(o,s,pn,Co,mf,i,kn,Ki,Na,ci,p,null,-0,0)}}break}while(!0);fr(t)}function Sg(t,i,s,o,h,p,v,_,P,te,le,pe,ne,ie){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:kr},mg(i,p,pe);var Ne=(p&62914560)===p?ko-vt():(p&4194048)===p?bg-vt():0;if(Ne=uw(pe,Ne),Ne!==null){qr=p,t.cancelPendingCommit=Ne(Og.bind(null,t,i,p,s,o,h,v,_,P,le,pe,null,ne,ie)),mi(t,p,v,!te);return}}Og(t,i,p,s,o,h,v,_,P)}function kx(t){for(var i=t;;){var s=i.tag;if((s===0||s===11||s===15)&&i.flags&16384&&(s=i.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var o=0;o<s.length;o++){var h=s[o],p=h.getSnapshot;h=h.value;try{if(!xn(p(),h))return!1}catch{return!1}}if(s=i.child,i.subtreeFlags&16384&&s!==null)s.return=i,i=s;else{if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function mi(t,i,s,o){i&=~df,i&=~Ki,t.suspendedLanes|=i,t.pingedLanes&=~i,o&&(t.warmLanes|=i),o=t.expirationTimes;for(var h=i;0<h;){var p=31-ot(h),v=1<<p;o[p]=-1,h&=~v}s!==0&&Kr(t,s,i)}function To(){return(lt&6)===0?(Gs(0),!1):!0}function bf(){if(Xe!==null){if(ut===0)var t=Xe.return;else t=Xe,jr=Ii=null,Mc(t),_a=null,Cs=0,t=Xe;for(;t!==null;)Wp(t.alternate,t),t=t.return;Xe=null}}function Ma(t,i){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,Gx(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),qr=0,bf(),yt=t,Xe=s=Cr(t.current,null),Ze=i,ut=0,En=null,ci=!1,Oa=Ri(t,i),hf=!1,Na=kn=df=Ki=fi=Rt=0,pn=Fs=null,mf=!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-ot(o),p=1<<h;i|=t[h],o&=~p}return Pr=i,Jl(),s}function _g(t,i){$e=null,I.H=zs,i===Sa||i===no?(i=Pm(),ut=3):i===wc?(i=Pm(),ut=4):ut=i===Xc?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,En=i,Xe===null&&(Rt=1,yo(t,qn(i,t.current)))}function Eg(){var t=Sn.current;return t===null?!0:(Ze&4194048)===Ze?$n===null:(Ze&62914560)===Ze||(Ze&536870912)!==0?t===$n:!1}function kg(){var t=I.H;return I.H=zs,t===null?zs:t}function Ag(){var t=I.A;return I.A=_x,t}function jo(){Rt=4,ci||(Ze&4194048)!==Ze&&Sn.current!==null||(Oa=!0),(fi&134217727)===0&&(Ki&134217727)===0||yt===null||mi(yt,Ze,kn,!1)}function vf(t,i,s){var o=lt;lt|=2;var h=kg(),p=Ag();(yt!==t||Ze!==i)&&(Co=null,Ma(t,i)),i=!1;var v=Rt;e:do try{if(ut!==0&&Xe!==null){var _=Xe,P=En;switch(ut){case 8:bf(),v=6;break e;case 3:case 2:case 9:case 6:Sn.current===null&&(i=!0);var te=ut;if(ut=0,En=null,Da(t,_,P,te),s&&Oa){v=0;break e}break;default:te=ut,ut=0,En=null,Da(t,_,P,te)}}Ax(),v=Rt;break}catch(le){_g(t,le)}while(!0);return i&&t.shellSuspendCounter++,jr=Ii=null,lt=o,I.H=h,I.A=p,Xe===null&&(yt=null,Ze=0,Jl()),v}function Ax(){for(;Xe!==null;)Cg(Xe)}function Cx(t,i){var s=lt;lt|=2;var o=kg(),h=Ag();yt!==t||Ze!==i?(Co=null,Ao=vt()+500,Ma(t,i)):Oa=Ri(t,i);e:do try{if(ut!==0&&Xe!==null){i=Xe;var p=En;t:switch(ut){case 1:ut=0,En=null,Da(t,i,p,1);break;case 2:case 9:if(Um(p)){ut=0,En=null,Tg(i);break}i=function(){ut!==2&&ut!==9||yt!==t||(ut=7),fr(t)},p.then(i,i);break e;case 3:ut=7;break e;case 4:ut=5;break e;case 7:Um(p)?(ut=0,En=null,Tg(i)):(ut=0,En=null,Da(t,i,p,7));break;case 5:var v=null;switch(Xe.tag){case 26:v=Xe.memoizedState;case 5:case 27:var _=Xe;if(v?dy(v):_.stateNode.complete){ut=0,En=null;var P=_.sibling;if(P!==null)Xe=P;else{var te=_.return;te!==null?(Xe=te,Oo(te)):Xe=null}break t}}ut=0,En=null,Da(t,i,p,5);break;case 6:ut=0,En=null,Da(t,i,p,6);break;case 8:bf(),Rt=6;break e;default:throw Error(a(462))}}Tx();break}catch(le){_g(t,le)}while(!0);return jr=Ii=null,I.H=o,I.A=h,lt=s,Xe!==null?0:(yt=null,Ze=0,Jl(),Rt)}function Tx(){for(;Xe!==null&&!jt();)Cg(Xe)}function Cg(t){var i=Kp(t.alternate,t,Pr);t.memoizedProps=t.pendingProps,i===null?Oo(t):Xe=i}function Tg(t){var i=t,s=i.alternate;switch(i.tag){case 15:case 0:i=Gp(s,i,i.pendingProps,i.type,void 0,Ze);break;case 11:i=Gp(s,i,i.pendingProps,i.type.render,i.ref,Ze);break;case 5:Mc(i);default:Wp(s,i),i=Xe=Am(i,Pr),i=Kp(s,i,Pr)}t.memoizedProps=t.pendingProps,i===null?Oo(t):Xe=i}function Da(t,i,s,o){jr=Ii=null,Mc(i),_a=null,Cs=0;var h=i.return;try{if(gx(t,h,i,s,Ze)){Rt=1,yo(t,qn(s,t.current)),Xe=null;return}}catch(p){if(h!==null)throw Xe=h,p;Rt=1,yo(t,qn(s,t.current)),Xe=null;return}i.flags&32768?(et||o===1?t=!0:Oa||(Ze&536870912)!==0?t=!1:(ci=t=!0,(o===2||o===9||o===3||o===6)&&(o=Sn.current,o!==null&&o.tag===13&&(o.flags|=16384))),jg(i,t)):Oo(i)}function Oo(t){var i=t;do{if((i.flags&32768)!==0){jg(i,ci);return}t=i.return;var s=vx(i.alternate,i,Pr);if(s!==null){Xe=s;return}if(i=i.sibling,i!==null){Xe=i;return}Xe=i=t}while(i!==null);Rt===0&&(Rt=5)}function jg(t,i){do{var s=xx(t.alternate,t);if(s!==null){s.flags&=32767,Xe=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!i&&(t=t.sibling,t!==null)){Xe=t;return}Xe=t=s}while(t!==null);Rt=6,Xe=null}function Og(t,i,s,o,h,p,v,_,P){t.cancelPendingCommit=null;do No();while($t!==0);if((lt&6)!==0)throw Error(a(327));if(i!==null){if(i===t.current)throw Error(a(177));if(p=i.lanes|i.childLanes,p|=sc,Qr(t,s,p,v,_,P),t===yt&&(Xe=yt=null,Ze=0),Ra=i,di=t,qr=s,pf=p,gf=h,vg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Rx(Pe,function(){return zg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=I.T,I.T=null,h=ae.p,ae.p=2,v=lt,lt|=4;try{wx(t,i,s)}finally{lt=v,ae.p=h,I.T=o}}$t=1,Ng(),Rg(),Mg()}}function Ng(){if($t===1){$t=0;var t=di,i=Ra,s=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||s){s=I.T,I.T=null;var o=ae.p;ae.p=2;var h=lt;lt|=4;try{fg(i,t);var p=Nf,v=ym(t.containerInfo),_=p.focusedElem,P=p.selectionRange;if(v!==_&&_&&_.ownerDocument&&gm(_.ownerDocument.documentElement,_)){if(P!==null&&tc(_)){var te=P.start,le=P.end;if(le===void 0&&(le=te),"selectionStart"in _)_.selectionStart=te,_.selectionEnd=Math.min(le,_.value.length);else{var pe=_.ownerDocument||document,ne=pe&&pe.defaultView||window;if(ne.getSelection){var ie=ne.getSelection(),Ne=_.textContent.length,Ue=Math.min(P.start,Ne),mt=P.end===void 0?Ue:Math.min(P.end,Ne);!ie.extend&&Ue>mt&&(v=mt,mt=Ue,Ue=v);var Q=pm(_,Ue),F=pm(_,mt);if(Q&&F&&(ie.rangeCount!==1||ie.anchorNode!==Q.node||ie.anchorOffset!==Q.offset||ie.focusNode!==F.node||ie.focusOffset!==F.offset)){var ee=pe.createRange();ee.setStart(Q.node,Q.offset),ie.removeAllRanges(),Ue>mt?(ie.addRange(ee),ie.extend(F.node,F.offset)):(ee.setEnd(F.node,F.offset),ie.addRange(ee))}}}}for(pe=[],ie=_;ie=ie.parentNode;)ie.nodeType===1&&pe.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<pe.length;_++){var ce=pe[_];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Fo=!!Of,Nf=Of=null}finally{lt=h,ae.p=o,I.T=s}}t.current=i,$t=2}}function Rg(){if($t===2){$t=0;var t=di,i=Ra,s=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||s){s=I.T,I.T=null;var o=ae.p;ae.p=2;var h=lt;lt|=4;try{sg(t,i.alternate,i)}finally{lt=h,ae.p=o,I.T=s}}$t=3}}function Mg(){if($t===4||$t===3){$t=0,Dn();var t=di,i=Ra,s=qr,o=vg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?$t=5:($t=0,Ra=di=null,Dg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(hi=null),Di(s),i=i.stateNode,pt&&typeof pt.onCommitFiberRoot=="function")try{pt.onCommitFiberRoot(Jt,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=I.T,h=ae.p,ae.p=2,I.T=null;try{for(var p=t.onRecoverableError,v=0;v<o.length;v++){var _=o[v];p(_.value,{componentStack:_.stack})}}finally{I.T=i,ae.p=h}}(qr&3)!==0&&No(),fr(t),h=t.pendingLanes,(s&261930)!==0&&(h&42)!==0?t===yf?$s++:($s=0,yf=t):$s=0,Gs(0)}}function Dg(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,ks(i)))}function No(){return Ng(),Rg(),Mg(),zg()}function zg(){if($t!==5)return!1;var t=di,i=pf;pf=0;var s=Di(qr),o=I.T,h=ae.p;try{ae.p=32>s?32:s,I.T=null,s=gf,gf=null;var p=di,v=qr;if($t=0,Ra=di=null,qr=0,(lt&6)!==0)throw Error(a(331));var _=lt;if(lt|=4,gg(p.current),dg(p,p.current,v,s),lt=_,Gs(0,!1),pt&&typeof pt.onPostCommitFiberRoot=="function")try{pt.onPostCommitFiberRoot(Jt,p)}catch{}return!0}finally{ae.p=h,I.T=o,Dg(t,i)}}function Lg(t,i,s){i=qn(s,i),i=Jc(t.stateNode,i,2),t=si(t,i,2),t!==null&&(Zn(t,2),fr(t))}function ct(t,i,s){if(t.tag===3)Lg(t,t,s);else for(;i!==null;){if(i.tag===3){Lg(i,t,s);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(hi===null||!hi.has(o))){t=qn(s,t),s=Up(2),o=si(i,s,2),o!==null&&(Bp(s,o,i,t),Zn(o,2),fr(o));break}}i=i.return}}function xf(t,i,s){var o=t.pingCache;if(o===null){o=t.pingCache=new Ex;var h=new Set;o.set(i,h)}else h=o.get(i),h===void 0&&(h=new Set,o.set(i,h));h.has(s)||(hf=!0,h.add(s),t=jx.bind(null,t,i,s),i.then(t,t))}function jx(t,i,s){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,yt===t&&(Ze&s)===s&&(Rt===4||Rt===3&&(Ze&62914560)===Ze&&300>vt()-ko?(lt&2)===0&&Ma(t,0):df|=s,Na===Ze&&(Na=0)),fr(t)}function Ug(t,i){i===0&&(i=aa()),t=Pi(t,i),t!==null&&(Zn(t,i),fr(t))}function Ox(t){var i=t.memoizedState,s=0;i!==null&&(s=i.retryLane),Ug(t,s)}function Nx(t,i){var s=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(s=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(a(314))}o!==null&&o.delete(i),Ug(t,s)}function Rx(t,i){return Ie(t,i)}var Ro=null,za=null,wf=!1,Mo=!1,Sf=!1,pi=0;function fr(t){t!==za&&t.next===null&&(za===null?Ro=za=t:za=za.next=t),Mo=!0,wf||(wf=!0,Dx())}function Gs(t,i){if(!Sf&&Mo){Sf=!0;do for(var s=!1,o=Ro;o!==null;){if(t!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var v=o.suspendedLanes,_=o.pingedLanes;p=(1<<31-ot(42|t)+1)-1,p&=h&~(v&~_),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(s=!0,Hg(o,p))}else p=Ze,p=Ni(o,o===yt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Ri(o,p)||(s=!0,Hg(o,p));o=o.next}while(s);Sf=!1}}function Mx(){Bg()}function Bg(){Mo=wf=!1;var t=0;pi!==0&&$x()&&(t=pi);for(var i=vt(),s=null,o=Ro;o!==null;){var h=o.next,p=Pg(o,i);p===0?(o.next=null,s===null?Ro=h:s.next=h,h===null&&(za=s)):(s=o,(t!==0||(p&3)!==0)&&(Mo=!0)),o=h}$t!==0&&$t!==5||Gs(t),pi!==0&&(pi=0)}function Pg(t,i){for(var s=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var v=31-ot(p),_=1<<v,P=h[v];P===-1?((_&s)===0||(_&o)!==0)&&(h[v]=fs(_,i)):P<=i&&(t.expiredLanes|=_),p&=~_}if(i=yt,s=Ze,s=Ni(t,t===i?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,s===0||t===i&&(ut===2||ut===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&Be(o),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||Ri(t,s)){if(i=s&-s,i===t.callbackPriority)return i;switch(o!==null&&Be(o),Di(s)){case 2:case 8:s=we;break;case 32:s=Pe;break;case 268435456:s=it;break;default:s=Pe}return o=qg.bind(null,t),s=Ie(s,o),t.callbackPriority=i,t.callbackNode=s,i}return o!==null&&o!==null&&Be(o),t.callbackPriority=2,t.callbackNode=null,2}function qg(t,i){if($t!==0&&$t!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(No()&&t.callbackNode!==s)return null;var o=Ze;return o=Ni(t,t===yt?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(wg(t,o,i),Pg(t,vt()),t.callbackNode!=null&&t.callbackNode===s?qg.bind(null,t):null)}function Hg(t,i){if(No())return null;wg(t,i,!0)}function Dx(){Yx(function(){(lt&6)!==0?Ie(oe,Mx):Bg()})}function _f(){if(pi===0){var t=xa;t===0&&(t=Vr,Vr<<=1,(Vr&261888)===0&&(Vr=256)),pi=t}return pi}function Ig(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:ql(""+t)}function Fg(t,i){var s=i.ownerDocument.createElement("input");return s.name=i.name,s.value=i.value,t.id&&s.setAttribute("form",t.id),i.parentNode.insertBefore(s,i),t=new FormData(t),s.parentNode.removeChild(s),t}function zx(t,i,s,o,h){if(i==="submit"&&s&&s.stateNode===h){var p=Ig((h[Ot]||null).action),v=o.submitter;v&&(i=(i=v[Ot]||null)?Ig(i.formAction):v.getAttribute("formAction"),i!==null&&(p=i,v=null));var _=new $l("action","action",null,o,h);t.push({event:_,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(pi!==0){var P=v?Fg(h,v):new FormData(h);Ic(s,{pending:!0,data:P,method:h.method,action:p},null,P)}}else typeof p=="function"&&(_.preventDefault(),P=v?Fg(h,v):new FormData(h),Ic(s,{pending:!0,data:P,method:h.method,action:p},p,P))},currentTarget:h}]})}}for(var Ef=0;Ef<ac.length;Ef++){var kf=ac[Ef],Lx=kf.toLowerCase(),Ux=kf[0].toUpperCase()+kf.slice(1);er(Lx,"on"+Ux)}er(xm,"onAnimationEnd"),er(wm,"onAnimationIteration"),er(Sm,"onAnimationStart"),er("dblclick","onDoubleClick"),er("focusin","onFocus"),er("focusout","onBlur"),er(Wv,"onTransitionRun"),er(ex,"onTransitionStart"),er(tx,"onTransitionCancel"),er(_m,"onTransitionEnd"),re("onMouseEnter",["mouseout","mouseover"]),re("onMouseLeave",["mouseout","mouseover"]),re("onPointerEnter",["pointerout","pointerover"]),re("onPointerLeave",["pointerout","pointerover"]),be("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),be("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),be("onBeforeInput",["compositionend","keypress","textInput","paste"]),be("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ys="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(" "),Bx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ys));function $g(t,i){i=(i&4)!==0;for(var s=0;s<t.length;s++){var o=t[s],h=o.event;o=o.listeners;e:{var p=void 0;if(i)for(var v=o.length-1;0<=v;v--){var _=o[v],P=_.instance,te=_.currentTarget;if(_=_.listener,P!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=te;try{p(h)}catch(le){Vl(le)}h.currentTarget=null,p=P}else for(v=0;v<o.length;v++){if(_=o[v],P=_.instance,te=_.currentTarget,_=_.listener,P!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=te;try{p(h)}catch(le){Vl(le)}h.currentTarget=null,p=P}}}}function Qe(t,i){var s=i[zi];s===void 0&&(s=i[zi]=new Set);var o=t+"__bubble";s.has(o)||(Gg(i,t,2,!1),s.add(o))}function Af(t,i,s){var o=0;i&&(o|=4),Gg(s,t,o,i)}var Do="_reactListening"+Math.random().toString(36).slice(2);function Cf(t){if(!t[Do]){t[Do]=!0,Z.forEach(function(s){s!=="selectionchange"&&(Bx.has(s)||Af(s,!1,t),Af(s,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[Do]||(i[Do]=!0,Af("selectionchange",!1,i))}}function Gg(t,i,s,o){switch(xy(i)){case 2:var h=hw;break;case 8:h=dw;break;default:h=If}s=h.bind(null,i,s,t),h=void 0,!Yu||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(i,s,{capture:!0,passive:h}):t.addEventListener(i,s,!0):h!==void 0?t.addEventListener(i,s,{passive:h}):t.addEventListener(i,s,!1)}function Tf(t,i,s,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 _=o.stateNode.containerInfo;if(_===h)break;if(v===4)for(v=o.return;v!==null;){var P=v.tag;if((P===3||P===4)&&v.stateNode.containerInfo===h)return;v=v.return}for(;_!==null;){if(v=E(_),v===null)return;if(P=v.tag,P===5||P===6||P===26||P===27){o=p=v;continue e}_=_.parentNode}}o=o.return}Qd(function(){var te=p,le=$u(s),pe=[];e:{var ne=Em.get(t);if(ne!==void 0){var ie=$l,Ne=t;switch(t){case"keypress":if(Il(s)===0)break e;case"keydown":case"keyup":ie=Nv;break;case"focusin":Ne="focus",ie=Qu;break;case"focusout":Ne="blur",ie=Qu;break;case"beforeblur":case"afterblur":ie=Qu;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=Wd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=vv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=Dv;break;case xm:case wm:case Sm:ie=Sv;break;case _m:ie=Lv;break;case"scroll":case"scrollend":ie=yv;break;case"wheel":ie=Bv;break;case"copy":case"cut":case"paste":ie=Ev;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=tm;break;case"toggle":case"beforetoggle":ie=qv}var Ue=(i&4)!==0,mt=!Ue&&(t==="scroll"||t==="scrollend"),Q=Ue?ne!==null?ne+"Capture":null:ne;Ue=[];for(var F=te,ee;F!==null;){var ce=F;if(ee=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||ee===null||Q===null||(ce=ms(F,Q),ce!=null&&Ue.push(Vs(F,ce,ee))),mt)break;F=F.return}0<Ue.length&&(ne=new ie(ne,Ne,null,s,le),pe.push({event:ne,listeners:Ue}))}}if((i&7)===0){e:{if(ne=t==="mouseover"||t==="pointerover",ie=t==="mouseout"||t==="pointerout",ne&&s!==Fu&&(Ne=s.relatedTarget||s.fromElement)&&(E(Ne)||Ne[vn]))break e;if((ie||ne)&&(ne=le.window===le?le:(ne=le.ownerDocument)?ne.defaultView||ne.parentWindow:window,ie?(Ne=s.relatedTarget||s.toElement,ie=te,Ne=Ne?E(Ne):null,Ne!==null&&(mt=u(Ne),Ue=Ne.tag,Ne!==mt||Ue!==5&&Ue!==27&&Ue!==6)&&(Ne=null)):(ie=null,Ne=te),ie!==Ne)){if(Ue=Wd,ce="onMouseLeave",Q="onMouseEnter",F="mouse",(t==="pointerout"||t==="pointerover")&&(Ue=tm,ce="onPointerLeave",Q="onPointerEnter",F="pointer"),mt=ie==null?ne:C(ie),ee=Ne==null?ne:C(Ne),ne=new Ue(ce,F+"leave",ie,s,le),ne.target=mt,ne.relatedTarget=ee,ce=null,E(le)===te&&(Ue=new Ue(Q,F+"enter",Ne,s,le),Ue.target=ee,Ue.relatedTarget=mt,ce=Ue),mt=ce,ie&&Ne)t:{for(Ue=Px,Q=ie,F=Ne,ee=0,ce=Q;ce;ce=Ue(ce))ee++;ce=0;for(var De=F;De;De=Ue(De))ce++;for(;0<ee-ce;)Q=Ue(Q),ee--;for(;0<ce-ee;)F=Ue(F),ce--;for(;ee--;){if(Q===F||F!==null&&Q===F.alternate){Ue=Q;break t}Q=Ue(Q),F=Ue(F)}Ue=null}else Ue=null;ie!==null&&Yg(pe,ne,ie,Ue,!1),Ne!==null&&mt!==null&&Yg(pe,mt,Ne,Ue,!0)}}e:{if(ne=te?C(te):window,ie=ne.nodeName&&ne.nodeName.toLowerCase(),ie==="select"||ie==="input"&&ne.type==="file")var at=um;else if(lm(ne))if(cm)at=Qv;else{at=Jv;var Re=Vv}else ie=ne.nodeName,!ie||ie.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&Iu(te.elementType)&&(at=um):at=Xv;if(at&&(at=at(t,te))){om(pe,at,s,le);break e}Re&&Re(t,ne,te),t==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&Hu(ne,"number",ne.value)}switch(Re=te?C(te):window,t){case"focusin":(lm(Re)||Re.contentEditable==="true")&&(ha=Re,nc=te,Ss=null);break;case"focusout":Ss=nc=ha=null;break;case"mousedown":rc=!0;break;case"contextmenu":case"mouseup":case"dragend":rc=!1,bm(pe,s,le);break;case"selectionchange":if(Zv)break;case"keydown":case"keyup":bm(pe,s,le)}var Ge;if(Zu)e:{switch(t){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else fa?am(t,s)&&(We="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(We="onCompositionStart");We&&(nm&&s.locale!=="ko"&&(fa||We!=="onCompositionStart"?We==="onCompositionEnd"&&fa&&(Ge=Kd()):(Wr=le,Vu="value"in Wr?Wr.value:Wr.textContent,fa=!0)),Re=zo(te,We),0<Re.length&&(We=new em(We,t,null,s,le),pe.push({event:We,listeners:Re}),Ge?We.data=Ge:(Ge=sm(s),Ge!==null&&(We.data=Ge)))),(Ge=Iv?Fv(t,s):$v(t,s))&&(We=zo(te,"onBeforeInput"),0<We.length&&(Re=new em("onBeforeInput","beforeinput",null,s,le),pe.push({event:Re,listeners:We}),Re.data=Ge)),zx(pe,t,te,s,le)}$g(pe,i)})}function Vs(t,i,s){return{instance:t,listener:i,currentTarget:s}}function zo(t,i){for(var s=i+"Capture",o=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=ms(t,s),h!=null&&o.unshift(Vs(t,h,p)),h=ms(t,i),h!=null&&o.push(Vs(t,h,p))),t.tag===3)return o;t=t.return}return[]}function Px(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Yg(t,i,s,o,h){for(var p=i._reactName,v=[];s!==null&&s!==o;){var _=s,P=_.alternate,te=_.stateNode;if(_=_.tag,P!==null&&P===o)break;_!==5&&_!==26&&_!==27||te===null||(P=te,h?(te=ms(s,p),te!=null&&v.unshift(Vs(s,te,P))):h||(te=ms(s,p),te!=null&&v.push(Vs(s,te,P)))),s=s.return}v.length!==0&&t.push({event:i,listeners:v})}var qx=/\r\n?/g,Hx=/\u0000|\uFFFD/g;function Vg(t){return(typeof t=="string"?t:""+t).replace(qx,`
49
- `).replace(Hx,"")}function Jg(t,i){return i=Vg(i),Vg(t)===i}function dt(t,i,s,o,h,p){switch(s){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||oa(t,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&oa(t,""+o);break;case"className":Wn(t,"class",o);break;case"tabIndex":Wn(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Wn(t,s,o);break;case"style":Jd(t,o,p);break;case"data":if(i!=="object"){Wn(t,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||s!=="href")){t.removeAttribute(s);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(s);break}o=ql(""+o),t.setAttribute(s,o);break;case"action":case"formAction":if(typeof o=="function"){t.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(s==="formAction"?(i!=="input"&&dt(t,i,"name",h.name,h,null),dt(t,i,"formEncType",h.formEncType,h,null),dt(t,i,"formMethod",h.formMethod,h,null),dt(t,i,"formTarget",h.formTarget,h,null)):(dt(t,i,"encType",h.encType,h,null),dt(t,i,"method",h.method,h,null),dt(t,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(s);break}o=ql(""+o),t.setAttribute(s,o);break;case"onClick":o!=null&&(t.onclick=kr);break;case"onScroll":o!=null&&Qe("scroll",t);break;case"onScrollEnd":o!=null&&Qe("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(s=o.__html,s!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=s}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){t.removeAttribute("xlink:href");break}s=ql(""+o),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(s,""+o):t.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(s,""):t.removeAttribute(s);break;case"capture":case"download":o===!0?t.setAttribute(s,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(s,o):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(s,o):t.removeAttribute(s);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(s):t.setAttribute(s,o);break;case"popover":Qe("beforetoggle",t),Qe("toggle",t),Wt(t,"popover",o);break;case"xlinkActuate":Er(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Er(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Er(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Er(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Er(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Er(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Er(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Er(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Er(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Wt(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=pv.get(s)||s,Wt(t,s,o))}}function jf(t,i,s,o,h,p){switch(s){case"style":Jd(t,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(s=o.__html,s!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=s}}break;case"children":typeof o=="string"?oa(t,o):(typeof o=="number"||typeof o=="bigint")&&oa(t,""+o);break;case"onScroll":o!=null&&Qe("scroll",t);break;case"onScrollEnd":o!=null&&Qe("scrollend",t);break;case"onClick":o!=null&&(t.onclick=kr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!me.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(h=s.endsWith("Capture"),i=s.slice(2,h?s.length-7:void 0),p=t[Ot]||null,p=p!=null?p[s]:null,typeof p=="function"&&t.removeEventListener(i,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(i,o,h);break e}s in t?t[s]=o:o===!0?t.setAttribute(s,""):Wt(t,s,o)}}}function Zt(t,i,s){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",t),Qe("load",t);var o=!1,h=!1,p;for(p in s)if(s.hasOwnProperty(p)){var v=s[p];if(v!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:dt(t,i,p,v,s,null)}}h&&dt(t,i,"srcSet",s.srcSet,s,null),o&&dt(t,i,"src",s.src,s,null);return;case"input":Qe("invalid",t);var _=p=v=h=null,P=null,te=null;for(o in s)if(s.hasOwnProperty(o)){var le=s[o];if(le!=null)switch(o){case"name":h=le;break;case"type":v=le;break;case"checked":P=le;break;case"defaultChecked":te=le;break;case"value":p=le;break;case"defaultValue":_=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(a(137,i));break;default:dt(t,i,o,le,s,null)}}$d(t,p,_,P,te,v,h,!1);return;case"select":Qe("invalid",t),o=v=p=null;for(h in s)if(s.hasOwnProperty(h)&&(_=s[h],_!=null))switch(h){case"value":p=_;break;case"defaultValue":v=_;break;case"multiple":o=_;default:dt(t,i,h,_,s,null)}i=p,s=v,t.multiple=!!o,i!=null?la(t,!!o,i,!1):s!=null&&la(t,!!o,s,!0);return;case"textarea":Qe("invalid",t),p=h=o=null;for(v in s)if(s.hasOwnProperty(v)&&(_=s[v],_!=null))switch(v){case"value":o=_;break;case"defaultValue":h=_;break;case"children":p=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(a(91));break;default:dt(t,i,v,_,s,null)}Yd(t,o,h,p);return;case"option":for(P in s)if(s.hasOwnProperty(P)&&(o=s[P],o!=null))switch(P){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:dt(t,i,P,o,s,null)}return;case"dialog":Qe("beforetoggle",t),Qe("toggle",t),Qe("cancel",t),Qe("close",t);break;case"iframe":case"object":Qe("load",t);break;case"video":case"audio":for(o=0;o<Ys.length;o++)Qe(Ys[o],t);break;case"image":Qe("error",t),Qe("load",t);break;case"details":Qe("toggle",t);break;case"embed":case"source":case"link":Qe("error",t),Qe("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in s)if(s.hasOwnProperty(te)&&(o=s[te],o!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:dt(t,i,te,o,s,null)}return;default:if(Iu(i)){for(le in s)s.hasOwnProperty(le)&&(o=s[le],o!==void 0&&jf(t,i,le,o,s,void 0));return}}for(_ in s)s.hasOwnProperty(_)&&(o=s[_],o!=null&&dt(t,i,_,o,s,null))}function Ix(t,i,s,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,v=null,_=null,P=null,te=null,le=null;for(ie in s){var pe=s[ie];if(s.hasOwnProperty(ie)&&pe!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":P=pe;default:o.hasOwnProperty(ie)||dt(t,i,ie,null,o,pe)}}for(var ne in o){var ie=o[ne];if(pe=s[ne],o.hasOwnProperty(ne)&&(ie!=null||pe!=null))switch(ne){case"type":p=ie;break;case"name":h=ie;break;case"checked":te=ie;break;case"defaultChecked":le=ie;break;case"value":v=ie;break;case"defaultValue":_=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(a(137,i));break;default:ie!==pe&&dt(t,i,ne,ie,o,pe)}}qu(t,v,_,P,te,le,p,h);return;case"select":ie=v=_=ne=null;for(p in s)if(P=s[p],s.hasOwnProperty(p)&&P!=null)switch(p){case"value":break;case"multiple":ie=P;default:o.hasOwnProperty(p)||dt(t,i,p,null,o,P)}for(h in o)if(p=o[h],P=s[h],o.hasOwnProperty(h)&&(p!=null||P!=null))switch(h){case"value":ne=p;break;case"defaultValue":_=p;break;case"multiple":v=p;default:p!==P&&dt(t,i,h,p,o,P)}i=_,s=v,o=ie,ne!=null?la(t,!!s,ne,!1):!!o!=!!s&&(i!=null?la(t,!!s,i,!0):la(t,!!s,s?[]:"",!1));return;case"textarea":ie=ne=null;for(_ in s)if(h=s[_],s.hasOwnProperty(_)&&h!=null&&!o.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:dt(t,i,_,null,o,h)}for(v in o)if(h=o[v],p=s[v],o.hasOwnProperty(v)&&(h!=null||p!=null))switch(v){case"value":ne=h;break;case"defaultValue":ie=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(a(91));break;default:h!==p&&dt(t,i,v,h,o,p)}Gd(t,ne,ie);return;case"option":for(var Ne in s)if(ne=s[Ne],s.hasOwnProperty(Ne)&&ne!=null&&!o.hasOwnProperty(Ne))switch(Ne){case"selected":t.selected=!1;break;default:dt(t,i,Ne,null,o,ne)}for(P in o)if(ne=o[P],ie=s[P],o.hasOwnProperty(P)&&ne!==ie&&(ne!=null||ie!=null))switch(P){case"selected":t.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:dt(t,i,P,ne,o,ie)}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 Ue in s)ne=s[Ue],s.hasOwnProperty(Ue)&&ne!=null&&!o.hasOwnProperty(Ue)&&dt(t,i,Ue,null,o,ne);for(te in o)if(ne=o[te],ie=s[te],o.hasOwnProperty(te)&&ne!==ie&&(ne!=null||ie!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(a(137,i));break;default:dt(t,i,te,ne,o,ie)}return;default:if(Iu(i)){for(var mt in s)ne=s[mt],s.hasOwnProperty(mt)&&ne!==void 0&&!o.hasOwnProperty(mt)&&jf(t,i,mt,void 0,o,ne);for(le in o)ne=o[le],ie=s[le],!o.hasOwnProperty(le)||ne===ie||ne===void 0&&ie===void 0||jf(t,i,le,ne,o,ie);return}}for(var Q in s)ne=s[Q],s.hasOwnProperty(Q)&&ne!=null&&!o.hasOwnProperty(Q)&&dt(t,i,Q,null,o,ne);for(pe in o)ne=o[pe],ie=s[pe],!o.hasOwnProperty(pe)||ne===ie||ne==null&&ie==null||dt(t,i,pe,ne,o,ie)}function Xg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Fx(){if(typeof performance.getEntriesByType=="function"){for(var t=0,i=0,s=performance.getEntriesByType("resource"),o=0;o<s.length;o++){var h=s[o],p=h.transferSize,v=h.initiatorType,_=h.duration;if(p&&_&&Xg(v)){for(v=0,_=h.responseEnd,o+=1;o<s.length;o++){var P=s[o],te=P.startTime;if(te>_)break;var le=P.transferSize,pe=P.initiatorType;le&&Xg(pe)&&(P=P.responseEnd,v+=le*(P<_?1:(_-te)/(P-te)))}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 Of=null,Nf=null;function Lo(t){return t.nodeType===9?t:t.ownerDocument}function Qg(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 Kg(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 Rf(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 Mf=null;function $x(){var t=window.event;return t&&t.type==="popstate"?t===Mf?!1:(Mf=t,!0):(Mf=null,!1)}var Zg=typeof setTimeout=="function"?setTimeout:void 0,Gx=typeof clearTimeout=="function"?clearTimeout:void 0,Wg=typeof Promise=="function"?Promise:void 0,Yx=typeof queueMicrotask=="function"?queueMicrotask:typeof Wg<"u"?function(t){return Wg.resolve(null).then(t).catch(Vx)}:Zg;function Vx(t){setTimeout(function(){throw t})}function gi(t){return t==="head"}function ey(t,i){var s=i,o=0;do{var h=s.nextSibling;if(t.removeChild(s),h&&h.nodeType===8)if(s=h.data,s==="/$"||s==="/&"){if(o===0){t.removeChild(h),Pa(i);return}o--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")o++;else if(s==="html")Js(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,Js(s);for(var p=s.firstChild;p;){var v=p.nextSibling,_=p.nodeName;p[Ft]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&p.rel.toLowerCase()==="stylesheet"||s.removeChild(p),p=v}}else s==="body"&&Js(t.ownerDocument.body);s=h}while(s);Pa(i)}function ty(t,i){var s=t;t=0;do{var o=s.nextSibling;if(s.nodeType===1?i?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(i?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),o&&o.nodeType===8)if(s=o.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=o}while(s)}function Df(t){var i=t.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var s=i;switch(i=i.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Df(s),sa(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function Jx(t,i,s,o){for(;t.nodeType===1;){var h=s;if(t.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[Ft])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=Gn(t.nextSibling),t===null)break}return null}function Xx(t,i,s){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=Gn(t.nextSibling),t===null))return null;return t}function ny(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Gn(t.nextSibling),t===null))return null;return t}function zf(t){return t.data==="$?"||t.data==="$~"}function Lf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Qx(t,i){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=i;else if(t.data!=="$?"||s.readyState!=="loading")i();else{var o=function(){i(),s.removeEventListener("DOMContentLoaded",o)};s.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function Gn(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 Uf=null;function ry(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(i===0)return Gn(t.nextSibling);i--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||i++}t=t.nextSibling}return null}function iy(t){t=t.previousSibling;for(var i=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(i===0)return t;i--}else s!=="/$"&&s!=="/&"||i++}t=t.previousSibling}return null}function ay(t,i,s){switch(i=Lo(s),t){case"html":if(t=i.documentElement,!t)throw Error(a(452));return t;case"head":if(t=i.head,!t)throw Error(a(453));return t;case"body":if(t=i.body,!t)throw Error(a(454));return t;default:throw Error(a(451))}}function Js(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);sa(t)}var Yn=new Map,sy=new Set;function Uo(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Hr=ae.d;ae.d={f:Kx,r:Zx,D:Wx,C:ew,L:tw,m:nw,X:iw,S:rw,M:aw};function Kx(){var t=Hr.f(),i=To();return t||i}function Zx(t){var i=j(t);i!==null&&i.tag===5&&i.type==="form"?_p(i):Hr.r(t)}var La=typeof document>"u"?null:document;function ly(t,i,s){var o=La;if(o&&typeof i=="string"&&i){var h=Bn(i);h='link[rel="'+t+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),sy.has(h)||(sy.add(h),t={rel:t,crossOrigin:s,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),Zt(i,"link",t),H(i),o.head.appendChild(i)))}}function Wx(t){Hr.D(t),ly("dns-prefetch",t,null)}function ew(t,i){Hr.C(t,i),ly("preconnect",t,i)}function tw(t,i,s){Hr.L(t,i,s);var o=La;if(o&&t&&i){var h='link[rel="preload"][as="'+Bn(i)+'"]';i==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+Bn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+Bn(s.imageSizes)+'"]')):h+='[href="'+Bn(t)+'"]';var p=h;switch(i){case"style":p=Ua(t);break;case"script":p=Ba(t)}Yn.has(p)||(t=g({rel:"preload",href:i==="image"&&s&&s.imageSrcSet?void 0:t,as:i},s),Yn.set(p,t),o.querySelector(h)!==null||i==="style"&&o.querySelector(Xs(p))||i==="script"&&o.querySelector(Qs(p))||(i=o.createElement("link"),Zt(i,"link",t),H(i),o.head.appendChild(i)))}}function nw(t,i){Hr.m(t,i);var s=La;if(s&&t){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Bn(o)+'"][href="'+Bn(t)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Ba(t)}if(!Yn.has(p)&&(t=g({rel:"modulepreload",href:t},i),Yn.set(p,t),s.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Qs(p)))return}o=s.createElement("link"),Zt(o,"link",t),H(o),s.head.appendChild(o)}}}function rw(t,i,s){Hr.S(t,i,s);var o=La;if(o&&t){var h=z(o).hoistableStyles,p=Ua(t);i=i||"default";var v=h.get(p);if(!v){var _={loading:0,preload:null};if(v=o.querySelector(Xs(p)))_.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":i},s),(s=Yn.get(p))&&Bf(t,s);var P=v=o.createElement("link");H(P),Zt(P,"link",t),P._p=new Promise(function(te,le){P.onload=te,P.onerror=le}),P.addEventListener("load",function(){_.loading|=1}),P.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Bo(v,i,o)}v={type:"stylesheet",instance:v,count:1,state:_},h.set(p,v)}}}function iw(t,i){Hr.X(t,i);var s=La;if(s&&t){var o=z(s).hoistableScripts,h=Ba(t),p=o.get(h);p||(p=s.querySelector(Qs(h)),p||(t=g({src:t,async:!0},i),(i=Yn.get(h))&&Pf(t,i),p=s.createElement("script"),H(p),Zt(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function aw(t,i){Hr.M(t,i);var s=La;if(s&&t){var o=z(s).hoistableScripts,h=Ba(t),p=o.get(h);p||(p=s.querySelector(Qs(h)),p||(t=g({src:t,async:!0,type:"module"},i),(i=Yn.get(h))&&Pf(t,i),p=s.createElement("script"),H(p),Zt(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function oy(t,i,s,o){var h=(h=ve.current)?Uo(h):null;if(!h)throw Error(a(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(i=Ua(s.href),s=z(h).hoistableStyles,o=s.get(i),o||(o={type:"style",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=Ua(s.href);var p=z(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(Xs(t)))&&!p._p&&(v.instance=p,v.state.loading=5),Yn.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Yn.set(t,s),p||sw(h,t,s,v.state))),i&&o===null)throw Error(a(528,""));return v}if(i&&o!==null)throw Error(a(529,""));return null;case"script":return i=s.async,s=s.src,typeof s=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Ba(s),s=z(h).hoistableScripts,o=s.get(i),o||(o={type:"script",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,t))}}function Ua(t){return'href="'+Bn(t)+'"'}function Xs(t){return'link[rel="stylesheet"]['+t+"]"}function uy(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function sw(t,i,s,o){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=t.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),Zt(i,"link",s),H(i),t.head.appendChild(i))}function Ba(t){return'[src="'+Bn(t)+'"]'}function Qs(t){return"script[async]"+t}function cy(t,i,s){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+Bn(s.href)+'"]');if(o)return i.instance=o,H(o),o;var h=g({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),H(o),Zt(o,"style",h),Bo(o,s.precedence,t),i.instance=o;case"stylesheet":h=Ua(s.href);var p=t.querySelector(Xs(h));if(p)return i.state.loading|=4,i.instance=p,H(p),p;o=uy(s),(h=Yn.get(h))&&Bf(o,h),p=(t.ownerDocument||t).createElement("link"),H(p);var v=p;return v._p=new Promise(function(_,P){v.onload=_,v.onerror=P}),Zt(p,"link",o),i.state.loading|=4,Bo(p,s.precedence,t),i.instance=p;case"script":return p=Ba(s.src),(h=t.querySelector(Qs(p)))?(i.instance=h,H(h),h):(o=s,(h=Yn.get(p))&&(o=g({},s),Pf(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),H(h),Zt(h,"link",o),t.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Bo(o,s.precedence,t));return i.instance}function Bo(t,i,s){for(var o=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,v=0;v<o.length;v++){var _=o[v];if(_.dataset.precedence===i)p=_;else if(p!==h)break}p?p.parentNode.insertBefore(t,p.nextSibling):(i=s.nodeType===9?s.head:s,i.insertBefore(t,i.firstChild))}function Bf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function Pf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.integrity==null&&(t.integrity=i.integrity)}var Po=null;function fy(t,i,s){if(Po===null){var o=new Map,h=Po=new Map;h.set(s,o)}else h=Po,o=h.get(s),o||(o=new Map,h.set(s,o));if(o.has(t))return o;for(o.set(t,null),s=s.getElementsByTagName(t),h=0;h<s.length;h++){var p=s[h];if(!(p[Ft]||p[gt]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var v=p.getAttribute(i)||"";v=t+v;var _=o.get(v);_?_.push(p):o.set(v,[p])}}return o}function hy(t,i,s){t=t.ownerDocument||t,t.head.insertBefore(s,i==="title"?t.querySelector("head > title"):null)}function lw(t,i,s){if(s===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return t=i.disabled,typeof i.precedence=="string"&&t==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function dy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function ow(t,i,s,o){if(s.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var h=Ua(o.href),p=i.querySelector(Xs(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=qo.bind(t),i.then(t,t)),s.state.loading|=4,s.instance=p,H(p);return}p=i.ownerDocument||i,o=uy(o),(h=Yn.get(h))&&Bf(o,h),p=p.createElement("link"),H(p);var v=p;v._p=new Promise(function(_,P){v.onload=_,v.onerror=P}),Zt(p,"link",o),s.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=qo.bind(t),i.addEventListener("load",s),i.addEventListener("error",s))}}var qf=0;function uw(t,i){return t.stylesheets&&t.count===0&&Io(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var o=setTimeout(function(){if(t.stylesheets&&Io(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+i);0<t.imgBytes&&qf===0&&(qf=62500*Fx());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Io(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>qf?50:800)+i);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function qo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Io(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Ho=null;function Io(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Ho=new Map,i.forEach(cw,t),Ho=null,qo.call(t))}function cw(t,i){if(!(i.state.loading&4)){var s=Ho.get(t);if(s)var o=s.get(null);else{s=new Map,Ho.set(t,s);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")&&(s.set(v.dataset.precedence,v),o=v)}o&&s.set(null,o)}h=i.instance,v=h.getAttribute("data-precedence"),p=s.get(v)||o,p===o&&s.set(null,h),s.set(v,h),this.count++,o=qo.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 Ks={$$typeof:V,Provider:null,Consumer:null,_currentValue:ge,_currentValue2:ge,_threadCount:0};function fw(t,i,s,o,h,p,v,_,P){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=Xr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xr(0),this.hiddenUpdates=Xr(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=P,this.incompleteTransitions=new Map}function my(t,i,s,o,h,p,v,_,P,te,le,pe){return t=new fw(t,i,s,v,P,te,le,pe,_),i=1,p===!0&&(i|=24),p=wn(3,null,null,i),t.current=p,p.stateNode=t,i=bc(),i.refCount++,t.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:s,cache:i},Sc(p),t}function py(t){return t?(t=pa,t):pa}function gy(t,i,s,o,h,p){h=py(h),o.context===null?o.context=h:o.pendingContext=h,o=ai(i),o.payload={element:s},p=p===void 0?null:p,p!==null&&(o.callback=p),s=si(t,o,i),s!==null&&(gn(s,t,i),js(s,t,i))}function yy(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<i?s:i}}function Hf(t,i){yy(t,i),(t=t.alternate)&&yy(t,i)}function by(t){if(t.tag===13||t.tag===31){var i=Pi(t,67108864);i!==null&&gn(i,t,67108864),Hf(t,67108864)}}function vy(t){if(t.tag===13||t.tag===31){var i=An();i=_r(i);var s=Pi(t,i);s!==null&&gn(s,t,i),Hf(t,i)}}var Fo=!0;function hw(t,i,s,o){var h=I.T;I.T=null;var p=ae.p;try{ae.p=2,If(t,i,s,o)}finally{ae.p=p,I.T=h}}function dw(t,i,s,o){var h=I.T;I.T=null;var p=ae.p;try{ae.p=8,If(t,i,s,o)}finally{ae.p=p,I.T=h}}function If(t,i,s,o){if(Fo){var h=Ff(o);if(h===null)Tf(t,i,o,$o,s),wy(t,o);else if(pw(h,t,i,s,o))o.stopPropagation();else if(wy(t,o),i&4&&-1<mw.indexOf(t)){for(;h!==null;){var p=j(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var v=Kn(p.pendingLanes);if(v!==0){var _=p;for(_.pendingLanes|=2,_.entangledLanes|=2;v;){var P=1<<31-ot(v);_.entanglements[1]|=P,v&=~P}fr(p),(lt&6)===0&&(Ao=vt()+500,Gs(0))}}break;case 31:case 13:_=Pi(p,2),_!==null&&gn(_,p,2),To(),Hf(p,2)}if(p=Ff(o),p===null&&Tf(t,i,o,$o,s),p===h)break;h=p}h!==null&&o.stopPropagation()}else Tf(t,i,o,null,s)}}function Ff(t){return t=$u(t),$f(t)}var $o=null;function $f(t){if($o=null,t=E(t),t!==null){var i=u(t);if(i===null)t=null;else{var s=i.tag;if(s===13){if(t=c(i),t!==null)return t;t=null}else if(s===31){if(t=f(i),t!==null)return t;t=null}else if(s===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;t=null}else i!==t&&(t=null)}}return $o=t,null}function xy(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(cs()){case oe:return 2;case we:return 8;case Pe:case Ve:return 32;case it:return 268435456;default:return 32}default:return 32}}var Gf=!1,yi=null,bi=null,vi=null,Zs=new Map,Ws=new Map,xi=[],mw="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 wy(t,i){switch(t){case"focusin":case"focusout":yi=null;break;case"dragenter":case"dragleave":bi=null;break;case"mouseover":case"mouseout":vi=null;break;case"pointerover":case"pointerout":Zs.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ws.delete(i.pointerId)}}function el(t,i,s,o,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:i,domEventName:s,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=j(i),i!==null&&by(i)),t):(t.eventSystemFlags|=o,i=t.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),t)}function pw(t,i,s,o,h){switch(i){case"focusin":return yi=el(yi,t,i,s,o,h),!0;case"dragenter":return bi=el(bi,t,i,s,o,h),!0;case"mouseover":return vi=el(vi,t,i,s,o,h),!0;case"pointerover":var p=h.pointerId;return Zs.set(p,el(Zs.get(p)||null,t,i,s,o,h)),!0;case"gotpointercapture":return p=h.pointerId,Ws.set(p,el(Ws.get(p)||null,t,i,s,o,h)),!0}return!1}function Sy(t){var i=E(t.target);if(i!==null){var s=u(i);if(s!==null){if(i=s.tag,i===13){if(i=c(s),i!==null){t.blockedOn=i,Ll(t.priority,function(){vy(s)});return}}else if(i===31){if(i=f(s),i!==null){t.blockedOn=i,Ll(t.priority,function(){vy(s)});return}}else if(i===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Go(t){if(t.blockedOn!==null)return!1;for(var i=t.targetContainers;0<i.length;){var s=Ff(t.nativeEvent);if(s===null){s=t.nativeEvent;var o=new s.constructor(s.type,s);Fu=o,s.target.dispatchEvent(o),Fu=null}else return i=j(s),i!==null&&by(i),t.blockedOn=s,!1;i.shift()}return!0}function _y(t,i,s){Go(t)&&s.delete(i)}function gw(){Gf=!1,yi!==null&&Go(yi)&&(yi=null),bi!==null&&Go(bi)&&(bi=null),vi!==null&&Go(vi)&&(vi=null),Zs.forEach(_y),Ws.forEach(_y)}function Yo(t,i){t.blockedOn===i&&(t.blockedOn=null,Gf||(Gf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,gw)))}var Vo=null;function Ey(t){Vo!==t&&(Vo=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Vo===t&&(Vo=null);for(var i=0;i<t.length;i+=3){var s=t[i],o=t[i+1],h=t[i+2];if(typeof o!="function"){if($f(o||s)===null)continue;break}var p=j(s);p!==null&&(t.splice(i,3),i-=3,Ic(p,{pending:!0,data:h,method:s.method,action:o},o,h))}}))}function Pa(t){function i(P){return Yo(P,t)}yi!==null&&Yo(yi,t),bi!==null&&Yo(bi,t),vi!==null&&Yo(vi,t),Zs.forEach(i),Ws.forEach(i);for(var s=0;s<xi.length;s++){var o=xi[s];o.blockedOn===t&&(o.blockedOn=null)}for(;0<xi.length&&(s=xi[0],s.blockedOn===null);)Sy(s),s.blockedOn===null&&xi.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(o=0;o<s.length;o+=3){var h=s[o],p=s[o+1],v=h[Ot]||null;if(typeof p=="function")v||Ey(s);else if(v){var _=null;if(p&&p.hasAttribute("formAction")){if(h=p,v=p[Ot]||null)_=v.formAction;else if($f(h)!==null)continue}else _=v.action;typeof _=="function"?s[o+1]=_:(s.splice(o,3),o-=3),Ey(s)}}}function ky(){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(s,20)}function s(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(s,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function Yf(t){this._internalRoot=t}Jo.prototype.render=Yf.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(a(409));var s=i.current,o=An();gy(s,o,t,i,null,null)},Jo.prototype.unmount=Yf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;gy(t.current,2,null,t,null,null),To(),i[vn]=null}};function Jo(t){this._internalRoot=t}Jo.prototype.unstable_scheduleHydration=function(t){if(t){var i=hs();t={blockedOn:null,target:t,priority:i};for(var s=0;s<xi.length&&i!==0&&i<xi[s].priority;s++);xi.splice(s,0,t),s===0&&Sy(t)}};var Ay=n.version;if(Ay!=="19.2.4")throw Error(a(527,Ay,"19.2.4"));ae.findDOMNode=function(t){var i=t._reactInternals;if(i===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=d(i),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var yw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xo.isDisabled&&Xo.supportsFiber)try{Jt=Xo.inject(yw),pt=Xo}catch{}}return nl.createRoot=function(t,i){if(!l(t))throw Error(a(299));var s=!1,o="",h=Mp,p=Dp,v=zp;return i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(v=i.onRecoverableError)),i=my(t,1,!1,null,null,s,o,null,h,p,v,ky),t[vn]=i.current,Cf(t),new Yf(i)},nl.hydrateRoot=function(t,i,s){if(!l(t))throw Error(a(299));var o=!1,h="",p=Mp,v=Dp,_=zp,P=null;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(h=s.identifierPrefix),s.onUncaughtError!==void 0&&(p=s.onUncaughtError),s.onCaughtError!==void 0&&(v=s.onCaughtError),s.onRecoverableError!==void 0&&(_=s.onRecoverableError),s.formState!==void 0&&(P=s.formState)),i=my(t,1,!0,i,s??null,o,h,P,p,v,_,ky),i.context=py(null),s=i.current,o=An(),o=_r(o),h=ai(o),h.callback=null,si(s,h,o),s=o,i.current.lanes=s,Zn(i,s),fr(i),t[vn]=i.current,Cf(t),new Jo(i)},nl.version="19.2.4",nl}var Ly;function Tw(){if(Ly)return Xf.exports;Ly=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(),Xf.exports=Cw(),Xf.exports}var jw=Tw();/**
48
+ `+o.stack}}var Rn=Object.prototype.hasOwnProperty,$r=e.unstable_scheduleCallback,Xn=e.unstable_cancelCallback,ra=e.unstable_shouldYield,Gr=e.unstable_requestPaint,vt=e.unstable_now,cs=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,Pe=e.unstable_NormalPriority,Ve=e.unstable_LowPriority,it=e.unstable_IdlePriority,tn=e.log,Mn=e.unstable_setDisableYieldValue,Yt=null,pt=null;function qt(t){if(typeof tn=="function"&&Mn(t),pt&&typeof pt.setStrictMode=="function")try{pt.setStrictMode(Yt,t)}catch{}}var ot=Math.clz32?Math.clz32:ia,Dn=Math.log,nn=Math.LN2;function ia(t){return t>>>=0,t===0?32:31-(Dn(t)/nn|0)|0}var Yr=256,vr=262144,Vr=4194304;function Qn(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 ji(t,i,s){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=Qn(o):(v&=S,v!==0?h=Qn(v):s||(s=S&~t,s!==0&&(h=Qn(s))))):(S=o&~p,S!==0?h=Qn(S):v!==0?h=Qn(v):s||(s=o&~t,s!==0&&(h=Qn(s)))),h===0?0:i!==0&&i!==h&&(i&p)===0&&(p=h&-h,s=i&-i,p>=s||p===32&&(s&4194048)!==0)?i:h}function Ni(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function fs(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 aa(){var t=Vr;return Vr<<=1,(Vr&62914560)===0&&(Vr=4194304),t}function Jr(t){for(var i=[],s=0;31>s;s++)i.push(t);return i}function Kn(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Xr(t,i,s,o,h,p){var v=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var S=t.entanglements,P=t.expirationTimes,te=t.hiddenUpdates;for(s=v&~s;0<s;){var le=31-ot(s),pe=1<<le;S[le]=0,P[le]=-1;var ne=te[le];if(ne!==null)for(te[le]=null,le=0;le<ne.length;le++){var ae=ne[le];ae!==null&&(ae.lane&=-536870913)}s&=~pe}o!==0&&Qr(t,o,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(v&~i))}function Qr(t,i,s){t.pendingLanes|=i,t.suspendedLanes&=~i;var o=31-ot(i);t.entangledLanes|=i,t.entanglements[o]=t.entanglements[o]|1073741824|s&261930}function Ri(t,i){var s=t.entangledLanes|=i;for(t=t.entanglements;s;){var o=31-ot(s),h=1<<o;h&i|t[o]&i&&(t[o]|=i),s&=~h}}function Kr(t,i){var s=i&-i;return s=(s&42)!==0?1:xr(s),(s&(t.suspendedLanes|i))!==0?0:s}function xr(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 Mi(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function hs(){var t=ie.p;return t!==0?t:(t=window.event,t===void 0?32:by(t.type))}function Ll(t,i){var s=ie.p;try{return ie.p=t,i()}finally{ie.p=s}}var sr=Math.random().toString(36).slice(2),gt="__reactFiber$"+sr,Ot="__reactProps$"+sr,yn="__reactContainer$"+sr,Di="__reactEvents$"+sr,ds="__reactListeners$"+sr,Ul="__reactHandles$"+sr,Bl="__reactResources$"+sr,Ht="__reactMarker$"+sr;function sa(t){delete t[gt],delete t[Ot],delete t[Di],delete t[ds],delete t[Ul]}function E(t){var i=t[gt];if(i)return i;for(var s=t.parentNode;s;){if(i=s[yn]||s[gt]){if(s=i.alternate,i.child!==null||s!==null&&s.child!==null)for(t=ny(t);t!==null;){if(s=t[gt])return s;t=ny(t)}return i}t=s,s=t.parentNode}return null}function T(t){if(t=t[gt]||t[yn]){var i=t.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return t}return null}function C(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t.stateNode;throw Error(a(33))}function z(t){var i=t[Bl];return i||(i=t[Bl]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function I(t){t[Ht]=!0}var Z=new Set,me={};function be(t,i){re(t,i),re(t+"Capture",i)}function re(t,i){for(me[t]=i,t=0;t<i.length;t++)Z.add(i[t])}var fe=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]*$"),je={},Je={};function wt(t){return Rn.call(Je,t)?!0:Rn.call(je,t)?!1:fe.test(t)?Je[t]=!0:(je[t]=!0,!1)}function Kt(t,i,s){if(wt(i))if(s===null)t.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":t.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(i);return}}t.setAttribute(i,""+s)}}function Zn(t,i,s){if(s===null)t.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttribute(i,""+s)}}function wr(t,i,s,o){if(o===null)t.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(i,s,""+o)}}function zn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function qd(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function hv(t,i,s){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,i);if(!t.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return h.call(this)},set:function(v){s=""+v,p.call(this,v)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return s},setValue:function(v){s=""+v},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function Pu(t){if(!t._valueTracker){var i=qd(t)?"checked":"value";t._valueTracker=hv(t,i,""+t[i])}}function Hd(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var s=i.getValue(),o="";return t&&(o=qd(t)?t.checked?"true":"false":t.value),t=o,t!==s?(i.setValue(t),!0):!1}function Pl(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 dv=/[\n"\\]/g;function Ln(t){return t.replace(dv,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function qu(t,i,s,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=""+zn(i)):t.value!==""+zn(i)&&(t.value=""+zn(i)):v!=="submit"&&v!=="reset"||t.removeAttribute("value"),i!=null?Hu(t,v,zn(i)):s!=null?Hu(t,v,zn(s)):o!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.name=""+zn(S):t.removeAttribute("name")}function Id(t,i,s,o,h,p,v,S){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),i!=null||s!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){Pu(t);return}s=s!=null?""+zn(s):"",i=i!=null?""+zn(i):s,S||i===t.value||(t.value=i),t.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=S?t.checked:!!o,t.defaultChecked=!!o,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.name=v),Pu(t)}function Hu(t,i,s){i==="number"&&Pl(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function la(t,i,s,o){if(t=t.options,i){i={};for(var h=0;h<s.length;h++)i["$"+s[h]]=!0;for(s=0;s<t.length;s++)h=i.hasOwnProperty("$"+t[s].value),t[s].selected!==h&&(t[s].selected=h),h&&o&&(t[s].defaultSelected=!0)}else{for(s=""+zn(s),i=null,h=0;h<t.length;h++){if(t[h].value===s){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}i!==null||t[h].disabled||(i=t[h])}i!==null&&(i.selected=!0)}}function Fd(t,i,s){if(i!=null&&(i=""+zn(i),i!==t.value&&(t.value=i),s==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=s!=null?""+zn(s):""}function $d(t,i,s,o){if(i==null){if(o!=null){if(s!=null)throw Error(a(92));if(q(o)){if(1<o.length)throw Error(a(93));o=o[0]}s=o}s==null&&(s=""),i=s}s=zn(i),t.defaultValue=s,o=t.textContent,o===s&&o!==""&&o!==null&&(t.value=o),Pu(t)}function oa(t,i){if(i){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=i;return}}t.textContent=i}var mv=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 Gd(t,i,s){var o=i.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?o?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="":o?t.setProperty(i,s):typeof s!="number"||s===0||mv.has(i)?i==="float"?t.cssFloat=s:t[i]=(""+s).trim():t[i]=s+"px"}function Yd(t,i,s){if(i!=null&&typeof i!="object")throw Error(a(62));if(t=t.style,s!=null){for(var o in s)!s.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var h in i)o=i[h],i.hasOwnProperty(h)&&s[h]!==o&&Gd(t,h,o)}else for(var p in i)i.hasOwnProperty(p)&&Gd(t,p,i[p])}function Iu(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 pv=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"]]),gv=/^[\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 ql(t){return gv.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Sr(){}var Fu=null;function $u(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ua=null,ca=null;function Vd(t){var i=T(t);if(i&&(t=i.stateNode)){var s=t[Ot]||null;e:switch(t=i.stateNode,i.type){case"input":if(qu(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),i=s.name,s.type==="radio"&&i!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Ln(""+i)+'"][type="radio"]'),i=0;i<s.length;i++){var o=s[i];if(o!==t&&o.form===t.form){var h=o[Ot]||null;if(!h)throw Error(a(90));qu(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<s.length;i++)o=s[i],o.form===t.form&&Hd(o)}break e;case"textarea":Fd(t,s.value,s.defaultValue);break e;case"select":i=s.value,i!=null&&la(t,!!s.multiple,i,!1)}}}var Gu=!1;function Jd(t,i,s){if(Gu)return t(i,s);Gu=!0;try{var o=t(i);return o}finally{if(Gu=!1,(ua!==null||ca!==null)&&(To(),ua&&(i=ua,t=ca,ca=ua=null,Vd(i),t)))for(i=0;i<t.length;i++)Vd(t[i])}}function ms(t,i){var s=t.stateNode;if(s===null)return null;var o=s[Ot]||null;if(o===null)return null;s=o[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(a(231,i,typeof s));return s}var _r=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yu=!1;if(_r)try{var ps={};Object.defineProperty(ps,"passive",{get:function(){Yu=!0}}),window.addEventListener("test",ps,ps),window.removeEventListener("test",ps,ps)}catch{Yu=!1}var Zr=null,Vu=null,Hl=null;function Xd(){if(Hl)return Hl;var t,i=Vu,s=i.length,o,h="value"in Zr?Zr.value:Zr.textContent,p=h.length;for(t=0;t<s&&i[t]===h[t];t++);var v=s-t;for(o=1;o<=v&&i[s-o]===h[p-o];o++);return Hl=h.slice(t,1<o?1-o:void 0)}function Il(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 Fl(){return!0}function Qd(){return!1}function un(t){function i(s,o,h,p,v){this._reactName=s,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=v,this.currentTarget=null;for(var S in t)t.hasOwnProperty(S)&&(s=t[S],this[S]=s?s(p):p[S]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Fl:Qd,this.isPropagationStopped=Qd,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Fl)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Fl)},persist:function(){},isPersistent:Fl}),i}var zi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$l=un(zi),gs=g({},zi,{view:0,detail:0}),yv=un(gs),Ju,Xu,ys,Gl=g({},gs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ku,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!==ys&&(ys&&t.type==="mousemove"?(Ju=t.screenX-ys.screenX,Xu=t.screenY-ys.screenY):Xu=Ju=0,ys=t),Ju)},movementY:function(t){return"movementY"in t?t.movementY:Xu}}),Kd=un(Gl),bv=g({},Gl,{dataTransfer:0}),vv=un(bv),xv=g({},gs,{relatedTarget:0}),Qu=un(xv),wv=g({},zi,{animationName:0,elapsedTime:0,pseudoElement:0}),Sv=un(wv),_v=g({},zi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Ev=un(_v),kv=g({},zi,{data:0}),Zd=un(kv),Av={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Cv={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Tv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ov(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=Tv[t])?!!i[t]:!1}function Ku(){return Ov}var jv=g({},gs,{key:function(t){if(t.key){var i=Av[t.key]||t.key;if(i!=="Unidentified")return i}return t.type==="keypress"?(t=Il(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Cv[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ku,charCode:function(t){return t.type==="keypress"?Il(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Il(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Nv=un(jv),Rv=g({},Gl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wd=un(Rv),Mv=g({},gs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ku}),Dv=un(Mv),zv=g({},zi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lv=un(zv),Uv=g({},Gl,{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}),Bv=un(Uv),Pv=g({},zi,{newState:0,oldState:0}),qv=un(Pv),Hv=[9,13,27,32],Zu=_r&&"CompositionEvent"in window,bs=null;_r&&"documentMode"in document&&(bs=document.documentMode);var Iv=_r&&"TextEvent"in window&&!bs,em=_r&&(!Zu||bs&&8<bs&&11>=bs),tm=" ",nm=!1;function rm(t,i){switch(t){case"keyup":return Hv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function im(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var fa=!1;function Fv(t,i){switch(t){case"compositionend":return im(i);case"keypress":return i.which!==32?null:(nm=!0,tm);case"textInput":return t=i.data,t===tm&&nm?null:t;default:return null}}function $v(t,i){if(fa)return t==="compositionend"||!Zu&&rm(t,i)?(t=Xd(),Hl=Vu=Zr=null,fa=!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 em&&i.locale!=="ko"?null:i.data;default:return null}}var Gv={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 am(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!Gv[t.type]:i==="textarea"}function sm(t,i,s,o){ua?ca?ca.push(o):ca=[o]:ua=o,i=zo(i,"onChange"),0<i.length&&(s=new $l("onChange","change",null,s,o),t.push({event:s,listeners:i}))}var vs=null,xs=null;function Yv(t){Ig(t,0)}function Yl(t){var i=C(t);if(Hd(i))return t}function lm(t,i){if(t==="change")return i}var om=!1;if(_r){var Wu;if(_r){var ec="oninput"in document;if(!ec){var um=document.createElement("div");um.setAttribute("oninput","return;"),ec=typeof um.oninput=="function"}Wu=ec}else Wu=!1;om=Wu&&(!document.documentMode||9<document.documentMode)}function cm(){vs&&(vs.detachEvent("onpropertychange",fm),xs=vs=null)}function fm(t){if(t.propertyName==="value"&&Yl(xs)){var i=[];sm(i,xs,t,$u(t)),Jd(Yv,i)}}function Vv(t,i,s){t==="focusin"?(cm(),vs=i,xs=s,vs.attachEvent("onpropertychange",fm)):t==="focusout"&&cm()}function Jv(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Yl(xs)}function Xv(t,i){if(t==="click")return Yl(i)}function Qv(t,i){if(t==="input"||t==="change")return Yl(i)}function Kv(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var bn=typeof Object.is=="function"?Object.is:Kv;function ws(t,i){if(bn(t,i))return!0;if(typeof t!="object"||t===null||typeof i!="object"||i===null)return!1;var s=Object.keys(t),o=Object.keys(i);if(s.length!==o.length)return!1;for(o=0;o<s.length;o++){var h=s[o];if(!Rn.call(i,h)||!bn(t[h],i[h]))return!1}return!0}function hm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function dm(t,i){var s=hm(t);t=0;for(var o;s;){if(s.nodeType===3){if(o=t+s.textContent.length,t<=i&&o>=i)return{node:s,offset:i-t};t=o}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=hm(s)}}function mm(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?mm(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function pm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=Pl(t.document);i instanceof t.HTMLIFrameElement;){try{var s=typeof i.contentWindow.location.href=="string"}catch{s=!1}if(s)t=i.contentWindow;else break;i=Pl(t.document)}return i}function tc(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 Zv=_r&&"documentMode"in document&&11>=document.documentMode,ha=null,nc=null,Ss=null,rc=!1;function gm(t,i,s){var o=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;rc||ha==null||ha!==Pl(o)||(o=ha,"selectionStart"in o&&tc(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}),Ss&&ws(Ss,o)||(Ss=o,o=zo(nc,"onSelect"),0<o.length&&(i=new $l("onSelect","select",null,i,s),t.push({event:i,listeners:o}),i.target=ha)))}function Li(t,i){var s={};return s[t.toLowerCase()]=i.toLowerCase(),s["Webkit"+t]="webkit"+i,s["Moz"+t]="moz"+i,s}var da={animationend:Li("Animation","AnimationEnd"),animationiteration:Li("Animation","AnimationIteration"),animationstart:Li("Animation","AnimationStart"),transitionrun:Li("Transition","TransitionRun"),transitionstart:Li("Transition","TransitionStart"),transitioncancel:Li("Transition","TransitionCancel"),transitionend:Li("Transition","TransitionEnd")},ic={},ym={};_r&&(ym=document.createElement("div").style,"AnimationEvent"in window||(delete da.animationend.animation,delete da.animationiteration.animation,delete da.animationstart.animation),"TransitionEvent"in window||delete da.transitionend.transition);function Ui(t){if(ic[t])return ic[t];if(!da[t])return t;var i=da[t],s;for(s in i)if(i.hasOwnProperty(s)&&s in ym)return ic[t]=i[s];return t}var bm=Ui("animationend"),vm=Ui("animationiteration"),xm=Ui("animationstart"),Wv=Ui("transitionrun"),ex=Ui("transitionstart"),tx=Ui("transitioncancel"),wm=Ui("transitionend"),Sm=new Map,ac="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(" ");ac.push("scrollEnd");function Wn(t,i){Sm.set(t,i),be(i,[t])}var Vl=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)},Un=[],ma=0,sc=0;function Jl(){for(var t=ma,i=sc=ma=0;i<t;){var s=Un[i];Un[i++]=null;var o=Un[i];Un[i++]=null;var h=Un[i];Un[i++]=null;var p=Un[i];if(Un[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&&_m(s,h,p)}}function Xl(t,i,s,o){Un[ma++]=t,Un[ma++]=i,Un[ma++]=s,Un[ma++]=o,sc|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function lc(t,i,s,o){return Xl(t,i,s,o),Ql(t)}function Bi(t,i){return Xl(t,null,null,i),Ql(t)}function _m(t,i,s){t.lanes|=s;var o=t.alternate;o!==null&&(o.lanes|=s);for(var h=!1,p=t.return;p!==null;)p.childLanes|=s,o=p.alternate,o!==null&&(o.childLanes|=s),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(h=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,h&&i!==null&&(h=31-ot(s),t=p.hiddenUpdates,o=t[h],o===null?t[h]=[i]:o.push(i),i.lane=s|536870912),p):null}function Ql(t){if(50<$s)throw $s=0,yf=null,Error(a(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var pa={};function nx(t,i,s,o){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vn(t,i,s,o){return new nx(t,i,s,o)}function oc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Er(t,i){var s=t.alternate;return s===null?(s=vn(t.tag,i,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=i,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&65011712,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,i=t.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function Em(t,i){t.flags&=65011714;var s=t.alternate;return s===null?(t.childLanes=0,t.lanes=i,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,i=s.dependencies,t.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),t}function Kl(t,i,s,o,h,p){var v=0;if(o=t,typeof t=="function")oc(t)&&(v=1);else if(typeof t=="string")v=lw(t,s,de.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case Y:return t=vn(31,s,i,h),t.elementType=Y,t.lanes=p,t;case L:return Pi(s.children,h,p,i);case B:v=8,h|=24;break;case D:return t=vn(12,s,i,h|2),t.elementType=D,t.lanes=p,t;case R:return t=vn(13,s,i,h),t.elementType=R,t.lanes=p,t;case O:return t=vn(19,s,i,h),t.elementType=O,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case G:v=10;break e;case F:v=9;break e;case se:v=11;break e;case V:v=14;break e;case J:v=16,o=null;break e}v=29,s=Error(a(130,t===null?"null":typeof t,"")),o=null}return i=vn(v,s,i,h),i.elementType=t,i.type=o,i.lanes=p,i}function Pi(t,i,s,o){return t=vn(7,t,o,i),t.lanes=s,t}function uc(t,i,s){return t=vn(6,t,null,i),t.lanes=s,t}function km(t){var i=vn(18,null,null,0);return i.stateNode=t,i}function cc(t,i,s){return i=vn(4,t.children!==null?t.children:[],t.key,i),i.lanes=s,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var Am=new WeakMap;function Bn(t,i){if(typeof t=="object"&&t!==null){var s=Am.get(t);return s!==void 0?s:(i={value:t,source:i,stack:Tt(i)},Am.set(t,i),i)}return{value:t,source:i,stack:Tt(i)}}var ga=[],ya=0,Zl=null,_s=0,Pn=[],qn=0,Wr=null,lr=1,or="";function kr(t,i){ga[ya++]=_s,ga[ya++]=Zl,Zl=t,_s=i}function Cm(t,i,s){Pn[qn++]=lr,Pn[qn++]=or,Pn[qn++]=Wr,Wr=t;var o=lr;t=or;var h=32-ot(o)-1;o&=~(1<<h),s+=1;var p=32-ot(i)+h;if(30<p){var v=h-h%5;p=(o&(1<<v)-1).toString(32),o>>=v,h-=v,lr=1<<32-ot(i)+h|s<<h|o,or=p+t}else lr=1<<p|s<<h|o,or=t}function fc(t){t.return!==null&&(kr(t,1),Cm(t,1,0))}function hc(t){for(;t===Zl;)Zl=ga[--ya],ga[ya]=null,_s=ga[--ya],ga[ya]=null;for(;t===Wr;)Wr=Pn[--qn],Pn[qn]=null,or=Pn[--qn],Pn[qn]=null,lr=Pn[--qn],Pn[qn]=null}function Tm(t,i){Pn[qn++]=lr,Pn[qn++]=or,Pn[qn++]=Wr,lr=i.id,or=i.overflow,Wr=t}var Vt=null,St=null,et=!1,ei=null,Hn=!1,dc=Error(a(519));function ti(t){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Es(Bn(i,t)),dc}function Om(t){var i=t.stateNode,s=t.type,o=t.memoizedProps;switch(i[gt]=t,i[Ot]=o,s){case"dialog":Qe("cancel",i),Qe("close",i);break;case"iframe":case"object":case"embed":Qe("load",i);break;case"video":case"audio":for(s=0;s<Ys.length;s++)Qe(Ys[s],i);break;case"source":Qe("error",i);break;case"img":case"image":case"link":Qe("error",i),Qe("load",i);break;case"details":Qe("toggle",i);break;case"input":Qe("invalid",i),Id(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Qe("invalid",i);break;case"textarea":Qe("invalid",i),$d(i,o.value,o.defaultValue,o.children)}s=o.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||i.textContent===""+s||o.suppressHydrationWarning===!0||Yg(i.textContent,s)?(o.popover!=null&&(Qe("beforetoggle",i),Qe("toggle",i)),o.onScroll!=null&&Qe("scroll",i),o.onScrollEnd!=null&&Qe("scrollend",i),o.onClick!=null&&(i.onclick=Sr),i=!0):i=!1,i||ti(t,!0)}function jm(t){for(Vt=t.return;Vt;)switch(Vt.tag){case 5:case 31:case 13:Hn=!1;return;case 27:case 3:Hn=!0;return;default:Vt=Vt.return}}function ba(t){if(t!==Vt)return!1;if(!et)return jm(t),et=!0,!1;var i=t.tag,s;if((s=i!==3&&i!==27)&&((s=i===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||Rf(t.type,t.memoizedProps)),s=!s),s&&St&&ti(t),jm(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));St=ty(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));St=ty(t)}else i===27?(i=St,pi(t.type)?(t=Uf,Uf=null,St=t):St=i):St=Vt?Fn(t.stateNode.nextSibling):null;return!0}function qi(){St=Vt=null,et=!1}function mc(){var t=ei;return t!==null&&(dn===null?dn=t:dn.push.apply(dn,t),ei=null),t}function Es(t){ei===null?ei=[t]:ei.push(t)}var pc=M(null),Hi=null,Ar=null;function ni(t,i,s){_(pc,i._currentValue),i._currentValue=s}function Cr(t){t._currentValue=pc.current,W(pc)}function gc(t,i,s){for(;t!==null;){var o=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),t===s)break;t=t.return}}function yc(t,i,s,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 P=0;P<i.length;P++)if(S.context===i[P]){p.lanes|=s,S=p.alternate,S!==null&&(S.lanes|=s),gc(p.return,s,t),o||(v=null);break e}p=S.next}}else if(h.tag===18){if(v=h.return,v===null)throw Error(a(341));v.lanes|=s,p=v.alternate,p!==null&&(p.lanes|=s),gc(v,s,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 va(t,i,s,o){t=null;for(var h=i,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var v=h.alternate;if(v===null)throw Error(a(387));if(v=v.memoizedProps,v!==null){var S=h.type;bn(h.pendingProps.value,v.value)||(t!==null?t.push(S):t=[S])}}else if(h===Te.current){if(v=h.alternate,v===null)throw Error(a(387));v.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(Ks):t=[Ks])}h=h.return}t!==null&&yc(i,t,s,o),i.flags|=262144}function Wl(t){for(t=t.firstContext;t!==null;){if(!bn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Ii(t){Hi=t,Ar=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Jt(t){return Nm(Hi,t)}function eo(t,i){return Hi===null&&Ii(t),Nm(t,i)}function Nm(t,i){var s=i._currentValue;if(i={context:i,memoizedValue:s,next:null},Ar===null){if(t===null)throw Error(a(308));Ar=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else Ar=Ar.next=i;return s}var rx=typeof AbortController<"u"?AbortController:function(){var t=[],i=this.signal={aborted:!1,addEventListener:function(s,o){t.push(o)}};this.abort=function(){i.aborted=!0,t.forEach(function(s){return s()})}},ix=e.unstable_scheduleCallback,ax=e.unstable_NormalPriority,zt={$$typeof:G,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bc(){return{controller:new rx,data:new Map,refCount:0}}function ks(t){t.refCount--,t.refCount===0&&ix(ax,function(){t.controller.abort()})}var As=null,vc=0,xa=0,wa=null;function sx(t,i){if(As===null){var s=As=[];vc=0,xa=_f(),wa={status:"pending",value:void 0,then:function(o){s.push(o)}}}return vc++,i.then(Rm,Rm),i}function Rm(){if(--vc===0&&As!==null){wa!==null&&(wa.status="fulfilled");var t=As;As=null,xa=0,wa=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function lx(t,i){var s=[],o={status:"pending",value:null,reason:null,then:function(h){s.push(h)}};return t.then(function(){o.status="fulfilled",o.value=i;for(var h=0;h<s.length;h++)(0,s[h])(i)},function(h){for(o.status="rejected",o.reason=h,h=0;h<s.length;h++)(0,s[h])(void 0)}),o}var Mm=H.S;H.S=function(t,i){gg=vt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&sx(t,i),Mm!==null&&Mm(t,i)};var Fi=M(null);function xc(){var t=Fi.current;return t!==null?t:yt.pooledCache}function to(t,i){i===null?_(Fi,Fi.current):_(Fi,i.pool)}function Dm(){var t=xc();return t===null?null:{parent:zt._currentValue,pool:t}}var Sa=Error(a(460)),wc=Error(a(474)),no=Error(a(542)),ro={then:function(){}};function zm(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Lm(t,i,s){switch(s=t[s],s===void 0?t.push(i):s!==i&&(i.then(Sr,Sr),i=s),i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,Bm(t),t;default:if(typeof i.status=="string")i.then(Sr,Sr);else{if(t=yt,t!==null&&100<t.shellSuspendCounter)throw Error(a(482));t=i,t.status="pending",t.then(function(o){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=o}},function(o){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=o}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,Bm(t),t}throw Gi=i,Sa}}function $i(t){try{var i=t._init;return i(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Gi=s,Sa):s}}var Gi=null;function Um(){if(Gi===null)throw Error(a(459));var t=Gi;return Gi=null,t}function Bm(t){if(t===Sa||t===no)throw Error(a(483))}var _a=null,Cs=0;function io(t){var i=Cs;return Cs+=1,_a===null&&(_a=[]),Lm(_a,t,i)}function Ts(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function ao(t,i){throw i.$$typeof===b?Error(a(525)):(t=Object.prototype.toString.call(i),Error(a(31,t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)))}function Pm(t){function i(X,$){if(t){var ee=X.deletions;ee===null?(X.deletions=[$],X.flags|=16):ee.push($)}}function s(X,$){if(!t)return null;for(;$!==null;)i(X,$),$=$.sibling;return null}function o(X){for(var $=new Map;X!==null;)X.key!==null?$.set(X.key,X):$.set(X.index,X),X=X.sibling;return $}function h(X,$){return X=Er(X,$),X.index=0,X.sibling=null,X}function p(X,$,ee){return X.index=ee,t?(ee=X.alternate,ee!==null?(ee=ee.index,ee<$?(X.flags|=67108866,$):ee):(X.flags|=67108866,$)):(X.flags|=1048576,$)}function v(X){return t&&X.alternate===null&&(X.flags|=67108866),X}function S(X,$,ee,ce){return $===null||$.tag!==6?($=uc(ee,X.mode,ce),$.return=X,$):($=h($,ee),$.return=X,$)}function P(X,$,ee,ce){var De=ee.type;return De===L?le(X,$,ee.props.children,ce,ee.key):$!==null&&($.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===J&&$i(De)===$.type)?($=h($,ee.props),Ts($,ee),$.return=X,$):($=Kl(ee.type,ee.key,ee.props,null,X.mode,ce),Ts($,ee),$.return=X,$)}function te(X,$,ee,ce){return $===null||$.tag!==4||$.stateNode.containerInfo!==ee.containerInfo||$.stateNode.implementation!==ee.implementation?($=cc(ee,X.mode,ce),$.return=X,$):($=h($,ee.children||[]),$.return=X,$)}function le(X,$,ee,ce,De){return $===null||$.tag!==7?($=Pi(ee,X.mode,ce,De),$.return=X,$):($=h($,ee),$.return=X,$)}function pe(X,$,ee){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=uc(""+$,X.mode,ee),$.return=X,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case x:return ee=Kl($.type,$.key,$.props,null,X.mode,ee),Ts(ee,$),ee.return=X,ee;case k:return $=cc($,X.mode,ee),$.return=X,$;case J:return $=$i($),pe(X,$,ee)}if(q($)||Q($))return $=Pi($,X.mode,ee,null),$.return=X,$;if(typeof $.then=="function")return pe(X,io($),ee);if($.$$typeof===G)return pe(X,eo(X,$),ee);ao(X,$)}return null}function ne(X,$,ee,ce){var De=$!==null?$.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return De!==null?null:S(X,$,""+ee,ce);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case x:return ee.key===De?P(X,$,ee,ce):null;case k:return ee.key===De?te(X,$,ee,ce):null;case J:return ee=$i(ee),ne(X,$,ee,ce)}if(q(ee)||Q(ee))return De!==null?null:le(X,$,ee,ce,null);if(typeof ee.then=="function")return ne(X,$,io(ee),ce);if(ee.$$typeof===G)return ne(X,$,eo(X,ee),ce);ao(X,ee)}return null}function ae(X,$,ee,ce,De){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return X=X.get(ee)||null,S($,X,""+ce,De);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case x:return X=X.get(ce.key===null?ee:ce.key)||null,P($,X,ce,De);case k:return X=X.get(ce.key===null?ee:ce.key)||null,te($,X,ce,De);case J:return ce=$i(ce),ae(X,$,ee,ce,De)}if(q(ce)||Q(ce))return X=X.get(ee)||null,le($,X,ce,De,null);if(typeof ce.then=="function")return ae(X,$,ee,io(ce),De);if(ce.$$typeof===G)return ae(X,$,ee,eo($,ce),De);ao($,ce)}return null}function Ne(X,$,ee,ce){for(var De=null,at=null,Re=$,Ge=$=0,We=null;Re!==null&&Ge<ee.length;Ge++){Re.index>Ge?(We=Re,Re=null):We=Re.sibling;var st=ne(X,Re,ee[Ge],ce);if(st===null){Re===null&&(Re=We);break}t&&Re&&st.alternate===null&&i(X,Re),$=p(st,$,Ge),at===null?De=st:at.sibling=st,at=st,Re=We}if(Ge===ee.length)return s(X,Re),et&&kr(X,Ge),De;if(Re===null){for(;Ge<ee.length;Ge++)Re=pe(X,ee[Ge],ce),Re!==null&&($=p(Re,$,Ge),at===null?De=Re:at.sibling=Re,at=Re);return et&&kr(X,Ge),De}for(Re=o(Re);Ge<ee.length;Ge++)We=ae(Re,X,Ge,ee[Ge],ce),We!==null&&(t&&We.alternate!==null&&Re.delete(We.key===null?Ge:We.key),$=p(We,$,Ge),at===null?De=We:at.sibling=We,at=We);return t&&Re.forEach(function(xi){return i(X,xi)}),et&&kr(X,Ge),De}function Be(X,$,ee,ce){if(ee==null)throw Error(a(151));for(var De=null,at=null,Re=$,Ge=$=0,We=null,st=ee.next();Re!==null&&!st.done;Ge++,st=ee.next()){Re.index>Ge?(We=Re,Re=null):We=Re.sibling;var xi=ne(X,Re,st.value,ce);if(xi===null){Re===null&&(Re=We);break}t&&Re&&xi.alternate===null&&i(X,Re),$=p(xi,$,Ge),at===null?De=xi:at.sibling=xi,at=xi,Re=We}if(st.done)return s(X,Re),et&&kr(X,Ge),De;if(Re===null){for(;!st.done;Ge++,st=ee.next())st=pe(X,st.value,ce),st!==null&&($=p(st,$,Ge),at===null?De=st:at.sibling=st,at=st);return et&&kr(X,Ge),De}for(Re=o(Re);!st.done;Ge++,st=ee.next())st=ae(Re,X,Ge,st.value,ce),st!==null&&(t&&st.alternate!==null&&Re.delete(st.key===null?Ge:st.key),$=p(st,$,Ge),at===null?De=st:at.sibling=st,at=st);return t&&Re.forEach(function(bw){return i(X,bw)}),et&&kr(X,Ge),De}function mt(X,$,ee,ce){if(typeof ee=="object"&&ee!==null&&ee.type===L&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case x:e:{for(var De=ee.key;$!==null;){if($.key===De){if(De=ee.type,De===L){if($.tag===7){s(X,$.sibling),ce=h($,ee.props.children),ce.return=X,X=ce;break e}}else if($.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===J&&$i(De)===$.type){s(X,$.sibling),ce=h($,ee.props),Ts(ce,ee),ce.return=X,X=ce;break e}s(X,$);break}else i(X,$);$=$.sibling}ee.type===L?(ce=Pi(ee.props.children,X.mode,ce,ee.key),ce.return=X,X=ce):(ce=Kl(ee.type,ee.key,ee.props,null,X.mode,ce),Ts(ce,ee),ce.return=X,X=ce)}return v(X);case k:e:{for(De=ee.key;$!==null;){if($.key===De)if($.tag===4&&$.stateNode.containerInfo===ee.containerInfo&&$.stateNode.implementation===ee.implementation){s(X,$.sibling),ce=h($,ee.children||[]),ce.return=X,X=ce;break e}else{s(X,$);break}else i(X,$);$=$.sibling}ce=cc(ee,X.mode,ce),ce.return=X,X=ce}return v(X);case J:return ee=$i(ee),mt(X,$,ee,ce)}if(q(ee))return Ne(X,$,ee,ce);if(Q(ee)){if(De=Q(ee),typeof De!="function")throw Error(a(150));return ee=De.call(ee),Be(X,$,ee,ce)}if(typeof ee.then=="function")return mt(X,$,io(ee),ce);if(ee.$$typeof===G)return mt(X,$,eo(X,ee),ce);ao(X,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,$!==null&&$.tag===6?(s(X,$.sibling),ce=h($,ee),ce.return=X,X=ce):(s(X,$),ce=uc(ee,X.mode,ce),ce.return=X,X=ce),v(X)):s(X,$)}return function(X,$,ee,ce){try{Cs=0;var De=mt(X,$,ee,ce);return _a=null,De}catch(Re){if(Re===Sa||Re===no)throw Re;var at=vn(29,Re,null,X.mode);return at.lanes=ce,at.return=X,at}finally{}}}var Yi=Pm(!0),qm=Pm(!1),ri=!1;function Sc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _c(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 ii(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function ai(t,i,s){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(lt&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=Ql(t),_m(t,null,s),i}return Xl(t,o,i,s),Ql(t)}function Os(t,i,s){if(i=i.updateQueue,i!==null&&(i=i.shared,(s&4194048)!==0)){var o=i.lanes;o&=t.pendingLanes,s|=o,i.lanes=s,Ri(t,s)}}function Ec(t,i){var s=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,s===o)){var h=null,p=null;if(s=s.firstBaseUpdate,s!==null){do{var v={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};p===null?h=p=v:p=p.next=v,s=s.next}while(s!==null);p===null?h=p=i:p=p.next=i}else h=p=i;s={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=i:t.next=i,s.lastBaseUpdate=i}var kc=!1;function js(){if(kc){var t=wa;if(t!==null)throw t}}function Ns(t,i,s,o){kc=!1;var h=t.updateQueue;ri=!1;var p=h.firstBaseUpdate,v=h.lastBaseUpdate,S=h.shared.pending;if(S!==null){h.shared.pending=null;var P=S,te=P.next;P.next=null,v===null?p=te:v.next=te,v=P;var le=t.alternate;le!==null&&(le=le.updateQueue,S=le.lastBaseUpdate,S!==v&&(S===null?le.firstBaseUpdate=te:S.next=te,le.lastBaseUpdate=P))}if(p!==null){var pe=h.baseState;v=0,le=te=P=null,S=p;do{var ne=S.lane&-536870913,ae=ne!==S.lane;if(ae?(Ze&ne)===ne:(o&ne)===ne){ne!==0&&ne===xa&&(kc=!0),le!==null&&(le=le.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Ne=t,Be=S;ne=i;var mt=s;switch(Be.tag){case 1:if(Ne=Be.payload,typeof Ne=="function"){pe=Ne.call(mt,pe,ne);break e}pe=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Be.payload,ne=typeof Ne=="function"?Ne.call(mt,pe,ne):Ne,ne==null)break e;pe=g({},pe,ne);break e;case 2:ri=!0}}ne=S.callback,ne!==null&&(t.flags|=64,ae&&(t.flags|=8192),ae=h.callbacks,ae===null?h.callbacks=[ne]:ae.push(ne))}else ae={lane:ne,tag:S.tag,payload:S.payload,callback:S.callback,next:null},le===null?(te=le=ae,P=pe):le=le.next=ae,v|=ne;if(S=S.next,S===null){if(S=h.shared.pending,S===null)break;ae=S,S=ae.next,ae.next=null,h.lastBaseUpdate=ae,h.shared.pending=null}}while(!0);le===null&&(P=pe),h.baseState=P,h.firstBaseUpdate=te,h.lastBaseUpdate=le,p===null&&(h.shared.lanes=0),ci|=v,t.lanes=v,t.memoizedState=pe}}function Hm(t,i){if(typeof t!="function")throw Error(a(191,t));t.call(i)}function Im(t,i){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)Hm(s[t],i)}var Ea=M(null),so=M(0);function Fm(t,i){t=Lr,_(so,t),_(Ea,i),Lr=t|i.baseLanes}function Ac(){_(so,Lr),_(Ea,Ea.current)}function Cc(){Lr=so.current,W(Ea),W(so)}var xn=M(null),In=null;function si(t){var i=t.alternate;_(Rt,Rt.current&1),_(xn,t),In===null&&(i===null||Ea.current!==null||i.memoizedState!==null)&&(In=t)}function Tc(t){_(Rt,Rt.current),_(xn,t),In===null&&(In=t)}function $m(t){t.tag===22?(_(Rt,Rt.current),_(xn,t),In===null&&(In=t)):li()}function li(){_(Rt,Rt.current),_(xn,xn.current)}function wn(t){W(xn),In===t&&(In=null),W(Rt)}var Rt=M(0);function lo(t){for(var i=t;i!==null;){if(i.tag===13){var s=i.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||zf(s)||Lf(s)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Tr=0,$e=null,ht=null,Lt=null,oo=!1,ka=!1,Vi=!1,uo=0,Rs=0,Aa=null,ox=0;function jt(){throw Error(a(321))}function Oc(t,i){if(i===null)return!1;for(var s=0;s<i.length&&s<t.length;s++)if(!bn(t[s],i[s]))return!1;return!0}function jc(t,i,s,o,h,p){return Tr=p,$e=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,H.H=t===null||t.memoizedState===null?Cp:Gc,Vi=!1,p=s(o,h),Vi=!1,ka&&(p=Ym(i,s,o,h)),Gm(t),p}function Gm(t){H.H=zs;var i=ht!==null&&ht.next!==null;if(Tr=0,Lt=ht=$e=null,oo=!1,Rs=0,Aa=null,i)throw Error(a(300));t===null||Ut||(t=t.dependencies,t!==null&&Wl(t)&&(Ut=!0))}function Ym(t,i,s,o){$e=t;var h=0;do{if(ka&&(Aa=null),Rs=0,ka=!1,25<=h)throw Error(a(301));if(h+=1,Lt=ht=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=Tp,p=i(s,o)}while(ka);return p}function ux(){var t=H.H,i=t.useState()[0];return i=typeof i.then=="function"?Ms(i):i,t=t.useState()[0],(ht!==null?ht.memoizedState:null)!==t&&($e.flags|=1024),i}function Nc(){var t=uo!==0;return uo=0,t}function Rc(t,i,s){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~s}function Mc(t){if(oo){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}oo=!1}Tr=0,Lt=ht=$e=null,ka=!1,Rs=uo=0,Aa=null}function rn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lt===null?$e.memoizedState=Lt=t:Lt=Lt.next=t,Lt}function Mt(){if(ht===null){var t=$e.alternate;t=t!==null?t.memoizedState:null}else t=ht.next;var i=Lt===null?$e.memoizedState:Lt.next;if(i!==null)Lt=i,ht=t;else{if(t===null)throw $e.alternate===null?Error(a(467)):Error(a(310));ht=t,t={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},Lt===null?$e.memoizedState=Lt=t:Lt=Lt.next=t}return Lt}function co(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ms(t){var i=Rs;return Rs+=1,Aa===null&&(Aa=[]),t=Lm(Aa,t,i),i=$e,(Lt===null?i.memoizedState:Lt.next)===null&&(i=i.alternate,H.H=i===null||i.memoizedState===null?Cp:Gc),t}function fo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ms(t);if(t.$$typeof===G)return Jt(t)}throw Error(a(438,String(t)))}function Dc(t){var i=null,s=$e.updateQueue;if(s!==null&&(i=s.memoCache),i==null){var o=$e.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),s===null&&(s=co(),$e.updateQueue=s),s.memoCache=i,s=i.data[i.index],s===void 0)for(s=i.data[i.index]=Array(t),o=0;o<t;o++)s[o]=j;return i.index++,s}function Or(t,i){return typeof i=="function"?i(t):i}function ho(t){var i=Mt();return zc(i,ht,t)}function zc(t,i,s){var o=t.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=s;var h=t.baseQueue,p=o.pending;if(p!==null){if(h!==null){var 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,P=null,te=i,le=!1;do{var pe=te.lane&-536870913;if(pe!==te.lane?(Ze&pe)===pe:(Tr&pe)===pe){var ne=te.revertLane;if(ne===0)P!==null&&(P=P.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),pe===xa&&(le=!0);else if((Tr&ne)===ne){te=te.next,ne===xa&&(le=!0);continue}else pe={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},P===null?(S=P=pe,v=p):P=P.next=pe,$e.lanes|=ne,ci|=ne;pe=te.action,Vi&&s(p,pe),p=te.hasEagerState?te.eagerState:s(p,pe)}else ne={lane:pe,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},P===null?(S=P=ne,v=p):P=P.next=ne,$e.lanes|=pe,ci|=pe;te=te.next}while(te!==null&&te!==i);if(P===null?v=p:P.next=S,!bn(p,t.memoizedState)&&(Ut=!0,le&&(s=wa,s!==null)))throw s;t.memoizedState=p,t.baseState=v,t.baseQueue=P,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Lc(t){var i=Mt(),s=i.queue;if(s===null)throw Error(a(311));s.lastRenderedReducer=t;var o=s.dispatch,h=s.pending,p=i.memoizedState;if(h!==null){s.pending=null;var v=h=h.next;do p=t(p,v.action),v=v.next;while(v!==h);bn(p,i.memoizedState)||(Ut=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),s.lastRenderedState=p}return[p,o]}function Vm(t,i,s){var o=$e,h=Mt(),p=et;if(p){if(s===void 0)throw Error(a(407));s=s()}else s=i();var v=!bn((ht||h).memoizedState,s);if(v&&(h.memoizedState=s,Ut=!0),h=h.queue,Pc(Qm.bind(null,o,h,t),[t]),h.getSnapshot!==i||v||Lt!==null&&Lt.memoizedState.tag&1){if(o.flags|=2048,Ca(9,{destroy:void 0},Xm.bind(null,o,h,s,i),null),yt===null)throw Error(a(349));p||(Tr&127)!==0||Jm(o,i,s)}return s}function Jm(t,i,s){t.flags|=16384,t={getSnapshot:i,value:s},i=$e.updateQueue,i===null?(i=co(),$e.updateQueue=i,i.stores=[t]):(s=i.stores,s===null?i.stores=[t]:s.push(t))}function Xm(t,i,s,o){i.value=s,i.getSnapshot=o,Km(i)&&Zm(t)}function Qm(t,i,s){return s(function(){Km(i)&&Zm(t)})}function Km(t){var i=t.getSnapshot;t=t.value;try{var s=i();return!bn(t,s)}catch{return!0}}function Zm(t){var i=Bi(t,2);i!==null&&mn(i,t,2)}function Uc(t){var i=rn();if(typeof t=="function"){var s=t;if(t=s(),Vi){qt(!0);try{s()}finally{qt(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Or,lastRenderedState:t},i}function Wm(t,i,s,o){return t.baseState=s,zc(t,ht,typeof o=="function"?o:Or)}function cx(t,i,s,o,h){if(go(t))throw Error(a(485));if(t=i.action,t!==null){var p={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){p.listeners.push(v)}};H.T!==null?s(!0):p.isTransition=!1,o(p),s=i.pending,s===null?(p.next=i.pending=p,ep(i,p)):(p.next=s.next,i.pending=s.next=p)}}function ep(t,i){var s=i.action,o=i.payload,h=t.state;if(i.isTransition){var p=H.T,v={};H.T=v;try{var S=s(h,o),P=H.S;P!==null&&P(v,S),tp(t,i,S)}catch(te){Bc(t,i,te)}finally{p!==null&&v.types!==null&&(p.types=v.types),H.T=p}}else try{p=s(h,o),tp(t,i,p)}catch(te){Bc(t,i,te)}}function tp(t,i,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(o){np(t,i,o)},function(o){return Bc(t,i,o)}):np(t,i,s)}function np(t,i,s){i.status="fulfilled",i.value=s,rp(i),t.state=s,i=t.pending,i!==null&&(s=i.next,s===i?t.pending=null:(s=s.next,i.next=s,ep(t,s)))}function Bc(t,i,s){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=s,rp(i),i=i.next;while(i!==o)}t.action=null}function rp(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function ip(t,i){return i}function ap(t,i){if(et){var s=yt.formState;if(s!==null){e:{var o=$e;if(et){if(St){t:{for(var h=St,p=Hn;h.nodeType!==8;){if(!p){h=null;break t}if(h=Fn(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){St=Fn(h.nextSibling),o=h.data==="F!";break e}}ti(o)}o=!1}o&&(i=s[0])}}return s=rn(),s.memoizedState=s.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ip,lastRenderedState:i},s.queue=o,s=Ep.bind(null,$e,o),o.dispatch=s,o=Uc(!1),p=$c.bind(null,$e,!1,o.queue),o=rn(),h={state:i,dispatch:null,action:t,pending:null},o.queue=h,s=cx.bind(null,$e,h,p,s),h.dispatch=s,o.memoizedState=t,[i,s,!1]}function sp(t){var i=Mt();return lp(i,ht,t)}function lp(t,i,s){if(i=zc(t,i,ip)[0],t=ho(Or)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Ms(i)}catch(v){throw v===Sa?no:v}else o=i;i=Mt();var h=i.queue,p=h.dispatch;return s!==i.memoizedState&&($e.flags|=2048,Ca(9,{destroy:void 0},fx.bind(null,h,s),null)),[o,p,t]}function fx(t,i){t.action=i}function op(t){var i=Mt(),s=ht;if(s!==null)return lp(i,s,t);Mt(),i=i.memoizedState,s=Mt();var o=s.queue.dispatch;return s.memoizedState=t,[i,o,!1]}function Ca(t,i,s,o){return t={tag:t,create:s,deps:o,inst:i,next:null},i=$e.updateQueue,i===null&&(i=co(),$e.updateQueue=i),s=i.lastEffect,s===null?i.lastEffect=t.next=t:(o=s.next,s.next=t,t.next=o,i.lastEffect=t),t}function up(){return Mt().memoizedState}function mo(t,i,s,o){var h=rn();$e.flags|=t,h.memoizedState=Ca(1|i,{destroy:void 0},s,o===void 0?null:o)}function po(t,i,s,o){var h=Mt();o=o===void 0?null:o;var p=h.memoizedState.inst;ht!==null&&o!==null&&Oc(o,ht.memoizedState.deps)?h.memoizedState=Ca(i,p,s,o):($e.flags|=t,h.memoizedState=Ca(1|i,p,s,o))}function cp(t,i){mo(8390656,8,t,i)}function Pc(t,i){po(2048,8,t,i)}function hx(t){$e.flags|=4;var i=$e.updateQueue;if(i===null)i=co(),$e.updateQueue=i,i.events=[t];else{var s=i.events;s===null?i.events=[t]:s.push(t)}}function fp(t){var i=Mt().memoizedState;return hx({ref:i,nextImpl:t}),function(){if((lt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function hp(t,i){return po(4,2,t,i)}function dp(t,i){return po(4,4,t,i)}function mp(t,i){if(typeof i=="function"){t=t();var s=i(t);return function(){typeof s=="function"?s():i(null)}}if(i!=null)return t=t(),i.current=t,function(){i.current=null}}function pp(t,i,s){s=s!=null?s.concat([t]):null,po(4,4,mp.bind(null,i,t),s)}function qc(){}function gp(t,i){var s=Mt();i=i===void 0?null:i;var o=s.memoizedState;return i!==null&&Oc(i,o[1])?o[0]:(s.memoizedState=[t,i],t)}function yp(t,i){var s=Mt();i=i===void 0?null:i;var o=s.memoizedState;if(i!==null&&Oc(i,o[1]))return o[0];if(o=t(),Vi){qt(!0);try{t()}finally{qt(!1)}}return s.memoizedState=[o,i],o}function Hc(t,i,s){return s===void 0||(Tr&1073741824)!==0&&(Ze&261930)===0?t.memoizedState=i:(t.memoizedState=s,t=bg(),$e.lanes|=t,ci|=t,s)}function bp(t,i,s,o){return bn(s,i)?s:Ea.current!==null?(t=Hc(t,s,o),bn(t,i)||(Ut=!0),t):(Tr&42)===0||(Tr&1073741824)!==0&&(Ze&261930)===0?(Ut=!0,t.memoizedState=s):(t=bg(),$e.lanes|=t,ci|=t,i)}function vp(t,i,s,o,h){var p=ie.p;ie.p=p!==0&&8>p?p:8;var v=H.T,S={};H.T=S,$c(t,!1,i,s);try{var P=h(),te=H.S;if(te!==null&&te(S,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var le=lx(P,o);Ds(t,i,le,En(t))}else Ds(t,i,o,En(t))}catch(pe){Ds(t,i,{then:function(){},status:"rejected",reason:pe},En())}finally{ie.p=p,v!==null&&S.types!==null&&(v.types=S.types),H.T=v}}function dx(){}function Ic(t,i,s,o){if(t.tag!==5)throw Error(a(476));var h=xp(t).queue;vp(t,h,i,ge,s===null?dx:function(){return wp(t),s(o)})}function xp(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:ge,baseState:ge,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Or,lastRenderedState:ge},next:null};var s={};return i.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Or,lastRenderedState:s},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function wp(t){var i=xp(t);i.next===null&&(i=t.alternate.memoizedState),Ds(t,i.next.queue,{},En())}function Fc(){return Jt(Ks)}function Sp(){return Mt().memoizedState}function _p(){return Mt().memoizedState}function mx(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var s=En();t=ii(s);var o=ai(i,t,s);o!==null&&(mn(o,i,s),Os(o,i,s)),i={cache:bc()},t.payload=i;return}i=i.return}}function px(t,i,s){var o=En();s={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},go(t)?kp(i,s):(s=lc(t,i,s,o),s!==null&&(mn(s,t,o),Ap(s,i,o)))}function Ep(t,i,s){var o=En();Ds(t,i,s,o)}function Ds(t,i,s,o){var h={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(go(t))kp(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,s);if(h.hasEagerState=!0,h.eagerState=S,bn(S,v))return Xl(t,i,h,0),yt===null&&Jl(),!1}catch{}finally{}if(s=lc(t,i,h,o),s!==null)return mn(s,t,o),Ap(s,i,o),!0}return!1}function $c(t,i,s,o){if(o={lane:2,revertLane:_f(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},go(t)){if(i)throw Error(a(479))}else i=lc(t,s,o,2),i!==null&&mn(i,t,2)}function go(t){var i=t.alternate;return t===$e||i!==null&&i===$e}function kp(t,i){ka=oo=!0;var s=t.pending;s===null?i.next=i:(i.next=s.next,s.next=i),t.pending=i}function Ap(t,i,s){if((s&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,s|=o,i.lanes=s,Ri(t,s)}}var zs={readContext:Jt,use:fo,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};zs.useEffectEvent=jt;var Cp={readContext:Jt,use:fo,useCallback:function(t,i){return rn().memoizedState=[t,i===void 0?null:i],t},useContext:Jt,useEffect:cp,useImperativeHandle:function(t,i,s){s=s!=null?s.concat([t]):null,mo(4194308,4,mp.bind(null,i,t),s)},useLayoutEffect:function(t,i){return mo(4194308,4,t,i)},useInsertionEffect:function(t,i){mo(4,2,t,i)},useMemo:function(t,i){var s=rn();i=i===void 0?null:i;var o=t();if(Vi){qt(!0);try{t()}finally{qt(!1)}}return s.memoizedState=[o,i],o},useReducer:function(t,i,s){var o=rn();if(s!==void 0){var h=s(i);if(Vi){qt(!0);try{s(i)}finally{qt(!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=px.bind(null,$e,t),[o.memoizedState,t]},useRef:function(t){var i=rn();return t={current:t},i.memoizedState=t},useState:function(t){t=Uc(t);var i=t.queue,s=Ep.bind(null,$e,i);return i.dispatch=s,[t.memoizedState,s]},useDebugValue:qc,useDeferredValue:function(t,i){var s=rn();return Hc(s,t,i)},useTransition:function(){var t=Uc(!1);return t=vp.bind(null,$e,t.queue,!0,!1),rn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,s){var o=$e,h=rn();if(et){if(s===void 0)throw Error(a(407));s=s()}else{if(s=i(),yt===null)throw Error(a(349));(Ze&127)!==0||Jm(o,i,s)}h.memoizedState=s;var p={value:s,getSnapshot:i};return h.queue=p,cp(Qm.bind(null,o,p,t),[t]),o.flags|=2048,Ca(9,{destroy:void 0},Xm.bind(null,o,p,s,i),null),s},useId:function(){var t=rn(),i=yt.identifierPrefix;if(et){var s=or,o=lr;s=(o&~(1<<32-ot(o)-1)).toString(32)+s,i="_"+i+"R_"+s,s=uo++,0<s&&(i+="H"+s.toString(32)),i+="_"}else s=ox++,i="_"+i+"r_"+s.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:Fc,useFormState:ap,useActionState:ap,useOptimistic:function(t){var i=rn();i.memoizedState=i.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=s,i=$c.bind(null,$e,!0,s),s.dispatch=i,[t,i]},useMemoCache:Dc,useCacheRefresh:function(){return rn().memoizedState=mx.bind(null,$e)},useEffectEvent:function(t){var i=rn(),s={impl:t};return i.memoizedState=s,function(){if((lt&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}},Gc={readContext:Jt,use:fo,useCallback:gp,useContext:Jt,useEffect:Pc,useImperativeHandle:pp,useInsertionEffect:hp,useLayoutEffect:dp,useMemo:yp,useReducer:ho,useRef:up,useState:function(){return ho(Or)},useDebugValue:qc,useDeferredValue:function(t,i){var s=Mt();return bp(s,ht.memoizedState,t,i)},useTransition:function(){var t=ho(Or)[0],i=Mt().memoizedState;return[typeof t=="boolean"?t:Ms(t),i]},useSyncExternalStore:Vm,useId:Sp,useHostTransitionStatus:Fc,useFormState:sp,useActionState:sp,useOptimistic:function(t,i){var s=Mt();return Wm(s,ht,t,i)},useMemoCache:Dc,useCacheRefresh:_p};Gc.useEffectEvent=fp;var Tp={readContext:Jt,use:fo,useCallback:gp,useContext:Jt,useEffect:Pc,useImperativeHandle:pp,useInsertionEffect:hp,useLayoutEffect:dp,useMemo:yp,useReducer:Lc,useRef:up,useState:function(){return Lc(Or)},useDebugValue:qc,useDeferredValue:function(t,i){var s=Mt();return ht===null?Hc(s,t,i):bp(s,ht.memoizedState,t,i)},useTransition:function(){var t=Lc(Or)[0],i=Mt().memoizedState;return[typeof t=="boolean"?t:Ms(t),i]},useSyncExternalStore:Vm,useId:Sp,useHostTransitionStatus:Fc,useFormState:op,useActionState:op,useOptimistic:function(t,i){var s=Mt();return ht!==null?Wm(s,ht,t,i):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:Dc,useCacheRefresh:_p};Tp.useEffectEvent=fp;function Yc(t,i,s,o){i=t.memoizedState,s=s(o,i),s=s==null?i:g({},i,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var Vc={enqueueSetState:function(t,i,s){t=t._reactInternals;var o=En(),h=ii(o);h.payload=i,s!=null&&(h.callback=s),i=ai(t,h,o),i!==null&&(mn(i,t,o),Os(i,t,o))},enqueueReplaceState:function(t,i,s){t=t._reactInternals;var o=En(),h=ii(o);h.tag=1,h.payload=i,s!=null&&(h.callback=s),i=ai(t,h,o),i!==null&&(mn(i,t,o),Os(i,t,o))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var s=En(),o=ii(s);o.tag=2,i!=null&&(o.callback=i),i=ai(t,o,s),i!==null&&(mn(i,t,s),Os(i,t,s))}};function Op(t,i,s,o,h,p,v){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,p,v):i.prototype&&i.prototype.isPureReactComponent?!ws(s,o)||!ws(h,p):!0}function jp(t,i,s,o){t=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(s,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(s,o),i.state!==t&&Vc.enqueueReplaceState(i,i.state,null)}function Ji(t,i){var s=i;if("ref"in i){s={};for(var o in i)o!=="ref"&&(s[o]=i[o])}if(t=t.defaultProps){s===i&&(s=g({},s));for(var h in t)s[h]===void 0&&(s[h]=t[h])}return s}function Np(t){Vl(t)}function Rp(t){console.error(t)}function Mp(t){Vl(t)}function yo(t,i){try{var s=t.onUncaughtError;s(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function Dp(t,i,s){try{var o=t.onCaughtError;o(s.value,{componentStack:s.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Jc(t,i,s){return s=ii(s),s.tag=3,s.payload={element:null},s.callback=function(){yo(t,i)},s}function zp(t){return t=ii(t),t.tag=3,t}function Lp(t,i,s,o){var h=s.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;t.payload=function(){return h(p)},t.callback=function(){Dp(i,s,o)}}var v=s.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(t.callback=function(){Dp(i,s,o),typeof h!="function"&&(fi===null?fi=new Set([this]):fi.add(this));var S=o.stack;this.componentDidCatch(o.value,{componentStack:S!==null?S:""})})}function gx(t,i,s,o,h){if(s.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=s.alternate,i!==null&&va(i,s,h,!0),s=xn.current,s!==null){switch(s.tag){case 31:case 13:return In===null?Oo():s.alternate===null&&Nt===0&&(Nt=3),s.flags&=-257,s.flags|=65536,s.lanes=h,o===ro?s.flags|=16384:(i=s.updateQueue,i===null?s.updateQueue=new Set([o]):i.add(o),xf(t,o,h)),!1;case 22:return s.flags|=65536,o===ro?s.flags|=16384:(i=s.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},s.updateQueue=i):(s=i.retryQueue,s===null?i.retryQueue=new Set([o]):s.add(o)),xf(t,o,h)),!1}throw Error(a(435,s.tag))}return xf(t,o,h),Oo(),!1}if(et)return i=xn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==dc&&(t=Error(a(422),{cause:o}),Es(Bn(t,s)))):(o!==dc&&(i=Error(a(423),{cause:o}),Es(Bn(i,s))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=Bn(o,s),h=Jc(t.stateNode,o,h),Ec(t,h),Nt!==4&&(Nt=2)),!1;var p=Error(a(520),{cause:o});if(p=Bn(p,s),Fs===null?Fs=[p]:Fs.push(p),Nt!==4&&(Nt=2),i===null)return!0;o=Bn(o,s),s=i;do{switch(s.tag){case 3:return s.flags|=65536,t=h&-h,s.lanes|=t,t=Jc(s.stateNode,o,t),Ec(s,t),!1;case 1:if(i=s.type,p=s.stateNode,(s.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(fi===null||!fi.has(p))))return s.flags|=65536,h&=-h,s.lanes|=h,h=zp(h),Lp(h,t,s,o),Ec(s,h),!1}s=s.return}while(s!==null);return!1}var Xc=Error(a(461)),Ut=!1;function Xt(t,i,s,o){i.child=t===null?qm(i,null,s,o):Yi(i,t.child,s,o)}function Up(t,i,s,o,h){s=s.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 Ii(i),o=jc(t,i,s,v,p,h),S=Nc(),t!==null&&!Ut?(Rc(t,i,h),jr(t,i,h)):(et&&S&&fc(i),i.flags|=1,Xt(t,i,o,h),i.child)}function Bp(t,i,s,o,h){if(t===null){var p=s.type;return typeof p=="function"&&!oc(p)&&p.defaultProps===void 0&&s.compare===null?(i.tag=15,i.type=p,Pp(t,i,p,o,h)):(t=Kl(s.type,null,o,i,i.mode,h),t.ref=i.ref,t.return=i,i.child=t)}if(p=t.child,!rf(t,h)){var v=p.memoizedProps;if(s=s.compare,s=s!==null?s:ws,s(v,o)&&t.ref===i.ref)return jr(t,i,h)}return i.flags|=1,t=Er(p,o),t.ref=i.ref,t.return=i,i.child=t}function Pp(t,i,s,o,h){if(t!==null){var p=t.memoizedProps;if(ws(p,o)&&t.ref===i.ref)if(Ut=!1,i.pendingProps=o=p,rf(t,h))(t.flags&131072)!==0&&(Ut=!0);else return i.lanes=t.lanes,jr(t,i,h)}return Qc(t,i,s,o,h)}function qp(t,i,s,o){var h=o.children,p=t!==null?t.memoizedState:null;if(t===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((i.flags&128)!==0){if(p=p!==null?p.baseLanes|s:s,t!==null){for(o=i.child=t.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,i.child=null;return Hp(t,i,p,s,o)}if((s&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&to(i,p!==null?p.cachePool:null),p!==null?Fm(i,p):Ac(),$m(i);else return o=i.lanes=536870912,Hp(t,i,p!==null?p.baseLanes|s:s,s,o)}else p!==null?(to(i,p.cachePool),Fm(i,p),li(),i.memoizedState=null):(t!==null&&to(i,null),Ac(),li());return Xt(t,i,h,s),i.child}function Ls(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function Hp(t,i,s,o,h){var p=xc();return p=p===null?null:{parent:zt._currentValue,pool:p},i.memoizedState={baseLanes:s,cachePool:p},t!==null&&to(i,null),Ac(),$m(i),t!==null&&va(t,i,o,!0),i.childLanes=h,null}function bo(t,i){return i=xo({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function Ip(t,i,s){return Yi(i,t.child,null,s),t=bo(i,i.pendingProps),t.flags|=2,wn(i),i.memoizedState=null,t}function yx(t,i,s){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(et){if(o.mode==="hidden")return t=bo(i,o),i.lanes=536870912,Ls(null,t);if(Tc(i),(t=St)?(t=ey(t,Hn),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:Wr!==null?{id:lr,overflow:or}:null,retryLane:536870912,hydrationErrors:null},s=km(t),s.return=i,i.child=s,Vt=i,St=null)):t=null,t===null)throw ti(i);return i.lanes=536870912,null}return bo(i,o)}var p=t.memoizedState;if(p!==null){var v=p.dehydrated;if(Tc(i),h)if(i.flags&256)i.flags&=-257,i=Ip(t,i,s);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(a(558));else if(Ut||va(t,i,s,!1),h=(s&t.childLanes)!==0,Ut||h){if(o=yt,o!==null&&(v=Kr(o,s),v!==0&&v!==p.retryLane))throw p.retryLane=v,Bi(t,v),mn(o,t,v),Xc;Oo(),i=Ip(t,i,s)}else t=p.treeContext,St=Fn(v.nextSibling),Vt=i,et=!0,ei=null,Hn=!1,t!==null&&Tm(i,t),i=bo(i,o),i.flags|=4096;return i}return t=Er(t.child,{mode:o.mode,children:o.children}),t.ref=i.ref,i.child=t,t.return=i,t}function vo(t,i){var s=i.ref;if(s===null)t!==null&&t.ref!==null&&(i.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(a(284));(t===null||t.ref!==s)&&(i.flags|=4194816)}}function Qc(t,i,s,o,h){return Ii(i),s=jc(t,i,s,o,void 0,h),o=Nc(),t!==null&&!Ut?(Rc(t,i,h),jr(t,i,h)):(et&&o&&fc(i),i.flags|=1,Xt(t,i,s,h),i.child)}function Fp(t,i,s,o,h,p){return Ii(i),i.updateQueue=null,s=Ym(i,o,s,h),Gm(t),o=Nc(),t!==null&&!Ut?(Rc(t,i,p),jr(t,i,p)):(et&&o&&fc(i),i.flags|=1,Xt(t,i,s,p),i.child)}function $p(t,i,s,o,h){if(Ii(i),i.stateNode===null){var p=pa,v=s.contextType;typeof v=="object"&&v!==null&&(p=Jt(v)),p=new s(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Vc,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},Sc(i),v=s.contextType,p.context=typeof v=="object"&&v!==null?Jt(v):pa,p.state=i.memoizedState,v=s.getDerivedStateFromProps,typeof v=="function"&&(Yc(i,s,v,o),p.state=i.memoizedState),typeof s.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&&Vc.enqueueReplaceState(p,p.state,null),Ns(i,o,p,h),js(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(t===null){p=i.stateNode;var S=i.memoizedProps,P=Ji(s,S);p.props=P;var te=p.context,le=s.contextType;v=pa,typeof le=="object"&&le!==null&&(v=Jt(le));var pe=s.getDerivedStateFromProps;le=typeof pe=="function"||typeof p.getSnapshotBeforeUpdate=="function",S=i.pendingProps!==S,le||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(S||te!==v)&&jp(i,p,o,v),ri=!1;var ne=i.memoizedState;p.state=ne,Ns(i,o,p,h),js(),te=i.memoizedState,S||ne!==te||ri?(typeof pe=="function"&&(Yc(i,s,pe,o),te=i.memoizedState),(P=ri||Op(i,s,P,o,ne,te,v))?(le||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(i.flags|=4194308)):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=o,i.memoizedState=te),p.props=o,p.state=te,p.context=v,o=P):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,_c(t,i),v=i.memoizedProps,le=Ji(s,v),p.props=le,pe=i.pendingProps,ne=p.context,te=s.contextType,P=pa,typeof te=="object"&&te!==null&&(P=Jt(te)),S=s.getDerivedStateFromProps,(te=typeof S=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==pe||ne!==P)&&jp(i,p,o,P),ri=!1,ne=i.memoizedState,p.state=ne,Ns(i,o,p,h),js();var ae=i.memoizedState;v!==pe||ne!==ae||ri||t!==null&&t.dependencies!==null&&Wl(t.dependencies)?(typeof S=="function"&&(Yc(i,s,S,o),ae=i.memoizedState),(le=ri||Op(i,s,le,o,ne,ae,P)||t!==null&&t.dependencies!==null&&Wl(t.dependencies))?(te||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,ae,P),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,ae,P)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||v===t.memoizedProps&&ne===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===t.memoizedProps&&ne===t.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=ae),p.props=o,p.state=ae,p.context=P,o=le):(typeof p.componentDidUpdate!="function"||v===t.memoizedProps&&ne===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===t.memoizedProps&&ne===t.memoizedState||(i.flags|=1024),o=!1)}return p=o,vo(t,i),o=(i.flags&128)!==0,p||o?(p=i.stateNode,s=o&&typeof s.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,t!==null&&o?(i.child=Yi(i,t.child,null,h),i.child=Yi(i,null,s,h)):Xt(t,i,s,h),i.memoizedState=p.state,t=i.child):t=jr(t,i,h),t}function Gp(t,i,s,o){return qi(),i.flags|=256,Xt(t,i,s,o),i.child}var Kc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zc(t){return{baseLanes:t,cachePool:Dm()}}function Wc(t,i,s){return t=t!==null?t.childLanes&~s:0,i&&(t|=_n),t}function Yp(t,i,s){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,v;if((v=p)||(v=t!==null&&t.memoizedState===null?!1:(Rt.current&2)!==0),v&&(h=!0,i.flags&=-129),v=(i.flags&32)!==0,i.flags&=-33,t===null){if(et){if(h?si(i):li(),(t=St)?(t=ey(t,Hn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:Wr!==null?{id:lr,overflow:or}:null,retryLane:536870912,hydrationErrors:null},s=km(t),s.return=i,i.child=s,Vt=i,St=null)):t=null,t===null)throw ti(i);return Lf(t)?i.lanes=32:i.lanes=536870912,null}var S=o.children;return o=o.fallback,h?(li(),h=i.mode,S=xo({mode:"hidden",children:S},h),o=Pi(o,h,s,null),S.return=i,o.return=i,S.sibling=o,i.child=S,o=i.child,o.memoizedState=Zc(s),o.childLanes=Wc(t,v,s),i.memoizedState=Kc,Ls(null,o)):(si(i),ef(i,S))}var P=t.memoizedState;if(P!==null&&(S=P.dehydrated,S!==null)){if(p)i.flags&256?(si(i),i.flags&=-257,i=tf(t,i,s)):i.memoizedState!==null?(li(),i.child=t.child,i.flags|=128,i=null):(li(),S=o.fallback,h=i.mode,o=xo({mode:"visible",children:o.children},h),S=Pi(S,h,s,null),S.flags|=2,o.return=i,S.return=i,o.sibling=S,i.child=o,Yi(i,t.child,null,s),o=i.child,o.memoizedState=Zc(s),o.childLanes=Wc(t,v,s),i.memoizedState=Kc,i=Ls(null,o));else if(si(i),Lf(S)){if(v=S.nextSibling&&S.nextSibling.dataset,v)var te=v.dgst;v=te,o=Error(a(419)),o.stack="",o.digest=v,Es({value:o,source:null,stack:null}),i=tf(t,i,s)}else if(Ut||va(t,i,s,!1),v=(s&t.childLanes)!==0,Ut||v){if(v=yt,v!==null&&(o=Kr(v,s),o!==0&&o!==P.retryLane))throw P.retryLane=o,Bi(t,o),mn(v,t,o),Xc;zf(S)||Oo(),i=tf(t,i,s)}else zf(S)?(i.flags|=192,i.child=t.child,i=null):(t=P.treeContext,St=Fn(S.nextSibling),Vt=i,et=!0,ei=null,Hn=!1,t!==null&&Tm(i,t),i=ef(i,o.children),i.flags|=4096);return i}return h?(li(),S=o.fallback,h=i.mode,P=t.child,te=P.sibling,o=Er(P,{mode:"hidden",children:o.children}),o.subtreeFlags=P.subtreeFlags&65011712,te!==null?S=Er(te,S):(S=Pi(S,h,s,null),S.flags|=2),S.return=i,o.return=i,o.sibling=S,i.child=o,Ls(null,o),o=i.child,S=t.child.memoizedState,S===null?S=Zc(s):(h=S.cachePool,h!==null?(P=zt._currentValue,h=h.parent!==P?{parent:P,pool:P}:h):h=Dm(),S={baseLanes:S.baseLanes|s,cachePool:h}),o.memoizedState=S,o.childLanes=Wc(t,v,s),i.memoizedState=Kc,Ls(t.child,o)):(si(i),s=t.child,t=s.sibling,s=Er(s,{mode:"visible",children:o.children}),s.return=i,s.sibling=null,t!==null&&(v=i.deletions,v===null?(i.deletions=[t],i.flags|=16):v.push(t)),i.child=s,i.memoizedState=null,s)}function ef(t,i){return i=xo({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function xo(t,i){return t=vn(22,t,null,i),t.lanes=0,t}function tf(t,i,s){return Yi(i,t.child,null,s),t=ef(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function Vp(t,i,s){t.lanes|=i;var o=t.alternate;o!==null&&(o.lanes|=i),gc(t.return,i,s)}function nf(t,i,s,o,h,p){var v=t.memoizedState;v===null?t.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:s,tailMode:h,treeForkCount:p}:(v.isBackwards=i,v.rendering=null,v.renderingStartTime=0,v.last=o,v.tail=s,v.tailMode=h,v.treeForkCount=p)}function Jp(t,i,s){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var v=Rt.current,S=(v&2)!==0;if(S?(v=v&1|2,i.flags|=128):v&=1,_(Rt,v),Xt(t,i,o,s),o=et?_s:0,!S&&t!==null&&(t.flags&128)!==0)e:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Vp(t,s,i);else if(t.tag===19)Vp(t,s,i);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break e;for(;t.sibling===null;){if(t.return===null||t.return===i)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(s=i.child,h=null;s!==null;)t=s.alternate,t!==null&&lo(t)===null&&(h=s),s=s.sibling;s=h,s===null?(h=i.child,i.child=null):(h=s.sibling,s.sibling=null),nf(i,!1,h,s,p,o);break;case"backwards":case"unstable_legacy-backwards":for(s=null,h=i.child,i.child=null;h!==null;){if(t=h.alternate,t!==null&&lo(t)===null){i.child=h;break}t=h.sibling,h.sibling=s,s=h,h=t}nf(i,!0,s,null,p,o);break;case"together":nf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function jr(t,i,s){if(t!==null&&(i.dependencies=t.dependencies),ci|=i.lanes,(s&i.childLanes)===0)if(t!==null){if(va(t,i,s,!1),(s&i.childLanes)===0)return null}else return null;if(t!==null&&i.child!==t.child)throw Error(a(153));if(i.child!==null){for(t=i.child,s=Er(t,t.pendingProps),i.child=s,s.return=i;t.sibling!==null;)t=t.sibling,s=s.sibling=Er(t,t.pendingProps),s.return=i;s.sibling=null}return i.child}function rf(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&Wl(t)))}function bx(t,i,s){switch(i.tag){case 3:Me(i,i.stateNode.containerInfo),ni(i,zt,t.memoizedState.cache),qi();break;case 27:case 5:ze(i);break;case 4:Me(i,i.stateNode.containerInfo);break;case 10:ni(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Tc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(si(i),i.flags|=128,null):(s&i.child.childLanes)!==0?Yp(t,i,s):(si(i),t=jr(t,i,s),t!==null?t.sibling:null);si(i);break;case 19:var h=(t.flags&128)!==0;if(o=(s&i.childLanes)!==0,o||(va(t,i,s,!1),o=(s&i.childLanes)!==0),h){if(o)return Jp(t,i,s);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),_(Rt,Rt.current),o)break;return null;case 22:return i.lanes=0,qp(t,i,s,i.pendingProps);case 24:ni(i,zt,t.memoizedState.cache)}return jr(t,i,s)}function Xp(t,i,s){if(t!==null)if(t.memoizedProps!==i.pendingProps)Ut=!0;else{if(!rf(t,s)&&(i.flags&128)===0)return Ut=!1,bx(t,i,s);Ut=(t.flags&131072)!==0}else Ut=!1,et&&(i.flags&1048576)!==0&&Cm(i,_s,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(t=$i(i.elementType),i.type=t,typeof t=="function")oc(t)?(o=Ji(t,o),i.tag=1,i=$p(null,i,t,o,s)):(i.tag=0,i=Qc(null,i,t,o,s));else{if(t!=null){var h=t.$$typeof;if(h===se){i.tag=11,i=Up(null,i,t,o,s);break e}else if(h===V){i.tag=14,i=Bp(null,i,t,o,s);break e}}throw i=he(t)||t,Error(a(306,i,""))}}return i;case 0:return Qc(t,i,i.type,i.pendingProps,s);case 1:return o=i.type,h=Ji(o,i.pendingProps),$p(t,i,o,h,s);case 3:e:{if(Me(i,i.stateNode.containerInfo),t===null)throw Error(a(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,_c(t,i),Ns(i,o,null,s);var v=i.memoizedState;if(o=v.cache,ni(i,zt,o),o!==p.cache&&yc(i,[zt],s,!0),js(),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=Gp(t,i,o,s);break e}else if(o!==h){h=Bn(Error(a(424)),i),Es(h),i=Gp(t,i,o,s);break e}else{switch(t=i.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(St=Fn(t.firstChild),Vt=i,et=!0,ei=null,Hn=!0,s=qm(i,null,o,s),i.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(qi(),o===h){i=jr(t,i,s);break e}Xt(t,i,o,s)}i=i.child}return i;case 26:return vo(t,i),t===null?(s=sy(i.type,null,i.pendingProps,null))?i.memoizedState=s:et||(s=i.type,t=i.pendingProps,o=Lo(xe.current).createElement(s),o[gt]=i,o[Ot]=t,Qt(o,s,t),I(o),i.stateNode=o):i.memoizedState=sy(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return ze(i),t===null&&et&&(o=i.stateNode=ry(i.type,i.pendingProps,xe.current),Vt=i,Hn=!0,h=St,pi(i.type)?(Uf=h,St=Fn(o.firstChild)):St=h),Xt(t,i,i.pendingProps.children,s),vo(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&&et&&((h=o=St)&&(o=Jx(o,i.type,i.pendingProps,Hn),o!==null?(i.stateNode=o,Vt=i,St=Fn(o.firstChild),Hn=!1,h=!0):h=!1),h||ti(i)),ze(i),h=i.type,p=i.pendingProps,v=t!==null?t.memoizedProps:null,o=p.children,Rf(h,p)?o=null:v!==null&&Rf(h,v)&&(i.flags|=32),i.memoizedState!==null&&(h=jc(t,i,ux,null,null,s),Ks._currentValue=h),vo(t,i),Xt(t,i,o,s),i.child;case 6:return t===null&&et&&((t=s=St)&&(s=Xx(s,i.pendingProps,Hn),s!==null?(i.stateNode=s,Vt=i,St=null,t=!0):t=!1),t||ti(i)),null;case 13:return Yp(t,i,s);case 4:return Me(i,i.stateNode.containerInfo),o=i.pendingProps,t===null?i.child=Yi(i,null,o,s):Xt(t,i,o,s),i.child;case 11:return Up(t,i,i.type,i.pendingProps,s);case 7:return Xt(t,i,i.pendingProps,s),i.child;case 8:return Xt(t,i,i.pendingProps.children,s),i.child;case 12:return Xt(t,i,i.pendingProps.children,s),i.child;case 10:return o=i.pendingProps,ni(i,i.type,o.value),Xt(t,i,o.children,s),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,Ii(i),h=Jt(h),o=o(h),i.flags|=1,Xt(t,i,o,s),i.child;case 14:return Bp(t,i,i.type,i.pendingProps,s);case 15:return Pp(t,i,i.type,i.pendingProps,s);case 19:return Jp(t,i,s);case 31:return yx(t,i,s);case 22:return qp(t,i,s,i.pendingProps);case 24:return Ii(i),o=Jt(zt),t===null?(h=xc(),h===null&&(h=yt,p=bc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=s),h=p),i.memoizedState={parent:o,cache:h},Sc(i),ni(i,zt,h)):((t.lanes&s)!==0&&(_c(t,i),Ns(i,null,null,s),js()),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),ni(i,zt,o)):(o=p.cache,ni(i,zt,o),o!==h.cache&&yc(i,[zt],s,!0))),Xt(t,i,i.pendingProps.children,s),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Nr(t){t.flags|=4}function af(t,i,s,o,h){if((i=(t.mode&32)!==0)&&(i=!1),i){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(Sg())t.flags|=8192;else throw Gi=ro,wc}else t.flags&=-16777217}function Qp(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!fy(i))if(Sg())t.flags|=8192;else throw Gi=ro,wc}function wo(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?aa():536870912,t.lanes|=i,Na|=i)}function Us(t,i){if(!et)switch(t.tailMode){case"hidden":i=t.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?i||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function _t(t){var i=t.alternate!==null&&t.alternate.child===t.child,s=0,o=0;if(i)for(var h=t.child;h!==null;)s|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)s|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=s,i}function vx(t,i,s){var o=i.pendingProps;switch(hc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(i),null;case 1:return _t(i),null;case 3:return s=i.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Cr(zt),ke(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(ba(i)?Nr(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,mc())),_t(i),null;case 26:var h=i.type,p=i.memoizedState;return t===null?(Nr(i),p!==null?(_t(i),Qp(i,p)):(_t(i),af(i,h,null,o,s))):p?p!==t.memoizedState?(Nr(i),_t(i),Qp(i,p)):(_t(i),i.flags&=-16777217):(t=t.memoizedProps,t!==o&&Nr(i),_t(i),af(i,h,t,o,s)),null;case 27:if(ft(i),s=xe.current,h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Nr(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return _t(i),null}t=de.current,ba(i)?Om(i):(t=ry(h,o,s),i.stateNode=t,Nr(i))}return _t(i),null;case 5:if(ft(i),h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Nr(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return _t(i),null}if(p=de.current,ba(i))Om(i);else{var v=Lo(xe.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[gt]=i,p[Ot]=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(Qt(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&&Nr(i)}}return _t(i),af(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,s),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&Nr(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(a(166));if(t=xe.current,ba(i)){if(t=i.stateNode,s=i.memoizedProps,o=null,h=Vt,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[gt]=i,t=!!(t.nodeValue===s||o!==null&&o.suppressHydrationWarning===!0||Yg(t.nodeValue,s)),t||ti(i,!0)}else t=Lo(t).createTextNode(o),t[gt]=i,i.stateNode=t}return _t(i),null;case 31:if(s=i.memoizedState,t===null||t.memoizedState!==null){if(o=ba(i),s!==null){if(t===null){if(!o)throw Error(a(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(557));t[gt]=i}else qi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;_t(i),t=!1}else s=mc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return i.flags&256?(wn(i),i):(wn(i),null);if((i.flags&128)!==0)throw Error(a(558))}return _t(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=ba(i),o!==null&&o.dehydrated!==null){if(t===null){if(!h)throw Error(a(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(a(317));h[gt]=i}else qi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;_t(i),h=!1}else h=mc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(wn(i),i):(wn(i),null)}return wn(i),(i.flags&128)!==0?(i.lanes=s,i):(s=o!==null,t=t!==null&&t.memoizedState!==null,s&&(o=i.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),s!==t&&s&&(i.child.flags|=8192),wo(i,i.updateQueue),_t(i),null);case 4:return ke(),t===null&&Cf(i.stateNode.containerInfo),_t(i),null;case 10:return Cr(i.type),_t(i),null;case 19:if(W(Rt),o=i.memoizedState,o===null)return _t(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Us(o,!1);else{if(Nt!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(p=lo(t),p!==null){for(i.flags|=128,Us(o,!1),t=p.updateQueue,i.updateQueue=t,wo(i,t),i.subtreeFlags=0,t=s,s=i.child;s!==null;)Em(s,t),s=s.sibling;return _(Rt,Rt.current&1|2),et&&kr(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&&vt()>Ao&&(i.flags|=128,h=!0,Us(o,!1),i.lanes=4194304)}else{if(!h)if(t=lo(p),t!==null){if(i.flags|=128,h=!0,t=t.updateQueue,i.updateQueue=t,wo(i,t),Us(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!et)return _t(i),null}else 2*vt()-o.renderingStartTime>Ao&&s!==536870912&&(i.flags|=128,h=!0,Us(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,s=Rt.current,_(Rt,h?s&1|2:s&1),et&&kr(i,o.treeForkCount),t):(_t(i),null);case 22:case 23:return wn(i),Cc(),o=i.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(s&536870912)!==0&&(i.flags&128)===0&&(_t(i),i.subtreeFlags&6&&(i.flags|=8192)):_t(i),s=i.updateQueue,s!==null&&wo(i,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==s&&(i.flags|=2048),t!==null&&W(Fi),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),i.memoizedState.cache!==s&&(i.flags|=2048),Cr(zt),_t(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function xx(t,i){switch(hc(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Cr(zt),ke(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return ft(i),null;case 31:if(i.memoizedState!==null){if(wn(i),i.alternate===null)throw Error(a(340));qi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(wn(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(a(340));qi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return W(Rt),null;case 4:return ke(),null;case 10:return Cr(i.type),null;case 22:case 23:return wn(i),Cc(),t!==null&&W(Fi),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return Cr(zt),null;case 25:return null;default:return null}}function Kp(t,i){switch(hc(i),i.tag){case 3:Cr(zt),ke();break;case 26:case 27:case 5:ft(i);break;case 4:ke();break;case 31:i.memoizedState!==null&&wn(i);break;case 13:wn(i);break;case 19:W(Rt);break;case 10:Cr(i.type);break;case 22:case 23:wn(i),Cc(),t!==null&&W(Fi);break;case 24:Cr(zt)}}function Bs(t,i){try{var s=i.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var h=o.next;s=h;do{if((s.tag&t)===t){o=void 0;var p=s.create,v=s.inst;o=p(),v.destroy=o}s=s.next}while(s!==h)}}catch(S){ct(i,i.return,S)}}function oi(t,i,s){try{var o=i.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&t)===t){var v=o.inst,S=v.destroy;if(S!==void 0){v.destroy=void 0,h=i;var P=s,te=S;try{te()}catch(le){ct(h,P,le)}}}o=o.next}while(o!==p)}}catch(le){ct(i,i.return,le)}}function Zp(t){var i=t.updateQueue;if(i!==null){var s=t.stateNode;try{Im(i,s)}catch(o){ct(t,t.return,o)}}}function Wp(t,i,s){s.props=Ji(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(o){ct(t,i,o)}}function Ps(t,i){try{var s=t.ref;if(s!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof s=="function"?t.refCleanup=s(o):s.current=o}}catch(h){ct(t,i,h)}}function ur(t,i){var s=t.ref,o=t.refCleanup;if(s!==null)if(typeof o=="function")try{o()}catch(h){ct(t,i,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(h){ct(t,i,h)}else s.current=null}function eg(t){var i=t.type,s=t.memoizedProps,o=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":s.autoFocus&&o.focus();break e;case"img":s.src?o.src=s.src:s.srcSet&&(o.srcset=s.srcSet)}}catch(h){ct(t,t.return,h)}}function sf(t,i,s){try{var o=t.stateNode;Ix(o,t.type,s,i),o[Ot]=i}catch(h){ct(t,t.return,h)}}function tg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&pi(t.type)||t.tag===4}function lf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||tg(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&&pi(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 of(t,i,s){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,i):(i=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,i.appendChild(t),s=s._reactRootContainer,s!=null||i.onclick!==null||(i.onclick=Sr));else if(o!==4&&(o===27&&pi(t.type)&&(s=t.stateNode,i=null),t=t.child,t!==null))for(of(t,i,s),t=t.sibling;t!==null;)of(t,i,s),t=t.sibling}function So(t,i,s){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?s.insertBefore(t,i):s.appendChild(t);else if(o!==4&&(o===27&&pi(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(So(t,i,s),t=t.sibling;t!==null;)So(t,i,s),t=t.sibling}function ng(t){var i=t.stateNode,s=t.memoizedProps;try{for(var o=t.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);Qt(i,o,s),i[gt]=t,i[Ot]=s}catch(p){ct(t,t.return,p)}}var Rr=!1,Bt=!1,uf=!1,rg=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function wx(t,i){if(t=t.containerInfo,jf=Fo,t=pm(t),tc(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var o=s.getSelection&&s.getSelection();if(o&&o.rangeCount!==0){s=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{s.nodeType,p.nodeType}catch{s=null;break e}var v=0,S=-1,P=-1,te=0,le=0,pe=t,ne=null;t:for(;;){for(var ae;pe!==s||h!==0&&pe.nodeType!==3||(S=v+h),pe!==p||o!==0&&pe.nodeType!==3||(P=v+o),pe.nodeType===3&&(v+=pe.nodeValue.length),(ae=pe.firstChild)!==null;)ne=pe,pe=ae;for(;;){if(pe===t)break t;if(ne===s&&++te===h&&(S=v),ne===p&&++le===o&&(P=v),(ae=pe.nextSibling)!==null)break;pe=ne,ne=pe.parentNode}pe=ae}s=S===-1||P===-1?null:{start:S,end:P}}else s=null}s=s||{start:0,end:0}}else s=null;for(Nf={focusedElem:t,selectionRange:s},Fo=!1,Ft=i;Ft!==null;)if(i=Ft,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,Ft=t;else for(;Ft!==null;){switch(i=Ft,p=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(s=0;s<t.length;s++)h=t[s],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,s=i,h=p.memoizedProps,p=p.memoizedState,o=s.stateNode;try{var Ne=Ji(s.type,h);t=o.getSnapshotBeforeUpdate(Ne,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(Be){ct(s,s.return,Be)}}break;case 3:if((t&1024)!==0){if(t=i.stateNode.containerInfo,s=t.nodeType,s===9)Df(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Df(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(a(163))}if(t=i.sibling,t!==null){t.return=i.return,Ft=t;break}Ft=i.return}}function ig(t,i,s){var o=s.flags;switch(s.tag){case 0:case 11:case 15:Dr(t,s),o&4&&Bs(5,s);break;case 1:if(Dr(t,s),o&4)if(t=s.stateNode,i===null)try{t.componentDidMount()}catch(v){ct(s,s.return,v)}else{var h=Ji(s.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(h,i,t.__reactInternalSnapshotBeforeUpdate)}catch(v){ct(s,s.return,v)}}o&64&&Zp(s),o&512&&Ps(s,s.return);break;case 3:if(Dr(t,s),o&64&&(t=s.updateQueue,t!==null)){if(i=null,s.child!==null)switch(s.child.tag){case 27:case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}try{Im(t,i)}catch(v){ct(s,s.return,v)}}break;case 27:i===null&&o&4&&ng(s);case 26:case 5:Dr(t,s),i===null&&o&4&&eg(s),o&512&&Ps(s,s.return);break;case 12:Dr(t,s);break;case 31:Dr(t,s),o&4&&lg(t,s);break;case 13:Dr(t,s),o&4&&og(t,s),o&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=jx.bind(null,s),Qx(t,s))));break;case 22:if(o=s.memoizedState!==null||Rr,!o){i=i!==null&&i.memoizedState!==null||Bt,h=Rr;var p=Bt;Rr=o,(Bt=i)&&!p?zr(t,s,(s.subtreeFlags&8772)!==0):Dr(t,s),Rr=h,Bt=p}break;case 30:break;default:Dr(t,s)}}function ag(t){var i=t.alternate;i!==null&&(t.alternate=null,ag(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&sa(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 Et=null,cn=!1;function Mr(t,i,s){for(s=s.child;s!==null;)sg(t,i,s),s=s.sibling}function sg(t,i,s){if(pt&&typeof pt.onCommitFiberUnmount=="function")try{pt.onCommitFiberUnmount(Yt,s)}catch{}switch(s.tag){case 26:Bt||ur(s,i),Mr(t,i,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Bt||ur(s,i);var o=Et,h=cn;pi(s.type)&&(Et=s.stateNode,cn=!1),Mr(t,i,s),Js(s.stateNode),Et=o,cn=h;break;case 5:Bt||ur(s,i);case 6:if(o=Et,h=cn,Et=null,Mr(t,i,s),Et=o,cn=h,Et!==null)if(cn)try{(Et.nodeType===9?Et.body:Et.nodeName==="HTML"?Et.ownerDocument.body:Et).removeChild(s.stateNode)}catch(p){ct(s,i,p)}else try{Et.removeChild(s.stateNode)}catch(p){ct(s,i,p)}break;case 18:Et!==null&&(cn?(t=Et,Zg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),Pa(t)):Zg(Et,s.stateNode));break;case 4:o=Et,h=cn,Et=s.stateNode.containerInfo,cn=!0,Mr(t,i,s),Et=o,cn=h;break;case 0:case 11:case 14:case 15:oi(2,s,i),Bt||oi(4,s,i),Mr(t,i,s);break;case 1:Bt||(ur(s,i),o=s.stateNode,typeof o.componentWillUnmount=="function"&&Wp(s,i,o)),Mr(t,i,s);break;case 21:Mr(t,i,s);break;case 22:Bt=(o=Bt)||s.memoizedState!==null,Mr(t,i,s),Bt=o;break;default:Mr(t,i,s)}}function lg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Pa(t)}catch(s){ct(i,i.return,s)}}}function og(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Pa(t)}catch(s){ct(i,i.return,s)}}function Sx(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new rg),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new rg),i;default:throw Error(a(435,t.tag))}}function _o(t,i){var s=Sx(t);i.forEach(function(o){if(!s.has(o)){s.add(o);var h=Nx.bind(null,t,o);o.then(h,h)}})}function fn(t,i){var s=i.deletions;if(s!==null)for(var o=0;o<s.length;o++){var h=s[o],p=t,v=i,S=v;e:for(;S!==null;){switch(S.tag){case 27:if(pi(S.type)){Et=S.stateNode,cn=!1;break e}break;case 5:Et=S.stateNode,cn=!1;break e;case 3:case 4:Et=S.stateNode.containerInfo,cn=!0;break e}S=S.return}if(Et===null)throw Error(a(160));sg(p,v,h),Et=null,cn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)ug(i,t),i=i.sibling}var er=null;function ug(t,i){var s=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:fn(i,t),hn(t),o&4&&(oi(3,t,t.return),Bs(3,t),oi(5,t,t.return));break;case 1:fn(i,t),hn(t),o&512&&(Bt||s===null||ur(s,s.return)),o&64&&Rr&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?o:s.concat(o))));break;case 26:var h=er;if(fn(i,t),hn(t),o&512&&(Bt||s===null||ur(s,s.return)),o&4){var p=s!==null?s.memoizedState:null;if(o=t.memoizedState,s===null)if(o===null)if(t.stateNode===null){e:{o=t.type,s=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[Ht]||p[gt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),Qt(p,o,s),p[gt]=t,I(p),o=p;break e;case"link":var v=uy("link","href",h).get(o+(s.href||""));if(v){for(var S=0;S<v.length;S++)if(p=v[S],p.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&p.getAttribute("rel")===(s.rel==null?null:s.rel)&&p.getAttribute("title")===(s.title==null?null:s.title)&&p.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){v.splice(S,1);break t}}p=h.createElement(o),Qt(p,o,s),h.head.appendChild(p);break;case"meta":if(v=uy("meta","content",h).get(o+(s.content||""))){for(S=0;S<v.length;S++)if(p=v[S],p.getAttribute("content")===(s.content==null?null:""+s.content)&&p.getAttribute("name")===(s.name==null?null:s.name)&&p.getAttribute("property")===(s.property==null?null:s.property)&&p.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&p.getAttribute("charset")===(s.charSet==null?null:s.charSet)){v.splice(S,1);break t}}p=h.createElement(o),Qt(p,o,s),h.head.appendChild(p);break;default:throw Error(a(468,o))}p[gt]=t,I(p),o=p}t.stateNode=o}else cy(h,t.type,t.stateNode);else t.stateNode=oy(h,o,t.memoizedProps);else p!==o?(p===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):p.count--,o===null?cy(h,t.type,t.stateNode):oy(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&sf(t,t.memoizedProps,s.memoizedProps)}break;case 27:fn(i,t),hn(t),o&512&&(Bt||s===null||ur(s,s.return)),s!==null&&o&4&&sf(t,t.memoizedProps,s.memoizedProps);break;case 5:if(fn(i,t),hn(t),o&512&&(Bt||s===null||ur(s,s.return)),t.flags&32){h=t.stateNode;try{oa(h,"")}catch(Ne){ct(t,t.return,Ne)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,sf(t,h,s!==null?s.memoizedProps:h)),o&1024&&(uf=!0);break;case 6:if(fn(i,t),hn(t),o&4){if(t.stateNode===null)throw Error(a(162));o=t.memoizedProps,s=t.stateNode;try{s.nodeValue=o}catch(Ne){ct(t,t.return,Ne)}}break;case 3:if(Po=null,h=er,er=Uo(i.containerInfo),fn(i,t),er=h,hn(t),o&4&&s!==null&&s.memoizedState.isDehydrated)try{Pa(i.containerInfo)}catch(Ne){ct(t,t.return,Ne)}uf&&(uf=!1,cg(t));break;case 4:o=er,er=Uo(t.stateNode.containerInfo),fn(i,t),hn(t),er=o;break;case 12:fn(i,t),hn(t);break;case 31:fn(i,t),hn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,_o(t,o)));break;case 13:fn(i,t),hn(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(ko=vt()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,_o(t,o)));break;case 22:h=t.memoizedState!==null;var P=s!==null&&s.memoizedState!==null,te=Rr,le=Bt;if(Rr=te||h,Bt=le||P,fn(i,t),Bt=le,Rr=te,hn(t),o&8192)e:for(i=t.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(s===null||P||Rr||Bt||Xi(t)),s=null,i=t;;){if(i.tag===5||i.tag===26){if(s===null){P=s=i;try{if(p=P.stateNode,h)v=p.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{S=P.stateNode;var pe=P.memoizedProps.style,ne=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;S.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ne){ct(P,P.return,Ne)}}}else if(i.tag===6){if(s===null){P=i;try{P.stateNode.nodeValue=h?"":P.memoizedProps}catch(Ne){ct(P,P.return,Ne)}}}else if(i.tag===18){if(s===null){P=i;try{var ae=P.stateNode;h?Wg(ae,!0):Wg(P.stateNode,!1)}catch(Ne){ct(P,P.return,Ne)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===t)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;s===i&&(s=null),i=i.return}s===i&&(s=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=t.updateQueue,o!==null&&(s=o.retryQueue,s!==null&&(o.retryQueue=null,_o(t,s))));break;case 19:fn(i,t),hn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,_o(t,o)));break;case 30:break;case 21:break;default:fn(i,t),hn(t)}}function hn(t){var i=t.flags;if(i&2){try{for(var s,o=t.return;o!==null;){if(tg(o)){s=o;break}o=o.return}if(s==null)throw Error(a(160));switch(s.tag){case 27:var h=s.stateNode,p=lf(t);So(t,p,h);break;case 5:var v=s.stateNode;s.flags&32&&(oa(v,""),s.flags&=-33);var S=lf(t);So(t,S,v);break;case 3:case 4:var P=s.stateNode.containerInfo,te=lf(t);of(t,te,P);break;default:throw Error(a(161))}}catch(le){ct(t,t.return,le)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function cg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;cg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),t=t.sibling}}function Dr(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)ig(t,i.alternate,i),i=i.sibling}function Xi(t){for(t=t.child;t!==null;){var i=t;switch(i.tag){case 0:case 11:case 14:case 15:oi(4,i,i.return),Xi(i);break;case 1:ur(i,i.return);var s=i.stateNode;typeof s.componentWillUnmount=="function"&&Wp(i,i.return,s),Xi(i);break;case 27:Js(i.stateNode);case 26:case 5:ur(i,i.return),Xi(i);break;case 22:i.memoizedState===null&&Xi(i);break;case 30:Xi(i);break;default:Xi(i)}t=t.sibling}}function zr(t,i,s){for(s=s&&(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:zr(h,p,s),Bs(4,p);break;case 1:if(zr(h,p,s),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(te){ct(o,o.return,te)}if(o=p,h=o.updateQueue,h!==null){var S=o.stateNode;try{var P=h.shared.hiddenCallbacks;if(P!==null)for(h.shared.hiddenCallbacks=null,h=0;h<P.length;h++)Hm(P[h],S)}catch(te){ct(o,o.return,te)}}s&&v&64&&Zp(p),Ps(p,p.return);break;case 27:ng(p);case 26:case 5:zr(h,p,s),s&&o===null&&v&4&&eg(p),Ps(p,p.return);break;case 12:zr(h,p,s);break;case 31:zr(h,p,s),s&&v&4&&lg(h,p);break;case 13:zr(h,p,s),s&&v&4&&og(h,p);break;case 22:p.memoizedState===null&&zr(h,p,s),Ps(p,p.return);break;case 30:break;default:zr(h,p,s)}i=i.sibling}}function cf(t,i){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(t=i.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&ks(s))}function ff(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&ks(t))}function tr(t,i,s,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)fg(t,i,s,o),i=i.sibling}function fg(t,i,s,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:tr(t,i,s,o),h&2048&&Bs(9,i);break;case 1:tr(t,i,s,o);break;case 3:tr(t,i,s,o),h&2048&&(t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&ks(t)));break;case 12:if(h&2048){tr(t,i,s,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(P){ct(i,i.return,P)}}else tr(t,i,s,o);break;case 31:tr(t,i,s,o);break;case 13:tr(t,i,s,o);break;case 23:break;case 22:p=i.stateNode,v=i.alternate,i.memoizedState!==null?p._visibility&2?tr(t,i,s,o):qs(t,i):p._visibility&2?tr(t,i,s,o):(p._visibility|=2,Ta(t,i,s,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&cf(v,i);break;case 24:tr(t,i,s,o),h&2048&&ff(i.alternate,i);break;default:tr(t,i,s,o)}}function Ta(t,i,s,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=t,v=i,S=s,P=o,te=v.flags;switch(v.tag){case 0:case 11:case 15:Ta(p,v,S,P,h),Bs(8,v);break;case 23:break;case 22:var le=v.stateNode;v.memoizedState!==null?le._visibility&2?Ta(p,v,S,P,h):qs(p,v):(le._visibility|=2,Ta(p,v,S,P,h)),h&&te&2048&&cf(v.alternate,v);break;case 24:Ta(p,v,S,P,h),h&&te&2048&&ff(v.alternate,v);break;default:Ta(p,v,S,P,h)}i=i.sibling}}function qs(t,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var s=t,o=i,h=o.flags;switch(o.tag){case 22:qs(s,o),h&2048&&cf(o.alternate,o);break;case 24:qs(s,o),h&2048&&ff(o.alternate,o);break;default:qs(s,o)}i=i.sibling}}var Hs=8192;function Oa(t,i,s){if(t.subtreeFlags&Hs)for(t=t.child;t!==null;)hg(t,i,s),t=t.sibling}function hg(t,i,s){switch(t.tag){case 26:Oa(t,i,s),t.flags&Hs&&t.memoizedState!==null&&ow(s,er,t.memoizedState,t.memoizedProps);break;case 5:Oa(t,i,s);break;case 3:case 4:var o=er;er=Uo(t.stateNode.containerInfo),Oa(t,i,s),er=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=Hs,Hs=16777216,Oa(t,i,s),Hs=o):Oa(t,i,s));break;default:Oa(t,i,s)}}function dg(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 Is(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var o=i[s];Ft=o,pg(o,t)}dg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)mg(t),t=t.sibling}function mg(t){switch(t.tag){case 0:case 11:case 15:Is(t),t.flags&2048&&oi(9,t,t.return);break;case 3:Is(t);break;case 12:Is(t);break;case 22:var i=t.stateNode;t.memoizedState!==null&&i._visibility&2&&(t.return===null||t.return.tag!==13)?(i._visibility&=-3,Eo(t)):Is(t);break;default:Is(t)}}function Eo(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var o=i[s];Ft=o,pg(o,t)}dg(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:oi(8,i,i.return),Eo(i);break;case 22:s=i.stateNode,s._visibility&2&&(s._visibility&=-3,Eo(i));break;default:Eo(i)}t=t.sibling}}function pg(t,i){for(;Ft!==null;){var s=Ft;switch(s.tag){case 0:case 11:case 15:oi(8,s,i);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var o=s.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:ks(s.memoizedState.cache)}if(o=s.child,o!==null)o.return=s,Ft=o;else e:for(s=t;Ft!==null;){o=Ft;var h=o.sibling,p=o.return;if(ag(o),o===s){Ft=null;break e}if(h!==null){h.return=p,Ft=h;break e}Ft=p}}}var _x={getCacheForType:function(t){var i=Jt(zt),s=i.data.get(t);return s===void 0&&(s=t(),i.data.set(t,s)),s},cacheSignal:function(){return Jt(zt).controller.signal}},Ex=typeof WeakMap=="function"?WeakMap:Map,lt=0,yt=null,Xe=null,Ze=0,ut=0,Sn=null,ui=!1,ja=!1,hf=!1,Lr=0,Nt=0,ci=0,Qi=0,df=0,_n=0,Na=0,Fs=null,dn=null,mf=!1,ko=0,gg=0,Ao=1/0,Co=null,fi=null,It=0,hi=null,Ra=null,Ur=0,pf=0,gf=null,yg=null,$s=0,yf=null;function En(){return(lt&2)!==0&&Ze!==0?Ze&-Ze:H.T!==null?_f():hs()}function bg(){if(_n===0)if((Ze&536870912)===0||et){var t=vr;vr<<=1,(vr&3932160)===0&&(vr=262144),_n=t}else _n=536870912;return t=xn.current,t!==null&&(t.flags|=32),_n}function mn(t,i,s){(t===yt&&(ut===2||ut===9)||t.cancelPendingCommit!==null)&&(Ma(t,0),di(t,Ze,_n,!1)),Kn(t,s),((lt&2)===0||t!==yt)&&(t===yt&&((lt&2)===0&&(Qi|=s),Nt===4&&di(t,Ze,_n,!1)),cr(t))}function vg(t,i,s){if((lt&6)!==0)throw Error(a(327));var o=!s&&(i&127)===0&&(i&t.expiredLanes)===0||Ni(t,i),h=o?Cx(t,i):vf(t,i,!0),p=o;do{if(h===0){ja&&!o&&di(t,i,0,!1);break}else{if(s=t.current.alternate,p&&!kx(s)){h=vf(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=Fs;var P=S.current.memoizedState.isDehydrated;if(P&&(Ma(S,v).flags|=256),v=vf(S,v,!1),v!==2){if(hf&&!P){S.errorRecoveryDisabledLanes|=p,Qi|=p,h=4;break e}p=dn,dn=h,p!==null&&(dn===null?dn=p:dn.push.apply(dn,p))}h=v}if(p=!1,h!==2)continue}}if(h===1){Ma(t,0),di(t,i,0,!0);break}e:{switch(o=t,p=h,p){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:di(o,i,_n,!ui);break e;case 2:dn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(h=ko+300-vt(),10<h)){if(di(o,i,_n,!ui),ji(o,0,!0)!==0)break e;Ur=i,o.timeoutHandle=Qg(xg.bind(null,o,s,dn,Co,mf,i,_n,Qi,Na,ui,p,"Throttled",-0,0),h);break e}xg(o,s,dn,Co,mf,i,_n,Qi,Na,ui,p,null,-0,0)}}break}while(!0);cr(t)}function xg(t,i,s,o,h,p,v,S,P,te,le,pe,ne,ae){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:Sr},hg(i,p,pe);var Ne=(p&62914560)===p?ko-vt():(p&4194048)===p?gg-vt():0;if(Ne=uw(pe,Ne),Ne!==null){Ur=p,t.cancelPendingCommit=Ne(Tg.bind(null,t,i,p,s,o,h,v,S,P,le,pe,null,ne,ae)),di(t,p,v,!te);return}}Tg(t,i,p,s,o,h,v,S,P)}function kx(t){for(var i=t;;){var s=i.tag;if((s===0||s===11||s===15)&&i.flags&16384&&(s=i.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var o=0;o<s.length;o++){var h=s[o],p=h.getSnapshot;h=h.value;try{if(!bn(p(),h))return!1}catch{return!1}}if(s=i.child,i.subtreeFlags&16384&&s!==null)s.return=i,i=s;else{if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function di(t,i,s,o){i&=~df,i&=~Qi,t.suspendedLanes|=i,t.pingedLanes&=~i,o&&(t.warmLanes|=i),o=t.expirationTimes;for(var h=i;0<h;){var p=31-ot(h),v=1<<p;o[p]=-1,h&=~v}s!==0&&Qr(t,s,i)}function To(){return(lt&6)===0?(Gs(0),!1):!0}function bf(){if(Xe!==null){if(ut===0)var t=Xe.return;else t=Xe,Ar=Hi=null,Mc(t),_a=null,Cs=0,t=Xe;for(;t!==null;)Kp(t.alternate,t),t=t.return;Xe=null}}function Ma(t,i){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,Gx(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),Ur=0,bf(),yt=t,Xe=s=Er(t.current,null),Ze=i,ut=0,Sn=null,ui=!1,ja=Ni(t,i),hf=!1,Na=_n=df=Qi=ci=Nt=0,dn=Fs=null,mf=!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-ot(o),p=1<<h;i|=t[h],o&=~p}return Lr=i,Jl(),s}function wg(t,i){$e=null,H.H=zs,i===Sa||i===no?(i=Um(),ut=3):i===wc?(i=Um(),ut=4):ut=i===Xc?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Sn=i,Xe===null&&(Nt=1,yo(t,Bn(i,t.current)))}function Sg(){var t=xn.current;return t===null?!0:(Ze&4194048)===Ze?In===null:(Ze&62914560)===Ze||(Ze&536870912)!==0?t===In:!1}function _g(){var t=H.H;return H.H=zs,t===null?zs:t}function Eg(){var t=H.A;return H.A=_x,t}function Oo(){Nt=4,ui||(Ze&4194048)!==Ze&&xn.current!==null||(ja=!0),(ci&134217727)===0&&(Qi&134217727)===0||yt===null||di(yt,Ze,_n,!1)}function vf(t,i,s){var o=lt;lt|=2;var h=_g(),p=Eg();(yt!==t||Ze!==i)&&(Co=null,Ma(t,i)),i=!1;var v=Nt;e:do try{if(ut!==0&&Xe!==null){var S=Xe,P=Sn;switch(ut){case 8:bf(),v=6;break e;case 3:case 2:case 9:case 6:xn.current===null&&(i=!0);var te=ut;if(ut=0,Sn=null,Da(t,S,P,te),s&&ja){v=0;break e}break;default:te=ut,ut=0,Sn=null,Da(t,S,P,te)}}Ax(),v=Nt;break}catch(le){wg(t,le)}while(!0);return i&&t.shellSuspendCounter++,Ar=Hi=null,lt=o,H.H=h,H.A=p,Xe===null&&(yt=null,Ze=0,Jl()),v}function Ax(){for(;Xe!==null;)kg(Xe)}function Cx(t,i){var s=lt;lt|=2;var o=_g(),h=Eg();yt!==t||Ze!==i?(Co=null,Ao=vt()+500,Ma(t,i)):ja=Ni(t,i);e:do try{if(ut!==0&&Xe!==null){i=Xe;var p=Sn;t:switch(ut){case 1:ut=0,Sn=null,Da(t,i,p,1);break;case 2:case 9:if(zm(p)){ut=0,Sn=null,Ag(i);break}i=function(){ut!==2&&ut!==9||yt!==t||(ut=7),cr(t)},p.then(i,i);break e;case 3:ut=7;break e;case 4:ut=5;break e;case 7:zm(p)?(ut=0,Sn=null,Ag(i)):(ut=0,Sn=null,Da(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?fy(v):S.stateNode.complete){ut=0,Sn=null;var P=S.sibling;if(P!==null)Xe=P;else{var te=S.return;te!==null?(Xe=te,jo(te)):Xe=null}break t}}ut=0,Sn=null,Da(t,i,p,5);break;case 6:ut=0,Sn=null,Da(t,i,p,6);break;case 8:bf(),Nt=6;break e;default:throw Error(a(462))}}Tx();break}catch(le){wg(t,le)}while(!0);return Ar=Hi=null,H.H=o,H.A=h,lt=s,Xe!==null?0:(yt=null,Ze=0,Jl(),Nt)}function Tx(){for(;Xe!==null&&!ra();)kg(Xe)}function kg(t){var i=Xp(t.alternate,t,Lr);t.memoizedProps=t.pendingProps,i===null?jo(t):Xe=i}function Ag(t){var i=t,s=i.alternate;switch(i.tag){case 15:case 0:i=Fp(s,i,i.pendingProps,i.type,void 0,Ze);break;case 11:i=Fp(s,i,i.pendingProps,i.type.render,i.ref,Ze);break;case 5:Mc(i);default:Kp(s,i),i=Xe=Em(i,Lr),i=Xp(s,i,Lr)}t.memoizedProps=t.pendingProps,i===null?jo(t):Xe=i}function Da(t,i,s,o){Ar=Hi=null,Mc(i),_a=null,Cs=0;var h=i.return;try{if(gx(t,h,i,s,Ze)){Nt=1,yo(t,Bn(s,t.current)),Xe=null;return}}catch(p){if(h!==null)throw Xe=h,p;Nt=1,yo(t,Bn(s,t.current)),Xe=null;return}i.flags&32768?(et||o===1?t=!0:ja||(Ze&536870912)!==0?t=!1:(ui=t=!0,(o===2||o===9||o===3||o===6)&&(o=xn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Cg(i,t)):jo(i)}function jo(t){var i=t;do{if((i.flags&32768)!==0){Cg(i,ui);return}t=i.return;var s=vx(i.alternate,i,Lr);if(s!==null){Xe=s;return}if(i=i.sibling,i!==null){Xe=i;return}Xe=i=t}while(i!==null);Nt===0&&(Nt=5)}function Cg(t,i){do{var s=xx(t.alternate,t);if(s!==null){s.flags&=32767,Xe=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!i&&(t=t.sibling,t!==null)){Xe=t;return}Xe=t=s}while(t!==null);Nt=6,Xe=null}function Tg(t,i,s,o,h,p,v,S,P){t.cancelPendingCommit=null;do No();while(It!==0);if((lt&6)!==0)throw Error(a(327));if(i!==null){if(i===t.current)throw Error(a(177));if(p=i.lanes|i.childLanes,p|=sc,Xr(t,s,p,v,S,P),t===yt&&(Xe=yt=null,Ze=0),Ra=i,hi=t,Ur=s,pf=p,gf=h,yg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Rx(Pe,function(){return Mg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=H.T,H.T=null,h=ie.p,ie.p=2,v=lt,lt|=4;try{wx(t,i,s)}finally{lt=v,ie.p=h,H.T=o}}It=1,Og(),jg(),Ng()}}function Og(){if(It===1){It=0;var t=hi,i=Ra,s=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||s){s=H.T,H.T=null;var o=ie.p;ie.p=2;var h=lt;lt|=4;try{ug(i,t);var p=Nf,v=pm(t.containerInfo),S=p.focusedElem,P=p.selectionRange;if(v!==S&&S&&S.ownerDocument&&mm(S.ownerDocument.documentElement,S)){if(P!==null&&tc(S)){var te=P.start,le=P.end;if(le===void 0&&(le=te),"selectionStart"in S)S.selectionStart=te,S.selectionEnd=Math.min(le,S.value.length);else{var pe=S.ownerDocument||document,ne=pe&&pe.defaultView||window;if(ne.getSelection){var ae=ne.getSelection(),Ne=S.textContent.length,Be=Math.min(P.start,Ne),mt=P.end===void 0?Be:Math.min(P.end,Ne);!ae.extend&&Be>mt&&(v=mt,mt=Be,Be=v);var X=dm(S,Be),$=dm(S,mt);if(X&&$&&(ae.rangeCount!==1||ae.anchorNode!==X.node||ae.anchorOffset!==X.offset||ae.focusNode!==$.node||ae.focusOffset!==$.offset)){var ee=pe.createRange();ee.setStart(X.node,X.offset),ae.removeAllRanges(),Be>mt?(ae.addRange(ee),ae.extend($.node,$.offset)):(ee.setEnd($.node,$.offset),ae.addRange(ee))}}}}for(pe=[],ae=S;ae=ae.parentNode;)ae.nodeType===1&&pe.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<pe.length;S++){var ce=pe[S];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Fo=!!jf,Nf=jf=null}finally{lt=h,ie.p=o,H.T=s}}t.current=i,It=2}}function jg(){if(It===2){It=0;var t=hi,i=Ra,s=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||s){s=H.T,H.T=null;var o=ie.p;ie.p=2;var h=lt;lt|=4;try{ig(t,i.alternate,i)}finally{lt=h,ie.p=o,H.T=s}}It=3}}function Ng(){if(It===4||It===3){It=0,Gr();var t=hi,i=Ra,s=Ur,o=yg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?It=5:(It=0,Ra=hi=null,Rg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(fi=null),Mi(s),i=i.stateNode,pt&&typeof pt.onCommitFiberRoot=="function")try{pt.onCommitFiberRoot(Yt,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=H.T,h=ie.p,ie.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,ie.p=h}}(Ur&3)!==0&&No(),cr(t),h=t.pendingLanes,(s&261930)!==0&&(h&42)!==0?t===yf?$s++:($s=0,yf=t):$s=0,Gs(0)}}function Rg(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,ks(i)))}function No(){return Og(),jg(),Ng(),Mg()}function Mg(){if(It!==5)return!1;var t=hi,i=pf;pf=0;var s=Mi(Ur),o=H.T,h=ie.p;try{ie.p=32>s?32:s,H.T=null,s=gf,gf=null;var p=hi,v=Ur;if(It=0,Ra=hi=null,Ur=0,(lt&6)!==0)throw Error(a(331));var S=lt;if(lt|=4,mg(p.current),fg(p,p.current,v,s),lt=S,Gs(0,!1),pt&&typeof pt.onPostCommitFiberRoot=="function")try{pt.onPostCommitFiberRoot(Yt,p)}catch{}return!0}finally{ie.p=h,H.T=o,Rg(t,i)}}function Dg(t,i,s){i=Bn(s,i),i=Jc(t.stateNode,i,2),t=ai(t,i,2),t!==null&&(Kn(t,2),cr(t))}function ct(t,i,s){if(t.tag===3)Dg(t,t,s);else for(;i!==null;){if(i.tag===3){Dg(i,t,s);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(fi===null||!fi.has(o))){t=Bn(s,t),s=zp(2),o=ai(i,s,2),o!==null&&(Lp(s,o,i,t),Kn(o,2),cr(o));break}}i=i.return}}function xf(t,i,s){var o=t.pingCache;if(o===null){o=t.pingCache=new Ex;var h=new Set;o.set(i,h)}else h=o.get(i),h===void 0&&(h=new Set,o.set(i,h));h.has(s)||(hf=!0,h.add(s),t=Ox.bind(null,t,i,s),i.then(t,t))}function Ox(t,i,s){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,yt===t&&(Ze&s)===s&&(Nt===4||Nt===3&&(Ze&62914560)===Ze&&300>vt()-ko?(lt&2)===0&&Ma(t,0):df|=s,Na===Ze&&(Na=0)),cr(t)}function zg(t,i){i===0&&(i=aa()),t=Bi(t,i),t!==null&&(Kn(t,i),cr(t))}function jx(t){var i=t.memoizedState,s=0;i!==null&&(s=i.retryLane),zg(t,s)}function Nx(t,i){var s=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(s=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(a(314))}o!==null&&o.delete(i),zg(t,s)}function Rx(t,i){return $r(t,i)}var Ro=null,za=null,wf=!1,Mo=!1,Sf=!1,mi=0;function cr(t){t!==za&&t.next===null&&(za===null?Ro=za=t:za=za.next=t),Mo=!0,wf||(wf=!0,Dx())}function Gs(t,i){if(!Sf&&Mo){Sf=!0;do for(var s=!1,o=Ro;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-ot(42|t)+1)-1,p&=h&~(v&~S),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(s=!0,Pg(o,p))}else p=Ze,p=ji(o,o===yt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Ni(o,p)||(s=!0,Pg(o,p));o=o.next}while(s);Sf=!1}}function Mx(){Lg()}function Lg(){Mo=wf=!1;var t=0;mi!==0&&$x()&&(t=mi);for(var i=vt(),s=null,o=Ro;o!==null;){var h=o.next,p=Ug(o,i);p===0?(o.next=null,s===null?Ro=h:s.next=h,h===null&&(za=s)):(s=o,(t!==0||(p&3)!==0)&&(Mo=!0)),o=h}It!==0&&It!==5||Gs(t),mi!==0&&(mi=0)}function Ug(t,i){for(var s=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var v=31-ot(p),S=1<<v,P=h[v];P===-1?((S&s)===0||(S&o)!==0)&&(h[v]=fs(S,i)):P<=i&&(t.expiredLanes|=S),p&=~S}if(i=yt,s=Ze,s=ji(t,t===i?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,s===0||t===i&&(ut===2||ut===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&Xn(o),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||Ni(t,s)){if(i=s&-s,i===t.callbackPriority)return i;switch(o!==null&&Xn(o),Mi(s)){case 2:case 8:s=_e;break;case 32:s=Pe;break;case 268435456:s=it;break;default:s=Pe}return o=Bg.bind(null,t),s=$r(s,o),t.callbackPriority=i,t.callbackNode=s,i}return o!==null&&o!==null&&Xn(o),t.callbackPriority=2,t.callbackNode=null,2}function Bg(t,i){if(It!==0&&It!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(No()&&t.callbackNode!==s)return null;var o=Ze;return o=ji(t,t===yt?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(vg(t,o,i),Ug(t,vt()),t.callbackNode!=null&&t.callbackNode===s?Bg.bind(null,t):null)}function Pg(t,i){if(No())return null;vg(t,i,!0)}function Dx(){Yx(function(){(lt&6)!==0?$r(oe,Mx):Lg()})}function _f(){if(mi===0){var t=xa;t===0&&(t=Yr,Yr<<=1,(Yr&261888)===0&&(Yr=256)),mi=t}return mi}function qg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:ql(""+t)}function Hg(t,i){var s=i.ownerDocument.createElement("input");return s.name=i.name,s.value=i.value,t.id&&s.setAttribute("form",t.id),i.parentNode.insertBefore(s,i),t=new FormData(t),s.parentNode.removeChild(s),t}function zx(t,i,s,o,h){if(i==="submit"&&s&&s.stateNode===h){var p=qg((h[Ot]||null).action),v=o.submitter;v&&(i=(i=v[Ot]||null)?qg(i.formAction):v.getAttribute("formAction"),i!==null&&(p=i,v=null));var S=new $l("action","action",null,o,h);t.push({event:S,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(mi!==0){var P=v?Hg(h,v):new FormData(h);Ic(s,{pending:!0,data:P,method:h.method,action:p},null,P)}}else typeof p=="function"&&(S.preventDefault(),P=v?Hg(h,v):new FormData(h),Ic(s,{pending:!0,data:P,method:h.method,action:p},p,P))},currentTarget:h}]})}}for(var Ef=0;Ef<ac.length;Ef++){var kf=ac[Ef],Lx=kf.toLowerCase(),Ux=kf[0].toUpperCase()+kf.slice(1);Wn(Lx,"on"+Ux)}Wn(bm,"onAnimationEnd"),Wn(vm,"onAnimationIteration"),Wn(xm,"onAnimationStart"),Wn("dblclick","onDoubleClick"),Wn("focusin","onFocus"),Wn("focusout","onBlur"),Wn(Wv,"onTransitionRun"),Wn(ex,"onTransitionStart"),Wn(tx,"onTransitionCancel"),Wn(wm,"onTransitionEnd"),re("onMouseEnter",["mouseout","mouseover"]),re("onMouseLeave",["mouseout","mouseover"]),re("onPointerEnter",["pointerout","pointerover"]),re("onPointerLeave",["pointerout","pointerover"]),be("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),be("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),be("onBeforeInput",["compositionend","keypress","textInput","paste"]),be("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ys="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(" "),Bx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ys));function Ig(t,i){i=(i&4)!==0;for(var s=0;s<t.length;s++){var o=t[s],h=o.event;o=o.listeners;e:{var p=void 0;if(i)for(var v=o.length-1;0<=v;v--){var S=o[v],P=S.instance,te=S.currentTarget;if(S=S.listener,P!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=te;try{p(h)}catch(le){Vl(le)}h.currentTarget=null,p=P}else for(v=0;v<o.length;v++){if(S=o[v],P=S.instance,te=S.currentTarget,S=S.listener,P!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=te;try{p(h)}catch(le){Vl(le)}h.currentTarget=null,p=P}}}}function Qe(t,i){var s=i[Di];s===void 0&&(s=i[Di]=new Set);var o=t+"__bubble";s.has(o)||(Fg(i,t,2,!1),s.add(o))}function Af(t,i,s){var o=0;i&&(o|=4),Fg(s,t,o,i)}var Do="_reactListening"+Math.random().toString(36).slice(2);function Cf(t){if(!t[Do]){t[Do]=!0,Z.forEach(function(s){s!=="selectionchange"&&(Bx.has(s)||Af(s,!1,t),Af(s,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[Do]||(i[Do]=!0,Af("selectionchange",!1,i))}}function Fg(t,i,s,o){switch(by(i)){case 2:var h=hw;break;case 8:h=dw;break;default:h=If}s=h.bind(null,i,s,t),h=void 0,!Yu||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(i,s,{capture:!0,passive:h}):t.addEventListener(i,s,!0):h!==void 0?t.addEventListener(i,s,{passive:h}):t.addEventListener(i,s,!1)}function Tf(t,i,s,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 P=v.tag;if((P===3||P===4)&&v.stateNode.containerInfo===h)return;v=v.return}for(;S!==null;){if(v=E(S),v===null)return;if(P=v.tag,P===5||P===6||P===26||P===27){o=p=v;continue e}S=S.parentNode}}o=o.return}Jd(function(){var te=p,le=$u(s),pe=[];e:{var ne=Sm.get(t);if(ne!==void 0){var ae=$l,Ne=t;switch(t){case"keypress":if(Il(s)===0)break e;case"keydown":case"keyup":ae=Nv;break;case"focusin":Ne="focus",ae=Qu;break;case"focusout":Ne="blur",ae=Qu;break;case"beforeblur":case"afterblur":ae=Qu;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=Kd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=vv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=Dv;break;case bm:case vm:case xm:ae=Sv;break;case wm:ae=Lv;break;case"scroll":case"scrollend":ae=yv;break;case"wheel":ae=Bv;break;case"copy":case"cut":case"paste":ae=Ev;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=Wd;break;case"toggle":case"beforetoggle":ae=qv}var Be=(i&4)!==0,mt=!Be&&(t==="scroll"||t==="scrollend"),X=Be?ne!==null?ne+"Capture":null:ne;Be=[];for(var $=te,ee;$!==null;){var ce=$;if(ee=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||ee===null||X===null||(ce=ms($,X),ce!=null&&Be.push(Vs($,ce,ee))),mt)break;$=$.return}0<Be.length&&(ne=new ae(ne,Ne,null,s,le),pe.push({event:ne,listeners:Be}))}}if((i&7)===0){e:{if(ne=t==="mouseover"||t==="pointerover",ae=t==="mouseout"||t==="pointerout",ne&&s!==Fu&&(Ne=s.relatedTarget||s.fromElement)&&(E(Ne)||Ne[yn]))break e;if((ae||ne)&&(ne=le.window===le?le:(ne=le.ownerDocument)?ne.defaultView||ne.parentWindow:window,ae?(Ne=s.relatedTarget||s.toElement,ae=te,Ne=Ne?E(Ne):null,Ne!==null&&(mt=u(Ne),Be=Ne.tag,Ne!==mt||Be!==5&&Be!==27&&Be!==6)&&(Ne=null)):(ae=null,Ne=te),ae!==Ne)){if(Be=Kd,ce="onMouseLeave",X="onMouseEnter",$="mouse",(t==="pointerout"||t==="pointerover")&&(Be=Wd,ce="onPointerLeave",X="onPointerEnter",$="pointer"),mt=ae==null?ne:C(ae),ee=Ne==null?ne:C(Ne),ne=new Be(ce,$+"leave",ae,s,le),ne.target=mt,ne.relatedTarget=ee,ce=null,E(le)===te&&(Be=new Be(X,$+"enter",Ne,s,le),Be.target=ee,Be.relatedTarget=mt,ce=Be),mt=ce,ae&&Ne)t:{for(Be=Px,X=ae,$=Ne,ee=0,ce=X;ce;ce=Be(ce))ee++;ce=0;for(var De=$;De;De=Be(De))ce++;for(;0<ee-ce;)X=Be(X),ee--;for(;0<ce-ee;)$=Be($),ce--;for(;ee--;){if(X===$||$!==null&&X===$.alternate){Be=X;break t}X=Be(X),$=Be($)}Be=null}else Be=null;ae!==null&&$g(pe,ne,ae,Be,!1),Ne!==null&&mt!==null&&$g(pe,mt,Ne,Be,!0)}}e:{if(ne=te?C(te):window,ae=ne.nodeName&&ne.nodeName.toLowerCase(),ae==="select"||ae==="input"&&ne.type==="file")var at=lm;else if(am(ne))if(om)at=Qv;else{at=Jv;var Re=Vv}else ae=ne.nodeName,!ae||ae.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&Iu(te.elementType)&&(at=lm):at=Xv;if(at&&(at=at(t,te))){sm(pe,at,s,le);break e}Re&&Re(t,ne,te),t==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&Hu(ne,"number",ne.value)}switch(Re=te?C(te):window,t){case"focusin":(am(Re)||Re.contentEditable==="true")&&(ha=Re,nc=te,Ss=null);break;case"focusout":Ss=nc=ha=null;break;case"mousedown":rc=!0;break;case"contextmenu":case"mouseup":case"dragend":rc=!1,gm(pe,s,le);break;case"selectionchange":if(Zv)break;case"keydown":case"keyup":gm(pe,s,le)}var Ge;if(Zu)e:{switch(t){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else fa?rm(t,s)&&(We="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(We="onCompositionStart");We&&(em&&s.locale!=="ko"&&(fa||We!=="onCompositionStart"?We==="onCompositionEnd"&&fa&&(Ge=Xd()):(Zr=le,Vu="value"in Zr?Zr.value:Zr.textContent,fa=!0)),Re=zo(te,We),0<Re.length&&(We=new Zd(We,t,null,s,le),pe.push({event:We,listeners:Re}),Ge?We.data=Ge:(Ge=im(s),Ge!==null&&(We.data=Ge)))),(Ge=Iv?Fv(t,s):$v(t,s))&&(We=zo(te,"onBeforeInput"),0<We.length&&(Re=new Zd("onBeforeInput","beforeinput",null,s,le),pe.push({event:Re,listeners:We}),Re.data=Ge)),zx(pe,t,te,s,le)}Ig(pe,i)})}function Vs(t,i,s){return{instance:t,listener:i,currentTarget:s}}function zo(t,i){for(var s=i+"Capture",o=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=ms(t,s),h!=null&&o.unshift(Vs(t,h,p)),h=ms(t,i),h!=null&&o.push(Vs(t,h,p))),t.tag===3)return o;t=t.return}return[]}function Px(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function $g(t,i,s,o,h){for(var p=i._reactName,v=[];s!==null&&s!==o;){var S=s,P=S.alternate,te=S.stateNode;if(S=S.tag,P!==null&&P===o)break;S!==5&&S!==26&&S!==27||te===null||(P=te,h?(te=ms(s,p),te!=null&&v.unshift(Vs(s,te,P))):h||(te=ms(s,p),te!=null&&v.push(Vs(s,te,P)))),s=s.return}v.length!==0&&t.push({event:i,listeners:v})}var qx=/\r\n?/g,Hx=/\u0000|\uFFFD/g;function Gg(t){return(typeof t=="string"?t:""+t).replace(qx,`
49
+ `).replace(Hx,"")}function Yg(t,i){return i=Gg(i),Gg(t)===i}function dt(t,i,s,o,h,p){switch(s){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||oa(t,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&oa(t,""+o);break;case"className":Zn(t,"class",o);break;case"tabIndex":Zn(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Zn(t,s,o);break;case"style":Yd(t,o,p);break;case"data":if(i!=="object"){Zn(t,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||s!=="href")){t.removeAttribute(s);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(s);break}o=ql(""+o),t.setAttribute(s,o);break;case"action":case"formAction":if(typeof o=="function"){t.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(s==="formAction"?(i!=="input"&&dt(t,i,"name",h.name,h,null),dt(t,i,"formEncType",h.formEncType,h,null),dt(t,i,"formMethod",h.formMethod,h,null),dt(t,i,"formTarget",h.formTarget,h,null)):(dt(t,i,"encType",h.encType,h,null),dt(t,i,"method",h.method,h,null),dt(t,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(s);break}o=ql(""+o),t.setAttribute(s,o);break;case"onClick":o!=null&&(t.onclick=Sr);break;case"onScroll":o!=null&&Qe("scroll",t);break;case"onScrollEnd":o!=null&&Qe("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(s=o.__html,s!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=s}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){t.removeAttribute("xlink:href");break}s=ql(""+o),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(s,""+o):t.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(s,""):t.removeAttribute(s);break;case"capture":case"download":o===!0?t.setAttribute(s,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(s,o):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(s,o):t.removeAttribute(s);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(s):t.setAttribute(s,o);break;case"popover":Qe("beforetoggle",t),Qe("toggle",t),Kt(t,"popover",o);break;case"xlinkActuate":wr(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":wr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":wr(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":wr(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":wr(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":wr(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":wr(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":wr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":wr(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Kt(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=pv.get(s)||s,Kt(t,s,o))}}function Of(t,i,s,o,h,p){switch(s){case"style":Yd(t,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(s=o.__html,s!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=s}}break;case"children":typeof o=="string"?oa(t,o):(typeof o=="number"||typeof o=="bigint")&&oa(t,""+o);break;case"onScroll":o!=null&&Qe("scroll",t);break;case"onScrollEnd":o!=null&&Qe("scrollend",t);break;case"onClick":o!=null&&(t.onclick=Sr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!me.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(h=s.endsWith("Capture"),i=s.slice(2,h?s.length-7:void 0),p=t[Ot]||null,p=p!=null?p[s]:null,typeof p=="function"&&t.removeEventListener(i,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(i,o,h);break e}s in t?t[s]=o:o===!0?t.setAttribute(s,""):Kt(t,s,o)}}}function Qt(t,i,s){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",t),Qe("load",t);var o=!1,h=!1,p;for(p in s)if(s.hasOwnProperty(p)){var v=s[p];if(v!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:dt(t,i,p,v,s,null)}}h&&dt(t,i,"srcSet",s.srcSet,s,null),o&&dt(t,i,"src",s.src,s,null);return;case"input":Qe("invalid",t);var S=p=v=h=null,P=null,te=null;for(o in s)if(s.hasOwnProperty(o)){var le=s[o];if(le!=null)switch(o){case"name":h=le;break;case"type":v=le;break;case"checked":P=le;break;case"defaultChecked":te=le;break;case"value":p=le;break;case"defaultValue":S=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(a(137,i));break;default:dt(t,i,o,le,s,null)}}Id(t,p,S,P,te,v,h,!1);return;case"select":Qe("invalid",t),o=v=p=null;for(h in s)if(s.hasOwnProperty(h)&&(S=s[h],S!=null))switch(h){case"value":p=S;break;case"defaultValue":v=S;break;case"multiple":o=S;default:dt(t,i,h,S,s,null)}i=p,s=v,t.multiple=!!o,i!=null?la(t,!!o,i,!1):s!=null&&la(t,!!o,s,!0);return;case"textarea":Qe("invalid",t),p=h=o=null;for(v in s)if(s.hasOwnProperty(v)&&(S=s[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(a(91));break;default:dt(t,i,v,S,s,null)}$d(t,o,h,p);return;case"option":for(P in s)if(s.hasOwnProperty(P)&&(o=s[P],o!=null))switch(P){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:dt(t,i,P,o,s,null)}return;case"dialog":Qe("beforetoggle",t),Qe("toggle",t),Qe("cancel",t),Qe("close",t);break;case"iframe":case"object":Qe("load",t);break;case"video":case"audio":for(o=0;o<Ys.length;o++)Qe(Ys[o],t);break;case"image":Qe("error",t),Qe("load",t);break;case"details":Qe("toggle",t);break;case"embed":case"source":case"link":Qe("error",t),Qe("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in s)if(s.hasOwnProperty(te)&&(o=s[te],o!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:dt(t,i,te,o,s,null)}return;default:if(Iu(i)){for(le in s)s.hasOwnProperty(le)&&(o=s[le],o!==void 0&&Of(t,i,le,o,s,void 0));return}}for(S in s)s.hasOwnProperty(S)&&(o=s[S],o!=null&&dt(t,i,S,o,s,null))}function Ix(t,i,s,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,v=null,S=null,P=null,te=null,le=null;for(ae in s){var pe=s[ae];if(s.hasOwnProperty(ae)&&pe!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":P=pe;default:o.hasOwnProperty(ae)||dt(t,i,ae,null,o,pe)}}for(var ne in o){var ae=o[ne];if(pe=s[ne],o.hasOwnProperty(ne)&&(ae!=null||pe!=null))switch(ne){case"type":p=ae;break;case"name":h=ae;break;case"checked":te=ae;break;case"defaultChecked":le=ae;break;case"value":v=ae;break;case"defaultValue":S=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(a(137,i));break;default:ae!==pe&&dt(t,i,ne,ae,o,pe)}}qu(t,v,S,P,te,le,p,h);return;case"select":ae=v=S=ne=null;for(p in s)if(P=s[p],s.hasOwnProperty(p)&&P!=null)switch(p){case"value":break;case"multiple":ae=P;default:o.hasOwnProperty(p)||dt(t,i,p,null,o,P)}for(h in o)if(p=o[h],P=s[h],o.hasOwnProperty(h)&&(p!=null||P!=null))switch(h){case"value":ne=p;break;case"defaultValue":S=p;break;case"multiple":v=p;default:p!==P&&dt(t,i,h,p,o,P)}i=S,s=v,o=ae,ne!=null?la(t,!!s,ne,!1):!!o!=!!s&&(i!=null?la(t,!!s,i,!0):la(t,!!s,s?[]:"",!1));return;case"textarea":ae=ne=null;for(S in s)if(h=s[S],s.hasOwnProperty(S)&&h!=null&&!o.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:dt(t,i,S,null,o,h)}for(v in o)if(h=o[v],p=s[v],o.hasOwnProperty(v)&&(h!=null||p!=null))switch(v){case"value":ne=h;break;case"defaultValue":ae=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(a(91));break;default:h!==p&&dt(t,i,v,h,o,p)}Fd(t,ne,ae);return;case"option":for(var Ne in s)if(ne=s[Ne],s.hasOwnProperty(Ne)&&ne!=null&&!o.hasOwnProperty(Ne))switch(Ne){case"selected":t.selected=!1;break;default:dt(t,i,Ne,null,o,ne)}for(P in o)if(ne=o[P],ae=s[P],o.hasOwnProperty(P)&&ne!==ae&&(ne!=null||ae!=null))switch(P){case"selected":t.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:dt(t,i,P,ne,o,ae)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Be in s)ne=s[Be],s.hasOwnProperty(Be)&&ne!=null&&!o.hasOwnProperty(Be)&&dt(t,i,Be,null,o,ne);for(te in o)if(ne=o[te],ae=s[te],o.hasOwnProperty(te)&&ne!==ae&&(ne!=null||ae!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(a(137,i));break;default:dt(t,i,te,ne,o,ae)}return;default:if(Iu(i)){for(var mt in s)ne=s[mt],s.hasOwnProperty(mt)&&ne!==void 0&&!o.hasOwnProperty(mt)&&Of(t,i,mt,void 0,o,ne);for(le in o)ne=o[le],ae=s[le],!o.hasOwnProperty(le)||ne===ae||ne===void 0&&ae===void 0||Of(t,i,le,ne,o,ae);return}}for(var X in s)ne=s[X],s.hasOwnProperty(X)&&ne!=null&&!o.hasOwnProperty(X)&&dt(t,i,X,null,o,ne);for(pe in o)ne=o[pe],ae=s[pe],!o.hasOwnProperty(pe)||ne===ae||ne==null&&ae==null||dt(t,i,pe,ne,o,ae)}function Vg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Fx(){if(typeof performance.getEntriesByType=="function"){for(var t=0,i=0,s=performance.getEntriesByType("resource"),o=0;o<s.length;o++){var h=s[o],p=h.transferSize,v=h.initiatorType,S=h.duration;if(p&&S&&Vg(v)){for(v=0,S=h.responseEnd,o+=1;o<s.length;o++){var P=s[o],te=P.startTime;if(te>S)break;var le=P.transferSize,pe=P.initiatorType;le&&Vg(pe)&&(P=P.responseEnd,v+=le*(P<S?1:(S-te)/(P-te)))}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 jf=null,Nf=null;function Lo(t){return t.nodeType===9?t:t.ownerDocument}function Jg(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 Xg(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 Rf(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 Mf=null;function $x(){var t=window.event;return t&&t.type==="popstate"?t===Mf?!1:(Mf=t,!0):(Mf=null,!1)}var Qg=typeof setTimeout=="function"?setTimeout:void 0,Gx=typeof clearTimeout=="function"?clearTimeout:void 0,Kg=typeof Promise=="function"?Promise:void 0,Yx=typeof queueMicrotask=="function"?queueMicrotask:typeof Kg<"u"?function(t){return Kg.resolve(null).then(t).catch(Vx)}:Qg;function Vx(t){setTimeout(function(){throw t})}function pi(t){return t==="head"}function Zg(t,i){var s=i,o=0;do{var h=s.nextSibling;if(t.removeChild(s),h&&h.nodeType===8)if(s=h.data,s==="/$"||s==="/&"){if(o===0){t.removeChild(h),Pa(i);return}o--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")o++;else if(s==="html")Js(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,Js(s);for(var p=s.firstChild;p;){var v=p.nextSibling,S=p.nodeName;p[Ht]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&p.rel.toLowerCase()==="stylesheet"||s.removeChild(p),p=v}}else s==="body"&&Js(t.ownerDocument.body);s=h}while(s);Pa(i)}function Wg(t,i){var s=t;t=0;do{var o=s.nextSibling;if(s.nodeType===1?i?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(i?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),o&&o.nodeType===8)if(s=o.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=o}while(s)}function Df(t){var i=t.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var s=i;switch(i=i.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Df(s),sa(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function Jx(t,i,s,o){for(;t.nodeType===1;){var h=s;if(t.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[Ht])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=Fn(t.nextSibling),t===null)break}return null}function Xx(t,i,s){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=Fn(t.nextSibling),t===null))return null;return t}function ey(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Fn(t.nextSibling),t===null))return null;return t}function zf(t){return t.data==="$?"||t.data==="$~"}function Lf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Qx(t,i){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=i;else if(t.data!=="$?"||s.readyState!=="loading")i();else{var o=function(){i(),s.removeEventListener("DOMContentLoaded",o)};s.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function Fn(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 Uf=null;function ty(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(i===0)return Fn(t.nextSibling);i--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||i++}t=t.nextSibling}return null}function ny(t){t=t.previousSibling;for(var i=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(i===0)return t;i--}else s!=="/$"&&s!=="/&"||i++}t=t.previousSibling}return null}function ry(t,i,s){switch(i=Lo(s),t){case"html":if(t=i.documentElement,!t)throw Error(a(452));return t;case"head":if(t=i.head,!t)throw Error(a(453));return t;case"body":if(t=i.body,!t)throw Error(a(454));return t;default:throw Error(a(451))}}function Js(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);sa(t)}var $n=new Map,iy=new Set;function Uo(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Br=ie.d;ie.d={f:Kx,r:Zx,D:Wx,C:ew,L:tw,m:nw,X:iw,S:rw,M:aw};function Kx(){var t=Br.f(),i=To();return t||i}function Zx(t){var i=T(t);i!==null&&i.tag===5&&i.type==="form"?wp(i):Br.r(t)}var La=typeof document>"u"?null:document;function ay(t,i,s){var o=La;if(o&&typeof i=="string"&&i){var h=Ln(i);h='link[rel="'+t+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),iy.has(h)||(iy.add(h),t={rel:t,crossOrigin:s,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),Qt(i,"link",t),I(i),o.head.appendChild(i)))}}function Wx(t){Br.D(t),ay("dns-prefetch",t,null)}function ew(t,i){Br.C(t,i),ay("preconnect",t,i)}function tw(t,i,s){Br.L(t,i,s);var o=La;if(o&&t&&i){var h='link[rel="preload"][as="'+Ln(i)+'"]';i==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+Ln(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+Ln(s.imageSizes)+'"]')):h+='[href="'+Ln(t)+'"]';var p=h;switch(i){case"style":p=Ua(t);break;case"script":p=Ba(t)}$n.has(p)||(t=g({rel:"preload",href:i==="image"&&s&&s.imageSrcSet?void 0:t,as:i},s),$n.set(p,t),o.querySelector(h)!==null||i==="style"&&o.querySelector(Xs(p))||i==="script"&&o.querySelector(Qs(p))||(i=o.createElement("link"),Qt(i,"link",t),I(i),o.head.appendChild(i)))}}function nw(t,i){Br.m(t,i);var s=La;if(s&&t){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Ln(o)+'"][href="'+Ln(t)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Ba(t)}if(!$n.has(p)&&(t=g({rel:"modulepreload",href:t},i),$n.set(p,t),s.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Qs(p)))return}o=s.createElement("link"),Qt(o,"link",t),I(o),s.head.appendChild(o)}}}function rw(t,i,s){Br.S(t,i,s);var o=La;if(o&&t){var h=z(o).hoistableStyles,p=Ua(t);i=i||"default";var v=h.get(p);if(!v){var S={loading:0,preload:null};if(v=o.querySelector(Xs(p)))S.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":i},s),(s=$n.get(p))&&Bf(t,s);var P=v=o.createElement("link");I(P),Qt(P,"link",t),P._p=new Promise(function(te,le){P.onload=te,P.onerror=le}),P.addEventListener("load",function(){S.loading|=1}),P.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Bo(v,i,o)}v={type:"stylesheet",instance:v,count:1,state:S},h.set(p,v)}}}function iw(t,i){Br.X(t,i);var s=La;if(s&&t){var o=z(s).hoistableScripts,h=Ba(t),p=o.get(h);p||(p=s.querySelector(Qs(h)),p||(t=g({src:t,async:!0},i),(i=$n.get(h))&&Pf(t,i),p=s.createElement("script"),I(p),Qt(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function aw(t,i){Br.M(t,i);var s=La;if(s&&t){var o=z(s).hoistableScripts,h=Ba(t),p=o.get(h);p||(p=s.querySelector(Qs(h)),p||(t=g({src:t,async:!0,type:"module"},i),(i=$n.get(h))&&Pf(t,i),p=s.createElement("script"),I(p),Qt(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function sy(t,i,s,o){var h=(h=xe.current)?Uo(h):null;if(!h)throw Error(a(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(i=Ua(s.href),s=z(h).hoistableStyles,o=s.get(i),o||(o={type:"style",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=Ua(s.href);var p=z(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(Xs(t)))&&!p._p&&(v.instance=p,v.state.loading=5),$n.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},$n.set(t,s),p||sw(h,t,s,v.state))),i&&o===null)throw Error(a(528,""));return v}if(i&&o!==null)throw Error(a(529,""));return null;case"script":return i=s.async,s=s.src,typeof s=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Ba(s),s=z(h).hoistableScripts,o=s.get(i),o||(o={type:"script",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,t))}}function Ua(t){return'href="'+Ln(t)+'"'}function Xs(t){return'link[rel="stylesheet"]['+t+"]"}function ly(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function sw(t,i,s,o){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=t.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),Qt(i,"link",s),I(i),t.head.appendChild(i))}function Ba(t){return'[src="'+Ln(t)+'"]'}function Qs(t){return"script[async]"+t}function oy(t,i,s){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+Ln(s.href)+'"]');if(o)return i.instance=o,I(o),o;var h=g({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),I(o),Qt(o,"style",h),Bo(o,s.precedence,t),i.instance=o;case"stylesheet":h=Ua(s.href);var p=t.querySelector(Xs(h));if(p)return i.state.loading|=4,i.instance=p,I(p),p;o=ly(s),(h=$n.get(h))&&Bf(o,h),p=(t.ownerDocument||t).createElement("link"),I(p);var v=p;return v._p=new Promise(function(S,P){v.onload=S,v.onerror=P}),Qt(p,"link",o),i.state.loading|=4,Bo(p,s.precedence,t),i.instance=p;case"script":return p=Ba(s.src),(h=t.querySelector(Qs(p)))?(i.instance=h,I(h),h):(o=s,(h=$n.get(p))&&(o=g({},s),Pf(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),I(h),Qt(h,"link",o),t.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Bo(o,s.precedence,t));return i.instance}function Bo(t,i,s){for(var o=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,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=s.nodeType===9?s.head:s,i.insertBefore(t,i.firstChild))}function Bf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function Pf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.integrity==null&&(t.integrity=i.integrity)}var Po=null;function uy(t,i,s){if(Po===null){var o=new Map,h=Po=new Map;h.set(s,o)}else h=Po,o=h.get(s),o||(o=new Map,h.set(s,o));if(o.has(t))return o;for(o.set(t,null),s=s.getElementsByTagName(t),h=0;h<s.length;h++){var p=s[h];if(!(p[Ht]||p[gt]||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 cy(t,i,s){t=t.ownerDocument||t,t.head.insertBefore(s,i==="title"?t.querySelector("head > title"):null)}function lw(t,i,s){if(s===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return t=i.disabled,typeof i.precedence=="string"&&t==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function fy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function ow(t,i,s,o){if(s.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var h=Ua(o.href),p=i.querySelector(Xs(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=qo.bind(t),i.then(t,t)),s.state.loading|=4,s.instance=p,I(p);return}p=i.ownerDocument||i,o=ly(o),(h=$n.get(h))&&Bf(o,h),p=p.createElement("link"),I(p);var v=p;v._p=new Promise(function(S,P){v.onload=S,v.onerror=P}),Qt(p,"link",o),s.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=qo.bind(t),i.addEventListener("load",s),i.addEventListener("error",s))}}var qf=0;function uw(t,i){return t.stylesheets&&t.count===0&&Io(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var o=setTimeout(function(){if(t.stylesheets&&Io(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+i);0<t.imgBytes&&qf===0&&(qf=62500*Fx());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Io(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>qf?50:800)+i);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function qo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Io(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Ho=null;function Io(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Ho=new Map,i.forEach(cw,t),Ho=null,qo.call(t))}function cw(t,i){if(!(i.state.loading&4)){var s=Ho.get(t);if(s)var o=s.get(null);else{s=new Map,Ho.set(t,s);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")&&(s.set(v.dataset.precedence,v),o=v)}o&&s.set(null,o)}h=i.instance,v=h.getAttribute("data-precedence"),p=s.get(v)||o,p===o&&s.set(null,h),s.set(v,h),this.count++,o=qo.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 Ks={$$typeof:G,Provider:null,Consumer:null,_currentValue:ge,_currentValue2:ge,_threadCount:0};function fw(t,i,s,o,h,p,v,S,P){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=Jr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jr(0),this.hiddenUpdates=Jr(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=P,this.incompleteTransitions=new Map}function hy(t,i,s,o,h,p,v,S,P,te,le,pe){return t=new fw(t,i,s,v,P,te,le,pe,S),i=1,p===!0&&(i|=24),p=vn(3,null,null,i),t.current=p,p.stateNode=t,i=bc(),i.refCount++,t.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:s,cache:i},Sc(p),t}function dy(t){return t?(t=pa,t):pa}function my(t,i,s,o,h,p){h=dy(h),o.context===null?o.context=h:o.pendingContext=h,o=ii(i),o.payload={element:s},p=p===void 0?null:p,p!==null&&(o.callback=p),s=ai(t,o,i),s!==null&&(mn(s,t,i),Os(s,t,i))}function py(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<i?s:i}}function Hf(t,i){py(t,i),(t=t.alternate)&&py(t,i)}function gy(t){if(t.tag===13||t.tag===31){var i=Bi(t,67108864);i!==null&&mn(i,t,67108864),Hf(t,67108864)}}function yy(t){if(t.tag===13||t.tag===31){var i=En();i=xr(i);var s=Bi(t,i);s!==null&&mn(s,t,i),Hf(t,i)}}var Fo=!0;function hw(t,i,s,o){var h=H.T;H.T=null;var p=ie.p;try{ie.p=2,If(t,i,s,o)}finally{ie.p=p,H.T=h}}function dw(t,i,s,o){var h=H.T;H.T=null;var p=ie.p;try{ie.p=8,If(t,i,s,o)}finally{ie.p=p,H.T=h}}function If(t,i,s,o){if(Fo){var h=Ff(o);if(h===null)Tf(t,i,o,$o,s),vy(t,o);else if(pw(h,t,i,s,o))o.stopPropagation();else if(vy(t,o),i&4&&-1<mw.indexOf(t)){for(;h!==null;){var p=T(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var v=Qn(p.pendingLanes);if(v!==0){var S=p;for(S.pendingLanes|=2,S.entangledLanes|=2;v;){var P=1<<31-ot(v);S.entanglements[1]|=P,v&=~P}cr(p),(lt&6)===0&&(Ao=vt()+500,Gs(0))}}break;case 31:case 13:S=Bi(p,2),S!==null&&mn(S,p,2),To(),Hf(p,2)}if(p=Ff(o),p===null&&Tf(t,i,o,$o,s),p===h)break;h=p}h!==null&&o.stopPropagation()}else Tf(t,i,o,null,s)}}function Ff(t){return t=$u(t),$f(t)}var $o=null;function $f(t){if($o=null,t=E(t),t!==null){var i=u(t);if(i===null)t=null;else{var s=i.tag;if(s===13){if(t=c(i),t!==null)return t;t=null}else if(s===31){if(t=f(i),t!==null)return t;t=null}else if(s===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;t=null}else i!==t&&(t=null)}}return $o=t,null}function by(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(cs()){case oe:return 2;case _e:return 8;case Pe:case Ve:return 32;case it:return 268435456;default:return 32}default:return 32}}var Gf=!1,gi=null,yi=null,bi=null,Zs=new Map,Ws=new Map,vi=[],mw="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 vy(t,i){switch(t){case"focusin":case"focusout":gi=null;break;case"dragenter":case"dragleave":yi=null;break;case"mouseover":case"mouseout":bi=null;break;case"pointerover":case"pointerout":Zs.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ws.delete(i.pointerId)}}function el(t,i,s,o,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:i,domEventName:s,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=T(i),i!==null&&gy(i)),t):(t.eventSystemFlags|=o,i=t.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),t)}function pw(t,i,s,o,h){switch(i){case"focusin":return gi=el(gi,t,i,s,o,h),!0;case"dragenter":return yi=el(yi,t,i,s,o,h),!0;case"mouseover":return bi=el(bi,t,i,s,o,h),!0;case"pointerover":var p=h.pointerId;return Zs.set(p,el(Zs.get(p)||null,t,i,s,o,h)),!0;case"gotpointercapture":return p=h.pointerId,Ws.set(p,el(Ws.get(p)||null,t,i,s,o,h)),!0}return!1}function xy(t){var i=E(t.target);if(i!==null){var s=u(i);if(s!==null){if(i=s.tag,i===13){if(i=c(s),i!==null){t.blockedOn=i,Ll(t.priority,function(){yy(s)});return}}else if(i===31){if(i=f(s),i!==null){t.blockedOn=i,Ll(t.priority,function(){yy(s)});return}}else if(i===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Go(t){if(t.blockedOn!==null)return!1;for(var i=t.targetContainers;0<i.length;){var s=Ff(t.nativeEvent);if(s===null){s=t.nativeEvent;var o=new s.constructor(s.type,s);Fu=o,s.target.dispatchEvent(o),Fu=null}else return i=T(s),i!==null&&gy(i),t.blockedOn=s,!1;i.shift()}return!0}function wy(t,i,s){Go(t)&&s.delete(i)}function gw(){Gf=!1,gi!==null&&Go(gi)&&(gi=null),yi!==null&&Go(yi)&&(yi=null),bi!==null&&Go(bi)&&(bi=null),Zs.forEach(wy),Ws.forEach(wy)}function Yo(t,i){t.blockedOn===i&&(t.blockedOn=null,Gf||(Gf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,gw)))}var Vo=null;function Sy(t){Vo!==t&&(Vo=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Vo===t&&(Vo=null);for(var i=0;i<t.length;i+=3){var s=t[i],o=t[i+1],h=t[i+2];if(typeof o!="function"){if($f(o||s)===null)continue;break}var p=T(s);p!==null&&(t.splice(i,3),i-=3,Ic(p,{pending:!0,data:h,method:s.method,action:o},o,h))}}))}function Pa(t){function i(P){return Yo(P,t)}gi!==null&&Yo(gi,t),yi!==null&&Yo(yi,t),bi!==null&&Yo(bi,t),Zs.forEach(i),Ws.forEach(i);for(var s=0;s<vi.length;s++){var o=vi[s];o.blockedOn===t&&(o.blockedOn=null)}for(;0<vi.length&&(s=vi[0],s.blockedOn===null);)xy(s),s.blockedOn===null&&vi.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(o=0;o<s.length;o+=3){var h=s[o],p=s[o+1],v=h[Ot]||null;if(typeof p=="function")v||Sy(s);else if(v){var S=null;if(p&&p.hasAttribute("formAction")){if(h=p,v=p[Ot]||null)S=v.formAction;else if($f(h)!==null)continue}else S=v.action;typeof S=="function"?s[o+1]=S:(s.splice(o,3),o-=3),Sy(s)}}}function _y(){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(s,20)}function s(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(s,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function Yf(t){this._internalRoot=t}Jo.prototype.render=Yf.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(a(409));var s=i.current,o=En();my(s,o,t,i,null,null)},Jo.prototype.unmount=Yf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;my(t.current,2,null,t,null,null),To(),i[yn]=null}};function Jo(t){this._internalRoot=t}Jo.prototype.unstable_scheduleHydration=function(t){if(t){var i=hs();t={blockedOn:null,target:t,priority:i};for(var s=0;s<vi.length&&i!==0&&i<vi[s].priority;s++);vi.splice(s,0,t),s===0&&xy(t)}};var Ey=n.version;if(Ey!=="19.2.4")throw Error(a(527,Ey,"19.2.4"));ie.findDOMNode=function(t){var i=t._reactInternals;if(i===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=d(i),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var yw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xo.isDisabled&&Xo.supportsFiber)try{Yt=Xo.inject(yw),pt=Xo}catch{}}return nl.createRoot=function(t,i){if(!l(t))throw Error(a(299));var s=!1,o="",h=Np,p=Rp,v=Mp;return i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(v=i.onRecoverableError)),i=hy(t,1,!1,null,null,s,o,null,h,p,v,_y),t[yn]=i.current,Cf(t),new Yf(i)},nl.hydrateRoot=function(t,i,s){if(!l(t))throw Error(a(299));var o=!1,h="",p=Np,v=Rp,S=Mp,P=null;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(h=s.identifierPrefix),s.onUncaughtError!==void 0&&(p=s.onUncaughtError),s.onCaughtError!==void 0&&(v=s.onCaughtError),s.onRecoverableError!==void 0&&(S=s.onRecoverableError),s.formState!==void 0&&(P=s.formState)),i=hy(t,1,!0,i,s??null,o,h,P,p,v,S,_y),i.context=dy(null),s=i.current,o=En(),o=xr(o),h=ii(o),h.callback=null,ai(s,h,o),s=o,i.current.lanes=s,Kn(i,s),cr(i),t[yn]=i.current,Cf(t),new Jo(i)},nl.version="19.2.4",nl}var Dy;function Tw(){if(Dy)return Xf.exports;Dy=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(),Xf.exports=Cw(),Xf.exports}var Ow=Tw();/**
50
50
  * react-router v7.13.1
51
51
  *
52
52
  * Copyright (c) Remix Software Inc.
@@ -55,22 +55,22 @@ Error generating stack: `+o.message+`
55
55
  * LICENSE.md file in the root directory of this source tree.
56
56
  *
57
57
  * @license MIT
58
- */var Uy="popstate";function By(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Ow(e={}){function n(a,l){var d;let u=(d=l.state)==null?void 0:d.masked,{pathname:c,search:f,hash:m}=u||a.location;return jh("",{pathname:c,search:f,hash:m},l.state&&l.state.usr||null,l.state&&l.state.key||"default",u?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,l){return typeof l=="string"?l:xl(l)}return Rw(n,r,null,e)}function Tt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function gr(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function Nw(){return Math.random().toString(36).substring(2,10)}function Py(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function jh(e,n,r=null,a,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?is(n):n,state:r,key:n&&n.key||a||Nw(),unstable_mask:l}}function xl({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 is(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(n.search=e.substring(a),e=e.substring(0,a)),e&&(n.pathname=e)}return n}function Rw(e,n,r,a={}){let{window:l=document.defaultView,v5Compat:u=!1}=a,c=l.history,f="POP",m=null,d=y();d==null&&(d=0,c.replaceState({...c.state,idx:d},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let B=y(),D=B==null?null:B-d;d=B,m&&m({action:f,location:L.location,delta:D})}function b(B,D){f="PUSH";let $=By(B)?B:jh(L.location,B,D);d=y()+1;let V=Py($,d),se=L.createHref($.unstable_mask||$);try{c.pushState(V,"",se)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;l.location.assign(se)}u&&m&&m({action:f,location:L.location,delta:1})}function x(B,D){f="REPLACE";let $=By(B)?B:jh(L.location,B,D);d=y();let V=Py($,d),se=L.createHref($.unstable_mask||$);c.replaceState(V,"",se),u&&m&&m({action:f,location:L.location,delta:0})}function k(B){return Mw(B)}let L={get action(){return f},get location(){return e(l,c)},listen(B){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(Uy,g),m=B,()=>{l.removeEventListener(Uy,g),m=null}},createHref(B){return n(l,B)},createURL:k,encodeLocation(B){let D=k(B);return{pathname:D.pathname,search:D.search,hash:D.hash}},push:b,replace:x,go(B){return c.go(B)}};return L}function Mw(e,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Tt(r,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:xl(e);return a=a.replace(/ $/,"%20"),!n&&a.startsWith("//")&&(a=r+a),new URL(a,r)}function gb(e,n,r="/"){return Dw(e,n,r,!1)}function Dw(e,n,r,a){let l=typeof n=="string"?is(n):n,u=$r(l.pathname||"/",r);if(u==null)return null;let c=yb(e);zw(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let d=Yw(u);f=$w(c[m],d,a)}return f}function yb(e,n=[],r=[],a="",l=!1){let u=(c,f,m=l,d)=>{let y={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(a)&&m)return;Tt(y.relativePath.startsWith(a),`Absolute route path "${y.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(a.length)}let g=pr([a,y.relativePath]),b=r.concat(y);c.children&&c.children.length>0&&(Tt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),yb(c.children,n,b,g,m)),!(c.path==null&&!c.index)&&n.push({path:g,score:Iw(g,c.index),routesMeta:b})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))u(c,f);else for(let d of bb(c.path))u(c,f,!0,d)}),n}function bb(e){let n=e.split("/");if(n.length===0)return[];let[r,...a]=n,l=r.endsWith("?"),u=r.replace(/\?$/,"");if(a.length===0)return l?[u,""]:[u];let c=bb(a.join("/")),f=[];return f.push(...c.map(m=>m===""?u:[u,m].join("/"))),l&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function zw(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:Fw(n.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Lw=/^:[\w-]+$/,Uw=3,Bw=2,Pw=1,qw=10,Hw=-2,qy=e=>e==="*";function Iw(e,n){let r=e.split("/"),a=r.length;return r.some(qy)&&(a+=Hw),n&&(a+=Bw),r.filter(l=>!qy(l)).reduce((l,u)=>l+(Lw.test(u)?Uw:u===""?Pw:qw),a)}function Fw(e,n){return e.length===n.length&&e.slice(0,-1).every((a,l)=>a===n[l])?e[e.length-1]-n[n.length-1]:0}function $w(e,n,r=!1){let{routesMeta:a}=e,l={},u="/",c=[];for(let f=0;f<a.length;++f){let m=a[f],d=f===a.length-1,y=u==="/"?n:n.slice(u.length)||"/",g=hu({path:m.relativePath,caseSensitive:m.caseSensitive,end:d},y),b=m.route;if(!g&&d&&r&&!a[a.length-1].route.index&&(g=hu({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:pr([u,g.pathname]),pathnameBase:Qw(pr([u,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(u=pr([u,g.pathnameBase]))}return c}function hu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Gw(e.path,e.caseSensitive,e.end),l=n.match(r);if(!l)return null;let u=l[0],c=u.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:a.reduce((d,{paramName:y,isOptional:g},b)=>{if(y==="*"){let k=f[b]||"";c=u.slice(0,u.length-k.length).replace(/(.)\/+$/,"$1")}const x=f[b];return g&&!x?d[y]=void 0:d[y]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:u,pathnameBase:c,pattern:e}}function Gw(e,n=!1,r=!0){gr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,d,y)=>{if(a.push({paramName:f,isOptional:m!=null}),m){let g=y.charAt(d+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,n?void 0:"i"),a]}function Yw(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return gr(!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 $r(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}var Vw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Jw(e,n="/"){let{pathname:r,search:a="",hash:l=""}=typeof e=="string"?is(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=Hy(r.substring(1),"/"):u=Hy(r,n)):u=n,{pathname:u,search:Kw(a),hash:Zw(l)}}function Hy(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 Wf(e,n,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Xw(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function vb(e){let n=Xw(e);return n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase)}function ld(e,n,r,a=!1){let l;typeof e=="string"?l=is(e):(l={...e},Tt(!l.pathname||!l.pathname.includes("?"),Wf("?","pathname","search",l)),Tt(!l.pathname||!l.pathname.includes("#"),Wf("#","pathname","hash",l)),Tt(!l.search||!l.search.includes("#"),Wf("#","search","hash",l)));let u=e===""||l.pathname==="",c=u?"/":l.pathname,f;if(c==null)f=r;else{let g=n.length-1;if(!a&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),g-=1;l.pathname=b.join("/")}f=g>=0?n[g]:"/"}let m=Jw(l,f),d=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(d||y)&&(m.pathname+="/"),m}var pr=e=>e.join("/").replace(/\/\/+/g,"/"),Qw=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Kw=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Zw=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Ww=class{constructor(e,n,r,a=!1){this.status=e,this.statusText=n||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function eS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function tS(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var xb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wb(e,n){let r=e;if(typeof r!="string"||!Vw.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,l=!1;if(xb)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=$r(c.pathname,n);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{gr(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:l,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Sb=["POST","PUT","PATCH","DELETE"];new Set(Sb);var nS=["GET",...Sb];new Set(nS);var as=U.createContext(null);as.displayName="DataRouter";var Tu=U.createContext(null);Tu.displayName="DataRouterState";var rS=U.createContext(!1),_b=U.createContext({isTransitioning:!1});_b.displayName="ViewTransition";var iS=U.createContext(new Map);iS.displayName="Fetchers";var aS=U.createContext(null);aS.displayName="Await";var Qn=U.createContext(null);Qn.displayName="Navigation";var Cl=U.createContext(null);Cl.displayName="Location";var yr=U.createContext({outlet:null,matches:[],isDataRoute:!1});yr.displayName="Route";var od=U.createContext(null);od.displayName="RouteError";var Eb="REACT_ROUTER_ERROR",sS="REDIRECT",lS="ROUTE_ERROR_RESPONSE";function oS(e){if(e.startsWith(`${Eb}:${sS}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function uS(e){if(e.startsWith(`${Eb}:${lS}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new Ww(n.status,n.statusText,n.data)}catch{}}function cS(e,{relative:n}={}){Tt(Tl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=U.useContext(Qn),{hash:l,pathname:u,search:c}=jl(e,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:pr([r,u])),a.createHref({pathname:f,search:c,hash:l})}function Tl(){return U.useContext(Cl)!=null}function br(){return Tt(Tl(),"useLocation() may be used only in the context of a <Router> component."),U.useContext(Cl).location}var kb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ab(e){U.useContext(Qn).static||U.useLayoutEffect(e)}function ta(){let{isDataRoute:e}=U.useContext(yr);return e?ES():fS()}function fS(){Tt(Tl(),"useNavigate() may be used only in the context of a <Router> component.");let e=U.useContext(as),{basename:n,navigator:r}=U.useContext(Qn),{matches:a}=U.useContext(yr),{pathname:l}=br(),u=JSON.stringify(vb(a)),c=U.useRef(!1);return Ab(()=>{c.current=!0}),U.useCallback((m,d={})=>{if(gr(c.current,kb),!c.current)return;if(typeof m=="number"){r.go(m);return}let y=ld(m,JSON.parse(u),l,d.relative==="path");e==null&&n!=="/"&&(y.pathname=y.pathname==="/"?n:pr([n,y.pathname])),(d.replace?r.replace:r.push)(y,d.state,d)},[n,r,u,l,e])}U.createContext(null);function hS(){let{matches:e}=U.useContext(yr),n=e[e.length-1];return n?n.params:{}}function jl(e,{relative:n}={}){let{matches:r}=U.useContext(yr),{pathname:a}=br(),l=JSON.stringify(vb(r));return U.useMemo(()=>ld(e,JSON.parse(l),a,n==="path"),[e,l,a,n])}function dS(e,n){return Cb(e,n)}function Cb(e,n,r){var B;Tt(Tl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=U.useContext(Qn),{matches:l}=U.useContext(yr),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",d=u&&u.route;{let D=d&&d.path||"";jb(f,!d||D.endsWith("*")||D.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${D}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
58
+ */var zy="popstate";function Ly(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function jw(e={}){function n(a,l){var d;let u=(d=l.state)==null?void 0:d.masked,{pathname:c,search:f,hash:m}=u||a.location;return Oh("",{pathname:c,search:f,hash:m},l.state&&l.state.usr||null,l.state&&l.state.key||"default",u?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,l){return typeof l=="string"?l:xl(l)}return Rw(n,r,null,e)}function Ct(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function pr(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function Nw(){return Math.random().toString(36).substring(2,10)}function Uy(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 Oh(e,n,r=null,a,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?is(n):n,state:r,key:n&&n.key||a||Nw(),unstable_mask:l}}function xl({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 is(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(n.search=e.substring(a),e=e.substring(0,a)),e&&(n.pathname=e)}return n}function Rw(e,n,r,a={}){let{window:l=document.defaultView,v5Compat:u=!1}=a,c=l.history,f="POP",m=null,d=y();d==null&&(d=0,c.replaceState({...c.state,idx:d},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let B=y(),D=B==null?null:B-d;d=B,m&&m({action:f,location:L.location,delta:D})}function b(B,D){f="PUSH";let F=Ly(B)?B:Oh(L.location,B,D);d=y()+1;let G=Uy(F,d),se=L.createHref(F.unstable_mask||F);try{c.pushState(G,"",se)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;l.location.assign(se)}u&&m&&m({action:f,location:L.location,delta:1})}function x(B,D){f="REPLACE";let F=Ly(B)?B:Oh(L.location,B,D);d=y();let G=Uy(F,d),se=L.createHref(F.unstable_mask||F);c.replaceState(G,"",se),u&&m&&m({action:f,location:L.location,delta:0})}function k(B){return Mw(B)}let L={get action(){return f},get location(){return e(l,c)},listen(B){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(zy,g),m=B,()=>{l.removeEventListener(zy,g),m=null}},createHref(B){return n(l,B)},createURL:k,encodeLocation(B){let D=k(B);return{pathname:D.pathname,search:D.search,hash:D.hash}},push:b,replace:x,go(B){return c.go(B)}};return L}function Mw(e,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Ct(r,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:xl(e);return a=a.replace(/ $/,"%20"),!n&&a.startsWith("//")&&(a=r+a),new URL(a,r)}function gb(e,n,r="/"){return Dw(e,n,r,!1)}function Dw(e,n,r,a){let l=typeof n=="string"?is(n):n,u=Hr(l.pathname||"/",r);if(u==null)return null;let c=yb(e);zw(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let d=Yw(u);f=$w(c[m],d,a)}return f}function yb(e,n=[],r=[],a="",l=!1){let u=(c,f,m=l,d)=>{let y={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(a)&&m)return;Ct(y.relativePath.startsWith(a),`Absolute route path "${y.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(a.length)}let g=mr([a,y.relativePath]),b=r.concat(y);c.children&&c.children.length>0&&(Ct(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),yb(c.children,n,b,g,m)),!(c.path==null&&!c.index)&&n.push({path:g,score:Iw(g,c.index),routesMeta:b})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))u(c,f);else for(let d of bb(c.path))u(c,f,!0,d)}),n}function bb(e){let n=e.split("/");if(n.length===0)return[];let[r,...a]=n,l=r.endsWith("?"),u=r.replace(/\?$/,"");if(a.length===0)return l?[u,""]:[u];let c=bb(a.join("/")),f=[];return f.push(...c.map(m=>m===""?u:[u,m].join("/"))),l&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function zw(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:Fw(n.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Lw=/^:[\w-]+$/,Uw=3,Bw=2,Pw=1,qw=10,Hw=-2,By=e=>e==="*";function Iw(e,n){let r=e.split("/"),a=r.length;return r.some(By)&&(a+=Hw),n&&(a+=Bw),r.filter(l=>!By(l)).reduce((l,u)=>l+(Lw.test(u)?Uw:u===""?Pw:qw),a)}function Fw(e,n){return e.length===n.length&&e.slice(0,-1).every((a,l)=>a===n[l])?e[e.length-1]-n[n.length-1]:0}function $w(e,n,r=!1){let{routesMeta:a}=e,l={},u="/",c=[];for(let f=0;f<a.length;++f){let m=a[f],d=f===a.length-1,y=u==="/"?n:n.slice(u.length)||"/",g=hu({path:m.relativePath,caseSensitive:m.caseSensitive,end:d},y),b=m.route;if(!g&&d&&r&&!a[a.length-1].route.index&&(g=hu({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:mr([u,g.pathname]),pathnameBase:Qw(mr([u,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(u=mr([u,g.pathnameBase]))}return c}function hu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Gw(e.path,e.caseSensitive,e.end),l=n.match(r);if(!l)return null;let u=l[0],c=u.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:a.reduce((d,{paramName:y,isOptional:g},b)=>{if(y==="*"){let k=f[b]||"";c=u.slice(0,u.length-k.length).replace(/(.)\/+$/,"$1")}const x=f[b];return g&&!x?d[y]=void 0:d[y]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:u,pathnameBase:c,pattern:e}}function Gw(e,n=!1,r=!0){pr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,d,y)=>{if(a.push({paramName:f,isOptional:m!=null}),m){let g=y.charAt(d+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,n?void 0:"i"),a]}function Yw(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return pr(!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 Hr(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}var Vw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Jw(e,n="/"){let{pathname:r,search:a="",hash:l=""}=typeof e=="string"?is(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=Py(r.substring(1),"/"):u=Py(r,n)):u=n,{pathname:u,search:Kw(a),hash:Zw(l)}}function Py(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 Wf(e,n,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Xw(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function vb(e){let n=Xw(e);return n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase)}function ad(e,n,r,a=!1){let l;typeof e=="string"?l=is(e):(l={...e},Ct(!l.pathname||!l.pathname.includes("?"),Wf("?","pathname","search",l)),Ct(!l.pathname||!l.pathname.includes("#"),Wf("#","pathname","hash",l)),Ct(!l.search||!l.search.includes("#"),Wf("#","search","hash",l)));let u=e===""||l.pathname==="",c=u?"/":l.pathname,f;if(c==null)f=r;else{let g=n.length-1;if(!a&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),g-=1;l.pathname=b.join("/")}f=g>=0?n[g]:"/"}let m=Jw(l,f),d=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(d||y)&&(m.pathname+="/"),m}var mr=e=>e.join("/").replace(/\/\/+/g,"/"),Qw=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Kw=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Zw=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Ww=class{constructor(e,n,r,a=!1){this.status=e,this.statusText=n||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function eS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function tS(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var xb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wb(e,n){let r=e;if(typeof r!="string"||!Vw.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,l=!1;if(xb)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=Hr(c.pathname,n);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{pr(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:l,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Sb=["POST","PUT","PATCH","DELETE"];new Set(Sb);var nS=["GET",...Sb];new Set(nS);var as=U.createContext(null);as.displayName="DataRouter";var Tu=U.createContext(null);Tu.displayName="DataRouterState";var rS=U.createContext(!1),_b=U.createContext({isTransitioning:!1});_b.displayName="ViewTransition";var iS=U.createContext(new Map);iS.displayName="Fetchers";var aS=U.createContext(null);aS.displayName="Await";var Jn=U.createContext(null);Jn.displayName="Navigation";var Cl=U.createContext(null);Cl.displayName="Location";var gr=U.createContext({outlet:null,matches:[],isDataRoute:!1});gr.displayName="Route";var sd=U.createContext(null);sd.displayName="RouteError";var Eb="REACT_ROUTER_ERROR",sS="REDIRECT",lS="ROUTE_ERROR_RESPONSE";function oS(e){if(e.startsWith(`${Eb}:${sS}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function uS(e){if(e.startsWith(`${Eb}:${lS}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new Ww(n.status,n.statusText,n.data)}catch{}}function cS(e,{relative:n}={}){Ct(Tl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=U.useContext(Jn),{hash:l,pathname:u,search:c}=Ol(e,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:mr([r,u])),a.createHref({pathname:f,search:c,hash:l})}function Tl(){return U.useContext(Cl)!=null}function yr(){return Ct(Tl(),"useLocation() may be used only in the context of a <Router> component."),U.useContext(Cl).location}var kb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ab(e){U.useContext(Jn).static||U.useLayoutEffect(e)}function ea(){let{isDataRoute:e}=U.useContext(gr);return e?ES():fS()}function fS(){Ct(Tl(),"useNavigate() may be used only in the context of a <Router> component.");let e=U.useContext(as),{basename:n,navigator:r}=U.useContext(Jn),{matches:a}=U.useContext(gr),{pathname:l}=yr(),u=JSON.stringify(vb(a)),c=U.useRef(!1);return Ab(()=>{c.current=!0}),U.useCallback((m,d={})=>{if(pr(c.current,kb),!c.current)return;if(typeof m=="number"){r.go(m);return}let y=ad(m,JSON.parse(u),l,d.relative==="path");e==null&&n!=="/"&&(y.pathname=y.pathname==="/"?n:mr([n,y.pathname])),(d.replace?r.replace:r.push)(y,d.state,d)},[n,r,u,l,e])}U.createContext(null);function hS(){let{matches:e}=U.useContext(gr),n=e[e.length-1];return n?n.params:{}}function Ol(e,{relative:n}={}){let{matches:r}=U.useContext(gr),{pathname:a}=yr(),l=JSON.stringify(vb(r));return U.useMemo(()=>ad(e,JSON.parse(l),a,n==="path"),[e,l,a,n])}function dS(e,n){return Cb(e,n)}function Cb(e,n,r){var B;Ct(Tl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=U.useContext(Jn),{matches:l}=U.useContext(gr),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",d=u&&u.route;{let D=d&&d.path||"";Ob(f,!d||D.endsWith("*")||D.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${D}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
59
 
60
- Please change the parent <Route path="${D}"> to <Route path="${D==="/"?"*":`${D}/*`}">.`)}let y=br(),g;if(n){let D=typeof n=="string"?is(n):n;Tt(m==="/"||((B=D.pathname)==null?void 0:B.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 "${D.pathname}" was given in the \`location\` prop.`),g=D}else g=y;let b=g.pathname||"/",x=b;if(m!=="/"){let D=m.replace(/^\//,"").split("/");x="/"+b.replace(/^\//,"").split("/").slice(D.length).join("/")}let k=gb(e,{pathname:x});gr(d||k!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),gr(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let L=bS(k&&k.map(D=>Object.assign({},D,{params:Object.assign({},c,D.params),pathname:pr([m,a.encodeLocation?a.encodeLocation(D.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:D.pathname]),pathnameBase:D.pathnameBase==="/"?m:pr([m,a.encodeLocation?a.encodeLocation(D.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:D.pathnameBase])})),l,r);return n&&L?U.createElement(Cl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},L):L}function mS(){let e=_S(),n=eS(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:a},u={padding:"2px 4px",backgroundColor:a},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=U.createElement(U.Fragment,null,U.createElement("p",null,"💿 Hey developer 👋"),U.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",U.createElement("code",{style:u},"ErrorBoundary")," or"," ",U.createElement("code",{style:u},"errorElement")," prop on your route.")),U.createElement(U.Fragment,null,U.createElement("h2",null,"Unexpected Application Error!"),U.createElement("h3",{style:{fontStyle:"italic"}},n),r?U.createElement("pre",{style:l},r):null,c)}var pS=U.createElement(mS,null),Tb=class extends U.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=uS(e.digest);r&&(e=r)}let n=e!==void 0?U.createElement(yr.Provider,{value:this.props.routeContext},U.createElement(od.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?U.createElement(gS,{error:e},n):n}};Tb.contextType=rS;var eh=new WeakMap;function gS({children:e,error:n}){let{basename:r}=U.useContext(Qn);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let a=oS(n.digest);if(a){let l=eh.get(n);if(l)throw l;let u=wb(a.location,r);if(xb&&!eh.get(n))if(u.isExternal||a.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:a.replace}));throw eh.set(n,c),c}return U.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function yS({routeContext:e,match:n,children:r}){let a=U.useContext(as);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),U.createElement(yr.Provider,{value:e},r)}function bS(e,n=[],r){let a=r==null?void 0:r.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(n.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let l=e,u=a==null?void 0:a.errors;if(u!=null){let y=l.findIndex(g=>g.route.id&&(u==null?void 0:u[g.route.id])!==void 0);Tt(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),l=l.slice(0,Math.min(l.length,y+1))}let c=!1,f=-1;if(r&&a){c=a.renderFallback;for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=y),g.route.id){let{loaderData:b,errors:x}=a,k=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!x||x[g.route.id]===void 0);if(g.route.lazy||k){r.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let m=r==null?void 0:r.onError,d=a&&m?(y,g)=>{var b,x;m(y,{location:a.location,params:((x=(b=a.matches)==null?void 0:b[0])==null?void 0:x.params)??{},unstable_pattern:tS(a.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,b)=>{let x,k=!1,L=null,B=null;a&&(x=u&&g.route.id?u[g.route.id]:void 0,L=g.route.errorElement||pS,c&&(f<0&&b===0?(jb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,B=null):f===b&&(k=!0,B=g.route.hydrateFallbackElement||null)));let D=n.concat(l.slice(0,b+1)),$=()=>{let V;return x?V=L:k?V=B:g.route.Component?V=U.createElement(g.route.Component,null):g.route.element?V=g.route.element:V=y,U.createElement(yS,{match:g,routeContext:{outlet:y,matches:D,isDataRoute:a!=null},children:V})};return a&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?U.createElement(Tb,{location:a.location,revalidation:a.revalidation,component:L,error:x,children:$(),routeContext:{outlet:null,matches:D,isDataRoute:!0},onError:d}):$()},null)}function ud(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vS(e){let n=U.useContext(as);return Tt(n,ud(e)),n}function xS(e){let n=U.useContext(Tu);return Tt(n,ud(e)),n}function wS(e){let n=U.useContext(yr);return Tt(n,ud(e)),n}function cd(e){let n=wS(e),r=n.matches[n.matches.length-1];return Tt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function SS(){return cd("useRouteId")}function _S(){var a;let e=U.useContext(od),n=xS("useRouteError"),r=cd("useRouteError");return e!==void 0?e:(a=n.errors)==null?void 0:a[r]}function ES(){let{router:e}=vS("useNavigate"),n=cd("useNavigate"),r=U.useRef(!1);return Ab(()=>{r.current=!0}),U.useCallback(async(l,u={})=>{gr(r.current,kb),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...u}))},[e,n])}var Iy={};function jb(e,n,r){!n&&!Iy[e]&&(Iy[e]=!0,gr(!1,r))}U.memo(kS);function kS({routes:e,future:n,state:r,isStatic:a,onError:l}){return Cb(e,void 0,{state:r,isStatic:a,onError:l})}function Fa(e){Tt(!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 AS({basename:e="/",children:n=null,location:r,navigationType:a="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Tt(!Tl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=U.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=is(r));let{pathname:d="/",search:y="",hash:g="",state:b=null,key:x="default",unstable_mask:k}=r,L=U.useMemo(()=>{let B=$r(d,f);return B==null?null:{location:{pathname:B,search:y,hash:g,state:b,key:x,unstable_mask:k},navigationType:a}},[f,d,y,g,b,x,a,k]);return gr(L!=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.`),L==null?null:U.createElement(Qn.Provider,{value:m},U.createElement(Cl.Provider,{children:n,value:L}))}function CS({children:e,location:n}){return dS(Oh(e),n)}function Oh(e,n=[]){let r=[];return U.Children.forEach(e,(a,l)=>{if(!U.isValidElement(a))return;let u=[...n,l];if(a.type===U.Fragment){r.push.apply(r,Oh(a.props.children,u));return}Tt(a.type===Fa,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Tt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let c={id:a.props.id||u.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(c.children=Oh(a.props.children,u)),r.push(c)}),r}var lu="get",ou="application/x-www-form-urlencoded";function ju(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function TS(e){return ju(e)&&e.tagName.toLowerCase()==="button"}function jS(e){return ju(e)&&e.tagName.toLowerCase()==="form"}function OS(e){return ju(e)&&e.tagName.toLowerCase()==="input"}function NS(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function RS(e,n){return e.button===0&&(!n||n==="_self")&&!NS(e)}var Qo=null;function MS(){if(Qo===null)try{new FormData(document.createElement("form"),0),Qo=!1}catch{Qo=!0}return Qo}var DS=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function th(e){return e!=null&&!DS.has(e)?(gr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ou}"`),null):e}function zS(e,n){let r,a,l,u,c;if(jS(e)){let f=e.getAttribute("action");a=f?$r(f,n):null,r=e.getAttribute("method")||lu,l=th(e.getAttribute("enctype"))||ou,u=new FormData(e)}else if(TS(e)||OS(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(a=m?$r(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||lu,l=th(e.getAttribute("formenctype"))||th(f.getAttribute("enctype"))||ou,u=new FormData(f,e),!MS()){let{name:d,type:y,value:g}=e;if(y==="image"){let b=d?`${d}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else d&&u.append(d,g)}}else{if(ju(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=lu,a=null,l=ou,c=e}return u&&l==="text/plain"&&(c=u,u=void 0),{action:a,method:r.toLowerCase(),encType:l,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function fd(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function LS(e,n,r,a){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${a}`:l.pathname=`${l.pathname}.${a}`:l.pathname==="/"?l.pathname=`_root.${a}`:n&&$r(l.pathname,n)==="/"?l.pathname=`${n.replace(/\/$/,"")}/_root.${a}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${a}`,l}async function US(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 BS(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 PS(e,n,r){let a=await Promise.all(e.map(async l=>{let u=n.routes[l.route.id];if(u){let c=await US(u,r);return c.links?c.links():[]}return[]}));return FS(a.flat(1).filter(BS).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function Fy(e,n,r,a,l,u){let c=(m,d)=>r[d]?m.route.id!==r[d].route.id:!0,f=(m,d)=>{var y;return r[d].pathname!==m.pathname||((y=r[d].route.path)==null?void 0:y.endsWith("*"))&&r[d].params["*"]!==m.params["*"]};return u==="assets"?n.filter((m,d)=>c(m,d)||f(m,d)):u==="data"?n.filter((m,d)=>{var g;let y=a.routes[m.route.id];if(!y||!y.hasLoader)return!1;if(c(m,d)||f(m,d))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function qS(e,n,{includeHydrateFallback:r}={}){return HS(e.map(a=>{let l=n.routes[a.route.id];if(!l)return[];let u=[l.module];return l.clientActionModule&&(u=u.concat(l.clientActionModule)),l.clientLoaderModule&&(u=u.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(u=u.concat(l.hydrateFallbackModule)),l.imports&&(u=u.concat(l.imports)),u}).flat(1))}function HS(e){return[...new Set(e)]}function IS(e){let n={},r=Object.keys(e).sort();for(let a of r)n[a]=e[a];return n}function FS(e,n){let r=new Set;return new Set(n),e.reduce((a,l)=>{let u=JSON.stringify(IS(l));return r.has(u)||(r.add(u),a.push({key:u,link:l})),a},[])}function Ob(){let e=U.useContext(as);return fd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function $S(){let e=U.useContext(Tu);return fd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var hd=U.createContext(void 0);hd.displayName="FrameworkContext";function Nb(){let e=U.useContext(hd);return fd(e,"You must render this element inside a <HydratedRouter> element"),e}function GS(e,n){let r=U.useContext(hd),[a,l]=U.useState(!1),[u,c]=U.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:y,onTouchStart:g}=n,b=U.useRef(null);U.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let L=D=>{D.forEach($=>{c($.isIntersecting)})},B=new IntersectionObserver(L,{threshold:.5});return b.current&&B.observe(b.current),()=>{B.disconnect()}}},[e]),U.useEffect(()=>{if(a){let L=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(L)}}},[a]);let x=()=>{l(!0)},k=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,b,{}]:[u,b,{onFocus:rl(f,x),onBlur:rl(m,k),onMouseEnter:rl(d,x),onMouseLeave:rl(y,k),onTouchStart:rl(g,x)}]:[!1,b,{}]}function rl(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function YS({page:e,...n}){let{router:r}=Ob(),a=U.useMemo(()=>gb(r.routes,e,r.basename),[r.routes,e,r.basename]);return a?U.createElement(JS,{page:e,matches:a,...n}):null}function VS(e){let{manifest:n,routeModules:r}=Nb(),[a,l]=U.useState([]);return U.useEffect(()=>{let u=!1;return PS(e,n,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,n,r]),a}function JS({page:e,matches:n,...r}){let a=br(),{future:l,manifest:u,routeModules:c}=Nb(),{basename:f}=Ob(),{loaderData:m,matches:d}=$S(),y=U.useMemo(()=>Fy(e,n,d,u,a,"data"),[e,n,d,u,a]),g=U.useMemo(()=>Fy(e,n,d,u,a,"assets"),[e,n,d,u,a]),b=U.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let L=new Set,B=!1;if(n.forEach($=>{var se;let V=u.routes[$.route.id];!V||!V.hasLoader||(!y.some(N=>N.route.id===$.route.id)&&$.route.id in m&&((se=c[$.route.id])!=null&&se.shouldRevalidate)||V.hasClientLoader?B=!0:L.add($.route.id))}),L.size===0)return[];let D=LS(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return B&&L.size>0&&D.searchParams.set("_routes",n.filter($=>L.has($.route.id)).map($=>$.route.id).join(",")),[D.pathname+D.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,a,u,y,n,e,c]),x=U.useMemo(()=>qS(g,u),[g,u]),k=VS(g);return U.createElement(U.Fragment,null,b.map(L=>U.createElement("link",{key:L,rel:"prefetch",as:"fetch",href:L,...r})),x.map(L=>U.createElement("link",{key:L,rel:"modulepreload",href:L,...r})),k.map(({key:L,link:B})=>U.createElement("link",{key:L,nonce:r.nonce,...B,crossOrigin:B.crossOrigin??r.crossOrigin})))}function XS(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var QS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{QS&&(window.__reactRouterVersion="7.13.1")}catch{}function KS({basename:e,children:n,unstable_useTransitions:r,window:a}){let l=U.useRef();l.current==null&&(l.current=Ow({window:a,v5Compat:!0}));let u=l.current,[c,f]=U.useState({action:u.action,location:u.location}),m=U.useCallback(d=>{r===!1?f(d):U.startTransition(()=>f(d))},[r]);return U.useLayoutEffect(()=>u.listen(m),[u,m]),U.createElement(AS,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var Rb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Mb=U.forwardRef(function({onClick:n,discover:r="render",prefetch:a="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:m,target:d,to:y,preventScrollReset:g,viewTransition:b,unstable_defaultShouldRevalidate:x,...k},L){let{basename:B,navigator:D,unstable_useTransitions:$}=U.useContext(Qn),V=typeof y=="string"&&Rb.test(y),se=wb(y,B);y=se.to;let N=cS(y,{relative:l}),R=br(),G=null;if(f){let q=ld(f,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);B!=="/"&&(q.pathname=q.pathname==="/"?B:pr([B,q.pathname])),G=D.createHref(q)}let[J,Y,T]=GS(a,k),X=t_(y,{replace:c,unstable_mask:f,state:m,target:d,preventScrollReset:g,relative:l,viewTransition:b,unstable_defaultShouldRevalidate:x,unstable_useTransitions:$});function K(q){n&&n(q),q.defaultPrevented||X(q)}let ye=!(se.isExternal||u),ue=U.createElement("a",{...k,...T,href:(ye?G:void 0)||se.absoluteURL||N,onClick:ye?K:n,ref:XS(L,Y),target:d,"data-discover":!V&&r==="render"?"true":void 0});return J&&!V?U.createElement(U.Fragment,null,ue,U.createElement(YS,{page:N})):ue});Mb.displayName="Link";var ZS=U.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:a="",end:l=!1,style:u,to:c,viewTransition:f,children:m,...d},y){let g=jl(c,{relative:d.relative}),b=br(),x=U.useContext(Tu),{navigator:k,basename:L}=U.useContext(Qn),B=x!=null&&s_(g)&&f===!0,D=k.encodeLocation?k.encodeLocation(g).pathname:g.pathname,$=b.pathname,V=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;r||($=$.toLowerCase(),V=V?V.toLowerCase():null,D=D.toLowerCase()),V&&L&&(V=$r(V,L)||V);const se=D!=="/"&&D.endsWith("/")?D.length-1:D.length;let N=$===D||!l&&$.startsWith(D)&&$.charAt(se)==="/",R=V!=null&&(V===D||!l&&V.startsWith(D)&&V.charAt(D.length)==="/"),G={isActive:N,isPending:R,isTransitioning:B},J=N?n:void 0,Y;typeof a=="function"?Y=a(G):Y=[a,N?"active":null,R?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let T=typeof u=="function"?u(G):u;return U.createElement(Mb,{...d,"aria-current":J,className:Y,ref:y,style:T,to:c,viewTransition:f},typeof m=="function"?m(G):m)});ZS.displayName="NavLink";var WS=U.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:a,replace:l,state:u,method:c=lu,action:f,onSubmit:m,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b,...x},k)=>{let{unstable_useTransitions:L}=U.useContext(Qn),B=i_(),D=a_(f,{relative:d}),$=c.toLowerCase()==="get"?"get":"post",V=typeof f=="string"&&Rb.test(f),se=N=>{if(m&&m(N),N.defaultPrevented)return;N.preventDefault();let R=N.nativeEvent.submitter,G=(R==null?void 0:R.getAttribute("formmethod"))||c,J=()=>B(R||N.currentTarget,{fetcherKey:n,method:G,navigate:r,replace:l,state:u,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b});L&&r!==!1?U.startTransition(()=>J()):J()};return U.createElement("form",{ref:k,method:$,action:D,onSubmit:a?m:se,...x,"data-discover":!V&&e==="render"?"true":void 0})});WS.displayName="Form";function e_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Db(e){let n=U.useContext(as);return Tt(n,e_(e)),n}function t_(e,{target:n,replace:r,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:d}={}){let y=ta(),g=br(),b=jl(e,{relative:c});return U.useCallback(x=>{if(RS(x,n)){x.preventDefault();let k=r!==void 0?r:xl(g)===xl(b),L=()=>y(e,{replace:k,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});d?U.startTransition(()=>L()):L()}},[g,y,b,r,a,l,n,e,u,c,f,m,d])}var n_=0,r_=()=>`__${String(++n_)}__`;function i_(){let{router:e}=Db("useSubmit"),{basename:n}=U.useContext(Qn),r=SS(),a=e.fetch,l=e.navigate;return U.useCallback(async(u,c={})=>{let{action:f,method:m,encType:d,formData:y,body:g}=zS(u,n);if(c.navigate===!1){let b=c.fetcherKey||r_();await a(b,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[a,l,n,r])}function a_(e,{relative:n}={}){let{basename:r}=U.useContext(Qn),a=U.useContext(yr);Tt(a,"useFormAction must be used inside a RouteContext");let[l]=a.matches.slice(-1),u={...jl(e||".",{relative:n})},c=br();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:pr([r,u.pathname])),xl(u)}function s_(e,{relative:n}={}){let r=U.useContext(_b);Tt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Db("useViewTransitionState"),l=jl(e,{relative:n});if(!r.isTransitioning)return!1;let u=$r(r.currentLocation.pathname,a)||r.currentLocation.pathname,c=$r(r.nextLocation.pathname,a)||r.nextLocation.pathname;return hu(l.pathname,c)!=null||hu(l.pathname,u)!=null}var du=pb();const zb=U.createContext(null),Lb="palmier_paired_hosts",Nh="palmier_active_host";function nh(){try{const e=localStorage.getItem(Lb);if(e)return JSON.parse(e)}catch{}return[]}function l_(e){localStorage.setItem(Lb,JSON.stringify(e))}function o_(){return localStorage.getItem(Nh)}function u_(e){e?localStorage.setItem(Nh,e):localStorage.removeItem(Nh)}const c_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function f_({children:e}){const[n,r]=U.useState(nh),[a,l]=U.useState(()=>{const y=o_(),g=nh();return y&&g.some(b=>b.hostId===y)?y:g.length>0?g[0].hostId:null});U.useEffect(()=>{if(!c_)return;const y="local";if(!nh().find(b=>b.hostId===y)){const b={hostId:y,clientToken:"",directUrl:window.location.origin};r(x=>[...x.filter(k=>k.hostId!==y),b]),l(y)}},[]),U.useEffect(()=>{l_(n)},[n]),U.useEffect(()=>{u_(a)},[a]);const u=U.useCallback(y=>{r(g=>[...g.filter(x=>x.hostId!==y.hostId),y]),l(y.hostId)},[]),c=U.useCallback(y=>{r(g=>{const b=g.filter(x=>x.hostId!==y);return b.length>0?l(b[0].hostId):l(null),b})},[]),f=U.useCallback((y,g)=>{r(b=>b.map(x=>x.hostId===y?{...x,name:g}:x))},[]),m=U.useCallback(y=>{l(y)},[]),d=U.useCallback(()=>n.find(y=>y.hostId===a)??null,[n,a]);return w.jsx(zb.Provider,{value:{pairedHosts:n,activeHostId:a,addPairedHost:u,removePairedHost:c,renamePairedHost:f,setActiveHostId:m,getActiveHost:d},children:e})}function Ol(){const e=U.useContext(zb);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const Mn=new Uint8Array(0),na=new TextEncoder,On=new TextDecoder;function h_(...e){let n=0;for(let l=0;l<e.length;l++)n+=e[l].length;const r=new Uint8Array(n);let a=0;for(let l=0;l<e.length;l++)r.set(e[l],a),a+=e[l].length;return r}function dl(...e){const n=[];for(let r=0;r<e.length;r++)n.push(na.encode(e[r]));return n.length===0?Mn:n.length===1?n[0]:h_(...n)}function $y(e){return!e||e.length===0?"":On.decode(e)}const Gy="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Yy=36,d_=0xcfd41b9100000,Vy=33,m_=333,Jy=22;function p_(e){for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*255)}function g_(e){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(e):p_(e)}class y_{constructor(){A(this,"buf");A(this,"seq");A(this,"inc");A(this,"inited");this.buf=new Uint8Array(Jy),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*d_),this.inc=Math.floor(Math.random()*(m_-Vy)+Vy)}setPre(){const n=new Uint8Array(12);g_(n);for(let r=0;r<12;r++){const a=n[r]%36;this.buf[r]=Gy.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let r=Jy-1;r>=12;r--)this.buf[r]=Gy.charCodeAt(n%Yy),n=Math.floor(n/Yy)}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 Ci=new y_;var Ir;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(Ir||(Ir={}));var Va;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(Va||(Va={}));var Se;(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"})(Se||(Se={}));function b_(e){return typeof e.code=="string"}class Ub{constructor(){A(this,"messages");this.messages=new Map,this.messages.set(Se.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(Se.BadJson,"Bad JSON"),this.messages.set(Se.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return v_.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const v_=new Ub;class je extends Error{constructor(r,a,l){super(r);A(this,"name");A(this,"message");A(this,"code");A(this,"permissionContext");A(this,"chainedError");A(this,"api_error");this.name="NatsError",this.message=r,this.code=a,this.chainedError=l}static errorForCode(r,a){const l=Ub.getMessage(r);return new je(l,r,a)}isAuthError(){return this.code===Se.AuthenticationExpired||this.code===Se.AuthorizationViolation||this.code===Se.AccountExpired}isAuthTimeout(){return this.code===Se.AuthenticationTimeout}isPermissionError(){return this.code===Se.PermissionsViolation}isProtocolError(){return this.code===Se.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Tn;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(Tn||(Tn={}));var ir;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(ir||(ir={}));var ml;(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"})(ml||(ml={}));const mu="Nats-Service-Error",pu="Nats-Service-Error-Code";class gu extends Error{constructor(r,a){super(a);A(this,"code");this.code=r}static isServiceError(r){return gu.toServiceError(r)!==null}static toServiceError(r){var l,u;const a=((l=r==null?void 0:r.headers)==null?void 0:l.get(pu))||"";if(a!==""){const c=parseInt(a)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(mu))||"";return new gu(c,f.length?f:a)}return null}}function Fr(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}.${Ci.next()}`}const Rh="127.0.0.1";var Ei;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Ei||(Ei={}));function Ou(e,...n){for(let r=0;r<n.length;r++){const a=n[r];Object.keys(a).forEach(function(l){e[l]=a[l]})}return e}function Ko(e){return On.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Wa(e,n=!0){const r=n?je.errorForCode(Se.Timeout):null;let a,l;const u=new Promise((c,f)=>{a={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?je.errorForCode(Se.Timeout):r)},e)});return Object.assign(u,a)}function ss(e=0){let n;const r=new Promise(a=>{const l=setTimeout(()=>{a()},e);n={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,n)}function Ct(){let e={};const n=new Promise((r,a)=>{e={resolve:r,reject:a}});return Object.assign(n,e)}function Bb(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 x_(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function dd(e=[0,250,250,500,500,3e3,5e3]){Array.isArray(e)||(e=[0,250,250,500,500,3e3,5e3]);const n=e.length-1;return{backoff(r){return x_(r>n?e[n]:e[r])}}}function At(e){return e*1e6}function md(e){return Math.floor(e/1e6)}function Xy(e){let a=!0;const l=new Array(e.length);for(let u=0;u<e.length;u++){let c=e.charCodeAt(u);if(c===58||c<33||c>126)throw new je(`'${e[u]}' is not a valid character for a header key`,Se.BadHeader);a&&97<=c&&c<=122?c-=32:!a&&65<=c&&c<=90&&(c+=32),l[u]=c,a=c==45}return String.fromCharCode(...l)}function Gr(e=0,n=""){if(e===0&&n!==""||e>0&&n==="")throw new Error("setting status requires both code and description");return new ki(e,n)}const rh="NATS/1.0";class ki{constructor(n=0,r=""){A(this,"_code");A(this,"headers");A(this,"_description");this._code=n,this._description=r,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[r,a]of this.headers){const l=n.values(r);if(a.length!==l.length)return!1;const u=[...a].sort(),c=[...l].sort();for(let f=0;f<u.length;f++)if(u[f]!==c[f])return!1}return!0}return!1}static decode(n){const r=new ki,l=On.decode(n).split(`\r
60
+ Please change the parent <Route path="${D}"> to <Route path="${D==="/"?"*":`${D}/*`}">.`)}let y=yr(),g;if(n){let D=typeof n=="string"?is(n):n;Ct(m==="/"||((B=D.pathname)==null?void 0:B.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 "${D.pathname}" was given in the \`location\` prop.`),g=D}else g=y;let b=g.pathname||"/",x=b;if(m!=="/"){let D=m.replace(/^\//,"").split("/");x="/"+b.replace(/^\//,"").split("/").slice(D.length).join("/")}let k=gb(e,{pathname:x});pr(d||k!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),pr(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let L=bS(k&&k.map(D=>Object.assign({},D,{params:Object.assign({},c,D.params),pathname:mr([m,a.encodeLocation?a.encodeLocation(D.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:D.pathname]),pathnameBase:D.pathnameBase==="/"?m:mr([m,a.encodeLocation?a.encodeLocation(D.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:D.pathnameBase])})),l,r);return n&&L?U.createElement(Cl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},L):L}function mS(){let e=_S(),n=eS(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:a},u={padding:"2px 4px",backgroundColor:a},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=U.createElement(U.Fragment,null,U.createElement("p",null,"💿 Hey developer 👋"),U.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",U.createElement("code",{style:u},"ErrorBoundary")," or"," ",U.createElement("code",{style:u},"errorElement")," prop on your route.")),U.createElement(U.Fragment,null,U.createElement("h2",null,"Unexpected Application Error!"),U.createElement("h3",{style:{fontStyle:"italic"}},n),r?U.createElement("pre",{style:l},r):null,c)}var pS=U.createElement(mS,null),Tb=class extends U.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=uS(e.digest);r&&(e=r)}let n=e!==void 0?U.createElement(gr.Provider,{value:this.props.routeContext},U.createElement(sd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?U.createElement(gS,{error:e},n):n}};Tb.contextType=rS;var eh=new WeakMap;function gS({children:e,error:n}){let{basename:r}=U.useContext(Jn);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let a=oS(n.digest);if(a){let l=eh.get(n);if(l)throw l;let u=wb(a.location,r);if(xb&&!eh.get(n))if(u.isExternal||a.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:a.replace}));throw eh.set(n,c),c}return U.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function yS({routeContext:e,match:n,children:r}){let a=U.useContext(as);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),U.createElement(gr.Provider,{value:e},r)}function bS(e,n=[],r){let a=r==null?void 0:r.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(n.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let l=e,u=a==null?void 0:a.errors;if(u!=null){let y=l.findIndex(g=>g.route.id&&(u==null?void 0:u[g.route.id])!==void 0);Ct(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),l=l.slice(0,Math.min(l.length,y+1))}let c=!1,f=-1;if(r&&a){c=a.renderFallback;for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=y),g.route.id){let{loaderData:b,errors:x}=a,k=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!x||x[g.route.id]===void 0);if(g.route.lazy||k){r.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let m=r==null?void 0:r.onError,d=a&&m?(y,g)=>{var b,x;m(y,{location:a.location,params:((x=(b=a.matches)==null?void 0:b[0])==null?void 0:x.params)??{},unstable_pattern:tS(a.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,b)=>{let x,k=!1,L=null,B=null;a&&(x=u&&g.route.id?u[g.route.id]:void 0,L=g.route.errorElement||pS,c&&(f<0&&b===0?(Ob("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,B=null):f===b&&(k=!0,B=g.route.hydrateFallbackElement||null)));let D=n.concat(l.slice(0,b+1)),F=()=>{let G;return x?G=L:k?G=B:g.route.Component?G=U.createElement(g.route.Component,null):g.route.element?G=g.route.element:G=y,U.createElement(yS,{match:g,routeContext:{outlet:y,matches:D,isDataRoute:a!=null},children:G})};return a&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?U.createElement(Tb,{location:a.location,revalidation:a.revalidation,component:L,error:x,children:F(),routeContext:{outlet:null,matches:D,isDataRoute:!0},onError:d}):F()},null)}function ld(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vS(e){let n=U.useContext(as);return Ct(n,ld(e)),n}function xS(e){let n=U.useContext(Tu);return Ct(n,ld(e)),n}function wS(e){let n=U.useContext(gr);return Ct(n,ld(e)),n}function od(e){let n=wS(e),r=n.matches[n.matches.length-1];return Ct(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function SS(){return od("useRouteId")}function _S(){var a;let e=U.useContext(sd),n=xS("useRouteError"),r=od("useRouteError");return e!==void 0?e:(a=n.errors)==null?void 0:a[r]}function ES(){let{router:e}=vS("useNavigate"),n=od("useNavigate"),r=U.useRef(!1);return Ab(()=>{r.current=!0}),U.useCallback(async(l,u={})=>{pr(r.current,kb),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...u}))},[e,n])}var qy={};function Ob(e,n,r){!n&&!qy[e]&&(qy[e]=!0,pr(!1,r))}U.memo(kS);function kS({routes:e,future:n,state:r,isStatic:a,onError:l}){return Cb(e,void 0,{state:r,isStatic:a,onError:l})}function Fa(e){Ct(!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 AS({basename:e="/",children:n=null,location:r,navigationType:a="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Ct(!Tl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=U.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=is(r));let{pathname:d="/",search:y="",hash:g="",state:b=null,key:x="default",unstable_mask:k}=r,L=U.useMemo(()=>{let B=Hr(d,f);return B==null?null:{location:{pathname:B,search:y,hash:g,state:b,key:x,unstable_mask:k},navigationType:a}},[f,d,y,g,b,x,a,k]);return pr(L!=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.`),L==null?null:U.createElement(Jn.Provider,{value:m},U.createElement(Cl.Provider,{children:n,value:L}))}function CS({children:e,location:n}){return dS(jh(e),n)}function jh(e,n=[]){let r=[];return U.Children.forEach(e,(a,l)=>{if(!U.isValidElement(a))return;let u=[...n,l];if(a.type===U.Fragment){r.push.apply(r,jh(a.props.children,u));return}Ct(a.type===Fa,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ct(!a.props.index||!a.props.children,"An index route cannot have child routes.");let c={id:a.props.id||u.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(c.children=jh(a.props.children,u)),r.push(c)}),r}var lu="get",ou="application/x-www-form-urlencoded";function Ou(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function TS(e){return Ou(e)&&e.tagName.toLowerCase()==="button"}function OS(e){return Ou(e)&&e.tagName.toLowerCase()==="form"}function jS(e){return Ou(e)&&e.tagName.toLowerCase()==="input"}function NS(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function RS(e,n){return e.button===0&&(!n||n==="_self")&&!NS(e)}var Qo=null;function MS(){if(Qo===null)try{new FormData(document.createElement("form"),0),Qo=!1}catch{Qo=!0}return Qo}var DS=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function th(e){return e!=null&&!DS.has(e)?(pr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ou}"`),null):e}function zS(e,n){let r,a,l,u,c;if(OS(e)){let f=e.getAttribute("action");a=f?Hr(f,n):null,r=e.getAttribute("method")||lu,l=th(e.getAttribute("enctype"))||ou,u=new FormData(e)}else if(TS(e)||jS(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(a=m?Hr(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||lu,l=th(e.getAttribute("formenctype"))||th(f.getAttribute("enctype"))||ou,u=new FormData(f,e),!MS()){let{name:d,type:y,value:g}=e;if(y==="image"){let b=d?`${d}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else d&&u.append(d,g)}}else{if(Ou(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=lu,a=null,l=ou,c=e}return u&&l==="text/plain"&&(c=u,u=void 0),{action:a,method:r.toLowerCase(),encType:l,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function ud(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function LS(e,n,r,a){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${a}`:l.pathname=`${l.pathname}.${a}`:l.pathname==="/"?l.pathname=`_root.${a}`:n&&Hr(l.pathname,n)==="/"?l.pathname=`${n.replace(/\/$/,"")}/_root.${a}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${a}`,l}async function US(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 BS(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 PS(e,n,r){let a=await Promise.all(e.map(async l=>{let u=n.routes[l.route.id];if(u){let c=await US(u,r);return c.links?c.links():[]}return[]}));return FS(a.flat(1).filter(BS).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function Hy(e,n,r,a,l,u){let c=(m,d)=>r[d]?m.route.id!==r[d].route.id:!0,f=(m,d)=>{var y;return r[d].pathname!==m.pathname||((y=r[d].route.path)==null?void 0:y.endsWith("*"))&&r[d].params["*"]!==m.params["*"]};return u==="assets"?n.filter((m,d)=>c(m,d)||f(m,d)):u==="data"?n.filter((m,d)=>{var g;let y=a.routes[m.route.id];if(!y||!y.hasLoader)return!1;if(c(m,d)||f(m,d))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function qS(e,n,{includeHydrateFallback:r}={}){return HS(e.map(a=>{let l=n.routes[a.route.id];if(!l)return[];let u=[l.module];return l.clientActionModule&&(u=u.concat(l.clientActionModule)),l.clientLoaderModule&&(u=u.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(u=u.concat(l.hydrateFallbackModule)),l.imports&&(u=u.concat(l.imports)),u}).flat(1))}function HS(e){return[...new Set(e)]}function IS(e){let n={},r=Object.keys(e).sort();for(let a of r)n[a]=e[a];return n}function FS(e,n){let r=new Set;return new Set(n),e.reduce((a,l)=>{let u=JSON.stringify(IS(l));return r.has(u)||(r.add(u),a.push({key:u,link:l})),a},[])}function jb(){let e=U.useContext(as);return ud(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function $S(){let e=U.useContext(Tu);return ud(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var cd=U.createContext(void 0);cd.displayName="FrameworkContext";function Nb(){let e=U.useContext(cd);return ud(e,"You must render this element inside a <HydratedRouter> element"),e}function GS(e,n){let r=U.useContext(cd),[a,l]=U.useState(!1),[u,c]=U.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:y,onTouchStart:g}=n,b=U.useRef(null);U.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let L=D=>{D.forEach(F=>{c(F.isIntersecting)})},B=new IntersectionObserver(L,{threshold:.5});return b.current&&B.observe(b.current),()=>{B.disconnect()}}},[e]),U.useEffect(()=>{if(a){let L=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(L)}}},[a]);let x=()=>{l(!0)},k=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,b,{}]:[u,b,{onFocus:rl(f,x),onBlur:rl(m,k),onMouseEnter:rl(d,x),onMouseLeave:rl(y,k),onTouchStart:rl(g,x)}]:[!1,b,{}]}function rl(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function YS({page:e,...n}){let{router:r}=jb(),a=U.useMemo(()=>gb(r.routes,e,r.basename),[r.routes,e,r.basename]);return a?U.createElement(JS,{page:e,matches:a,...n}):null}function VS(e){let{manifest:n,routeModules:r}=Nb(),[a,l]=U.useState([]);return U.useEffect(()=>{let u=!1;return PS(e,n,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,n,r]),a}function JS({page:e,matches:n,...r}){let a=yr(),{future:l,manifest:u,routeModules:c}=Nb(),{basename:f}=jb(),{loaderData:m,matches:d}=$S(),y=U.useMemo(()=>Hy(e,n,d,u,a,"data"),[e,n,d,u,a]),g=U.useMemo(()=>Hy(e,n,d,u,a,"assets"),[e,n,d,u,a]),b=U.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let L=new Set,B=!1;if(n.forEach(F=>{var se;let G=u.routes[F.route.id];!G||!G.hasLoader||(!y.some(R=>R.route.id===F.route.id)&&F.route.id in m&&((se=c[F.route.id])!=null&&se.shouldRevalidate)||G.hasClientLoader?B=!0:L.add(F.route.id))}),L.size===0)return[];let D=LS(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return B&&L.size>0&&D.searchParams.set("_routes",n.filter(F=>L.has(F.route.id)).map(F=>F.route.id).join(",")),[D.pathname+D.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,a,u,y,n,e,c]),x=U.useMemo(()=>qS(g,u),[g,u]),k=VS(g);return U.createElement(U.Fragment,null,b.map(L=>U.createElement("link",{key:L,rel:"prefetch",as:"fetch",href:L,...r})),x.map(L=>U.createElement("link",{key:L,rel:"modulepreload",href:L,...r})),k.map(({key:L,link:B})=>U.createElement("link",{key:L,nonce:r.nonce,...B,crossOrigin:B.crossOrigin??r.crossOrigin})))}function XS(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var QS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{QS&&(window.__reactRouterVersion="7.13.1")}catch{}function KS({basename:e,children:n,unstable_useTransitions:r,window:a}){let l=U.useRef();l.current==null&&(l.current=jw({window:a,v5Compat:!0}));let u=l.current,[c,f]=U.useState({action:u.action,location:u.location}),m=U.useCallback(d=>{r===!1?f(d):U.startTransition(()=>f(d))},[r]);return U.useLayoutEffect(()=>u.listen(m),[u,m]),U.createElement(AS,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var Rb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Mb=U.forwardRef(function({onClick:n,discover:r="render",prefetch:a="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:m,target:d,to:y,preventScrollReset:g,viewTransition:b,unstable_defaultShouldRevalidate:x,...k},L){let{basename:B,navigator:D,unstable_useTransitions:F}=U.useContext(Jn),G=typeof y=="string"&&Rb.test(y),se=wb(y,B);y=se.to;let R=cS(y,{relative:l}),O=yr(),V=null;if(f){let q=ad(f,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);B!=="/"&&(q.pathname=q.pathname==="/"?B:mr([B,q.pathname])),V=D.createHref(q)}let[J,Y,j]=GS(a,k),K=t_(y,{replace:c,unstable_mask:f,state:m,target:d,preventScrollReset:g,relative:l,viewTransition:b,unstable_defaultShouldRevalidate:x,unstable_useTransitions:F});function Q(q){n&&n(q),q.defaultPrevented||K(q)}let ye=!(se.isExternal||u),he=U.createElement("a",{...k,...j,href:(ye?V:void 0)||se.absoluteURL||R,onClick:ye?Q:n,ref:XS(L,Y),target:d,"data-discover":!G&&r==="render"?"true":void 0});return J&&!G?U.createElement(U.Fragment,null,he,U.createElement(YS,{page:R})):he});Mb.displayName="Link";var ZS=U.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:a="",end:l=!1,style:u,to:c,viewTransition:f,children:m,...d},y){let g=Ol(c,{relative:d.relative}),b=yr(),x=U.useContext(Tu),{navigator:k,basename:L}=U.useContext(Jn),B=x!=null&&s_(g)&&f===!0,D=k.encodeLocation?k.encodeLocation(g).pathname:g.pathname,F=b.pathname,G=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;r||(F=F.toLowerCase(),G=G?G.toLowerCase():null,D=D.toLowerCase()),G&&L&&(G=Hr(G,L)||G);const se=D!=="/"&&D.endsWith("/")?D.length-1:D.length;let R=F===D||!l&&F.startsWith(D)&&F.charAt(se)==="/",O=G!=null&&(G===D||!l&&G.startsWith(D)&&G.charAt(D.length)==="/"),V={isActive:R,isPending:O,isTransitioning:B},J=R?n:void 0,Y;typeof a=="function"?Y=a(V):Y=[a,R?"active":null,O?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let j=typeof u=="function"?u(V):u;return U.createElement(Mb,{...d,"aria-current":J,className:Y,ref:y,style:j,to:c,viewTransition:f},typeof m=="function"?m(V):m)});ZS.displayName="NavLink";var WS=U.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:a,replace:l,state:u,method:c=lu,action:f,onSubmit:m,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b,...x},k)=>{let{unstable_useTransitions:L}=U.useContext(Jn),B=i_(),D=a_(f,{relative:d}),F=c.toLowerCase()==="get"?"get":"post",G=typeof f=="string"&&Rb.test(f),se=R=>{if(m&&m(R),R.defaultPrevented)return;R.preventDefault();let O=R.nativeEvent.submitter,V=(O==null?void 0:O.getAttribute("formmethod"))||c,J=()=>B(O||R.currentTarget,{fetcherKey:n,method:V,navigate:r,replace:l,state:u,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b});L&&r!==!1?U.startTransition(()=>J()):J()};return U.createElement("form",{ref:k,method:F,action:D,onSubmit:a?m:se,...x,"data-discover":!G&&e==="render"?"true":void 0})});WS.displayName="Form";function e_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Db(e){let n=U.useContext(as);return Ct(n,e_(e)),n}function t_(e,{target:n,replace:r,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:d}={}){let y=ea(),g=yr(),b=Ol(e,{relative:c});return U.useCallback(x=>{if(RS(x,n)){x.preventDefault();let k=r!==void 0?r:xl(g)===xl(b),L=()=>y(e,{replace:k,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});d?U.startTransition(()=>L()):L()}},[g,y,b,r,a,l,n,e,u,c,f,m,d])}var n_=0,r_=()=>`__${String(++n_)}__`;function i_(){let{router:e}=Db("useSubmit"),{basename:n}=U.useContext(Jn),r=SS(),a=e.fetch,l=e.navigate;return U.useCallback(async(u,c={})=>{let{action:f,method:m,encType:d,formData:y,body:g}=zS(u,n);if(c.navigate===!1){let b=c.fetcherKey||r_();await a(b,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[a,l,n,r])}function a_(e,{relative:n}={}){let{basename:r}=U.useContext(Jn),a=U.useContext(gr);Ct(a,"useFormAction must be used inside a RouteContext");let[l]=a.matches.slice(-1),u={...Ol(e||".",{relative:n})},c=yr();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:mr([r,u.pathname])),xl(u)}function s_(e,{relative:n}={}){let r=U.useContext(_b);Ct(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Db("useViewTransitionState"),l=Ol(e,{relative:n});if(!r.isTransitioning)return!1;let u=Hr(r.currentLocation.pathname,a)||r.currentLocation.pathname,c=Hr(r.nextLocation.pathname,a)||r.nextLocation.pathname;return hu(l.pathname,c)!=null||hu(l.pathname,u)!=null}var du=pb();const zb=U.createContext(null),Lb="palmier_paired_hosts",Nh="palmier_active_host";function nh(){try{const e=localStorage.getItem(Lb);if(e)return JSON.parse(e)}catch{}return[]}function l_(e){localStorage.setItem(Lb,JSON.stringify(e))}function o_(){return localStorage.getItem(Nh)}function u_(e){e?localStorage.setItem(Nh,e):localStorage.removeItem(Nh)}const c_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function f_({children:e}){const[n,r]=U.useState(nh),[a,l]=U.useState(()=>{const y=o_(),g=nh();return y&&g.some(b=>b.hostId===y)?y:g.length>0?g[0].hostId:null});U.useEffect(()=>{if(!c_)return;const y="local";if(!nh().find(b=>b.hostId===y)){const b={hostId:y,clientToken:"",directUrl:window.location.origin};r(x=>[...x.filter(k=>k.hostId!==y),b]),l(y)}},[]),U.useEffect(()=>{l_(n)},[n]),U.useEffect(()=>{u_(a)},[a]);const u=U.useCallback(y=>{r(g=>[...g.filter(x=>x.hostId!==y.hostId),y]),l(y.hostId)},[]),c=U.useCallback(y=>{r(g=>{const b=g.filter(x=>x.hostId!==y);return b.length>0?l(b[0].hostId):l(null),b})},[]),f=U.useCallback((y,g)=>{r(b=>b.map(x=>x.hostId===y?{...x,name:g}:x))},[]),m=U.useCallback(y=>{l(y)},[]),d=U.useCallback(()=>n.find(y=>y.hostId===a)??null,[n,a]);return w.jsx(zb.Provider,{value:{pairedHosts:n,activeHostId:a,addPairedHost:u,removePairedHost:c,renamePairedHost:f,setActiveHostId:m,getActiveHost:d},children:e})}function jl(){const e=U.useContext(zb);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const Nn=new Uint8Array(0),ta=new TextEncoder,Tn=new TextDecoder;function h_(...e){let n=0;for(let l=0;l<e.length;l++)n+=e[l].length;const r=new Uint8Array(n);let a=0;for(let l=0;l<e.length;l++)r.set(e[l],a),a+=e[l].length;return r}function dl(...e){const n=[];for(let r=0;r<e.length;r++)n.push(ta.encode(e[r]));return n.length===0?Nn:n.length===1?n[0]:h_(...n)}function Iy(e){return!e||e.length===0?"":Tn.decode(e)}const Fy="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",$y=36,d_=0xcfd41b9100000,Gy=33,m_=333,Yy=22;function p_(e){for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*255)}function g_(e){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(e):p_(e)}class y_{constructor(){A(this,"buf");A(this,"seq");A(this,"inc");A(this,"inited");this.buf=new Uint8Array(Yy),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*d_),this.inc=Math.floor(Math.random()*(m_-Gy)+Gy)}setPre(){const n=new Uint8Array(12);g_(n);for(let r=0;r<12;r++){const a=n[r]%36;this.buf[r]=Fy.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let r=Yy-1;r>=12;r--)this.buf[r]=Fy.charCodeAt(n%$y),n=Math.floor(n/$y)}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 Ai=new y_;var Pr;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(Pr||(Pr={}));var Va;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(Va||(Va={}));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 b_(e){return typeof e.code=="string"}class Ub{constructor(){A(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 v_.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const v_=new Ub;class Oe extends Error{constructor(r,a,l){super(r);A(this,"name");A(this,"message");A(this,"code");A(this,"permissionContext");A(this,"chainedError");A(this,"api_error");this.name="NatsError",this.message=r,this.code=a,this.chainedError=l}static errorForCode(r,a){const l=Ub.getMessage(r);return new Oe(l,r,a)}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 An;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(An||(An={}));var rr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(rr||(rr={}));var ml;(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"})(ml||(ml={}));const mu="Nats-Service-Error",pu="Nats-Service-Error-Code";class gu extends Error{constructor(r,a){super(a);A(this,"code");this.code=r}static isServiceError(r){return gu.toServiceError(r)!==null}static toServiceError(r){var l,u;const a=((l=r==null?void 0:r.headers)==null?void 0:l.get(pu))||"";if(a!==""){const c=parseInt(a)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(mu))||"";return new gu(c,f.length?f:a)}return null}}function qr(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}.${Ai.next()}`}const Rh="127.0.0.1";var _i;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(_i||(_i={}));function ju(e,...n){for(let r=0;r<n.length;r++){const a=n[r];Object.keys(a).forEach(function(l){e[l]=a[l]})}return e}function Ko(e){return Tn.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Wa(e,n=!0){const r=n?Oe.errorForCode(Ee.Timeout):null;let a,l;const u=new Promise((c,f)=>{a={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?Oe.errorForCode(Ee.Timeout):r)},e)});return Object.assign(u,a)}function ss(e=0){let n;const r=new Promise(a=>{const l=setTimeout(()=>{a()},e);n={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,n)}function At(){let e={};const n=new Promise((r,a)=>{e={resolve:r,reject:a}});return Object.assign(n,e)}function Bb(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 x_(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function fd(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 x_(r>n?e[n]:e[r])}}}function kt(e){return e*1e6}function hd(e){return Math.floor(e/1e6)}function Vy(e){let a=!0;const l=new Array(e.length);for(let u=0;u<e.length;u++){let c=e.charCodeAt(u);if(c===58||c<33||c>126)throw new Oe(`'${e[u]}' is not a valid character for a header key`,Ee.BadHeader);a&&97<=c&&c<=122?c-=32:!a&&65<=c&&c<=90&&(c+=32),l[u]=c,a=c==45}return String.fromCharCode(...l)}function Ir(e=0,n=""){if(e===0&&n!==""||e>0&&n==="")throw new Error("setting status requires both code and description");return new Ei(e,n)}const rh="NATS/1.0";class Ei{constructor(n=0,r=""){A(this,"_code");A(this,"headers");A(this,"_description");this._code=n,this._description=r,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[r,a]of this.headers){const l=n.values(r);if(a.length!==l.length)return!1;const u=[...a].sort(),c=[...l].sort();for(let f=0;f<u.length;f++)if(u[f]!==c[f])return!1}return!0}return!1}static decode(n){const r=new Ei,l=Tn.decode(n).split(`\r
61
61
  `),u=l[0];if(u!==rh){let c=u.replace(rh,"").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=rh;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[r,a]of this.headers)for(let l=0;l<a.length;l++)n=`${n}\r
62
62
  ${r}: ${a[l]}`;return`${n}\r
63
63
  \r
64
- `}encode(){return na.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new je("invalid header value - \\r and \\n are not allowed.",Se.BadHeader);return n.trim()}keys(){const n=[];for(const r of this.headers.keys())n.push(r);return n}findKeys(n,r=Tn.Exact){const a=this.keys();switch(r){case Tn.Exact:return a.filter(l=>l===n);case Tn.CanonicalMIME:return n=Xy(n),a.filter(l=>l===n);default:{const l=n.toLowerCase();return a.filter(u=>l===u.toLowerCase())}}}get(n,r=Tn.Exact){const a=this.findKeys(n,r);if(a.length){const l=this.headers.get(a[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(n,r=Tn.Exact){const a=this.findKeys(n,r);if(a.length){const l=this.headers.get(a[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(n,r=Tn.Exact){return this.findKeys(n,r).length>0}set(n,r,a=Tn.Exact){this.delete(n,a),this.append(n,r,a)}append(n,r,a=Tn.Exact){const l=Xy(n);a===Tn.CanonicalMIME&&(n=l);const u=this.findKeys(n,a);n=u.length>0?u[0]:n;const c=ki.validHeaderValue(r);let f=this.headers.get(n);f||(f=[],this.headers.set(n,f)),f.push(c)}values(n,r=Tn.Exact){const a=[];return this.findKeys(n,r).forEach(u=>{const c=this.headers.get(u);c&&a.push(...c)}),a}delete(n,r=Tn.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 ki;for(const a in n)r.headers.set(a,n[a]);return r}}function yu(){return{encode(e){return na.encode(e)},decode(e){return On.decode(e)}}}function ar(e){return{encode(n){try{return n===void 0&&(n=null),na.encode(JSON.stringify(n))}catch(r){throw je.errorForCode(Se.BadJson,r)}},decode(n){try{return JSON.parse(On.decode(n),e)}catch(r){throw je.errorForCode(Se.BadJson,r)}}}}function Pb(e){var n;return e&&e.data.length===0&&((n=e.headers)==null?void 0:n.code)===503?je.errorForCode(Se.NoResponders):null}class pd{constructor(n,r,a){A(this,"_headers");A(this,"_msg");A(this,"_rdata");A(this,"_reply");A(this,"_subject");A(this,"publisher");this._msg=n,this._rdata=r,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=On.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=On.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=ki.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=Mn,r){return this.reply?(this.publisher.publish(this.reply,n,r),!0):!1}size(){var l;const n=this._msg.subject.length,r=((l=this._msg.reply)==null?void 0:l.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+r+a}json(n){return ar(n).decode(this.data)}string(){return On.decode(this.data)}requestInfo(){var r;const n=(r=this.headers)==null?void 0:r.get("Nats-Request-Info");return n?JSON.parse(n,function(a,l){return(a==="start"||a==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}A(pd,"jc");function Ja(e){return Nu("durable",e)}function ln(e){return Nu("stream",e)}function Nu(e,n=""){if(n==="")throw Error(`${e} name required`);return[".","*",">","/","\\"," "," ",`
64
+ `}encode(){return ta.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new Oe("invalid header value - \\r and \\n are not allowed.",Ee.BadHeader);return n.trim()}keys(){const n=[];for(const r of this.headers.keys())n.push(r);return n}findKeys(n,r=An.Exact){const a=this.keys();switch(r){case An.Exact:return a.filter(l=>l===n);case An.CanonicalMIME:return n=Vy(n),a.filter(l=>l===n);default:{const l=n.toLowerCase();return a.filter(u=>l===u.toLowerCase())}}}get(n,r=An.Exact){const a=this.findKeys(n,r);if(a.length){const l=this.headers.get(a[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(n,r=An.Exact){const a=this.findKeys(n,r);if(a.length){const l=this.headers.get(a[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(n,r=An.Exact){return this.findKeys(n,r).length>0}set(n,r,a=An.Exact){this.delete(n,a),this.append(n,r,a)}append(n,r,a=An.Exact){const l=Vy(n);a===An.CanonicalMIME&&(n=l);const u=this.findKeys(n,a);n=u.length>0?u[0]:n;const c=Ei.validHeaderValue(r);let f=this.headers.get(n);f||(f=[],this.headers.set(n,f)),f.push(c)}values(n,r=An.Exact){const a=[];return this.findKeys(n,r).forEach(u=>{const c=this.headers.get(u);c&&a.push(...c)}),a}delete(n,r=An.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 Ei;for(const a in n)r.headers.set(a,n[a]);return r}}function yu(){return{encode(e){return ta.encode(e)},decode(e){return Tn.decode(e)}}}function ir(e){return{encode(n){try{return n===void 0&&(n=null),ta.encode(JSON.stringify(n))}catch(r){throw Oe.errorForCode(Ee.BadJson,r)}},decode(n){try{return JSON.parse(Tn.decode(n),e)}catch(r){throw Oe.errorForCode(Ee.BadJson,r)}}}}function Pb(e){var n;return e&&e.data.length===0&&((n=e.headers)==null?void 0:n.code)===503?Oe.errorForCode(Ee.NoResponders):null}class dd{constructor(n,r,a){A(this,"_headers");A(this,"_msg");A(this,"_rdata");A(this,"_reply");A(this,"_subject");A(this,"publisher");this._msg=n,this._rdata=r,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=Tn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Tn.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=Ei.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=Nn,r){return this.reply?(this.publisher.publish(this.reply,n,r),!0):!1}size(){var l;const n=this._msg.subject.length,r=((l=this._msg.reply)==null?void 0:l.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+r+a}json(n){return ir(n).decode(this.data)}string(){return Tn.decode(this.data)}requestInfo(){var r;const n=(r=this.headers)==null?void 0:r.get("Nats-Request-Info");return n?JSON.parse(n,function(a,l){return(a==="start"||a==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}A(dd,"jc");function Ja(e){return Nu("durable",e)}function an(e){return Nu("stream",e)}function Nu(e,n=""){if(n==="")throw Error(`${e} name required`);return[".","*",">","/","\\"," "," ",`
65
65
  `,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
66
- `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${e} name - ${e} name cannot contain '${a}'`)}}),""}function fl(e,n=""){if(n==="")throw Error(`${e} name required`);const r=w_(n);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function w_(e=""){if(e==="")throw Error("name required");const n=/^[-\w]+$/g;if(e.match(n)===null){for(const a of e.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Mh(e){if(e.data.length>0)return!1;const n=e.headers;return n?n.code>=100&&n.code<200:!1}function Dh(e){var n;return Mh(e)&&((n=e.headers)==null?void 0:n.description)==="Idle Heartbeat"}function S_(e,n,r){const a=Gr(e,n),l={hdr:1,sid:0,size:0},u=new pd(l,Mn,{});return u._headers=a,u._subject=r,u}function Xa(e){if(e.data.length!==0)return null;const n=e.headers;return n?qb(n.code,n.description):null}var Jn;(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"})(Jn||(Jn={}));function __(e){return e.code!==Se.JetStream409?!1:[Jn.MaxBatchExceeded,Jn.MaxExpiresExceeded,Jn.MaxBytesExceeded,Jn.MaxMessageSizeExceeded,Jn.PushConsumer,Jn.IdleHeartbeatMissed,Jn.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function qb(e,n=""){if(e<300)return null;switch(n=n.toLowerCase(),e){case 404:return new je(n,Se.JetStream404NoMessages);case 408:return new je(n,Se.JetStream408RequestTimeout);case 409:{const r=n.startsWith(Jn.IdleHeartbeatMissed)?Se.JetStreamIdleHeartBeat:Se.JetStream409;return new je(n,r)}case 503:return je.errorForCode(Se.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=Se.Unknown),new je(n,`${e}`)}}class Vt{constructor(){A(this,"inflight");A(this,"processed");A(this,"received");A(this,"noIterator");A(this,"iterClosed");A(this,"done");A(this,"signal");A(this,"yields");A(this,"filtered");A(this,"pendingFiltered");A(this,"ingestionFilterFn");A(this,"protocolFilterFn");A(this,"dispatchedFn");A(this,"ctx");A(this,"_data");A(this,"err");A(this,"time");A(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=Ct(),this.yields=[],this.iterClosed=Ct(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:r,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};r&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new je("unsupported iterator",Se.ApiError);if(this.yielding)throw new je("already yielding",Se.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=Ct())}}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 gd{constructor(n,r,a={maxOut:2}){A(this,"interval");A(this,"maxOut");A(this,"cancelAfter");A(this,"timer");A(this,"autoCancelTimer");A(this,"last");A(this,"missed");A(this,"count");A(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,r=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=r,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var zh;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(zh||(zh={}));var wl;(function(e){e.Old="old",e.New="new"})(wl||(wl={}));var Lh;(function(e){e.File="file",e.Memory="memory"})(Lh||(Lh={}));var Lt;(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"})(Lt||(Lt={}));var Yt;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(Yt||(Yt={}));var es;(function(e){e.Instant="instant",e.Original="original"})(es||(es={}));var Ti;(function(e){e.None="none",e.S2="s2"})(Ti||(Ti={}));var bu;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(bu||(bu={}));function E_(e,n={}){return Object.assign({name:e,deliver_policy:Lt.All,ack_policy:Yt.Explicit,ack_wait:At(30*1e3),replay_policy:es.Instant},n)}var Qy;(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"})(Qy||(Qy={}));var cn;(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"})(cn||(cn={}));var rr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(rr||(rr={}));var Ya;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(Ya||(Ya={}));var Ky;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(Ky||(Ky={}));const jn="KV_";class k_{constructor(n){A(this,"config");A(this,"ordered");A(this,"mack");A(this,"stream");A(this,"callbackFn");A(this,"max");A(this,"qname");A(this,"isBind");A(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=E_("",n||{})}getOpts(){var r;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((r=n.config.filter_subjects)==null||r.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?Yt.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 Ja(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=Lt.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=Lt.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=Lt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Lt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Lt.Last,this}deliverNew(){return this.config.deliver_policy=Lt.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=Yt.None,this}ackAll(){return this.config.ack_policy=Yt.All,this}ackExplicit(){return this.config.ack_policy=Yt.Explicit,this}ackWait(n){return this.config.ack_wait=At(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=es.Instant,this}replayOriginal(){return this.config.replay_policy=es.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=At(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=At(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=At(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 Ai(e){return new k_(e)}function Zy(e){return typeof e.getOpts=="function"}class A_{static encode(n){if(typeof n=="string")return btoa(n);const r=Array.from(n);return btoa(String.fromCharCode(...r))}static decode(n,r=!1){const a=atob(n);return r?Uint8Array.from(a,l=>l.charCodeAt(0)):a}}class Qa{static encode(n){return Qa.toB64URLEncoding(A_.encode(n))}static decode(n,r=!1){return Qa.decode(Qa.fromB64URLEncoding(n),r)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class ts{constructor(){A(this,"buffers");A(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let r=0;for(let u=0;u<n.length;u++)r+=n[u].length;const a=new Uint8Array(r);let l=0;for(let u=0;u<n.length;u++)a.set(n[u],l),l+=n[u].length;return a}static fromAscii(n){return n||(n=""),na.encode(n)}static toAscii(n){return On.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let r=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],r),r+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const r=this.buffers.pop();if(r){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const l=r.subarray(0,n);return a>n&&this.buffers.push(r.subarray(n)),this.byteLength=a-n,l}}return new Uint8Array(0)}fill(n,...r){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<r.length;a++)r[a]&&r[a].length&&(this.buffers.push(r[a]),this.byteLength+=r[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function C_(e,n){return n.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(a){if(a!=="default"&&!(a in e)){var l=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(e,a,l.get?l:{enumerable:!0,get:function(){return r[a]}})}})}),Object.freeze(e)}var T_=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},il=T_.performance||{};il.now||il.mozNow||il.msNow||il.oNow||il.webkitNow;var Wy={versions:{}},j_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function O_(e){if(e.__esModule)return e;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var ih,Ru={exports:{}},e0={},t0=O_(C_({__proto__:null,default:e0},[e0]));ih=Ru,(function(){var e="input is invalid type",n=typeof window=="object",r=n?window:{};r.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&Wy.versions&&Wy.versions.node;l?r=j_:a&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&ih.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),m=[-2147483648,8388608,32768,128],d=[24,16,8,0],y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],g=["hex","array","digest","arrayBuffer"],b=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(N){return Object.prototype.toString.call(N)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(N){return typeof N=="object"&&N.buffer&&N.buffer.constructor===ArrayBuffer});var x=function(N,R){return function(G){return new $(R,!0).update(G)[N]()}},k=function(N){var R=x("hex",N);l&&(R=L(R,N)),R.create=function(){return new $(N)},R.update=function(Y){return R.create().update(Y)};for(var G=0;G<g.length;++G){var J=g[G];R[J]=x(J,N)}return R},L=function(N,R){var G,J=t0,Y=t0.Buffer,T=R?"sha224":"sha256";return G=Y.from&&!r.JS_SHA256_NO_BUFFER_FROM?Y.from:function(X){return new Y(X)},function(X){if(typeof X=="string")return J.createHash(T).update(X,"utf8").digest("hex");if(X==null)throw new Error(e);return X.constructor===ArrayBuffer&&(X=new Uint8Array(X)),Array.isArray(X)||ArrayBuffer.isView(X)||X.constructor===Y?J.createHash(T).update(G(X)).digest("hex"):N(X)}},B=function(N,R){return function(G,J){return new V(G,R,!0).update(J)[N]()}},D=function(N){var R=B("hex",N);R.create=function(Y){return new V(Y,N)},R.update=function(Y,T){return R.create(Y).update(T)};for(var G=0;G<g.length;++G){var J=g[G];R[J]=B(J,N)}return R};function $(N,R){R?(b[0]=b[16]=b[1]=b[2]=b[3]=b[4]=b[5]=b[6]=b[7]=b[8]=b[9]=b[10]=b[11]=b[12]=b[13]=b[14]=b[15]=0,this.blocks=b):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],N?(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=N}function V(N,R,G){var J,Y=typeof N;if(Y==="string"){var T,X=[],K=N.length,ye=0;for(J=0;J<K;++J)(T=N.charCodeAt(J))<128?X[ye++]=T:T<2048?(X[ye++]=192|T>>>6,X[ye++]=128|63&T):T<55296||T>=57344?(X[ye++]=224|T>>>12,X[ye++]=128|T>>>6&63,X[ye++]=128|63&T):(T=65536+((1023&T)<<10|1023&N.charCodeAt(++J)),X[ye++]=240|T>>>18,X[ye++]=128|T>>>12&63,X[ye++]=128|T>>>6&63,X[ye++]=128|63&T);N=X}else{if(Y!=="object")throw new Error(e);if(N===null)throw new Error(e);if(c&&N.constructor===ArrayBuffer)N=new Uint8Array(N);else if(!(Array.isArray(N)||c&&ArrayBuffer.isView(N)))throw new Error(e)}N.length>64&&(N=new $(R,!0).update(N).array());var ue=[],q=[];for(J=0;J<64;++J){var I=N[J]||0;ue[J]=92^I,q[J]=54^I}$.call(this,R,G),this.update(q),this.oKeyPad=ue,this.inner=!0,this.sharedMemory=G}$.prototype.update=function(N){if(!this.finalized){var R,G=typeof N;if(G!=="string"){if(G!=="object")throw new Error(e);if(N===null)throw new Error(e);if(c&&N.constructor===ArrayBuffer)N=new Uint8Array(N);else if(!(Array.isArray(N)||c&&ArrayBuffer.isView(N)))throw new Error(e);R=!0}for(var J,Y,T=0,X=N.length,K=this.blocks;T<X;){if(this.hashed&&(this.hashed=!1,K[0]=this.block,this.block=K[16]=K[1]=K[2]=K[3]=K[4]=K[5]=K[6]=K[7]=K[8]=K[9]=K[10]=K[11]=K[12]=K[13]=K[14]=K[15]=0),R)for(Y=this.start;T<X&&Y<64;++T)K[Y>>>2]|=N[T]<<d[3&Y++];else for(Y=this.start;T<X&&Y<64;++T)(J=N.charCodeAt(T))<128?K[Y>>>2]|=J<<d[3&Y++]:J<2048?(K[Y>>>2]|=(192|J>>>6)<<d[3&Y++],K[Y>>>2]|=(128|63&J)<<d[3&Y++]):J<55296||J>=57344?(K[Y>>>2]|=(224|J>>>12)<<d[3&Y++],K[Y>>>2]|=(128|J>>>6&63)<<d[3&Y++],K[Y>>>2]|=(128|63&J)<<d[3&Y++]):(J=65536+((1023&J)<<10|1023&N.charCodeAt(++T)),K[Y>>>2]|=(240|J>>>18)<<d[3&Y++],K[Y>>>2]|=(128|J>>>12&63)<<d[3&Y++],K[Y>>>2]|=(128|J>>>6&63)<<d[3&Y++],K[Y>>>2]|=(128|63&J)<<d[3&Y++]);this.lastByteIndex=Y,this.bytes+=Y-this.start,Y>=64?(this.block=K[16],this.start=Y-64,this.hash(),this.hashed=!0):this.start=Y}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},$.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var N=this.blocks,R=this.lastByteIndex;N[16]=this.block,N[R>>>2]|=m[3&R],this.block=N[16],R>=56&&(this.hashed||this.hash(),N[0]=this.block,N[16]=N[1]=N[2]=N[3]=N[4]=N[5]=N[6]=N[7]=N[8]=N[9]=N[10]=N[11]=N[12]=N[13]=N[14]=N[15]=0),N[14]=this.hBytes<<3|this.bytes>>>29,N[15]=this.bytes<<3,this.hash()}},$.prototype.hash=function(){var N,R,G,J,Y,T,X,K,ye,ue=this.h0,q=this.h1,I=this.h2,ae=this.h3,ge=this.h4,_e=this.h5,O=this.h6,M=this.h7,W=this.blocks;for(N=16;N<64;++N)R=((Y=W[N-15])>>>7|Y<<25)^(Y>>>18|Y<<14)^Y>>>3,G=((Y=W[N-2])>>>17|Y<<15)^(Y>>>19|Y<<13)^Y>>>10,W[N]=W[N-16]+R+W[N-7]+G|0;for(ye=q&I,N=0;N<64;N+=4)this.first?(this.is224?(T=300032,M=(Y=W[0]-1413257819)-150054599|0,ae=Y+24177077|0):(T=704751109,M=(Y=W[0]-210244248)-1521486534|0,ae=Y+143694565|0),this.first=!1):(R=(ue>>>2|ue<<30)^(ue>>>13|ue<<19)^(ue>>>22|ue<<10),J=(T=ue&q)^ue&I^ye,M=ae+(Y=M+(G=(ge>>>6|ge<<26)^(ge>>>11|ge<<21)^(ge>>>25|ge<<7))+(ge&_e^~ge&O)+y[N]+W[N])|0,ae=Y+(R+J)|0),R=(ae>>>2|ae<<30)^(ae>>>13|ae<<19)^(ae>>>22|ae<<10),J=(X=ae&ue)^ae&q^T,O=I+(Y=O+(G=(M>>>6|M<<26)^(M>>>11|M<<21)^(M>>>25|M<<7))+(M&ge^~M&_e)+y[N+1]+W[N+1])|0,R=((I=Y+(R+J)|0)>>>2|I<<30)^(I>>>13|I<<19)^(I>>>22|I<<10),J=(K=I&ae)^I&ue^X,_e=q+(Y=_e+(G=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7))+(O&M^~O&ge)+y[N+2]+W[N+2])|0,R=((q=Y+(R+J)|0)>>>2|q<<30)^(q>>>13|q<<19)^(q>>>22|q<<10),J=(ye=q&I)^q&ae^K,ge=ue+(Y=ge+(G=(_e>>>6|_e<<26)^(_e>>>11|_e<<21)^(_e>>>25|_e<<7))+(_e&O^~_e&M)+y[N+3]+W[N+3])|0,ue=Y+(R+J)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+ue|0,this.h1=this.h1+q|0,this.h2=this.h2+I|0,this.h3=this.h3+ae|0,this.h4=this.h4+ge|0,this.h5=this.h5+_e|0,this.h6=this.h6+O|0,this.h7=this.h7+M|0},$.prototype.hex=function(){this.finalize();var N=this.h0,R=this.h1,G=this.h2,J=this.h3,Y=this.h4,T=this.h5,X=this.h6,K=this.h7,ye=f[N>>>28&15]+f[N>>>24&15]+f[N>>>20&15]+f[N>>>16&15]+f[N>>>12&15]+f[N>>>8&15]+f[N>>>4&15]+f[15&N]+f[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[G>>>28&15]+f[G>>>24&15]+f[G>>>20&15]+f[G>>>16&15]+f[G>>>12&15]+f[G>>>8&15]+f[G>>>4&15]+f[15&G]+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[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[T>>>28&15]+f[T>>>24&15]+f[T>>>20&15]+f[T>>>16&15]+f[T>>>12&15]+f[T>>>8&15]+f[T>>>4&15]+f[15&T]+f[X>>>28&15]+f[X>>>24&15]+f[X>>>20&15]+f[X>>>16&15]+f[X>>>12&15]+f[X>>>8&15]+f[X>>>4&15]+f[15&X];return this.is224||(ye+=f[K>>>28&15]+f[K>>>24&15]+f[K>>>20&15]+f[K>>>16&15]+f[K>>>12&15]+f[K>>>8&15]+f[K>>>4&15]+f[15&K]),ye},$.prototype.toString=$.prototype.hex,$.prototype.digest=function(){this.finalize();var N=this.h0,R=this.h1,G=this.h2,J=this.h3,Y=this.h4,T=this.h5,X=this.h6,K=this.h7,ye=[N>>>24&255,N>>>16&255,N>>>8&255,255&N,R>>>24&255,R>>>16&255,R>>>8&255,255&R,G>>>24&255,G>>>16&255,G>>>8&255,255&G,J>>>24&255,J>>>16&255,J>>>8&255,255&J,Y>>>24&255,Y>>>16&255,Y>>>8&255,255&Y,T>>>24&255,T>>>16&255,T>>>8&255,255&T,X>>>24&255,X>>>16&255,X>>>8&255,255&X];return this.is224||ye.push(K>>>24&255,K>>>16&255,K>>>8&255,255&K),ye},$.prototype.array=$.prototype.digest,$.prototype.arrayBuffer=function(){this.finalize();var N=new ArrayBuffer(this.is224?28:32),R=new DataView(N);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),N},V.prototype=new $,V.prototype.finalize=function(){if($.prototype.finalize.call(this),this.inner){this.inner=!1;var N=this.array();$.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(N),$.prototype.finalize.call(this)}};var se=k();se.sha256=se,se.sha224=k(!0),se.sha256.hmac=D(),se.sha224.hmac=D(!0),u?ih.exports=se:(r.sha256=se.sha256,r.sha224=se.sha224)})();Ru.exports;Ru.exports.sha224;var n0=Ru.exports.sha256;function Uh(e){return L_(e)}function N_(e){if(!/^[0-9A-Fa-f]+$/.test(e))return!1;const r=/^[0-9A-F]+$/.test(e),a=/^[0-9a-f]+$/.test(e);return r||a?e.length%2===0:!1}function R_(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function M_(e){return N_(e)?"hex":R_(e)?"b64":""}function D_(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 z_(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))}function L_(e){switch(M_(e)){case"hex":return D_(e);case"b64":return z_(e)}return null}function U_(e,n){const r=typeof e=="string"?Uh(e):e,a=typeof n=="string"?Uh(n):n;if(r===null||a===null||r.length!==a.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==a[l])return!1;return!0}class Hb{constructor(n,r,a=!0){A(this,"token");A(this,"received");A(this,"ctx");A(this,"requestSubject");A(this,"mux");this.mux=n,this.requestSubject=r,this.received=0,this.token=Ci.next(),a&&(this.ctx=new Error)}}class B_ extends Hb{constructor(r,a,l={maxWait:1e3}){super(r,a);A(this,"callback");A(this,"done");A(this,"timer");A(this,"max");A(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=Ct(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(r){r&&this.callback(r,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(r,a){r?(this.ctx&&(r.stack+=`
66
+ `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${e} name - ${e} name cannot contain '${a}'`)}}),""}function fl(e,n=""){if(n==="")throw Error(`${e} name required`);const r=w_(n);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function w_(e=""){if(e==="")throw Error("name required");const n=/^[-\w]+$/g;if(e.match(n)===null){for(const a of e.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Mh(e){if(e.data.length>0)return!1;const n=e.headers;return n?n.code>=100&&n.code<200:!1}function Dh(e){var n;return Mh(e)&&((n=e.headers)==null?void 0:n.description)==="Idle Heartbeat"}function S_(e,n,r){const a=Ir(e,n),l={hdr:1,sid:0,size:0},u=new dd(l,Nn,{});return u._headers=a,u._subject=r,u}function Xa(e){if(e.data.length!==0)return null;const n=e.headers;return n?qb(n.code,n.description):null}var Yn;(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"})(Yn||(Yn={}));function __(e){return e.code!==Ee.JetStream409?!1:[Yn.MaxBatchExceeded,Yn.MaxExpiresExceeded,Yn.MaxBytesExceeded,Yn.MaxMessageSizeExceeded,Yn.PushConsumer,Yn.IdleHeartbeatMissed,Yn.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function qb(e,n=""){if(e<300)return null;switch(n=n.toLowerCase(),e){case 404:return new Oe(n,Ee.JetStream404NoMessages);case 408:return new Oe(n,Ee.JetStream408RequestTimeout);case 409:{const r=n.startsWith(Yn.IdleHeartbeatMissed)?Ee.JetStreamIdleHeartBeat:Ee.JetStream409;return new Oe(n,r)}case 503:return Oe.errorForCode(Ee.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=Ee.Unknown),new Oe(n,`${e}`)}}class Gt{constructor(){A(this,"inflight");A(this,"processed");A(this,"received");A(this,"noIterator");A(this,"iterClosed");A(this,"done");A(this,"signal");A(this,"yields");A(this,"filtered");A(this,"pendingFiltered");A(this,"ingestionFilterFn");A(this,"protocolFilterFn");A(this,"dispatchedFn");A(this,"ctx");A(this,"_data");A(this,"err");A(this,"time");A(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=At(),this.yields=[],this.iterClosed=At(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:r,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};r&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new Oe("unsupported iterator",Ee.ApiError);if(this.yielding)throw new Oe("already yielding",Ee.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let r=0;r<n.length;r++){if(typeof n[r]=="function"){const l=n[r];try{l()}catch(u){throw u}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[r]):!0){this.processed++;const l=Date.now();yield n[r],this.time=Date.now()-l,this.dispatchedFn&&n[r]&&this.dispatchedFn(n[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=At())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class md{constructor(n,r,a={maxOut:2}){A(this,"interval");A(this,"maxOut");A(this,"cancelAfter");A(this,"timer");A(this,"autoCancelTimer");A(this,"last");A(this,"missed");A(this,"count");A(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,r=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=r,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var zh;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(zh||(zh={}));var wl;(function(e){e.Old="old",e.New="new"})(wl||(wl={}));var Lh;(function(e){e.File="file",e.Memory="memory"})(Lh||(Lh={}));var Dt;(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"})(Dt||(Dt={}));var $t;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})($t||($t={}));var es;(function(e){e.Instant="instant",e.Original="original"})(es||(es={}));var Ci;(function(e){e.None="none",e.S2="s2"})(Ci||(Ci={}));var bu;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(bu||(bu={}));function E_(e,n={}){return Object.assign({name:e,deliver_policy:Dt.All,ack_policy:$t.Explicit,ack_wait:kt(30*1e3),replay_policy:es.Instant},n)}var Jy;(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"})(Jy||(Jy={}));var on;(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"})(on||(on={}));var nr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(nr||(nr={}));var Ya;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(Ya||(Ya={}));var Xy;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(Xy||(Xy={}));const Cn="KV_";class k_{constructor(n){A(this,"config");A(this,"ordered");A(this,"mack");A(this,"stream");A(this,"callbackFn");A(this,"max");A(this,"qname");A(this,"isBind");A(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=E_("",n||{})}getOpts(){var r;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((r=n.config.filter_subjects)==null||r.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?$t.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 Ja(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=Dt.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=Dt.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=Dt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Dt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Dt.Last,this}deliverNew(){return this.config.deliver_policy=Dt.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=$t.None,this}ackAll(){return this.config.ack_policy=$t.All,this}ackExplicit(){return this.config.ack_policy=$t.Explicit,this}ackWait(n){return this.config.ack_wait=kt(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=es.Instant,this}replayOriginal(){return this.config.replay_policy=es.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=kt(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=kt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=kt(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 ki(e){return new k_(e)}function Qy(e){return typeof e.getOpts=="function"}class A_{static encode(n){if(typeof n=="string")return btoa(n);const r=Array.from(n);return btoa(String.fromCharCode(...r))}static decode(n,r=!1){const a=atob(n);return r?Uint8Array.from(a,l=>l.charCodeAt(0)):a}}class Qa{static encode(n){return Qa.toB64URLEncoding(A_.encode(n))}static decode(n,r=!1){return Qa.decode(Qa.fromB64URLEncoding(n),r)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class ts{constructor(){A(this,"buffers");A(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let r=0;for(let u=0;u<n.length;u++)r+=n[u].length;const a=new Uint8Array(r);let l=0;for(let u=0;u<n.length;u++)a.set(n[u],l),l+=n[u].length;return a}static fromAscii(n){return n||(n=""),ta.encode(n)}static toAscii(n){return Tn.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let r=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],r),r+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const r=this.buffers.pop();if(r){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const l=r.subarray(0,n);return a>n&&this.buffers.push(r.subarray(n)),this.byteLength=a-n,l}}return new Uint8Array(0)}fill(n,...r){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<r.length;a++)r[a]&&r[a].length&&(this.buffers.push(r[a]),this.byteLength+=r[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function C_(e,n){return n.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(a){if(a!=="default"&&!(a in e)){var l=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(e,a,l.get?l:{enumerable:!0,get:function(){return r[a]}})}})}),Object.freeze(e)}var T_=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},il=T_.performance||{};il.now||il.mozNow||il.msNow||il.oNow||il.webkitNow;var Ky={versions:{}},O_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function j_(e){if(e.__esModule)return e;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var ih,Ru={exports:{}},Zy={},Wy=j_(C_({__proto__:null,default:Zy},[Zy]));ih=Ru,(function(){var e="input is invalid type",n=typeof window=="object",r=n?window:{};r.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&Ky.versions&&Ky.versions.node;l?r=O_:a&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&ih.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),m=[-2147483648,8388608,32768,128],d=[24,16,8,0],y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],g=["hex","array","digest","arrayBuffer"],b=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(R){return Object.prototype.toString.call(R)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(R){return typeof R=="object"&&R.buffer&&R.buffer.constructor===ArrayBuffer});var x=function(R,O){return function(V){return new F(O,!0).update(V)[R]()}},k=function(R){var O=x("hex",R);l&&(O=L(O,R)),O.create=function(){return new F(R)},O.update=function(Y){return O.create().update(Y)};for(var V=0;V<g.length;++V){var J=g[V];O[J]=x(J,R)}return O},L=function(R,O){var V,J=Wy,Y=Wy.Buffer,j=O?"sha224":"sha256";return V=Y.from&&!r.JS_SHA256_NO_BUFFER_FROM?Y.from:function(K){return new Y(K)},function(K){if(typeof K=="string")return J.createHash(j).update(K,"utf8").digest("hex");if(K==null)throw new Error(e);return K.constructor===ArrayBuffer&&(K=new Uint8Array(K)),Array.isArray(K)||ArrayBuffer.isView(K)||K.constructor===Y?J.createHash(j).update(V(K)).digest("hex"):R(K)}},B=function(R,O){return function(V,J){return new G(V,O,!0).update(J)[R]()}},D=function(R){var O=B("hex",R);O.create=function(Y){return new G(Y,R)},O.update=function(Y,j){return O.create(Y).update(j)};for(var V=0;V<g.length;++V){var J=g[V];O[J]=B(J,R)}return O};function F(R,O){O?(b[0]=b[16]=b[1]=b[2]=b[3]=b[4]=b[5]=b[6]=b[7]=b[8]=b[9]=b[10]=b[11]=b[12]=b[13]=b[14]=b[15]=0,this.blocks=b):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],R?(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=R}function G(R,O,V){var J,Y=typeof R;if(Y==="string"){var j,K=[],Q=R.length,ye=0;for(J=0;J<Q;++J)(j=R.charCodeAt(J))<128?K[ye++]=j:j<2048?(K[ye++]=192|j>>>6,K[ye++]=128|63&j):j<55296||j>=57344?(K[ye++]=224|j>>>12,K[ye++]=128|j>>>6&63,K[ye++]=128|63&j):(j=65536+((1023&j)<<10|1023&R.charCodeAt(++J)),K[ye++]=240|j>>>18,K[ye++]=128|j>>>12&63,K[ye++]=128|j>>>6&63,K[ye++]=128|63&j);R=K}else{if(Y!=="object")throw new Error(e);if(R===null)throw new Error(e);if(c&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!(Array.isArray(R)||c&&ArrayBuffer.isView(R)))throw new Error(e)}R.length>64&&(R=new F(O,!0).update(R).array());var he=[],q=[];for(J=0;J<64;++J){var H=R[J]||0;he[J]=92^H,q[J]=54^H}F.call(this,O,V),this.update(q),this.oKeyPad=he,this.inner=!0,this.sharedMemory=V}F.prototype.update=function(R){if(!this.finalized){var O,V=typeof R;if(V!=="string"){if(V!=="object")throw new Error(e);if(R===null)throw new Error(e);if(c&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!(Array.isArray(R)||c&&ArrayBuffer.isView(R)))throw new Error(e);O=!0}for(var J,Y,j=0,K=R.length,Q=this.blocks;j<K;){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),O)for(Y=this.start;j<K&&Y<64;++j)Q[Y>>>2]|=R[j]<<d[3&Y++];else for(Y=this.start;j<K&&Y<64;++j)(J=R.charCodeAt(j))<128?Q[Y>>>2]|=J<<d[3&Y++]:J<2048?(Q[Y>>>2]|=(192|J>>>6)<<d[3&Y++],Q[Y>>>2]|=(128|63&J)<<d[3&Y++]):J<55296||J>=57344?(Q[Y>>>2]|=(224|J>>>12)<<d[3&Y++],Q[Y>>>2]|=(128|J>>>6&63)<<d[3&Y++],Q[Y>>>2]|=(128|63&J)<<d[3&Y++]):(J=65536+((1023&J)<<10|1023&R.charCodeAt(++j)),Q[Y>>>2]|=(240|J>>>18)<<d[3&Y++],Q[Y>>>2]|=(128|J>>>12&63)<<d[3&Y++],Q[Y>>>2]|=(128|J>>>6&63)<<d[3&Y++],Q[Y>>>2]|=(128|63&J)<<d[3&Y++]);this.lastByteIndex=Y,this.bytes+=Y-this.start,Y>=64?(this.block=Q[16],this.start=Y-64,this.hash(),this.hashed=!0):this.start=Y}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},F.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var R=this.blocks,O=this.lastByteIndex;R[16]=this.block,R[O>>>2]|=m[3&O],this.block=R[16],O>=56&&(this.hashed||this.hash(),R[0]=this.block,R[16]=R[1]=R[2]=R[3]=R[4]=R[5]=R[6]=R[7]=R[8]=R[9]=R[10]=R[11]=R[12]=R[13]=R[14]=R[15]=0),R[14]=this.hBytes<<3|this.bytes>>>29,R[15]=this.bytes<<3,this.hash()}},F.prototype.hash=function(){var R,O,V,J,Y,j,K,Q,ye,he=this.h0,q=this.h1,H=this.h2,ie=this.h3,ge=this.h4,Se=this.h5,N=this.h6,M=this.h7,W=this.blocks;for(R=16;R<64;++R)O=((Y=W[R-15])>>>7|Y<<25)^(Y>>>18|Y<<14)^Y>>>3,V=((Y=W[R-2])>>>17|Y<<15)^(Y>>>19|Y<<13)^Y>>>10,W[R]=W[R-16]+O+W[R-7]+V|0;for(ye=q&H,R=0;R<64;R+=4)this.first?(this.is224?(j=300032,M=(Y=W[0]-1413257819)-150054599|0,ie=Y+24177077|0):(j=704751109,M=(Y=W[0]-210244248)-1521486534|0,ie=Y+143694565|0),this.first=!1):(O=(he>>>2|he<<30)^(he>>>13|he<<19)^(he>>>22|he<<10),J=(j=he&q)^he&H^ye,M=ie+(Y=M+(V=(ge>>>6|ge<<26)^(ge>>>11|ge<<21)^(ge>>>25|ge<<7))+(ge&Se^~ge&N)+y[R]+W[R])|0,ie=Y+(O+J)|0),O=(ie>>>2|ie<<30)^(ie>>>13|ie<<19)^(ie>>>22|ie<<10),J=(K=ie&he)^ie&q^j,N=H+(Y=N+(V=(M>>>6|M<<26)^(M>>>11|M<<21)^(M>>>25|M<<7))+(M&ge^~M&Se)+y[R+1]+W[R+1])|0,O=((H=Y+(O+J)|0)>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),J=(Q=H&ie)^H&he^K,Se=q+(Y=Se+(V=(N>>>6|N<<26)^(N>>>11|N<<21)^(N>>>25|N<<7))+(N&M^~N&ge)+y[R+2]+W[R+2])|0,O=((q=Y+(O+J)|0)>>>2|q<<30)^(q>>>13|q<<19)^(q>>>22|q<<10),J=(ye=q&H)^q&ie^Q,ge=he+(Y=ge+(V=(Se>>>6|Se<<26)^(Se>>>11|Se<<21)^(Se>>>25|Se<<7))+(Se&N^~Se&M)+y[R+3]+W[R+3])|0,he=Y+(O+J)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+he|0,this.h1=this.h1+q|0,this.h2=this.h2+H|0,this.h3=this.h3+ie|0,this.h4=this.h4+ge|0,this.h5=this.h5+Se|0,this.h6=this.h6+N|0,this.h7=this.h7+M|0},F.prototype.hex=function(){this.finalize();var R=this.h0,O=this.h1,V=this.h2,J=this.h3,Y=this.h4,j=this.h5,K=this.h6,Q=this.h7,ye=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[O>>>28&15]+f[O>>>24&15]+f[O>>>20&15]+f[O>>>16&15]+f[O>>>12&15]+f[O>>>8&15]+f[O>>>4&15]+f[15&O]+f[V>>>28&15]+f[V>>>24&15]+f[V>>>20&15]+f[V>>>16&15]+f[V>>>12&15]+f[V>>>8&15]+f[V>>>4&15]+f[15&V]+f[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[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[K>>>28&15]+f[K>>>24&15]+f[K>>>20&15]+f[K>>>16&15]+f[K>>>12&15]+f[K>>>8&15]+f[K>>>4&15]+f[15&K];return this.is224||(ye+=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]),ye},F.prototype.toString=F.prototype.hex,F.prototype.digest=function(){this.finalize();var R=this.h0,O=this.h1,V=this.h2,J=this.h3,Y=this.h4,j=this.h5,K=this.h6,Q=this.h7,ye=[R>>>24&255,R>>>16&255,R>>>8&255,255&R,O>>>24&255,O>>>16&255,O>>>8&255,255&O,V>>>24&255,V>>>16&255,V>>>8&255,255&V,J>>>24&255,J>>>16&255,J>>>8&255,255&J,Y>>>24&255,Y>>>16&255,Y>>>8&255,255&Y,j>>>24&255,j>>>16&255,j>>>8&255,255&j,K>>>24&255,K>>>16&255,K>>>8&255,255&K];return this.is224||ye.push(Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q),ye},F.prototype.array=F.prototype.digest,F.prototype.arrayBuffer=function(){this.finalize();var R=new ArrayBuffer(this.is224?28:32),O=new DataView(R);return O.setUint32(0,this.h0),O.setUint32(4,this.h1),O.setUint32(8,this.h2),O.setUint32(12,this.h3),O.setUint32(16,this.h4),O.setUint32(20,this.h5),O.setUint32(24,this.h6),this.is224||O.setUint32(28,this.h7),R},G.prototype=new F,G.prototype.finalize=function(){if(F.prototype.finalize.call(this),this.inner){this.inner=!1;var R=this.array();F.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(R),F.prototype.finalize.call(this)}};var se=k();se.sha256=se,se.sha224=k(!0),se.sha256.hmac=D(),se.sha224.hmac=D(!0),u?ih.exports=se:(r.sha256=se.sha256,r.sha224=se.sha224)})();Ru.exports;Ru.exports.sha224;var e0=Ru.exports.sha256;function Uh(e){return L_(e)}function N_(e){if(!/^[0-9A-Fa-f]+$/.test(e))return!1;const r=/^[0-9A-F]+$/.test(e),a=/^[0-9a-f]+$/.test(e);return r||a?e.length%2===0:!1}function R_(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function M_(e){return N_(e)?"hex":R_(e)?"b64":""}function D_(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 z_(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))}function L_(e){switch(M_(e)){case"hex":return D_(e);case"b64":return z_(e)}return null}function U_(e,n){const r=typeof e=="string"?Uh(e):e,a=typeof n=="string"?Uh(n):n;if(r===null||a===null||r.length!==a.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==a[l])return!1;return!0}class Hb{constructor(n,r,a=!0){A(this,"token");A(this,"received");A(this,"ctx");A(this,"requestSubject");A(this,"mux");this.mux=n,this.requestSubject=r,this.received=0,this.token=Ai.next(),a&&(this.ctx=new Error)}}class B_ extends Hb{constructor(r,a,l={maxWait:1e3}){super(r,a);A(this,"callback");A(this,"done");A(this,"timer");A(this,"max");A(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=At(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(r){r&&this.callback(r,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(r,a){r?(this.ctx&&(r.stack+=`
67
67
 
68
- ${this.ctx.stack}`),this.cancel(r)):(this.callback(null,a),this.opts.strategy===ir.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===ir.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===ir.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class Ib extends Hb{constructor(r,a,l={timeout:1e3},u=!0){super(r,a,u);A(this,"deferred");A(this,"timer");this.deferred=Ct(),this.timer=Wa(l.timeout,u)}resolver(r,a){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
68
+ ${this.ctx.stack}`),this.cancel(r)):(this.callback(null,a),this.opts.strategy===rr.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===rr.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===rr.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class Ib extends Hb{constructor(r,a,l={timeout:1e3},u=!0){super(r,a,u);A(this,"deferred");A(this,"timer");this.deferred=At(),this.timer=Wa(l.timeout,u)}resolver(r,a){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
69
69
 
70
- ${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(a),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||je.errorForCode(Se.Cancelled))}}const P_="$JS.API";function q_(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Ou({apiPrefix:P_,timeout:5e3},e)}class Nl{constructor(n,r){A(this,"nc");A(this,"opts");A(this,"prefix");A(this,"timeout");A(this,"jc");this.nc=n,this.opts=q_(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=ar()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,r=null,a){a=a||{},a.timeout=this.timeout;let l=Mn;r&&(l=this.jc.encode(r));let{retries:u}=a;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=dd();for(let f=0;f<u;f++)try{const m=await this.nc.request(n,l,a);return this.parseJsResponse(m)}catch(m){const d=m;if((d.code==="503"||d.code===Se.Timeout)&&f+1<u)await ss(c.backoff(f));else throw m}}async findStream(n){const r={subject:n},l=await this._request(`${this.prefix}.STREAM.NAMES`,r);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const r=this.jc.decode(n.data),a=r;if(a.error){const l=qb(a.error.code,a.error.description);if(l!==null)throw l.api_error=a.error,l}return r}}class hl{constructor(n,r,a,l){A(this,"err");A(this,"offset");A(this,"pageInfo");A(this,"subject");A(this,"jsm");A(this,"filter");A(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=r,this.payload=l||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const r=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=r;const a=this.countResponse(r);return a===0?[]:(this.offset+=a,this.filter(r))}catch(r){throw this.err=r,r}}countResponse(n){var r,a,l;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((r=n.streams)==null?void 0:r.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((l=n.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const r of n)yield r;n=await this.next()}}}function Wi(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 Bh(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 rt;(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"})(rt||(rt={}));class H_{constructor(n){A(this,"server");A(this,"features");A(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=Wi(n)),this.server=n,this.set(rt.JS_KV,"2.6.2"),this.set(rt.JS_OBJECTSTORE,"2.6.3"),this.set(rt.JS_PULL_MAX_BYTES,"2.8.3"),this.set(rt.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(rt.JS_ALLOW_DIRECT,"2.9.0"),this.set(rt.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(rt.JS_SIMPLIFICATION,"2.9.4"),this.set(rt.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(rt.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(rt.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(rt.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(rt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(rt.JS_STREAM_COMPRESSION,"2.10.0"),this.set(rt.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(rt.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:Bh(this.server,Wi(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=Wi(n)),Bh(this.server,n)>=0}}class vu extends Nl{constructor(n,r){super(n,r)}async add(n,r,a=bu.Create){if(ln(n),r.deliver_group&&r.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(r.deliver_group&&r.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=r,l.stream_name=n,l.action=a,l.config.durable_name&&Ja(l.config.durable_name);const u=this.nc;let{min:c,ok:f}=u.features.get(rt.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{Nu("name",m)}catch(b){const x=b.message,k=x.indexOf("cannot contain");throw k!==-1?new Error(`consumer 'name' ${x.substring(k)}`):b}let d,y="";if(Array.isArray(r.filter_subjects)){const{min:b,ok:x}=u.features.get(rt.JS_MULTIPLE_CONSUMER_FILTER);if(!x)throw new Error(`consumer 'filter_subjects' requires server ${b}`);f=!1}if(r.metadata){const{min:b,ok:x}=u.features.get(rt.JS_STREAM_CONSUMER_METADATA);if(!x)throw new Error(`consumer 'metadata' requires server ${b}`)}if(f&&(y=r.name??r.durable_name??""),y!==""){let b=r.filter_subject??void 0;b===">"&&(b=void 0),d=b!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${y}.${b}`:`${this.prefix}.CONSUMER.CREATE.${n}.${y}`}else d=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(d,l)}async update(n,r,a){const l=await this.info(n,r),u=a;return this.add(n,Object.assign(l.config,u),bu.Update)}async info(n,r){return ln(n),Ja(r),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${r}`)}async delete(n,r){return ln(n),Ja(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${r}`)).success}list(n){ln(n);const r=l=>l.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new hl(a,r,this)}pause(n,r,a){const l=`${this.prefix}.CONSUMER.PAUSE.${n}.${r}`,u={pause_until:a.toISOString()};return this._request(l,u)}resume(n,r){return this.pause(n,r,new Date(0))}}function qa(e,n,r=!1){if(r===!0&&!e)throw je.errorForCode(Se.ApiError,new Error(`${n} is not a function`));if(e&&typeof e!="function")throw je.errorForCode(Se.ApiError,new Error(`${n} is not a function`))}class I_ extends Vt{constructor(r,a,l){super();A(this,"sub");A(this,"adapter");A(this,"subIterDone");qa(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&qa(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(qa(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(qa(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(qa(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&qa(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,b)=>{const[x,k]=this.adapter(g,b);if(x){y(x,null);return}const{ingest:L}=this.ingestionFilterFn?this.ingestionFilterFn(k,this):{ingest:!0};L&&(!this.protocolFilterFn||this.protocolFilterFn(k))&&(y(x,k),this.dispatchedFn&&k&&this.dispatchedFn(k))}}const{max:c,queue:f,timeout:m}=l,d={queue:f,timeout:m,callback:u};c&&c>0&&(d.max=c),this.sub=r.subscribe(a,d),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=Ct(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async y=>{await y.closed,this.stop()})(this.sub).then().catch()}unsubscribe(r){this.sub.unsubscribe(r)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(r,a){this.sub.cancelTimeout();const[l,u]=this.adapter(r,a);l&&this.stop(l),u&&this.push(u)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let Nn;function F_(e){Nn=e}function Fb(){return Nn!==void 0&&Nn.defaultPort!==void 0?Nn.defaultPort:4222}function ah(){return Nn!==void 0&&Nn.urlParseFn?Nn.urlParseFn:void 0}function $_(){if(!Nn||typeof Nn.factory!="function")throw new Error("transport fn is not set");return Nn.factory()}function Ph(){return Nn!==void 0&&Nn.dnsResolveFn?Nn.dnsResolveFn:void 0}const uu=`\r
71
- `,xu=ts.fromAscii(uu),G_=new Uint8Array(xu)[0],Y_=new Uint8Array(xu)[1];function V_(e){for(let n=0;n<e.length;n++){const r=n+1;if(e.byteLength>r&&e[n]===G_&&e[r]===Y_)return r+1}return 0}function J_(e){const n=V_(e);if(n>0){const a=new Uint8Array(e).slice(0,n);return On.decode(a)}return""}const X_=4,$b=48,Q_=65,K_=97;function Z_(e,n,r,a){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((c,f)=>{l[f]=c}),l[12]=e,l[13]=n,l[14]=r,l[15]=a,l}function qh(e){return W_(e)!==void 0}function W_(e){for(let n=0;n<e.length;n++)switch(e[n]){case".":return Gb(e);case":":return eE(e)}}function Gb(e){const n=new Uint8Array(4);for(let r=0;r<4;r++){if(e.length===0)return;if(r>0){if(e[0]!==".")return;e=e.substring(1)}const{n:a,c:l,ok:u}=tE(e);if(!u||a>255)return;e=e.substring(l),n[r]=a}return Z_(n[0],n[1],n[2],n[3])}function eE(e){const n=new Uint8Array(16);let r=-1;if(e.length>=2&&e[0]===":"&&e[1]===":"&&(r=0,e=e.substring(2),e.length===0))return n;let a=0;for(;a<16;){const{n:l,c:u,ok:c}=nE(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&a!=12||a+4>16)return;const f=Gb(e);if(f===void 0)return;n[a]=f[12],n[a+1]=f[13],n[a+2]=f[14],n[a+3]=f[15],e="",a+=X_;break}if(n[a]=l>>8,n[a+1]=l,a+=2,e=e.substring(u),e.length===0)break;if(e[0]!==":"||e.length==1)return;if(e=e.substring(1),e[0]===":"){if(r>=0)return;if(r=a,e=e.substring(1),e.length===0)break}}if(e.length===0){if(a<16){if(r<0)return;const l=16-a;for(let u=a-1;u>=r;u--)n[u+l]=n[u];for(let u=r+l-1;u>=r;u--)n[u]=0}else if(r>=0)return;return n}}function tE(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)-$b),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 nE(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)-$b;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)n*=16,n+=e.charCodeAt(r)-K_+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)n*=16,n+=e.charCodeAt(r)-Q_+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 rE(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function Hh(e){return!rE(e)}function iE(e){const n="::FFFF:",r=e.toUpperCase().indexOf(n);if(r!==-1&&e.indexOf(".")!==-1){let a=e.substring(r+n.length);return a=a.replace("[",""),a.replace("]","")}return e}function aE(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=iE(e),Hh(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const n=Hh(e)?e.match(/(]:)(\d+)/):e.match(/(:)(\d+)/),r=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=r===80?"https":"http",l=new URL(`${a}://${e}`);l.port=`${r}`;let u=l.hostname;return u.charAt(0)==="["&&(u=u.substring(1,u.length-1)),{listen:l.host,hostname:u,port:r}}class pl{constructor(n,r=!1){A(this,"src");A(this,"listen");A(this,"hostname");A(this,"port");A(this,"didConnect");A(this,"reconnects");A(this,"lastConnect");A(this,"gossiped");A(this,"tlsName");A(this,"resolves");this.src=n,this.tlsName="";const a=aE(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=r}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const r=[];if(qh(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const l of a){const u=this.port===80?"https":"http",c=new URL(`${u}://${Hh(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new pl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return n.randomize&&Bb(r),this.resolves=r,r}}class sE{constructor(n=[],r={}){A(this,"firstSelect");A(this,"servers");A(this,"currentServer");A(this,"tlsName");A(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const a=ah();n&&(n.forEach(l=>{l=a?a(l):l,this.servers.push(new pl(l))}),this.randomize&&(this.servers=Bb(this.servers))),this.servers.length===0&&this.addServer(`${Rh}:${Fb()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();qh(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,r=!1){const a=ah();n=a?a(n):n;const l=new pl(n,r);qh(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const r=this.servers.indexOf(n);this.servers.splice(r,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,r){const a=[];let l=[];const u=ah(),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 pl(m,!0);c.set(m,d)});const f=[];return this.servers.forEach((m,d)=>{const y=m.listen;m.gossiped&&this.currentServer.listen!==y&&c.get(y)===void 0&&f.push(d),c.delete(y)}),f.reverse(),f.forEach(m=>{const d=this.servers.splice(m,1);l=l.concat(d[0].listen)}),c.forEach((m,d)=>{this.servers.push(m),a.push(d)}),{added:a,deleted:l}}}class lE{constructor(){A(this,"baseInbox");A(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${Fr(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const r=n.subject||"";return r.indexOf(this.baseInbox)===0?r.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,r){if(r&&r.permissionContext){if(n)return this.all().forEach(l=>{l.resolver(r,{})}),!0;const a=r.permissionContext;if(a.operation==="publish"){const l=this.all().find(u=>u.requestSubject===a.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(n,r)=>{const a=this.getToken(r);if(a){const l=this.get(a);l&&(n===null&&r.headers&&(n=Pb(r)),l.resolver(n,r))}}}close(){const n=je.errorForCode(Se.Timeout);this.reqs.forEach(r=>{r.resolver(n,{})})}}class oE{constructor(n,r,a){A(this,"ph");A(this,"interval");A(this,"maxOut");A(this,"timer");A(this,"pendings");this.ph=n,this.interval=r,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Va.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=Ct();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 uE extends Error{constructor(n){super(n),this.name="AssertionError"}}function cE(e,n="Assertion failed."){if(!e)throw new uE(n)}const r0=32*1024,sh=2**32-2;function Zo(e,n,r=0){const a=n.byteLength-r;return e.byteLength>a&&(e=e.subarray(0,a)),n.set(e,r),e.byteLength}class lh{constructor(n){A(this,"_buf");A(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){cE(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=Zo(this._buf.subarray(this._off),n);return this._off+=r,r}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(na.encode(n))}write(n){const r=this._grow(n.byteLength);return Zo(n,this._buf,r)}_grow(n){const r=this.length;r===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const l=this.capacity;if(n<=Math.floor(l/2)-r)Zo(this._buf.subarray(this._off),this._buf);else{if(l+n>sh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+n,sh));Zo(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+n,sh)),r}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const r=this._grow(n);this._reslice(r)}readFrom(n){let r=0;const a=new Uint8Array(r0);for(;;){const l=this.capacity-this.length<r0,u=l?a:new Uint8Array(this._buf.buffer,this.length),c=n.read(u);if(c===null)return r;l?this.write(u.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var on;(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"})(on||(on={}));function i0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const fE=48;class a0{constructor(n){A(this,"dispatcher");A(this,"state");A(this,"as");A(this,"drop");A(this,"hdr");A(this,"ma");A(this,"argBuf");A(this,"msgBuf");this.dispatcher=n,this.state=Ae.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let r;for(r=0;r<n.length;r++){const a=n[r];switch(this.state){case Ae.OP_START:switch(a){case Ce.M:case Ce.m:this.state=Ae.OP_M,this.hdr=-1,this.ma=i0();break;case Ce.H:case Ce.h:this.state=Ae.OP_H,this.hdr=0,this.ma=i0();break;case Ce.P:case Ce.p:this.state=Ae.OP_P;break;case Ce.PLUS:this.state=Ae.OP_PLUS;break;case Ce.MINUS:this.state=Ae.OP_MINUS;break;case Ce.I:case Ce.i:this.state=Ae.OP_I;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_H:switch(a){case Ce.M:case Ce.m:this.state=Ae.OP_M;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_M:switch(a){case Ce.S:case Ce.s:this.state=Ae.OP_MS;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MS:switch(a){case Ce.G:case Ce.g:this.state=Ae.OP_MSG;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MSG:switch(a){case Ce.SPACE:case Ce.TAB:this.state=Ae.OP_MSG_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MSG_SPC:switch(a){case Ce.SPACE:case Ce.TAB:continue;default:this.state=Ae.MSG_ARG,this.as=r}break;case Ae.MSG_ARG:switch(a){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=Ae.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case Ae.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:on.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ae.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const u=n.length-r;u<l&&(l=u),l>0?(this.msgBuf.write(n.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(a)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:on.MSG,msg:this.ma,data:n.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ae.MSG_END);break;case Ae.MSG_END:switch(a){case Ce.NL:this.drop=0,this.as=r+1,this.state=Ae.OP_START;break;default:continue}break;case Ae.OP_PLUS:switch(a){case Ce.O:case Ce.o:this.state=Ae.OP_PLUS_O;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PLUS_O:switch(a){case Ce.K:case Ce.k:this.state=Ae.OP_PLUS_OK;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PLUS_OK:switch(a){case Ce.NL:this.dispatcher.push({kind:on.OK}),this.drop=0,this.state=Ae.OP_START;break}break;case Ae.OP_MINUS:switch(a){case Ce.E:case Ce.e:this.state=Ae.OP_MINUS_E;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_E:switch(a){case Ce.R:case Ce.r:this.state=Ae.OP_MINUS_ER;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_ER:switch(a){case Ce.R:case Ce.r:this.state=Ae.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_ERR:switch(a){case Ce.SPACE:case Ce.TAB:this.state=Ae.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_ERR_SPC:switch(a){case Ce.SPACE:case Ce.TAB:continue;default:this.state=Ae.MINUS_ERR_ARG,this.as=r}break;case Ae.MINUS_ERR_ARG:switch(a){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:on.ERR,data:l}),this.drop=0,this.as=r+1,this.state=Ae.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case Ae.OP_P:switch(a){case Ce.I:case Ce.i:this.state=Ae.OP_PI;break;case Ce.O:case Ce.o:this.state=Ae.OP_PO;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PO:switch(a){case Ce.N:case Ce.n:this.state=Ae.OP_PON;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PON:switch(a){case Ce.G:case Ce.g:this.state=Ae.OP_PONG;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PONG:switch(a){case Ce.NL:this.dispatcher.push({kind:on.PONG}),this.drop=0,this.state=Ae.OP_START;break}break;case Ae.OP_PI:switch(a){case Ce.N:case Ce.n:this.state=Ae.OP_PIN;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PIN:switch(a){case Ce.G:case Ce.g:this.state=Ae.OP_PING;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PING:switch(a){case Ce.NL:this.dispatcher.push({kind:on.PING}),this.drop=0,this.state=Ae.OP_START;break}break;case Ae.OP_I:switch(a){case Ce.N:case Ce.n:this.state=Ae.OP_IN;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_IN:switch(a){case Ce.F:case Ce.f:this.state=Ae.OP_INF;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_INF:switch(a){case Ce.O:case Ce.o:this.state=Ae.OP_INFO;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_INFO:switch(a){case Ce.SPACE:case Ce.TAB:this.state=Ae.OP_INFO_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_INFO_SPC:switch(a){case Ce.SPACE:case Ce.TAB:continue;default:this.state=Ae.INFO_ARG,this.as=r}break;case Ae.INFO_ARG:switch(a){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:on.INFO,data:l}),this.drop=0,this.as=r+1,this.state=Ae.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(r))}}(this.state===Ae.MSG_ARG||this.state===Ae.MINUS_ERR_ARG||this.state===Ae.INFO_ARG)&&!this.argBuf&&(this.argBuf=new lh(n.subarray(this.as,r-this.drop))),this.state===Ae.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new lh(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+r);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new lh(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Ce.SPACE:case Ce.TAB:case Ce.CR:case Ce.NL:a>=0&&(r.push(n.subarray(a,l)),a=-1);break;default:a<0&&(a=l)}switch(a>=0&&r.push(n.subarray(a)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${On.decode(n)}`)}processHeaderMsgArgs(n){const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Ce.SPACE:case Ce.TAB:case Ce.CR:case Ce.NL:a>=0&&(r.push(n.subarray(a,l)),a=-1);break;default:a<0&&(a=l)}switch(a>=0&&r.push(n.subarray(a)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let r=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;r=r*10+(n[a]-fE)}return r}}var Ae;(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"})(Ae||(Ae={}));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(E,j){this.hi=E|0,this.lo=j|0},r=function(E){var j,C=new Float64Array(16);if(E)for(j=0;j<E.length;j++)C[j]=E[j];return C},a=function(){throw new Error("no PRNG")},l=new Uint8Array(16),u=new Uint8Array(32);u[0]=9;var c=r(),f=r([1]),m=r([56129,1]),d=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),b=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),x=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function k(E,j){return E<<j|E>>>32-j}function L(E,j){var C=E[j+3]&255;return C=C<<8|E[j+2]&255,C=C<<8|E[j+1]&255,C<<8|E[j+0]&255}function B(E,j){var C=E[j]<<24|E[j+1]<<16|E[j+2]<<8|E[j+3],z=E[j+4]<<24|E[j+5]<<16|E[j+6]<<8|E[j+7];return new n(C,z)}function D(E,j,C){var z;for(z=0;z<4;z++)E[j+z]=C&255,C>>>=8}function $(E,j,C){E[j]=C.hi>>24&255,E[j+1]=C.hi>>16&255,E[j+2]=C.hi>>8&255,E[j+3]=C.hi&255,E[j+4]=C.lo>>24&255,E[j+5]=C.lo>>16&255,E[j+6]=C.lo>>8&255,E[j+7]=C.lo&255}function V(E,j,C,z,H){var Z,me=0;for(Z=0;Z<H;Z++)me|=E[j+Z]^C[z+Z];return(1&me-1>>>8)-1}function se(E,j,C,z){return V(E,j,C,z,16)}function N(E,j,C,z){return V(E,j,C,z,32)}function R(E,j,C,z,H){var Z=new Uint32Array(16),me=new Uint32Array(16),be=new Uint32Array(16),re=new Uint32Array(4),de,Oe,Je;for(de=0;de<4;de++)me[5*de]=L(z,4*de),me[1+de]=L(C,4*de),me[6+de]=L(j,4*de),me[11+de]=L(C,16+4*de);for(de=0;de<16;de++)be[de]=me[de];for(de=0;de<20;de++){for(Oe=0;Oe<4;Oe++){for(Je=0;Je<4;Je++)re[Je]=me[(5*Oe+4*Je)%16];for(re[1]^=k(re[0]+re[3]|0,7),re[2]^=k(re[1]+re[0]|0,9),re[3]^=k(re[2]+re[1]|0,13),re[0]^=k(re[3]+re[2]|0,18),Je=0;Je<4;Je++)Z[4*Oe+(Oe+Je)%4]=re[Je]}for(Je=0;Je<16;Je++)me[Je]=Z[Je]}if(H){for(de=0;de<16;de++)me[de]=me[de]+be[de]|0;for(de=0;de<4;de++)me[5*de]=me[5*de]-L(z,4*de)|0,me[6+de]=me[6+de]-L(j,4*de)|0;for(de=0;de<4;de++)D(E,4*de,me[5*de]),D(E,16+4*de,me[6+de])}else for(de=0;de<16;de++)D(E,4*de,me[de]+be[de]|0)}function G(E,j,C,z){return R(E,j,C,z,!1),0}function J(E,j,C,z){return R(E,j,C,z,!0),0}var Y=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T(E,j,C,z,H,Z,me){var be=new Uint8Array(16),re=new Uint8Array(64),de,Oe;if(!H)return 0;for(Oe=0;Oe<16;Oe++)be[Oe]=0;for(Oe=0;Oe<8;Oe++)be[Oe]=Z[Oe];for(;H>=64;){for(G(re,be,me,Y),Oe=0;Oe<64;Oe++)E[j+Oe]=(C?C[z+Oe]:0)^re[Oe];for(de=1,Oe=8;Oe<16;Oe++)de=de+(be[Oe]&255)|0,be[Oe]=de&255,de>>>=8;H-=64,j+=64,C&&(z+=64)}if(H>0)for(G(re,be,me,Y),Oe=0;Oe<H;Oe++)E[j+Oe]=(C?C[z+Oe]:0)^re[Oe];return 0}function X(E,j,C,z,H){return T(E,j,null,0,C,z,H)}function K(E,j,C,z,H){var Z=new Uint8Array(32);return J(Z,z,H,Y),X(E,j,C,z.subarray(16),Z)}function ye(E,j,C,z,H,Z,me){var be=new Uint8Array(32);return J(be,Z,me,Y),T(E,j,C,z,H,Z.subarray(16),be)}function ue(E,j){var C,z=0;for(C=0;C<17;C++)z=z+(E[C]+j[C]|0)|0,E[C]=z&255,z>>>=8}var q=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function I(E,j,C,z,H,Z){var me,be,re,de,Oe=new Uint32Array(17),Je=new Uint32Array(17),St=new Uint32Array(17),Wt=new Uint32Array(17),Wn=new Uint32Array(17);for(re=0;re<17;re++)Je[re]=St[re]=0;for(re=0;re<16;re++)Je[re]=Z[re];for(Je[3]&=15,Je[4]&=252,Je[7]&=15,Je[8]&=252,Je[11]&=15,Je[12]&=252,Je[15]&=15;H>0;){for(re=0;re<17;re++)Wt[re]=0;for(re=0;re<16&&re<H;++re)Wt[re]=C[z+re];for(Wt[re]=1,z+=re,H-=re,ue(St,Wt),be=0;be<17;be++)for(Oe[be]=0,re=0;re<17;re++)Oe[be]=Oe[be]+St[re]*(re<=be?Je[be-re]:320*Je[be+17-re]|0)|0|0;for(be=0;be<17;be++)St[be]=Oe[be];for(de=0,re=0;re<16;re++)de=de+St[re]|0,St[re]=de&255,de>>>=8;for(de=de+St[16]|0,St[16]=de&3,de=5*(de>>>2)|0,re=0;re<16;re++)de=de+St[re]|0,St[re]=de&255,de>>>=8;de=de+St[16]|0,St[16]=de}for(re=0;re<17;re++)Wn[re]=St[re];for(ue(St,q),me=-(St[16]>>>7)|0,re=0;re<17;re++)St[re]^=me&(Wn[re]^St[re]);for(re=0;re<16;re++)Wt[re]=Z[re+16];for(Wt[16]=0,ue(St,Wt),re=0;re<16;re++)E[j+re]=St[re];return 0}function ae(E,j,C,z,H,Z){var me=new Uint8Array(16);return I(me,0,C,z,H,Z),se(E,j,me,0)}function ge(E,j,C,z,H){var Z;if(C<32)return-1;for(ye(E,0,j,0,C,z,H),I(E,16,E,32,C-32,E),Z=0;Z<16;Z++)E[Z]=0;return 0}function _e(E,j,C,z,H){var Z,me=new Uint8Array(32);if(C<32||(K(me,0,32,z,H),ae(j,16,j,32,C-32,me)!==0))return-1;for(ye(E,0,j,0,C,z,H),Z=0;Z<32;Z++)E[Z]=0;return 0}function O(E,j){var C;for(C=0;C<16;C++)E[C]=j[C]|0}function M(E){var j,C;for(C=0;C<16;C++)E[C]+=65536,j=Math.floor(E[C]/65536),E[(C+1)*(C<15?1:0)]+=j-1+37*(j-1)*(C===15?1:0),E[C]-=j*65536}function W(E,j,C){for(var z,H=~(C-1),Z=0;Z<16;Z++)z=H&(E[Z]^j[Z]),E[Z]^=z,j[Z]^=z}function S(E,j){var C,z,H,Z=r(),me=r();for(C=0;C<16;C++)me[C]=j[C];for(M(me),M(me),M(me),z=0;z<2;z++){for(Z[0]=me[0]-65517,C=1;C<15;C++)Z[C]=me[C]-65535-(Z[C-1]>>16&1),Z[C-1]&=65535;Z[15]=me[15]-32767-(Z[14]>>16&1),H=Z[15]>>16&1,Z[14]&=65535,W(me,Z,1-H)}for(C=0;C<16;C++)E[2*C]=me[C]&255,E[2*C+1]=me[C]>>8}function he(E,j){var C=new Uint8Array(32),z=new Uint8Array(32);return S(C,E),S(z,j),N(C,0,z,0)}function fe(E){var j=new Uint8Array(32);return S(j,E),j[0]&1}function ve(E,j){var C;for(C=0;C<16;C++)E[C]=j[2*C]+(j[2*C+1]<<8);E[15]&=32767}function Te(E,j,C){var z;for(z=0;z<16;z++)E[z]=j[z]+C[z]|0}function ze(E,j,C){var z;for(z=0;z<16;z++)E[z]=j[z]-C[z]|0}function ke(E,j,C){var z,H,Z=new Float64Array(31);for(z=0;z<31;z++)Z[z]=0;for(z=0;z<16;z++)for(H=0;H<16;H++)Z[z+H]+=j[z]*C[H];for(z=0;z<15;z++)Z[z]+=38*Z[z+16];for(z=0;z<16;z++)E[z]=Z[z];M(E),M(E)}function Me(E,j){ke(E,j,j)}function wt(E,j){var C=r(),z;for(z=0;z<16;z++)C[z]=j[z];for(z=253;z>=0;z--)Me(C,C),z!==2&&z!==4&&ke(C,C,j);for(z=0;z<16;z++)E[z]=C[z]}function He(E,j){var C=r(),z;for(z=0;z<16;z++)C[z]=j[z];for(z=250;z>=0;z--)Me(C,C),z!==1&&ke(C,C,j);for(z=0;z<16;z++)E[z]=C[z]}function qe(E,j,C){var z=new Uint8Array(32),H=new Float64Array(80),Z,me,be=r(),re=r(),de=r(),Oe=r(),Je=r(),St=r();for(me=0;me<31;me++)z[me]=j[me];for(z[31]=j[31]&127|64,z[0]&=248,ve(H,C),me=0;me<16;me++)re[me]=H[me],Oe[me]=be[me]=de[me]=0;for(be[0]=Oe[0]=1,me=254;me>=0;--me)Z=z[me>>>3]>>>(me&7)&1,W(be,re,Z),W(de,Oe,Z),Te(Je,be,de),ze(be,be,de),Te(de,re,Oe),ze(re,re,Oe),Me(Oe,Je),Me(St,be),ke(be,de,be),ke(de,re,Je),Te(Je,be,de),ze(be,be,de),Me(re,be),ze(de,Oe,St),ke(be,de,m),Te(be,be,Oe),ke(de,de,be),ke(be,Oe,St),ke(Oe,re,H),Me(re,Je),W(be,re,Z),W(de,Oe,Z);for(me=0;me<16;me++)H[me+16]=be[me],H[me+32]=de[me],H[me+48]=re[me],H[me+64]=Oe[me];var Wt=H.subarray(32),Wn=H.subarray(16);return wt(Wt,Wt),ke(Wn,Wn,Wt),S(E,Wn),0}function nt(E,j){return qe(E,j,u)}function ft(E,j){return a(j,32),nt(E,j)}function Mt(E,j,C){var z=new Uint8Array(32);return qe(z,C,j),J(E,l,z,Y)}var xr=ge,wr=_e;function Ee(E,j,C,z,H,Z){var me=new Uint8Array(32);return Mt(me,H,Z),xr(E,j,C,z,me)}function Ie(E,j,C,z,H,Z){var me=new Uint8Array(32);return Mt(me,H,Z),wr(E,j,C,z,me)}function Be(){var E=0,j=0,C=0,z=0,H=65535,Z,me,be;for(be=0;be<arguments.length;be++)Z=arguments[be].lo,me=arguments[be].hi,E+=Z&H,j+=Z>>>16,C+=me&H,z+=me>>>16;return j+=E>>>16,C+=j>>>16,z+=C>>>16,new n(C&H|z<<16,E&H|j<<16)}function jt(E,j){return new n(E.hi>>>j,E.lo>>>j|E.hi<<32-j)}function Dn(){var E=0,j=0,C;for(C=0;C<arguments.length;C++)E^=arguments[C].lo,j^=arguments[C].hi;return new n(j,E)}function vt(E,j){var C,z,H=32-j;return j<32?(C=E.hi>>>j|E.lo<<H,z=E.lo>>>j|E.hi<<H):j<64&&(C=E.lo>>>j|E.hi<<H,z=E.hi>>>j|E.lo<<H),new n(C,z)}function cs(E,j,C){var z=E.hi&j.hi^~E.hi&C.hi,H=E.lo&j.lo^~E.lo&C.lo;return new n(z,H)}function oe(E,j,C){var z=E.hi&j.hi^E.hi&C.hi^j.hi&C.hi,H=E.lo&j.lo^E.lo&C.lo^j.lo&C.lo;return new n(z,H)}function we(E){return Dn(vt(E,28),vt(E,34),vt(E,39))}function Pe(E){return Dn(vt(E,14),vt(E,18),vt(E,41))}function Ve(E){return Dn(vt(E,1),vt(E,8),jt(E,7))}function it(E){return Dn(vt(E,19),vt(E,61),jt(E,6))}var rn=[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 zn(E,j,C){var z=[],H=[],Z=[],me=[],be,re,de;for(re=0;re<8;re++)z[re]=Z[re]=B(E,8*re);for(var Oe=0;C>=128;){for(re=0;re<16;re++)me[re]=B(j,8*re+Oe);for(re=0;re<80;re++){for(de=0;de<8;de++)H[de]=Z[de];for(be=Be(Z[7],Pe(Z[4]),cs(Z[4],Z[5],Z[6]),rn[re],me[re%16]),H[7]=Be(be,we(Z[0]),oe(Z[0],Z[1],Z[2])),H[3]=Be(H[3],be),de=0;de<8;de++)Z[(de+1)%8]=H[de];if(re%16===15)for(de=0;de<16;de++)me[de]=Be(me[de],me[(de+9)%16],Ve(me[(de+1)%16]),it(me[(de+14)%16]))}for(re=0;re<8;re++)Z[re]=Be(Z[re],z[re]),z[re]=Z[re];Oe+=128,C-=128}for(re=0;re<8;re++)$(E,8*re,z[re]);return C}var Jt=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 pt(E,j,C){var z=new Uint8Array(64),H=new Uint8Array(256),Z,me=C;for(Z=0;Z<64;Z++)z[Z]=Jt[Z];for(zn(z,j,C),C%=128,Z=0;Z<256;Z++)H[Z]=0;for(Z=0;Z<C;Z++)H[Z]=j[me-C+Z];for(H[C]=128,C=256-128*(C<112?1:0),H[C-9]=0,$(H,C-8,new n(me/536870912|0,me<<3)),zn(z,H,C),Z=0;Z<64;Z++)E[Z]=z[Z];return 0}function It(E,j){var C=r(),z=r(),H=r(),Z=r(),me=r(),be=r(),re=r(),de=r(),Oe=r();ze(C,E[1],E[0]),ze(Oe,j[1],j[0]),ke(C,C,Oe),Te(z,E[0],E[1]),Te(Oe,j[0],j[1]),ke(z,z,Oe),ke(H,E[3],j[3]),ke(H,H,y),ke(Z,E[2],j[2]),Te(Z,Z,Z),ze(me,z,C),ze(be,Z,H),Te(re,Z,H),Te(de,z,C),ke(E[0],me,be),ke(E[1],de,re),ke(E[2],re,be),ke(E[3],me,de)}function ot(E,j,C){var z;for(z=0;z<4;z++)W(E[z],j[z],C)}function Ln(E,j){var C=r(),z=r(),H=r();wt(H,j[2]),ke(C,j[0],H),ke(z,j[1],H),S(E,z),E[31]^=fe(C)<<7}function an(E,j,C){var z,H;for(O(E[0],c),O(E[1],f),O(E[2],f),O(E[3],c),H=255;H>=0;--H)z=C[H/8|0]>>(H&7)&1,ot(E,j,z),It(j,E),It(E,E),ot(E,j,z)}function ia(E,j){var C=[r(),r(),r(),r()];O(C[0],g),O(C[1],b),O(C[2],f),ke(C[3],g,b),an(E,C,j)}function Vr(E,j,C){var z=new Uint8Array(64),H=[r(),r(),r(),r()],Z;for(C||a(j,32),pt(z,j,32),z[0]&=248,z[31]&=127,z[31]|=64,ia(H,z),Ln(E,H),Z=0;Z<32;Z++)j[Z+32]=E[Z];return 0}var Sr=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 Jr(E,j){var C,z,H,Z;for(z=63;z>=32;--z){for(C=0,H=z-32,Z=z-12;H<Z;++H)j[H]+=C-16*j[z]*Sr[H-(z-32)],C=Math.floor((j[H]+128)/256),j[H]-=C*256;j[H]+=C,j[z]=0}for(C=0,H=0;H<32;H++)j[H]+=C-(j[31]>>4)*Sr[H],C=j[H]>>8,j[H]&=255;for(H=0;H<32;H++)j[H]-=C*Sr[H];for(z=0;z<32;z++)j[z+1]+=j[z]>>8,E[z]=j[z]&255}function Kn(E){var j=new Float64Array(64),C;for(C=0;C<64;C++)j[C]=E[C];for(C=0;C<64;C++)E[C]=0;Jr(E,j)}function Ni(E,j,C,z){var H=new Uint8Array(64),Z=new Uint8Array(64),me=new Uint8Array(64),be,re,de=new Float64Array(64),Oe=[r(),r(),r(),r()];pt(H,z,32),H[0]&=248,H[31]&=127,H[31]|=64;var Je=C+64;for(be=0;be<C;be++)E[64+be]=j[be];for(be=0;be<32;be++)E[32+be]=H[32+be];for(pt(me,E.subarray(32),C+32),Kn(me),ia(Oe,me),Ln(E,Oe),be=32;be<64;be++)E[be]=z[be];for(pt(Z,E,C+64),Kn(Z),be=0;be<64;be++)de[be]=0;for(be=0;be<32;be++)de[be]=me[be];for(be=0;be<32;be++)for(re=0;re<32;re++)de[be+re]+=Z[be]*H[re];return Jr(E.subarray(32),de),Je}function Ri(E,j){var C=r(),z=r(),H=r(),Z=r(),me=r(),be=r(),re=r();return O(E[2],f),ve(E[1],j),Me(H,E[1]),ke(Z,H,d),ze(H,H,E[2]),Te(Z,E[2],Z),Me(me,Z),Me(be,me),ke(re,be,me),ke(C,re,H),ke(C,C,Z),He(C,C),ke(C,C,H),ke(C,C,Z),ke(C,C,Z),ke(E[0],C,Z),Me(z,E[0]),ke(z,z,Z),he(z,H)&&ke(E[0],E[0],x),Me(z,E[0]),ke(z,z,Z),he(z,H)?-1:(fe(E[0])===j[31]>>7&&ze(E[0],c,E[0]),ke(E[3],E[0],E[1]),0)}function fs(E,j,C,z){var H,Z=new Uint8Array(32),me=new Uint8Array(64),be=[r(),r(),r(),r()],re=[r(),r(),r(),r()];if(C<64||Ri(re,z))return-1;for(H=0;H<C;H++)E[H]=j[H];for(H=0;H<32;H++)E[H+32]=z[H];if(pt(me,E,C),Kn(me),an(be,re,me),ia(re,j.subarray(32)),It(be,re),Ln(Z,be),C-=64,N(j,0,Z,0)){for(H=0;H<C;H++)E[H]=0;return-1}for(H=0;H<C;H++)E[H]=j[H+64];return C}var aa=32,Xr=24,Zn=32,Qr=16,Kr=32,Mi=32,Zr=32,_r=32,Di=32,hs=Xr,Ll=Zn,lr=Qr,gt=64,Ot=32,vn=64,zi=32,ds=64;e.lowlevel={crypto_core_hsalsa20:J,crypto_stream_xor:ye,crypto_stream:K,crypto_stream_salsa20_xor:T,crypto_stream_salsa20:X,crypto_onetimeauth:I,crypto_onetimeauth_verify:ae,crypto_verify_16:se,crypto_verify_32:N,crypto_secretbox:ge,crypto_secretbox_open:_e,crypto_scalarmult:qe,crypto_scalarmult_base:nt,crypto_box_beforenm:Mt,crypto_box_afternm:xr,crypto_box:Ee,crypto_box_open:Ie,crypto_box_keypair:ft,crypto_hash:pt,crypto_sign:Ni,crypto_sign_keypair:Vr,crypto_sign_open:fs,crypto_secretbox_KEYBYTES:aa,crypto_secretbox_NONCEBYTES:Xr,crypto_secretbox_ZEROBYTES:Zn,crypto_secretbox_BOXZEROBYTES:Qr,crypto_scalarmult_BYTES:Kr,crypto_scalarmult_SCALARBYTES:Mi,crypto_box_PUBLICKEYBYTES:Zr,crypto_box_SECRETKEYBYTES:_r,crypto_box_BEFORENMBYTES:Di,crypto_box_NONCEBYTES:hs,crypto_box_ZEROBYTES:Ll,crypto_box_BOXZEROBYTES:lr,crypto_sign_BYTES:gt,crypto_sign_PUBLICKEYBYTES:Ot,crypto_sign_SECRETKEYBYTES:vn,crypto_sign_SEEDBYTES:zi,crypto_hash_BYTES:ds,gf:r,D:d,L:Sr,pack25519:S,unpack25519:ve,M:ke,A:Te,S:Me,Z:ze,pow2523:He,add:It,set25519:O,modL:Jr,scalarmult:an,scalarbase:ia};function Ul(E,j){if(E.length!==aa)throw new Error("bad key size");if(j.length!==Xr)throw new Error("bad nonce size")}function Bl(E,j){if(E.length!==Zr)throw new Error("bad public key size");if(j.length!==_r)throw new Error("bad secret key size")}function Ft(){for(var E=0;E<arguments.length;E++)if(!(arguments[E]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function sa(E){for(var j=0;j<E.length;j++)E[j]=0}e.randomBytes=function(E){var j=new Uint8Array(E);return a(j,E),j},e.secretbox=function(E,j,C){Ft(E,j,C),Ul(C,j);for(var z=new Uint8Array(Zn+E.length),H=new Uint8Array(z.length),Z=0;Z<E.length;Z++)z[Z+Zn]=E[Z];return ge(H,z,z.length,j,C),H.subarray(Qr)},e.secretbox.open=function(E,j,C){Ft(E,j,C),Ul(C,j);for(var z=new Uint8Array(Qr+E.length),H=new Uint8Array(z.length),Z=0;Z<E.length;Z++)z[Z+Qr]=E[Z];return z.length<32||_e(H,z,z.length,j,C)!==0?null:H.subarray(Zn)},e.secretbox.keyLength=aa,e.secretbox.nonceLength=Xr,e.secretbox.overheadLength=Qr,e.scalarMult=function(E,j){if(Ft(E,j),E.length!==Mi)throw new Error("bad n size");if(j.length!==Kr)throw new Error("bad p size");var C=new Uint8Array(Kr);return qe(C,E,j),C},e.scalarMult.base=function(E){if(Ft(E),E.length!==Mi)throw new Error("bad n size");var j=new Uint8Array(Kr);return nt(j,E),j},e.scalarMult.scalarLength=Mi,e.scalarMult.groupElementLength=Kr,e.box=function(E,j,C,z){var H=e.box.before(C,z);return e.secretbox(E,j,H)},e.box.before=function(E,j){Ft(E,j),Bl(E,j);var C=new Uint8Array(Di);return Mt(C,E,j),C},e.box.after=e.secretbox,e.box.open=function(E,j,C,z){var H=e.box.before(C,z);return e.secretbox.open(E,j,H)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var E=new Uint8Array(Zr),j=new Uint8Array(_r);return ft(E,j),{publicKey:E,secretKey:j}},e.box.keyPair.fromSecretKey=function(E){if(Ft(E),E.length!==_r)throw new Error("bad secret key size");var j=new Uint8Array(Zr);return nt(j,E),{publicKey:j,secretKey:new Uint8Array(E)}},e.box.publicKeyLength=Zr,e.box.secretKeyLength=_r,e.box.sharedKeyLength=Di,e.box.nonceLength=hs,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(E,j){if(Ft(E,j),j.length!==vn)throw new Error("bad secret key size");var C=new Uint8Array(gt+E.length);return Ni(C,E,E.length,j),C},e.sign.open=function(E,j){if(Ft(E,j),j.length!==Ot)throw new Error("bad public key size");var C=new Uint8Array(E.length),z=fs(C,E,E.length,j);if(z<0)return null;for(var H=new Uint8Array(z),Z=0;Z<H.length;Z++)H[Z]=C[Z];return H},e.sign.detached=function(E,j){for(var C=e.sign(E,j),z=new Uint8Array(gt),H=0;H<z.length;H++)z[H]=C[H];return z},e.sign.detached.verify=function(E,j,C){if(Ft(E,j,C),j.length!==gt)throw new Error("bad signature size");if(C.length!==Ot)throw new Error("bad public key size");var z=new Uint8Array(gt+E.length),H=new Uint8Array(gt+E.length),Z;for(Z=0;Z<gt;Z++)z[Z]=j[Z];for(Z=0;Z<E.length;Z++)z[Z+gt]=E[Z];return fs(H,z,z.length,C)>=0},e.sign.keyPair=function(){var E=new Uint8Array(Ot),j=new Uint8Array(vn);return Vr(E,j),{publicKey:E,secretKey:j}},e.sign.keyPair.fromSecretKey=function(E){if(Ft(E),E.length!==vn)throw new Error("bad secret key size");for(var j=new Uint8Array(Ot),C=0;C<j.length;C++)j[C]=E[32+C];return{publicKey:j,secretKey:new Uint8Array(E)}},e.sign.keyPair.fromSeed=function(E){if(Ft(E),E.length!==zi)throw new Error("bad seed size");for(var j=new Uint8Array(Ot),C=new Uint8Array(vn),z=0;z<32;z++)C[z]=E[z];return Vr(j,C,!0),{publicKey:j,secretKey:C}},e.sign.publicKeyLength=Ot,e.sign.secretKeyLength=vn,e.sign.seedLength=zi,e.sign.signatureLength=gt,e.hash=function(E){Ft(E);var j=new Uint8Array(ds);return pt(j,E,E.length),j},e.hash.hashLength=ds,e.verify=function(E,j){return Ft(E,j),E.length===0||j.length===0||E.length!==j.length?!1:V(E,0,j,0,E.length)===0},e.setPRNG=function(E){a=E},(function(){var E=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(E&&E.getRandomValues){var j=65536;e.setPRNG(function(C,z){var H,Z=new Uint8Array(z);for(H=0;H<z;H+=j)E.getRandomValues(Z.subarray(H,H+Math.min(z-H,j)));for(H=0;H<z;H++)C[H]=Z[H];sa(Z)})}else typeof require<"u"&&(E=require("crypto"),E&&E.randomBytes&&e.setPRNG(function(C,z){var H,Z=E.randomBytes(z);for(H=0;H<z;H++)C[H]=Z[H];sa(Z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const Wo=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;Wo.sign.keyPair.fromSeed,Wo.sign.detached,Wo.sign.detached.verify,Wo.randomBytes;var s0;(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"})(s0||(s0={}));var l0;(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"})(l0||(l0={}));function hE(e){return n=>{let r={};return e.forEach(a=>{const l=a(n)||{};r=Object.assign(r,l)}),r}}function dE(){return()=>{}}function mE(e,n){return()=>{const r=typeof e=="function"?e():e,a=typeof n=="function"?n():n;return{user:r,pass:a}}}function pE(e){return()=>({auth_token:typeof e=="function"?e():e})}const Yb=120*1e3,gE=2,Vb=2*1e3;function yE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Yb,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Vb,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function bE(e){const n=[];return typeof e.authenticator=="function"&&n.push(e.authenticator),Array.isArray(e.authenticator)&&n.push(...e.authenticator),e.token&&n.push(pE(e.token)),e.user&&n.push(mE(e.user,e.pass)),n.length===0?dE():hE(n)}function vE(e){const n=`${Rh}:${Fb()}`;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",Se.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${Rh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[n]);const r=Ou(yE(),e);if(r.authenticator=bE(r),["reconnectDelayHandler","authenticator"].forEach(a=>{if(r[a]&&typeof r[a]!="function")throw new je(`${a} option should be a function`,Se.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let a=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),r.reconnectTimeWait+a}),r.inboxPrefix)try{Fr(r.inboxPrefix)}catch(a){throw new je(a.message,Se.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof Ph()=="function"),r.resolve&&typeof Ph()!="function")throw new je("'resolve' is not supported on this client",Se.InvalidOption);return r}function xE(e,n){const{proto:r,tls_required:a,tls_available:l}=e;if((r===void 0||r<1)&&n.noEcho)throw new je("noEcho",Se.ServerOptionNotAvailable);const u=a||l||!1;if(n.tls&&!u)throw new je("tls",Se.ServerOptionNotAvailable)}const wE=1024*32,SE=/^INFO\s+([^\r\n]+)\r\n/i,_E=dl(`PONG\r
72
- `),o0=dl(`PING\r
73
- `);class EE{constructor(n,r,a){A(this,"echo");A(this,"no_responders");A(this,"protocol");A(this,"verbose");A(this,"pedantic");A(this,"jwt");A(this,"nkey");A(this,"sig");A(this,"user");A(this,"pass");A(this,"auth_token");A(this,"tls_required");A(this,"name");A(this,"lang");A(this,"version");A(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=r.noEcho?!1:void 0,this.verbose=r.verbose,this.pedantic=r.pedantic,this.tls_required=r.tls?!0:void 0,this.name=r.name;const l=(r&&typeof r.authenticator=="function"?r.authenticator(a):{})||{};Ou(this,l)}}class Jb extends Vt{constructor(r,a,l={}){var c;super();A(this,"sid");A(this,"queue");A(this,"draining");A(this,"max");A(this,"subject");A(this,"drained");A(this,"protocol");A(this,"timer");A(this,"info");A(this,"cleanupFn");A(this,"closed");A(this,"requestSubject");Ou(this,l),this.protocol=r,this.subject=a,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Ct();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=Wa(l.timeout,u),this.timer.then(()=>{this.timer=void 0}).catch(f=>{this.stop(f),this.noIterator&&this.callback(f,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const a=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),u=r.protocolFilterFn?r.protocolFilterFn:()=>!0,c=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(f,m)=>{const{ingest:d}=l(m);d&&u(m)&&(a(f,m),c(m))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,a){this.cancelTimeout(),r?this.stop(r):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(je.errorForCode(Se.ConnectionClosed)):this.isClosed()?Promise.reject(je.errorForCode(Se.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Ct()).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 kE{constructor(){A(this,"mux");A(this,"subs");A(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const r=n.permissionContext,a=this.all();let l;if(r.operation==="subscription"&&(l=a.find(u=>u.subject===r.subject&&u.queue===r.queue)),r.operation==="publish"&&(l=a.find(u=>u.requestSubject===r.subject)),l)return l.callback(n,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class wu{constructor(n,r){A(this,"connected");A(this,"connectedOnce");A(this,"infoReceived");A(this,"info");A(this,"muxSubscriptions");A(this,"options");A(this,"outbound");A(this,"pongs");A(this,"subscriptions");A(this,"transport");A(this,"noMorePublishing");A(this,"connectError");A(this,"publisher");A(this,"_closed");A(this,"closed");A(this,"listeners");A(this,"heartbeats");A(this,"parser");A(this,"outMsgs");A(this,"inMsgs");A(this,"outBytes");A(this,"inBytes");A(this,"pendingLimit");A(this,"lastError");A(this,"abortReconnect");A(this,"whyClosed");A(this,"servers");A(this,"server");A(this,"features");A(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=wE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=r,this.subscriptions=new kE,this.muxSubscriptions=new lE,this.outbound=new ts,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new H_({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new sE(a,{randomize:!n.noRandomize}),this.closed=Ct(),this.parser=new a0(this),this.heartbeats=new oE(this,this.options.pingInterval||Yb,this.options.maxPingOut||gE)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const r=je.errorForCode(Se.Disconnect);r.stack="",n.forEach(a=>{a.reject(r)}),this.parser=new a0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(r=>{r.push(n)})}status(){const n=new Vt;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=Ct();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=r=>{n.reject(r)},this.transport=$_(),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:Va.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Va.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:Ir.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:Ir.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===Se.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(n)}async dial(n){const r=this.prepare();let a;try{a=Wa(this.options.timeout||2e4);const l=this.transport.connect(n,this.options);await Promise.race([l,a]),(async()=>{try{for await(const u of this.transport)this.parser.parse(u)}catch(u){console.log("reader closed",u)}})().then()}catch(l){r.reject(l)}try{await Promise.race([a,r]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw a&&a.cancel(),await this.transport.close(l),l}}async _doDial(n){const{resolve:r}=this.options,a=await n.resolve({fn:Ph(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of a)try{l=null,this.dispatchStatus({type:Va.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():Vb;let a=r;const l=this.selectServer();if(!l||this.abortReconnect)throw n||(this.lastError?this.lastError:je.errorForCode(Se.ConnectionRefused));const u=Date.now();if(l.lastConnect===0||l.lastConnect+r<=u){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(c){if(n=c,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const f=this.options.maxReconnectAttempts||0;f!==-1&&l.reconnects>=f&&this.servers.removeCurrentServer()}}else a=Math.min(a,l.lastConnect+r-u),await ss(a)}}static async connect(n,r){const a=new wu(n,r);return await a.dialLoop(),a}static toError(n){const r=n?n.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const a=new je(n,Se.PermissionsViolation),l=n.match(/(Publish|Subscription) to "(\S+)"/);if(l){a.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const u=n.match(/using queue "(\S+)"/);u&&(a.permissionContext.queue=u[1])}return a}else return r.indexOf("authorization violation")!==-1?new je(n,Se.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new je(n,Se.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new je(n,Se.AccountExpired):r.indexOf("authentication timeout")!==-1?new je(n,Se.AuthenticationTimeout):new je(n,Se.ProtocolError)}processMsg(n,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new pd(n,r,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const r=$y(n),a=wu.toError(r),l={type:Ir.Error,data:a.code};if(a.isPermissionError()){let u=!1;if(a.permissionContext){l.permissionContext=a.permissionContext;const c=this.subscriptions.getMux();u=(c==null?void 0:c.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(u,a),u&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(_E)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const r=JSON.parse($y(n));this.info=r;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Wi(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new EE({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(dl(`CONNECT ${m}${uu}`)),this.transport.send(o0)}catch(f){this._close(f)}}a&&this.dispatchStatus({type:Ir.Update,data:a}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:Ir.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case on.MSG:{const{msg:r,data:a}=n;this.processMsg(r,a);break}case on.OK:break;case on.ERR:this.processError(n.data);break;case on.PING:this.processPing();break;case on.PONG:this.processPong();break;case on.INFO:this.processInfo(n.data);break}}sendCommand(n,...r){const a=this.outbound.length();let l;typeof n=="string"?l=dl(n):l=n,this.outbound.fill(l,...r),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,r=Mn,a){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=na.encode(r);else throw je.errorForCode(Se.BadPayload);let u=l.length;a=a||{},a.reply=a.reply||"";let c=Mn,f=0;if(a.headers){if(this.info&&!this.info.headers)throw new je("headers",Se.ServerOptionNotAvailable);c=a.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw je.errorForCode(Se.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let m;a.headers?(a.reply?m=`HPUB ${n} ${a.reply} ${f} ${u}\r
70
+ ${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(a),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||Oe.errorForCode(Ee.Cancelled))}}const P_="$JS.API";function q_(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),ju({apiPrefix:P_,timeout:5e3},e)}class Nl{constructor(n,r){A(this,"nc");A(this,"opts");A(this,"prefix");A(this,"timeout");A(this,"jc");this.nc=n,this.opts=q_(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=ir()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,r=null,a){a=a||{},a.timeout=this.timeout;let l=Nn;r&&(l=this.jc.encode(r));let{retries:u}=a;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=fd();for(let f=0;f<u;f++)try{const m=await this.nc.request(n,l,a);return this.parseJsResponse(m)}catch(m){const d=m;if((d.code==="503"||d.code===Ee.Timeout)&&f+1<u)await ss(c.backoff(f));else throw m}}async findStream(n){const r={subject:n},l=await this._request(`${this.prefix}.STREAM.NAMES`,r);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const r=this.jc.decode(n.data),a=r;if(a.error){const l=qb(a.error.code,a.error.description);if(l!==null)throw l.api_error=a.error,l}return r}}class hl{constructor(n,r,a,l){A(this,"err");A(this,"offset");A(this,"pageInfo");A(this,"subject");A(this,"jsm");A(this,"filter");A(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=r,this.payload=l||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const r=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=r;const a=this.countResponse(r);return a===0?[]:(this.offset+=a,this.filter(r))}catch(r){throw this.err=r,r}}countResponse(n){var r,a,l;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((r=n.streams)==null?void 0:r.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((l=n.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const r of n)yield r;n=await this.next()}}}function Zi(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 Bh(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 rt;(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"})(rt||(rt={}));class H_{constructor(n){A(this,"server");A(this,"features");A(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=Zi(n)),this.server=n,this.set(rt.JS_KV,"2.6.2"),this.set(rt.JS_OBJECTSTORE,"2.6.3"),this.set(rt.JS_PULL_MAX_BYTES,"2.8.3"),this.set(rt.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(rt.JS_ALLOW_DIRECT,"2.9.0"),this.set(rt.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(rt.JS_SIMPLIFICATION,"2.9.4"),this.set(rt.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(rt.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(rt.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(rt.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(rt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(rt.JS_STREAM_COMPRESSION,"2.10.0"),this.set(rt.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(rt.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:Bh(this.server,Zi(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=Zi(n)),Bh(this.server,n)>=0}}class vu extends Nl{constructor(n,r){super(n,r)}async add(n,r,a=bu.Create){if(an(n),r.deliver_group&&r.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(r.deliver_group&&r.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=r,l.stream_name=n,l.action=a,l.config.durable_name&&Ja(l.config.durable_name);const u=this.nc;let{min:c,ok:f}=u.features.get(rt.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{Nu("name",m)}catch(b){const x=b.message,k=x.indexOf("cannot contain");throw k!==-1?new Error(`consumer 'name' ${x.substring(k)}`):b}let d,y="";if(Array.isArray(r.filter_subjects)){const{min:b,ok:x}=u.features.get(rt.JS_MULTIPLE_CONSUMER_FILTER);if(!x)throw new Error(`consumer 'filter_subjects' requires server ${b}`);f=!1}if(r.metadata){const{min:b,ok:x}=u.features.get(rt.JS_STREAM_CONSUMER_METADATA);if(!x)throw new Error(`consumer 'metadata' requires server ${b}`)}if(f&&(y=r.name??r.durable_name??""),y!==""){let b=r.filter_subject??void 0;b===">"&&(b=void 0),d=b!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${y}.${b}`:`${this.prefix}.CONSUMER.CREATE.${n}.${y}`}else d=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(d,l)}async update(n,r,a){const l=await this.info(n,r),u=a;return this.add(n,Object.assign(l.config,u),bu.Update)}async info(n,r){return an(n),Ja(r),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${r}`)}async delete(n,r){return an(n),Ja(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${r}`)).success}list(n){an(n);const r=l=>l.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new hl(a,r,this)}pause(n,r,a){const l=`${this.prefix}.CONSUMER.PAUSE.${n}.${r}`,u={pause_until:a.toISOString()};return this._request(l,u)}resume(n,r){return this.pause(n,r,new Date(0))}}function qa(e,n,r=!1){if(r===!0&&!e)throw Oe.errorForCode(Ee.ApiError,new Error(`${n} is not a function`));if(e&&typeof e!="function")throw Oe.errorForCode(Ee.ApiError,new Error(`${n} is not a function`))}class I_ extends Gt{constructor(r,a,l){super();A(this,"sub");A(this,"adapter");A(this,"subIterDone");qa(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&qa(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(qa(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(qa(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(qa(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&qa(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,b)=>{const[x,k]=this.adapter(g,b);if(x){y(x,null);return}const{ingest:L}=this.ingestionFilterFn?this.ingestionFilterFn(k,this):{ingest:!0};L&&(!this.protocolFilterFn||this.protocolFilterFn(k))&&(y(x,k),this.dispatchedFn&&k&&this.dispatchedFn(k))}}const{max:c,queue:f,timeout:m}=l,d={queue:f,timeout:m,callback:u};c&&c>0&&(d.max=c),this.sub=r.subscribe(a,d),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=At(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async y=>{await y.closed,this.stop()})(this.sub).then().catch()}unsubscribe(r){this.sub.unsubscribe(r)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(r,a){this.sub.cancelTimeout();const[l,u]=this.adapter(r,a);l&&this.stop(l),u&&this.push(u)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let On;function F_(e){On=e}function Fb(){return On!==void 0&&On.defaultPort!==void 0?On.defaultPort:4222}function ah(){return On!==void 0&&On.urlParseFn?On.urlParseFn:void 0}function $_(){if(!On||typeof On.factory!="function")throw new Error("transport fn is not set");return On.factory()}function Ph(){return On!==void 0&&On.dnsResolveFn?On.dnsResolveFn:void 0}const uu=`\r
71
+ `,xu=ts.fromAscii(uu),G_=new Uint8Array(xu)[0],Y_=new Uint8Array(xu)[1];function V_(e){for(let n=0;n<e.length;n++){const r=n+1;if(e.byteLength>r&&e[n]===G_&&e[r]===Y_)return r+1}return 0}function J_(e){const n=V_(e);if(n>0){const a=new Uint8Array(e).slice(0,n);return Tn.decode(a)}return""}const X_=4,$b=48,Q_=65,K_=97;function Z_(e,n,r,a){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((c,f)=>{l[f]=c}),l[12]=e,l[13]=n,l[14]=r,l[15]=a,l}function qh(e){return W_(e)!==void 0}function W_(e){for(let n=0;n<e.length;n++)switch(e[n]){case".":return Gb(e);case":":return eE(e)}}function Gb(e){const n=new Uint8Array(4);for(let r=0;r<4;r++){if(e.length===0)return;if(r>0){if(e[0]!==".")return;e=e.substring(1)}const{n:a,c:l,ok:u}=tE(e);if(!u||a>255)return;e=e.substring(l),n[r]=a}return Z_(n[0],n[1],n[2],n[3])}function eE(e){const n=new Uint8Array(16);let r=-1;if(e.length>=2&&e[0]===":"&&e[1]===":"&&(r=0,e=e.substring(2),e.length===0))return n;let a=0;for(;a<16;){const{n:l,c:u,ok:c}=nE(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&a!=12||a+4>16)return;const f=Gb(e);if(f===void 0)return;n[a]=f[12],n[a+1]=f[13],n[a+2]=f[14],n[a+3]=f[15],e="",a+=X_;break}if(n[a]=l>>8,n[a+1]=l,a+=2,e=e.substring(u),e.length===0)break;if(e[0]!==":"||e.length==1)return;if(e=e.substring(1),e[0]===":"){if(r>=0)return;if(r=a,e=e.substring(1),e.length===0)break}}if(e.length===0){if(a<16){if(r<0)return;const l=16-a;for(let u=a-1;u>=r;u--)n[u+l]=n[u];for(let u=r+l-1;u>=r;u--)n[u]=0}else if(r>=0)return;return n}}function tE(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)-$b),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 nE(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)-$b;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)n*=16,n+=e.charCodeAt(r)-K_+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)n*=16,n+=e.charCodeAt(r)-Q_+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 rE(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function Hh(e){return!rE(e)}function iE(e){const n="::FFFF:",r=e.toUpperCase().indexOf(n);if(r!==-1&&e.indexOf(".")!==-1){let a=e.substring(r+n.length);return a=a.replace("[",""),a.replace("]","")}return e}function aE(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=iE(e),Hh(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const n=Hh(e)?e.match(/(]:)(\d+)/):e.match(/(:)(\d+)/),r=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=r===80?"https":"http",l=new URL(`${a}://${e}`);l.port=`${r}`;let u=l.hostname;return u.charAt(0)==="["&&(u=u.substring(1,u.length-1)),{listen:l.host,hostname:u,port:r}}class pl{constructor(n,r=!1){A(this,"src");A(this,"listen");A(this,"hostname");A(this,"port");A(this,"didConnect");A(this,"reconnects");A(this,"lastConnect");A(this,"gossiped");A(this,"tlsName");A(this,"resolves");this.src=n,this.tlsName="";const a=aE(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=r}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const r=[];if(qh(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const l of a){const u=this.port===80?"https":"http",c=new URL(`${u}://${Hh(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new pl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return n.randomize&&Bb(r),this.resolves=r,r}}class sE{constructor(n=[],r={}){A(this,"firstSelect");A(this,"servers");A(this,"currentServer");A(this,"tlsName");A(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const a=ah();n&&(n.forEach(l=>{l=a?a(l):l,this.servers.push(new pl(l))}),this.randomize&&(this.servers=Bb(this.servers))),this.servers.length===0&&this.addServer(`${Rh}:${Fb()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();qh(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,r=!1){const a=ah();n=a?a(n):n;const l=new pl(n,r);qh(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const r=this.servers.indexOf(n);this.servers.splice(r,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,r){const a=[];let l=[];const u=ah(),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 pl(m,!0);c.set(m,d)});const f=[];return this.servers.forEach((m,d)=>{const y=m.listen;m.gossiped&&this.currentServer.listen!==y&&c.get(y)===void 0&&f.push(d),c.delete(y)}),f.reverse(),f.forEach(m=>{const d=this.servers.splice(m,1);l=l.concat(d[0].listen)}),c.forEach((m,d)=>{this.servers.push(m),a.push(d)}),{added:a,deleted:l}}}class lE{constructor(){A(this,"baseInbox");A(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${qr(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const r=n.subject||"";return r.indexOf(this.baseInbox)===0?r.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,r){if(r&&r.permissionContext){if(n)return this.all().forEach(l=>{l.resolver(r,{})}),!0;const a=r.permissionContext;if(a.operation==="publish"){const l=this.all().find(u=>u.requestSubject===a.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(n,r)=>{const a=this.getToken(r);if(a){const l=this.get(a);l&&(n===null&&r.headers&&(n=Pb(r)),l.resolver(n,r))}}}close(){const n=Oe.errorForCode(Ee.Timeout);this.reqs.forEach(r=>{r.resolver(n,{})})}}class oE{constructor(n,r,a){A(this,"ph");A(this,"interval");A(this,"maxOut");A(this,"timer");A(this,"pendings");this.ph=n,this.interval=r,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Va.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=At();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 uE extends Error{constructor(n){super(n),this.name="AssertionError"}}function cE(e,n="Assertion failed."){if(!e)throw new uE(n)}const t0=32*1024,sh=2**32-2;function Zo(e,n,r=0){const a=n.byteLength-r;return e.byteLength>a&&(e=e.subarray(0,a)),n.set(e,r),e.byteLength}class lh{constructor(n){A(this,"_buf");A(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){cE(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=Zo(this._buf.subarray(this._off),n);return this._off+=r,r}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(ta.encode(n))}write(n){const r=this._grow(n.byteLength);return Zo(n,this._buf,r)}_grow(n){const r=this.length;r===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const l=this.capacity;if(n<=Math.floor(l/2)-r)Zo(this._buf.subarray(this._off),this._buf);else{if(l+n>sh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+n,sh));Zo(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+n,sh)),r}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const r=this._grow(n);this._reslice(r)}readFrom(n){let r=0;const a=new Uint8Array(t0);for(;;){const l=this.capacity-this.length<t0,u=l?a:new Uint8Array(this._buf.buffer,this.length),c=n.read(u);if(c===null)return r;l?this.write(u.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var sn;(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"})(sn||(sn={}));function n0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const fE=48;class r0{constructor(n){A(this,"dispatcher");A(this,"state");A(this,"as");A(this,"drop");A(this,"hdr");A(this,"ma");A(this,"argBuf");A(this,"msgBuf");this.dispatcher=n,this.state=Ae.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let r;for(r=0;r<n.length;r++){const a=n[r];switch(this.state){case Ae.OP_START:switch(a){case Ce.M:case Ce.m:this.state=Ae.OP_M,this.hdr=-1,this.ma=n0();break;case Ce.H:case Ce.h:this.state=Ae.OP_H,this.hdr=0,this.ma=n0();break;case Ce.P:case Ce.p:this.state=Ae.OP_P;break;case Ce.PLUS:this.state=Ae.OP_PLUS;break;case Ce.MINUS:this.state=Ae.OP_MINUS;break;case Ce.I:case Ce.i:this.state=Ae.OP_I;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_H:switch(a){case Ce.M:case Ce.m:this.state=Ae.OP_M;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_M:switch(a){case Ce.S:case Ce.s:this.state=Ae.OP_MS;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MS:switch(a){case Ce.G:case Ce.g:this.state=Ae.OP_MSG;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MSG:switch(a){case Ce.SPACE:case Ce.TAB:this.state=Ae.OP_MSG_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MSG_SPC:switch(a){case Ce.SPACE:case Ce.TAB:continue;default:this.state=Ae.MSG_ARG,this.as=r}break;case Ae.MSG_ARG:switch(a){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=Ae.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case Ae.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:sn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ae.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const u=n.length-r;u<l&&(l=u),l>0?(this.msgBuf.write(n.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(a)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:sn.MSG,msg:this.ma,data:n.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ae.MSG_END);break;case Ae.MSG_END:switch(a){case Ce.NL:this.drop=0,this.as=r+1,this.state=Ae.OP_START;break;default:continue}break;case Ae.OP_PLUS:switch(a){case Ce.O:case Ce.o:this.state=Ae.OP_PLUS_O;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PLUS_O:switch(a){case Ce.K:case Ce.k:this.state=Ae.OP_PLUS_OK;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PLUS_OK:switch(a){case Ce.NL:this.dispatcher.push({kind:sn.OK}),this.drop=0,this.state=Ae.OP_START;break}break;case Ae.OP_MINUS:switch(a){case Ce.E:case Ce.e:this.state=Ae.OP_MINUS_E;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_E:switch(a){case Ce.R:case Ce.r:this.state=Ae.OP_MINUS_ER;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_ER:switch(a){case Ce.R:case Ce.r:this.state=Ae.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_ERR:switch(a){case Ce.SPACE:case Ce.TAB:this.state=Ae.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_ERR_SPC:switch(a){case Ce.SPACE:case Ce.TAB:continue;default:this.state=Ae.MINUS_ERR_ARG,this.as=r}break;case Ae.MINUS_ERR_ARG:switch(a){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:sn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=Ae.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case Ae.OP_P:switch(a){case Ce.I:case Ce.i:this.state=Ae.OP_PI;break;case Ce.O:case Ce.o:this.state=Ae.OP_PO;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PO:switch(a){case Ce.N:case Ce.n:this.state=Ae.OP_PON;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PON:switch(a){case Ce.G:case Ce.g:this.state=Ae.OP_PONG;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PONG:switch(a){case Ce.NL:this.dispatcher.push({kind:sn.PONG}),this.drop=0,this.state=Ae.OP_START;break}break;case Ae.OP_PI:switch(a){case Ce.N:case Ce.n:this.state=Ae.OP_PIN;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PIN:switch(a){case Ce.G:case Ce.g:this.state=Ae.OP_PING;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PING:switch(a){case Ce.NL:this.dispatcher.push({kind:sn.PING}),this.drop=0,this.state=Ae.OP_START;break}break;case Ae.OP_I:switch(a){case Ce.N:case Ce.n:this.state=Ae.OP_IN;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_IN:switch(a){case Ce.F:case Ce.f:this.state=Ae.OP_INF;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_INF:switch(a){case Ce.O:case Ce.o:this.state=Ae.OP_INFO;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_INFO:switch(a){case Ce.SPACE:case Ce.TAB:this.state=Ae.OP_INFO_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_INFO_SPC:switch(a){case Ce.SPACE:case Ce.TAB:continue;default:this.state=Ae.INFO_ARG,this.as=r}break;case Ae.INFO_ARG:switch(a){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:sn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=Ae.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(r))}}(this.state===Ae.MSG_ARG||this.state===Ae.MINUS_ERR_ARG||this.state===Ae.INFO_ARG)&&!this.argBuf&&(this.argBuf=new lh(n.subarray(this.as,r-this.drop))),this.state===Ae.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new lh(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+r);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new lh(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Ce.SPACE:case Ce.TAB:case Ce.CR:case Ce.NL:a>=0&&(r.push(n.subarray(a,l)),a=-1);break;default:a<0&&(a=l)}switch(a>=0&&r.push(n.subarray(a)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${Tn.decode(n)}`)}processHeaderMsgArgs(n){const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Ce.SPACE:case Ce.TAB:case Ce.CR:case Ce.NL:a>=0&&(r.push(n.subarray(a,l)),a=-1);break;default:a<0&&(a=l)}switch(a>=0&&r.push(n.subarray(a)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let r=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;r=r*10+(n[a]-fE)}return r}}var Ae;(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"})(Ae||(Ae={}));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(E,T){this.hi=E|0,this.lo=T|0},r=function(E){var T,C=new Float64Array(16);if(E)for(T=0;T<E.length;T++)C[T]=E[T];return C},a=function(){throw new Error("no PRNG")},l=new Uint8Array(16),u=new Uint8Array(32);u[0]=9;var c=r(),f=r([1]),m=r([56129,1]),d=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),b=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),x=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function k(E,T){return E<<T|E>>>32-T}function L(E,T){var C=E[T+3]&255;return C=C<<8|E[T+2]&255,C=C<<8|E[T+1]&255,C<<8|E[T+0]&255}function B(E,T){var C=E[T]<<24|E[T+1]<<16|E[T+2]<<8|E[T+3],z=E[T+4]<<24|E[T+5]<<16|E[T+6]<<8|E[T+7];return new n(C,z)}function D(E,T,C){var z;for(z=0;z<4;z++)E[T+z]=C&255,C>>>=8}function F(E,T,C){E[T]=C.hi>>24&255,E[T+1]=C.hi>>16&255,E[T+2]=C.hi>>8&255,E[T+3]=C.hi&255,E[T+4]=C.lo>>24&255,E[T+5]=C.lo>>16&255,E[T+6]=C.lo>>8&255,E[T+7]=C.lo&255}function G(E,T,C,z,I){var Z,me=0;for(Z=0;Z<I;Z++)me|=E[T+Z]^C[z+Z];return(1&me-1>>>8)-1}function se(E,T,C,z){return G(E,T,C,z,16)}function R(E,T,C,z){return G(E,T,C,z,32)}function O(E,T,C,z,I){var Z=new Uint32Array(16),me=new Uint32Array(16),be=new Uint32Array(16),re=new Uint32Array(4),fe,je,Je;for(fe=0;fe<4;fe++)me[5*fe]=L(z,4*fe),me[1+fe]=L(C,4*fe),me[6+fe]=L(T,4*fe),me[11+fe]=L(C,16+4*fe);for(fe=0;fe<16;fe++)be[fe]=me[fe];for(fe=0;fe<20;fe++){for(je=0;je<4;je++){for(Je=0;Je<4;Je++)re[Je]=me[(5*je+4*Je)%16];for(re[1]^=k(re[0]+re[3]|0,7),re[2]^=k(re[1]+re[0]|0,9),re[3]^=k(re[2]+re[1]|0,13),re[0]^=k(re[3]+re[2]|0,18),Je=0;Je<4;Je++)Z[4*je+(je+Je)%4]=re[Je]}for(Je=0;Je<16;Je++)me[Je]=Z[Je]}if(I){for(fe=0;fe<16;fe++)me[fe]=me[fe]+be[fe]|0;for(fe=0;fe<4;fe++)me[5*fe]=me[5*fe]-L(z,4*fe)|0,me[6+fe]=me[6+fe]-L(T,4*fe)|0;for(fe=0;fe<4;fe++)D(E,4*fe,me[5*fe]),D(E,16+4*fe,me[6+fe])}else for(fe=0;fe<16;fe++)D(E,4*fe,me[fe]+be[fe]|0)}function V(E,T,C,z){return O(E,T,C,z,!1),0}function J(E,T,C,z){return O(E,T,C,z,!0),0}var Y=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function j(E,T,C,z,I,Z,me){var be=new Uint8Array(16),re=new Uint8Array(64),fe,je;if(!I)return 0;for(je=0;je<16;je++)be[je]=0;for(je=0;je<8;je++)be[je]=Z[je];for(;I>=64;){for(V(re,be,me,Y),je=0;je<64;je++)E[T+je]=(C?C[z+je]:0)^re[je];for(fe=1,je=8;je<16;je++)fe=fe+(be[je]&255)|0,be[je]=fe&255,fe>>>=8;I-=64,T+=64,C&&(z+=64)}if(I>0)for(V(re,be,me,Y),je=0;je<I;je++)E[T+je]=(C?C[z+je]:0)^re[je];return 0}function K(E,T,C,z,I){return j(E,T,null,0,C,z,I)}function Q(E,T,C,z,I){var Z=new Uint8Array(32);return J(Z,z,I,Y),K(E,T,C,z.subarray(16),Z)}function ye(E,T,C,z,I,Z,me){var be=new Uint8Array(32);return J(be,Z,me,Y),j(E,T,C,z,I,Z.subarray(16),be)}function he(E,T){var C,z=0;for(C=0;C<17;C++)z=z+(E[C]+T[C]|0)|0,E[C]=z&255,z>>>=8}var q=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function H(E,T,C,z,I,Z){var me,be,re,fe,je=new Uint32Array(17),Je=new Uint32Array(17),wt=new Uint32Array(17),Kt=new Uint32Array(17),Zn=new Uint32Array(17);for(re=0;re<17;re++)Je[re]=wt[re]=0;for(re=0;re<16;re++)Je[re]=Z[re];for(Je[3]&=15,Je[4]&=252,Je[7]&=15,Je[8]&=252,Je[11]&=15,Je[12]&=252,Je[15]&=15;I>0;){for(re=0;re<17;re++)Kt[re]=0;for(re=0;re<16&&re<I;++re)Kt[re]=C[z+re];for(Kt[re]=1,z+=re,I-=re,he(wt,Kt),be=0;be<17;be++)for(je[be]=0,re=0;re<17;re++)je[be]=je[be]+wt[re]*(re<=be?Je[be-re]:320*Je[be+17-re]|0)|0|0;for(be=0;be<17;be++)wt[be]=je[be];for(fe=0,re=0;re<16;re++)fe=fe+wt[re]|0,wt[re]=fe&255,fe>>>=8;for(fe=fe+wt[16]|0,wt[16]=fe&3,fe=5*(fe>>>2)|0,re=0;re<16;re++)fe=fe+wt[re]|0,wt[re]=fe&255,fe>>>=8;fe=fe+wt[16]|0,wt[16]=fe}for(re=0;re<17;re++)Zn[re]=wt[re];for(he(wt,q),me=-(wt[16]>>>7)|0,re=0;re<17;re++)wt[re]^=me&(Zn[re]^wt[re]);for(re=0;re<16;re++)Kt[re]=Z[re+16];for(Kt[16]=0,he(wt,Kt),re=0;re<16;re++)E[T+re]=wt[re];return 0}function ie(E,T,C,z,I,Z){var me=new Uint8Array(16);return H(me,0,C,z,I,Z),se(E,T,me,0)}function ge(E,T,C,z,I){var Z;if(C<32)return-1;for(ye(E,0,T,0,C,z,I),H(E,16,E,32,C-32,E),Z=0;Z<16;Z++)E[Z]=0;return 0}function Se(E,T,C,z,I){var Z,me=new Uint8Array(32);if(C<32||(Q(me,0,32,z,I),ie(T,16,T,32,C-32,me)!==0))return-1;for(ye(E,0,T,0,C,z,I),Z=0;Z<32;Z++)E[Z]=0;return 0}function N(E,T){var C;for(C=0;C<16;C++)E[C]=T[C]|0}function M(E){var T,C;for(C=0;C<16;C++)E[C]+=65536,T=Math.floor(E[C]/65536),E[(C+1)*(C<15?1:0)]+=T-1+37*(T-1)*(C===15?1:0),E[C]-=T*65536}function W(E,T,C){for(var z,I=~(C-1),Z=0;Z<16;Z++)z=I&(E[Z]^T[Z]),E[Z]^=z,T[Z]^=z}function _(E,T){var C,z,I,Z=r(),me=r();for(C=0;C<16;C++)me[C]=T[C];for(M(me),M(me),M(me),z=0;z<2;z++){for(Z[0]=me[0]-65517,C=1;C<15;C++)Z[C]=me[C]-65535-(Z[C-1]>>16&1),Z[C-1]&=65535;Z[15]=me[15]-32767-(Z[14]>>16&1),I=Z[15]>>16&1,Z[14]&=65535,W(me,Z,1-I)}for(C=0;C<16;C++)E[2*C]=me[C]&255,E[2*C+1]=me[C]>>8}function de(E,T){var C=new Uint8Array(32),z=new Uint8Array(32);return _(C,E),_(z,T),R(C,0,z,0)}function ue(E){var T=new Uint8Array(32);return _(T,E),T[0]&1}function xe(E,T){var C;for(C=0;C<16;C++)E[C]=T[2*C]+(T[2*C+1]<<8);E[15]&=32767}function Te(E,T,C){var z;for(z=0;z<16;z++)E[z]=T[z]+C[z]|0}function Me(E,T,C){var z;for(z=0;z<16;z++)E[z]=T[z]-C[z]|0}function ke(E,T,C){var z,I,Z=new Float64Array(31);for(z=0;z<31;z++)Z[z]=0;for(z=0;z<16;z++)for(I=0;I<16;I++)Z[z+I]+=T[z]*C[I];for(z=0;z<15;z++)Z[z]+=38*Z[z+16];for(z=0;z<16;z++)E[z]=Z[z];M(E),M(E)}function ze(E,T){ke(E,T,T)}function ft(E,T){var C=r(),z;for(z=0;z<16;z++)C[z]=T[z];for(z=253;z>=0;z--)ze(C,C),z!==2&&z!==4&&ke(C,C,T);for(z=0;z<16;z++)E[z]=C[z]}function He(E,T){var C=r(),z;for(z=0;z<16;z++)C[z]=T[z];for(z=250;z>=0;z--)ze(C,C),z!==1&&ke(C,C,T);for(z=0;z<16;z++)E[z]=C[z]}function qe(E,T,C){var z=new Uint8Array(32),I=new Float64Array(80),Z,me,be=r(),re=r(),fe=r(),je=r(),Je=r(),wt=r();for(me=0;me<31;me++)z[me]=T[me];for(z[31]=T[31]&127|64,z[0]&=248,xe(I,C),me=0;me<16;me++)re[me]=I[me],je[me]=be[me]=fe[me]=0;for(be[0]=je[0]=1,me=254;me>=0;--me)Z=z[me>>>3]>>>(me&7)&1,W(be,re,Z),W(fe,je,Z),Te(Je,be,fe),Me(be,be,fe),Te(fe,re,je),Me(re,re,je),ze(je,Je),ze(wt,be),ke(be,fe,be),ke(fe,re,Je),Te(Je,be,fe),Me(be,be,fe),ze(re,be),Me(fe,je,wt),ke(be,fe,m),Te(be,be,je),ke(fe,fe,be),ke(be,je,wt),ke(je,re,I),ze(re,Je),W(be,re,Z),W(fe,je,Z);for(me=0;me<16;me++)I[me+16]=be[me],I[me+32]=fe[me],I[me+48]=re[me],I[me+64]=je[me];var Kt=I.subarray(32),Zn=I.subarray(16);return ft(Kt,Kt),ke(Zn,Zn,Kt),_(E,Zn),0}function nt(E,T){return qe(E,T,u)}function ve(E,T){return a(T,32),nt(E,T)}function Le(E,T,C){var z=new Uint8Array(32);return qe(z,C,T),J(E,l,z,Y)}var Ie=ge,Tt=Se;function Rn(E,T,C,z,I,Z){var me=new Uint8Array(32);return Le(me,I,Z),Ie(E,T,C,z,me)}function $r(E,T,C,z,I,Z){var me=new Uint8Array(32);return Le(me,I,Z),Tt(E,T,C,z,me)}function Xn(){var E=0,T=0,C=0,z=0,I=65535,Z,me,be;for(be=0;be<arguments.length;be++)Z=arguments[be].lo,me=arguments[be].hi,E+=Z&I,T+=Z>>>16,C+=me&I,z+=me>>>16;return T+=E>>>16,C+=T>>>16,z+=C>>>16,new n(C&I|z<<16,E&I|T<<16)}function ra(E,T){return new n(E.hi>>>T,E.lo>>>T|E.hi<<32-T)}function Gr(){var E=0,T=0,C;for(C=0;C<arguments.length;C++)E^=arguments[C].lo,T^=arguments[C].hi;return new n(T,E)}function vt(E,T){var C,z,I=32-T;return T<32?(C=E.hi>>>T|E.lo<<I,z=E.lo>>>T|E.hi<<I):T<64&&(C=E.lo>>>T|E.hi<<I,z=E.hi>>>T|E.lo<<I),new n(C,z)}function cs(E,T,C){var z=E.hi&T.hi^~E.hi&C.hi,I=E.lo&T.lo^~E.lo&C.lo;return new n(z,I)}function oe(E,T,C){var z=E.hi&T.hi^E.hi&C.hi^T.hi&C.hi,I=E.lo&T.lo^E.lo&C.lo^T.lo&C.lo;return new n(z,I)}function _e(E){return Gr(vt(E,28),vt(E,34),vt(E,39))}function Pe(E){return Gr(vt(E,14),vt(E,18),vt(E,41))}function Ve(E){return Gr(vt(E,1),vt(E,8),ra(E,7))}function it(E){return Gr(vt(E,19),vt(E,61),ra(E,6))}var tn=[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 Mn(E,T,C){var z=[],I=[],Z=[],me=[],be,re,fe;for(re=0;re<8;re++)z[re]=Z[re]=B(E,8*re);for(var je=0;C>=128;){for(re=0;re<16;re++)me[re]=B(T,8*re+je);for(re=0;re<80;re++){for(fe=0;fe<8;fe++)I[fe]=Z[fe];for(be=Xn(Z[7],Pe(Z[4]),cs(Z[4],Z[5],Z[6]),tn[re],me[re%16]),I[7]=Xn(be,_e(Z[0]),oe(Z[0],Z[1],Z[2])),I[3]=Xn(I[3],be),fe=0;fe<8;fe++)Z[(fe+1)%8]=I[fe];if(re%16===15)for(fe=0;fe<16;fe++)me[fe]=Xn(me[fe],me[(fe+9)%16],Ve(me[(fe+1)%16]),it(me[(fe+14)%16]))}for(re=0;re<8;re++)Z[re]=Xn(Z[re],z[re]),z[re]=Z[re];je+=128,C-=128}for(re=0;re<8;re++)F(E,8*re,z[re]);return C}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 pt(E,T,C){var z=new Uint8Array(64),I=new Uint8Array(256),Z,me=C;for(Z=0;Z<64;Z++)z[Z]=Yt[Z];for(Mn(z,T,C),C%=128,Z=0;Z<256;Z++)I[Z]=0;for(Z=0;Z<C;Z++)I[Z]=T[me-C+Z];for(I[C]=128,C=256-128*(C<112?1:0),I[C-9]=0,F(I,C-8,new n(me/536870912|0,me<<3)),Mn(z,I,C),Z=0;Z<64;Z++)E[Z]=z[Z];return 0}function qt(E,T){var C=r(),z=r(),I=r(),Z=r(),me=r(),be=r(),re=r(),fe=r(),je=r();Me(C,E[1],E[0]),Me(je,T[1],T[0]),ke(C,C,je),Te(z,E[0],E[1]),Te(je,T[0],T[1]),ke(z,z,je),ke(I,E[3],T[3]),ke(I,I,y),ke(Z,E[2],T[2]),Te(Z,Z,Z),Me(me,z,C),Me(be,Z,I),Te(re,Z,I),Te(fe,z,C),ke(E[0],me,be),ke(E[1],fe,re),ke(E[2],re,be),ke(E[3],me,fe)}function ot(E,T,C){var z;for(z=0;z<4;z++)W(E[z],T[z],C)}function Dn(E,T){var C=r(),z=r(),I=r();ft(I,T[2]),ke(C,T[0],I),ke(z,T[1],I),_(E,z),E[31]^=ue(C)<<7}function nn(E,T,C){var z,I;for(N(E[0],c),N(E[1],f),N(E[2],f),N(E[3],c),I=255;I>=0;--I)z=C[I/8|0]>>(I&7)&1,ot(E,T,z),qt(T,E),qt(E,E),ot(E,T,z)}function ia(E,T){var C=[r(),r(),r(),r()];N(C[0],g),N(C[1],b),N(C[2],f),ke(C[3],g,b),nn(E,C,T)}function Yr(E,T,C){var z=new Uint8Array(64),I=[r(),r(),r(),r()],Z;for(C||a(T,32),pt(z,T,32),z[0]&=248,z[31]&=127,z[31]|=64,ia(I,z),Dn(E,I),Z=0;Z<32;Z++)T[Z+32]=E[Z];return 0}var vr=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 Vr(E,T){var C,z,I,Z;for(z=63;z>=32;--z){for(C=0,I=z-32,Z=z-12;I<Z;++I)T[I]+=C-16*T[z]*vr[I-(z-32)],C=Math.floor((T[I]+128)/256),T[I]-=C*256;T[I]+=C,T[z]=0}for(C=0,I=0;I<32;I++)T[I]+=C-(T[31]>>4)*vr[I],C=T[I]>>8,T[I]&=255;for(I=0;I<32;I++)T[I]-=C*vr[I];for(z=0;z<32;z++)T[z+1]+=T[z]>>8,E[z]=T[z]&255}function Qn(E){var T=new Float64Array(64),C;for(C=0;C<64;C++)T[C]=E[C];for(C=0;C<64;C++)E[C]=0;Vr(E,T)}function ji(E,T,C,z){var I=new Uint8Array(64),Z=new Uint8Array(64),me=new Uint8Array(64),be,re,fe=new Float64Array(64),je=[r(),r(),r(),r()];pt(I,z,32),I[0]&=248,I[31]&=127,I[31]|=64;var Je=C+64;for(be=0;be<C;be++)E[64+be]=T[be];for(be=0;be<32;be++)E[32+be]=I[32+be];for(pt(me,E.subarray(32),C+32),Qn(me),ia(je,me),Dn(E,je),be=32;be<64;be++)E[be]=z[be];for(pt(Z,E,C+64),Qn(Z),be=0;be<64;be++)fe[be]=0;for(be=0;be<32;be++)fe[be]=me[be];for(be=0;be<32;be++)for(re=0;re<32;re++)fe[be+re]+=Z[be]*I[re];return Vr(E.subarray(32),fe),Je}function Ni(E,T){var C=r(),z=r(),I=r(),Z=r(),me=r(),be=r(),re=r();return N(E[2],f),xe(E[1],T),ze(I,E[1]),ke(Z,I,d),Me(I,I,E[2]),Te(Z,E[2],Z),ze(me,Z),ze(be,me),ke(re,be,me),ke(C,re,I),ke(C,C,Z),He(C,C),ke(C,C,I),ke(C,C,Z),ke(C,C,Z),ke(E[0],C,Z),ze(z,E[0]),ke(z,z,Z),de(z,I)&&ke(E[0],E[0],x),ze(z,E[0]),ke(z,z,Z),de(z,I)?-1:(ue(E[0])===T[31]>>7&&Me(E[0],c,E[0]),ke(E[3],E[0],E[1]),0)}function fs(E,T,C,z){var I,Z=new Uint8Array(32),me=new Uint8Array(64),be=[r(),r(),r(),r()],re=[r(),r(),r(),r()];if(C<64||Ni(re,z))return-1;for(I=0;I<C;I++)E[I]=T[I];for(I=0;I<32;I++)E[I+32]=z[I];if(pt(me,E,C),Qn(me),nn(be,re,me),ia(re,T.subarray(32)),qt(be,re),Dn(Z,be),C-=64,R(T,0,Z,0)){for(I=0;I<C;I++)E[I]=0;return-1}for(I=0;I<C;I++)E[I]=T[I+64];return C}var aa=32,Jr=24,Kn=32,Xr=16,Qr=32,Ri=32,Kr=32,xr=32,Mi=32,hs=Jr,Ll=Kn,sr=Xr,gt=64,Ot=32,yn=64,Di=32,ds=64;e.lowlevel={crypto_core_hsalsa20:J,crypto_stream_xor:ye,crypto_stream:Q,crypto_stream_salsa20_xor:j,crypto_stream_salsa20:K,crypto_onetimeauth:H,crypto_onetimeauth_verify:ie,crypto_verify_16:se,crypto_verify_32:R,crypto_secretbox:ge,crypto_secretbox_open:Se,crypto_scalarmult:qe,crypto_scalarmult_base:nt,crypto_box_beforenm:Le,crypto_box_afternm:Ie,crypto_box:Rn,crypto_box_open:$r,crypto_box_keypair:ve,crypto_hash:pt,crypto_sign:ji,crypto_sign_keypair:Yr,crypto_sign_open:fs,crypto_secretbox_KEYBYTES:aa,crypto_secretbox_NONCEBYTES:Jr,crypto_secretbox_ZEROBYTES:Kn,crypto_secretbox_BOXZEROBYTES:Xr,crypto_scalarmult_BYTES:Qr,crypto_scalarmult_SCALARBYTES:Ri,crypto_box_PUBLICKEYBYTES:Kr,crypto_box_SECRETKEYBYTES:xr,crypto_box_BEFORENMBYTES:Mi,crypto_box_NONCEBYTES:hs,crypto_box_ZEROBYTES:Ll,crypto_box_BOXZEROBYTES:sr,crypto_sign_BYTES:gt,crypto_sign_PUBLICKEYBYTES:Ot,crypto_sign_SECRETKEYBYTES:yn,crypto_sign_SEEDBYTES:Di,crypto_hash_BYTES:ds,gf:r,D:d,L:vr,pack25519:_,unpack25519:xe,M:ke,A:Te,S:ze,Z:Me,pow2523:He,add:qt,set25519:N,modL:Vr,scalarmult:nn,scalarbase:ia};function Ul(E,T){if(E.length!==aa)throw new Error("bad key size");if(T.length!==Jr)throw new Error("bad nonce size")}function Bl(E,T){if(E.length!==Kr)throw new Error("bad public key size");if(T.length!==xr)throw new Error("bad secret key size")}function Ht(){for(var E=0;E<arguments.length;E++)if(!(arguments[E]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function sa(E){for(var T=0;T<E.length;T++)E[T]=0}e.randomBytes=function(E){var T=new Uint8Array(E);return a(T,E),T},e.secretbox=function(E,T,C){Ht(E,T,C),Ul(C,T);for(var z=new Uint8Array(Kn+E.length),I=new Uint8Array(z.length),Z=0;Z<E.length;Z++)z[Z+Kn]=E[Z];return ge(I,z,z.length,T,C),I.subarray(Xr)},e.secretbox.open=function(E,T,C){Ht(E,T,C),Ul(C,T);for(var z=new Uint8Array(Xr+E.length),I=new Uint8Array(z.length),Z=0;Z<E.length;Z++)z[Z+Xr]=E[Z];return z.length<32||Se(I,z,z.length,T,C)!==0?null:I.subarray(Kn)},e.secretbox.keyLength=aa,e.secretbox.nonceLength=Jr,e.secretbox.overheadLength=Xr,e.scalarMult=function(E,T){if(Ht(E,T),E.length!==Ri)throw new Error("bad n size");if(T.length!==Qr)throw new Error("bad p size");var C=new Uint8Array(Qr);return qe(C,E,T),C},e.scalarMult.base=function(E){if(Ht(E),E.length!==Ri)throw new Error("bad n size");var T=new Uint8Array(Qr);return nt(T,E),T},e.scalarMult.scalarLength=Ri,e.scalarMult.groupElementLength=Qr,e.box=function(E,T,C,z){var I=e.box.before(C,z);return e.secretbox(E,T,I)},e.box.before=function(E,T){Ht(E,T),Bl(E,T);var C=new Uint8Array(Mi);return Le(C,E,T),C},e.box.after=e.secretbox,e.box.open=function(E,T,C,z){var I=e.box.before(C,z);return e.secretbox.open(E,T,I)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var E=new Uint8Array(Kr),T=new Uint8Array(xr);return ve(E,T),{publicKey:E,secretKey:T}},e.box.keyPair.fromSecretKey=function(E){if(Ht(E),E.length!==xr)throw new Error("bad secret key size");var T=new Uint8Array(Kr);return nt(T,E),{publicKey:T,secretKey:new Uint8Array(E)}},e.box.publicKeyLength=Kr,e.box.secretKeyLength=xr,e.box.sharedKeyLength=Mi,e.box.nonceLength=hs,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(E,T){if(Ht(E,T),T.length!==yn)throw new Error("bad secret key size");var C=new Uint8Array(gt+E.length);return ji(C,E,E.length,T),C},e.sign.open=function(E,T){if(Ht(E,T),T.length!==Ot)throw new Error("bad public key size");var C=new Uint8Array(E.length),z=fs(C,E,E.length,T);if(z<0)return null;for(var I=new Uint8Array(z),Z=0;Z<I.length;Z++)I[Z]=C[Z];return I},e.sign.detached=function(E,T){for(var C=e.sign(E,T),z=new Uint8Array(gt),I=0;I<z.length;I++)z[I]=C[I];return z},e.sign.detached.verify=function(E,T,C){if(Ht(E,T,C),T.length!==gt)throw new Error("bad signature size");if(C.length!==Ot)throw new Error("bad public key size");var z=new Uint8Array(gt+E.length),I=new Uint8Array(gt+E.length),Z;for(Z=0;Z<gt;Z++)z[Z]=T[Z];for(Z=0;Z<E.length;Z++)z[Z+gt]=E[Z];return fs(I,z,z.length,C)>=0},e.sign.keyPair=function(){var E=new Uint8Array(Ot),T=new Uint8Array(yn);return Yr(E,T),{publicKey:E,secretKey:T}},e.sign.keyPair.fromSecretKey=function(E){if(Ht(E),E.length!==yn)throw new Error("bad secret key size");for(var T=new Uint8Array(Ot),C=0;C<T.length;C++)T[C]=E[32+C];return{publicKey:T,secretKey:new Uint8Array(E)}},e.sign.keyPair.fromSeed=function(E){if(Ht(E),E.length!==Di)throw new Error("bad seed size");for(var T=new Uint8Array(Ot),C=new Uint8Array(yn),z=0;z<32;z++)C[z]=E[z];return Yr(T,C,!0),{publicKey:T,secretKey:C}},e.sign.publicKeyLength=Ot,e.sign.secretKeyLength=yn,e.sign.seedLength=Di,e.sign.signatureLength=gt,e.hash=function(E){Ht(E);var T=new Uint8Array(ds);return pt(T,E,E.length),T},e.hash.hashLength=ds,e.verify=function(E,T){return Ht(E,T),E.length===0||T.length===0||E.length!==T.length?!1:G(E,0,T,0,E.length)===0},e.setPRNG=function(E){a=E},(function(){var E=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(E&&E.getRandomValues){var T=65536;e.setPRNG(function(C,z){var I,Z=new Uint8Array(z);for(I=0;I<z;I+=T)E.getRandomValues(Z.subarray(I,I+Math.min(z-I,T)));for(I=0;I<z;I++)C[I]=Z[I];sa(Z)})}else typeof require<"u"&&(E=require("crypto"),E&&E.randomBytes&&e.setPRNG(function(C,z){var I,Z=E.randomBytes(z);for(I=0;I<z;I++)C[I]=Z[I];sa(Z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const Wo=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;Wo.sign.keyPair.fromSeed,Wo.sign.detached,Wo.sign.detached.verify,Wo.randomBytes;var i0;(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"})(i0||(i0={}));var a0;(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"})(a0||(a0={}));function hE(e){return n=>{let r={};return e.forEach(a=>{const l=a(n)||{};r=Object.assign(r,l)}),r}}function dE(){return()=>{}}function mE(e,n){return()=>{const r=typeof e=="function"?e():e,a=typeof n=="function"?n():n;return{user:r,pass:a}}}function pE(e){return()=>({auth_token:typeof e=="function"?e():e})}const Yb=120*1e3,gE=2,Vb=2*1e3;function yE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Yb,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Vb,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function bE(e){const n=[];return typeof e.authenticator=="function"&&n.push(e.authenticator),Array.isArray(e.authenticator)&&n.push(...e.authenticator),e.token&&n.push(pE(e.token)),e.user&&n.push(mE(e.user,e.pass)),n.length===0?dE():hE(n)}function vE(e){const n=`${Rh}:${Fb()}`;if(e=e||{servers:[n]},e.servers=e.servers||[],typeof e.servers=="string"&&(e.servers=[e.servers]),e.servers.length>0&&e.port)throw new Oe("port and servers options are mutually exclusive",Ee.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${Rh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[n]);const r=ju(yE(),e);if(r.authenticator=bE(r),["reconnectDelayHandler","authenticator"].forEach(a=>{if(r[a]&&typeof r[a]!="function")throw new Oe(`${a} option should be a function`,Ee.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let a=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),r.reconnectTimeWait+a}),r.inboxPrefix)try{qr(r.inboxPrefix)}catch(a){throw new Oe(a.message,Ee.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof Ph()=="function"),r.resolve&&typeof Ph()!="function")throw new Oe("'resolve' is not supported on this client",Ee.InvalidOption);return r}function xE(e,n){const{proto:r,tls_required:a,tls_available:l}=e;if((r===void 0||r<1)&&n.noEcho)throw new Oe("noEcho",Ee.ServerOptionNotAvailable);const u=a||l||!1;if(n.tls&&!u)throw new Oe("tls",Ee.ServerOptionNotAvailable)}const wE=1024*32,SE=/^INFO\s+([^\r\n]+)\r\n/i,_E=dl(`PONG\r
72
+ `),s0=dl(`PING\r
73
+ `);class EE{constructor(n,r,a){A(this,"echo");A(this,"no_responders");A(this,"protocol");A(this,"verbose");A(this,"pedantic");A(this,"jwt");A(this,"nkey");A(this,"sig");A(this,"user");A(this,"pass");A(this,"auth_token");A(this,"tls_required");A(this,"name");A(this,"lang");A(this,"version");A(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=r.noEcho?!1:void 0,this.verbose=r.verbose,this.pedantic=r.pedantic,this.tls_required=r.tls?!0:void 0,this.name=r.name;const l=(r&&typeof r.authenticator=="function"?r.authenticator(a):{})||{};ju(this,l)}}class Jb extends Gt{constructor(r,a,l={}){var c;super();A(this,"sid");A(this,"queue");A(this,"draining");A(this,"max");A(this,"subject");A(this,"drained");A(this,"protocol");A(this,"timer");A(this,"info");A(this,"cleanupFn");A(this,"closed");A(this,"requestSubject");ju(this,l),this.protocol=r,this.subject=a,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=At();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=Wa(l.timeout,u),this.timer.then(()=>{this.timer=void 0}).catch(f=>{this.stop(f),this.noIterator&&this.callback(f,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const a=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),u=r.protocolFilterFn?r.protocolFilterFn:()=>!0,c=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(f,m)=>{const{ingest:d}=l(m);d&&u(m)&&(a(f,m),c(m))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,a){this.cancelTimeout(),r?this.stop(r):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(Oe.errorForCode(Ee.ConnectionClosed)):this.isClosed()?Promise.reject(Oe.errorForCode(Ee.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(At()).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 kE{constructor(){A(this,"mux");A(this,"subs");A(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const r=n.permissionContext,a=this.all();let l;if(r.operation==="subscription"&&(l=a.find(u=>u.subject===r.subject&&u.queue===r.queue)),r.operation==="publish"&&(l=a.find(u=>u.requestSubject===r.subject)),l)return l.callback(n,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class wu{constructor(n,r){A(this,"connected");A(this,"connectedOnce");A(this,"infoReceived");A(this,"info");A(this,"muxSubscriptions");A(this,"options");A(this,"outbound");A(this,"pongs");A(this,"subscriptions");A(this,"transport");A(this,"noMorePublishing");A(this,"connectError");A(this,"publisher");A(this,"_closed");A(this,"closed");A(this,"listeners");A(this,"heartbeats");A(this,"parser");A(this,"outMsgs");A(this,"inMsgs");A(this,"outBytes");A(this,"inBytes");A(this,"pendingLimit");A(this,"lastError");A(this,"abortReconnect");A(this,"whyClosed");A(this,"servers");A(this,"server");A(this,"features");A(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=wE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=r,this.subscriptions=new kE,this.muxSubscriptions=new lE,this.outbound=new ts,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new H_({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new sE(a,{randomize:!n.noRandomize}),this.closed=At(),this.parser=new r0(this),this.heartbeats=new oE(this,this.options.pingInterval||Yb,this.options.maxPingOut||gE)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const r=Oe.errorForCode(Ee.Disconnect);r.stack="",n.forEach(a=>{a.reject(r)}),this.parser=new r0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(r=>{r.push(n)})}status(){const n=new Gt;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=At();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=r=>{n.reject(r)},this.transport=$_(),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:Va.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Va.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:Pr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:Pr.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 a;try{a=Wa(this.options.timeout||2e4);const l=this.transport.connect(n,this.options);await Promise.race([l,a]),(async()=>{try{for await(const u of this.transport)this.parser.parse(u)}catch(u){console.log("reader closed",u)}})().then()}catch(l){r.reject(l)}try{await Promise.race([a,r]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw a&&a.cancel(),await this.transport.close(l),l}}async _doDial(n){const{resolve:r}=this.options,a=await n.resolve({fn:Ph(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of a)try{l=null,this.dispatchStatus({type:Va.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():Vb;let a=r;const l=this.selectServer();if(!l||this.abortReconnect)throw n||(this.lastError?this.lastError:Oe.errorForCode(Ee.ConnectionRefused));const u=Date.now();if(l.lastConnect===0||l.lastConnect+r<=u){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(c){if(n=c,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const f=this.options.maxReconnectAttempts||0;f!==-1&&l.reconnects>=f&&this.servers.removeCurrentServer()}}else a=Math.min(a,l.lastConnect+r-u),await ss(a)}}static async connect(n,r){const a=new wu(n,r);return await a.dialLoop(),a}static toError(n){const r=n?n.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const a=new Oe(n,Ee.PermissionsViolation),l=n.match(/(Publish|Subscription) to "(\S+)"/);if(l){a.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const u=n.match(/using queue "(\S+)"/);u&&(a.permissionContext.queue=u[1])}return a}else return r.indexOf("authorization violation")!==-1?new Oe(n,Ee.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new Oe(n,Ee.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new Oe(n,Ee.AccountExpired):r.indexOf("authentication timeout")!==-1?new Oe(n,Ee.AuthenticationTimeout):new Oe(n,Ee.ProtocolError)}processMsg(n,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new dd(n,r,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const r=Iy(n),a=wu.toError(r),l={type:Pr.Error,data:a.code};if(a.isPermissionError()){let u=!1;if(a.permissionContext){l.permissionContext=a.permissionContext;const c=this.subscriptions.getMux();u=(c==null?void 0:c.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(u,a),u&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(_E)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const r=JSON.parse(Iy(n));this.info=r;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Zi(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new EE({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(dl(`CONNECT ${m}${uu}`)),this.transport.send(s0)}catch(f){this._close(f)}}a&&this.dispatchStatus({type:Pr.Update,data:a}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:Pr.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case sn.MSG:{const{msg:r,data:a}=n;this.processMsg(r,a);break}case sn.OK:break;case sn.ERR:this.processError(n.data);break;case sn.PING:this.processPing();break;case sn.PONG:this.processPong();break;case sn.INFO:this.processInfo(n.data);break}}sendCommand(n,...r){const a=this.outbound.length();let l;typeof n=="string"?l=dl(n):l=n,this.outbound.fill(l,...r),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,r=Nn,a){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=ta.encode(r);else throw Oe.errorForCode(Ee.BadPayload);let u=l.length;a=a||{},a.reply=a.reply||"";let c=Nn,f=0;if(a.headers){if(this.info&&!this.info.headers)throw new Oe("headers",Ee.ServerOptionNotAvailable);c=a.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw Oe.errorForCode(Ee.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let m;a.headers?(a.reply?m=`HPUB ${n} ${a.reply} ${f} ${u}\r
74
74
  `:m=`HPUB ${n} ${f} ${u}\r
75
75
  `,this.sendCommand(m,c,l,xu)):(a.reply?m=`PUB ${n} ${a.reply} ${u}\r
76
76
  `:m=`PUB ${n} ${u}\r
@@ -78,41 +78,41 @@ ${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(a),this.cance
78
78
  `):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
79
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
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=Ct()),this.pongs.push(n),this.outbound.fill(o0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(r=>{const a=r;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${uu}`):n.push(`SUB ${a.subject} ${a.sid}${uu}`)}),n.length&&this.transport.send(dl(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(r=>{r.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),r=[];return n.forEach(a=>{r.push(a.drain())}),Promise.all(r).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const r=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Jb(this,`${r}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const AE="$SRV";class u0{constructor(n){A(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,r){return this.msg.respond(n,r)}respondError(n,r,a,l){var u,c;return l=l||{},l.headers=l.headers||Gr(),(u=l.headers)==null||u.set(pu,`${n}`),(c=l.headers)==null||c.set(mu,r),this.msg.respond(a,l)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Sl{constructor(n,r="",a=""){A(this,"subject");A(this,"queue");A(this,"srv");r!==""&&TE("service group",r);let l="";if(n instanceof Rl)this.srv=n,l="";else if(n instanceof Sl){const u=n;this.srv=u.srv,a===""&&u.queue!==""&&(a=u.queue),l=u.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=a}calcSubject(n,r=""){return r===""?n:n!==""?`${n}.${r}`:r}addEndpoint(n="",r){r=r||{subject:n};const a=typeof r=="function"?{handler:r,subject:n}:r;fl("endpoint",n);let{subject:l,handler:u,metadata:c,queue:f}=a;l=l||n,f=f||this.queue,CE("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 Sl(this,n,r)}}function CE(e,n){if(n==="")throw new Error(`${e} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);const r=n.split(".");r.forEach((a,l)=>{if(a===">"&&l!==r.length-1)throw new Error(`${e} cannot have internal '>': '${n}'`)})}function TE(e,n){if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${e} name cannot contain internal '>': '${n}'`)})}class Rl{constructor(n,r={name:"",version:""}){A(this,"nc");A(this,"_id");A(this,"config");A(this,"handlers");A(this,"internal");A(this,"_stopped");A(this,"_done");A(this,"started");this.nc=n,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),fl("name",this.config.name),fl("queue",this.config.queue),Wi(this.config.version),this._id=Ci.next(),this.internal=[],this._done=Ct(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,r="",a="",l){const u=l??AE;return r===""&&a===""?`${u}.${n}`:(fl("control subject name",r),a!==""?(fl("control subject id",a),`${u}.${n}.${r}.${a}`):`${u}.${n}.${r}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const r=Gr();if(n instanceof gu){const a=n;r.set(mu,a.message),r.set(pu,`${a.code}`)}else r.set(mu,n.message),r.set(pu,"500");return r}setupHandler(n,r=!1){const a=r?"":n.queue?n.queue:this.config.queue,{name:l,subject:u,handler:c}=n,f=n;f.internal=r,r&&this.internal.push(f),f.stats=new jE(l,u,a),f.queue=a;const m=c?(d,y)=>{if(d){this.close(d);return}const g=Date.now();try{c(d,new u0(y))}catch(b){f.stats.countError(b),y==null||y.respond(Mn,{headers:this.errorToHeader(b)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(u,{callback:m,queue:a}),f.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(d=>{if(!this._stopped){const y=new Error(`required subscription ${n.subject} errored: ${d.message}`);y.stack=d.stack,this.close(y).catch()}}),f}info(){return{type:ml.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:r,metadata:a,name:l,queue:u}=n;return{subject:r,metadata:a,name:l,queue_group:u}})}async stats(){const n=[];for(const r of this.handlers){if(typeof this.config.statsHandler=="function")try{r.stats.data=await this.config.statsHandler(r)}catch(a){r.stats.countError(a)}n.push(r.stats.stats(r.qi))}return{type:ml.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,r){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,r),this._doAddInternalHandler(`${a}-kind`,n,r,this.name),this._doAddInternalHandler(`${a}`,n,r,this.name,this.id)}_doAddInternalHandler(n,r,a,l="",u=""){const c={};c.name=n,c.subject=Rl.controlSubject(r,l,u),c.handler=a,this.setupHandler(c,!0)}start(){const n=ar(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(m=>(f==null||f.respond(n.encode(m)),Promise.resolve())),a=(c,f)=>c?(this.close(c),Promise.reject(c)):(f==null||f.respond(n.encode(this.info())),Promise.resolve()),l=n.encode(this.ping()),u=(c,f)=>c?(this.close(c).then().catch(),Promise.reject(c)):(f.respond(l),Promise.resolve());return this.addInternalHandler(Ei.PING,u),this.addInternalHandler(Ei.STATS,r),this.addInternalHandler(Ei.INFO,a),this.handlers.forEach(c=>{const{subject:f}=c;typeof f=="string"&&c.handler!==null&&this.setupHandler(c)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let r=[];return this.nc.isClosed()||(r=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(r).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:ml.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 Sl(this,n,r)}addEndpoint(n,r){return new Sl(this).addEndpoint(n,r)}_addEndpoint(n){const r=new Vt;r.noIterator=typeof n.handler=="function",r.noIterator||(n.handler=(l,u)=>{l?this.stop(l).catch():r.push(new u0(u))},r.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=r,this.handlers.push(a),r}}class jE{constructor(n,r,a=""){A(this,"name");A(this,"subject");A(this,"average_processing_time");A(this,"num_requests");A(this,"processing_time");A(this,"num_errors");A(this,"last_error");A(this,"data");A(this,"metadata");A(this,"queue");this.name=n,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const r=n;r&&(r.time=0,r.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=At(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:r,average_processing_time:a,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue:d}=this;return{name:n,subject:r,average_processing_time:a,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue_group:d}}stats(n){const r=n;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=At(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 OE{constructor(n,r={strategy:ir.JitterTimer,maxWait:2e3},a){A(this,"nc");A(this,"prefix");A(this,"opts");this.nc=n,this.prefix=a,this.opts=r}ping(n="",r=""){return this.q(Ei.PING,n,r)}stats(n="",r=""){return this.q(Ei.STATS,n,r)}info(n="",r=""){return this.q(Ei.INFO,n,r)}async q(n,r="",a=""){const l=new Vt,u=ar(),c=Rl.controlSubject(n,r,a,this.prefix),f=await this.nc.requestMany(c,Mn,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 Xb(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function NE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Xb(),storage:Lh.File}}const Su="KV-Operation",c0="$KV",RE=/^[-/=.\w]+$/,ME=/^[-/=.>*\w]+$/,DE=/^[-\w]+$/;function zE(e){if(e.startsWith(".")||e.endsWith(".")||!RE.test(e))throw new Error(`invalid key: ${e}`)}function LE(e){if(e.startsWith(".")||e.endsWith(".")||!ME.test(e))throw new Error(`invalid key: ${e}`)}function UE(e){if(e.startsWith(".")||e.endsWith("."))throw new Error(`invalid key: ${e}`);const n=e.split(".");let r=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":r=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${e}`);r=!0;break}return r}function cu(e){if(!DE.test(e))throw new Error(`invalid bucket name: ${e}`)}var dr;(function(e){e.MsgIdHdr="Nats-Msg-Id",e.ExpectedStreamHdr="Nats-Expected-Stream",e.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",e.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",e.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(dr||(dr={}));class _l{constructor(n,r,a){A(this,"js");A(this,"jsm");A(this,"stream");A(this,"bucket");A(this,"direct");A(this,"codec");A(this,"prefix");A(this,"editPrefix");A(this,"useJsPrefix");A(this,"_prefixLen");A(this,"validateKey",zE);A(this,"validateSearchKey",LE);A(this,"hasWildcards",UE);cu(n),this.js=r,this.jsm=a,this.bucket=n,this.prefix=c0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,r,a={}){cu(r);const l=await n.jetstreamManager(),u=new _l(r,n,l);return await u.init(a),u}static async bind(n,r,a={}){const l=await n.jetstreamManager(),u={config:{allow_direct:a.allow_direct}};cu(r);const c=new _l(r,n,l);return u.config.name=a.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=a.codec||Xb(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(n={}){const r=Object.assign(NE(),n);this.codec=r.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=zh.Limits,a.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(a.max_bytes=r.max_bytes),a.max_msg_size=r.maxValueSize,a.storage=r.storage;const l=n.placementCluster??"";if(l&&(n.placement={},n.placement.cluster=l,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const g=Object.assign({},n.mirror);g.name.startsWith(jn)||(g.name=`${jn}${g.name}`),a.mirror=g,a.mirror_direct=!0}else if(n.sources){const g=n.sources.map(b=>{const x=Object.assign({},b),k=x.name.startsWith(jn)?x.name.substring(jn.length):x.name;return x.name.startsWith(jn)||(x.name=`${jn}${x.name}`),!b.external&&k!==this.bucket&&(x.subject_transforms=[{src:`$KV.${k}.>`,dest:`$KV.${this.bucket}.>`}]),x});a.sources=g,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Ti.S2:Ti.None);const u=this.js.nc,c=u.getServerVersion(),f=c?Bh(c,Wi("2.7.2"))>=0:!1;a.discard=f?wl.New:wl.Old;const{ok:m,min:d}=u.features.get(rt.JS_ALLOW_DIRECT);if(!m&&n.allow_direct===!0){const g=c?`${c.major}.${c.minor}.${c.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${g} - requires ${d}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:m,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=r.replicas,r.ttl&&(a.max_age=At(r.ttl)),a.allow_rollup_hdrs=!0;let y;try{y=await this.jsm.streams.info(a.name),!y.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(g){if(g.message==="stream not found")y=await this.jsm.streams.add(a);else throw g}this.initializePrefixes(y)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=n.config;if(r){let a=r.name;if(a.startsWith(jn)&&(a=a.substring(jn.length)),r.external&&r.external.api!==""){const l=r.name.substring(jn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${jn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,r=!1){const a=[];return r?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${c0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const r=[];for(const a of n.split("."))switch(a){case">":case"*":r.push(a);break;default:r.push(this.codec.key.encode(a));break}return r.join(".")}decodeKey(n){const r=[];for(const a of n.split("."))switch(a){case">":case"*":r.push(a);break;default:r.push(this.codec.key.decode(a));break}return r.join(".")}close(){return Promise.resolve()}dataLen(n,r){const a=r&&r.get(cn.MessageSizeHdr)||"";return a!==""?parseInt(a,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 WE(this.bucket,r,n)}async create(n,r){var u;let a;try{const c=await this.put(n,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(a=c,((u=c==null?void 0:c.api_error)==null?void 0:u.err_code)!==10071)return Promise.reject(c)}let l=0;try{const c=await this.get(n);return(c==null?void 0:c.operation)==="DEL"||(c==null?void 0:c.operation)==="PURGE"?(l=c!==null?c.revision:0,this.update(n,r,l)):Promise.reject(a)}catch(c){return Promise.reject(c)}}update(n,r,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,r,{previousSeq:a})}async put(n,r,a={}){var c,f;const l=this.encodeKey(n);this.validateKey(l);const u={};if(a.previousSeq!==void 0){const m=Gr();u.headers=m,m.set(dr.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,u)).seq}catch(m){const d=m;return d.isJetStreamError()?(d.message=(c=d.api_error)==null?void 0:c.description,d.code=`${(f=d.api_error)==null?void 0:f.code}`,Promise.reject(d)):Promise.reject(m)}}async get(n,r){const a=this.encodeKey(n);this.validateKey(a);let l={last_by_subj:this.subjectForKey(a)};r&&r.revision>0&&(l={seq:r.revision});let u;try{this.direct?u=await this.jsm.direct.getMessage(this.bucketName(),l):u=await this.jsm.streams.getMessage(this.bucketName(),l);const c=this.smToEntry(u);return c.key!==a?null:c}catch(c){if(c.code===Se.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=Ct(),a=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const m of l)(m.operation==="DEL"||m.operation==="PURGE")&&a.push(m)})().then(),await r,l.stop();const u=Date.now()-n,c=a.map(m=>{const d=this.subjectForKey(m.key);return m.created.getTime()>=u?this.jsm.streams.purge(this.stream,{filter:d,keep:1}):this.jsm.streams.purge(this.stream,{filter:d,keep:0})}),f=await Promise.all(c);return f.unshift({success:!0,purged:0}),f.reduce((m,d)=>(m.purged+=d.purged,m))}async _deleteOrPurge(n,r,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,r,a);const l=await this.keys(n),u=[];for await(const c of l)u.push(this._doDeleteOrPurge(c,r)),u.length===100&&(await Promise.all(u),u.length=0);u.length>0&&await Promise.all(u)}async _doDeleteOrPurge(n,r,a){const l=this.encodeKey(n);this.validateKey(l);const u=Gr();u.set(Su,r),r==="PURGE"&&u.set(cn.RollupHdr,cn.RollupValueSubject),a!=null&&a.previousSeq&&u.set(dr.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),Mn,{headers:u})}_buildCC(n,r,a={}){let u=(Array.isArray(n)?n:[n]).map(m=>{const d=this.encodeKey(m);return this.validateSearchKey(m),this.fullKeyName(d)}),c=Lt.LastPerSubject;r===rr.AllHistory&&(c=Lt.All),r===rr.UpdatesOnly&&(c=Lt.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:Yt.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:At(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const r=n.key??">",a=new Vt,l={};l.headers_only=n.headers_only||!1;let u;u=()=>{a.stop()};let c=0;const f=this._buildCC(r,rr.AllHistory,l),m=f.filter_subject,d=Ai(f);d.bindStream(this.stream),d.orderedConsumer(),d.callback((g,b)=>{if(g){a.stop(g);return}if(b){const x=this.jmToEntry(b);a.push(x),a.received++,(u&&c>0&&a.received>=c||b.info.pending===0)&&(a.push(u),u=void 0)}});const y=await this.js.subscribe(m,d);if(u){const{info:{last:g}}=y,b=g.num_pending+g.delivered.consumer_seq;if(b===0||a.received>=b)try{u()}catch(x){a.stop(x)}finally{u=void 0}else c=b}return a._data=y,a.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}canSetWatcherName(){const r=this.js.nc,{ok:a}=r.features.get(rt.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const r=n.key??">",a=new Vt,l={};l.headers_only=n.headers_only||!1;let u=rr.LastValue;n.include===rr.AllHistory?u=rr.AllHistory:n.include===rr.UpdatesOnly&&(u=rr.UpdatesOnly);const c=n.ignoreDeletes===!0;let f=n.initializedFn,m=0;const d=this._buildCC(r,u,l),y=d.filter_subject,g=Ai(d);this.canSetWatcherName()&&g.consumerName(Ci.next()),g.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&g.startSequence(n.resumeFromRevision),g.orderedConsumer(),g.callback((x,k)=>{if(x){a.stop(x);return}if(k){const L=this.jmToEntry(k);if(c&&L.operation==="DEL")return;a.push(L),a.received++,f&&(m>0&&a.received>=m||k.info.pending===0)&&(a.push(f),f=void 0)}});const b=await this.js.subscribe(y,g);if(f){const{info:{last:x}}=b,k=x.num_pending+x.delivered.consumer_seq;if(k===0||a.received>=k)try{f()}catch(L){a.stop(L)}finally{f=void 0}else m=k}return a._data=b,a.iterClosed.then(()=>{b.unsubscribe()}),b.closed.then(()=>{a.stop()}).catch(x=>{a.stop(x)}),a}async keys(n=">"){const r=new Vt,a=this._buildCC(n,rr.LastValue,{headers_only:!0}),l=Array.isArray(n)?">":a.filter_subject,u=Ai(a);u.bindStream(this.stream),u.orderedConsumer();const c=await this.js.subscribe(l,u);return(async()=>{var m;for await(const d of c){const y=(m=d.headers)==null?void 0:m.get(Su);if(y!=="DEL"&&y!=="PURGE"){const g=this.decodeKey(d.subject.substring(this.prefixLen));r.push(g)}d.info.pending===0&&c.unsubscribe()}})().then(()=>{r.stop()}).catch(m=>{r.stop(m)}),c.info.last.num_pending===0&&c.unsubscribe(),r}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var u;const r=((u=this.js.nc.info)==null?void 0:u.cluster)??"",a=this.bucketName(),l=await this.jsm.streams.info(a);return new Qb(l,r)}}class Qb{constructor(n,r=""){A(this,"si");A(this,"cluster");this.si=n,this.cluster=r}get bucket(){return this.si.config.name.startsWith(jn)?this.si.config.name.substring(jn.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return md(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Ti.None:!1}}const yd="OBJ_",f0="SHA-256=";function BE(e){return cu(e),`${yd}${e}`}function PE(e){return e.startsWith(yd)?e.substring(4):e}class Ih{constructor(n){A(this,"si");A(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return PE(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!==Ti.None:!1}}function eu(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 Vn;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(Vn||(Vn={}));var mr;(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"})(mr||(mr={}));var Ka;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(Ka||(Ka={}));const h0=Uint8Array.of(43,65,67,75),qE=Uint8Array.of(45,78,65,75),al=Uint8Array.of(43,87,80,73),HE=Uint8Array.of(43,78,88,84),IE=Uint8Array.of(43,84,69,82,77),FE=Uint8Array.of(32);function El(e,n=5e3){return new s2(e,n)}class oh extends Vt{constructor(r,a,l=!1){super();A(this,"consumer");A(this,"opts");A(this,"sub");A(this,"monitor");A(this,"pending");A(this,"inbox");A(this,"refilling");A(this,"pong");A(this,"callback");A(this,"timeout");A(this,"cleanupHandler");A(this,"listeners");A(this,"statusIterator");A(this,"forOrderedConsumer");A(this,"resetHandler");A(this,"abortOnMissingResource");A(this,"bind");A(this,"inBackOff");this.consumer=r;const u=a;this.opts=this.parseOptions(a,l),this.callback=u.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=Fr(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=u.abort_on_missing_resource===!0,this.bind=u.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:a,idle_heartbeat:l,threshold_bytes:u,threshold_messages:c}=this.opts;this.closed().then(m=>{if(this.cleanupHandler)try{this.cleanupHandler(m)}catch{}});const{sub:f}=this;f&&f.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(m,d)=>{var g,b,x,k;if(m){this.stop(m);return}if((g=this.monitor)==null||g.work(),d.subject===this.inbox){if(Dh(d))return;const L=(b=d.headers)==null?void 0:b.code,B=((k=(x=d.headers)==null?void 0:x.description)==null?void 0:k.toLowerCase())||"unknown",{msgsLeft:D,bytesLeft:$}=this.parseDiscard(d.headers);if(D>0||$>0)this.pending.msgs-=D,this.pending.bytes-=$,this.pending.requests--,this.notify(Ka.Discard,{msgsLeft:D,bytesLeft:$});else if(L===400){this.stop(new je(B,`${L}`));return}else if(L===409&&B==="consumer deleted"){if(this.notify(mr.ConsumerDeleted,`${L} ${B}`),!this.refilling||this.abortOnMissingResource){const V=new je(B,`${L}`);this.stop(V);return}}else if(L===503){if(this.notify(mr.NoResponders,`${L} No Responders`),!this.refilling||this.abortOnMissingResource){const V=new je("no responders",`${L}`);this.stop(V);return}}else this.notify(Ka.DebugEvent,`${L} ${B}`)}else this._push(El(d,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=d.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=c||a&&this.pending.bytes<=u){const L=this.pullOptions();this.pull(L)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new gd(l,m=>(this.notify(mr.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 Ir.Disconnect:(d=this.monitor)==null||d.cancel();break;case Ir.Reconnect:this.resetPending().then(g=>{var b;g&&((b=this.monitor)==null||b.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const a=typeof r=="function"?r:null;try{a?a():this.callback(r)}catch(l){this.stop(l)}}}notify(r,a){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let r=0,a=0;const l=dd([this.opts.expires]);let u=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,r=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(c){if(c.message==="stream not found"){if(a++,this.notify(mr.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(mr.ConsumerNotFound,r),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(c),!1;if(this.forOrderedConsumer)return!1}else r=0,a=0;this.inBackOff=!0;const f=l.backoff(u),m=ss(f);await Promise.race([m,this.consumer.api.nc.closed()]),m.cancel(),u++}}}pull(r){this.pending.bytes+=r.max_bytes??0,this.pending.msgs+=r.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(r),{reply:this.inbox}),this.notify(Ka.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,l=At(this.opts.idle_heartbeat),u=At(this.opts.expires);return{batch:r,max_bytes:a,idle_heartbeat:l,expires:u}}parseDiscard(r){const a={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(cn.PendingMessagesHdr);l&&(a.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(cn.PendingBytesHdr);return u&&(a.bytesLeft=parseInt(u)),a}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,a;(r=this.monitor)==null||r.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var a,l;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(u=>{u.stop()})}))}parseOptions(r,a=!1){const l=r||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,a){const u=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||u;const c=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||c}return l}status(){const r=new Vt;return this.listeners.push(r),Promise.resolve(r)}}class $E extends Vt{constructor(){super();A(this,"src");A(this,"listeners");this.listeners=[]}setSource(r){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=r,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const l of a)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,a){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:a})})}stop(r){var a;this.done||((a=this.src)==null||a.stop(r),super.stop(r),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const r=new Vt;return this.listeners.push(r),Promise.resolve(r)}}class Fh{constructor(n,r){A(this,"api");A(this,"_info");A(this,"stream");A(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 oh(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const r=new oh(this,n,!1),a=Math.round(r.opts.expires*1.05),l=Wa(a);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(n={expires:3e4}){const r=Ct(),a=n;a.max_messages=1;const l=new oh(this,a,!1),u=Math.round(l.opts.expires*1.05);u>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===mr.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=Wa(u);return l.closed().then(f=>{f?r.reject(f):r.resolve(null)}).catch(f=>{r.reject(f)}).finally(()=>{c.cancel()}),c.catch(f=>{r.resolve(null),l.close().catch()}),l.trackTimeout(c),r}delete(){const{stream_name:n,name:r}=this._info;return this.api.delete(n,r)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:r,name:a}=this._info;return this.api.info(r,a).then(l=>(this._info=l,this._info))}}class GE{constructor(n,r,a={}){A(this,"api");A(this,"consumerOpts");A(this,"consumer");A(this,"opts");A(this,"cursor");A(this,"stream");A(this,"namePrefix");A(this,"serial");A(this,"currentConsumer");A(this,"userCallback");A(this,"iter");A(this,"type");A(this,"startSeq");A(this,"maxInitialReset");this.api=n,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ci.next(),typeof a.name_prefix=="string"&&(Nu("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Vn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const r=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:r,deliver_policy:Lt.StartSequence,opt_start_seq:n,ack_policy:Yt.None,inactive_threshold:At(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||Lt.StartSequence,(this.consumerOpts.deliver_policy===Lt.LastPerSubject||this.consumerOpts.deliver_policy===Lt.New||this.consumerOpts.deliver_policy===Lt.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===Lt.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=Lt.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=At(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var c,f,m,d,y;Ci.next();const r=this.serial===0;(c=this.consumer)==null||c.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const l=dd([((f=this.opts)==null?void 0:f.expires)||3e4]);let u;for(let g=0;;g++)try{u=await this.api.add(this.stream,a),(m=this.iter)==null||m.notify(mr.OrderedConsumerRecreated,u.name);break}catch(b){if(b.message==="stream not found"&&((d=this.iter)==null||d.notify(mr.StreamNotFound,g),this.type===Vn.Fetch||this.opts.abort_on_missing_resource===!0))return(y=this.iter)==null||y.stop(b),Promise.reject(b);if(r&&g>=this.maxInitialReset)throw b;await ss(l.backoff(g+1))}return u}internalHandler(n){return r=>{var l;if(this.serial!==n)return;const a=r.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=r.info.streamSequence,this.userCallback?this.userCallback(r):(l=this.iter)==null||l.push(r)}}async reset(n={max_messages:100,expires:3e4},r){var m,d;r=r||{};const a=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===Vn.Fetch&&l){(m=this.iter)==null||m.src.stop(),await((d=this.iter)==null?void 0:d.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new $E),this.consumer=new Fh(this.api,this.currentConsumer);const u=n;u.callback=this.internalHandler(this.serial);let c=null;this.type===Vn.Fetch&&a?c=await this.consumer.fetch(n):this.type===Vn.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(Ka.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===Vn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Vn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=Vn.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===Vn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=Vn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const r=n;if(r.bind)return Promise.reject(new Error("bind is not supported"));r.max_messages=1;const a=Ct();return r.callback=u=>{this.userCallback=null,a.resolve(u)},(await this.fetch(r)).iterClosed.then(u=>{u&&a.reject(u),a.resolve(null)}).catch(u=>{a.reject(u)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class $h{constructor(n){A(this,"api");A(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(rt.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 Fh(this.api,n)}async get(n,r={}){return typeof r=="object"?this.ordered(n,r):(await this.checkVersion(),this.api.info(n,r).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Fh(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,r){await this.checkVersion();const a=this.api;return new bd(a.nc,a.opts).info(n).then(u=>Promise.resolve(new GE(this.api,n,r))).catch(u=>Promise.reject(u))}}class Mu{constructor(n,r){A(this,"api");A(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 Mu(this.api,n)}else return this}info(n=!1,r){return n?Promise.resolve(this._info):this.api.info(this.name,r).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new $h(new vu(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new $h(new vu(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 bd extends Nl{constructor(n,r){super(n,r)}checkStreamConfigVersions(n){const r=this.nc;if(n.metadata){const{min:l,ok:u}=r.features.get(rt.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(rt.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(rt.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(rt.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(rt.JS_DEFAULT_CONSUMER_LIMITS);if(!u)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function a(l,u){var f;if((((f=u==null?void 0:u.subject_transforms)==null?void 0:f.length)||0)>0){const{min:m,ok:d}=r.features.get(rt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!d)throw new Error(`${l} 'subject_transforms' requires server ${m}`)}}n.sources&&n.sources.forEach(l=>{a("stream sources",l)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var l;this.checkStreamConfigVersions(n),ln(n.name),n.mirror=eu(n.mirror),n.sources=(l=n.sources)==null?void 0:l.map(eu);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return ln(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),ln(n);const a=await this.info(n),l=Object.assign(a.config,r);l.mirror=eu(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(eu);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,l);return this._fixInfo(c),c}async info(n,r){ln(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let u=await this._request(a,r),{total:c,limit:f}=u,m=u.state.subjects?Object.getOwnPropertyNames(u.state.subjects).length:1;if(c&&c>m){const d=[u],y=r||{};let g=0;for(;c>m;){g++,y.offset=f*g;const x=await this._request(a,y);c=x.total,d.push(x);const k=Object.getOwnPropertyNames(x.state.subjects).length;if(m+=k,k<f)break}let b={};for(let x=0;x<d.length;x++)u=d[x],u.state.subjects&&(b=Object.assign(b,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=b}return this._fixInfo(u),u}list(n=""){const r=n!=null&&n.length?{subject:n}:{},a=u=>{const c=u;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new hl(l,a,this,r)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,r){if(r){const{keep:l,seq:u}=r;if(typeof l=="number"&&typeof u=="number")throw new Error("can specify one of keep or seq")}return ln(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,r)}async deleteMessage(n,r,a=!0){ln(n);const l={seq:r};return a||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,l)).success}async getMessage(n,r){ln(n);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,r);return new Kb(l)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var m;const u=a.streams.filter(d=>d.config.name.startsWith(jn));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 Qb(d,c))},r=`${this.prefix}.STREAM.LIST`;return new hl(r,n,this)}listObjectStores(){const n=a=>{const u=a.streams.filter(f=>f.config.name.startsWith(yd));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new Ih(f))},r=`${this.prefix}.STREAM.LIST`;return new hl(r,n,this)}names(n=""){const r=n!=null&&n.length?{subject:n}:{},a=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new hl(l,a,this,r)}async get(n){const r=await this.info(n);return Promise.resolve(new Mu(this,r))}}class YE extends Nl{constructor(n,r){super(n,r)}async getMessage(n,r){ln(n);let a=r;const{last_by_subj:l}=a;l&&(a=null);const u=a?this.jc.encode(a):Mn,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=Xa(m);if(d)return Promise.reject(d);const y=new Gh(m);return Promise.resolve(y)}async getBatch(n,r){ln(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 Vt,f=await this.nc.requestMany(l,u,{strategy:ir.SentinelMsg});return(async()=>{var g,b,x;let m=!1,d=!1,y;for await(const k of f){if(!m){m=!0;const L=((g=k.headers)==null?void 0:g.code)||0;if(L!==0&&L<200||L>299){y=(b=k.headers)==null?void 0:b.description.toLowerCase();break}if(((x=k.headers)==null?void 0:x.get("Nats-Num-Pending"))===""){d=!0;break}}if(k.data.length===0)break;c.push(new Gh(k))}c.push(()=>{if(d)throw new Error("batch direct get not supported by the server");if(y)throw new Error(`bad request: ${y}`);c.stop()})})(),Promise.resolve(c)}}class Gh{constructor(n){A(this,"data");A(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(Ya.Subject)}get seq(){const n=this.header.last(Ya.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Ya.TimeStamp)}get stream(){return this.header.last(Ya.Stream)}json(n){return ar(n).decode(this.data)}string(){return On.decode(this.data)}}A(Gh,"jc");class VE extends Nl{constructor(r,a){super(r,a);A(this,"streams");A(this,"consumers");A(this,"direct");this.streams=new bd(r,a),this.consumers=new vu(r,a),this.direct=new YE(r,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new Vt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,l)=>{if(a)throw a;try{const u=this.parseJsResponse(l),c=u.type.split("."),f=c[c.length-1];r.push({kind:f,data:u})}catch(u){r.stop(u)}}}),r}}class Kb{constructor(n){A(this,"_header");A(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):Mn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=ki.decode(n)}else this._header=Gr();return this._header}_parse(n){const r=atob(n),a=r.length,l=new Uint8Array(a);for(let u=0;u<a;u++)l[u]=r.charCodeAt(u);return l}json(n){return ar(n).decode(this.data)}string(){return On.decode(this.data)}}A(Kb,"jc");class JE{constructor(n){A(this,"api");this.api=n}get(n){return this.api.info(n).then(r=>new Mu(this.api,r))}}class uh{constructor(n){A(this,"info");A(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=ki.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 d0(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 XE(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class gl{constructor(n,r,a){A(this,"jsm");A(this,"js");A(this,"stream");A(this,"name");this.name=n,this.jsm=r,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const r=await this.rawInfo(n);return r?new uh(r):null}async list(){const n=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of r){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:r,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const l=this._metaSubject(r);try{const u=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=ar().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 Ih(n)))}async status(n){const r=await this._si(n);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Ih(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,r,a){var se;const l=this.js.getOptions();a=a||{timeout:l.timeout},a.timeout=a.timeout||l.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:u,previousRevision:c}=a,f=this.js.nc.info,m=(f==null?void 0:f.max_payload)||1024;n=n||{},n.options=n.options||{};let d=((se=n.options)==null?void 0:se.max_chunk_size)||128*1024;d=d>m?m:d,n.options.max_chunk_size=d;const y=await this.info(n.name),{name:g,error:b}=this._checkNotEmpty(n.name);if(b)return Promise.reject(b);const x=Ci.next(),k=this._chunkSubject(x),L=this._metaSubject(g),B=Object.assign({bucket:this.name,nuid:x,size:0,chunks:0},d0(n)),D=Ct(),$=[],V=new ts;try{const N=r?r.getReader():null,R=n0.create();for(;;){const{done:G,value:J}=N?await N.read():{done:!0,value:void 0};if(G){if(V.size()>0){const K=V.drain();R.update(K),B.chunks++,B.size+=K.length,$.push(this.js.publish(k,K,{timeout:u}))}await Promise.all($),$.length=0,B.mtime=new Date().toISOString();const Y=Qa.encode(R.digest());B.digest=`${f0}${Y}`,B.deleted=!1;const T=Gr();typeof c=="number"&&T.set(dr.ExpectedLastSubjectSequenceHdr,`${c}`),T.set(cn.RollupHdr,cn.RollupValueSubject);const X=await this.js.publish(L,ar().encode(B),{headers:T,timeout:u});if(B.revision=X.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}D.resolve(new uh(B));break}if(J)for(V.fill(J);V.size()>d;){B.chunks++,B.size+=d;const Y=V.drain(n.options.max_chunk_size);R.update(Y),$.push(this.js.publish(k,Y,{timeout:u}))}}}catch(N){await this.jsm.streams.purge(this.stream,{filter:k}),D.reject(N)}return D}putBlob(n,r,a){function l(u){return new ReadableStream({pull(c){c.enqueue(u),c.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(n,l(r),a)}put(n,r,a){var l;return(l=n==null?void 0:n.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,r,a)}async getBlob(n){async function r(u){const c=new ts,f=u.getReader();for(;;){const{done:m,value:d}=await f.read();if(m)return c.drain();d&&d.length&&c.fill(d)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const l=await Promise.all([a.error,r(a.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(n){const r=await this.rawInfo(n);if(r===null||r.deleted)return Promise.resolve(null);if(r.options&&r.options.link){const g=r.options.link.name||"";if(g==="")throw new Error("link is a bucket");return(r.options.link.bucket!==this.name?await gl.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(f0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const a=Uh(r.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Ct(),u={info:new uh(r),error:l};if(r.size===0)return u.data=XE(),l.resolve(null),Promise.resolve(u);let c;const f=Ai();f.orderedConsumer();const m=n0.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&&(U_(a,m.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${a}`)),y.unsubscribe())})().then(()=>{l.resolve()}).catch(g=>{c.error(g),l.reject(g)}),u.data=new ReadableStream({start(g){c=g},cancel(){y.unsubscribe()}}),u}linkStore(n,r){if(!(r instanceof gl))return Promise.reject("bucket required");const a=r,{name:l,error:u}=this._checkNotEmpty(n);if(u)return Promise.reject(u);const c={name:l,options:{link:{bucket:a.name}}};return this._put(c,null)}async link(n,r){const{name:a,error:l}=this._checkNotEmpty(n);if(l)return Promise.reject(l);if(r.deleted)return Promise.reject(new Error("src object is deleted"));if(r.isLink())return Promise.reject(new Error("src object is a link"));const u=await this.rawInfo(n);if(u!==null&&!u.deleted)return Promise.reject(new Error("an object already exists with that name"));const c={bucket:r.bucket,name:r.name},f={name:a,bucket:r.bucket,options:{link:c}};await this.js.publish(this._metaSubject(n),JSON.stringify(f));const m=await this.info(n);return Promise.resolve(m)}async delete(n){const r=await this.rawInfo(n);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const a=ar(),l=Gr();return l.set(cn.RollupHdr,cn.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),a.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(n,r={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??a.name;const{name:l,error:u}=this._checkNotEmpty(r.name);if(u)return Promise.reject(u);if(n!==r.name){const m=await this.info(r.name);if(m&&!m.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const c=Object.assign({},a,d0(r)),f=await this.js.publish(this._metaSubject(c.name),JSON.stringify(c));return n!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(f)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let r=!1;const a=new Vt,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(m){m.code==="404"?(a.push(null),r=!0):a.stop(m)}const u=ar(),c=Ai();c.orderedConsumer(),n.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((m,d)=>{var y;if(m){a.stop(m);return}if(d!==null){const g=u.decode(d.data);g.deleted&&n.ignoreDeletes===!0||a.push(g),((y=d.info)==null?void 0:y.pending)===0&&!r&&(r=!0,a.push(null))}});const f=await this.js.subscribe(l,c);return a._data=f,a.iterClosed.then(()=>{f.unsubscribe()}),f.closed.then(()=>{a.stop()}).catch(m=>{a.stop(m)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${Qa.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=BE(this.name)}catch(l){return Promise.reject(l)}const r=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:r},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=wl.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Ti.S2:Ti.None);try{await this.jsm.streams.info(a.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,r,a={}){const l=await n.jetstreamManager(),u=new gl(r,l,n);return await u.init(a),Promise.resolve(u)}}class QE{constructor(n){A(this,"js");this.js=n}kv(n,r={}){const a=this.js,{ok:l,min:u}=a.nc.features.get(rt.JS_KV);return l?r.bindOnly?_l.bind(this.js,n,r):_l.create(this.js,n,r):Promise.reject(new Error(`kv is only supported on servers ${u} or better`))}os(n,r={}){var c;if(typeof((c=crypto==null?void 0:crypto.subtle)==null?void 0:c.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:l,min:u}=a.nc.features.get(rt.JS_OBJECTSTORE);return l?gl.create(this.js,n,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class vd extends Nl{constructor(r,a){super(r,a);A(this,"consumers");A(this,"streams");A(this,"consumerAPI");A(this,"streamAPI");this.consumerAPI=new vu(r,a),this.streamAPI=new bd(r,a),this.consumers=new $h(this.consumerAPI),this.streams=new JE(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new QE(this)}async publish(r,a=Mn,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||Gr();l&&(l.msgID&&u.set(dr.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(dr.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(dr.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(dr.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(dr.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=u);let{retries:m,retry_delay:d}=l;m=m||1,d=d||250;let y;for(let b=0;b<m;b++)try{y=await this.nc.request(r,a,f);break}catch(x){if(x.code==="503"&&b+1<m)await ss(d);else throw x}const g=this.parseJsResponse(y);if(g.stream==="")throw je.errorForCode(Se.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,a,l=0){ln(r),Ja(a);let u=this.timeout;l>u&&(u=l),l=l<0?0:At(l);const c={batch:1,no_wait:l===0,expires:l},f=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${a}`,this.jc.encode(c),{noMux:!0,timeout:u}),m=Xa(f);if(m)throw m;return El(f,this.timeout)}fetch(r,a,l={}){ln(r),Ja(a);let u=null;const c=(l.max_bytes??0)>0;let f=0;const m=c?l.max_bytes:0;let d=null;const y={};if(y.batch=l.batch||1,m){const $=this.nc.features.get(rt.JS_PULL_MAX_BYTES);if(!$.ok)throw new Error(`max_bytes is only supported on servers ${$.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=At(g)),g===0&&y.no_wait===!1)throw new Error("expires or no_wait is required");const b=l.idle_heartbeat||0;b&&(y.idle_heartbeat=At(b),l.delay_heartbeat===!0&&(y.idle_heartbeat=At(b*4)));const x=new Vt,k=y.batch;let L=0;x.protocolFilterFn=($,V=!1)=>Dh($.msg)?(d==null||d.work(),!1):!0,x.dispatchedFn=$=>{if($){if(c&&(f+=$.data.length),L++,u&&$.info.pending===0)return;(x.getPending()===1&&$.info.pending===0||k===L||m>0&&f>=m)&&x.stop()}};const B=Fr(this.nc.options.inboxPrefix),D=this.nc.subscribe(B,{max:l.batch,callback:($,V)=>{$===null&&($=Xa(V)),$!==null?(u&&(u.cancel(),u=null),b_($)?x.stop(Wb($)===null?void 0:$):x.stop($)):(d==null||d.work(),x.received++,x.push(El(V,this.timeout)))}});return g&&(u=Wa(g),u.catch(()=>{D.isClosed()||(D.drain().catch(()=>{}),u=null),d&&d.cancel()})),(async()=>{try{b&&(d=new gd(b,$=>(x.push(()=>{x.err=new je(`${Jn.IdleHeartbeatMissed}: ${$}`,Se.JetStreamIdleHeartBeat)}),!0)))}catch{}await D.closed,u!==null&&(u.cancel(),u=null),d&&d.cancel(),x.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${a}`,this.jc.encode(y),{reply:B}),x}async pullSubscribe(r,a=Ai()){const l=await this._processOptions(r,a);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const u=l.config.ack_policy;if(u===Yt.None||u===Yt.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new e2(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(m){throw f.unsubscribe(),m}return f}async subscribe(r,a=Ai()){const l=await this._processOptions(r,a);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const u=this._buildTypedSubscriptionOpts(l),c=new Zb(this,l.deliver,u);c.info=l;try{await this._maybeCreateConsumer(l)}catch(f){throw c.unsubscribe(),f}return c._maybeSetupHbMonitoring(),c}async _processOptions(r,a=Ai()){const l=Zy(a)?a.getOpts():a;if(l.isBind=Zy(a)?a.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==Yt.NotSet&&l.config.ack_policy!==Yt.None)throw new je("ordered consumer: ack_policy can only be set to 'none'",Se.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new je("ordered consumer: durable_name cannot be set",Se.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new je("ordered consumer: deliver_subject cannot be set",Se.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new je("ordered consumer: max_deliver cannot be set",Se.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new je("ordered consumer: deliver_group cannot be set",Se.ApiError);l.config.deliver_subject=Fr(this.nc.options.inboxPrefix),l.config.ack_policy=Yt.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||At(5e3),l.config.ack_wait=At(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===Yt.NotSet&&(l.config.ack_policy=Yt.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||Fr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const a={};return a.adapter=t2(r.callbackFn===void 0,this.timeout),a.ingestionFilterFn=vd.ingestionFn(r.ordered),a.protocolFilterFn=(l,u=!1)=>{const c=l;return Mh(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==Yt.None&&(a.dispatchedFn=i2),r.callbackFn&&(a.callback=r.callbackFn),a.max=r.max||0,a.queue=r.queue,a}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:Lt.All,ack_policy:Yt.Explicit,ack_wait:At(30*1e3),replay_policy:es.Instant},r.config);const a=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=a.name,r.config=a.config,r.last=a}static ingestionFn(r){return(a,l)=>{var m;const u=l;if(!a)return{ingest:!1,protocol:!1};const c=a;if(Xa(c.msg)||(m=u.monitor)==null||m.work(),Dh(c.msg)){const d=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:d,protocol:!0}}else if(Mh(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(a):!0,protocol:!1}}}}class xd{constructor(n){A(this,"options");A(this,"protocol");A(this,"draining");A(this,"listeners");A(this,"_services");this.draining=!1,this.options=vE(n),this.listeners=[]}static connect(n={}){return new Promise((r,a)=>{const l=new xd(n);wu.connect(l.options,l).then(u=>{l.protocol=u,(async function(){for await(const c of u.status())l.listeners.forEach(f=>{f.push(c)})})(),r(l)}).catch(u=>{a(u)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,r,a){if(this.isClosed())throw je.errorForCode(Se.ConnectionClosed);if(r&&this.isDraining()||a&&this.protocol.noMorePublishing)throw je.errorForCode(Se.ConnectionDraining);if(n=n||"",n.length===0)throw je.errorForCode(Se.BadSubject)}publish(n,r,a){this._check(n,!1,!0),this.protocol.publish(n,r,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,r={}){this._check(n,!0,!1);const a=new Jb(this.protocol,n,r);return this.protocol.subscribe(a),a}_resub(n,r,a){this._check(r,!0,!1);const l=n;l.max=a,a&&(l.max=a+l.received),this.protocol.resub(l,r)}requestMany(n,r=Mn,a={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(m){return Promise.reject(m)}if(a.strategy=a.strategy||ir.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new je("timeout",Se.InvalidOption));const u=new Vt;function c(m){u.push(()=>{u.stop(m)})}function f(m,d){m||d===null?c(m===null?void 0:m):u.push(d)}if(a.noMux){const m=l?new Error().stack:null;let d=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const y=this.subscribe(Fr(this.options.inboxPrefix),{callback:(k,L)=>{var B,D;if(((B=L==null?void 0:L.data)==null?void 0:B.length)===0&&((D=L==null?void 0:L.headers)==null?void 0:D.status)===Se.NoResponders&&(k=je.errorForCode(Se.NoResponders)),k){m&&(k.stack+=`
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=At()),this.pongs.push(n),this.outbound.fill(s0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(r=>{const a=r;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${uu}`):n.push(`SUB ${a.subject} ${a.sid}${uu}`)}),n.length&&this.transport.send(dl(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(r=>{r.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),r=[];return n.forEach(a=>{r.push(a.drain())}),Promise.all(r).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const r=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Jb(this,`${r}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const AE="$SRV";class l0{constructor(n){A(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,r){return this.msg.respond(n,r)}respondError(n,r,a,l){var u,c;return l=l||{},l.headers=l.headers||Ir(),(u=l.headers)==null||u.set(pu,`${n}`),(c=l.headers)==null||c.set(mu,r),this.msg.respond(a,l)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Sl{constructor(n,r="",a=""){A(this,"subject");A(this,"queue");A(this,"srv");r!==""&&TE("service group",r);let l="";if(n instanceof Rl)this.srv=n,l="";else if(n instanceof Sl){const u=n;this.srv=u.srv,a===""&&u.queue!==""&&(a=u.queue),l=u.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=a}calcSubject(n,r=""){return r===""?n:n!==""?`${n}.${r}`:r}addEndpoint(n="",r){r=r||{subject:n};const a=typeof r=="function"?{handler:r,subject:n}:r;fl("endpoint",n);let{subject:l,handler:u,metadata:c,queue:f}=a;l=l||n,f=f||this.queue,CE("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 Sl(this,n,r)}}function CE(e,n){if(n==="")throw new Error(`${e} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);const r=n.split(".");r.forEach((a,l)=>{if(a===">"&&l!==r.length-1)throw new Error(`${e} cannot have internal '>': '${n}'`)})}function TE(e,n){if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${e} name cannot contain internal '>': '${n}'`)})}class Rl{constructor(n,r={name:"",version:""}){A(this,"nc");A(this,"_id");A(this,"config");A(this,"handlers");A(this,"internal");A(this,"_stopped");A(this,"_done");A(this,"started");this.nc=n,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),fl("name",this.config.name),fl("queue",this.config.queue),Zi(this.config.version),this._id=Ai.next(),this.internal=[],this._done=At(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,r="",a="",l){const u=l??AE;return r===""&&a===""?`${u}.${n}`:(fl("control subject name",r),a!==""?(fl("control subject id",a),`${u}.${n}.${r}.${a}`):`${u}.${n}.${r}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const r=Ir();if(n instanceof gu){const a=n;r.set(mu,a.message),r.set(pu,`${a.code}`)}else r.set(mu,n.message),r.set(pu,"500");return r}setupHandler(n,r=!1){const a=r?"":n.queue?n.queue:this.config.queue,{name:l,subject:u,handler:c}=n,f=n;f.internal=r,r&&this.internal.push(f),f.stats=new OE(l,u,a),f.queue=a;const m=c?(d,y)=>{if(d){this.close(d);return}const g=Date.now();try{c(d,new l0(y))}catch(b){f.stats.countError(b),y==null||y.respond(Nn,{headers:this.errorToHeader(b)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(u,{callback:m,queue:a}),f.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(d=>{if(!this._stopped){const y=new Error(`required subscription ${n.subject} errored: ${d.message}`);y.stack=d.stack,this.close(y).catch()}}),f}info(){return{type:ml.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:r,metadata:a,name:l,queue:u}=n;return{subject:r,metadata:a,name:l,queue_group:u}})}async stats(){const n=[];for(const r of this.handlers){if(typeof this.config.statsHandler=="function")try{r.stats.data=await this.config.statsHandler(r)}catch(a){r.stats.countError(a)}n.push(r.stats.stats(r.qi))}return{type:ml.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,r){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,r),this._doAddInternalHandler(`${a}-kind`,n,r,this.name),this._doAddInternalHandler(`${a}`,n,r,this.name,this.id)}_doAddInternalHandler(n,r,a,l="",u=""){const c={};c.name=n,c.subject=Rl.controlSubject(r,l,u),c.handler=a,this.setupHandler(c,!0)}start(){const n=ir(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(m=>(f==null||f.respond(n.encode(m)),Promise.resolve())),a=(c,f)=>c?(this.close(c),Promise.reject(c)):(f==null||f.respond(n.encode(this.info())),Promise.resolve()),l=n.encode(this.ping()),u=(c,f)=>c?(this.close(c).then().catch(),Promise.reject(c)):(f.respond(l),Promise.resolve());return this.addInternalHandler(_i.PING,u),this.addInternalHandler(_i.STATS,r),this.addInternalHandler(_i.INFO,a),this.handlers.forEach(c=>{const{subject:f}=c;typeof f=="string"&&c.handler!==null&&this.setupHandler(c)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let r=[];return this.nc.isClosed()||(r=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(r).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:ml.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 Sl(this,n,r)}addEndpoint(n,r){return new Sl(this).addEndpoint(n,r)}_addEndpoint(n){const r=new Gt;r.noIterator=typeof n.handler=="function",r.noIterator||(n.handler=(l,u)=>{l?this.stop(l).catch():r.push(new l0(u))},r.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=r,this.handlers.push(a),r}}class OE{constructor(n,r,a=""){A(this,"name");A(this,"subject");A(this,"average_processing_time");A(this,"num_requests");A(this,"processing_time");A(this,"num_errors");A(this,"last_error");A(this,"data");A(this,"metadata");A(this,"queue");this.name=n,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const r=n;r&&(r.time=0,r.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=kt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:r,average_processing_time:a,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue:d}=this;return{name:n,subject:r,average_processing_time:a,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue_group:d}}stats(n){const r=n;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=kt(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 jE{constructor(n,r={strategy:rr.JitterTimer,maxWait:2e3},a){A(this,"nc");A(this,"prefix");A(this,"opts");this.nc=n,this.prefix=a,this.opts=r}ping(n="",r=""){return this.q(_i.PING,n,r)}stats(n="",r=""){return this.q(_i.STATS,n,r)}info(n="",r=""){return this.q(_i.INFO,n,r)}async q(n,r="",a=""){const l=new Gt,u=ir(),c=Rl.controlSubject(n,r,a,this.prefix),f=await this.nc.requestMany(c,Nn,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 Xb(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function NE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Xb(),storage:Lh.File}}const Su="KV-Operation",o0="$KV",RE=/^[-/=.\w]+$/,ME=/^[-/=.>*\w]+$/,DE=/^[-\w]+$/;function zE(e){if(e.startsWith(".")||e.endsWith(".")||!RE.test(e))throw new Error(`invalid key: ${e}`)}function LE(e){if(e.startsWith(".")||e.endsWith(".")||!ME.test(e))throw new Error(`invalid key: ${e}`)}function UE(e){if(e.startsWith(".")||e.endsWith("."))throw new Error(`invalid key: ${e}`);const n=e.split(".");let r=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":r=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${e}`);r=!0;break}return r}function cu(e){if(!DE.test(e))throw new Error(`invalid bucket name: ${e}`)}var hr;(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"})(hr||(hr={}));class _l{constructor(n,r,a){A(this,"js");A(this,"jsm");A(this,"stream");A(this,"bucket");A(this,"direct");A(this,"codec");A(this,"prefix");A(this,"editPrefix");A(this,"useJsPrefix");A(this,"_prefixLen");A(this,"validateKey",zE);A(this,"validateSearchKey",LE);A(this,"hasWildcards",UE);cu(n),this.js=r,this.jsm=a,this.bucket=n,this.prefix=o0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,r,a={}){cu(r);const l=await n.jetstreamManager(),u=new _l(r,n,l);return await u.init(a),u}static async bind(n,r,a={}){const l=await n.jetstreamManager(),u={config:{allow_direct:a.allow_direct}};cu(r);const c=new _l(r,n,l);return u.config.name=a.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=a.codec||Xb(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(n={}){const r=Object.assign(NE(),n);this.codec=r.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=zh.Limits,a.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(a.max_bytes=r.max_bytes),a.max_msg_size=r.maxValueSize,a.storage=r.storage;const l=n.placementCluster??"";if(l&&(n.placement={},n.placement.cluster=l,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const g=Object.assign({},n.mirror);g.name.startsWith(Cn)||(g.name=`${Cn}${g.name}`),a.mirror=g,a.mirror_direct=!0}else if(n.sources){const g=n.sources.map(b=>{const x=Object.assign({},b),k=x.name.startsWith(Cn)?x.name.substring(Cn.length):x.name;return x.name.startsWith(Cn)||(x.name=`${Cn}${x.name}`),!b.external&&k!==this.bucket&&(x.subject_transforms=[{src:`$KV.${k}.>`,dest:`$KV.${this.bucket}.>`}]),x});a.sources=g,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Ci.S2:Ci.None);const u=this.js.nc,c=u.getServerVersion(),f=c?Bh(c,Zi("2.7.2"))>=0:!1;a.discard=f?wl.New:wl.Old;const{ok:m,min:d}=u.features.get(rt.JS_ALLOW_DIRECT);if(!m&&n.allow_direct===!0){const g=c?`${c.major}.${c.minor}.${c.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${g} - requires ${d}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:m,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=r.replicas,r.ttl&&(a.max_age=kt(r.ttl)),a.allow_rollup_hdrs=!0;let y;try{y=await this.jsm.streams.info(a.name),!y.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(g){if(g.message==="stream not found")y=await this.jsm.streams.add(a);else throw g}this.initializePrefixes(y)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=n.config;if(r){let a=r.name;if(a.startsWith(Cn)&&(a=a.substring(Cn.length)),r.external&&r.external.api!==""){const l=r.name.substring(Cn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Cn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,r=!1){const a=[];return r?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${o0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const r=[];for(const a of n.split("."))switch(a){case">":case"*":r.push(a);break;default:r.push(this.codec.key.encode(a));break}return r.join(".")}decodeKey(n){const r=[];for(const a of n.split("."))switch(a){case">":case"*":r.push(a);break;default:r.push(this.codec.key.decode(a));break}return r.join(".")}close(){return Promise.resolve()}dataLen(n,r){const a=r&&r.get(on.MessageSizeHdr)||"";return a!==""?parseInt(a,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 WE(this.bucket,r,n)}async create(n,r){var u;let a;try{const c=await this.put(n,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(a=c,((u=c==null?void 0:c.api_error)==null?void 0:u.err_code)!==10071)return Promise.reject(c)}let l=0;try{const c=await this.get(n);return(c==null?void 0:c.operation)==="DEL"||(c==null?void 0:c.operation)==="PURGE"?(l=c!==null?c.revision:0,this.update(n,r,l)):Promise.reject(a)}catch(c){return Promise.reject(c)}}update(n,r,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,r,{previousSeq:a})}async put(n,r,a={}){var c,f;const l=this.encodeKey(n);this.validateKey(l);const u={};if(a.previousSeq!==void 0){const m=Ir();u.headers=m,m.set(hr.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,u)).seq}catch(m){const d=m;return d.isJetStreamError()?(d.message=(c=d.api_error)==null?void 0:c.description,d.code=`${(f=d.api_error)==null?void 0:f.code}`,Promise.reject(d)):Promise.reject(m)}}async get(n,r){const a=this.encodeKey(n);this.validateKey(a);let l={last_by_subj:this.subjectForKey(a)};r&&r.revision>0&&(l={seq:r.revision});let u;try{this.direct?u=await this.jsm.direct.getMessage(this.bucketName(),l):u=await this.jsm.streams.getMessage(this.bucketName(),l);const c=this.smToEntry(u);return c.key!==a?null:c}catch(c){if(c.code===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=At(),a=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const m of l)(m.operation==="DEL"||m.operation==="PURGE")&&a.push(m)})().then(),await r,l.stop();const u=Date.now()-n,c=a.map(m=>{const d=this.subjectForKey(m.key);return m.created.getTime()>=u?this.jsm.streams.purge(this.stream,{filter:d,keep:1}):this.jsm.streams.purge(this.stream,{filter:d,keep:0})}),f=await Promise.all(c);return f.unshift({success:!0,purged:0}),f.reduce((m,d)=>(m.purged+=d.purged,m))}async _deleteOrPurge(n,r,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,r,a);const l=await this.keys(n),u=[];for await(const c of l)u.push(this._doDeleteOrPurge(c,r)),u.length===100&&(await Promise.all(u),u.length=0);u.length>0&&await Promise.all(u)}async _doDeleteOrPurge(n,r,a){const l=this.encodeKey(n);this.validateKey(l);const u=Ir();u.set(Su,r),r==="PURGE"&&u.set(on.RollupHdr,on.RollupValueSubject),a!=null&&a.previousSeq&&u.set(hr.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),Nn,{headers:u})}_buildCC(n,r,a={}){let u=(Array.isArray(n)?n:[n]).map(m=>{const d=this.encodeKey(m);return this.validateSearchKey(m),this.fullKeyName(d)}),c=Dt.LastPerSubject;r===nr.AllHistory&&(c=Dt.All),r===nr.UpdatesOnly&&(c=Dt.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:$t.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:kt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const r=n.key??">",a=new Gt,l={};l.headers_only=n.headers_only||!1;let u;u=()=>{a.stop()};let c=0;const f=this._buildCC(r,nr.AllHistory,l),m=f.filter_subject,d=ki(f);d.bindStream(this.stream),d.orderedConsumer(),d.callback((g,b)=>{if(g){a.stop(g);return}if(b){const x=this.jmToEntry(b);a.push(x),a.received++,(u&&c>0&&a.received>=c||b.info.pending===0)&&(a.push(u),u=void 0)}});const y=await this.js.subscribe(m,d);if(u){const{info:{last:g}}=y,b=g.num_pending+g.delivered.consumer_seq;if(b===0||a.received>=b)try{u()}catch(x){a.stop(x)}finally{u=void 0}else c=b}return a._data=y,a.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}canSetWatcherName(){const r=this.js.nc,{ok:a}=r.features.get(rt.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const r=n.key??">",a=new Gt,l={};l.headers_only=n.headers_only||!1;let u=nr.LastValue;n.include===nr.AllHistory?u=nr.AllHistory:n.include===nr.UpdatesOnly&&(u=nr.UpdatesOnly);const c=n.ignoreDeletes===!0;let f=n.initializedFn,m=0;const d=this._buildCC(r,u,l),y=d.filter_subject,g=ki(d);this.canSetWatcherName()&&g.consumerName(Ai.next()),g.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&g.startSequence(n.resumeFromRevision),g.orderedConsumer(),g.callback((x,k)=>{if(x){a.stop(x);return}if(k){const L=this.jmToEntry(k);if(c&&L.operation==="DEL")return;a.push(L),a.received++,f&&(m>0&&a.received>=m||k.info.pending===0)&&(a.push(f),f=void 0)}});const b=await this.js.subscribe(y,g);if(f){const{info:{last:x}}=b,k=x.num_pending+x.delivered.consumer_seq;if(k===0||a.received>=k)try{f()}catch(L){a.stop(L)}finally{f=void 0}else m=k}return a._data=b,a.iterClosed.then(()=>{b.unsubscribe()}),b.closed.then(()=>{a.stop()}).catch(x=>{a.stop(x)}),a}async keys(n=">"){const r=new Gt,a=this._buildCC(n,nr.LastValue,{headers_only:!0}),l=Array.isArray(n)?">":a.filter_subject,u=ki(a);u.bindStream(this.stream),u.orderedConsumer();const c=await this.js.subscribe(l,u);return(async()=>{var m;for await(const d of c){const y=(m=d.headers)==null?void 0:m.get(Su);if(y!=="DEL"&&y!=="PURGE"){const g=this.decodeKey(d.subject.substring(this.prefixLen));r.push(g)}d.info.pending===0&&c.unsubscribe()}})().then(()=>{r.stop()}).catch(m=>{r.stop(m)}),c.info.last.num_pending===0&&c.unsubscribe(),r}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var u;const r=((u=this.js.nc.info)==null?void 0:u.cluster)??"",a=this.bucketName(),l=await this.jsm.streams.info(a);return new Qb(l,r)}}class Qb{constructor(n,r=""){A(this,"si");A(this,"cluster");this.si=n,this.cluster=r}get bucket(){return this.si.config.name.startsWith(Cn)?this.si.config.name.substring(Cn.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 hd(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!==Ci.None:!1}}const pd="OBJ_",u0="SHA-256=";function BE(e){return cu(e),`${pd}${e}`}function PE(e){return e.startsWith(pd)?e.substring(4):e}class Ih{constructor(n){A(this,"si");A(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return PE(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!==Ci.None:!1}}function eu(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 Gn;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(Gn||(Gn={}));var dr;(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"})(dr||(dr={}));var Ka;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(Ka||(Ka={}));const c0=Uint8Array.of(43,65,67,75),qE=Uint8Array.of(45,78,65,75),al=Uint8Array.of(43,87,80,73),HE=Uint8Array.of(43,78,88,84),IE=Uint8Array.of(43,84,69,82,77),FE=Uint8Array.of(32);function El(e,n=5e3){return new s2(e,n)}class oh extends Gt{constructor(r,a,l=!1){super();A(this,"consumer");A(this,"opts");A(this,"sub");A(this,"monitor");A(this,"pending");A(this,"inbox");A(this,"refilling");A(this,"pong");A(this,"callback");A(this,"timeout");A(this,"cleanupHandler");A(this,"listeners");A(this,"statusIterator");A(this,"forOrderedConsumer");A(this,"resetHandler");A(this,"abortOnMissingResource");A(this,"bind");A(this,"inBackOff");this.consumer=r;const u=a;this.opts=this.parseOptions(a,l),this.callback=u.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=qr(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=u.abort_on_missing_resource===!0,this.bind=u.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:a,idle_heartbeat:l,threshold_bytes:u,threshold_messages:c}=this.opts;this.closed().then(m=>{if(this.cleanupHandler)try{this.cleanupHandler(m)}catch{}});const{sub:f}=this;f&&f.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(m,d)=>{var g,b,x,k;if(m){this.stop(m);return}if((g=this.monitor)==null||g.work(),d.subject===this.inbox){if(Dh(d))return;const L=(b=d.headers)==null?void 0:b.code,B=((k=(x=d.headers)==null?void 0:x.description)==null?void 0:k.toLowerCase())||"unknown",{msgsLeft:D,bytesLeft:F}=this.parseDiscard(d.headers);if(D>0||F>0)this.pending.msgs-=D,this.pending.bytes-=F,this.pending.requests--,this.notify(Ka.Discard,{msgsLeft:D,bytesLeft:F});else if(L===400){this.stop(new Oe(B,`${L}`));return}else if(L===409&&B==="consumer deleted"){if(this.notify(dr.ConsumerDeleted,`${L} ${B}`),!this.refilling||this.abortOnMissingResource){const G=new Oe(B,`${L}`);this.stop(G);return}}else if(L===503){if(this.notify(dr.NoResponders,`${L} No Responders`),!this.refilling||this.abortOnMissingResource){const G=new Oe("no responders",`${L}`);this.stop(G);return}}else this.notify(Ka.DebugEvent,`${L} ${B}`)}else this._push(El(d,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=d.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=c||a&&this.pending.bytes<=u){const L=this.pullOptions();this.pull(L)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new md(l,m=>(this.notify(dr.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 Pr.Disconnect:(d=this.monitor)==null||d.cancel();break;case Pr.Reconnect:this.resetPending().then(g=>{var b;g&&((b=this.monitor)==null||b.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const a=typeof r=="function"?r:null;try{a?a():this.callback(r)}catch(l){this.stop(l)}}}notify(r,a){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let r=0,a=0;const l=fd([this.opts.expires]);let u=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,r=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(c){if(c.message==="stream not found"){if(a++,this.notify(dr.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(dr.ConsumerNotFound,r),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(c),!1;if(this.forOrderedConsumer)return!1}else r=0,a=0;this.inBackOff=!0;const f=l.backoff(u),m=ss(f);await Promise.race([m,this.consumer.api.nc.closed()]),m.cancel(),u++}}}pull(r){this.pending.bytes+=r.max_bytes??0,this.pending.msgs+=r.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(r),{reply:this.inbox}),this.notify(Ka.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,l=kt(this.opts.idle_heartbeat),u=kt(this.opts.expires);return{batch:r,max_bytes:a,idle_heartbeat:l,expires:u}}parseDiscard(r){const a={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(on.PendingMessagesHdr);l&&(a.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(on.PendingBytesHdr);return u&&(a.bytesLeft=parseInt(u)),a}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,a;(r=this.monitor)==null||r.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var a,l;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(u=>{u.stop()})}))}parseOptions(r,a=!1){const l=r||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,a){const u=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||u;const c=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||c}return l}status(){const r=new Gt;return this.listeners.push(r),Promise.resolve(r)}}class $E extends Gt{constructor(){super();A(this,"src");A(this,"listeners");this.listeners=[]}setSource(r){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=r,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const l of a)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,a){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:a})})}stop(r){var a;this.done||((a=this.src)==null||a.stop(r),super.stop(r),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const r=new Gt;return this.listeners.push(r),Promise.resolve(r)}}class Fh{constructor(n,r){A(this,"api");A(this,"_info");A(this,"stream");A(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 oh(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const r=new oh(this,n,!1),a=Math.round(r.opts.expires*1.05),l=Wa(a);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(n={expires:3e4}){const r=At(),a=n;a.max_messages=1;const l=new oh(this,a,!1),u=Math.round(l.opts.expires*1.05);u>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===dr.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=Wa(u);return l.closed().then(f=>{f?r.reject(f):r.resolve(null)}).catch(f=>{r.reject(f)}).finally(()=>{c.cancel()}),c.catch(f=>{r.resolve(null),l.close().catch()}),l.trackTimeout(c),r}delete(){const{stream_name:n,name:r}=this._info;return this.api.delete(n,r)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:r,name:a}=this._info;return this.api.info(r,a).then(l=>(this._info=l,this._info))}}class GE{constructor(n,r,a={}){A(this,"api");A(this,"consumerOpts");A(this,"consumer");A(this,"opts");A(this,"cursor");A(this,"stream");A(this,"namePrefix");A(this,"serial");A(this,"currentConsumer");A(this,"userCallback");A(this,"iter");A(this,"type");A(this,"startSeq");A(this,"maxInitialReset");this.api=n,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ai.next(),typeof a.name_prefix=="string"&&(Nu("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Gn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const r=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:r,deliver_policy:Dt.StartSequence,opt_start_seq:n,ack_policy:$t.None,inactive_threshold:kt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||Dt.StartSequence,(this.consumerOpts.deliver_policy===Dt.LastPerSubject||this.consumerOpts.deliver_policy===Dt.New||this.consumerOpts.deliver_policy===Dt.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===Dt.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=Dt.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=kt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var c,f,m,d,y;Ai.next();const r=this.serial===0;(c=this.consumer)==null||c.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const l=fd([((f=this.opts)==null?void 0:f.expires)||3e4]);let u;for(let g=0;;g++)try{u=await this.api.add(this.stream,a),(m=this.iter)==null||m.notify(dr.OrderedConsumerRecreated,u.name);break}catch(b){if(b.message==="stream not found"&&((d=this.iter)==null||d.notify(dr.StreamNotFound,g),this.type===Gn.Fetch||this.opts.abort_on_missing_resource===!0))return(y=this.iter)==null||y.stop(b),Promise.reject(b);if(r&&g>=this.maxInitialReset)throw b;await ss(l.backoff(g+1))}return u}internalHandler(n){return r=>{var l;if(this.serial!==n)return;const a=r.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=r.info.streamSequence,this.userCallback?this.userCallback(r):(l=this.iter)==null||l.push(r)}}async reset(n={max_messages:100,expires:3e4},r){var m,d;r=r||{};const a=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===Gn.Fetch&&l){(m=this.iter)==null||m.src.stop(),await((d=this.iter)==null?void 0:d.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new $E),this.consumer=new Fh(this.api,this.currentConsumer);const u=n;u.callback=this.internalHandler(this.serial);let c=null;this.type===Gn.Fetch&&a?c=await this.consumer.fetch(n):this.type===Gn.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(Ka.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===Gn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Gn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=Gn.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===Gn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=Gn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const r=n;if(r.bind)return Promise.reject(new Error("bind is not supported"));r.max_messages=1;const a=At();return r.callback=u=>{this.userCallback=null,a.resolve(u)},(await this.fetch(r)).iterClosed.then(u=>{u&&a.reject(u),a.resolve(null)}).catch(u=>{a.reject(u)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class $h{constructor(n){A(this,"api");A(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(rt.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 Fh(this.api,n)}async get(n,r={}){return typeof r=="object"?this.ordered(n,r):(await this.checkVersion(),this.api.info(n,r).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Fh(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,r){await this.checkVersion();const a=this.api;return new gd(a.nc,a.opts).info(n).then(u=>Promise.resolve(new GE(this.api,n,r))).catch(u=>Promise.reject(u))}}class Mu{constructor(n,r){A(this,"api");A(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 Mu(this.api,n)}else return this}info(n=!1,r){return n?Promise.resolve(this._info):this.api.info(this.name,r).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new $h(new vu(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new $h(new vu(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 gd extends Nl{constructor(n,r){super(n,r)}checkStreamConfigVersions(n){const r=this.nc;if(n.metadata){const{min:l,ok:u}=r.features.get(rt.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(rt.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(rt.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(rt.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(rt.JS_DEFAULT_CONSUMER_LIMITS);if(!u)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function a(l,u){var f;if((((f=u==null?void 0:u.subject_transforms)==null?void 0:f.length)||0)>0){const{min:m,ok:d}=r.features.get(rt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!d)throw new Error(`${l} 'subject_transforms' requires server ${m}`)}}n.sources&&n.sources.forEach(l=>{a("stream sources",l)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var l;this.checkStreamConfigVersions(n),an(n.name),n.mirror=eu(n.mirror),n.sources=(l=n.sources)==null?void 0:l.map(eu);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return an(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),an(n);const a=await this.info(n),l=Object.assign(a.config,r);l.mirror=eu(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(eu);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,l);return this._fixInfo(c),c}async info(n,r){an(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let u=await this._request(a,r),{total:c,limit:f}=u,m=u.state.subjects?Object.getOwnPropertyNames(u.state.subjects).length:1;if(c&&c>m){const d=[u],y=r||{};let g=0;for(;c>m;){g++,y.offset=f*g;const x=await this._request(a,y);c=x.total,d.push(x);const k=Object.getOwnPropertyNames(x.state.subjects).length;if(m+=k,k<f)break}let b={};for(let x=0;x<d.length;x++)u=d[x],u.state.subjects&&(b=Object.assign(b,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=b}return this._fixInfo(u),u}list(n=""){const r=n!=null&&n.length?{subject:n}:{},a=u=>{const c=u;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new hl(l,a,this,r)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,r){if(r){const{keep:l,seq:u}=r;if(typeof l=="number"&&typeof u=="number")throw new Error("can specify one of keep or seq")}return an(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,r)}async deleteMessage(n,r,a=!0){an(n);const l={seq:r};return a||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,l)).success}async getMessage(n,r){an(n);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,r);return new Kb(l)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var m;const u=a.streams.filter(d=>d.config.name.startsWith(Cn));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 Qb(d,c))},r=`${this.prefix}.STREAM.LIST`;return new hl(r,n,this)}listObjectStores(){const n=a=>{const u=a.streams.filter(f=>f.config.name.startsWith(pd));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new Ih(f))},r=`${this.prefix}.STREAM.LIST`;return new hl(r,n,this)}names(n=""){const r=n!=null&&n.length?{subject:n}:{},a=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new hl(l,a,this,r)}async get(n){const r=await this.info(n);return Promise.resolve(new Mu(this,r))}}class YE extends Nl{constructor(n,r){super(n,r)}async getMessage(n,r){an(n);let a=r;const{last_by_subj:l}=a;l&&(a=null);const u=a?this.jc.encode(a):Nn,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=Xa(m);if(d)return Promise.reject(d);const y=new Gh(m);return Promise.resolve(y)}async getBatch(n,r){an(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 Gt,f=await this.nc.requestMany(l,u,{strategy:rr.SentinelMsg});return(async()=>{var g,b,x;let m=!1,d=!1,y;for await(const k of f){if(!m){m=!0;const L=((g=k.headers)==null?void 0:g.code)||0;if(L!==0&&L<200||L>299){y=(b=k.headers)==null?void 0:b.description.toLowerCase();break}if(((x=k.headers)==null?void 0:x.get("Nats-Num-Pending"))===""){d=!0;break}}if(k.data.length===0)break;c.push(new Gh(k))}c.push(()=>{if(d)throw new Error("batch direct get not supported by the server");if(y)throw new Error(`bad request: ${y}`);c.stop()})})(),Promise.resolve(c)}}class Gh{constructor(n){A(this,"data");A(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(Ya.Subject)}get seq(){const n=this.header.last(Ya.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Ya.TimeStamp)}get stream(){return this.header.last(Ya.Stream)}json(n){return ir(n).decode(this.data)}string(){return Tn.decode(this.data)}}A(Gh,"jc");class VE extends Nl{constructor(r,a){super(r,a);A(this,"streams");A(this,"consumers");A(this,"direct");this.streams=new gd(r,a),this.consumers=new vu(r,a),this.direct=new YE(r,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new Gt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,l)=>{if(a)throw a;try{const u=this.parseJsResponse(l),c=u.type.split("."),f=c[c.length-1];r.push({kind:f,data:u})}catch(u){r.stop(u)}}}),r}}class Kb{constructor(n){A(this,"_header");A(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):Nn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Ei.decode(n)}else this._header=Ir();return this._header}_parse(n){const r=atob(n),a=r.length,l=new Uint8Array(a);for(let u=0;u<a;u++)l[u]=r.charCodeAt(u);return l}json(n){return ir(n).decode(this.data)}string(){return Tn.decode(this.data)}}A(Kb,"jc");class JE{constructor(n){A(this,"api");this.api=n}get(n){return this.api.info(n).then(r=>new Mu(this.api,r))}}class uh{constructor(n){A(this,"info");A(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Ei.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 f0(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 XE(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class gl{constructor(n,r,a){A(this,"jsm");A(this,"js");A(this,"stream");A(this,"name");this.name=n,this.jsm=r,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const r=await this.rawInfo(n);return r?new uh(r):null}async list(){const n=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of r){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:r,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const l=this._metaSubject(r);try{const u=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=ir().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 Ih(n)))}async status(n){const r=await this._si(n);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Ih(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,r,a){var se;const l=this.js.getOptions();a=a||{timeout:l.timeout},a.timeout=a.timeout||l.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:u,previousRevision:c}=a,f=this.js.nc.info,m=(f==null?void 0:f.max_payload)||1024;n=n||{},n.options=n.options||{};let d=((se=n.options)==null?void 0:se.max_chunk_size)||128*1024;d=d>m?m:d,n.options.max_chunk_size=d;const y=await this.info(n.name),{name:g,error:b}=this._checkNotEmpty(n.name);if(b)return Promise.reject(b);const x=Ai.next(),k=this._chunkSubject(x),L=this._metaSubject(g),B=Object.assign({bucket:this.name,nuid:x,size:0,chunks:0},f0(n)),D=At(),F=[],G=new ts;try{const R=r?r.getReader():null,O=e0.create();for(;;){const{done:V,value:J}=R?await R.read():{done:!0,value:void 0};if(V){if(G.size()>0){const Q=G.drain();O.update(Q),B.chunks++,B.size+=Q.length,F.push(this.js.publish(k,Q,{timeout:u}))}await Promise.all(F),F.length=0,B.mtime=new Date().toISOString();const Y=Qa.encode(O.digest());B.digest=`${u0}${Y}`,B.deleted=!1;const j=Ir();typeof c=="number"&&j.set(hr.ExpectedLastSubjectSequenceHdr,`${c}`),j.set(on.RollupHdr,on.RollupValueSubject);const K=await this.js.publish(L,ir().encode(B),{headers:j,timeout:u});if(B.revision=K.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}D.resolve(new uh(B));break}if(J)for(G.fill(J);G.size()>d;){B.chunks++,B.size+=d;const Y=G.drain(n.options.max_chunk_size);O.update(Y),F.push(this.js.publish(k,Y,{timeout:u}))}}}catch(R){await this.jsm.streams.purge(this.stream,{filter:k}),D.reject(R)}return D}putBlob(n,r,a){function l(u){return new ReadableStream({pull(c){c.enqueue(u),c.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(n,l(r),a)}put(n,r,a){var l;return(l=n==null?void 0:n.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,r,a)}async getBlob(n){async function r(u){const c=new ts,f=u.getReader();for(;;){const{done:m,value:d}=await f.read();if(m)return c.drain();d&&d.length&&c.fill(d)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const l=await Promise.all([a.error,r(a.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(n){const r=await this.rawInfo(n);if(r===null||r.deleted)return Promise.resolve(null);if(r.options&&r.options.link){const g=r.options.link.name||"";if(g==="")throw new Error("link is a bucket");return(r.options.link.bucket!==this.name?await gl.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(u0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const a=Uh(r.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=At(),u={info:new uh(r),error:l};if(r.size===0)return u.data=XE(),l.resolve(null),Promise.resolve(u);let c;const f=ki();f.orderedConsumer();const m=e0.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&&(U_(a,m.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${a}`)),y.unsubscribe())})().then(()=>{l.resolve()}).catch(g=>{c.error(g),l.reject(g)}),u.data=new ReadableStream({start(g){c=g},cancel(){y.unsubscribe()}}),u}linkStore(n,r){if(!(r instanceof gl))return Promise.reject("bucket required");const a=r,{name:l,error:u}=this._checkNotEmpty(n);if(u)return Promise.reject(u);const c={name:l,options:{link:{bucket:a.name}}};return this._put(c,null)}async link(n,r){const{name:a,error:l}=this._checkNotEmpty(n);if(l)return Promise.reject(l);if(r.deleted)return Promise.reject(new Error("src object is deleted"));if(r.isLink())return Promise.reject(new Error("src object is a link"));const u=await this.rawInfo(n);if(u!==null&&!u.deleted)return Promise.reject(new Error("an object already exists with that name"));const c={bucket:r.bucket,name:r.name},f={name:a,bucket:r.bucket,options:{link:c}};await this.js.publish(this._metaSubject(n),JSON.stringify(f));const m=await this.info(n);return Promise.resolve(m)}async delete(n){const r=await this.rawInfo(n);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const a=ir(),l=Ir();return l.set(on.RollupHdr,on.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),a.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(n,r={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??a.name;const{name:l,error:u}=this._checkNotEmpty(r.name);if(u)return Promise.reject(u);if(n!==r.name){const m=await this.info(r.name);if(m&&!m.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const c=Object.assign({},a,f0(r)),f=await this.js.publish(this._metaSubject(c.name),JSON.stringify(c));return n!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(f)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let r=!1;const a=new Gt,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(m){m.code==="404"?(a.push(null),r=!0):a.stop(m)}const u=ir(),c=ki();c.orderedConsumer(),n.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((m,d)=>{var y;if(m){a.stop(m);return}if(d!==null){const g=u.decode(d.data);g.deleted&&n.ignoreDeletes===!0||a.push(g),((y=d.info)==null?void 0:y.pending)===0&&!r&&(r=!0,a.push(null))}});const f=await this.js.subscribe(l,c);return a._data=f,a.iterClosed.then(()=>{f.unsubscribe()}),f.closed.then(()=>{a.stop()}).catch(m=>{a.stop(m)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${Qa.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=BE(this.name)}catch(l){return Promise.reject(l)}const r=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:r},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=wl.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Ci.S2:Ci.None);try{await this.jsm.streams.info(a.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,r,a={}){const l=await n.jetstreamManager(),u=new gl(r,l,n);return await u.init(a),Promise.resolve(u)}}class QE{constructor(n){A(this,"js");this.js=n}kv(n,r={}){const a=this.js,{ok:l,min:u}=a.nc.features.get(rt.JS_KV);return l?r.bindOnly?_l.bind(this.js,n,r):_l.create(this.js,n,r):Promise.reject(new Error(`kv is only supported on servers ${u} or better`))}os(n,r={}){var c;if(typeof((c=crypto==null?void 0:crypto.subtle)==null?void 0:c.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:l,min:u}=a.nc.features.get(rt.JS_OBJECTSTORE);return l?gl.create(this.js,n,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class yd extends Nl{constructor(r,a){super(r,a);A(this,"consumers");A(this,"streams");A(this,"consumerAPI");A(this,"streamAPI");this.consumerAPI=new vu(r,a),this.streamAPI=new gd(r,a),this.consumers=new $h(this.consumerAPI),this.streams=new JE(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new QE(this)}async publish(r,a=Nn,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||Ir();l&&(l.msgID&&u.set(hr.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(hr.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(hr.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(hr.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(hr.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=u);let{retries:m,retry_delay:d}=l;m=m||1,d=d||250;let y;for(let b=0;b<m;b++)try{y=await this.nc.request(r,a,f);break}catch(x){if(x.code==="503"&&b+1<m)await ss(d);else throw x}const g=this.parseJsResponse(y);if(g.stream==="")throw Oe.errorForCode(Ee.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,a,l=0){an(r),Ja(a);let u=this.timeout;l>u&&(u=l),l=l<0?0:kt(l);const c={batch:1,no_wait:l===0,expires:l},f=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${a}`,this.jc.encode(c),{noMux:!0,timeout:u}),m=Xa(f);if(m)throw m;return El(f,this.timeout)}fetch(r,a,l={}){an(r),Ja(a);let u=null;const c=(l.max_bytes??0)>0;let f=0;const m=c?l.max_bytes:0;let d=null;const y={};if(y.batch=l.batch||1,m){const F=this.nc.features.get(rt.JS_PULL_MAX_BYTES);if(!F.ok)throw new Error(`max_bytes is only supported on servers ${F.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=kt(g)),g===0&&y.no_wait===!1)throw new Error("expires or no_wait is required");const b=l.idle_heartbeat||0;b&&(y.idle_heartbeat=kt(b),l.delay_heartbeat===!0&&(y.idle_heartbeat=kt(b*4)));const x=new Gt,k=y.batch;let L=0;x.protocolFilterFn=(F,G=!1)=>Dh(F.msg)?(d==null||d.work(),!1):!0,x.dispatchedFn=F=>{if(F){if(c&&(f+=F.data.length),L++,u&&F.info.pending===0)return;(x.getPending()===1&&F.info.pending===0||k===L||m>0&&f>=m)&&x.stop()}};const B=qr(this.nc.options.inboxPrefix),D=this.nc.subscribe(B,{max:l.batch,callback:(F,G)=>{F===null&&(F=Xa(G)),F!==null?(u&&(u.cancel(),u=null),b_(F)?x.stop(Wb(F)===null?void 0:F):x.stop(F)):(d==null||d.work(),x.received++,x.push(El(G,this.timeout)))}});return g&&(u=Wa(g),u.catch(()=>{D.isClosed()||(D.drain().catch(()=>{}),u=null),d&&d.cancel()})),(async()=>{try{b&&(d=new md(b,F=>(x.push(()=>{x.err=new Oe(`${Yn.IdleHeartbeatMissed}: ${F}`,Ee.JetStreamIdleHeartBeat)}),!0)))}catch{}await D.closed,u!==null&&(u.cancel(),u=null),d&&d.cancel(),x.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${a}`,this.jc.encode(y),{reply:B}),x}async pullSubscribe(r,a=ki()){const l=await this._processOptions(r,a);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const u=l.config.ack_policy;if(u===$t.None||u===$t.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new e2(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(m){throw f.unsubscribe(),m}return f}async subscribe(r,a=ki()){const l=await this._processOptions(r,a);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const u=this._buildTypedSubscriptionOpts(l),c=new Zb(this,l.deliver,u);c.info=l;try{await this._maybeCreateConsumer(l)}catch(f){throw c.unsubscribe(),f}return c._maybeSetupHbMonitoring(),c}async _processOptions(r,a=ki()){const l=Qy(a)?a.getOpts():a;if(l.isBind=Qy(a)?a.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==$t.NotSet&&l.config.ack_policy!==$t.None)throw new Oe("ordered consumer: ack_policy can only be set to 'none'",Ee.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new Oe("ordered consumer: durable_name cannot be set",Ee.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new Oe("ordered consumer: deliver_subject cannot be set",Ee.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new Oe("ordered consumer: max_deliver cannot be set",Ee.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new Oe("ordered consumer: deliver_group cannot be set",Ee.ApiError);l.config.deliver_subject=qr(this.nc.options.inboxPrefix),l.config.ack_policy=$t.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||kt(5e3),l.config.ack_wait=kt(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===$t.NotSet&&(l.config.ack_policy=$t.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||qr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const a={};return a.adapter=t2(r.callbackFn===void 0,this.timeout),a.ingestionFilterFn=yd.ingestionFn(r.ordered),a.protocolFilterFn=(l,u=!1)=>{const c=l;return Mh(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==$t.None&&(a.dispatchedFn=i2),r.callbackFn&&(a.callback=r.callbackFn),a.max=r.max||0,a.queue=r.queue,a}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:Dt.All,ack_policy:$t.Explicit,ack_wait:kt(30*1e3),replay_policy:es.Instant},r.config);const a=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=a.name,r.config=a.config,r.last=a}static ingestionFn(r){return(a,l)=>{var m;const u=l;if(!a)return{ingest:!1,protocol:!1};const c=a;if(Xa(c.msg)||(m=u.monitor)==null||m.work(),Dh(c.msg)){const d=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:d,protocol:!0}}else if(Mh(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(a):!0,protocol:!1}}}}class bd{constructor(n){A(this,"options");A(this,"protocol");A(this,"draining");A(this,"listeners");A(this,"_services");this.draining=!1,this.options=vE(n),this.listeners=[]}static connect(n={}){return new Promise((r,a)=>{const l=new bd(n);wu.connect(l.options,l).then(u=>{l.protocol=u,(async function(){for await(const c of u.status())l.listeners.forEach(f=>{f.push(c)})})(),r(l)}).catch(u=>{a(u)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,r,a){if(this.isClosed())throw Oe.errorForCode(Ee.ConnectionClosed);if(r&&this.isDraining()||a&&this.protocol.noMorePublishing)throw Oe.errorForCode(Ee.ConnectionDraining);if(n=n||"",n.length===0)throw Oe.errorForCode(Ee.BadSubject)}publish(n,r,a){this._check(n,!1,!0),this.protocol.publish(n,r,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,r={}){this._check(n,!0,!1);const a=new Jb(this.protocol,n,r);return this.protocol.subscribe(a),a}_resub(n,r,a){this._check(r,!0,!1);const l=n;l.max=a,a&&(l.max=a+l.received),this.protocol.resub(l,r)}requestMany(n,r=Nn,a={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(m){return Promise.reject(m)}if(a.strategy=a.strategy||rr.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new Oe("timeout",Ee.InvalidOption));const u=new Gt;function c(m){u.push(()=>{u.stop(m)})}function f(m,d){m||d===null?c(m===null?void 0:m):u.push(d)}if(a.noMux){const m=l?new Error().stack:null;let d=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const y=this.subscribe(qr(this.options.inboxPrefix),{callback:(k,L)=>{var B,D;if(((B=L==null?void 0:L.data)==null?void 0:B.length)===0&&((D=L==null?void 0:L.headers)==null?void 0:D.status)===Ee.NoResponders&&(k=Oe.errorForCode(Ee.NoResponders)),k){m&&(k.stack+=`
82
82
 
83
- ${m}`),g(k);return}f(null,L),a.strategy===ir.Count&&(d--,d===0&&g()),a.strategy===ir.JitterTimer&&(x(),b=setTimeout(()=>{g()},300)),a.strategy===ir.SentinelMsg&&L&&L.data.length===0&&g()}});y.requestSubject=n,y.closed.then(()=>{c()}).catch(k=>{u.stop(k)});const g=k=>{k&&u.push(()=>{throw k}),x(),y.drain().then(()=>{c()}).catch(L=>{c()})};u.iterClosed.then(()=>{x(),y==null||y.unsubscribe()}).catch(k=>{x(),y==null||y.unsubscribe()});try{this.publish(n,r,{reply:y.getSubject()})}catch(k){g(k)}let b=setTimeout(()=>{g()},a.maxWait);const x=()=>{b&&clearTimeout(b)}}else{const m=a;m.callback=f,u.iterClosed.then(()=>{d.cancel()}).catch(y=>{d.cancel(y)});const d=new B_(this.protocol.muxSubscriptions,n,m);this.protocol.request(d);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${d.token}`,headers:a.headers})}catch(y){d.cancel(y)}}return Promise.resolve(u)}request(n,r,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(u){return Promise.reject(u)}const l=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new je("timeout",Se.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new je("reply can only be used with noMux",Se.InvalidOption));if(a.noMux){const u=a.reply?a.reply:Fr(this.options.inboxPrefix),c=Ct(),f=l?new Error:null,m=this.subscribe(u,{max:1,timeout:a.timeout,callback:(d,y)=>{d?(f&&d.code!==Se.Timeout&&(d.stack+=`
83
+ ${m}`),g(k);return}f(null,L),a.strategy===rr.Count&&(d--,d===0&&g()),a.strategy===rr.JitterTimer&&(x(),b=setTimeout(()=>{g()},300)),a.strategy===rr.SentinelMsg&&L&&L.data.length===0&&g()}});y.requestSubject=n,y.closed.then(()=>{c()}).catch(k=>{u.stop(k)});const g=k=>{k&&u.push(()=>{throw k}),x(),y.drain().then(()=>{c()}).catch(L=>{c()})};u.iterClosed.then(()=>{x(),y==null||y.unsubscribe()}).catch(k=>{x(),y==null||y.unsubscribe()});try{this.publish(n,r,{reply:y.getSubject()})}catch(k){g(k)}let b=setTimeout(()=>{g()},a.maxWait);const x=()=>{b&&clearTimeout(b)}}else{const m=a;m.callback=f,u.iterClosed.then(()=>{d.cancel()}).catch(y=>{d.cancel(y)});const d=new B_(this.protocol.muxSubscriptions,n,m);this.protocol.request(d);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${d.token}`,headers:a.headers})}catch(y){d.cancel(y)}}return Promise.resolve(u)}request(n,r,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(u){return Promise.reject(u)}const l=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new Oe("timeout",Ee.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new Oe("reply can only be used with noMux",Ee.InvalidOption));if(a.noMux){const u=a.reply?a.reply:qr(this.options.inboxPrefix),c=At(),f=l?new Error:null,m=this.subscribe(u,{max:1,timeout:a.timeout,callback:(d,y)=>{d?(f&&d.code!==Ee.Timeout&&(d.stack+=`
84
84
 
85
85
  ${f.stack}`),m.unsubscribe(),c.reject(d)):(d=Pb(y),d?(f&&(d.stack+=`
86
86
 
87
- ${f.stack}`),c.reject(d)):c.resolve(y))}});return m.requestSubject=n,this.protocol.publish(n,r,{reply:u,headers:a.headers}),c}else{const u=new Ib(this.protocol.muxSubscriptions,n,a,l);this.protocol.request(u);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:a.headers})}catch(f){u.cancel(f)}const c=Promise.race([u.timer,u.deferred]);return c.catch(()=>{u.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(je.errorForCode(Se.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(je.errorForCode(Se.ConnectionClosed)):this.isDraining()?Promise.reject(je.errorForCode(Se.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 Vt;return n.iterClosed.then(()=>{const r=this.listeners.indexOf(n);this.listeners.splice(r,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((r,a)=>r==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const r=new VE(this,n);if(n.checkAPI!==!1)try{await r.getAccountInfo()}catch(a){const l=a;throw l.code===Se.NoResponders&&(l.code=Se.JetStreamNotEnabled),l}return r}jetstream(n={}){return new vd(this,n)}getServerVersion(){const n=this.info;return n?Wi(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw je.errorForCode(Se.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 KE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(je.errorForCode(Se.ConnectionClosed)):this.isDraining()?Promise.reject(je.errorForCode(Se.ConnectionDraining)):this.protocol.reconnect()}}class KE{constructor(n){A(this,"nc");this.nc=n}add(n){try{return new Rl(this.nc,n).start()}catch(r){return Promise.reject(r)}}client(n,r){return new OE(this.nc,n,r)}}class ZE{constructor(n,r,a){A(this,"bucket");A(this,"sm");A(this,"prefixLen");this.bucket=n,this.prefixLen=r,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Su)||"PUT"}get length(){const n=this.sm.header.get(cn.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class WE{constructor(n,r,a){A(this,"bucket");A(this,"key");A(this,"sm");this.bucket=n,this.key=r,this.sm=a}get value(){return this.sm.data}get created(){return new Date(md(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Su))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const n=((r=this.sm.headers)==null?void 0:r.get(cn.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Zb extends I_{constructor(r,a,l){super(r.nc,a,l);A(this,"js");A(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const a=Fr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const u=this.info;u.config.name=Ci.next(),u.ordered_consumer_sequence.delivery_seq=0,u.flow_control.heartbeat_count=0,u.flow_control.fc_count=0,u.flow_control.consumer_restarts++,u.deliver=a,u.config.deliver_subject=a,u.config.deliver_policy=Lt.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}`,Se.RequestError,m);this.sub.callback(d,{})})}_maybeSetupHbMonitoring(){var a,l;const r=((l=(a=this.info)==null?void 0:a.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(md(r))}_setupHbMonitoring(r,a=0){const l={cancelAfter:0,maxOut:2};a&&(l.cancelAfter=a);const u=this.sub,c=f=>{var y,g,b,x;const m=S_(409,`${Jn.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((y=this.info)==null?void 0:y.ordered))this.sub.callback(null,m);else{if(!this.js.nc.protocol.connected)return!1;const k=((b=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:b.stream_seq)||0;return this._resetOrderedConsumer(k+1),(x=this.monitor)==null||x.restart(),!1}return!u.noIterator};this.monitor=new gd(r,c,l)}_checkHbOrderConsumer(r){const a=r.headers.get(cn.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const l=parseInt(r.headers.get(cn.LastConsumerSeqHdr),10),u=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==u.delivery_seq&&this._resetOrderedConsumer(u.stream_seq+1),!1}_checkOrderedConsumer(r){const a=this.info.ordered_consumer_sequence,l=r.info.streamSequence,u=r.info.deliverySequence;return u!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=u,a.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,a=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${a}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,a=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${a}`,u=await r.api._request(l);return r.last=u,u}}class e2 extends Zb{constructor(n,r,a){super(n,r,a)}pull(n={batch:1}){const{stream:r,config:a,name:l}=this.sub.info,u=a.durable_name??l,c={};if(c.batch=n.batch||1,c.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const d=this.js.nc.features.get(rt.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=At(f));let m=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(m=n.idle_heartbeat,c.idle_heartbeat=At(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 t2(e,n){return e?r2(n):n2(n)}function n2(e){return(n,r)=>n?[n,null]:(n=Xa(r),n?[n,null]:[null,El(r,e)])}function r2(e){return(n,r)=>{if(n)return[n,null];const a=Xa(r);return a!==null?[Wb(a),null]:[null,El(r,e)]}}function Wb(e){if(e!==null)switch(e.code){case Se.JetStream404NoMessages:case Se.JetStream408RequestTimeout:return null;case Se.JetStream409:return __(e)?e:null;default:return e}return null}function i2(e){e&&e.ack()}function a2(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 s2{constructor(n,r){A(this,"msg");A(this,"di");A(this,"didAck");A(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=a2(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]===al[0]&&n[1]===al[1]&&n[2]===al[2]&&n[3]===al[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const r=Ct();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const u=this.msg.publisher,c=!((a=u.options)!=null&&a.noAsyncTraces),f=new Ib(u.muxSubscriptions,this.msg.reply,{timeout:n.timeout},c);u.request(f);try{u.publish(this.msg.reply,h0,{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(h0)}nak(n){let r=qE;n&&(r=yu().encode(`-NAK ${JSON.stringify({delay:At(n)})}`)),this.doAck(r)}working(){this.doAck(al)}next(n,r={batch:1}){const a={};a.batch=r.batch||1,a.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(a.expires=At(r.expires));const l=ar().encode(a),u=ts.concat(HE,FE,l),c=n?{reply:n}:void 0;this.msg.respond(u,c)}term(n=""){let r=IE;(n==null?void 0:n.length)>0&&(r=yu().encode(`+TERM ${n}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const l2="1.30.3",o2="nats.ws";class u2{constructor(){A(this,"version");A(this,"lang");A(this,"closeError");A(this,"connected");A(this,"done");A(this,"socket");A(this,"options");A(this,"socketClosed");A(this,"encrypted");A(this,"peeked");A(this,"yields");A(this,"signal");A(this,"closedNotification");this.version=l2,this.lang=o2,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Ct(),this.closedNotification=Ct()}async connect(n,r){const a=Ct();if(r.tls)return a.reject(new je("tls",Se.InvalidOption)),a;this.options=r;const l=n.src;if(r.wsFactory){const{socket:u,encrypted:c}=await r.wsFactory(n.src,r);this.socket=u,this.encrypted=c}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=u=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(u.data)),this.peeked){this.signal.resolve();return}const c=ts.concat(...this.yields),f=J_(c);if(f!==""){const m=SE.exec(f);if(!m){r.debug&&console.error("!!!",Ko(c)),a.reject(new Error("unexpected response from server"));return}try{const d=JSON.parse(m[1]);xE(d,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(d){a.reject(d);return}}},this.socket.onclose=u=>{if(this.isDiscarded())return;this.socketClosed=!0;let c;this.done||(u.wasClean||(c=new Error(u.reason)),this._closed(c))},this.socket.onerror=u=>{if(this.isDiscarded())return;const c=u,f=new je(c.message,Se.Unknown,new Error(c.error));a.reject(f)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ss(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(`> ${Ko(n[r])}`),yield n[r];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=Ct())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${Ko(n)}`);return}catch(r){this.options.debug&&console.error(`!!! ${Ko(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 c2(e,n){/^(.*:\/\/)(.*)/.test(e)||(typeof n=="boolean"?e=`${n===!0?"https":"http"}://${e}`:e=`https://${e}`);let a=new URL(e);const l=a.protocol.toLowerCase();l==="ws:"&&(n=!1),l==="wss:"&&(n=!0),l!=="https:"&&l!=="http"&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${e}`));let u,c;const f=a.hostname,m=a.pathname,d=a.search||"";switch(l){case"http:":case"ws:":case"nats:":c=a.port||"80",u="ws:";break;case"https:":case"wss:":case"tls:":c=a.port||"443",u="wss:";break;default:c=a.port||n===!0?"443":"80",u=n===!0?"wss:":"ws:";break}return`${u}//${f}:${c}${m}${d}`}function e1(e={}){return F_({defaultPort:443,urlParseFn:c2,factory:()=>new u2}),xd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var ns;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(ns||(ns={}));class ch extends Error{constructor(n,r,a){super(n),this.message=n,this.code=r,this.data=a}}const f2=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"},h2=e=>{const n=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},a=r.Plugins=r.Plugins||{},l=()=>n!==null?n.name:f2(e),u=()=>l()!=="web",c=g=>{const b=d.get(g);return!!(b!=null&&b.platforms.has(l())||f(g))},f=g=>{var b;return(b=r.PluginHeaders)===null||b===void 0?void 0:b.find(x=>x.name===g)},m=g=>e.console.error(g),d=new Map,y=(g,b={})=>{const x=d.get(g);if(x)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),x.proxy;const k=l(),L=f(g);let B;const D=async()=>(!B&&k in b?B=typeof b[k]=="function"?B=await b[k]():B=b[k]:n!==null&&!B&&"web"in b&&(B=typeof b.web=="function"?B=await b.web():B=b.web),B),$=(J,Y)=>{var T,X;if(L){const K=L==null?void 0:L.methods.find(ye=>Y===ye.name);if(K)return K.rtype==="promise"?ye=>r.nativePromise(g,Y.toString(),ye):(ye,ue)=>r.nativeCallback(g,Y.toString(),ye,ue);if(J)return(T=J[Y])===null||T===void 0?void 0:T.bind(J)}else{if(J)return(X=J[Y])===null||X===void 0?void 0:X.bind(J);throw new ch(`"${g}" plugin is not implemented on ${k}`,ns.Unimplemented)}},V=J=>{let Y;const T=(...X)=>{const K=D().then(ye=>{const ue=$(ye,J);if(ue){const q=ue(...X);return Y=q==null?void 0:q.remove,q}else throw new ch(`"${g}.${J}()" is not implemented on ${k}`,ns.Unimplemented)});return J==="addListener"&&(K.remove=async()=>Y()),K};return T.toString=()=>`${J.toString()}() { [capacitor code] }`,Object.defineProperty(T,"name",{value:J,writable:!1,configurable:!1}),T},se=V("addListener"),N=V("removeListener"),R=(J,Y)=>{const T=se({eventName:J},Y),X=async()=>{const ye=await T;N({eventName:J,callbackId:ye},Y)},K=new Promise(ye=>T.then(()=>ye({remove:X})));return K.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await X()},K},G=new Proxy({},{get(J,Y){switch(Y){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return L?R:se;case"removeListener":return N;default:return V(Y)}}});return a[g]=G,d.set(g,{name:g,proxy:G,platforms:new Set([...Object.keys(b),...L?[k]:[]])}),G};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},d2=e=>e.Capacitor=h2(e),ji=d2(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ls=ji.registerPlugin;class wd{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(n,r){let a=!1;this.listeners[n]||(this.listeners[n]=[],a=!0),this.listeners[n].push(r);const u=this.windowListeners[n];u&&!u.registered&&this.addWindowListener(u),a&&this.sendRetainedArgumentsForEvent(n);const c=async()=>this.removeListener(n,r);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const n in this.windowListeners)this.removeWindowListener(this.windowListeners[n]);this.windowListeners={}}notifyListeners(n,r,a){const l=this.listeners[n];if(!l){if(a){let u=this.retainedEventArguments[n];u||(u=[]),u.push(r),this.retainedEventArguments[n]=u}return}l.forEach(u=>u(r))}hasListeners(n){var r;return!!(!((r=this.listeners[n])===null||r===void 0)&&r.length)}registerWindowListener(n,r){this.windowListeners[r]={registered:!1,windowEventName:n,pluginEventName:r,handler:a=>{this.notifyListeners(r,a)}}}unimplemented(n="not implemented"){return new ji.Exception(n,ns.Unimplemented)}unavailable(n="not available"){return new ji.Exception(n,ns.Unavailable)}async removeListener(n,r){const a=this.listeners[n];if(!a)return;const l=a.indexOf(r);this.listeners[n].splice(l,1),this.listeners[n].length||this.removeWindowListener(this.windowListeners[n])}addWindowListener(n){window.addEventListener(n.windowEventName,n.handler),n.registered=!0}removeWindowListener(n){n&&(window.removeEventListener(n.windowEventName,n.handler),n.registered=!1)}sendRetainedArgumentsForEvent(n){const r=this.retainedEventArguments[n];r&&(delete this.retainedEventArguments[n],r.forEach(a=>{this.notifyListeners(n,a)}))}}const m0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),p0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class m2 extends wd{async getCookies(){const n=document.cookie,r={};return n.split(";").forEach(a=>{if(a.length<=0)return;let[l,u]=a.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=p0(l).trim(),u=p0(u).trim(),r[l]=u}),r}async setCookie(n){try{const r=m0(n.key),a=m0(n.value),l=n.expires?`; expires=${n.expires.replace("expires=","")}`:"",u=(n.path||"/").replace("path=",""),c=n.url!=null&&n.url.length>0?`domain=${n.url}`:"";document.cookie=`${r}=${a||""}${l}; path=${u}; ${c};`}catch(r){return Promise.reject(r)}}async deleteCookie(n){try{document.cookie=`${n.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const n=document.cookie.split(";")||[];for(const r of n)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(n){return Promise.reject(n)}}async clearAllCookies(){try{await this.clearCookies()}catch(n){return Promise.reject(n)}}}ls("CapacitorCookies",{web:()=>new m2});const p2=async e=>new Promise((n,r)=>{const a=new FileReader;a.onload=()=>{const l=a.result;n(l.indexOf(",")>=0?l.split(",")[1]:l)},a.onerror=l=>r(l),a.readAsDataURL(e)}),g2=(e={})=>{const n=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[n[c]],l),{})},y2=(e,n=!0)=>e?Object.entries(e).reduce((a,l)=>{const[u,c]=l;let f,m;return Array.isArray(c)?(m="",c.forEach(d=>{f=n?encodeURIComponent(d):d,m+=`${u}=${f}&`}),m.slice(0,-1)):(f=n?encodeURIComponent(c):c,m=`${u}=${f}`),`${a}&${m}`},"").substr(1):null,b2=(e,n={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},n),l=g2(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 v2 extends wd{async request(n){const r=b2(n,n.webFetchExtra),a=y2(n.params,n.shouldEncodeUrlParams),l=a?`${n.url}?${a}`:n.url,u=await fetch(l,r),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?n:{};c.includes("application/json")&&(f="json");let m,d;switch(f){case"arraybuffer":case"blob":d=await u.blob(),m=await p2(d);break;case"json":m=await u.json();break;case"document":case"text":default:m=await u.text()}const y={};return u.headers.forEach((g,b)=>{y[b]=g}),{data:m,headers:y,status:u.status,url:u.url}}async get(n){return this.request(Object.assign(Object.assign({},n),{method:"GET"}))}async post(n){return this.request(Object.assign(Object.assign({},n),{method:"POST"}))}async put(n){return this.request(Object.assign(Object.assign({},n),{method:"PUT"}))}async patch(n){return this.request(Object.assign(Object.assign({},n),{method:"PATCH"}))}async delete(n){return this.request(Object.assign(Object.assign({},n),{method:"DELETE"}))}}ls("CapacitorHttp",{web:()=>new v2});var g0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(g0||(g0={}));var y0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(y0||(y0={}));class x2 extends wd{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")}}ls("SystemBars",{web:()=>new x2});const Sd=ji.isNativePlatform()?"https://app.palmier.me":"";async function t1(e,n,r,a){const l=`${Sd}${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 w2(e,n,r){return t1("POST",e,n)}function S2(e,n){return t1("GET",e,void 0)}const n1=U.createContext({connected:!1,mode:"disconnected",nc:null,request(){return Promise.reject(new Error("No host connection"))},subscribeEvents(){return()=>{}},activeHost:null,unauthorized:!1}),_2=2e3,fh=6e3;function E2({children:e}){const{getActiveHost:n}=Ol(),r=n(),[a,l]=U.useState(null),[u,c]=U.useState(!1),f=U.useRef(null),[m,d]=U.useState(!1),[y,g]=U.useState(!1),b=U.useRef(yu()),x=U.useRef(new Set),k=U.useRef(0),L=r!=null&&!!r.directUrl,B=r?L?m?"direct":"disconnected":u?"nats":"disconnected":"disconnected",D=B!=="disconnected";U.useEffect(()=>{g(!1)},[r==null?void 0:r.hostId,r==null?void 0:r.clientToken]),U.useEffect(()=>{if(L){f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1));return}if(!r)return;let se=!1;async function N(){try{const R=await fetch(`${Sd}/api/config`);if(!R.ok){console.error("[NATS] Failed to fetch config");return}const G=await R.json();if(!G.natsWsUrl){console.warn("[NATS] No WebSocket URL configured");return}if(se)return;console.log("[NATS] Connecting to",G.natsWsUrl);const J=await e1({servers:G.natsWsUrl,token:G.natsToken});if(se){J.close().catch(()=>{});return}console.log("[NATS] Connected"),f.current=J,l(J),c(!0),J.closed().then(()=>{console.log("[NATS] Connection closed"),se||(l(null),c(!1),f.current=null)})}catch(R){console.error("[NATS] Connection failed:",R),se||c(!1)}}return N(),()=>{se=!0,f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1))}},[L,r]),U.useEffect(()=>{if(!r||!L){d(!1);return}const se=new AbortController;async function N(){var Y;const G=new AbortController,J=setTimeout(()=>G.abort(),_2);se.signal.addEventListener("abort",()=>G.abort());try{const T=await fetch(`${r.directUrl}/events`,{headers:{Authorization:`Bearer ${r.clientToken}`},signal:G.signal});return clearTimeout(J),T.ok?((Y=T.body)==null?void 0:Y.getReader())??null:null}catch{return clearTimeout(J),null}}async function R(G){d(!0),console.log("[HOST] SSE connected to",r.directUrl),k.current=Date.now();function J(){setTimeout(()=>{se.signal.aborted||Date.now()-k.current<fh||(console.log("[HOST] Heartbeat timeout — no data for",fh/1e3,"s"),se.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},fh)}J();const Y=new TextDecoder;let T="";try{for(;;){const{done:X,value:K}=await G.read();if(X)break;T+=Y.decode(K,{stream:!0}),k.current=Date.now(),J();const ye=T.split(`
88
- `);T=ye.pop()??"";for(const ue of ye)if(ue.startsWith("data: ")){const q=ue.slice(6);try{const I=JSON.parse(q);if(I.task_id&&I.event_type){const ae=`host-event.${r.hostId}.${I.task_id}`;for(const ge of x.current)ge({subject:ae,data:b.current.encode(q)})}}catch{}}}}catch{}}return(async()=>{const G=await N();G&&await R(G)})(),()=>{se.abort(),d(!1)}},[r,L]);const $=U.useCallback(async(se,N,R)=>{if(!r)throw new Error("No active host");function G(ye){ye&&typeof ye=="object"&&ye.error==="Unauthorized"&&g(!0)}if(L){console.log(`[HOST/HTTP] → ${se}`,N??"");const ye=await fetch(`${r.directUrl}/rpc/${se}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.clientToken}`},body:N!=null?JSON.stringify(N):void 0,signal:R!=null&&R.timeout?AbortSignal.timeout(R.timeout):void 0});if(ye.status===401)throw g(!0),new Error("Unauthorized");const ue=await ye.json();return G(ue),console.log(`[HOST/HTTP] ← ${se}`,ue),ue}if(!f.current)throw new Error("Not connected");const J=`host.${r.hostId}.rpc.${se}`,Y={...N??{},clientToken:r.clientToken},T=b.current.encode(JSON.stringify(Y));console.log(`[HOST/NATS] → ${se}`,N??"");const X=await f.current.request(J,T,{timeout:(R==null?void 0:R.timeout)??1e4}),K=JSON.parse(b.current.decode(X.data));return G(K),console.log(`[HOST/NATS] ← ${se}`,K),K},[r,L]),V=U.useCallback((se,N)=>{if(L)return x.current.add(N),()=>{x.current.delete(N)};if(f.current){const R=f.current.subscribe(`host-event.${se}.>`);let G=!1;return(async()=>{try{for await(const J of R){if(G)break;N({subject:J.subject,data:J.data})}}catch{}})(),()=>{G=!0,R.unsubscribe()}}return()=>{}},[r,L]);return w.jsx(n1.Provider,{value:{connected:D,mode:B,nc:a,request:$,subscribeEvents:V,activeHost:r,unauthorized:y},children:e})}function _d(){return U.useContext(n1)}function _u(e){const n=new Date(e),r=new Date,a=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return n.toDateString()===r.toDateString()?a:`${n.toLocaleDateString(void 0,{month:"short",day:"numeric"})} ${a}`}const r1={};function k2(e){for(const n of e)r1[n.key]=n.label}function Yh(e){return r1[e]??e}const A2=()=>window.matchMedia("(max-width: 600px)").matches;function C2({task:e,lastEvent:n,onEdit:r,onDelete:a,onViewRun:l}){const{request:u}=_d(),[c,f]=U.useState(!1),[m,d]=U.useState(!1),[y,g]=U.useState(!1),b=U.useRef(null),x=(n==null?void 0:n.running_state)==="started",k=!e.triggers_enabled||e.triggers.length===0?"var(--color-text-secondary)":x?"var(--color-success)":(n==null?void 0:n.running_state)==="failed"?"var(--color-error)":"var(--color-success)";U.useEffect(()=>{if(!m)return;function T(X){b.current&&!b.current.contains(X.target)&&d(!1)}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[m]);function L(){A2()?g(!0):d(T=>!T)}function B(){d(!1),g(!1)}async function D(){if(B(),!!confirm("Abort this task?")){f(!0);try{await u("task.abort",{id:e.id})}catch(T){console.error("Abort failed:",T)}finally{f(!1)}}}async function $(){B();try{const T=await u("task.run",{id:e.id});l(e.id,T.run_id)}catch(T){console.error("Run failed:",T)}}async function V(){if(B(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),a(e.id)}catch(T){console.error("Delete failed:",T)}}const se={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function N(T){if(T.length===0)return"";if(T.length===1)return G(T[0]);const X=T.map(R);if(new Set(X.map(ye=>ye.kind)).size===1){const ye=X[0].kind;if(ye==="hourly")return"Every hour";const ue=X.map(q=>q.detail);return`${ye.charAt(0).toUpperCase()+ye.slice(1)}: ${ue.join(", ")}`}return T.map(G).join(", ")}function R(T){if(T.type==="once"){const _e=new Date(T.value);return{kind:"once",detail:isNaN(_e.getTime())?T.value:`${_e.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})} at ${_e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}}const X=T.value.split(" ");if(X.length!==5)return{kind:"unknown",detail:T.value};const[K,ye,ue,,q]=X,I=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(ye==="*")return{kind:"hourly",detail:""};const ae=new Date;ae.setHours(Number(ye),Number(K),0,0);const ge=ae.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return q!=="*"?{kind:"weekly",detail:`${I[Number(q)]??q} at ${ge}`}:ue!=="*"?{kind:"monthly",detail:`day ${ue} at ${ge}`}:{kind:"daily",detail:ge}}function G(T){const X=R(T);return X.kind==="hourly"?"Every hour":X.kind==="once"?`Once on ${X.detail}`:`${X.kind.charAt(0).toUpperCase()+X.kind.slice(1)}: ${X.detail}`}const J=N(e.triggers),Y=w.jsxs(w.Fragment,{children:[w.jsxs("button",{onClick:()=>{B(),r(e)},children:[w.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),w.jsxs("button",{onClick:()=>{B(),l(e.id)},children:[w.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),x?w.jsxs("button",{className:"menu-item-danger",onClick:D,disabled:c,children:[w.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):w.jsxs(w.Fragment,{children:[w.jsxs("button",{onClick:$,children:[w.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),w.jsxs("button",{className:"menu-item-danger",onClick:V,children:[w.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"task-card",onClick:()=>x?l(e.id,"latest"):l(e.id),children:[w.jsxs("div",{className:"task-card-header",children:[w.jsxs("div",{className:"task-card-title-row",children:[x?w.jsx("span",{className:"status-spinner",children:w.jsx("span",{})}):w.jsx("span",{className:"status-dot",style:{backgroundColor:k}}),w.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),w.jsx("div",{className:"task-card-actions",onClick:T=>T.stopPropagation(),children:w.jsxs("div",{className:"task-card-menu",ref:b,children:[w.jsx("button",{className:"task-card-menu-btn",onClick:L,"aria-label":"Task actions",children:"⋮"}),m&&w.jsx("div",{className:"task-card-menu-dropdown",children:Y})]})})]}),w.jsxs("div",{className:"task-card-meta",children:[e.agent&&w.jsx("span",{className:"task-card-agent",children:Yh(e.agent)}),n&&se[n.running_state]&&w.jsxs("span",{className:"task-card-last-event",children:[se[n.running_state]," ",_u(n.time_stamp)]}),e.triggers.length>0&&w.jsx("span",{className:"task-card-triggers",children:e.triggers_enabled?J:"Triggers disabled"})]})]}),y&&du.createPortal(w.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>g(!1),children:w.jsxs("div",{className:"bottom-sheet",onClick:T=>T.stopPropagation(),children:[w.jsx("div",{className:"bottom-sheet-handle"}),w.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),w.jsx("div",{className:"bottom-sheet-actions",children:Y})]})}),document.body)]})}function T2(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const j2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,O2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,N2={};function b0(e,n){return(N2.jsx?O2:j2).test(e)}const R2=/[ \t\n\f\r]/g;function M2(e){return typeof e=="object"?e.type==="text"?v0(e.value):!1:v0(e)}function v0(e){return e.replace(R2,"")===""}class Ml{constructor(n,r,a){this.normal=r,this.property=n,a&&(this.space=a)}}Ml.prototype.normal={};Ml.prototype.property={};Ml.prototype.space=void 0;function i1(e,n){const r={},a={};for(const l of e)Object.assign(r,l.property),Object.assign(a,l.normal);return new Ml(r,a,n)}function Vh(e){return e.toLowerCase()}class bn{constructor(n,r){this.attribute=r,this.property=n}}bn.prototype.attribute="";bn.prototype.booleanish=!1;bn.prototype.boolean=!1;bn.prototype.commaOrSpaceSeparated=!1;bn.prototype.commaSeparated=!1;bn.prototype.defined=!1;bn.prototype.mustUseProperty=!1;bn.prototype.number=!1;bn.prototype.overloadedBoolean=!1;bn.prototype.property="";bn.prototype.spaceSeparated=!1;bn.prototype.space=void 0;let D2=0;const Ye=ra(),Ht=ra(),Jh=ra(),xe=ra(),xt=ra(),Za=ra(),Cn=ra();function ra(){return 2**++D2}const Xh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ye,booleanish:Ht,commaOrSpaceSeparated:Cn,commaSeparated:Za,number:xe,overloadedBoolean:Jh,spaceSeparated:xt},Symbol.toStringTag,{value:"Module"})),hh=Object.keys(Xh);class Ed extends bn{constructor(n,r,a,l){let u=-1;if(super(n,r),x0(this,"space",l),typeof a=="number")for(;++u<hh.length;){const c=hh[u];x0(this,hh[u],(a&Xh[c])===Xh[c])}}}Ed.prototype.defined=!0;function x0(e,n,r){r&&(e[n]=r)}function os(e){const n={},r={};for(const[a,l]of Object.entries(e.properties)){const u=new Ed(a,e.transform(e.attributes||{},a),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(u.mustUseProperty=!0),n[a]=u,r[Vh(a)]=a,r[Vh(u.attribute)]=a}return new Ml(n,r,e.space)}const a1=os({properties:{ariaActiveDescendant:null,ariaAtomic:Ht,ariaAutoComplete:null,ariaBusy:Ht,ariaChecked:Ht,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:xt,ariaCurrent:null,ariaDescribedBy:xt,ariaDetails:null,ariaDisabled:Ht,ariaDropEffect:xt,ariaErrorMessage:null,ariaExpanded:Ht,ariaFlowTo:xt,ariaGrabbed:Ht,ariaHasPopup:null,ariaHidden:Ht,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xt,ariaLevel:xe,ariaLive:null,ariaModal:Ht,ariaMultiLine:Ht,ariaMultiSelectable:Ht,ariaOrientation:null,ariaOwns:xt,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:Ht,ariaReadOnly:Ht,ariaRelevant:null,ariaRequired:Ht,ariaRoleDescription:xt,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:Ht,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 s1(e,n){return n in e?e[n]:n}function l1(e,n){return s1(e,n.toLowerCase())}const z2=os({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Za,acceptCharset:xt,accessKey:xt,action:null,allow:null,allowFullScreen:Ye,allowPaymentRequest:Ye,allowUserMedia:Ye,alt:null,as:null,async:Ye,autoCapitalize:null,autoComplete:xt,autoFocus:Ye,autoPlay:Ye,blocking:xt,capture:null,charSet:null,checked:Ye,cite:null,className:xt,cols:xe,colSpan:null,content:null,contentEditable:Ht,controls:Ye,controlsList:xt,coords:xe|Za,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ye,defer:Ye,dir:null,dirName:null,disabled:Ye,download:Jh,draggable:Ht,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ye,formTarget:null,headers:xt,height:xe,hidden:Jh,high:xe,href:null,hrefLang:null,htmlFor:xt,httpEquiv:xt,id:null,imageSizes:null,imageSrcSet:null,inert:Ye,inputMode:null,integrity:null,is:null,isMap:Ye,itemId:null,itemProp:xt,itemRef:xt,itemScope:Ye,itemType:xt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ye,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:Ye,muted:Ye,name:null,nonce:null,noModule:Ye,noValidate:Ye,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:Ye,optimum:xe,pattern:null,ping:xt,placeholder:null,playsInline:Ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ye,referrerPolicy:null,rel:xt,required:Ye,reversed:Ye,rows:xe,rowSpan:xe,sandbox:xt,scope:null,scoped:Ye,seamless:Ye,selected:Ye,shadowRootClonable:Ye,shadowRootDelegatesFocus:Ye,shadowRootMode:null,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:Ht,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:Ye,useMap:null,value:Ht,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xt,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:Ye,declare:Ye,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:Ye,noHref:Ye,noShade:Ye,noWrap:Ye,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:Ht,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:Ye,disableRemotePlayback:Ye,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:l1}),L2=os({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:Cn,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:xt,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:Ye,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:Za,g2:Za,glyphName:Za,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:Cn,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:xt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Cn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Cn,rev:Cn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Cn,requiredFeatures:Cn,requiredFonts:Cn,requiredFormats:Cn,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:Cn,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:Cn,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:Cn,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:s1}),o1=os({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()}}),u1=os({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:l1}),c1=os({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),U2={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"},B2=/[A-Z]/g,w0=/-[a-z]/g,P2=/^data[-\w.:]+$/i;function q2(e,n){const r=Vh(n);let a=n,l=bn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&P2.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(w0,I2);a="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!w0.test(u)){let c=u.replace(B2,H2);c.charAt(0)!=="-"&&(c="-"+c),n="data"+c}}l=Ed}return new l(a,n)}function H2(e){return"-"+e.toLowerCase()}function I2(e){return e.charAt(1).toUpperCase()}const F2=i1([a1,z2,o1,u1,c1],"html"),kd=i1([a1,L2,o1,u1,c1],"svg");function $2(e){return e.join(" ").trim()}var Ha={},dh,S0;function G2(){if(S0)return dh;S0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
89
- `,d="/",y="*",g="",b="comment",x="declaration";function k(B,D){if(typeof B!="string")throw new TypeError("First argument must be a string");if(!B)return[];D=D||{};var $=1,V=1;function se(ue){var q=ue.match(n);q&&($+=q.length);var I=ue.lastIndexOf(m);V=~I?ue.length-I:V+ue.length}function N(){var ue={line:$,column:V};return function(q){return q.position=new R(ue),Y(),q}}function R(ue){this.start=ue,this.end={line:$,column:V},this.source=D.source}R.prototype.content=B;function G(ue){var q=new Error(D.source+":"+$+":"+V+": "+ue);if(q.reason=ue,q.filename=D.source,q.line=$,q.column=V,q.source=B,!D.silent)throw q}function J(ue){var q=ue.exec(B);if(q){var I=q[0];return se(I),B=B.slice(I.length),q}}function Y(){J(r)}function T(ue){var q;for(ue=ue||[];q=X();)q!==!1&&ue.push(q);return ue}function X(){var ue=N();if(!(d!=B.charAt(0)||y!=B.charAt(1))){for(var q=2;g!=B.charAt(q)&&(y!=B.charAt(q)||d!=B.charAt(q+1));)++q;if(q+=2,g===B.charAt(q-1))return G("End of comment missing");var I=B.slice(2,q-2);return V+=2,se(I),B=B.slice(q),V+=2,ue({type:b,comment:I})}}function K(){var ue=N(),q=J(a);if(q){if(X(),!J(l))return G("property missing ':'");var I=J(u),ae=ue({type:x,property:L(q[0].replace(e,g)),value:I?L(I[0].replace(e,g)):g});return J(c),ae}}function ye(){var ue=[];T(ue);for(var q;q=K();)q!==!1&&(ue.push(q),T(ue));return ue}return Y(),ye()}function L(B){return B?B.replace(f,g):g}return dh=k,dh}var _0;function Y2(){if(_0)return Ha;_0=1;var e=Ha&&Ha.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.default=r;const n=e(G2());function r(a,l){let u=null;if(!a||typeof a!="string")return u;const c=(0,n.default)(a),f=typeof l=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:d,value:y}=m;f?l(d,y,m):y&&(u=u||{},u[d]=y)}),u}return Ha}var sl={},E0;function V2(){if(E0)return sl;E0=1,Object.defineProperty(sl,"__esModule",{value:!0}),sl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(d){return!d||r.test(d)||e.test(d)},c=function(d,y){return y.toUpperCase()},f=function(d,y){return"".concat(y,"-")},m=function(d,y){return y===void 0&&(y={}),u(d)?d:(d=d.toLowerCase(),y.reactCompat?d=d.replace(l,f):d=d.replace(a,f),d.replace(n,c))};return sl.camelCase=m,sl}var ll,k0;function J2(){if(k0)return ll;k0=1;var e=ll&&ll.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},n=e(Y2()),r=V2();function a(l,u){var c={};return!l||typeof l!="string"||(0,n.default)(l,function(f,m){f&&m&&(c[(0,r.camelCase)(f,u)]=m)}),c}return a.default=a,ll=a,ll}var X2=J2();const Q2=mb(X2),f1=h1("end"),Ad=h1("start");function h1(e){return n;function n(r){const a=r&&r.position&&r.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function K2(e){const n=Ad(e),r=f1(e);if(n&&r)return{start:n,end:r}}function yl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?A0(e.position):"start"in e||"end"in e?A0(e):"line"in e||"column"in e?Qh(e):""}function Qh(e){return C0(e&&e.line)+":"+C0(e&&e.column)}function A0(e){return Qh(e&&e.start)+"-"+Qh(e&&e.end)}function C0(e){return e&&typeof e=="number"?e:1}class nn extends Error{constructor(n,r,a){super(),typeof r=="string"&&(a=r,r=void 0);let l="",u={},c=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof n=="string"?l=n:!u.cause&&n&&(c=!0,l=n.message,u.cause=n),!u.ruleId&&!u.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?u.ruleId=a:(u.source=a.slice(0,m),u.ruleId=a.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=yl(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}}nn.prototype.file="";nn.prototype.name="";nn.prototype.reason="";nn.prototype.message="";nn.prototype.stack="";nn.prototype.column=void 0;nn.prototype.line=void 0;nn.prototype.ancestors=void 0;nn.prototype.cause=void 0;nn.prototype.fatal=void 0;nn.prototype.place=void 0;nn.prototype.ruleId=void 0;nn.prototype.source=void 0;const Cd={}.hasOwnProperty,Z2=new Map,W2=/[A-Z]/g,ek=new Set(["table","tbody","thead","tfoot","tr"]),tk=new Set(["td","th"]),d1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function nk(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let a;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=ck(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=uk(r,n.jsx,n.jsxs)}const l={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:a,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?kd:F2,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=m1(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function m1(e,n,r){if(n.type==="element")return rk(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return ik(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return sk(e,n,r);if(n.type==="mdxjsEsm")return ak(e,n);if(n.type==="root")return lk(e,n,r);if(n.type==="text")return ok(e,n)}function rk(e,n,r){const a=e.schema;let l=a;n.tagName.toLowerCase()==="svg"&&a.space==="html"&&(l=kd,e.schema=l),e.ancestors.push(n);const u=g1(e,n.tagName,!1),c=fk(e,n);let f=jd(e,n);return ek.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!M2(m):!0})),p1(e,c,u,n),Td(c,f),e.ancestors.pop(),e.schema=a,e.create(n,u,c,r)}function ik(e,n){if(n.data&&n.data.estree&&e.evaluater){const a=n.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}kl(e,n.position)}function ak(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);kl(e,n.position)}function sk(e,n,r){const a=e.schema;let l=a;n.name==="svg"&&a.space==="html"&&(l=kd,e.schema=l),e.ancestors.push(n);const u=n.name===null?e.Fragment:g1(e,n.name,!0),c=hk(e,n),f=jd(e,n);return p1(e,c,u,n),Td(c,f),e.ancestors.pop(),e.schema=a,e.create(n,u,c,r)}function lk(e,n,r){const a={};return Td(a,jd(e,n)),e.create(n,e.Fragment,a,r)}function ok(e,n){return n.value}function p1(e,n,r,a){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=a)}function Td(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function uk(e,n,r){return a;function a(l,u,c,f){const d=Array.isArray(c.children)?r:n;return f?d(u,c,f):d(u,c)}}function ck(e,n){return r;function r(a,l,u,c){const f=Array.isArray(u.children),m=Ad(a);return n(l,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function fk(e,n){const r={};let a,l;for(l in n.properties)if(l!=="children"&&Cd.call(n.properties,l)){const u=dk(e,l,n.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&tk.has(n.tagName)?a=f:r[c]=f}}if(a){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return r}function hk(e,n){const r={};for(const a of n.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const u=a.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else kl(e,n.position);else{const l=a.name;let u;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const f=a.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else kl(e,n.position);else u=a.value===null?!0:a.value;r[l]=u}return r}function jd(e,n){const r=[];let a=-1;const l=e.passKeys?new Map:Z2;for(;++a<n.children.length;){const u=n.children[a];let c;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const d=l.get(m)||0;c=m+"-"+d,l.set(m,d+1)}}const f=m1(e,u,c);f!==void 0&&r.push(f)}return r}function dk(e,n,r){const a=q2(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=a.commaSeparated?T2(r):$2(r)),a.property==="style"){let l=typeof r=="object"?r:mk(e,String(r));return e.stylePropertyNameCase==="css"&&(l=pk(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&a.space?U2[a.property]||a.property:a.attribute,r]}}function mk(e,n){try{return Q2(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,l=new nn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=d1+"#cannot-parse-style-attribute",l}}function g1(e,n,r){let a;if(!r)a={type:"Literal",value:n};else if(n.includes(".")){const l=n.split(".");let u=-1,c;for(;++u<l.length;){const f=b0(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}a=c}else a=b0(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(a.type==="Literal"){const l=a.value;return Cd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(a);kl(e)}function kl(e,n){const r=new nn("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=d1+"#cannot-handle-mdx-estrees-without-createevaluater",r}function pk(e){const n={};let r;for(r in e)Cd.call(e,r)&&(n[gk(r)]=e[r]);return n}function gk(e){let n=e.replace(W2,yk);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function yk(e){return"-"+e.toLowerCase()}const mh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},bk={};function Od(e,n){const r=bk,a=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return y1(e,a,l)}function y1(e,n,r){if(vk(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 T0(e.children,n,r)}return Array.isArray(e)?T0(e,n,r):""}function T0(e,n,r){const a=[];let l=-1;for(;++l<e.length;)a[l]=y1(e[l],n,r);return a.join("")}function vk(e){return!!(e&&typeof e=="object")}const j0=document.createElement("i");function Nd(e){const n="&"+e+";";j0.innerHTML=n;const r=j0.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function Rn(e,n,r,a){const l=e.length;let u=0,c;if(n<0?n=-n>l?0:l+n:n=n>l?l:n,r=r>0?r:0,a.length<1e4)c=Array.from(a),c.unshift(n,r),e.splice(...c);else for(r&&e.splice(n,r);u<a.length;)c=a.slice(u,u+1e4),c.unshift(n,0),e.splice(...c),u+=1e4,n+=1e4}function Xn(e,n){return e.length>0?(Rn(e,e.length,0,n),e):n}const O0={}.hasOwnProperty;function b1(e){const n={};let r=-1;for(;++r<e.length;)xk(n,e[r]);return n}function xk(e,n){let r;for(r in n){const l=(O0.call(e,r)?e[r]:void 0)||(e[r]={}),u=n[r];let c;if(u)for(c in u){O0.call(l,c)||(l[c]=[]);const f=u[c];wk(l[c],Array.isArray(f)?f:f?[f]:[])}}}function wk(e,n){let r=-1;const a=[];for(;++r<n.length;)(n[r].add==="after"?e:a).push(n[r]);Rn(e,0,0,a)}function v1(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 sr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const un=Oi(/[A-Za-z]/),tn=Oi(/[\dA-Za-z]/),Sk=Oi(/[#-'*+\--9=?A-Z^-~]/);function Eu(e){return e!==null&&(e<32||e===127)}const Kh=Oi(/\d/),_k=Oi(/[\dA-Fa-f]/),Ek=Oi(/[!-/:-@[-`{-~]/);function Le(e){return e!==null&&e<-2}function bt(e){return e!==null&&(e<0||e===32)}function Ke(e){return e===-2||e===-1||e===32}const Du=Oi(new RegExp("\\p{P}|\\p{S}","u")),ea=Oi(/\s/);function Oi(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function us(e){const n=[];let r=-1,a=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&tn(e.charCodeAt(r+1))&&tn(e.charCodeAt(r+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(r+1);u<56320&&f>56319&&f<57344?(c=String.fromCharCode(u,f),l=1):c="�"}else c=String.fromCharCode(u);c&&(n.push(e.slice(a,r),encodeURIComponent(c)),a=r+l+1,c=""),l&&(r+=l,l=0)}return n.join("")+e.slice(a)}function tt(e,n,r,a){const l=a?a-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return Ke(m)?(e.enter(r),f(m)):n(m)}function f(m){return Ke(m)&&u++<l?(e.consume(m),f):(e.exit(r),n(m))}}const kk={tokenize:Ak};function Ak(e){const n=e.attempt(this.parser.constructs.contentInitial,a,l);let r;return n;function a(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),tt(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 Le(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const Ck={tokenize:Tk},N0={tokenize:jk};function Tk(e){const n=this,r=[];let a=0,l,u,c;return f;function f(V){if(a<r.length){const se=r[a];return n.containerState=se[1],e.attempt(se[0].continuation,m,d)(V)}return d(V)}function m(V){if(a++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,l&&$();const se=n.events.length;let N=se,R;for(;N--;)if(n.events[N][0]==="exit"&&n.events[N][1].type==="chunkFlow"){R=n.events[N][1].end;break}D(a);let G=se;for(;G<n.events.length;)n.events[G][1].end={...R},G++;return Rn(n.events,N+1,0,n.events.slice(se)),n.events.length=G,d(V)}return f(V)}function d(V){if(a===r.length){if(!l)return b(V);if(l.currentConstruct&&l.currentConstruct.concrete)return k(V);n.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(N0,y,g)(V)}function y(V){return l&&$(),D(a),b(V)}function g(V){return n.parser.lazy[n.now().line]=a!==r.length,c=n.now().offset,k(V)}function b(V){return n.containerState={},e.attempt(N0,x,k)(V)}function x(V){return a++,r.push([n.currentConstruct,n.containerState]),b(V)}function k(V){if(V===null){l&&$(),D(0),e.consume(V);return}return l=l||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),L(V)}function L(V){if(V===null){B(e.exit("chunkFlow"),!0),D(0),e.consume(V);return}return Le(V)?(e.consume(V),B(e.exit("chunkFlow")),a=0,n.interrupt=void 0,f):(e.consume(V),L)}function B(V,se){const N=n.sliceStream(V);if(se&&N.push(null),V.previous=u,u&&(u.next=V),u=V,l.defineSkip(V.start),l.write(N),n.parser.lazy[V.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 G=n.events.length;let J=G,Y,T;for(;J--;)if(n.events[J][0]==="exit"&&n.events[J][1].type==="chunkFlow"){if(Y){T=n.events[J][1].end;break}Y=!0}for(D(a),R=G;R<n.events.length;)n.events[R][1].end={...T},R++;Rn(n.events,J+1,0,n.events.slice(G)),n.events.length=R}}function D(V){let se=r.length;for(;se-- >V;){const N=r[se];n.containerState=N[1],N[0].exit.call(n,e)}r.length=V}function $(){l.write([null]),u=void 0,l=void 0,n.containerState._closeFlow=void 0}}function jk(e,n,r){return tt(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function rs(e){if(e===null||bt(e)||ea(e))return 1;if(Du(e))return 2}function zu(e,n,r){const a=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!a.includes(u)&&(n=u(n,r),a.push(u))}return n}const Zh={name:"attention",resolveAll:Ok,tokenize:Nk};function Ok(e,n){let r=-1,a,l,u,c,f,m,d,y;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(a=r;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&n.sliceSerialize(e[a][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[a][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[a][1].end},b={...e[r][1].start};R0(g,-m),R0(b,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:b},u={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[r][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[a][1].end={...c.start},e[r][1].start={...f.end},d=[],e[a][1].end.offset-e[a][1].start.offset&&(d=Xn(d,[["enter",e[a][1],n],["exit",e[a][1],n]])),d=Xn(d,[["enter",l,n],["enter",c,n],["exit",c,n],["enter",u,n]]),d=Xn(d,zu(n.parser.constructs.insideSpan.null,e.slice(a+1,r),n)),d=Xn(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=Xn(d,[["enter",e[r][1],n],["exit",e[r][1],n]])):y=0,Rn(e,a-1,r-a+3,d),r=a+d.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function Nk(e,n){const r=this.parser.constructs.attentionMarkers.null,a=this.previous,l=rs(a);let u;return c;function c(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const d=e.exit("attentionSequence"),y=rs(m),g=!y||y===2&&l||r.includes(m),b=!l||l===2&&y||r.includes(a);return d._open=!!(u===42?g:g&&(l||!b)),d._close=!!(u===42?b:b&&(y||!g)),n(m)}}function R0(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const Rk={name:"autolink",tokenize:Mk};function Mk(e,n,r){let a=0;return l;function l(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(x){return un(x)?(e.consume(x),c):x===64?r(x):d(x)}function c(x){return x===43||x===45||x===46||tn(x)?(a=1,f(x)):d(x)}function f(x){return x===58?(e.consume(x),a=0,m):(x===43||x===45||x===46||tn(x))&&a++<32?(e.consume(x),f):(a=0,d(x))}function m(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),n):x===null||x===32||x===60||Eu(x)?r(x):(e.consume(x),m)}function d(x){return x===64?(e.consume(x),y):Sk(x)?(e.consume(x),d):r(x)}function y(x){return tn(x)?g(x):r(x)}function g(x){return x===46?(e.consume(x),a=0,y):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),n):b(x)}function b(x){if((x===45||tn(x))&&a++<63){const k=x===45?b:g;return e.consume(x),k}return r(x)}}const Dl={partial:!0,tokenize:Dk};function Dk(e,n,r){return a;function a(u){return Ke(u)?tt(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Le(u)?n(u):r(u)}}const x1={continuation:{tokenize:Lk},exit:Uk,name:"blockQuote",tokenize:zk};function zk(e,n,r){const a=this;return l;function l(c){if(c===62){const f=a.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return r(c)}function u(c){return Ke(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(c))}}function Lk(e,n,r){const a=this;return l;function l(c){return Ke(c)?tt(e,u,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(x1,n,r)(c)}}function Uk(e){e.exit("blockQuote")}const w1={name:"characterEscape",tokenize:Bk};function Bk(e,n,r){return a;function a(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return Ek(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(u)}}const S1={name:"characterReference",tokenize:Pk};function Pk(e,n,r){const a=this;let l=0,u,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),u=31,c=tn,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=_k,y):(e.enter("characterReferenceValue"),u=7,c=Kh,y(g))}function y(g){if(g===59&&l){const b=e.exit("characterReferenceValue");return c===tn&&!Nd(a.sliceSerialize(b))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return c(g)&&l++<u?(e.consume(g),y):r(g)}}const M0={partial:!0,tokenize:Hk},D0={concrete:!0,name:"codeFenced",tokenize:qk};function qk(e,n,r){const a=this,l={partial:!0,tokenize:N};let u=0,c=0,f;return m;function m(R){return d(R)}function d(R){const G=a.events[a.events.length-1];return u=G&&G[1].type==="linePrefix"?G[2].sliceSerialize(G[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"),Ke(R)?tt(e,g,"whitespace")(R):g(R))}function g(R){return R===null||Le(R)?(e.exit("codeFencedFence"),a.interrupt?n(R):e.check(M0,L,se)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(R))}function b(R){return R===null||Le(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):Ke(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),tt(e,x,"whitespace")(R)):R===96&&R===f?r(R):(e.consume(R),b)}function x(R){return R===null||Le(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(R))}function k(R){return R===null||Le(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===f?r(R):(e.consume(R),k)}function L(R){return e.attempt(l,se,B)(R)}function B(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),D}function D(R){return u>0&&Ke(R)?tt(e,$,"linePrefix",u+1)(R):$(R)}function $(R){return R===null||Le(R)?e.check(M0,L,se)(R):(e.enter("codeFlowValue"),V(R))}function V(R){return R===null||Le(R)?(e.exit("codeFlowValue"),$(R)):(e.consume(R),V)}function se(R){return e.exit("codeFenced"),n(R)}function N(R,G,J){let Y=0;return T;function T(q){return R.enter("lineEnding"),R.consume(q),R.exit("lineEnding"),X}function X(q){return R.enter("codeFencedFence"),Ke(q)?tt(R,K,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):K(q)}function K(q){return q===f?(R.enter("codeFencedFenceSequence"),ye(q)):J(q)}function ye(q){return q===f?(Y++,R.consume(q),ye):Y>=c?(R.exit("codeFencedFenceSequence"),Ke(q)?tt(R,ue,"whitespace")(q):ue(q)):J(q)}function ue(q){return q===null||Le(q)?(R.exit("codeFencedFence"),G(q)):J(q)}}}function Hk(e,n,r){const a=this;return l;function l(c){return c===null?r(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return a.parser.lazy[a.now().line]?r(c):n(c)}}const ph={name:"codeIndented",tokenize:Fk},Ik={partial:!0,tokenize:$k};function Fk(e,n,r){const a=this;return l;function l(d){return e.enter("codeIndented"),tt(e,u,"linePrefix",5)(d)}function u(d){const y=a.events[a.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?c(d):r(d)}function c(d){return d===null?m(d):Le(d)?e.attempt(Ik,c,m)(d):(e.enter("codeFlowValue"),f(d))}function f(d){return d===null||Le(d)?(e.exit("codeFlowValue"),c(d)):(e.consume(d),f)}function m(d){return e.exit("codeIndented"),n(d)}}function $k(e,n,r){const a=this;return l;function l(c){return a.parser.lazy[a.now().line]?r(c):Le(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):tt(e,u,"linePrefix",5)(c)}function u(c){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):Le(c)?l(c):r(c)}}const Gk={name:"codeText",previous:Vk,resolve:Yk,tokenize:Jk};function Yk(e){let n=e.length-4,r=3,a,l;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(a=r;++a<n;)if(e[a][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(a=r-1,n++;++a<=n;)l===void 0?a!==n&&e[a][1].type!=="lineEnding"&&(l=a):(a===n||e[a][1].type==="lineEnding")&&(e[l][1].type="codeTextData",a!==l+2&&(e[l][1].end=e[a-1][1].end,e.splice(l+2,a-l-2),n-=a-l-2,a=l+2),l=void 0);return e}function Vk(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Jk(e,n,r){let a=0,l,u;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),a++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(u=e.enter("codeTextSequence"),l=0,y(g)):Le(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||Le(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),d)}function y(g){return g===96?(e.consume(g),l++,y):l===a?(e.exit("codeTextSequence"),e.exit("codeText"),n(g)):(u.type="codeTextData",d(g))}}class Xk{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const a=r??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(n,a):n>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(n,r,a){const l=r||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return a&&ol(this.left,a),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),ol(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),ol(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);ol(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);ol(this.left,r.reverse())}}}function ol(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 _1(e){const n={};let r=-1,a,l,u,c,f,m,d;const y=new Xk(e);for(;++r<y.length;){for(;r in n;)r=n[r];if(a=y.get(r),r&&a[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(m=a[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(a[0]==="enter")a[1].contentType&&(Object.assign(n,Qk(y,r)),r=n[r],d=!0);else if(a[1]._container){for(u=r,l=void 0;u--;)if(c=y.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(y.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(a[1].end={...y.get(l)[1].start},f=y.slice(l,r),f.unshift(a),y.splice(l,r-l+1,f))}}return Rn(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!d}function Qk(e,n){const r=e.get(n)[1],a=e.get(n)[2];let l=n-1;const u=[];let c=r._tokenizer;c||(c=a.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],d={};let y,g,b=-1,x=r,k=0,L=0;const B=[L];for(;x;){for(;e.get(++l)[1]!==x;);u.push(l),x._tokenizer||(y=a.sliceStream(x),x.next||y.push(null),g&&c.defineSkip(x.start),x._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),x._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=r;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(L=b+1,B.push(L),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(c.events=[],x?(x._tokenizer=void 0,x.previous=void 0):B.pop(),b=B.length;b--;){const D=f.slice(B[b],B[b+1]),$=u.pop();m.push([$,$+D.length-1]),e.splice($,2,D)}for(m.reverse(),b=-1;++b<m.length;)d[k+m[b][0]]=k+m[b][1],k+=m[b][1]-m[b][0]-1;return d}const Kk={resolve:Wk,tokenize:eA},Zk={partial:!0,tokenize:tA};function Wk(e){return _1(e),e}function eA(e,n){let r;return a;function a(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?u(f):Le(f)?e.check(Zk,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 tA(e,n,r){const a=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),tt(e,u,"linePrefix")}function u(c){if(c===null||Le(c))return r(c);const f=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):e.interrupt(a.parser.constructs.flow,r,n)(c)}}function E1(e,n,r,a,l,u,c,f,m){const d=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(D){return D===60?(e.enter(a),e.enter(l),e.enter(u),e.consume(D),e.exit(u),b):D===null||D===32||D===41||Eu(D)?r(D):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),L(D))}function b(D){return D===62?(e.enter(u),e.consume(D),e.exit(u),e.exit(l),e.exit(a),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),x(D))}function x(D){return D===62?(e.exit("chunkString"),e.exit(f),b(D)):D===null||D===60||Le(D)?r(D):(e.consume(D),D===92?k:x)}function k(D){return D===60||D===62||D===92?(e.consume(D),x):x(D)}function L(D){return!y&&(D===null||D===41||bt(D))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),n(D)):y<d&&D===40?(e.consume(D),y++,L):D===41?(e.consume(D),y--,L):D===null||D===32||D===40||Eu(D)?r(D):(e.consume(D),D===92?B:L)}function B(D){return D===40||D===41||D===92?(e.consume(D),L):L(D)}}function k1(e,n,r,a,l,u){const c=this;let f=0,m;return d;function d(x){return e.enter(a),e.enter(l),e.consume(x),e.exit(l),e.enter(u),y}function y(x){return f>999||x===null||x===91||x===93&&!m||x===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(x):x===93?(e.exit(u),e.enter(l),e.consume(x),e.exit(l),e.exit(a),n):Le(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||Le(x)||f++>999?(e.exit("chunkString"),y(x)):(e.consume(x),m||(m=!Ke(x)),x===92?b:g)}function b(x){return x===91||x===92||x===93?(e.consume(x),f++,g):g(x)}}function A1(e,n,r,a,l,u){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(a),e.enter(l),e.consume(b),e.exit(l),c=b===40?41:b,m):r(b)}function m(b){return b===c?(e.enter(l),e.consume(b),e.exit(l),e.exit(a),n):(e.enter(u),d(b))}function d(b){return b===c?(e.exit(u),m(c)):b===null?r(b):Le(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),tt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===c||b===null||Le(b)?(e.exit("chunkString"),d(b)):(e.consume(b),b===92?g:y)}function g(b){return b===c||b===92?(e.consume(b),y):y(b)}}function bl(e,n){let r;return a;function a(l){return Le(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,a):Ke(l)?tt(e,a,r?"linePrefix":"lineSuffix")(l):n(l)}}const nA={name:"definition",tokenize:iA},rA={partial:!0,tokenize:aA};function iA(e,n,r){const a=this;let l;return u;function u(x){return e.enter("definition"),c(x)}function c(x){return k1.call(a,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function f(x){return l=sr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),m):r(x)}function m(x){return bt(x)?bl(e,d)(x):d(x)}function d(x){return E1(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function y(x){return e.attempt(rA,g,g)(x)}function g(x){return Ke(x)?tt(e,b,"whitespace")(x):b(x)}function b(x){return x===null||Le(x)?(e.exit("definition"),a.parser.defined.push(l),n(x)):r(x)}}function aA(e,n,r){return a;function a(f){return bt(f)?bl(e,l)(f):r(f)}function l(f){return A1(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return Ke(f)?tt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Le(f)?n(f):r(f)}}const sA={name:"hardBreakEscape",tokenize:lA};function lA(e,n,r){return a;function a(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Le(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const oA={name:"headingAtx",resolve:uA,tokenize:cA};function uA(e,n){let r=e.length-2,a=3,l,u;return e[a][1].type==="whitespace"&&(a+=2),r-2>a&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(a===r-1||r-4>a&&e[r-2][1].type==="whitespace")&&(r-=a+1===r?2:4),r>a&&(l={type:"atxHeadingText",start:e[a][1].start,end:e[r][1].end},u={type:"chunkText",start:e[a][1].start,end:e[r][1].end,contentType:"text"},Rn(e,a,r-a+1,[["enter",l,n],["enter",u,n],["exit",u,n],["exit",l,n]])),e}function cA(e,n,r){let a=0;return l;function l(y){return e.enter("atxHeading"),u(y)}function u(y){return e.enter("atxHeadingSequence"),c(y)}function c(y){return y===35&&a++<6?(e.consume(y),c):y===null||bt(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||Le(y)?(e.exit("atxHeading"),n(y)):Ke(y)?tt(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||bt(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),d)}}const fA=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],z0=["pre","script","style","textarea"],hA={concrete:!0,name:"htmlFlow",resolveTo:pA,tokenize:gA},dA={partial:!0,tokenize:bA},mA={partial:!0,tokenize:yA};function pA(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 gA(e,n,r){const a=this;let l,u,c,f,m;return d;function d(S){return y(S)}function y(S){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(S),g}function g(S){return S===33?(e.consume(S),b):S===47?(e.consume(S),u=!0,L):S===63?(e.consume(S),l=3,a.interrupt?n:O):un(S)?(e.consume(S),c=String.fromCharCode(S),B):r(S)}function b(S){return S===45?(e.consume(S),l=2,x):S===91?(e.consume(S),l=5,f=0,k):un(S)?(e.consume(S),l=4,a.interrupt?n:O):r(S)}function x(S){return S===45?(e.consume(S),a.interrupt?n:O):r(S)}function k(S){const he="CDATA[";return S===he.charCodeAt(f++)?(e.consume(S),f===he.length?a.interrupt?n:K:k):r(S)}function L(S){return un(S)?(e.consume(S),c=String.fromCharCode(S),B):r(S)}function B(S){if(S===null||S===47||S===62||bt(S)){const he=S===47,fe=c.toLowerCase();return!he&&!u&&z0.includes(fe)?(l=1,a.interrupt?n(S):K(S)):fA.includes(c.toLowerCase())?(l=6,he?(e.consume(S),D):a.interrupt?n(S):K(S)):(l=7,a.interrupt&&!a.parser.lazy[a.now().line]?r(S):u?$(S):V(S))}return S===45||tn(S)?(e.consume(S),c+=String.fromCharCode(S),B):r(S)}function D(S){return S===62?(e.consume(S),a.interrupt?n:K):r(S)}function $(S){return Ke(S)?(e.consume(S),$):T(S)}function V(S){return S===47?(e.consume(S),T):S===58||S===95||un(S)?(e.consume(S),se):Ke(S)?(e.consume(S),V):T(S)}function se(S){return S===45||S===46||S===58||S===95||tn(S)?(e.consume(S),se):N(S)}function N(S){return S===61?(e.consume(S),R):Ke(S)?(e.consume(S),N):V(S)}function R(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(e.consume(S),m=S,G):Ke(S)?(e.consume(S),R):J(S)}function G(S){return S===m?(e.consume(S),m=null,Y):S===null||Le(S)?r(S):(e.consume(S),G)}function J(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||bt(S)?N(S):(e.consume(S),J)}function Y(S){return S===47||S===62||Ke(S)?V(S):r(S)}function T(S){return S===62?(e.consume(S),X):r(S)}function X(S){return S===null||Le(S)?K(S):Ke(S)?(e.consume(S),X):r(S)}function K(S){return S===45&&l===2?(e.consume(S),I):S===60&&l===1?(e.consume(S),ae):S===62&&l===4?(e.consume(S),M):S===63&&l===3?(e.consume(S),O):S===93&&l===5?(e.consume(S),_e):Le(S)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(dA,W,ye)(S)):S===null||Le(S)?(e.exit("htmlFlowData"),ye(S)):(e.consume(S),K)}function ye(S){return e.check(mA,ue,W)(S)}function ue(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),q}function q(S){return S===null||Le(S)?ye(S):(e.enter("htmlFlowData"),K(S))}function I(S){return S===45?(e.consume(S),O):K(S)}function ae(S){return S===47?(e.consume(S),c="",ge):K(S)}function ge(S){if(S===62){const he=c.toLowerCase();return z0.includes(he)?(e.consume(S),M):K(S)}return un(S)&&c.length<8?(e.consume(S),c+=String.fromCharCode(S),ge):K(S)}function _e(S){return S===93?(e.consume(S),O):K(S)}function O(S){return S===62?(e.consume(S),M):S===45&&l===2?(e.consume(S),O):K(S)}function M(S){return S===null||Le(S)?(e.exit("htmlFlowData"),W(S)):(e.consume(S),M)}function W(S){return e.exit("htmlFlow"),n(S)}}function yA(e,n,r){const a=this;return l;function l(c){return Le(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return a.parser.lazy[a.now().line]?r(c):n(c)}}function bA(e,n,r){return a;function a(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Dl,n,r)}}const vA={name:"htmlText",tokenize:xA};function xA(e,n,r){const a=this;let l,u,c;return f;function f(O){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(O),m}function m(O){return O===33?(e.consume(O),d):O===47?(e.consume(O),N):O===63?(e.consume(O),V):un(O)?(e.consume(O),J):r(O)}function d(O){return O===45?(e.consume(O),y):O===91?(e.consume(O),u=0,k):un(O)?(e.consume(O),$):r(O)}function y(O){return O===45?(e.consume(O),x):r(O)}function g(O){return O===null?r(O):O===45?(e.consume(O),b):Le(O)?(c=g,ae(O)):(e.consume(O),g)}function b(O){return O===45?(e.consume(O),x):g(O)}function x(O){return O===62?I(O):O===45?b(O):g(O)}function k(O){const M="CDATA[";return O===M.charCodeAt(u++)?(e.consume(O),u===M.length?L:k):r(O)}function L(O){return O===null?r(O):O===93?(e.consume(O),B):Le(O)?(c=L,ae(O)):(e.consume(O),L)}function B(O){return O===93?(e.consume(O),D):L(O)}function D(O){return O===62?I(O):O===93?(e.consume(O),D):L(O)}function $(O){return O===null||O===62?I(O):Le(O)?(c=$,ae(O)):(e.consume(O),$)}function V(O){return O===null?r(O):O===63?(e.consume(O),se):Le(O)?(c=V,ae(O)):(e.consume(O),V)}function se(O){return O===62?I(O):V(O)}function N(O){return un(O)?(e.consume(O),R):r(O)}function R(O){return O===45||tn(O)?(e.consume(O),R):G(O)}function G(O){return Le(O)?(c=G,ae(O)):Ke(O)?(e.consume(O),G):I(O)}function J(O){return O===45||tn(O)?(e.consume(O),J):O===47||O===62||bt(O)?Y(O):r(O)}function Y(O){return O===47?(e.consume(O),I):O===58||O===95||un(O)?(e.consume(O),T):Le(O)?(c=Y,ae(O)):Ke(O)?(e.consume(O),Y):I(O)}function T(O){return O===45||O===46||O===58||O===95||tn(O)?(e.consume(O),T):X(O)}function X(O){return O===61?(e.consume(O),K):Le(O)?(c=X,ae(O)):Ke(O)?(e.consume(O),X):Y(O)}function K(O){return O===null||O===60||O===61||O===62||O===96?r(O):O===34||O===39?(e.consume(O),l=O,ye):Le(O)?(c=K,ae(O)):Ke(O)?(e.consume(O),K):(e.consume(O),ue)}function ye(O){return O===l?(e.consume(O),l=void 0,q):O===null?r(O):Le(O)?(c=ye,ae(O)):(e.consume(O),ye)}function ue(O){return O===null||O===34||O===39||O===60||O===61||O===96?r(O):O===47||O===62||bt(O)?Y(O):(e.consume(O),ue)}function q(O){return O===47||O===62||bt(O)?Y(O):r(O)}function I(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),n):r(O)}function ae(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),ge}function ge(O){return Ke(O)?tt(e,_e,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):_e(O)}function _e(O){return e.enter("htmlTextData"),c(O)}}const Rd={name:"labelEnd",resolveAll:EA,resolveTo:kA,tokenize:AA},wA={tokenize:CA},SA={tokenize:TA},_A={tokenize:jA};function EA(e){let n=-1;const r=[];for(;++n<e.length;){const a=e[n][1];if(r.push(e[n]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const l=a.type==="labelImage"?4:2;a.type="data",n+=l}}return e.length!==r.length&&Rn(e,0,e.length,r),e}function kA(e,n){let r=e.length,a=0,l,u,c,f;for(;r--;)if(l=e[r][1],u){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[r][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(c){if(e[r][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(u=r,l.type!=="labelLink")){a=2;break}}else l.type==="labelEnd"&&(c=r);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},y={type:"labelText",start:{...e[u+a+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,n],["enter",d,n]],f=Xn(f,e.slice(u+1,u+a+3)),f=Xn(f,[["enter",y,n]]),f=Xn(f,zu(n.parser.constructs.insideSpan.null,e.slice(u+a+4,c-3),n)),f=Xn(f,[["exit",y,n],e[c-2],e[c-1],["exit",d,n]]),f=Xn(f,e.slice(c+1)),f=Xn(f,[["exit",m,n]]),Rn(e,u,e.length,f),e}function AA(e,n,r){const a=this;let l=a.events.length,u,c;for(;l--;)if((a.events[l][1].type==="labelImage"||a.events[l][1].type==="labelLink")&&!a.events[l][1]._balanced){u=a.events[l][1];break}return f;function f(b){return u?u._inactive?g(b):(c=a.parser.defined.includes(sr(a.sliceSerialize({start:u.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),m):r(b)}function m(b){return b===40?e.attempt(wA,y,c?y:g)(b):b===91?e.attempt(SA,y,c?d:g)(b):c?y(b):g(b)}function d(b){return e.attempt(_A,y,g)(b)}function y(b){return n(b)}function g(b){return u._balanced=!0,r(b)}}function CA(e,n,r){return a;function a(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return bt(g)?bl(e,u)(g):u(g)}function u(g){return g===41?y(g):E1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return bt(g)?bl(e,m)(g):y(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?A1(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function d(g){return bt(g)?bl(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 TA(e,n,r){const a=this;return l;function l(f){return k1.call(a,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return a.parser.defined.includes(sr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function c(f){return r(f)}}function jA(e,n,r){return a;function a(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),l}function l(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),n):r(u)}}const OA={name:"labelStartImage",resolveAll:Rd.resolveAll,tokenize:NA};function NA(e,n,r){const a=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):r(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(f):n(f)}}const RA={name:"labelStartLink",resolveAll:Rd.resolveAll,tokenize:MA};function MA(e,n,r){const a=this;return l;function l(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(c):n(c)}}const gh={name:"lineEnding",tokenize:DA};function DA(e,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),tt(e,n,"linePrefix")}}const fu={name:"thematicBreak",tokenize:zA};function zA(e,n,r){let a=0,l;return u;function u(d){return e.enter("thematicBreak"),c(d)}function c(d){return l=d,f(d)}function f(d){return d===l?(e.enter("thematicBreakSequence"),m(d)):a>=3&&(d===null||Le(d))?(e.exit("thematicBreak"),n(d)):r(d)}function m(d){return d===l?(e.consume(d),a++,m):(e.exit("thematicBreakSequence"),Ke(d)?tt(e,f,"whitespace")(d):f(d))}}const yn={continuation:{tokenize:PA},exit:HA,name:"list",tokenize:BA},LA={partial:!0,tokenize:IA},UA={partial:!0,tokenize:qA};function BA(e,n,r){const a=this,l=a.events[a.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return f;function f(x){const k=a.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||x===a.containerState.marker:Kh(x)){if(a.containerState.type||(a.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(fu,r,d)(x):d(x);if(!a.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(x)}return r(x)}function m(x){return Kh(x)&&++c<10?(e.consume(x),m):(!a.interrupt||c<2)&&(a.containerState.marker?x===a.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),d(x)):r(x)}function d(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||x,e.check(Dl,a.interrupt?r:y,e.attempt(LA,b,g))}function y(x){return a.containerState.initialBlankLine=!0,u++,b(x)}function g(x){return Ke(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),b):r(x)}function b(x){return a.containerState.size=u+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(x)}}function PA(e,n,r){const a=this;return a.containerState._closeFlow=void 0,e.check(Dl,l,u);function l(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,tt(e,n,"listItemIndent",a.containerState.size+1)(f)}function u(f){return a.containerState.furtherBlankLines||!Ke(f)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(f)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(UA,n,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,tt(e,e.attempt(yn,n,r),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function qA(e,n,r){const a=this;return tt(e,l,"listItemIndent",a.containerState.size+1);function l(u){const c=a.events[a.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===a.containerState.size?n(u):r(u)}}function HA(e){e.exit(this.containerState.type)}function IA(e,n,r){const a=this;return tt(e,l,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const c=a.events[a.events.length-1];return!Ke(u)&&c&&c[1].type==="listItemPrefixWhitespace"?n(u):r(u)}}const L0={name:"setextUnderline",resolveTo:FA,tokenize:$A};function FA(e,n){let r=e.length,a,l,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){a=r;break}e[r][1].type==="paragraph"&&(l=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const c={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",u?(e.splice(l,0,["enter",c,n]),e.splice(u+1,0,["exit",e[a][1],n]),e[a][1].end={...e[u][1].end}):e[a][1]=c,e.push(["exit",c,n]),e}function $A(e,n,r){const a=this;let l;return u;function u(d){let y=a.events.length,g;for(;y--;)if(a.events[y][1].type!=="lineEnding"&&a.events[y][1].type!=="linePrefix"&&a.events[y][1].type!=="content"){g=a.events[y][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||g)?(e.enter("setextHeadingLine"),l=d,c(d)):r(d)}function c(d){return e.enter("setextHeadingLineSequence"),f(d)}function f(d){return d===l?(e.consume(d),f):(e.exit("setextHeadingLineSequence"),Ke(d)?tt(e,m,"lineSuffix")(d):m(d))}function m(d){return d===null||Le(d)?(e.exit("setextHeadingLine"),n(d)):r(d)}}const GA={tokenize:YA};function YA(e){const n=this,r=e.attempt(Dl,a,e.attempt(this.parser.constructs.flowInitial,l,tt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(Kk,l)),"linePrefix")));return r;function a(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const VA={resolveAll:T1()},JA=C1("string"),XA=C1("text");function C1(e){return{resolveAll:T1(e==="text"?QA:void 0),tokenize:n};function n(r){const a=this,l=this.parser.constructs[e],u=r.attempt(l,c,f);return c;function c(y){return d(y)?u(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),m}function m(y){return d(y)?(r.exit("data"),u(y)):(r.consume(y),m)}function d(y){if(y===null)return!0;const g=l[y];let b=-1;if(g)for(;++b<g.length;){const x=g[b];if(!x.previous||x.previous.call(a,a.previous))return!0}return!1}}}function T1(e){return n;function n(r,a){let l=-1,u;for(;++l<=r.length;)u===void 0?r[l]&&r[l][1].type==="data"&&(u=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==u+2&&(r[u][1].end=r[l-1][1].end,r.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(r,a):r}}function QA(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const a=e[r-1][1],l=n.sliceStream(a);let u=l.length,c=-1,f=0,m;for(;u--;){const d=l[u];if(typeof d=="string"){for(c=d.length;d.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(d===-2)m=!0,f++;else if(d!==-1){u++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(f=0),f){const d={type:r===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:a.start._bufferIndex+c,_index:a.start._index+u,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...d.start},a.start.offset===a.end.offset?Object.assign(a,d):(e.splice(r,0,["enter",d,n],["exit",d,n]),r+=2)}r++}return e}const KA={42:yn,43:yn,45:yn,48:yn,49:yn,50:yn,51:yn,52:yn,53:yn,54:yn,55:yn,56:yn,57:yn,62:x1},ZA={91:nA},WA={[-2]:ph,[-1]:ph,32:ph},eC={35:oA,42:fu,45:[L0,fu],60:hA,61:L0,95:fu,96:D0,126:D0},tC={38:S1,92:w1},nC={[-5]:gh,[-4]:gh,[-3]:gh,33:OA,38:S1,42:Zh,60:[Rk,vA],91:RA,92:[sA,w1],93:Rd,95:Zh,96:Gk},rC={null:[Zh,VA]},iC={null:[42,95]},aC={null:[]},sC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:iC,contentInitial:ZA,disable:aC,document:KA,flow:eC,flowInitial:WA,insideSpan:rC,string:tC,text:nC},Symbol.toStringTag,{value:"Module"}));function lC(e,n,r){let a={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const l={},u=[];let c=[],f=[];const m={attempt:G(N),check:G(R),consume:$,enter:V,exit:se,interrupt:G(R,{interrupt:!0})},d={code:null,containerState:{},defineSkip:L,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:x,write:g};let y=n.tokenize.call(d,m);return n.resolveAll&&u.push(n),d;function g(X){return c=Xn(c,X),B(),c[c.length-1]!==null?[]:(J(n,0),d.events=zu(u,d.events,d),d.events)}function b(X,K){return uC(x(X),K)}function x(X){return oC(c,X)}function k(){const{_bufferIndex:X,_index:K,line:ye,column:ue,offset:q}=a;return{_bufferIndex:X,_index:K,line:ye,column:ue,offset:q}}function L(X){l[X.line]=X.column,T()}function B(){let X;for(;a._index<c.length;){const K=c[a._index];if(typeof K=="string")for(X=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===X&&a._bufferIndex<K.length;)D(K.charCodeAt(a._bufferIndex));else D(K)}}function D(X){y=y(X)}function $(X){Le(X)?(a.line++,a.column=1,a.offset+=X===-3?2:1,T()):X!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===c[a._index].length&&(a._bufferIndex=-1,a._index++)),d.previous=X}function V(X,K){const ye=K||{};return ye.type=X,ye.start=k(),d.events.push(["enter",ye,d]),f.push(ye),ye}function se(X){const K=f.pop();return K.end=k(),d.events.push(["exit",K,d]),K}function N(X,K){J(X,K.from)}function R(X,K){K.restore()}function G(X,K){return ye;function ye(ue,q,I){let ae,ge,_e,O;return Array.isArray(ue)?W(ue):"tokenize"in ue?W([ue]):M(ue);function M(ve){return Te;function Te(ze){const ke=ze!==null&&ve[ze],Me=ze!==null&&ve.null,wt=[...Array.isArray(ke)?ke:ke?[ke]:[],...Array.isArray(Me)?Me:Me?[Me]:[]];return W(wt)(ze)}}function W(ve){return ae=ve,ge=0,ve.length===0?I:S(ve[ge])}function S(ve){return Te;function Te(ze){return O=Y(),_e=ve,ve.partial||(d.currentConstruct=ve),ve.name&&d.parser.constructs.disable.null.includes(ve.name)?fe():ve.tokenize.call(K?Object.assign(Object.create(d),K):d,m,he,fe)(ze)}}function he(ve){return X(_e,O),q}function fe(ve){return O.restore(),++ge<ae.length?S(ae[ge]):I}}}function J(X,K){X.resolveAll&&!u.includes(X)&&u.push(X),X.resolve&&Rn(d.events,K,d.events.length-K,X.resolve(d.events.slice(K),d)),X.resolveTo&&(d.events=X.resolveTo(d.events,d))}function Y(){const X=k(),K=d.previous,ye=d.currentConstruct,ue=d.events.length,q=Array.from(f);return{from:ue,restore:I};function I(){a=X,d.previous=K,d.currentConstruct=ye,d.events.length=ue,f=q,T()}}function T(){a.line in l&&a.column<2&&(a.column=l[a.line],a.offset+=l[a.line]-1)}}function oC(e,n){const r=n.start._index,a=n.start._bufferIndex,l=n.end._index,u=n.end._bufferIndex;let c;if(r===l)c=[e[r].slice(a,u)];else{if(c=e.slice(r,l),a>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(a):c.shift()}u>0&&c.push(e[l].slice(0,u))}return c}function uC(e,n){let r=-1;const a=[];let l;for(;++r<e.length;){const u=e[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
87
+ ${f.stack}`),c.reject(d)):c.resolve(y))}});return m.requestSubject=n,this.protocol.publish(n,r,{reply:u,headers:a.headers}),c}else{const u=new Ib(this.protocol.muxSubscriptions,n,a,l);this.protocol.request(u);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:a.headers})}catch(f){u.cancel(f)}const c=Promise.race([u.timer,u.deferred]);return c.catch(()=>{u.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(Oe.errorForCode(Ee.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Oe.errorForCode(Ee.ConnectionClosed)):this.isDraining()?Promise.reject(Oe.errorForCode(Ee.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new Gt;return n.iterClosed.then(()=>{const r=this.listeners.indexOf(n);this.listeners.splice(r,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((r,a)=>r==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const r=new VE(this,n);if(n.checkAPI!==!1)try{await r.getAccountInfo()}catch(a){const l=a;throw l.code===Ee.NoResponders&&(l.code=Ee.JetStreamNotEnabled),l}return r}jetstream(n={}){return new yd(this,n)}getServerVersion(){const n=this.info;return n?Zi(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Oe.errorForCode(Ee.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new KE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Oe.errorForCode(Ee.ConnectionClosed)):this.isDraining()?Promise.reject(Oe.errorForCode(Ee.ConnectionDraining)):this.protocol.reconnect()}}class KE{constructor(n){A(this,"nc");this.nc=n}add(n){try{return new Rl(this.nc,n).start()}catch(r){return Promise.reject(r)}}client(n,r){return new jE(this.nc,n,r)}}class ZE{constructor(n,r,a){A(this,"bucket");A(this,"sm");A(this,"prefixLen");this.bucket=n,this.prefixLen=r,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Su)||"PUT"}get length(){const n=this.sm.header.get(on.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class WE{constructor(n,r,a){A(this,"bucket");A(this,"key");A(this,"sm");this.bucket=n,this.key=r,this.sm=a}get value(){return this.sm.data}get created(){return new Date(hd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Su))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const n=((r=this.sm.headers)==null?void 0:r.get(on.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Zb extends I_{constructor(r,a,l){super(r.nc,a,l);A(this,"js");A(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const a=qr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const u=this.info;u.config.name=Ai.next(),u.ordered_consumer_sequence.delivery_seq=0,u.flow_control.heartbeat_count=0,u.flow_control.fc_count=0,u.flow_control.consumer_restarts++,u.deliver=a,u.config.deliver_subject=a,u.config.deliver_policy=Dt.StartSequence,u.config.opt_start_seq=r;const c={};c.stream_name=this.info.stream,c.config=u.config;const f=`${u.api.prefix}.CONSUMER.CREATE.${u.stream}`;this.js._request(f,c,{retries:-1}).then(m=>{const d=m,y=this.sub.info;y.last=d,this.info.config=d.config,this.info.name=d.name}).catch(m=>{const d=new Oe(`unable to recreate ordered consumer ${u.stream} at seq ${r}`,Ee.RequestError,m);this.sub.callback(d,{})})}_maybeSetupHbMonitoring(){var a,l;const r=((l=(a=this.info)==null?void 0:a.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(hd(r))}_setupHbMonitoring(r,a=0){const l={cancelAfter:0,maxOut:2};a&&(l.cancelAfter=a);const u=this.sub,c=f=>{var y,g,b,x;const m=S_(409,`${Yn.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((y=this.info)==null?void 0:y.ordered))this.sub.callback(null,m);else{if(!this.js.nc.protocol.connected)return!1;const k=((b=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:b.stream_seq)||0;return this._resetOrderedConsumer(k+1),(x=this.monitor)==null||x.restart(),!1}return!u.noIterator};this.monitor=new md(r,c,l)}_checkHbOrderConsumer(r){const a=r.headers.get(on.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const l=parseInt(r.headers.get(on.LastConsumerSeqHdr),10),u=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==u.delivery_seq&&this._resetOrderedConsumer(u.stream_seq+1),!1}_checkOrderedConsumer(r){const a=this.info.ordered_consumer_sequence,l=r.info.streamSequence,u=r.info.deliverySequence;return u!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=u,a.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,a=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${a}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,a=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${a}`,u=await r.api._request(l);return r.last=u,u}}class e2 extends Zb{constructor(n,r,a){super(n,r,a)}pull(n={batch:1}){const{stream:r,config:a,name:l}=this.sub.info,u=a.durable_name??l,c={};if(c.batch=n.batch||1,c.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const d=this.js.nc.features.get(rt.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=kt(f));let m=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(m=n.idle_heartbeat,c.idle_heartbeat=kt(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 t2(e,n){return e?r2(n):n2(n)}function n2(e){return(n,r)=>n?[n,null]:(n=Xa(r),n?[n,null]:[null,El(r,e)])}function r2(e){return(n,r)=>{if(n)return[n,null];const a=Xa(r);return a!==null?[Wb(a),null]:[null,El(r,e)]}}function Wb(e){if(e!==null)switch(e.code){case Ee.JetStream404NoMessages:case Ee.JetStream408RequestTimeout:return null;case Ee.JetStream409:return __(e)?e:null;default:return e}return null}function i2(e){e&&e.ack()}function a2(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 s2{constructor(n,r){A(this,"msg");A(this,"di");A(this,"didAck");A(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=a2(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]===al[0]&&n[1]===al[1]&&n[2]===al[2]&&n[3]===al[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const r=At();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const u=this.msg.publisher,c=!((a=u.options)!=null&&a.noAsyncTraces),f=new Ib(u.muxSubscriptions,this.msg.reply,{timeout:n.timeout},c);u.request(f);try{u.publish(this.msg.reply,c0,{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(c0)}nak(n){let r=qE;n&&(r=yu().encode(`-NAK ${JSON.stringify({delay:kt(n)})}`)),this.doAck(r)}working(){this.doAck(al)}next(n,r={batch:1}){const a={};a.batch=r.batch||1,a.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(a.expires=kt(r.expires));const l=ir().encode(a),u=ts.concat(HE,FE,l),c=n?{reply:n}:void 0;this.msg.respond(u,c)}term(n=""){let r=IE;(n==null?void 0:n.length)>0&&(r=yu().encode(`+TERM ${n}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const l2="1.30.3",o2="nats.ws";class u2{constructor(){A(this,"version");A(this,"lang");A(this,"closeError");A(this,"connected");A(this,"done");A(this,"socket");A(this,"options");A(this,"socketClosed");A(this,"encrypted");A(this,"peeked");A(this,"yields");A(this,"signal");A(this,"closedNotification");this.version=l2,this.lang=o2,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=At(),this.closedNotification=At()}async connect(n,r){const a=At();if(r.tls)return a.reject(new Oe("tls",Ee.InvalidOption)),a;this.options=r;const l=n.src;if(r.wsFactory){const{socket:u,encrypted:c}=await r.wsFactory(n.src,r);this.socket=u,this.encrypted=c}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=u=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(u.data)),this.peeked){this.signal.resolve();return}const c=ts.concat(...this.yields),f=J_(c);if(f!==""){const m=SE.exec(f);if(!m){r.debug&&console.error("!!!",Ko(c)),a.reject(new Error("unexpected response from server"));return}try{const d=JSON.parse(m[1]);xE(d,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(d){a.reject(d);return}}},this.socket.onclose=u=>{if(this.isDiscarded())return;this.socketClosed=!0;let c;this.done||(u.wasClean||(c=new Error(u.reason)),this._closed(c))},this.socket.onerror=u=>{if(this.isDiscarded())return;const c=u,f=new Oe(c.message,Ee.Unknown,new Error(c.error));a.reject(f)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ss(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(`> ${Ko(n[r])}`),yield n[r];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=At())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${Ko(n)}`);return}catch(r){this.options.debug&&console.error(`!!! ${Ko(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 c2(e,n){/^(.*:\/\/)(.*)/.test(e)||(typeof n=="boolean"?e=`${n===!0?"https":"http"}://${e}`:e=`https://${e}`);let a=new URL(e);const l=a.protocol.toLowerCase();l==="ws:"&&(n=!1),l==="wss:"&&(n=!0),l!=="https:"&&l!=="http"&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${e}`));let u,c;const f=a.hostname,m=a.pathname,d=a.search||"";switch(l){case"http:":case"ws:":case"nats:":c=a.port||"80",u="ws:";break;case"https:":case"wss:":case"tls:":c=a.port||"443",u="wss:";break;default:c=a.port||n===!0?"443":"80",u=n===!0?"wss:":"ws:";break}return`${u}//${f}:${c}${m}${d}`}function e1(e={}){return F_({defaultPort:443,urlParseFn:c2,factory:()=>new u2}),bd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var ns;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(ns||(ns={}));class ch extends Error{constructor(n,r,a){super(n),this.message=n,this.code=r,this.data=a}}const f2=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"},h2=e=>{const n=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},a=r.Plugins=r.Plugins||{},l=()=>n!==null?n.name:f2(e),u=()=>l()!=="web",c=g=>{const b=d.get(g);return!!(b!=null&&b.platforms.has(l())||f(g))},f=g=>{var b;return(b=r.PluginHeaders)===null||b===void 0?void 0:b.find(x=>x.name===g)},m=g=>e.console.error(g),d=new Map,y=(g,b={})=>{const x=d.get(g);if(x)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),x.proxy;const k=l(),L=f(g);let B;const D=async()=>(!B&&k in b?B=typeof b[k]=="function"?B=await b[k]():B=b[k]:n!==null&&!B&&"web"in b&&(B=typeof b.web=="function"?B=await b.web():B=b.web),B),F=(J,Y)=>{var j,K;if(L){const Q=L==null?void 0:L.methods.find(ye=>Y===ye.name);if(Q)return Q.rtype==="promise"?ye=>r.nativePromise(g,Y.toString(),ye):(ye,he)=>r.nativeCallback(g,Y.toString(),ye,he);if(J)return(j=J[Y])===null||j===void 0?void 0:j.bind(J)}else{if(J)return(K=J[Y])===null||K===void 0?void 0:K.bind(J);throw new ch(`"${g}" plugin is not implemented on ${k}`,ns.Unimplemented)}},G=J=>{let Y;const j=(...K)=>{const Q=D().then(ye=>{const he=F(ye,J);if(he){const q=he(...K);return Y=q==null?void 0:q.remove,q}else throw new ch(`"${g}.${J}()" is not implemented on ${k}`,ns.Unimplemented)});return J==="addListener"&&(Q.remove=async()=>Y()),Q};return j.toString=()=>`${J.toString()}() { [capacitor code] }`,Object.defineProperty(j,"name",{value:J,writable:!1,configurable:!1}),j},se=G("addListener"),R=G("removeListener"),O=(J,Y)=>{const j=se({eventName:J},Y),K=async()=>{const ye=await j;R({eventName:J,callbackId:ye},Y)},Q=new Promise(ye=>j.then(()=>ye({remove:K})));return Q.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await K()},Q},V=new Proxy({},{get(J,Y){switch(Y){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return L?O:se;case"removeListener":return R;default:return G(Y)}}});return a[g]=V,d.set(g,{name:g,proxy:V,platforms:new Set([...Object.keys(b),...L?[k]:[]])}),V};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=m,r.isNativePlatform=u,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=ch,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},d2=e=>e.Capacitor=h2(e),Ti=d2(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ls=Ti.registerPlugin;class vd{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(n,r){let a=!1;this.listeners[n]||(this.listeners[n]=[],a=!0),this.listeners[n].push(r);const u=this.windowListeners[n];u&&!u.registered&&this.addWindowListener(u),a&&this.sendRetainedArgumentsForEvent(n);const c=async()=>this.removeListener(n,r);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const n in this.windowListeners)this.removeWindowListener(this.windowListeners[n]);this.windowListeners={}}notifyListeners(n,r,a){const l=this.listeners[n];if(!l){if(a){let u=this.retainedEventArguments[n];u||(u=[]),u.push(r),this.retainedEventArguments[n]=u}return}l.forEach(u=>u(r))}hasListeners(n){var r;return!!(!((r=this.listeners[n])===null||r===void 0)&&r.length)}registerWindowListener(n,r){this.windowListeners[r]={registered:!1,windowEventName:n,pluginEventName:r,handler:a=>{this.notifyListeners(r,a)}}}unimplemented(n="not implemented"){return new Ti.Exception(n,ns.Unimplemented)}unavailable(n="not available"){return new Ti.Exception(n,ns.Unavailable)}async removeListener(n,r){const a=this.listeners[n];if(!a)return;const l=a.indexOf(r);this.listeners[n].splice(l,1),this.listeners[n].length||this.removeWindowListener(this.windowListeners[n])}addWindowListener(n){window.addEventListener(n.windowEventName,n.handler),n.registered=!0}removeWindowListener(n){n&&(window.removeEventListener(n.windowEventName,n.handler),n.registered=!1)}sendRetainedArgumentsForEvent(n){const r=this.retainedEventArguments[n];r&&(delete this.retainedEventArguments[n],r.forEach(a=>{this.notifyListeners(n,a)}))}}const h0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),d0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class m2 extends vd{async getCookies(){const n=document.cookie,r={};return n.split(";").forEach(a=>{if(a.length<=0)return;let[l,u]=a.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=d0(l).trim(),u=d0(u).trim(),r[l]=u}),r}async setCookie(n){try{const r=h0(n.key),a=h0(n.value),l=n.expires?`; expires=${n.expires.replace("expires=","")}`:"",u=(n.path||"/").replace("path=",""),c=n.url!=null&&n.url.length>0?`domain=${n.url}`:"";document.cookie=`${r}=${a||""}${l}; path=${u}; ${c};`}catch(r){return Promise.reject(r)}}async deleteCookie(n){try{document.cookie=`${n.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const n=document.cookie.split(";")||[];for(const r of n)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(n){return Promise.reject(n)}}async clearAllCookies(){try{await this.clearCookies()}catch(n){return Promise.reject(n)}}}ls("CapacitorCookies",{web:()=>new m2});const p2=async e=>new Promise((n,r)=>{const a=new FileReader;a.onload=()=>{const l=a.result;n(l.indexOf(",")>=0?l.split(",")[1]:l)},a.onerror=l=>r(l),a.readAsDataURL(e)}),g2=(e={})=>{const n=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[n[c]],l),{})},y2=(e,n=!0)=>e?Object.entries(e).reduce((a,l)=>{const[u,c]=l;let f,m;return Array.isArray(c)?(m="",c.forEach(d=>{f=n?encodeURIComponent(d):d,m+=`${u}=${f}&`}),m.slice(0,-1)):(f=n?encodeURIComponent(c):c,m=`${u}=${f}`),`${a}&${m}`},"").substr(1):null,b2=(e,n={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},n),l=g2(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 v2 extends vd{async request(n){const r=b2(n,n.webFetchExtra),a=y2(n.params,n.shouldEncodeUrlParams),l=a?`${n.url}?${a}`:n.url,u=await fetch(l,r),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?n:{};c.includes("application/json")&&(f="json");let m,d;switch(f){case"arraybuffer":case"blob":d=await u.blob(),m=await p2(d);break;case"json":m=await u.json();break;case"document":case"text":default:m=await u.text()}const y={};return u.headers.forEach((g,b)=>{y[b]=g}),{data:m,headers:y,status:u.status,url:u.url}}async get(n){return this.request(Object.assign(Object.assign({},n),{method:"GET"}))}async post(n){return this.request(Object.assign(Object.assign({},n),{method:"POST"}))}async put(n){return this.request(Object.assign(Object.assign({},n),{method:"PUT"}))}async patch(n){return this.request(Object.assign(Object.assign({},n),{method:"PATCH"}))}async delete(n){return this.request(Object.assign(Object.assign({},n),{method:"DELETE"}))}}ls("CapacitorHttp",{web:()=>new v2});var m0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(m0||(m0={}));var p0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(p0||(p0={}));class x2 extends vd{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")}}ls("SystemBars",{web:()=>new x2});const xd=Ti.isNativePlatform()?"https://app.palmier.me":"";async function t1(e,n,r,a){const l=`${xd}${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 w2(e,n,r){return t1("POST",e,n)}function S2(e,n){return t1("GET",e,void 0)}const n1=U.createContext({connected:!1,mode:"disconnected",nc:null,request(){return Promise.reject(new Error("No host connection"))},subscribeEvents(){return()=>{}},activeHost:null,unauthorized:!1}),_2=2e3,fh=6e3;function E2({children:e}){const{getActiveHost:n}=jl(),r=n(),[a,l]=U.useState(null),[u,c]=U.useState(!1),f=U.useRef(null),[m,d]=U.useState(!1),[y,g]=U.useState(!1),b=U.useRef(yu()),x=U.useRef(new Set),k=U.useRef(0),L=r!=null&&!!r.directUrl,B=r?L?m?"direct":"disconnected":u?"nats":"disconnected":"disconnected",D=B!=="disconnected";U.useEffect(()=>{g(!1)},[r==null?void 0:r.hostId,r==null?void 0:r.clientToken]),U.useEffect(()=>{if(L){f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1));return}if(!r)return;let se=!1;async function R(){try{const O=await fetch(`${xd}/api/config`);if(!O.ok){console.error("[NATS] Failed to fetch config");return}const V=await O.json();if(!V.natsWsUrl){console.warn("[NATS] No WebSocket URL configured");return}if(se)return;console.log("[NATS] Connecting to",V.natsWsUrl);const J=await e1({servers:V.natsWsUrl,token:V.natsToken});if(se){J.close().catch(()=>{});return}console.log("[NATS] Connected"),f.current=J,l(J),c(!0),J.closed().then(()=>{console.log("[NATS] Connection closed"),se||(l(null),c(!1),f.current=null)})}catch(O){console.error("[NATS] Connection failed:",O),se||c(!1)}}return R(),()=>{se=!0,f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1))}},[L,r]),U.useEffect(()=>{if(!r||!L){d(!1);return}const se=new AbortController;async function R(){var Y;const V=new AbortController,J=setTimeout(()=>V.abort(),_2);se.signal.addEventListener("abort",()=>V.abort());try{const j=await fetch(`${r.directUrl}/events`,{headers:{Authorization:`Bearer ${r.clientToken}`},signal:V.signal});return clearTimeout(J),j.ok?((Y=j.body)==null?void 0:Y.getReader())??null:null}catch{return clearTimeout(J),null}}async function O(V){d(!0),console.log("[HOST] SSE connected to",r.directUrl),k.current=Date.now();function J(){setTimeout(()=>{se.signal.aborted||Date.now()-k.current<fh||(console.log("[HOST] Heartbeat timeout — no data for",fh/1e3,"s"),se.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},fh)}J();const Y=new TextDecoder;let j="";try{for(;;){const{done:K,value:Q}=await V.read();if(K)break;j+=Y.decode(Q,{stream:!0}),k.current=Date.now(),J();const ye=j.split(`
88
+ `);j=ye.pop()??"";for(const he of ye)if(he.startsWith("data: ")){const q=he.slice(6);try{const H=JSON.parse(q);if(H.task_id&&H.event_type){const ie=`host-event.${r.hostId}.${H.task_id}`;for(const ge of x.current)ge({subject:ie,data:b.current.encode(q)})}}catch{}}}}catch{}}return(async()=>{const V=await R();V&&await O(V)})(),()=>{se.abort(),d(!1)}},[r,L]);const F=U.useCallback(async(se,R,O)=>{if(!r)throw new Error("No active host");function V(ye){ye&&typeof ye=="object"&&ye.error==="Unauthorized"&&g(!0)}if(L){console.log(`[HOST/HTTP] → ${se}`,R??"");const ye=await fetch(`${r.directUrl}/rpc/${se}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.clientToken}`},body:R!=null?JSON.stringify(R):void 0,signal:O!=null&&O.timeout?AbortSignal.timeout(O.timeout):void 0});if(ye.status===401)throw g(!0),new Error("Unauthorized");const he=await ye.json();return V(he),console.log(`[HOST/HTTP] ← ${se}`,he),he}if(!f.current)throw new Error("Not connected");const J=`host.${r.hostId}.rpc.${se}`,Y={...R??{},clientToken:r.clientToken},j=b.current.encode(JSON.stringify(Y));console.log(`[HOST/NATS] → ${se}`,R??"");const K=await f.current.request(J,j,{timeout:(O==null?void 0:O.timeout)??1e4}),Q=JSON.parse(b.current.decode(K.data));return V(Q),console.log(`[HOST/NATS] ← ${se}`,Q),Q},[r,L]),G=U.useCallback((se,R)=>{if(L)return x.current.add(R),()=>{x.current.delete(R)};if(f.current){const O=f.current.subscribe(`host-event.${se}.>`);let V=!1;return(async()=>{try{for await(const J of O){if(V)break;R({subject:J.subject,data:J.data})}}catch{}})(),()=>{V=!0,O.unsubscribe()}}return()=>{}},[r,L]);return w.jsx(n1.Provider,{value:{connected:D,mode:B,nc:a,request:F,subscribeEvents:G,activeHost:r,unauthorized:y},children:e})}function wd(){return U.useContext(n1)}function _u(e){const n=new Date(e),r=new Date,a=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return n.toDateString()===r.toDateString()?a:`${n.toLocaleDateString(void 0,{month:"short",day:"numeric"})} ${a}`}const r1={};function k2(e){for(const n of e)r1[n.key]=n.label}function Yh(e){return r1[e]??e}const A2=()=>window.matchMedia("(max-width: 600px)").matches;function C2({task:e,lastEvent:n,onEdit:r,onDelete:a,onViewRun:l}){const{request:u}=wd(),[c,f]=U.useState(!1),[m,d]=U.useState(!1),[y,g]=U.useState(!1),b=U.useRef(null),x=(n==null?void 0:n.running_state)==="started",k=!e.triggers_enabled||e.triggers.length===0?"var(--color-text-secondary)":x?"var(--color-success)":(n==null?void 0:n.running_state)==="failed"?"var(--color-error)":"var(--color-success)";U.useEffect(()=>{if(!m)return;function j(K){b.current&&!b.current.contains(K.target)&&d(!1)}return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[m]);function L(){A2()?g(!0):d(j=>!j)}function B(){d(!1),g(!1)}async function D(){if(B(),!!confirm("Abort this task?")){f(!0);try{await u("task.abort",{id:e.id})}catch(j){console.error("Abort failed:",j)}finally{f(!1)}}}async function F(){B();try{const j=await u("task.run",{id:e.id});l(e.id,j.run_id)}catch(j){console.error("Run failed:",j)}}async function G(){if(B(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),a(e.id)}catch(j){console.error("Delete failed:",j)}}const se={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function R(j){if(j.length===0)return"";if(j.length===1)return V(j[0]);const K=j.map(O);if(new Set(K.map(ye=>ye.kind)).size===1){const ye=K[0].kind;if(ye==="hourly")return"Every hour";const he=K.map(q=>q.detail);return`${ye.charAt(0).toUpperCase()+ye.slice(1)}: ${he.join(", ")}`}return j.map(V).join(", ")}function O(j){if(j.type==="once"){const Se=new Date(j.value);return{kind:"once",detail:isNaN(Se.getTime())?j.value:`${Se.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})} at ${Se.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}}const K=j.value.split(" ");if(K.length!==5)return{kind:"unknown",detail:j.value};const[Q,ye,he,,q]=K,H=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(ye==="*")return{kind:"hourly",detail:""};const ie=new Date;ie.setHours(Number(ye),Number(Q),0,0);const ge=ie.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return q!=="*"?{kind:"weekly",detail:`${H[Number(q)]??q} at ${ge}`}:he!=="*"?{kind:"monthly",detail:`day ${he} at ${ge}`}:{kind:"daily",detail:ge}}function V(j){const K=O(j);return K.kind==="hourly"?"Every hour":K.kind==="once"?`Once on ${K.detail}`:`${K.kind.charAt(0).toUpperCase()+K.kind.slice(1)}: ${K.detail}`}const J=R(e.triggers),Y=w.jsxs(w.Fragment,{children:[w.jsxs("button",{onClick:()=>{B(),r(e)},children:[w.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),w.jsxs("button",{onClick:()=>{B(),l(e.id)},children:[w.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),x?w.jsxs("button",{className:"menu-item-danger",onClick:D,disabled:c,children:[w.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):w.jsxs(w.Fragment,{children:[w.jsxs("button",{onClick:F,children:[w.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),w.jsxs("button",{className:"menu-item-danger",onClick:G,children:[w.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"task-card",onClick:()=>x?l(e.id,"latest"):l(e.id),children:[w.jsxs("div",{className:"task-card-header",children:[w.jsxs("div",{className:"task-card-title-row",children:[x?w.jsx("span",{className:"status-spinner",children:w.jsx("span",{})}):w.jsx("span",{className:"status-dot",style:{backgroundColor:k}}),w.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),w.jsx("div",{className:"task-card-actions",onClick:j=>j.stopPropagation(),children:w.jsxs("div",{className:"task-card-menu",ref:b,children:[w.jsx("button",{className:"task-card-menu-btn",onClick:L,"aria-label":"Task actions",children:"⋮"}),m&&w.jsx("div",{className:"task-card-menu-dropdown",children:Y})]})})]}),w.jsxs("div",{className:"task-card-meta",children:[e.agent&&w.jsx("span",{className:"task-card-agent",children:Yh(e.agent)}),n&&se[n.running_state]&&w.jsxs("span",{className:"task-card-last-event",children:[se[n.running_state]," ",_u(n.time_stamp)]}),e.triggers.length>0&&w.jsx("span",{className:"task-card-triggers",children:e.triggers_enabled?J:"Triggers disabled"})]})]}),y&&du.createPortal(w.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>g(!1),children:w.jsxs("div",{className:"bottom-sheet",onClick:j=>j.stopPropagation(),children:[w.jsx("div",{className:"bottom-sheet-handle"}),w.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),w.jsx("div",{className:"bottom-sheet-actions",children:Y})]})}),document.body)]})}function T2({permissions:e}){return w.jsxs("div",{className:"plan-dialog",children:[w.jsx("h2",{children:"Granted Permissions"}),w.jsx("div",{className:"plan-dialog-scroll",children:e&&e.length>0?w.jsx("div",{className:"permissions-section",children:w.jsx("ul",{className:"permissions-list",children:e.map((n,r)=>w.jsxs("li",{className:"permission-item",children:[w.jsx("span",{className:"permission-tool",children:n.name}),w.jsx("span",{className:"permission-desc",children:n.description})]},r))})}):w.jsx("p",{className:"plan-empty",children:"No permissions have been granted for this task."})}),w.jsx("div",{className:"plan-dialog-actions",children:w.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const $a=[];function O2(){const e=$a.pop();e&&(e.pushed.current=!1,e.close())}let g0=!1;function j2(){g0||(g0=!0,window.addEventListener("popstate",O2))}function N2(e,n){const r=U.useRef(!1),a=U.useRef(n);a.current=n;const l=U.useCallback(()=>a.current(),[]),u=U.useRef({close:l,pushed:r});u.current.close=l,U.useEffect(()=>{if(e&&!r.current)j2(),history.pushState({modal:!0},""),$a.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=$a.indexOf(u.current);c!==-1&&$a.splice(c,1),history.back()}},[e,l]),U.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=$a.indexOf(c);f!==-1&&$a.splice(f,1),history.back()}}},[])}const R2=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Si(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function M2(e){const n=e.split(" ");if(n.length!==5)return Si();const[r,a,l,,u]=n;if(a==="*")return Si("hourly");const c=`${a.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...Si("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...Si("monthly"),time:c,dayOfMonth:l}:{...Si("daily"),time:c}}function y0(e){if(e.type==="once"){const[n,r]=e.value.split("T");return{...Si("once"),onceDate:n??"",onceTime:(r??"09:00").slice(0,5)}}return M2(e.value)}function D2(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 z2(e){return e.schedule==="once"?e.onceDate?{type:"once",value:`${e.onceDate}T${e.onceTime}`}:null:{type:"cron",value:D2(e)}}function L2({initial:e,agents:n,hostPlatform:r,onSaved:a,onRun:l,onCancel:u}){var nt;const{request:c}=wd(),f=()=>{var Ie;const ve=localStorage.getItem("palmier:lastAgent"),Le=n.map(Tt=>Tt.key);return ve&&Le.includes(ve)?ve:((Ie=n[0])==null?void 0:Ie.key)??""},[m,d]=U.useState((e==null?void 0:e.user_prompt)??""),[y,g]=U.useState((e==null?void 0:e.agent)??f()),b=!!((nt=e==null?void 0:e.permissions)!=null&&nt.length),[x,k]=U.useState(!1),L=U.useCallback(()=>k(!1),[]);N2(x,L);const[B,D]=U.useState(null),[F,G]=U.useState(()=>((e==null?void 0:e.triggers)??[]).map(y0)),[se,R]=U.useState(()=>{var ve;return((ve=((e==null?void 0:e.triggers)??[]).map(y0)[0])==null?void 0:ve.schedule)??"daily"}),[O,V]=U.useState((e==null?void 0:e.triggers_enabled)??!1),[J,Y]=U.useState((e==null?void 0:e.requires_confirmation)??!1),[j,K]=U.useState((e==null?void 0:e.yolo_mode)??!1),[Q,ye]=U.useState((e==null?void 0:e.foreground_mode)??!1),[he,q]=U.useState(null),H=he!==null,[ie,ge]=U.useState(!!(e!=null&&e.command)),[Se,N]=U.useState((e==null?void 0:e.command)??""),M=U.useRef(null),W=!!e,_=!W||m!==((e==null?void 0:e.user_prompt)??"")||y!==((e==null?void 0:e.agent)??"")||O!==((e==null?void 0:e.triggers_enabled)??!0)||J!==((e==null?void 0:e.requires_confirmation)??!1)||j!==((e==null?void 0:e.yolo_mode)??!1)||Q!==((e==null?void 0:e.foreground_mode)??!1)||ie!==!!(e!=null&&e.command)||ie&&Se!==((e==null?void 0:e.command)??"")||JSON.stringify(ze())!==JSON.stringify((e==null?void 0:e.triggers)??[]),de=O&&F.some(ve=>ve.schedule==="once"&&(!ve.onceDate||new Date(`${ve.onceDate}T${ve.onceTime}`)<=new Date)),ue=_&&!!m.trim()&&!de&&(!ie||!!Se.trim());function xe(ve,Le){G(Ie=>Ie.map((Tt,Rn)=>Rn===ve?{...Tt,...Le}:Tt))}function Te(ve){G(Le=>{const Ie=Le.filter((Tt,Rn)=>Rn!==ve);return Ie.length===0&&(V(!1),Y(!1)),Ie})}function Me(){G(ve=>[...ve,Si(se)])}function ke(ve){R(ve),G([Si(ve)])}function ze(){return F.flatMap(ve=>{const Le=z2(ve);return Le?[Le]:[]})}function ft(){return j?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 He(){q("save"),D(null);try{const ve=W?"task.update":"task.create",Le={user_prompt:m,agent:y,triggers:ze(),triggers_enabled:O,requires_confirmation:J,yolo_mode:j,foreground_mode:Q,command:ie?Se:""};W&&(Le.id=e.id);const Ie=await c(ve,Le,{timeout:45e3});return Ie.error?(D(Ie.error),null):(W||localStorage.setItem("palmier:lastAgent",y),a(Ie),Ie)}catch(ve){return D(ve instanceof Error?ve.message:String(ve)),null}finally{q(null)}}async function qe(){q("run"),D(null);try{const Le=await c("task.run_oneoff",{user_prompt:m,agent:y,requires_confirmation:J,yolo_mode:j,foreground_mode:Q,command:ie?Se:""});if(Le.error){D(Le.error);return}localStorage.setItem("palmier:lastAgent",y),l(Le.task_id,Le.run_id),u()}catch(ve){D(ve instanceof Error?ve.message:String(ve))}finally{q(null)}}return w.jsx("div",{className:"task-form-overlay",children:w.jsx("div",{className:"task-form",children:x?w.jsx(T2,{permissions:e==null?void 0:e.permissions}):w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"task-form-header",children:w.jsx("h2",{children:e?"Edit Task":"New Task"})}),B&&w.jsx("div",{className:"form-error",children:B}),w.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:m,onChange:ve=>d(ve.target.value),placeholder:ie?"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:H}),w.jsxs("div",{className:"plan-actions",children:[b&&w.jsx("button",{className:"btn btn-link",onClick:()=>k(!0),children:"Granted Permissions"}),w.jsxs("div",{className:"agent-picker-section-inline",style:{marginLeft:"auto"},children:[w.jsx("span",{className:"agent-picker-label",children:"Run with"}),w.jsx("select",{className:"form-select form-select-sm",value:y,onChange:ve=>g(ve.target.value),children:n.map(ve=>w.jsx("option",{value:ve.key,children:ve.label},ve.key))})]})]}),w.jsxs("div",{className:"toggles-group",children:[w.jsxs("div",{className:`command-section${ie?" command-section-active":""}`,children:[w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:ie,onChange:ve=>{ge(ve.target.checked),ve.target.checked?setTimeout(()=>{var Le;return(Le=M.current)==null?void 0:Le.focus()},0):N("")},disabled:H}),"Reactive"]}),ie&&w.jsxs(w.Fragment,{children:[w.jsx("p",{className:"command-help-text",children:"Runs a command and invokes the task for each line of output. Use “the input” in your task description to reference each line."}),w.jsx("input",{ref:M,className:"form-input form-input-mono",type:"text",value:Se,onChange:ve=>N(ve.target.value),placeholder:"gws gmail +watch --project my-project",disabled:H})]})]}),r==="win32"&&w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:Q,onChange:ve=>ye(ve.target.checked),disabled:H}),"Run in the foreground (host must login to Windows)"]}),w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:j,onChange:ve=>K(ve.target.checked),disabled:H}),"Yolo mode"]}),j&&w.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."}),w.jsxs("div",{className:"triggers-section",children:[w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:O,onChange:ve=>{ve.target.checked?(V(!0),F.length===0&&Me()):(V(!1),Y(!1),G(Le=>{const Ie=Le.filter(Tt=>Tt.schedule==="once"?Tt.onceDate&&new Date(`${Tt.onceDate}T${Tt.onceTime}`)>new Date:!0);return Ie.length===1&&Ie[0].schedule==="daily"&&Ie[0].time==="00:00"?[]:Ie}))},disabled:H}),"Enable schedule"]}),w.jsxs("div",{className:`triggers-section-body${O?"":" disabled"}`,children:[F.length>0&&w.jsxs("select",{className:"form-select",value:se,disabled:!O,onChange:ve=>ke(ve.target.value),children:[w.jsx("option",{value:"once",children:"Specific Time"}),w.jsx("option",{value:"hourly",children:"Hourly"}),w.jsx("option",{value:"daily",children:"Daily"}),w.jsx("option",{value:"weekly",children:"Weekly"}),w.jsx("option",{value:"monthly",children:"Monthly"})]}),se!=="hourly"&&F.map((ve,Le)=>w.jsxs("div",{className:"trigger-row-card",children:[w.jsxs("div",{className:"trigger-row-content",children:[se==="daily"&&w.jsx("input",{className:"form-input",type:"time",value:ve.time,disabled:!O,onChange:Ie=>xe(Le,{time:Ie.target.value})}),se==="weekly"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("select",{className:"form-select",value:ve.dayOfWeek,disabled:!O,onChange:Ie=>xe(Le,{dayOfWeek:Ie.target.value}),children:R2.map((Ie,Tt)=>w.jsx("option",{value:String(Tt),children:Ie},Tt))}),w.jsx("input",{className:"form-input",type:"time",value:ve.time,disabled:!O,onChange:Ie=>xe(Le,{time:Ie.target.value})})]}),se==="monthly"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("select",{className:"form-select",value:ve.dayOfMonth,disabled:!O,onChange:Ie=>xe(Le,{dayOfMonth:Ie.target.value}),children:Array.from({length:28},(Ie,Tt)=>Tt+1).map(Ie=>w.jsxs("option",{value:String(Ie),children:["Day ",Ie]},Ie))}),w.jsx("input",{className:"form-input",type:"time",value:ve.time,disabled:!O,onChange:Ie=>xe(Le,{time:Ie.target.value})})]}),se==="once"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("input",{className:"form-input",type:"date",value:ve.onceDate,min:new Date().toISOString().split("T")[0],disabled:!O,onChange:Ie=>xe(Le,{onceDate:Ie.target.value})}),w.jsx("input",{className:"form-input",type:"time",value:ve.onceTime,min:ve.onceDate===new Date().toISOString().split("T")[0]?new Date().toTimeString().slice(0,5):void 0,disabled:!O,onChange:Ie=>xe(Le,{onceTime:Ie.target.value})})]})]}),F.length>1&&w.jsx("button",{className:"trigger-remove-btn",onClick:()=>Te(Le),disabled:!O,title:"Remove trigger",children:"×"})]},Le)),F.length>0&&se!=="hourly"&&w.jsx("button",{className:"trigger-add-btn",onClick:Me,disabled:!O,children:"+ Add"})]})]}),O&&F.length>0&&w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:J,onChange:ve=>Y(ve.target.checked),disabled:H}),"Confirm before each run"]})]}),!j&&(()=>{const ve=n.find(Le=>Le.key===y);return(ve==null?void 0:ve.supportsPermissions)===!1&&w.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",ve.label,". The task may fail if required permissions are not pre-configured."]})})(),w.jsxs("div",{className:"form-actions",children:[(()=>{const ve=F.length>0,Le=!!m.trim()&&(!ie||!!Se.trim());return W?_?w.jsxs("button",{className:"btn btn-primary",onClick:()=>ft()&&He(),disabled:!ue||H,children:[he==="save"&&w.jsx("span",{className:"btn-spinner"}),"Save"]}):w.jsx("button",{className:"btn btn-primary",disabled:!0,children:"Save"}):ve?w.jsxs("button",{className:"btn btn-primary",onClick:()=>ft()&&He(),disabled:!ue||H,children:[he==="save"&&w.jsx("span",{className:"btn-spinner"}),"Schedule"]}):w.jsxs(w.Fragment,{children:[w.jsxs("button",{className:"btn btn-primary",onClick:()=>ft()&&qe(),disabled:!Le||H,children:[he==="run"&&w.jsx("span",{className:"btn-spinner"}),"Run"]}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>ft()&&He(),disabled:!ue||H,children:"Save"})]})})(),w.jsx("button",{className:"btn btn-secondary",onClick:()=>{_&&m.trim()&&!confirm("You have unsaved changes. Discard?")||u()},style:{marginLeft:"auto"},children:"Cancel"})]})]})})})}const U2="0.6.9";function B2(e,n){if(e.includes("-"))return!1;const r=e.split(".").map(Number),a=n.split(".").map(Number);for(let l=0;l<3;l++){if((r[l]??0)<(a[l]??0))return!0;if((r[l]??0)>(a[l]??0))return!1}return!1}function P2({connected:e,hostId:n,request:r,subscribeEvents:a,onViewRun:l,onUpdateRequired:u,onVersion:c,onLocationClientToken:f}){const[m,d]=U.useState([]),[y,g]=U.useState(!1),[b,x]=U.useState(null),[k,L]=U.useState(new Map),[B,D]=U.useState(new Map),[F,G]=U.useState(new Map),[se,R]=U.useState(new Map),[O,V]=U.useState(new Map),[J,Y]=U.useState(!1),[j,K]=U.useState(void 0),[Q,ye]=U.useState([]),[he,q]=U.useState(),H=U.useCallback(()=>{Y(!1),K(void 0)},[]),ie=U.useCallback(async()=>{var _,de;if(e){g(!0),x(null);try{const ue=await r("task.list"),xe=ue.tasks??[],Te=new Map,Me=new Map,ke=new Map,ze=new Map,ft=new Map;for(const qe of xe)qe.status&&(Te.set(qe.id,qe.status),(_=qe.status.pending_permission)!=null&&_.length&&ke.set(qe.id,qe.status.pending_permission),(de=qe.status.pending_input)!=null&&de.length&&(ze.set(qe.id,{questions:qe.status.pending_input}),ft.set(qe.id,new Array(qe.status.pending_input.length).fill(""))));L(Te),D(Me),G(ke),R(ze),V(ft),d(xe),ye(ue.agents??[]),q(ue.host_platform),k2(ue.agents??[]);const He=ue.version??null;c==null||c(He),f==null||f(ue.location_client_token??null),u==null||u(!!He&&B2(He,U2))}catch(ue){const xe=ue instanceof Error?ue.message:String(ue);xe==="Not connected"||xe.includes("503")||xe.toLowerCase().includes("no responders")?x(null):x(xe),d([])}finally{g(!1)}}},[e,n,r]);U.useEffect(()=>{e?ie():(d([]),g(!1))},[e,n,ie]),U.useEffect(()=>{if(!e||!n)return;const _={decode:ue=>new TextDecoder().decode(ue)};return a(n,async ue=>{var ft;const xe=ue.subject.split(".");if(xe.length<3)return;const Te=xe.slice(2).join(".");let Me={};try{Me=JSON.parse(_.decode(ue.data))}catch{return}const ke=Me.event_type,ze=Me.session_id;if(ke==="input-request"&&ze){const He=Me.input_questions,qe=Me.agent_name,nt=Me.description;He!=null&&He.length&&(R(ve=>{if(ve.has(ze))return ve;const Le=new Map(ve);return Le.set(ze,{questions:He,description:nt,agentName:qe}),Le}),V(ve=>{if(ve.has(ze))return ve;const Le=new Map(ve);return Le.set(ze,new Array(He.length).fill("")),Le}));return}if(ke==="input-resolved"&&ze){R(He=>{if(!He.has(ze))return He;const qe=new Map(He);return qe.delete(ze),qe}),V(He=>{const qe=new Map(He);return qe.delete(ze),qe});return}if(ke==="confirm-request"&&ze){const He=Me.description,qe=Me.agent_name;He&&D(nt=>{if(nt.has(ze))return nt;const ve=new Map(nt);return ve.set(ze,{description:He,agentName:qe}),ve});return}if(ke==="confirm-resolved"&&ze){D(He=>{if(!He.has(ze))return He;const qe=new Map(He);return qe.delete(ze),qe});return}if(ke==="permission-resolved"){G(He=>{if(!He.has(Te))return He;const qe=new Map(He);return qe.delete(Te),qe});return}try{const He=await r("task.status",{id:Te},{timeout:5e3});if(He.error)return;L(qe=>{const nt=new Map(qe);return nt.set(Te,He),nt}),(ft=He.pending_permission)!=null&&ft.length&&G(qe=>{if(qe.has(Te))return qe;const nt=new Map(qe);return nt.set(Te,He.pending_permission),nt})}catch{}})},[e,n,a,r]);async function ge(_,de){try{await r("task.user_input",{id:_,value:[de]})}catch(ue){console.error("[TaskListView] Failed to respond to confirmation:",ue)}}async function Se(_,de){try{await r("task.user_input",{id:_,value:[de]})}catch(ue){console.error("[TaskListView] Failed to respond to permission request:",ue)}}async function N(_,de){try{await r("task.user_input",{id:_,value:de})}catch(ue){console.error("[TaskListView] Failed to respond to input request:",ue)}}function M(_){d(de=>{const ue=de.findIndex(xe=>xe.id===_.id);if(ue>=0){const xe=[...de];return xe[ue]=_,xe}return[_,...de]}),Y(!1),K(void 0)}function W(_){d(de=>de.filter(ue=>ue.id!==_)),L(de=>{const ue=new Map(de);return ue.delete(_),ue}),R(de=>{const ue=new Map(de);return ue.delete(_),ue}),V(de=>{const ue=new Map(de);return ue.delete(_),ue})}return w.jsxs(w.Fragment,{children:[b&&w.jsxs("div",{className:"form-error",children:[b,b.toLowerCase().includes("failed to fetch")&&w.jsxs(w.Fragment,{children:[" ",w.jsx("a",{href:"#",onClick:_=>{_.preventDefault(),window.location.reload()},children:"Reload"})]})]}),w.jsx("div",{className:"new-task-input-card",onClick:()=>{K(void 0),Y(!0)},role:"button",tabIndex:0,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(K(void 0),Y(!0))},children:w.jsx("span",{className:"new-task-placeholder",children:"Describe your new task..."})}),y&&!m.length?w.jsx("div",{className:"task-list",children:[0,1,2].map(_=>w.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[w.jsx("div",{className:"task-card-header",children:w.jsxs("div",{className:"task-card-title-row",children:[w.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),w.jsx("div",{className:"skeleton-line",style:{width:`${60+_*12}%`}})]})}),w.jsxs("div",{className:"task-card-meta",children:[w.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},_))}):w.jsx("div",{className:"task-list",children:m.map(_=>w.jsx(C2,{task:_,lastEvent:k.get(_.id),onEdit:async de=>{try{const ue=await r("task.get",{id:de.id});K(ue.error?de:ue)}catch{K(de)}Y(!0)},onDelete:W,onViewRun:l},_.id))}),J&&w.jsx(L2,{initial:j,agents:Q,hostPlatform:he,onSaved:M,onRun:l,onCancel:H}),du.createPortal(w.jsxs(w.Fragment,{children:[[...B.entries()].map(([_,{description:de,agentName:ue}])=>{var Te;const xe=ue||((Te=m.find(Me=>Me.id===_))==null?void 0:Te.name);return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),xe&&w.jsx("p",{className:"confirm-modal-subtitle",children:xe}),w.jsx("p",{className:"confirm-modal-message",children:de}),w.jsxs("div",{className:"confirm-modal-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>ge(_,"confirmed"),children:"Confirm"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>ge(_,"aborted"),children:"Abort"})]})]})},_)}),[...F.entries()].map(([_,de])=>{const ue=m.find(xe=>xe.id===_);return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal permission-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),w.jsx("p",{className:"confirm-modal-message",children:w.jsx("strong",{children:(ue==null?void 0:ue.name)||(ue==null?void 0:ue.user_prompt)||_})}),w.jsx("div",{className:"permission-list",children:de.map((xe,Te)=>w.jsxs("div",{className:"permission-item",children:[w.jsx("span",{className:"permission-name",children:xe.name}),xe.description&&w.jsx("span",{className:"permission-desc",children:xe.description})]},Te))}),w.jsxs("div",{className:"permission-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>Se(_,"granted"),children:"Allow Once"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>Se(_,"granted_all"),children:"Allow Always"})]}),w.jsx("button",{className:"permission-abort-link",onClick:()=>Se(_,"aborted"),children:"Deny & Abort Task"})]})},_)}),[...se.entries()].map(([_,{questions:de,description:ue,agentName:xe}])=>{var ke;const Te=O.get(_)??new Array(de.length).fill(""),Me=xe||((ke=m.find(ze=>ze.id===_))==null?void 0:ke.name);return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal input-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),Me&&w.jsx("p",{className:"confirm-modal-subtitle",children:Me}),ue&&w.jsx("p",{className:"confirm-modal-message",children:ue}),w.jsx("div",{className:"input-list",children:de.map((ze,ft)=>w.jsxs("div",{className:"input-item",children:[w.jsx("label",{className:"input-label",children:ze}),w.jsx("input",{type:"text",className:"input-field",value:Te[ft]??"",onChange:He=>{V(qe=>{const nt=new Map(qe),ve=[...nt.get(_)??[]];return ve[ft]=He.target.value,nt.set(_,ve),nt})},autoFocus:ft===0})]},ft))}),w.jsx("div",{className:"input-actions",children:w.jsx("button",{className:"btn btn-primary",disabled:Te.some(ze=>!ze.trim()),onClick:()=>N(_,Te),children:"Submit"})}),w.jsx("button",{className:"permission-abort-link",onClick:()=>N(_,["aborted"]),children:"Cancel"})]})},_)})]}),document.body)]})}function q2(){const e=ea(),r=yr().pathname.startsWith("/runs");return w.jsxs(w.Fragment,{children:[w.jsxs("button",{className:`tab-btn ${r?"":"tab-btn-active"}`,onClick:()=>e("/"),children:[w.jsxs("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),w.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]}),w.jsxs("button",{className:`tab-btn ${r?"tab-btn-active":""}`,onClick:()=>e("/runs"),children:[w.jsx("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Runs"]})]})}const H2="modulepreload",I2=function(e){return"/"+e},b0={},i1=function(n,r,a){let l=Promise.resolve();if(r&&r.length>0){let c=function(d){return Promise.all(d.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=c(r.map(d=>{if(d=I2(d),d in b0)return;b0[d]=!0;const y=d.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":H2,y||(b.as="script"),b.crossOrigin="",b.href=d,m&&b.setAttribute("nonce",m),document.head.appendChild(b),y)return new Promise((x,k)=>{b.addEventListener("load",x),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${d}`)))})}))}function u(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return l.then(c=>{for(const f of c||[])f.status==="rejected"&&u(f.reason);return n().catch(u)})},F2=ls("App",{web:()=>i1(()=>import("./web-HDs03L2B.js"),[]).then(e=>new e.AppWeb)}),a1=ls("Preferences",{web:()=>i1(()=>import("./web-CBI458eN.js"),[]).then(e=>new e.PreferencesWeb)});function s1(e){const[n,r]=U.useState(()=>window.matchMedia(e).matches);return U.useEffect(()=>{const a=window.matchMedia(e),l=u=>r(u.matches);return a.addEventListener("change",l),r(a.matches),()=>a.removeEventListener("change",l)},[e]),n}const tu=Ti.isNativePlatform()?ls("LocationPermission"):null,v0=!!window.__PALMIER_SERVE__,x0=Ti.isNativePlatform();function w0({daemonVersion:e,locationClientToken:n,activeClientToken:r,request:a,onLocationClientTokenChange:l}){var N;const{pairedHosts:u,activeHostId:c,setActiveHostId:f,removePairedHost:m,renamePairedHost:d}=jl(),y=ea(),g=s1("(min-width: 768px)"),[b,x]=U.useState(!1),[k,L]=U.useState(!1),[B,D]=U.useState(null),[F,G]=U.useState(""),[se,R]=U.useState(null),[O,V]=U.useState(!1),J=!!(r&&n===r);U.useEffect(()=>{if(!x0||!tu||!a)return;function M(){J&&tu.check().then(({fine:_})=>{_||a("device.location.disable").then(()=>{l==null||l(null)}).catch(()=>{})})}M();const W=F2.addListener("resume",()=>{M()});return()=>{W.then(_=>_.remove())}},[J,r]);async function Y(){if(a){V(!0);try{if(J)await a("device.location.disable"),l==null||l(null);else{if(tu&&!(await tu.request()).fine)return;const{value:M}=await a1.get({key:"fcmToken"});if(!M){console.warn("No FCM token available");return}await a("device.location.enable",{fcmToken:M}),l==null||l(r??null)}}catch(M){console.error("Failed to toggle location:",M)}finally{V(!1)}}}const j=U.useRef(null),K=U.useRef(null),Q=U.useCallback(()=>{L(!0)},[]);function ye(){k&&(x(!1),L(!1))}function he(){L(!1),x(!0)}function q(M,W){D(M),G(W)}function H(){B&&F.trim()&&d(B,F.trim()),D(null),G("")}function ie(){D(null),G("")}U.useEffect(()=>{B&&K.current&&(K.current.focus(),K.current.select())},[B]),U.useEffect(()=>{if(!b||k)return;function M(W){W.key==="Escape"&&Q()}return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M)}},[b,k,Q]);const ge=w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"drawer-header",children:[w.jsx("span",{className:"drawer-title",children:"Palmier"}),!g&&w.jsx("button",{className:"drawer-close-btn",onClick:Q,"aria-label":"Close menu",children:w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:w.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),!v0&&u.length>0&&w.jsxs("div",{className:"drawer-section",children:[w.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),w.jsx("div",{className:"host-picker-inline",children:w.jsx("div",{className:"host-picker-list",role:"listbox",children:u.map(M=>{const W=M.hostId===c,_=B===M.hostId,de=M.name||M.hostId.slice(0,8);return w.jsx("div",{className:"host-picker-item-wrapper",children:w.jsxs("div",{className:`host-picker-item ${W?"host-picker-item-active":""}`,onClick:()=>{_||W||(f(M.hostId),g||Q())},role:"option","aria-selected":W,children:[_?w.jsx("input",{ref:K,className:"form-input host-picker-rename-input",type:"text",value:F,onChange:ue=>G(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"&&H(),ue.key==="Escape"&&ie()},onBlur:H,onClick:ue=>ue.stopPropagation()}):w.jsx("span",{className:"host-picker-item-name",children:de}),w.jsxs("div",{className:"host-picker-item-actions",children:[W&&!_&&w.jsx("button",{className:"host-picker-edit-btn",onClick:ue=>{ue.stopPropagation(),q(M.hostId,de)},"aria-label":"Rename host",children:w.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:w.jsx("path",{d:"M9.5 1.5L11.5 3.5M1.5 11.5L2 9L9 2L11 4L4 11L1.5 11.5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),!W&&w.jsx("button",{className:"host-picker-delete-btn",onClick:ue=>{ue.stopPropagation(),R(M.hostId)},"aria-label":`Unpair ${de}`,children:w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:w.jsx("path",{d:"M4 5.5V11C4 11.2761 4.22386 11.5 4.5 11.5H9.5C9.77614 11.5 10 11.2761 10 11V5.5M3 4H11M5.5 4V3C5.5 2.72386 5.72386 2.5 6 2.5H8C8.27614 2.5 8.5 2.72386 8.5 3V4M6.5 6.5V9.5M7.5 6.5V9.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})},M.hostId)})})})]}),!v0&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-divider"}),w.jsx("div",{className:"drawer-section",children:w.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{y("/pair"),g||Q()},children:"Pair New Host"})})]}),x0&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-divider"}),w.jsx("div",{className:"drawer-section",children:w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Location Access"}),w.jsx("button",{className:`toggle-switch ${J?"toggle-switch-on":""}`,onClick:Y,disabled:O,role:"switch","aria-checked":J,children:w.jsx("span",{className:"toggle-switch-thumb"})})]})})]}),w.jsxs("div",{className:"drawer-footer",children:[e&&w.jsxs("div",{className:"drawer-version",children:["Palmier v",e]}),w.jsxs("div",{className:"drawer-legal",children:[w.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),w.jsx("span",{className:"drawer-legal-sep",children:"·"}),w.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),Se=se&&du.createPortal(w.jsx("div",{className:"confirm-modal-overlay",onClick:()=>R(null),children:w.jsxs("div",{className:"confirm-modal",onClick:M=>M.stopPropagation(),children:[w.jsx("h2",{className:"confirm-modal-title",children:"Delete host?"}),w.jsxs("p",{className:"confirm-modal-message",children:['"',((N=u.find(M=>M.hostId===se))==null?void 0:N.name)||se.slice(0,8),'" will be unpaired from this device.']}),w.jsxs("div",{className:"confirm-modal-actions",children:[w.jsx("button",{className:"btn btn-secondary",onClick:()=>R(null),children:"Cancel"}),w.jsx("button",{className:"btn btn-danger",onClick:()=>{m(se),R(null)},children:"Delete"})]})]})}),document.body);return g?w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:j,children:ge}),Se]}):w.jsxs(w.Fragment,{children:[w.jsx("button",{className:"hamburger-btn",onClick:he,"aria-label":"Open menu",children:w.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:w.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),b&&du.createPortal(w.jsx("div",{className:`drawer-overlay ${k?"drawer-overlay-closing":""}`,onClick:Q,onAnimationEnd:ye,children:w.jsx("div",{className:`drawer-panel ${k?"drawer-panel-closing":""}`,ref:j,onClick:M=>M.stopPropagation(),children:ge})}),document.body),Se]})}const $2=10;function G2({connected:e,hostId:n,request:r,subscribeEvents:a,filterTaskId:l,onClearFilter:u}){const[c,f]=U.useState([]),[m,d]=U.useState(0),[y,g]=U.useState(!1),[b,x]=U.useState(!1),k=ea(),L=U.useRef(null),B=U.useCallback(R=>{const O={offset:R,limit:$2};return l&&(O.task_id=l),O},[l]),D=U.useCallback(async(R,O)=>{if(e){O?x(!0):g(!0);try{const V=await r("taskrun.list",B(R)),J=V.entries??[];d(V.total??0),f(O?Y=>{const j=new Set(Y.map(Q=>`${Q.task_id}:${Q.run_id}`)),K=J.filter(Q=>!j.has(`${Q.task_id}:${Q.run_id}`));return[...Y,...K]}:J)}catch(V){V instanceof Error&&V.message==="Not connected"||console.error("Failed to load runs:",V)}finally{g(!1),x(!1)}}},[e,r,B]);U.useEffect(()=>{e?(f([]),d(0),D(0,!1)):(f([]),d(0))},[e,n,D,l]),U.useEffect(()=>!e||!n?void 0:a(n,async O=>{try{const V=JSON.parse(new TextDecoder().decode(O.data));if(V.event_type==="running-state"&&V.running_state&&["monitoring","started","finished","failed","aborted"].includes(V.running_state)){const J=await r("taskrun.list",B(0)),Y=J.entries??[];d(J.total??0),f(j=>{const K=new Map(Y.map(q=>[`${q.task_id}:${q.run_id}`,q])),Q=j.map(q=>{const H=`${q.task_id}:${q.run_id}`;return K.get(H)??q}),ye=new Set(Q.map(q=>`${q.task_id}:${q.run_id}`));return[...Y.filter(q=>!ye.has(`${q.task_id}:${q.run_id}`)),...Q]})}}catch{}}),[e,n,a,r]),U.useEffect(()=>{const R=L.current;if(!R)return;const O=new IntersectionObserver(V=>{V[0].isIntersecting&&!b&&c.length<m&&D(c.length,!0)},{threshold:.1});return O.observe(R),()=>O.disconnect()},[c.length,m,b,D]);function F(R,O){if(!R||!O)return"";const V=Math.round((O-R)/1e3);if(V<60)return`${V}s`;const J=Math.floor(V/60),Y=V%60;return`${J}m ${Y}s`}const G={monitoring:"Monitoring",started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function se(R){if(R==="failed")return"var(--color-error)";if(R==="aborted")return"var(--color-warning, #d97706)"}return y&&c.length===0&&e?w.jsx("div",{className:"task-list",children:[0,1,2].map(R=>w.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[w.jsx("div",{className:"task-card-header",children:w.jsx("div",{className:"task-card-title-row",children:w.jsx("div",{className:"skeleton-line",style:{width:`${70+R*10}%`}})})}),w.jsx("div",{className:"task-card-meta",children:w.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},R))}):!e||y&&c.length===0?w.jsx("div",{className:"runs-view",children:w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{className:"empty-state-text",children:"Runs"}),w.jsx("p",{className:"empty-state-hint",children:"Run history will appear here"})]})}):c.length===0?w.jsxs(w.Fragment,{children:[l&&u&&w.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:w.jsxs("span",{className:"runs-filter-chip",children:["Filtered by task",w.jsx("button",{onClick:u,"aria-label":"Clear filter",children:"×"})]})}),w.jsx("div",{className:"runs-view",children:w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{className:"empty-state-text",children:"No runs yet"}),w.jsx("p",{className:"empty-state-hint",children:l?"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger.":"Run history will appear here."})]})})]}):w.jsxs(w.Fragment,{children:[l&&u&&w.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:w.jsxs("span",{className:"runs-filter-chip",children:["Filtered by task",w.jsx("button",{onClick:u,"aria-label":"Clear filter",children:"×"})]})}),w.jsxs("div",{className:"task-list",children:[c.map((R,O)=>w.jsxs("div",{className:"runs-card",onClick:()=>!R.error&&k(`/runs/${R.task_id}/${encodeURIComponent(R.run_id)}`),children:[w.jsxs("div",{className:"runs-card-body",children:[w.jsx("h3",{className:"runs-card-name",children:R.task_name||R.task_id}),w.jsxs("div",{className:"runs-card-meta",children:[w.jsx("span",{style:{color:se(R.running_state)},children:G[R.running_state??""]??R.running_state}),R.end_time&&w.jsx("span",{children:_u(R.end_time)}),R.start_time&&R.end_time&&w.jsx("span",{style:{color:"var(--color-muted)"},children:F(R.start_time,R.end_time)}),R.error&&w.jsx("span",{style:{color:"var(--color-muted)"},children:R.error})]})]}),w.jsx("span",{className:"runs-card-chevron",children:"›"})]},`${R.task_id}-${R.run_id}-${O}`)),w.jsx("div",{ref:L,style:{height:1}}),b&&w.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:w.jsx("div",{className:"spinner"})})]})]})}function Y2(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const V2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,J2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,X2={};function S0(e,n){return(X2.jsx?J2:V2).test(e)}const Q2=/[ \t\n\f\r]/g;function K2(e){return typeof e=="object"?e.type==="text"?_0(e.value):!1:_0(e)}function _0(e){return e.replace(Q2,"")===""}class Ml{constructor(n,r,a){this.normal=r,this.property=n,a&&(this.space=a)}}Ml.prototype.normal={};Ml.prototype.property={};Ml.prototype.space=void 0;function l1(e,n){const r={},a={};for(const l of e)Object.assign(r,l.property),Object.assign(a,l.normal);return new Ml(r,a,n)}function Vh(e){return e.toLowerCase()}class gn{constructor(n,r){this.attribute=r,this.property=n}}gn.prototype.attribute="";gn.prototype.booleanish=!1;gn.prototype.boolean=!1;gn.prototype.commaOrSpaceSeparated=!1;gn.prototype.commaSeparated=!1;gn.prototype.defined=!1;gn.prototype.mustUseProperty=!1;gn.prototype.number=!1;gn.prototype.overloadedBoolean=!1;gn.prototype.property="";gn.prototype.spaceSeparated=!1;gn.prototype.space=void 0;let Z2=0;const Ye=na(),Pt=na(),Jh=na(),we=na(),xt=na(),Za=na(),kn=na();function na(){return 2**++Z2}const Xh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ye,booleanish:Pt,commaOrSpaceSeparated:kn,commaSeparated:Za,number:we,overloadedBoolean:Jh,spaceSeparated:xt},Symbol.toStringTag,{value:"Module"})),hh=Object.keys(Xh);class Sd extends gn{constructor(n,r,a,l){let u=-1;if(super(n,r),E0(this,"space",l),typeof a=="number")for(;++u<hh.length;){const c=hh[u];E0(this,hh[u],(a&Xh[c])===Xh[c])}}}Sd.prototype.defined=!0;function E0(e,n,r){r&&(e[n]=r)}function os(e){const n={},r={};for(const[a,l]of Object.entries(e.properties)){const u=new Sd(a,e.transform(e.attributes||{},a),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(u.mustUseProperty=!0),n[a]=u,r[Vh(a)]=a,r[Vh(u.attribute)]=a}return new Ml(n,r,e.space)}const o1=os({properties:{ariaActiveDescendant:null,ariaAtomic:Pt,ariaAutoComplete:null,ariaBusy:Pt,ariaChecked:Pt,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:xt,ariaCurrent:null,ariaDescribedBy:xt,ariaDetails:null,ariaDisabled:Pt,ariaDropEffect:xt,ariaErrorMessage:null,ariaExpanded:Pt,ariaFlowTo:xt,ariaGrabbed:Pt,ariaHasPopup:null,ariaHidden:Pt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xt,ariaLevel:we,ariaLive:null,ariaModal:Pt,ariaMultiLine:Pt,ariaMultiSelectable:Pt,ariaOrientation:null,ariaOwns:xt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:Pt,ariaReadOnly:Pt,ariaRelevant:null,ariaRequired:Pt,ariaRoleDescription:xt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:Pt,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function u1(e,n){return n in e?e[n]:n}function c1(e,n){return u1(e,n.toLowerCase())}const W2=os({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Za,acceptCharset:xt,accessKey:xt,action:null,allow:null,allowFullScreen:Ye,allowPaymentRequest:Ye,allowUserMedia:Ye,alt:null,as:null,async:Ye,autoCapitalize:null,autoComplete:xt,autoFocus:Ye,autoPlay:Ye,blocking:xt,capture:null,charSet:null,checked:Ye,cite:null,className:xt,cols:we,colSpan:null,content:null,contentEditable:Pt,controls:Ye,controlsList:xt,coords:we|Za,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ye,defer:Ye,dir:null,dirName:null,disabled:Ye,download:Jh,draggable:Pt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ye,formTarget:null,headers:xt,height:we,hidden:Jh,high:we,href:null,hrefLang:null,htmlFor:xt,httpEquiv:xt,id:null,imageSizes:null,imageSrcSet:null,inert:Ye,inputMode:null,integrity:null,is:null,isMap:Ye,itemId:null,itemProp:xt,itemRef:xt,itemScope:Ye,itemType:xt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ye,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Ye,muted:Ye,name:null,nonce:null,noModule:Ye,noValidate:Ye,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:Ye,optimum:we,pattern:null,ping:xt,placeholder:null,playsInline:Ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ye,referrerPolicy:null,rel:xt,required:Ye,reversed:Ye,rows:we,rowSpan:we,sandbox:xt,scope:null,scoped:Ye,seamless:Ye,selected:Ye,shadowRootClonable:Ye,shadowRootDelegatesFocus:Ye,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:Pt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Ye,useMap:null,value:Pt,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ye,declare:Ye,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Ye,noHref:Ye,noShade:Ye,noWrap:Ye,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:Pt,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ye,disableRemotePlayback:Ye,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:c1}),ek=os({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:kn,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:xt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:Ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Za,g2:Za,glyphName:Za,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:kn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:we,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kn,rev:kn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kn,requiredFeatures:kn,requiredFonts:kn,requiredFormats:kn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:kn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kn,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:u1}),f1=os({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()}}),h1=os({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:c1}),d1=os({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),tk={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"},nk=/[A-Z]/g,k0=/-[a-z]/g,rk=/^data[-\w.:]+$/i;function ik(e,n){const r=Vh(n);let a=n,l=gn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&rk.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(k0,sk);a="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!k0.test(u)){let c=u.replace(nk,ak);c.charAt(0)!=="-"&&(c="-"+c),n="data"+c}}l=Sd}return new l(a,n)}function ak(e){return"-"+e.toLowerCase()}function sk(e){return e.charAt(1).toUpperCase()}const lk=l1([o1,W2,f1,h1,d1],"html"),_d=l1([o1,ek,f1,h1,d1],"svg");function ok(e){return e.join(" ").trim()}var Ha={},dh,A0;function uk(){if(A0)return dh;A0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
91
+ `,d="/",y="*",g="",b="comment",x="declaration";function k(B,D){if(typeof B!="string")throw new TypeError("First argument must be a string");if(!B)return[];D=D||{};var F=1,G=1;function se(he){var q=he.match(n);q&&(F+=q.length);var H=he.lastIndexOf(m);G=~H?he.length-H:G+he.length}function R(){var he={line:F,column:G};return function(q){return q.position=new O(he),Y(),q}}function O(he){this.start=he,this.end={line:F,column:G},this.source=D.source}O.prototype.content=B;function V(he){var q=new Error(D.source+":"+F+":"+G+": "+he);if(q.reason=he,q.filename=D.source,q.line=F,q.column=G,q.source=B,!D.silent)throw q}function J(he){var q=he.exec(B);if(q){var H=q[0];return se(H),B=B.slice(H.length),q}}function Y(){J(r)}function j(he){var q;for(he=he||[];q=K();)q!==!1&&he.push(q);return he}function K(){var he=R();if(!(d!=B.charAt(0)||y!=B.charAt(1))){for(var q=2;g!=B.charAt(q)&&(y!=B.charAt(q)||d!=B.charAt(q+1));)++q;if(q+=2,g===B.charAt(q-1))return V("End of comment missing");var H=B.slice(2,q-2);return G+=2,se(H),B=B.slice(q),G+=2,he({type:b,comment:H})}}function Q(){var he=R(),q=J(a);if(q){if(K(),!J(l))return V("property missing ':'");var H=J(u),ie=he({type:x,property:L(q[0].replace(e,g)),value:H?L(H[0].replace(e,g)):g});return J(c),ie}}function ye(){var he=[];j(he);for(var q;q=Q();)q!==!1&&(he.push(q),j(he));return he}return Y(),ye()}function L(B){return B?B.replace(f,g):g}return dh=k,dh}var C0;function ck(){if(C0)return Ha;C0=1;var e=Ha&&Ha.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.default=r;const n=e(uk());function r(a,l){let u=null;if(!a||typeof a!="string")return u;const c=(0,n.default)(a),f=typeof l=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:d,value:y}=m;f?l(d,y,m):y&&(u=u||{},u[d]=y)}),u}return Ha}var sl={},T0;function fk(){if(T0)return sl;T0=1,Object.defineProperty(sl,"__esModule",{value:!0}),sl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(d){return!d||r.test(d)||e.test(d)},c=function(d,y){return y.toUpperCase()},f=function(d,y){return"".concat(y,"-")},m=function(d,y){return y===void 0&&(y={}),u(d)?d:(d=d.toLowerCase(),y.reactCompat?d=d.replace(l,f):d=d.replace(a,f),d.replace(n,c))};return sl.camelCase=m,sl}var ll,O0;function hk(){if(O0)return ll;O0=1;var e=ll&&ll.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},n=e(ck()),r=fk();function a(l,u){var c={};return!l||typeof l!="string"||(0,n.default)(l,function(f,m){f&&m&&(c[(0,r.camelCase)(f,u)]=m)}),c}return a.default=a,ll=a,ll}var dk=hk();const mk=mb(dk),m1=p1("end"),Ed=p1("start");function p1(e){return n;function n(r){const a=r&&r.position&&r.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function pk(e){const n=Ed(e),r=m1(e);if(n&&r)return{start:n,end:r}}function yl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?j0(e.position):"start"in e||"end"in e?j0(e):"line"in e||"column"in e?Qh(e):""}function Qh(e){return N0(e&&e.line)+":"+N0(e&&e.column)}function j0(e){return Qh(e&&e.start)+"-"+Qh(e&&e.end)}function N0(e){return e&&typeof e=="number"?e:1}class en extends Error{constructor(n,r,a){super(),typeof r=="string"&&(a=r,r=void 0);let l="",u={},c=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof n=="string"?l=n:!u.cause&&n&&(c=!0,l=n.message,u.cause=n),!u.ruleId&&!u.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?u.ruleId=a:(u.source=a.slice(0,m),u.ruleId=a.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=yl(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}}en.prototype.file="";en.prototype.name="";en.prototype.reason="";en.prototype.message="";en.prototype.stack="";en.prototype.column=void 0;en.prototype.line=void 0;en.prototype.ancestors=void 0;en.prototype.cause=void 0;en.prototype.fatal=void 0;en.prototype.place=void 0;en.prototype.ruleId=void 0;en.prototype.source=void 0;const kd={}.hasOwnProperty,gk=new Map,yk=/[A-Z]/g,bk=new Set(["table","tbody","thead","tfoot","tr"]),vk=new Set(["td","th"]),g1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function xk(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let a;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=Tk(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=Ck(r,n.jsx,n.jsxs)}const l={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:a,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?_d:lk,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=y1(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function y1(e,n,r){if(n.type==="element")return wk(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Sk(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Ek(e,n,r);if(n.type==="mdxjsEsm")return _k(e,n);if(n.type==="root")return kk(e,n,r);if(n.type==="text")return Ak(e,n)}function wk(e,n,r){const a=e.schema;let l=a;n.tagName.toLowerCase()==="svg"&&a.space==="html"&&(l=_d,e.schema=l),e.ancestors.push(n);const u=v1(e,n.tagName,!1),c=Ok(e,n);let f=Cd(e,n);return bk.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!K2(m):!0})),b1(e,c,u,n),Ad(c,f),e.ancestors.pop(),e.schema=a,e.create(n,u,c,r)}function Sk(e,n){if(n.data&&n.data.estree&&e.evaluater){const a=n.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}kl(e,n.position)}function _k(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);kl(e,n.position)}function Ek(e,n,r){const a=e.schema;let l=a;n.name==="svg"&&a.space==="html"&&(l=_d,e.schema=l),e.ancestors.push(n);const u=n.name===null?e.Fragment:v1(e,n.name,!0),c=jk(e,n),f=Cd(e,n);return b1(e,c,u,n),Ad(c,f),e.ancestors.pop(),e.schema=a,e.create(n,u,c,r)}function kk(e,n,r){const a={};return Ad(a,Cd(e,n)),e.create(n,e.Fragment,a,r)}function Ak(e,n){return n.value}function b1(e,n,r,a){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=a)}function Ad(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function Ck(e,n,r){return a;function a(l,u,c,f){const d=Array.isArray(c.children)?r:n;return f?d(u,c,f):d(u,c)}}function Tk(e,n){return r;function r(a,l,u,c){const f=Array.isArray(u.children),m=Ed(a);return n(l,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function Ok(e,n){const r={};let a,l;for(l in n.properties)if(l!=="children"&&kd.call(n.properties,l)){const u=Nk(e,l,n.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&vk.has(n.tagName)?a=f:r[c]=f}}if(a){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return r}function jk(e,n){const r={};for(const a of n.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const u=a.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else kl(e,n.position);else{const l=a.name;let u;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const f=a.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else kl(e,n.position);else u=a.value===null?!0:a.value;r[l]=u}return r}function Cd(e,n){const r=[];let a=-1;const l=e.passKeys?new Map:gk;for(;++a<n.children.length;){const u=n.children[a];let c;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const d=l.get(m)||0;c=m+"-"+d,l.set(m,d+1)}}const f=y1(e,u,c);f!==void 0&&r.push(f)}return r}function Nk(e,n,r){const a=ik(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=a.commaSeparated?Y2(r):ok(r)),a.property==="style"){let l=typeof r=="object"?r:Rk(e,String(r));return e.stylePropertyNameCase==="css"&&(l=Mk(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&a.space?tk[a.property]||a.property:a.attribute,r]}}function Rk(e,n){try{return mk(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,l=new en("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=g1+"#cannot-parse-style-attribute",l}}function v1(e,n,r){let a;if(!r)a={type:"Literal",value:n};else if(n.includes(".")){const l=n.split(".");let u=-1,c;for(;++u<l.length;){const f=S0(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}a=c}else a=S0(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(a.type==="Literal"){const l=a.value;return kd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(a);kl(e)}function kl(e,n){const r=new en("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=g1+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Mk(e){const n={};let r;for(r in e)kd.call(e,r)&&(n[Dk(r)]=e[r]);return n}function Dk(e){let n=e.replace(yk,zk);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function zk(e){return"-"+e.toLowerCase()}const mh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Lk={};function Td(e,n){const r=Lk,a=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return x1(e,a,l)}function x1(e,n,r){if(Uk(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 R0(e.children,n,r)}return Array.isArray(e)?R0(e,n,r):""}function R0(e,n,r){const a=[];let l=-1;for(;++l<e.length;)a[l]=x1(e[l],n,r);return a.join("")}function Uk(e){return!!(e&&typeof e=="object")}const M0=document.createElement("i");function Od(e){const n="&"+e+";";M0.innerHTML=n;const r=M0.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function jn(e,n,r,a){const l=e.length;let u=0,c;if(n<0?n=-n>l?0:l+n:n=n>l?l:n,r=r>0?r:0,a.length<1e4)c=Array.from(a),c.unshift(n,r),e.splice(...c);else for(r&&e.splice(n,r);u<a.length;)c=a.slice(u,u+1e4),c.unshift(n,0),e.splice(...c),u+=1e4,n+=1e4}function Vn(e,n){return e.length>0?(jn(e,e.length,0,n),e):n}const D0={}.hasOwnProperty;function w1(e){const n={};let r=-1;for(;++r<e.length;)Bk(n,e[r]);return n}function Bk(e,n){let r;for(r in n){const l=(D0.call(e,r)?e[r]:void 0)||(e[r]={}),u=n[r];let c;if(u)for(c in u){D0.call(l,c)||(l[c]=[]);const f=u[c];Pk(l[c],Array.isArray(f)?f:f?[f]:[])}}}function Pk(e,n){let r=-1;const a=[];for(;++r<n.length;)(n[r].add==="after"?e:a).push(n[r]);jn(e,0,0,a)}function S1(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 ar(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ln=Oi(/[A-Za-z]/),Wt=Oi(/[\dA-Za-z]/),qk=Oi(/[#-'*+\--9=?A-Z^-~]/);function Eu(e){return e!==null&&(e<32||e===127)}const Kh=Oi(/\d/),Hk=Oi(/[\dA-Fa-f]/),Ik=Oi(/[!-/:-@[-`{-~]/);function Ue(e){return e!==null&&e<-2}function bt(e){return e!==null&&(e<0||e===32)}function Ke(e){return e===-2||e===-1||e===32}const Du=Oi(new RegExp("\\p{P}|\\p{S}","u")),Wi=Oi(/\s/);function Oi(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function us(e){const n=[];let r=-1,a=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&Wt(e.charCodeAt(r+1))&&Wt(e.charCodeAt(r+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(r+1);u<56320&&f>56319&&f<57344?(c=String.fromCharCode(u,f),l=1):c="�"}else c=String.fromCharCode(u);c&&(n.push(e.slice(a,r),encodeURIComponent(c)),a=r+l+1,c=""),l&&(r+=l,l=0)}return n.join("")+e.slice(a)}function tt(e,n,r,a){const l=a?a-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return Ke(m)?(e.enter(r),f(m)):n(m)}function f(m){return Ke(m)&&u++<l?(e.consume(m),f):(e.exit(r),n(m))}}const Fk={tokenize:$k};function $k(e){const n=e.attempt(this.parser.constructs.contentInitial,a,l);let r;return n;function a(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),tt(e,n,"linePrefix")}function l(f){return e.enter("paragraph"),u(f)}function u(f){const m=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Ue(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const Gk={tokenize:Yk},z0={tokenize:Vk};function Yk(e){const n=this,r=[];let a=0,l,u,c;return f;function f(G){if(a<r.length){const se=r[a];return n.containerState=se[1],e.attempt(se[0].continuation,m,d)(G)}return d(G)}function m(G){if(a++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,l&&F();const se=n.events.length;let R=se,O;for(;R--;)if(n.events[R][0]==="exit"&&n.events[R][1].type==="chunkFlow"){O=n.events[R][1].end;break}D(a);let V=se;for(;V<n.events.length;)n.events[V][1].end={...O},V++;return jn(n.events,R+1,0,n.events.slice(se)),n.events.length=V,d(G)}return f(G)}function d(G){if(a===r.length){if(!l)return b(G);if(l.currentConstruct&&l.currentConstruct.concrete)return k(G);n.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(z0,y,g)(G)}function y(G){return l&&F(),D(a),b(G)}function g(G){return n.parser.lazy[n.now().line]=a!==r.length,c=n.now().offset,k(G)}function b(G){return n.containerState={},e.attempt(z0,x,k)(G)}function x(G){return a++,r.push([n.currentConstruct,n.containerState]),b(G)}function k(G){if(G===null){l&&F(),D(0),e.consume(G);return}return l=l||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),L(G)}function L(G){if(G===null){B(e.exit("chunkFlow"),!0),D(0),e.consume(G);return}return Ue(G)?(e.consume(G),B(e.exit("chunkFlow")),a=0,n.interrupt=void 0,f):(e.consume(G),L)}function B(G,se){const R=n.sliceStream(G);if(se&&R.push(null),G.previous=u,u&&(u.next=G),u=G,l.defineSkip(G.start),l.write(R),n.parser.lazy[G.start.line]){let O=l.events.length;for(;O--;)if(l.events[O][1].start.offset<c&&(!l.events[O][1].end||l.events[O][1].end.offset>c))return;const V=n.events.length;let J=V,Y,j;for(;J--;)if(n.events[J][0]==="exit"&&n.events[J][1].type==="chunkFlow"){if(Y){j=n.events[J][1].end;break}Y=!0}for(D(a),O=V;O<n.events.length;)n.events[O][1].end={...j},O++;jn(n.events,J+1,0,n.events.slice(V)),n.events.length=O}}function D(G){let se=r.length;for(;se-- >G;){const R=r[se];n.containerState=R[1],R[0].exit.call(n,e)}r.length=G}function F(){l.write([null]),u=void 0,l=void 0,n.containerState._closeFlow=void 0}}function Vk(e,n,r){return tt(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function rs(e){if(e===null||bt(e)||Wi(e))return 1;if(Du(e))return 2}function zu(e,n,r){const a=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!a.includes(u)&&(n=u(n,r),a.push(u))}return n}const Zh={name:"attention",resolveAll:Jk,tokenize:Xk};function Jk(e,n){let r=-1,a,l,u,c,f,m,d,y;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(a=r;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&n.sliceSerialize(e[a][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[a][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[a][1].end},b={...e[r][1].start};L0(g,-m),L0(b,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:b},u={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[r][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[a][1].end={...c.start},e[r][1].start={...f.end},d=[],e[a][1].end.offset-e[a][1].start.offset&&(d=Vn(d,[["enter",e[a][1],n],["exit",e[a][1],n]])),d=Vn(d,[["enter",l,n],["enter",c,n],["exit",c,n],["enter",u,n]]),d=Vn(d,zu(n.parser.constructs.insideSpan.null,e.slice(a+1,r),n)),d=Vn(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=Vn(d,[["enter",e[r][1],n],["exit",e[r][1],n]])):y=0,jn(e,a-1,r-a+3,d),r=a+d.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function Xk(e,n){const r=this.parser.constructs.attentionMarkers.null,a=this.previous,l=rs(a);let u;return c;function c(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const d=e.exit("attentionSequence"),y=rs(m),g=!y||y===2&&l||r.includes(m),b=!l||l===2&&y||r.includes(a);return d._open=!!(u===42?g:g&&(l||!b)),d._close=!!(u===42?b:b&&(y||!g)),n(m)}}function L0(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const Qk={name:"autolink",tokenize:Kk};function Kk(e,n,r){let a=0;return l;function l(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(x){return ln(x)?(e.consume(x),c):x===64?r(x):d(x)}function c(x){return x===43||x===45||x===46||Wt(x)?(a=1,f(x)):d(x)}function f(x){return x===58?(e.consume(x),a=0,m):(x===43||x===45||x===46||Wt(x))&&a++<32?(e.consume(x),f):(a=0,d(x))}function m(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),n):x===null||x===32||x===60||Eu(x)?r(x):(e.consume(x),m)}function d(x){return x===64?(e.consume(x),y):qk(x)?(e.consume(x),d):r(x)}function y(x){return Wt(x)?g(x):r(x)}function g(x){return x===46?(e.consume(x),a=0,y):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),n):b(x)}function b(x){if((x===45||Wt(x))&&a++<63){const k=x===45?b:g;return e.consume(x),k}return r(x)}}const Dl={partial:!0,tokenize:Zk};function Zk(e,n,r){return a;function a(u){return Ke(u)?tt(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Ue(u)?n(u):r(u)}}const _1={continuation:{tokenize:eA},exit:tA,name:"blockQuote",tokenize:Wk};function Wk(e,n,r){const a=this;return l;function l(c){if(c===62){const f=a.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return r(c)}function u(c){return Ke(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(c))}}function eA(e,n,r){const a=this;return l;function l(c){return Ke(c)?tt(e,u,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(_1,n,r)(c)}}function tA(e){e.exit("blockQuote")}const E1={name:"characterEscape",tokenize:nA};function nA(e,n,r){return a;function a(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return Ik(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(u)}}const k1={name:"characterReference",tokenize:rA};function rA(e,n,r){const a=this;let l=0,u,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),u=31,c=Wt,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=Hk,y):(e.enter("characterReferenceValue"),u=7,c=Kh,y(g))}function y(g){if(g===59&&l){const b=e.exit("characterReferenceValue");return c===Wt&&!Od(a.sliceSerialize(b))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return c(g)&&l++<u?(e.consume(g),y):r(g)}}const U0={partial:!0,tokenize:aA},B0={concrete:!0,name:"codeFenced",tokenize:iA};function iA(e,n,r){const a=this,l={partial:!0,tokenize:R};let u=0,c=0,f;return m;function m(O){return d(O)}function d(O){const V=a.events[a.events.length-1];return u=V&&V[1].type==="linePrefix"?V[2].sliceSerialize(V[1],!0).length:0,f=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(O)}function y(O){return O===f?(c++,e.consume(O),y):c<3?r(O):(e.exit("codeFencedFenceSequence"),Ke(O)?tt(e,g,"whitespace")(O):g(O))}function g(O){return O===null||Ue(O)?(e.exit("codeFencedFence"),a.interrupt?n(O):e.check(U0,L,se)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||Ue(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(O)):Ke(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),tt(e,x,"whitespace")(O)):O===96&&O===f?r(O):(e.consume(O),b)}function x(O){return O===null||Ue(O)?g(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(O))}function k(O){return O===null||Ue(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(O)):O===96&&O===f?r(O):(e.consume(O),k)}function L(O){return e.attempt(l,se,B)(O)}function B(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),D}function D(O){return u>0&&Ke(O)?tt(e,F,"linePrefix",u+1)(O):F(O)}function F(O){return O===null||Ue(O)?e.check(U0,L,se)(O):(e.enter("codeFlowValue"),G(O))}function G(O){return O===null||Ue(O)?(e.exit("codeFlowValue"),F(O)):(e.consume(O),G)}function se(O){return e.exit("codeFenced"),n(O)}function R(O,V,J){let Y=0;return j;function j(q){return O.enter("lineEnding"),O.consume(q),O.exit("lineEnding"),K}function K(q){return O.enter("codeFencedFence"),Ke(q)?tt(O,Q,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):Q(q)}function Q(q){return q===f?(O.enter("codeFencedFenceSequence"),ye(q)):J(q)}function ye(q){return q===f?(Y++,O.consume(q),ye):Y>=c?(O.exit("codeFencedFenceSequence"),Ke(q)?tt(O,he,"whitespace")(q):he(q)):J(q)}function he(q){return q===null||Ue(q)?(O.exit("codeFencedFence"),V(q)):J(q)}}}function aA(e,n,r){const a=this;return l;function l(c){return c===null?r(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return a.parser.lazy[a.now().line]?r(c):n(c)}}const ph={name:"codeIndented",tokenize:lA},sA={partial:!0,tokenize:oA};function lA(e,n,r){const a=this;return l;function l(d){return e.enter("codeIndented"),tt(e,u,"linePrefix",5)(d)}function u(d){const y=a.events[a.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?c(d):r(d)}function c(d){return d===null?m(d):Ue(d)?e.attempt(sA,c,m)(d):(e.enter("codeFlowValue"),f(d))}function f(d){return d===null||Ue(d)?(e.exit("codeFlowValue"),c(d)):(e.consume(d),f)}function m(d){return e.exit("codeIndented"),n(d)}}function oA(e,n,r){const a=this;return l;function l(c){return a.parser.lazy[a.now().line]?r(c):Ue(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):tt(e,u,"linePrefix",5)(c)}function u(c){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):Ue(c)?l(c):r(c)}}const uA={name:"codeText",previous:fA,resolve:cA,tokenize:hA};function cA(e){let n=e.length-4,r=3,a,l;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(a=r;++a<n;)if(e[a][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(a=r-1,n++;++a<=n;)l===void 0?a!==n&&e[a][1].type!=="lineEnding"&&(l=a):(a===n||e[a][1].type==="lineEnding")&&(e[l][1].type="codeTextData",a!==l+2&&(e[l][1].end=e[a-1][1].end,e.splice(l+2,a-l-2),n-=a-l-2,a=l+2),l=void 0);return e}function fA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function hA(e,n,r){let a=0,l,u;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),a++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(u=e.enter("codeTextSequence"),l=0,y(g)):Ue(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),d(g))}function d(g){return g===null||g===32||g===96||Ue(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),d)}function y(g){return g===96?(e.consume(g),l++,y):l===a?(e.exit("codeTextSequence"),e.exit("codeText"),n(g)):(u.type="codeTextData",d(g))}}class dA{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const a=r??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(n,a):n>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(n,r,a){const l=r||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return a&&ol(this.left,a),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),ol(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),ol(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);ol(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);ol(this.left,r.reverse())}}}function ol(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 A1(e){const n={};let r=-1,a,l,u,c,f,m,d;const y=new dA(e);for(;++r<y.length;){for(;r in n;)r=n[r];if(a=y.get(r),r&&a[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(m=a[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(a[0]==="enter")a[1].contentType&&(Object.assign(n,mA(y,r)),r=n[r],d=!0);else if(a[1]._container){for(u=r,l=void 0;u--;)if(c=y.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(y.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(a[1].end={...y.get(l)[1].start},f=y.slice(l,r),f.unshift(a),y.splice(l,r-l+1,f))}}return jn(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!d}function mA(e,n){const r=e.get(n)[1],a=e.get(n)[2];let l=n-1;const u=[];let c=r._tokenizer;c||(c=a.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],d={};let y,g,b=-1,x=r,k=0,L=0;const B=[L];for(;x;){for(;e.get(++l)[1]!==x;);u.push(l),x._tokenizer||(y=a.sliceStream(x),x.next||y.push(null),g&&c.defineSkip(x.start),x._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),x._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=r;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(L=b+1,B.push(L),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(c.events=[],x?(x._tokenizer=void 0,x.previous=void 0):B.pop(),b=B.length;b--;){const D=f.slice(B[b],B[b+1]),F=u.pop();m.push([F,F+D.length-1]),e.splice(F,2,D)}for(m.reverse(),b=-1;++b<m.length;)d[k+m[b][0]]=k+m[b][1],k+=m[b][1]-m[b][0]-1;return d}const pA={resolve:yA,tokenize:bA},gA={partial:!0,tokenize:vA};function yA(e){return A1(e),e}function bA(e,n){let r;return a;function a(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?u(f):Ue(f)?e.check(gA,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 vA(e,n,r){const a=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),tt(e,u,"linePrefix")}function u(c){if(c===null||Ue(c))return r(c);const f=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):e.interrupt(a.parser.constructs.flow,r,n)(c)}}function C1(e,n,r,a,l,u,c,f,m){const d=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(D){return D===60?(e.enter(a),e.enter(l),e.enter(u),e.consume(D),e.exit(u),b):D===null||D===32||D===41||Eu(D)?r(D):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),L(D))}function b(D){return D===62?(e.enter(u),e.consume(D),e.exit(u),e.exit(l),e.exit(a),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),x(D))}function x(D){return D===62?(e.exit("chunkString"),e.exit(f),b(D)):D===null||D===60||Ue(D)?r(D):(e.consume(D),D===92?k:x)}function k(D){return D===60||D===62||D===92?(e.consume(D),x):x(D)}function L(D){return!y&&(D===null||D===41||bt(D))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),n(D)):y<d&&D===40?(e.consume(D),y++,L):D===41?(e.consume(D),y--,L):D===null||D===32||D===40||Eu(D)?r(D):(e.consume(D),D===92?B:L)}function B(D){return D===40||D===41||D===92?(e.consume(D),L):L(D)}}function T1(e,n,r,a,l,u){const c=this;let f=0,m;return d;function d(x){return e.enter(a),e.enter(l),e.consume(x),e.exit(l),e.enter(u),y}function y(x){return f>999||x===null||x===91||x===93&&!m||x===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(x):x===93?(e.exit(u),e.enter(l),e.consume(x),e.exit(l),e.exit(a),n):Ue(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||Ue(x)||f++>999?(e.exit("chunkString"),y(x)):(e.consume(x),m||(m=!Ke(x)),x===92?b:g)}function b(x){return x===91||x===92||x===93?(e.consume(x),f++,g):g(x)}}function O1(e,n,r,a,l,u){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(a),e.enter(l),e.consume(b),e.exit(l),c=b===40?41:b,m):r(b)}function m(b){return b===c?(e.enter(l),e.consume(b),e.exit(l),e.exit(a),n):(e.enter(u),d(b))}function d(b){return b===c?(e.exit(u),m(c)):b===null?r(b):Ue(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),tt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===c||b===null||Ue(b)?(e.exit("chunkString"),d(b)):(e.consume(b),b===92?g:y)}function g(b){return b===c||b===92?(e.consume(b),y):y(b)}}function bl(e,n){let r;return a;function a(l){return Ue(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,a):Ke(l)?tt(e,a,r?"linePrefix":"lineSuffix")(l):n(l)}}const xA={name:"definition",tokenize:SA},wA={partial:!0,tokenize:_A};function SA(e,n,r){const a=this;let l;return u;function u(x){return e.enter("definition"),c(x)}function c(x){return T1.call(a,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function f(x){return l=ar(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),m):r(x)}function m(x){return bt(x)?bl(e,d)(x):d(x)}function d(x){return C1(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function y(x){return e.attempt(wA,g,g)(x)}function g(x){return Ke(x)?tt(e,b,"whitespace")(x):b(x)}function b(x){return x===null||Ue(x)?(e.exit("definition"),a.parser.defined.push(l),n(x)):r(x)}}function _A(e,n,r){return a;function a(f){return bt(f)?bl(e,l)(f):r(f)}function l(f){return O1(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return Ke(f)?tt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Ue(f)?n(f):r(f)}}const EA={name:"hardBreakEscape",tokenize:kA};function kA(e,n,r){return a;function a(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Ue(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const AA={name:"headingAtx",resolve:CA,tokenize:TA};function CA(e,n){let r=e.length-2,a=3,l,u;return e[a][1].type==="whitespace"&&(a+=2),r-2>a&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(a===r-1||r-4>a&&e[r-2][1].type==="whitespace")&&(r-=a+1===r?2:4),r>a&&(l={type:"atxHeadingText",start:e[a][1].start,end:e[r][1].end},u={type:"chunkText",start:e[a][1].start,end:e[r][1].end,contentType:"text"},jn(e,a,r-a+1,[["enter",l,n],["enter",u,n],["exit",u,n],["exit",l,n]])),e}function TA(e,n,r){let a=0;return l;function l(y){return e.enter("atxHeading"),u(y)}function u(y){return e.enter("atxHeadingSequence"),c(y)}function c(y){return y===35&&a++<6?(e.consume(y),c):y===null||bt(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||Ue(y)?(e.exit("atxHeading"),n(y)):Ke(y)?tt(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||bt(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),d)}}const OA=["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"],P0=["pre","script","style","textarea"],jA={concrete:!0,name:"htmlFlow",resolveTo:MA,tokenize:DA},NA={partial:!0,tokenize:LA},RA={partial:!0,tokenize:zA};function MA(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function DA(e,n,r){const a=this;let l,u,c,f,m;return d;function d(_){return y(_)}function y(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),g}function g(_){return _===33?(e.consume(_),b):_===47?(e.consume(_),u=!0,L):_===63?(e.consume(_),l=3,a.interrupt?n:N):ln(_)?(e.consume(_),c=String.fromCharCode(_),B):r(_)}function b(_){return _===45?(e.consume(_),l=2,x):_===91?(e.consume(_),l=5,f=0,k):ln(_)?(e.consume(_),l=4,a.interrupt?n:N):r(_)}function x(_){return _===45?(e.consume(_),a.interrupt?n:N):r(_)}function k(_){const de="CDATA[";return _===de.charCodeAt(f++)?(e.consume(_),f===de.length?a.interrupt?n:Q:k):r(_)}function L(_){return ln(_)?(e.consume(_),c=String.fromCharCode(_),B):r(_)}function B(_){if(_===null||_===47||_===62||bt(_)){const de=_===47,ue=c.toLowerCase();return!de&&!u&&P0.includes(ue)?(l=1,a.interrupt?n(_):Q(_)):OA.includes(c.toLowerCase())?(l=6,de?(e.consume(_),D):a.interrupt?n(_):Q(_)):(l=7,a.interrupt&&!a.parser.lazy[a.now().line]?r(_):u?F(_):G(_))}return _===45||Wt(_)?(e.consume(_),c+=String.fromCharCode(_),B):r(_)}function D(_){return _===62?(e.consume(_),a.interrupt?n:Q):r(_)}function F(_){return Ke(_)?(e.consume(_),F):j(_)}function G(_){return _===47?(e.consume(_),j):_===58||_===95||ln(_)?(e.consume(_),se):Ke(_)?(e.consume(_),G):j(_)}function se(_){return _===45||_===46||_===58||_===95||Wt(_)?(e.consume(_),se):R(_)}function R(_){return _===61?(e.consume(_),O):Ke(_)?(e.consume(_),R):G(_)}function O(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(e.consume(_),m=_,V):Ke(_)?(e.consume(_),O):J(_)}function V(_){return _===m?(e.consume(_),m=null,Y):_===null||Ue(_)?r(_):(e.consume(_),V)}function J(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||bt(_)?R(_):(e.consume(_),J)}function Y(_){return _===47||_===62||Ke(_)?G(_):r(_)}function j(_){return _===62?(e.consume(_),K):r(_)}function K(_){return _===null||Ue(_)?Q(_):Ke(_)?(e.consume(_),K):r(_)}function Q(_){return _===45&&l===2?(e.consume(_),H):_===60&&l===1?(e.consume(_),ie):_===62&&l===4?(e.consume(_),M):_===63&&l===3?(e.consume(_),N):_===93&&l===5?(e.consume(_),Se):Ue(_)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(NA,W,ye)(_)):_===null||Ue(_)?(e.exit("htmlFlowData"),ye(_)):(e.consume(_),Q)}function ye(_){return e.check(RA,he,W)(_)}function he(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),q}function q(_){return _===null||Ue(_)?ye(_):(e.enter("htmlFlowData"),Q(_))}function H(_){return _===45?(e.consume(_),N):Q(_)}function ie(_){return _===47?(e.consume(_),c="",ge):Q(_)}function ge(_){if(_===62){const de=c.toLowerCase();return P0.includes(de)?(e.consume(_),M):Q(_)}return ln(_)&&c.length<8?(e.consume(_),c+=String.fromCharCode(_),ge):Q(_)}function Se(_){return _===93?(e.consume(_),N):Q(_)}function N(_){return _===62?(e.consume(_),M):_===45&&l===2?(e.consume(_),N):Q(_)}function M(_){return _===null||Ue(_)?(e.exit("htmlFlowData"),W(_)):(e.consume(_),M)}function W(_){return e.exit("htmlFlow"),n(_)}}function zA(e,n,r){const a=this;return l;function l(c){return Ue(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return a.parser.lazy[a.now().line]?r(c):n(c)}}function LA(e,n,r){return a;function a(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Dl,n,r)}}const UA={name:"htmlText",tokenize:BA};function BA(e,n,r){const a=this;let l,u,c;return f;function f(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),m}function m(N){return N===33?(e.consume(N),d):N===47?(e.consume(N),R):N===63?(e.consume(N),G):ln(N)?(e.consume(N),J):r(N)}function d(N){return N===45?(e.consume(N),y):N===91?(e.consume(N),u=0,k):ln(N)?(e.consume(N),F):r(N)}function y(N){return N===45?(e.consume(N),x):r(N)}function g(N){return N===null?r(N):N===45?(e.consume(N),b):Ue(N)?(c=g,ie(N)):(e.consume(N),g)}function b(N){return N===45?(e.consume(N),x):g(N)}function x(N){return N===62?H(N):N===45?b(N):g(N)}function k(N){const M="CDATA[";return N===M.charCodeAt(u++)?(e.consume(N),u===M.length?L:k):r(N)}function L(N){return N===null?r(N):N===93?(e.consume(N),B):Ue(N)?(c=L,ie(N)):(e.consume(N),L)}function B(N){return N===93?(e.consume(N),D):L(N)}function D(N){return N===62?H(N):N===93?(e.consume(N),D):L(N)}function F(N){return N===null||N===62?H(N):Ue(N)?(c=F,ie(N)):(e.consume(N),F)}function G(N){return N===null?r(N):N===63?(e.consume(N),se):Ue(N)?(c=G,ie(N)):(e.consume(N),G)}function se(N){return N===62?H(N):G(N)}function R(N){return ln(N)?(e.consume(N),O):r(N)}function O(N){return N===45||Wt(N)?(e.consume(N),O):V(N)}function V(N){return Ue(N)?(c=V,ie(N)):Ke(N)?(e.consume(N),V):H(N)}function J(N){return N===45||Wt(N)?(e.consume(N),J):N===47||N===62||bt(N)?Y(N):r(N)}function Y(N){return N===47?(e.consume(N),H):N===58||N===95||ln(N)?(e.consume(N),j):Ue(N)?(c=Y,ie(N)):Ke(N)?(e.consume(N),Y):H(N)}function j(N){return N===45||N===46||N===58||N===95||Wt(N)?(e.consume(N),j):K(N)}function K(N){return N===61?(e.consume(N),Q):Ue(N)?(c=K,ie(N)):Ke(N)?(e.consume(N),K):Y(N)}function Q(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),l=N,ye):Ue(N)?(c=Q,ie(N)):Ke(N)?(e.consume(N),Q):(e.consume(N),he)}function ye(N){return N===l?(e.consume(N),l=void 0,q):N===null?r(N):Ue(N)?(c=ye,ie(N)):(e.consume(N),ye)}function he(N){return N===null||N===34||N===39||N===60||N===61||N===96?r(N):N===47||N===62||bt(N)?Y(N):(e.consume(N),he)}function q(N){return N===47||N===62||bt(N)?Y(N):r(N)}function H(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),n):r(N)}function ie(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),ge}function ge(N){return Ke(N)?tt(e,Se,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):Se(N)}function Se(N){return e.enter("htmlTextData"),c(N)}}const jd={name:"labelEnd",resolveAll:IA,resolveTo:FA,tokenize:$A},PA={tokenize:GA},qA={tokenize:YA},HA={tokenize:VA};function IA(e){let n=-1;const r=[];for(;++n<e.length;){const a=e[n][1];if(r.push(e[n]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const l=a.type==="labelImage"?4:2;a.type="data",n+=l}}return e.length!==r.length&&jn(e,0,e.length,r),e}function FA(e,n){let r=e.length,a=0,l,u,c,f;for(;r--;)if(l=e[r][1],u){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[r][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(c){if(e[r][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(u=r,l.type!=="labelLink")){a=2;break}}else l.type==="labelEnd"&&(c=r);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},y={type:"labelText",start:{...e[u+a+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,n],["enter",d,n]],f=Vn(f,e.slice(u+1,u+a+3)),f=Vn(f,[["enter",y,n]]),f=Vn(f,zu(n.parser.constructs.insideSpan.null,e.slice(u+a+4,c-3),n)),f=Vn(f,[["exit",y,n],e[c-2],e[c-1],["exit",d,n]]),f=Vn(f,e.slice(c+1)),f=Vn(f,[["exit",m,n]]),jn(e,u,e.length,f),e}function $A(e,n,r){const a=this;let l=a.events.length,u,c;for(;l--;)if((a.events[l][1].type==="labelImage"||a.events[l][1].type==="labelLink")&&!a.events[l][1]._balanced){u=a.events[l][1];break}return f;function f(b){return u?u._inactive?g(b):(c=a.parser.defined.includes(ar(a.sliceSerialize({start:u.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),m):r(b)}function m(b){return b===40?e.attempt(PA,y,c?y:g)(b):b===91?e.attempt(qA,y,c?d:g)(b):c?y(b):g(b)}function d(b){return e.attempt(HA,y,g)(b)}function y(b){return n(b)}function g(b){return u._balanced=!0,r(b)}}function GA(e,n,r){return a;function a(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return bt(g)?bl(e,u)(g):u(g)}function u(g){return g===41?y(g):C1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return bt(g)?bl(e,m)(g):y(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?O1(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function d(g){return bt(g)?bl(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 YA(e,n,r){const a=this;return l;function l(f){return T1.call(a,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return a.parser.defined.includes(ar(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function c(f){return r(f)}}function VA(e,n,r){return a;function a(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),l}function l(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),n):r(u)}}const JA={name:"labelStartImage",resolveAll:jd.resolveAll,tokenize:XA};function XA(e,n,r){const a=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):r(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(f):n(f)}}const QA={name:"labelStartLink",resolveAll:jd.resolveAll,tokenize:KA};function KA(e,n,r){const a=this;return l;function l(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(c):n(c)}}const gh={name:"lineEnding",tokenize:ZA};function ZA(e,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),tt(e,n,"linePrefix")}}const fu={name:"thematicBreak",tokenize:WA};function WA(e,n,r){let a=0,l;return u;function u(d){return e.enter("thematicBreak"),c(d)}function c(d){return l=d,f(d)}function f(d){return d===l?(e.enter("thematicBreakSequence"),m(d)):a>=3&&(d===null||Ue(d))?(e.exit("thematicBreak"),n(d)):r(d)}function m(d){return d===l?(e.consume(d),a++,m):(e.exit("thematicBreakSequence"),Ke(d)?tt(e,f,"whitespace")(d):f(d))}}const pn={continuation:{tokenize:rC},exit:aC,name:"list",tokenize:nC},eC={partial:!0,tokenize:sC},tC={partial:!0,tokenize:iC};function nC(e,n,r){const a=this,l=a.events[a.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return f;function f(x){const k=a.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||x===a.containerState.marker:Kh(x)){if(a.containerState.type||(a.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(fu,r,d)(x):d(x);if(!a.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(x)}return r(x)}function m(x){return Kh(x)&&++c<10?(e.consume(x),m):(!a.interrupt||c<2)&&(a.containerState.marker?x===a.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),d(x)):r(x)}function d(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||x,e.check(Dl,a.interrupt?r:y,e.attempt(eC,b,g))}function y(x){return a.containerState.initialBlankLine=!0,u++,b(x)}function g(x){return Ke(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),b):r(x)}function b(x){return a.containerState.size=u+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(x)}}function rC(e,n,r){const a=this;return a.containerState._closeFlow=void 0,e.check(Dl,l,u);function l(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,tt(e,n,"listItemIndent",a.containerState.size+1)(f)}function u(f){return a.containerState.furtherBlankLines||!Ke(f)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(f)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(tC,n,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,tt(e,e.attempt(pn,n,r),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function iC(e,n,r){const a=this;return tt(e,l,"listItemIndent",a.containerState.size+1);function l(u){const c=a.events[a.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===a.containerState.size?n(u):r(u)}}function aC(e){e.exit(this.containerState.type)}function sC(e,n,r){const a=this;return tt(e,l,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const c=a.events[a.events.length-1];return!Ke(u)&&c&&c[1].type==="listItemPrefixWhitespace"?n(u):r(u)}}const q0={name:"setextUnderline",resolveTo:lC,tokenize:oC};function lC(e,n){let r=e.length,a,l,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){a=r;break}e[r][1].type==="paragraph"&&(l=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const c={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",u?(e.splice(l,0,["enter",c,n]),e.splice(u+1,0,["exit",e[a][1],n]),e[a][1].end={...e[u][1].end}):e[a][1]=c,e.push(["exit",c,n]),e}function oC(e,n,r){const a=this;let l;return u;function u(d){let y=a.events.length,g;for(;y--;)if(a.events[y][1].type!=="lineEnding"&&a.events[y][1].type!=="linePrefix"&&a.events[y][1].type!=="content"){g=a.events[y][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||g)?(e.enter("setextHeadingLine"),l=d,c(d)):r(d)}function c(d){return e.enter("setextHeadingLineSequence"),f(d)}function f(d){return d===l?(e.consume(d),f):(e.exit("setextHeadingLineSequence"),Ke(d)?tt(e,m,"lineSuffix")(d):m(d))}function m(d){return d===null||Ue(d)?(e.exit("setextHeadingLine"),n(d)):r(d)}}const uC={tokenize:cC};function cC(e){const n=this,r=e.attempt(Dl,a,e.attempt(this.parser.constructs.flowInitial,l,tt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(pA,l)),"linePrefix")));return r;function a(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const fC={resolveAll:N1()},hC=j1("string"),dC=j1("text");function j1(e){return{resolveAll:N1(e==="text"?mC:void 0),tokenize:n};function n(r){const a=this,l=this.parser.constructs[e],u=r.attempt(l,c,f);return c;function c(y){return d(y)?u(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),m}function m(y){return d(y)?(r.exit("data"),u(y)):(r.consume(y),m)}function d(y){if(y===null)return!0;const g=l[y];let b=-1;if(g)for(;++b<g.length;){const x=g[b];if(!x.previous||x.previous.call(a,a.previous))return!0}return!1}}}function N1(e){return n;function n(r,a){let l=-1,u;for(;++l<=r.length;)u===void 0?r[l]&&r[l][1].type==="data"&&(u=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==u+2&&(r[u][1].end=r[l-1][1].end,r.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(r,a):r}}function mC(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const a=e[r-1][1],l=n.sliceStream(a);let u=l.length,c=-1,f=0,m;for(;u--;){const d=l[u];if(typeof d=="string"){for(c=d.length;d.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(d===-2)m=!0,f++;else if(d!==-1){u++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(f=0),f){const d={type:r===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:a.start._bufferIndex+c,_index:a.start._index+u,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...d.start},a.start.offset===a.end.offset?Object.assign(a,d):(e.splice(r,0,["enter",d,n],["exit",d,n]),r+=2)}r++}return e}const pC={42:pn,43:pn,45:pn,48:pn,49:pn,50:pn,51:pn,52:pn,53:pn,54:pn,55:pn,56:pn,57:pn,62:_1},gC={91:xA},yC={[-2]:ph,[-1]:ph,32:ph},bC={35:AA,42:fu,45:[q0,fu],60:jA,61:q0,95:fu,96:B0,126:B0},vC={38:k1,92:E1},xC={[-5]:gh,[-4]:gh,[-3]:gh,33:JA,38:k1,42:Zh,60:[Qk,UA],91:QA,92:[EA,E1],93:jd,95:Zh,96:uA},wC={null:[Zh,fC]},SC={null:[42,95]},_C={null:[]},EC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:SC,contentInitial:gC,disable:_C,document:pC,flow:bC,flowInitial:yC,insideSpan:wC,string:vC,text:xC},Symbol.toStringTag,{value:"Module"}));function kC(e,n,r){let a={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const l={},u=[];let c=[],f=[];const m={attempt:V(R),check:V(O),consume:F,enter:G,exit:se,interrupt:V(O,{interrupt:!0})},d={code:null,containerState:{},defineSkip:L,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:x,write:g};let y=n.tokenize.call(d,m);return n.resolveAll&&u.push(n),d;function g(K){return c=Vn(c,K),B(),c[c.length-1]!==null?[]:(J(n,0),d.events=zu(u,d.events,d),d.events)}function b(K,Q){return CC(x(K),Q)}function x(K){return AC(c,K)}function k(){const{_bufferIndex:K,_index:Q,line:ye,column:he,offset:q}=a;return{_bufferIndex:K,_index:Q,line:ye,column:he,offset:q}}function L(K){l[K.line]=K.column,j()}function B(){let K;for(;a._index<c.length;){const Q=c[a._index];if(typeof Q=="string")for(K=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===K&&a._bufferIndex<Q.length;)D(Q.charCodeAt(a._bufferIndex));else D(Q)}}function D(K){y=y(K)}function F(K){Ue(K)?(a.line++,a.column=1,a.offset+=K===-3?2:1,j()):K!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===c[a._index].length&&(a._bufferIndex=-1,a._index++)),d.previous=K}function G(K,Q){const ye=Q||{};return ye.type=K,ye.start=k(),d.events.push(["enter",ye,d]),f.push(ye),ye}function se(K){const Q=f.pop();return Q.end=k(),d.events.push(["exit",Q,d]),Q}function R(K,Q){J(K,Q.from)}function O(K,Q){Q.restore()}function V(K,Q){return ye;function ye(he,q,H){let ie,ge,Se,N;return Array.isArray(he)?W(he):"tokenize"in he?W([he]):M(he);function M(xe){return Te;function Te(Me){const ke=Me!==null&&xe[Me],ze=Me!==null&&xe.null,ft=[...Array.isArray(ke)?ke:ke?[ke]:[],...Array.isArray(ze)?ze:ze?[ze]:[]];return W(ft)(Me)}}function W(xe){return ie=xe,ge=0,xe.length===0?H:_(xe[ge])}function _(xe){return Te;function Te(Me){return N=Y(),Se=xe,xe.partial||(d.currentConstruct=xe),xe.name&&d.parser.constructs.disable.null.includes(xe.name)?ue():xe.tokenize.call(Q?Object.assign(Object.create(d),Q):d,m,de,ue)(Me)}}function de(xe){return K(Se,N),q}function ue(xe){return N.restore(),++ge<ie.length?_(ie[ge]):H}}}function J(K,Q){K.resolveAll&&!u.includes(K)&&u.push(K),K.resolve&&jn(d.events,Q,d.events.length-Q,K.resolve(d.events.slice(Q),d)),K.resolveTo&&(d.events=K.resolveTo(d.events,d))}function Y(){const K=k(),Q=d.previous,ye=d.currentConstruct,he=d.events.length,q=Array.from(f);return{from:he,restore:H};function H(){a=K,d.previous=Q,d.currentConstruct=ye,d.events.length=he,f=q,j()}}function j(){a.line in l&&a.column<2&&(a.column=l[a.line],a.offset+=l[a.line]-1)}}function AC(e,n){const r=n.start._index,a=n.start._bufferIndex,l=n.end._index,u=n.end._bufferIndex;let c;if(r===l)c=[e[r].slice(a,u)];else{if(c=e.slice(r,l),a>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(a):c.shift()}u>0&&c.push(e[l].slice(0,u))}return c}function CC(e,n){let r=-1;const a=[];let l;for(;++r<e.length;){const u=e[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
90
92
  `;break}case-3:{c=`\r
91
- `;break}case-2:{c=n?" ":" ";break}case-1:{if(!n&&l)continue;c=" ";break}default:c=String.fromCharCode(u)}l=u===-2,a.push(c)}return a.join("")}function cC(e){const a={constructs:b1([sC,...(e||{}).extensions||[]]),content:l(kk),defined:[],document:l(Ck),flow:l(GA),lazy:{},string:l(JA),text:l(XA)};return a;function l(u){return c;function c(f){return lC(a,u,f)}}}function fC(e){for(;!_1(e););return e}const U0=/[\0\t\n\r]/g;function hC(){let e=1,n="",r=!0,a;return l;function l(u,c,f){const m=[];let d,y,g,b,x;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(U0.lastIndex=g,d=U0.exec(u),b=d&&d.index!==void 0?d.index:u.length,x=u.charCodeAt(b),!d){n=u.slice(g);break}if(x===10&&g===b&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<b&&(m.push(u.slice(g,b)),e+=b-g),x){case 0:{m.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,m.push(-2);e++<y;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}g=b+1}return f&&(a&&m.push(-5),n&&m.push(n),m.push(null)),m}}const dC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function mC(e){return e.replace(dC,pC)}function pC(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return v1(r.slice(u?2:1),u?16:10)}return Nd(r)||e}const j1={}.hasOwnProperty;function gC(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),yC(r)(fC(cC(r).document().write(hC()(e,n,!0))))}function yC(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Ee),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:u(ft),blockQuote:u(Me),characterEscape:Y,characterReference:Y,codeFenced:u(wt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(wt,c),codeText:u(He,c),codeTextData:Y,data:Y,codeFlowValue:Y,definition:u(qe),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(nt),hardBreakEscape:u(Mt),hardBreakTrailing:u(Mt),htmlFlow:u(xr,c),htmlFlowData:Y,htmlText:u(xr,c),htmlTextData:Y,image:u(wr),label:c,link:u(Ee),listItem:u(Be),listItemValue:b,listOrdered:u(Ie,g),listUnordered:u(Ie),paragraph:u(jt),reference:S,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(ft),strong:u(Dn),thematicBreak:u(cs)},exit:{atxHeading:m(),atxHeadingSequence:N,autolink:m(),autolinkEmail:ke,autolinkProtocol:ze,blockQuote:m(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:fe,characterReferenceMarkerNumeric:fe,characterReferenceValue:ve,characterReference:Te,codeFenced:m(B),codeFencedFence:L,codeFencedFenceInfo:x,codeFencedFenceMeta:k,codeFlowValue:T,codeIndented:m(D),codeText:m(q),codeTextData:T,data:T,definition:m(),definitionDestinationString:se,definitionLabelString:$,definitionTitleString:V,emphasis:m(),hardBreakEscape:m(K),hardBreakTrailing:m(K),htmlFlow:m(ye),htmlFlowData:T,htmlText:m(ue),htmlTextData:T,image:m(ae),label:_e,labelText:ge,lineEnding:X,link:m(I),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:he,resourceDestinationString:O,resourceTitleString:M,resource:W,setextHeading:m(J),setextHeadingLineSequence:G,setextHeadingText:R,strong:m(),thematicBreak:m()}};O1(n,(e||{}).mdastExtensions||[]);const r={};return a;function a(oe){let we={type:"root",children:[]};const Pe={stack:[we],tokenStack:[],config:n,enter:f,exit:d,buffer:c,resume:y,data:r},Ve=[];let it=-1;for(;++it<oe.length;)if(oe[it][1].type==="listOrdered"||oe[it][1].type==="listUnordered")if(oe[it][0]==="enter")Ve.push(it);else{const rn=Ve.pop();it=l(oe,rn,it)}for(it=-1;++it<oe.length;){const rn=n[oe[it][0]];j1.call(rn,oe[it][1].type)&&rn[oe[it][1].type].call(Object.assign({sliceSerialize:oe[it][2].sliceSerialize},Pe),oe[it][1])}if(Pe.tokenStack.length>0){const rn=Pe.tokenStack[Pe.tokenStack.length-1];(rn[1]||B0).call(Pe,void 0,rn[0])}for(we.position={start:Si(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:Si(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},it=-1;++it<n.transforms.length;)we=n.transforms[it](we)||we;return we}function l(oe,we,Pe){let Ve=we-1,it=-1,rn=!1,zn,Jt,pt,It;for(;++Ve<=Pe;){const ot=oe[Ve];switch(ot[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ot[0]==="enter"?it++:it--,It=void 0;break}case"lineEndingBlank":{ot[0]==="enter"&&(zn&&!It&&!it&&!pt&&(pt=Ve),It=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:It=void 0}if(!it&&ot[0]==="enter"&&ot[1].type==="listItemPrefix"||it===-1&&ot[0]==="exit"&&(ot[1].type==="listUnordered"||ot[1].type==="listOrdered")){if(zn){let Ln=Ve;for(Jt=void 0;Ln--;){const an=oe[Ln];if(an[1].type==="lineEnding"||an[1].type==="lineEndingBlank"){if(an[0]==="exit")continue;Jt&&(oe[Jt][1].type="lineEndingBlank",rn=!0),an[1].type="lineEnding",Jt=Ln}else if(!(an[1].type==="linePrefix"||an[1].type==="blockQuotePrefix"||an[1].type==="blockQuotePrefixWhitespace"||an[1].type==="blockQuoteMarker"||an[1].type==="listItemIndent"))break}pt&&(!Jt||pt<Jt)&&(zn._spread=!0),zn.end=Object.assign({},Jt?oe[Jt][1].start:ot[1].end),oe.splice(Jt||Ve,0,["exit",zn,ot[2]]),Ve++,Pe++}if(ot[1].type==="listItemPrefix"){const Ln={type:"listItem",_spread:!1,start:Object.assign({},ot[1].start),end:void 0};zn=Ln,oe.splice(Ve,0,["enter",Ln,ot[2]]),Ve++,Pe++,pt=void 0,It=!0}}}return oe[we][1]._spread=rn,Pe}function u(oe,we){return Pe;function Pe(Ve){f.call(this,oe(Ve),Ve),we&&we.call(this,Ve)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(oe,we,Pe){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([we,Pe||void 0]),oe.position={start:Si(we.start),end:void 0}}function m(oe){return we;function we(Pe){oe&&oe.call(this,Pe),d.call(this,Pe)}}function d(oe,we){const Pe=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==oe.type&&(we?we.call(this,oe,Ve[0]):(Ve[1]||B0).call(this,oe,Ve[0]));else throw new Error("Cannot close `"+oe.type+"` ("+yl({start:oe.start,end:oe.end})+"): it’s not open");Pe.position.end=Si(oe.end)}function y(){return Od(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(oe){if(this.data.expectingFirstListItemValue){const we=this.stack[this.stack.length-2];we.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function x(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.lang=oe}function k(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.meta=oe}function L(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function B(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function D(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe.replace(/(\r?\n|\r)$/g,"")}function $(oe){const we=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=we,Pe.identifier=sr(this.sliceSerialize(oe)).toLowerCase()}function V(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.title=oe}function se(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.url=oe}function N(oe){const we=this.stack[this.stack.length-1];if(!we.depth){const Pe=this.sliceSerialize(oe).length;we.depth=Pe}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function G(oe){const we=this.stack[this.stack.length-1];we.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function J(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(oe){const Pe=this.stack[this.stack.length-1].children;let Ve=Pe[Pe.length-1];(!Ve||Ve.type!=="text")&&(Ve=vt(),Ve.position={start:Si(oe.start),end:void 0},Pe.push(Ve)),this.stack.push(Ve)}function T(oe){const we=this.stack.pop();we.value+=this.sliceSerialize(oe),we.position.end=Si(oe.end)}function X(oe){const we=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Pe=we.children[we.children.length-1];Pe.position.end=Si(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(we.type)&&(Y.call(this,oe),T.call(this,oe))}function K(){this.data.atHardBreak=!0}function ye(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe}function ue(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe}function q(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe}function I(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=we,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ae(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=we,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ge(oe){const we=this.sliceSerialize(oe),Pe=this.stack[this.stack.length-2];Pe.label=mC(we),Pe.identifier=sr(we).toLowerCase()}function _e(){const oe=this.stack[this.stack.length-1],we=this.resume(),Pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Pe.type==="link"){const Ve=oe.children;Pe.children=Ve}else Pe.alt=we}function O(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.url=oe}function M(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.title=oe}function W(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function he(oe){const we=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=we,Pe.identifier=sr(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function fe(oe){this.data.characterReferenceType=oe.type}function ve(oe){const we=this.sliceSerialize(oe),Pe=this.data.characterReferenceType;let Ve;Pe?(Ve=v1(we,Pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=Nd(we);const it=this.stack[this.stack.length-1];it.value+=Ve}function Te(oe){const we=this.stack.pop();we.position.end=Si(oe.end)}function ze(oe){T.call(this,oe);const we=this.stack[this.stack.length-1];we.url=this.sliceSerialize(oe)}function ke(oe){T.call(this,oe);const we=this.stack[this.stack.length-1];we.url="mailto:"+this.sliceSerialize(oe)}function Me(){return{type:"blockquote",children:[]}}function wt(){return{type:"code",lang:null,meta:null,value:""}}function He(){return{type:"inlineCode",value:""}}function qe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function nt(){return{type:"emphasis",children:[]}}function ft(){return{type:"heading",depth:0,children:[]}}function Mt(){return{type:"break"}}function xr(){return{type:"html",value:""}}function wr(){return{type:"image",title:null,url:"",alt:null}}function Ee(){return{type:"link",title:null,url:"",children:[]}}function Ie(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function Be(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function jt(){return{type:"paragraph",children:[]}}function Dn(){return{type:"strong",children:[]}}function vt(){return{type:"text",value:""}}function cs(){return{type:"thematicBreak"}}}function Si(e){return{line:e.line,column:e.column,offset:e.offset}}function O1(e,n){let r=-1;for(;++r<n.length;){const a=n[r];Array.isArray(a)?O1(e,a):bC(e,a)}}function bC(e,n){let r;for(r in n)if(j1.call(n,r))switch(r){case"canContainEols":{const a=n[r];a&&e[r].push(...a);break}case"transforms":{const a=n[r];a&&e[r].push(...a);break}case"enter":case"exit":{const a=n[r];a&&Object.assign(e[r],a);break}}}function B0(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+yl({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+yl({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+yl({start:n.start,end:n.end})+") is still open")}function vC(e){const n=this;n.parser=r;function r(a){return gC(a,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function xC(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 wC(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
92
- `}]}function SC(e,n){const r=n.value?n.value+`
93
- `:"",a={},l=n.lang?n.lang.split(/\s+/):[];l.length>0&&(a.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:a,children:[{type:"text",value:r}]};return n.meta&&(u.data={meta:n.meta}),e.patch(n,u),u=e.applyData(n,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(n,u),u}function _C(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function EC(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function kC(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(n.identifier).toUpperCase(),l=us(a.toLowerCase()),u=e.footnoteOrder.indexOf(a);let c,f=e.footnoteCounts.get(a);f===void 0?(f=0,e.footnoteOrder.push(a),c=e.footnoteOrder.length):c=u+1,f+=1,e.footnoteCounts.set(a,f);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+l,id:r+"fnref-"+l+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(n,m);const d={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(n,d),e.applyData(n,d)}function AC(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 CC(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function N1(e,n){const r=n.referenceType;let a="]";if(r==="collapsed"?a+="[]":r==="full"&&(a+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+a}];const l=e.all(n),u=l[0];u&&u.type==="text"?u.value="["+u.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=a:l.push({type:"text",value:a}),l}function TC(e,n){const r=String(n.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return N1(e,n);const l={src:us(a.url||""),alt:n.alt};a.title!==null&&a.title!==void 0&&(l.title=a.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(n,u),e.applyData(n,u)}function jC(e,n){const r={src:us(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const a={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,a),e.applyData(n,a)}function OC(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const a={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,a),e.applyData(n,a)}function NC(e,n){const r=String(n.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return N1(e,n);const l={href:us(a.url||"")};a.title!==null&&a.title!==void 0&&(l.title=a.title);const u={type:"element",tagName:"a",properties:l,children:e.all(n)};return e.patch(n,u),e.applyData(n,u)}function RC(e,n){const r={href:us(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const a={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function MC(e,n,r){const a=e.all(n),l=r?DC(r):R1(n),u={},c=[];if(typeof n.checked=="boolean"){const y=a[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},a.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<a.length;){const y=a[f];(l||f!==0||y.type!=="element"||y.tagName!=="p")&&c.push({type:"text",value:`
93
+ `;break}case-2:{c=n?" ":" ";break}case-1:{if(!n&&l)continue;c=" ";break}default:c=String.fromCharCode(u)}l=u===-2,a.push(c)}return a.join("")}function TC(e){const a={constructs:w1([EC,...(e||{}).extensions||[]]),content:l(Fk),defined:[],document:l(Gk),flow:l(uC),lazy:{},string:l(hC),text:l(dC)};return a;function l(u){return c;function c(f){return kC(a,u,f)}}}function OC(e){for(;!A1(e););return e}const H0=/[\0\t\n\r]/g;function jC(){let e=1,n="",r=!0,a;return l;function l(u,c,f){const m=[];let d,y,g,b,x;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(H0.lastIndex=g,d=H0.exec(u),b=d&&d.index!==void 0?d.index:u.length,x=u.charCodeAt(b),!d){n=u.slice(g);break}if(x===10&&g===b&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<b&&(m.push(u.slice(g,b)),e+=b-g),x){case 0:{m.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,m.push(-2);e++<y;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}g=b+1}return f&&(a&&m.push(-5),n&&m.push(n),m.push(null)),m}}const NC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function RC(e){return e.replace(NC,MC)}function MC(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return S1(r.slice(u?2:1),u?16:10)}return Od(r)||e}const R1={}.hasOwnProperty;function DC(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),zC(r)(OC(TC(r).document().write(jC()(e,n,!0))))}function zC(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Rn),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:u(ve),blockQuote:u(ze),characterEscape:Y,characterReference:Y,codeFenced:u(ft),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(ft,c),codeText:u(He,c),codeTextData:Y,data:Y,codeFlowValue:Y,definition:u(qe),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(nt),hardBreakEscape:u(Le),hardBreakTrailing:u(Le),htmlFlow:u(Ie,c),htmlFlowData:Y,htmlText:u(Ie,c),htmlTextData:Y,image:u(Tt),label:c,link:u(Rn),listItem:u(Xn),listItemValue:b,listOrdered:u($r,g),listUnordered:u($r),paragraph:u(ra),reference:_,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(ve),strong:u(Gr),thematicBreak:u(cs)},exit:{atxHeading:m(),atxHeadingSequence:R,autolink:m(),autolinkEmail:ke,autolinkProtocol:Me,blockQuote:m(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:xe,characterReference:Te,codeFenced:m(B),codeFencedFence:L,codeFencedFenceInfo:x,codeFencedFenceMeta:k,codeFlowValue:j,codeIndented:m(D),codeText:m(q),codeTextData:j,data:j,definition:m(),definitionDestinationString:se,definitionLabelString:F,definitionTitleString:G,emphasis:m(),hardBreakEscape:m(Q),hardBreakTrailing:m(Q),htmlFlow:m(ye),htmlFlowData:j,htmlText:m(he),htmlTextData:j,image:m(ie),label:Se,labelText:ge,lineEnding:K,link:m(H),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:de,resourceDestinationString:N,resourceTitleString:M,resource:W,setextHeading:m(J),setextHeadingLineSequence:V,setextHeadingText:O,strong:m(),thematicBreak:m()}};M1(n,(e||{}).mdastExtensions||[]);const r={};return a;function a(oe){let _e={type:"root",children:[]};const Pe={stack:[_e],tokenStack:[],config:n,enter:f,exit:d,buffer:c,resume:y,data:r},Ve=[];let it=-1;for(;++it<oe.length;)if(oe[it][1].type==="listOrdered"||oe[it][1].type==="listUnordered")if(oe[it][0]==="enter")Ve.push(it);else{const tn=Ve.pop();it=l(oe,tn,it)}for(it=-1;++it<oe.length;){const tn=n[oe[it][0]];R1.call(tn,oe[it][1].type)&&tn[oe[it][1].type].call(Object.assign({sliceSerialize:oe[it][2].sliceSerialize},Pe),oe[it][1])}if(Pe.tokenStack.length>0){const tn=Pe.tokenStack[Pe.tokenStack.length-1];(tn[1]||I0).call(Pe,void 0,tn[0])}for(_e.position={start:wi(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:wi(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},it=-1;++it<n.transforms.length;)_e=n.transforms[it](_e)||_e;return _e}function l(oe,_e,Pe){let Ve=_e-1,it=-1,tn=!1,Mn,Yt,pt,qt;for(;++Ve<=Pe;){const ot=oe[Ve];switch(ot[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ot[0]==="enter"?it++:it--,qt=void 0;break}case"lineEndingBlank":{ot[0]==="enter"&&(Mn&&!qt&&!it&&!pt&&(pt=Ve),qt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:qt=void 0}if(!it&&ot[0]==="enter"&&ot[1].type==="listItemPrefix"||it===-1&&ot[0]==="exit"&&(ot[1].type==="listUnordered"||ot[1].type==="listOrdered")){if(Mn){let Dn=Ve;for(Yt=void 0;Dn--;){const nn=oe[Dn];if(nn[1].type==="lineEnding"||nn[1].type==="lineEndingBlank"){if(nn[0]==="exit")continue;Yt&&(oe[Yt][1].type="lineEndingBlank",tn=!0),nn[1].type="lineEnding",Yt=Dn}else if(!(nn[1].type==="linePrefix"||nn[1].type==="blockQuotePrefix"||nn[1].type==="blockQuotePrefixWhitespace"||nn[1].type==="blockQuoteMarker"||nn[1].type==="listItemIndent"))break}pt&&(!Yt||pt<Yt)&&(Mn._spread=!0),Mn.end=Object.assign({},Yt?oe[Yt][1].start:ot[1].end),oe.splice(Yt||Ve,0,["exit",Mn,ot[2]]),Ve++,Pe++}if(ot[1].type==="listItemPrefix"){const Dn={type:"listItem",_spread:!1,start:Object.assign({},ot[1].start),end:void 0};Mn=Dn,oe.splice(Ve,0,["enter",Dn,ot[2]]),Ve++,Pe++,pt=void 0,qt=!0}}}return oe[_e][1]._spread=tn,Pe}function u(oe,_e){return Pe;function Pe(Ve){f.call(this,oe(Ve),Ve),_e&&_e.call(this,Ve)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(oe,_e,Pe){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([_e,Pe||void 0]),oe.position={start:wi(_e.start),end:void 0}}function m(oe){return _e;function _e(Pe){oe&&oe.call(this,Pe),d.call(this,Pe)}}function d(oe,_e){const Pe=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==oe.type&&(_e?_e.call(this,oe,Ve[0]):(Ve[1]||I0).call(this,oe,Ve[0]));else throw new Error("Cannot close `"+oe.type+"` ("+yl({start:oe.start,end:oe.end})+"): it’s not open");Pe.position.end=wi(oe.end)}function y(){return Td(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(oe){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function x(){const oe=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=oe}function k(){const oe=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=oe}function L(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function B(){const oe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function D(){const oe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=oe.replace(/(\r?\n|\r)$/g,"")}function F(oe){const _e=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=_e,Pe.identifier=ar(this.sliceSerialize(oe)).toLowerCase()}function G(){const oe=this.resume(),_e=this.stack[this.stack.length-1];_e.title=oe}function se(){const oe=this.resume(),_e=this.stack[this.stack.length-1];_e.url=oe}function R(oe){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Pe=this.sliceSerialize(oe).length;_e.depth=Pe}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function V(oe){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function J(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(oe){const Pe=this.stack[this.stack.length-1].children;let Ve=Pe[Pe.length-1];(!Ve||Ve.type!=="text")&&(Ve=vt(),Ve.position={start:wi(oe.start),end:void 0},Pe.push(Ve)),this.stack.push(Ve)}function j(oe){const _e=this.stack.pop();_e.value+=this.sliceSerialize(oe),_e.position.end=wi(oe.end)}function K(oe){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Pe=_e.children[_e.children.length-1];Pe.position.end=wi(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(_e.type)&&(Y.call(this,oe),j.call(this,oe))}function Q(){this.data.atHardBreak=!0}function ye(){const oe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=oe}function he(){const oe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=oe}function q(){const oe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=oe}function H(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=_e,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ie(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=_e,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ge(oe){const _e=this.sliceSerialize(oe),Pe=this.stack[this.stack.length-2];Pe.label=RC(_e),Pe.identifier=ar(_e).toLowerCase()}function Se(){const oe=this.stack[this.stack.length-1],_e=this.resume(),Pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Pe.type==="link"){const Ve=oe.children;Pe.children=Ve}else Pe.alt=_e}function N(){const oe=this.resume(),_e=this.stack[this.stack.length-1];_e.url=oe}function M(){const oe=this.resume(),_e=this.stack[this.stack.length-1];_e.title=oe}function W(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function de(oe){const _e=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=_e,Pe.identifier=ar(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function ue(oe){this.data.characterReferenceType=oe.type}function xe(oe){const _e=this.sliceSerialize(oe),Pe=this.data.characterReferenceType;let Ve;Pe?(Ve=S1(_e,Pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=Od(_e);const it=this.stack[this.stack.length-1];it.value+=Ve}function Te(oe){const _e=this.stack.pop();_e.position.end=wi(oe.end)}function Me(oe){j.call(this,oe);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(oe)}function ke(oe){j.call(this,oe);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(oe)}function ze(){return{type:"blockquote",children:[]}}function ft(){return{type:"code",lang:null,meta:null,value:""}}function He(){return{type:"inlineCode",value:""}}function qe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function nt(){return{type:"emphasis",children:[]}}function ve(){return{type:"heading",depth:0,children:[]}}function Le(){return{type:"break"}}function Ie(){return{type:"html",value:""}}function Tt(){return{type:"image",title:null,url:"",alt:null}}function Rn(){return{type:"link",title:null,url:"",children:[]}}function $r(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function Xn(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function ra(){return{type:"paragraph",children:[]}}function Gr(){return{type:"strong",children:[]}}function vt(){return{type:"text",value:""}}function cs(){return{type:"thematicBreak"}}}function wi(e){return{line:e.line,column:e.column,offset:e.offset}}function M1(e,n){let r=-1;for(;++r<n.length;){const a=n[r];Array.isArray(a)?M1(e,a):LC(e,a)}}function LC(e,n){let r;for(r in n)if(R1.call(n,r))switch(r){case"canContainEols":{const a=n[r];a&&e[r].push(...a);break}case"transforms":{const a=n[r];a&&e[r].push(...a);break}case"enter":case"exit":{const a=n[r];a&&Object.assign(e[r],a);break}}}function I0(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+yl({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+yl({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+yl({start:n.start,end:n.end})+") is still open")}function UC(e){const n=this;n.parser=r;function r(a){return DC(a,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function BC(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 PC(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
94
+ `}]}function qC(e,n){const r=n.value?n.value+`
95
+ `:"",a={},l=n.lang?n.lang.split(/\s+/):[];l.length>0&&(a.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:a,children:[{type:"text",value:r}]};return n.meta&&(u.data={meta:n.meta}),e.patch(n,u),u=e.applyData(n,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(n,u),u}function HC(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function IC(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function FC(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(n.identifier).toUpperCase(),l=us(a.toLowerCase()),u=e.footnoteOrder.indexOf(a);let c,f=e.footnoteCounts.get(a);f===void 0?(f=0,e.footnoteOrder.push(a),c=e.footnoteOrder.length):c=u+1,f+=1,e.footnoteCounts.set(a,f);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+l,id:r+"fnref-"+l+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(n,m);const d={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(n,d),e.applyData(n,d)}function $C(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 GC(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function D1(e,n){const r=n.referenceType;let a="]";if(r==="collapsed"?a+="[]":r==="full"&&(a+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+a}];const l=e.all(n),u=l[0];u&&u.type==="text"?u.value="["+u.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=a:l.push({type:"text",value:a}),l}function YC(e,n){const r=String(n.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return D1(e,n);const l={src:us(a.url||""),alt:n.alt};a.title!==null&&a.title!==void 0&&(l.title=a.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(n,u),e.applyData(n,u)}function VC(e,n){const r={src:us(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const a={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,a),e.applyData(n,a)}function JC(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const a={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,a),e.applyData(n,a)}function XC(e,n){const r=String(n.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return D1(e,n);const l={href:us(a.url||"")};a.title!==null&&a.title!==void 0&&(l.title=a.title);const u={type:"element",tagName:"a",properties:l,children:e.all(n)};return e.patch(n,u),e.applyData(n,u)}function QC(e,n){const r={href:us(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const a={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function KC(e,n,r){const a=e.all(n),l=r?ZC(r):z1(n),u={},c=[];if(typeof n.checked=="boolean"){const y=a[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},a.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<a.length;){const y=a[f];(l||f!==0||y.type!=="element"||y.tagName!=="p")&&c.push({type:"text",value:`
94
96
  `}),y.type==="element"&&y.tagName==="p"&&!l?c.push(...y.children):c.push(y)}const m=a[a.length-1];m&&(l||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
95
- `});const d={type:"element",tagName:"li",properties:u,children:c};return e.patch(n,d),e.applyData(n,d)}function DC(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let a=-1;for(;!n&&++a<r.length;)n=R1(r[a])}return n}function R1(e){const n=e.spread;return n??e.children.length>1}function zC(e,n){const r={},a=e.all(n);let l=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++l<a.length;){const c=a[l];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(a,!0)};return e.patch(n,u),e.applyData(n,u)}function LC(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function UC(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function BC(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function PC(e,n){const r=e.all(n),a=r.shift(),l=[];if(a){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(n.children[0],c),l.push(c)}if(r.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=Ad(n.children[1]),m=f1(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 qC(e,n,r){const a=r?r.children:void 0,u=(a?a.indexOf(n):1)===0?"th":"td",c=r&&r.type==="table"?r.align:void 0,f=c?c.length:n.children.length;let m=-1;const d=[];for(;++m<f;){const g=n.children[m],b={},x=c?c[m]:void 0;x&&(b.align=x);let k={type:"element",tagName:u,properties:b,children:[]};g&&(k.children=e.all(g),e.patch(g,k),k=e.applyData(g,k)),d.push(k)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(n,y),e.applyData(n,y)}function HC(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const P0=9,q0=32;function IC(e){const n=String(e),r=/\r?\n|\r/g;let a=r.exec(n),l=0;const u=[];for(;a;)u.push(H0(n.slice(l,a.index),l>0,!0),a[0]),l=a.index+a[0].length,a=r.exec(n);return u.push(H0(n.slice(l),l>0,!1)),u.join("")}function H0(e,n,r){let a=0,l=e.length;if(n){let u=e.codePointAt(a);for(;u===P0||u===q0;)a++,u=e.codePointAt(a)}if(r){let u=e.codePointAt(l-1);for(;u===P0||u===q0;)l--,u=e.codePointAt(l-1)}return l>a?e.slice(a,l):""}function FC(e,n){const r={type:"text",value:IC(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function $C(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const GC={blockquote:xC,break:wC,code:SC,delete:_C,emphasis:EC,footnoteReference:kC,heading:AC,html:CC,imageReference:TC,image:jC,inlineCode:OC,linkReference:NC,link:RC,listItem:MC,list:zC,paragraph:LC,root:UC,strong:BC,table:PC,tableCell:HC,tableRow:qC,text:FC,thematicBreak:$C,toml:tu,yaml:tu,definition:tu,footnoteDefinition:tu};function tu(){}const M1=-1,Lu=0,vl=1,ku=2,Md=3,Dd=4,zd=5,Ld=6,D1=7,z1=8,I0=typeof self=="object"?self:globalThis,YC=(e,n)=>{const r=(l,u)=>(e.set(u,l),l),a=l=>{if(e.has(l))return e.get(l);const[u,c]=n[l];switch(u){case Lu:case M1:return r(c,l);case vl:{const f=r([],l);for(const m of c)f.push(a(m));return f}case ku:{const f=r({},l);for(const[m,d]of c)f[a(m)]=a(d);return f}case Md:return r(new Date(c),l);case Dd:{const{source:f,flags:m}=c;return r(new RegExp(f,m),l)}case zd:{const f=r(new Map,l);for(const[m,d]of c)f.set(a(m),a(d));return f}case Ld:{const f=r(new Set,l);for(const m of c)f.add(a(m));return f}case D1:{const{name:f,message:m}=c;return r(new I0[f](m),l)}case z1: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 I0[u](c),l)};return a},F0=e=>YC(new Map,e)(0),Ia="",{toString:VC}={},{keys:JC}=Object,ul=e=>{const n=typeof e;if(n!=="object"||!e)return[Lu,n];const r=VC.call(e).slice(8,-1);switch(r){case"Array":return[vl,Ia];case"Object":return[ku,Ia];case"Date":return[Md,Ia];case"RegExp":return[Dd,Ia];case"Map":return[zd,Ia];case"Set":return[Ld,Ia];case"DataView":return[vl,r]}return r.includes("Array")?[vl,r]:r.includes("Error")?[D1,r]:[ku,r]},nu=([e,n])=>e===Lu&&(n==="function"||n==="symbol"),XC=(e,n,r,a)=>{const l=(c,f)=>{const m=a.push(c)-1;return r.set(f,m),m},u=c=>{if(r.has(c))return r.get(c);let[f,m]=ul(c);switch(f){case Lu:{let y=c;switch(m){case"bigint":f=z1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([M1],c)}return l([f,y],c)}case vl:{if(m){let b=c;return m==="DataView"?b=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(b=new Uint8Array(c)),l([m,[...b]],c)}const y=[],g=l([f,y],c);for(const b of c)y.push(u(b));return g}case ku:{if(m)switch(m){case"BigInt":return l([m,c.toString()],c);case"Boolean":case"Number":case"String":return l([m,c.valueOf()],c)}if(n&&"toJSON"in c)return u(c.toJSON());const y=[],g=l([f,y],c);for(const b of JC(c))(e||!nu(ul(c[b])))&&y.push([u(b),u(c[b])]);return g}case Md:return l([f,c.toISOString()],c);case Dd:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case zd:{const y=[],g=l([f,y],c);for(const[b,x]of c)(e||!(nu(ul(b))||nu(ul(x))))&&y.push([u(b),u(x)]);return g}case Ld:{const y=[],g=l([f,y],c);for(const b of c)(e||!nu(ul(b)))&&y.push(u(b));return g}}const{message:d}=c;return l([f,{name:m,message:d}],c)};return u},$0=(e,{json:n,lossy:r}={})=>{const a=[];return XC(!(n||r),!!n,new Map,a)(e),a},Au=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?F0($0(e,n)):structuredClone(e):(e,n)=>F0($0(e,n));function QC(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 KC(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function ZC(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||QC,a=e.options.footnoteBackLabel||KC,l=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[m]);if(!d)continue;const y=e.all(d),g=String(d.identifier).toUpperCase(),b=us(g.toLowerCase());let x=0;const k=[],L=e.footnoteCounts.get(g);for(;L!==void 0&&++x<=L;){k.length>0&&k.push({type:"text",value:" "});let $=typeof r=="string"?r:r(m,x);typeof $=="string"&&($={type:"text",value:$}),k.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+b+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,x),className:["data-footnote-backref"]},children:Array.isArray($)?$:[$]})}const B=y[y.length-1];if(B&&B.type==="element"&&B.tagName==="p"){const $=B.children[B.children.length-1];$&&$.type==="text"?$.value+=" ":B.children.push({type:"text",value:" "}),B.children.push(...k)}else y.push(...k);const D={type:"element",tagName:"li",properties:{id:n+"fn-"+b},children:e.wrap(y,!0)};e.patch(d,D),f.push(D)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Au(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
97
+ `});const d={type:"element",tagName:"li",properties:u,children:c};return e.patch(n,d),e.applyData(n,d)}function ZC(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let a=-1;for(;!n&&++a<r.length;)n=z1(r[a])}return n}function z1(e){const n=e.spread;return n??e.children.length>1}function WC(e,n){const r={},a=e.all(n);let l=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++l<a.length;){const c=a[l];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(a,!0)};return e.patch(n,u),e.applyData(n,u)}function eT(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function tT(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function nT(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function rT(e,n){const r=e.all(n),a=r.shift(),l=[];if(a){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(n.children[0],c),l.push(c)}if(r.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=Ed(n.children[1]),m=m1(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 iT(e,n,r){const a=r?r.children:void 0,u=(a?a.indexOf(n):1)===0?"th":"td",c=r&&r.type==="table"?r.align:void 0,f=c?c.length:n.children.length;let m=-1;const d=[];for(;++m<f;){const g=n.children[m],b={},x=c?c[m]:void 0;x&&(b.align=x);let k={type:"element",tagName:u,properties:b,children:[]};g&&(k.children=e.all(g),e.patch(g,k),k=e.applyData(g,k)),d.push(k)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(n,y),e.applyData(n,y)}function aT(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const F0=9,$0=32;function sT(e){const n=String(e),r=/\r?\n|\r/g;let a=r.exec(n),l=0;const u=[];for(;a;)u.push(G0(n.slice(l,a.index),l>0,!0),a[0]),l=a.index+a[0].length,a=r.exec(n);return u.push(G0(n.slice(l),l>0,!1)),u.join("")}function G0(e,n,r){let a=0,l=e.length;if(n){let u=e.codePointAt(a);for(;u===F0||u===$0;)a++,u=e.codePointAt(a)}if(r){let u=e.codePointAt(l-1);for(;u===F0||u===$0;)l--,u=e.codePointAt(l-1)}return l>a?e.slice(a,l):""}function lT(e,n){const r={type:"text",value:sT(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function oT(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const uT={blockquote:BC,break:PC,code:qC,delete:HC,emphasis:IC,footnoteReference:FC,heading:$C,html:GC,imageReference:YC,image:VC,inlineCode:JC,linkReference:XC,link:QC,listItem:KC,list:WC,paragraph:eT,root:tT,strong:nT,table:rT,tableCell:aT,tableRow:iT,text:lT,thematicBreak:oT,toml:nu,yaml:nu,definition:nu,footnoteDefinition:nu};function nu(){}const L1=-1,Lu=0,vl=1,ku=2,Nd=3,Rd=4,Md=5,Dd=6,U1=7,B1=8,Y0=typeof self=="object"?self:globalThis,cT=(e,n)=>{const r=(l,u)=>(e.set(u,l),l),a=l=>{if(e.has(l))return e.get(l);const[u,c]=n[l];switch(u){case Lu:case L1:return r(c,l);case vl:{const f=r([],l);for(const m of c)f.push(a(m));return f}case ku:{const f=r({},l);for(const[m,d]of c)f[a(m)]=a(d);return f}case Nd:return r(new Date(c),l);case Rd:{const{source:f,flags:m}=c;return r(new RegExp(f,m),l)}case Md:{const f=r(new Map,l);for(const[m,d]of c)f.set(a(m),a(d));return f}case Dd:{const f=r(new Set,l);for(const m of c)f.add(a(m));return f}case U1:{const{name:f,message:m}=c;return r(new Y0[f](m),l)}case B1: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 Y0[u](c),l)};return a},V0=e=>cT(new Map,e)(0),Ia="",{toString:fT}={},{keys:hT}=Object,ul=e=>{const n=typeof e;if(n!=="object"||!e)return[Lu,n];const r=fT.call(e).slice(8,-1);switch(r){case"Array":return[vl,Ia];case"Object":return[ku,Ia];case"Date":return[Nd,Ia];case"RegExp":return[Rd,Ia];case"Map":return[Md,Ia];case"Set":return[Dd,Ia];case"DataView":return[vl,r]}return r.includes("Array")?[vl,r]:r.includes("Error")?[U1,r]:[ku,r]},ru=([e,n])=>e===Lu&&(n==="function"||n==="symbol"),dT=(e,n,r,a)=>{const l=(c,f)=>{const m=a.push(c)-1;return r.set(f,m),m},u=c=>{if(r.has(c))return r.get(c);let[f,m]=ul(c);switch(f){case Lu:{let y=c;switch(m){case"bigint":f=B1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([L1],c)}return l([f,y],c)}case vl:{if(m){let b=c;return m==="DataView"?b=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(b=new Uint8Array(c)),l([m,[...b]],c)}const y=[],g=l([f,y],c);for(const b of c)y.push(u(b));return g}case ku:{if(m)switch(m){case"BigInt":return l([m,c.toString()],c);case"Boolean":case"Number":case"String":return l([m,c.valueOf()],c)}if(n&&"toJSON"in c)return u(c.toJSON());const y=[],g=l([f,y],c);for(const b of hT(c))(e||!ru(ul(c[b])))&&y.push([u(b),u(c[b])]);return g}case Nd:return l([f,c.toISOString()],c);case Rd:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case Md:{const y=[],g=l([f,y],c);for(const[b,x]of c)(e||!(ru(ul(b))||ru(ul(x))))&&y.push([u(b),u(x)]);return g}case Dd:{const y=[],g=l([f,y],c);for(const b of c)(e||!ru(ul(b)))&&y.push(u(b));return g}}const{message:d}=c;return l([f,{name:m,message:d}],c)};return u},J0=(e,{json:n,lossy:r}={})=>{const a=[];return dT(!(n||r),!!n,new Map,a)(e),a},Au=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?V0(J0(e,n)):structuredClone(e):(e,n)=>V0(J0(e,n));function mT(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 pT(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function gT(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||mT,a=e.options.footnoteBackLabel||pT,l=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[m]);if(!d)continue;const y=e.all(d),g=String(d.identifier).toUpperCase(),b=us(g.toLowerCase());let x=0;const k=[],L=e.footnoteCounts.get(g);for(;L!==void 0&&++x<=L;){k.length>0&&k.push({type:"text",value:" "});let F=typeof r=="string"?r:r(m,x);typeof F=="string"&&(F={type:"text",value:F}),k.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+b+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,x),className:["data-footnote-backref"]},children:Array.isArray(F)?F:[F]})}const B=y[y.length-1];if(B&&B.type==="element"&&B.tagName==="p"){const F=B.children[B.children.length-1];F&&F.type==="text"?F.value+=" ":B.children.push({type:"text",value:" "}),B.children.push(...k)}else y.push(...k);const D={type:"element",tagName:"li",properties:{id:n+"fn-"+b},children:e.wrap(y,!0)};e.patch(d,D),f.push(D)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Au(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
96
98
  `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
97
- `}]}}const Uu=(function(e){if(e==null)return nT;if(typeof e=="function")return Bu(e);if(typeof e=="object")return Array.isArray(e)?WC(e):eT(e);if(typeof e=="string")return tT(e);throw new Error("Expected function, string, or object as test")});function WC(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Uu(e[r]);return Bu(a);function a(...l){let u=-1;for(;++u<n.length;)if(n[u].apply(this,l))return!0;return!1}}function eT(e){const n=e;return Bu(r);function r(a){const l=a;let u;for(u in e)if(l[u]!==n[u])return!1;return!0}}function tT(e){return Bu(n);function n(r){return r&&r.type===e}}function Bu(e){return n;function n(r,a,l){return!!(rT(r)&&e.call(this,r,typeof a=="number"?a:void 0,l||void 0))}}function nT(){return!0}function rT(e){return e!==null&&typeof e=="object"&&"type"in e}const L1=[],iT=!0,Wh=!1,aT="skip";function U1(e,n,r,a){let l;typeof n=="function"&&typeof r!="function"?(a=r,r=n):l=n;const u=Uu(l),c=a?-1:1;f(e,void 0,[])();function f(m,d,y){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(x?"<"+x+">":""))+")"})}return b;function b(){let x=L1,k,L,B;if((!n||u(m,d,y[y.length-1]||void 0))&&(x=sT(r(m,y)),x[0]===Wh))return x;if("children"in m&&m.children){const D=m;if(D.children&&x[0]!==aT)for(L=(a?D.children.length:-1)+c,B=y.concat(D);L>-1&&L<D.children.length;){const $=D.children[L];if(k=f($,L,B)(),k[0]===Wh)return k;L=typeof k[1]=="number"?k[1]:L+c}}return x}}}function sT(e){return Array.isArray(e)?e:typeof e=="number"?[iT,e]:e==null?L1:[e]}function Ud(e,n,r,a){let l,u,c;typeof n=="function"&&typeof r!="function"?(u=void 0,c=n,l=r):(u=n,c=r,l=a),U1(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 ed={}.hasOwnProperty,lT={};function oT(e,n){const r=n||lT,a=new Map,l=new Map,u=new Map,c={...GC,...r.handlers},f={all:d,applyData:cT,definitionById:a,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:uT,wrap:hT};return Ud(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?a:l,b=String(y.identifier).toUpperCase();g.has(b)||g.set(b,y)}}),f;function m(y,g){const b=y.type,x=f.handlers[b];if(ed.call(f.handlers,b)&&x)return x(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in y){const{children:L,...B}=y,D=Au(B);return D.children=f.all(y),D}return Au(y)}return(f.options.unknownHandler||fT)(f,y,g)}function d(y){const g=[];if("children"in y){const b=y.children;let x=-1;for(;++x<b.length;){const k=f.one(b[x],y);if(k){if(x&&b[x-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=G0(k.value)),!Array.isArray(k)&&k.type==="element")){const L=k.children[0];L&&L.type==="text"&&(L.value=G0(L.value))}Array.isArray(k)?g.push(...k):g.push(k)}}}return g}}function uT(e,n){e.position&&(n.position=K2(e))}function cT(e,n){let r=n;if(e&&e.data){const a=e.data.hName,l=e.data.hChildren,u=e.data.hProperties;if(typeof a=="string")if(r.type==="element")r.tagName=a;else{const c="children"in r?r.children:[r];r={type:"element",tagName:a,properties:{},children:c}}r.type==="element"&&u&&Object.assign(r.properties,Au(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function fT(e,n){const r=n.data||{},a="value"in n&&!(ed.call(r,"hProperties")||ed.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function hT(e,n){const r=[];let a=-1;for(n&&r.push({type:"text",value:`
99
+ `}]}}const Uu=(function(e){if(e==null)return xT;if(typeof e=="function")return Bu(e);if(typeof e=="object")return Array.isArray(e)?yT(e):bT(e);if(typeof e=="string")return vT(e);throw new Error("Expected function, string, or object as test")});function yT(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Uu(e[r]);return Bu(a);function a(...l){let u=-1;for(;++u<n.length;)if(n[u].apply(this,l))return!0;return!1}}function bT(e){const n=e;return Bu(r);function r(a){const l=a;let u;for(u in e)if(l[u]!==n[u])return!1;return!0}}function vT(e){return Bu(n);function n(r){return r&&r.type===e}}function Bu(e){return n;function n(r,a,l){return!!(wT(r)&&e.call(this,r,typeof a=="number"?a:void 0,l||void 0))}}function xT(){return!0}function wT(e){return e!==null&&typeof e=="object"&&"type"in e}const P1=[],ST=!0,Wh=!1,_T="skip";function q1(e,n,r,a){let l;typeof n=="function"&&typeof r!="function"?(a=r,r=n):l=n;const u=Uu(l),c=a?-1:1;f(e,void 0,[])();function f(m,d,y){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(x?"<"+x+">":""))+")"})}return b;function b(){let x=P1,k,L,B;if((!n||u(m,d,y[y.length-1]||void 0))&&(x=ET(r(m,y)),x[0]===Wh))return x;if("children"in m&&m.children){const D=m;if(D.children&&x[0]!==_T)for(L=(a?D.children.length:-1)+c,B=y.concat(D);L>-1&&L<D.children.length;){const F=D.children[L];if(k=f(F,L,B)(),k[0]===Wh)return k;L=typeof k[1]=="number"?k[1]:L+c}}return x}}}function ET(e){return Array.isArray(e)?e:typeof e=="number"?[ST,e]:e==null?P1:[e]}function zd(e,n,r,a){let l,u,c;typeof n=="function"&&typeof r!="function"?(u=void 0,c=n,l=r):(u=n,c=r,l=a),q1(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 ed={}.hasOwnProperty,kT={};function AT(e,n){const r=n||kT,a=new Map,l=new Map,u=new Map,c={...uT,...r.handlers},f={all:d,applyData:TT,definitionById:a,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:CT,wrap:jT};return zd(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?a:l,b=String(y.identifier).toUpperCase();g.has(b)||g.set(b,y)}}),f;function m(y,g){const b=y.type,x=f.handlers[b];if(ed.call(f.handlers,b)&&x)return x(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in y){const{children:L,...B}=y,D=Au(B);return D.children=f.all(y),D}return Au(y)}return(f.options.unknownHandler||OT)(f,y,g)}function d(y){const g=[];if("children"in y){const b=y.children;let x=-1;for(;++x<b.length;){const k=f.one(b[x],y);if(k){if(x&&b[x-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=X0(k.value)),!Array.isArray(k)&&k.type==="element")){const L=k.children[0];L&&L.type==="text"&&(L.value=X0(L.value))}Array.isArray(k)?g.push(...k):g.push(k)}}}return g}}function CT(e,n){e.position&&(n.position=pk(e))}function TT(e,n){let r=n;if(e&&e.data){const a=e.data.hName,l=e.data.hChildren,u=e.data.hProperties;if(typeof a=="string")if(r.type==="element")r.tagName=a;else{const c="children"in r?r.children:[r];r={type:"element",tagName:a,properties:{},children:c}}r.type==="element"&&u&&Object.assign(r.properties,Au(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function OT(e,n){const r=n.data||{},a="value"in n&&!(ed.call(r,"hProperties")||ed.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function jT(e,n){const r=[];let a=-1;for(n&&r.push({type:"text",value:`
98
100
  `});++a<e.length;)a&&r.push({type:"text",value:`
99
101
  `}),r.push(e[a]);return n&&e.length>0&&r.push({type:"text",value:`
100
- `}),r}function G0(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function Y0(e,n){const r=oT(e,n),a=r.one(e,void 0),l=ZC(r),u=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
101
- `},l),u}function dT(e,n){return e&&"run"in e?async function(r,a){const l=Y0(r,{file:a,...n});await e.run(l,a)}:function(r,a){return Y0(r,{file:a,...e||n})}}function V0(e){if(e)throw e}var yh,J0;function mT(){if(J0)return yh;J0=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=function(d){return typeof Array.isArray=="function"?Array.isArray(d):n.call(d)==="[object Array]"},u=function(d){if(!d||n.call(d)!=="[object Object]")return!1;var y=e.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!y&&!g)return!1;var b;for(b in d);return typeof b>"u"||e.call(d,b)},c=function(d,y){r&&y.name==="__proto__"?r(d,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):d[y.name]=y.newValue},f=function(d,y){if(y==="__proto__")if(e.call(d,y)){if(a)return a(d,y).value}else return;return d[y]};return yh=function m(){var d,y,g,b,x,k,L=arguments[0],B=1,D=arguments.length,$=!1;for(typeof L=="boolean"&&($=L,L=arguments[1]||{},B=2),(L==null||typeof L!="object"&&typeof L!="function")&&(L={});B<D;++B)if(d=arguments[B],d!=null)for(y in d)g=f(L,y),b=f(d,y),L!==b&&($&&b&&(u(b)||(x=l(b)))?(x?(x=!1,k=g&&l(g)?g:[]):k=g&&u(g)?g:{},c(L,{name:y,newValue:m($,k,b)})):typeof b<"u"&&c(L,{name:y,newValue:b}));return L},yh}var pT=mT();const bh=mb(pT);function td(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 gT(){const e=[],n={run:r,use:a};return n;function r(...l){let u=-1;const c=l.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...l);function f(m,...d){const y=e[++u];let g=-1;if(m){c(m);return}for(;++g<l.length;)(d[g]===null||d[g]===void 0)&&(d[g]=l[g]);l=d,y?yT(y,f)(...d):c(null,...d)}}function a(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),n}}function yT(e,n){let r;return a;function a(...c){const f=e.length>c.length;let m;f&&c.push(l);try{m=e.apply(this,c)}catch(d){const y=d;if(f&&r)throw y;return l(y)}f||(m&&m.then&&typeof m.then=="function"?m.then(u,l):m instanceof Error?l(m):u(m))}function l(c,...f){r||(r=!0,n(c,...f))}function u(c){l(null,c)}}const hr={basename:bT,dirname:vT,extname:xT,join:wT,sep:"/"};function bT(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');zl(e);let r=0,a=-1,l=e.length,u;if(n===void 0||n.length===0||n.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else a<0&&(u=!0,a=l+1);return a<0?"":e.slice(r,a)}if(n===e)return"";let c=-1,f=n.length-1;for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else c<0&&(u=!0,c=l+1),f>-1&&(e.codePointAt(l)===n.codePointAt(f--)?f<0&&(a=l):(f=-1,a=c));return r===a?a=c:a<0&&(a=e.length),e.slice(r,a)}function vT(e){if(zl(e),e.length===0)return".";let n=-1,r=e.length,a;for(;--r;)if(e.codePointAt(r)===47){if(a){n=r;break}}else a||(a=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function xT(e){zl(e);let n=e.length,r=-1,a=0,l=-1,u=0,c;for(;n--;){const f=e.codePointAt(n);if(f===47){if(c){a=n+1;break}continue}r<0&&(c=!0,r=n+1),f===46?l<0?l=n:u!==1&&(u=1):l>-1&&(u=-1)}return l<0||r<0||u===0||u===1&&l===r-1&&l===a+1?"":e.slice(l,r)}function wT(...e){let n=-1,r;for(;++n<e.length;)zl(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":ST(r)}function ST(e){zl(e);const n=e.codePointAt(0)===47;let r=_T(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function _T(e,n){let r="",a=0,l=-1,u=0,c=-1,f,m;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(l===c-1||u===1))if(l!==c-1&&u===2){if(r.length<2||a!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",a=0):(r=r.slice(0,m),a=r.length-1-r.lastIndexOf("/")),l=c,u=0;continue}}else if(r.length>0){r="",a=0,l=c,u=0;continue}}n&&(r=r.length>0?r+"/..":"..",a=2)}else r.length>0?r+="/"+e.slice(l+1,c):r=e.slice(l+1,c),a=c-l-1;l=c,u=0}else f===46&&u>-1?u++:u=-1}return r}function zl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const ET={cwd:kT};function kT(){return"/"}function nd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function AT(e){if(typeof e=="string")e=new URL(e);else if(!nd(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 CT(e)}function CT(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const a=n.codePointAt(r+2);if(a===70||a===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(n)}const vh=["history","path","basename","stem","extname","dirname"];class B1{constructor(n){let r;n?nd(n)?r={path:n}:typeof n=="string"||TT(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":ET.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<vh.length;){const u=vh[a];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let l;for(l in r)vh.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?hr.basename(this.path):void 0}set basename(n){wh(n,"basename"),xh(n,"basename"),this.path=hr.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?hr.dirname(this.path):void 0}set dirname(n){X0(this.basename,"dirname"),this.path=hr.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?hr.extname(this.path):void 0}set extname(n){if(xh(n,"extname"),X0(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=hr.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){nd(n)&&(n=AT(n)),wh(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?hr.basename(this.path,this.extname):void 0}set stem(n){wh(n,"stem"),xh(n,"stem"),this.path=hr.join(this.dirname||"",n+(this.extname||""))}fail(n,r,a){const l=this.message(n,r,a);throw l.fatal=!0,l}info(n,r,a){const l=this.message(n,r,a);return l.fatal=void 0,l}message(n,r,a){const l=new nn(n,r,a);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function xh(e,n){if(e&&e.includes(hr.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+hr.sep+"`")}function wh(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function X0(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function TT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const jT=(function(e){const a=this.constructor.prototype,l=a[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,a),u}),OT={}.hasOwnProperty;class Bd extends jT{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=gT()}copy(){const n=new Bd;let r=-1;for(;++r<this.attachers.length;){const a=this.attachers[r];n.use(...a)}return n.data(bh(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(Eh("data",this.frozen),this.namespace[n]=r,this):OT.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Eh("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const l=r.call(n,...a);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=ru(n),a=this.parser||this.Parser;return Sh("parse",a),a(String(r),r)}process(n,r){const a=this;return this.freeze(),Sh("process",this.parser||this.Parser),_h("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=ru(n),m=a.parse(f);a.run(m,f,function(y,g,b){if(y||!g||!b)return d(y);const x=g,k=a.stringify(x,b);MT(k)?b.value=k:b.result=k,d(y,b)});function d(y,g){y||!g?c(y):u?u(g):r(void 0,g)}}}processSync(n){let r=!1,a;return this.freeze(),Sh("processSync",this.parser||this.Parser),_h("processSync",this.compiler||this.Compiler),this.process(n,l),K0("processSync","process",r),a;function l(u,c){r=!0,V0(u),a=c}}run(n,r,a){Q0(n),this.freeze();const l=this.transformers;return!a&&typeof r=="function"&&(a=r,r=void 0),a?u(void 0,a):new Promise(u);function u(c,f){const m=ru(r);l.run(n,m,d);function d(y,g,b){const x=g||n;y?f(y):c?c(x):a(void 0,x,b)}}}runSync(n,r){let a=!1,l;return this.run(n,r,u),K0("runSync","run",a),l;function u(c,f){V0(c),l=f,a=!0}}stringify(n,r){this.freeze();const a=ru(r),l=this.compiler||this.Compiler;return _h("stringify",l),Q0(n),l(n,a)}use(n,...r){const a=this.attachers,l=this.namespace;if(Eh("use",this.frozen),n!=null)if(typeof n=="function")m(n,r);else if(typeof n=="object")Array.isArray(n)?f(n):c(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function u(d){if(typeof d=="function")m(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[y,...g]=d;m(y,g)}else c(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function c(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(d.plugins),d.settings&&(l.settings=bh(!0,l.settings,d.settings))}function f(d){let y=-1;if(d!=null)if(Array.isArray(d))for(;++y<d.length;){const g=d[y];u(g)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function m(d,y){let g=-1,b=-1;for(;++g<a.length;)if(a[g][0]===d){b=g;break}if(b===-1)a.push([d,...y]);else if(y.length>0){let[x,...k]=y;const L=a[b][1];td(L)&&td(x)&&(x=bh(!0,L,x)),a[b]=[d,x,...k]}}}}const NT=new Bd().freeze();function Sh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function _h(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Eh(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 Q0(e){if(!td(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function K0(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function ru(e){return RT(e)?e:new B1(e)}function RT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function MT(e){return typeof e=="string"||DT(e)}function DT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const zT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Z0=[],W0={allowDangerousHtml:!0},LT=/^(https?|ircs?|mailto|xmpp)$/i,UT=[{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 rd(e){const n=BT(e),r=PT(e);return qT(n.runSync(n.parse(r),r),e)}function BT(e){const n=e.rehypePlugins||Z0,r=e.remarkPlugins||Z0,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...W0}:W0;return NT().use(vC).use(r).use(dT,a).use(n)}function PT(e){const n=e.children||"",r=new B1;return typeof n=="string"&&(r.value=n),r}function qT(e,n){const r=n.allowedElements,a=n.allowElement,l=n.components,u=n.disallowedElements,c=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||HT;for(const y of UT)Object.hasOwn(n,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+zT+y.id,void 0);return Ud(e,d),nk(e,{Fragment:w.Fragment,components:l,ignoreInvalidStyle:!0,jsx:w.jsx,jsxs:w.jsxs,passKeys:!0,passNode:!0});function d(y,g,b){if(y.type==="raw"&&b&&typeof g=="number")return c?b.children.splice(g,1):b.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let x;for(x in mh)if(Object.hasOwn(mh,x)&&Object.hasOwn(y.properties,x)){const k=y.properties[x],L=mh[x];(L===null||L.includes(y.tagName))&&(y.properties[x]=m(String(k||""),x,y))}}if(y.type==="element"){let x=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!x&&a&&typeof g=="number"&&(x=!a(y,g,b)),x&&b&&typeof g=="number")return f&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function HT(e){const n=e.indexOf(":"),r=e.indexOf("?"),a=e.indexOf("#"),l=e.indexOf("/");return n===-1||l!==-1&&n>l||r!==-1&&n>r||a!==-1&&n>a||LT.test(e.slice(0,n))?e:""}function eb(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let a=0,l=r.indexOf(n);for(;l!==-1;)a++,l=r.indexOf(n,l+n.length);return a}function IT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function P1(e,n,r){const l=Uu((r||{}).ignore||[]),u=FT(n);let c=-1;for(;++c<u.length;)U1(e,"text",f);function f(d,y){let g=-1,b;for(;++g<y.length;){const x=y[g],k=b?b.children:void 0;if(l(x,k?k.indexOf(x):void 0,b))return;b=x}if(b)return m(d,y)}function m(d,y){const g=y[y.length-1],b=u[c][0],x=u[c][1];let k=0;const B=g.children.indexOf(d);let D=!1,$=[];b.lastIndex=0;let V=b.exec(d.value);for(;V;){const se=V.index,N={index:V.index,input:V.input,stack:[...y,d]};let R=x(...V,N);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?b.lastIndex=se+1:(k!==se&&$.push({type:"text",value:d.value.slice(k,se)}),Array.isArray(R)?$.push(...R):R&&$.push(R),k=se+V[0].length,D=!0),!b.global)break;V=b.exec(d.value)}return D?(k<d.value.length&&$.push({type:"text",value:d.value.slice(k)}),g.children.splice(B,1,...$)):$=[d],B+$.length}}function FT(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<r.length;){const l=r[a];n.push([$T(l[0]),GT(l[1])])}return n}function $T(e){return typeof e=="string"?new RegExp(IT(e),"g"):e}function GT(e){return typeof e=="function"?e:function(){return e}}const kh="phrasing",Ah=["autolink","link","image","label"];function YT(){return{transforms:[WT],enter:{literalAutolink:JT,literalAutolinkEmail:Ch,literalAutolinkHttp:Ch,literalAutolinkWww:Ch},exit:{literalAutolink:ZT,literalAutolinkEmail:KT,literalAutolinkHttp:XT,literalAutolinkWww:QT}}}function VT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:kh,notInConstruct:Ah},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:kh,notInConstruct:Ah},{character:":",before:"[ps]",after:"\\/",inConstruct:kh,notInConstruct:Ah}]}}function JT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ch(e){this.config.enter.autolinkProtocol.call(this,e)}function XT(e){this.config.exit.autolinkProtocol.call(this,e)}function QT(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 KT(e){this.config.exit.autolinkEmail.call(this,e)}function ZT(e){this.exit(e)}function WT(e){P1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ej],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),tj]],{ignore:["link","linkReference"]})}function ej(e,n,r,a,l){let u="";if(!q1(l)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!nj(r)))return!1;const c=rj(r+a);if(!c[0])return!1;const f={type:"link",title:null,url:u+n+c[0],children:[{type:"text",value:n+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function tj(e,n,r,a){return!q1(a,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function nj(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 rj(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],a=r.indexOf(")");const l=eb(e,"(");let u=eb(e,")");for(;a!==-1&&l>u;)e+=r.slice(0,a+1),r=r.slice(a+1),a=r.indexOf(")"),u++;return[e,r]}function q1(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ea(r)||Du(r))&&(!n||r!==47)}H1.peek=hj;function ij(){this.buffer()}function aj(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function sj(){this.buffer()}function lj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function oj(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=sr(this.sliceSerialize(e)).toLowerCase(),r.label=n}function uj(e){this.exit(e)}function cj(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=sr(this.sliceSerialize(e)).toLowerCase(),r.label=n}function fj(e){this.exit(e)}function hj(){return"["}function H1(e,n,r,a){const l=r.createTracker(a);let u=l.move("[^");const c=r.enter("footnoteReference"),f=r.enter("reference");return u+=l.move(r.safe(r.associationId(e),{after:"]",before:u})),f(),c(),u+=l.move("]"),u}function dj(){return{enter:{gfmFootnoteCallString:ij,gfmFootnoteCall:aj,gfmFootnoteDefinitionLabelString:sj,gfmFootnoteDefinition:lj},exit:{gfmFootnoteCallString:oj,gfmFootnoteCall:uj,gfmFootnoteDefinitionLabelString:cj,gfmFootnoteDefinition:fj}}}function mj(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:H1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(a,l,u,c){const f=u.createTracker(c);let m=f.move("[^");const d=u.enter("footnoteDefinition"),y=u.enter("label");return m+=f.move(u.safe(u.associationId(a),{before:m,after:"]"})),y(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((n?`
102
- `:" ")+u.indentLines(u.containerFlow(a,f.current()),n?I1:pj))),d(),m}}function pj(e,n,r){return n===0?e:I1(e,n,r)}function I1(e,n,r){return(r?"":" ")+e}const gj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];F1.peek=wj;function yj(){return{canContainEols:["delete"],enter:{strikethrough:vj},exit:{strikethrough:xj}}}function bj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:gj}],handlers:{delete:F1}}}function vj(e){this.enter({type:"delete",children:[]},e)}function xj(e){this.exit(e)}function F1(e,n,r,a){const l=r.createTracker(a),u=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),u(),c}function wj(){return"~"}function Sj(e){return e.length}function _j(e,n){const r=n||{},a=(r.align||[]).concat(),l=r.stringLength||Sj,u=[],c=[],f=[],m=[];let d=0,y=-1;for(;++y<e.length;){const L=[],B=[];let D=-1;for(e[y].length>d&&(d=e[y].length);++D<e[y].length;){const $=Ej(e[y][D]);if(r.alignDelimiters!==!1){const V=l($);B[D]=V,(m[D]===void 0||V>m[D])&&(m[D]=V)}L.push($)}c[y]=L,f[y]=B}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<d;)u[g]=tb(a[g]);else{const L=tb(a);for(;++g<d;)u[g]=L}g=-1;const b=[],x=[];for(;++g<d;){const L=u[g];let B="",D="";L===99?(B=":",D=":"):L===108?B=":":L===114&&(D=":");let $=r.alignDelimiters===!1?1:Math.max(1,m[g]-B.length-D.length);const V=B+"-".repeat($)+D;r.alignDelimiters!==!1&&($=B.length+$+D.length,$>m[g]&&(m[g]=$),x[g]=$),b[g]=V}c.splice(1,0,b),f.splice(1,0,x),y=-1;const k=[];for(;++y<c.length;){const L=c[y],B=f[y];g=-1;const D=[];for(;++g<d;){const $=L[g]||"";let V="",se="";if(r.alignDelimiters!==!1){const N=m[g]-(B[g]||0),R=u[g];R===114?V=" ".repeat(N):R===99?N%2?(V=" ".repeat(N/2+.5),se=" ".repeat(N/2-.5)):(V=" ".repeat(N/2),se=V):se=" ".repeat(N)}r.delimiterStart!==!1&&!g&&D.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&$==="")&&(r.delimiterStart!==!1||g)&&D.push(" "),r.alignDelimiters!==!1&&D.push(V),D.push($),r.alignDelimiters!==!1&&D.push(se),r.padding!==!1&&D.push(" "),(r.delimiterEnd!==!1||g!==d-1)&&D.push("|")}k.push(r.delimiterEnd===!1?D.join("").replace(/ +$/,""):D.join(""))}return k.join(`
103
- `)}function Ej(e){return e==null?"":String(e)}function tb(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 kj(e,n,r,a){const l=r.enter("blockquote"),u=r.createTracker(a);u.move("> "),u.shift(2);const c=r.indentLines(r.containerFlow(e,u.current()),Aj);return l(),c}function Aj(e,n,r){return">"+(r?"":" ")+e}function Cj(e,n){return nb(e,n.inConstruct,!0)&&!nb(e,n.notInConstruct,!1)}function nb(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let a=-1;for(;++a<n.length;)if(e.includes(n[a]))return!0;return!1}function rb(e,n,r,a){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
104
- `&&Cj(r.stack,r.unsafe[l]))return/[ \t]/.test(a.before)?"":" ";return`\\
105
- `}function Tj(e,n){const r=String(e);let a=r.indexOf(n),l=a,u=0,c=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===l?++u>c&&(c=u):u=1,l=a+n.length,a=r.indexOf(n,l);return c}function jj(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 Oj(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 Nj(e,n,r,a){const l=Oj(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(jj(e,r)){const g=r.enter("codeIndented"),b=r.indentLines(u,Rj);return g(),b}const f=r.createTracker(a),m=l.repeat(Math.max(Tj(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:`
102
+ `}),r}function X0(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function Q0(e,n){const r=AT(e,n),a=r.one(e,void 0),l=gT(r),u=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
103
+ `},l),u}function NT(e,n){return e&&"run"in e?async function(r,a){const l=Q0(r,{file:a,...n});await e.run(l,a)}:function(r,a){return Q0(r,{file:a,...e||n})}}function K0(e){if(e)throw e}var yh,Z0;function RT(){if(Z0)return yh;Z0=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=function(d){return typeof Array.isArray=="function"?Array.isArray(d):n.call(d)==="[object Array]"},u=function(d){if(!d||n.call(d)!=="[object Object]")return!1;var y=e.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!y&&!g)return!1;var b;for(b in d);return typeof b>"u"||e.call(d,b)},c=function(d,y){r&&y.name==="__proto__"?r(d,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):d[y.name]=y.newValue},f=function(d,y){if(y==="__proto__")if(e.call(d,y)){if(a)return a(d,y).value}else return;return d[y]};return yh=function m(){var d,y,g,b,x,k,L=arguments[0],B=1,D=arguments.length,F=!1;for(typeof L=="boolean"&&(F=L,L=arguments[1]||{},B=2),(L==null||typeof L!="object"&&typeof L!="function")&&(L={});B<D;++B)if(d=arguments[B],d!=null)for(y in d)g=f(L,y),b=f(d,y),L!==b&&(F&&b&&(u(b)||(x=l(b)))?(x?(x=!1,k=g&&l(g)?g:[]):k=g&&u(g)?g:{},c(L,{name:y,newValue:m(F,k,b)})):typeof b<"u"&&c(L,{name:y,newValue:b}));return L},yh}var MT=RT();const bh=mb(MT);function td(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 DT(){const e=[],n={run:r,use:a};return n;function r(...l){let u=-1;const c=l.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...l);function f(m,...d){const y=e[++u];let g=-1;if(m){c(m);return}for(;++g<l.length;)(d[g]===null||d[g]===void 0)&&(d[g]=l[g]);l=d,y?zT(y,f)(...d):c(null,...d)}}function a(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),n}}function zT(e,n){let r;return a;function a(...c){const f=e.length>c.length;let m;f&&c.push(l);try{m=e.apply(this,c)}catch(d){const y=d;if(f&&r)throw y;return l(y)}f||(m&&m.then&&typeof m.then=="function"?m.then(u,l):m instanceof Error?l(m):u(m))}function l(c,...f){r||(r=!0,n(c,...f))}function u(c){l(null,c)}}const fr={basename:LT,dirname:UT,extname:BT,join:PT,sep:"/"};function LT(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');zl(e);let r=0,a=-1,l=e.length,u;if(n===void 0||n.length===0||n.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else a<0&&(u=!0,a=l+1);return a<0?"":e.slice(r,a)}if(n===e)return"";let c=-1,f=n.length-1;for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else c<0&&(u=!0,c=l+1),f>-1&&(e.codePointAt(l)===n.codePointAt(f--)?f<0&&(a=l):(f=-1,a=c));return r===a?a=c:a<0&&(a=e.length),e.slice(r,a)}function UT(e){if(zl(e),e.length===0)return".";let n=-1,r=e.length,a;for(;--r;)if(e.codePointAt(r)===47){if(a){n=r;break}}else a||(a=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function BT(e){zl(e);let n=e.length,r=-1,a=0,l=-1,u=0,c;for(;n--;){const f=e.codePointAt(n);if(f===47){if(c){a=n+1;break}continue}r<0&&(c=!0,r=n+1),f===46?l<0?l=n:u!==1&&(u=1):l>-1&&(u=-1)}return l<0||r<0||u===0||u===1&&l===r-1&&l===a+1?"":e.slice(l,r)}function PT(...e){let n=-1,r;for(;++n<e.length;)zl(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":qT(r)}function qT(e){zl(e);const n=e.codePointAt(0)===47;let r=HT(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function HT(e,n){let r="",a=0,l=-1,u=0,c=-1,f,m;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(l===c-1||u===1))if(l!==c-1&&u===2){if(r.length<2||a!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",a=0):(r=r.slice(0,m),a=r.length-1-r.lastIndexOf("/")),l=c,u=0;continue}}else if(r.length>0){r="",a=0,l=c,u=0;continue}}n&&(r=r.length>0?r+"/..":"..",a=2)}else r.length>0?r+="/"+e.slice(l+1,c):r=e.slice(l+1,c),a=c-l-1;l=c,u=0}else f===46&&u>-1?u++:u=-1}return r}function zl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const IT={cwd:FT};function FT(){return"/"}function nd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function $T(e){if(typeof e=="string")e=new URL(e);else if(!nd(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 GT(e)}function GT(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const a=n.codePointAt(r+2);if(a===70||a===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(n)}const vh=["history","path","basename","stem","extname","dirname"];class H1{constructor(n){let r;n?nd(n)?r={path:n}:typeof n=="string"||YT(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":IT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<vh.length;){const u=vh[a];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let l;for(l in r)vh.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?fr.basename(this.path):void 0}set basename(n){wh(n,"basename"),xh(n,"basename"),this.path=fr.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?fr.dirname(this.path):void 0}set dirname(n){W0(this.basename,"dirname"),this.path=fr.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?fr.extname(this.path):void 0}set extname(n){if(xh(n,"extname"),W0(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=fr.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){nd(n)&&(n=$T(n)),wh(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?fr.basename(this.path,this.extname):void 0}set stem(n){wh(n,"stem"),xh(n,"stem"),this.path=fr.join(this.dirname||"",n+(this.extname||""))}fail(n,r,a){const l=this.message(n,r,a);throw l.fatal=!0,l}info(n,r,a){const l=this.message(n,r,a);return l.fatal=void 0,l}message(n,r,a){const l=new en(n,r,a);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function xh(e,n){if(e&&e.includes(fr.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+fr.sep+"`")}function wh(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function W0(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function YT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const VT=(function(e){const a=this.constructor.prototype,l=a[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,a),u}),JT={}.hasOwnProperty;class Ld extends VT{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=DT()}copy(){const n=new Ld;let r=-1;for(;++r<this.attachers.length;){const a=this.attachers[r];n.use(...a)}return n.data(bh(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(Eh("data",this.frozen),this.namespace[n]=r,this):JT.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Eh("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const l=r.call(n,...a);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=iu(n),a=this.parser||this.Parser;return Sh("parse",a),a(String(r),r)}process(n,r){const a=this;return this.freeze(),Sh("process",this.parser||this.Parser),_h("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=iu(n),m=a.parse(f);a.run(m,f,function(y,g,b){if(y||!g||!b)return d(y);const x=g,k=a.stringify(x,b);KT(k)?b.value=k:b.result=k,d(y,b)});function d(y,g){y||!g?c(y):u?u(g):r(void 0,g)}}}processSync(n){let r=!1,a;return this.freeze(),Sh("processSync",this.parser||this.Parser),_h("processSync",this.compiler||this.Compiler),this.process(n,l),tb("processSync","process",r),a;function l(u,c){r=!0,K0(u),a=c}}run(n,r,a){eb(n),this.freeze();const l=this.transformers;return!a&&typeof r=="function"&&(a=r,r=void 0),a?u(void 0,a):new Promise(u);function u(c,f){const m=iu(r);l.run(n,m,d);function d(y,g,b){const x=g||n;y?f(y):c?c(x):a(void 0,x,b)}}}runSync(n,r){let a=!1,l;return this.run(n,r,u),tb("runSync","run",a),l;function u(c,f){K0(c),l=f,a=!0}}stringify(n,r){this.freeze();const a=iu(r),l=this.compiler||this.Compiler;return _h("stringify",l),eb(n),l(n,a)}use(n,...r){const a=this.attachers,l=this.namespace;if(Eh("use",this.frozen),n!=null)if(typeof n=="function")m(n,r);else if(typeof n=="object")Array.isArray(n)?f(n):c(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function u(d){if(typeof d=="function")m(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[y,...g]=d;m(y,g)}else c(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function c(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(d.plugins),d.settings&&(l.settings=bh(!0,l.settings,d.settings))}function f(d){let y=-1;if(d!=null)if(Array.isArray(d))for(;++y<d.length;){const g=d[y];u(g)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function m(d,y){let g=-1,b=-1;for(;++g<a.length;)if(a[g][0]===d){b=g;break}if(b===-1)a.push([d,...y]);else if(y.length>0){let[x,...k]=y;const L=a[b][1];td(L)&&td(x)&&(x=bh(!0,L,x)),a[b]=[d,x,...k]}}}}const XT=new Ld().freeze();function Sh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function _h(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Eh(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 eb(e){if(!td(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function tb(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function iu(e){return QT(e)?e:new H1(e)}function QT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function KT(e){return typeof e=="string"||ZT(e)}function ZT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const WT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",nb=[],rb={allowDangerousHtml:!0},eO=/^(https?|ircs?|mailto|xmpp)$/i,tO=[{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 ib(e){const n=nO(e),r=rO(e);return iO(n.runSync(n.parse(r),r),e)}function nO(e){const n=e.rehypePlugins||nb,r=e.remarkPlugins||nb,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...rb}:rb;return XT().use(UC).use(r).use(NT,a).use(n)}function rO(e){const n=e.children||"",r=new H1;return typeof n=="string"&&(r.value=n),r}function iO(e,n){const r=n.allowedElements,a=n.allowElement,l=n.components,u=n.disallowedElements,c=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||aO;for(const y of tO)Object.hasOwn(n,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+WT+y.id,void 0);return zd(e,d),xk(e,{Fragment:w.Fragment,components:l,ignoreInvalidStyle:!0,jsx:w.jsx,jsxs:w.jsxs,passKeys:!0,passNode:!0});function d(y,g,b){if(y.type==="raw"&&b&&typeof g=="number")return c?b.children.splice(g,1):b.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let x;for(x in mh)if(Object.hasOwn(mh,x)&&Object.hasOwn(y.properties,x)){const k=y.properties[x],L=mh[x];(L===null||L.includes(y.tagName))&&(y.properties[x]=m(String(k||""),x,y))}}if(y.type==="element"){let x=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!x&&a&&typeof g=="number"&&(x=!a(y,g,b)),x&&b&&typeof g=="number")return f&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function aO(e){const n=e.indexOf(":"),r=e.indexOf("?"),a=e.indexOf("#"),l=e.indexOf("/");return n===-1||l!==-1&&n>l||r!==-1&&n>r||a!==-1&&n>a||eO.test(e.slice(0,n))?e:""}function ab(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let a=0,l=r.indexOf(n);for(;l!==-1;)a++,l=r.indexOf(n,l+n.length);return a}function sO(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function I1(e,n,r){const l=Uu((r||{}).ignore||[]),u=lO(n);let c=-1;for(;++c<u.length;)q1(e,"text",f);function f(d,y){let g=-1,b;for(;++g<y.length;){const x=y[g],k=b?b.children:void 0;if(l(x,k?k.indexOf(x):void 0,b))return;b=x}if(b)return m(d,y)}function m(d,y){const g=y[y.length-1],b=u[c][0],x=u[c][1];let k=0;const B=g.children.indexOf(d);let D=!1,F=[];b.lastIndex=0;let G=b.exec(d.value);for(;G;){const se=G.index,R={index:G.index,input:G.input,stack:[...y,d]};let O=x(...G,R);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?b.lastIndex=se+1:(k!==se&&F.push({type:"text",value:d.value.slice(k,se)}),Array.isArray(O)?F.push(...O):O&&F.push(O),k=se+G[0].length,D=!0),!b.global)break;G=b.exec(d.value)}return D?(k<d.value.length&&F.push({type:"text",value:d.value.slice(k)}),g.children.splice(B,1,...F)):F=[d],B+F.length}}function lO(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<r.length;){const l=r[a];n.push([oO(l[0]),uO(l[1])])}return n}function oO(e){return typeof e=="string"?new RegExp(sO(e),"g"):e}function uO(e){return typeof e=="function"?e:function(){return e}}const kh="phrasing",Ah=["autolink","link","image","label"];function cO(){return{transforms:[yO],enter:{literalAutolink:hO,literalAutolinkEmail:Ch,literalAutolinkHttp:Ch,literalAutolinkWww:Ch},exit:{literalAutolink:gO,literalAutolinkEmail:pO,literalAutolinkHttp:dO,literalAutolinkWww:mO}}}function fO(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:kh,notInConstruct:Ah},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:kh,notInConstruct:Ah},{character:":",before:"[ps]",after:"\\/",inConstruct:kh,notInConstruct:Ah}]}}function hO(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ch(e){this.config.enter.autolinkProtocol.call(this,e)}function dO(e){this.config.exit.autolinkProtocol.call(this,e)}function mO(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 pO(e){this.config.exit.autolinkEmail.call(this,e)}function gO(e){this.exit(e)}function yO(e){I1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,bO],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),vO]],{ignore:["link","linkReference"]})}function bO(e,n,r,a,l){let u="";if(!F1(l)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!xO(r)))return!1;const c=wO(r+a);if(!c[0])return!1;const f={type:"link",title:null,url:u+n+c[0],children:[{type:"text",value:n+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function vO(e,n,r,a){return!F1(a,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function xO(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 wO(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],a=r.indexOf(")");const l=ab(e,"(");let u=ab(e,")");for(;a!==-1&&l>u;)e+=r.slice(0,a+1),r=r.slice(a+1),a=r.indexOf(")"),u++;return[e,r]}function F1(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Wi(r)||Du(r))&&(!n||r!==47)}$1.peek=jO;function SO(){this.buffer()}function _O(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function EO(){this.buffer()}function kO(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function AO(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=ar(this.sliceSerialize(e)).toLowerCase(),r.label=n}function CO(e){this.exit(e)}function TO(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=ar(this.sliceSerialize(e)).toLowerCase(),r.label=n}function OO(e){this.exit(e)}function jO(){return"["}function $1(e,n,r,a){const l=r.createTracker(a);let u=l.move("[^");const c=r.enter("footnoteReference"),f=r.enter("reference");return u+=l.move(r.safe(r.associationId(e),{after:"]",before:u})),f(),c(),u+=l.move("]"),u}function NO(){return{enter:{gfmFootnoteCallString:SO,gfmFootnoteCall:_O,gfmFootnoteDefinitionLabelString:EO,gfmFootnoteDefinition:kO},exit:{gfmFootnoteCallString:AO,gfmFootnoteCall:CO,gfmFootnoteDefinitionLabelString:TO,gfmFootnoteDefinition:OO}}}function RO(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:$1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(a,l,u,c){const f=u.createTracker(c);let m=f.move("[^");const d=u.enter("footnoteDefinition"),y=u.enter("label");return m+=f.move(u.safe(u.associationId(a),{before:m,after:"]"})),y(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((n?`
104
+ `:" ")+u.indentLines(u.containerFlow(a,f.current()),n?G1:MO))),d(),m}}function MO(e,n,r){return n===0?e:G1(e,n,r)}function G1(e,n,r){return(r?"":" ")+e}const DO=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Y1.peek=PO;function zO(){return{canContainEols:["delete"],enter:{strikethrough:UO},exit:{strikethrough:BO}}}function LO(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:DO}],handlers:{delete:Y1}}}function UO(e){this.enter({type:"delete",children:[]},e)}function BO(e){this.exit(e)}function Y1(e,n,r,a){const l=r.createTracker(a),u=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),u(),c}function PO(){return"~"}function qO(e){return e.length}function HO(e,n){const r=n||{},a=(r.align||[]).concat(),l=r.stringLength||qO,u=[],c=[],f=[],m=[];let d=0,y=-1;for(;++y<e.length;){const L=[],B=[];let D=-1;for(e[y].length>d&&(d=e[y].length);++D<e[y].length;){const F=IO(e[y][D]);if(r.alignDelimiters!==!1){const G=l(F);B[D]=G,(m[D]===void 0||G>m[D])&&(m[D]=G)}L.push(F)}c[y]=L,f[y]=B}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<d;)u[g]=sb(a[g]);else{const L=sb(a);for(;++g<d;)u[g]=L}g=-1;const b=[],x=[];for(;++g<d;){const L=u[g];let B="",D="";L===99?(B=":",D=":"):L===108?B=":":L===114&&(D=":");let F=r.alignDelimiters===!1?1:Math.max(1,m[g]-B.length-D.length);const G=B+"-".repeat(F)+D;r.alignDelimiters!==!1&&(F=B.length+F+D.length,F>m[g]&&(m[g]=F),x[g]=F),b[g]=G}c.splice(1,0,b),f.splice(1,0,x),y=-1;const k=[];for(;++y<c.length;){const L=c[y],B=f[y];g=-1;const D=[];for(;++g<d;){const F=L[g]||"";let G="",se="";if(r.alignDelimiters!==!1){const R=m[g]-(B[g]||0),O=u[g];O===114?G=" ".repeat(R):O===99?R%2?(G=" ".repeat(R/2+.5),se=" ".repeat(R/2-.5)):(G=" ".repeat(R/2),se=G):se=" ".repeat(R)}r.delimiterStart!==!1&&!g&&D.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&F==="")&&(r.delimiterStart!==!1||g)&&D.push(" "),r.alignDelimiters!==!1&&D.push(G),D.push(F),r.alignDelimiters!==!1&&D.push(se),r.padding!==!1&&D.push(" "),(r.delimiterEnd!==!1||g!==d-1)&&D.push("|")}k.push(r.delimiterEnd===!1?D.join("").replace(/ +$/,""):D.join(""))}return k.join(`
105
+ `)}function IO(e){return e==null?"":String(e)}function sb(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 FO(e,n,r,a){const l=r.enter("blockquote"),u=r.createTracker(a);u.move("> "),u.shift(2);const c=r.indentLines(r.containerFlow(e,u.current()),$O);return l(),c}function $O(e,n,r){return">"+(r?"":" ")+e}function GO(e,n){return lb(e,n.inConstruct,!0)&&!lb(e,n.notInConstruct,!1)}function lb(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let a=-1;for(;++a<n.length;)if(e.includes(n[a]))return!0;return!1}function ob(e,n,r,a){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
106
+ `&&GO(r.stack,r.unsafe[l]))return/[ \t]/.test(a.before)?"":" ";return`\\
107
+ `}function YO(e,n){const r=String(e);let a=r.indexOf(n),l=a,u=0,c=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===l?++u>c&&(c=u):u=1,l=a+n.length,a=r.indexOf(n,l);return c}function VO(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 JO(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 XO(e,n,r,a){const l=JO(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(VO(e,r)){const g=r.enter("codeIndented"),b=r.indentLines(u,QO);return g(),b}const f=r.createTracker(a),m=l.repeat(Math.max(YO(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:`
106
108
  `,encode:["`"],...f.current()})),g()}return y+=f.move(`
107
109
  `),u&&(y+=f.move(u+`
108
- `)),y+=f.move(m),d(),y}function Rj(e,n,r){return(r?"":" ")+e}function Pd(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 Mj(e,n,r,a){const l=Pd(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const m=r.createTracker(a);let d=m.move("[");return d+=m.move(r.safe(r.associationId(e),{before:d,after:"]",...m.current()})),d+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":`
109
- `,...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 Dj(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 Al(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Cu(e,n,r){const a=rs(e),l=rs(n);return a===void 0?l===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}$1.peek=zj;function $1(e,n,r,a){const l=Dj(r),u=r.enter("emphasis"),c=r.createTracker(a),f=c.move(l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Cu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=Al(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=Cu(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Al(g));const x=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+x}function zj(e,n,r){return r.options.emphasis||"*"}function Lj(e,n){let r=!1;return Ud(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return r=!0,Wh}),!!((!e.depth||e.depth<3)&&Od(e)&&(n.options.setext||r))}function Uj(e,n,r,a){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(a);if(Lj(e,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),b=r.containerPhrasing(e,{...u.current(),before:`
110
+ `)),y+=f.move(m),d(),y}function QO(e,n,r){return(r?"":" ")+e}function Ud(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 KO(e,n,r,a){const l=Ud(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const m=r.createTracker(a);let d=m.move("[");return d+=m.move(r.safe(r.associationId(e),{before:d,after:"]",...m.current()})),d+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":`
111
+ `,...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 ZO(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 Al(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Cu(e,n,r){const a=rs(e),l=rs(n);return a===void 0?l===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}V1.peek=WO;function V1(e,n,r,a){const l=ZO(r),u=r.enter("emphasis"),c=r.createTracker(a),f=c.move(l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Cu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=Al(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=Cu(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Al(g));const x=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+x}function WO(e,n,r){return r.options.emphasis||"*"}function ej(e,n){let r=!1;return zd(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return r=!0,Wh}),!!((!e.depth||e.depth<3)&&Td(e)&&(n.options.setext||r))}function tj(e,n,r,a){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(a);if(ej(e,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),b=r.containerPhrasing(e,{...u.current(),before:`
110
112
  `,after:`
111
113
  `});return g(),y(),b+`
112
114
  `+(l===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
113
115
  `))+1))}const c="#".repeat(l),f=r.enter("headingAtx"),m=r.enter("phrasing");u.move(c+" ");let d=r.containerPhrasing(e,{before:"# ",after:`
114
- `,...u.current()});return/^[\t ]/.test(d)&&(d=Al(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,r.options.closeAtx&&(d+=" "+c),m(),f(),d}G1.peek=Bj;function G1(e){return e.value||""}function Bj(){return"<"}Y1.peek=Pj;function Y1(e,n,r,a){const l=Pd(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("image");let f=r.enter("label");const m=r.createTracker(a);let d=m.move("![");return d+=m.move(r.safe(e.alt,{before:d,after:"]",...m.current()})),d+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),d+=m.move(")"),c(),d}function Pj(){return"!"}V1.peek=qj;function V1(e,n,r,a){const l=e.referenceType,u=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(a);let m=f.move("![");const d=r.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function qj(){return"!"}J1.peek=Hj;function J1(e,n,r){let a=e.value||"",l="`",u=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(a);)l+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++u<r.unsafe.length;){const c=r.unsafe[u],f=r.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(a);){let d=m.index;a.charCodeAt(d)===10&&a.charCodeAt(d-1)===13&&d--,a=a.slice(0,d)+" "+a.slice(m.index+1)}}return l+a+l}function Hj(){return"`"}function X1(e,n){const r=Od(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))}Q1.peek=Ij;function Q1(e,n,r,a){const l=Pd(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(a);let f,m;if(X1(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 Ij(e,n,r){return X1(e,r)?"<":"["}K1.peek=Fj;function K1(e,n,r,a){const l=e.referenceType,u=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(a);let m=f.move("[");const d=r.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function Fj(){return"["}function qd(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 $j(e){const n=qd(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 Gj(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 Z1(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 Yj(e,n,r,a){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?Gj(r):qd(r);const f=e.ordered?c==="."?")":".":$j(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),Z1(r)===c&&y){let g=-1;for(;++g<e.children.length;){const b=e.children[g];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),r.bulletCurrent=c;const d=r.containerFlow(e,a);return r.bulletLastUsed=c,r.bulletCurrent=u,l(),d}function Vj(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 Jj(e,n,r,a){const l=Vj(r);let u=r.bulletCurrent||qd(r);n&&n.type==="list"&&n.ordered&&(u=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+u);let c=u.length+1;(l==="tab"||l==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=r.createTracker(a);f.move(u+" ".repeat(c-u.length)),f.shift(c);const m=r.enter("listItem"),d=r.indentLines(r.containerFlow(e,f.current()),y);return m(),d;function y(g,b,x){return b?(x?"":" ".repeat(c))+g:(x?u:u+" ".repeat(c-u.length))+g}}function Xj(e,n,r,a){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,a);return u(),l(),c}const Qj=Uu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Kj(e,n,r,a){return(e.children.some(function(c){return Qj(c)})?r.containerPhrasing:r.containerFlow).call(r,e,a)}function Zj(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}W1.peek=Wj;function W1(e,n,r,a){const l=Zj(r),u=r.enter("strong"),c=r.createTracker(a),f=c.move(l+l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Cu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=Al(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=Cu(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Al(g));const x=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+x}function Wj(e,n,r){return r.options.strong||"*"}function eO(e,n,r,a){return r.safe(e.value,a)}function tO(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 nO(e,n,r){const a=(Z1(r)+(r.options.ruleSpaces?" ":"")).repeat(tO(r));return r.options.ruleSpaces?a.slice(0,-1):a}const ev={blockquote:kj,break:rb,code:Nj,definition:Mj,emphasis:$1,hardBreak:rb,heading:Uj,html:G1,image:Y1,imageReference:V1,inlineCode:J1,link:Q1,linkReference:K1,list:Yj,listItem:Jj,paragraph:Xj,root:Kj,strong:W1,text:eO,thematicBreak:nO};function rO(){return{enter:{table:iO,tableData:ib,tableHeader:ib,tableRow:sO},exit:{codeText:lO,table:aO,tableData:Th,tableHeader:Th,tableRow:Th}}}function iO(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 aO(e){this.exit(e),this.data.inTable=void 0}function sO(e){this.enter({type:"tableRow",children:[]},e)}function Th(e){this.exit(e)}function ib(e){this.enter({type:"tableCell",children:[]},e)}function lO(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,oO));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function oO(e,n){return n==="|"?n:e}function uO(e){const n=e||{},r=n.tableCellPadding,a=n.tablePipeAlign,l=n.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
115
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:m,tableRow:f}};function c(x,k,L,B){return d(y(x,L,B),x.align)}function f(x,k,L,B){const D=g(x,L,B),$=d([D]);return $.slice(0,$.indexOf(`
116
- `))}function m(x,k,L,B){const D=L.enter("tableCell"),$=L.enter("phrasing"),V=L.containerPhrasing(x,{...B,before:u,after:u});return $(),D(),V}function d(x,k){return _j(x,{align:k,alignDelimiters:a,padding:r,stringLength:l})}function y(x,k,L){const B=x.children;let D=-1;const $=[],V=k.enter("table");for(;++D<B.length;)$[D]=g(B[D],k,L);return V(),$}function g(x,k,L){const B=x.children;let D=-1;const $=[],V=k.enter("tableRow");for(;++D<B.length;)$[D]=m(B[D],x,k,L);return V(),$}function b(x,k,L){let B=ev.inlineCode(x,k,L);return L.stack.includes("tableCell")&&(B=B.replace(/\|/g,"\\$&")),B}}function cO(){return{exit:{taskListCheckValueChecked:ab,taskListCheckValueUnchecked:ab,paragraph:hO}}}function fO(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:dO}}}function ab(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function hO(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const a=r.children[0];if(a&&a.type==="text"){const l=n.children;let u=-1,c;for(;++u<l.length;){const f=l[u];if(f.type==="paragraph"){c=f;break}}c===r&&(a.value=a.value.slice(1),a.value.length===0?r.children.shift():r.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,r.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function dO(e,n,r,a){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(a);u&&f.move(c);let m=ev.listItem(e,n,r,{...a,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),m;function d(y){return y+c}}function mO(){return[YT(),dj(),yj(),rO(),cO()]}function pO(e){return{extensions:[VT(),mj(e),bj(),uO(e),fO()]}}const gO={tokenize:SO,partial:!0},tv={tokenize:_O,partial:!0},nv={tokenize:EO,partial:!0},rv={tokenize:kO,partial:!0},yO={tokenize:AO,partial:!0},iv={name:"wwwAutolink",tokenize:xO,previous:sv},av={name:"protocolAutolink",tokenize:wO,previous:lv},Yr={name:"emailAutolink",tokenize:vO,previous:ov},vr={};function bO(){return{text:vr}}let Zi=48;for(;Zi<123;)vr[Zi]=Yr,Zi++,Zi===58?Zi=65:Zi===91&&(Zi=97);vr[43]=Yr;vr[45]=Yr;vr[46]=Yr;vr[95]=Yr;vr[72]=[Yr,av];vr[104]=[Yr,av];vr[87]=[Yr,iv];vr[119]=[Yr,iv];function vO(e,n,r){const a=this;let l,u;return c;function c(g){return!id(g)||!ov.call(a,a.previous)||Hd(a.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return id(g)?(e.consume(g),f):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(yO,y,d)(g):g===45||g===95||tn(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&&un(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):r(g)}}function xO(e,n,r){const a=this;return l;function l(c){return c!==87&&c!==119||!sv.call(a,a.previous)||Hd(a.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(gO,e.attempt(tv,e.attempt(nv,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(c)}}function wO(e,n,r){const a=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&lv.call(a,a.previous)&&!Hd(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(un(g)&&l.length<5)return l+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const b=l.toLowerCase();if(b==="http"||b==="https")return e.consume(g),m}return r(g)}function m(g){return g===47?(e.consume(g),u?d:(u=!0,m)):r(g)}function d(g){return g===null||Eu(g)||bt(g)||ea(g)||Du(g)?r(g):e.attempt(tv,e.attempt(nv,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function SO(e,n,r){let a=0;return l;function l(c){return(c===87||c===119)&&a<3?(a++,e.consume(c),l):c===46&&a===3?(e.consume(c),u):r(c)}function u(c){return c===null?r(c):n(c)}}function _O(e,n,r){let a,l,u;return c;function c(d){return d===46||d===95?e.check(rv,m,f)(d):d===null||bt(d)||ea(d)||d!==45&&Du(d)?m(d):(u=!0,e.consume(d),c)}function f(d){return d===95?a=!0:(l=a,a=void 0),e.consume(d),c}function m(d){return l||a||!u?r(d):n(d)}}function EO(e,n){let r=0,a=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&a<r?u(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(rv,n,u)(c):c===null||bt(c)||ea(c)?n(c):(e.consume(c),l)}function u(c){return c===41&&a++,e.consume(c),l}}function kO(e,n,r){return a;function a(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),a):f===38?(e.consume(f),u):f===93?(e.consume(f),l):f===60||f===null||bt(f)||ea(f)?n(f):r(f)}function l(f){return f===null||f===40||f===91||bt(f)||ea(f)?n(f):a(f)}function u(f){return un(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),a):un(f)?(e.consume(f),c):r(f)}}function AO(e,n,r){return a;function a(u){return e.consume(u),l}function l(u){return tn(u)?r(u):n(u)}}function sv(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||bt(e)}function lv(e){return!un(e)}function ov(e){return!(e===47||id(e))}function id(e){return e===43||e===45||e===46||e===95||tn(e)}function Hd(e){let n=e.length,r=!1;for(;n--;){const a=e[n][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){r=!0;break}if(a._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const CO={tokenize:zO,partial:!0};function TO(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:RO,continuation:{tokenize:MO},exit:DO}},text:{91:{name:"gfmFootnoteCall",tokenize:NO},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:jO,resolveTo:OO}}}}function jO(e,n,r){const a=this;let l=a.events.length;const u=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;l--;){const m=a.events[l][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return r(m);const d=sr(a.sliceSerialize({start:c.end,end:a.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function OO(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[r+1],e[r+2],["enter",a,n],e[r+3],e[r+4],["enter",l,n],["exit",l,n],["enter",u,n],["enter",c,n],["exit",c,n],["exit",u,n],e[e.length-2],e[e.length-1],["exit",a,n]];return e.splice(r,e.length-r+1,...f),e}function NO(e,n,r){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(g){if(u>999||g===93&&!c||g===null||g===91||bt(g))return r(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return l.includes(sr(a.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(g)}return bt(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 RO(e,n,r){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):r(k)}function y(k){if(c>999||k===93&&!f||k===null||k===91||bt(k))return r(k);if(k===93){e.exit("chunkString");const L=e.exit("gfmFootnoteDefinitionLabelString");return u=sr(a.sliceSerialize(L)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return bt(k)||(f=!0),c++,e.consume(k),k===92?g:y}function g(k){return k===91||k===92||k===93?(e.consume(k),c++,y):y(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),l.includes(u)||l.push(u),tt(e,x,"gfmFootnoteDefinitionWhitespace")):r(k)}function x(k){return n(k)}}function MO(e,n,r){return e.check(Dl,n,e.attempt(CO,n,r))}function DO(e){e.exit("gfmFootnoteDefinition")}function zO(e,n,r){const a=this;return tt(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?n(u):r(u)}}function LO(e){let r=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:u,resolveAll:l};return r==null&&(r=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function l(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let d=m;for(;d--;)if(c[d][0]==="exit"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[d][1].end.offset-c[d][1].start.offset){c[m][1].type="strikethroughSequence",c[d][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[d][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[d][1].end),end:Object.assign({},c[m][1].start)},b=[["enter",y,f],["enter",c[d][1],f],["exit",c[d][1],f],["enter",g,f]],x=f.parser.constructs.insideSpan.null;x&&Rn(b,b.length,0,zu(x,c.slice(d+1,m),f)),Rn(b,b.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",y,f]]),Rn(c,d-1,m-d+3,b),m=d+b.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,f,m){const d=this.previous,y=this.events;let g=0;return b;function b(k){return d===126&&y[y.length-1][1].type!=="characterEscape"?m(k):(c.enter("strikethroughSequenceTemporary"),x(k))}function x(k){const L=rs(d);if(k===126)return g>1?m(k):(c.consume(k),g++,x);if(g<2&&!r)return m(k);const B=c.exit("strikethroughSequenceTemporary"),D=rs(k);return B._open=!D||D===2&&!!L,B._close=!L||L===2&&!!D,f(k)}}}class UO{constructor(){this.map=[]}add(n,r,a){BO(this,n,r,a)}consume(n){if(this.map.sort(function(u,c){return u[0]-c[0]}),this.map.length===0)return;let r=this.map.length;const a=[];for(;r>0;)r-=1,a.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];a.push(n.slice()),n.length=0;let l=a.pop();for(;l;){for(const u of l)n.push(u);l=a.pop()}this.map.length=0}}function BO(e,n,r,a){let l=0;if(!(r===0&&a.length===0)){for(;l<e.map.length;){if(e.map[l][0]===n){e.map[l][1]+=r,e.map[l][2].push(...a);return}l+=1}e.map.push([n,r,a])}}function PO(e,n){let r=!1;const a=[];for(;n<e.length;){const l=e[n];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&a.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const u=a.length-1;a[u]=a[u]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return a}function qO(){return{flow:{null:{name:"table",tokenize:HO,resolveAll:IO}}}}function HO(e,n,r){const a=this;let l=0,u=0,c;return f;function f(T){let X=a.events.length-1;for(;X>-1;){const ue=a.events[X][1].type;if(ue==="lineEnding"||ue==="linePrefix")X--;else break}const K=X>-1?a.events[X][1].type:null,ye=K==="tableHead"||K==="tableRow"?R:m;return ye===R&&a.parser.lazy[a.now().line]?r(T):ye(T)}function m(T){return e.enter("tableHead"),e.enter("tableRow"),d(T)}function d(T){return T===124||(c=!0,u+=1),y(T)}function y(T){return T===null?r(T):Le(T)?u>1?(u=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),x):r(T):Ke(T)?tt(e,y,"whitespace")(T):(u+=1,c&&(c=!1,l+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(T)))}function g(T){return T===null||T===124||bt(T)?(e.exit("data"),y(T)):(e.consume(T),T===92?b:g)}function b(T){return T===92||T===124?(e.consume(T),g):g(T)}function x(T){return a.interrupt=!1,a.parser.lazy[a.now().line]?r(T):(e.enter("tableDelimiterRow"),c=!1,Ke(T)?tt(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):k(T))}function k(T){return T===45||T===58?B(T):T===124?(c=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),L):N(T)}function L(T){return Ke(T)?tt(e,B,"whitespace")(T):B(T)}function B(T){return T===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),D):T===45?(u+=1,D(T)):T===null||Le(T)?se(T):N(T)}function D(T){return T===45?(e.enter("tableDelimiterFiller"),$(T)):N(T)}function $(T){return T===45?(e.consume(T),$):T===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),V):(e.exit("tableDelimiterFiller"),V(T))}function V(T){return Ke(T)?tt(e,se,"whitespace")(T):se(T)}function se(T){return T===124?k(T):T===null||Le(T)?!c||l!==u?N(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(T)):N(T)}function N(T){return r(T)}function R(T){return e.enter("tableRow"),G(T)}function G(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),G):T===null||Le(T)?(e.exit("tableRow"),n(T)):Ke(T)?tt(e,G,"whitespace")(T):(e.enter("data"),J(T))}function J(T){return T===null||T===124||bt(T)?(e.exit("data"),G(T)):(e.consume(T),T===92?Y:J)}function Y(T){return T===92||T===124?(e.consume(T),J):J(T)}}function IO(e,n){let r=-1,a=!0,l=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,d,y,g;const b=new UO;for(;++r<e.length;){const x=e[r],k=x[1];x[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(sb(b,n,m,d,y),y=void 0,m=0),d={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(r,0,[["enter",d,n]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(a=!0,g=void 0,u=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,y={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(r,0,[["enter",y,n]])),l=k.type==="tableDelimiterRow"?2:y?3:1):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=iu(b,n,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):k.type==="tableCellDivider"&&(a?a=!1:(u[1]!==0&&(c[0]=c[1],g=iu(b,n,u,l,void 0,g)),u=c,c=[u[1],r,0,0])):k.type==="tableHead"?(f=!0,m=r):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=r,u[1]!==0?(c[0]=c[1],g=iu(b,n,u,l,r,g)):c[1]!==0&&(g=iu(b,n,c,l,r,g)),l=0):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&sb(b,n,m,d,y),b.consume(n.events),r=-1;++r<n.events.length;){const x=n.events[r];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=PO(n.events,r))}return e}function iu(e,n,r,a,l,u){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},$a(n.events,r[0])),e.add(r[0],0,[["exit",u,n]]));const m=$a(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=$a(n.events,r[2]),y=$a(n.events,r[3]),g={type:f,start:Object.assign({},d),end:Object.assign({},y)};if(e.add(r[2],0,[["enter",g,n]]),a!==2){const b=n.events[r[2]],x=n.events[r[3]];if(b[1].end=Object.assign({},x[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const k=r[2]+1,L=r[3]-r[2]-1;e.add(k,L,[])}}e.add(r[3]+1,0,[["exit",g,n]])}return l!==void 0&&(u.end=Object.assign({},$a(n.events,l)),e.add(l,0,[["exit",u,n]]),u=void 0),u}function sb(e,n,r,a,l){const u=[],c=$a(n.events,r);l&&(l.end=Object.assign({},c),u.push(["exit",l,n])),a.end=Object.assign({},c),u.push(["exit",a,n]),e.add(r+1,0,u)}function $a(e,n){const r=e[n],a=r[0]==="enter"?"start":"end";return r[1][a]}const FO={name:"tasklistCheck",tokenize:GO};function $O(){return{text:{91:FO}}}function GO(e,n,r){const a=this;return l;function l(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return bt(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 Le(m)?n(m):Ke(m)?e.check({tokenize:YO},n,r)(m):r(m)}}function YO(e,n,r){return tt(e,a,"whitespace");function a(l){return l===null?r(l):n(l)}}function VO(e){return b1([bO(),TO(),LO(e),qO(),$O()])}const JO={};function ad(e){const n=this,r=e||JO,a=n.data(),l=a.micromarkExtensions||(a.micromarkExtensions=[]),u=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);l.push(VO(r)),u.push(mO()),c.push(pO(r))}function XO({body:e,permissions:n}){return w.jsxs("div",{className:"plan-dialog",children:[w.jsx("h2",{children:"Task Execution Plan"}),w.jsxs("div",{className:"plan-dialog-scroll",children:[e?w.jsx("div",{className:"plan-preview",children:w.jsx(rd,{remarkPlugins:[ad],children:e})}):w.jsx("p",{className:"plan-empty",children:"No execution plan generated for this task. Your task description will be used directly."}),n&&n.length>0&&w.jsxs("div",{className:"permissions-section",children:[w.jsx("h3",{children:"Granted Permissions"}),w.jsx("ul",{className:"permissions-list",children:n.map((r,a)=>w.jsxs("li",{className:"permission-item",children:[w.jsx("span",{className:"permission-tool",children:r.name}),w.jsx("span",{className:"permission-desc",children:r.description})]},a))})]})]}),w.jsx("div",{className:"plan-dialog-actions",children:w.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const Ga=[];function QO(){const e=Ga.pop();e&&(e.pushed.current=!1,e.close())}let lb=!1;function KO(){lb||(lb=!0,window.addEventListener("popstate",QO))}function ZO(e,n){const r=U.useRef(!1),a=U.useRef(n);a.current=n;const l=U.useCallback(()=>a.current(),[]),u=U.useRef({close:l,pushed:r});u.current.close=l,U.useEffect(()=>{if(e&&!r.current)KO(),history.pushState({modal:!0},""),Ga.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=Ga.indexOf(u.current);c!==-1&&Ga.splice(c,1),history.back()}},[e,l]),U.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=Ga.indexOf(c);f!==-1&&Ga.splice(f,1),history.back()}}},[])}const WO=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function _i(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function eN(e){const n=e.split(" ");if(n.length!==5)return _i();const[r,a,l,,u]=n;if(a==="*")return _i("hourly");const c=`${a.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{..._i("weekly"),time:c,dayOfWeek:u}:l!=="*"?{..._i("monthly"),time:c,dayOfMonth:l}:{..._i("daily"),time:c}}function ob(e){if(e.type==="once"){const[n,r]=e.value.split("T");return{..._i("once"),onceDate:n??"",onceTime:(r??"09:00").slice(0,5)}}return eN(e.value)}function tN(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 nN(e){return e.schedule==="once"?e.onceDate?{type:"once",value:`${e.onceDate}T${e.onceTime}`}:null:{type:"cron",value:tN(e)}}function rN({initial:e,agents:n,hostPlatform:r,onSaved:a,onRun:l,onCancel:u}){var wr;const{request:c}=_d(),f=()=>{var Be;const Ee=localStorage.getItem("palmier:lastAgent"),Ie=n.map(jt=>jt.key);return Ee&&Ie.includes(Ee)?Ee:((Be=n[0])==null?void 0:Be.key)??""},[m,d]=U.useState((e==null?void 0:e.user_prompt)??""),[y,g]=U.useState((e==null?void 0:e.agent)??f()),[b]=U.useState((e==null?void 0:e.body)??""),x=!!e&&m!==(e.user_prompt??""),k=!!e&&y!==(e.agent??""),L=x||k,B=!!e&&(!!b||!!((wr=e.permissions)!=null&&wr.length))&&!L,[D,$]=U.useState(!1),V=U.useCallback(()=>$(!1),[]);ZO(D,V);const[se,N]=U.useState(null),[R,G]=U.useState(()=>((e==null?void 0:e.triggers)??[]).map(ob)),[J,Y]=U.useState(()=>{var Ee;return((Ee=((e==null?void 0:e.triggers)??[]).map(ob)[0])==null?void 0:Ee.schedule)??"daily"}),[T,X]=U.useState((e==null?void 0:e.triggers_enabled)??!1),[K,ye]=U.useState((e==null?void 0:e.requires_confirmation)??!1),[ue,q]=U.useState((e==null?void 0:e.yolo_mode)??!1),[I,ae]=U.useState((e==null?void 0:e.foreground_mode)??!1),[ge,_e]=U.useState(null),O=ge!==null,[M,W]=U.useState(!!(e!=null&&e.command)),[S,he]=U.useState((e==null?void 0:e.command)??""),fe=U.useRef(null),ve=!!e,Te=!ve||m!==((e==null?void 0:e.user_prompt)??"")||y!==((e==null?void 0:e.agent)??"")||T!==((e==null?void 0:e.triggers_enabled)??!0)||K!==((e==null?void 0:e.requires_confirmation)??!1)||ue!==((e==null?void 0:e.yolo_mode)??!1)||I!==((e==null?void 0:e.foreground_mode)??!1)||M!==!!(e!=null&&e.command)||M&&S!==((e==null?void 0:e.command)??"")||JSON.stringify(nt())!==JSON.stringify((e==null?void 0:e.triggers)??[]),ze=T&&R.some(Ee=>Ee.schedule==="once"&&(!Ee.onceDate||new Date(`${Ee.onceDate}T${Ee.onceTime}`)<=new Date)),ke=Te&&!!m.trim()&&!ze&&(!M||!!S.trim());function Me(Ee,Ie){G(Be=>Be.map((jt,Dn)=>Dn===Ee?{...jt,...Ie}:jt))}function wt(Ee){G(Ie=>{const Be=Ie.filter((jt,Dn)=>Dn!==Ee);return Be.length===0&&(X(!1),ye(!1)),Be})}function He(){G(Ee=>[...Ee,_i(J)])}function qe(Ee){Y(Ee),G([_i(Ee)])}function nt(){return R.flatMap(Ee=>{const Ie=nN(Ee);return Ie?[Ie]:[]})}function ft(){return ue?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.
117
-
118
- Are you sure you want to continue?`):!0}async function Mt(){_e("save"),N(null);try{const Ee=ve?"task.update":"task.create",Ie={user_prompt:m,agent:y,triggers:nt(),triggers_enabled:T,requires_confirmation:K,yolo_mode:ue,foreground_mode:I,command:M?S:""};ve&&(Ie.id=e.id);const Be=await c(Ee,Ie,{timeout:13e4});return Be.error?(N(Be.error),null):(ve||localStorage.setItem("palmier:lastAgent",y),a(Be),Be)}catch(Ee){return N(Ee instanceof Error?Ee.message:String(Ee)),null}finally{_e(null)}}async function xr(){_e("run"),N(null);try{const Ie=await c("task.run_oneoff",{user_prompt:m,agent:y,requires_confirmation:K,yolo_mode:ue,foreground_mode:I,command:M?S:""});if(Ie.error){N(Ie.error);return}localStorage.setItem("palmier:lastAgent",y),l(Ie.task_id,Ie.run_id),u()}catch(Ee){N(Ee instanceof Error?Ee.message:String(Ee))}finally{_e(null)}}return w.jsx("div",{className:"task-form-overlay",children:w.jsx("div",{className:"task-form",children:D?w.jsx(XO,{body:b,permissions:e==null?void 0:e.permissions}):w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"task-form-header",children:w.jsx("h2",{children:e?"Edit Task":"New Task"})}),se&&w.jsx("div",{className:"form-error",children:se}),w.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:m,onChange:Ee=>d(Ee.target.value),placeholder:M?"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:O}),w.jsxs("div",{className:"plan-actions",children:[B&&w.jsx("button",{className:"btn btn-link",onClick:()=>$(!0),children:"Execution Plan"}),w.jsxs("div",{className:"agent-picker-section-inline",style:{marginLeft:"auto"},children:[w.jsx("span",{className:"agent-picker-label",children:"Run with"}),w.jsx("select",{className:"form-select form-select-sm",value:y,onChange:Ee=>g(Ee.target.value),children:n.map(Ee=>w.jsx("option",{value:Ee.key,children:Ee.label},Ee.key))})]})]}),w.jsxs("div",{className:"toggles-group",children:[w.jsxs("div",{className:`command-section${M?" command-section-active":""}`,children:[w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:M,onChange:Ee=>{W(Ee.target.checked),Ee.target.checked?setTimeout(()=>{var Ie;return(Ie=fe.current)==null?void 0:Ie.focus()},0):he("")},disabled:O}),"Reactive"]}),M&&w.jsxs(w.Fragment,{children:[w.jsx("p",{className:"command-help-text",children:"Runs a command and invokes the task for each line of output. Use “the input” in your task description to reference each line."}),w.jsx("input",{ref:fe,className:"form-input form-input-mono",type:"text",value:S,onChange:Ee=>he(Ee.target.value),placeholder:"gws gmail +watch --project my-project",disabled:O})]})]}),r==="win32"&&w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:I,onChange:Ee=>ae(Ee.target.checked),disabled:O}),"Run in the foreground (host must login to Windows)"]}),w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:ue,onChange:Ee=>q(Ee.target.checked),disabled:O}),"Yolo mode"]}),ue&&w.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."}),w.jsxs("div",{className:"triggers-section",children:[w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:T,onChange:Ee=>{Ee.target.checked?(X(!0),R.length===0&&He()):(X(!1),ye(!1),G(Ie=>{const Be=Ie.filter(jt=>jt.schedule==="once"?jt.onceDate&&new Date(`${jt.onceDate}T${jt.onceTime}`)>new Date:!0);return Be.length===1&&Be[0].schedule==="daily"&&Be[0].time==="00:00"?[]:Be}))},disabled:O}),"Enable schedule"]}),w.jsxs("div",{className:`triggers-section-body${T?"":" disabled"}`,children:[R.length>0&&w.jsxs("select",{className:"form-select",value:J,disabled:!T,onChange:Ee=>qe(Ee.target.value),children:[w.jsx("option",{value:"once",children:"Specific Time"}),w.jsx("option",{value:"hourly",children:"Hourly"}),w.jsx("option",{value:"daily",children:"Daily"}),w.jsx("option",{value:"weekly",children:"Weekly"}),w.jsx("option",{value:"monthly",children:"Monthly"})]}),J!=="hourly"&&R.map((Ee,Ie)=>w.jsxs("div",{className:"trigger-row-card",children:[w.jsxs("div",{className:"trigger-row-content",children:[J==="daily"&&w.jsx("input",{className:"form-input",type:"time",value:Ee.time,disabled:!T,onChange:Be=>Me(Ie,{time:Be.target.value})}),J==="weekly"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("select",{className:"form-select",value:Ee.dayOfWeek,disabled:!T,onChange:Be=>Me(Ie,{dayOfWeek:Be.target.value}),children:WO.map((Be,jt)=>w.jsx("option",{value:String(jt),children:Be},jt))}),w.jsx("input",{className:"form-input",type:"time",value:Ee.time,disabled:!T,onChange:Be=>Me(Ie,{time:Be.target.value})})]}),J==="monthly"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("select",{className:"form-select",value:Ee.dayOfMonth,disabled:!T,onChange:Be=>Me(Ie,{dayOfMonth:Be.target.value}),children:Array.from({length:28},(Be,jt)=>jt+1).map(Be=>w.jsxs("option",{value:String(Be),children:["Day ",Be]},Be))}),w.jsx("input",{className:"form-input",type:"time",value:Ee.time,disabled:!T,onChange:Be=>Me(Ie,{time:Be.target.value})})]}),J==="once"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("input",{className:"form-input",type:"date",value:Ee.onceDate,min:new Date().toISOString().split("T")[0],disabled:!T,onChange:Be=>Me(Ie,{onceDate:Be.target.value})}),w.jsx("input",{className:"form-input",type:"time",value:Ee.onceTime,min:Ee.onceDate===new Date().toISOString().split("T")[0]?new Date().toTimeString().slice(0,5):void 0,disabled:!T,onChange:Be=>Me(Ie,{onceTime:Be.target.value})})]})]}),R.length>1&&w.jsx("button",{className:"trigger-remove-btn",onClick:()=>wt(Ie),disabled:!T,title:"Remove trigger",children:"×"})]},Ie)),R.length>0&&J!=="hourly"&&w.jsx("button",{className:"trigger-add-btn",onClick:He,disabled:!T,children:"+ Add"})]})]}),T&&R.length>0&&w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:K,onChange:Ee=>ye(Ee.target.checked),disabled:O}),"Confirm before each run"]})]}),!ue&&(()=>{const Ee=n.find(Ie=>Ie.key===y);return(Ee==null?void 0:Ee.supportsPermissions)===!1&&w.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",Ee.label,". The task may fail if required permissions are not pre-configured."]})})(),w.jsxs("div",{className:"form-actions",children:[(()=>{const Ee=R.length>0,Ie=!!m.trim()&&(!M||!!S.trim());return ve?Te?w.jsxs("button",{className:"btn btn-primary",onClick:()=>ft()&&Mt(),disabled:!ke||O,children:[ge==="save"&&w.jsx("span",{className:"btn-spinner"}),"Save"]}):w.jsx("button",{className:"btn btn-primary",disabled:!0,children:"Save"}):Ee?w.jsxs("button",{className:"btn btn-primary",onClick:()=>ft()&&Mt(),disabled:!ke||O,children:[ge==="save"&&w.jsx("span",{className:"btn-spinner"}),"Schedule"]}):w.jsxs(w.Fragment,{children:[w.jsxs("button",{className:"btn btn-primary",onClick:()=>ft()&&xr(),disabled:!Ie||O,children:[ge==="run"&&w.jsx("span",{className:"btn-spinner"}),"Run"]}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>ft()&&Mt(),disabled:!ke||O,children:"Save"})]})})(),w.jsx("button",{className:"btn btn-secondary",onClick:()=>{Te&&m.trim()&&!confirm("You have unsaved changes. Discard?")||u()},style:{marginLeft:"auto"},children:"Cancel"})]})]})})})}const iN="0.6.7";function aN(e,n){if(e.includes("-"))return!1;const r=e.split(".").map(Number),a=n.split(".").map(Number);for(let l=0;l<3;l++){if((r[l]??0)<(a[l]??0))return!0;if((r[l]??0)>(a[l]??0))return!1}return!1}function sN({connected:e,hostId:n,request:r,subscribeEvents:a,onViewRun:l,onUpdateRequired:u,onVersion:c,onLocationClientToken:f}){const[m,d]=U.useState([]),[y,g]=U.useState(!1),[b,x]=U.useState(null),[k,L]=U.useState(new Map),[B,D]=U.useState(new Map),[$,V]=U.useState(new Map),[se,N]=U.useState(new Map),[R,G]=U.useState(new Map),[J,Y]=U.useState(!1),[T,X]=U.useState(void 0),[K,ye]=U.useState([]),[ue,q]=U.useState(),I=U.useCallback(()=>{Y(!1),X(void 0)},[]),ae=U.useCallback(async()=>{var S,he;if(e){g(!0),x(null);try{const fe=await r("task.list"),ve=fe.tasks??[],Te=new Map,ze=new Map,ke=new Map,Me=new Map,wt=new Map;for(const qe of ve)qe.status&&(Te.set(qe.id,qe.status),(S=qe.status.pending_permission)!=null&&S.length&&ke.set(qe.id,qe.status.pending_permission),(he=qe.status.pending_input)!=null&&he.length&&(Me.set(qe.id,{questions:qe.status.pending_input}),wt.set(qe.id,new Array(qe.status.pending_input.length).fill(""))));L(Te),D(ze),V(ke),N(Me),G(wt),d(ve),ye(fe.agents??[]),q(fe.host_platform),k2(fe.agents??[]);const He=fe.version??null;c==null||c(He),f==null||f(fe.location_client_token??null),u==null||u(!!He&&aN(He,iN))}catch(fe){const ve=fe instanceof Error?fe.message:String(fe);ve==="Not connected"||ve.includes("503")||ve.toLowerCase().includes("no responders")?x(null):x(ve),d([])}finally{g(!1)}}},[e,n,r]);U.useEffect(()=>{e?ae():(d([]),g(!1))},[e,n,ae]),U.useEffect(()=>{if(!e||!n)return;const S={decode:fe=>new TextDecoder().decode(fe)};return a(n,async fe=>{var wt;const ve=fe.subject.split(".");if(ve.length<3)return;const Te=ve.slice(2).join(".");let ze={};try{ze=JSON.parse(S.decode(fe.data))}catch{return}const ke=ze.event_type,Me=ze.session_id;if(ke==="input-request"&&Me){const He=ze.input_questions,qe=ze.agent_name,nt=ze.description;He!=null&&He.length&&(N(ft=>{if(ft.has(Me))return ft;const Mt=new Map(ft);return Mt.set(Me,{questions:He,description:nt,agentName:qe}),Mt}),G(ft=>{if(ft.has(Me))return ft;const Mt=new Map(ft);return Mt.set(Me,new Array(He.length).fill("")),Mt}));return}if(ke==="input-resolved"&&Me){N(He=>{if(!He.has(Me))return He;const qe=new Map(He);return qe.delete(Me),qe}),G(He=>{const qe=new Map(He);return qe.delete(Me),qe});return}if(ke==="confirm-request"&&Me){const He=ze.description,qe=ze.agent_name;He&&D(nt=>{if(nt.has(Me))return nt;const ft=new Map(nt);return ft.set(Me,{description:He,agentName:qe}),ft});return}if(ke==="confirm-resolved"&&Me){D(He=>{if(!He.has(Me))return He;const qe=new Map(He);return qe.delete(Me),qe});return}if(ke==="permission-resolved"){V(He=>{if(!He.has(Te))return He;const qe=new Map(He);return qe.delete(Te),qe});return}try{const He=await r("task.status",{id:Te},{timeout:5e3});if(He.error)return;L(qe=>{const nt=new Map(qe);return nt.set(Te,He),nt}),(wt=He.pending_permission)!=null&&wt.length&&V(qe=>{if(qe.has(Te))return qe;const nt=new Map(qe);return nt.set(Te,He.pending_permission),nt})}catch{}})},[e,n,a,r]);async function ge(S,he){try{await r("task.user_input",{id:S,value:[he]})}catch(fe){console.error("[TaskListView] Failed to respond to confirmation:",fe)}}async function _e(S,he){try{await r("task.user_input",{id:S,value:[he]})}catch(fe){console.error("[TaskListView] Failed to respond to permission request:",fe)}}async function O(S,he){try{await r("task.user_input",{id:S,value:he})}catch(fe){console.error("[TaskListView] Failed to respond to input request:",fe)}}function M(S){d(he=>{const fe=he.findIndex(ve=>ve.id===S.id);if(fe>=0){const ve=[...he];return ve[fe]=S,ve}return[S,...he]}),Y(!1),X(void 0)}function W(S){d(he=>he.filter(fe=>fe.id!==S)),L(he=>{const fe=new Map(he);return fe.delete(S),fe}),N(he=>{const fe=new Map(he);return fe.delete(S),fe}),G(he=>{const fe=new Map(he);return fe.delete(S),fe})}return w.jsxs(w.Fragment,{children:[b&&w.jsxs("div",{className:"form-error",children:[b,b.toLowerCase().includes("failed to fetch")&&w.jsxs(w.Fragment,{children:[" ",w.jsx("a",{href:"#",onClick:S=>{S.preventDefault(),window.location.reload()},children:"Reload"})]})]}),w.jsx("div",{className:"new-task-input-card",onClick:()=>{X(void 0),Y(!0)},role:"button",tabIndex:0,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(X(void 0),Y(!0))},children:w.jsx("span",{className:"new-task-placeholder",children:"Describe your new task..."})}),y&&!m.length?w.jsx("div",{className:"task-list",children:[0,1,2].map(S=>w.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[w.jsx("div",{className:"task-card-header",children:w.jsxs("div",{className:"task-card-title-row",children:[w.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),w.jsx("div",{className:"skeleton-line",style:{width:`${60+S*12}%`}})]})}),w.jsxs("div",{className:"task-card-meta",children:[w.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},S))}):w.jsx("div",{className:"task-list",children:m.map(S=>w.jsx(C2,{task:S,lastEvent:k.get(S.id),onEdit:async he=>{try{const fe=await r("task.get",{id:he.id});X(fe.error?he:fe)}catch{X(he)}Y(!0)},onDelete:W,onViewRun:l},S.id))}),J&&w.jsx(rN,{initial:T,agents:K,hostPlatform:ue,onSaved:M,onRun:l,onCancel:I}),du.createPortal(w.jsxs(w.Fragment,{children:[[...B.entries()].map(([S,{description:he,agentName:fe}])=>{var Te;const ve=fe||((Te=m.find(ze=>ze.id===S))==null?void 0:Te.name);return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),ve&&w.jsx("p",{className:"confirm-modal-subtitle",children:ve}),w.jsx("p",{className:"confirm-modal-message",children:he}),w.jsxs("div",{className:"confirm-modal-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>ge(S,"confirmed"),children:"Confirm"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>ge(S,"aborted"),children:"Abort"})]})]})},S)}),[...$.entries()].map(([S,he])=>{const fe=m.find(ve=>ve.id===S);return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal permission-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),w.jsx("p",{className:"confirm-modal-message",children:w.jsx("strong",{children:(fe==null?void 0:fe.name)||(fe==null?void 0:fe.user_prompt)||S})}),w.jsx("div",{className:"permission-list",children:he.map((ve,Te)=>w.jsxs("div",{className:"permission-item",children:[w.jsx("span",{className:"permission-name",children:ve.name}),ve.description&&w.jsx("span",{className:"permission-desc",children:ve.description})]},Te))}),w.jsxs("div",{className:"permission-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>_e(S,"granted"),children:"Allow Once"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>_e(S,"granted_all"),children:"Allow Always"})]}),w.jsx("button",{className:"permission-abort-link",onClick:()=>_e(S,"aborted"),children:"Deny & Abort Task"})]})},S)}),[...se.entries()].map(([S,{questions:he,description:fe,agentName:ve}])=>{var ke;const Te=R.get(S)??new Array(he.length).fill(""),ze=ve||((ke=m.find(Me=>Me.id===S))==null?void 0:ke.name);return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal input-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),ze&&w.jsx("p",{className:"confirm-modal-subtitle",children:ze}),fe&&w.jsx("p",{className:"confirm-modal-message",children:fe}),w.jsx("div",{className:"input-list",children:he.map((Me,wt)=>w.jsxs("div",{className:"input-item",children:[w.jsx("label",{className:"input-label",children:Me}),w.jsx("input",{type:"text",className:"input-field",value:Te[wt]??"",onChange:He=>{G(qe=>{const nt=new Map(qe),ft=[...nt.get(S)??[]];return ft[wt]=He.target.value,nt.set(S,ft),nt})},autoFocus:wt===0})]},wt))}),w.jsx("div",{className:"input-actions",children:w.jsx("button",{className:"btn btn-primary",disabled:Te.some(Me=>!Me.trim()),onClick:()=>O(S,Te),children:"Submit"})}),w.jsx("button",{className:"permission-abort-link",onClick:()=>O(S,["aborted"]),children:"Cancel"})]})},S)})]}),document.body)]})}function lN(){const e=ta(),r=br().pathname.startsWith("/runs");return w.jsxs(w.Fragment,{children:[w.jsxs("button",{className:`tab-btn ${r?"":"tab-btn-active"}`,onClick:()=>e("/"),children:[w.jsxs("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),w.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]}),w.jsxs("button",{className:`tab-btn ${r?"tab-btn-active":""}`,onClick:()=>e("/runs"),children:[w.jsx("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Runs"]})]})}const oN="modulepreload",uN=function(e){return"/"+e},ub={},uv=function(n,r,a){let l=Promise.resolve();if(r&&r.length>0){let c=function(d){return Promise.all(d.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=c(r.map(d=>{if(d=uN(d),d in ub)return;ub[d]=!0;const y=d.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":oN,y||(b.as="script"),b.crossOrigin="",b.href=d,m&&b.setAttribute("nonce",m),document.head.appendChild(b),y)return new Promise((x,k)=>{b.addEventListener("load",x),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${d}`)))})}))}function u(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return l.then(c=>{for(const f of c||[])f.status==="rejected"&&u(f.reason);return n().catch(u)})},cN=ls("App",{web:()=>uv(()=>import("./web-6UChJFov.js"),[]).then(e=>new e.AppWeb)}),cv=ls("Preferences",{web:()=>uv(()=>import("./web-NxTETXZK.js"),[]).then(e=>new e.PreferencesWeb)});function fv(e){const[n,r]=U.useState(()=>window.matchMedia(e).matches);return U.useEffect(()=>{const a=window.matchMedia(e),l=u=>r(u.matches);return a.addEventListener("change",l),r(a.matches),()=>a.removeEventListener("change",l)},[e]),n}const au=ji.isNativePlatform()?ls("LocationPermission"):null,cb=!!window.__PALMIER_SERVE__,fb=ji.isNativePlatform();function hb({daemonVersion:e,locationClientToken:n,activeClientToken:r,request:a,onLocationClientTokenChange:l}){var O;const{pairedHosts:u,activeHostId:c,setActiveHostId:f,removePairedHost:m,renamePairedHost:d}=Ol(),y=ta(),g=fv("(min-width: 768px)"),[b,x]=U.useState(!1),[k,L]=U.useState(!1),[B,D]=U.useState(null),[$,V]=U.useState(""),[se,N]=U.useState(null),[R,G]=U.useState(!1),J=!!(r&&n===r);U.useEffect(()=>{if(!fb||!au||!a)return;function M(){J&&au.check().then(({fine:S})=>{S||a("device.location.disable").then(()=>{l==null||l(null)}).catch(()=>{})})}M();const W=cN.addListener("resume",()=>{M()});return()=>{W.then(S=>S.remove())}},[J,r]);async function Y(){if(a){G(!0);try{if(J)await a("device.location.disable"),l==null||l(null);else{if(au&&!(await au.request()).fine)return;const{value:M}=await cv.get({key:"fcmToken"});if(!M){console.warn("No FCM token available");return}await a("device.location.enable",{fcmToken:M}),l==null||l(r??null)}}catch(M){console.error("Failed to toggle location:",M)}finally{G(!1)}}}const T=U.useRef(null),X=U.useRef(null),K=U.useCallback(()=>{L(!0)},[]);function ye(){k&&(x(!1),L(!1))}function ue(){L(!1),x(!0)}function q(M,W){D(M),V(W)}function I(){B&&$.trim()&&d(B,$.trim()),D(null),V("")}function ae(){D(null),V("")}U.useEffect(()=>{B&&X.current&&(X.current.focus(),X.current.select())},[B]),U.useEffect(()=>{if(!b||k)return;function M(W){W.key==="Escape"&&K()}return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M)}},[b,k,K]);const ge=w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"drawer-header",children:[w.jsx("span",{className:"drawer-title",children:"Palmier"}),!g&&w.jsx("button",{className:"drawer-close-btn",onClick:K,"aria-label":"Close menu",children:w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:w.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),!cb&&u.length>0&&w.jsxs("div",{className:"drawer-section",children:[w.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),w.jsx("div",{className:"host-picker-inline",children:w.jsx("div",{className:"host-picker-list",role:"listbox",children:u.map(M=>{const W=M.hostId===c,S=B===M.hostId,he=M.name||M.hostId.slice(0,8);return w.jsx("div",{className:"host-picker-item-wrapper",children:w.jsxs("div",{className:`host-picker-item ${W?"host-picker-item-active":""}`,onClick:()=>{S||W||(f(M.hostId),g||K())},role:"option","aria-selected":W,children:[S?w.jsx("input",{ref:X,className:"form-input host-picker-rename-input",type:"text",value:$,onChange:fe=>V(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"&&I(),fe.key==="Escape"&&ae()},onBlur:I,onClick:fe=>fe.stopPropagation()}):w.jsx("span",{className:"host-picker-item-name",children:he}),w.jsxs("div",{className:"host-picker-item-actions",children:[W&&!S&&w.jsx("button",{className:"host-picker-edit-btn",onClick:fe=>{fe.stopPropagation(),q(M.hostId,he)},"aria-label":"Rename host",children:w.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:w.jsx("path",{d:"M9.5 1.5L11.5 3.5M1.5 11.5L2 9L9 2L11 4L4 11L1.5 11.5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),!W&&w.jsx("button",{className:"host-picker-delete-btn",onClick:fe=>{fe.stopPropagation(),N(M.hostId)},"aria-label":`Unpair ${he}`,children:w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:w.jsx("path",{d:"M4 5.5V11C4 11.2761 4.22386 11.5 4.5 11.5H9.5C9.77614 11.5 10 11.2761 10 11V5.5M3 4H11M5.5 4V3C5.5 2.72386 5.72386 2.5 6 2.5H8C8.27614 2.5 8.5 2.72386 8.5 3V4M6.5 6.5V9.5M7.5 6.5V9.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})},M.hostId)})})})]}),!cb&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-divider"}),w.jsx("div",{className:"drawer-section",children:w.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{y("/pair"),g||K()},children:"Pair New Host"})})]}),fb&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-divider"}),w.jsx("div",{className:"drawer-section",children:w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Location Access"}),w.jsx("button",{className:`toggle-switch ${J?"toggle-switch-on":""}`,onClick:Y,disabled:R,role:"switch","aria-checked":J,children:w.jsx("span",{className:"toggle-switch-thumb"})})]})})]}),w.jsxs("div",{className:"drawer-footer",children:[e&&w.jsxs("div",{className:"drawer-version",children:["Palmier v",e]}),w.jsxs("div",{className:"drawer-legal",children:[w.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),w.jsx("span",{className:"drawer-legal-sep",children:"·"}),w.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),_e=se&&du.createPortal(w.jsx("div",{className:"confirm-modal-overlay",onClick:()=>N(null),children:w.jsxs("div",{className:"confirm-modal",onClick:M=>M.stopPropagation(),children:[w.jsx("h2",{className:"confirm-modal-title",children:"Delete host?"}),w.jsxs("p",{className:"confirm-modal-message",children:['"',((O=u.find(M=>M.hostId===se))==null?void 0:O.name)||se.slice(0,8),'" will be unpaired from this device.']}),w.jsxs("div",{className:"confirm-modal-actions",children:[w.jsx("button",{className:"btn btn-secondary",onClick:()=>N(null),children:"Cancel"}),w.jsx("button",{className:"btn btn-danger",onClick:()=>{m(se),N(null)},children:"Delete"})]})]})}),document.body);return g?w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:T,children:ge}),_e]}):w.jsxs(w.Fragment,{children:[w.jsx("button",{className:"hamburger-btn",onClick:ue,"aria-label":"Open menu",children:w.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:w.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),b&&du.createPortal(w.jsx("div",{className:`drawer-overlay ${k?"drawer-overlay-closing":""}`,onClick:K,onAnimationEnd:ye,children:w.jsx("div",{className:`drawer-panel ${k?"drawer-panel-closing":""}`,ref:T,onClick:M=>M.stopPropagation(),children:ge})}),document.body),_e]})}const fN=10;function hN({connected:e,hostId:n,request:r,subscribeEvents:a,filterTaskId:l,onClearFilter:u}){const[c,f]=U.useState([]),[m,d]=U.useState(0),[y,g]=U.useState(!1),[b,x]=U.useState(!1),k=ta(),L=U.useRef(null),B=U.useCallback(N=>{const R={offset:N,limit:fN};return l&&(R.task_id=l),R},[l]),D=U.useCallback(async(N,R)=>{if(e){R?x(!0):g(!0);try{const G=await r("taskrun.list",B(N)),J=G.entries??[];d(G.total??0),f(R?Y=>{const T=new Set(Y.map(K=>`${K.task_id}:${K.run_id}`)),X=J.filter(K=>!T.has(`${K.task_id}:${K.run_id}`));return[...Y,...X]}:J)}catch(G){G instanceof Error&&G.message==="Not connected"||console.error("Failed to load runs:",G)}finally{g(!1),x(!1)}}},[e,r,B]);U.useEffect(()=>{e?(f([]),d(0),D(0,!1)):(f([]),d(0))},[e,n,D,l]),U.useEffect(()=>!e||!n?void 0:a(n,async R=>{try{const G=JSON.parse(new TextDecoder().decode(R.data));if(G.event_type==="running-state"&&G.running_state&&["monitoring","started","finished","failed","aborted"].includes(G.running_state)){const J=await r("taskrun.list",B(0)),Y=J.entries??[];d(J.total??0),f(T=>{const X=new Map(Y.map(q=>[`${q.task_id}:${q.run_id}`,q])),K=T.map(q=>{const I=`${q.task_id}:${q.run_id}`;return X.get(I)??q}),ye=new Set(K.map(q=>`${q.task_id}:${q.run_id}`));return[...Y.filter(q=>!ye.has(`${q.task_id}:${q.run_id}`)),...K]})}}catch{}}),[e,n,a,r]),U.useEffect(()=>{const N=L.current;if(!N)return;const R=new IntersectionObserver(G=>{G[0].isIntersecting&&!b&&c.length<m&&D(c.length,!0)},{threshold:.1});return R.observe(N),()=>R.disconnect()},[c.length,m,b,D]);function $(N,R){if(!N||!R)return"";const G=Math.round((R-N)/1e3);if(G<60)return`${G}s`;const J=Math.floor(G/60),Y=G%60;return`${J}m ${Y}s`}const V={monitoring:"Monitoring",started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function se(N){if(N==="failed")return"var(--color-error)";if(N==="aborted")return"var(--color-warning, #d97706)"}return y&&c.length===0&&e?w.jsx("div",{className:"task-list",children:[0,1,2].map(N=>w.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[w.jsx("div",{className:"task-card-header",children:w.jsx("div",{className:"task-card-title-row",children:w.jsx("div",{className:"skeleton-line",style:{width:`${70+N*10}%`}})})}),w.jsx("div",{className:"task-card-meta",children:w.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},N))}):!e||y&&c.length===0?w.jsx("div",{className:"runs-view",children:w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{className:"empty-state-text",children:"Runs"}),w.jsx("p",{className:"empty-state-hint",children:"Run history will appear here"})]})}):c.length===0?w.jsxs(w.Fragment,{children:[l&&u&&w.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:w.jsxs("span",{className:"runs-filter-chip",children:["Filtered by task",w.jsx("button",{onClick:u,"aria-label":"Clear filter",children:"×"})]})}),w.jsx("div",{className:"runs-view",children:w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{className:"empty-state-text",children:"No runs yet"}),w.jsx("p",{className:"empty-state-hint",children:l?"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger.":"Run history will appear here."})]})})]}):w.jsxs(w.Fragment,{children:[l&&u&&w.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:w.jsxs("span",{className:"runs-filter-chip",children:["Filtered by task",w.jsx("button",{onClick:u,"aria-label":"Clear filter",children:"×"})]})}),w.jsxs("div",{className:"task-list",children:[c.map((N,R)=>w.jsxs("div",{className:"runs-card",onClick:()=>!N.error&&k(`/runs/${N.task_id}/${encodeURIComponent(N.run_id)}`),children:[w.jsxs("div",{className:"runs-card-body",children:[w.jsx("h3",{className:"runs-card-name",children:N.task_name||N.task_id}),w.jsxs("div",{className:"runs-card-meta",children:[w.jsx("span",{style:{color:se(N.running_state)},children:V[N.running_state??""]??N.running_state}),N.end_time&&w.jsx("span",{children:_u(N.end_time)}),N.start_time&&N.end_time&&w.jsx("span",{style:{color:"var(--color-muted)"},children:$(N.start_time,N.end_time)}),N.error&&w.jsx("span",{style:{color:"var(--color-muted)"},children:N.error})]})]}),w.jsx("span",{className:"runs-card-chevron",children:"›"})]},`${N.task_id}-${N.run_id}-${R}`)),w.jsx("div",{ref:L,style:{height:1}}),b&&w.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:w.jsx("div",{className:"spinner"})})]})]})}function dN(e){P1(e,[/\r?\n|\r/g,mN])}function mN(){return{type:"break"}}function db(){return function(e){dN(e)}}function pN({connected:e,hostId:n,request:r,subscribeEvents:a,taskId:l,runId:u}){const c=ta(),[f,m]=U.useState(!0),[d,y]=U.useState([]),[g,b]=U.useState(),[x,k]=U.useState(),L=g==="started"||g==="monitoring",B=g==="followup",D=g==="started"||g==="followup",[$,V]=U.useState(null),[se,N]=U.useState(!1),[R,G]=U.useState(""),[J,Y]=U.useState(!1),T=U.useRef(null);async function X(){try{const q=await r("task.result",{id:l,run_id:u});if(q.error){console.error("No result:",q.error),c("/runs",{replace:!0});return}y(q.messages??[]),b(q.running_state),k(q.agent)}catch(q){console.error("Failed to load result:",q),c("/runs",{replace:!0})}finally{m(!1)}}async function K(q){var I;try{const ge=(I=(await r("task.reports",{id:l,run_id:u,report_files:[q]})).reports)==null?void 0:I[0];ge!=null&&ge.data_url?V({file:q,data_url:ge.data_url}):V({file:q,content:(ge==null?void 0:ge.content)??"Report not found."})}catch{V({file:q,content:"Failed to load report."})}}U.useEffect(()=>{e&&(m(!0),X())},[e,l,u]),U.useEffect(()=>!e||!n?void 0:a(n,async I=>{try{const ae=JSON.parse(new TextDecoder().decode(I.data));if(ae.event_type!=="running-state"&&ae.event_type!=="result-updated"||I.subject.split(".").pop()!==l||ae.event_type==="result-updated"&&ae.run_id&&ae.run_id!==u)return;X()}catch{}}),[e,n,l,a,r]),U.useEffect(()=>{T.current&&(T.current.scrollTop=T.current.scrollHeight)},[d]);function ye(q){if(q==="input")return"User Input";if(q==="permission")return"Permission";if(q==="confirmation")return"Confirmation"}function ue(q){return q==="started"?"Task started":q==="finished"?"Task finished":q==="failed"?"Task failed":q==="error"?"Command failed":q==="aborted"?"Task aborted":q==="confirmation"?"Task confirmed":q==="stopped"?"Follow-up stopped":q??""}return w.jsxs("div",{className:"run-detail",children:[w.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),f?w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[w.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"chat-thread",ref:T,children:[d.map((q,I)=>{const ae=D&&q.role==="assistant"&&!d.slice(I+1).some(ge=>ge.role==="assistant"||ge.role==="user");return q.role==="status"&&q.type==="monitoring"?null:q.role==="status"?w.jsxs("div",{className:`chat-status${q.type==="error"?" chat-status--error":""}`,children:[w.jsxs("div",{children:[ue(q.type),q.time>0&&w.jsx("span",{className:"chat-status-time",children:_u(q.time)})]}),q.content&&w.jsx("pre",{className:"chat-status-detail",children:q.content})]},I):w.jsxs("div",{className:`chat-message chat-message--${q.role}`,children:[q.role==="assistant"&&x&&w.jsx("div",{className:"chat-message-agent",children:Yh(x)}),w.jsxs("div",{className:"chat-message-content",children:[w.jsx(rd,{remarkPlugins:[ad,db],children:q.content}),ae&&w.jsxs("div",{className:"chat-typing-indicator",children:[w.jsx("span",{}),w.jsx("span",{}),w.jsx("span",{})]})]}),q.attachments&&q.attachments.length>0&&w.jsx("div",{className:"chat-message-attachments",children:q.attachments.map(ge=>w.jsx("button",{className:"chat-attachment-chip",onClick:()=>K(ge),children:ge},ge))}),w.jsxs("div",{className:"chat-message-meta",children:[ye(q.type)&&w.jsx("span",{className:"chat-message-type",children:ye(q.type)}),q.time>0&&w.jsx("span",{children:_u(q.time)})]})]},I)}),D&&(()=>{const q=d.filter(I=>I.role!=="status");return q.length===0||q[q.length-1].role!=="assistant"})()&&w.jsxs("div",{className:"chat-message chat-message--assistant",children:[x&&w.jsx("div",{className:"chat-message-agent",children:Yh(x)}),w.jsxs("div",{className:"chat-typing-indicator",children:[w.jsx("span",{}),w.jsx("span",{}),w.jsx("span",{})]})]}),g==="monitoring"&&w.jsxs("div",{className:"chat-monitoring-indicator",children:[w.jsx("span",{className:"chat-monitoring-dot"}),"Monitoring command output"]})]}),L?w.jsx("div",{className:"chat-abort-bar",children:w.jsx("button",{className:"btn btn-secondary chat-abort-btn",disabled:se,onClick:async()=>{if(confirm("Abort this task?")){N(!0);try{await r("task.abort",{id:l})}catch(q){console.error("Abort failed:",q)}finally{N(!1)}}},children:se?"Aborting...":"Abort Task"})}):B?w.jsx("div",{className:"chat-input-bar",children:w.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:se,onClick:async()=>{N(!0);try{await r("task.stop_followup",{id:l,run_id:u})}catch(q){console.error("Stop failed:",q)}finally{N(!1)}},children:w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:w.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):w.jsxs("form",{className:"chat-input-bar",onSubmit:async q=>{q.preventDefault();const I=R.trim();if(!(!I||J)){Y(!0);try{await r("task.followup",{id:l,run_id:u,message:I}),G("")}catch(ae){console.error("Follow-up failed:",ae)}finally{Y(!1)}}},children:[w.jsx("input",{className:"chat-input",type:"text",placeholder:"Follow-up message",value:R,onChange:q=>G(q.target.value),disabled:J}),w.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!R.trim()||J,children:w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),w.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),$&&w.jsx("div",{className:"report-dialog-overlay",onClick:()=>V(null),children:w.jsxs("div",{className:"report-dialog",onClick:q=>q.stopPropagation(),children:[w.jsxs("div",{className:"report-dialog-header",children:[w.jsx("span",{className:"report-dialog-title",children:$.file}),w.jsx("button",{className:"report-dialog-close",onClick:()=>V(null),"aria-label":"Close",children:w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),w.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),w.jsx("div",{className:"report-dialog-body",children:$.data_url?w.jsx("img",{src:$.data_url,alt:$.file,style:{maxWidth:"100%",height:"auto"}}):w.jsx(rd,{remarkPlugins:[ad,db],components:{a:({...q})=>w.jsx("a",{...q,target:"_blank",rel:"noopener noreferrer"})},children:$.content??""})})]})})]})}function gN(){const{getActiveHost:e}=Ol(),n=e(),r=U.useRef(null);U.useEffect(()=>{if(ji.isNativePlatform()||!n||n.directUrl||r.current===n.hostId)return;async function a(){var l;try{if(!("serviceWorker"in navigator)||!("PushManager"in window)){console.warn("[Push] Push notifications not supported");return}const u=await navigator.serviceWorker.ready;(l=u.active)==null||l.postMessage({type:"set-host-id",hostId:n.hostId});let c=await u.pushManager.getSubscription();if(!c){const{publicKey:m}=await S2("/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 w2("/api/push/subscribe",{hostId:n.hostId,endpoint:f.endpoint,keys:{p256dh:f.keys.p256dh,auth:f.keys.auth}}),r.current=n.hostId}catch(u){console.error("[Push] Subscription failed:",u)}}a()},[n])}function su(){var ge;const{pairedHosts:e,activeHostId:n,removePairedHost:r}=Ol(),{connected:a,request:l,subscribeEvents:u,unauthorized:c}=_d(),f=ta(),m=br(),d=hS(),y=fv("(min-width: 768px)"),g=m.pathname.startsWith("/runs"),b=d.runId?void 0:d.taskId,[x,k]=U.useState(null),L=d.runId,B=L==="latest";U.useEffect(()=>{if(!B||!d.taskId||!a){k(null);return}l("taskrun.list",{task_id:d.taskId,limit:1}).then(_e=>{var M,W;const O=(W=(M=_e.entries)==null?void 0:M[0])==null?void 0:W.run_id;k(O??null)}).catch(()=>k(null))},[B,d.taskId,a]);const D=B?x:L,$=!!(d.taskId&&D&&D!=="latest"),[V,se]=U.useState(!1),[N,R]=U.useState(!1),[G,J]=U.useState(null),[Y,T]=U.useState(null),[X,K]=U.useState(null);gN(),U.useEffect(()=>{window.scrollTo(0,0)},[n]);function ye(_e,O){f(O?`/runs/${encodeURIComponent(_e)}/${encodeURIComponent(O)}`:`/runs/${encodeURIComponent(_e)}`)}async function ue(){R(!0),J(null);try{const _e=await l("host.update");if(_e.error){J(_e.error),R(!1);return}}catch{}setTimeout(()=>window.location.reload(),1e4)}const q=e.length>0,I=q&&a&&n&&!c,ae=((ge=e.find(_e=>_e.hostId===n))==null?void 0:ge.clientToken)??null;return w.jsxs("div",{className:"dashboard",children:[y&&w.jsx(hb,{daemonVersion:Y,locationClientToken:X,activeClientToken:ae,request:l,onLocationClientTokenChange:K}),w.jsxs("div",{className:"dashboard-content",children:[w.jsxs("div",{className:"tab-bar",children:[!y&&w.jsx(hb,{daemonVersion:Y,locationClientToken:X,activeClientToken:ae,request:l,onLocationClientTokenChange:K}),w.jsx(lN,{})]}),w.jsx("main",{className:"dashboard-main",children:c?w.jsxs("div",{className:"revoked-state",children:[w.jsx("div",{className:"revoked-icon",children:w.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),w.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),w.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),w.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),w.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),w.jsx("div",{className:"revoked-command",children:w.jsx("code",{children:"palmier pair"})}),w.jsxs("div",{className:"revoked-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Re-pair Device"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>{n&&r(n)},children:"Remove Host"})]})]}):I?w.jsxs(w.Fragment,{children:[w.jsx("div",{style:{display:g?"none":"contents"},children:w.jsx(sN,{connected:a,hostId:n,request:l,subscribeEvents:u,onViewRun:ye,onUpdateRequired:se,onVersion:T,onLocationClientToken:K})}),$?w.jsx(pN,{connected:a,hostId:n,request:l,subscribeEvents:u,taskId:d.taskId,runId:decodeURIComponent(D)}):g?w.jsx(hN,{connected:a,hostId:n,request:l,subscribeEvents:u,filterTaskId:b,onClearFilter:()=>f("/runs")}):null]}):w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{children:q?"Connecting to host...":"No hosts paired yet."}),!q&&w.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Pair Host"})]})}),V&&!N&&!G&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Update Required"}),w.jsxs("p",{className:"confirm-modal-message",children:["Your Palmier host",Y?` (v${Y})`:""," is too old for this version of the app. Please update to continue."]}),w.jsx("div",{className:"confirm-modal-actions",children:w.jsx("button",{className:"btn btn-primary",onClick:ue,children:"Update Now"})})]})}),N&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),w.jsx("p",{className:"confirm-modal-message",children:"Installing update and restarting daemon. Please wait..."})]})}),G&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),w.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:G}),w.jsx("div",{className:"confirm-modal-actions",children:w.jsx("button",{className:"btn btn-secondary",onClick:()=>{J(null)},children:"Retry"})})]})})]})]})}const cl=!!window.__PALMIER_SERVE__;function yN(){const[e,n]=U.useState(""),[r,a]=U.useState(!1),[l,u]=U.useState(null),{addPairedHost:c}=Ol(),f=ta();async function m(){const d=e.trim().toUpperCase();if(!d){u("Enter a pairing code.");return}a(!0),u(null);try{let y;if(cl){const b=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,label:navigator.userAgent})});if(!b.ok){const x=await b.json().catch(()=>({error:"Connection failed"}));throw new Error(x.error||`HTTP ${b.status}`)}y=await b.json()}else{const b=await fetch(`${Sd}/api/config`);if(!b.ok)throw new Error("Failed to fetch server config");const x=await b.json();if(!x.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const k=await e1({servers:x.natsWsUrl,token:x.natsToken}),L=yu(),B=`pair.${d}`,D=await k.request(B,L.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});y=JSON.parse(L.decode(D.data)),await k.close()}const g={hostId:y.hostId,clientToken:y.clientToken,directUrl:cl?window.location.origin:void 0};c(g),ji.isNativePlatform()&&await cv.set({key:"hostId",value:y.hostId}),f("/")}catch(y){const g=y instanceof Error?y.message:String(y);g.includes("timeout")||g.includes("TIMEOUT")||g.includes("503")||g.toLowerCase().includes("no responders")?u("Code not found or expired. Check the code and try again."):u(g)}finally{a(!1)}}return w.jsx("div",{className:"pair-page",children:w.jsxs("div",{className:"pair-card",children:[w.jsxs("div",{className:"pair-header",children:[w.jsx("h1",{className:"pair-title",children:cl?"Pair":"Pair with Host"}),w.jsx("p",{className:"pair-subtitle",children:cl?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!cl&&w.jsxs("div",{className:"pair-instructions",children:[w.jsxs("div",{className:"pair-instruction-block",children:[w.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),w.jsxs("ol",{className:"pair-steps",children:[w.jsxs("li",{children:["Install at least one agent CLI (e.g., ",w.jsx("a",{href:"https://www.palmier.me/agents",target:"_blank",rel:"noopener noreferrer",children:"Claude Code, Gemini CLI, Codex CLI"}),")"]}),w.jsxs("li",{children:["Install Palmier on your host machine:",w.jsx("code",{className:"pair-command",children:"npm install -g palmier"})]}),w.jsxs("li",{children:["Run the setup wizard:",w.jsx("code",{className:"pair-command",children:"palmier init"})]}),w.jsx("li",{children:"A pairing code will display automatically"})]})]}),w.jsx("div",{className:"pair-instruction-divider"}),w.jsxs("div",{className:"pair-instruction-block",children:[w.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),w.jsxs("ol",{className:"pair-steps",children:[w.jsxs("li",{children:["Run ",w.jsx("code",{children:"palmier pair"})," on the host machine"]}),w.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),w.jsxs("div",{className:"pair-form",children:[w.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",w.jsx("input",{id:"pair-code",type:"text",maxLength:6,value:e,onChange:d=>n(d.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:r})]}),l&&w.jsx("p",{className:"pair-error",children:l}),w.jsxs("button",{className:"btn btn-primary btn-full",onClick:m,disabled:r||!e.trim(),children:[r&&w.jsx("span",{className:"btn-spinner"}),r?"Pairing...":"Pair"]}),w.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>f("/"),disabled:r,children:"Cancel"}),w.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",w.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",w.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function bN(){return w.jsx(f_,{children:w.jsx(E2,{children:w.jsxs(CS,{children:[w.jsx(Fa,{path:"/",element:w.jsx(su,{})}),w.jsx(Fa,{path:"/runs",element:w.jsx(su,{})}),w.jsx(Fa,{path:"/runs/:taskId",element:w.jsx(su,{})}),w.jsx(Fa,{path:"/runs/:taskId/:runId",element:w.jsx(su,{})}),w.jsx(Fa,{path:"/pair",element:w.jsx(yN,{})})]})})})}jw.createRoot(document.getElementById("root")).render(w.jsx(U.StrictMode,{children:w.jsx(KS,{children:w.jsx(bN,{})})}));export{wd as W};
116
+ `,...u.current()});return/^[\t ]/.test(d)&&(d=Al(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,r.options.closeAtx&&(d+=" "+c),m(),f(),d}J1.peek=nj;function J1(e){return e.value||""}function nj(){return"<"}X1.peek=rj;function X1(e,n,r,a){const l=Ud(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("image");let f=r.enter("label");const m=r.createTracker(a);let d=m.move("![");return d+=m.move(r.safe(e.alt,{before:d,after:"]",...m.current()})),d+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),d+=m.move(")"),c(),d}function rj(){return"!"}Q1.peek=ij;function Q1(e,n,r,a){const l=e.referenceType,u=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(a);let m=f.move("![");const d=r.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function ij(){return"!"}K1.peek=aj;function K1(e,n,r){let a=e.value||"",l="`",u=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(a);)l+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++u<r.unsafe.length;){const c=r.unsafe[u],f=r.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(a);){let d=m.index;a.charCodeAt(d)===10&&a.charCodeAt(d-1)===13&&d--,a=a.slice(0,d)+" "+a.slice(m.index+1)}}return l+a+l}function aj(){return"`"}function Z1(e,n){const r=Td(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}W1.peek=sj;function W1(e,n,r,a){const l=Ud(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(a);let f,m;if(Z1(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 sj(e,n,r){return Z1(e,r)?"<":"["}ev.peek=lj;function ev(e,n,r,a){const l=e.referenceType,u=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(a);let m=f.move("[");const d=r.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function lj(){return"["}function Bd(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 oj(e){const n=Bd(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 uj(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 tv(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 cj(e,n,r,a){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?uj(r):Bd(r);const f=e.ordered?c==="."?")":".":oj(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),tv(r)===c&&y){let g=-1;for(;++g<e.children.length;){const b=e.children[g];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),r.bulletCurrent=c;const d=r.containerFlow(e,a);return r.bulletLastUsed=c,r.bulletCurrent=u,l(),d}function fj(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 hj(e,n,r,a){const l=fj(r);let u=r.bulletCurrent||Bd(r);n&&n.type==="list"&&n.ordered&&(u=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+u);let c=u.length+1;(l==="tab"||l==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=r.createTracker(a);f.move(u+" ".repeat(c-u.length)),f.shift(c);const m=r.enter("listItem"),d=r.indentLines(r.containerFlow(e,f.current()),y);return m(),d;function y(g,b,x){return b?(x?"":" ".repeat(c))+g:(x?u:u+" ".repeat(c-u.length))+g}}function dj(e,n,r,a){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,a);return u(),l(),c}const mj=Uu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function pj(e,n,r,a){return(e.children.some(function(c){return mj(c)})?r.containerPhrasing:r.containerFlow).call(r,e,a)}function gj(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}nv.peek=yj;function nv(e,n,r,a){const l=gj(r),u=r.enter("strong"),c=r.createTracker(a),f=c.move(l+l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Cu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=Al(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=Cu(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Al(g));const x=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+x}function yj(e,n,r){return r.options.strong||"*"}function bj(e,n,r,a){return r.safe(e.value,a)}function vj(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 xj(e,n,r){const a=(tv(r)+(r.options.ruleSpaces?" ":"")).repeat(vj(r));return r.options.ruleSpaces?a.slice(0,-1):a}const rv={blockquote:FO,break:ob,code:XO,definition:KO,emphasis:V1,hardBreak:ob,heading:tj,html:J1,image:X1,imageReference:Q1,inlineCode:K1,link:W1,linkReference:ev,list:cj,listItem:hj,paragraph:dj,root:pj,strong:nv,text:bj,thematicBreak:xj};function wj(){return{enter:{table:Sj,tableData:ub,tableHeader:ub,tableRow:Ej},exit:{codeText:kj,table:_j,tableData:Th,tableHeader:Th,tableRow:Th}}}function Sj(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 _j(e){this.exit(e),this.data.inTable=void 0}function Ej(e){this.enter({type:"tableRow",children:[]},e)}function Th(e){this.exit(e)}function ub(e){this.enter({type:"tableCell",children:[]},e)}function kj(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,Aj));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function Aj(e,n){return n==="|"?n:e}function Cj(e){const n=e||{},r=n.tableCellPadding,a=n.tablePipeAlign,l=n.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
117
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:m,tableRow:f}};function c(x,k,L,B){return d(y(x,L,B),x.align)}function f(x,k,L,B){const D=g(x,L,B),F=d([D]);return F.slice(0,F.indexOf(`
118
+ `))}function m(x,k,L,B){const D=L.enter("tableCell"),F=L.enter("phrasing"),G=L.containerPhrasing(x,{...B,before:u,after:u});return F(),D(),G}function d(x,k){return HO(x,{align:k,alignDelimiters:a,padding:r,stringLength:l})}function y(x,k,L){const B=x.children;let D=-1;const F=[],G=k.enter("table");for(;++D<B.length;)F[D]=g(B[D],k,L);return G(),F}function g(x,k,L){const B=x.children;let D=-1;const F=[],G=k.enter("tableRow");for(;++D<B.length;)F[D]=m(B[D],x,k,L);return G(),F}function b(x,k,L){let B=rv.inlineCode(x,k,L);return L.stack.includes("tableCell")&&(B=B.replace(/\|/g,"\\$&")),B}}function Tj(){return{exit:{taskListCheckValueChecked:cb,taskListCheckValueUnchecked:cb,paragraph:jj}}}function Oj(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Nj}}}function cb(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function jj(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const a=r.children[0];if(a&&a.type==="text"){const l=n.children;let u=-1,c;for(;++u<l.length;){const f=l[u];if(f.type==="paragraph"){c=f;break}}c===r&&(a.value=a.value.slice(1),a.value.length===0?r.children.shift():r.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,r.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function Nj(e,n,r,a){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(a);u&&f.move(c);let m=rv.listItem(e,n,r,{...a,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),m;function d(y){return y+c}}function Rj(){return[cO(),NO(),zO(),wj(),Tj()]}function Mj(e){return{extensions:[fO(),RO(e),LO(),Cj(e),Oj()]}}const Dj={tokenize:qj,partial:!0},iv={tokenize:Hj,partial:!0},av={tokenize:Ij,partial:!0},sv={tokenize:Fj,partial:!0},zj={tokenize:$j,partial:!0},lv={name:"wwwAutolink",tokenize:Bj,previous:uv},ov={name:"protocolAutolink",tokenize:Pj,previous:cv},Fr={name:"emailAutolink",tokenize:Uj,previous:fv},br={};function Lj(){return{text:br}}let Ki=48;for(;Ki<123;)br[Ki]=Fr,Ki++,Ki===58?Ki=65:Ki===91&&(Ki=97);br[43]=Fr;br[45]=Fr;br[46]=Fr;br[95]=Fr;br[72]=[Fr,ov];br[104]=[Fr,ov];br[87]=[Fr,lv];br[119]=[Fr,lv];function Uj(e,n,r){const a=this;let l,u;return c;function c(g){return!rd(g)||!fv.call(a,a.previous)||Pd(a.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return rd(g)?(e.consume(g),f):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(zj,y,d)(g):g===45||g===95||Wt(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&&ln(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):r(g)}}function Bj(e,n,r){const a=this;return l;function l(c){return c!==87&&c!==119||!uv.call(a,a.previous)||Pd(a.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Dj,e.attempt(iv,e.attempt(av,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(c)}}function Pj(e,n,r){const a=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&cv.call(a,a.previous)&&!Pd(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(ln(g)&&l.length<5)return l+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const b=l.toLowerCase();if(b==="http"||b==="https")return e.consume(g),m}return r(g)}function m(g){return g===47?(e.consume(g),u?d:(u=!0,m)):r(g)}function d(g){return g===null||Eu(g)||bt(g)||Wi(g)||Du(g)?r(g):e.attempt(iv,e.attempt(av,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function qj(e,n,r){let a=0;return l;function l(c){return(c===87||c===119)&&a<3?(a++,e.consume(c),l):c===46&&a===3?(e.consume(c),u):r(c)}function u(c){return c===null?r(c):n(c)}}function Hj(e,n,r){let a,l,u;return c;function c(d){return d===46||d===95?e.check(sv,m,f)(d):d===null||bt(d)||Wi(d)||d!==45&&Du(d)?m(d):(u=!0,e.consume(d),c)}function f(d){return d===95?a=!0:(l=a,a=void 0),e.consume(d),c}function m(d){return l||a||!u?r(d):n(d)}}function Ij(e,n){let r=0,a=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&a<r?u(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(sv,n,u)(c):c===null||bt(c)||Wi(c)?n(c):(e.consume(c),l)}function u(c){return c===41&&a++,e.consume(c),l}}function Fj(e,n,r){return a;function a(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),a):f===38?(e.consume(f),u):f===93?(e.consume(f),l):f===60||f===null||bt(f)||Wi(f)?n(f):r(f)}function l(f){return f===null||f===40||f===91||bt(f)||Wi(f)?n(f):a(f)}function u(f){return ln(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),a):ln(f)?(e.consume(f),c):r(f)}}function $j(e,n,r){return a;function a(u){return e.consume(u),l}function l(u){return Wt(u)?r(u):n(u)}}function uv(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||bt(e)}function cv(e){return!ln(e)}function fv(e){return!(e===47||rd(e))}function rd(e){return e===43||e===45||e===46||e===95||Wt(e)}function Pd(e){let n=e.length,r=!1;for(;n--;){const a=e[n][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){r=!0;break}if(a._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const Gj={tokenize:Wj,partial:!0};function Yj(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Qj,continuation:{tokenize:Kj},exit:Zj}},text:{91:{name:"gfmFootnoteCall",tokenize:Xj},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Vj,resolveTo:Jj}}}}function Vj(e,n,r){const a=this;let l=a.events.length;const u=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;l--;){const m=a.events[l][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return r(m);const d=ar(a.sliceSerialize({start:c.end,end:a.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function Jj(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[r+1],e[r+2],["enter",a,n],e[r+3],e[r+4],["enter",l,n],["exit",l,n],["enter",u,n],["enter",c,n],["exit",c,n],["exit",u,n],e[e.length-2],e[e.length-1],["exit",a,n]];return e.splice(r,e.length-r+1,...f),e}function Xj(e,n,r){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(g){if(u>999||g===93&&!c||g===null||g===91||bt(g))return r(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return l.includes(ar(a.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(g)}return bt(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 Qj(e,n,r){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):r(k)}function y(k){if(c>999||k===93&&!f||k===null||k===91||bt(k))return r(k);if(k===93){e.exit("chunkString");const L=e.exit("gfmFootnoteDefinitionLabelString");return u=ar(a.sliceSerialize(L)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return bt(k)||(f=!0),c++,e.consume(k),k===92?g:y}function g(k){return k===91||k===92||k===93?(e.consume(k),c++,y):y(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),l.includes(u)||l.push(u),tt(e,x,"gfmFootnoteDefinitionWhitespace")):r(k)}function x(k){return n(k)}}function Kj(e,n,r){return e.check(Dl,n,e.attempt(Gj,n,r))}function Zj(e){e.exit("gfmFootnoteDefinition")}function Wj(e,n,r){const a=this;return tt(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?n(u):r(u)}}function eN(e){let r=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:u,resolveAll:l};return r==null&&(r=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function l(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let d=m;for(;d--;)if(c[d][0]==="exit"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[d][1].end.offset-c[d][1].start.offset){c[m][1].type="strikethroughSequence",c[d][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[d][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[d][1].end),end:Object.assign({},c[m][1].start)},b=[["enter",y,f],["enter",c[d][1],f],["exit",c[d][1],f],["enter",g,f]],x=f.parser.constructs.insideSpan.null;x&&jn(b,b.length,0,zu(x,c.slice(d+1,m),f)),jn(b,b.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",y,f]]),jn(c,d-1,m-d+3,b),m=d+b.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,f,m){const d=this.previous,y=this.events;let g=0;return b;function b(k){return d===126&&y[y.length-1][1].type!=="characterEscape"?m(k):(c.enter("strikethroughSequenceTemporary"),x(k))}function x(k){const L=rs(d);if(k===126)return g>1?m(k):(c.consume(k),g++,x);if(g<2&&!r)return m(k);const B=c.exit("strikethroughSequenceTemporary"),D=rs(k);return B._open=!D||D===2&&!!L,B._close=!L||L===2&&!!D,f(k)}}}class tN{constructor(){this.map=[]}add(n,r,a){nN(this,n,r,a)}consume(n){if(this.map.sort(function(u,c){return u[0]-c[0]}),this.map.length===0)return;let r=this.map.length;const a=[];for(;r>0;)r-=1,a.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];a.push(n.slice()),n.length=0;let l=a.pop();for(;l;){for(const u of l)n.push(u);l=a.pop()}this.map.length=0}}function nN(e,n,r,a){let l=0;if(!(r===0&&a.length===0)){for(;l<e.map.length;){if(e.map[l][0]===n){e.map[l][1]+=r,e.map[l][2].push(...a);return}l+=1}e.map.push([n,r,a])}}function rN(e,n){let r=!1;const a=[];for(;n<e.length;){const l=e[n];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&a.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const u=a.length-1;a[u]=a[u]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return a}function iN(){return{flow:{null:{name:"table",tokenize:aN,resolveAll:sN}}}}function aN(e,n,r){const a=this;let l=0,u=0,c;return f;function f(j){let K=a.events.length-1;for(;K>-1;){const he=a.events[K][1].type;if(he==="lineEnding"||he==="linePrefix")K--;else break}const Q=K>-1?a.events[K][1].type:null,ye=Q==="tableHead"||Q==="tableRow"?O:m;return ye===O&&a.parser.lazy[a.now().line]?r(j):ye(j)}function m(j){return e.enter("tableHead"),e.enter("tableRow"),d(j)}function d(j){return j===124||(c=!0,u+=1),y(j)}function y(j){return j===null?r(j):Ue(j)?u>1?(u=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),x):r(j):Ke(j)?tt(e,y,"whitespace")(j):(u+=1,c&&(c=!1,l+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(j)))}function g(j){return j===null||j===124||bt(j)?(e.exit("data"),y(j)):(e.consume(j),j===92?b:g)}function b(j){return j===92||j===124?(e.consume(j),g):g(j)}function x(j){return a.interrupt=!1,a.parser.lazy[a.now().line]?r(j):(e.enter("tableDelimiterRow"),c=!1,Ke(j)?tt(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):k(j))}function k(j){return j===45||j===58?B(j):j===124?(c=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),L):R(j)}function L(j){return Ke(j)?tt(e,B,"whitespace")(j):B(j)}function B(j){return j===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),D):j===45?(u+=1,D(j)):j===null||Ue(j)?se(j):R(j)}function D(j){return j===45?(e.enter("tableDelimiterFiller"),F(j)):R(j)}function F(j){return j===45?(e.consume(j),F):j===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),G):(e.exit("tableDelimiterFiller"),G(j))}function G(j){return Ke(j)?tt(e,se,"whitespace")(j):se(j)}function se(j){return j===124?k(j):j===null||Ue(j)?!c||l!==u?R(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(j)):R(j)}function R(j){return r(j)}function O(j){return e.enter("tableRow"),V(j)}function V(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),V):j===null||Ue(j)?(e.exit("tableRow"),n(j)):Ke(j)?tt(e,V,"whitespace")(j):(e.enter("data"),J(j))}function J(j){return j===null||j===124||bt(j)?(e.exit("data"),V(j)):(e.consume(j),j===92?Y:J)}function Y(j){return j===92||j===124?(e.consume(j),J):J(j)}}function sN(e,n){let r=-1,a=!0,l=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,d,y,g;const b=new tN;for(;++r<e.length;){const x=e[r],k=x[1];x[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(fb(b,n,m,d,y),y=void 0,m=0),d={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(r,0,[["enter",d,n]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(a=!0,g=void 0,u=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,y={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(r,0,[["enter",y,n]])),l=k.type==="tableDelimiterRow"?2:y?3:1):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=au(b,n,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):k.type==="tableCellDivider"&&(a?a=!1:(u[1]!==0&&(c[0]=c[1],g=au(b,n,u,l,void 0,g)),u=c,c=[u[1],r,0,0])):k.type==="tableHead"?(f=!0,m=r):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=r,u[1]!==0?(c[0]=c[1],g=au(b,n,u,l,r,g)):c[1]!==0&&(g=au(b,n,c,l,r,g)),l=0):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&fb(b,n,m,d,y),b.consume(n.events),r=-1;++r<n.events.length;){const x=n.events[r];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=rN(n.events,r))}return e}function au(e,n,r,a,l,u){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},Ga(n.events,r[0])),e.add(r[0],0,[["exit",u,n]]));const m=Ga(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=Ga(n.events,r[2]),y=Ga(n.events,r[3]),g={type:f,start:Object.assign({},d),end:Object.assign({},y)};if(e.add(r[2],0,[["enter",g,n]]),a!==2){const b=n.events[r[2]],x=n.events[r[3]];if(b[1].end=Object.assign({},x[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const k=r[2]+1,L=r[3]-r[2]-1;e.add(k,L,[])}}e.add(r[3]+1,0,[["exit",g,n]])}return l!==void 0&&(u.end=Object.assign({},Ga(n.events,l)),e.add(l,0,[["exit",u,n]]),u=void 0),u}function fb(e,n,r,a,l){const u=[],c=Ga(n.events,r);l&&(l.end=Object.assign({},c),u.push(["exit",l,n])),a.end=Object.assign({},c),u.push(["exit",a,n]),e.add(r+1,0,u)}function Ga(e,n){const r=e[n],a=r[0]==="enter"?"start":"end";return r[1][a]}const lN={name:"tasklistCheck",tokenize:uN};function oN(){return{text:{91:lN}}}function uN(e,n,r){const a=this;return l;function l(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return bt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):r(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(m)}function f(m){return Ue(m)?n(m):Ke(m)?e.check({tokenize:cN},n,r)(m):r(m)}}function cN(e,n,r){return tt(e,a,"whitespace");function a(l){return l===null?r(l):n(l)}}function fN(e){return w1([Lj(),Yj(),eN(e),iN(),oN()])}const hN={};function hb(e){const n=this,r=e||hN,a=n.data(),l=a.micromarkExtensions||(a.micromarkExtensions=[]),u=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);l.push(fN(r)),u.push(Rj()),c.push(Mj(r))}function dN(e){I1(e,[/\r?\n|\r/g,mN])}function mN(){return{type:"break"}}function db(){return function(e){dN(e)}}function pN({connected:e,hostId:n,request:r,subscribeEvents:a,taskId:l,runId:u}){const c=ea(),[f,m]=U.useState(!0),[d,y]=U.useState([]),[g,b]=U.useState(),[x,k]=U.useState(),L=g==="started"||g==="monitoring",B=g==="followup",D=g==="started"||g==="followup",[F,G]=U.useState(null),[se,R]=U.useState(!1),[O,V]=U.useState(""),[J,Y]=U.useState(!1),j=U.useRef(null);async function K(){try{const q=await r("task.result",{id:l,run_id:u});if(q.error){console.error("No result:",q.error),c("/runs",{replace:!0});return}y(q.messages??[]),b(q.running_state),k(q.agent)}catch(q){console.error("Failed to load result:",q),c("/runs",{replace:!0})}finally{m(!1)}}async function Q(q){var H;try{const ge=(H=(await r("task.reports",{id:l,run_id:u,report_files:[q]})).reports)==null?void 0:H[0];ge!=null&&ge.data_url?G({file:q,data_url:ge.data_url}):G({file:q,content:(ge==null?void 0:ge.content)??"Report not found."})}catch{G({file:q,content:"Failed to load report."})}}U.useEffect(()=>{e&&(m(!0),K())},[e,l,u]),U.useEffect(()=>!e||!n?void 0:a(n,async H=>{try{const ie=JSON.parse(new TextDecoder().decode(H.data));if(ie.event_type!=="running-state"&&ie.event_type!=="result-updated"||H.subject.split(".").pop()!==l||ie.event_type==="result-updated"&&ie.run_id&&ie.run_id!==u)return;K()}catch{}}),[e,n,l,a,r]),U.useEffect(()=>{j.current&&(j.current.scrollTop=j.current.scrollHeight)},[d]);function ye(q){if(q==="input")return"User Input";if(q==="permission")return"Permission";if(q==="confirmation")return"Confirmation"}function he(q){return q==="started"?"Task started":q==="finished"?"Task finished":q==="failed"?"Task failed":q==="error"?"Command failed":q==="aborted"?"Task aborted":q==="confirmation"?"Task confirmed":q==="stopped"?"Follow-up stopped":q??""}return w.jsxs("div",{className:"run-detail",children:[w.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),f?w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[w.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"chat-thread",ref:j,children:[d.map((q,H)=>{const ie=D&&q.role==="assistant"&&!d.slice(H+1).some(ge=>ge.role==="assistant"||ge.role==="user");return q.role==="status"&&q.type==="monitoring"?null:q.role==="status"?w.jsxs("div",{className:`chat-status${q.type==="error"?" chat-status--error":""}`,children:[w.jsxs("div",{children:[he(q.type),q.time>0&&w.jsx("span",{className:"chat-status-time",children:_u(q.time)})]}),q.content&&w.jsx("pre",{className:"chat-status-detail",children:q.content})]},H):w.jsxs("div",{className:`chat-message chat-message--${q.role}`,children:[q.role==="assistant"&&x&&w.jsx("div",{className:"chat-message-agent",children:Yh(x)}),w.jsxs("div",{className:"chat-message-content",children:[w.jsx(ib,{remarkPlugins:[hb,db],children:q.content}),ie&&w.jsxs("div",{className:"chat-typing-indicator",children:[w.jsx("span",{}),w.jsx("span",{}),w.jsx("span",{})]})]}),q.attachments&&q.attachments.length>0&&w.jsx("div",{className:"chat-message-attachments",children:q.attachments.map(ge=>w.jsx("button",{className:"chat-attachment-chip",onClick:()=>Q(ge),children:ge},ge))}),w.jsxs("div",{className:"chat-message-meta",children:[ye(q.type)&&w.jsx("span",{className:"chat-message-type",children:ye(q.type)}),q.time>0&&w.jsx("span",{children:_u(q.time)})]})]},H)}),D&&(()=>{const q=d.filter(H=>H.role!=="status");return q.length===0||q[q.length-1].role!=="assistant"})()&&w.jsxs("div",{className:"chat-message chat-message--assistant",children:[x&&w.jsx("div",{className:"chat-message-agent",children:Yh(x)}),w.jsxs("div",{className:"chat-typing-indicator",children:[w.jsx("span",{}),w.jsx("span",{}),w.jsx("span",{})]})]}),g==="monitoring"&&w.jsxs("div",{className:"chat-monitoring-indicator",children:[w.jsx("span",{className:"chat-monitoring-dot"}),"Monitoring command output"]})]}),L?w.jsx("div",{className:"chat-abort-bar",children:w.jsx("button",{className:"btn btn-secondary chat-abort-btn",disabled:se,onClick:async()=>{if(confirm("Abort this task?")){R(!0);try{await r("task.abort",{id:l})}catch(q){console.error("Abort failed:",q)}finally{R(!1)}}},children:se?"Aborting...":"Abort Task"})}):B?w.jsx("div",{className:"chat-input-bar",children:w.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:se,onClick:async()=>{R(!0);try{await r("task.stop_followup",{id:l,run_id:u})}catch(q){console.error("Stop failed:",q)}finally{R(!1)}},children:w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:w.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):w.jsxs("form",{className:"chat-input-bar",onSubmit:async q=>{q.preventDefault();const H=O.trim();if(!(!H||J)){Y(!0);try{await r("task.followup",{id:l,run_id:u,message:H}),V("")}catch(ie){console.error("Follow-up failed:",ie)}finally{Y(!1)}}},children:[w.jsx("input",{className:"chat-input",type:"text",placeholder:"Follow-up message",value:O,onChange:q=>V(q.target.value),disabled:J}),w.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!O.trim()||J,children:w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),w.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),F&&w.jsx("div",{className:"report-dialog-overlay",onClick:()=>G(null),children:w.jsxs("div",{className:"report-dialog",onClick:q=>q.stopPropagation(),children:[w.jsxs("div",{className:"report-dialog-header",children:[w.jsx("span",{className:"report-dialog-title",children:F.file}),w.jsx("button",{className:"report-dialog-close",onClick:()=>G(null),"aria-label":"Close",children:w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),w.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),w.jsx("div",{className:"report-dialog-body",children:F.data_url?w.jsx("img",{src:F.data_url,alt:F.file,style:{maxWidth:"100%",height:"auto"}}):w.jsx(ib,{remarkPlugins:[hb,db],components:{a:({...q})=>w.jsx("a",{...q,target:"_blank",rel:"noopener noreferrer"})},children:F.content??""})})]})})]})}function gN(){const{getActiveHost:e}=jl(),n=e(),r=U.useRef(null);U.useEffect(()=>{if(Ti.isNativePlatform()||!n||n.directUrl||r.current===n.hostId)return;async function a(){var l;try{if(!("serviceWorker"in navigator)||!("PushManager"in window)){console.warn("[Push] Push notifications not supported");return}const u=await navigator.serviceWorker.ready;(l=u.active)==null||l.postMessage({type:"set-host-id",hostId:n.hostId});let c=await u.pushManager.getSubscription();if(!c){const{publicKey:m}=await S2("/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 w2("/api/push/subscribe",{hostId:n.hostId,endpoint:f.endpoint,keys:{p256dh:f.keys.p256dh,auth:f.keys.auth}}),r.current=n.hostId}catch(u){console.error("[Push] Subscription failed:",u)}}a()},[n])}function su(){var ge;const{pairedHosts:e,activeHostId:n,removePairedHost:r}=jl(),{connected:a,request:l,subscribeEvents:u,unauthorized:c}=wd(),f=ea(),m=yr(),d=hS(),y=s1("(min-width: 768px)"),g=m.pathname.startsWith("/runs"),b=d.runId?void 0:d.taskId,[x,k]=U.useState(null),L=d.runId,B=L==="latest";U.useEffect(()=>{if(!B||!d.taskId||!a){k(null);return}l("taskrun.list",{task_id:d.taskId,limit:1}).then(Se=>{var M,W;const N=(W=(M=Se.entries)==null?void 0:M[0])==null?void 0:W.run_id;k(N??null)}).catch(()=>k(null))},[B,d.taskId,a]);const D=B?x:L,F=!!(d.taskId&&D&&D!=="latest"),[G,se]=U.useState(!1),[R,O]=U.useState(!1),[V,J]=U.useState(null),[Y,j]=U.useState(null),[K,Q]=U.useState(null);gN(),U.useEffect(()=>{window.scrollTo(0,0)},[n]);function ye(Se,N){f(N?`/runs/${encodeURIComponent(Se)}/${encodeURIComponent(N)}`:`/runs/${encodeURIComponent(Se)}`)}async function he(){O(!0),J(null);try{const Se=await l("host.update");if(Se.error){J(Se.error),O(!1);return}}catch{}setTimeout(()=>window.location.reload(),1e4)}const q=e.length>0,H=q&&a&&n&&!c,ie=((ge=e.find(Se=>Se.hostId===n))==null?void 0:ge.clientToken)??null;return w.jsxs("div",{className:"dashboard",children:[y&&w.jsx(w0,{daemonVersion:Y,locationClientToken:K,activeClientToken:ie,request:l,onLocationClientTokenChange:Q}),w.jsxs("div",{className:"dashboard-content",children:[w.jsxs("div",{className:"tab-bar",children:[!y&&w.jsx(w0,{daemonVersion:Y,locationClientToken:K,activeClientToken:ie,request:l,onLocationClientTokenChange:Q}),w.jsx(q2,{})]}),w.jsx("main",{className:"dashboard-main",children:c?w.jsxs("div",{className:"revoked-state",children:[w.jsx("div",{className:"revoked-icon",children:w.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),w.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),w.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),w.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),w.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),w.jsx("div",{className:"revoked-command",children:w.jsx("code",{children:"palmier pair"})}),w.jsxs("div",{className:"revoked-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Re-pair Device"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>{n&&r(n)},children:"Remove Host"})]})]}):H?w.jsxs(w.Fragment,{children:[w.jsx("div",{style:{display:g?"none":"contents"},children:w.jsx(P2,{connected:a,hostId:n,request:l,subscribeEvents:u,onViewRun:ye,onUpdateRequired:se,onVersion:j,onLocationClientToken:Q})}),F?w.jsx(pN,{connected:a,hostId:n,request:l,subscribeEvents:u,taskId:d.taskId,runId:decodeURIComponent(D)}):g?w.jsx(G2,{connected:a,hostId:n,request:l,subscribeEvents:u,filterTaskId:b,onClearFilter:()=>f("/runs")}):null]}):w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{children:q?"Connecting to host...":"No hosts paired yet."}),!q&&w.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Pair Host"})]})}),G&&!R&&!V&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Update Required"}),w.jsxs("p",{className:"confirm-modal-message",children:["Your Palmier host",Y?` (v${Y})`:""," is too old for this version of the app. Please update to continue."]}),w.jsx("div",{className:"confirm-modal-actions",children:w.jsx("button",{className:"btn btn-primary",onClick:he,children:"Update Now"})})]})}),R&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),w.jsx("p",{className:"confirm-modal-message",children:"Installing update and restarting daemon. Please wait..."})]})}),V&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),w.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:V}),w.jsx("div",{className:"confirm-modal-actions",children:w.jsx("button",{className:"btn btn-secondary",onClick:()=>{J(null)},children:"Retry"})})]})})]})]})}const cl=!!window.__PALMIER_SERVE__;function yN(){const[e,n]=U.useState(""),[r,a]=U.useState(!1),[l,u]=U.useState(null),{addPairedHost:c}=jl(),f=ea();async function m(){const d=e.trim().toUpperCase();if(!d){u("Enter a pairing code.");return}a(!0),u(null);try{let y;if(cl){const b=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,label:navigator.userAgent})});if(!b.ok){const x=await b.json().catch(()=>({error:"Connection failed"}));throw new Error(x.error||`HTTP ${b.status}`)}y=await b.json()}else{const b=await fetch(`${xd}/api/config`);if(!b.ok)throw new Error("Failed to fetch server config");const x=await b.json();if(!x.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const k=await e1({servers:x.natsWsUrl,token:x.natsToken}),L=yu(),B=`pair.${d}`,D=await k.request(B,L.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});y=JSON.parse(L.decode(D.data)),await k.close()}const g={hostId:y.hostId,clientToken:y.clientToken,directUrl:cl?window.location.origin:void 0};c(g),Ti.isNativePlatform()&&await a1.set({key:"hostId",value:y.hostId}),f("/")}catch(y){const g=y instanceof Error?y.message:String(y);g.includes("timeout")||g.includes("TIMEOUT")||g.includes("503")||g.toLowerCase().includes("no responders")?u("Code not found or expired. Check the code and try again."):u(g)}finally{a(!1)}}return w.jsx("div",{className:"pair-page",children:w.jsxs("div",{className:"pair-card",children:[w.jsxs("div",{className:"pair-header",children:[w.jsx("h1",{className:"pair-title",children:cl?"Pair":"Pair with Host"}),w.jsx("p",{className:"pair-subtitle",children:cl?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!cl&&w.jsxs("div",{className:"pair-instructions",children:[w.jsxs("div",{className:"pair-instruction-block",children:[w.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),w.jsxs("ol",{className:"pair-steps",children:[w.jsxs("li",{children:["Install at least one agent CLI (e.g., ",w.jsx("a",{href:"https://www.palmier.me/agents",target:"_blank",rel:"noopener noreferrer",children:"Claude Code, Gemini CLI, Codex CLI"}),")"]}),w.jsxs("li",{children:["Install Palmier on your host machine:",w.jsx("code",{className:"pair-command",children:"npm install -g palmier"})]}),w.jsxs("li",{children:["Run the setup wizard:",w.jsx("code",{className:"pair-command",children:"palmier init"})]}),w.jsx("li",{children:"A pairing code will display automatically"})]})]}),w.jsx("div",{className:"pair-instruction-divider"}),w.jsxs("div",{className:"pair-instruction-block",children:[w.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),w.jsxs("ol",{className:"pair-steps",children:[w.jsxs("li",{children:["Run ",w.jsx("code",{children:"palmier pair"})," on the host machine"]}),w.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),w.jsxs("div",{className:"pair-form",children:[w.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",w.jsx("input",{id:"pair-code",type:"text",maxLength:6,value:e,onChange:d=>n(d.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:r})]}),l&&w.jsx("p",{className:"pair-error",children:l}),w.jsxs("button",{className:"btn btn-primary btn-full",onClick:m,disabled:r||!e.trim(),children:[r&&w.jsx("span",{className:"btn-spinner"}),r?"Pairing...":"Pair"]}),w.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>f("/"),disabled:r,children:"Cancel"}),w.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",w.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",w.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function bN(){return w.jsx(f_,{children:w.jsx(E2,{children:w.jsxs(CS,{children:[w.jsx(Fa,{path:"/",element:w.jsx(su,{})}),w.jsx(Fa,{path:"/runs",element:w.jsx(su,{})}),w.jsx(Fa,{path:"/runs/:taskId",element:w.jsx(su,{})}),w.jsx(Fa,{path:"/runs/:taskId/:runId",element:w.jsx(su,{})}),w.jsx(Fa,{path:"/pair",element:w.jsx(yN,{})})]})})})}Ow.createRoot(document.getElementById("root")).render(w.jsx(U.StrictMode,{children:w.jsx(KS,{children:w.jsx(bN,{})})}));export{vd as W};