panopticon-cli 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agents-5OPQKM5K.js → agents-DMPT32H7.js} +7 -6
- package/dist/{chunk-OWHXCGVO.js → chunk-2V2DQ3IX.js} +378 -101
- package/dist/chunk-2V2DQ3IX.js.map +1 -0
- package/dist/{chunk-F5555J3A.js → chunk-4HST45MO.js} +13 -27
- package/dist/chunk-4HST45MO.js.map +1 -0
- package/dist/{chunk-YLPSQAM2.js → chunk-565HZ6VV.js} +2 -2
- package/dist/chunk-6N2KBSJA.js +452 -0
- package/dist/chunk-6N2KBSJA.js.map +1 -0
- package/dist/{chunk-VHKSS7QX.js → chunk-D67AQTHF.js} +21 -19
- package/dist/chunk-D67AQTHF.js.map +1 -0
- package/dist/{chunk-4YSYJ4HM.js → chunk-DFNVHK3N.js} +2 -2
- package/dist/{chunk-7SN4L4PH.js → chunk-HOGYHJ2G.js} +2 -2
- package/dist/{chunk-FTCPTHIJ.js → chunk-HRU7S4TA.js} +24 -7
- package/dist/chunk-HRU7S4TA.js.map +1 -0
- package/dist/{chunk-NLQRED36.js → chunk-KBHRXV5T.js} +3 -3
- package/dist/chunk-KBHRXV5T.js.map +1 -0
- package/dist/{chunk-CWELWPWQ.js → chunk-MOPGR3CL.js} +1 -1
- package/dist/chunk-MOPGR3CL.js.map +1 -0
- package/dist/{chunk-2V4NF7J2.js → chunk-RLZQB7HS.js} +2 -2
- package/dist/chunk-RLZQB7HS.js.map +1 -0
- package/dist/{chunk-76F6DSVS.js → chunk-T7BBPDEJ.js} +11 -7
- package/dist/chunk-T7BBPDEJ.js.map +1 -0
- package/dist/chunk-USYP2SBE.js +317 -0
- package/dist/chunk-USYP2SBE.js.map +1 -0
- package/dist/{chunk-JM6V62LT.js → chunk-ZDNQFWR5.js} +2 -2
- package/dist/{chunk-JM6V62LT.js.map → chunk-ZDNQFWR5.js.map} +1 -1
- package/dist/{chunk-HJSM6E6U.js → chunk-ZP6EWSZV.js} +29 -322
- package/dist/chunk-ZP6EWSZV.js.map +1 -0
- package/dist/{chunk-PELXV435.js → chunk-ZTYHZMEC.js} +2 -2
- package/dist/chunk-ZTYHZMEC.js.map +1 -0
- package/dist/cli/index.js +1381 -777
- package/dist/cli/index.js.map +1 -1
- package/dist/config-yaml-OVZLKFMA.js +18 -0
- package/dist/dashboard/prompts/merge-agent.md +7 -5
- package/dist/dashboard/prompts/review-agent.md +12 -1
- package/dist/dashboard/prompts/test-agent.md +3 -1
- package/dist/dashboard/public/assets/index-BJKEp64j.css +32 -0
- package/dist/dashboard/public/assets/index-CgJjqjAV.js +767 -0
- package/dist/dashboard/public/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dist/dashboard/public/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/dist/dashboard/public/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/dist/dashboard/public/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dist/dashboard/public/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/dashboard/public/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/dashboard/public/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/dashboard/public/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/dist/dashboard/public/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/dist/dashboard/public/assets/space-grotesk-latin-400-normal-BnQMeOim.woff +0 -0
- package/dist/dashboard/public/assets/space-grotesk-latin-400-normal-CJ-V5oYT.woff2 +0 -0
- package/dist/dashboard/public/assets/space-grotesk-latin-600-normal-BflQw4A9.woff +0 -0
- package/dist/dashboard/public/assets/space-grotesk-latin-600-normal-DjKNqYRj.woff2 +0 -0
- package/dist/dashboard/public/assets/space-grotesk-latin-700-normal-CwsQ-cCU.woff +0 -0
- package/dist/dashboard/public/assets/space-grotesk-latin-700-normal-RjhwGPKo.woff2 +0 -0
- package/dist/dashboard/public/assets/space-grotesk-latin-ext-400-normal-CfP_5XZW.woff2 +0 -0
- package/dist/dashboard/public/assets/space-grotesk-latin-ext-400-normal-DRPE3kg4.woff +0 -0
- package/dist/dashboard/public/assets/space-grotesk-latin-ext-600-normal-DxxdqCpr.woff2 +0 -0
- package/dist/dashboard/public/assets/space-grotesk-latin-ext-600-normal-VcznFIpX.woff +0 -0
- package/dist/dashboard/public/assets/space-grotesk-latin-ext-700-normal-BQnZhY3m.woff2 +0 -0
- package/dist/dashboard/public/assets/space-grotesk-latin-ext-700-normal-HVCqSBdx.woff +0 -0
- package/dist/dashboard/public/assets/space-grotesk-vietnamese-400-normal-B7xT_GF5.woff2 +0 -0
- package/dist/dashboard/public/assets/space-grotesk-vietnamese-400-normal-BIWiOVfw.woff +0 -0
- package/dist/dashboard/public/assets/space-grotesk-vietnamese-600-normal-D6zpsUhD.woff +0 -0
- package/dist/dashboard/public/assets/space-grotesk-vietnamese-600-normal-DUi7WF5p.woff2 +0 -0
- package/dist/dashboard/public/assets/space-grotesk-vietnamese-700-normal-DMty7AZE.woff2 +0 -0
- package/dist/dashboard/public/assets/space-grotesk-vietnamese-700-normal-Duxec5Rn.woff +0 -0
- package/dist/dashboard/public/index.html +5 -3
- package/dist/dashboard/server.js +4647 -2723
- package/dist/{feedback-writer-VRMMWWTW.js → feedback-writer-T43PI5S2.js} +2 -2
- package/dist/{hume-WMAUBBV2.js → hume-CKJJ3OUU.js} +3 -3
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/{projects-CFX3RTDL.js → projects-KVM3MN3Y.js} +2 -2
- package/dist/{remote-agents-TFSMW7GN.js → remote-agents-ULPD6C5U.js} +3 -3
- package/dist/{remote-workspace-7FPGF2RM.js → remote-workspace-XX6ARE6I.js} +3 -3
- package/dist/{review-status-TDPSOU5J.js → review-status-XKUKZF6J.js} +3 -2
- package/dist/{specialist-context-WGUUYDWY.js → specialist-context-53AWO6AE.js} +6 -5
- package/dist/{specialist-context-WGUUYDWY.js.map → specialist-context-53AWO6AE.js.map} +1 -1
- package/dist/{specialist-logs-XJB5TCKJ.js → specialist-logs-QREUJ4HN.js} +6 -5
- package/dist/{specialists-5LBRHYFA.js → specialists-2DBBXRCK.js} +6 -5
- package/dist/{traefik-WFMQX2LY.js → traefik-5GL3Q7DJ.js} +3 -3
- package/dist/{tunnel-W2GZBLEV.js → tunnel-BKC7KLBX.js} +3 -3
- package/dist/{workspace-manager-E434Z45T.js → workspace-manager-ALBR62AS.js} +5 -5
- package/dist/workspace-manager-ALBR62AS.js.map +1 -0
- package/package.json +1 -1
- package/scripts/record-cost-event.js +8424 -42
- package/scripts/work-agent-stop-hook +221 -24
- package/dist/chunk-2V4NF7J2.js.map +0 -1
- package/dist/chunk-76F6DSVS.js.map +0 -1
- package/dist/chunk-CWELWPWQ.js.map +0 -1
- package/dist/chunk-F5555J3A.js.map +0 -1
- package/dist/chunk-FTCPTHIJ.js.map +0 -1
- package/dist/chunk-HJSM6E6U.js.map +0 -1
- package/dist/chunk-NLQRED36.js.map +0 -1
- package/dist/chunk-OWHXCGVO.js.map +0 -1
- package/dist/chunk-PELXV435.js.map +0 -1
- package/dist/chunk-VHKSS7QX.js.map +0 -1
- package/dist/chunk-YGJ54GW2.js +0 -96
- package/dist/chunk-YGJ54GW2.js.map +0 -1
- package/dist/dashboard/public/assets/index-Ce6q21Fm.js +0 -743
- package/dist/dashboard/public/assets/index-NzpI0ItZ.css +0 -32
- package/dist/git-utils-I2UDKNZH.js +0 -131
- package/dist/git-utils-I2UDKNZH.js.map +0 -1
- /package/dist/{agents-5OPQKM5K.js.map → agents-DMPT32H7.js.map} +0 -0
- /package/dist/{chunk-YLPSQAM2.js.map → chunk-565HZ6VV.js.map} +0 -0
- /package/dist/{chunk-4YSYJ4HM.js.map → chunk-DFNVHK3N.js.map} +0 -0
- /package/dist/{chunk-7SN4L4PH.js.map → chunk-HOGYHJ2G.js.map} +0 -0
- /package/dist/{hume-WMAUBBV2.js.map → config-yaml-OVZLKFMA.js.map} +0 -0
- /package/dist/{feedback-writer-VRMMWWTW.js.map → feedback-writer-T43PI5S2.js.map} +0 -0
- /package/dist/{projects-CFX3RTDL.js.map → hume-CKJJ3OUU.js.map} +0 -0
- /package/dist/{remote-agents-TFSMW7GN.js.map → projects-KVM3MN3Y.js.map} +0 -0
- /package/dist/{review-status-TDPSOU5J.js.map → remote-agents-ULPD6C5U.js.map} +0 -0
- /package/dist/{remote-workspace-7FPGF2RM.js.map → remote-workspace-XX6ARE6I.js.map} +0 -0
- /package/dist/{specialist-logs-XJB5TCKJ.js.map → review-status-XKUKZF6J.js.map} +0 -0
- /package/dist/{specialists-5LBRHYFA.js.map → specialist-logs-QREUJ4HN.js.map} +0 -0
- /package/dist/{traefik-WFMQX2LY.js.map → specialists-2DBBXRCK.js.map} +0 -0
- /package/dist/{tunnel-W2GZBLEV.js.map → traefik-5GL3Q7DJ.js.map} +0 -0
- /package/dist/{workspace-manager-E434Z45T.js.map → tunnel-BKC7KLBX.js.map} +0 -0
|
@@ -1,743 +0,0 @@
|
|
|
1
|
-
var E4=Object.defineProperty;var wb=e=>{throw TypeError(e)};var P4=(e,t,n)=>t in e?E4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t,n)=>P4(e,typeof t!="symbol"?t+"":t,n),Mp=(e,t,n)=>t.has(e)||wb("Cannot "+n);var A=(e,t,n)=>(Mp(e,t,"read from private field"),n?n.call(e):t.get(e)),me=(e,t,n)=>t.has(e)?wb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),oe=(e,t,n,s)=>(Mp(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),Ne=(e,t,n)=>(Mp(e,t,"access private method"),n);var Qu=(e,t,n,s)=>({set _(r){oe(e,t,r,n)},get _(){return A(e,t,s)}});function T4(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in e)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();var Oh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ml(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function R4(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:function(){return e[s]}})}),n}var wC={exports:{}},Ff={},SC={exports:{}},Le={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Eu=Symbol.for("react.element"),D4=Symbol.for("react.portal"),M4=Symbol.for("react.fragment"),L4=Symbol.for("react.strict_mode"),A4=Symbol.for("react.profiler"),O4=Symbol.for("react.provider"),I4=Symbol.for("react.context"),F4=Symbol.for("react.forward_ref"),B4=Symbol.for("react.suspense"),z4=Symbol.for("react.memo"),$4=Symbol.for("react.lazy"),Sb=Symbol.iterator;function H4(e){return e===null||typeof e!="object"?null:(e=Sb&&e[Sb]||e["@@iterator"],typeof e=="function"?e:null)}var kC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},CC=Object.assign,NC={};function gl(e,t,n){this.props=e,this.context=t,this.refs=NC,this.updater=n||kC}gl.prototype.isReactComponent={};gl.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};gl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function jC(){}jC.prototype=gl.prototype;function ny(e,t,n){this.props=e,this.context=t,this.refs=NC,this.updater=n||kC}var sy=ny.prototype=new jC;sy.constructor=ny;CC(sy,gl.prototype);sy.isPureReactComponent=!0;var kb=Array.isArray,EC=Object.prototype.hasOwnProperty,ry={current:null},PC={key:!0,ref:!0,__self:!0,__source:!0};function TC(e,t,n){var s,r={},i=null,o=null;if(t!=null)for(s in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)EC.call(t,s)&&!PC.hasOwnProperty(s)&&(r[s]=t[s]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];r.children=c}if(e&&e.defaultProps)for(s in a=e.defaultProps,a)r[s]===void 0&&(r[s]=a[s]);return{$$typeof:Eu,type:e,key:i,ref:o,props:r,_owner:ry.current}}function W4(e,t){return{$$typeof:Eu,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function iy(e){return typeof e=="object"&&e!==null&&e.$$typeof===Eu}function U4(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Cb=/\/+/g;function Lp(e,t){return typeof e=="object"&&e!==null&&e.key!=null?U4(""+e.key):t.toString(36)}function rh(e,t,n,s,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Eu:case D4:o=!0}}if(o)return o=e,r=r(o),e=s===""?"."+Lp(o,0):s,kb(r)?(n="",e!=null&&(n=e.replace(Cb,"$&/")+"/"),rh(r,t,n,"",function(u){return u})):r!=null&&(iy(r)&&(r=W4(r,n+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(Cb,"$&/")+"/")+e)),t.push(r)),1;if(o=0,s=s===""?".":s+":",kb(e))for(var a=0;a<e.length;a++){i=e[a];var c=s+Lp(i,a);o+=rh(i,t,n,c,r)}else if(c=H4(e),typeof c=="function")for(e=c.call(e),a=0;!(i=e.next()).done;)i=i.value,c=s+Lp(i,a++),o+=rh(i,t,n,c,r);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Gu(e,t,n){if(e==null)return e;var s=[],r=0;return rh(e,s,"","",function(i){return t.call(n,i,r++)}),s}function q4(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var On={current:null},ih={transition:null},K4={ReactCurrentDispatcher:On,ReactCurrentBatchConfig:ih,ReactCurrentOwner:ry};function RC(){throw Error("act(...) is not supported in production builds of React.")}Le.Children={map:Gu,forEach:function(e,t,n){Gu(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Gu(e,function(){t++}),t},toArray:function(e){return Gu(e,function(t){return t})||[]},only:function(e){if(!iy(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Le.Component=gl;Le.Fragment=M4;Le.Profiler=A4;Le.PureComponent=ny;Le.StrictMode=L4;Le.Suspense=B4;Le.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=K4;Le.act=RC;Le.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=CC({},e.props),r=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=ry.current),t.key!==void 0&&(r=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(c in t)EC.call(t,c)&&!PC.hasOwnProperty(c)&&(s[c]=t[c]===void 0&&a!==void 0?a[c]:t[c])}var c=arguments.length-2;if(c===1)s.children=n;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];s.children=a}return{$$typeof:Eu,type:e.type,key:r,ref:i,props:s,_owner:o}};Le.createContext=function(e){return e={$$typeof:I4,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:O4,_context:e},e.Consumer=e};Le.createElement=TC;Le.createFactory=function(e){var t=TC.bind(null,e);return t.type=e,t};Le.createRef=function(){return{current:null}};Le.forwardRef=function(e){return{$$typeof:F4,render:e}};Le.isValidElement=iy;Le.lazy=function(e){return{$$typeof:$4,_payload:{_status:-1,_result:e},_init:q4}};Le.memo=function(e,t){return{$$typeof:z4,type:e,compare:t===void 0?null:t}};Le.startTransition=function(e){var t=ih.transition;ih.transition={};try{e()}finally{ih.transition=t}};Le.unstable_act=RC;Le.useCallback=function(e,t){return On.current.useCallback(e,t)};Le.useContext=function(e){return On.current.useContext(e)};Le.useDebugValue=function(){};Le.useDeferredValue=function(e){return On.current.useDeferredValue(e)};Le.useEffect=function(e,t){return On.current.useEffect(e,t)};Le.useId=function(){return On.current.useId()};Le.useImperativeHandle=function(e,t,n){return On.current.useImperativeHandle(e,t,n)};Le.useInsertionEffect=function(e,t){return On.current.useInsertionEffect(e,t)};Le.useLayoutEffect=function(e,t){return On.current.useLayoutEffect(e,t)};Le.useMemo=function(e,t){return On.current.useMemo(e,t)};Le.useReducer=function(e,t,n){return On.current.useReducer(e,t,n)};Le.useRef=function(e){return On.current.useRef(e)};Le.useState=function(e){return On.current.useState(e)};Le.useSyncExternalStore=function(e,t,n){return On.current.useSyncExternalStore(e,t,n)};Le.useTransition=function(){return On.current.useTransition()};Le.version="18.3.1";SC.exports=Le;var v=SC.exports;const J=ml(v),oy=T4({__proto__:null,default:J},[v]);/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var V4=v,Y4=Symbol.for("react.element"),X4=Symbol.for("react.fragment"),Q4=Object.prototype.hasOwnProperty,G4=V4.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,J4={key:!0,ref:!0,__self:!0,__source:!0};function DC(e,t,n){var s,r={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(s in t)Q4.call(t,s)&&!J4.hasOwnProperty(s)&&(r[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)r[s]===void 0&&(r[s]=t[s]);return{$$typeof:Y4,type:e,key:i,ref:o,props:r,_owner:G4.current}}Ff.Fragment=X4;Ff.jsx=DC;Ff.jsxs=DC;wC.exports=Ff;var l=wC.exports,vg={},MC={exports:{}},fs={},LC={exports:{}},AC={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(I,H){var k=I.length;I.push(H);e:for(;0<k;){var F=k-1>>>1,M=I[F];if(0<r(M,H))I[F]=H,I[k]=M,k=F;else break e}}function n(I){return I.length===0?null:I[0]}function s(I){if(I.length===0)return null;var H=I[0],k=I.pop();if(k!==H){I[0]=k;e:for(var F=0,M=I.length,N=M>>>1;F<N;){var z=2*(F+1)-1,U=I[z],K=z+1,Q=I[K];if(0>r(U,k))K<M&&0>r(Q,U)?(I[F]=Q,I[K]=k,F=K):(I[F]=U,I[z]=k,F=z);else if(K<M&&0>r(Q,k))I[F]=Q,I[K]=k,F=K;else break e}}return H}function r(I,H){var k=I.sortIndex-H.sortIndex;return k!==0?k:I.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var c=[],u=[],d=1,h=null,p=3,f=!1,m=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(I){for(var H=n(u);H!==null;){if(H.callback===null)s(u);else if(H.startTime<=I)s(u),H.sortIndex=H.expirationTime,t(c,H);else break;H=n(u)}}function S(I){if(g=!1,_(I),!m)if(n(c)!==null)m=!0,$(C);else{var H=n(u);H!==null&&W(S,H.startTime-I)}}function C(I,H){m=!1,g&&(g=!1,x(E),E=-1),f=!0;var k=p;try{for(_(H),h=n(c);h!==null&&(!(h.expirationTime>H)||I&&!B());){var F=h.callback;if(typeof F=="function"){h.callback=null,p=h.priorityLevel;var M=F(h.expirationTime<=H);H=e.unstable_now(),typeof M=="function"?h.callback=M:h===n(c)&&s(c),_(H)}else s(c);h=n(c)}if(h!==null)var N=!0;else{var z=n(u);z!==null&&W(S,z.startTime-H),N=!1}return N}finally{h=null,p=k,f=!1}}var w=!1,j=null,E=-1,O=5,R=-1;function B(){return!(e.unstable_now()-R<O)}function L(){if(j!==null){var I=e.unstable_now();R=I;var H=!0;try{H=j(!0,I)}finally{H?D():(w=!1,j=null)}}else w=!1}var D;if(typeof b=="function")D=function(){b(L)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,P=T.port2;T.port1.onmessage=L,D=function(){P.postMessage(null)}}else D=function(){y(L,0)};function $(I){j=I,w||(w=!0,D())}function W(I,H){E=y(function(){I(e.unstable_now())},H)}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_continueExecution=function(){m||f||(m=!0,$(C))},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"):O=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(I){switch(p){case 1:case 2:case 3:var H=3;break;default:H=p}var k=p;p=H;try{return I()}finally{p=k}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(I,H){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var k=p;p=I;try{return H()}finally{p=k}},e.unstable_scheduleCallback=function(I,H,k){var F=e.unstable_now();switch(typeof k=="object"&&k!==null?(k=k.delay,k=typeof k=="number"&&0<k?F+k:F):k=F,I){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=k+M,I={id:d++,callback:H,priorityLevel:I,startTime:k,expirationTime:M,sortIndex:-1},k>F?(I.sortIndex=k,t(u,I),n(c)===null&&I===n(u)&&(g?(x(E),E=-1):g=!0,W(S,k-F))):(I.sortIndex=M,t(c,I),m||f||(m=!0,$(C))),I},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(I){var H=p;return function(){var k=p;p=H;try{return I.apply(this,arguments)}finally{p=k}}}})(AC);LC.exports=AC;var Z4=LC.exports;/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var eT=v,ds=Z4;function te(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var OC=new Set,Hc={};function ea(e,t){el(e,t),el(e+"Capture",t)}function el(e,t){for(Hc[e]=t,e=0;e<t.length;e++)OC.add(t[e])}var Hr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yg=Object.prototype.hasOwnProperty,tT=/^[: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]*$/,Nb={},jb={};function nT(e){return yg.call(jb,e)?!0:yg.call(Nb,e)?!1:tT.test(e)?jb[e]=!0:(Nb[e]=!0,!1)}function sT(e,t,n,s){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function rT(e,t,n,s){if(t===null||typeof t>"u"||sT(e,t,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function In(e,t,n,s,r,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var fn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){fn[e]=new In(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];fn[t]=new In(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){fn[e]=new In(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){fn[e]=new In(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){fn[e]=new In(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){fn[e]=new In(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){fn[e]=new In(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){fn[e]=new In(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){fn[e]=new In(e,5,!1,e.toLowerCase(),null,!1,!1)});var ay=/[\-:]([a-z])/g;function ly(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ay,ly);fn[t]=new In(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ay,ly);fn[t]=new In(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ay,ly);fn[t]=new In(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){fn[e]=new In(e,1,!1,e.toLowerCase(),null,!1,!1)});fn.xlinkHref=new In("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){fn[e]=new In(e,1,!1,e.toLowerCase(),null,!0,!0)});function cy(e,t,n,s){var r=fn.hasOwnProperty(t)?fn[t]:null;(r!==null?r.type!==0:s||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(rT(t,n,r,s)&&(n=null),s||r===null?nT(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):r.mustUseProperty?e[r.propertyName]=n===null?r.type===3?!1:"":n:(t=r.attributeName,s=r.attributeNamespace,n===null?e.removeAttribute(t):(r=r.type,n=r===3||r===4&&n===!0?"":""+n,s?e.setAttributeNS(s,t,n):e.setAttribute(t,n))))}var Yr=eT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ju=Symbol.for("react.element"),ya=Symbol.for("react.portal"),ba=Symbol.for("react.fragment"),uy=Symbol.for("react.strict_mode"),bg=Symbol.for("react.profiler"),IC=Symbol.for("react.provider"),FC=Symbol.for("react.context"),dy=Symbol.for("react.forward_ref"),_g=Symbol.for("react.suspense"),wg=Symbol.for("react.suspense_list"),hy=Symbol.for("react.memo"),li=Symbol.for("react.lazy"),BC=Symbol.for("react.offscreen"),Eb=Symbol.iterator;function Ll(e){return e===null||typeof e!="object"?null:(e=Eb&&e[Eb]||e["@@iterator"],typeof e=="function"?e:null)}var ht=Object.assign,Ap;function ic(e){if(Ap===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ap=t&&t[1]||""}return`
|
|
34
|
-
`+Ap+e}var Op=!1;function Ip(e,t){if(!e||Op)return"";Op=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var s=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){s=u}e.call(t.prototype)}else{try{throw Error()}catch(u){s=u}e()}}catch(u){if(u&&s&&typeof u.stack=="string"){for(var r=u.stack.split(`
|
|
35
|
-
`),i=s.stack.split(`
|
|
36
|
-
`),o=r.length-1,a=i.length-1;1<=o&&0<=a&&r[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(r[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||r[o]!==i[a]){var c=`
|
|
37
|
-
`+r[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=a);break}}}finally{Op=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ic(e):""}function iT(e){switch(e.tag){case 5:return ic(e.type);case 16:return ic("Lazy");case 13:return ic("Suspense");case 19:return ic("SuspenseList");case 0:case 2:case 15:return e=Ip(e.type,!1),e;case 11:return e=Ip(e.type.render,!1),e;case 1:return e=Ip(e.type,!0),e;default:return""}}function Sg(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ba:return"Fragment";case ya:return"Portal";case bg:return"Profiler";case uy:return"StrictMode";case _g:return"Suspense";case wg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case FC:return(e.displayName||"Context")+".Consumer";case IC:return(e._context.displayName||"Context")+".Provider";case dy:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case hy:return t=e.displayName||null,t!==null?t:Sg(e.type)||"Memo";case li:t=e._payload,e=e._init;try{return Sg(e(t))}catch{}}return null}function oT(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Sg(t);case 8:return t===uy?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function qi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function zC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function aT(e){var t=zC(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(o){s=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(o){s=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zu(e){e._valueTracker||(e._valueTracker=aT(e))}function $C(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=zC(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Ih(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function kg(e,t){var n=t.checked;return ht({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Pb(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=qi(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function HC(e,t){t=t.checked,t!=null&&cy(e,"checked",t,!1)}function Cg(e,t){HC(e,t);var n=qi(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ng(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ng(e,t.type,qi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Tb(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ng(e,t,n){(t!=="number"||Ih(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var oc=Array.isArray;function Ma(e,t,n,s){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&s&&(e[n].defaultSelected=!0)}else{for(n=""+qi(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,s&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function jg(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(te(91));return ht({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Rb(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(te(92));if(oc(n)){if(1<n.length)throw Error(te(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:qi(n)}}function WC(e,t){var n=qi(t.value),s=qi(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),s!=null&&(e.defaultValue=""+s)}function Db(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function UC(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Eg(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?UC(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ed,qC=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,s,r){MSApp.execUnsafeLocalFunction(function(){return e(t,n,s,r)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ed=ed||document.createElement("div"),ed.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ed.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Wc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var yc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},lT=["Webkit","ms","Moz","O"];Object.keys(yc).forEach(function(e){lT.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),yc[t]=yc[e]})});function KC(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||yc.hasOwnProperty(e)&&yc[e]?(""+t).trim():t+"px"}function VC(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,r=KC(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,r):e[n]=r}}var cT=ht({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Pg(e,t){if(t){if(cT[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function Tg(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Rg=null;function fy(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Dg=null,La=null,Aa=null;function Mb(e){if(e=Ru(e)){if(typeof Dg!="function")throw Error(te(280));var t=e.stateNode;t&&(t=Wf(t),Dg(e.stateNode,e.type,t))}}function YC(e){La?Aa?Aa.push(e):Aa=[e]:La=e}function XC(){if(La){var e=La,t=Aa;if(Aa=La=null,Mb(e),t)for(e=0;e<t.length;e++)Mb(t[e])}}function QC(e,t){return e(t)}function GC(){}var Fp=!1;function JC(e,t,n){if(Fp)return e(t,n);Fp=!0;try{return QC(e,t,n)}finally{Fp=!1,(La!==null||Aa!==null)&&(GC(),XC())}}function Uc(e,t){var n=e.stateNode;if(n===null)return null;var s=Wf(n);if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(te(231,t,typeof n));return n}var Mg=!1;if(Hr)try{var Al={};Object.defineProperty(Al,"passive",{get:function(){Mg=!0}}),window.addEventListener("test",Al,Al),window.removeEventListener("test",Al,Al)}catch{Mg=!1}function uT(e,t,n,s,r,i,o,a,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var bc=!1,Fh=null,Bh=!1,Lg=null,dT={onError:function(e){bc=!0,Fh=e}};function hT(e,t,n,s,r,i,o,a,c){bc=!1,Fh=null,uT.apply(dT,arguments)}function fT(e,t,n,s,r,i,o,a,c){if(hT.apply(this,arguments),bc){if(bc){var u=Fh;bc=!1,Fh=null}else throw Error(te(198));Bh||(Bh=!0,Lg=u)}}function ta(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function ZC(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Lb(e){if(ta(e)!==e)throw Error(te(188))}function pT(e){var t=e.alternate;if(!t){if(t=ta(e),t===null)throw Error(te(188));return t!==e?null:e}for(var n=e,s=t;;){var r=n.return;if(r===null)break;var i=r.alternate;if(i===null){if(s=r.return,s!==null){n=s;continue}break}if(r.child===i.child){for(i=r.child;i;){if(i===n)return Lb(r),e;if(i===s)return Lb(r),t;i=i.sibling}throw Error(te(188))}if(n.return!==s.return)n=r,s=i;else{for(var o=!1,a=r.child;a;){if(a===n){o=!0,n=r,s=i;break}if(a===s){o=!0,s=r,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,s=r;break}if(a===s){o=!0,s=i,n=r;break}a=a.sibling}if(!o)throw Error(te(189))}}if(n.alternate!==s)throw Error(te(190))}if(n.tag!==3)throw Error(te(188));return n.stateNode.current===n?e:t}function e2(e){return e=pT(e),e!==null?t2(e):null}function t2(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=t2(e);if(t!==null)return t;e=e.sibling}return null}var n2=ds.unstable_scheduleCallback,Ab=ds.unstable_cancelCallback,mT=ds.unstable_shouldYield,gT=ds.unstable_requestPaint,Ct=ds.unstable_now,xT=ds.unstable_getCurrentPriorityLevel,py=ds.unstable_ImmediatePriority,s2=ds.unstable_UserBlockingPriority,zh=ds.unstable_NormalPriority,vT=ds.unstable_LowPriority,r2=ds.unstable_IdlePriority,Bf=null,ur=null;function yT(e){if(ur&&typeof ur.onCommitFiberRoot=="function")try{ur.onCommitFiberRoot(Bf,e,void 0,(e.current.flags&128)===128)}catch{}}var Hs=Math.clz32?Math.clz32:wT,bT=Math.log,_T=Math.LN2;function wT(e){return e>>>=0,e===0?32:31-(bT(e)/_T|0)|0}var td=64,nd=4194304;function ac(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function $h(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,r=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~r;a!==0?s=ac(a):(i&=o,i!==0&&(s=ac(i)))}else o=n&~r,o!==0?s=ac(o):i!==0&&(s=ac(i));if(s===0)return 0;if(t!==0&&t!==s&&!(t&r)&&(r=s&-s,i=t&-t,r>=i||r===16&&(i&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)n=31-Hs(t),r=1<<n,s|=e[n],t&=~r;return s}function ST(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function kT(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-Hs(i),a=1<<o,c=r[o];c===-1?(!(a&n)||a&s)&&(r[o]=ST(a,t)):c<=t&&(e.expiredLanes|=a),i&=~a}}function Ag(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function i2(){var e=td;return td<<=1,!(td&4194240)&&(td=64),e}function Bp(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Pu(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Hs(t),e[t]=n}function CT(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<n;){var r=31-Hs(n),i=1<<r;t[r]=0,s[r]=-1,e[r]=-1,n&=~i}}function my(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Hs(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}var Ke=0;function o2(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var a2,gy,l2,c2,u2,Og=!1,sd=[],Di=null,Mi=null,Li=null,qc=new Map,Kc=new Map,hi=[],NT="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 submit".split(" ");function Ob(e,t){switch(e){case"focusin":case"focusout":Di=null;break;case"dragenter":case"dragleave":Mi=null;break;case"mouseover":case"mouseout":Li=null;break;case"pointerover":case"pointerout":qc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kc.delete(t.pointerId)}}function Ol(e,t,n,s,r,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:i,targetContainers:[r]},t!==null&&(t=Ru(t),t!==null&&gy(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function jT(e,t,n,s,r){switch(t){case"focusin":return Di=Ol(Di,e,t,n,s,r),!0;case"dragenter":return Mi=Ol(Mi,e,t,n,s,r),!0;case"mouseover":return Li=Ol(Li,e,t,n,s,r),!0;case"pointerover":var i=r.pointerId;return qc.set(i,Ol(qc.get(i)||null,e,t,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,Kc.set(i,Ol(Kc.get(i)||null,e,t,n,s,r)),!0}return!1}function d2(e){var t=go(e.target);if(t!==null){var n=ta(t);if(n!==null){if(t=n.tag,t===13){if(t=ZC(n),t!==null){e.blockedOn=t,u2(e.priority,function(){l2(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function oh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ig(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Rg=s,n.target.dispatchEvent(s),Rg=null}else return t=Ru(n),t!==null&&gy(t),e.blockedOn=n,!1;t.shift()}return!0}function Ib(e,t,n){oh(e)&&n.delete(t)}function ET(){Og=!1,Di!==null&&oh(Di)&&(Di=null),Mi!==null&&oh(Mi)&&(Mi=null),Li!==null&&oh(Li)&&(Li=null),qc.forEach(Ib),Kc.forEach(Ib)}function Il(e,t){e.blockedOn===t&&(e.blockedOn=null,Og||(Og=!0,ds.unstable_scheduleCallback(ds.unstable_NormalPriority,ET)))}function Vc(e){function t(r){return Il(r,e)}if(0<sd.length){Il(sd[0],e);for(var n=1;n<sd.length;n++){var s=sd[n];s.blockedOn===e&&(s.blockedOn=null)}}for(Di!==null&&Il(Di,e),Mi!==null&&Il(Mi,e),Li!==null&&Il(Li,e),qc.forEach(t),Kc.forEach(t),n=0;n<hi.length;n++)s=hi[n],s.blockedOn===e&&(s.blockedOn=null);for(;0<hi.length&&(n=hi[0],n.blockedOn===null);)d2(n),n.blockedOn===null&&hi.shift()}var Oa=Yr.ReactCurrentBatchConfig,Hh=!0;function PT(e,t,n,s){var r=Ke,i=Oa.transition;Oa.transition=null;try{Ke=1,xy(e,t,n,s)}finally{Ke=r,Oa.transition=i}}function TT(e,t,n,s){var r=Ke,i=Oa.transition;Oa.transition=null;try{Ke=4,xy(e,t,n,s)}finally{Ke=r,Oa.transition=i}}function xy(e,t,n,s){if(Hh){var r=Ig(e,t,n,s);if(r===null)Xp(e,t,s,Wh,n),Ob(e,s);else if(jT(r,e,t,n,s))s.stopPropagation();else if(Ob(e,s),t&4&&-1<NT.indexOf(e)){for(;r!==null;){var i=Ru(r);if(i!==null&&a2(i),i=Ig(e,t,n,s),i===null&&Xp(e,t,s,Wh,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else Xp(e,t,s,null,n)}}var Wh=null;function Ig(e,t,n,s){if(Wh=null,e=fy(s),e=go(e),e!==null)if(t=ta(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ZC(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Wh=e,null}function h2(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(xT()){case py:return 1;case s2:return 4;case zh:case vT:return 16;case r2:return 536870912;default:return 16}default:return 16}}var ki=null,vy=null,ah=null;function f2(){if(ah)return ah;var e,t=vy,n=t.length,s,r="value"in ki?ki.value:ki.textContent,i=r.length;for(e=0;e<n&&t[e]===r[e];e++);var o=n-e;for(s=1;s<=o&&t[n-s]===r[i-s];s++);return ah=r.slice(e,1<s?1-s:void 0)}function lh(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function rd(){return!0}function Fb(){return!1}function ps(e){function t(n,s,r,i,o){this._reactName=n,this._targetInst=r,this.type=s,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?rd:Fb,this.isPropagationStopped=Fb,this}return ht(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=rd)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=rd)},persist:function(){},isPersistent:rd}),t}var xl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yy=ps(xl),Tu=ht({},xl,{view:0,detail:0}),RT=ps(Tu),zp,$p,Fl,zf=ht({},Tu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:by,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Fl&&(Fl&&e.type==="mousemove"?(zp=e.screenX-Fl.screenX,$p=e.screenY-Fl.screenY):$p=zp=0,Fl=e),zp)},movementY:function(e){return"movementY"in e?e.movementY:$p}}),Bb=ps(zf),DT=ht({},zf,{dataTransfer:0}),MT=ps(DT),LT=ht({},Tu,{relatedTarget:0}),Hp=ps(LT),AT=ht({},xl,{animationName:0,elapsedTime:0,pseudoElement:0}),OT=ps(AT),IT=ht({},xl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),FT=ps(IT),BT=ht({},xl,{data:0}),zb=ps(BT),zT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$T={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"},HT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function WT(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=HT[e])?!!t[e]:!1}function by(){return WT}var UT=ht({},Tu,{key:function(e){if(e.key){var t=zT[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=lh(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?$T[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:by,charCode:function(e){return e.type==="keypress"?lh(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?lh(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),qT=ps(UT),KT=ht({},zf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$b=ps(KT),VT=ht({},Tu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:by}),YT=ps(VT),XT=ht({},xl,{propertyName:0,elapsedTime:0,pseudoElement:0}),QT=ps(XT),GT=ht({},zf,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),JT=ps(GT),ZT=[9,13,27,32],_y=Hr&&"CompositionEvent"in window,_c=null;Hr&&"documentMode"in document&&(_c=document.documentMode);var eR=Hr&&"TextEvent"in window&&!_c,p2=Hr&&(!_y||_c&&8<_c&&11>=_c),Hb=" ",Wb=!1;function m2(e,t){switch(e){case"keyup":return ZT.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function g2(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _a=!1;function tR(e,t){switch(e){case"compositionend":return g2(t);case"keypress":return t.which!==32?null:(Wb=!0,Hb);case"textInput":return e=t.data,e===Hb&&Wb?null:e;default:return null}}function nR(e,t){if(_a)return e==="compositionend"||!_y&&m2(e,t)?(e=f2(),ah=vy=ki=null,_a=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return p2&&t.locale!=="ko"?null:t.data;default:return null}}var sR={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 Ub(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!sR[e.type]:t==="textarea"}function x2(e,t,n,s){YC(s),t=Uh(t,"onChange"),0<t.length&&(n=new yy("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var wc=null,Yc=null;function rR(e){E2(e,0)}function $f(e){var t=ka(e);if($C(t))return e}function iR(e,t){if(e==="change")return t}var v2=!1;if(Hr){var Wp;if(Hr){var Up="oninput"in document;if(!Up){var qb=document.createElement("div");qb.setAttribute("oninput","return;"),Up=typeof qb.oninput=="function"}Wp=Up}else Wp=!1;v2=Wp&&(!document.documentMode||9<document.documentMode)}function Kb(){wc&&(wc.detachEvent("onpropertychange",y2),Yc=wc=null)}function y2(e){if(e.propertyName==="value"&&$f(Yc)){var t=[];x2(t,Yc,e,fy(e)),JC(rR,t)}}function oR(e,t,n){e==="focusin"?(Kb(),wc=t,Yc=n,wc.attachEvent("onpropertychange",y2)):e==="focusout"&&Kb()}function aR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return $f(Yc)}function lR(e,t){if(e==="click")return $f(t)}function cR(e,t){if(e==="input"||e==="change")return $f(t)}function uR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qs=typeof Object.is=="function"?Object.is:uR;function Xc(e,t){if(qs(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var r=n[s];if(!yg.call(t,r)||!qs(e[r],t[r]))return!1}return!0}function Vb(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Yb(e,t){var n=Vb(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Vb(n)}}function b2(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?b2(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _2(){for(var e=window,t=Ih();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ih(e.document)}return t}function wy(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function dR(e){var t=_2(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&b2(n.ownerDocument.documentElement,n)){if(s!==null&&wy(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var r=n.textContent.length,i=Math.min(s.start,r);s=s.end===void 0?i:Math.min(s.end,r),!e.extend&&i>s&&(r=s,s=i,i=r),r=Yb(n,i);var o=Yb(n,s);r&&o&&(e.rangeCount!==1||e.anchorNode!==r.node||e.anchorOffset!==r.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(r.node,r.offset),e.removeAllRanges(),i>s?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var hR=Hr&&"documentMode"in document&&11>=document.documentMode,wa=null,Fg=null,Sc=null,Bg=!1;function Xb(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bg||wa==null||wa!==Ih(s)||(s=wa,"selectionStart"in s&&wy(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Sc&&Xc(Sc,s)||(Sc=s,s=Uh(Fg,"onSelect"),0<s.length&&(t=new yy("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=wa)))}function id(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Sa={animationend:id("Animation","AnimationEnd"),animationiteration:id("Animation","AnimationIteration"),animationstart:id("Animation","AnimationStart"),transitionend:id("Transition","TransitionEnd")},qp={},w2={};Hr&&(w2=document.createElement("div").style,"AnimationEvent"in window||(delete Sa.animationend.animation,delete Sa.animationiteration.animation,delete Sa.animationstart.animation),"TransitionEvent"in window||delete Sa.transitionend.transition);function Hf(e){if(qp[e])return qp[e];if(!Sa[e])return e;var t=Sa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in w2)return qp[e]=t[n];return e}var S2=Hf("animationend"),k2=Hf("animationiteration"),C2=Hf("animationstart"),N2=Hf("transitionend"),j2=new Map,Qb="abort auxClick 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(" ");function Qi(e,t){j2.set(e,t),ea(t,[e])}for(var Kp=0;Kp<Qb.length;Kp++){var Vp=Qb[Kp],fR=Vp.toLowerCase(),pR=Vp[0].toUpperCase()+Vp.slice(1);Qi(fR,"on"+pR)}Qi(S2,"onAnimationEnd");Qi(k2,"onAnimationIteration");Qi(C2,"onAnimationStart");Qi("dblclick","onDoubleClick");Qi("focusin","onFocus");Qi("focusout","onBlur");Qi(N2,"onTransitionEnd");el("onMouseEnter",["mouseout","mouseover"]);el("onMouseLeave",["mouseout","mouseover"]);el("onPointerEnter",["pointerout","pointerover"]);el("onPointerLeave",["pointerout","pointerover"]);ea("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ea("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ea("onBeforeInput",["compositionend","keypress","textInput","paste"]);ea("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ea("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ea("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var lc="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(" "),mR=new Set("cancel close invalid load scroll toggle".split(" ").concat(lc));function Gb(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,fT(s,t,void 0,e),e.currentTarget=null}function E2(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],r=s.event;s=s.listeners;e:{var i=void 0;if(t)for(var o=s.length-1;0<=o;o--){var a=s[o],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==i&&r.isPropagationStopped())break e;Gb(r,a,u),i=c}else for(o=0;o<s.length;o++){if(a=s[o],c=a.instance,u=a.currentTarget,a=a.listener,c!==i&&r.isPropagationStopped())break e;Gb(r,a,u),i=c}}}if(Bh)throw e=Lg,Bh=!1,Lg=null,e}function nt(e,t){var n=t[Ug];n===void 0&&(n=t[Ug]=new Set);var s=e+"__bubble";n.has(s)||(P2(t,e,2,!1),n.add(s))}function Yp(e,t,n){var s=0;t&&(s|=4),P2(n,e,s,t)}var od="_reactListening"+Math.random().toString(36).slice(2);function Qc(e){if(!e[od]){e[od]=!0,OC.forEach(function(n){n!=="selectionchange"&&(mR.has(n)||Yp(n,!1,e),Yp(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[od]||(t[od]=!0,Yp("selectionchange",!1,t))}}function P2(e,t,n,s){switch(h2(t)){case 1:var r=PT;break;case 4:r=TT;break;default:r=xy}n=r.bind(null,t,n,e),r=void 0,!Mg||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),s?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function Xp(e,t,n,s,r){var i=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var a=s.stateNode.containerInfo;if(a===r||a.nodeType===8&&a.parentNode===r)break;if(o===4)for(o=s.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===r||c.nodeType===8&&c.parentNode===r))return;o=o.return}for(;a!==null;){if(o=go(a),o===null)return;if(c=o.tag,c===5||c===6){s=i=o;continue e}a=a.parentNode}}s=s.return}JC(function(){var u=i,d=fy(n),h=[];e:{var p=j2.get(e);if(p!==void 0){var f=yy,m=e;switch(e){case"keypress":if(lh(n)===0)break e;case"keydown":case"keyup":f=qT;break;case"focusin":m="focus",f=Hp;break;case"focusout":m="blur",f=Hp;break;case"beforeblur":case"afterblur":f=Hp;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=Bb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=MT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=YT;break;case S2:case k2:case C2:f=OT;break;case N2:f=QT;break;case"scroll":f=RT;break;case"wheel":f=JT;break;case"copy":case"cut":case"paste":f=FT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=$b}var g=(t&4)!==0,y=!g&&e==="scroll",x=g?p!==null?p+"Capture":null:p;g=[];for(var b=u,_;b!==null;){_=b;var S=_.stateNode;if(_.tag===5&&S!==null&&(_=S,x!==null&&(S=Uc(b,x),S!=null&&g.push(Gc(b,S,_)))),y)break;b=b.return}0<g.length&&(p=new f(p,m,null,n,d),h.push({event:p,listeners:g}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",p&&n!==Rg&&(m=n.relatedTarget||n.fromElement)&&(go(m)||m[Wr]))break e;if((f||p)&&(p=d.window===d?d:(p=d.ownerDocument)?p.defaultView||p.parentWindow:window,f?(m=n.relatedTarget||n.toElement,f=u,m=m?go(m):null,m!==null&&(y=ta(m),m!==y||m.tag!==5&&m.tag!==6)&&(m=null)):(f=null,m=u),f!==m)){if(g=Bb,S="onMouseLeave",x="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(g=$b,S="onPointerLeave",x="onPointerEnter",b="pointer"),y=f==null?p:ka(f),_=m==null?p:ka(m),p=new g(S,b+"leave",f,n,d),p.target=y,p.relatedTarget=_,S=null,go(d)===u&&(g=new g(x,b+"enter",m,n,d),g.target=_,g.relatedTarget=y,S=g),y=S,f&&m)t:{for(g=f,x=m,b=0,_=g;_;_=aa(_))b++;for(_=0,S=x;S;S=aa(S))_++;for(;0<b-_;)g=aa(g),b--;for(;0<_-b;)x=aa(x),_--;for(;b--;){if(g===x||x!==null&&g===x.alternate)break t;g=aa(g),x=aa(x)}g=null}else g=null;f!==null&&Jb(h,p,f,g,!1),m!==null&&y!==null&&Jb(h,y,m,g,!0)}}e:{if(p=u?ka(u):window,f=p.nodeName&&p.nodeName.toLowerCase(),f==="select"||f==="input"&&p.type==="file")var C=iR;else if(Ub(p))if(v2)C=cR;else{C=aR;var w=oR}else(f=p.nodeName)&&f.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(C=lR);if(C&&(C=C(e,u))){x2(h,C,n,d);break e}w&&w(e,p,u),e==="focusout"&&(w=p._wrapperState)&&w.controlled&&p.type==="number"&&Ng(p,"number",p.value)}switch(w=u?ka(u):window,e){case"focusin":(Ub(w)||w.contentEditable==="true")&&(wa=w,Fg=u,Sc=null);break;case"focusout":Sc=Fg=wa=null;break;case"mousedown":Bg=!0;break;case"contextmenu":case"mouseup":case"dragend":Bg=!1,Xb(h,n,d);break;case"selectionchange":if(hR)break;case"keydown":case"keyup":Xb(h,n,d)}var j;if(_y)e:{switch(e){case"compositionstart":var E="onCompositionStart";break e;case"compositionend":E="onCompositionEnd";break e;case"compositionupdate":E="onCompositionUpdate";break e}E=void 0}else _a?m2(e,n)&&(E="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(E="onCompositionStart");E&&(p2&&n.locale!=="ko"&&(_a||E!=="onCompositionStart"?E==="onCompositionEnd"&&_a&&(j=f2()):(ki=d,vy="value"in ki?ki.value:ki.textContent,_a=!0)),w=Uh(u,E),0<w.length&&(E=new zb(E,e,null,n,d),h.push({event:E,listeners:w}),j?E.data=j:(j=g2(n),j!==null&&(E.data=j)))),(j=eR?tR(e,n):nR(e,n))&&(u=Uh(u,"onBeforeInput"),0<u.length&&(d=new zb("onBeforeInput","beforeinput",null,n,d),h.push({event:d,listeners:u}),d.data=j))}E2(h,t)})}function Gc(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Uh(e,t){for(var n=t+"Capture",s=[];e!==null;){var r=e,i=r.stateNode;r.tag===5&&i!==null&&(r=i,i=Uc(e,n),i!=null&&s.unshift(Gc(e,i,r)),i=Uc(e,t),i!=null&&s.push(Gc(e,i,r))),e=e.return}return s}function aa(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Jb(e,t,n,s,r){for(var i=t._reactName,o=[];n!==null&&n!==s;){var a=n,c=a.alternate,u=a.stateNode;if(c!==null&&c===s)break;a.tag===5&&u!==null&&(a=u,r?(c=Uc(n,i),c!=null&&o.unshift(Gc(n,c,a))):r||(c=Uc(n,i),c!=null&&o.push(Gc(n,c,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var gR=/\r\n?/g,xR=/\u0000|\uFFFD/g;function Zb(e){return(typeof e=="string"?e:""+e).replace(gR,`
|
|
38
|
-
`).replace(xR,"")}function ad(e,t,n){if(t=Zb(t),Zb(e)!==t&&n)throw Error(te(425))}function qh(){}var zg=null,$g=null;function Hg(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wg=typeof setTimeout=="function"?setTimeout:void 0,vR=typeof clearTimeout=="function"?clearTimeout:void 0,e_=typeof Promise=="function"?Promise:void 0,yR=typeof queueMicrotask=="function"?queueMicrotask:typeof e_<"u"?function(e){return e_.resolve(null).then(e).catch(bR)}:Wg;function bR(e){setTimeout(function(){throw e})}function Qp(e,t){var n=t,s=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(s===0){e.removeChild(r),Vc(t);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=r}while(n);Vc(t)}function Ai(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function t_(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var vl=Math.random().toString(36).slice(2),ar="__reactFiber$"+vl,Jc="__reactProps$"+vl,Wr="__reactContainer$"+vl,Ug="__reactEvents$"+vl,_R="__reactListeners$"+vl,wR="__reactHandles$"+vl;function go(e){var t=e[ar];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Wr]||n[ar]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=t_(e);e!==null;){if(n=e[ar])return n;e=t_(e)}return t}e=n,n=e.parentNode}return null}function Ru(e){return e=e[ar]||e[Wr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ka(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(te(33))}function Wf(e){return e[Jc]||null}var qg=[],Ca=-1;function Gi(e){return{current:e}}function rt(e){0>Ca||(e.current=qg[Ca],qg[Ca]=null,Ca--)}function et(e,t){Ca++,qg[Ca]=e.current,e.current=t}var Ki={},Cn=Gi(Ki),Gn=Gi(!1),Io=Ki;function tl(e,t){var n=e.type.contextTypes;if(!n)return Ki;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var r={},i;for(i in n)r[i]=t[i];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=r),r}function Jn(e){return e=e.childContextTypes,e!=null}function Kh(){rt(Gn),rt(Cn)}function n_(e,t,n){if(Cn.current!==Ki)throw Error(te(168));et(Cn,t),et(Gn,n)}function T2(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var r in s)if(!(r in t))throw Error(te(108,oT(e)||"Unknown",r));return ht({},n,s)}function Vh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ki,Io=Cn.current,et(Cn,e),et(Gn,Gn.current),!0}function s_(e,t,n){var s=e.stateNode;if(!s)throw Error(te(169));n?(e=T2(e,t,Io),s.__reactInternalMemoizedMergedChildContext=e,rt(Gn),rt(Cn),et(Cn,e)):rt(Gn),et(Gn,n)}var Er=null,Uf=!1,Gp=!1;function R2(e){Er===null?Er=[e]:Er.push(e)}function SR(e){Uf=!0,R2(e)}function Ji(){if(!Gp&&Er!==null){Gp=!0;var e=0,t=Ke;try{var n=Er;for(Ke=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}Er=null,Uf=!1}catch(r){throw Er!==null&&(Er=Er.slice(e+1)),n2(py,Ji),r}finally{Ke=t,Gp=!1}}return null}var Na=[],ja=0,Yh=null,Xh=0,ws=[],Ss=0,Fo=null,Or=1,Ir="";function ao(e,t){Na[ja++]=Xh,Na[ja++]=Yh,Yh=e,Xh=t}function D2(e,t,n){ws[Ss++]=Or,ws[Ss++]=Ir,ws[Ss++]=Fo,Fo=e;var s=Or;e=Ir;var r=32-Hs(s)-1;s&=~(1<<r),n+=1;var i=32-Hs(t)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,Or=1<<32-Hs(t)+r|n<<r|s,Ir=i+e}else Or=1<<i|n<<r|s,Ir=e}function Sy(e){e.return!==null&&(ao(e,1),D2(e,1,0))}function ky(e){for(;e===Yh;)Yh=Na[--ja],Na[ja]=null,Xh=Na[--ja],Na[ja]=null;for(;e===Fo;)Fo=ws[--Ss],ws[Ss]=null,Ir=ws[--Ss],ws[Ss]=null,Or=ws[--Ss],ws[Ss]=null}var ls=null,as=null,ot=!1,$s=null;function M2(e,t){var n=Ns(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function r_(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,ls=e,as=Ai(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ls=e,as=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Fo!==null?{id:Or,overflow:Ir}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ns(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ls=e,as=null,!0):!1;default:return!1}}function Kg(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Vg(e){if(ot){var t=as;if(t){var n=t;if(!r_(e,t)){if(Kg(e))throw Error(te(418));t=Ai(n.nextSibling);var s=ls;t&&r_(e,t)?M2(s,n):(e.flags=e.flags&-4097|2,ot=!1,ls=e)}}else{if(Kg(e))throw Error(te(418));e.flags=e.flags&-4097|2,ot=!1,ls=e}}}function i_(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ls=e}function ld(e){if(e!==ls)return!1;if(!ot)return i_(e),ot=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Hg(e.type,e.memoizedProps)),t&&(t=as)){if(Kg(e))throw L2(),Error(te(418));for(;t;)M2(e,t),t=Ai(t.nextSibling)}if(i_(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(te(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){as=Ai(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}as=null}}else as=ls?Ai(e.stateNode.nextSibling):null;return!0}function L2(){for(var e=as;e;)e=Ai(e.nextSibling)}function nl(){as=ls=null,ot=!1}function Cy(e){$s===null?$s=[e]:$s.push(e)}var kR=Yr.ReactCurrentBatchConfig;function Bl(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(te(309));var s=n.stateNode}if(!s)throw Error(te(147,e));var r=s,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var a=r.refs;o===null?delete a[i]:a[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(te(284));if(!n._owner)throw Error(te(290,e))}return e}function cd(e,t){throw e=Object.prototype.toString.call(t),Error(te(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function o_(e){var t=e._init;return t(e._payload)}function A2(e){function t(x,b){if(e){var _=x.deletions;_===null?(x.deletions=[b],x.flags|=16):_.push(b)}}function n(x,b){if(!e)return null;for(;b!==null;)t(x,b),b=b.sibling;return null}function s(x,b){for(x=new Map;b!==null;)b.key!==null?x.set(b.key,b):x.set(b.index,b),b=b.sibling;return x}function r(x,b){return x=Bi(x,b),x.index=0,x.sibling=null,x}function i(x,b,_){return x.index=_,e?(_=x.alternate,_!==null?(_=_.index,_<b?(x.flags|=2,b):_):(x.flags|=2,b)):(x.flags|=1048576,b)}function o(x){return e&&x.alternate===null&&(x.flags|=2),x}function a(x,b,_,S){return b===null||b.tag!==6?(b=rm(_,x.mode,S),b.return=x,b):(b=r(b,_),b.return=x,b)}function c(x,b,_,S){var C=_.type;return C===ba?d(x,b,_.props.children,S,_.key):b!==null&&(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===li&&o_(C)===b.type)?(S=r(b,_.props),S.ref=Bl(x,b,_),S.return=x,S):(S=mh(_.type,_.key,_.props,null,x.mode,S),S.ref=Bl(x,b,_),S.return=x,S)}function u(x,b,_,S){return b===null||b.tag!==4||b.stateNode.containerInfo!==_.containerInfo||b.stateNode.implementation!==_.implementation?(b=im(_,x.mode,S),b.return=x,b):(b=r(b,_.children||[]),b.return=x,b)}function d(x,b,_,S,C){return b===null||b.tag!==7?(b=Mo(_,x.mode,S,C),b.return=x,b):(b=r(b,_),b.return=x,b)}function h(x,b,_){if(typeof b=="string"&&b!==""||typeof b=="number")return b=rm(""+b,x.mode,_),b.return=x,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ju:return _=mh(b.type,b.key,b.props,null,x.mode,_),_.ref=Bl(x,null,b),_.return=x,_;case ya:return b=im(b,x.mode,_),b.return=x,b;case li:var S=b._init;return h(x,S(b._payload),_)}if(oc(b)||Ll(b))return b=Mo(b,x.mode,_,null),b.return=x,b;cd(x,b)}return null}function p(x,b,_,S){var C=b!==null?b.key:null;if(typeof _=="string"&&_!==""||typeof _=="number")return C!==null?null:a(x,b,""+_,S);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Ju:return _.key===C?c(x,b,_,S):null;case ya:return _.key===C?u(x,b,_,S):null;case li:return C=_._init,p(x,b,C(_._payload),S)}if(oc(_)||Ll(_))return C!==null?null:d(x,b,_,S,null);cd(x,_)}return null}function f(x,b,_,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return x=x.get(_)||null,a(b,x,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Ju:return x=x.get(S.key===null?_:S.key)||null,c(b,x,S,C);case ya:return x=x.get(S.key===null?_:S.key)||null,u(b,x,S,C);case li:var w=S._init;return f(x,b,_,w(S._payload),C)}if(oc(S)||Ll(S))return x=x.get(_)||null,d(b,x,S,C,null);cd(b,S)}return null}function m(x,b,_,S){for(var C=null,w=null,j=b,E=b=0,O=null;j!==null&&E<_.length;E++){j.index>E?(O=j,j=null):O=j.sibling;var R=p(x,j,_[E],S);if(R===null){j===null&&(j=O);break}e&&j&&R.alternate===null&&t(x,j),b=i(R,b,E),w===null?C=R:w.sibling=R,w=R,j=O}if(E===_.length)return n(x,j),ot&&ao(x,E),C;if(j===null){for(;E<_.length;E++)j=h(x,_[E],S),j!==null&&(b=i(j,b,E),w===null?C=j:w.sibling=j,w=j);return ot&&ao(x,E),C}for(j=s(x,j);E<_.length;E++)O=f(j,x,E,_[E],S),O!==null&&(e&&O.alternate!==null&&j.delete(O.key===null?E:O.key),b=i(O,b,E),w===null?C=O:w.sibling=O,w=O);return e&&j.forEach(function(B){return t(x,B)}),ot&&ao(x,E),C}function g(x,b,_,S){var C=Ll(_);if(typeof C!="function")throw Error(te(150));if(_=C.call(_),_==null)throw Error(te(151));for(var w=C=null,j=b,E=b=0,O=null,R=_.next();j!==null&&!R.done;E++,R=_.next()){j.index>E?(O=j,j=null):O=j.sibling;var B=p(x,j,R.value,S);if(B===null){j===null&&(j=O);break}e&&j&&B.alternate===null&&t(x,j),b=i(B,b,E),w===null?C=B:w.sibling=B,w=B,j=O}if(R.done)return n(x,j),ot&&ao(x,E),C;if(j===null){for(;!R.done;E++,R=_.next())R=h(x,R.value,S),R!==null&&(b=i(R,b,E),w===null?C=R:w.sibling=R,w=R);return ot&&ao(x,E),C}for(j=s(x,j);!R.done;E++,R=_.next())R=f(j,x,E,R.value,S),R!==null&&(e&&R.alternate!==null&&j.delete(R.key===null?E:R.key),b=i(R,b,E),w===null?C=R:w.sibling=R,w=R);return e&&j.forEach(function(L){return t(x,L)}),ot&&ao(x,E),C}function y(x,b,_,S){if(typeof _=="object"&&_!==null&&_.type===ba&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Ju:e:{for(var C=_.key,w=b;w!==null;){if(w.key===C){if(C=_.type,C===ba){if(w.tag===7){n(x,w.sibling),b=r(w,_.props.children),b.return=x,x=b;break e}}else if(w.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===li&&o_(C)===w.type){n(x,w.sibling),b=r(w,_.props),b.ref=Bl(x,w,_),b.return=x,x=b;break e}n(x,w);break}else t(x,w);w=w.sibling}_.type===ba?(b=Mo(_.props.children,x.mode,S,_.key),b.return=x,x=b):(S=mh(_.type,_.key,_.props,null,x.mode,S),S.ref=Bl(x,b,_),S.return=x,x=S)}return o(x);case ya:e:{for(w=_.key;b!==null;){if(b.key===w)if(b.tag===4&&b.stateNode.containerInfo===_.containerInfo&&b.stateNode.implementation===_.implementation){n(x,b.sibling),b=r(b,_.children||[]),b.return=x,x=b;break e}else{n(x,b);break}else t(x,b);b=b.sibling}b=im(_,x.mode,S),b.return=x,x=b}return o(x);case li:return w=_._init,y(x,b,w(_._payload),S)}if(oc(_))return m(x,b,_,S);if(Ll(_))return g(x,b,_,S);cd(x,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,b!==null&&b.tag===6?(n(x,b.sibling),b=r(b,_),b.return=x,x=b):(n(x,b),b=rm(_,x.mode,S),b.return=x,x=b),o(x)):n(x,b)}return y}var sl=A2(!0),O2=A2(!1),Qh=Gi(null),Gh=null,Ea=null,Ny=null;function jy(){Ny=Ea=Gh=null}function Ey(e){var t=Qh.current;rt(Qh),e._currentValue=t}function Yg(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Ia(e,t){Gh=e,Ny=Ea=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Xn=!0),e.firstContext=null)}function Ts(e){var t=e._currentValue;if(Ny!==e)if(e={context:e,memoizedValue:t,next:null},Ea===null){if(Gh===null)throw Error(te(308));Ea=e,Gh.dependencies={lanes:0,firstContext:e}}else Ea=Ea.next=e;return t}var xo=null;function Py(e){xo===null?xo=[e]:xo.push(e)}function I2(e,t,n,s){var r=t.interleaved;return r===null?(n.next=n,Py(t)):(n.next=r.next,r.next=n),t.interleaved=n,Ur(e,s)}function Ur(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ci=!1;function Ty(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function F2(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Br(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Oi(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,ze&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,Ur(e,n)}return r=s.interleaved,r===null?(t.next=t,Py(s)):(t.next=r.next,r.next=t),s.interleaved=t,Ur(e,n)}function ch(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,my(e,n)}}function a_(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var r=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?r=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?r=i=t:i=i.next=t}else r=i=t;n={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Jh(e,t,n,s){var r=e.updateQueue;ci=!1;var i=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var c=a,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=c))}if(i!==null){var h=r.baseState;o=0,d=u=c=null,a=i;do{var p=a.lane,f=a.eventTime;if((s&p)===p){d!==null&&(d=d.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=e,g=a;switch(p=t,f=n,g.tag){case 1:if(m=g.payload,typeof m=="function"){h=m.call(f,h,p);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,p=typeof m=="function"?m.call(f,h,p):m,p==null)break e;h=ht({},h,p);break e;case 2:ci=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,p=r.effects,p===null?r.effects=[a]:p.push(a))}else f={eventTime:f,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=f,c=h):d=d.next=f,o|=p;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;p=a,a=p.next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}while(!0);if(d===null&&(c=h),r.baseState=c,r.firstBaseUpdate=u,r.lastBaseUpdate=d,t=r.shared.interleaved,t!==null){r=t;do o|=r.lane,r=r.next;while(r!==t)}else i===null&&(r.shared.lanes=0);zo|=o,e.lanes=o,e.memoizedState=h}}function l_(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],r=s.callback;if(r!==null){if(s.callback=null,s=n,typeof r!="function")throw Error(te(191,r));r.call(s)}}}var Du={},dr=Gi(Du),Zc=Gi(Du),eu=Gi(Du);function vo(e){if(e===Du)throw Error(te(174));return e}function Ry(e,t){switch(et(eu,t),et(Zc,e),et(dr,Du),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Eg(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Eg(t,e)}rt(dr),et(dr,t)}function rl(){rt(dr),rt(Zc),rt(eu)}function B2(e){vo(eu.current);var t=vo(dr.current),n=Eg(t,e.type);t!==n&&(et(Zc,e),et(dr,n))}function Dy(e){Zc.current===e&&(rt(dr),rt(Zc))}var ut=Gi(0);function Zh(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Jp=[];function My(){for(var e=0;e<Jp.length;e++)Jp[e]._workInProgressVersionPrimary=null;Jp.length=0}var uh=Yr.ReactCurrentDispatcher,Zp=Yr.ReactCurrentBatchConfig,Bo=0,dt=null,Ft=null,Qt=null,ef=!1,kc=!1,tu=0,CR=0;function gn(){throw Error(te(321))}function Ly(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!qs(e[n],t[n]))return!1;return!0}function Ay(e,t,n,s,r,i){if(Bo=i,dt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,uh.current=e===null||e.memoizedState===null?PR:TR,e=n(s,r),kc){i=0;do{if(kc=!1,tu=0,25<=i)throw Error(te(301));i+=1,Qt=Ft=null,t.updateQueue=null,uh.current=RR,e=n(s,r)}while(kc)}if(uh.current=tf,t=Ft!==null&&Ft.next!==null,Bo=0,Qt=Ft=dt=null,ef=!1,t)throw Error(te(300));return e}function Oy(){var e=tu!==0;return tu=0,e}function Zs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?dt.memoizedState=Qt=e:Qt=Qt.next=e,Qt}function Rs(){if(Ft===null){var e=dt.alternate;e=e!==null?e.memoizedState:null}else e=Ft.next;var t=Qt===null?dt.memoizedState:Qt.next;if(t!==null)Qt=t,Ft=e;else{if(e===null)throw Error(te(310));Ft=e,e={memoizedState:Ft.memoizedState,baseState:Ft.baseState,baseQueue:Ft.baseQueue,queue:Ft.queue,next:null},Qt===null?dt.memoizedState=Qt=e:Qt=Qt.next=e}return Qt}function nu(e,t){return typeof t=="function"?t(e):t}function em(e){var t=Rs(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var s=Ft,r=s.baseQueue,i=n.pending;if(i!==null){if(r!==null){var o=r.next;r.next=i.next,i.next=o}s.baseQueue=r=i,n.pending=null}if(r!==null){i=r.next,s=s.baseState;var a=o=null,c=null,u=i;do{var d=u.lane;if((Bo&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),s=u.hasEagerState?u.eagerState:e(s,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(a=c=h,o=s):c=c.next=h,dt.lanes|=d,zo|=d}u=u.next}while(u!==null&&u!==i);c===null?o=s:c.next=a,qs(s,t.memoizedState)||(Xn=!0),t.memoizedState=s,t.baseState=o,t.baseQueue=c,n.lastRenderedState=s}if(e=n.interleaved,e!==null){r=e;do i=r.lane,dt.lanes|=i,zo|=i,r=r.next;while(r!==e)}else r===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function tm(e){var t=Rs(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var s=n.dispatch,r=n.pending,i=t.memoizedState;if(r!==null){n.pending=null;var o=r=r.next;do i=e(i,o.action),o=o.next;while(o!==r);qs(i,t.memoizedState)||(Xn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function z2(){}function $2(e,t){var n=dt,s=Rs(),r=t(),i=!qs(s.memoizedState,r);if(i&&(s.memoizedState=r,Xn=!0),s=s.queue,Iy(U2.bind(null,n,s,e),[e]),s.getSnapshot!==t||i||Qt!==null&&Qt.memoizedState.tag&1){if(n.flags|=2048,su(9,W2.bind(null,n,s,r,t),void 0,null),tn===null)throw Error(te(349));Bo&30||H2(n,t,r)}return r}function H2(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=dt.updateQueue,t===null?(t={lastEffect:null,stores:null},dt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function W2(e,t,n,s){t.value=n,t.getSnapshot=s,q2(t)&&K2(e)}function U2(e,t,n){return n(function(){q2(t)&&K2(e)})}function q2(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!qs(e,n)}catch{return!0}}function K2(e){var t=Ur(e,1);t!==null&&Ws(t,e,1,-1)}function c_(e){var t=Zs();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:nu,lastRenderedState:e},t.queue=e,e=e.dispatch=ER.bind(null,dt,e),[t.memoizedState,e]}function su(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=dt.updateQueue,t===null?(t={lastEffect:null,stores:null},dt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e)),e}function V2(){return Rs().memoizedState}function dh(e,t,n,s){var r=Zs();dt.flags|=e,r.memoizedState=su(1|t,n,void 0,s===void 0?null:s)}function qf(e,t,n,s){var r=Rs();s=s===void 0?null:s;var i=void 0;if(Ft!==null){var o=Ft.memoizedState;if(i=o.destroy,s!==null&&Ly(s,o.deps)){r.memoizedState=su(t,n,i,s);return}}dt.flags|=e,r.memoizedState=su(1|t,n,i,s)}function u_(e,t){return dh(8390656,8,e,t)}function Iy(e,t){return qf(2048,8,e,t)}function Y2(e,t){return qf(4,2,e,t)}function X2(e,t){return qf(4,4,e,t)}function Q2(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function G2(e,t,n){return n=n!=null?n.concat([e]):null,qf(4,4,Q2.bind(null,t,e),n)}function Fy(){}function J2(e,t){var n=Rs();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Ly(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Z2(e,t){var n=Rs();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Ly(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function eN(e,t,n){return Bo&21?(qs(n,t)||(n=i2(),dt.lanes|=n,zo|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Xn=!0),e.memoizedState=n)}function NR(e,t){var n=Ke;Ke=n!==0&&4>n?n:4,e(!0);var s=Zp.transition;Zp.transition={};try{e(!1),t()}finally{Ke=n,Zp.transition=s}}function tN(){return Rs().memoizedState}function jR(e,t,n){var s=Fi(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},nN(e))sN(t,n);else if(n=I2(e,t,n,s),n!==null){var r=An();Ws(n,e,s,r),rN(n,t,s)}}function ER(e,t,n){var s=Fi(e),r={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(nN(e))sN(t,r);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(r.hasEagerState=!0,r.eagerState=a,qs(a,o)){var c=t.interleaved;c===null?(r.next=r,Py(t)):(r.next=c.next,c.next=r),t.interleaved=r;return}}catch{}finally{}n=I2(e,t,r,s),n!==null&&(r=An(),Ws(n,e,s,r),rN(n,t,s))}}function nN(e){var t=e.alternate;return e===dt||t!==null&&t===dt}function sN(e,t){kc=ef=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function rN(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,my(e,n)}}var tf={readContext:Ts,useCallback:gn,useContext:gn,useEffect:gn,useImperativeHandle:gn,useInsertionEffect:gn,useLayoutEffect:gn,useMemo:gn,useReducer:gn,useRef:gn,useState:gn,useDebugValue:gn,useDeferredValue:gn,useTransition:gn,useMutableSource:gn,useSyncExternalStore:gn,useId:gn,unstable_isNewReconciler:!1},PR={readContext:Ts,useCallback:function(e,t){return Zs().memoizedState=[e,t===void 0?null:t],e},useContext:Ts,useEffect:u_,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,dh(4194308,4,Q2.bind(null,t,e),n)},useLayoutEffect:function(e,t){return dh(4194308,4,e,t)},useInsertionEffect:function(e,t){return dh(4,2,e,t)},useMemo:function(e,t){var n=Zs();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=Zs();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=jR.bind(null,dt,e),[s.memoizedState,e]},useRef:function(e){var t=Zs();return e={current:e},t.memoizedState=e},useState:c_,useDebugValue:Fy,useDeferredValue:function(e){return Zs().memoizedState=e},useTransition:function(){var e=c_(!1),t=e[0];return e=NR.bind(null,e[1]),Zs().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=dt,r=Zs();if(ot){if(n===void 0)throw Error(te(407));n=n()}else{if(n=t(),tn===null)throw Error(te(349));Bo&30||H2(s,t,n)}r.memoizedState=n;var i={value:n,getSnapshot:t};return r.queue=i,u_(U2.bind(null,s,i,e),[e]),s.flags|=2048,su(9,W2.bind(null,s,i,n,t),void 0,null),n},useId:function(){var e=Zs(),t=tn.identifierPrefix;if(ot){var n=Ir,s=Or;n=(s&~(1<<32-Hs(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=tu++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=CR++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},TR={readContext:Ts,useCallback:J2,useContext:Ts,useEffect:Iy,useImperativeHandle:G2,useInsertionEffect:Y2,useLayoutEffect:X2,useMemo:Z2,useReducer:em,useRef:V2,useState:function(){return em(nu)},useDebugValue:Fy,useDeferredValue:function(e){var t=Rs();return eN(t,Ft.memoizedState,e)},useTransition:function(){var e=em(nu)[0],t=Rs().memoizedState;return[e,t]},useMutableSource:z2,useSyncExternalStore:$2,useId:tN,unstable_isNewReconciler:!1},RR={readContext:Ts,useCallback:J2,useContext:Ts,useEffect:Iy,useImperativeHandle:G2,useInsertionEffect:Y2,useLayoutEffect:X2,useMemo:Z2,useReducer:tm,useRef:V2,useState:function(){return tm(nu)},useDebugValue:Fy,useDeferredValue:function(e){var t=Rs();return Ft===null?t.memoizedState=e:eN(t,Ft.memoizedState,e)},useTransition:function(){var e=tm(nu)[0],t=Rs().memoizedState;return[e,t]},useMutableSource:z2,useSyncExternalStore:$2,useId:tN,unstable_isNewReconciler:!1};function Os(e,t){if(e&&e.defaultProps){t=ht({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Xg(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:ht({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Kf={isMounted:function(e){return(e=e._reactInternals)?ta(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=An(),r=Fi(e),i=Br(s,r);i.payload=t,n!=null&&(i.callback=n),t=Oi(e,i,r),t!==null&&(Ws(t,e,r,s),ch(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=An(),r=Fi(e),i=Br(s,r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Oi(e,i,r),t!==null&&(Ws(t,e,r,s),ch(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=An(),s=Fi(e),r=Br(n,s);r.tag=2,t!=null&&(r.callback=t),t=Oi(e,r,s),t!==null&&(Ws(t,e,s,n),ch(t,e,s))}};function d_(e,t,n,s,r,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,i,o):t.prototype&&t.prototype.isPureReactComponent?!Xc(n,s)||!Xc(r,i):!0}function iN(e,t,n){var s=!1,r=Ki,i=t.contextType;return typeof i=="object"&&i!==null?i=Ts(i):(r=Jn(t)?Io:Cn.current,s=t.contextTypes,i=(s=s!=null)?tl(e,r):Ki),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Kf,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=i),t}function h_(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&Kf.enqueueReplaceState(t,t.state,null)}function Qg(e,t,n,s){var r=e.stateNode;r.props=n,r.state=e.memoizedState,r.refs={},Ty(e);var i=t.contextType;typeof i=="object"&&i!==null?r.context=Ts(i):(i=Jn(t)?Io:Cn.current,r.context=tl(e,i)),r.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Xg(e,t,i,n),r.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(t=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),t!==r.state&&Kf.enqueueReplaceState(r,r.state,null),Jh(e,n,r,s),r.state=e.memoizedState),typeof r.componentDidMount=="function"&&(e.flags|=4194308)}function il(e,t){try{var n="",s=t;do n+=iT(s),s=s.return;while(s);var r=n}catch(i){r=`
|
|
39
|
-
Error generating stack: `+i.message+`
|
|
40
|
-
`+i.stack}return{value:e,source:t,stack:r,digest:null}}function nm(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Gg(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var DR=typeof WeakMap=="function"?WeakMap:Map;function oN(e,t,n){n=Br(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){sf||(sf=!0,ax=s),Gg(e,t)},n}function aN(e,t,n){n=Br(-1,n),n.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var r=t.value;n.payload=function(){return s(r)},n.callback=function(){Gg(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Gg(e,t),typeof s!="function"&&(Ii===null?Ii=new Set([this]):Ii.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function f_(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new DR;var r=new Set;s.set(t,r)}else r=s.get(t),r===void 0&&(r=new Set,s.set(t,r));r.has(n)||(r.add(n),e=KR.bind(null,e,t,n),t.then(e,e))}function p_(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function m_(e,t,n,s,r){return e.mode&1?(e.flags|=65536,e.lanes=r,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Br(-1,1),t.tag=2,Oi(n,t,1))),n.lanes|=1),e)}var MR=Yr.ReactCurrentOwner,Xn=!1;function Dn(e,t,n,s){t.child=e===null?O2(t,null,n,s):sl(t,e.child,n,s)}function g_(e,t,n,s,r){n=n.render;var i=t.ref;return Ia(t,r),s=Ay(e,t,n,s,i,r),n=Oy(),e!==null&&!Xn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,qr(e,t,r)):(ot&&n&&Sy(t),t.flags|=1,Dn(e,t,s,r),t.child)}function x_(e,t,n,s,r){if(e===null){var i=n.type;return typeof i=="function"&&!Ky(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,lN(e,t,i,s,r)):(e=mh(n.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&r)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Xc,n(o,s)&&e.ref===t.ref)return qr(e,t,r)}return t.flags|=1,e=Bi(i,s),e.ref=t.ref,e.return=t,t.child=e}function lN(e,t,n,s,r){if(e!==null){var i=e.memoizedProps;if(Xc(i,s)&&e.ref===t.ref)if(Xn=!1,t.pendingProps=s=i,(e.lanes&r)!==0)e.flags&131072&&(Xn=!0);else return t.lanes=e.lanes,qr(e,t,r)}return Jg(e,t,n,s,r)}function cN(e,t,n){var s=t.pendingProps,r=s.children,i=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},et(Ta,os),os|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,et(Ta,os),os|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=i!==null?i.baseLanes:n,et(Ta,os),os|=s}else i!==null?(s=i.baseLanes|n,t.memoizedState=null):s=n,et(Ta,os),os|=s;return Dn(e,t,r,n),t.child}function uN(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Jg(e,t,n,s,r){var i=Jn(n)?Io:Cn.current;return i=tl(t,i),Ia(t,r),n=Ay(e,t,n,s,i,r),s=Oy(),e!==null&&!Xn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,qr(e,t,r)):(ot&&s&&Sy(t),t.flags|=1,Dn(e,t,n,r),t.child)}function v_(e,t,n,s,r){if(Jn(n)){var i=!0;Vh(t)}else i=!1;if(Ia(t,r),t.stateNode===null)hh(e,t),iN(t,n,s),Qg(t,n,s,r),s=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Ts(u):(u=Jn(n)?Io:Cn.current,u=tl(t,u));var d=n.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==s||c!==u)&&h_(t,o,s,u),ci=!1;var p=t.memoizedState;o.state=p,Jh(t,s,o,r),c=t.memoizedState,a!==s||p!==c||Gn.current||ci?(typeof d=="function"&&(Xg(t,n,d,s),c=t.memoizedState),(a=ci||d_(t,n,a,s,p,c,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=c),o.props=s,o.state=c,o.context=u,s=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{o=t.stateNode,F2(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Os(t.type,a),o.props=u,h=t.pendingProps,p=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=Ts(c):(c=Jn(n)?Io:Cn.current,c=tl(t,c));var f=n.getDerivedStateFromProps;(d=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||p!==c)&&h_(t,o,s,c),ci=!1,p=t.memoizedState,o.state=p,Jh(t,s,o,r);var m=t.memoizedState;a!==h||p!==m||Gn.current||ci?(typeof f=="function"&&(Xg(t,n,f,s),m=t.memoizedState),(u=ci||d_(t,n,u,s,p,m,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(s,m,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(s,m,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=m),o.props=s,o.state=m,o.context=c,s=u):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),s=!1)}return Zg(e,t,n,s,i,r)}function Zg(e,t,n,s,r,i){uN(e,t);var o=(t.flags&128)!==0;if(!s&&!o)return r&&s_(t,n,!1),qr(e,t,i);s=t.stateNode,MR.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&o?(t.child=sl(t,e.child,null,i),t.child=sl(t,null,a,i)):Dn(e,t,a,i),t.memoizedState=s.state,r&&s_(t,n,!0),t.child}function dN(e){var t=e.stateNode;t.pendingContext?n_(e,t.pendingContext,t.pendingContext!==t.context):t.context&&n_(e,t.context,!1),Ry(e,t.containerInfo)}function y_(e,t,n,s,r){return nl(),Cy(r),t.flags|=256,Dn(e,t,n,s),t.child}var ex={dehydrated:null,treeContext:null,retryLane:0};function tx(e){return{baseLanes:e,cachePool:null,transitions:null}}function hN(e,t,n){var s=t.pendingProps,r=ut.current,i=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(r&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(r|=1),et(ut,r&1),e===null)return Vg(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=s.children,e=s.fallback,i?(s=t.mode,i=t.child,o={mode:"hidden",children:o},!(s&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Xf(o,s,0,null),e=Mo(e,s,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=tx(n),t.memoizedState=ex,e):By(t,o));if(r=e.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return LR(e,t,o,s,a,r,n);if(i){i=s.fallback,o=t.mode,r=e.child,a=r.sibling;var c={mode:"hidden",children:s.children};return!(o&1)&&t.child!==r?(s=t.child,s.childLanes=0,s.pendingProps=c,t.deletions=null):(s=Bi(r,c),s.subtreeFlags=r.subtreeFlags&14680064),a!==null?i=Bi(a,i):(i=Mo(i,o,n,null),i.flags|=2),i.return=t,s.return=t,s.sibling=i,t.child=s,s=i,i=t.child,o=e.child.memoizedState,o=o===null?tx(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=ex,s}return i=e.child,e=i.sibling,s=Bi(i,{mode:"visible",children:s.children}),!(t.mode&1)&&(s.lanes=n),s.return=t,s.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=s,t.memoizedState=null,s}function By(e,t){return t=Xf({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ud(e,t,n,s){return s!==null&&Cy(s),sl(t,e.child,null,n),e=By(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function LR(e,t,n,s,r,i,o){if(n)return t.flags&256?(t.flags&=-257,s=nm(Error(te(422))),ud(e,t,o,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=s.fallback,r=t.mode,s=Xf({mode:"visible",children:s.children},r,0,null),i=Mo(i,r,o,null),i.flags|=2,s.return=t,i.return=t,s.sibling=i,t.child=s,t.mode&1&&sl(t,e.child,null,o),t.child.memoizedState=tx(o),t.memoizedState=ex,i);if(!(t.mode&1))return ud(e,t,o,null);if(r.data==="$!"){if(s=r.nextSibling&&r.nextSibling.dataset,s)var a=s.dgst;return s=a,i=Error(te(419)),s=nm(i,s,void 0),ud(e,t,o,s)}if(a=(o&e.childLanes)!==0,Xn||a){if(s=tn,s!==null){switch(o&-o){case 4:r=2;break;case 16:r=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(s.suspendedLanes|o)?0:r,r!==0&&r!==i.retryLane&&(i.retryLane=r,Ur(e,r),Ws(s,e,r,-1))}return qy(),s=nm(Error(te(421))),ud(e,t,o,s)}return r.data==="$?"?(t.flags|=128,t.child=e.child,t=VR.bind(null,e),r._reactRetry=t,null):(e=i.treeContext,as=Ai(r.nextSibling),ls=t,ot=!0,$s=null,e!==null&&(ws[Ss++]=Or,ws[Ss++]=Ir,ws[Ss++]=Fo,Or=e.id,Ir=e.overflow,Fo=t),t=By(t,s.children),t.flags|=4096,t)}function b_(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Yg(e.return,t,n)}function sm(e,t,n,s,r){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:r}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=s,i.tail=n,i.tailMode=r)}function fN(e,t,n){var s=t.pendingProps,r=s.revealOrder,i=s.tail;if(Dn(e,t,s.children,n),s=ut.current,s&2)s=s&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&b_(e,n,t);else if(e.tag===19)b_(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(et(ut,s),!(t.mode&1))t.memoizedState=null;else switch(r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&Zh(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),sm(t,!1,r,n,i);break;case"backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Zh(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}sm(t,!0,n,null,i);break;case"together":sm(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function hh(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function qr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),zo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(te(153));if(t.child!==null){for(e=t.child,n=Bi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Bi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function AR(e,t,n){switch(t.tag){case 3:dN(t),nl();break;case 5:B2(t);break;case 1:Jn(t.type)&&Vh(t);break;case 4:Ry(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,r=t.memoizedProps.value;et(Qh,s._currentValue),s._currentValue=r;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(et(ut,ut.current&1),t.flags|=128,null):n&t.child.childLanes?hN(e,t,n):(et(ut,ut.current&1),e=qr(e,t,n),e!==null?e.sibling:null);et(ut,ut.current&1);break;case 19:if(s=(n&t.childLanes)!==0,e.flags&128){if(s)return fN(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),et(ut,ut.current),s)break;return null;case 22:case 23:return t.lanes=0,cN(e,t,n)}return qr(e,t,n)}var pN,nx,mN,gN;pN=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};nx=function(){};mN=function(e,t,n,s){var r=e.memoizedProps;if(r!==s){e=t.stateNode,vo(dr.current);var i=null;switch(n){case"input":r=kg(e,r),s=kg(e,s),i=[];break;case"select":r=ht({},r,{value:void 0}),s=ht({},s,{value:void 0}),i=[];break;case"textarea":r=jg(e,r),s=jg(e,s),i=[];break;default:typeof r.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=qh)}Pg(n,s);var o;n=null;for(u in r)if(!s.hasOwnProperty(u)&&r.hasOwnProperty(u)&&r[u]!=null)if(u==="style"){var a=r[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Hc.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in s){var c=s[u];if(a=r!=null?r[u]:void 0,s.hasOwnProperty(u)&&c!==a&&(c!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&a[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,a=a?a.__html:void 0,c!=null&&a!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Hc.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&nt("scroll",e),i||a===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};gN=function(e,t,n,s){n!==s&&(t.flags|=4)};function zl(e,t){if(!ot)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function xn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags&14680064,s|=r.flags&14680064,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function OR(e,t,n){var s=t.pendingProps;switch(ky(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xn(t),null;case 1:return Jn(t.type)&&Kh(),xn(t),null;case 3:return s=t.stateNode,rl(),rt(Gn),rt(Cn),My(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(ld(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,$s!==null&&(ux($s),$s=null))),nx(e,t),xn(t),null;case 5:Dy(t);var r=vo(eu.current);if(n=t.type,e!==null&&t.stateNode!=null)mN(e,t,n,s,r),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(te(166));return xn(t),null}if(e=vo(dr.current),ld(t)){s=t.stateNode,n=t.type;var i=t.memoizedProps;switch(s[ar]=t,s[Jc]=i,e=(t.mode&1)!==0,n){case"dialog":nt("cancel",s),nt("close",s);break;case"iframe":case"object":case"embed":nt("load",s);break;case"video":case"audio":for(r=0;r<lc.length;r++)nt(lc[r],s);break;case"source":nt("error",s);break;case"img":case"image":case"link":nt("error",s),nt("load",s);break;case"details":nt("toggle",s);break;case"input":Pb(s,i),nt("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!i.multiple},nt("invalid",s);break;case"textarea":Rb(s,i),nt("invalid",s)}Pg(n,i),r=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?s.textContent!==a&&(i.suppressHydrationWarning!==!0&&ad(s.textContent,a,e),r=["children",a]):typeof a=="number"&&s.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&ad(s.textContent,a,e),r=["children",""+a]):Hc.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&nt("scroll",s)}switch(n){case"input":Zu(s),Tb(s,i,!0);break;case"textarea":Zu(s),Db(s);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(s.onclick=qh)}s=r,t.updateQueue=s,s!==null&&(t.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=UC(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=o.createElement(n,{is:s.is}):(e=o.createElement(n),n==="select"&&(o=e,s.multiple?o.multiple=!0:s.size&&(o.size=s.size))):e=o.createElementNS(e,n),e[ar]=t,e[Jc]=s,pN(e,t,!1,!1),t.stateNode=e;e:{switch(o=Tg(n,s),n){case"dialog":nt("cancel",e),nt("close",e),r=s;break;case"iframe":case"object":case"embed":nt("load",e),r=s;break;case"video":case"audio":for(r=0;r<lc.length;r++)nt(lc[r],e);r=s;break;case"source":nt("error",e),r=s;break;case"img":case"image":case"link":nt("error",e),nt("load",e),r=s;break;case"details":nt("toggle",e),r=s;break;case"input":Pb(e,s),r=kg(e,s),nt("invalid",e);break;case"option":r=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},r=ht({},s,{value:void 0}),nt("invalid",e);break;case"textarea":Rb(e,s),r=jg(e,s),nt("invalid",e);break;default:r=s}Pg(n,r),a=r;for(i in a)if(a.hasOwnProperty(i)){var c=a[i];i==="style"?VC(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&qC(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Wc(e,c):typeof c=="number"&&Wc(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Hc.hasOwnProperty(i)?c!=null&&i==="onScroll"&&nt("scroll",e):c!=null&&cy(e,i,c,o))}switch(n){case"input":Zu(e),Tb(e,s,!1);break;case"textarea":Zu(e),Db(e);break;case"option":s.value!=null&&e.setAttribute("value",""+qi(s.value));break;case"select":e.multiple=!!s.multiple,i=s.value,i!=null?Ma(e,!!s.multiple,i,!1):s.defaultValue!=null&&Ma(e,!!s.multiple,s.defaultValue,!0);break;default:typeof r.onClick=="function"&&(e.onclick=qh)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return xn(t),null;case 6:if(e&&t.stateNode!=null)gN(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(te(166));if(n=vo(eu.current),vo(dr.current),ld(t)){if(s=t.stateNode,n=t.memoizedProps,s[ar]=t,(i=s.nodeValue!==n)&&(e=ls,e!==null))switch(e.tag){case 3:ad(s.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ad(s.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[ar]=t,t.stateNode=s}return xn(t),null;case 13:if(rt(ut),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ot&&as!==null&&t.mode&1&&!(t.flags&128))L2(),nl(),t.flags|=98560,i=!1;else if(i=ld(t),s!==null&&s.dehydrated!==null){if(e===null){if(!i)throw Error(te(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(te(317));i[ar]=t}else nl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;xn(t),i=!1}else $s!==null&&(ux($s),$s=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,t.mode&1&&(e===null||ut.current&1?Ht===0&&(Ht=3):qy())),t.updateQueue!==null&&(t.flags|=4),xn(t),null);case 4:return rl(),nx(e,t),e===null&&Qc(t.stateNode.containerInfo),xn(t),null;case 10:return Ey(t.type._context),xn(t),null;case 17:return Jn(t.type)&&Kh(),xn(t),null;case 19:if(rt(ut),i=t.memoizedState,i===null)return xn(t),null;if(s=(t.flags&128)!==0,o=i.rendering,o===null)if(s)zl(i,!1);else{if(Ht!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Zh(e),o!==null){for(t.flags|=128,zl(i,!1),s=o.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=n,n=t.child;n!==null;)i=n,e=s,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return et(ut,ut.current&1|2),t.child}e=e.sibling}i.tail!==null&&Ct()>ol&&(t.flags|=128,s=!0,zl(i,!1),t.lanes=4194304)}else{if(!s)if(e=Zh(o),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),zl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ot)return xn(t),null}else 2*Ct()-i.renderingStartTime>ol&&n!==1073741824&&(t.flags|=128,s=!0,zl(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Ct(),t.sibling=null,n=ut.current,et(ut,s?n&1|2:n&1),t):(xn(t),null);case 22:case 23:return Uy(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?os&1073741824&&(xn(t),t.subtreeFlags&6&&(t.flags|=8192)):xn(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function IR(e,t){switch(ky(t),t.tag){case 1:return Jn(t.type)&&Kh(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rl(),rt(Gn),rt(Cn),My(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Dy(t),null;case 13:if(rt(ut),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));nl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return rt(ut),null;case 4:return rl(),null;case 10:return Ey(t.type._context),null;case 22:case 23:return Uy(),null;case 24:return null;default:return null}}var dd=!1,wn=!1,FR=typeof WeakSet=="function"?WeakSet:Set,ce=null;function Pa(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){xt(e,t,s)}else n.current=null}function sx(e,t,n){try{n()}catch(s){xt(e,t,s)}}var __=!1;function BR(e,t){if(zg=Hh,e=_2(),wy(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var r=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,c=-1,u=0,d=0,h=e,p=null;t:for(;;){for(var f;h!==n||r!==0&&h.nodeType!==3||(a=o+r),h!==i||s!==0&&h.nodeType!==3||(c=o+s),h.nodeType===3&&(o+=h.nodeValue.length),(f=h.firstChild)!==null;)p=h,h=f;for(;;){if(h===e)break t;if(p===n&&++u===r&&(a=o),p===i&&++d===s&&(c=o),(f=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=f}n=a===-1||c===-1?null:{start:a,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for($g={focusedElem:e,selectionRange:n},Hh=!1,ce=t;ce!==null;)if(t=ce,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ce=e;else for(;ce!==null;){t=ce;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,y=m.memoizedState,x=t.stateNode,b=x.getSnapshotBeforeUpdate(t.elementType===t.type?g:Os(t.type,g),y);x.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var _=t.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(S){xt(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,ce=e;break}ce=t.return}return m=__,__=!1,m}function Cc(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var r=s=s.next;do{if((r.tag&e)===e){var i=r.destroy;r.destroy=void 0,i!==void 0&&sx(t,n,i)}r=r.next}while(r!==s)}}function Vf(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function rx(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function xN(e){var t=e.alternate;t!==null&&(e.alternate=null,xN(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ar],delete t[Jc],delete t[Ug],delete t[_R],delete t[wR])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function vN(e){return e.tag===5||e.tag===3||e.tag===4}function w_(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vN(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ix(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=qh));else if(s!==4&&(e=e.child,e!==null))for(ix(e,t,n),e=e.sibling;e!==null;)ix(e,t,n),e=e.sibling}function ox(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(ox(e,t,n),e=e.sibling;e!==null;)ox(e,t,n),e=e.sibling}var ln=null,Bs=!1;function Zr(e,t,n){for(n=n.child;n!==null;)yN(e,t,n),n=n.sibling}function yN(e,t,n){if(ur&&typeof ur.onCommitFiberUnmount=="function")try{ur.onCommitFiberUnmount(Bf,n)}catch{}switch(n.tag){case 5:wn||Pa(n,t);case 6:var s=ln,r=Bs;ln=null,Zr(e,t,n),ln=s,Bs=r,ln!==null&&(Bs?(e=ln,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ln.removeChild(n.stateNode));break;case 18:ln!==null&&(Bs?(e=ln,n=n.stateNode,e.nodeType===8?Qp(e.parentNode,n):e.nodeType===1&&Qp(e,n),Vc(e)):Qp(ln,n.stateNode));break;case 4:s=ln,r=Bs,ln=n.stateNode.containerInfo,Bs=!0,Zr(e,t,n),ln=s,Bs=r;break;case 0:case 11:case 14:case 15:if(!wn&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){r=s=s.next;do{var i=r,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&sx(n,t,o),r=r.next}while(r!==s)}Zr(e,t,n);break;case 1:if(!wn&&(Pa(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(a){xt(n,t,a)}Zr(e,t,n);break;case 21:Zr(e,t,n);break;case 22:n.mode&1?(wn=(s=wn)||n.memoizedState!==null,Zr(e,t,n),wn=s):Zr(e,t,n);break;default:Zr(e,t,n)}}function S_(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new FR),t.forEach(function(s){var r=YR.bind(null,e,s);n.has(s)||(n.add(s),s.then(r,r))})}}function Ds(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var r=n[s];try{var i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:ln=a.stateNode,Bs=!1;break e;case 3:ln=a.stateNode.containerInfo,Bs=!0;break e;case 4:ln=a.stateNode.containerInfo,Bs=!0;break e}a=a.return}if(ln===null)throw Error(te(160));yN(i,o,r),ln=null,Bs=!1;var c=r.alternate;c!==null&&(c.return=null),r.return=null}catch(u){xt(r,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)bN(t,e),t=t.sibling}function bN(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ds(t,e),Ys(e),s&4){try{Cc(3,e,e.return),Vf(3,e)}catch(g){xt(e,e.return,g)}try{Cc(5,e,e.return)}catch(g){xt(e,e.return,g)}}break;case 1:Ds(t,e),Ys(e),s&512&&n!==null&&Pa(n,n.return);break;case 5:if(Ds(t,e),Ys(e),s&512&&n!==null&&Pa(n,n.return),e.flags&32){var r=e.stateNode;try{Wc(r,"")}catch(g){xt(e,e.return,g)}}if(s&4&&(r=e.stateNode,r!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,a=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&HC(r,i),Tg(a,o);var u=Tg(a,i);for(o=0;o<c.length;o+=2){var d=c[o],h=c[o+1];d==="style"?VC(r,h):d==="dangerouslySetInnerHTML"?qC(r,h):d==="children"?Wc(r,h):cy(r,d,h,u)}switch(a){case"input":Cg(r,i);break;case"textarea":WC(r,i);break;case"select":var p=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!i.multiple;var f=i.value;f!=null?Ma(r,!!i.multiple,f,!1):p!==!!i.multiple&&(i.defaultValue!=null?Ma(r,!!i.multiple,i.defaultValue,!0):Ma(r,!!i.multiple,i.multiple?[]:"",!1))}r[Jc]=i}catch(g){xt(e,e.return,g)}}break;case 6:if(Ds(t,e),Ys(e),s&4){if(e.stateNode===null)throw Error(te(162));r=e.stateNode,i=e.memoizedProps;try{r.nodeValue=i}catch(g){xt(e,e.return,g)}}break;case 3:if(Ds(t,e),Ys(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Vc(t.containerInfo)}catch(g){xt(e,e.return,g)}break;case 4:Ds(t,e),Ys(e);break;case 13:Ds(t,e),Ys(e),r=e.child,r.flags&8192&&(i=r.memoizedState!==null,r.stateNode.isHidden=i,!i||r.alternate!==null&&r.alternate.memoizedState!==null||(Hy=Ct())),s&4&&S_(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(wn=(u=wn)||d,Ds(t,e),wn=u):Ds(t,e),Ys(e),s&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(ce=e,d=e.child;d!==null;){for(h=ce=d;ce!==null;){switch(p=ce,f=p.child,p.tag){case 0:case 11:case 14:case 15:Cc(4,p,p.return);break;case 1:Pa(p,p.return);var m=p.stateNode;if(typeof m.componentWillUnmount=="function"){s=p,n=p.return;try{t=s,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(g){xt(s,n,g)}}break;case 5:Pa(p,p.return);break;case 22:if(p.memoizedState!==null){C_(h);continue}}f!==null?(f.return=p,ce=f):C_(h)}d=d.sibling}e:for(d=null,h=e;;){if(h.tag===5){if(d===null){d=h;try{r=h.stateNode,u?(i=r.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,a.style.display=KC("display",o))}catch(g){xt(e,e.return,g)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(g){xt(e,e.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Ds(t,e),Ys(e),s&4&&S_(e);break;case 21:break;default:Ds(t,e),Ys(e)}}function Ys(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(vN(n)){var s=n;break e}n=n.return}throw Error(te(160))}switch(s.tag){case 5:var r=s.stateNode;s.flags&32&&(Wc(r,""),s.flags&=-33);var i=w_(e);ox(e,i,r);break;case 3:case 4:var o=s.stateNode.containerInfo,a=w_(e);ix(e,a,o);break;default:throw Error(te(161))}}catch(c){xt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function zR(e,t,n){ce=e,_N(e)}function _N(e,t,n){for(var s=(e.mode&1)!==0;ce!==null;){var r=ce,i=r.child;if(r.tag===22&&s){var o=r.memoizedState!==null||dd;if(!o){var a=r.alternate,c=a!==null&&a.memoizedState!==null||wn;a=dd;var u=wn;if(dd=o,(wn=c)&&!u)for(ce=r;ce!==null;)o=ce,c=o.child,o.tag===22&&o.memoizedState!==null?N_(r):c!==null?(c.return=o,ce=c):N_(r);for(;i!==null;)ce=i,_N(i),i=i.sibling;ce=r,dd=a,wn=u}k_(e)}else r.subtreeFlags&8772&&i!==null?(i.return=r,ce=i):k_(e)}}function k_(e){for(;ce!==null;){var t=ce;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:wn||Vf(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!wn)if(n===null)s.componentDidMount();else{var r=t.elementType===t.type?n.memoizedProps:Os(t.type,n.memoizedProps);s.componentDidUpdate(r,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&l_(t,i,s);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}l_(t,o,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&Vc(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}wn||t.flags&512&&rx(t)}catch(p){xt(t,t.return,p)}}if(t===e){ce=null;break}if(n=t.sibling,n!==null){n.return=t.return,ce=n;break}ce=t.return}}function C_(e){for(;ce!==null;){var t=ce;if(t===e){ce=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ce=n;break}ce=t.return}}function N_(e){for(;ce!==null;){var t=ce;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Vf(4,t)}catch(c){xt(t,n,c)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var r=t.return;try{s.componentDidMount()}catch(c){xt(t,r,c)}}var i=t.return;try{rx(t)}catch(c){xt(t,i,c)}break;case 5:var o=t.return;try{rx(t)}catch(c){xt(t,o,c)}}}catch(c){xt(t,t.return,c)}if(t===e){ce=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ce=a;break}ce=t.return}}var $R=Math.ceil,nf=Yr.ReactCurrentDispatcher,zy=Yr.ReactCurrentOwner,Es=Yr.ReactCurrentBatchConfig,ze=0,tn=null,Dt=null,hn=0,os=0,Ta=Gi(0),Ht=0,ru=null,zo=0,Yf=0,$y=0,Nc=null,Vn=null,Hy=0,ol=1/0,jr=null,sf=!1,ax=null,Ii=null,hd=!1,Ci=null,rf=0,jc=0,lx=null,fh=-1,ph=0;function An(){return ze&6?Ct():fh!==-1?fh:fh=Ct()}function Fi(e){return e.mode&1?ze&2&&hn!==0?hn&-hn:kR.transition!==null?(ph===0&&(ph=i2()),ph):(e=Ke,e!==0||(e=window.event,e=e===void 0?16:h2(e.type)),e):1}function Ws(e,t,n,s){if(50<jc)throw jc=0,lx=null,Error(te(185));Pu(e,n,s),(!(ze&2)||e!==tn)&&(e===tn&&(!(ze&2)&&(Yf|=n),Ht===4&&fi(e,hn)),Zn(e,s),n===1&&ze===0&&!(t.mode&1)&&(ol=Ct()+500,Uf&&Ji()))}function Zn(e,t){var n=e.callbackNode;kT(e,t);var s=$h(e,e===tn?hn:0);if(s===0)n!==null&&Ab(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&Ab(n),t===1)e.tag===0?SR(j_.bind(null,e)):R2(j_.bind(null,e)),yR(function(){!(ze&6)&&Ji()}),n=null;else{switch(o2(s)){case 1:n=py;break;case 4:n=s2;break;case 16:n=zh;break;case 536870912:n=r2;break;default:n=zh}n=PN(n,wN.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function wN(e,t){if(fh=-1,ph=0,ze&6)throw Error(te(327));var n=e.callbackNode;if(Fa()&&e.callbackNode!==n)return null;var s=$h(e,e===tn?hn:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=of(e,s);else{t=s;var r=ze;ze|=2;var i=kN();(tn!==e||hn!==t)&&(jr=null,ol=Ct()+500,Do(e,t));do try{UR();break}catch(a){SN(e,a)}while(!0);jy(),nf.current=i,ze=r,Dt!==null?t=0:(tn=null,hn=0,t=Ht)}if(t!==0){if(t===2&&(r=Ag(e),r!==0&&(s=r,t=cx(e,r))),t===1)throw n=ru,Do(e,0),fi(e,s),Zn(e,Ct()),n;if(t===6)fi(e,s);else{if(r=e.current.alternate,!(s&30)&&!HR(r)&&(t=of(e,s),t===2&&(i=Ag(e),i!==0&&(s=i,t=cx(e,i))),t===1))throw n=ru,Do(e,0),fi(e,s),Zn(e,Ct()),n;switch(e.finishedWork=r,e.finishedLanes=s,t){case 0:case 1:throw Error(te(345));case 2:lo(e,Vn,jr);break;case 3:if(fi(e,s),(s&130023424)===s&&(t=Hy+500-Ct(),10<t)){if($h(e,0)!==0)break;if(r=e.suspendedLanes,(r&s)!==s){An(),e.pingedLanes|=e.suspendedLanes&r;break}e.timeoutHandle=Wg(lo.bind(null,e,Vn,jr),t);break}lo(e,Vn,jr);break;case 4:if(fi(e,s),(s&4194240)===s)break;for(t=e.eventTimes,r=-1;0<s;){var o=31-Hs(s);i=1<<o,o=t[o],o>r&&(r=o),s&=~i}if(s=r,s=Ct()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*$R(s/1960))-s,10<s){e.timeoutHandle=Wg(lo.bind(null,e,Vn,jr),s);break}lo(e,Vn,jr);break;case 5:lo(e,Vn,jr);break;default:throw Error(te(329))}}}return Zn(e,Ct()),e.callbackNode===n?wN.bind(null,e):null}function cx(e,t){var n=Nc;return e.current.memoizedState.isDehydrated&&(Do(e,t).flags|=256),e=of(e,t),e!==2&&(t=Vn,Vn=n,t!==null&&ux(t)),e}function ux(e){Vn===null?Vn=e:Vn.push.apply(Vn,e)}function HR(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var r=n[s],i=r.getSnapshot;r=r.value;try{if(!qs(i(),r))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function fi(e,t){for(t&=~$y,t&=~Yf,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Hs(t),s=1<<n;e[n]=-1,t&=~s}}function j_(e){if(ze&6)throw Error(te(327));Fa();var t=$h(e,0);if(!(t&1))return Zn(e,Ct()),null;var n=of(e,t);if(e.tag!==0&&n===2){var s=Ag(e);s!==0&&(t=s,n=cx(e,s))}if(n===1)throw n=ru,Do(e,0),fi(e,t),Zn(e,Ct()),n;if(n===6)throw Error(te(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,lo(e,Vn,jr),Zn(e,Ct()),null}function Wy(e,t){var n=ze;ze|=1;try{return e(t)}finally{ze=n,ze===0&&(ol=Ct()+500,Uf&&Ji())}}function $o(e){Ci!==null&&Ci.tag===0&&!(ze&6)&&Fa();var t=ze;ze|=1;var n=Es.transition,s=Ke;try{if(Es.transition=null,Ke=1,e)return e()}finally{Ke=s,Es.transition=n,ze=t,!(ze&6)&&Ji()}}function Uy(){os=Ta.current,rt(Ta)}function Do(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,vR(n)),Dt!==null)for(n=Dt.return;n!==null;){var s=n;switch(ky(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Kh();break;case 3:rl(),rt(Gn),rt(Cn),My();break;case 5:Dy(s);break;case 4:rl();break;case 13:rt(ut);break;case 19:rt(ut);break;case 10:Ey(s.type._context);break;case 22:case 23:Uy()}n=n.return}if(tn=e,Dt=e=Bi(e.current,null),hn=os=t,Ht=0,ru=null,$y=Yf=zo=0,Vn=Nc=null,xo!==null){for(t=0;t<xo.length;t++)if(n=xo[t],s=n.interleaved,s!==null){n.interleaved=null;var r=s.next,i=n.pending;if(i!==null){var o=i.next;i.next=r,s.next=o}n.pending=s}xo=null}return e}function SN(e,t){do{var n=Dt;try{if(jy(),uh.current=tf,ef){for(var s=dt.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}ef=!1}if(Bo=0,Qt=Ft=dt=null,kc=!1,tu=0,zy.current=null,n===null||n.return===null){Ht=1,ru=t,Dt=null;break}e:{var i=e,o=n.return,a=n,c=t;if(t=hn,a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=a,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var f=p_(o);if(f!==null){f.flags&=-257,m_(f,o,a,i,t),f.mode&1&&f_(i,u,t),t=f,c=u;var m=t.updateQueue;if(m===null){var g=new Set;g.add(c),t.updateQueue=g}else m.add(c);break e}else{if(!(t&1)){f_(i,u,t),qy();break e}c=Error(te(426))}}else if(ot&&a.mode&1){var y=p_(o);if(y!==null){!(y.flags&65536)&&(y.flags|=256),m_(y,o,a,i,t),Cy(il(c,a));break e}}i=c=il(c,a),Ht!==4&&(Ht=2),Nc===null?Nc=[i]:Nc.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=oN(i,c,t);a_(i,x);break e;case 1:a=c;var b=i.type,_=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(Ii===null||!Ii.has(_)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=aN(i,a,t);a_(i,S);break e}}i=i.return}while(i!==null)}NN(n)}catch(C){t=C,Dt===n&&n!==null&&(Dt=n=n.return);continue}break}while(!0)}function kN(){var e=nf.current;return nf.current=tf,e===null?tf:e}function qy(){(Ht===0||Ht===3||Ht===2)&&(Ht=4),tn===null||!(zo&268435455)&&!(Yf&268435455)||fi(tn,hn)}function of(e,t){var n=ze;ze|=2;var s=kN();(tn!==e||hn!==t)&&(jr=null,Do(e,t));do try{WR();break}catch(r){SN(e,r)}while(!0);if(jy(),ze=n,nf.current=s,Dt!==null)throw Error(te(261));return tn=null,hn=0,Ht}function WR(){for(;Dt!==null;)CN(Dt)}function UR(){for(;Dt!==null&&!mT();)CN(Dt)}function CN(e){var t=EN(e.alternate,e,os);e.memoizedProps=e.pendingProps,t===null?NN(e):Dt=t,zy.current=null}function NN(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=IR(n,t),n!==null){n.flags&=32767,Dt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ht=6,Dt=null;return}}else if(n=OR(n,t,os),n!==null){Dt=n;return}if(t=t.sibling,t!==null){Dt=t;return}Dt=t=e}while(t!==null);Ht===0&&(Ht=5)}function lo(e,t,n){var s=Ke,r=Es.transition;try{Es.transition=null,Ke=1,qR(e,t,n,s)}finally{Es.transition=r,Ke=s}return null}function qR(e,t,n,s){do Fa();while(Ci!==null);if(ze&6)throw Error(te(327));n=e.finishedWork;var r=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(te(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(CT(e,i),e===tn&&(Dt=tn=null,hn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||hd||(hd=!0,PN(zh,function(){return Fa(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Es.transition,Es.transition=null;var o=Ke;Ke=1;var a=ze;ze|=4,zy.current=null,BR(e,n),bN(n,e),dR($g),Hh=!!zg,$g=zg=null,e.current=n,zR(n),gT(),ze=a,Ke=o,Es.transition=i}else e.current=n;if(hd&&(hd=!1,Ci=e,rf=r),i=e.pendingLanes,i===0&&(Ii=null),yT(n.stateNode),Zn(e,Ct()),t!==null)for(s=e.onRecoverableError,n=0;n<t.length;n++)r=t[n],s(r.value,{componentStack:r.stack,digest:r.digest});if(sf)throw sf=!1,e=ax,ax=null,e;return rf&1&&e.tag!==0&&Fa(),i=e.pendingLanes,i&1?e===lx?jc++:(jc=0,lx=e):jc=0,Ji(),null}function Fa(){if(Ci!==null){var e=o2(rf),t=Es.transition,n=Ke;try{if(Es.transition=null,Ke=16>e?16:e,Ci===null)var s=!1;else{if(e=Ci,Ci=null,rf=0,ze&6)throw Error(te(331));var r=ze;for(ze|=4,ce=e.current;ce!==null;){var i=ce,o=i.child;if(ce.flags&16){var a=i.deletions;if(a!==null){for(var c=0;c<a.length;c++){var u=a[c];for(ce=u;ce!==null;){var d=ce;switch(d.tag){case 0:case 11:case 15:Cc(8,d,i)}var h=d.child;if(h!==null)h.return=d,ce=h;else for(;ce!==null;){d=ce;var p=d.sibling,f=d.return;if(xN(d),d===u){ce=null;break}if(p!==null){p.return=f,ce=p;break}ce=f}}}var m=i.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var y=g.sibling;g.sibling=null,g=y}while(g!==null)}}ce=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,ce=o;else e:for(;ce!==null;){if(i=ce,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Cc(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,ce=x;break e}ce=i.return}}var b=e.current;for(ce=b;ce!==null;){o=ce;var _=o.child;if(o.subtreeFlags&2064&&_!==null)_.return=o,ce=_;else e:for(o=b;ce!==null;){if(a=ce,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Vf(9,a)}}catch(C){xt(a,a.return,C)}if(a===o){ce=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,ce=S;break e}ce=a.return}}if(ze=r,Ji(),ur&&typeof ur.onPostCommitFiberRoot=="function")try{ur.onPostCommitFiberRoot(Bf,e)}catch{}s=!0}return s}finally{Ke=n,Es.transition=t}}return!1}function E_(e,t,n){t=il(n,t),t=oN(e,t,1),e=Oi(e,t,1),t=An(),e!==null&&(Pu(e,1,t),Zn(e,t))}function xt(e,t,n){if(e.tag===3)E_(e,e,n);else for(;t!==null;){if(t.tag===3){E_(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Ii===null||!Ii.has(s))){e=il(n,e),e=aN(t,e,1),t=Oi(t,e,1),e=An(),t!==null&&(Pu(t,1,e),Zn(t,e));break}}t=t.return}}function KR(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=An(),e.pingedLanes|=e.suspendedLanes&n,tn===e&&(hn&n)===n&&(Ht===4||Ht===3&&(hn&130023424)===hn&&500>Ct()-Hy?Do(e,0):$y|=n),Zn(e,t)}function jN(e,t){t===0&&(e.mode&1?(t=nd,nd<<=1,!(nd&130023424)&&(nd=4194304)):t=1);var n=An();e=Ur(e,t),e!==null&&(Pu(e,t,n),Zn(e,n))}function VR(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),jN(e,n)}function YR(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(te(314))}s!==null&&s.delete(t),jN(e,n)}var EN;EN=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Gn.current)Xn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Xn=!1,AR(e,t,n);Xn=!!(e.flags&131072)}else Xn=!1,ot&&t.flags&1048576&&D2(t,Xh,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;hh(e,t),e=t.pendingProps;var r=tl(t,Cn.current);Ia(t,n),r=Ay(null,t,s,e,r,n);var i=Oy();return t.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Jn(s)?(i=!0,Vh(t)):i=!1,t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,Ty(t),r.updater=Kf,t.stateNode=r,r._reactInternals=t,Qg(t,s,e,n),t=Zg(null,t,s,!0,i,n)):(t.tag=0,ot&&i&&Sy(t),Dn(null,t,r,n),t=t.child),t;case 16:s=t.elementType;e:{switch(hh(e,t),e=t.pendingProps,r=s._init,s=r(s._payload),t.type=s,r=t.tag=QR(s),e=Os(s,e),r){case 0:t=Jg(null,t,s,e,n);break e;case 1:t=v_(null,t,s,e,n);break e;case 11:t=g_(null,t,s,e,n);break e;case 14:t=x_(null,t,s,Os(s.type,e),n);break e}throw Error(te(306,s,""))}return t;case 0:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Os(s,r),Jg(e,t,s,r,n);case 1:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Os(s,r),v_(e,t,s,r,n);case 3:e:{if(dN(t),e===null)throw Error(te(387));s=t.pendingProps,i=t.memoizedState,r=i.element,F2(e,t),Jh(t,s,null,n);var o=t.memoizedState;if(s=o.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){r=il(Error(te(423)),t),t=y_(e,t,s,n,r);break e}else if(s!==r){r=il(Error(te(424)),t),t=y_(e,t,s,n,r);break e}else for(as=Ai(t.stateNode.containerInfo.firstChild),ls=t,ot=!0,$s=null,n=O2(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(nl(),s===r){t=qr(e,t,n);break e}Dn(e,t,s,n)}t=t.child}return t;case 5:return B2(t),e===null&&Vg(t),s=t.type,r=t.pendingProps,i=e!==null?e.memoizedProps:null,o=r.children,Hg(s,r)?o=null:i!==null&&Hg(s,i)&&(t.flags|=32),uN(e,t),Dn(e,t,o,n),t.child;case 6:return e===null&&Vg(t),null;case 13:return hN(e,t,n);case 4:return Ry(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=sl(t,null,s,n):Dn(e,t,s,n),t.child;case 11:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Os(s,r),g_(e,t,s,r,n);case 7:return Dn(e,t,t.pendingProps,n),t.child;case 8:return Dn(e,t,t.pendingProps.children,n),t.child;case 12:return Dn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,r=t.pendingProps,i=t.memoizedProps,o=r.value,et(Qh,s._currentValue),s._currentValue=o,i!==null)if(qs(i.value,o)){if(i.children===r.children&&!Gn.current){t=qr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var c=a.firstContext;c!==null;){if(c.context===s){if(i.tag===1){c=Br(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Yg(i.return,n,t),a.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(te(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Yg(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Dn(e,t,r.children,n),t=t.child}return t;case 9:return r=t.type,s=t.pendingProps.children,Ia(t,n),r=Ts(r),s=s(r),t.flags|=1,Dn(e,t,s,n),t.child;case 14:return s=t.type,r=Os(s,t.pendingProps),r=Os(s.type,r),x_(e,t,s,r,n);case 15:return lN(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Os(s,r),hh(e,t),t.tag=1,Jn(s)?(e=!0,Vh(t)):e=!1,Ia(t,n),iN(t,s,r),Qg(t,s,r,n),Zg(null,t,s,!0,e,n);case 19:return fN(e,t,n);case 22:return cN(e,t,n)}throw Error(te(156,t.tag))};function PN(e,t){return n2(e,t)}function XR(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ns(e,t,n,s){return new XR(e,t,n,s)}function Ky(e){return e=e.prototype,!(!e||!e.isReactComponent)}function QR(e){if(typeof e=="function")return Ky(e)?1:0;if(e!=null){if(e=e.$$typeof,e===dy)return 11;if(e===hy)return 14}return 2}function Bi(e,t){var n=e.alternate;return n===null?(n=Ns(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function mh(e,t,n,s,r,i){var o=2;if(s=e,typeof e=="function")Ky(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ba:return Mo(n.children,r,i,t);case uy:o=8,r|=8;break;case bg:return e=Ns(12,n,t,r|2),e.elementType=bg,e.lanes=i,e;case _g:return e=Ns(13,n,t,r),e.elementType=_g,e.lanes=i,e;case wg:return e=Ns(19,n,t,r),e.elementType=wg,e.lanes=i,e;case BC:return Xf(n,r,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case IC:o=10;break e;case FC:o=9;break e;case dy:o=11;break e;case hy:o=14;break e;case li:o=16,s=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=Ns(o,n,t,r),t.elementType=e,t.type=s,t.lanes=i,t}function Mo(e,t,n,s){return e=Ns(7,e,s,t),e.lanes=n,e}function Xf(e,t,n,s){return e=Ns(22,e,s,t),e.elementType=BC,e.lanes=n,e.stateNode={isHidden:!1},e}function rm(e,t,n){return e=Ns(6,e,null,t),e.lanes=n,e}function im(e,t,n){return t=Ns(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function GR(e,t,n,s,r){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Bp(0),this.expirationTimes=Bp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bp(0),this.identifierPrefix=s,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Vy(e,t,n,s,r,i,o,a,c){return e=new GR(e,t,n,a,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ns(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ty(i),e}function JR(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ya,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}function TN(e){if(!e)return Ki;e=e._reactInternals;e:{if(ta(e)!==e||e.tag!==1)throw Error(te(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Jn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(te(171))}if(e.tag===1){var n=e.type;if(Jn(n))return T2(e,n,t)}return t}function RN(e,t,n,s,r,i,o,a,c){return e=Vy(n,s,!0,e,r,i,o,a,c),e.context=TN(null),n=e.current,s=An(),r=Fi(n),i=Br(s,r),i.callback=t??null,Oi(n,i,r),e.current.lanes=r,Pu(e,r,s),Zn(e,s),e}function Qf(e,t,n,s){var r=t.current,i=An(),o=Fi(r);return n=TN(n),t.context===null?t.context=n:t.pendingContext=n,t=Br(i,o),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=Oi(r,t,o),e!==null&&(Ws(e,r,o,i),ch(e,r,o)),o}function af(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function P_(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Yy(e,t){P_(e,t),(e=e.alternate)&&P_(e,t)}function ZR(){return null}var DN=typeof reportError=="function"?reportError:function(e){console.error(e)};function Xy(e){this._internalRoot=e}Gf.prototype.render=Xy.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(te(409));Qf(e,t,null,null)};Gf.prototype.unmount=Xy.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;$o(function(){Qf(null,e,null,null)}),t[Wr]=null}};function Gf(e){this._internalRoot=e}Gf.prototype.unstable_scheduleHydration=function(e){if(e){var t=c2();e={blockedOn:null,target:e,priority:t};for(var n=0;n<hi.length&&t!==0&&t<hi[n].priority;n++);hi.splice(n,0,e),n===0&&d2(e)}};function Qy(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Jf(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function T_(){}function eD(e,t,n,s,r){if(r){if(typeof s=="function"){var i=s;s=function(){var u=af(o);i.call(u)}}var o=RN(t,s,e,0,null,!1,!1,"",T_);return e._reactRootContainer=o,e[Wr]=o.current,Qc(e.nodeType===8?e.parentNode:e),$o(),o}for(;r=e.lastChild;)e.removeChild(r);if(typeof s=="function"){var a=s;s=function(){var u=af(c);a.call(u)}}var c=Vy(e,0,!1,null,null,!1,!1,"",T_);return e._reactRootContainer=c,e[Wr]=c.current,Qc(e.nodeType===8?e.parentNode:e),$o(function(){Qf(t,c,n,s)}),c}function Zf(e,t,n,s,r){var i=n._reactRootContainer;if(i){var o=i;if(typeof r=="function"){var a=r;r=function(){var c=af(o);a.call(c)}}Qf(t,o,e,r)}else o=eD(n,t,e,r,s);return af(o)}a2=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ac(t.pendingLanes);n!==0&&(my(t,n|1),Zn(t,Ct()),!(ze&6)&&(ol=Ct()+500,Ji()))}break;case 13:$o(function(){var s=Ur(e,1);if(s!==null){var r=An();Ws(s,e,1,r)}}),Yy(e,1)}};gy=function(e){if(e.tag===13){var t=Ur(e,134217728);if(t!==null){var n=An();Ws(t,e,134217728,n)}Yy(e,134217728)}};l2=function(e){if(e.tag===13){var t=Fi(e),n=Ur(e,t);if(n!==null){var s=An();Ws(n,e,t,s)}Yy(e,t)}};c2=function(){return Ke};u2=function(e,t){var n=Ke;try{return Ke=e,t()}finally{Ke=n}};Dg=function(e,t,n){switch(t){case"input":if(Cg(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var r=Wf(s);if(!r)throw Error(te(90));$C(s),Cg(s,r)}}}break;case"textarea":WC(e,n);break;case"select":t=n.value,t!=null&&Ma(e,!!n.multiple,t,!1)}};QC=Wy;GC=$o;var tD={usingClientEntryPoint:!1,Events:[Ru,ka,Wf,YC,XC,Wy]},$l={findFiberByHostInstance:go,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},nD={bundleType:$l.bundleType,version:$l.version,rendererPackageName:$l.rendererPackageName,rendererConfig:$l.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Yr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=e2(e),e===null?null:e.stateNode},findFiberByHostInstance:$l.findFiberByHostInstance||ZR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fd.isDisabled&&fd.supportsFiber)try{Bf=fd.inject(nD),ur=fd}catch{}}fs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=tD;fs.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Qy(t))throw Error(te(200));return JR(e,t,null,n)};fs.createRoot=function(e,t){if(!Qy(e))throw Error(te(299));var n=!1,s="",r=DN;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=Vy(e,1,!1,null,null,n,!1,s,r),e[Wr]=t.current,Qc(e.nodeType===8?e.parentNode:e),new Xy(t)};fs.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(te(188)):(e=Object.keys(e).join(","),Error(te(268,e)));return e=e2(t),e=e===null?null:e.stateNode,e};fs.flushSync=function(e){return $o(e)};fs.hydrate=function(e,t,n){if(!Jf(t))throw Error(te(200));return Zf(null,e,t,!0,n)};fs.hydrateRoot=function(e,t,n){if(!Qy(e))throw Error(te(405));var s=n!=null&&n.hydratedSources||null,r=!1,i="",o=DN;if(n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=RN(t,null,e,1,n??null,r,!1,i,o),e[Wr]=t.current,Qc(e),s)for(e=0;e<s.length;e++)n=s[e],r=n._getVersion,r=r(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,r]:t.mutableSourceEagerHydrationData.push(n,r);return new Gf(t)};fs.render=function(e,t,n){if(!Jf(t))throw Error(te(200));return Zf(null,e,t,!1,n)};fs.unmountComponentAtNode=function(e){if(!Jf(e))throw Error(te(40));return e._reactRootContainer?($o(function(){Zf(null,null,e,!1,function(){e._reactRootContainer=null,e[Wr]=null})}),!0):!1};fs.unstable_batchedUpdates=Wy;fs.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!Jf(n))throw Error(te(200));if(e==null||e._reactInternals===void 0)throw Error(te(38));return Zf(e,t,n,!1,s)};fs.version="18.3.1-next-f1338f8080-20240426";function MN(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(MN)}catch(e){console.error(e)}}MN(),MC.exports=fs;var js=MC.exports;const LN=ml(js);var R_=js;vg.createRoot=R_.createRoot,vg.hydrateRoot=R_.hydrateRoot;var yl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},sD={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},mi,ty,lC,rD=(lC=class{constructor(){me(this,mi,sD);me(this,ty,!1)}setTimeoutProvider(e){oe(this,mi,e)}setTimeout(e,t){return A(this,mi).setTimeout(e,t)}clearTimeout(e){A(this,mi).clearTimeout(e)}setInterval(e,t){return A(this,mi).setInterval(e,t)}clearInterval(e){A(this,mi).clearInterval(e)}},mi=new WeakMap,ty=new WeakMap,lC),yo=new rD;function iD(e){setTimeout(e,0)}var Ho=typeof window>"u"||"Deno"in globalThis;function Mn(){}function oD(e,t){return typeof e=="function"?e(t):e}function dx(e){return typeof e=="number"&&e>=0&&e!==1/0}function AN(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zi(e,t){return typeof e=="function"?e(t):e}function ys(e,t){return typeof e=="function"?e(t):e}function D_(e,t){const{type:n="all",exact:s,fetchStatus:r,predicate:i,queryKey:o,stale:a}=e;if(o){if(s){if(t.queryHash!==Gy(o,t.options))return!1}else if(!iu(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||r&&r!==t.state.fetchStatus||i&&!i(t))}function M_(e,t){const{exact:n,status:s,predicate:r,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Wo(t.options.mutationKey)!==Wo(i))return!1}else if(!iu(t.options.mutationKey,i))return!1}return!(s&&t.state.status!==s||r&&!r(t))}function Gy(e,t){return((t==null?void 0:t.queryKeyHashFn)||Wo)(e)}function Wo(e){return JSON.stringify(e,(t,n)=>hx(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):n)}function iu(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>iu(e[n],t[n])):!1}var aD=Object.prototype.hasOwnProperty;function ON(e,t,n=0){if(e===t)return e;if(n>500)return t;const s=L_(e)&&L_(t);if(!s&&!(hx(e)&&hx(t)))return t;const i=(s?e:Object.keys(e)).length,o=s?t:Object.keys(t),a=o.length,c=s?new Array(a):{};let u=0;for(let d=0;d<a;d++){const h=s?d:o[d],p=e[h],f=t[h];if(p===f){c[h]=p,(s?d<i:aD.call(e,h))&&u++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){c[h]=f;continue}const m=ON(p,f,n+1);c[h]=m,m===p&&u++}return i===a&&u===i?e:c}function lf(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function L_(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function hx(e){if(!A_(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!A_(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function A_(e){return Object.prototype.toString.call(e)==="[object Object]"}function lD(e){return new Promise(t=>{yo.setTimeout(t,e)})}function fx(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?ON(e,t):t}function cD(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function uD(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var Jy=Symbol();function IN(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Jy?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Zy(e,t){return typeof e=="function"?e(...t):!!e}function dD(e,t,n){let s=!1,r;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(r??(r=t()),s||(s=!0,r.aborted?n():r.addEventListener("abort",n,{once:!0})),r)}),e}var So,gi,Ha,cC,hD=(cC=class extends yl{constructor(){super();me(this,So);me(this,gi);me(this,Ha);oe(this,Ha,t=>{if(!Ho&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){A(this,gi)||this.setEventListener(A(this,Ha))}onUnsubscribe(){var t;this.hasListeners()||((t=A(this,gi))==null||t.call(this),oe(this,gi,void 0))}setEventListener(t){var n;oe(this,Ha,t),(n=A(this,gi))==null||n.call(this),oe(this,gi,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){A(this,So)!==t&&(oe(this,So,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof A(this,So)=="boolean"?A(this,So):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},So=new WeakMap,gi=new WeakMap,Ha=new WeakMap,cC),e0=new hD;function px(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});n.status="pending",n.catch(()=>{});function s(r){Object.assign(n,r),delete n.resolve,delete n.reject}return n.resolve=r=>{s({status:"fulfilled",value:r}),e(r)},n.reject=r=>{s({status:"rejected",reason:r}),t(r)},n}var fD=iD;function pD(){let e=[],t=0,n=a=>{a()},s=a=>{a()},r=fD;const i=a=>{t?e.push(a):r(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&r(()=>{s(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{s=a},setScheduler:a=>{r=a}}}var $t=pD(),Wa,xi,Ua,uC,mD=(uC=class extends yl{constructor(){super();me(this,Wa,!0);me(this,xi);me(this,Ua);oe(this,Ua,t=>{if(!Ho&&window.addEventListener){const n=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){A(this,xi)||this.setEventListener(A(this,Ua))}onUnsubscribe(){var t;this.hasListeners()||((t=A(this,xi))==null||t.call(this),oe(this,xi,void 0))}setEventListener(t){var n;oe(this,Ua,t),(n=A(this,xi))==null||n.call(this),oe(this,xi,t(this.setOnline.bind(this)))}setOnline(t){A(this,Wa)!==t&&(oe(this,Wa,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return A(this,Wa)}},Wa=new WeakMap,xi=new WeakMap,Ua=new WeakMap,uC),cf=new mD;function gD(e){return Math.min(1e3*2**e,3e4)}function FN(e){return(e??"online")==="online"?cf.isOnline():!0}var mx=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function BN(e){let t=!1,n=0,s;const r=px(),i=()=>r.status!=="pending",o=g=>{var y;if(!i()){const x=new mx(g);p(x),(y=e.onCancel)==null||y.call(e,x)}},a=()=>{t=!0},c=()=>{t=!1},u=()=>e0.isFocused()&&(e.networkMode==="always"||cf.isOnline())&&e.canRun(),d=()=>FN(e.networkMode)&&e.canRun(),h=g=>{i()||(s==null||s(),r.resolve(g))},p=g=>{i()||(s==null||s(),r.reject(g))},f=()=>new Promise(g=>{var y;s=x=>{(i()||u())&&g(x)},(y=e.onPause)==null||y.call(e)}).then(()=>{var g;s=void 0,i()||(g=e.onContinue)==null||g.call(e)}),m=()=>{if(i())return;let g;const y=n===0?e.initialPromise:void 0;try{g=y??e.fn()}catch(x){g=Promise.reject(x)}Promise.resolve(g).then(h).catch(x=>{var w;if(i())return;const b=e.retry??(Ho?0:3),_=e.retryDelay??gD,S=typeof _=="function"?_(n,x):_,C=b===!0||typeof b=="number"&&n<b||typeof b=="function"&&b(n,x);if(t||!C){p(x);return}n++,(w=e.onFail)==null||w.call(e,n,x),lD(S).then(()=>u()?void 0:f()).then(()=>{t?p(x):m()})})};return{promise:r,status:()=>r.status,cancel:o,continue:()=>(s==null||s(),r),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?m():f().then(m),r)}}var ko,dC,zN=(dC=class{constructor(){me(this,ko)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),dx(this.gcTime)&&oe(this,ko,yo.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ho?1/0:5*60*1e3))}clearGcTimeout(){A(this,ko)&&(yo.clearTimeout(A(this,ko)),oe(this,ko,void 0))}},ko=new WeakMap,dC),Co,qa,vs,No,Yt,Su,jo,Is,Cr,hC,xD=(hC=class extends zN{constructor(t){super();me(this,Is);me(this,Co);me(this,qa);me(this,vs);me(this,No);me(this,Yt);me(this,Su);me(this,jo);oe(this,jo,!1),oe(this,Su,t.defaultOptions),this.setOptions(t.options),this.observers=[],oe(this,No,t.client),oe(this,vs,A(this,No).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,oe(this,Co,I_(this.options)),this.state=t.state??A(this,Co),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=A(this,Yt))==null?void 0:t.promise}setOptions(t){if(this.options={...A(this,Su),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=I_(this.options);n.data!==void 0&&(this.setState(O_(n.data,n.dataUpdatedAt)),oe(this,Co,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&A(this,vs).remove(this)}setData(t,n){const s=fx(this.state.data,t,this.options);return Ne(this,Is,Cr).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t,n){Ne(this,Is,Cr).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var s,r;const n=(s=A(this,Yt))==null?void 0:s.promise;return(r=A(this,Yt))==null||r.cancel(t),n?n.then(Mn).catch(Mn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(A(this,Co))}isActive(){return this.observers.some(t=>ys(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Jy||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>zi(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!AN(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=A(this,Yt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=A(this,Yt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),A(this,vs).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(A(this,Yt)&&(A(this,jo)?A(this,Yt).cancel({revert:!0}):A(this,Yt).cancelRetry()),this.scheduleGc()),A(this,vs).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ne(this,Is,Cr).call(this,{type:"invalidate"})}async fetch(t,n){var c,u,d,h,p,f,m,g,y,x,b,_;if(this.state.fetchStatus!=="idle"&&((c=A(this,Yt))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(A(this,Yt))return A(this,Yt).continueRetry(),A(this,Yt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(C=>C.options.queryFn);S&&this.setOptions(S.options)}const s=new AbortController,r=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(oe(this,jo,!0),s.signal)})},i=()=>{const S=IN(this.options,n),w=(()=>{const j={client:A(this,No),queryKey:this.queryKey,meta:this.meta};return r(j),j})();return oe(this,jo,!1),this.options.persister?this.options.persister(S,w,this):S(w)},a=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:A(this,No),state:this.state,fetchFn:i};return r(S),S})();(u=this.options.behavior)==null||u.onFetch(a,this),oe(this,qa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&Ne(this,Is,Cr).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta}),oe(this,Yt,BN({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:S=>{S instanceof mx&&S.revert&&this.setState({...A(this,qa),fetchStatus:"idle"}),s.abort()},onFail:(S,C)=>{Ne(this,Is,Cr).call(this,{type:"failed",failureCount:S,error:C})},onPause:()=>{Ne(this,Is,Cr).call(this,{type:"pause"})},onContinue:()=>{Ne(this,Is,Cr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const S=await A(this,Yt).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(f=(p=A(this,vs).config).onSuccess)==null||f.call(p,S,this),(g=(m=A(this,vs).config).onSettled)==null||g.call(m,S,this.state.error,this),S}catch(S){if(S instanceof mx){if(S.silent)return A(this,Yt).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw Ne(this,Is,Cr).call(this,{type:"error",error:S}),(x=(y=A(this,vs).config).onError)==null||x.call(y,S,this),(_=(b=A(this,vs).config).onSettled)==null||_.call(b,this.state.data,S,this),S}finally{this.scheduleGc()}}},Co=new WeakMap,qa=new WeakMap,vs=new WeakMap,No=new WeakMap,Yt=new WeakMap,Su=new WeakMap,jo=new WeakMap,Is=new WeakSet,Cr=function(t){const n=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...$N(s.data,this.options),fetchMeta:t.meta??null};case"success":const r={...s,...O_(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return oe(this,qa,t.manual?r:void 0),r;case"error":const i=t.error;return{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=n(this.state),$t.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),A(this,vs).notify({query:this,type:"updated",action:t})})},hC);function $N(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:FN(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function O_(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function I_(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Un,Fe,ku,Rn,Eo,Ka,Rr,vi,Cu,Va,Ya,Po,To,yi,Xa,qe,cc,gx,xx,vx,yx,bx,_x,wx,HN,fC,vD=(fC=class extends yl{constructor(t,n){super();me(this,qe);me(this,Un);me(this,Fe);me(this,ku);me(this,Rn);me(this,Eo);me(this,Ka);me(this,Rr);me(this,vi);me(this,Cu);me(this,Va);me(this,Ya);me(this,Po);me(this,To);me(this,yi);me(this,Xa,new Set);this.options=n,oe(this,Un,t),oe(this,vi,null),oe(this,Rr,px()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(A(this,Fe).addObserver(this),F_(A(this,Fe),this.options)?Ne(this,qe,cc).call(this):this.updateResult(),Ne(this,qe,yx).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Sx(A(this,Fe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Sx(A(this,Fe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ne(this,qe,bx).call(this),Ne(this,qe,_x).call(this),A(this,Fe).removeObserver(this)}setOptions(t){const n=this.options,s=A(this,Fe);if(this.options=A(this,Un).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ys(this.options.enabled,A(this,Fe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ne(this,qe,wx).call(this),A(this,Fe).setOptions(this.options),n._defaulted&&!lf(this.options,n)&&A(this,Un).getQueryCache().notify({type:"observerOptionsUpdated",query:A(this,Fe),observer:this});const r=this.hasListeners();r&&B_(A(this,Fe),s,this.options,n)&&Ne(this,qe,cc).call(this),this.updateResult(),r&&(A(this,Fe)!==s||ys(this.options.enabled,A(this,Fe))!==ys(n.enabled,A(this,Fe))||zi(this.options.staleTime,A(this,Fe))!==zi(n.staleTime,A(this,Fe)))&&Ne(this,qe,gx).call(this);const i=Ne(this,qe,xx).call(this);r&&(A(this,Fe)!==s||ys(this.options.enabled,A(this,Fe))!==ys(n.enabled,A(this,Fe))||i!==A(this,yi))&&Ne(this,qe,vx).call(this,i)}getOptimisticResult(t){const n=A(this,Un).getQueryCache().build(A(this,Un),t),s=this.createResult(n,t);return bD(this,s)&&(oe(this,Rn,s),oe(this,Ka,this.options),oe(this,Eo,A(this,Fe).state)),s}getCurrentResult(){return A(this,Rn)}trackResult(t,n){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),n==null||n(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&A(this,Rr).status==="pending"&&A(this,Rr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){A(this,Xa).add(t)}getCurrentQuery(){return A(this,Fe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=A(this,Un).defaultQueryOptions(t),s=A(this,Un).getQueryCache().build(A(this,Un),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return Ne(this,qe,cc).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),A(this,Rn)))}createResult(t,n){var O;const s=A(this,Fe),r=this.options,i=A(this,Rn),o=A(this,Eo),a=A(this,Ka),u=t!==s?t.state:A(this,ku),{state:d}=t;let h={...d},p=!1,f;if(n._optimisticResults){const R=this.hasListeners(),B=!R&&F_(t,n),L=R&&B_(t,s,n,r);(B||L)&&(h={...h,...$N(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:y}=h;f=h.data;let x=!1;if(n.placeholderData!==void 0&&f===void 0&&y==="pending"){let R;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(R=i.data,x=!0):R=typeof n.placeholderData=="function"?n.placeholderData((O=A(this,Ya))==null?void 0:O.state.data,A(this,Ya)):n.placeholderData,R!==void 0&&(y="success",f=fx(i==null?void 0:i.data,R,n),p=!0)}if(n.select&&f!==void 0&&!x)if(i&&f===(o==null?void 0:o.data)&&n.select===A(this,Cu))f=A(this,Va);else try{oe(this,Cu,n.select),f=n.select(f),f=fx(i==null?void 0:i.data,f,n),oe(this,Va,f),oe(this,vi,null)}catch(R){oe(this,vi,R)}A(this,vi)&&(m=A(this,vi),f=A(this,Va),g=Date.now(),y="error");const b=h.fetchStatus==="fetching",_=y==="pending",S=y==="error",C=_&&b,w=f!==void 0,E={status:y,fetchStatus:h.fetchStatus,isPending:_,isSuccess:y==="success",isError:S,isInitialLoading:C,isLoading:C,data:f,dataUpdatedAt:h.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:b,isRefetching:b&&!_,isLoadingError:S&&!w,isPaused:h.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:S&&w,isStale:t0(t,n),refetch:this.refetch,promise:A(this,Rr),isEnabled:ys(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=E.data!==void 0,B=E.status==="error"&&!R,L=P=>{B?P.reject(E.error):R&&P.resolve(E.data)},D=()=>{const P=oe(this,Rr,E.promise=px());L(P)},T=A(this,Rr);switch(T.status){case"pending":t.queryHash===s.queryHash&&L(T);break;case"fulfilled":(B||E.data!==T.value)&&D();break;case"rejected":(!B||E.error!==T.reason)&&D();break}}return E}updateResult(){const t=A(this,Rn),n=this.createResult(A(this,Fe),this.options);if(oe(this,Eo,A(this,Fe).state),oe(this,Ka,this.options),A(this,Eo).data!==void 0&&oe(this,Ya,A(this,Fe)),lf(n,t))return;oe(this,Rn,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!A(this,Xa).size)return!0;const o=new Set(i??A(this,Xa));return this.options.throwOnError&&o.add("error"),Object.keys(A(this,Rn)).some(a=>{const c=a;return A(this,Rn)[c]!==t[c]&&o.has(c)})};Ne(this,qe,HN).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ne(this,qe,yx).call(this)}},Un=new WeakMap,Fe=new WeakMap,ku=new WeakMap,Rn=new WeakMap,Eo=new WeakMap,Ka=new WeakMap,Rr=new WeakMap,vi=new WeakMap,Cu=new WeakMap,Va=new WeakMap,Ya=new WeakMap,Po=new WeakMap,To=new WeakMap,yi=new WeakMap,Xa=new WeakMap,qe=new WeakSet,cc=function(t){Ne(this,qe,wx).call(this);let n=A(this,Fe).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Mn)),n},gx=function(){Ne(this,qe,bx).call(this);const t=zi(this.options.staleTime,A(this,Fe));if(Ho||A(this,Rn).isStale||!dx(t))return;const s=AN(A(this,Rn).dataUpdatedAt,t)+1;oe(this,Po,yo.setTimeout(()=>{A(this,Rn).isStale||this.updateResult()},s))},xx=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(A(this,Fe)):this.options.refetchInterval)??!1},vx=function(t){Ne(this,qe,_x).call(this),oe(this,yi,t),!(Ho||ys(this.options.enabled,A(this,Fe))===!1||!dx(A(this,yi))||A(this,yi)===0)&&oe(this,To,yo.setInterval(()=>{(this.options.refetchIntervalInBackground||e0.isFocused())&&Ne(this,qe,cc).call(this)},A(this,yi)))},yx=function(){Ne(this,qe,gx).call(this),Ne(this,qe,vx).call(this,Ne(this,qe,xx).call(this))},bx=function(){A(this,Po)&&(yo.clearTimeout(A(this,Po)),oe(this,Po,void 0))},_x=function(){A(this,To)&&(yo.clearInterval(A(this,To)),oe(this,To,void 0))},wx=function(){const t=A(this,Un).getQueryCache().build(A(this,Un),this.options);if(t===A(this,Fe))return;const n=A(this,Fe);oe(this,Fe,t),oe(this,ku,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},HN=function(t){$t.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(A(this,Rn))}),A(this,Un).getQueryCache().notify({query:A(this,Fe),type:"observerResultsUpdated"})})},fC);function yD(e,t){return ys(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function F_(e,t){return yD(e,t)||e.state.data!==void 0&&Sx(e,t,t.refetchOnMount)}function Sx(e,t,n){if(ys(t.enabled,e)!==!1&&zi(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&t0(e,t)}return!1}function B_(e,t,n,s){return(e!==t||ys(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&t0(e,n)}function t0(e,t){return ys(t.enabled,e)!==!1&&e.isStaleByTime(zi(t.staleTime,e))}function bD(e,t){return!lf(e.getCurrentResult(),t)}function z_(e){return{onFetch:(t,n)=>{var d,h,p,f,m;const s=t.options,r=(p=(h=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:p.direction,i=((f=t.state.data)==null?void 0:f.pages)||[],o=((m=t.state.data)==null?void 0:m.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let g=!1;const y=_=>{dD(_,()=>t.signal,()=>g=!0)},x=IN(t.options,t.fetchOptions),b=async(_,S,C)=>{if(g)return Promise.reject();if(S==null&&_.pages.length)return Promise.resolve(_);const j=(()=>{const B={client:t.client,queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};return y(B),B})(),E=await x(j),{maxPages:O}=t.options,R=C?uD:cD;return{pages:R(_.pages,E,O),pageParams:R(_.pageParams,S,O)}};if(r&&i.length){const _=r==="backward",S=_?_D:$_,C={pages:i,pageParams:o},w=S(s,C);a=await b(C,w,_)}else{const _=e??i.length;do{const S=c===0?o[0]??s.initialPageParam:$_(s,a);if(c>0&&S==null)break;a=await b(a,S),c++}while(c<_)}return a};t.options.persister?t.fetchFn=()=>{var g,y;return(y=(g=t.options).persister)==null?void 0:y.call(g,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function $_(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function _D(e,{pages:t,pageParams:n}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,n[0],n):void 0}var Nu,rr,bn,Ro,ir,oi,pC,wD=(pC=class extends zN{constructor(t){super();me(this,ir);me(this,Nu);me(this,rr);me(this,bn);me(this,Ro);oe(this,Nu,t.client),this.mutationId=t.mutationId,oe(this,bn,t.mutationCache),oe(this,rr,[]),this.state=t.state||WN(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){A(this,rr).includes(t)||(A(this,rr).push(t),this.clearGcTimeout(),A(this,bn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){oe(this,rr,A(this,rr).filter(n=>n!==t)),this.scheduleGc(),A(this,bn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){A(this,rr).length||(this.state.status==="pending"?this.scheduleGc():A(this,bn).remove(this))}continue(){var t;return((t=A(this,Ro))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,u,d,h,p,f,m,g,y,x,b,_,S,C,w,j;const n=()=>{Ne(this,ir,oi).call(this,{type:"continue"})},s={client:A(this,Nu),meta:this.options.meta,mutationKey:this.options.mutationKey};oe(this,Ro,BN({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(E,O)=>{Ne(this,ir,oi).call(this,{type:"failed",failureCount:E,error:O})},onPause:()=>{Ne(this,ir,oi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>A(this,bn).canRun(this)}));const r=this.state.status==="pending",i=!A(this,Ro).canStart();try{if(r)n();else{Ne(this,ir,oi).call(this,{type:"pending",variables:t,isPaused:i}),A(this,bn).config.onMutate&&await A(this,bn).config.onMutate(t,this,s);const O=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,s));O!==this.state.context&&Ne(this,ir,oi).call(this,{type:"pending",context:O,variables:t,isPaused:i})}const E=await A(this,Ro).start();return await((u=(c=A(this,bn).config).onSuccess)==null?void 0:u.call(c,E,t,this.state.context,this,s)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,E,t,this.state.context,s)),await((f=(p=A(this,bn).config).onSettled)==null?void 0:f.call(p,E,null,this.state.variables,this.state.context,this,s)),await((g=(m=this.options).onSettled)==null?void 0:g.call(m,E,null,t,this.state.context,s)),Ne(this,ir,oi).call(this,{type:"success",data:E}),E}catch(E){try{await((x=(y=A(this,bn).config).onError)==null?void 0:x.call(y,E,t,this.state.context,this,s))}catch(O){Promise.reject(O)}try{await((_=(b=this.options).onError)==null?void 0:_.call(b,E,t,this.state.context,s))}catch(O){Promise.reject(O)}try{await((C=(S=A(this,bn).config).onSettled)==null?void 0:C.call(S,void 0,E,this.state.variables,this.state.context,this,s))}catch(O){Promise.reject(O)}try{await((j=(w=this.options).onSettled)==null?void 0:j.call(w,void 0,E,t,this.state.context,s))}catch(O){Promise.reject(O)}throw Ne(this,ir,oi).call(this,{type:"error",error:E}),E}finally{A(this,bn).runNext(this)}}},Nu=new WeakMap,rr=new WeakMap,bn=new WeakMap,Ro=new WeakMap,ir=new WeakSet,oi=function(t){const n=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),$t.batch(()=>{A(this,rr).forEach(s=>{s.onMutationUpdate(t)}),A(this,bn).notify({mutation:this,type:"updated",action:t})})},pC);function WN(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Dr,Fs,ju,mC,SD=(mC=class extends yl{constructor(t={}){super();me(this,Dr);me(this,Fs);me(this,ju);this.config=t,oe(this,Dr,new Set),oe(this,Fs,new Map),oe(this,ju,0)}build(t,n,s){const r=new wD({client:t,mutationCache:this,mutationId:++Qu(this,ju)._,options:t.defaultMutationOptions(n),state:s});return this.add(r),r}add(t){A(this,Dr).add(t);const n=pd(t);if(typeof n=="string"){const s=A(this,Fs).get(n);s?s.push(t):A(this,Fs).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(A(this,Dr).delete(t)){const n=pd(t);if(typeof n=="string"){const s=A(this,Fs).get(n);if(s)if(s.length>1){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&A(this,Fs).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=pd(t);if(typeof n=="string"){const s=A(this,Fs).get(n),r=s==null?void 0:s.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){var s;const n=pd(t);if(typeof n=="string"){const r=(s=A(this,Fs).get(n))==null?void 0:s.find(i=>i!==t&&i.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){$t.batch(()=>{A(this,Dr).forEach(t=>{this.notify({type:"removed",mutation:t})}),A(this,Dr).clear(),A(this,Fs).clear()})}getAll(){return Array.from(A(this,Dr))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>M_(n,s))}findAll(t={}){return this.getAll().filter(n=>M_(t,n))}notify(t){$t.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return $t.batch(()=>Promise.all(t.map(n=>n.continue().catch(Mn))))}},Dr=new WeakMap,Fs=new WeakMap,ju=new WeakMap,mC);function pd(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Mr,bi,qn,Lr,$r,gh,kx,gC,kD=(gC=class extends yl{constructor(n,s){super();me(this,$r);me(this,Mr);me(this,bi);me(this,qn);me(this,Lr);oe(this,Mr,n),this.setOptions(s),this.bindMethods(),Ne(this,$r,gh).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var r;const s=this.options;this.options=A(this,Mr).defaultMutationOptions(n),lf(this.options,s)||A(this,Mr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:A(this,qn),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Wo(s.mutationKey)!==Wo(this.options.mutationKey)?this.reset():((r=A(this,qn))==null?void 0:r.state.status)==="pending"&&A(this,qn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=A(this,qn))==null||n.removeObserver(this)}onMutationUpdate(n){Ne(this,$r,gh).call(this),Ne(this,$r,kx).call(this,n)}getCurrentResult(){return A(this,bi)}reset(){var n;(n=A(this,qn))==null||n.removeObserver(this),oe(this,qn,void 0),Ne(this,$r,gh).call(this),Ne(this,$r,kx).call(this)}mutate(n,s){var r;return oe(this,Lr,s),(r=A(this,qn))==null||r.removeObserver(this),oe(this,qn,A(this,Mr).getMutationCache().build(A(this,Mr),this.options)),A(this,qn).addObserver(this),A(this,qn).execute(n)}},Mr=new WeakMap,bi=new WeakMap,qn=new WeakMap,Lr=new WeakMap,$r=new WeakSet,gh=function(){var s;const n=((s=A(this,qn))==null?void 0:s.state)??WN();oe(this,bi,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},kx=function(n){$t.batch(()=>{var s,r,i,o,a,c,u,d;if(A(this,Lr)&&this.hasListeners()){const h=A(this,bi).variables,p=A(this,bi).context,f={client:A(this,Mr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(r=(s=A(this,Lr)).onSuccess)==null||r.call(s,n.data,h,p,f)}catch(m){Promise.reject(m)}try{(o=(i=A(this,Lr)).onSettled)==null||o.call(i,n.data,null,h,p,f)}catch(m){Promise.reject(m)}}else if((n==null?void 0:n.type)==="error"){try{(c=(a=A(this,Lr)).onError)==null||c.call(a,n.error,h,p,f)}catch(m){Promise.reject(m)}try{(d=(u=A(this,Lr)).onSettled)==null||d.call(u,void 0,n.error,h,p,f)}catch(m){Promise.reject(m)}}}this.listeners.forEach(h=>{h(A(this,bi))})})},gC),or,xC,CD=(xC=class extends yl{constructor(t={}){super();me(this,or);this.config=t,oe(this,or,new Map)}build(t,n,s){const r=n.queryKey,i=n.queryHash??Gy(r,n);let o=this.get(i);return o||(o=new xD({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(o)),o}add(t){A(this,or).has(t.queryHash)||(A(this,or).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=A(this,or).get(t.queryHash);n&&(t.destroy(),n===t&&A(this,or).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){$t.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return A(this,or).get(t)}getAll(){return[...A(this,or).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>D_(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>D_(t,s)):n}notify(t){$t.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){$t.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){$t.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},or=new WeakMap,xC),mt,_i,wi,Qa,Ga,Si,Ja,Za,vC,ND=(vC=class{constructor(e={}){me(this,mt);me(this,_i);me(this,wi);me(this,Qa);me(this,Ga);me(this,Si);me(this,Ja);me(this,Za);oe(this,mt,e.queryCache||new CD),oe(this,_i,e.mutationCache||new SD),oe(this,wi,e.defaultOptions||{}),oe(this,Qa,new Map),oe(this,Ga,new Map),oe(this,Si,0)}mount(){Qu(this,Si)._++,A(this,Si)===1&&(oe(this,Ja,e0.subscribe(async e=>{e&&(await this.resumePausedMutations(),A(this,mt).onFocus())})),oe(this,Za,cf.subscribe(async e=>{e&&(await this.resumePausedMutations(),A(this,mt).onOnline())})))}unmount(){var e,t;Qu(this,Si)._--,A(this,Si)===0&&((e=A(this,Ja))==null||e.call(this),oe(this,Ja,void 0),(t=A(this,Za))==null||t.call(this),oe(this,Za,void 0))}isFetching(e){return A(this,mt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return A(this,_i).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=A(this,mt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=A(this,mt).build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(zi(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return A(this,mt).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),r=A(this,mt).get(s.queryHash),i=r==null?void 0:r.state.data,o=oD(t,i);if(o!==void 0)return A(this,mt).build(this,s).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return $t.batch(()=>A(this,mt).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=A(this,mt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=A(this,mt);$t.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=A(this,mt);return $t.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=$t.batch(()=>A(this,mt).findAll(e).map(r=>r.cancel(n)));return Promise.all(s).then(Mn).catch(Mn)}invalidateQueries(e,t={}){return $t.batch(()=>(A(this,mt).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=$t.batch(()=>A(this,mt).findAll(e).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let i=r.fetch(void 0,n);return n.throwOnError||(i=i.catch(Mn)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(s).then(Mn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=A(this,mt).build(this,t);return n.isStaleByTime(zi(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Mn).catch(Mn)}fetchInfiniteQuery(e){return e.behavior=z_(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Mn).catch(Mn)}ensureInfiniteQueryData(e){return e.behavior=z_(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return cf.isOnline()?A(this,_i).resumePausedMutations():Promise.resolve()}getQueryCache(){return A(this,mt)}getMutationCache(){return A(this,_i)}getDefaultOptions(){return A(this,wi)}setDefaultOptions(e){oe(this,wi,e)}setQueryDefaults(e,t){A(this,Qa).set(Wo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...A(this,Qa).values()],n={};return t.forEach(s=>{iu(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){A(this,Ga).set(Wo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...A(this,Ga).values()],n={};return t.forEach(s=>{iu(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...A(this,wi).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Gy(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Jy&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...A(this,wi).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){A(this,mt).clear(),A(this,_i).clear()}},mt=new WeakMap,_i=new WeakMap,wi=new WeakMap,Qa=new WeakMap,Ga=new WeakMap,Si=new WeakMap,Ja=new WeakMap,Za=new WeakMap,vC),UN=v.createContext(void 0),Nt=e=>{const t=v.useContext(UN);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},jD=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(UN.Provider,{value:e,children:t})),qN=v.createContext(!1),ED=()=>v.useContext(qN);qN.Provider;function PD(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var TD=v.createContext(PD()),RD=()=>v.useContext(TD),DD=(e,t,n)=>{const s=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Zy(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||s)&&(t.isReset()||(e.retryOnMount=!1))},MD=e=>{v.useEffect(()=>{e.clearReset()},[e])},LD=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(r&&e.data===void 0||Zy(n,[e.error,s])),AD=e=>{if(e.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>n(s(...r)):n(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},OD=(e,t)=>e.isLoading&&e.isFetching&&!t,ID=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,H_=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function FD(e,t,n){var p,f,m,g;const s=ED(),r=RD(),i=Nt(),o=i.defaultQueryOptions(e);(f=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||f.call(p,o);const a=i.getQueryCache().get(o.queryHash);o._optimisticResults=s?"isRestoring":"optimistic",AD(o),DD(o,r,a),MD(r);const c=!i.getQueryCache().get(o.queryHash),[u]=v.useState(()=>new t(i,o)),d=u.getOptimisticResult(o),h=!s&&e.subscribed!==!1;if(v.useSyncExternalStore(v.useCallback(y=>{const x=h?u.subscribe($t.batchCalls(y)):Mn;return u.updateResult(),x},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),v.useEffect(()=>{u.setOptions(o)},[o,u]),ID(o,d))throw H_(o,u,r);if(LD({result:d,errorResetBoundary:r,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw d.error;if((g=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||g.call(m,o,d),o.experimental_prefetchInRender&&!Ho&&OD(d,s)){const y=c?H_(o,u,r):a==null?void 0:a.promise;y==null||y.catch(Mn).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?d:u.trackResult(d)}function he(e,t){return FD(e,vD)}function we(e,t){const n=Nt(),[s]=v.useState(()=>new kD(n,e));v.useEffect(()=>{s.setOptions(e)},[s,e]);const r=v.useSyncExternalStore(v.useCallback(o=>s.subscribe($t.batchCalls(o)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),i=v.useCallback((o,a)=>{s.mutate(o,a).catch(Mn)},[s]);if(r.error&&Zy(s.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:i,mutateAsync:r.mutate}}/**
|
|
41
|
-
* @license lucide-react v0.400.0 - ISC
|
|
42
|
-
*
|
|
43
|
-
* This source code is licensed under the ISC license.
|
|
44
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/const BD=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),KN=(...e)=>e.filter((t,n,s)=>!!t&&s.indexOf(t)===n).join(" ");/**
|
|
46
|
-
* @license lucide-react v0.400.0 - ISC
|
|
47
|
-
*
|
|
48
|
-
* This source code is licensed under the ISC license.
|
|
49
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/var zD={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
51
|
-
* @license lucide-react v0.400.0 - ISC
|
|
52
|
-
*
|
|
53
|
-
* This source code is licensed under the ISC license.
|
|
54
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
-
*/const $D=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...a},c)=>v.createElement("svg",{ref:c,...zD,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:KN("lucide",r),...a},[...o.map(([u,d])=>v.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
|
|
56
|
-
* @license lucide-react v0.400.0 - ISC
|
|
57
|
-
*
|
|
58
|
-
* This source code is licensed under the ISC license.
|
|
59
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/const ie=(e,t)=>{const n=v.forwardRef(({className:s,...r},i)=>v.createElement($D,{ref:i,iconNode:t,className:KN(`lucide-${BD(e)}`,s),...r}));return n.displayName=`${e}`,n};/**
|
|
61
|
-
* @license lucide-react v0.400.0 - ISC
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the ISC license.
|
|
64
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/const al=ie("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
|
|
66
|
-
* @license lucide-react v0.400.0 - ISC
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the ISC license.
|
|
69
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/const n0=ie("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
|
|
71
|
-
* @license lucide-react v0.400.0 - ISC
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the ISC license.
|
|
74
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/const Cx=ie("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
76
|
-
* @license lucide-react v0.400.0 - ISC
|
|
77
|
-
*
|
|
78
|
-
* This source code is licensed under the ISC license.
|
|
79
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
-
*/const HD=ie("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
|
|
81
|
-
* @license lucide-react v0.400.0 - ISC
|
|
82
|
-
*
|
|
83
|
-
* This source code is licensed under the ISC license.
|
|
84
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
-
*/const WD=ie("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
|
|
86
|
-
* @license lucide-react v0.400.0 - ISC
|
|
87
|
-
*
|
|
88
|
-
* This source code is licensed under the ISC license.
|
|
89
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*/const UD=ie("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
91
|
-
* @license lucide-react v0.400.0 - ISC
|
|
92
|
-
*
|
|
93
|
-
* This source code is licensed under the ISC license.
|
|
94
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
-
*/const VN=ie("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
|
|
96
|
-
* @license lucide-react v0.400.0 - ISC
|
|
97
|
-
*
|
|
98
|
-
* This source code is licensed under the ISC license.
|
|
99
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/const YN=ie("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/**
|
|
101
|
-
* @license lucide-react v0.400.0 - ISC
|
|
102
|
-
*
|
|
103
|
-
* This source code is licensed under the ISC license.
|
|
104
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
-
*/const W_=ie("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
|
|
106
|
-
* @license lucide-react v0.400.0 - ISC
|
|
107
|
-
*
|
|
108
|
-
* This source code is licensed under the ISC license.
|
|
109
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
-
*/const ep=ie("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
|
111
|
-
* @license lucide-react v0.400.0 - ISC
|
|
112
|
-
*
|
|
113
|
-
* This source code is licensed under the ISC license.
|
|
114
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
-
*/const qD=ie("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
|
|
116
|
-
* @license lucide-react v0.400.0 - ISC
|
|
117
|
-
*
|
|
118
|
-
* This source code is licensed under the ISC license.
|
|
119
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
-
*/const XN=ie("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
|
|
121
|
-
* @license lucide-react v0.400.0 - ISC
|
|
122
|
-
*
|
|
123
|
-
* This source code is licensed under the ISC license.
|
|
124
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
-
*/const Ec=ie("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
126
|
-
* @license lucide-react v0.400.0 - ISC
|
|
127
|
-
*
|
|
128
|
-
* This source code is licensed under the ISC license.
|
|
129
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
-
*/const Mu=ie("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
131
|
-
* @license lucide-react v0.400.0 - ISC
|
|
132
|
-
*
|
|
133
|
-
* This source code is licensed under the ISC license.
|
|
134
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
-
*/const bl=ie("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
136
|
-
* @license lucide-react v0.400.0 - ISC
|
|
137
|
-
*
|
|
138
|
-
* This source code is licensed under the ISC license.
|
|
139
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
-
*/const Uo=ie("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
141
|
-
* @license lucide-react v0.400.0 - ISC
|
|
142
|
-
*
|
|
143
|
-
* This source code is licensed under the ISC license.
|
|
144
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/const mr=ie("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
146
|
-
* @license lucide-react v0.400.0 - ISC
|
|
147
|
-
*
|
|
148
|
-
* This source code is licensed under the ISC license.
|
|
149
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/const po=ie("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
151
|
-
* @license lucide-react v0.400.0 - ISC
|
|
152
|
-
*
|
|
153
|
-
* This source code is licensed under the ISC license.
|
|
154
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
-
*/const KD=ie("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
156
|
-
* @license lucide-react v0.400.0 - ISC
|
|
157
|
-
*
|
|
158
|
-
* This source code is licensed under the ISC license.
|
|
159
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
-
*/const VD=ie("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{width:"6",height:"6",x:"9",y:"9",key:"1wrtvo"}]]);/**
|
|
161
|
-
* @license lucide-react v0.400.0 - ISC
|
|
162
|
-
*
|
|
163
|
-
* This source code is licensed under the ISC license.
|
|
164
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
-
*/const Kr=ie("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
166
|
-
* @license lucide-react v0.400.0 - ISC
|
|
167
|
-
*
|
|
168
|
-
* This source code is licensed under the ISC license.
|
|
169
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
-
*/const QN=ie("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
171
|
-
* @license lucide-react v0.400.0 - ISC
|
|
172
|
-
*
|
|
173
|
-
* This source code is licensed under the ISC license.
|
|
174
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
-
*/const YD=ie("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
|
|
176
|
-
* @license lucide-react v0.400.0 - ISC
|
|
177
|
-
*
|
|
178
|
-
* This source code is licensed under the ISC license.
|
|
179
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
-
*/const ll=ie("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
181
|
-
* @license lucide-react v0.400.0 - ISC
|
|
182
|
-
*
|
|
183
|
-
* This source code is licensed under the ISC license.
|
|
184
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
-
*/const Nx=ie("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
|
186
|
-
* @license lucide-react v0.400.0 - ISC
|
|
187
|
-
*
|
|
188
|
-
* This source code is licensed under the ISC license.
|
|
189
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
-
*/const GN=ie("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
191
|
-
* @license lucide-react v0.400.0 - ISC
|
|
192
|
-
*
|
|
193
|
-
* This source code is licensed under the ISC license.
|
|
194
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/const XD=ie("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
196
|
-
* @license lucide-react v0.400.0 - ISC
|
|
197
|
-
*
|
|
198
|
-
* This source code is licensed under the ISC license.
|
|
199
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
-
*/const JN=ie("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
|
|
201
|
-
* @license lucide-react v0.400.0 - ISC
|
|
202
|
-
*
|
|
203
|
-
* This source code is licensed under the ISC license.
|
|
204
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
-
*/const jx=ie("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
|
|
206
|
-
* @license lucide-react v0.400.0 - ISC
|
|
207
|
-
*
|
|
208
|
-
* This source code is licensed under the ISC license.
|
|
209
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
-
*/const na=ie("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
|
|
211
|
-
* @license lucide-react v0.400.0 - ISC
|
|
212
|
-
*
|
|
213
|
-
* This source code is licensed under the ISC license.
|
|
214
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
-
*/const gr=ie("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
216
|
-
* @license lucide-react v0.400.0 - ISC
|
|
217
|
-
*
|
|
218
|
-
* This source code is licensed under the ISC license.
|
|
219
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
-
*/const Lo=ie("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
221
|
-
* @license lucide-react v0.400.0 - ISC
|
|
222
|
-
*
|
|
223
|
-
* This source code is licensed under the ISC license.
|
|
224
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
-
*/const qo=ie("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
226
|
-
* @license lucide-react v0.400.0 - ISC
|
|
227
|
-
*
|
|
228
|
-
* This source code is licensed under the ISC license.
|
|
229
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const QD=ie("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
|
|
231
|
-
* @license lucide-react v0.400.0 - ISC
|
|
232
|
-
*
|
|
233
|
-
* This source code is licensed under the ISC license.
|
|
234
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const U_=ie("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
236
|
-
* @license lucide-react v0.400.0 - ISC
|
|
237
|
-
*
|
|
238
|
-
* This source code is licensed under the ISC license.
|
|
239
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
-
*/const Ex=ie("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
241
|
-
* @license lucide-react v0.400.0 - ISC
|
|
242
|
-
*
|
|
243
|
-
* This source code is licensed under the ISC license.
|
|
244
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
-
*/const ZN=ie("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
|
|
246
|
-
* @license lucide-react v0.400.0 - ISC
|
|
247
|
-
*
|
|
248
|
-
* This source code is licensed under the ISC license.
|
|
249
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
-
*/const Px=ie("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);/**
|
|
251
|
-
* @license lucide-react v0.400.0 - ISC
|
|
252
|
-
*
|
|
253
|
-
* This source code is licensed under the ISC license.
|
|
254
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/const s0=ie("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
|
|
256
|
-
* @license lucide-react v0.400.0 - ISC
|
|
257
|
-
*
|
|
258
|
-
* This source code is licensed under the ISC license.
|
|
259
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
-
*/const q_=ie("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
|
|
261
|
-
* @license lucide-react v0.400.0 - ISC
|
|
262
|
-
*
|
|
263
|
-
* This source code is licensed under the ISC license.
|
|
264
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
-
*/const GD=ie("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]);/**
|
|
266
|
-
* @license lucide-react v0.400.0 - ISC
|
|
267
|
-
*
|
|
268
|
-
* This source code is licensed under the ISC license.
|
|
269
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
-
*/const ej=ie("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
271
|
-
* @license lucide-react v0.400.0 - ISC
|
|
272
|
-
*
|
|
273
|
-
* This source code is licensed under the ISC license.
|
|
274
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
-
*/const tj=ie("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
|
|
276
|
-
* @license lucide-react v0.400.0 - ISC
|
|
277
|
-
*
|
|
278
|
-
* This source code is licensed under the ISC license.
|
|
279
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
-
*/const JD=ie("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
|
|
281
|
-
* @license lucide-react v0.400.0 - ISC
|
|
282
|
-
*
|
|
283
|
-
* This source code is licensed under the ISC license.
|
|
284
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
-
*/const nj=ie("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
286
|
-
* @license lucide-react v0.400.0 - ISC
|
|
287
|
-
*
|
|
288
|
-
* This source code is licensed under the ISC license.
|
|
289
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
-
*/const Ko=ie("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
|
|
291
|
-
* @license lucide-react v0.400.0 - ISC
|
|
292
|
-
*
|
|
293
|
-
* This source code is licensed under the ISC license.
|
|
294
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
-
*/const _e=ie("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
296
|
-
* @license lucide-react v0.400.0 - ISC
|
|
297
|
-
*
|
|
298
|
-
* This source code is licensed under the ISC license.
|
|
299
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
-
*/const ZD=ie("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
301
|
-
* @license lucide-react v0.400.0 - ISC
|
|
302
|
-
*
|
|
303
|
-
* This source code is licensed under the ISC license.
|
|
304
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
-
*/const eM=ie("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
|
|
306
|
-
* @license lucide-react v0.400.0 - ISC
|
|
307
|
-
*
|
|
308
|
-
* This source code is licensed under the ISC license.
|
|
309
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
-
*/const tM=ie("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
311
|
-
* @license lucide-react v0.400.0 - ISC
|
|
312
|
-
*
|
|
313
|
-
* This source code is licensed under the ISC license.
|
|
314
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
-
*/const Tx=ie("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
316
|
-
* @license lucide-react v0.400.0 - ISC
|
|
317
|
-
*
|
|
318
|
-
* This source code is licensed under the ISC license.
|
|
319
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
-
*/const nM=ie("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
321
|
-
* @license lucide-react v0.400.0 - ISC
|
|
322
|
-
*
|
|
323
|
-
* This source code is licensed under the ISC license.
|
|
324
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
-
*/const sM=ie("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
|
|
326
|
-
* @license lucide-react v0.400.0 - ISC
|
|
327
|
-
*
|
|
328
|
-
* This source code is licensed under the ISC license.
|
|
329
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
-
*/const rM=ie("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
|
|
331
|
-
* @license lucide-react v0.400.0 - ISC
|
|
332
|
-
*
|
|
333
|
-
* This source code is licensed under the ISC license.
|
|
334
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
-
*/const Qn=ie("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
336
|
-
* @license lucide-react v0.400.0 - ISC
|
|
337
|
-
*
|
|
338
|
-
* This source code is licensed under the ISC license.
|
|
339
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
340
|
-
*/const iM=ie("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
|
|
341
|
-
* @license lucide-react v0.400.0 - ISC
|
|
342
|
-
*
|
|
343
|
-
* This source code is licensed under the ISC license.
|
|
344
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
-
*/const Ar=ie("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
346
|
-
* @license lucide-react v0.400.0 - ISC
|
|
347
|
-
*
|
|
348
|
-
* This source code is licensed under the ISC license.
|
|
349
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
350
|
-
*/const Lu=ie("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
351
|
-
* @license lucide-react v0.400.0 - ISC
|
|
352
|
-
*
|
|
353
|
-
* This source code is licensed under the ISC license.
|
|
354
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
355
|
-
*/const oM=ie("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
|
|
356
|
-
* @license lucide-react v0.400.0 - ISC
|
|
357
|
-
*
|
|
358
|
-
* This source code is licensed under the ISC license.
|
|
359
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
360
|
-
*/const aM=ie("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
361
|
-
* @license lucide-react v0.400.0 - ISC
|
|
362
|
-
*
|
|
363
|
-
* This source code is licensed under the ISC license.
|
|
364
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
-
*/const sj=ie("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
|
|
366
|
-
* @license lucide-react v0.400.0 - ISC
|
|
367
|
-
*
|
|
368
|
-
* This source code is licensed under the ISC license.
|
|
369
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
370
|
-
*/const lM=ie("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
|
|
371
|
-
* @license lucide-react v0.400.0 - ISC
|
|
372
|
-
*
|
|
373
|
-
* This source code is licensed under the ISC license.
|
|
374
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
-
*/const rj=ie("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
376
|
-
* @license lucide-react v0.400.0 - ISC
|
|
377
|
-
*
|
|
378
|
-
* This source code is licensed under the ISC license.
|
|
379
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
380
|
-
*/const cM=ie("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
|
|
381
|
-
* @license lucide-react v0.400.0 - ISC
|
|
382
|
-
*
|
|
383
|
-
* This source code is licensed under the ISC license.
|
|
384
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
385
|
-
*/const Rx=ie("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
|
386
|
-
* @license lucide-react v0.400.0 - ISC
|
|
387
|
-
*
|
|
388
|
-
* This source code is licensed under the ISC license.
|
|
389
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
390
|
-
*/const ou=ie("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
391
|
-
* @license lucide-react v0.400.0 - ISC
|
|
392
|
-
*
|
|
393
|
-
* This source code is licensed under the ISC license.
|
|
394
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
395
|
-
*/const uM=ie("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
|
396
|
-
* @license lucide-react v0.400.0 - ISC
|
|
397
|
-
*
|
|
398
|
-
* This source code is licensed under the ISC license.
|
|
399
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
400
|
-
*/const r0=ie("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
|
|
401
|
-
* @license lucide-react v0.400.0 - ISC
|
|
402
|
-
*
|
|
403
|
-
* This source code is licensed under the ISC license.
|
|
404
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
405
|
-
*/const Vo=ie("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
406
|
-
* @license lucide-react v0.400.0 - ISC
|
|
407
|
-
*
|
|
408
|
-
* This source code is licensed under the ISC license.
|
|
409
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
410
|
-
*/const ij=ie("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
411
|
-
* @license lucide-react v0.400.0 - ISC
|
|
412
|
-
*
|
|
413
|
-
* This source code is licensed under the ISC license.
|
|
414
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
415
|
-
*/const i0=ie("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
|
|
416
|
-
* @license lucide-react v0.400.0 - ISC
|
|
417
|
-
*
|
|
418
|
-
* This source code is licensed under the ISC license.
|
|
419
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
420
|
-
*/const kn=ie("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
421
|
-
* @license lucide-react v0.400.0 - ISC
|
|
422
|
-
*
|
|
423
|
-
* This source code is licensed under the ISC license.
|
|
424
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
425
|
-
*/const oj=ie("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/**
|
|
426
|
-
* @license lucide-react v0.400.0 - ISC
|
|
427
|
-
*
|
|
428
|
-
* This source code is licensed under the ISC license.
|
|
429
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
430
|
-
*/const aj=ie("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
431
|
-
* @license lucide-react v0.400.0 - ISC
|
|
432
|
-
*
|
|
433
|
-
* This source code is licensed under the ISC license.
|
|
434
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
435
|
-
*/const o0=ie("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
436
|
-
* @license lucide-react v0.400.0 - ISC
|
|
437
|
-
*
|
|
438
|
-
* This source code is licensed under the ISC license.
|
|
439
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
440
|
-
*/const au=ie("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
|
|
441
|
-
* @license lucide-react v0.400.0 - ISC
|
|
442
|
-
*
|
|
443
|
-
* This source code is licensed under the ISC license.
|
|
444
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
445
|
-
*/const yt=ie("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
446
|
-
* @license lucide-react v0.400.0 - ISC
|
|
447
|
-
*
|
|
448
|
-
* This source code is licensed under the ISC license.
|
|
449
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
450
|
-
*/const dM=ie("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),a0=v.createContext(null);function yr(){const e=v.useContext(a0);if(!e)throw new Error("useConfirm must be used within DialogProvider");return e.confirm}function _l(){const e=v.useContext(a0);if(!e)throw new Error("useAlert must be used within DialogProvider");return e.alert}function hM({options:e,onConfirm:t,onCancel:n}){const s=v.useRef(null),r=v.useRef(null),i=e.variant==="destructive";return v.useEffect(()=>{var o,a;i?(o=s.current)==null||o.focus():(a=r.current)==null||a.focus()},[i]),v.useEffect(()=>{const o=a=>{a.key==="Escape"&&n()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),l.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[100]",onClick:n,children:l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg shadow-2xl w-full max-w-md mx-4 animate-fade-in",onClick:o=>o.stopPropagation(),role:"alertdialog","aria-modal":"true","aria-labelledby":"dialog-title","aria-describedby":"dialog-message",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-divider",children:[i?l.jsx(kn,{className:"w-5 h-5 text-red-400 shrink-0"}):l.jsx(ej,{className:"w-5 h-5 text-blue-400 shrink-0"}),l.jsx("h3",{id:"dialog-title",className:"text-lg font-semibold text-content",children:e.title})]}),l.jsx("div",{className:"px-4 py-4",children:l.jsx("p",{id:"dialog-message",className:"text-sm text-content-body whitespace-pre-line",children:e.message})}),l.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-divider",children:[l.jsx("button",{ref:s,onClick:n,className:"px-4 py-2 rounded text-sm bg-surface-overlay text-content-body hover:bg-surface-emphasis transition-colors",children:e.cancelLabel||"Cancel"}),l.jsx("button",{ref:r,onClick:t,className:`px-4 py-2 rounded text-sm font-medium transition-colors ${i?"bg-red-600 text-white hover:bg-red-700":"bg-blue-600 text-white hover:bg-blue-700"}`,children:e.confirmLabel||"Confirm"})]})]})})}function fM({options:e,onClose:t}){const n=v.useRef(null);v.useEffect(()=>{var i;(i=n.current)==null||i.focus()},[]),v.useEffect(()=>{const i=o=>{(o.key==="Escape"||o.key==="Enter")&&t()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[t]);const s={info:l.jsx(ej,{className:"w-5 h-5 text-blue-400 shrink-0"}),error:l.jsx(Kr,{className:"w-5 h-5 text-red-400 shrink-0"}),success:l.jsx(mr,{className:"w-5 h-5 text-green-400 shrink-0"})},r=e.variant||"info";return l.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[100]",onClick:t,children:l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg shadow-2xl w-full max-w-md mx-4 animate-fade-in",onClick:i=>i.stopPropagation(),role:"alertdialog","aria-modal":"true","aria-labelledby":"alert-title","aria-describedby":"alert-message",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[s[r],l.jsx("h3",{id:"alert-title",className:"text-lg font-semibold text-content",children:e.title||(r==="error"?"Error":r==="success"?"Success":"Notice")})]}),l.jsx("button",{onClick:t,className:"text-content-subtle hover:text-content-body transition-colors",children:l.jsx(yt,{className:"w-5 h-5"})})]}),l.jsx("div",{className:"px-4 py-4",children:l.jsx("p",{id:"alert-message",className:"text-sm text-content-body whitespace-pre-line",children:e.message})}),l.jsx("div",{className:"flex items-center justify-end px-4 py-3 border-t border-divider",children:l.jsx("button",{ref:n,onClick:t,className:"px-4 py-2 rounded text-sm bg-blue-600 text-white hover:bg-blue-700 transition-colors font-medium",children:"OK"})})]})})}function pM({children:e}){const[t,n]=v.useState(null),s=v.useRef(null),r=v.useCallback(()=>{s.current&&(s.current.resolve(!1),s.current=null)},[]),i=v.useCallback(d=>(r(),new Promise(h=>{const p={type:"confirm",options:d,resolve:h};s.current=p,n(p)})),[r]),o=v.useCallback(d=>(r(),new Promise(h=>{const p={type:"alert",options:d,resolve:()=>h()};s.current=p,n(p)})),[r]),a=v.useCallback(()=>{t==null||t.resolve(!0),s.current=null,n(null)},[t]),c=v.useCallback(()=>{t==null||t.resolve(!1),s.current=null,n(null)},[t]),u=v.useCallback(()=>{t==null||t.resolve(!1),s.current=null,n(null)},[t]);return l.jsxs(a0.Provider,{value:{confirm:i,alert:o},children:[e,(t==null?void 0:t.type)==="confirm"&&l.jsx(hM,{options:t.options,onConfirm:a,onCancel:c}),(t==null?void 0:t.type)==="alert"&&l.jsx(fM,{options:t.options,onClose:u})]})}var mM=e=>{switch(e){case"success":return vM;case"info":return bM;case"warning":return yM;case"error":return _M;default:return null}},gM=Array(12).fill(0),xM=({visible:e,className:t})=>J.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},J.createElement("div",{className:"sonner-spinner"},gM.map((n,s)=>J.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),vM=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),yM=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),bM=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),_M=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),wM=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},J.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),J.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),SM=()=>{let[e,t]=J.useState(document.hidden);return J.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Dx=1,kM=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...s}=e,r=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Dx++,i=this.toasts.find(a=>a.id===r),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(a=>a.id===r?(this.publish({...a,...e,id:r,title:n}),{...a,...e,id:r,dismissible:o,title:n}):a):this.addToast({title:n,...s,dismissible:o,id:r}),r},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let s=e instanceof Promise?e:e(),r=n!==void 0,i,o=s.then(async c=>{if(i=["resolve",c],J.isValidElement(c))r=!1,this.create({id:n,type:"default",message:c});else if(NM(c)&&!c.ok){r=!1;let u=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,d=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:n,type:"error",message:u,description:d})}else if(t.success!==void 0){r=!1;let u=typeof t.success=="function"?await t.success(c):t.success,d=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"success",message:u,description:d})}}).catch(async c=>{if(i=["reject",c],t.error!==void 0){r=!1;let u=typeof t.error=="function"?await t.error(c):t.error,d=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"error",message:u,description:d})}}).finally(()=>{var c;r&&(this.dismiss(n),n=void 0),(c=t.finally)==null||c.call(t)}),a=()=>new Promise((c,u)=>o.then(()=>i[0]==="reject"?u(i[1]):c(i[1])).catch(u));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Dx++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Kn=new kM,CM=(e,t)=>{let n=(t==null?void 0:t.id)||Dx++;return Kn.addToast({title:e,...t,id:n}),n},NM=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",jM=CM,EM=()=>Kn.toasts,PM=()=>Kn.getActiveToasts(),uc=Object.assign(jM,{success:Kn.success,info:Kn.info,warning:Kn.warning,error:Kn.error,custom:Kn.custom,message:Kn.message,promise:Kn.promise,dismiss:Kn.dismiss,loading:Kn.loading},{getHistory:EM,getToasts:PM});function TM(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}TM(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
451
|
-
`);function md(e){return e.label!==void 0}var RM=3,DM="32px",MM="16px",K_=4e3,LM=356,AM=14,OM=20,IM=200;function Ms(...e){return e.filter(Boolean).join(" ")}function FM(e){let[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}var BM=e=>{var t,n,s,r,i,o,a,c,u,d,h;let{invert:p,toast:f,unstyled:m,interacting:g,setHeights:y,visibleToasts:x,heights:b,index:_,toasts:S,expanded:C,removeToast:w,defaultRichColors:j,closeButton:E,style:O,cancelButtonStyle:R,actionButtonStyle:B,className:L="",descriptionClassName:D="",duration:T,position:P,gap:$,loadingIcon:W,expandByDefault:I,classNames:H,icons:k,closeButtonAriaLabel:F="Close toast",pauseWhenPageIsHidden:M}=e,[N,z]=J.useState(null),[U,K]=J.useState(null),[Q,Y]=J.useState(!1),[Z,ue]=J.useState(!1),[Oe,Re]=J.useState(!1),[fe,Ie]=J.useState(!1),[Ut,sn]=J.useState(!1),[se,de]=J.useState(0),[Ee,We]=J.useState(0),Ue=J.useRef(f.duration||T||K_),wt=J.useRef(null),ft=J.useRef(null),pn=_===0,Sr=_+1<=x,q=f.type,ee=f.dismissible!==!1,ge=f.className||"",ye=f.descriptionClassName||"",ke=J.useMemo(()=>b.findIndex(pe=>pe.toastId===f.id)||0,[b,f.id]),it=J.useMemo(()=>{var pe;return(pe=f.closeButton)!=null?pe:E},[f.closeButton,E]),rn=J.useMemo(()=>f.duration||T||K_,[f.duration,T]),qt=J.useRef(0),on=J.useRef(0),En=J.useRef(0),Ge=J.useRef(null),[ts,an]=P.split("-"),to=J.useMemo(()=>b.reduce((pe,be,Se)=>Se>=ke?pe:pe+be.height,0),[b,ke]),X=SM(),ae=f.invert||p,De=q==="loading";on.current=J.useMemo(()=>ke*$+to,[ke,to]),J.useEffect(()=>{Ue.current=rn},[rn]),J.useEffect(()=>{Y(!0)},[]),J.useEffect(()=>{let pe=ft.current;if(pe){let be=pe.getBoundingClientRect().height;return We(be),y(Se=>[{toastId:f.id,height:be,position:f.position},...Se]),()=>y(Se=>Se.filter(tt=>tt.toastId!==f.id))}},[y,f.id]),J.useLayoutEffect(()=>{if(!Q)return;let pe=ft.current,be=pe.style.height;pe.style.height="auto";let Se=pe.getBoundingClientRect().height;pe.style.height=be,We(Se),y(tt=>tt.find(Kt=>Kt.toastId===f.id)?tt.map(Kt=>Kt.toastId===f.id?{...Kt,height:Se}:Kt):[{toastId:f.id,height:Se,position:f.position},...tt])},[Q,f.title,f.description,y,f.id]);let He=J.useCallback(()=>{ue(!0),de(on.current),y(pe=>pe.filter(be=>be.toastId!==f.id)),setTimeout(()=>{w(f)},IM)},[f,w,y,on]);J.useEffect(()=>{if(f.promise&&q==="loading"||f.duration===1/0||f.type==="loading")return;let pe;return C||g||M&&X?(()=>{if(En.current<qt.current){let be=new Date().getTime()-qt.current;Ue.current=Ue.current-be}En.current=new Date().getTime()})():Ue.current!==1/0&&(qt.current=new Date().getTime(),pe=setTimeout(()=>{var be;(be=f.onAutoClose)==null||be.call(f,f),He()},Ue.current)),()=>clearTimeout(pe)},[C,g,f,q,M,X,He]),J.useEffect(()=>{f.delete&&He()},[He,f.delete]);function jt(){var pe,be,Se;return k!=null&&k.loading?J.createElement("div",{className:Ms(H==null?void 0:H.loader,(pe=f==null?void 0:f.classNames)==null?void 0:pe.loader,"sonner-loader"),"data-visible":q==="loading"},k.loading):W?J.createElement("div",{className:Ms(H==null?void 0:H.loader,(be=f==null?void 0:f.classNames)==null?void 0:be.loader,"sonner-loader"),"data-visible":q==="loading"},W):J.createElement(xM,{className:Ms(H==null?void 0:H.loader,(Se=f==null?void 0:f.classNames)==null?void 0:Se.loader),visible:q==="loading"})}return J.createElement("li",{tabIndex:0,ref:ft,className:Ms(L,ge,H==null?void 0:H.toast,(t=f==null?void 0:f.classNames)==null?void 0:t.toast,H==null?void 0:H.default,H==null?void 0:H[q],(n=f==null?void 0:f.classNames)==null?void 0:n[q]),"data-sonner-toast":"","data-rich-colors":(s=f.richColors)!=null?s:j,"data-styled":!(f.jsx||f.unstyled||m),"data-mounted":Q,"data-promise":!!f.promise,"data-swiped":Ut,"data-removed":Z,"data-visible":Sr,"data-y-position":ts,"data-x-position":an,"data-index":_,"data-front":pn,"data-swiping":Oe,"data-dismissible":ee,"data-type":q,"data-invert":ae,"data-swipe-out":fe,"data-swipe-direction":U,"data-expanded":!!(C||I&&Q),style:{"--index":_,"--toasts-before":_,"--z-index":S.length-_,"--offset":`${Z?se:on.current}px`,"--initial-height":I?"auto":`${Ee}px`,...O,...f.style},onDragEnd:()=>{Re(!1),z(null),Ge.current=null},onPointerDown:pe=>{De||!ee||(wt.current=new Date,de(on.current),pe.target.setPointerCapture(pe.pointerId),pe.target.tagName!=="BUTTON"&&(Re(!0),Ge.current={x:pe.clientX,y:pe.clientY}))},onPointerUp:()=>{var pe,be,Se,tt;if(fe||!ee)return;Ge.current=null;let Kt=Number(((pe=ft.current)==null?void 0:pe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Je=Number(((be=ft.current)==null?void 0:be.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),mn=new Date().getTime()-((Se=wt.current)==null?void 0:Se.getTime()),pt=N==="x"?Kt:Je,Vt=Math.abs(pt)/mn;if(Math.abs(pt)>=OM||Vt>.11){de(on.current),(tt=f.onDismiss)==null||tt.call(f,f),K(N==="x"?Kt>0?"right":"left":Je>0?"down":"up"),He(),Ie(!0),sn(!1);return}Re(!1),z(null)},onPointerMove:pe=>{var be,Se,tt,Kt;if(!Ge.current||!ee||((be=window.getSelection())==null?void 0:be.toString().length)>0)return;let Je=pe.clientY-Ge.current.y,mn=pe.clientX-Ge.current.x,pt=(Se=e.swipeDirections)!=null?Se:FM(P);!N&&(Math.abs(mn)>1||Math.abs(Je)>1)&&z(Math.abs(mn)>Math.abs(Je)?"x":"y");let Vt={x:0,y:0};N==="y"?(pt.includes("top")||pt.includes("bottom"))&&(pt.includes("top")&&Je<0||pt.includes("bottom")&&Je>0)&&(Vt.y=Je):N==="x"&&(pt.includes("left")||pt.includes("right"))&&(pt.includes("left")&&mn<0||pt.includes("right")&&mn>0)&&(Vt.x=mn),(Math.abs(Vt.x)>0||Math.abs(Vt.y)>0)&&sn(!0),(tt=ft.current)==null||tt.style.setProperty("--swipe-amount-x",`${Vt.x}px`),(Kt=ft.current)==null||Kt.style.setProperty("--swipe-amount-y",`${Vt.y}px`)}},it&&!f.jsx?J.createElement("button",{"aria-label":F,"data-disabled":De,"data-close-button":!0,onClick:De||!ee?()=>{}:()=>{var pe;He(),(pe=f.onDismiss)==null||pe.call(f,f)},className:Ms(H==null?void 0:H.closeButton,(r=f==null?void 0:f.classNames)==null?void 0:r.closeButton)},(i=k==null?void 0:k.close)!=null?i:wM):null,f.jsx||v.isValidElement(f.title)?f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title:J.createElement(J.Fragment,null,q||f.icon||f.promise?J.createElement("div",{"data-icon":"",className:Ms(H==null?void 0:H.icon,(o=f==null?void 0:f.classNames)==null?void 0:o.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||jt():null,f.type!=="loading"?f.icon||(k==null?void 0:k[q])||mM(q):null):null,J.createElement("div",{"data-content":"",className:Ms(H==null?void 0:H.content,(a=f==null?void 0:f.classNames)==null?void 0:a.content)},J.createElement("div",{"data-title":"",className:Ms(H==null?void 0:H.title,(c=f==null?void 0:f.classNames)==null?void 0:c.title)},typeof f.title=="function"?f.title():f.title),f.description?J.createElement("div",{"data-description":"",className:Ms(D,ye,H==null?void 0:H.description,(u=f==null?void 0:f.classNames)==null?void 0:u.description)},typeof f.description=="function"?f.description():f.description):null),v.isValidElement(f.cancel)?f.cancel:f.cancel&&md(f.cancel)?J.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||R,onClick:pe=>{var be,Se;md(f.cancel)&&ee&&((Se=(be=f.cancel).onClick)==null||Se.call(be,pe),He())},className:Ms(H==null?void 0:H.cancelButton,(d=f==null?void 0:f.classNames)==null?void 0:d.cancelButton)},f.cancel.label):null,v.isValidElement(f.action)?f.action:f.action&&md(f.action)?J.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||B,onClick:pe=>{var be,Se;md(f.action)&&((Se=(be=f.action).onClick)==null||Se.call(be,pe),!pe.defaultPrevented&&He())},className:Ms(H==null?void 0:H.actionButton,(h=f==null?void 0:f.classNames)==null?void 0:h.actionButton)},f.action.label):null))};function V_(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function zM(e,t){let n={};return[e,t].forEach((s,r)=>{let i=r===1,o=i?"--mobile-offset":"--offset",a=i?MM:DM;function c(u){["top","right","bottom","left"].forEach(d=>{n[`${o}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof s=="number"||typeof s=="string"?c(s):typeof s=="object"?["top","right","bottom","left"].forEach(u=>{s[u]===void 0?n[`${o}-${u}`]=a:n[`${o}-${u}`]=typeof s[u]=="number"?`${s[u]}px`:s[u]}):c(a)}),n}var $M=v.forwardRef(function(e,t){let{invert:n,position:s="bottom-right",hotkey:r=["altKey","KeyT"],expand:i,closeButton:o,className:a,offset:c,mobileOffset:u,theme:d="light",richColors:h,duration:p,style:f,visibleToasts:m=RM,toastOptions:g,dir:y=V_(),gap:x=AM,loadingIcon:b,icons:_,containerAriaLabel:S="Notifications",pauseWhenPageIsHidden:C}=e,[w,j]=J.useState([]),E=J.useMemo(()=>Array.from(new Set([s].concat(w.filter(M=>M.position).map(M=>M.position)))),[w,s]),[O,R]=J.useState([]),[B,L]=J.useState(!1),[D,T]=J.useState(!1),[P,$]=J.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=J.useRef(null),I=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),H=J.useRef(null),k=J.useRef(!1),F=J.useCallback(M=>{j(N=>{var z;return(z=N.find(U=>U.id===M.id))!=null&&z.delete||Kn.dismiss(M.id),N.filter(({id:U})=>U!==M.id)})},[]);return J.useEffect(()=>Kn.subscribe(M=>{if(M.dismiss){j(N=>N.map(z=>z.id===M.id?{...z,delete:!0}:z));return}setTimeout(()=>{LN.flushSync(()=>{j(N=>{let z=N.findIndex(U=>U.id===M.id);return z!==-1?[...N.slice(0,z),{...N[z],...M},...N.slice(z+1)]:[M,...N]})})})}),[]),J.useEffect(()=>{if(d!=="system"){$(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?$("dark"):$("light")),typeof window>"u")return;let M=window.matchMedia("(prefers-color-scheme: dark)");try{M.addEventListener("change",({matches:N})=>{$(N?"dark":"light")})}catch{M.addListener(({matches:z})=>{try{$(z?"dark":"light")}catch(U){console.error(U)}})}},[d]),J.useEffect(()=>{w.length<=1&&L(!1)},[w]),J.useEffect(()=>{let M=N=>{var z,U;r.every(K=>N[K]||N.code===K)&&(L(!0),(z=W.current)==null||z.focus()),N.code==="Escape"&&(document.activeElement===W.current||(U=W.current)!=null&&U.contains(document.activeElement))&&L(!1)};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[r]),J.useEffect(()=>{if(W.current)return()=>{H.current&&(H.current.focus({preventScroll:!0}),H.current=null,k.current=!1)}},[W.current]),J.createElement("section",{ref:t,"aria-label":`${S} ${I}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},E.map((M,N)=>{var z;let[U,K]=M.split("-");return w.length?J.createElement("ol",{key:M,dir:y==="auto"?V_():y,tabIndex:-1,ref:W,className:a,"data-sonner-toaster":!0,"data-theme":P,"data-y-position":U,"data-lifted":B&&w.length>1&&!i,"data-x-position":K,style:{"--front-toast-height":`${((z=O[0])==null?void 0:z.height)||0}px`,"--width":`${LM}px`,"--gap":`${x}px`,...f,...zM(c,u)},onBlur:Q=>{k.current&&!Q.currentTarget.contains(Q.relatedTarget)&&(k.current=!1,H.current&&(H.current.focus({preventScroll:!0}),H.current=null))},onFocus:Q=>{Q.target instanceof HTMLElement&&Q.target.dataset.dismissible==="false"||k.current||(k.current=!0,H.current=Q.relatedTarget)},onMouseEnter:()=>L(!0),onMouseMove:()=>L(!0),onMouseLeave:()=>{D||L(!1)},onDragEnd:()=>L(!1),onPointerDown:Q=>{Q.target instanceof HTMLElement&&Q.target.dataset.dismissible==="false"||T(!0)},onPointerUp:()=>T(!1)},w.filter(Q=>!Q.position&&N===0||Q.position===M).map((Q,Y)=>{var Z,ue;return J.createElement(BM,{key:Q.id,icons:_,index:Y,toast:Q,defaultRichColors:h,duration:(Z=g==null?void 0:g.duration)!=null?Z:p,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:n,visibleToasts:m,closeButton:(ue=g==null?void 0:g.closeButton)!=null?ue:o,interacting:D,position:M,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:F,toasts:w.filter(Oe=>Oe.position==Q.position),heights:O.filter(Oe=>Oe.position==Q.position),setHeights:R,expandByDefault:i,gap:x,loadingIcon:b,expanded:B,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections})})):null}))});const tp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wl(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function l0(e){return"nodeType"in e}function Fn(e){var t,n;return e?wl(e)?e:l0(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function c0(e){const{Document:t}=Fn(e);return e instanceof t}function Au(e){return wl(e)?!1:e instanceof Fn(e).HTMLElement}function lj(e){return e instanceof Fn(e).SVGElement}function Sl(e){return e?wl(e)?e.document:l0(e)?c0(e)?e:Au(e)||lj(e)?e.ownerDocument:document:document:document}const Vr=tp?v.useLayoutEffect:v.useEffect;function np(e){const t=v.useRef(e);return Vr(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.current==null?void 0:t.current(...s)},[])}function HM(){const e=v.useRef(null),t=v.useCallback((s,r)=>{e.current=setInterval(s,r)},[]),n=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function lu(e,t){t===void 0&&(t=[e]);const n=v.useRef(e);return Vr(()=>{n.current!==e&&(n.current=e)},t),n}function Ou(e,t){const n=v.useRef();return v.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function uf(e){const t=np(e),n=v.useRef(null),s=v.useCallback(r=>{r!==n.current&&(t==null||t(r,n.current)),n.current=r},[]);return[n,s]}function df(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let om={};function sp(e,t){return v.useMemo(()=>{if(t)return t;const n=om[e]==null?0:om[e]+1;return om[e]=n,e+"-"+n},[e,t])}function cj(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];return s.reduce((i,o)=>{const a=Object.entries(o);for(const[c,u]of a){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const Ba=cj(1),hf=cj(-1);function WM(e){return"clientX"in e&&"clientY"in e}function u0(e){if(!e)return!1;const{KeyboardEvent:t}=Fn(e.target);return t&&e instanceof t}function UM(e){if(!e)return!1;const{TouchEvent:t}=Fn(e.target);return t&&e instanceof t}function ff(e){if(UM(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return WM(e)?{x:e.clientX,y:e.clientY}:null}const cu=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[cu.Translate.toString(e),cu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),Y_="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function qM(e){return e.matches(Y_)?e:e.querySelector(Y_)}const KM={display:"none"};function VM(e){let{id:t,value:n}=e;return J.createElement("div",{id:t,style:KM},n)}function YM(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return J.createElement("div",{id:t,style:r,role:"status","aria-live":s,"aria-atomic":!0},n)}function XM(){const[e,t]=v.useState("");return{announce:v.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const uj=v.createContext(null);function QM(e){const t=v.useContext(uj);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function GM(){const[e]=v.useState(()=>new Set),t=v.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[v.useCallback(s=>{let{type:r,event:i}=s;e.forEach(o=>{var a;return(a=o[r])==null?void 0:a.call(o,i)})},[e]),t]}const JM={draggable:`
|
|
452
|
-
To pick up a draggable item, press the space bar.
|
|
453
|
-
While dragging, use the arrow keys to move the item.
|
|
454
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
455
|
-
`},ZM={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function e3(e){let{announcements:t=ZM,container:n,hiddenTextDescribedById:s,screenReaderInstructions:r=JM}=e;const{announce:i,announcement:o}=XM(),a=sp("DndLiveRegion"),[c,u]=v.useState(!1);if(v.useEffect(()=>{u(!0)},[]),QM(v.useMemo(()=>({onDragStart(h){let{active:p}=h;i(t.onDragStart({active:p}))},onDragMove(h){let{active:p,over:f}=h;t.onDragMove&&i(t.onDragMove({active:p,over:f}))},onDragOver(h){let{active:p,over:f}=h;i(t.onDragOver({active:p,over:f}))},onDragEnd(h){let{active:p,over:f}=h;i(t.onDragEnd({active:p,over:f}))},onDragCancel(h){let{active:p,over:f}=h;i(t.onDragCancel({active:p,over:f}))}}),[i,t])),!c)return null;const d=J.createElement(J.Fragment,null,J.createElement(VM,{id:s,value:r.draggable}),J.createElement(YM,{id:a,announcement:o}));return n?js.createPortal(d,n):d}var zt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(zt||(zt={}));function pf(){}function X_(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function t3(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const Ks=Object.freeze({x:0,y:0});function n3(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function s3(e,t){const n=ff(e);if(!n)return"0 0";const s={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return s.x+"% "+s.y+"%"}function r3(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function i3(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function Q_(e){let{left:t,top:n,height:s,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+s},{x:t+r,y:n+s}]}function o3(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const a3=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const r=Q_(t),i=[];for(const o of s){const{id:a}=o,c=n.get(a);if(c){const u=Q_(c),d=r.reduce((p,f,m)=>p+n3(u[m],f),0),h=Number((d/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:h}})}}return i.sort(r3)};function l3(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=r-s,a=i-n;if(s<r&&n<i){const c=t.width*t.height,u=e.width*e.height,d=o*a,h=d/(c+u-d);return Number(h.toFixed(4))}return 0}const c3=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const r=[];for(const i of s){const{id:o}=i,a=n.get(o);if(a){const c=l3(a,t);c>0&&r.push({id:o,data:{droppableContainer:i,value:c}})}}return r.sort(i3)};function u3(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function dj(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ks}function d3(e){return function(n){for(var s=arguments.length,r=new Array(s>1?s-1:0),i=1;i<s;i++)r[i-1]=arguments[i];return r.reduce((o,a)=>({...o,top:o.top+e*a.y,bottom:o.bottom+e*a.y,left:o.left+e*a.x,right:o.right+e*a.x}),{...n})}}const h3=d3(1);function hj(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function f3(e,t,n){const s=hj(t);if(!s)return e;const{scaleX:r,scaleY:i,x:o,y:a}=s,c=e.left-o-(1-r)*parseFloat(n),u=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=r?e.width/r:e.width,h=i?e.height/i:e.height;return{width:d,height:h,top:u,right:c+d,bottom:u+h,left:c}}const p3={ignoreTransform:!1};function Iu(e,t){t===void 0&&(t=p3);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=Fn(e).getComputedStyle(e);u&&(n=f3(n,u,d))}const{top:s,left:r,width:i,height:o,bottom:a,right:c}=n;return{top:s,left:r,width:i,height:o,bottom:a,right:c}}function G_(e){return Iu(e,{ignoreTransform:!0})}function m3(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function g3(e,t){return t===void 0&&(t=Fn(e).getComputedStyle(e)),t.position==="fixed"}function x3(e,t){t===void 0&&(t=Fn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{const i=t[r];return typeof i=="string"?n.test(i):!1})}function d0(e,t){const n=[];function s(r){if(t!=null&&n.length>=t||!r)return n;if(c0(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Au(r)||lj(r)||n.includes(r))return n;const i=Fn(e).getComputedStyle(r);return r!==e&&x3(r,i)&&n.push(r),g3(r,i)?n:s(r.parentNode)}return e?s(e):n}function fj(e){const[t]=d0(e,1);return t??null}function am(e){return!tp||!e?null:wl(e)?e:l0(e)?c0(e)||e===Sl(e).scrollingElement?window:Au(e)?e:null:null}function pj(e){return wl(e)?e.scrollX:e.scrollLeft}function mj(e){return wl(e)?e.scrollY:e.scrollTop}function Mx(e){return{x:pj(e),y:mj(e)}}var Gt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Gt||(Gt={}));function gj(e){return!tp||!e?!1:e===document.scrollingElement}function xj(e){const t={x:0,y:0},n=gj(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},r=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=s.y,a=e.scrollLeft>=s.x;return{isTop:r,isLeft:i,isBottom:o,isRight:a,maxScroll:s,minScroll:t}}const v3={x:.2,y:.2};function y3(e,t,n,s,r){let{top:i,left:o,right:a,bottom:c}=n;s===void 0&&(s=10),r===void 0&&(r=v3);const{isTop:u,isBottom:d,isLeft:h,isRight:p}=xj(e),f={x:0,y:0},m={x:0,y:0},g={height:t.height*r.y,width:t.width*r.x};return!u&&i<=t.top+g.height?(f.y=Gt.Backward,m.y=s*Math.abs((t.top+g.height-i)/g.height)):!d&&c>=t.bottom-g.height&&(f.y=Gt.Forward,m.y=s*Math.abs((t.bottom-g.height-c)/g.height)),!p&&a>=t.right-g.width?(f.x=Gt.Forward,m.x=s*Math.abs((t.right-g.width-a)/g.width)):!h&&o<=t.left+g.width&&(f.x=Gt.Backward,m.x=s*Math.abs((t.left+g.width-o)/g.width)),{direction:f,speed:m}}function b3(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:n,right:s,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:r,width:e.clientWidth,height:e.clientHeight}}function vj(e){return e.reduce((t,n)=>Ba(t,Mx(n)),Ks)}function _3(e){return e.reduce((t,n)=>t+pj(n),0)}function w3(e){return e.reduce((t,n)=>t+mj(n),0)}function yj(e,t){if(t===void 0&&(t=Iu),!e)return;const{top:n,left:s,bottom:r,right:i}=t(e);fj(e)&&(r<=0||i<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const S3=[["x",["left","right"],_3],["y",["top","bottom"],w3]];class h0{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=d0(n),r=vj(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of S3)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=a(s),d=r[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Pc{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var r;(r=this.target)==null||r.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function k3(e){const{EventTarget:t}=Fn(e);return e instanceof t?e:Sl(e)}function lm(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var bs;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(bs||(bs={}));function J_(e){e.preventDefault()}function C3(e){e.stopPropagation()}var Xe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Xe||(Xe={}));const bj={start:[Xe.Space,Xe.Enter],cancel:[Xe.Esc],end:[Xe.Space,Xe.Enter,Xe.Tab]},N3=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Xe.Right:return{...n,x:n.x+25};case Xe.Left:return{...n,x:n.x-25};case Xe.Down:return{...n,y:n.y+25};case Xe.Up:return{...n,y:n.y-25}}};class f0{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Pc(Sl(n)),this.windowListeners=new Pc(Fn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(bs.Resize,this.handleCancel),this.windowListeners.add(bs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(bs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&yj(s),n(Ks)}handleKeyDown(t){if(u0(t)){const{active:n,context:s,options:r}=this.props,{keyboardCodes:i=bj,coordinateGetter:o=N3,scrollBehavior:a="smooth"}=r,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=s.current,d=u?{x:u.left,y:u.top}:Ks;this.referenceCoordinates||(this.referenceCoordinates=d);const h=o(t,{active:n,context:s.current,currentCoordinates:d});if(h){const p=hf(h,d),f={x:0,y:0},{scrollableAncestors:m}=s.current;for(const g of m){const y=t.code,{isTop:x,isRight:b,isLeft:_,isBottom:S,maxScroll:C,minScroll:w}=xj(g),j=b3(g),E={x:Math.min(y===Xe.Right?j.right-j.width/2:j.right,Math.max(y===Xe.Right?j.left:j.left+j.width/2,h.x)),y:Math.min(y===Xe.Down?j.bottom-j.height/2:j.bottom,Math.max(y===Xe.Down?j.top:j.top+j.height/2,h.y))},O=y===Xe.Right&&!b||y===Xe.Left&&!_,R=y===Xe.Down&&!S||y===Xe.Up&&!x;if(O&&E.x!==h.x){const B=g.scrollLeft+p.x,L=y===Xe.Right&&B<=C.x||y===Xe.Left&&B>=w.x;if(L&&!p.y){g.scrollTo({left:B,behavior:a});return}L?f.x=g.scrollLeft-B:f.x=y===Xe.Right?g.scrollLeft-C.x:g.scrollLeft-w.x,f.x&&g.scrollBy({left:-f.x,behavior:a});break}else if(R&&E.y!==h.y){const B=g.scrollTop+p.y,L=y===Xe.Down&&B<=C.y||y===Xe.Up&&B>=w.y;if(L&&!p.x){g.scrollTo({top:B,behavior:a});return}L?f.y=g.scrollTop-B:f.y=y===Xe.Down?g.scrollTop-C.y:g.scrollTop-w.y,f.y&&g.scrollBy({top:-f.y,behavior:a});break}}this.handleMove(t,Ba(hf(h,this.referenceCoordinates),f))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}f0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=bj,onActivation:r}=t,{active:i}=n;const{code:o}=e.nativeEvent;if(s.start.includes(o)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),r==null||r({event:e.nativeEvent}),!0)}return!1}}];function Z_(e){return!!(e&&"distance"in e)}function ew(e){return!!(e&&"delay"in e)}class p0{constructor(t,n,s){var r;s===void 0&&(s=k3(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:o}=i;this.props=t,this.events=n,this.document=Sl(o),this.documentListeners=new Pc(this.document),this.listeners=new Pc(s),this.windowListeners=new Pc(Fn(o)),this.initialCoordinates=(r=ff(i))!=null?r:Ks,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(bs.Resize,this.handleCancel),this.windowListeners.add(bs.DragStart,J_),this.windowListeners.add(bs.VisibilityChange,this.handleCancel),this.windowListeners.add(bs.ContextMenu,J_),this.documentListeners.add(bs.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ew(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Z_(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:s,onPending:r}=this.props;r(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(bs.Click,C3,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(bs.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:r,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!r)return;const c=(n=ff(t))!=null?n:Ks,u=hf(r,c);if(!s&&a){if(Z_(a)){if(a.tolerance!=null&&lm(u,a.tolerance))return this.handleCancel();if(lm(u,a.distance))return this.handleStart()}if(ew(a)&&lm(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Xe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const j3={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class m0 extends p0{constructor(t){const{event:n}=t,s=Sl(n.target);super(t,j3,s)}}m0.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const E3={move:{name:"mousemove"},end:{name:"mouseup"}};var Lx;(function(e){e[e.RightClick=2]="RightClick"})(Lx||(Lx={}));class P3 extends p0{constructor(t){super(t,E3,Sl(t.event.target))}}P3.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===Lx.RightClick?!1:(s==null||s({event:n}),!0)}}];const cm={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class T3 extends p0{constructor(t){super(t,cm)}static setup(){return window.addEventListener(cm.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(cm.move.name,t)};function t(){}}}T3.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:r}=n;return r.length>1?!1:(s==null||s({event:n}),!0)}}];var Tc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Tc||(Tc={}));var mf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(mf||(mf={}));function R3(e){let{acceleration:t,activator:n=Tc.Pointer,canScroll:s,draggingRect:r,enabled:i,interval:o=5,order:a=mf.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:h,threshold:p}=e;const f=M3({delta:h,disabled:!i}),[m,g]=HM(),y=v.useRef({x:0,y:0}),x=v.useRef({x:0,y:0}),b=v.useMemo(()=>{switch(n){case Tc.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Tc.DraggableRect:return r}},[n,r,c]),_=v.useRef(null),S=v.useCallback(()=>{const w=_.current;if(!w)return;const j=y.current.x*x.current.x,E=y.current.y*x.current.y;w.scrollBy(j,E)},[]),C=v.useMemo(()=>a===mf.TreeOrder?[...u].reverse():u,[a,u]);v.useEffect(()=>{if(!i||!u.length||!b){g();return}for(const w of C){if((s==null?void 0:s(w))===!1)continue;const j=u.indexOf(w),E=d[j];if(!E)continue;const{direction:O,speed:R}=y3(w,E,b,t,p);for(const B of["x","y"])f[B][O[B]]||(R[B]=0,O[B]=0);if(R.x>0||R.y>0){g(),_.current=w,m(S,o),y.current=R,x.current=O;return}}y.current={x:0,y:0},x.current={x:0,y:0},g()},[t,S,s,g,i,o,JSON.stringify(b),JSON.stringify(f),m,u,C,d,JSON.stringify(p)])}const D3={x:{[Gt.Backward]:!1,[Gt.Forward]:!1},y:{[Gt.Backward]:!1,[Gt.Forward]:!1}};function M3(e){let{delta:t,disabled:n}=e;const s=df(t);return Ou(r=>{if(n||!s||!r)return D3;const i={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Gt.Backward]:r.x[Gt.Backward]||i.x===-1,[Gt.Forward]:r.x[Gt.Forward]||i.x===1},y:{[Gt.Backward]:r.y[Gt.Backward]||i.y===-1,[Gt.Forward]:r.y[Gt.Forward]||i.y===1}}},[n,t,s])}function L3(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return Ou(r=>{var i;return t==null?null:(i=s??r)!=null?i:null},[s,t])}function A3(e,t){return v.useMemo(()=>e.reduce((n,s)=>{const{sensor:r}=s,i=r.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,s)}));return[...n,...i]},[]),[e,t])}var uu;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(uu||(uu={}));var Ax;(function(e){e.Optimized="optimized"})(Ax||(Ax={}));const tw=new Map;function O3(e,t){let{dragging:n,dependencies:s,config:r}=t;const[i,o]=v.useState(null),{frequency:a,measure:c,strategy:u}=r,d=v.useRef(e),h=y(),p=lu(h),f=v.useCallback(function(x){x===void 0&&(x=[]),!p.current&&o(b=>b===null?x:b.concat(x.filter(_=>!b.includes(_))))},[p]),m=v.useRef(null),g=Ou(x=>{if(h&&!n)return tw;if(!x||x===tw||d.current!==e||i!=null){const b=new Map;for(let _ of e){if(!_)continue;if(i&&i.length>0&&!i.includes(_.id)&&_.rect.current){b.set(_.id,_.rect.current);continue}const S=_.node.current,C=S?new h0(c(S),S):null;_.rect.current=C,C&&b.set(_.id,C)}return b}return x},[e,i,n,h,c]);return v.useEffect(()=>{d.current=e},[e]),v.useEffect(()=>{h||f()},[n,h]),v.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),v.useEffect(()=>{h||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{f(),m.current=null},a))},[a,h,f,...s]),{droppableRects:g,measureDroppableContainers:f,measuringScheduled:i!=null};function y(){switch(u){case uu.Always:return!1;case uu.BeforeDragging:return n;default:return!n}}}function g0(e,t){return Ou(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function I3(e,t){return g0(e,t)}function F3(e){let{callback:t,disabled:n}=e;const s=np(t),r=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(s)},[s,n]);return v.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function rp(e){let{callback:t,disabled:n}=e;const s=np(t),r=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(s)},[n]);return v.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function B3(e){return new h0(Iu(e),e)}function nw(e,t,n){t===void 0&&(t=B3);const[s,r]=v.useState(null);function i(){r(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const o=F3({callback(c){if(e)for(const u of c){const{type:d,target:h}=u;if(d==="childList"&&h instanceof HTMLElement&&h.contains(e)){i();break}}}}),a=rp({callback:i});return Vr(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),s}function z3(e){const t=g0(e);return dj(e,t)}const sw=[];function $3(e){const t=v.useRef(e),n=Ou(s=>e?s&&s!==sw&&e&&t.current&&e.parentNode===t.current.parentNode?s:d0(e):sw,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function H3(e){const[t,n]=v.useState(null),s=v.useRef(e),r=v.useCallback(i=>{const o=am(i.target);o&&n(a=>a?(a.set(o,Mx(o)),new Map(a)):null)},[]);return v.useEffect(()=>{const i=s.current;if(e!==i){o(i);const a=e.map(c=>{const u=am(c);return u?(u.addEventListener("scroll",r,{passive:!0}),[u,Mx(u)]):null}).filter(c=>c!=null);n(a.length?new Map(a):null),s.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(c=>{const u=am(c);u==null||u.removeEventListener("scroll",r)})}},[r,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>Ba(i,o),Ks):vj(e):Ks,[e,t])}function rw(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const s=e!==Ks;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?hf(e,n.current):Ks}function W3(e){v.useEffect(()=>{if(!tp)return;const t=e.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function U3(e,t){return v.useMemo(()=>e.reduce((n,s)=>{let{eventName:r,handler:i}=s;return n[r]=o=>{i(o,t)},n},{}),[e,t])}function _j(e){return v.useMemo(()=>e?m3(e):null,[e])}const iw=[];function q3(e,t){t===void 0&&(t=Iu);const[n]=e,s=_j(n?Fn(n):null),[r,i]=v.useState(iw);function o(){i(()=>e.length?e.map(c=>gj(c)?s:new h0(t(c),c)):iw)}const a=rp({callback:o});return Vr(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),r}function wj(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Au(t)?t:e}function K3(e){let{measure:t}=e;const[n,s]=v.useState(null),r=v.useCallback(u=>{for(const{target:d}of u)if(Au(d)){s(h=>{const p=t(d);return h?{...h,width:p.width,height:p.height}:p});break}},[t]),i=rp({callback:r}),o=v.useCallback(u=>{const d=wj(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),s(d?t(d):null)},[t,i]),[a,c]=uf(o);return v.useMemo(()=>({nodeRef:a,rect:n,setRef:c}),[n,a,c])}const V3=[{sensor:m0,options:{}},{sensor:f0,options:{}}],Y3={current:{}},xh={draggable:{measure:G_},droppable:{measure:G_,strategy:uu.WhileDragging,frequency:Ax.Optimized},dragOverlay:{measure:Iu}};class Rc extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const X3={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Rc,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:pf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:xh,measureDroppableContainers:pf,windowRect:null,measuringScheduled:!1},Sj={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pf,draggableNodes:new Map,over:null,measureDroppableContainers:pf},Fu=v.createContext(Sj),kj=v.createContext(X3);function Q3(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Rc}}}function G3(e,t){switch(t.type){case zt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case zt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case zt.DragEnd:case zt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case zt.RegisterDroppable:{const{element:n}=t,{id:s}=n,r=new Rc(e.droppable.containers);return r.set(s,n),{...e,droppable:{...e.droppable,containers:r}}}case zt.SetDroppableDisabled:{const{id:n,key:s,disabled:r}=t,i=e.droppable.containers.get(n);if(!i||s!==i.key)return e;const o=new Rc(e.droppable.containers);return o.set(n,{...i,disabled:r}),{...e,droppable:{...e.droppable,containers:o}}}case zt.UnregisterDroppable:{const{id:n,key:s}=t,r=e.droppable.containers.get(n);if(!r||s!==r.key)return e;const i=new Rc(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function J3(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:r}=v.useContext(Fu),i=df(s),o=df(n==null?void 0:n.id);return v.useEffect(()=>{if(!t&&!s&&i&&o!=null){if(!u0(i)||document.activeElement===i.target)return;const a=r.get(o);if(!a)return;const{activatorNode:c,node:u}=a;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const h=qM(d);if(h){h.focus();break}}})}},[s,t,r,o,i]),null}function Cj(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((r,i)=>i({transform:r,...s}),n):n}function Z3(e){return v.useMemo(()=>({draggable:{...xh.draggable,...e==null?void 0:e.draggable},droppable:{...xh.droppable,...e==null?void 0:e.droppable},dragOverlay:{...xh.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function eL(e){let{activeNode:t,measure:n,initialRect:s,config:r=!0}=e;const i=v.useRef(!1),{x:o,y:a}=typeof r=="boolean"?{x:r,y:r}:r;Vr(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!s)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),h=dj(d,s);if(o||(h.x=0),a||(h.y=0),i.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const p=fj(u);p&&p.scrollBy({top:h.y,left:h.x})}},[t,o,a,s,n])}const ip=v.createContext({...Ks,scaleX:1,scaleY:1});var ui;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ui||(ui={}));const tL=v.memo(function(t){var n,s,r,i;let{id:o,accessibility:a,autoScroll:c=!0,children:u,sensors:d=V3,collisionDetection:h=c3,measuring:p,modifiers:f,...m}=t;const g=v.useReducer(G3,void 0,Q3),[y,x]=g,[b,_]=GM(),[S,C]=v.useState(ui.Uninitialized),w=S===ui.Initialized,{draggable:{active:j,nodes:E,translate:O},droppable:{containers:R}}=y,B=j!=null?E.get(j):null,L=v.useRef({initial:null,translated:null}),D=v.useMemo(()=>{var De;return j!=null?{id:j,data:(De=B==null?void 0:B.data)!=null?De:Y3,rect:L}:null},[j,B]),T=v.useRef(null),[P,$]=v.useState(null),[W,I]=v.useState(null),H=lu(m,Object.values(m)),k=sp("DndDescribedBy",o),F=v.useMemo(()=>R.getEnabled(),[R]),M=Z3(p),{droppableRects:N,measureDroppableContainers:z,measuringScheduled:U}=O3(F,{dragging:w,dependencies:[O.x,O.y],config:M.droppable}),K=L3(E,j),Q=v.useMemo(()=>W?ff(W):null,[W]),Y=ae(),Z=I3(K,M.draggable.measure);eL({activeNode:j!=null?E.get(j):null,config:Y.layoutShiftCompensation,initialRect:Z,measure:M.draggable.measure});const ue=nw(K,M.draggable.measure,Z),Oe=nw(K?K.parentElement:null),Re=v.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=R.getNodeFor((n=Re.current.over)==null?void 0:n.id),Ie=K3({measure:M.dragOverlay.measure}),Ut=(s=Ie.nodeRef.current)!=null?s:K,sn=w?(r=Ie.rect)!=null?r:ue:null,se=!!(Ie.nodeRef.current&&Ie.rect),de=z3(se?null:ue),Ee=_j(Ut?Fn(Ut):null),We=$3(w?fe??K:null),Ue=q3(We),wt=Cj(f,{transform:{x:O.x-de.x,y:O.y-de.y,scaleX:1,scaleY:1},activatorEvent:W,active:D,activeNodeRect:ue,containerNodeRect:Oe,draggingNodeRect:sn,over:Re.current.over,overlayNodeRect:Ie.rect,scrollableAncestors:We,scrollableAncestorRects:Ue,windowRect:Ee}),ft=Q?Ba(Q,O):null,pn=H3(We),Sr=rw(pn),q=rw(pn,[ue]),ee=Ba(wt,Sr),ge=sn?h3(sn,wt):null,ye=D&&ge?h({active:D,collisionRect:ge,droppableRects:N,droppableContainers:F,pointerCoordinates:ft}):null,ke=o3(ye,"id"),[it,rn]=v.useState(null),qt=se?wt:Ba(wt,q),on=u3(qt,(i=it==null?void 0:it.rect)!=null?i:null,ue),En=v.useRef(null),Ge=v.useCallback((De,He)=>{let{sensor:jt,options:pe}=He;if(T.current==null)return;const be=E.get(T.current);if(!be)return;const Se=De.nativeEvent,tt=new jt({active:T.current,activeNode:be,event:Se,options:pe,context:Re,onAbort(Je){if(!E.get(Je))return;const{onDragAbort:pt}=H.current,Vt={id:Je};pt==null||pt(Vt),b({type:"onDragAbort",event:Vt})},onPending(Je,mn,pt,Vt){if(!E.get(Je))return;const{onDragPending:Dl}=H.current,Jr={id:Je,constraint:mn,initialCoordinates:pt,offset:Vt};Dl==null||Dl(Jr),b({type:"onDragPending",event:Jr})},onStart(Je){const mn=T.current;if(mn==null)return;const pt=E.get(mn);if(!pt)return;const{onDragStart:Vt}=H.current,Rl={activatorEvent:Se,active:{id:mn,data:pt.data,rect:L}};js.unstable_batchedUpdates(()=>{Vt==null||Vt(Rl),C(ui.Initializing),x({type:zt.DragStart,initialCoordinates:Je,active:mn}),b({type:"onDragStart",event:Rl}),$(En.current),I(Se)})},onMove(Je){x({type:zt.DragMove,coordinates:Je})},onEnd:Kt(zt.DragEnd),onCancel:Kt(zt.DragCancel)});En.current=tt;function Kt(Je){return async function(){const{active:pt,collisions:Vt,over:Rl,scrollAdjustedTranslate:Dl}=Re.current;let Jr=null;if(pt&&Dl){const{cancelDrop:Ml}=H.current;Jr={activatorEvent:Se,active:pt,collisions:Vt,delta:Dl,over:Rl},Je===zt.DragEnd&&typeof Ml=="function"&&await Promise.resolve(Ml(Jr))&&(Je=zt.DragCancel)}T.current=null,js.unstable_batchedUpdates(()=>{x({type:Je}),C(ui.Uninitialized),rn(null),$(null),I(null),En.current=null;const Ml=Je===zt.DragEnd?"onDragEnd":"onDragCancel";if(Jr){const Dp=H.current[Ml];Dp==null||Dp(Jr),b({type:Ml,event:Jr})}})}}},[E]),ts=v.useCallback((De,He)=>(jt,pe)=>{const be=jt.nativeEvent,Se=E.get(pe);if(T.current!==null||!Se||be.dndKit||be.defaultPrevented)return;const tt={active:Se};De(jt,He.options,tt)===!0&&(be.dndKit={capturedBy:He.sensor},T.current=pe,Ge(jt,He))},[E,Ge]),an=A3(d,ts);W3(d),Vr(()=>{ue&&S===ui.Initializing&&C(ui.Initialized)},[ue,S]),v.useEffect(()=>{const{onDragMove:De}=H.current,{active:He,activatorEvent:jt,collisions:pe,over:be}=Re.current;if(!He||!jt)return;const Se={active:He,activatorEvent:jt,collisions:pe,delta:{x:ee.x,y:ee.y},over:be};js.unstable_batchedUpdates(()=>{De==null||De(Se),b({type:"onDragMove",event:Se})})},[ee.x,ee.y]),v.useEffect(()=>{const{active:De,activatorEvent:He,collisions:jt,droppableContainers:pe,scrollAdjustedTranslate:be}=Re.current;if(!De||T.current==null||!He||!be)return;const{onDragOver:Se}=H.current,tt=pe.get(ke),Kt=tt&&tt.rect.current?{id:tt.id,rect:tt.rect.current,data:tt.data,disabled:tt.disabled}:null,Je={active:De,activatorEvent:He,collisions:jt,delta:{x:be.x,y:be.y},over:Kt};js.unstable_batchedUpdates(()=>{rn(Kt),Se==null||Se(Je),b({type:"onDragOver",event:Je})})},[ke]),Vr(()=>{Re.current={activatorEvent:W,active:D,activeNode:K,collisionRect:ge,collisions:ye,droppableRects:N,draggableNodes:E,draggingNode:Ut,draggingNodeRect:sn,droppableContainers:R,over:it,scrollableAncestors:We,scrollAdjustedTranslate:ee},L.current={initial:sn,translated:ge}},[D,K,ye,ge,E,Ut,sn,N,R,it,We,ee]),R3({...Y,delta:O,draggingRect:ge,pointerCoordinates:ft,scrollableAncestors:We,scrollableAncestorRects:Ue});const to=v.useMemo(()=>({active:D,activeNode:K,activeNodeRect:ue,activatorEvent:W,collisions:ye,containerNodeRect:Oe,dragOverlay:Ie,draggableNodes:E,droppableContainers:R,droppableRects:N,over:it,measureDroppableContainers:z,scrollableAncestors:We,scrollableAncestorRects:Ue,measuringConfiguration:M,measuringScheduled:U,windowRect:Ee}),[D,K,ue,W,ye,Oe,Ie,E,R,N,it,z,We,Ue,M,U,Ee]),X=v.useMemo(()=>({activatorEvent:W,activators:an,active:D,activeNodeRect:ue,ariaDescribedById:{draggable:k},dispatch:x,draggableNodes:E,over:it,measureDroppableContainers:z}),[W,an,D,ue,x,k,E,it,z]);return J.createElement(uj.Provider,{value:_},J.createElement(Fu.Provider,{value:X},J.createElement(kj.Provider,{value:to},J.createElement(ip.Provider,{value:on},u)),J.createElement(J3,{disabled:(a==null?void 0:a.restoreFocus)===!1})),J.createElement(e3,{...a,hiddenTextDescribedById:k}));function ae(){const De=(P==null?void 0:P.autoScrollEnabled)===!1,He=typeof c=="object"?c.enabled===!1:c===!1,jt=w&&!De&&!He;return typeof c=="object"?{...c,enabled:jt}:{enabled:jt}}}),nL=v.createContext(null),ow="button",sL="Draggable";function rL(e){let{id:t,data:n,disabled:s=!1,attributes:r}=e;const i=sp(sL),{activators:o,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:h,over:p}=v.useContext(Fu),{role:f=ow,roleDescription:m="draggable",tabIndex:g=0}=r??{},y=(c==null?void 0:c.id)===t,x=v.useContext(y?ip:nL),[b,_]=uf(),[S,C]=uf(),w=U3(o,t),j=lu(n);Vr(()=>(h.set(t,{id:t,key:i,node:b,activatorNode:S,data:j}),()=>{const O=h.get(t);O&&O.key===i&&h.delete(t)}),[h,t]);const E=v.useMemo(()=>({role:f,tabIndex:g,"aria-disabled":s,"aria-pressed":y&&f===ow?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[s,f,g,y,m,d.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:E,isDragging:y,listeners:s?void 0:w,node:b,over:p,setNodeRef:_,setActivatorNodeRef:C,transform:x}}function iL(){return v.useContext(kj)}const oL="Droppable",aL={timeout:25};function lL(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:r}=e;const i=sp(oL),{active:o,dispatch:a,over:c,measureDroppableContainers:u}=v.useContext(Fu),d=v.useRef({disabled:n}),h=v.useRef(!1),p=v.useRef(null),f=v.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:y}={...aL,...r},x=lu(g??s),b=v.useCallback(()=>{if(!h.current){h.current=!0;return}f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{u(Array.isArray(x.current)?x.current:[x.current]),f.current=null},y)},[y]),_=rp({callback:b,disabled:m||!o}),S=v.useCallback((E,O)=>{_&&(O&&(_.unobserve(O),h.current=!1),E&&_.observe(E))},[_]),[C,w]=uf(S),j=lu(t);return v.useEffect(()=>{!_||!C.current||(_.disconnect(),h.current=!1,_.observe(C.current))},[C,_]),v.useEffect(()=>(a({type:zt.RegisterDroppable,element:{id:s,key:i,disabled:n,node:C,rect:p,data:j}}),()=>a({type:zt.UnregisterDroppable,key:i,id:s})),[s]),v.useEffect(()=>{n!==d.current.disabled&&(a({type:zt.SetDroppableDisabled,id:s,key:i,disabled:n}),d.current.disabled=n)},[s,i,n,a]),{active:o,rect:p,isOver:(c==null?void 0:c.id)===s,node:C,over:c,setNodeRef:w}}function cL(e){let{animation:t,children:n}=e;const[s,r]=v.useState(null),[i,o]=v.useState(null),a=df(n);return!n&&!s&&a&&r(a),Vr(()=>{if(!i)return;const c=s==null?void 0:s.key,u=s==null?void 0:s.props.id;if(c==null||u==null){r(null);return}Promise.resolve(t(u,i)).then(()=>{r(null)})},[t,s,i]),J.createElement(J.Fragment,null,n,s?v.cloneElement(s,{ref:o}):null)}const uL={x:0,y:0,scaleX:1,scaleY:1};function dL(e){let{children:t}=e;return J.createElement(Fu.Provider,{value:Sj},J.createElement(ip.Provider,{value:uL},t))}const hL={position:"fixed",touchAction:"none"},fL=e=>u0(e)?"transform 250ms ease":void 0,pL=v.forwardRef((e,t)=>{let{as:n,activatorEvent:s,adjustScale:r,children:i,className:o,rect:a,style:c,transform:u,transition:d=fL}=e;if(!a)return null;const h=r?u:{...u,scaleX:1,scaleY:1},p={...hL,width:a.width,height:a.height,top:a.top,left:a.left,transform:cu.Transform.toString(h),transformOrigin:r&&s?s3(s,a):void 0,transition:typeof d=="function"?d(s):d,...c};return J.createElement(n,{className:o,style:p,ref:t},i)}),Nj=e=>t=>{let{active:n,dragOverlay:s}=t;const r={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(r[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&s.node.style.setProperty(a,c);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&s.node.classList.add(o.dragOverlay),function(){for(const[c,u]of Object.entries(r))n.node.style.setProperty(c,u);o!=null&&o.active&&n.node.classList.remove(o.active)}},mL=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:cu.Transform.toString(t)},{transform:cu.Transform.toString(n)}]},gL={duration:250,easing:"ease",keyframes:mL,sideEffects:Nj({styles:{active:{opacity:"0"}}})};function xL(e){let{config:t,draggableNodes:n,droppableContainers:s,measuringConfiguration:r}=e;return np((i,o)=>{if(t===null)return;const a=n.get(i);if(!a)return;const c=a.node.current;if(!c)return;const u=wj(o);if(!u)return;const{transform:d}=Fn(o).getComputedStyle(o),h=hj(d);if(!h)return;const p=typeof t=="function"?t:vL(t);return yj(c,r.draggable.measure),p({active:{id:i,data:a.data,node:c,rect:r.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:o,rect:r.dragOverlay.measure(u)},droppableContainers:s,measuringConfiguration:r,transform:h})})}function vL(e){const{duration:t,easing:n,sideEffects:s,keyframes:r}={...gL,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...u}=i;if(!t)return;const d={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},h={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/a.rect.height:1},p={x:c.x-d.x,y:c.y-d.y,...h},f=r({...u,active:o,dragOverlay:a,transform:{initial:c,final:p}}),[m]=f,g=f[f.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const y=s==null?void 0:s({active:o,dragOverlay:a,...u}),x=a.node.animate(f,{duration:t,easing:n,fill:"forwards"});return new Promise(b=>{x.onfinish=()=>{y==null||y(),b()}})}}let aw=0;function yL(e){return v.useMemo(()=>{if(e!=null)return aw++,aw},[e])}const bL=J.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:s,style:r,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:h,activeNodeRect:p,containerNodeRect:f,draggableNodes:m,droppableContainers:g,dragOverlay:y,over:x,measuringConfiguration:b,scrollableAncestors:_,scrollableAncestorRects:S,windowRect:C}=iL(),w=v.useContext(ip),j=yL(h==null?void 0:h.id),E=Cj(o,{activatorEvent:d,active:h,activeNodeRect:p,containerNodeRect:f,draggingNodeRect:y.rect,over:x,overlayNodeRect:y.rect,scrollableAncestors:_,scrollableAncestorRects:S,transform:w,windowRect:C}),O=g0(p),R=xL({config:s,draggableNodes:m,droppableContainers:g,measuringConfiguration:b}),B=O?y.setRef:void 0;return J.createElement(dL,null,J.createElement(cL,{animation:R},h&&j?J.createElement(pL,{key:j,id:h.id,ref:B,as:a,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:O,style:{zIndex:u,...r},transform:E},n):null))}),lw=["backlog","todo","in_progress","in_review","done"],Bt={Backlog:"backlog",Triage:"backlog",Unknown:"backlog",Todo:"todo","To Do":"todo",Ready:"todo",Unstarted:"todo","In Progress":"in_progress","In Planning":"in_progress",Started:"in_progress",Active:"in_progress","In Review":"in_review",Review:"in_review",QA:"in_review",Testing:"in_review",Done:"done",Completed:"done",Closed:"done",Canceled:"canceled",Cancelled:"canceled",Duplicate:"canceled","Won't Do":"canceled",Wontfix:"canceled"};var op={exports:{}},jj={},Ej={exports:{}},_L="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",wL=_L,SL=wL;function Pj(){}function Tj(){}Tj.resetWarningCache=Pj;var kL=function(){function e(s,r,i,o,a,c){if(c!==SL){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Tj,resetWarningCache:Pj};return n.PropTypes=n,n};Ej.exports=kL();var Rj=Ej.exports;function Dj(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Dj(e[t]))&&(s&&(s+=" "),s+=n);else for(t in e)e[t]&&(s&&(s+=" "),s+=t);return s}function cw(){for(var e,t,n=0,s="";n<arguments.length;)(e=arguments[n++])&&(t=Dj(e))&&(s&&(s+=" "),s+=t);return s}const CL=Object.freeze(Object.defineProperty({__proto__:null,clsx:cw,default:cw},Symbol.toStringTag,{value:"Module"})),NL=R4(CL);var bt={},br={};Object.defineProperty(br,"__esModule",{value:!0});br.dontSetMe=RL;br.findInArray=jL;br.int=TL;br.isFunction=EL;br.isNum=PL;function jL(e,t){for(let n=0,s=e.length;n<s;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function EL(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function PL(e){return typeof e=="number"&&!isNaN(e)}function TL(e){return parseInt(e,10)}function RL(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))}var sa={};Object.defineProperty(sa,"__esModule",{value:!0});sa.browserPrefixToKey=Lj;sa.browserPrefixToStyle=DL;sa.default=void 0;sa.getPrefix=Mj;const um=["Moz","Webkit","O","ms"];function Mj(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!n||t in n)return"";for(let s=0;s<um.length;s++)if(Lj(t,um[s])in n)return um[s];return""}function Lj(e,t){return t?"".concat(t).concat(ML(e)):e}function DL(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function ML(e){let t="",n=!0;for(let s=0;s<e.length;s++)n?(t+=e[s].toUpperCase(),n=!1):e[s]==="-"?n=!0:t+=e[s];return t}sa.default=Mj();Object.defineProperty(bt,"__esModule",{value:!0});bt.addClassName=Ij;bt.addEvent=OL;bt.addUserSelectStyles=VL;bt.createCSSTransform=WL;bt.createSVGTransform=UL;bt.getTouch=qL;bt.getTouchIdentifier=KL;bt.getTranslation=x0;bt.innerHeight=zL;bt.innerWidth=$L;bt.matchesSelector=Oj;bt.matchesSelectorAndParentsTo=AL;bt.offsetXYFromParent=HL;bt.outerHeight=FL;bt.outerWidth=BL;bt.removeClassName=Fj;bt.removeEvent=IL;bt.removeUserSelectStyles=YL;var cs=br,uw=LL(sa);function Aj(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Aj=function(s){return s?n:t})(e)}function LL(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Aj(t);if(n&&n.has(e))return n.get(e);var s={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var o=r?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(s,i,o):s[i]=e[i]}return s.default=e,n&&n.set(e,s),s}let gd="";function Oj(e,t){return gd||(gd=(0,cs.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,cs.isFunction)(e[n])})),(0,cs.isFunction)(e[gd])?e[gd](t):!1}function AL(e,t,n){let s=e;do{if(Oj(s,t))return!0;if(s===n)return!1;s=s.parentNode}while(s);return!1}function OL(e,t,n,s){if(!e)return;const r={capture:!0,...s};e.addEventListener?e.addEventListener(t,n,r):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function IL(e,t,n,s){if(!e)return;const r={capture:!0,...s};e.removeEventListener?e.removeEventListener(t,n,r):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function FL(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,cs.int)(n.borderTopWidth),t+=(0,cs.int)(n.borderBottomWidth),t}function BL(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,cs.int)(n.borderLeftWidth),t+=(0,cs.int)(n.borderRightWidth),t}function zL(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,cs.int)(n.paddingTop),t-=(0,cs.int)(n.paddingBottom),t}function $L(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,cs.int)(n.paddingLeft),t-=(0,cs.int)(n.paddingRight),t}function HL(e,t,n){const r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),i=(e.clientX+t.scrollLeft-r.left)/n,o=(e.clientY+t.scrollTop-r.top)/n;return{x:i,y:o}}function WL(e,t){const n=x0(e,t,"px");return{[(0,uw.browserPrefixToKey)("transform",uw.default)]:n}}function UL(e,t){return x0(e,t,"")}function x0(e,t,n){let{x:s,y:r}=e,i="translate(".concat(s).concat(n,",").concat(r).concat(n,")");if(t){const o="".concat(typeof t.x=="string"?t.x:t.x+n),a="".concat(typeof t.y=="string"?t.y:t.y+n);i="translate(".concat(o,", ").concat(a,")")+i}return i}function qL(e,t){return e.targetTouches&&(0,cs.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,cs.findInArray)(e.changedTouches,n=>t===n.identifier)}function KL(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function VL(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
456
|
-
`,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
457
|
-
`,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&Ij(e.body,"react-draggable-transparent-selection")}function YL(e){if(e)try{if(e.body&&Fj(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function Ij(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Fj(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var _r={};Object.defineProperty(_r,"__esModule",{value:!0});_r.canDragX=GL;_r.canDragY=JL;_r.createCoreData=eA;_r.createDraggableData=tA;_r.getBoundPosition=XL;_r.getControlPosition=ZL;_r.snapToGrid=QL;var rs=br,Ra=bt;function XL(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:s}=e.props;s=typeof s=="string"?s:nA(s);const r=v0(e);if(typeof s=="string"){const{ownerDocument:i}=r,o=i.defaultView;let a;if(s==="parent"?a=r.parentNode:a=i.querySelector(s),!(a instanceof o.HTMLElement))throw new Error('Bounds selector "'+s+'" could not find an element.');const c=a,u=o.getComputedStyle(r),d=o.getComputedStyle(c);s={left:-r.offsetLeft+(0,rs.int)(d.paddingLeft)+(0,rs.int)(u.marginLeft),top:-r.offsetTop+(0,rs.int)(d.paddingTop)+(0,rs.int)(u.marginTop),right:(0,Ra.innerWidth)(c)-(0,Ra.outerWidth)(r)-r.offsetLeft+(0,rs.int)(d.paddingRight)-(0,rs.int)(u.marginRight),bottom:(0,Ra.innerHeight)(c)-(0,Ra.outerHeight)(r)-r.offsetTop+(0,rs.int)(d.paddingBottom)-(0,rs.int)(u.marginBottom)}}return(0,rs.isNum)(s.right)&&(t=Math.min(t,s.right)),(0,rs.isNum)(s.bottom)&&(n=Math.min(n,s.bottom)),(0,rs.isNum)(s.left)&&(t=Math.max(t,s.left)),(0,rs.isNum)(s.top)&&(n=Math.max(n,s.top)),[t,n]}function QL(e,t,n){const s=Math.round(t/e[0])*e[0],r=Math.round(n/e[1])*e[1];return[s,r]}function GL(e){return e.props.axis==="both"||e.props.axis==="x"}function JL(e){return e.props.axis==="both"||e.props.axis==="y"}function ZL(e,t,n){const s=typeof t=="number"?(0,Ra.getTouch)(e,t):null;if(typeof t=="number"&&!s)return null;const r=v0(n),i=n.props.offsetParent||r.offsetParent||r.ownerDocument.body;return(0,Ra.offsetXYFromParent)(s||e,i,n.props.scale)}function eA(e,t,n){const s=!(0,rs.isNum)(e.lastX),r=v0(e);return s?{node:r,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:r,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function tA(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function nA(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function v0(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var ap={},lp={};Object.defineProperty(lp,"__esModule",{value:!0});lp.default=sA;function sA(){}Object.defineProperty(ap,"__esModule",{value:!0});ap.default=void 0;var dm=iA(v),$n=y0(Rj),rA=y0(js),vn=bt,ei=_r,hm=br,Hl=y0(lp);function y0(e){return e&&e.__esModule?e:{default:e}}function Bj(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Bj=function(s){return s?n:t})(e)}function iA(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Bj(t);if(n&&n.has(e))return n.get(e);var s={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var o=r?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(s,i,o):s[i]=e[i]}return s.default=e,n&&n.set(e,s),s}function Tn(e,t,n){return t=oA(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oA(e){var t=aA(e,"string");return typeof t=="symbol"?t:String(t)}function aA(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Ls={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let ti=Ls.mouse,cp=class extends dm.Component{constructor(){super(...arguments),Tn(this,"dragging",!1),Tn(this,"lastX",NaN),Tn(this,"lastY",NaN),Tn(this,"touchIdentifier",null),Tn(this,"mounted",!1),Tn(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:s}=n;if(this.props.disabled||!(t.target instanceof s.defaultView.Node)||this.props.handle&&!(0,vn.matchesSelectorAndParentsTo)(t.target,this.props.handle,n)||this.props.cancel&&(0,vn.matchesSelectorAndParentsTo)(t.target,this.props.cancel,n))return;t.type==="touchstart"&&t.preventDefault();const r=(0,vn.getTouchIdentifier)(t);this.touchIdentifier=r;const i=(0,ei.getControlPosition)(t,r,this);if(i==null)return;const{x:o,y:a}=i,c=(0,ei.createCoreData)(this,o,a);(0,Hl.default)("DraggableCore: handleDragStart: %j",c),(0,Hl.default)("calling",this.props.onStart),!(this.props.onStart(t,c)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,vn.addUserSelectStyles)(s),this.dragging=!0,this.lastX=o,this.lastY=a,(0,vn.addEvent)(s,ti.move,this.handleDrag),(0,vn.addEvent)(s,ti.stop,this.handleDragStop))}),Tn(this,"handleDrag",t=>{const n=(0,ei.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:s,y:r}=n;if(Array.isArray(this.props.grid)){let a=s-this.lastX,c=r-this.lastY;if([a,c]=(0,ei.snapToGrid)(this.props.grid,a,c),!a&&!c)return;s=this.lastX+a,r=this.lastY+c}const i=(0,ei.createCoreData)(this,s,r);if((0,Hl.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(t,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const c=document.createEvent("MouseEvents");c.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(c)}return}this.lastX=s,this.lastY=r}),Tn(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,ei.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:s,y:r}=n;if(Array.isArray(this.props.grid)){let c=s-this.lastX||0,u=r-this.lastY||0;[c,u]=(0,ei.snapToGrid)(this.props.grid,c,u),s=this.lastX+c,r=this.lastY+u}const i=(0,ei.createCoreData)(this,s,r);if(this.props.onStop(t,i)===!1||this.mounted===!1)return!1;const a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,vn.removeUserSelectStyles)(a.ownerDocument),(0,Hl.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,Hl.default)("DraggableCore: Removing handlers"),(0,vn.removeEvent)(a.ownerDocument,ti.move,this.handleDrag),(0,vn.removeEvent)(a.ownerDocument,ti.stop,this.handleDragStop))}),Tn(this,"onMouseDown",t=>(ti=Ls.mouse,this.handleDragStart(t))),Tn(this,"onMouseUp",t=>(ti=Ls.mouse,this.handleDragStop(t))),Tn(this,"onTouchStart",t=>(ti=Ls.touch,this.handleDragStart(t))),Tn(this,"onTouchEnd",t=>(ti=Ls.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,vn.addEvent)(t,Ls.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,vn.removeEvent)(n,Ls.mouse.move,this.handleDrag),(0,vn.removeEvent)(n,Ls.touch.move,this.handleDrag),(0,vn.removeEvent)(n,Ls.mouse.stop,this.handleDragStop),(0,vn.removeEvent)(n,Ls.touch.stop,this.handleDragStop),(0,vn.removeEvent)(t,Ls.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,vn.removeUserSelectStyles)(n)}}findDOMNode(){var t,n;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:rA.default.findDOMNode(this)}render(){return dm.cloneElement(dm.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};ap.default=cp;Tn(cp,"displayName","DraggableCore");Tn(cp,"propTypes",{allowAnyClick:$n.default.bool,children:$n.default.node.isRequired,disabled:$n.default.bool,enableUserSelectHack:$n.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:$n.default.arrayOf($n.default.number),handle:$n.default.string,cancel:$n.default.string,nodeRef:$n.default.object,onStart:$n.default.func,onDrag:$n.default.func,onStop:$n.default.func,onMouseDown:$n.default.func,scale:$n.default.number,className:hm.dontSetMe,style:hm.dontSetMe,transform:hm.dontSetMe});Tn(cp,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return c.default}}),e.default=void 0;var t=p(v),n=d(Rj),s=d(js),r=d(NL),i=bt,o=_r,a=br,c=d(ap),u=d(lp);function d(b){return b&&b.__esModule?b:{default:b}}function h(b){if(typeof WeakMap!="function")return null;var _=new WeakMap,S=new WeakMap;return(h=function(C){return C?S:_})(b)}function p(b,_){if(b&&b.__esModule)return b;if(b===null||typeof b!="object"&&typeof b!="function")return{default:b};var S=h(_);if(S&&S.has(b))return S.get(b);var C={},w=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var j in b)if(j!=="default"&&Object.prototype.hasOwnProperty.call(b,j)){var E=w?Object.getOwnPropertyDescriptor(b,j):null;E&&(E.get||E.set)?Object.defineProperty(C,j,E):C[j]=b[j]}return C.default=b,S&&S.set(b,C),C}function f(){return f=Object.assign?Object.assign.bind():function(b){for(var _=1;_<arguments.length;_++){var S=arguments[_];for(var C in S)Object.prototype.hasOwnProperty.call(S,C)&&(b[C]=S[C])}return b},f.apply(this,arguments)}function m(b,_,S){return _=g(_),_ in b?Object.defineProperty(b,_,{value:S,enumerable:!0,configurable:!0,writable:!0}):b[_]=S,b}function g(b){var _=y(b,"string");return typeof _=="symbol"?_:String(_)}function y(b,_){if(typeof b!="object"||b===null)return b;var S=b[Symbol.toPrimitive];if(S!==void 0){var C=S.call(b,_);if(typeof C!="object")return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return(_==="string"?String:Number)(b)}class x extends t.Component{static getDerivedStateFromProps(_,S){let{position:C}=_,{prevPropsPosition:w}=S;return C&&(!w||C.x!==w.x||C.y!==w.y)?((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:C,prevPropsPosition:w}),{x:C.x,y:C.y,prevPropsPosition:{...C}}):null}constructor(_){super(_),m(this,"onDragStart",(S,C)=>{if((0,u.default)("Draggable: onDragStart: %j",C),this.props.onStart(S,(0,o.createDraggableData)(this,C))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),m(this,"onDrag",(S,C)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",C);const w=(0,o.createDraggableData)(this,C),j={x:w.x,y:w.y,slackX:0,slackY:0};if(this.props.bounds){const{x:O,y:R}=j;j.x+=this.state.slackX,j.y+=this.state.slackY;const[B,L]=(0,o.getBoundPosition)(this,j.x,j.y);j.x=B,j.y=L,j.slackX=this.state.slackX+(O-j.x),j.slackY=this.state.slackY+(R-j.y),w.x=j.x,w.y=j.y,w.deltaX=j.x-this.state.x,w.deltaY=j.y-this.state.y}if(this.props.onDrag(S,w)===!1)return!1;this.setState(j)}),m(this,"onDragStop",(S,C)=>{if(!this.state.dragging||this.props.onStop(S,(0,o.createDraggableData)(this,C))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",C);const j={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:O,y:R}=this.props.position;j.x=O,j.y=R}this.setState(j)}),this.state={dragging:!1,dragged:!1,x:_.position?_.position.x:_.defaultPosition.x,y:_.position?_.position.y:_.defaultPosition.y,prevPropsPosition:{..._.position},slackX:0,slackY:0,isElementSVG:!1},_.position&&!(_.onDrag||_.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var _,S;return(_=(S=this.props)===null||S===void 0||(S=S.nodeRef)===null||S===void 0?void 0:S.current)!==null&&_!==void 0?_:s.default.findDOMNode(this)}render(){const{axis:_,bounds:S,children:C,defaultPosition:w,defaultClassName:j,defaultClassNameDragging:E,defaultClassNameDragged:O,position:R,positionOffset:B,scale:L,...D}=this.props;let T={},P=null;const W=!!!R||this.state.dragging,I=R||w,H={x:(0,o.canDragX)(this)&&W?this.state.x:I.x,y:(0,o.canDragY)(this)&&W?this.state.y:I.y};this.state.isElementSVG?P=(0,i.createSVGTransform)(H,B):T=(0,i.createCSSTransform)(H,B);const k=(0,r.default)(C.props.className||"",j,{[E]:this.state.dragging,[O]:this.state.dragged});return t.createElement(c.default,f({},D,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(C),{className:k,style:{...C.props.style,...T},transform:P}))}}e.default=x,m(x,"displayName","Draggable"),m(x,"propTypes",{...c.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),m(x,"defaultProps",{...c.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(jj);const{default:zj,DraggableCore:lA}=jj;op.exports=zj;op.exports.default=zj;op.exports.DraggableCore=lA;var cA=op.exports;const uA=ml(cA);var Et=function(){return Et=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Et.apply(this,arguments)},dw={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},hw={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},xd={width:"20px",height:"20px",position:"absolute",zIndex:1},dA={top:Et(Et({},dw),{top:"-5px"}),right:Et(Et({},hw),{left:void 0,right:"-5px"}),bottom:Et(Et({},dw),{top:void 0,bottom:"-5px"}),left:Et(Et({},hw),{left:"-5px"}),topRight:Et(Et({},xd),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:Et(Et({},xd),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:Et(Et({},xd),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:Et(Et({},xd),{left:"-10px",top:"-10px",cursor:"nw-resize"})},hA=v.memo(function(e){var t=e.onResizeStart,n=e.direction,s=e.children,r=e.replaceStyles,i=e.className,o=v.useCallback(function(u){t(u,n)},[t,n]),a=v.useCallback(function(u){t(u,n)},[t,n]),c=v.useMemo(function(){return Et(Et({position:"absolute",userSelect:"none"},dA[n]),r??{})},[r,n]);return l.jsx("div",{className:i||void 0,style:c,onMouseDown:o,onTouchStart:a,children:s})}),fA=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(s[i]=r[i])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function s(){this.constructor=t}t.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)}}(),er=function(){return er=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},er.apply(this,arguments)},pA={width:"auto",height:"auto"},vd=function(e,t,n){return Math.max(Math.min(e,n),t)},fw=function(e,t,n){var s=Math.round(e/t);return s*t+n*(s-1)},la=function(e,t){return new RegExp(e,"i").test(t)},yd=function(e){return!!(e.touches&&e.touches.length)},mA=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},pw=function(e,t,n){n===void 0&&(n=0);var s=t.reduce(function(i,o,a){return Math.abs(o-e)<Math.abs(t[i]-e)?a:i},0),r=Math.abs(t[s]-e);return n===0||r<n?t[s]:e},fm=function(e){return e=e.toString(),e==="auto"||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:"".concat(e,"px")},bd=function(e,t,n,s){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var r=Number(e.replace("%",""))/100;return t*r}if(e.endsWith("vw")){var r=Number(e.replace("vw",""))/100;return n*r}if(e.endsWith("vh")){var r=Number(e.replace("vh",""))/100;return s*r}}return e},gA=function(e,t,n,s,r,i,o){return s=bd(s,e.width,t,n),r=bd(r,e.height,t,n),i=bd(i,e.width,t,n),o=bd(o,e.height,t,n),{maxWidth:typeof s>"u"?void 0:Number(s),maxHeight:typeof r>"u"?void 0:Number(r),minWidth:typeof i>"u"?void 0:Number(i),minHeight:typeof o>"u"?void 0:Number(o)}},xA=function(e){return Array.isArray(e)?e:[e,e]},vA=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],mw="__resizable_base__",yA=function(e){fA(t,e);function t(n){var s,r,i,o,a=e.call(this,n)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.delta={width:0,height:0},a.appendBase=function(){if(!a.resizable||!a.window)return null;var c=a.parentNode;if(!c)return null;var u=a.window.document.createElement("div");return u.style.width="100%",u.style.height="100%",u.style.position="absolute",u.style.transform="scale(0, 0)",u.style.left="0",u.style.flex="0 0 100%",u.classList?u.classList.add(mw):u.className+=mw,c.appendChild(u),u},a.removeBase=function(c){var u=a.parentNode;u&&u.removeChild(c)},a.state={isResizing:!1,width:(r=(s=a.propsSize)===null||s===void 0?void 0:s.width)!==null&&r!==void 0?r:"auto",height:(o=(i=a.propsSize)===null||i===void 0?void 0:i.height)!==null&&o!==void 0?o:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||pA},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,s=0;if(this.resizable&&this.window){var r=this.resizable.offsetWidth,i=this.resizable.offsetHeight,o=this.resizable.style.position;o!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:r,s=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:i,this.resizable.style.position=o}return{width:n,height:s}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,s=this.props.size,r=function(a){var c;if(typeof n.state[a]>"u"||n.state[a]==="auto")return"auto";if(n.propsSize&&n.propsSize[a]&&(!((c=n.propsSize[a])===null||c===void 0)&&c.toString().endsWith("%"))){if(n.state[a].toString().endsWith("%"))return n.state[a].toString();var u=n.getParentSize(),d=Number(n.state[a].toString().replace("px","")),h=d/u[a]*100;return"".concat(h,"%")}return fm(n.state[a])},i=s&&typeof s.width<"u"&&!this.state.isResizing?fm(s.width):r("width"),o=s&&typeof s.height<"u"&&!this.state.isResizing?fm(s.height):r("height");return{width:i,height:o}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var s=!1,r=this.parentNode.style.flexWrap;r!=="wrap"&&(s=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var i={width:n.offsetWidth,height:n.offsetHeight};return s&&(this.parentNode.style.flexWrap=r),this.removeBase(n),i},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,s){var r=this.propsSize&&this.propsSize[s];return this.state[s]==="auto"&&this.state.original[s]===n&&(typeof r>"u"||r==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,s){var r=this.props.boundsByDirection,i=this.state.direction,o=r&&la("left",i),a=r&&la("top",i),c,u;if(this.props.bounds==="parent"){var d=this.parentNode;d&&(c=o?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),u=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(c=o?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(c=o?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return c&&Number.isFinite(c)&&(n=n&&n<c?n:c),u&&Number.isFinite(u)&&(s=s&&s<u?s:u),{maxWidth:n,maxHeight:s}},t.prototype.calculateNewSizeFromDirection=function(n,s){var r=this.props.scale||1,i=xA(this.props.resizeRatio||1),o=i[0],a=i[1],c=this.state,u=c.direction,d=c.original,h=this.props,p=h.lockAspectRatio,f=h.lockAspectRatioExtraHeight,m=h.lockAspectRatioExtraWidth,g=d.width,y=d.height,x=f||0,b=m||0;return la("right",u)&&(g=d.width+(n-d.x)*o/r,p&&(y=(g-b)/this.ratio+x)),la("left",u)&&(g=d.width-(n-d.x)*o/r,p&&(y=(g-b)/this.ratio+x)),la("bottom",u)&&(y=d.height+(s-d.y)*a/r,p&&(g=(y-x)*this.ratio+b)),la("top",u)&&(y=d.height-(s-d.y)*a/r,p&&(g=(y-x)*this.ratio+b)),{newWidth:g,newHeight:y}},t.prototype.calculateNewSizeFromAspectRatio=function(n,s,r,i){var o=this.props,a=o.lockAspectRatio,c=o.lockAspectRatioExtraHeight,u=o.lockAspectRatioExtraWidth,d=typeof i.width>"u"?10:i.width,h=typeof r.width>"u"||r.width<0?n:r.width,p=typeof i.height>"u"?10:i.height,f=typeof r.height>"u"||r.height<0?s:r.height,m=c||0,g=u||0;if(a){var y=(p-m)*this.ratio+g,x=(f-m)*this.ratio+g,b=(d-g)/this.ratio+m,_=(h-g)/this.ratio+m,S=Math.max(d,y),C=Math.min(h,x),w=Math.max(p,b),j=Math.min(f,_);n=vd(n,S,C),s=vd(s,w,j)}else n=vd(n,d,h),s=vd(s,p,f);return{newWidth:n,newHeight:s}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var s=this.parentNode;if(s){var r=s.getBoundingClientRect();this.parentLeft=r.left*n,this.parentTop=r.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left*n,this.targetTop=i.top*n}if(this.resizable){var o=this.resizable.getBoundingClientRect(),a=o.left,c=o.top,u=o.right,d=o.bottom;this.resizableLeft=a*n,this.resizableRight=u*n,this.resizableTop=c*n,this.resizableBottom=d*n}},t.prototype.onResizeStart=function(n,s){if(!(!this.resizable||!this.window)){var r=0,i=0;if(n.nativeEvent&&mA(n.nativeEvent)?(r=n.nativeEvent.clientX,i=n.nativeEvent.clientY):n.nativeEvent&&yd(n.nativeEvent)&&(r=n.nativeEvent.touches[0].clientX,i=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var o=this.props.onResizeStart(n,s,this.resizable);if(o===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var a,c=this.window.getComputedStyle(this.resizable);if(c.flexBasis!=="auto"){var u=this.parentNode;if(u){var d=this.window.getComputedStyle(u).flexDirection;this.flexDir=d.startsWith("row")?"row":"column",a=c.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var h={original:{x:r,y:i,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:er(er({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:s,flexBasis:a};this.setState(h)}},t.prototype.onMouseMove=function(n){var s=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&yd(n))try{n.preventDefault(),n.stopPropagation()}catch{}var r=this.props,i=r.maxWidth,o=r.maxHeight,a=r.minWidth,c=r.minHeight,u=yd(n)?n.touches[0].clientX:n.clientX,d=yd(n)?n.touches[0].clientY:n.clientY,h=this.state,p=h.direction,f=h.original,m=h.width,g=h.height,y=this.getParentSize(),x=gA(y,this.window.innerWidth,this.window.innerHeight,i,o,a,c);i=x.maxWidth,o=x.maxHeight,a=x.minWidth,c=x.minHeight;var b=this.calculateNewSizeFromDirection(u,d),_=b.newHeight,S=b.newWidth,C=this.calculateNewMaxFromBoundary(i,o);this.props.snap&&this.props.snap.x&&(S=pw(S,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(_=pw(_,this.props.snap.y,this.props.snapGap));var w=this.calculateNewSizeFromAspectRatio(S,_,{width:C.maxWidth,height:C.maxHeight},{width:a,height:c});if(S=w.newWidth,_=w.newHeight,this.props.grid){var j=fw(S,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),E=fw(_,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),O=this.props.snapGap||0,R=O===0||Math.abs(j-S)<=O?j:S,B=O===0||Math.abs(E-_)<=O?E:_;S=R,_=B}var L={width:S-f.width,height:_-f.height};if(this.delta=L,m&&typeof m=="string"){if(m.endsWith("%")){var D=S/y.width*100;S="".concat(D,"%")}else if(m.endsWith("vw")){var T=S/this.window.innerWidth*100;S="".concat(T,"vw")}else if(m.endsWith("vh")){var P=S/this.window.innerHeight*100;S="".concat(P,"vh")}}if(g&&typeof g=="string"){if(g.endsWith("%")){var D=_/y.height*100;_="".concat(D,"%")}else if(g.endsWith("vw")){var T=_/this.window.innerWidth*100;_="".concat(T,"vw")}else if(g.endsWith("vh")){var P=_/this.window.innerHeight*100;_="".concat(P,"vh")}}var $={width:this.createSizeForCssProperty(S,"width"),height:this.createSizeForCssProperty(_,"height")};this.flexDir==="row"?$.flexBasis=$.width:this.flexDir==="column"&&($.flexBasis=$.height);var W=this.state.width!==$.width,I=this.state.height!==$.height,H=this.state.flexBasis!==$.flexBasis,k=W||I||H;k&&js.flushSync(function(){s.setState($)}),this.props.onResize&&k&&this.props.onResize(n,p,this.resizable,L)}},t.prototype.onMouseUp=function(n){var s,r,i=this.state,o=i.isResizing,a=i.direction;i.original,!(!o||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(n,a,this.resizable,this.delta),this.props.size&&this.setState({width:(s=this.props.size.width)!==null&&s!==void 0?s:"auto",height:(r=this.props.size.height)!==null&&r!==void 0?r:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:er(er({},this.state.backgroundStyle),{cursor:"auto"})}))},t.prototype.updateSize=function(n){var s,r;this.setState({width:(s=n.width)!==null&&s!==void 0?s:"auto",height:(r=n.height)!==null&&r!==void 0?r:"auto"})},t.prototype.renderResizer=function(){var n=this,s=this.props,r=s.enable,i=s.handleStyles,o=s.handleClasses,a=s.handleWrapperStyle,c=s.handleWrapperClass,u=s.handleComponent;if(!r)return null;var d=Object.keys(r).map(function(h){return r[h]!==!1?l.jsx(hA,{direction:h,onResizeStart:n.onResizeStart,replaceStyles:i&&i[h],className:o&&o[h],children:u&&u[h]?u[h]:null},h):null});return l.jsx("div",{className:c,style:a,children:d})},t.prototype.render=function(){var n=this,s=Object.keys(this.props).reduce(function(o,a){return vA.indexOf(a)!==-1||(o[a]=n.props[a]),o},{}),r=er(er(er({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(r.flexBasis=this.state.flexBasis);var i=this.props.as||"div";return l.jsxs(i,er({style:r,className:this.props.className},s,{ref:function(o){o&&(n.resizable=o)},children:[this.state.isResizing&&l.jsx("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(v.PureComponent);/*! *****************************************************************************
|
|
458
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
459
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
460
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
461
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
462
|
-
|
|
463
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
464
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
465
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
466
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
467
|
-
|
|
468
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
469
|
-
and limitations under the License.
|
|
470
|
-
***************************************************************************** */var Ox=function(e,t){return Ox=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var r in s)s.hasOwnProperty(r)&&(n[r]=s[r])},Ox(e,t)};function bA(e,t){Ox(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var It=function(){return It=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},It.apply(this,arguments)};function _A(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}var wA={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},SA=function(e){return{bottom:e,bottomLeft:e,bottomRight:e,left:e,right:e,top:e,topLeft:e,topRight:e}},kA=function(e){bA(t,e);function t(n){var s=e.call(this,n)||this;return s.resizingPosition={x:0,y:0},s.offsetFromParent={left:0,top:0},s.resizableElement={current:null},s.originalPosition={x:0,y:0},s.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:n.maxWidth,maxHeight:n.maxHeight},s.onResizeStart=s.onResizeStart.bind(s),s.onResize=s.onResize.bind(s),s.onResizeStop=s.onResizeStop.bind(s),s.onDragStart=s.onDragStart.bind(s),s.onDrag=s.onDrag.bind(s),s.onDragStop=s.onDragStop.bind(s),s.getMaxSizesFromProps=s.getMaxSizesFromProps.bind(s),s}return t.prototype.componentDidMount=function(){this.updateOffsetFromParent();var n=this.offsetFromParent,s=n.left,r=n.top,i=this.getDraggablePosition(),o=i.x,a=i.y;this.draggable.setState({x:o-s,y:a-r}),this.forceUpdate()},t.prototype.getDraggablePosition=function(){var n=this.draggable.state,s=n.x,r=n.y;return{x:s,y:r}},t.prototype.getParent=function(){return this.resizable&&this.resizable.parentNode},t.prototype.getParentSize=function(){return this.resizable.getParentSize()},t.prototype.getMaxSizesFromProps=function(){var n=typeof this.props.maxWidth>"u"?Number.MAX_SAFE_INTEGER:this.props.maxWidth,s=typeof this.props.maxHeight>"u"?Number.MAX_SAFE_INTEGER:this.props.maxHeight;return{maxWidth:n,maxHeight:s}},t.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},t.prototype.getOffsetHeight=function(n){var s=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/s;case"body":return document.body.offsetHeight/s;default:return n.offsetHeight}},t.prototype.getOffsetWidth=function(n){var s=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/s;case"body":return document.body.offsetWidth/s;default:return n.offsetWidth}},t.prototype.onDragStart=function(n,s){this.props.onDragStart&&this.props.onDragStart(n,s);var r=this.getDraggablePosition();if(this.originalPosition=r,!!this.props.bounds){var i=this.getParent(),o=this.props.scale,a;if(this.props.bounds==="parent")a=i;else if(this.props.bounds==="body"){var c=i.getBoundingClientRect(),u=c.left,d=c.top,h=document.body.getBoundingClientRect(),p=-(u-i.offsetLeft*o-h.left)/o,f=-(d-i.offsetTop*o-h.top)/o,m=(document.body.offsetWidth-this.resizable.size.width*o)/o+p,g=(document.body.offsetHeight-this.resizable.size.height*o)/o+f;return this.setState({bounds:{top:f,right:m,bottom:g,left:p}})}else if(this.props.bounds==="window"){if(!this.resizable)return;var y=i.getBoundingClientRect(),x=y.left,b=y.top,_=-(x-i.offsetLeft*o)/o,S=-(b-i.offsetTop*o)/o,m=(window.innerWidth-this.resizable.size.width*o)/o+_,g=(window.innerHeight-this.resizable.size.height*o)/o+S;return this.setState({bounds:{top:S,right:m,bottom:g,left:_}})}else typeof this.props.bounds=="string"?a=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(a=this.props.bounds);if(!(!(a instanceof HTMLElement)||!(i instanceof HTMLElement))){var C=a.getBoundingClientRect(),w=C.left,j=C.top,E=i.getBoundingClientRect(),O=E.left,R=E.top,B=(w-O)/o,L=j-R;if(this.resizable){this.updateOffsetFromParent();var D=this.offsetFromParent;this.setState({bounds:{top:L-D.top,right:B+(a.offsetWidth-this.resizable.size.width)-D.left/o,bottom:L+(a.offsetHeight-this.resizable.size.height)-D.top,left:B-D.left/o}})}}}},t.prototype.onDrag=function(n,s){if(this.props.onDrag){var r=this.offsetFromParent,i=r.left,o=r.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDrag(n,It(It({},s),{x:s.x+i,y:s.y+o}));if(this.props.dragAxis==="x")return this.props.onDrag(n,It(It({},s),{x:s.x+i,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDrag(n,It(It({},s),{x:this.originalPosition.x+i,y:s.y+o,deltaX:0}))}},t.prototype.onDragStop=function(n,s){if(this.props.onDragStop){var r=this.offsetFromParent,i=r.left,o=r.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDragStop(n,It(It({},s),{x:s.x+i,y:s.y+o}));if(this.props.dragAxis==="x")return this.props.onDragStop(n,It(It({},s),{x:s.x+i,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDragStop(n,It(It({},s),{x:this.originalPosition.x+i,y:s.y+o,deltaX:0}))}},t.prototype.onResizeStart=function(n,s,r){n.stopPropagation(),this.setState({resizing:!0});var i=this.props.scale,o=this.offsetFromParent,a=this.getDraggablePosition();if(this.resizingPosition={x:a.x+o.left,y:a.y+o.top},this.originalPosition=a,this.props.bounds){var c=this.getParent(),u=void 0;this.props.bounds==="parent"?u=c:this.props.bounds==="body"?u=document.body:this.props.bounds==="window"?u=window:typeof this.props.bounds=="string"?u=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(u=this.props.bounds);var d=this.getSelfElement();if(d instanceof Element&&(u instanceof HTMLElement||u===window)&&c instanceof HTMLElement){var h=this.getMaxSizesFromProps(),p=h.maxWidth,f=h.maxHeight,m=this.getParentSize();if(p&&typeof p=="string")if(p.endsWith("%")){var g=Number(p.replace("%",""))/100;p=m.width*g}else p.endsWith("px")&&(p=Number(p.replace("px","")));if(f&&typeof f=="string")if(f.endsWith("%")){var g=Number(f.replace("%",""))/100;f=m.height*g}else f.endsWith("px")&&(f=Number(f.replace("px","")));var y=d.getBoundingClientRect(),x=y.left,b=y.top,_=this.props.bounds==="window"?{left:0,top:0}:u.getBoundingClientRect(),S=_.left,C=_.top,w=this.getOffsetWidth(u),j=this.getOffsetHeight(u),E=s.toLowerCase().endsWith("left"),O=s.toLowerCase().endsWith("right"),R=s.startsWith("top"),B=s.startsWith("bottom");if((E||R)&&this.resizable){var L=(x-S)/i+this.resizable.size.width;this.setState({maxWidth:L>Number(p)?p:L})}if(O||this.props.lockAspectRatio&&!E&&!R){var L=w+(S-x)/i;this.setState({maxWidth:L>Number(p)?p:L})}if((R||E)&&this.resizable){var L=(b-C)/i+this.resizable.size.height;this.setState({maxHeight:L>Number(f)?f:L})}if(B||this.props.lockAspectRatio&&!R&&!E){var L=j+(C-b)/i;this.setState({maxHeight:L>Number(f)?f:L})}}}else this.setState({maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight});this.props.onResizeStart&&this.props.onResizeStart(n,s,r)},t.prototype.onResize=function(n,s,r,i){var o=this,a={x:this.originalPosition.x,y:this.originalPosition.y},c=-i.width,u=-i.height,d=["top","left","topLeft","bottomLeft","topRight"];d.includes(s)&&(s==="bottomLeft"?a.x+=c:(s==="topRight"||(a.x+=c),a.y+=u));var h=this.draggable.state;(a.x!==h.x||a.y!==h.y)&&js.flushSync(function(){o.draggable.setState(a)}),this.updateOffsetFromParent();var p=this.offsetFromParent,f=this.getDraggablePosition().x+p.left,m=this.getDraggablePosition().y+p.top;this.resizingPosition={x:f,y:m},this.props.onResize&&this.props.onResize(n,s,r,i,{x:f,y:m})},t.prototype.onResizeStop=function(n,s,r,i){this.setState({resizing:!1});var o=this.getMaxSizesFromProps(),a=o.maxWidth,c=o.maxHeight;this.setState({maxWidth:a,maxHeight:c}),this.props.onResizeStop&&this.props.onResizeStop(n,s,r,i,this.resizingPosition)},t.prototype.updateSize=function(n){this.resizable&&this.resizable.updateSize({width:n.width,height:n.height})},t.prototype.updatePosition=function(n){this.draggable.setState(n)},t.prototype.updateOffsetFromParent=function(){var n=this.props.scale,s=this.getParent(),r=this.getSelfElement();if(!s||r===null)return{top:0,left:0};var i=s.getBoundingClientRect(),o=i.left,a=i.top,c=r.getBoundingClientRect(),u=this.getDraggablePosition(),d=s.scrollLeft,h=s.scrollTop;this.offsetFromParent={left:c.left-o+d-u.x*n,top:c.top-a+h-u.y*n}},t.prototype.render=function(){var n=this,s=this.props,r=s.disableDragging,i=s.style,o=s.dragHandleClassName,a=s.position,c=s.onMouseDown,u=s.onMouseUp,d=s.dragAxis,h=s.dragGrid,p=s.bounds,f=s.enableUserSelectHack,m=s.cancel,g=s.children;s.onResizeStart,s.onResize,s.onResizeStop,s.onDragStart,s.onDrag,s.onDragStop;var y=s.resizeHandleStyles,x=s.resizeHandleClasses,b=s.resizeHandleComponent,_=s.enableResizing,S=s.resizeGrid,C=s.resizeHandleWrapperClass,w=s.resizeHandleWrapperStyle,j=s.scale,E=s.allowAnyClick,O=s.dragPositionOffset,R=_A(s,["disableDragging","style","dragHandleClassName","position","onMouseDown","onMouseUp","dragAxis","dragGrid","bounds","enableUserSelectHack","cancel","children","onResizeStart","onResize","onResizeStop","onDragStart","onDrag","onDragStop","resizeHandleStyles","resizeHandleClasses","resizeHandleComponent","enableResizing","resizeGrid","resizeHandleWrapperClass","resizeHandleWrapperStyle","scale","allowAnyClick","dragPositionOffset"]),B=this.props.default?It({},this.props.default):void 0;delete R.default;var L=r||o?{cursor:"auto"}:{cursor:"move"},D=It(It(It({},wA),L),i),T=this.offsetFromParent,P=T.left,$=T.top,W;a&&(W={x:a.x-P,y:a.y-$});var I=this.state.resizing?void 0:W,H=this.state.resizing?"both":d;return v.createElement(uA,{ref:function(k){k&&(n.draggable=k)},handle:o?".".concat(o):void 0,defaultPosition:B,onMouseDown:c,onMouseUp:u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,axis:H,disabled:r,grid:h,bounds:p?this.state.bounds:void 0,position:I,enableUserSelectHack:f,cancel:m,scale:j,allowAnyClick:E,nodeRef:this.resizableElement,positionOffset:O},v.createElement(yA,It({},R,{ref:function(k){k&&(n.resizable=k,n.resizableElement.current=k.resizable)},defaultSize:B,size:this.props.size,enable:typeof _=="boolean"?SA(_):_,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,style:D,minWidth:this.props.minWidth,minHeight:this.props.minHeight,maxWidth:this.state.resizing?this.state.maxWidth:this.props.maxWidth,maxHeight:this.state.resizing?this.state.maxHeight:this.props.maxHeight,grid:S,handleWrapperClass:C,handleWrapperStyle:w,lockAspectRatio:this.props.lockAspectRatio,lockAspectRatioExtraWidth:this.props.lockAspectRatioExtraWidth,lockAspectRatioExtraHeight:this.props.lockAspectRatioExtraHeight,handleStyles:y,handleClasses:x,handleComponent:b,scale:this.props.scale}),g))},t.defaultProps={maxWidth:Number.MAX_SAFE_INTEGER,maxHeight:Number.MAX_SAFE_INTEGER,scale:1,onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},onDragStart:function(){},onDrag:function(){},onDragStop:function(){}},t}(v.PureComponent);/**
|
|
471
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
472
|
-
* @license MIT
|
|
473
|
-
*
|
|
474
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
475
|
-
* @license MIT
|
|
476
|
-
*
|
|
477
|
-
* Originally forked from (with the author's permission):
|
|
478
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
479
|
-
* http://bellard.org/jslinux/
|
|
480
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
481
|
-
*/var $j=Object.defineProperty,CA=Object.getOwnPropertyDescriptor,NA=(e,t)=>{for(var n in t)$j(e,n,{get:t[n],enumerable:!0})},_t=(e,t,n,s)=>{for(var r=s>1?void 0:s?CA(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(r=(s?o(t,n,r):o(r))||r);return s&&r&&$j(t,n,r),r},le=(e,t)=>(n,s)=>t(n,s,e),gw="Terminal input",Ix={get:()=>gw,set:e=>gw=e},xw="Too much output to announce, navigate to rows manually to read",Fx={get:()=>xw,set:e=>xw=e};function jA(e){return e.replace(/\r?\n/g,"\r")}function EA(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function PA(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function TA(e,t,n,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");Hj(r,t,n,s)}}function Hj(e,t,n,s){e=jA(e),e=EA(e,n.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function Wj(e,t,n){let s=n.getBoundingClientRect(),r=e.clientX-s.left-10,i=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${i}px`,t.style.zIndex="1000",t.focus()}function vw(e,t,n,s,r){Wj(e,t,n),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function di(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function up(e,t=0,n=e.length){let s="";for(let r=t;r<n;++r){let i=e[r];i>65535?(i-=65536,s+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):s+=String.fromCharCode(i)}return s}var RA=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let s=0,r=0;if(this._interim){let i=e.charCodeAt(r++);56320<=i&&i<=57343?t[s++]=(this._interim-55296)*1024+i-56320+65536:(t[s++]=this._interim,t[s++]=i),this._interim=0}for(let i=r;i<n;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=n)return this._interim=o,s;let a=e.charCodeAt(i);56320<=a&&a<=57343?t[s++]=(o-55296)*1024+a-56320+65536:(t[s++]=o,t[s++]=a);continue}o!==65279&&(t[s++]=o)}return s}},DA=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let s=0,r,i,o,a,c=0,u=0;if(this.interim[0]){let p=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let m=0,g;for(;(g=this.interim[++m]&63)&&m<4;)f<<=6,f|=g;let y=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,x=y-m;for(;u<x;){if(u>=n)return 0;if(g=e[u++],(g&192)!==128){u--,p=!0;break}else this.interim[m++]=g,f<<=6,f|=g&63}p||(y===2?f<128?u--:t[s++]=f:y===3?f<2048||f>=55296&&f<=57343||f===65279||(t[s++]=f):f<65536||f>1114111||(t[s++]=f)),this.interim.fill(0)}let d=n-4,h=u;for(;h<n;){for(;h<d&&!((r=e[h])&128)&&!((i=e[h+1])&128)&&!((o=e[h+2])&128)&&!((a=e[h+3])&128);)t[s++]=r,t[s++]=i,t[s++]=o,t[s++]=a,h+=4;if(r=e[h++],r<128)t[s++]=r;else if((r&224)===192){if(h>=n)return this.interim[0]=r,s;if(i=e[h++],(i&192)!==128){h--;continue}if(c=(r&31)<<6|i&63,c<128){h--;continue}t[s++]=c}else if((r&240)===224){if(h>=n)return this.interim[0]=r,s;if(i=e[h++],(i&192)!==128){h--;continue}if(h>=n)return this.interim[0]=r,this.interim[1]=i,s;if(o=e[h++],(o&192)!==128){h--;continue}if(c=(r&15)<<12|(i&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((r&248)===240){if(h>=n)return this.interim[0]=r,s;if(i=e[h++],(i&192)!==128){h--;continue}if(h>=n)return this.interim[0]=r,this.interim[1]=i,s;if(o=e[h++],(o&192)!==128){h--;continue}if(h>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=o,s;if(a=e[h++],(a&192)!==128){h--;continue}if(c=(r&7)<<18|(i&63)<<12|(o&63)<<6|a&63,c<65536||c>1114111)continue;t[s++]=c}}return s}},Uj="",Ni=" ",Bu=class qj{constructor(){this.fg=0,this.bg=0,this.extended=new gf}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new qj;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},gf=class Kj{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Kj(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ps=class Vj extends Bu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new gf,this.combinedData=""}static fromCharData(t){let n=new Vj;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?di(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},yw="di$target",Bx="di$dependencies",pm=new Map;function MA(e){return e[Bx]||[]}function nn(e){if(pm.has(e))return pm.get(e);let t=function(n,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");LA(t,n,r)};return t._id=e,pm.set(e,t),t}function LA(e,t,n){t[yw]===t?t[Bx].push({id:e,index:n}):(t[Bx]=[{id:e,index:n}],t[yw]=t)}var Bn=nn("BufferService"),Yj=nn("CoreMouseService"),ra=nn("CoreService"),AA=nn("CharsetService"),b0=nn("InstantiationService"),Xj=nn("LogService"),zn=nn("OptionsService"),Qj=nn("OscLinkService"),OA=nn("UnicodeService"),zu=nn("DecorationService"),zx=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var d;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,i=new Ps,o=n.getTrimmedLength(),a=-1,c=-1,u=!1;for(let h=0;h<o;h++)if(!(c===-1&&!n.hasContent(h))){if(n.loadCell(h,i),i.hasExtendedAttrs()&&i.extended.urlId)if(c===-1){c=h,a=i.extended.urlId;continue}else u=i.extended.urlId!==a;else c!==-1&&(u=!0);if(u||c!==-1&&h===o-1){let p=(d=this._oscLinkService.getLinkData(a))==null?void 0:d.uri;if(p){let f={start:{x:c+1,y:e},end:{x:h+(!u&&h===o-1?1:0),y:e}},m=!1;if(!(r!=null&&r.allowNonHttpProtocols))try{let g=new URL(p);["http:","https:"].includes(g.protocol)||(m=!0)}catch{m=!0}m||s.push({text:p,range:f,activate:(g,y)=>r?r.activate(g,y,f):IA(g,y),hover:(g,y)=>{var x;return(x=r==null?void 0:r.hover)==null?void 0:x.call(r,g,y,f)},leave:(g,y)=>{var x;return(x=r==null?void 0:r.leave)==null?void 0:x.call(r,g,y,f)}})}u=!1,i.hasExtendedAttrs()&&i.extended.urlId?(c=h,a=i.extended.urlId):(c=-1,a=-1)}}t(s)}};zx=_t([le(0,Bn),le(1,zn),le(2,Qj)],zx);function IA(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
482
|
-
|
|
483
|
-
WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var dp=nn("CharSizeService"),Xr=nn("CoreBrowserService"),_0=nn("MouseService"),Qr=nn("RenderService"),FA=nn("SelectionService"),Gj=nn("CharacterJoinerService"),kl=nn("ThemeService"),Jj=nn("LinkProviderService"),BA=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?bw.isErrorNoTelemetry(e)?new bw(e.message+`
|
|
484
|
-
|
|
485
|
-
`+e.stack):new Error(e.message+`
|
|
486
|
-
|
|
487
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},zA=new BA;function vh(e){$A(e)||zA.onUnexpectedError(e)}var $x="Canceled";function $A(e){return e instanceof HA?!0:e instanceof Error&&e.name===$x&&e.message===$x}var HA=class extends Error{constructor(){super($x),this.name=this.message}};function WA(e){return new Error(`Illegal argument: ${e}`)}var bw=class Hx extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Hx)return t;let n=new Hx;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Wx=class Zj extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Zj.prototype)}};function ns(e,t=0){return e[e.length-(1+t)]}var UA;(e=>{function t(i){return i<0}e.isLessThan=t;function n(i){return i<=0}e.isLessThanOrEqual=n;function s(i){return i>0}e.isGreaterThan=s;function r(i){return i===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(UA||(UA={}));function qA(e,t){let n=this,s=!1,r;return function(){return s||(s=!0,t||(r=e.apply(n,arguments))),r}}var eE;(e=>{function t(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function s(){return n}e.empty=s;function*r(S){yield S}e.single=r;function i(S){return t(S)?S:r(S)}e.wrap=i;function o(S){return S||n}e.from=o;function*a(S){for(let C=S.length-1;C>=0;C--)yield S[C]}e.reverse=a;function c(S){return!S||S[Symbol.iterator]().next().done===!0}e.isEmpty=c;function u(S){return S[Symbol.iterator]().next().value}e.first=u;function d(S,C){let w=0;for(let j of S)if(C(j,w++))return!0;return!1}e.some=d;function h(S,C){for(let w of S)if(C(w))return w}e.find=h;function*p(S,C){for(let w of S)C(w)&&(yield w)}e.filter=p;function*f(S,C){let w=0;for(let j of S)yield C(j,w++)}e.map=f;function*m(S,C){let w=0;for(let j of S)yield*C(j,w++)}e.flatMap=m;function*g(...S){for(let C of S)yield*C}e.concat=g;function y(S,C,w){let j=w;for(let E of S)j=C(j,E);return j}e.reduce=y;function*x(S,C,w=S.length){for(C<0&&(C+=S.length),w<0?w+=S.length:w>S.length&&(w=S.length);C<w;C++)yield S[C]}e.slice=x;function b(S,C=Number.POSITIVE_INFINITY){let w=[];if(C===0)return[w,S];let j=S[Symbol.iterator]();for(let E=0;E<C;E++){let O=j.next();if(O.done)return[w,e.empty()];w.push(O.value)}return[w,{[Symbol.iterator](){return j}}]}e.consume=b;async function _(S){let C=[];for await(let w of S)C.push(w);return Promise.resolve(C)}e.asyncToArray=_})(eE||(eE={}));function Yo(e){if(eE.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function KA(...e){return at(()=>Yo(e))}function at(e){return{dispose:qA(()=>{e()})}}var tE=class nE{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Yo(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?nE.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};tE.DISABLE_DISPOSED_WARNING=!1;var $i=tE,Te=class{constructor(){this._store=new $i,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Te.None=Object.freeze({dispose(){}});var cl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var n;this._isDisposed||t===this._value||((n=this._value)==null||n.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Fr=typeof window=="object"?window:globalThis,Ux=class qx{constructor(t){this.element=t,this.next=qx.Undefined,this.prev=qx.Undefined}};Ux.Undefined=new Ux(void 0);var lt=Ux,_w=class{constructor(){this._first=lt.Undefined,this._last=lt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===lt.Undefined}clear(){let e=this._first;for(;e!==lt.Undefined;){let t=e.next;e.prev=lt.Undefined,e.next=lt.Undefined,e=t}this._first=lt.Undefined,this._last=lt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new lt(e);if(this._first===lt.Undefined)this._first=n,this._last=n;else if(t){let r=this._last;this._last=n,n.prev=r,r.next=n}else{let r=this._first;this._first=n,n.next=r,r.prev=n}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(n))}}shift(){if(this._first!==lt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==lt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==lt.Undefined&&e.next!==lt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===lt.Undefined&&e.next===lt.Undefined?(this._first=lt.Undefined,this._last=lt.Undefined):e.next===lt.Undefined?(this._last=this._last.prev,this._last.next=lt.Undefined):e.prev===lt.Undefined&&(this._first=this._first.next,this._first.prev=lt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==lt.Undefined;)yield e.element,e=e.next}},VA=globalThis.performance&&typeof globalThis.performance.now=="function",YA=class sE{static create(t){return new sE(t)}constructor(t){this._now=VA&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},un;(e=>{e.None=()=>Te.None;function t(L,D){return h(L,()=>{},0,void 0,!0,void 0,D)}e.defer=t;function n(L){return(D,T=null,P)=>{let $=!1,W;return W=L(I=>{if(!$)return W?W.dispose():$=!0,D.call(T,I)},null,P),$&&W.dispose(),W}}e.once=n;function s(L,D,T){return u((P,$=null,W)=>L(I=>P.call($,D(I)),null,W),T)}e.map=s;function r(L,D,T){return u((P,$=null,W)=>L(I=>{D(I),P.call($,I)},null,W),T)}e.forEach=r;function i(L,D,T){return u((P,$=null,W)=>L(I=>D(I)&&P.call($,I),null,W),T)}e.filter=i;function o(L){return L}e.signal=o;function a(...L){return(D,T=null,P)=>{let $=KA(...L.map(W=>W(I=>D.call(T,I))));return d($,P)}}e.any=a;function c(L,D,T,P){let $=T;return s(L,W=>($=D($,W),$),P)}e.reduce=c;function u(L,D){let T,P={onWillAddFirstListener(){T=L($.fire,$)},onDidRemoveLastListener(){T==null||T.dispose()}},$=new re(P);return D==null||D.add($),$.event}function d(L,D){return D instanceof Array?D.push(L):D&&D.add(L),L}function h(L,D,T=100,P=!1,$=!1,W,I){let H,k,F,M=0,N,z={leakWarningThreshold:W,onWillAddFirstListener(){H=L(K=>{M++,k=D(k,K),P&&!F&&(U.fire(k),k=void 0),N=()=>{let Q=k;k=void 0,F=void 0,(!P||M>1)&&U.fire(Q),M=0},typeof T=="number"?(clearTimeout(F),F=setTimeout(N,T)):F===void 0&&(F=0,queueMicrotask(N))})},onWillRemoveListener(){$&&M>0&&(N==null||N())},onDidRemoveLastListener(){N=void 0,H.dispose()}},U=new re(z);return I==null||I.add(U),U.event}e.debounce=h;function p(L,D=0,T){return e.debounce(L,(P,$)=>P?(P.push($),P):[$],D,void 0,!0,void 0,T)}e.accumulate=p;function f(L,D=(P,$)=>P===$,T){let P=!0,$;return i(L,W=>{let I=P||!D(W,$);return P=!1,$=W,I},T)}e.latch=f;function m(L,D,T){return[e.filter(L,D,T),e.filter(L,P=>!D(P),T)]}e.split=m;function g(L,D=!1,T=[],P){let $=T.slice(),W=L(k=>{$?$.push(k):H.fire(k)});P&&P.add(W);let I=()=>{$==null||$.forEach(k=>H.fire(k)),$=null},H=new re({onWillAddFirstListener(){W||(W=L(k=>H.fire(k)),P&&P.add(W))},onDidAddFirstListener(){$&&(D?setTimeout(I):I())},onDidRemoveLastListener(){W&&W.dispose(),W=null}});return P&&P.add(H),H.event}e.buffer=g;function y(L,D){return(T,P,$)=>{let W=D(new b);return L(function(I){let H=W.evaluate(I);H!==x&&T.call(P,H)},void 0,$)}}e.chain=y;let x=Symbol("HaltChainable");class b{constructor(){this.steps=[]}map(D){return this.steps.push(D),this}forEach(D){return this.steps.push(T=>(D(T),T)),this}filter(D){return this.steps.push(T=>D(T)?T:x),this}reduce(D,T){let P=T;return this.steps.push($=>(P=D(P,$),P)),this}latch(D=(T,P)=>T===P){let T=!0,P;return this.steps.push($=>{let W=T||!D($,P);return T=!1,P=$,W?$:x}),this}evaluate(D){for(let T of this.steps)if(D=T(D),D===x)break;return D}}function _(L,D,T=P=>P){let P=(...H)=>I.fire(T(...H)),$=()=>L.on(D,P),W=()=>L.removeListener(D,P),I=new re({onWillAddFirstListener:$,onDidRemoveLastListener:W});return I.event}e.fromNodeEventEmitter=_;function S(L,D,T=P=>P){let P=(...H)=>I.fire(T(...H)),$=()=>L.addEventListener(D,P),W=()=>L.removeEventListener(D,P),I=new re({onWillAddFirstListener:$,onDidRemoveLastListener:W});return I.event}e.fromDOMEventEmitter=S;function C(L){return new Promise(D=>n(L)(D))}e.toPromise=C;function w(L){let D=new re;return L.then(T=>{D.fire(T)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event}e.fromPromise=w;function j(L,D){return L(T=>D.fire(T))}e.forward=j;function E(L,D,T){return D(T),L(P=>D(P))}e.runAndSubscribe=E;class O{constructor(D,T){this._observable=D,this._counter=0,this._hasChanged=!1;let P={onWillAddFirstListener:()=>{D.addObserver(this)},onDidRemoveLastListener:()=>{D.removeObserver(this)}};this.emitter=new re(P),T&&T.add(this.emitter)}beginUpdate(D){this._counter++}handlePossibleChange(D){}handleChange(D,T){this._hasChanged=!0}endUpdate(D){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(L,D){return new O(L,D).emitter.event}e.fromObservable=R;function B(L){return(D,T,P)=>{let $=0,W=!1,I={beginUpdate(){$++},endUpdate(){$--,$===0&&(L.reportChanges(),W&&(W=!1,D.call(T)))},handlePossibleChange(){},handleChange(){W=!0}};L.addObserver(I),L.reportChanges();let H={dispose(){L.removeObserver(I)}};return P instanceof $i?P.add(H):Array.isArray(P)&&P.push(H),H}}e.fromObservableLight=B})(un||(un={}));var Kx=class Vx{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Vx._idPool++}`,Vx.all.add(this)}start(t){this._stopWatch=new YA,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Kx.all=new Set,Kx._idPool=0;var XA=Kx,QA=-1,rE=class iE{constructor(t,n,s=(iE._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let s=this.threshold;if(s<=0||n<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[i,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(i);let c=new ZA(a,i);this._errorHandler(c)}return()=>{let i=this._stacks.get(t.value)||0;this._stacks.set(t.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[s,r]of this._stacks)(!t||n<r)&&(t=[s,r],n=r);return t}};rE._idPool=1;var GA=rE,JA=class oE{constructor(t){this.value=t}static create(){let t=new Error;return new oE(t.stack??"")}print(){console.warn(this.value.split(`
|
|
488
|
-
`).slice(2).join(`
|
|
489
|
-
`))}},ZA=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},eO=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},tO=0,mm=class{constructor(e){this.value=e,this.id=tO++}},nO=2,sO,re=class{constructor(e){var t,n,s,r;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new GA((e==null?void 0:e.onListenerError)??vh,((n=this._options)==null?void 0:n.leakWarningThreshold)??QA):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new XA(this._options._profName):void 0,this._deliveryQueue=(r=this._options)==null?void 0:r.deliveryQueue}dispose(){var e,t,n,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var o,a,c,u,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new eO(`${h}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(((o=this._options)==null?void 0:o.onListenerError)||vh)(f),Te.None}if(this._disposed)return Te.None;t&&(e=e.bind(t));let s=new mm(e),r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=JA.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof mm?(this._deliveryQueue??(this._deliveryQueue=new rO),this._listeners=[this._listeners,s]):this._listeners.push(s):((c=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||c.call(a,this),this._listeners=s,(d=(u=this._options)==null?void 0:u.onDidAddFirstListener)==null||d.call(u,this)),this._size++;let i=at(()=>{r==null||r(),this._removeListener(s)});return n instanceof $i?n.add(i):Array.isArray(n)&&n.push(i),i}),this._event}_removeListener(e){var r,i,o,a;if((i=(r=this._options)==null?void 0:r.onWillRemoveListener)==null||i.call(r,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||a.call(o,this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let s=this._deliveryQueue.current===this;if(this._size*nO<=t.length){let c=0;for(let u=0;u<t.length;u++)t[u]?t[c++]=t[u]:s&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=c}}_deliver(e,t){var s;if(!e)return;let n=((s=this._options)==null?void 0:s.onListenerError)||vh;if(!n){e.value(t);return}try{e.value(t)}catch(r){n(r)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,n,s,r;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof mm)this._deliver(this._listeners,e);else{let i=this._deliveryQueue;i.enqueue(this,e,this._listeners.length),this._deliverQueue(i)}(r=this._perfMon)==null||r.stop()}hasListeners(){return this._size>0}},rO=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Yx=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new re,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new re,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let s=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let s=this.getWindowId(n);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Yx.INSTANCE=new Yx;var w0=Yx;function iO(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}w0.INSTANCE.onDidChangeZoomLevel;function oO(e){return w0.INSTANCE.getZoomFactor(e)}w0.INSTANCE.onDidChangeFullscreen;var Cl=typeof navigator=="object"?navigator.userAgent:"",Xx=Cl.indexOf("Firefox")>=0,aO=Cl.indexOf("AppleWebKit")>=0,S0=Cl.indexOf("Chrome")>=0,lO=!S0&&Cl.indexOf("Safari")>=0;Cl.indexOf("Electron/")>=0;Cl.indexOf("Android")>=0;var gm=!1;if(typeof Fr.matchMedia=="function"){let e=Fr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Fr.matchMedia("(display-mode: fullscreen)");gm=e.matches,iO(Fr,e,({matches:n})=>{gm&&t.matches||(gm=n)})}var Da="en",Qx=!1,Gx=!1,yh=!1,aE=!1,_d,bh=Da,ww=Da,cO,As,Ao=globalThis,cn,yC;typeof Ao.vscode<"u"&&typeof Ao.vscode.process<"u"?cn=Ao.vscode.process:typeof process<"u"&&typeof((yC=process==null?void 0:process.versions)==null?void 0:yC.node)=="string"&&(cn=process);var bC,uO=typeof((bC=cn==null?void 0:cn.versions)==null?void 0:bC.electron)=="string",dO=uO&&(cn==null?void 0:cn.type)==="renderer",_C;if(typeof cn=="object"){Qx=cn.platform==="win32",Gx=cn.platform==="darwin",yh=cn.platform==="linux",yh&&cn.env.SNAP&&cn.env.SNAP_REVISION,cn.env.CI||cn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,_d=Da,bh=Da;let e=cn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);_d=t.userLocale,ww=t.osLocale,bh=t.resolvedLanguage||Da,cO=(_C=t.languagePack)==null?void 0:_C.translationsConfigFile}catch{}aE=!0}else typeof navigator=="object"&&!dO?(As=navigator.userAgent,Qx=As.indexOf("Windows")>=0,Gx=As.indexOf("Macintosh")>=0,(As.indexOf("Macintosh")>=0||As.indexOf("iPad")>=0||As.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,yh=As.indexOf("Linux")>=0,(As==null?void 0:As.indexOf("Mobi"))>=0,bh=globalThis._VSCODE_NLS_LANGUAGE||Da,_d=navigator.language.toLowerCase(),ww=_d):console.error("Unable to resolve platform.");var lE=Qx,hr=Gx,hO=yh,Sw=aE,xr=As,ni=bh,fO;(e=>{function t(){return ni}e.value=t;function n(){return ni.length===2?ni==="en":ni.length>=3?ni[0]==="e"&&ni[1]==="n"&&ni[2]==="-":!1}e.isDefaultVariant=n;function s(){return ni==="en"}e.isDefault=s})(fO||(fO={}));var pO=typeof Ao.postMessage=="function"&&!Ao.importScripts;(()=>{if(pO){let e=[];Ao.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.id===n.data.vscodeScheduleAsyncWork){e.splice(s,1),i.callback();return}}});let t=0;return n=>{let s=++t;e.push({id:s,callback:n}),Ao.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var mO=!!(xr&&xr.indexOf("Chrome")>=0);xr&&xr.indexOf("Firefox")>=0;!mO&&xr&&xr.indexOf("Safari")>=0;xr&&xr.indexOf("Edg/")>=0;xr&&xr.indexOf("Android")>=0;var ca=typeof navigator=="object"?navigator:{};Sw||document.queryCommandSupported&&document.queryCommandSupported("copy")||ca&&ca.clipboard&&ca.clipboard.writeText,Sw||ca&&ca.clipboard&&ca.clipboard.readText;var k0=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},xm=new k0,kw=new k0,Cw=new k0,gO=new Array(230),cE;(e=>{function t(a){return xm.keyCodeToStr(a)}e.toString=t;function n(a){return xm.strToKeyCode(a)}e.fromString=n;function s(a){return kw.keyCodeToStr(a)}e.toUserSettingsUS=s;function r(a){return Cw.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function i(a){return kw.strToKeyCode(a)||Cw.strToKeyCode(a)}e.fromUserSettings=i;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return xm.keyCodeToStr(a)}e.toElectronAccelerator=o})(cE||(cE={}));var xO=class uE{constructor(t,n,s,r,i){this.ctrlKey=t,this.shiftKey=n,this.altKey=s,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof uE&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${n}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new vO([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},vO=class{constructor(e){if(e.length===0)throw WA("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function yO(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return cE.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Xx)switch(t){case 59:return 85;case 60:if(hO)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(hr)return 57;break}else if(aO&&(hr&&t===93||!hr&&t===92))return 57;return gO[t]||0}var bO=hr?256:2048,_O=512,wO=1024,SO=hr?2048:256,Nw=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=yO(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=bO),this.altKey&&(t|=_O),this.shiftKey&&(t|=wO),this.metaKey&&(t|=SO),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new xO(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},jw=new WeakMap;function kO(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var CO=class{static getSameOriginWindowChain(e){let t=jw.get(e);if(!t){t=[],jw.set(e,t);let n=e,s;do s=kO(n),s?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=s;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,s=0,r=this.getSameOriginWindowChain(e);for(let i of r){let o=i.window.deref();if(n+=(o==null?void 0:o.scrollY)??0,s+=(o==null?void 0:o.scrollX)??0,o===t||!i.iframeElement)break;let a=i.iframeElement.getBoundingClientRect();n+=a.top,s+=a.left}return{top:n,left:s}}},wd=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=CO.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Ew=class{constructor(e,t=0,n=0){var r;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let s=!1;if(S0){let i=navigator.userAgent.match(/Chrome\/(\d+)/);s=(i?parseInt(i[1]):123)<=122}if(e){let i=e,o=e,a=((r=e.view)==null?void 0:r.devicePixelRatio)||1;if(typeof i.wheelDeltaY<"u")s?this.deltaY=i.wheelDeltaY/(120*a):this.deltaY=i.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let c=e;c.deltaMode===c.DOM_DELTA_LINE?Xx&&!hr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof i.wheelDeltaX<"u")lO&&lE?this.deltaX=-(i.wheelDeltaX/120):s?this.deltaX=i.wheelDeltaX/(120*a):this.deltaX=i.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let c=e;c.deltaMode===c.DOM_DELTA_LINE?Xx&&!hr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},dE=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),NO;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof jO?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:un.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:dE})})(NO||(NO={}));var jO=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?dE:(this._emitter||(this._emitter=new re),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},C0=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Wx("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Wx("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},EO=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Wx("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=n.setInterval(()=>{e()},t);this.disposable=at(()=>{n.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},PO;(e=>{async function t(s){let r,i=await Promise.all(s.map(o=>o.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return i}e.settled=t;function n(s){return new Promise(async(r,i)=>{try{await s(r,i)}catch(o){i(o)}})}e.withAsyncBody=n})(PO||(PO={}));var Pw=class xs{static fromArray(t){return new xs(n=>{n.emitMany(t)})}static fromPromise(t){return new xs(async n=>{n.emitMany(await t)})}static fromPromises(t){return new xs(async n=>{await Promise.all(t.map(async s=>n.emitOne(await s)))})}static merge(t){return new xs(async n=>{await Promise.all(t.map(async s=>{for await(let r of s)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new re,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await un.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new xs(async s=>{for await(let r of t)s.emitOne(n(r))})}map(t){return xs.map(this,t)}static filter(t,n){return new xs(async s=>{for await(let r of t)n(r)&&s.emitOne(r)})}filter(t){return xs.filter(this,t)}static coalesce(t){return xs.filter(t,n=>!!n)}coalesce(){return xs.coalesce(this)}static async toPromise(t){let n=[];for await(let s of t)n.push(s);return n}toPromise(){return xs.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Pw.EMPTY=Pw.fromArray([]);var{getWindow:cr,getWindowId:TO,onDidRegisterWindow:RO}=function(){let e=new Map,t={window:Fr,disposables:new $i};e.set(Fr.vscodeWindowId,t);let n=new re,s=new re,r=new re;function i(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(e.has(o.vscodeWindowId))return Te.None;let a=new $i,c={window:o,disposables:a.add(new $i)};return e.set(o.vscodeWindowId,c),a.add(at(()=>{e.delete(o.vscodeWindowId),s.fire(o)})),a.add(ve(o,Xt.BEFORE_UNLOAD,()=>{r.fire(o)})),n.fire(c),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:i,getWindow(o){var u;let a=o;if((u=a==null?void 0:a.ownerDocument)!=null&&u.defaultView)return a.ownerDocument.defaultView.window;let c=o;return c!=null&&c.view?c.view.window:Fr},getDocument(o){return cr(o).document}}}(),DO=class{constructor(e,t,n,s){this._node=e,this._type=t,this._handler=n,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function ve(e,t,n,s){return new DO(e,t,n,s)}var Tw=function(e,t,n,s){return ve(e,t,n,s)},N0,MO=class extends EO{constructor(e){super(),this.defaultTarget=e&&cr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Rw=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){vh(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,s=new Map,r=i=>{n.set(i,!1);let o=e.get(i)??[];for(t.set(i,o),e.set(i,[]),s.set(i,!0);o.length>0;)o.sort(Rw.sort),o.shift().execute();s.set(i,!1)};N0=(i,o,a=0)=>{let c=TO(i),u=new Rw(o,a),d=e.get(c);return d||(d=[],e.set(c,d)),d.push(u),n.get(c)||(n.set(c,!0),i.requestAnimationFrame(()=>r(c))),u}})();function LO(e){let t=e.getBoundingClientRect(),n=cr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Xt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},AO=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Hn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Hn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Hn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Hn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Hn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Hn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Hn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Hn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Hn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Hn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Hn(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Hn(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Hn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Hn(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Hn(e){return typeof e=="number"?`${e}px`:e}function Dc(e){return new AO(e)}var hE=class{constructor(){this._hooks=new $i,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,s,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=r;let i=e;try{e.setPointerCapture(t),this._hooks.add(at(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{i=cr(e)}this._hooks.add(ve(i,Xt.POINTER_MOVE,o=>{if(o.buttons!==n){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(ve(i,Xt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function OO(e,t,n){let s=null,r=null;if(typeof n.value=="function"?(s="value",r=n.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(s="get",r=n.get),!r)throw new Error("not supported");let i=`$memoize$${t}`;n[s]=function(...o){return this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[i]}}var Js;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Js||(Js={}));var dc=class yn extends Te{constructor(){super(),this.dispatched=!1,this.targets=new _w,this.ignoreTargets=new _w,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(un.runAndSubscribe(RO,({window:t,disposables:n})=>{n.add(ve(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),n.add(ve(t.document,"touchend",s=>this.onTouchEnd(t,s))),n.add(ve(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:Fr,disposables:this._store}))}static addTarget(t){if(!yn.isTouchDevice())return Te.None;yn.INSTANCE||(yn.INSTANCE=new yn);let n=yn.INSTANCE.targets.push(t);return at(n)}static ignoreTarget(t){if(!yn.isTouchDevice())return Te.None;yn.INSTANCE||(yn.INSTANCE=new yn);let n=yn.INSTANCE.ignoreTargets.push(t);return at(n)}static isTouchDevice(){return"ontouchstart"in Fr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=t.targetTouches.length;s<r;s++){let i=t.targetTouches.item(s);this.activeTouches[i.identifier]={id:i.identifier,initialTarget:i.target,initialTimeStamp:n,initialPageX:i.pageX,initialPageY:i.pageY,rollingTimestamps:[n],rollingPageX:[i.pageX],rollingPageY:[i.pageY]};let o=this.newGestureEvent(Js.Start,i.target);o.pageX=i.pageX,o.pageY=i.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let s=Date.now(),r=Object.keys(this.activeTouches).length;for(let i=0,o=n.changedTouches.length;i<o;i++){let a=n.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let c=this.activeTouches[a.identifier],u=Date.now()-c.initialTimeStamp;if(u<yn.HOLD_DELAY&&Math.abs(c.initialPageX-ns(c.rollingPageX))<30&&Math.abs(c.initialPageY-ns(c.rollingPageY))<30){let d=this.newGestureEvent(Js.Tap,c.initialTarget);d.pageX=ns(c.rollingPageX),d.pageY=ns(c.rollingPageY),this.dispatchEvent(d)}else if(u>=yn.HOLD_DELAY&&Math.abs(c.initialPageX-ns(c.rollingPageX))<30&&Math.abs(c.initialPageY-ns(c.rollingPageY))<30){let d=this.newGestureEvent(Js.Contextmenu,c.initialTarget);d.pageX=ns(c.rollingPageX),d.pageY=ns(c.rollingPageY),this.dispatchEvent(d)}else if(r===1){let d=ns(c.rollingPageX),h=ns(c.rollingPageY),p=ns(c.rollingTimestamps)-c.rollingTimestamps[0],f=d-c.rollingPageX[0],m=h-c.rollingPageY[0],g=[...this.targets].filter(y=>c.initialTarget instanceof Node&&y.contains(c.initialTarget));this.inertia(t,g,s,Math.abs(f)/p,f>0?1:-1,d,Math.abs(m)/p,m>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(Js.End,c.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=n,s.tapCount=0,s}dispatchEvent(t){if(t.type===Js.Tap){let n=new Date().getTime(),s=0;n-this._lastSetTapCountTime>yn.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=n,t.tapCount=s}else(t.type===Js.Change||t.type===Js.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let n=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==s;)r++,i=i.parentElement;n.push([r,s])}n.sort((s,r)=>s[0]-r[0]);for(let[s,r]of n)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,s,r,i,o,a,c,u){this.handle=N0(t,()=>{let d=Date.now(),h=d-s,p=0,f=0,m=!0;r+=yn.SCROLL_FRICTION*h,a+=yn.SCROLL_FRICTION*h,r>0&&(m=!1,p=i*r*h),a>0&&(m=!1,f=c*a*h);let g=this.newGestureEvent(Js.Change);g.translationX=p,g.translationY=f,n.forEach(y=>y.dispatchEvent(g)),m||this.inertia(t,n,d,r,i,o+p,a,c,u+f)})}onTouchMove(t){let n=Date.now();for(let s=0,r=t.changedTouches.length;s<r;s++){let i=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(i.identifier))){console.warn("end of an UNKNOWN touch",i);continue}let o=this.activeTouches[i.identifier],a=this.newGestureEvent(Js.Change,o.initialTarget);a.translationX=i.pageX-ns(o.rollingPageX),a.translationY=i.pageY-ns(o.rollingPageY),a.pageX=i.pageX,a.pageY=i.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(i.pageX),o.rollingPageY.push(i.pageY),o.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};dc.SCROLL_FRICTION=-.005,dc.HOLD_DELAY=700,dc.CLEAR_TAP_COUNT_TIME=400,_t([OO],dc,"isTouchDevice",1);var IO=dc,j0=class extends Te{onclick(e,t){this._register(ve(e,Xt.CLICK,n=>t(new wd(cr(e),n))))}onmousedown(e,t){this._register(ve(e,Xt.MOUSE_DOWN,n=>t(new wd(cr(e),n))))}onmouseover(e,t){this._register(ve(e,Xt.MOUSE_OVER,n=>t(new wd(cr(e),n))))}onmouseleave(e,t){this._register(ve(e,Xt.MOUSE_LEAVE,n=>t(new wd(cr(e),n))))}onkeydown(e,t){this._register(ve(e,Xt.KEY_DOWN,n=>t(new Nw(n))))}onkeyup(e,t){this._register(ve(e,Xt.KEY_UP,n=>t(new Nw(n))))}oninput(e,t){this._register(ve(e,Xt.INPUT,t))}onblur(e,t){this._register(ve(e,Xt.BLUR,t))}onfocus(e,t){this._register(ve(e,Xt.FOCUS,t))}onchange(e,t){this._register(ve(e,Xt.CHANGE,t))}ignoreGesture(e){return IO.ignoreTarget(e)}},Dw=11,FO=class extends j0{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=Dw+"px",this.domNode.style.height=Dw+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new hE),this._register(Tw(this.bgDomNode,Xt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Tw(this.domNode,Xt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new MO),this._pointerdownScheduleRepeatTimer=this._register(new C0)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,cr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},BO=class Jx{constructor(t,n,s,r,i,o,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,s=s|0,r=r|0,i=i|0,o=o|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,n<0&&(n=0),r+n>s&&(r=s-n),r<0&&(r=0),i<0&&(i=0),a+i>o&&(a=o-i),a<0&&(a=0),this.width=n,this.scrollWidth=s,this.scrollLeft=r,this.height=i,this.scrollHeight=o,this.scrollTop=a}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new Jx(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Jx(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let s=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,i=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,c=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:c}}},zO=class extends Te{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new re),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new BO(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var s;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let s;t?s=new Lw(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=Lw.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Mw=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function vm(e,t){let n=t-e;return function(s){return e+n*WO(s)}}function $O(e,t,n){return function(s){return s<n?e(s/n):t((s-n)/(1-n))}}var Lw=class Zx{constructor(t,n,s,r){this.from=t,this.to=n,this.duration=r,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,s){if(Math.abs(t-n)>2.5*s){let r,i;return t<n?(r=t+.75*s,i=n-.75*s):(r=t-.75*s,i=n+.75*s),$O(vm(t,r),vm(i,n),.33)}return vm(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let s=this.scrollLeft(n),r=this.scrollTop(n);return new Mw(s,r,!1)}return new Mw(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,s){return Zx.start(t,n,s)}static start(t,n,s){s=s+10;let r=Date.now()-10;return new Zx(t,n,r,s)}};function HO(e){return Math.pow(e,3)}function WO(e){return 1-HO(1-e)}var UO=class extends Te{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new C0)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},qO=140,fE=class extends j0{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new UO(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new hE),this._shouldRender=!0,this.domNode=Dc(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(ve(this.domNode.domNode,Xt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new FO(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,s){this.slider=Dc(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(ve(this.slider.domNode,Xt.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);n<=r&&r<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let r=LO(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let s=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let i=this._sliderOrthogonalPointerPosition(r),o=Math.abs(i-n);if(lE&&o>qO){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let a=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(a))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},pE=class ev{constructor(t,n,s,r,i,o){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new ev(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,s,r,i){let o=Math.max(0,s-t),a=Math.max(0,o-2*n),c=r>0&&r>s;if(!c)return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let u=Math.round(Math.max(20,Math.floor(s*a/r))),d=(a-u)/(r-s),h=i*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(u),computedSliderRatio:d,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let t=ev._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,s=this._scrollPosition;return n<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},KO=class extends fE{constructor(e,t,n){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new pE(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},VO=class extends fE{constructor(e,t,n){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new pE(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},YO=500,Aw=50,XO=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},tv=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,s=1,r=this._rear;do{let i=r===this._front?t:Math.pow(2,-s);if(t-=i,n+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,s++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(S0){let n=cr(t.browserEvent),s=oO(n);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,s){let r=null,i=new XO(t,n,s);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),n){let r=Math.abs(t.deltaX),i=Math.abs(t.deltaY),o=Math.abs(n.deltaX),a=Math.abs(n.deltaY),c=Math.max(Math.min(r,o),1),u=Math.max(Math.min(i,a),1),d=Math.max(r,o),h=Math.max(i,a);d%c===0&&h%u===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};tv.INSTANCE=new tv;var QO=tv,GO=class extends j0{constructor(e,t,n){super(),this._onScroll=this._register(new re),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new re),this.onWillScroll=this._onWillScroll.event,this._options=ZO(t),this._scrollable=n,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new VO(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new KO(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Dc(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Dc(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Dc(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new C0),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Yo(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,hr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ew(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Yo(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new Ew(n))};this._mouseWheelToDispose.push(ve(this._listenOnDomNode,Xt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var r;if((r=e.browserEvent)!=null&&r.defaultPrevented)return;let t=QO.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let i=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+i===0?o=i=0:Math.abs(i)>=Math.abs(o)?o=0:i=0),this._options.flipAxes&&([i,o]=[o,i]);let a=!hr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=i,i=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,i=i*this._options.fastScrollSensitivity);let c=this._scrollable.getFutureScrollPosition(),u={};if(i){let d=Aw*i,h=c.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(u,h)}if(o){let d=Aw*o,h=c.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(u,h)}u=this._scrollable.validateScrollPosition(u),(c.scrollLeft!==u.scrollLeft||c.scrollTop!==u.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(u):this._scrollable.setScrollPositionNow(u),n=!0)}let s=n;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,s=n?" left":"",r=t?" top":"",i=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${i}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),YO)}},JO=class extends GO{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function ZO(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,hr&&(t.className+=" mac"),t}var nv=class extends Te{constructor(e,t,n,s,r,i,o,a){super(),this._bufferService=n,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new re),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new zO({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:u=>N0(s.window,u)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new JO(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(u=>{this._scrollableElement.updateOptions({handleMouseWheel:!(u&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(un.runAndSubscribe(i.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=i.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(at(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(at(()=>this._styleElement.remove())),this._register(un.runAndSubscribe(i.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${i.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${i.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${i.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
490
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(u=>this._handleScroll(u)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};nv=_t([le(2,Bn),le(3,Xr),le(4,Yj),le(5,kl),le(6,zn),le(7,Qr)],nv);var sv=class extends Te{constructor(e,t,n,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=s,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(i=>this._removeDecoration(i))),this._register(at(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};sv=_t([le(1,Bn),le(2,Xr),le(3,zu),le(4,Qr)],sv);var eI=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Xs={full:0,left:0,center:0,right:0},si={full:0,left:0,center:0,right:0},Wl={full:0,left:0,center:0,right:0},xf=class extends Te{constructor(e,t,n,s,r,i,o,a){var u;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=s,this._renderService=r,this._optionsService=i,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new eI,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(u=this._viewportElement.parentElement)==null||u.insertBefore(this._canvas,this._viewportElement),this._register(at(()=>{var d;return(d=this._canvas)==null?void 0:d.remove()}));let c=this._canvas.getContext("2d");if(c)this._ctx=c;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);si.full=this._canvas.width,si.left=e,si.center=t,si.right=e,this._refreshDrawHeightConstants(),Wl.full=1,Wl.left=1,Wl.center=1+si.left,Wl.right=1+si.left+si.center}_refreshDrawHeightConstants(){Xs.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Xs.left=t,Xs.center=t,Xs.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xs.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xs.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xs.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xs.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Wl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Xs[e.position||"full"]/2),si[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Xs[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};xf=_t([le(2,Bn),le(3,zu),le(4,Qr),le(5,zn),le(6,kl),le(7,Xr)],xf);var G;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
491
|
-
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(G||(G={}));var _h;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(_h||(_h={}));var mE;(e=>e.ST=`${G.ESC}\\`)(mE||(mE={}));var rv=class{constructor(e,t,n,s,r,i){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=s,this._coreService=r,this._renderService=i,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${G.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(i.width,1)+"px",this._textarea.style.height=Math.max(i.height,1)+"px",this._textarea.style.lineHeight=i.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};rv=_t([le(2,Bn),le(3,zn),le(4,ra),le(5,Qr)],rv);var Jt=0,Zt=0,en=0,gt=0,Ow={css:"#00000000",rgba:0},Rt;(e=>{function t(r,i,o,a){return a!==void 0?`#${no(r)}${no(i)}${no(o)}${no(a)}`:`#${no(r)}${no(i)}${no(o)}`}e.toCss=t;function n(r,i,o,a=255){return(r<<24|i<<16|o<<8|a)>>>0}e.toRgba=n;function s(r,i,o,a){return{css:e.toCss(r,i,o,a),rgba:e.toRgba(r,i,o,a)}}e.toColor=s})(Rt||(Rt={}));var st;(e=>{function t(c,u){if(gt=(u.rgba&255)/255,gt===1)return{css:u.css,rgba:u.rgba};let d=u.rgba>>24&255,h=u.rgba>>16&255,p=u.rgba>>8&255,f=c.rgba>>24&255,m=c.rgba>>16&255,g=c.rgba>>8&255;Jt=f+Math.round((d-f)*gt),Zt=m+Math.round((h-m)*gt),en=g+Math.round((p-g)*gt);let y=Rt.toCss(Jt,Zt,en),x=Rt.toRgba(Jt,Zt,en);return{css:y,rgba:x}}e.blend=t;function n(c){return(c.rgba&255)===255}e.isOpaque=n;function s(c,u,d){let h=wh.ensureContrastRatio(c.rgba,u.rgba,d);if(h)return Rt.toColor(h>>24&255,h>>16&255,h>>8&255)}e.ensureContrastRatio=s;function r(c){let u=(c.rgba|255)>>>0;return[Jt,Zt,en]=wh.toChannels(u),{css:Rt.toCss(Jt,Zt,en),rgba:u}}e.opaque=r;function i(c,u){return gt=Math.round(u*255),[Jt,Zt,en]=wh.toChannels(c.rgba),{css:Rt.toCss(Jt,Zt,en,gt),rgba:Rt.toRgba(Jt,Zt,en,gt)}}e.opacity=i;function o(c,u){return gt=c.rgba&255,i(c,gt*u/255)}e.multiplyOpacity=o;function a(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}e.toColorRGB=a})(st||(st={}));var ct;(e=>{let t,n;try{let r=document.createElement("canvas");r.width=1,r.height=1;let i=r.getContext("2d",{willReadFrequently:!0});i&&(t=i,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Jt=parseInt(r.slice(1,2).repeat(2),16),Zt=parseInt(r.slice(2,3).repeat(2),16),en=parseInt(r.slice(3,4).repeat(2),16),Rt.toColor(Jt,Zt,en);case 5:return Jt=parseInt(r.slice(1,2).repeat(2),16),Zt=parseInt(r.slice(2,3).repeat(2),16),en=parseInt(r.slice(3,4).repeat(2),16),gt=parseInt(r.slice(4,5).repeat(2),16),Rt.toColor(Jt,Zt,en,gt);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let i=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(i)return Jt=parseInt(i[1]),Zt=parseInt(i[2]),en=parseInt(i[3]),gt=Math.round((i[5]===void 0?1:parseFloat(i[5]))*255),Rt.toColor(Jt,Zt,en,gt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Jt,Zt,en,gt]=t.getImageData(0,0,1,1).data,gt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Rt.toRgba(Jt,Zt,en,gt),css:r}}e.toColor=s})(ct||(ct={}));var Pn;(e=>{function t(s){return n(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function n(s,r,i){let o=s/255,a=r/255,c=i/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return u*.2126+d*.7152+h*.0722}e.relativeLuminance2=n})(Pn||(Pn={}));var wh;(e=>{function t(o,a){if(gt=(a&255)/255,gt===1)return a;let c=a>>24&255,u=a>>16&255,d=a>>8&255,h=o>>24&255,p=o>>16&255,f=o>>8&255;return Jt=h+Math.round((c-h)*gt),Zt=p+Math.round((u-p)*gt),en=f+Math.round((d-f)*gt),Rt.toRgba(Jt,Zt,en)}e.blend=t;function n(o,a,c){let u=Pn.relativeLuminance(o>>8),d=Pn.relativeLuminance(a>>8);if(kr(u,d)<c){if(d<u){let f=s(o,a,c),m=kr(u,Pn.relativeLuminance(f>>8));if(m<c){let g=r(o,a,c),y=kr(u,Pn.relativeLuminance(g>>8));return m>y?f:g}return f}let h=r(o,a,c),p=kr(u,Pn.relativeLuminance(h>>8));if(p<c){let f=s(o,a,c),m=kr(u,Pn.relativeLuminance(f>>8));return p>m?h:f}return h}}e.ensureContrastRatio=n;function s(o,a,c){let u=o>>24&255,d=o>>16&255,h=o>>8&255,p=a>>24&255,f=a>>16&255,m=a>>8&255,g=kr(Pn.relativeLuminance2(p,f,m),Pn.relativeLuminance2(u,d,h));for(;g<c&&(p>0||f>0||m>0);)p-=Math.max(0,Math.ceil(p*.1)),f-=Math.max(0,Math.ceil(f*.1)),m-=Math.max(0,Math.ceil(m*.1)),g=kr(Pn.relativeLuminance2(p,f,m),Pn.relativeLuminance2(u,d,h));return(p<<24|f<<16|m<<8|255)>>>0}e.reduceLuminance=s;function r(o,a,c){let u=o>>24&255,d=o>>16&255,h=o>>8&255,p=a>>24&255,f=a>>16&255,m=a>>8&255,g=kr(Pn.relativeLuminance2(p,f,m),Pn.relativeLuminance2(u,d,h));for(;g<c&&(p<255||f<255||m<255);)p=Math.min(255,p+Math.ceil((255-p)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),g=kr(Pn.relativeLuminance2(p,f,m),Pn.relativeLuminance2(u,d,h));return(p<<24|f<<16|m<<8|255)>>>0}e.increaseLuminance=r;function i(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=i})(wh||(wh={}));function no(e){let t=e.toString(16);return t.length<2?"0"+t:t}function kr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var tI=class extends Bu{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},vf=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ps}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],s=t.translateToString(!0),r=0,i=0,o=0,a=t.getFg(0),c=t.getBg(0);for(let u=0;u<t.getTrimmedLength();u++)if(t.loadCell(u,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==c){if(u-r>1){let d=this._getJoinedRanges(s,o,i,t,r);for(let h=0;h<d.length;h++)n.push(d[h])}r=u,o=i,a=this._workCell.fg,c=this._workCell.bg}i+=this._workCell.getChars().length||Ni.length}if(this._bufferService.cols-r>1){let u=this._getJoinedRanges(s,o,i,t,r);for(let d=0;d<u.length;d++)n.push(u[d])}return n}_getJoinedRanges(e,t,n,s,r){let i=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(i)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let c=this._characterJoiners[a].handler(i);for(let u=0;u<c.length;u++)vf._mergeRanges(o,c[u])}catch(c){console.error(c)}return this._stringRangesToCellRanges(o,s,r),o}_stringRangesToCellRanges(e,t,n){let s=0,r=!1,i=0,o=e[s];if(o){for(let a=n;a<this._bufferService.cols;a++){let c=t.getWidth(a),u=t.getString(a).length||Ni.length;if(c!==0){if(!r&&o[0]<=i&&(o[0]=a,r=!0),o[1]<=i){if(o[1]=a,o=e[++s],!o)break;o[0]<=i?(o[0]=a,r=!0):r=!1}i+=u}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let s=0;s<e.length;s++){let r=e[s];if(n){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};vf=_t([le(0,Bn)],vf);function nI(e){return 57508<=e&&e<=57558}function sI(e){return 9472<=e&&e<=9631}function rI(e){return nI(e)||sI(e)}function iI(){return{css:{canvas:Sd(),cell:Sd()},device:{canvas:Sd(),cell:Sd(),char:{width:0,height:0,left:0,top:0}}}}function Sd(){return{width:0,height:0}}var iv=class{constructor(e,t,n,s,r,i,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=s,this._coreService=r,this._decorationService=i,this._themeService=o,this._workCell=new Ps,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,s,r,i,o,a,c,u,d){let h=[],p=this._characterJoinerService.getJoinedCharacters(t),f=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<i+1&&(m=i+1);let g,y=0,x="",b=0,_=0,S=0,C=0,w=!1,j=0,E=!1,O=0,R=0,B=[],L=u!==-1&&d!==-1;for(let D=0;D<m;D++){e.loadCell(D,this._workCell);let T=this._workCell.getWidth();if(T===0)continue;let P=!1,$=D>=R,W=D,I=this._workCell;if(p.length>0&&D===p[0][0]&&$){let fe=p.shift(),Ie=this._isCellInSelection(fe[0],t);for(b=fe[0]+1;b<fe[1];b++)$&&($=Ie===this._isCellInSelection(b,t));$&&($=!n||i<fe[0]||i>=fe[1]),$?(P=!0,I=new tI(this._workCell,e.translateToString(!0,fe[0],fe[1]),fe[1]-fe[0]),W=fe[1]-1,T=I.getWidth()):R=fe[1]}let H=this._isCellInSelection(D,t),k=n&&D===i,F=L&&D>=u&&D<=d,M=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,fe=>{M=!0});let N=I.getChars()||Ni;if(N===" "&&(I.isUnderline()||I.isOverline())&&(N=" "),O=T*a-c.get(N,I.isBold(),I.isItalic()),!g)g=this._document.createElement("span");else if(y&&(H&&E||!H&&!E&&I.bg===_)&&(H&&E&&f.selectionForeground||I.fg===S)&&I.extended.ext===C&&F===w&&O===j&&!k&&!P&&!M&&$){I.isInvisible()?x+=Ni:x+=N,y++;continue}else y&&(g.textContent=x),g=this._document.createElement("span"),y=0,x="";if(_=I.bg,S=I.fg,C=I.extended.ext,w=F,j=O,E=H,P&&i>=D&&i<=W&&(i=D),!this._coreService.isCursorHidden&&k&&this._coreService.isCursorInitialized){if(B.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&B.push("xterm-cursor-blink"),B.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":B.push("xterm-cursor-outline");break;case"block":B.push("xterm-cursor-block");break;case"bar":B.push("xterm-cursor-bar");break;case"underline":B.push("xterm-cursor-underline");break}}if(I.isBold()&&B.push("xterm-bold"),I.isItalic()&&B.push("xterm-italic"),I.isDim()&&B.push("xterm-dim"),I.isInvisible()?x=Ni:x=I.getChars()||Ni,I.isUnderline()&&(B.push(`xterm-underline-${I.extended.underlineStyle}`),x===" "&&(x=" "),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${Bu.toColorRGB(I.getUnderlineColor()).join(",")})`;else{let fe=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&fe<8&&(fe+=8),g.style.textDecorationColor=f.ansi[fe].css}I.isOverline()&&(B.push("xterm-overline"),x===" "&&(x=" ")),I.isStrikethrough()&&B.push("xterm-strikethrough"),F&&(g.style.textDecoration="underline");let z=I.getFgColor(),U=I.getFgColorMode(),K=I.getBgColor(),Q=I.getBgColorMode(),Y=!!I.isInverse();if(Y){let fe=z;z=K,K=fe;let Ie=U;U=Q,Q=Ie}let Z,ue,Oe=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,fe=>{fe.options.layer!=="top"&&Oe||(fe.backgroundColorRGB&&(Q=50331648,K=fe.backgroundColorRGB.rgba>>8&16777215,Z=fe.backgroundColorRGB),fe.foregroundColorRGB&&(U=50331648,z=fe.foregroundColorRGB.rgba>>8&16777215,ue=fe.foregroundColorRGB),Oe=fe.options.layer==="top")}),!Oe&&H&&(Z=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,K=Z.rgba>>8&16777215,Q=50331648,Oe=!0,f.selectionForeground&&(U=50331648,z=f.selectionForeground.rgba>>8&16777215,ue=f.selectionForeground)),Oe&&B.push("xterm-decoration-top");let Re;switch(Q){case 16777216:case 33554432:Re=f.ansi[K],B.push(`xterm-bg-${K}`);break;case 50331648:Re=Rt.toColor(K>>16,K>>8&255,K&255),this._addStyle(g,`background-color:#${Iw((K>>>0).toString(16),"0",6)}`);break;case 0:default:Y?(Re=f.foreground,B.push("xterm-bg-257")):Re=f.background}switch(Z||I.isDim()&&(Z=st.multiplyOpacity(Re,.5)),U){case 16777216:case 33554432:I.isBold()&&z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(z+=8),this._applyMinimumContrast(g,Re,f.ansi[z],I,Z,void 0)||B.push(`xterm-fg-${z}`);break;case 50331648:let fe=Rt.toColor(z>>16&255,z>>8&255,z&255);this._applyMinimumContrast(g,Re,fe,I,Z,ue)||this._addStyle(g,`color:#${Iw(z.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,Re,f.foreground,I,Z,ue)||Y&&B.push("xterm-fg-257")}B.length&&(g.className=B.join(" "),B.length=0),!k&&!P&&!M&&$?y++:g.textContent=x,O!==this.defaultSpacing&&(g.style.letterSpacing=`${O}px`),h.push(g),D=W}return g&&y&&(g.textContent=x),h}_applyMinimumContrast(e,t,n,s,r,i){if(this._optionsService.rawOptions.minimumContrastRatio===1||rI(s.getCode()))return!1;let o=this._getContrastCache(s),a;if(!r&&!i&&(a=o.getColor(t.rgba,n.rgba)),a===void 0){let c=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=st.ensureContrastRatio(r||t,i||n,c),o.setColor((r||t).rgba,(i||n).rgba,a??null)}return a?(this._addStyle(e,`color:${a.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,s=this._selectionEnd;return!n||!s?!1:this._columnSelectMode?n[0]<=s[0]?e>=n[0]&&t>=n[1]&&e<s[0]&&t<=s[1]:e<n[0]&&t>=n[1]&&e>=s[0]&&t<=s[1]:t>n[1]&&t<s[1]||n[1]===s[1]&&t===n[1]&&e>=n[0]&&e<s[0]||n[1]<s[1]&&t===s[1]&&e<s[0]||n[1]<s[1]&&t===n[1]&&e>=n[0]}};iv=_t([le(1,Gj),le(2,zn),le(3,Xr),le(4,ra),le(5,zu),le(6,kl)],iv);function Iw(e,t,n){for(;e.length<n;)e=t+e;return e}var oI=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold",i.style.fontStyle="italic",this._measureElements=[n,s,r,i],this._container.appendChild(n),this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(i),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,s){e===this._font&&t===this._fontSize&&n===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,n){let s=0;if(!t&&!n&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let o=this._measure(e,0);return o>0&&(this._flat[s]=o),o}let r=e;t&&(r+="B"),n&&(r+="I");let i=this._holey.get(r);if(i===void 0){let o=0;t&&(o|=1),n&&(o|=2),i=this._measure(e,o),i>0&&this._holey.set(r,i)}return i}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},aI=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,s=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let r=e.buffers.active.ydisp,i=t[1]-r,o=n[1]-r,a=Math.max(i,0),c=Math.min(o,e.rows-1);if(a>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=i,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function lI(){return new aI}var ym="xterm-dom-renderer-owner-",ms="xterm-rows",kd="xterm-fg-",Fw="xterm-bg-",Ul="xterm-focus",Cd="xterm-selection",cI=1,ov=class extends Te{constructor(e,t,n,s,r,i,o,a,c,u,d,h,p,f){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=s,this._viewportElement=r,this._helperContainer=i,this._linkifier2=o,this._charSizeService=c,this._optionsService=u,this._bufferService=d,this._coreService=h,this._coreBrowserService=p,this._themeService=f,this._terminalClass=cI++,this._rowElements=[],this._selectionRenderModel=lI(),this.onRequestRedraw=this._register(new re).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ms),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Cd),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=iI(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(iv,document),this._element.classList.add(ym+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(at(()=>{this._element.classList.remove(ym+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new oI(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ms} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${ms} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${ms} .xterm-dim { color: ${st.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ms}.${Ul} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ms}.${Ul} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ms}.${Ul} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${ms} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ms} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ms} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ms} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ms} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Cd} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Cd} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Cd} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[i,o]of e.ansi.entries())t+=`${this._terminalSelector} .${kd}${i} { color: ${o.css}; }${this._terminalSelector} .${kd}${i}.xterm-dim { color: ${st.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Fw}${i} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${kd}257 { color: ${st.opaque(e.background).css}; }${this._terminalSelector} .${kd}257.xterm-dim { color: ${st.multiplyOpacity(st.opaque(e.background),.5).css}; }${this._terminalSelector} .${Fw}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Ul),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ul),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,i=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(n){let c=e[0]>t[0];a.appendChild(this._createSelectionElement(i,c?t[0]:e[0],c?e[0]:t[0],o-i+1))}else{let c=s===i?e[0]:0,u=i===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(i,c,u));let d=o-i-1;if(a.appendChild(this._createSelectionElement(i+1,0,this._bufferService.cols,d)),i!==o){let h=r===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,h))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,n,s=1){let r=this._document.createElement("div"),i=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return i+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-i),r.style.height=`${s*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${i}px`,r.style.width=`${o}px`,r}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,s=n.ybase+n.y,r=Math.min(n.x,this._bufferService.cols-1),i=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let u=c+n.ydisp,d=this._rowElements[c],h=n.lines.get(u);if(!d||!h)break;d.replaceChildren(...this._rowFactory.createRow(h,u,u===s,o,a,r,i,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ym}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,s,r,i){n<0&&(e=0),s<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);let a=this._bufferService.buffer,c=a.ybase+a.y,u=Math.min(a.x,r-1),d=this._optionsService.rawOptions.cursorBlink,h=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=n;f<=s;++f){let m=f+a.ydisp,g=this._rowElements[f],y=a.lines.get(m);if(!g||!y)break;g.replaceChildren(...this._rowFactory.createRow(y,m,m===c,h,p,u,d,this.dimensions.css.cell.width,this._widthCache,i?f===n?e:0:-1,i?(f===s?t:r)-1:-1))}}};ov=_t([le(7,b0),le(8,dp),le(9,zn),le(10,Bn),le(11,ra),le(12,Xr),le(13,kl)],ov);var av=class extends Te{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new re),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new dI(this._optionsService))}catch{this._measureStrategy=this._register(new uI(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};av=_t([le(2,zn)],av);var gE=class extends Te{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},uI=class extends gE{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},dI=class extends gE{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},hI=class extends Te{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new fI(this._window)),this._onDprChange=this._register(new re),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new re),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(un.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ve(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ve(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},fI=class extends Te{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new cl),this._onDprChange=this._register(new re),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(at(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ve(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},pI=class extends Te{constructor(){super(),this.linkProviders=[],this._register(at(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function E0(e,t,n){let s=n.getBoundingClientRect(),r=e.getComputedStyle(n),i=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-i,t.clientY-s.top-o]}function mI(e,t,n,s,r,i,o,a,c){if(!i)return;let u=E0(e,t,n);if(u)return u[0]=Math.ceil((u[0]+(c?o/2:0))/o),u[1]=Math.ceil(u[1]/a),u[0]=Math.min(Math.max(u[0],1),s+(c?1:0)),u[1]=Math.min(Math.max(u[1],1),r),u}var lv=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,s,r){return mI(window,e,t,n,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let n=E0(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};lv=_t([le(0,Qr),le(1,dp)],lv);var gI=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},xE={};NA(xE,{getSafariVersion:()=>vI,isChromeOS:()=>_E,isFirefox:()=>vE,isIpad:()=>yI,isIphone:()=>bI,isLegacyEdge:()=>xI,isLinux:()=>P0,isMac:()=>yf,isNode:()=>hp,isSafari:()=>yE,isWindows:()=>bE});var hp=typeof process<"u"&&"title"in process,$u=hp?"node":navigator.userAgent,Hu=hp?"node":navigator.platform,vE=$u.includes("Firefox"),xI=$u.includes("Edge"),yE=/^((?!chrome|android).)*safari/i.test($u);function vI(){if(!yE)return 0;let e=$u.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var yf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Hu),yI=Hu==="iPad",bI=Hu==="iPhone",bE=["Windows","Win16","Win32","WinCE"].includes(Hu),P0=Hu.indexOf("Linux")>=0,_E=/\bCrOS\b/.test($u),wE=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),r=e.timeRemaining(),n*1.5>r){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=r}this.clear()}},_I=class extends wE{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},wI=class extends wE{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},bf=!hp&&"requestIdleCallback"in window?wI:_I,SI=class{constructor(){this._queue=new bf}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},cv=class extends Te{constructor(e,t,n,s,r,i,o,a,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=s,this._coreService=r,this._coreBrowserService=a,this._renderer=this._register(new cl),this._pausedResizeTask=new SI,this._observerDisposable=this._register(new cl),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new re),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new re),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new re),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new re),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new gI((u,d)=>this._renderRows(u,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new kI(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(at(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var u;return(u=this._renderer.value)==null?void 0:u.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(i.onDecorationRegistered(()=>this._fullRefresh())),this._register(i.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(u=>this._registerIntersectionObserver(u,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=at(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};cv=_t([le(2,zn),le(3,dp),le(4,ra),le(5,zu),le(6,Bn),le(7,Xr),le(8,kl)],cv);var kI=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function CI(e,t,n,s){let r=n.buffer.x,i=n.buffer.y;if(!n.buffer.hasScrollback)return EI(r,i,e,t,n,s)+fp(i,t,n,s)+PI(r,i,e,t,n,s);let o;if(i===t)return o=r>e?"D":"C",hu(Math.abs(r-e),du(o,s));o=i>t?"D":"C";let a=Math.abs(i-t),c=jI(i>t?e:r,n)+(a-1)*n.cols+1+NI(i>t?r:e);return hu(c,du(o,s))}function NI(e,t){return e-1}function jI(e,t){return t.cols-e}function EI(e,t,n,s,r,i){return fp(t,s,r,i).length===0?"":hu(kE(e,t,e,t-Xo(t,r),!1,r).length,du("D",i))}function fp(e,t,n,s){let r=e-Xo(e,n),i=t-Xo(t,n),o=Math.abs(r-i)-TI(e,t,n);return hu(o,du(SE(e,t),s))}function PI(e,t,n,s,r,i){let o;fp(t,s,r,i).length>0?o=s-Xo(s,r):o=t;let a=s,c=RI(e,t,n,s,r,i);return hu(kE(e,o,n,a,c==="C",r).length,du(c,i))}function TI(e,t,n){var o;let s=0,r=e-Xo(e,n),i=t-Xo(t,n);for(let a=0;a<Math.abs(r-i);a++){let c=SE(e,t)==="A"?-1:1;(o=n.buffer.lines.get(r+c*a))!=null&&o.isWrapped&&s++}return s}function Xo(e,t){let n=0,s=t.buffer.lines.get(e),r=s==null?void 0:s.isWrapped;for(;r&&e>=0&&e<t.rows;)n++,s=t.buffer.lines.get(--e),r=s==null?void 0:s.isWrapped;return n}function RI(e,t,n,s,r,i){let o;return fp(n,s,r,i).length>0?o=s-Xo(s,r):o=t,e<n&&o<=s||e>=n&&o<s?"C":"D"}function SE(e,t){return e>t?"A":"B"}function kE(e,t,n,s,r,i){let o=e,a=t,c="";for(;(o!==n||a!==s)&&a>=0&&a<i.buffer.lines.length;)o+=r?1:-1,r&&o>i.cols-1?(c+=i.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(c+=i.buffer.translateBufferLineToString(a,!1,0,e+1),o=i.cols-1,e=o,a--);return c+i.buffer.translateBufferLineToString(a,!1,e,o)}function du(e,t){let n=t?"O":"[";return G.ESC+n+e}function hu(e,t){e=Math.floor(e);let n="";for(let s=0;s<e;s++)n+=t;return n}var DI=class{constructor(t){this._bufferService=t,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,n=this.selectionEnd;return!t||!n?!1:t[1]>n[1]||t[1]===n[1]&&t[0]>n[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Bw(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var bm=50,MI=15,LI=50,AI=500,OI=" ",II=new RegExp(OI,"g"),uv=class extends Te{constructor(e,t,n,s,r,i,o,a,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=s,this._coreService=r,this._mouseService=i,this._optionsService=o,this._renderService=a,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ps,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new re),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new re),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new re),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new re),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=u=>this._handleMouseMove(u),this._mouseUpListener=u=>this._handleMouseUp(u),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(u=>this._handleTrim(u)),this._register(this._bufferService.buffers.onBufferActivate(u=>this._handleBufferActivate(u))),this.enable(),this._model=new DI(this._bufferService),this._activeSelectionMode=0,this._register(at(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(u=>{u.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],i=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let a=n.translateBufferLineToString(o,!0,r,i);s.push(a)}}else{let r=e[1]===t[1]?t[0]:void 0;s.push(n.translateBufferLineToString(e[1],!0,e[0],r));for(let i=e[1]+1;i<=t[1]-1;i++){let o=n.lines.get(i),a=n.translateBufferLineToString(i,!0);o!=null&&o.isWrapped?s[s.length-1]+=a:s.push(a)}if(e[1]!==t[1]){let i=n.lines.get(t[1]),o=n.translateBufferLineToString(t[1],!0,0,t[0]);i&&i.isWrapped?s[s.length-1]+=o:s.push(o)}}return s.map(r=>r.replace(II," ")).join(bE?`\r
|
|
492
|
-
`:`
|
|
493
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),P0&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s||!t?!1:this._areCoordsInSelection(t,n,s)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s?!1:this._areCoordsInSelection([e,t],n,s)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var r,i;let n=(i=(r=this._linkifier.currentLink)==null?void 0:r.link)==null?void 0:i.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Bw(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=E0(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-bm),bm),t/=bm,t/Math.abs(t)+Math.round(t*(MI-1)))}shouldForceSelection(e){return yf?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),LI)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(yf&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let s=n.lines.get(this._model.selectionEnd[1]);s&&s.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<AI&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let s=CI(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let s=0;t>=s;s++){let r=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:r>1&&t!==s&&(n+=r-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,i=r.lines.get(e[1]);if(!i)return;let o=r.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(i,e[0]),c=a,u=e[0]-a,d=0,h=0,p=0,f=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;c<o.length&&o.charAt(c+1)===" ";)c++}else{let y=e[0],x=e[0];i.getWidth(y)===0&&(d++,y--),i.getWidth(x)===2&&(h++,x++);let b=i.getString(x).length;for(b>1&&(f+=b-1,c+=b-1);y>0&&a>0&&!this._isCharWordSeparator(i.loadCell(y-1,this._workCell));){i.loadCell(y-1,this._workCell);let _=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,y--):_>1&&(p+=_-1,a-=_-1),a--,y--}for(;x<i.length&&c+1<o.length&&!this._isCharWordSeparator(i.loadCell(x+1,this._workCell));){i.loadCell(x+1,this._workCell);let _=this._workCell.getChars().length;this._workCell.getWidth()===2?(h++,x++):_>1&&(f+=_-1,c+=_-1),c++,x++}}c++;let m=a+u-d+p,g=Math.min(this._bufferService.cols,c-a+d+h-p-f);if(!(!t&&o.slice(a,c).trim()==="")){if(n&&m===0&&i.getCodePoint(0)!==32){let y=r.lines.get(e[1]-1);if(y&&i.isWrapped&&y.getCodePoint(this._bufferService.cols-1)!==32){let x=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(x){let b=this._bufferService.cols-x.start;m-=b,g+=b}}}if(s&&m+g===this._bufferService.cols&&i.getCodePoint(this._bufferService.cols-1)!==32){let y=r.lines.get(e[1]+1);if(y!=null&&y.isWrapped&&y.getCodePoint(0)!==32){let x=this._getWordAt([0,e[1]+1],!1,!1,!0);x&&(g+=x.length)}}return{start:m,length:g}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Bw(n,this._bufferService.cols)}};uv=_t([le(3,Bn),le(4,ra),le(5,_0),le(6,zn),le(7,Qr),le(8,Xr)],uv);var zw=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},$w=class{constructor(){this._color=new zw,this._css=new zw}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},At=Object.freeze((()=>{let e=[ct.toColor("#2e3436"),ct.toColor("#cc0000"),ct.toColor("#4e9a06"),ct.toColor("#c4a000"),ct.toColor("#3465a4"),ct.toColor("#75507b"),ct.toColor("#06989a"),ct.toColor("#d3d7cf"),ct.toColor("#555753"),ct.toColor("#ef2929"),ct.toColor("#8ae234"),ct.toColor("#fce94f"),ct.toColor("#729fcf"),ct.toColor("#ad7fa8"),ct.toColor("#34e2e2"),ct.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let s=t[n/36%6|0],r=t[n/6%6|0],i=t[n%6];e.push({css:Rt.toCss(s,r,i),rgba:Rt.toRgba(s,r,i)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:Rt.toCss(s,s,s),rgba:Rt.toRgba(s,s,s)})}return e})()),co=ct.toColor("#ffffff"),hc=ct.toColor("#000000"),Hw=ct.toColor("#ffffff"),Ww=hc,ql={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},FI=co,dv=class extends Te{constructor(e){super(),this._optionsService=e,this._contrastCache=new $w,this._halfContrastCache=new $w,this._onChangeColors=this._register(new re),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:co,background:hc,cursor:Hw,cursorAccent:Ww,selectionForeground:void 0,selectionBackgroundTransparent:ql,selectionBackgroundOpaque:st.blend(hc,ql),selectionInactiveBackgroundTransparent:ql,selectionInactiveBackgroundOpaque:st.blend(hc,ql),scrollbarSliderBackground:st.opacity(co,.2),scrollbarSliderHoverBackground:st.opacity(co,.4),scrollbarSliderActiveBackground:st.opacity(co,.5),overviewRulerBorder:co,ansi:At.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Ve(e.foreground,co),t.background=Ve(e.background,hc),t.cursor=st.blend(t.background,Ve(e.cursor,Hw)),t.cursorAccent=st.blend(t.background,Ve(e.cursorAccent,Ww)),t.selectionBackgroundTransparent=Ve(e.selectionBackground,ql),t.selectionBackgroundOpaque=st.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ve(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=st.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ve(e.selectionForeground,Ow):void 0,t.selectionForeground===Ow&&(t.selectionForeground=void 0),st.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=st.opacity(t.selectionBackgroundTransparent,.3)),st.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=st.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ve(e.scrollbarSliderBackground,st.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ve(e.scrollbarSliderHoverBackground,st.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ve(e.scrollbarSliderActiveBackground,st.opacity(t.foreground,.5)),t.overviewRulerBorder=Ve(e.overviewRulerBorder,FI),t.ansi=At.slice(),t.ansi[0]=Ve(e.black,At[0]),t.ansi[1]=Ve(e.red,At[1]),t.ansi[2]=Ve(e.green,At[2]),t.ansi[3]=Ve(e.yellow,At[3]),t.ansi[4]=Ve(e.blue,At[4]),t.ansi[5]=Ve(e.magenta,At[5]),t.ansi[6]=Ve(e.cyan,At[6]),t.ansi[7]=Ve(e.white,At[7]),t.ansi[8]=Ve(e.brightBlack,At[8]),t.ansi[9]=Ve(e.brightRed,At[9]),t.ansi[10]=Ve(e.brightGreen,At[10]),t.ansi[11]=Ve(e.brightYellow,At[11]),t.ansi[12]=Ve(e.brightBlue,At[12]),t.ansi[13]=Ve(e.brightMagenta,At[13]),t.ansi[14]=Ve(e.brightCyan,At[14]),t.ansi[15]=Ve(e.brightWhite,At[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<n;s++)t.ansi[s+16]=Ve(e.extendedAnsi[s],At[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};dv=_t([le(0,zn)],dv);function Ve(e,t){if(e!==void 0)try{return ct.toColor(e)}catch{}return t}var BI=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},zI=class{constructor(){this._services=new BI,this._services.set(b0,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=MA(e).sort((i,o)=>i.index-o.index),s=[];for(let i of n){let o=this._services.get(i.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${i.id._id}.`);s.push(o)}let r=n.length>0?n[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},$I={trace:0,debug:1,info:2,warn:3,error:4,off:5},HI="xterm.js: ",hv=class extends Te{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=$I[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":HI)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};hv=_t([le(0,zn)],hv);var Uw=class extends Te{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new re),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new re),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new re),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+n.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<n.length;s++)this._array[this._getCyclicIndex(e+s)]=n[s];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let s=this._length+n.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let s=e+t+n-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+n,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Pe=3,Tt=Object.freeze(new Bu),Nd=0,_m=2,fc=class CE{constructor(t,n,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Pe);let r=n||Ps.fromCharData([0,Uj,1,0]);for(let i=0;i<t;++i)this.setCell(i,r);this.length=t}get(t){let n=this._data[t*Pe+0],s=n&2097151;return[this._data[t*Pe+1],n&2097152?this._combined[t]:s?di(s):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,n){this._data[t*Pe+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Pe+0]=t|2097152|n[2]<<22):this._data[t*Pe+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Pe+0]>>22}hasWidth(t){return this._data[t*Pe+0]&12582912}getFg(t){return this._data[t*Pe+1]}getBg(t){return this._data[t*Pe+2]}hasContent(t){return this._data[t*Pe+0]&4194303}getCodePoint(t){let n=this._data[t*Pe+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Pe+0]&2097152}getString(t){let n=this._data[t*Pe+0];return n&2097152?this._combined[t]:n&2097151?di(n&2097151):""}isProtected(t){return this._data[t*Pe+2]&536870912}loadCell(t,n){return Nd=t*Pe,n.content=this._data[Nd+0],n.fg=this._data[Nd+1],n.bg=this._data[Nd+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Pe+0]=n.content,this._data[t*Pe+1]=n.fg,this._data[t*Pe+2]=n.bg}setCellFromCodepoint(t,n,s,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Pe+0]=n|s<<22,this._data[t*Pe+1]=r.fg,this._data[t*Pe+2]=r.bg}addCodepointToCell(t,n,s){let r=this._data[t*Pe+0];r&2097152?this._combined[t]+=di(n):r&2097151?(this._combined[t]=di(r&2097151)+di(n),r&=-2097152,r|=2097152):r=n|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[t*Pe+0]=r}insertCells(t,n,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length-t){let r=new Ps;for(let i=this.length-t-n-1;i>=0;--i)this.setCell(t+n+i,this.loadCell(t+i,r));for(let i=0;i<n;++i)this.setCell(t+i,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,n,s){if(t%=this.length,n<this.length-t){let r=new Ps;for(let i=0;i<this.length-t-n;++i)this.setCell(t+i,this.loadCell(t+n+i,r));for(let i=this.length-n;i<this.length;++i)this.setCell(i,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,n,s,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.setCell(t++,s)}resize(t,n){if(t===this.length)return this._data.length*4*_m<this._data.buffer.byteLength;let s=t*Pe;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,n)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let o=0;o<r.length;o++){let a=parseInt(r[o],10);a>=t&&delete this._combined[a]}let i=Object.keys(this._extendedAttrs);for(let o=0;o<i.length;o++){let a=parseInt(i[o],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,s*4*_m<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*_m<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new CE(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Pe+0]&4194303)return t+(this._data[t*Pe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Pe+0]&4194303||this._data[t*Pe+2]&50331648)return t+(this._data[t*Pe+0]>>22);return 0}copyCellsFrom(t,n,s,r,i){let o=t._data;if(i)for(let c=r-1;c>=0;c--){for(let u=0;u<Pe;u++)this._data[(s+c)*Pe+u]=o[(n+c)*Pe+u];o[(n+c)*Pe+2]&268435456&&(this._extendedAttrs[s+c]=t._extendedAttrs[n+c])}else for(let c=0;c<r;c++){for(let u=0;u<Pe;u++)this._data[(s+c)*Pe+u]=o[(n+c)*Pe+u];o[(n+c)*Pe+2]&268435456&&(this._extendedAttrs[s+c]=t._extendedAttrs[n+c])}let a=Object.keys(t._combined);for(let c=0;c<a.length;c++){let u=parseInt(a[c],10);u>=n&&(this._combined[u-n+s]=t._combined[u])}}translateToString(t,n,s,r){n=n??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let i="";for(;n<s;){let o=this._data[n*Pe+0],a=o&2097151,c=o&2097152?this._combined[n]:a?di(a):Ni;if(i+=c,r)for(let u=0;u<c.length;++u)r.push(n);n+=o>>22||1}return r&&r.push(n),i}};function WI(e,t,n,s,r,i){let o=[];for(let a=0;a<e.length-1;a++){let c=a,u=e.get(++c);if(!u.isWrapped)continue;let d=[e.get(a)];for(;c<e.length&&u.isWrapped;)d.push(u),u=e.get(++c);if(!i&&s>=a&&s<c){a+=d.length-1;continue}let h=0,p=fu(d,h,t),f=1,m=0;for(;f<d.length;){let y=fu(d,f,t),x=y-m,b=n-p,_=Math.min(x,b);d[h].copyCellsFrom(d[f],m,p,_,!1),p+=_,p===n&&(h++,p=0),m+=_,m===y&&(f++,m=0),p===0&&h!==0&&d[h-1].getWidth(n-1)===2&&(d[h].copyCellsFrom(d[h-1],n-1,p++,1,!1),d[h-1].setCell(n-1,r))}d[h].replaceCells(p,n,r);let g=0;for(let y=d.length-1;y>0&&(y>h||d[y].getTrimmedLength()===0);y--)g++;g>0&&(o.push(a+d.length-g),o.push(g)),a+=d.length-1}return o}function UI(e,t){let n=[],s=0,r=t[s],i=0;for(let o=0;o<e.length;o++)if(r===o){let a=t[++s];e.onDeleteEmitter.fire({index:o-i,amount:a}),o+=a-1,i+=a,r=t[++s]}else n.push(o);return{layout:n,countRemoved:i}}function qI(e,t){let n=[];for(let s=0;s<t.length;s++)n.push(e.get(t[s]));for(let s=0;s<n.length;s++)e.set(s,n[s]);e.length=t.length}function KI(e,t,n){let s=[],r=e.map((c,u)=>fu(e,u,t)).reduce((c,u)=>c+u),i=0,o=0,a=0;for(;a<r;){if(r-a<n){s.push(r-a);break}i+=n;let c=fu(e,o,t);i>c&&(i-=c,o++);let u=e[o].getWidth(i-1)===2;u&&i--;let d=u?n-1:n;s.push(d),a+=d}return s}function fu(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,r=e[t+1].getWidth(0)===2;return s&&r?n-1:n}var NE=class jE{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=jE._nextId++,this._onDispose=this.register(new re),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Yo(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};NE._nextId=1;var VI=NE,Wt={},uo=Wt.B;Wt[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};Wt.A={"#":"£"};Wt.B=void 0;Wt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Wt.C=Wt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Wt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Wt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Wt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Wt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Wt.E=Wt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Wt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Wt.H=Wt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Wt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var qw=4294967295,Kw=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Tt.clone(),this.savedCharset=uo,this.markers=[],this._nullCell=Ps.fromCharData([0,Uj,1,0]),this._whitespaceCell=Ps.fromCharData([0,Ni,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new bf,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Uw(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new gf),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new gf),this._whitespaceCell}getBlankLine(e,t){return new fc(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>qw?qw:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Tt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Uw(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Tt),s=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(e,n);let i=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new fc(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+i+1?(this.ybase--,i++,this.ydisp>0&&this.ydisp--):this.lines.push(new fc(e,n)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let o=this.lines.length-r;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),i&&(this.y+=i),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let i=0;i<this.lines.length;i++)s+=+this.lines.get(i).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,s=WI(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Tt),n);if(s.length>0){let r=UI(this.lines,s);qI(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let s=this.getNullCell(Tt),r=n;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new fc(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(Tt),r=[],i=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let c=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),c.unshift(a);if(!n){let _=this.ybase+this.y;if(_>=o&&_<o+c.length)continue}let u=c[c.length-1].getTrimmedLength(),d=KI(c,this._cols,e),h=d.length-c.length,p;this.ybase===0&&this.y!==this.lines.length-1?p=Math.max(0,this.y-this.lines.maxLength+h):p=Math.max(0,this.lines.length-this.lines.maxLength+h);let f=[];for(let _=0;_<h;_++){let S=this.getBlankLine(Tt,!0);f.push(S)}f.length>0&&(r.push({start:o+c.length+i,newLines:f}),i+=f.length),c.push(...f);let m=d.length-1,g=d[m];g===0&&(m--,g=d[m]);let y=c.length-h-1,x=u;for(;y>=0;){let _=Math.min(x,g);if(c[m]===void 0)break;if(c[m].copyCellsFrom(c[y],x-_,g-_,_,!0),g-=_,g===0&&(m--,g=d[m]),x-=_,x===0){y--;let S=Math.max(y,0);x=fu(c,S,this._cols)}}for(let _=0;_<c.length;_++)d[_]<e&&c[_].setCell(d[_],s);let b=h-p;for(;b-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+i)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+h,this.ybase+t-1)}if(r.length>0){let o=[],a=[];for(let g=0;g<this.lines.length;g++)a.push(this.lines.get(g));let c=this.lines.length,u=c-1,d=0,h=r[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+i);let p=0;for(let g=Math.min(this.lines.maxLength-1,c+i-1);g>=0;g--)if(h&&h.start>u+p){for(let y=h.newLines.length-1;y>=0;y--)this.lines.set(g--,h.newLines[y]);g++,o.push({index:u+1,amount:h.newLines.length}),p+=h.newLines.length,h=r[++d]}else this.lines.set(g,a[u--]);let f=0;for(let g=o.length-1;g>=0;g--)o[g].index+=f,this.lines.onInsertEmitter.fire(o[g]),f+=o[g].amount;let m=Math.max(0,c+i-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,n=0,s){let r=this.lines.get(e);return r?r.translateToString(t,n,s):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new VI(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},YI=class extends Te{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new re),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new Kw(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Kw(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},EE=2,PE=1,fv=class extends Te{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new re),this.onResize=this._onResize.event,this._onScroll=this._register(new re),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,EE),this.rows=Math.max(e.rawOptions.rows||0,PE),this.buffers=this._register(new YI(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=n.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let r=n.ybase+n.scrollTop,i=n.ybase+n.scrollBottom;if(n.scrollTop===0){let o=n.lines.isFull;i===n.lines.length-1?o?n.lines.recycle().copyFrom(s):n.lines.push(s.clone()):n.lines.splice(i+1,0,s.clone()),o?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let o=i-r+1;n.lines.shiftElements(r+1,o-1,-1),n.lines.set(i,s.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let s=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),s!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};fv=_t([le(0,zn)],fv);var ua={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:yf,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},XI=["normal","bold","100","200","300","400","500","600","700","800","900"],QI=class extends Te{constructor(e){super(),this._onOptionChange=this._register(new re),this.onOptionChange=this._onOptionChange.event;let t={...ua};for(let n in e)if(n in t)try{let s=e[n];t[n]=this._sanitizeAndValidateOption(n,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(at(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in ua))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,s)=>{if(!(n in ua))throw new Error(`No option with key "${n}"`);s=this._sanitizeAndValidateOption(n,s),this.rawOptions[n]!==s&&(this.rawOptions[n]=s,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let s={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=ua[e]),!GI(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=ua[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=XI.includes(t)?t:ua[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function GI(e){return e==="block"||e==="underline"||e==="bar"}function pc(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let s in e)n[s]=t<=1?e[s]:e[s]&&pc(e[s],t-1);return n}var Vw=Object.freeze({insertMode:!1}),Yw=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),pv=class extends Te{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new re),this.onData=this._onData.event,this._onUserInput=this._register(new re),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new re),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new re),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=pc(Vw),this.decPrivateModes=pc(Yw)}reset(){this.modes=pc(Vw),this.decPrivateModes=pc(Yw)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};pv=_t([le(0,Bn),le(1,Xj),le(2,zn)],pv);var Xw={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function wm(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Sm=String.fromCharCode,Qw={DEFAULT:e=>{let t=[wm(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Sm(t[0])}${Sm(t[1])}${Sm(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${wm(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${wm(e,!0)};${e.x};${e.y}${t}`}},mv=class extends Te{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new re),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(Xw))this.addProtocol(s,Xw[s]);for(let s of Object.keys(Qw))this.addEncoding(s,Qw[s]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let s=t/n,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};mv=_t([le(0,Bn),le(1,ra),le(2,zn)],mv);var km=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],JI=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Ot;function ZI(e,t){let n=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=n;)if(r=n+s>>1,e>t[r][1])n=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var eF=class{constructor(){if(this.version="6",!Ot){Ot=new Uint8Array(65536),Ot.fill(1),Ot[0]=0,Ot.fill(0,1,32),Ot.fill(0,127,160),Ot.fill(2,4352,4448),Ot[9001]=2,Ot[9002]=2,Ot.fill(2,11904,42192),Ot[12351]=1,Ot.fill(2,44032,55204),Ot.fill(2,63744,64256),Ot.fill(2,65040,65050),Ot.fill(2,65072,65136),Ot.fill(2,65280,65377),Ot.fill(2,65504,65511);for(let e=0;e<km.length;++e)Ot.fill(0,km[e][0],km[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ot[e]:ZI(e,JI)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),s=n===0&&t!==0;if(s){let r=bo.extractWidth(t);r===0?s=!1:r>n&&(n=r)}return bo.createPropertyValue(0,n,s)}},bo=class Sh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new re,this.onChange=this._onChange.event;let t=new eF;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,s=!1){return(t&16777215)<<3|(n&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,s=0,r=t.length;for(let i=0;i<r;++i){let o=t.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=r)return n+this.wcwidth(o);let u=t.charCodeAt(i);56320<=u&&u<=57343?o=(o-55296)*1024+u-56320+65536:n+=this.wcwidth(u)}let a=this.charProperties(o,s),c=Sh.extractWidth(a);Sh.extractShouldJoin(a)&&(c-=Sh.extractWidth(s)),n+=c,s=a}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},tF=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Gw(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Kl=2147483647,nF=256,TE=class gv{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>nF)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new gv;if(!t.length)return n;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let r=t[s];if(Array.isArray(r))for(let i=0;i<r.length;++i)n.addSubParam(r[i]);else n.addParam(r)}return n}clone(){let t=new gv(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let s=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Kl?Kl:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Kl?Kl:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-n>0?this._subParams.subarray(n,s):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let s=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-s>0&&(t[n]=this._subParams.slice(s,r))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[n-1];s[n-1]=~r?Math.min(r*10+t,Kl):t}},Vl=[],sF=class{constructor(){this._state=0,this._active=Vl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Vl}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Vl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Vl,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",up(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;s>=0&&(n=this._active[s].end(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=Vl,this._id=-1,this._state=0}}},ss=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,n,s){this._hitLimit||(this._data+=up(t,n,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let n=!1;if(this._hitLimit)n=!1;else if(t&&(n=this._handler(this._data),n instanceof Promise))return n.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,n}},Yl=[],rF=class{constructor(){this._handlers=Object.create(null),this._active=Yl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Yl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Yl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Yl,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",up(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;s>=0&&(n=this._active[s].unhook(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=Yl,this._ident=0}},mc=new TE;mc.addParam(0);var Jw=class{constructor(e){this._handler=e,this._data="",this._params=mc,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():mc,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=up(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=mc,this._data="",this._hitLimit=!1,n));return this._params=mc,this._data="",this._hitLimit=!1,t}},iF=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,s){this.table[t<<8|e]=n<<4|s}addMany(e,t,n,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=n<<4|s}},_s=160,oF=function(){let e=new iF(4095),t=Array.apply(null,Array(256)).map((a,c)=>c),n=(a,c)=>t.slice(a,c),s=n(32,127),r=n(0,24);r.push(25),r.push.apply(r,n(28,32));let i=n(0,14),o;e.setDefault(1,0),e.addMany(s,0,2,0);for(o in i)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(_s,0,2,0),e.add(_s,8,5,8),e.add(_s,6,0,6),e.add(_s,11,0,11),e.add(_s,13,13,13),e}(),aF=class extends Te{constructor(e=oF){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new TE,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(at(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new sF),this._dcsParser=this._register(new rF),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;r<e.intermediates.length;++r){let i=e.intermediates.charCodeAt(r);if(32>i||i>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=i}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=s,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let s=this._escHandlers[n];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let s=this._csiHandlers[n];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,n){let s=0,r=0,i=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,i=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,c=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&c>-1){for(;c>=0&&(o=a[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&c>-1){for(;c>=0&&(o=a[c](),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(s!==24&&s!==26,n),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],o=this._oscParser.end(s!==24&&s!==26,n),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,i=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=i;a<t;++a){switch(s=e[a],r=this._transitions.table[this.currentState<<8|(s<160?s:_s)],r>>4){case 2:for(let p=a+1;;++p){if(p>=t||(s=e[p])<32||s>126&&s<_s){this._printHandler(e,a,p),a=p-1;break}if(++p>=t||(s=e[p])<32||s>126&&s<_s){this._printHandler(e,a,p),a=p-1;break}if(++p>=t||(s=e[p])<32||s>126&&s<_s){this._printHandler(e,a,p),a=p-1;break}if(++p>=t||(s=e[p])<32||s>126&&s<_s){this._printHandler(e,a,p),a=p-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let c=this._csiHandlers[this._collect<<8|s],u=c?c.length-1:-1;for(;u>=0&&(o=c[u](this._params),o!==!0);u--)if(o instanceof Promise)return this._preserveStack(3,c,u,r,a),o;u<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++a<t&&(s=e[a])>47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let d=this._escHandlers[this._collect<<8|s],h=d?d.length-1:-1;for(;h>=0&&(o=d[h](),o!==!0);h--)if(o instanceof Promise)return this._preserveStack(4,d,h,r,a),o;h<0&&this._escHandlerFb(this._collect<<8|s),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|s,this._params);break;case 13:for(let p=a+1;;++p)if(p>=t||(s=e[p])===24||s===26||s===27||s>127&&s<_s){this._dcsParser.put(e,a,p),a=p-1;break}break;case 14:if(o=this._dcsParser.unhook(s!==24&&s!==26),o)return this._preserveStack(6,[],0,r,a),o;s===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let p=a+1;;p++)if(p>=t||(s=e[p])<32||s>127&&s<_s){this._oscParser.put(e,a,p),a=p-1;break}break;case 6:if(o=this._oscParser.end(s!==24&&s!==26),o)return this._preserveStack(5,[],0,r,a),o;s===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},lF=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,cF=/^[\da-f]+$/;function Zw(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=lF.exec(t);if(n){let s=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/s*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/s*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),cF.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,s=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(n*r,n*r+n),16);s[r]=n===1?i<<4:n===2?i:n===3?i>>4:i>>8}return s}}function Cm(e,t){let n=e.toString(16),s=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function uF(e,t=16){let[n,s,r]=e;return`rgb:${Cm(n,t)}/${Cm(s,t)}/${Cm(r,t)}`}var dF={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ri=131072,e1=10;function t1(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var n1=5e3,s1=0,hF=class extends Te{constructor(e,t,n,s,r,i,o,a,c=new aF){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=s,this._optionsService=r,this._oscLinkService=i,this._coreMouseService=o,this._unicodeService=a,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new RA,this._utf8Decoder=new DA,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Tt.clone(),this._eraseAttrDataInternal=Tt.clone(),this._onRequestBell=this._register(new re),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new re),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new re),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new re),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new re),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new re),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new re),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new re),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new re),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new re),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new re),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new re),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new re),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new xv(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(u=>this._activeBuffer=u.activeBuffer)),this._parser.setCsiHandlerFallback((u,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(u),params:d.toArray()})}),this._parser.setEscHandlerFallback(u=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(u)})}),this._parser.setExecuteHandlerFallback(u=>{this._logService.debug("Unknown EXECUTE code: ",{code:u})}),this._parser.setOscHandlerFallback((u,d,h)=>{this._logService.debug("Unknown OSC code: ",{identifier:u,action:d,data:h})}),this._parser.setDcsHandlerFallback((u,d,h)=>{d==="HOOK"&&(h=h.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(u),action:d,payload:h})}),this._parser.setPrintHandler((u,d,h)=>this.print(u,d,h)),this._parser.registerCsiHandler({final:"@"},u=>this.insertChars(u)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},u=>this.scrollLeft(u)),this._parser.registerCsiHandler({final:"A"},u=>this.cursorUp(u)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},u=>this.scrollRight(u)),this._parser.registerCsiHandler({final:"B"},u=>this.cursorDown(u)),this._parser.registerCsiHandler({final:"C"},u=>this.cursorForward(u)),this._parser.registerCsiHandler({final:"D"},u=>this.cursorBackward(u)),this._parser.registerCsiHandler({final:"E"},u=>this.cursorNextLine(u)),this._parser.registerCsiHandler({final:"F"},u=>this.cursorPrecedingLine(u)),this._parser.registerCsiHandler({final:"G"},u=>this.cursorCharAbsolute(u)),this._parser.registerCsiHandler({final:"H"},u=>this.cursorPosition(u)),this._parser.registerCsiHandler({final:"I"},u=>this.cursorForwardTab(u)),this._parser.registerCsiHandler({final:"J"},u=>this.eraseInDisplay(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},u=>this.eraseInDisplay(u,!0)),this._parser.registerCsiHandler({final:"K"},u=>this.eraseInLine(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},u=>this.eraseInLine(u,!0)),this._parser.registerCsiHandler({final:"L"},u=>this.insertLines(u)),this._parser.registerCsiHandler({final:"M"},u=>this.deleteLines(u)),this._parser.registerCsiHandler({final:"P"},u=>this.deleteChars(u)),this._parser.registerCsiHandler({final:"S"},u=>this.scrollUp(u)),this._parser.registerCsiHandler({final:"T"},u=>this.scrollDown(u)),this._parser.registerCsiHandler({final:"X"},u=>this.eraseChars(u)),this._parser.registerCsiHandler({final:"Z"},u=>this.cursorBackwardTab(u)),this._parser.registerCsiHandler({final:"`"},u=>this.charPosAbsolute(u)),this._parser.registerCsiHandler({final:"a"},u=>this.hPositionRelative(u)),this._parser.registerCsiHandler({final:"b"},u=>this.repeatPrecedingCharacter(u)),this._parser.registerCsiHandler({final:"c"},u=>this.sendDeviceAttributesPrimary(u)),this._parser.registerCsiHandler({prefix:">",final:"c"},u=>this.sendDeviceAttributesSecondary(u)),this._parser.registerCsiHandler({final:"d"},u=>this.linePosAbsolute(u)),this._parser.registerCsiHandler({final:"e"},u=>this.vPositionRelative(u)),this._parser.registerCsiHandler({final:"f"},u=>this.hVPosition(u)),this._parser.registerCsiHandler({final:"g"},u=>this.tabClear(u)),this._parser.registerCsiHandler({final:"h"},u=>this.setMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"h"},u=>this.setModePrivate(u)),this._parser.registerCsiHandler({final:"l"},u=>this.resetMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"l"},u=>this.resetModePrivate(u)),this._parser.registerCsiHandler({final:"m"},u=>this.charAttributes(u)),this._parser.registerCsiHandler({final:"n"},u=>this.deviceStatus(u)),this._parser.registerCsiHandler({prefix:"?",final:"n"},u=>this.deviceStatusPrivate(u)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},u=>this.softReset(u)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},u=>this.setCursorStyle(u)),this._parser.registerCsiHandler({final:"r"},u=>this.setScrollRegion(u)),this._parser.registerCsiHandler({final:"s"},u=>this.saveCursor(u)),this._parser.registerCsiHandler({final:"t"},u=>this.windowOptions(u)),this._parser.registerCsiHandler({final:"u"},u=>this.restoreCursor(u)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},u=>this.insertColumns(u)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},u=>this.deleteColumns(u)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},u=>this.selectProtected(u)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},u=>this.requestMode(u,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},u=>this.requestMode(u,!1)),this._parser.setExecuteHandler(G.BEL,()=>this.bell()),this._parser.setExecuteHandler(G.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(G.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(G.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(G.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(G.BS,()=>this.backspace()),this._parser.setExecuteHandler(G.HT,()=>this.tab()),this._parser.setExecuteHandler(G.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(G.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(_h.IND,()=>this.index()),this._parser.setExecuteHandler(_h.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(_h.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ss(u=>(this.setTitle(u),this.setIconName(u),!0))),this._parser.registerOscHandler(1,new ss(u=>this.setIconName(u))),this._parser.registerOscHandler(2,new ss(u=>this.setTitle(u))),this._parser.registerOscHandler(4,new ss(u=>this.setOrReportIndexedColor(u))),this._parser.registerOscHandler(8,new ss(u=>this.setHyperlink(u))),this._parser.registerOscHandler(10,new ss(u=>this.setOrReportFgColor(u))),this._parser.registerOscHandler(11,new ss(u=>this.setOrReportBgColor(u))),this._parser.registerOscHandler(12,new ss(u=>this.setOrReportCursorColor(u))),this._parser.registerOscHandler(104,new ss(u=>this.restoreIndexedColor(u))),this._parser.registerOscHandler(110,new ss(u=>this.restoreFgColor(u))),this._parser.registerOscHandler(111,new ss(u=>this.restoreBgColor(u))),this._parser.registerOscHandler(112,new ss(u=>this.restoreCursorColor(u))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let u in Wt)this._parser.registerEscHandler({intermediates:"(",final:u},()=>this.selectCharset("("+u)),this._parser.registerEscHandler({intermediates:")",final:u},()=>this.selectCharset(")"+u)),this._parser.registerEscHandler({intermediates:"*",final:u},()=>this.selectCharset("*"+u)),this._parser.registerEscHandler({intermediates:"+",final:u},()=>this.selectCharset("+"+u)),this._parser.registerEscHandler({intermediates:"-",final:u},()=>this.selectCharset("-"+u)),this._parser.registerEscHandler({intermediates:".",final:u},()=>this.selectCharset("."+u)),this._parser.registerEscHandler({intermediates:"/",final:u},()=>this.selectCharset("/"+u));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(u=>(this._logService.error("Parsing error: ",u),u)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Jw((u,d)=>this.requestStatusString(u,d)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),n1))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${n1} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,s=this._activeBuffer.x,r=this._activeBuffer.y,i=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ri&&(i=this._parseStack.position+ri)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,u=>String.fromCharCode(u)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(u=>u.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ri&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ri))),o||this._dirtyRowTracker.clearRange(),e.length>ri)for(let u=i;u<e.length;u+=ri){let d=u+ri<e.length?u+ri:e.length,h=typeof e=="string"?this._stringDecoder.decode(e.substring(u,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(u,d),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,h))return this._preserveStack(s,r,h,u),this._logSlowResolvingAsync(n),n}else if(!o){let u=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,u))return this._preserveStack(s,r,u,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,n){let s,r,i=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,u=this._coreService.modes.insertMode,d=this._curAttrData,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&h.getWidth(this._activeBuffer.x-1)===2&&h.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let p=this._parser.precedingJoinState;for(let f=t;f<n;++f){if(s=e[f],s<127&&i){let x=i[String.fromCharCode(s)];x&&(s=x.charCodeAt(0))}let m=this._unicodeService.charProperties(s,p);r=bo.extractWidth(m);let g=bo.extractShouldJoin(m),y=g?bo.extractWidth(p):0;if(p=m,o&&this._onA11yChar.fire(di(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-y>a){if(c){let x=h,b=this._activeBuffer.x-y;for(this._activeBuffer.x=y,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),y>0&&h instanceof fc&&h.copyCellsFrom(x,b,0,y,!1);b<a;)x.setCellFromCodepoint(b++,0,1,d)}else if(this._activeBuffer.x=a-1,r===2)continue}if(g&&this._activeBuffer.x){let x=h.getWidth(this._activeBuffer.x-1)?1:2;h.addCodepointToCell(this._activeBuffer.x-x,s,r);for(let b=r-y;--b>=0;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(u&&(h.insertCells(this._activeBuffer.x,r-y,this._activeBuffer.getNullCell(d)),h.getWidth(a-1)===2&&h.setCellFromCodepoint(a-1,0,1,d)),h.setCellFromCodepoint(this._activeBuffer.x++,s,r,d),r>0)for(;--r;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=p,this._activeBuffer.x<a&&n-t>0&&h.getWidth(this._activeBuffer.x)===0&&!h.hasContent(this._activeBuffer.x)&&h.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>t1(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Jw(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ss(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,s=!1,r=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(i.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&s.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Tt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,s=bo.extractWidth(t),r=this._activeBuffer.x-s,i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(i.length*n),a=0;for(let u=0;u<i.length;){let d=i.codePointAt(u)||0;o[a++]=d,u+=d>65535?2:1}let c=a;for(let u=1;u<n;++u)o.copyWithin(c,0,a),c+=a;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(G.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(G.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(G.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(G.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(G.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,uo),this._charsetService.setgCharset(1,uo),this._charsetService.setgCharset(2,uo),this._charsetService.setgCharset(3,uo);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:i}=this._coreMouseService,o=this._coreService,{buffers:a,cols:c}=this._bufferService,{active:u,alt:d}=a,h=this._optionsService.rawOptions,p=(g,y)=>(o.triggerDataEvent(`${G.ESC}[${t?"":"?"}${g};${y}$y`),!0),f=g=>g?1:2,m=e.params[0];return t?m===2?p(m,4):m===4?p(m,f(o.modes.insertMode)):m===12?p(m,3):m===20?p(m,f(h.convertEol)):p(m,0):m===1?p(m,f(s.applicationCursorKeys)):m===3?p(m,h.windowOptions.setWinLines?c===80?2:c===132?1:0:0):m===6?p(m,f(s.origin)):m===7?p(m,f(s.wraparound)):m===8?p(m,3):m===9?p(m,f(r==="X10")):m===12?p(m,f(h.cursorBlink)):m===25?p(m,f(!o.isCursorHidden)):m===45?p(m,f(s.reverseWraparound)):m===66?p(m,f(s.applicationKeypad)):m===67?p(m,4):m===1e3?p(m,f(r==="VT200")):m===1002?p(m,f(r==="DRAG")):m===1003?p(m,f(r==="ANY")):m===1004?p(m,f(s.sendFocus)):m===1005?p(m,4):m===1006?p(m,f(i==="SGR")):m===1015?p(m,4):m===1016?p(m,f(i==="SGR_PIXELS")):m===1048?p(m,1):m===47||m===1047||m===1049?p(m,f(u===d)):m===2004?p(m,f(s.bracketedPasteMode)):m===2026?p(m,f(s.synchronizedOutput)):p(m,0)}_updateAttrColor(e,t,n,s,r){return t===2?(e|=50331648,e&=-16777216,e|=Bu.fromColorRGB([n,s,r])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let s=[0,0,-1,0,0,0],r=0,i=0;do{if(s[i+r]=e.params[t+i],e.hasSubParams(t+i)){let o=e.getSubParams(t+i),a=0;do s[1]===5&&(r=1),s[i+a+1+r]=o[a];while(++a<o.length&&a+i+1+r<s.length);break}if(s[1]===5&&i+r>=2||s[1]===2&&i+r>=5)break;s[1]&&(r=1)}while(++i+t<e.length&&i+r<s.length);for(let o=2;o<s.length;++o)s[o]===-1&&(s[o]=0);switch(s[0]){case 38:n.fg=this._updateAttrColor(n.fg,s[1],s[3],s[4],s[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,s[1],s[3],s[4],s[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,s[1],s[3],s[4],s[5])}return i}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Tt.fg,e.bg=Tt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,s=this._curAttrData;for(let r=0;r<t;r++)n=e.params[r],n>=30&&n<=37?(s.fg&=-50331904,s.fg|=16777216|n-30):n>=40&&n<=47?(s.bg&=-50331904,s.bg|=16777216|n-40):n>=90&&n<=97?(s.fg&=-50331904,s.fg|=16777216|n-90|8):n>=100&&n<=107?(s.bg&=-50331904,s.bg|=16777216|n-100|8):n===0?this._processSGR0(s):n===1?s.fg|=134217728:n===3?s.bg|=67108864:n===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):n===5?s.fg|=536870912:n===7?s.fg|=67108864:n===8?s.fg|=1073741824:n===9?s.fg|=2147483648:n===2?s.bg|=134217728:n===21?this._processUnderline(2,s):n===22?(s.fg&=-134217729,s.bg&=-134217729):n===23?s.bg&=-67108865:n===24?(s.fg&=-268435457,this._processUnderline(0,s)):n===25?s.fg&=-536870913:n===27?s.fg&=-67108865:n===28?s.fg&=-1073741825:n===29?s.fg&=2147483647:n===39?(s.fg&=-67108864,s.fg|=Tt.fg&16777215):n===49?(s.bg&=-67108864,s.bg|=Tt.bg&16777215):n===38||n===48||n===58?r+=this._extractColor(e,r,s):n===53?s.bg|=1073741824:n===55?s.bg&=-1073741825:n===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):n===100?(s.fg&=-67108864,s.fg|=Tt.fg&16777215,s.bg&=-67108864,s.bg|=Tt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${G.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${G.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${G.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Tt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!t1(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${G.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>e1&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>e1&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let s=n.shift(),r=n.shift();if(/^\d+$/.exec(s)){let i=parseInt(s);if(r1(i))if(r==="?")t.push({type:0,index:i});else{let o=Zw(r);o&&t.push({type:1,index:i,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(n,s):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),s,r=n.findIndex(i=>i.startsWith("id="));return r!==-1&&(s=n[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let s=0;s<n.length&&!(t>=this._specialColors.length);++s,++t)if(n[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=Zw(n[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let s=0;s<n.length;++s)if(/^\d+$/.exec(n[s])){let r=parseInt(n[s]);r1(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,uo),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(dF[e[0]],Wt[e[1]]||uo),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Tt.clone(),this._eraseAttrDataInternal=Tt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Ps;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(n);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=o=>(this._coreService.triggerDataEvent(`${G.ESC}${o}${G.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},xv=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(s1=e,e=t,t=s1),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};xv=_t([le(0,Bn)],xv);function r1(e){return 0<=e&&e<256}var fF=5e7,i1=12,pF=50,mF=class extends Te{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new re),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>fF)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],r=this._action(s,t);if(r){let o=a=>performance.now()-n>=i1?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(n,a);r.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(o);return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-n>=i1)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>pF&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},vv=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let a=t.addMarker(t.ybase+t.y),c={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(c,a)),this._dataByLinkId.set(c.id,c),c.id}let n=e,s=this._getEntryIdKey(n),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let i=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(o,i)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);n.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(n,s))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};vv=_t([le(0,Bn)],vv);var o1=!1,gF=class extends Te{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new cl),this._onBinary=this._register(new re),this.onBinary=this._onBinary.event,this._onData=this._register(new re),this.onData=this._onData.event,this._onLineFeed=this._register(new re),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new re),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new re),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new re),this._instantiationService=new zI,this.optionsService=this._register(new QI(e)),this._instantiationService.setService(zn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(fv)),this._instantiationService.setService(Bn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(hv)),this._instantiationService.setService(Xj,this._logService),this.coreService=this._register(this._instantiationService.createInstance(pv)),this._instantiationService.setService(ra,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(mv)),this._instantiationService.setService(Yj,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(bo)),this._instantiationService.setService(OA,this.unicodeService),this._charsetService=this._instantiationService.createInstance(tF),this._instantiationService.setService(AA,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(vv),this._instantiationService.setService(Qj,this._oscLinkService),this._inputHandler=this._register(new hF(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(un.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(un.forward(this._bufferService.onResize,this._onResize)),this._register(un.forward(this.coreService.onData,this._onData)),this._register(un.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new mF((t,n)=>this._inputHandler.parse(t,n))),this._register(un.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new re),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!o1&&(this._logService.warn("writeSync is unreliable and will be removed soon."),o1=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,EE),t=Math.max(t,PE),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Gw.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Gw(this._bufferService),!1))),this._windowsWrappingHeuristics.value=at(()=>{for(let t of e)t.dispose()})}}},xF={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function vF(e,t,n,s){var o;let r={type:0,cancel:!1,key:void 0},i=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=G.ESC+"OA":r.key=G.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=G.ESC+"OD":r.key=G.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=G.ESC+"OC":r.key=G.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=G.ESC+"OB":r.key=G.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":G.DEL,e.altKey&&(r.key=G.ESC+r.key);break;case 9:if(e.shiftKey){r.key=G.ESC+"[Z";break}r.key=G.HT,r.cancel=!0;break;case 13:r.key=e.altKey?G.ESC+G.CR:G.CR,r.cancel=!0;break;case 27:r.key=G.ESC,e.altKey&&(r.key=G.ESC+G.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;i?r.key=G.ESC+"[1;"+(i+1)+"D":t?r.key=G.ESC+"OD":r.key=G.ESC+"[D";break;case 39:if(e.metaKey)break;i?r.key=G.ESC+"[1;"+(i+1)+"C":t?r.key=G.ESC+"OC":r.key=G.ESC+"[C";break;case 38:if(e.metaKey)break;i?r.key=G.ESC+"[1;"+(i+1)+"A":t?r.key=G.ESC+"OA":r.key=G.ESC+"[A";break;case 40:if(e.metaKey)break;i?r.key=G.ESC+"[1;"+(i+1)+"B":t?r.key=G.ESC+"OB":r.key=G.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=G.ESC+"[2~");break;case 46:i?r.key=G.ESC+"[3;"+(i+1)+"~":r.key=G.ESC+"[3~";break;case 36:i?r.key=G.ESC+"[1;"+(i+1)+"H":t?r.key=G.ESC+"OH":r.key=G.ESC+"[H";break;case 35:i?r.key=G.ESC+"[1;"+(i+1)+"F":t?r.key=G.ESC+"OF":r.key=G.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=G.ESC+"[5;"+(i+1)+"~":r.key=G.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=G.ESC+"[6;"+(i+1)+"~":r.key=G.ESC+"[6~";break;case 112:i?r.key=G.ESC+"[1;"+(i+1)+"P":r.key=G.ESC+"OP";break;case 113:i?r.key=G.ESC+"[1;"+(i+1)+"Q":r.key=G.ESC+"OQ";break;case 114:i?r.key=G.ESC+"[1;"+(i+1)+"R":r.key=G.ESC+"OR";break;case 115:i?r.key=G.ESC+"[1;"+(i+1)+"S":r.key=G.ESC+"OS";break;case 116:i?r.key=G.ESC+"[15;"+(i+1)+"~":r.key=G.ESC+"[15~";break;case 117:i?r.key=G.ESC+"[17;"+(i+1)+"~":r.key=G.ESC+"[17~";break;case 118:i?r.key=G.ESC+"[18;"+(i+1)+"~":r.key=G.ESC+"[18~";break;case 119:i?r.key=G.ESC+"[19;"+(i+1)+"~":r.key=G.ESC+"[19~";break;case 120:i?r.key=G.ESC+"[20;"+(i+1)+"~":r.key=G.ESC+"[20~";break;case 121:i?r.key=G.ESC+"[21;"+(i+1)+"~":r.key=G.ESC+"[21~";break;case 122:i?r.key=G.ESC+"[23;"+(i+1)+"~":r.key=G.ESC+"[23~";break;case 123:i?r.key=G.ESC+"[24;"+(i+1)+"~":r.key=G.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=G.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=G.DEL:e.keyCode===219?r.key=G.ESC:e.keyCode===220?r.key=G.FS:e.keyCode===221&&(r.key=G.GS);else if((!n||s)&&e.altKey&&!e.metaKey){let a=(o=xF[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(a)r.key=G.ESC+a;else if(e.keyCode>=65&&e.keyCode<=90){let c=e.ctrlKey?e.keyCode-64:e.keyCode+32,u=String.fromCharCode(c);e.shiftKey&&(u=u.toUpperCase()),r.key=G.ESC+u}else if(e.keyCode===32)r.key=G.ESC+(e.ctrlKey?G.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let c=e.code.slice(3,4);e.shiftKey||(c=c.toLowerCase()),r.key=G.ESC+c,r.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=G.US),e.key==="@"&&(r.key=G.NUL));break}return r}var St=0,yF=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new bf,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new bf,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((r,i)=>this._getKey(r)-this._getKey(i)),t=0,n=0,s=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<s.length;r++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(s[r]=e[t],t++):s[r]=this._array[n++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(St=this._search(t),St===-1)||this._getKey(this._array[St])!==t)return!1;do if(this._array[St]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(St),!0;while(++St<this._array.length&&this._getKey(this._array[St])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,i)=>r-i),t=0,n=new Array(this._array.length-e.length),s=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:n[s++]=this._array[r];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do yield this._array[St];while(++St<this._array.length&&this._getKey(this._array[St])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do t(this._array[St]);while(++St<this._array.length&&this._getKey(this._array[St])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let s=t+n>>1,r=this._getKey(this._array[s]);if(r>e)n=s-1;else if(r<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},Nm=0,a1=0,bF=class extends Te{constructor(){super(),this._decorations=new yF(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new re),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new re),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(at(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new _F(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let s=0,r=0;for(let i of this._decorations.getKeyIterator(t))s=i.options.x??0,r=s+(i.options.width??1),e>=s&&e<r&&(!n||(i.options.layer??"bottom")===n)&&(yield i)}forEachDecorationAtCell(e,t,n,s){this._decorations.forEachByKey(t,r=>{Nm=r.options.x??0,a1=Nm+(r.options.width??1),e>=Nm&&e<a1&&(!n||(r.options.layer??"bottom")===n)&&s(r)})}},_F=class extends $i{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new re),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new re),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=ct.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ct.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},wF=1e3,SF=class{constructor(e,t=wF){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=s-this._lastRefreshMs,i=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},i)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},l1=20,_f=class extends Te{constructor(e,t,n,s){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let i=0;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);if(this._topBoundaryFocusListener=i=>this._handleBoundaryFocus(i,0),this._bottomBoundaryFocusListener=i=>this._handleBoundaryFocus(i,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new SF(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(i=>this._handleResize(i.rows))),this._register(this._terminal.onRender(i=>this._refreshRows(i.start,i.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(i=>this._handleChar(i))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
494
|
-
`))),this._register(this._terminal.onA11yTab(i=>this._handleTab(i))),this._register(this._terminal.onKey(i=>this._handleKey(i.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(ve(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(at(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<l1+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
495
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===l1+1&&(this._liveRegion.textContent+=Fx.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,s=n.lines.length.toString();for(let r=e;r<=t;r++){let i=n.lines.get(n.ydisp+r),o=[],a=(i==null?void 0:i.translateToString(!0,void 0,void 0,o))||"",c=(n.ydisp+r+1).toString(),u=this._rowElements[r];u&&(a.length===0?(u.textContent=" ",this._rowColumns.set(u,[0,1])):(u.textContent=a,this._rowColumns.set(u,o)),u.setAttribute("aria-posinset",c),u.setAttribute("aria-setsize",s),this._alignRowWidth(u))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],r=n.getAttribute("aria-posinset"),i=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===i||e.relatedTarget!==s)return;let o,a;if(t===0?(o=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=n,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{let c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var a;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let s=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:s,offset:((a=s.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(n.node))return;let r=({node:c,offset:u})=>{let d=c instanceof Text?c.parentNode:c,h=parseInt(d==null?void 0:d.getAttribute("aria-posinset"),10)-1;if(isNaN(h))return console.warn("row is invalid. Race condition?"),null;let p=this._rowColumns.get(d);if(!p)return console.warn("columns is null. Race condition?"),null;let f=u<p.length?p[u]:p.slice(-1)[0]+1;return f>=this._terminal.cols&&(++h,f=0),{row:h,column:f}},i=r(t),o=r(n);if(!(!i||!o)){if(i.row>o.row||i.row===o.row&&i.column>=o.column)throw new Error("invalid range");this._terminal.select(i.column,i.row,(o.row-i.row)*this._terminal.cols-i.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var r,i;e.style.transform="";let t=e.getBoundingClientRect().width,n=(i=(r=this._rowColumns.get(e))==null?void 0:r.slice(-1))==null?void 0:i[0];if(!n)return;let s=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};_f=_t([le(1,b0),le(2,Xr),le(3,Qr)],_f);var yv=class extends Te{constructor(e,t,n,s,r){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new re),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new re),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(at(()=>{var i;Yo(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(i=this._activeProviderReplies)==null||i.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(ve(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ve(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ve(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ve(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let s=0;s<n.length;s++){let r=n[s];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var s,r;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(i=>{i==null||i.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[i,o]of this._linkProviderService.linkProviders.entries())t?(r=this._activeProviderReplies)!=null&&r.get(i)&&(n=this._checkLinkProviderResult(i,e,n)):o.provideLinks(e.y,a=>{var u,d;if(this._isMouseOut)return;let c=a==null?void 0:a.map(h=>({link:h}));(u=this._activeProviderReplies)==null||u.set(i,c),n=this._checkLinkProviderResult(i,e,n),((d=this._activeProviderReplies)==null?void 0:d.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let s=0;s<t.size;s++){let r=t.get(s);if(r)for(let i=0;i<r.length;i++){let o=r[i],a=o.link.range.start.y<e?0:o.link.range.start.x,c=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let u=a;u<=c;u++){if(n.has(u)){r.splice(i--,1);break}n.add(u)}}}}_checkLinkProviderResult(e,t,n){var i;if(!this._activeProviderReplies)return n;let s=this._activeProviderReplies.get(e),r=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&s){let o=s.find(a=>this._linkAtPosition(a.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let a=(i=this._activeProviderReplies.get(o))==null?void 0:i.find(c=>this._linkAtPosition(c.link,t));if(a){n=!0,this._handleNewLink(a);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&kF(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Yo(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.pointerCursor},set:n=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.underline},set:n=>{var s,r,i;(s=this._currentLink)!=null&&s.state&&((i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let s=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._askForLink(i,!1)}})))}_linkHover(e,t,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-s-1,n.end.x,n.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return n<=r&&r<=s}_positionFromMouseEvent(e,t,n){let s=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,s,r){return{x1:e,y1:t,x2:n,y2:s,cols:this._bufferService.cols,fg:r}}};yv=_t([le(1,_0),le(2,Qr),le(3,Bn),le(4,Jj)],yv);function kF(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var CF=class extends gF{constructor(e={}){super(e),this._linkifier=this._register(new cl),this.browser=xE,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new cl),this._onCursorMove=this._register(new re),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new re),this.onKey=this._onKey.event,this._onRender=this._register(new re),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new re),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new re),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new re),this.onBell=this._onBell.event,this._onFocus=this._register(new re),this._onBlur=this._register(new re),this._onA11yCharEmitter=this._register(new re),this._onA11yTabEmitter=this._register(new re),this._onWillOpen=this._register(new re),this._setup(),this._decorationService=this._instantiationService.createInstance(bF),this._instantiationService.setService(zu,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(pI),this._instantiationService.setService(Jj,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(zx)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(un.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(un.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(un.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(un.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(at(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,s="";switch(t.index){case 256:n="foreground",s="10";break;case 257:n="background",s="11";break;case 258:n="cursor",s="12";break;default:n="ansi",s="4;"+t.index}switch(t.type){case 0:let r=st.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${G.ESC}]${s};${uF(r)}${mE.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(i=>i.ansi[t.index]=Rt.toColor(...t.color));else{let i=n;this._themeService.modifyColors(o=>o[i]=Rt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(_f,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(n),i=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=i+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(ve(this.element,"copy",t=>{this.hasSelection()&&PA(t,this._selectionService)}));let e=t=>TA(t,this.textarea,this.coreService,this.optionsService);this._register(ve(this.textarea,"paste",e)),this._register(ve(this.element,"paste",e)),vE?this._register(ve(this.element,"mousedown",t=>{t.button===2&&vw(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ve(this.element,"contextmenu",t=>{vw(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),P0&&this._register(ve(this.element,"auxclick",t=>{t.button===1&&Wj(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ve(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ve(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ve(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ve(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ve(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ve(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ve(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var r;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((r=this.element)==null?void 0:r.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(ve(this.screenElement,"mousemove",i=>this.updateCursorStyle(i))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Ix.get()),_E||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(hI,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Xr,this._coreBrowserService),this._register(ve(this.textarea,"focus",i=>this._handleTextAreaFocus(i))),this._register(ve(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(av,this._document,this._helperContainer),this._instantiationService.setService(dp,this._charSizeService),this._themeService=this._instantiationService.createInstance(dv),this._instantiationService.setService(kl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(vf),this._instantiationService.setService(Gj,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(cv,this.rows,this.screenElement)),this._instantiationService.setService(Qr,this._renderService),this._register(this._renderService.onRenderedViewportChange(i=>this._onRender.fire(i))),this.onResize(i=>this._renderService.resize(i.cols,i.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(rv,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(lv),this._instantiationService.setService(_0,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(yv,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(nv,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(i=>{super.scrollLines(i,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(uv,this.element,this.screenElement,s)),this._instantiationService.setService(FA,this._selectionService),this._register(this._selectionService.onRequestScrollLines(i=>this.scrollLines(i.amount,i.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(i=>this._renderService.handleSelectionChanged(i.start,i.end,i.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(i=>{this.textarea.value=i,this.textarea.focus(),this.textarea.select()})),this._register(un.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var i;this._selectionService.refresh(),(i=this._viewport)==null||i.queueSync()})),this._register(this._instantiationService.createInstance(sv,this.screenElement)),this._register(ve(this.element,"mousedown",i=>this._selectionService.handleMouseDown(i))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(_f,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",i=>this._handleScreenReaderModeOptionChange(i))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(xf,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",i=>{!this._overviewRulerRenderer&&i&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(xf,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ov,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(i){var u,d,h,p,f;let o=e._mouseService.getMouseReportCoords(i,e.screenElement);if(!o)return!1;let a,c;switch(i.overrideType||i.type){case"mousemove":c=32,i.buttons===void 0?(a=3,i.button!==void 0&&(a=i.button<3?i.button:3)):a=i.buttons&1?0:i.buttons&4?1:i.buttons&2?2:3;break;case"mouseup":c=0,a=i.button<3?i.button:3;break;case"mousedown":c=1,a=i.button<3?i.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(i)===!1)return!1;let m=i.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(i,(p=(h=(d=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:d.device)==null?void 0:h.cell)==null?void 0:p.height,(f=e._coreBrowserService)==null?void 0:f.dpr)===0)return!1;c=m<0?0:1,a=4;break;default:return!1}return c===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:c,ctrl:i.ctrlKey,alt:i.altKey,shift:i.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:i=>(n(i),i.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(i)),wheel:i=>(n(i),this.cancel(i,!0)),mousedrag:i=>{i.buttons&&n(i)},mousemove:i=>{i.buttons||n(i)}};this._register(this.coreMouseService.onProtocolChange(i=>{i?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(i)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),i&8?s.mousemove||(t.addEventListener("mousemove",r.mousemove),s.mousemove=r.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),i&16?s.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),s.wheel=r.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),i&2?s.mouseup||(s.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),i&4?s.mousedrag||(s.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(ve(t,"mousedown",i=>{if(i.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(i)))return n(i),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(i)})),this._register(ve(t,"wheel",i=>{var o,a,c,u,d;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(i)===!1)return!1;if(!this.buffer.hasScrollback){if(i.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(i,(u=(c=(a=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:a.device)==null?void 0:c.cell)==null?void 0:u.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return this.cancel(i,!0);let h=G.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(i.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!0),this.cancel(i,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Hj(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=vF(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let s=this.rows-1;return this.scrollLines(n.type===2?-s:s),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===G.ETX||n.key===G.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(NF(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Tt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(G.ESC+"[I"):this.coreService.triggerDataEvent(G.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${G.ESC}[4;${n};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.ESC}[6;${r};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function NF(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var jF=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},EF=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Ps)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},c1=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new EF(t)}getNullCell(){return new Ps}},PF=class extends Te{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new re),this.onBufferChange=this._onBufferChange.event,this._normal=new c1(this._core.buffers.normal,"normal"),this._alternate=new c1(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},TF=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,s)=>t(n,s.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},RF=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},DF=["cols","rows"],Qs=0,MF=class extends Te{constructor(e){super(),this._core=this._register(new CF(e)),this._addonManager=this._register(new jF),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],n=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:t.bind(this,s),set:n.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(e){if(DF.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new TF(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new RF(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new PF(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
496
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Ix.get()},set promptLabel(e){Ix.set(e)},get tooMuchOutput(){return Fx.get()},set tooMuchOutput(e){Fx.set(e)}}}_verifyIntegers(...e){for(Qs of e)if(Qs===1/0||isNaN(Qs)||Qs%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Qs of e)if(Qs&&(Qs===1/0||isNaN(Qs)||Qs%1!==0||Qs<0))throw new Error("This API only accepts positive integers")}};/**
|
|
497
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
498
|
-
* @license MIT
|
|
499
|
-
*
|
|
500
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
501
|
-
* @license MIT
|
|
502
|
-
*
|
|
503
|
-
* Originally forked from (with the author's permission):
|
|
504
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
505
|
-
* http://bellard.org/jslinux/
|
|
506
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
507
|
-
*/var LF=2,AF=1,OF=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var h;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((h=this._terminal.options.overviewRuler)==null?void 0:h.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(n.getPropertyValue("height")),r=Math.max(0,parseInt(n.getPropertyValue("width"))),i=window.getComputedStyle(this._terminal.element),o={top:parseInt(i.getPropertyValue("padding-top")),bottom:parseInt(i.getPropertyValue("padding-bottom")),right:parseInt(i.getPropertyValue("padding-right")),left:parseInt(i.getPropertyValue("padding-left"))},a=o.top+o.bottom,c=o.right+o.left,u=s-a,d=r-c-t;return{cols:Math.max(LF,Math.floor(d/e.css.cell.width)),rows:Math.max(AF,Math.floor(u/e.css.cell.height))}}};function u1(e,t){let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>e(...s),t)}}const d1="panopticon.terminal.autoCopyOnSelect",jm=navigator.platform.toLowerCase().includes("mac");function h1({sessionName:e,onDisconnect:t,autoCopyOnSelect:n}){const s=v.useRef(null),r=v.useRef(null),i=v.useRef(null),o=v.useRef(null),a=v.useRef(0),c=v.useRef(null),u=5,[d,h]=v.useState(!0),[p,f]=v.useState(()=>{if(n!==void 0)return n;const D=localStorage.getItem(d1);return D===null?!0:D==="true"}),[m,g]=v.useState({visible:!1,x:0,y:0,canCopy:!1}),[y,x]=v.useState(!1),b=v.useRef(t);b.current=t,v.useEffect(()=>{try{localStorage.setItem(d1,String(p))}catch(D){console.error("Failed to save auto-copy setting:",D)}},[p]);const _=D=>Math.min(1e3*Math.pow(2,D),3e4),S=v.useCallback(async()=>{const D=r.current;if(!D||!D.hasSelection())return;const T=D.getSelection();try{await navigator.clipboard.writeText(T)}catch(P){console.error("Failed to copy to clipboard:",P);const $=document.createElement("textarea");$.value=T,$.style.position="fixed",$.style.opacity="0",document.body.appendChild($),$.select();try{document.execCommand("copy")}catch(W){console.error("Fallback copy failed:",W)}document.body.removeChild($)}},[]),C=v.useCallback(async()=>{var T;if(r.current)try{const P=await navigator.clipboard.readText();((T=o.current)==null?void 0:T.readyState)===WebSocket.OPEN&&o.current.send(P)}catch(P){console.error("Failed to read from clipboard:",P)}},[]),w=v.useCallback(D=>{const T=r.current;if(!T)return;const P=jm?D.metaKey:D.ctrlKey;P&&D.key.toLowerCase()==="c"&&T.hasSelection()&&(D.preventDefault(),S()),P&&D.key.toLowerCase()==="v"&&(D.preventDefault(),C())},[S,C]),j=v.useCallback(D=>{D.preventDefault();const T=r.current;T&&g({visible:!0,x:D.clientX,y:D.clientY,canCopy:T.hasSelection()})},[]),E=v.useCallback(()=>{g(D=>({...D,visible:!1}))},[]),O=v.useCallback(()=>{S(),E()},[S,E]),R=v.useCallback(()=>{C(),E()},[C,E]);v.useEffect(()=>{if(!m.visible)return;const D=()=>{E()};return document.addEventListener("click",D),()=>document.removeEventListener("click",D)},[m.visible,E]);const B=v.useCallback(()=>{if(!s.current||!e)return;c.current&&(clearTimeout(c.current),c.current=null);const D=s.current;if(D.clientWidth===0||D.clientHeight===0){console.warn("XTerminal: Container has no size, retrying in 100ms"),setTimeout(()=>B(),100);return}console.log("XTerminal: Creating terminal, container size:",D.clientWidth,"x",D.clientHeight);let T=r.current,P=i.current;if(!T){T=new MF({cursorBlink:!0,cursorStyle:"block",fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',cols:120,rows:29,scrollback:5e3,convertEol:!1,scrollOnUserInput:!0,allowProposedApi:!0,theme:{background:"#1a1a2e",foreground:"#eaeaea",cursor:"#eaeaea",cursorAccent:"#1a1a2e",selectionBackground:"#3a3a5e",black:"#1a1a2e",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#6272a4",magenta:"#ff79c6",cyan:"#8be9fd",white:"#f8f8f2",brightBlack:"#6272a4",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"}}),P=new OF,T.loadAddon(P),T.open(s.current),P.fit(),r.current=T,i.current=P;let Q=null;T.onSelectionChange(()=>{!p||!T||(Q&&clearTimeout(Q),Q=setTimeout(()=>{if(T&&T.hasSelection()){const Z=T.getSelection();Z&&navigator.clipboard.writeText(Z).catch(ue=>{console.error("Auto-copy failed:",ue)})}},300))}),s.current.addEventListener("keydown",w),s.current.addEventListener("contextmenu",j);const Y=Z=>{Z.preventDefault(),Z.stopPropagation();const ue=Math.round(Z.deltaY/20);T.scrollLines(ue)};s.current.addEventListener("wheel",Y,{passive:!1})}const W=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal?session=${encodeURIComponent(e)}`,I=new WebSocket(W);I.binaryType="arraybuffer",o.current=I,I.onopen=()=>{console.log("XTerminal: WebSocket opened"),a.current=0,T.clear(),P==null||P.fit(),console.log("XTerminal: Sending initial dimensions:",T.cols,"x",T.rows),I.send(JSON.stringify({type:"resize",cols:T.cols,rows:T.rows}))};const H=localStorage.getItem("DEBUG_TERMINAL")==="1";let k=0;const F=[],M=Q=>Q.replace(/[\x00-\x1f\x7f-\xff]/g,Y=>{const Z=Y.charCodeAt(0);return Z===27?"\\e":Z===10?"\\n":Z===13?"\\r":`\\x${Z.toString(16).padStart(2,"0")}`});H&&(console.log("XTerminal: Debug logging enabled. Messages will be logged to console and window.terminalDebugLog"),window.terminalDebugLog=F,window.showTerminalDebug=()=>{F.forEach(Q=>console.log(Q))});const N=[];let z=!1;const U=()=>{if(z||N.length===0||!T)return;z=!0;const Q=N.shift();H&&console.log(`XTerminal-debug: WRITE len=${Q.length}`),T.write(Q,()=>{const Y=T.buffer.active;Y.viewportY>=Y.length-T.rows&&T.scrollToBottom(),z=!1,N.length>0&&setTimeout(U,0)})};I.onmessage=Q=>{let Y="";if(Q.data instanceof ArrayBuffer?Y=new TextDecoder().decode(new Uint8Array(Q.data)):typeof Q.data=="string"&&(Y=Q.data),H){k++;const Z=`[${new Date().toISOString()}] RECV #${k} len=${Y.length}
|
|
508
|
-
DATA: ${M(Y).slice(0,500)}${Y.length>500?"...":""}`;F.push(Z),(k<=20||k%100===0)&&console.log(`XTerminal-debug: RECV #${k} len=${Y.length}`)}N.push(Y),U()},I.onclose=Q=>{var Y,Z;if(console.log("XTerminal: WebSocket closed",Q.code,Q.reason),!d){T.writeln(`\r
|
|
509
|
-
\x1B[33m● Session disconnected\x1B[0m`),(Y=b.current)==null||Y.call(b);return}if(a.current<u){const ue=_(a.current);a.current+=1,T.writeln(`\r
|
|
510
|
-
\x1B[33m● Connection lost. Reconnecting in ${ue/1e3}s (attempt ${a.current}/${u})...\x1B[0m`),c.current=setTimeout(()=>{B()},ue)}else T.writeln(`\r
|
|
511
|
-
\x1B[31m● Connection lost after multiple attempts.\x1B[0m`),(Z=b.current)==null||Z.call(b)},I.onerror=Q=>{console.error("WebSocket error:",Q)},T.onData(Q=>{I.readyState===WebSocket.OPEN&&I.send(Q)}),T.onResize(({cols:Q,rows:Y})=>{I.readyState===WebSocket.OPEN&&I.send(JSON.stringify({type:"resize",cols:Q,rows:Y}))});const K=u1(()=>{I.readyState===WebSocket.OPEN&&(P==null||P.fit())},200);return window.addEventListener("resize",K),()=>{window.removeEventListener("resize",K),h(!1),c.current&&clearTimeout(c.current),I.close(),T==null||T.dispose(),r.current=null,i.current=null}},[e,d,p,w,j]);v.useEffect(()=>{let D=!1,T;const P=setTimeout(()=>{D||(T=B())},50);return()=>{D=!0,clearTimeout(P),T==null||T()}},[B]),v.useEffect(()=>{const D=u1(()=>{var P,$;((P=o.current)==null?void 0:P.readyState)===WebSocket.OPEN&&(($=i.current)==null||$.fit())},200),T=new ResizeObserver(D);return s.current&&T.observe(s.current),()=>{T.disconnect()}},[]);const L=()=>{var D;(D=r.current)==null||D.focus()};return l.jsxs("div",{className:"relative w-full h-full",children:[l.jsx("div",{className:"absolute top-2 right-2 z-10 flex gap-2",children:l.jsx("button",{onClick:()=>x(!y),className:"p-1.5 rounded bg-slate-700/80 hover:bg-slate-600/80 text-slate-300 transition-colors",title:"Terminal settings",children:l.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})}),y&&l.jsxs("div",{className:"absolute top-10 right-2 z-20 w-64 p-3 rounded-lg bg-slate-800 border border-slate-700 shadow-xl",children:[l.jsx("h3",{className:"text-sm font-semibold text-slate-200 mb-3",children:"Terminal Settings"}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:p,onChange:D=>f(D.target.checked),className:"w-4 h-4 rounded border-slate-600 bg-slate-700 text-blue-500 focus:ring-blue-500"}),l.jsx("span",{className:"text-sm text-slate-300",children:"Auto-copy on selection"})]}),l.jsx("p",{className:"text-xs text-slate-500 mt-2",children:"Automatically copy selected text to clipboard"})]}),l.jsx("div",{ref:s,className:"absolute inset-0",onClick:L,tabIndex:0,style:{padding:"8px",backgroundColor:"#1a1a2e",overflow:"hidden",outline:"none"}}),m.visible&&l.jsxs("div",{className:"fixed z-50 min-w-[120px] py-1 rounded-lg bg-slate-800 border border-slate-700 shadow-xl",style:{left:m.x,top:m.y},onClick:D=>D.stopPropagation(),children:[m.canCopy&&l.jsxs("button",{onClick:O,className:"w-full px-4 py-2 text-left text-sm text-slate-200 hover:bg-slate-700 transition-colors flex items-center gap-2",children:[l.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy",l.jsx("span",{className:"ml-auto text-xs text-slate-500",children:jm?"⌘C":"Ctrl+C"})]}),l.jsxs("button",{onClick:R,className:"w-full px-4 py-2 text-left text-sm text-slate-200 hover:bg-slate-700 transition-colors flex items-center gap-2",children:[l.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),"Paste",l.jsx("span",{className:"ml-auto text-xs text-slate-500",children:jm?"⌘V":"Ctrl+V"})]})]})]})}function T0({issueId:e,isOpen:t,onClose:n}){var u,d,h,p,f;const{data:s,isLoading:r,isFetching:i,error:o}=he({queryKey:["beads",e],queryFn:async()=>{const m=await fetch(`/api/issues/${e}/beads`);if(!m.ok)throw new Error("Failed to fetch tasks");return m.json()},enabled:t,staleTime:0,refetchOnMount:"always"});if(!t)return null;const a=((u=s==null?void 0:s.tasks)==null?void 0:u.filter(m=>m.status!=="closed"))||[],c=((d=s==null?void 0:s.tasks)==null?void 0:d.filter(m=>m.status==="closed"))||[];return l.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:n}),l.jsxs("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-lg mx-4 max-h-[70vh] overflow-hidden flex flex-col",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ko,{className:"w-5 h-5 text-green-400"}),l.jsxs("h2",{className:"font-semibold text-content",children:["Tasks: ",e]})]}),l.jsx("button",{onClick:n,className:"p-1 text-content-subtle hover:text-content hover:bg-surface-overlay rounded transition-colors",children:l.jsx(yt,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[(r||i)&&!((h=s==null?void 0:s.tasks)!=null&&h.length)&&l.jsxs("div",{className:"space-y-2",children:[[1,2,3].map(m=>l.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border border-divider bg-surface-overlay/30 animate-pulse",children:[l.jsx("div",{className:"w-4 h-4 bg-surface-emphasis rounded-full mt-0.5"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-3/4"}),l.jsx("div",{className:"h-3 bg-surface-overlay rounded w-1/4"})]})]},m)),l.jsxs("div",{className:"flex items-center justify-center py-2 text-content-muted text-sm",children:[l.jsx(_e,{className:"w-4 h-4 animate-spin mr-2"}),"Loading tasks from workspace..."]})]}),o&&l.jsx("div",{className:"text-red-400 text-center py-8",children:"Failed to load tasks"}),s&&((p=s.tasks)==null?void 0:p.length)===0&&!i&&l.jsxs("div",{className:"text-content-muted text-center py-8",children:[l.jsx(Ko,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),l.jsx("p",{children:"No tasks created yet"}),l.jsx("p",{className:"text-xs mt-2",children:"Tasks will appear here once created using beads."})]}),s&&((f=s.tasks)==null?void 0:f.length)>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-subtle mb-3 pb-3 border-b border-divider",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full"}),a.length," open"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(mr,{className:"w-3 h-3 text-green-400"}),c.length," closed"]})]}),a.map(m=>l.jsx(f1,{task:m},m.id)),c.length>0&&a.length>0&&l.jsx("div",{className:"text-xs text-content-muted mt-4 mb-2",children:"Completed"}),c.map(m=>l.jsx(f1,{task:m},m.id))]})]}),l.jsxs("div",{className:"px-4 py-3 border-t border-divider text-xs text-content-muted flex items-center justify-between",children:[l.jsxs("span",{children:[(s==null?void 0:s.count)||0," task",(s==null?void 0:s.count)!==1?"s":""]}),l.jsx("span",{className:"text-gray-600",children:"Beads"})]})]})]})}function f1({task:e}){const t={open:"bg-surface-overlay/50 border-divider-strong",in_progress:"bg-blue-900/20 border-blue-600/50",closed:"bg-green-900/20 border-green-600/30 opacity-60"},n={open:l.jsx("div",{className:"w-4 h-4 border-2 border-gray-400 rounded-full"}),in_progress:l.jsx(_e,{className:"w-4 h-4 text-blue-400 animate-spin"}),closed:l.jsx(mr,{className:"w-4 h-4 text-green-400"})};return l.jsxs("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${t[e.status]}`,children:[l.jsx("div",{className:"mt-0.5",children:n[e.status]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm text-content",children:e.title}),l.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[l.jsx("span",{className:"text-xs text-content-muted",children:e.id}),e.blockedBy.length>0&&l.jsxs("span",{className:"flex items-center gap-1 text-xs text-orange-400",children:[l.jsx(ll,{className:"w-3 h-3"}),"Blocked"]}),e.labels.filter(s=>s.startsWith("difficulty:")).map(s=>l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${s.includes("simple")||s.includes("trivial")?"bg-green-900/50 text-green-400":s.includes("medium")?"bg-yellow-900/50 text-yellow-400":s.includes("complex")||s.includes("hard")?"bg-red-900/50 text-red-400":"bg-surface-overlay text-content-body"}`,children:s.replace("difficulty:","")},s))]})]})]})}const IF=()=>{const e=localStorage.getItem("panopticon.planning.startDocker");return e!==null?e==="true":!1},FF=()=>localStorage.getItem("panopticon.planning.workspaceLocation")==="remote"?"remote":"local";function BF({issue:e,isOpen:t,onClose:n,onComplete:s}){var U,K,Q;const[r,i]=v.useState("checking"),[o,a]=v.useState(null),[c,u]=v.useState(null),[d,h]=v.useState(!1),[p,f]=v.useState({x:-1,y:-1}),[m,g]=v.useState({width:900,height:720}),[y,x]=v.useState(IF),[b,_]=v.useState(FF),[S,C]=v.useState(!1),[w,j]=v.useState(!1),[E,O]=v.useState(!1),R=v.useRef(!1),B=Nt(),L=we({mutationFn:async()=>{const Y=await fetch(`/api/issues/${e.identifier}/start-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({startDocker:y,workspaceLocation:b,shadowMode:S})});if(!Y.ok){const Z=await Y.json();throw new Error(Z.error||"Failed to start planning")}return Y.json()},onSuccess:Y=>{a(Y),Y.planningAgent.started?w?(R.current=!0,B.invalidateQueries({queryKey:["planningStatus",e.identifier]}),i("planning")):n():Y.planningAgent.error&&(u(Y.planningAgent.error),i("error"))},onError:Y=>{u(Y.message),i("error")}}),D=he({queryKey:["planningStatus",e.identifier],queryFn:async()=>{const Y=await fetch(`/api/planning/${e.identifier}/status`);if(!Y.ok)throw new Error("Failed to get status");return Y.json()},enabled:r==="planning",refetchInterval:r==="planning"?2e3:!1}),T=we({mutationFn:async()=>{const Y=await fetch(`/api/planning/${e.identifier}`,{method:"DELETE"});if(!Y.ok)throw new Error("Failed to stop planning");const Z=await Y.json();return(await fetch(`/api/issues/${e.identifier}/complete-planning`,{method:"POST"})).ok||console.warn("Failed to mark planning complete, continuing anyway"),Z},onSuccess:()=>{B.invalidateQueries({queryKey:["issues"]}),i("complete")},onError:Y=>{console.error("Stop planning failed:",Y),u(Y.message),i("error")}}),P=we({mutationFn:async()=>{const Y=await fetch(`/api/issues/${e.identifier}/abort-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:!1})});if(!Y.ok){const Z=await Y.json();throw new Error(Z.error||"Failed to abort planning")}return Y.json()},onSuccess:()=>{s(),n()},onError:Y=>{u(Y.message)}}),$=we({mutationFn:async()=>{const Y=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier,phase:"implementation"})});if(!Y.ok){const Z=await Y.json();throw new Error(Z.error||"Failed to start agent")}return Y.json()},onSuccess:()=>{B.invalidateQueries({queryKey:["agents"]}),B.invalidateQueries({queryKey:["issues"]}),s(),n()},onError:Y=>{u(`Failed to start agent: ${Y.message}`)}}),W=v.useRef(null);v.useEffect(()=>{const Y=W.current!==null&&W.current!==e.identifier;W.current=e.identifier,t?Y?(i("checking"),a(null),u(null),h(!1),R.current=!1,B.invalidateQueries({queryKey:["planningStatus",e.identifier]})):(B.invalidateQueries({queryKey:["planningStatus",e.identifier]}),R.current=!1):(i("checking"),a(null),u(null),h(!1),R.current=!1)},[t,e.identifier,B]),v.useEffect(()=>{t&&r==="checking"&&fetch(`/api/planning/${e.identifier}/status`).then(Y=>Y.json()).then(Y=>{Y.active?(R.current=!0,i("planning")):Y.planningCompleted?i("complete"):i("ready")}).catch(()=>{i("ready")})},[t,e.identifier,r]);const I=()=>{i("starting"),L.mutate()},H=()=>{T.mutate()},k=()=>{confirm(`Abort planning and return to Todo?
|
|
512
|
-
|
|
513
|
-
This will:
|
|
514
|
-
• Stop the planning agent
|
|
515
|
-
• Move the issue back to "Todo"
|
|
516
|
-
• Keep the workspace (can be deleted separately)
|
|
517
|
-
|
|
518
|
-
Any planning artifacts in the workspace will be preserved.`)&&P.mutate()},F=()=>{$.mutate()};if(!t)return null;const M=p.x===-1?(window.innerWidth-m.width)/2:p.x,N=p.y===-1?(window.innerHeight-m.height)/2:p.y,z=()=>{var Z,ue;const Y=((Z=o==null?void 0:o.workspace)==null?void 0:Z.path)||((ue=D.data)==null?void 0:ue.workspacePath);return Y?`${Y}/docs/${e.identifier}-plan.md`:null};return d?l.jsxs("div",{className:"fixed bottom-4 right-4 z-50 bg-surface-raised rounded-lg shadow-2xl border border-divider px-4 py-2 flex items-center gap-3 cursor-pointer hover:bg-surface-overlay transition-colors",onClick:async()=>{if(r==="complete")try{(await(await fetch(`/api/planning/${e.identifier}/status`)).json()).active&&(R.current=!0,i("planning"))}catch{}h(!1)},children:[l.jsx("div",{className:"w-6 h-6 rounded bg-gradient-to-br from-purple-500 to-blue-500 flex items-center justify-center",children:l.jsx(Rx,{className:"w-3 h-3 text-content"})}),l.jsxs("span",{className:"text-sm text-content font-medium",children:["Plan: ",e.identifier]}),r==="planning"&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-pulse"}),(U=D.data)!=null&&U.isRemote?l.jsx("span",{className:"px-1.5 py-0.5 bg-blue-500/30 text-blue-300 text-xs rounded",children:"Remote"}):l.jsx("span",{className:"px-1.5 py-0.5 bg-gray-500/30 text-content-subtle text-xs rounded",children:"Local"})]}),r==="complete"&&l.jsx("span",{className:"px-1.5 py-0.5 bg-green-500/30 text-green-300 text-xs rounded",children:"Done"})]}):l.jsxs("div",{className:"fixed inset-0 z-50",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:()=>h(!0)}),l.jsx(kA,{position:{x:M,y:N},size:m,onDragStop:(Y,Z)=>f({x:Z.x,y:Z.y}),onResizeStop:(Y,Z,ue,Oe,Re)=>{g({width:ue.offsetWidth,height:ue.offsetHeight}),f({x:Re.x,y:Re.y})},minWidth:600,minHeight:400,bounds:"window",dragHandleClassName:"drag-handle",enableResizing:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},children:l.jsxs("div",{className:"w-full h-full bg-surface-raised rounded-xl shadow-2xl border border-divider overflow-hidden flex flex-col",children:[l.jsxs("div",{className:"drag-handle flex items-center justify-between px-6 py-4 border-b border-divider cursor-move",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-10 h-10 rounded-lg bg-gradient-to-br from-purple-500 to-blue-500 flex items-center justify-center",children:l.jsx(Rx,{className:"w-5 h-5 text-content"})}),l.jsxs("div",{children:[l.jsxs("h2",{className:"text-lg font-semibold text-content",children:["Plan: ",e.identifier]}),l.jsx("p",{className:"text-sm text-content-subtle line-clamp-1",children:e.title})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[r==="planning"&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-1 bg-purple-500/20 text-purple-400 text-xs rounded-full",children:[l.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-pulse"}),"Planning Active"]}),(K=D.data)!=null&&K.isRemote?l.jsx("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs rounded-full",title:D.data.vmName?`VM: ${D.data.vmName}`:void 0,children:"Remote"}):l.jsx("span",{className:"px-2 py-1 bg-gray-500/20 text-content-subtle text-xs rounded-full",children:"Local"}),l.jsxs("button",{onClick:H,disabled:T.isPending,className:"flex items-center gap-1 px-3 py-1.5 bg-red-600 hover:bg-red-500 text-content text-sm font-medium rounded-lg transition-colors disabled:opacity-50",title:"Stop the planning agent",children:[l.jsx(ou,{className:"w-4 h-4"}),"Stop"]})]}),l.jsx("button",{onClick:()=>h(!0),className:"p-2 text-content-subtle hover:text-content hover:bg-surface-overlay rounded-lg transition-colors",title:"Hide (planning continues in background)",children:l.jsx(yt,{className:"w-5 h-5"})})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[r==="checking"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx(_e,{className:"w-12 h-12 text-purple-400 animate-spin mb-4"}),l.jsx("p",{className:"text-content-body",children:"Checking session status..."})]}),r==="ready"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center p-8 pt-6 overflow-y-auto",children:[l.jsx("div",{className:"w-20 h-20 rounded-2xl bg-gradient-to-br from-purple-500/20 to-blue-500/20 border border-purple-500/30 flex items-center justify-center mb-6",children:l.jsx(Vo,{className:"w-10 h-10 text-purple-400"})}),["In Planning","Planning","Planned","Discovery"].includes(e.status)?l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Resume Planning Session"}),l.jsxs("p",{className:"text-content-subtle text-center max-w-md mb-6",children:["This issue is in ",l.jsx("span",{className:"text-purple-400 font-medium",children:'"In Planning"'})," state. You can resume planning or abort to return to Todo."]}),l.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[l.jsx("h4",{className:"text-sm font-medium text-content-body mb-2",children:"Options:"}),l.jsxs("ul",{className:"space-y-2 text-sm text-content-subtle",children:[l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(Qn,{className:"w-4 h-4 text-purple-400"}),l.jsxs("span",{children:[l.jsx("strong",{className:"text-purple-400",children:"Resume"})," - Start a new planning agent session"]})]}),l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(yt,{className:"w-4 h-4 text-orange-400"}),l.jsxs("span",{children:[l.jsx("strong",{className:"text-orange-400",children:"Abort"})," - Return issue to Todo (keeps workspace)"]})]})]})]}),l.jsxs("label",{className:"flex items-center gap-3 mb-4 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:w,onChange:Y=>j(Y.target.checked),className:"w-4 h-4 rounded border-gray-500 bg-surface-overlay text-purple-500 focus:ring-purple-500 focus:ring-offset-gray-800"}),l.jsxs("span",{className:"text-sm text-content-body",children:["Stay and watch planning",l.jsx("span",{className:"text-content-muted ml-1",children:"(keep dialog open; you'll see INPUT when agent needs you)"})]})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsxs("button",{onClick:k,disabled:P.isPending,className:"flex items-center gap-2 px-5 py-3 bg-orange-600/20 hover:bg-orange-600/30 text-orange-400 rounded-lg transition-colors font-medium disabled:opacity-50",children:[l.jsx(yt,{className:"w-5 h-5"}),P.isPending?"Aborting...":"Abort Planning"]}),l.jsxs("button",{onClick:I,className:"flex items-center gap-2 px-6 py-3 bg-purple-600 hover:bg-purple-500 text-content rounded-lg transition-colors font-medium",children:[l.jsx(Qn,{className:"w-5 h-5"}),"Resume Planning"]})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Start Planning Session"}),l.jsxs("p",{className:"text-content-subtle text-center max-w-md mb-6",children:["This will move the issue to ",l.jsx("span",{className:"text-purple-400 font-medium",children:'"In Planning"'}),", create a workspace, and start an AI discovery session to help define the implementation plan."]}),l.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[l.jsx("h4",{className:"text-sm font-medium text-content-body mb-2",children:"What happens:"}),l.jsxs("ul",{className:"space-y-2 text-sm text-content-subtle",children:[l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(po,{className:"w-4 h-4 text-green-400"}),'Issue moves to "In Planning" in ',e.source==="github"?"GitHub":"Linear"]}),l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(po,{className:"w-4 h-4 text-green-400"}),"Git worktree created for feature branch"]}),l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(po,{className:"w-4 h-4 text-green-400"}),"Planning agent starts discovery conversation"]})]})]}),l.jsxs("div",{className:"mb-4 w-full max-w-md",children:[l.jsx("label",{className:"text-sm font-medium text-content-body mb-2 block",children:"Workspace Location"}),l.jsxs("div",{className:"flex gap-4",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"radio",name:"workspaceLocation",value:"local",checked:b==="local",onChange:()=>{_("local"),localStorage.setItem("panopticon.planning.workspaceLocation","local")},className:"w-4 h-4 border-gray-500 bg-surface-overlay text-purple-500 focus:ring-purple-500 focus:ring-offset-gray-800"}),l.jsx("span",{className:"text-sm text-content-body",children:"Local"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"radio",name:"workspaceLocation",value:"remote",checked:b==="remote",onChange:()=>{_("remote"),localStorage.setItem("panopticon.planning.workspaceLocation","remote")},className:"w-4 h-4 border-gray-500 bg-surface-overlay text-purple-500 focus:ring-purple-500 focus:ring-offset-gray-800"}),l.jsx("span",{className:"text-sm text-content-body",children:"Remote (exe.dev)"})]})]})]}),l.jsxs("label",{className:"flex items-center gap-3 mb-4 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:S,onChange:Y=>C(Y.target.checked),className:"w-4 h-4 rounded border-gray-500 bg-surface-overlay text-blue-500 focus:ring-blue-500 focus:ring-offset-gray-800"}),l.jsxs("span",{className:"text-sm text-content-body",children:["Shadow Engineering",l.jsx("span",{className:"text-content-muted ml-1",children:"(AI observes your workflow, doesn't modify code)"})]})]}),l.jsxs("label",{className:"flex items-center gap-3 mb-4 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:y,onChange:Y=>{x(Y.target.checked),localStorage.setItem("panopticon.planning.startDocker",String(Y.target.checked))},className:"w-4 h-4 rounded border-gray-500 bg-surface-overlay text-purple-500 focus:ring-purple-500 focus:ring-offset-gray-800"}),l.jsxs("span",{className:"text-sm text-content-body",children:["Start Docker containers",l.jsx("span",{className:"text-content-muted ml-1",children:"(dev environment ready for testing)"})]})]}),l.jsxs("label",{className:"flex items-center gap-3 mb-6 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:w,onChange:Y=>j(Y.target.checked),className:"w-4 h-4 rounded border-gray-500 bg-surface-overlay text-purple-500 focus:ring-purple-500 focus:ring-offset-gray-800"}),l.jsxs("span",{className:"text-sm text-content-body",children:["Stay and watch planning",l.jsx("span",{className:"text-content-muted ml-1",children:"(keep dialog open; you'll see INPUT when agent needs you)"})]})]}),l.jsxs("button",{onClick:I,className:"flex items-center gap-2 px-6 py-3 bg-purple-600 hover:bg-purple-500 text-content rounded-lg transition-colors font-medium",children:[l.jsx(Qn,{className:"w-5 h-5"}),"Start Planning"]})]})]}),r==="starting"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx(_e,{className:"w-12 h-12 text-purple-400 animate-spin mb-4"}),l.jsx("p",{className:"text-content-body",children:"Starting planning session..."}),l.jsx("p",{className:"text-sm text-content-muted mt-2",children:"Moving to In Planning, creating workspace, spawning agent"})]}),r==="planning"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex-1 bg-black relative overflow-hidden",style:{minHeight:"400px"},children:o!=null&&o.planningAgent.sessionName?l.jsx(h1,{sessionName:o.planningAgent.sessionName,onDisconnect:()=>{D.refetch()}}):(Q=D.data)!=null&&Q.sessionName?l.jsx(h1,{sessionName:D.data.sessionName,onDisconnect:()=>{D.refetch()}}):l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsxs("div",{className:"flex items-center gap-2 text-content-muted",children:[l.jsx(_e,{className:"w-4 h-4 animate-spin"}),"Connecting to terminal..."]})})}),l.jsxs("div",{className:"border-t border-divider px-4 py-2 flex items-center justify-between bg-surface-raised",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm text-content-subtle",children:[l.jsx(Vo,{className:"w-4 h-4"}),"Interactive planning session"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>O(!0),className:"flex items-center gap-1 px-3 py-1 bg-surface-overlay hover:bg-surface-emphasis text-content-body text-sm rounded transition-colors",title:"View tasks created during planning",children:[l.jsx(Ko,{className:"w-4 h-4"}),"Tasks"]}),l.jsxs("button",{onClick:k,disabled:P.isPending,className:"flex items-center gap-1 px-3 py-1 bg-orange-600/20 hover:bg-orange-600/30 text-orange-400 text-sm rounded transition-colors disabled:opacity-50",title:"Stop planning and return to Todo",children:[l.jsx(yt,{className:"w-4 h-4"}),"Abort"]}),l.jsxs("button",{onClick:()=>{T.mutate(),D.refetch()},disabled:T.isPending,className:"flex items-center gap-1 px-3 py-1 bg-green-600/20 hover:bg-green-600/30 text-green-400 text-sm rounded transition-colors disabled:opacity-50",title:"Done - mark planning complete",children:[l.jsx(po,{className:"w-4 h-4"}),"Done"]})]})]})]}),r==="complete"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx("div",{className:"w-16 h-16 rounded-full bg-green-500/20 flex items-center justify-center mb-4",children:l.jsx(po,{className:"w-10 h-10 text-green-400"})}),l.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Planning Complete"}),l.jsx("p",{className:"text-content-subtle text-center max-w-md mb-6",children:"The planning session has ended. Review the plan and start the execution agent."}),z()&&l.jsx("div",{className:"bg-purple-500/10 border border-purple-500/30 rounded-lg p-4 mb-6 max-w-md w-full",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(qo,{className:"w-8 h-8 text-purple-400"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm text-content-body font-medium",children:"Feature Plan"}),l.jsx("p",{className:"text-xs text-content-muted font-mono truncate",children:z()})]}),l.jsxs("a",{href:`vscode://file${z()}`,className:"flex items-center gap-1 px-3 py-1.5 bg-purple-600 hover:bg-purple-500 text-content text-sm rounded-lg transition-colors",title:"Open in VS Code",children:[l.jsx(gr,{className:"w-4 h-4"}),"Open"]})]})}),l.jsxs("button",{onClick:()=>O(!0),className:"flex items-center gap-2 px-4 py-2 bg-green-600/20 hover:bg-green-600/30 text-green-400 rounded-lg transition-colors mb-6",children:[l.jsx(Ko,{className:"w-5 h-5"}),"View Tasks",l.jsx("span",{className:"text-xs text-green-600",children:"(beads created during planning)"})]}),o&&l.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[l.jsx("p",{className:"text-sm text-content-subtle mb-2",children:"Summary:"}),l.jsxs("ul",{className:"space-y-1 text-sm",children:[l.jsxs("li",{className:"text-content-body",children:[l.jsx("span",{className:"text-content-muted",children:"Issue:"})," ",o.issue.identifier]}),l.jsxs("li",{className:"text-content-body",children:[l.jsx("span",{className:"text-content-muted",children:"State:"})," ",l.jsx("span",{className:"text-purple-400",children:o.issue.newState})]}),o.workspace.created&&l.jsxs("li",{className:"text-content-body",children:[l.jsx("span",{className:"text-content-muted",children:"Workspace:"})," ",l.jsx("span",{className:"text-blue-400 font-mono text-xs",children:o.workspace.path})]})]})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsx("button",{onClick:n,disabled:$.isPending,className:"px-4 py-2 bg-surface-overlay hover:bg-surface-emphasis text-content rounded-lg transition-colors disabled:opacity-50",children:"Close"}),l.jsxs("button",{onClick:F,disabled:$.isPending,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-500 text-content rounded-lg transition-colors disabled:opacity-50",children:[$.isPending?l.jsx(_e,{className:"w-5 h-5 animate-spin"}):l.jsx(Qn,{className:"w-5 h-5"}),$.isPending?"Starting Agent...":"Start Agent"]})]})]}),r==="error"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx("div",{className:"w-16 h-16 rounded-full bg-red-500/20 flex items-center justify-center mb-4",children:l.jsx(Uo,{className:"w-10 h-10 text-red-400"})}),l.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Planning Failed"}),l.jsx("p",{className:"text-red-400 text-center max-w-md mb-6",children:c}),l.jsxs("div",{className:"flex gap-3",children:[l.jsx("button",{onClick:n,className:"px-4 py-2 bg-surface-overlay hover:bg-surface-emphasis text-content rounded-lg transition-colors",children:"Close"}),l.jsx("button",{onClick:()=>{i("ready"),u(null)},className:"px-4 py-2 bg-purple-600 hover:bg-purple-500 text-content rounded-lg transition-colors",children:"Try Again"})]})]})]})]})}),l.jsx(T0,{issueId:e.identifier,isOpen:E,onClose:()=>O(!1)})]})}function RE(e){const t=e.find(r=>r.startsWith("difficulty:"));if(!t)return null;const n=t.split(":")[1];return["trivial","simple","medium","complex","expert"].includes(n)?n:null}function zF(e){return e.includes("opus-4-6")||e.includes("opus-4.6")?"Opus 4.6":e.includes("opus-4-5")||e.includes("opus-4.5")?"Opus 4.5":e.includes("opus-4-1")?"Opus 4.1":e.includes("opus-4")||e.includes("opus")?"Opus":e.includes("sonnet-4-5")||e.includes("sonnet-4.5")?"Sonnet 4.5":e.includes("sonnet-4")||e.includes("sonnet")?"Sonnet":e.includes("haiku-4-5")||e.includes("haiku-4.5")?"Haiku 4.5":e.includes("haiku")?"Haiku":e}const $F={trivial:"bg-green-900/50 text-green-400",simple:"bg-green-900/50 text-green-400",medium:"bg-yellow-900/50 text-yellow-400",complex:"bg-orange-900/50 text-orange-400",expert:"bg-red-900/50 text-red-400"};function DE({level:e}){const t=$F[e];return l.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${t}`,children:e})}const HF={work:"🤖",review:"👁️",test:"🧪",merge:"🔀"};function WF({type:e,name:t,isConflict:n}){const s=HF[e],r=n?"animate-[pulse_2s_ease-in-out_infinite]":"";return l.jsxs("span",{className:`inline-flex items-center gap-1 text-xs text-blue-400 ${r}`,children:[l.jsx("span",{children:s}),l.jsx("span",{children:t})]})}async function UF(){try{const e=await fetch("/api/costs/by-issue");if(!e.ok)return{};const t=await e.json(),n={};for(const s of t.issues||[])n[s.issueId.toLowerCase()]=s;return n}catch{return{}}}function ME(e){return e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:e>0?`$${e.toFixed(2)}`:""}function LE(e){return e>=50?"bg-red-900/50 text-red-400":e>=20?"bg-orange-900/50 text-orange-400":e>=5?"bg-yellow-900/50 text-yellow-400":"bg-green-900/50 text-green-400"}async function qF(e="current",t=!1){const n=new URLSearchParams;n.set("cycle",e),t&&n.set("includeCompleted","true");const s=await fetch(`/api/issues?${n}`);if(!s.ok)throw new Error("Failed to fetch issues");return s.json()}async function KF(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function VF(){const e=await fetch("/api/specialists");if(!e.ok)throw new Error("Failed to fetch specialists");const t=await e.json();return t.specialists??t}function YF(e,t=!1){var s;const n={backlog:[],todo:[],in_progress:[],in_review:[],done:[],canceled:[]};for(const r of e){if(!t&&((s=r.labels)!=null&&s.some(o=>o.toLowerCase()==="closed-out")))continue;let i;r.targetCanonicalState?i=r.targetCanonicalState:r.shadowStatus?i=r.shadowStatus==="closed"?"done":r.shadowStatus==="in_progress"?Bt[r.status]||"in_progress":Bt[r.status]||"backlog":r.derivedStatus?i=r.derivedStatus==="closed"?"done":r.derivedStatus==="in_progress"?"in_progress":Bt[r.status]||"backlog":i=Bt[r.status]||"backlog",i!=="canceled"&&(n[i]?n[i].push(r):n.backlog.push(r))}return n}function XF(e){const t={},n=[];for(const r of e){const i=r.labels||[];if(i.length===0)n.push(r);else for(const o of i)t[o]||(t[o]=[]),t[o].push(r)}n.length>0&&(t.Uncategorized=n);const s={};return Object.keys(t).sort((r,i)=>r.localeCompare(i)).forEach(r=>{s[r]=t[r]}),s}function QF(e){const t=new Map,n=[];for(const r of e)if(r.project){const i=t.get(r.project.id);i?i.issues.push(r):t.set(r.project.id,{name:r.project.name,color:r.project.color,issues:[r]})}else n.push(r);const s=Array.from(t.values()).sort((r,i)=>r.name.localeCompare(i.name));return n.length>0&&s.push({name:"No Project",issues:n}),s}function GF(e){var s;const t={Canceled:[],Duplicate:[],"Won't Do":[],Other:[]};for(const r of e){const i=((s=r.status)==null?void 0:s.toLowerCase())||"";i==="canceled"||i==="cancelled"?t.Canceled.push(r):i==="duplicate"?t.Duplicate.push(r):i==="won't do"||i==="wontfix"?t["Won't Do"].push(r):t.Other.push(r)}const n=[];return t.Canceled.length>0&&n.push({name:"Canceled",issues:t.Canceled}),t.Duplicate.length>0&&n.push({name:"Duplicate",issues:t.Duplicate}),t["Won't Do"].length>0&&n.push({name:"Won't Do",issues:t["Won't Do"]}),t.Other.length>0&&n.push({name:"Other",issues:t.Other}),n}function JF(e){var a;const t=[],n=[];for(const c of e)(a=c.artifactType)!=null&&a.includes("PortfolioItem")?t.push(c):n.push(c);if(t.length===0)return e.map(c=>({type:"orphan",children:[c]}));const s=new Map;for(const c of t)s.set(c.identifier,c);const r=new Map,i=[];for(const c of n)if(c.parentRef&&s.has(c.parentRef)){const u=r.get(c.parentRef)||[];u.push(c),r.set(c.parentRef,u)}else i.push(c);const o=[];for(const c of t){const u=r.get(c.identifier)||[];o.push({type:"feature",feature:c,children:u})}for(const c of i)o.push({type:"orphan",children:[c]});return o}function R0({issue:e,compact:t=!1}){const n=e.rawTrackerState||e.shadowTrackerStatus,s=e.shadowStatus||e.targetCanonicalState;if(!n||!s)return null;const r=s==="in_progress"?"In Progress":s==="closed"||s==="done"?"Done":s==="in_review"?"In Review":s,i=n.toLowerCase().replace(/[-_\s]/g,""),o=r.toLowerCase().replace(/[-_\s]/g,"");return i===o?null:t?l.jsx("span",{className:"w-2 h-2 rounded-full bg-purple-500 shrink-0",title:`Rally: ${n} → Pan: ${r}`}):l.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[l.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-gray-700/50 text-gray-300",children:[l.jsx(gr,{className:"w-2.5 h-2.5"}),n]}),l.jsx("span",{className:"text-content-muted",children:"→"}),l.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-purple-900/50 text-purple-300",children:[l.jsx(Lo,{className:"w-2.5 h-2.5"}),r]})]})}function ZF({feature:e,childCount:t,isExpanded:n,onToggle:s}){const r=e.completedChildCount??0,i=e.inProgressChildCount??0,o=e.totalChildCount??t,a=o>0?Math.round(r/o*100):0,c=e.derivedStatus&&e.rawTrackerState&&(e.derivedStatus==="in_progress"&&e.rawTrackerState!=="Developing"||e.derivedStatus==="closed"&&e.rawTrackerState!=="Done");return l.jsx("div",{className:"bg-surface-overlay rounded-lg border-l-4 border-l-indigo-500 overflow-hidden",children:l.jsxs("div",{onClick:s,className:"flex items-start gap-2 px-3 py-2.5 cursor-pointer hover:bg-indigo-900/20 transition-colors",children:[n?l.jsx(Mu,{className:"w-4 h-4 text-indigo-400 shrink-0 mt-0.5"}):l.jsx(bl,{className:"w-4 h-4 text-indigo-400 shrink-0 mt-0.5"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.project&&l.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.project.color||"#6b7280"}}),l.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:u=>u.stopPropagation(),className:"text-xs font-medium text-indigo-300 hover:text-indigo-200 flex items-center gap-1",children:[l.jsx("span",{children:e.identifier}),l.jsx(gr,{className:"w-2.5 h-2.5 opacity-50"})]}),c&&l.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium bg-amber-900/50 text-amber-400",children:"derived"}),l.jsx(R0,{issue:e})]}),l.jsx("p",{className:"text-sm text-content-body mt-1 line-clamp-1",children:e.title}),o>0&&l.jsxs("div",{className:"mt-2",children:[l.jsx("div",{className:"w-full h-1.5 bg-gray-700 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full bg-green-500 rounded-full transition-all",style:{width:`${a}%`}})}),l.jsxs("div",{className:"flex items-center justify-between mt-1",children:[l.jsxs("span",{className:"text-xs text-content-muted",children:[r,"/",o," done",i>0?`, ${i} active`:""]}),l.jsxs("span",{className:"text-xs text-indigo-400",children:[t," in column"]})]})]})]})]})})}function eB({issue:e,agents:t}){const n=Bt[e.status]||"backlog",s=n==="done"?"bg-green-400":n==="in_progress"?"bg-yellow-400":n==="in_review"?"bg-pink-400":"bg-gray-500",r=e.identifier.toLowerCase(),i=t.some(o=>{var a;return((a=o.issueId)==null?void 0:a.toLowerCase())===r&&o.status!=="dead"});return l.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-surface-overlay/50 transition-colors group",children:[l.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${s}`}),l.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-content-subtle hover:text-blue-400 shrink-0",children:e.identifier}),l.jsx("span",{className:"text-xs text-content-body truncate flex-1",children:e.title}),l.jsx(R0,{issue:e,compact:!0}),i&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-400 animate-pulse shrink-0",title:"Agent running"})]})}function Em({issue:e,agents:t,specialists:n,issueCosts:s,selectedIssue:r,onSelectIssue:i,onPlan:o}){const a=r===e.id,c=Bt[e.status]||"backlog",u=c==="done"?"bg-green-400":c==="in_review"?"bg-pink-400":c==="in_progress"?"bg-yellow-400":c==="todo"?"bg-blue-400":"bg-gray-500",d=s[e.identifier.toLowerCase()],h=e.identifier.toLowerCase(),f=!!t.find(y=>{var x;return((x=y.issueId)==null?void 0:x.toLowerCase())===h&&y.status!=="dead"}),m=n.filter(y=>{var x;return((x=y.currentIssue)==null?void 0:x.toLowerCase())===h}),g=RE(e.labels||[]);return l.jsxs("div",{onClick:()=>i(a?null:e.id),className:`flex items-center gap-3 px-4 py-3 hover:bg-surface-overlay/50 transition-colors cursor-pointer ${a?"bg-surface-overlay":""}`,children:[l.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`,title:c}),l.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:y=>y.stopPropagation(),className:"text-xs text-content-subtle hover:text-blue-400 shrink-0 font-mono",children:e.identifier}),l.jsx("span",{className:`text-sm truncate flex-1 min-w-0 ${c==="canceled"?"text-content-muted line-through":"text-content-body"}`,children:e.title}),e.priority===1&&l.jsx("span",{className:"text-xs text-red-400 font-medium shrink-0",children:"Urgent"}),e.priority===2&&l.jsx("span",{className:"text-xs text-orange-400 font-medium shrink-0",children:"High"}),g&&l.jsx(DE,{level:g}),d&&d.totalCost>0&&l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${LE(d.totalCost)}`,children:ME(d.totalCost)}),e.assignee&&l.jsxs("span",{className:"text-xs text-content-subtle flex items-center gap-1 shrink-0",children:[l.jsx(o0,{className:"w-3 h-3"}),e.assignee.name.split(" ")[0]]}),f&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-400 animate-pulse shrink-0",title:"Agent running"}),m.map(y=>l.jsx("span",{className:"text-xs text-blue-400 shrink-0",title:`${y.displayName} specialist`,children:y.name==="review-agent"?"👁️":y.name==="test-agent"?"🧪":y.name==="merge-agent"?"🔀":"🤖"},y.name)),l.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[!f&&(c==="backlog"||c==="todo")&&l.jsx("button",{onClick:y=>{y.stopPropagation(),o(e)},className:"p-1 text-content-subtle hover:text-blue-400 transition-colors",title:"Plan issue",children:l.jsx(Qn,{className:"w-3.5 h-3.5"})}),l.jsx("button",{onClick:y=>{y.stopPropagation(),i(e.id)},className:"p-1 text-content-subtle hover:text-content transition-colors",title:"View details",children:l.jsx(Lo,{className:"w-3.5 h-3.5"})}),l.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:y=>y.stopPropagation(),className:"p-1 text-content-subtle hover:text-content transition-colors",title:"Open in tracker",children:l.jsx(gr,{className:"w-3.5 h-3.5"})})]})]})}const p1={backlog:"border-divider-strong",todo:"border-blue-600",in_progress:"border-yellow-500",in_review:"border-pink-500",done:"border-green-500"},tB={backlog:"Backlog",todo:"To Do",in_progress:"In Progress",in_review:"In Review",done:"Done"};function nB({selectedIssue:e,onSelectIssue:t}){const n=Nt(),[s,r]=v.useState(null),[i,o]=v.useState(new Set),[a,c]=v.useState(null),[u,d]=v.useState(null),[h,p]=v.useState("current"),[f,m]=v.useState(!1),[g,y]=v.useState(null),[x,b]=v.useState(null),[_,S]=v.useState([]),[C,w]=v.useState(!1),[j,E]=v.useState(null),[O,R]=v.useState({open:!1,issue:null,targetStatus:null}),[B,L]=v.useState({open:!1,issue:null}),D=e!==void 0?e:s,T=t||r,{data:P,isLoading:$,error:W}=he({queryKey:["issues",h,f],queryFn:()=>qF(h,f)}),{data:I=[]}=he({queryKey:["agents"],queryFn:KF,refetchInterval:5e3}),{data:H=[]}=he({queryKey:["specialists"],queryFn:VF,refetchInterval:5e3}),k=t3(X_(m0,{activationConstraint:{distance:8}}),X_(f0)),F=we({mutationFn:async({issueId:se,targetStatus:de,syncToTracker:Ee})=>{const We=await fetch(`/api/issues/${se}/move-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetStatus:de,syncToTracker:Ee})});if(!We.ok){const Ue=await We.json();throw new Error(Ue.error||"Failed to move issue")}return We.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["issues"]})}}),M=v.useCallback(()=>{if(_.length===0)return;const se=_[_.length-1];F.mutate({issueId:se.issueId,targetStatus:se.fromStatus}),S(de=>de.slice(0,-1)),w(!1),j&&(clearTimeout(j),E(null))},[_,F,j]);v.useEffect(()=>{const se=de=>{(de.metaKey||de.ctrlKey)&&de.key==="z"&&(de.preventDefault(),M())};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[M]);const N=v.useCallback((se,de,Ee)=>{S(Ue=>[...Ue,{issueId:se,fromStatus:de,toStatus:Ee,timestamp:Date.now()}]),w(!0),j&&clearTimeout(j);const We=setTimeout(()=>{w(!1)},8e3);E(We)},[j]),z=v.useCallback(se=>{const{active:de}=se,Ee=de.id,We=P==null?void 0:P.find(Ue=>Ue.id===Ee);We&&(y(We),b(Bt[We.status]))},[P]),U=v.useCallback(se=>{const{active:de,over:Ee}=se;if(y(null),b(null),!Ee)return;const We=de.id,Ue=Ee.id,wt=P==null?void 0:P.find(q=>q.id===We);if(!wt)return;const ft=Bt[wt.status];if(ft===Ue)return;const pn=wt.identifier.toLowerCase();if(I.some(q=>{var ee;return((ee=q.issueId)==null?void 0:ee.toLowerCase())===pn&&q.status!=="dead"})){R({open:!0,issue:wt,targetStatus:Ue});return}if(Ue==="done"){L({open:!0,issue:wt});return}N(wt.identifier,ft,Ue),F.mutate({issueId:wt.identifier,targetStatus:Ue})},[P,I,F,N]),K=v.useCallback(()=>{const{issue:se,targetStatus:de}=O;if(!se||!de)return;R({open:!1,issue:null,targetStatus:null});const Ee=Bt[se.status];if(de==="done"){L({open:!0,issue:se});return}N(se.identifier,Ee,de),F.mutate({issueId:se.identifier,targetStatus:de})},[O,F,N]),Q=v.useCallback(async(se,de)=>{const{issue:Ee}=B;if(!Ee)return;L({open:!1,issue:null});const We=Bt[Ee.status];if(de!=null&&de.stopAgents){const Ue=Ee.identifier.toLowerCase(),wt=I.filter(ft=>{var pn;return((pn=ft.issueId)==null?void 0:pn.toLowerCase())===Ue});for(const ft of wt)try{await fetch(`/api/agents/${ft.id}`,{method:"DELETE"})}catch(pn){console.error(`Failed to stop agent ${ft.id}:`,pn)}}if(de!=null&&de.cleanupWorkspace)try{await fetch(`/api/issues/${Ee.identifier}/cleanup-workspace`,{method:"POST"})}catch(Ue){console.error(`Failed to cleanup workspace for ${Ee.identifier}:`,Ue)}N(Ee.identifier,We,"done"),F.mutate({issueId:Ee.identifier,targetStatus:"done",syncToTracker:se}),de!=null&&de.stopAgents&&n.invalidateQueries({queryKey:["agents"]})},[B,F,N,I,n]),Y={sideEffects:Nj({styles:{active:{opacity:"0.5"}}})},{data:Z={}}=he({queryKey:["issueCosts"],queryFn:UF,refetchInterval:3e4,staleTime:1e4}),ue=v.useMemo(()=>{if(!P)return[];const se=new Map;for(const de of P)de.project&&!se.has(de.project.id)&&se.set(de.project.id,de.project);return Array.from(se.values()).sort((de,Ee)=>de.name.localeCompare(Ee.name))},[P]),Oe=v.useMemo(()=>P?i.size===0?P:P.filter(se=>se.project&&i.has(se.project.id)):[],[P,i]),Re=v.useMemo(()=>XF(Oe),[Oe]),fe=v.useMemo(()=>QF(Oe),[Oe]),Ie=v.useMemo(()=>GF(Oe),[Oe]),Ut=se=>{o(de=>{const Ee=new Set(de);return Ee.has(se)?Ee.delete(se):Ee.add(se),Ee})};if($)return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-2 animate-pulse",children:[l.jsx("div",{className:"w-4 h-4 bg-surface-overlay rounded"}),l.jsx("div",{className:"w-16 h-4 bg-surface-overlay rounded"}),l.jsx("div",{className:"w-24 h-6 bg-surface-overlay rounded"}),l.jsx("div",{className:"w-20 h-6 bg-surface-overlay rounded"}),l.jsx("div",{className:"w-28 h-6 bg-surface-overlay rounded"})]}),l.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:lw.filter(se=>se!=="backlog").map(se=>l.jsx("div",{className:"flex-shrink-0 w-80",children:l.jsxs("div",{className:`border-t-4 ${p1[se]} bg-surface-raised rounded-lg`,children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("div",{className:"h-5 bg-surface-overlay rounded w-24 animate-pulse"}),l.jsx("div",{className:"h-4 bg-surface-overlay rounded w-6 animate-pulse"})]})}),l.jsx("div",{className:"p-2 space-y-2",children:[1,2,3].map(de=>l.jsxs("div",{className:"bg-surface-overlay rounded-lg p-3 border-l-4 border-l-divider-strong animate-pulse",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("div",{className:"w-2 h-2 bg-surface-emphasis rounded-full"}),l.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-16"})]}),l.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-full mb-1"}),l.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-3/4"}),l.jsxs("div",{className:"flex gap-2 mt-3",children:[l.jsx("div",{className:"h-5 bg-surface-emphasis rounded w-16"}),l.jsx("div",{className:"h-5 bg-surface-emphasis rounded w-12"})]})]},de))})]})},se))})]});if(W)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsxs("div",{className:"text-red-400",children:["Error loading issues: ",W.message]})});const sn=YF(Oe,f);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(QD,{className:"w-4 h-4 text-content-subtle"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Cycle:"}),l.jsx("div",{className:"flex rounded-lg overflow-hidden border border-divider-strong",children:["current","all","backlog","canceled"].map(se=>l.jsx("button",{onClick:()=>p(se),className:`px-3 py-1 text-xs transition-colors ${h===se?"bg-blue-600 text-content":"bg-surface-raised text-content-subtle hover:text-content hover:bg-surface-overlay"}`,children:se==="current"?"Current":se==="all"?"All":se==="backlog"?"Backlog":"Canceled"},se))})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:f,onChange:se=>m(se.target.checked),className:"w-4 h-4 rounded border-divider-strong bg-surface-raised text-blue-600 focus:ring-blue-500 focus:ring-offset-surface"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Include closed-out"})]}),l.jsx("button",{onClick:async()=>{try{await fetch("/api/trackers/refresh",{method:"POST"}),n.invalidateQueries({queryKey:["issues"]})}catch(se){console.error("Refresh failed:",se)}},className:"flex items-center gap-1 px-2 py-1 text-xs text-content-subtle hover:text-content bg-surface-raised hover:bg-surface-overlay rounded transition-colors",title:"Force refresh all trackers",children:l.jsx(Lu,{className:"w-3.5 h-3.5"})}),l.jsxs("span",{className:"text-sm text-content-muted",children:[(P==null?void 0:P.length)||0," issues"]}),ue.length>1&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"w-px h-6 bg-surface-overlay"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Projects:"}),ue.map(se=>l.jsxs("button",{onClick:()=>Ut(se.id),className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${i.size===0||i.has(se.id)?"bg-surface-overlay text-content":"bg-surface-raised text-content-muted hover:text-content-body"}`,children:[l.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:se.color||"#6b7280"}}),se.name]},se.id)),i.size>0&&l.jsx("button",{onClick:()=>o(new Set),className:"text-xs text-content-subtle hover:text-content",children:"Clear"})]})]}),h==="all"?l.jsx("div",{className:"space-y-6 overflow-y-auto pb-4",children:Object.entries(Re).map(([se,de])=>l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(r0,{className:"w-4 h-4 text-blue-400"}),l.jsx("h3",{className:"font-semibold text-content",children:se}),l.jsxs("span",{className:"text-sm text-content-subtle",children:["(",de.length,")"]})]})}),l.jsx("div",{className:"divide-y divide-divider",children:de.map(Ee=>l.jsx(Em,{issue:Ee,agents:I,specialists:H,issueCosts:Z,selectedIssue:D,onSelectIssue:T,onPlan:c},Ee.id))})]},se))}):h==="backlog"?l.jsxs("div",{className:"space-y-6 overflow-y-auto pb-4",children:[fe.map(se=>l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:se.color||"#6b7280"}}),l.jsx("h3",{className:"font-semibold text-content",children:se.name}),l.jsxs("span",{className:"text-sm text-content-subtle",children:["(",se.issues.length,")"]})]})}),l.jsx("div",{className:"divide-y divide-divider",children:se.issues.map(de=>l.jsx(Em,{issue:de,agents:I,specialists:H,issueCosts:Z,selectedIssue:D,onSelectIssue:T,onPlan:c},de.id))})]},se.name)),fe.length===0&&l.jsx("div",{className:"text-center py-12 text-content-subtle",children:"No backlog items"})]}):h==="canceled"?l.jsxs("div",{className:"space-y-6 overflow-y-auto pb-4",children:[Ie.map(se=>l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(yt,{className:"w-4 h-4 text-red-400"}),l.jsx("h3",{className:"font-semibold text-content",children:se.name}),l.jsxs("span",{className:"text-sm text-content-subtle",children:["(",se.issues.length,")"]})]})}),l.jsx("div",{className:"divide-y divide-divider",children:se.issues.map(de=>l.jsx(Em,{issue:de,agents:I,specialists:H,issueCosts:Z,selectedIssue:D,onSelectIssue:T,onPlan:c},de.id))})]},se.name)),Ie.length===0&&l.jsx("div",{className:"text-center py-12 text-content-subtle",children:"No canceled issues"})]}):l.jsxs(tL,{sensors:k,collisionDetection:a3,onDragStart:z,onDragEnd:U,children:[l.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:lw.filter(se=>se!=="backlog").map(se=>l.jsx(rB,{status:se,children:l.jsxs("div",{className:`border-t-4 ${p1[se]} bg-surface-raised rounded-lg transition-colors ${x&&x!==se?"bg-surface-raised/80":""}`,children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h3",{className:"font-semibold text-content",children:tB[se]}),l.jsx("span",{className:"text-sm text-content-subtle",children:sn[se].length})]})}),l.jsx(sB,{issues:sn[se],agents:I,specialists:H,issueCosts:Z,selectedIssue:D,onSelectIssue:T,onPlan:c,onViewBeads:d})]})},se))}),l.jsx(bL,{dropAnimation:Y,children:g?l.jsx(oB,{issue:g}):null})]}),l.jsx(cB,{isVisible:C,onUndo:M,onClose:()=>w(!1)}),l.jsx(aB,{isOpen:O.open,onClose:()=>R({open:!1,issue:null,targetStatus:null}),onConfirm:K,issue:O.issue}),l.jsx(lB,{isOpen:B.open,onClose:()=>L({open:!1,issue:null}),onSync:Q,issue:B.issue}),a&&l.jsx(BF,{issue:a,isOpen:!0,onClose:()=>c(null),onComplete:()=>{c(null),n.invalidateQueries({queryKey:["issues"]})}}),u&&l.jsx(uB,{issue:u,onClose:()=>d(null)})]})}function sB({issues:e,agents:t,specialists:n,issueCosts:s,selectedIssue:r,onSelectIssue:i,onPlan:o,onViewBeads:a}){const[c,u]=v.useState(new Set),d=v.useCallback(m=>{u(g=>{const y=new Set(g);return y.has(m)?y.delete(m):y.add(m),y})},[]),p=e.some(m=>{var g;return(g=m.artifactType)==null?void 0:g.includes("PortfolioItem")})?JF(e):null,f=m=>{const g=m.identifier.toLowerCase(),y=t.find(_=>{var S;return((S=_.issueId)==null?void 0:S.toLowerCase())===g&&_.type==="agent"&&_.agentPhase!=="planning"}),x=t.find(_=>{var S;return((S=_.issueId)==null?void 0:S.toLowerCase())===g&&_.agentPhase==="planning"&&_.status!=="stopped"}),b=n.filter(_=>{var S;return((S=_.currentIssue)==null?void 0:S.toLowerCase())===g});return l.jsx(iB,{issue:m,children:l.jsx(dB,{issue:m,workAgent:y,planningAgent:x,specialists:b,cost:s[m.identifier.toLowerCase()],isSelected:r===m.identifier,onSelect:()=>i(r===m.identifier?null:m.identifier),onPlan:()=>o(m),onViewBeads:_=>a(_)})},m.id)};return e.length===0?l.jsx("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:l.jsx("div",{className:"text-center text-content-muted py-8 text-sm",children:"No issues"})}):p?l.jsx("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:p.map(m=>{if(m.type==="orphan")return f(m.children[0]);const g=m.feature,y=!c.has(g.identifier);return l.jsxs("div",{className:"space-y-1",children:[l.jsx(ZF,{feature:g,childCount:m.children.length,isExpanded:y,onToggle:()=>d(g.identifier)}),y&&l.jsxs("div",{className:"ml-3 border-l-2 border-indigo-700/30 pl-1",children:[m.children.map(x=>l.jsx(eB,{issue:x,agents:t},x.id)),m.children.length===0&&l.jsx("div",{className:"text-xs text-content-muted py-2 pl-2",children:"No stories in this column"})]})]},`feature-${g.id}`)})}):l.jsx("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:e.map(f)})}function rB({status:e,children:t}){const{isOver:n,setNodeRef:s}=lL({id:e});return l.jsx("div",{ref:s,className:`flex-shrink-0 w-80 transition-all ${n?"scale-[1.02]":""}`,children:t})}function iB({issue:e,children:t}){const{attributes:n,listeners:s,setNodeRef:r,transform:i,isDragging:o}=rL({id:e.id,data:{issue:e}}),a=i?{transform:`translate3d(${i.x}px, ${i.y}px, 0)`}:void 0;return l.jsx("div",{ref:r,style:a,...s,...n,className:`${o?"opacity-30":"opacity-100"} cursor-grab active:cursor-grabbing`,children:t})}function oB({issue:e}){return l.jsxs("div",{className:"bg-surface-overlay rounded-lg p-3 border-l-4 border-l-blue-500 shadow-2xl rotate-2 scale-105 opacity-90",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-content-subtle text-sm",children:e.identifier})}),l.jsx("p",{className:"text-sm text-content mt-1 line-clamp-2",children:e.title})]})}function aB({isOpen:e,onClose:t,onConfirm:n,issue:s}){return!e||!s?null:l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),l.jsx("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-md mx-4 p-6",children:l.jsxs("div",{className:"flex items-start gap-4",children:[l.jsx("div",{className:"p-2 bg-amber-900/50 rounded-lg",children:l.jsx(kn,{className:"w-6 h-6 text-amber-400"})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("h3",{className:"text-lg font-semibold text-content mb-2",children:"Active Agent Warning"}),l.jsxs("p",{className:"text-content-body text-sm mb-4",children:[l.jsx("strong",{children:s.identifier})," has an active agent working on it. Moving this issue may disrupt the agent's work."]}),l.jsx("p",{className:"text-content-subtle text-xs mb-6",children:"Are you sure you want to proceed?"}),l.jsxs("div",{className:"flex gap-3 justify-end",children:[l.jsx("button",{onClick:t,className:"px-4 py-2 text-content-subtle hover:text-content transition-colors text-sm",children:"Cancel"}),l.jsx("button",{onClick:n,className:"px-4 py-2 bg-amber-600 hover:bg-amber-500 text-content rounded-lg transition-colors text-sm",children:"Move Anyway"})]})]})]})})]})}function lB({isOpen:e,onClose:t,onSync:n,issue:s}){const[r,i]=v.useState(!1),[o,a]=v.useState(!1);if(!e||!s)return null;const c=s.source==="github"?"GitHub":"Linear";return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),l.jsx("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-md mx-4 p-6",children:l.jsxs("div",{className:"flex items-start gap-4",children:[l.jsx("div",{className:"p-2 bg-green-900/50 rounded-lg",children:l.jsx(Ec,{className:"w-6 h-6 text-green-400"})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("h3",{className:"text-lg font-semibold text-content mb-2",children:"Move to Done"}),l.jsxs("p",{className:"text-content-body text-sm mb-4",children:["You're moving ",l.jsx("strong",{children:s.identifier})," to Done."]}),l.jsxs("div",{className:"space-y-2 mb-4 p-3 bg-surface-overlay/50 rounded-lg",children:[l.jsxs("label",{className:"flex items-center gap-2 text-sm text-content-body cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:r,onChange:u=>i(u.target.checked),className:"rounded border-divider-strong bg-surface-overlay text-green-500 focus:ring-green-500"}),"Clean up workspace"]}),l.jsxs("label",{className:"flex items-center gap-2 text-sm text-content-body cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:o,onChange:u=>a(u.target.checked),className:"rounded border-divider-strong bg-surface-overlay text-green-500 focus:ring-green-500"}),"Stop running agents"]})]}),l.jsxs("p",{className:"text-content-subtle text-xs mb-4",children:["Sync status change to ",c,"?"]}),l.jsxs("div",{className:"flex gap-3 justify-end",children:[l.jsx("button",{onClick:()=>n(!1,{cleanupWorkspace:r,stopAgents:o}),className:"px-4 py-2 text-content-subtle hover:text-content transition-colors text-sm",children:"Shadow Only"}),l.jsxs("button",{onClick:()=>n(!0,{cleanupWorkspace:r,stopAgents:o}),className:"px-4 py-2 bg-green-600 hover:bg-green-500 text-content rounded-lg transition-colors text-sm",children:["Sync to ",c]})]})]})]})})]})}function cB({isVisible:e,onUndo:t,onClose:n}){return e?l.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",children:l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg shadow-xl px-4 py-3 flex items-center gap-4",children:[l.jsx("span",{className:"text-sm text-content-body",children:"Issue moved"}),l.jsxs("button",{onClick:t,className:"flex items-center gap-1 text-sm text-blue-400 hover:text-blue-300 transition-colors",children:[l.jsx(oj,{className:"w-4 h-4"}),"Undo"]}),l.jsx("button",{onClick:n,className:"text-content-muted hover:text-content-subtle",children:l.jsx(yt,{className:"w-4 h-4"})})]})}):null}function uB({issue:e,onClose:t}){var i,o;const{data:n,isLoading:s,error:r}=he({queryKey:["beads",e.identifier],queryFn:async()=>{const a=await fetch(`/api/issues/${e.identifier}/beads`);if(!a.ok)throw new Error("Failed to fetch tasks");return a.json()}});return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),l.jsxs("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-lg mx-4 max-h-[70vh] overflow-hidden flex flex-col",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ko,{className:"w-5 h-5 text-green-400"}),l.jsxs("h2",{className:"font-semibold text-content",children:["Tasks: ",e.identifier]})]}),l.jsx("button",{onClick:t,className:"p-1 text-content-subtle hover:text-content hover:bg-surface-overlay rounded transition-colors",children:l.jsx(yt,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[s&&l.jsxs("div",{className:"flex items-center justify-center py-8 text-content-subtle",children:[l.jsx(_e,{className:"w-5 h-5 animate-spin mr-2"}),"Loading tasks..."]}),r&&l.jsx("div",{className:"text-red-400 text-center py-8",children:"Failed to load tasks"}),n&&((i=n.tasks)==null?void 0:i.length)===0&&l.jsx("div",{className:"text-content-muted text-center py-8",children:"No tasks created yet"}),n&&((o=n.tasks)==null?void 0:o.length)>0&&l.jsx("div",{className:"space-y-2",children:n.tasks.map(a=>l.jsxs("div",{className:`flex items-start gap-3 p-3 rounded-lg ${a.status==="closed"?"bg-green-900/20":a.status==="in_progress"?"bg-blue-900/20":"bg-surface-overlay/50"}`,children:[l.jsx("div",{className:`mt-0.5 ${a.status==="closed"?"text-green-400":a.status==="in_progress"?"text-blue-400":"text-content-subtle"}`,children:a.status==="closed"?l.jsx(mr,{className:"w-4 h-4"}):a.status==="in_progress"?l.jsx(_e,{className:"w-4 h-4 animate-spin"}):l.jsx("div",{className:"w-4 h-4 border-2 border-current rounded-full"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm text-content",children:a.title}),l.jsxs("div",{className:"text-xs text-content-muted mt-1",children:[a.id," · ",a.status]})]})]},a.id))})]}),l.jsxs("div",{className:"px-4 py-3 border-t border-divider text-xs text-content-muted",children:[(n==null?void 0:n.count)||0," task",(n==null?void 0:n.count)!==1?"s":""," · Beads"]})]})]})}function dB({issue:e,workAgent:t,planningAgent:n,specialists:s=[],cost:r,isSelected:i,onSelect:o,onPlan:a,onViewBeads:c}){var I,H;const u=Nt(),d=yr(),h=_l(),p=t,f=p&&p.status!=="dead"&&p.status!=="stopped",m=n&&n.status!=="stopped",g=p||n,y=Bt[e.status]||"backlog",x=y==="done"||y==="canceled",b=!x&&(((I=e.labels)==null?void 0:I.some(k=>typeof k=="string"&&k.toLowerCase()==="review ready"))??!1),_={0:"border-l-gray-500",1:"border-l-red-500",2:"border-l-orange-500",3:"border-l-yellow-500",4:"border-l-blue-500"},S=we({mutationFn:async k=>{const F=await fetch(`/api/agents/${k}`,{method:"DELETE"});if(!F.ok)throw new Error("Failed to kill agent");return F.json()},onSuccess:()=>{u.invalidateQueries({queryKey:["agents"]})}}),[C,w]=v.useState(""),[j,E]=v.useState(!1),O=we({mutationFn:async({agentId:k,message:F})=>{const M=await fetch(`/api/agents/${k}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:F})});if(!M.ok)throw new Error("Failed to send message");return M.json()},onSuccess:()=>{w(""),E(!1)}}),R=async k=>{k.stopPropagation(),g&&await d({title:"Kill Agent",message:`Kill agent ${g.id}?`,variant:"destructive",confirmLabel:"Kill"})&&S.mutate(g.id)},B=k=>{k.stopPropagation(),o()},L=k=>{k.stopPropagation(),E(!j)},D=k=>{k.preventDefault(),k.stopPropagation(),g&&C.trim()&&O.mutate({agentId:g.id,message:C.trim()})},T=we({mutationFn:async()=>{const k=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier})});if(!k.ok){const F=await k.json();throw new Error(F.error||"Failed to start agent")}return k.json()},onSuccess:()=>{u.invalidateQueries({queryKey:["agents"]}),u.invalidateQueries({queryKey:["issues"]})},onError:k=>{h({message:`Failed to start agent: ${k.message}`,variant:"error"})}}),P=async k=>{k.stopPropagation(),await d({title:"Start Agent",message:`Start agent for ${e.identifier}?`,confirmLabel:"Start"})&&T.mutate()},$=k=>{k.stopPropagation(),a()},W=we({mutationFn:async k=>{const F=await fetch(`/api/issues/${e.identifier}/deep-wipe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:k.deleteWorkspace})});if(!F.ok){const M=await F.json();throw new Error(M.error||"Deep wipe failed")}return F.json()},onSuccess:k=>{u.invalidateQueries({queryKey:["issues"]}),u.invalidateQueries({queryKey:["agents"]}),console.log("Deep wipe completed:",k.cleanupLog)}});return l.jsxs("div",{onClick:o,className:`bg-surface-overlay rounded-lg p-3 border-l-4 cursor-pointer transition-all ${_[e.priority]||"border-l-gray-500"} ${i?"ring-2 ring-blue-500 bg-gray-650":"hover:bg-gray-650"} ${f?"bg-blue-900/20":""}`,children:[l.jsx("div",{className:"flex items-start justify-between gap-2",children:l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.project&&l.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.project.color||"#6b7280"},title:e.project.name}),f&&l.jsxs("div",{className:"flex gap-0.5",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"0ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"150ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"300ms"}})]}),l.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:k=>k.stopPropagation(),className:"text-sm font-medium text-content hover:text-blue-400 flex items-center gap-1",children:[e.source==="github"&&l.jsx("span",{title:"GitHub Issue",children:l.jsx(s0,{className:"w-3 h-3 text-content-subtle"})}),l.jsx("span",{className:"text-content-subtle",children:e.identifier}),l.jsx(gr,{className:"w-3 h-3 opacity-50"})]}),(()=>{const k=[],F=!!t&&s.length>0||s.length>1;t&&k.push({type:"work",name:"work"});for(const M of s){const N=M.name.replace("-agent","");k.push({type:N,name:N})}return k.map((M,N)=>l.jsx(WF,{type:M.type,name:M.name,isConflict:F},N))})(),n&&n.status!=="stopped"&&l.jsxs("button",{onClick:k=>{k.stopPropagation(),a()},className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-purple-900/50 text-purple-300 animate-pulse hover:bg-purple-800/60 transition-colors cursor-pointer",title:"Click to watch planning session",children:[l.jsx(Rx,{className:"w-3 h-3"}),"Planning"]}),p&&p.model&&l.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium bg-surface-emphasis text-content-body",title:`Model: ${p.model}`,children:zF(p.model)}),p&&p.workspaceLocation&&l.jsxs("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded text-xs font-medium ${p.workspaceLocation==="remote"?"bg-cyan-900/50 text-cyan-400":"bg-surface-emphasis text-content-body"}`,title:p.workspaceLocation==="remote"?"Running on remote VM (exe.dev)":"Running locally",children:[p.workspaceLocation==="remote"?l.jsx(Nx,{className:"w-3 h-3"}):l.jsx(Tx,{className:"w-3 h-3"}),p.workspaceLocation]}),b&&l.jsxs("span",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-green-600 text-content animate-pulse",title:"Agent completed work - ready for human review",children:[l.jsx(XN,{className:"w-3 h-3"}),"Ready"]}),!x&&(g==null?void 0:g.hasPendingQuestion)&&l.jsxs("span",{onClick:k=>{k.stopPropagation(),a()},className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-amber-600 text-content animate-pulse cursor-pointer hover:bg-amber-500",title:`Agent is waiting for user input - click to respond (${g.pendingQuestionCount||1} question${(g.pendingQuestionCount||1)>1?"s":""})`,children:[l.jsx(KD,{className:"w-3 h-3"}),"Input"]}),e.source==="rally"&&l.jsx(R0,{issue:e}),(()=>{const k=RE(e.labels);return k?l.jsx(DE,{level:k}):null})(),e.mergeStatus==="merged"&&l.jsxs("span",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-bold bg-green-900/60 text-green-300 border border-green-500/40 uppercase tracking-wide",title:"Branch verified merged into main",children:[l.jsx(Px,{className:"w-3 h-3"}),"Merged"]}),((H=e.labels)==null?void 0:H.some(k=>k.toLowerCase()==="needs-close-out"))&&l.jsxs("span",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-amber-900/60 text-amber-400 border border-amber-600/40",title:"Reopened for close-out review — verify this work is complete, then click Close Out",children:[l.jsx(kn,{className:"w-3 h-3"}),"Needs Review"]}),r&&r.totalCost>0&&l.jsxs("span",{className:`ml-auto px-1.5 py-0.5 rounded text-xs font-medium ${LE(r.totalCost)}`,title:`${(r.tokenCount/1e6).toFixed(2)}M tokens${r.model?` • ${r.model.replace("claude-","").replace(/-20[0-9]{6}$/,"")}`:""}${r.durationMinutes?` • ${Math.round(r.durationMinutes)}min`:""}`,children:[l.jsx(na,{className:"w-3 h-3 inline -mt-0.5"}),ME(r.totalCost).slice(1)]})]}),l.jsx("p",{className:"text-sm text-content-body mt-1 line-clamp-2",children:e.title})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[e.assignee&&l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-content-subtle",children:[l.jsx(o0,{className:"w-3 h-3"}),e.assignee.name.split(" ")[0]]}),(e.labels||[]).filter(k=>typeof k=="string"&&k.toLowerCase()!=="review ready"&&k.toLowerCase()!=="needs-close-out").slice(0,2).map(k=>l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs bg-surface-emphasis text-content-body px-2 py-0.5 rounded",children:[l.jsx(r0,{className:"w-3 h-3"}),k]},k))]}),f&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong",children:[l.jsxs("button",{onClick:B,className:`flex items-center gap-1 text-xs transition-colors ${i?"text-blue-400":"text-content-subtle hover:text-content"}`,children:[l.jsx(Lo,{className:"w-3.5 h-3.5"}),"Watch"]}),l.jsxs("button",{onClick:()=>c&&c(e),className:"flex items-center gap-1 text-xs text-green-400 hover:text-green-300 transition-colors",title:"View tasks for this issue",children:[l.jsx(Ko,{className:"w-3.5 h-3.5"}),"Tasks"]}),l.jsxs("button",{onClick:L,className:`flex items-center gap-1 text-xs transition-colors ${j?"text-blue-400":"text-content-subtle hover:text-content"}`,children:[l.jsx(eM,{className:"w-3.5 h-3.5"}),"Tell"]}),l.jsxs("button",{onClick:R,disabled:S.isPending,className:"flex items-center gap-1 text-xs text-red-400 hover:text-red-300 transition-colors ml-auto",children:[S.isPending?l.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(yt,{className:"w-3.5 h-3.5"}),"Kill"]})]}),j&&g&&l.jsx("form",{onSubmit:D,className:"mt-2",onClick:k=>k.stopPropagation(),children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"text",value:C,onChange:k=>w(k.target.value),placeholder:"Type a message...",className:"flex-1 bg-surface-raised text-content text-sm px-3 py-1.5 rounded border border-divider-strong focus:border-blue-500 focus:outline-none",autoFocus:!0}),l.jsx("button",{type:"submit",disabled:!C.trim()||O.isPending,className:"px-3 py-1.5 bg-blue-600 text-content text-sm rounded hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:O.isPending?"...":"Send"})]})}),!f&&(Bt[e.status]==="backlog"||Bt[e.status]==="todo")&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong flex-wrap",children:[m?l.jsxs("button",{onClick:$,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors animate-pulse",children:[l.jsx(Lo,{className:"w-3.5 h-3.5"}),"Watch Planning"]}):l.jsxs("button",{onClick:$,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[l.jsx(qo,{className:"w-3.5 h-3.5"}),"Plan"]}),l.jsxs("button",{onClick:P,disabled:T.isPending,className:"flex items-center gap-1 text-xs text-content-muted hover:text-content-subtle transition-colors disabled:opacity-50",title:"Plan first recommended",children:[T.isPending?l.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(Qn,{className:"w-3.5 h-3.5"}),T.isPending?"Starting...":"Start Agent"]}),Bt[e.status]==="todo"&&l.jsx(hB,{issue:e}),Bt[e.status]==="backlog"&&l.jsx(fB,{issue:e}),l.jsx(Pm,{issue:e}),l.jsx(jd,{issue:e,deepWipeMutation:W})]}),!f&&Bt[e.status]==="in_progress"&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong flex-wrap",children:[m?l.jsxs("button",{onClick:$,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors animate-pulse",children:[l.jsx(Lo,{className:"w-3.5 h-3.5"}),"Watch Planning"]}):l.jsxs("button",{onClick:$,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[l.jsx(qo,{className:"w-3.5 h-3.5"}),"Re-plan"]}),l.jsxs("button",{onClick:()=>c&&c(e),className:"flex items-center gap-1 text-xs text-green-400 hover:text-green-300 transition-colors",title:"View tasks for this issue",children:[l.jsx(Ko,{className:"w-3.5 h-3.5"}),"Tasks"]}),l.jsxs("button",{onClick:P,className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors",children:[l.jsx(Qn,{className:"w-3.5 h-3.5"}),"Resume Agent"]}),l.jsxs("button",{onClick:async k=>{k.stopPropagation(),await d({title:"Reset Issue",message:`Reset ${e.identifier}?
|
|
519
|
-
|
|
520
|
-
This will:
|
|
521
|
-
• Kill any running agents (local and remote)
|
|
522
|
-
• Move the issue back to To Do in Linear
|
|
523
|
-
• Keep the workspace for reference`,variant:"destructive",confirmLabel:"Reset"})&&fetch(`/api/issues/${e.identifier}/reset`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(async()=>{await u.refetchQueries({queryKey:["issues"]}),await u.refetchQueries({queryKey:["agents"]})}).catch(F=>console.error("Reset failed:",F))},className:"flex items-center gap-1 text-xs text-orange-400 hover:text-orange-300 transition-colors",title:"Reset to To Do - kills agents, resets Linear status",children:[l.jsx(oj,{className:"w-3.5 h-3.5"}),"Reset"]}),l.jsx(Pm,{issue:e}),l.jsx(jd,{issue:e,deepWipeMutation:W})]}),!f&&Bt[e.status]==="in_review"&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong flex-wrap",children:[l.jsx(m1,{issue:e,inline:!0}),l.jsx(Pm,{issue:e}),l.jsx(jd,{issue:e,deepWipeMutation:W})]}),!f&&Bt[e.status]==="done"&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-green-600/30 flex-wrap",children:[l.jsx(m1,{issue:e,inline:!0}),l.jsx(pB,{issue:e}),l.jsx(jd,{issue:e,deepWipeMutation:W})]})]})}function jd({issue:e,deepWipeMutation:t}){const n=yr();return l.jsxs("button",{onClick:async s=>{s.stopPropagation(),await n({title:"Deep Wipe",message:`Deep wipe ${e.identifier}? This will clean up ALL state:
|
|
524
|
-
|
|
525
|
-
• Kill agents
|
|
526
|
-
• Delete agent state
|
|
527
|
-
• Delete workspace & branches
|
|
528
|
-
• Reset issue to Todo/Open
|
|
529
|
-
|
|
530
|
-
This is irreversible.`,variant:"destructive",confirmLabel:"Wipe Everything"})&&t.mutate({deleteWorkspace:!0})},disabled:t.isPending,className:"flex items-center gap-1 text-xs text-red-400/60 hover:text-red-400 transition-colors disabled:opacity-50 ml-auto",title:"Deep wipe: delete workspace, branches, agent state — start completely fresh",children:[t.isPending?l.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(ij,{className:"w-3.5 h-3.5"}),t.isPending?"Wiping...":"Wipe"]})}function Pm({issue:e}){const t=Nt(),n=yr(),[s,r]=v.useState(!1);return l.jsxs("button",{onClick:async i=>{if(i.stopPropagation(),!await n({title:"Cancel Issue",message:`Cancel ${e.identifier}?
|
|
531
|
-
|
|
532
|
-
This will:
|
|
533
|
-
• Stop any running agents
|
|
534
|
-
• Clean up agent & review state
|
|
535
|
-
• Move issue to Canceled on tracker`,variant:"destructive",confirmLabel:"Cancel Issue"}))return;const o=await n({title:"Delete Workspace?",message:`Also delete the workspace and branches for ${e.identifier}?
|
|
536
|
-
|
|
537
|
-
This removes the git worktree, local & remote feature branches, and all workspace files.
|
|
538
|
-
|
|
539
|
-
Choose "Keep" to preserve the code for reference.`,confirmLabel:"Delete Workspace",cancelLabel:"Keep Workspace",variant:"destructive"});r(!0);try{if(!(await fetch(`/api/issues/${e.identifier}/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wipeWorkspace:o})})).ok)throw new Error("Cancel failed");await t.refetchQueries({queryKey:["issues"]}),await t.refetchQueries({queryKey:["agents"]})}catch(a){console.error("Cancel failed:",a)}finally{r(!1)}},disabled:s,className:"flex items-center gap-1 text-xs text-orange-400/70 hover:text-orange-400 transition-colors disabled:opacity-50",title:"Cancel issue — stop agents, move to Canceled on tracker",children:[s?l.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(HD,{className:"w-3.5 h-3.5"}),s?"Canceling...":"Cancel"]})}function hB({issue:e}){const t=Nt(),[n,s]=v.useState(!1);return l.jsxs("button",{onClick:async r=>{r.stopPropagation(),s(!0);try{await fetch(`/api/issues/${e.identifier}/move-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"backlog"})}),await t.refetchQueries({queryKey:["issues"]})}catch(i){console.error("Move to backlog failed:",i)}finally{s(!1)}},disabled:n,className:"flex items-center gap-1 text-xs text-content-muted hover:text-content-subtle transition-colors disabled:opacity-50",title:"Move to Backlog",children:[n?l.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(Mu,{className:"w-3.5 h-3.5"}),"Backlog"]})}function fB({issue:e}){const t=Nt(),[n,s]=v.useState(!1);return l.jsxs("button",{onClick:async r=>{r.stopPropagation(),s(!0);try{await fetch(`/api/issues/${e.identifier}/move-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"todo"})}),await t.refetchQueries({queryKey:["issues"]})}catch(i){console.error("Move to todo failed:",i)}finally{s(!1)}},disabled:n,className:"flex items-center gap-1 text-xs text-content-muted hover:text-content-subtle transition-colors disabled:opacity-50",title:"Move to Todo",children:[n?l.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(bl,{className:"w-3.5 h-3.5"}),"Todo"]})}function m1({issue:e,inline:t}){const n=Nt(),s=yr(),r=we({mutationFn:async()=>{const a=await fetch(`/api/issues/${e.identifier}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!a.ok){const c=await a.json();throw new Error(c.error||"Failed to reopen issue")}return a.json()},onSuccess:async()=>{await n.refetchQueries({queryKey:["issues"]})}}),i=async a=>{a.stopPropagation(),await s({title:"Reopen Issue",message:`Reopen ${e.identifier} for re-work?
|
|
540
|
-
|
|
541
|
-
This will move it back to In Progress.`,confirmLabel:"Reopen"})&&r.mutate()},o=l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:i,disabled:r.isPending,className:"flex items-center gap-1 text-xs text-orange-400 hover:text-orange-300 transition-colors disabled:opacity-50",children:[r.isPending?l.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(Lu,{className:"w-3.5 h-3.5"}),r.isPending?"Reopening...":"Reopen"]}),r.isError&&l.jsx("span",{className:"text-xs text-red-400",children:r.error.message})]});return t?o:l.jsx("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-green-600/30",children:o})}function pB({issue:e}){const t=Nt(),n=yr(),s=we({mutationFn:async()=>{const i=await fetch(`/api/issues/${e.identifier}/close-out`,{method:"POST",headers:{"Content-Type":"application/json"}}),o=await i.json();if(!i.ok||!o.success)throw new Error(o.error||"Close-out failed");return o},onSuccess:async()=>{await t.refetchQueries({queryKey:["issues"]})}}),r=async i=>{i.stopPropagation(),await n({title:"Close Out Issue",message:`Close out ${e.identifier}?
|
|
542
|
-
|
|
543
|
-
This will:
|
|
544
|
-
• Verify branch is merged
|
|
545
|
-
• Archive workspace artifacts
|
|
546
|
-
• Clean up agent state
|
|
547
|
-
• Close issue on tracker
|
|
548
|
-
• Apply closed-out label`,variant:"destructive",confirmLabel:"Close Out"})&&s.mutate()};return l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:r,disabled:s.isPending,className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors disabled:opacity-50",children:[s.isPending?l.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(XN,{className:"w-3.5 h-3.5"}),s.isPending?"Closing out...":"Close Out"]}),s.isError&&l.jsx("span",{className:"text-xs text-red-400",children:s.error.message})]})}const mB={sleeping:"😴",active:"🟢",uninitialized:"⚪",suspended:"⏸️"},gB={sleeping:"Sleeping",active:"Active",uninitialized:"Not Initialized",suspended:"Suspended"},xB={sleeping:"text-blue-400",active:"text-green-400",uninitialized:"text-content-muted",suspended:"text-yellow-400"};async function vB(e){const t=await fetch(`/api/specialists/${e}/wake`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to wake specialist")}}async function yB(e){const t=await fetch(`/api/specialists/${e}/reset`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reinitialize:!1})});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to reset specialist")}}async function bB(e){if(!(await fetch(`/api/agents/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to kill specialist")}async function _B(e,t){const n=await fetch(`/api/agents/${e}/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})});if(!n.ok){const s=await n.json();throw new Error(s.error||"Failed to resume agent")}}async function wB(e){const t=await fetch(`/api/agents/${e}/activity?limit=20`);return t.ok?(await t.json()).activity||[]:[]}async function SB(e){const t=await fetch(`/api/specialists/${e}/cost`);return t.ok?t.json():{cost:0,inputTokens:0,outputTokens:0}}function kB(e,t){return he({queryKey:["specialist-cost",e],queryFn:()=>SB(e),enabled:t,refetchInterval:1e4})}async function CB(e){const t=await fetch(`/api/specialists/${e}/queue`);return t.ok?t.json():{specialistName:e,hasWork:!1,urgentCount:0,totalCount:0,items:[]}}async function NB(e,t){const n=await fetch(`/api/specialists/${e}/queue/${t}`,{method:"DELETE"});if(!n.ok){const s=await n.json();throw new Error(s.error||"Failed to remove queue item")}}async function jB(e,t){const n=await fetch(`/api/specialists/${e}/queue/reorder`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({itemIds:t})});if(!n.ok){const s=await n.json();throw new Error(s.error||"Failed to reorder queue")}}function EB(e){return he({queryKey:["specialist-queue",e],queryFn:()=>CB(e),refetchInterval:5e3})}function PB(e,t){return he({queryKey:["activity",e],queryFn:()=>wB(e),enabled:t,refetchInterval:1e4})}function TB(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function RB(e){if(!e)return"Never";const t=new Date(e),s=new Date().getTime()-t.getTime(),r=Math.floor(s/6e4),i=Math.floor(r/60),o=Math.floor(i/24);return o>0?`${o}d ago`:i>0?`${i}h ago`:r>0?`${r}m ago`:"Just now"}function DB({specialist:e,issueInfo:t,onSelect:n,isSelected:s}){const r=Nt(),i=yr(),o=_l(),{data:a}=kB(e.name,e.state!=="uninitialized"),{data:c}=EB(e.name),{data:u}=PB(e.tmuxSession,e.state!=="uninitialized"),[d,h]=v.useState(!1),[p,f]=v.useState(!1),m=we({mutationFn:()=>vB(e.name),onSuccess:()=>{r.invalidateQueries({queryKey:["specialists"]}),r.invalidateQueries({queryKey:["agents"]})},onError:T=>{o({message:`Failed to wake ${e.displayName}: ${T.message}`,variant:"error"})}}),g=we({mutationFn:()=>yB(e.name),onSuccess:()=>{r.invalidateQueries({queryKey:["specialists"]})},onError:T=>{o({message:`Failed to reset ${e.displayName}: ${T.message}`,variant:"error"})}}),y=we({mutationFn:()=>bB(e.tmuxSession),onSuccess:()=>{r.invalidateQueries({queryKey:["specialists"]}),r.invalidateQueries({queryKey:["agents"]})}}),x=we({mutationFn:T=>_B(e.tmuxSession,T),onSuccess:()=>{r.invalidateQueries({queryKey:["specialists"]}),r.invalidateQueries({queryKey:["agents"]})},onError:T=>{o({message:`Failed to resume ${e.displayName}: ${T.message}`,variant:"error"})}}),b=we({mutationFn:T=>NB(e.name,T),onSuccess:()=>{r.invalidateQueries({queryKey:["specialist-queue",e.name]})},onError:T=>{o({message:`Failed to remove queue item: ${T.message}`,variant:"error"})}}),_=we({mutationFn:T=>jB(e.name,T),onSuccess:()=>{r.invalidateQueries({queryKey:["specialist-queue",e.name]})},onError:T=>{o({message:`Failed to reorder queue: ${T.message}`,variant:"error"})}}),S=T=>{T.stopPropagation(),m.mutate()},C=async T=>{T.stopPropagation(),await i({title:"Reset Specialist",message:`Reset ${e.displayName}? This will clear the session file and context.`,variant:"destructive",confirmLabel:"Reset"})&&g.mutate()},w=async T=>{T.stopPropagation(),await i({title:"Kill Specialist",message:`Kill ${e.displayName}?`,variant:"destructive",confirmLabel:"Kill"})&&y.mutate()},j=(T,P)=>{T.stopPropagation(),b.mutate(P)},E=(T,P)=>{if(T.stopPropagation(),!c||P===0)return;const $=[...c.items];[$[P-1],$[P]]=[$[P],$[P-1]],_.mutate($.map(W=>W.id))},O=(T,P)=>{if(T.stopPropagation(),!c||P===c.items.length-1)return;const $=[...c.items];[$[P],$[P+1]]=[$[P+1],$[P]],_.mutate($.map(W=>W.id))},R=T=>{T.stopPropagation(),h(!d)},B=T=>{T.stopPropagation(),f(!p)},L=T=>{T.stopPropagation(),x.mutate(void 0)},D={urgent:"text-red-400",high:"text-orange-400",normal:"text-blue-400",low:"text-content-subtle"};return l.jsxs("div",{onClick:n,className:`p-4 cursor-pointer transition-colors ${s?"bg-surface-overlay":"hover:bg-gray-750"}`,children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(ep,{className:"w-5 h-5 text-purple-400"}),l.jsxs("div",{children:[l.jsxs("div",{className:"font-medium text-content flex items-center gap-2",children:[e.displayName,e.state==="active"?l.jsx(_e,{className:"w-4 h-4 text-green-400 animate-spin"}):l.jsx("span",{className:`text-xs ${xB[e.state]}`,children:mB[e.state]}),c&&c.totalCount>0&&l.jsxs("button",{onClick:R,className:"text-xs text-yellow-400 hover:text-yellow-300 flex items-center gap-1",title:`${c.totalCount} queued task${c.totalCount>1?"s":""}`,children:["(",c.totalCount,")",d?l.jsx(Mu,{className:"w-3 h-3"}):l.jsx(bl,{className:"w-3 h-3"})]})]}),l.jsx("div",{className:"text-sm text-content-subtle",children:e.description}),e.currentIssue&&l.jsxs("div",{className:"text-xs text-cyan-400 mt-1 flex items-center gap-1",children:[l.jsx("span",{className:"text-content-muted",children:"Working on:"}),l.jsx("span",{className:"font-mono",children:e.currentIssue}),t&&l.jsxs("span",{className:"text-content-subtle truncate max-w-[200px]",title:t.title,children:["- ",t.title]})]}),e.sessionId&&!e.currentIssue&&l.jsxs("div",{className:"text-xs text-content-muted font-mono mt-1",children:["Session: ",e.sessionId.slice(0,8),"..."]})]})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("div",{className:"text-right",children:[l.jsx("div",{className:"text-sm text-content-subtle",children:gB[e.state]}),a&&a.cost>0&&l.jsxs("div",{className:"text-xs text-green-400 font-medium",title:"Total cost",children:["$",a.cost.toFixed(4)]}),e.contextTokens&&l.jsxs("div",{className:"text-xs text-content-muted",children:[TB(e.contextTokens)," tokens"]}),e.lastWake&&l.jsxs("div",{className:"text-xs text-content-muted",children:["Last wake: ",RB(e.lastWake)]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[e.state!=="uninitialized"&&u&&u.length>0&&l.jsx("button",{onClick:B,className:"p-2 text-content-subtle hover:text-blue-400 hover:bg-surface-emphasis rounded",title:`Show activity history (${u.length} entries)`,children:l.jsx(al,{className:"w-4 h-4"})}),e.state==="suspended"&&l.jsx("button",{onClick:L,disabled:x.isPending,className:"p-2 text-content-subtle hover:text-green-400 hover:bg-surface-emphasis rounded disabled:opacity-50",title:"Resume specialist",children:l.jsx(Qn,{className:"w-4 h-4"})}),(e.state==="sleeping"||e.state==="uninitialized")&&l.jsx("button",{onClick:S,disabled:m.isPending||e.state==="uninitialized",className:"p-2 text-content-subtle hover:text-green-400 hover:bg-surface-emphasis rounded disabled:opacity-50 disabled:cursor-not-allowed",title:e.state==="uninitialized"?"Specialist not initialized - needs session ID":"Wake specialist",children:l.jsx(iM,{className:"w-4 h-4"})}),e.state==="active"&&l.jsx("button",{onClick:w,disabled:y.isPending,className:"p-2 text-content-subtle hover:text-red-400 hover:bg-surface-emphasis rounded",title:"Kill specialist",children:l.jsx(Kr,{className:"w-4 h-4"})}),(e.state==="sleeping"||e.state==="uninitialized")&&l.jsx("button",{onClick:C,disabled:g.isPending,className:"p-2 text-content-subtle hover:text-yellow-400 hover:bg-surface-emphasis rounded",title:"Reset specialist (clear session)",children:l.jsx(Lu,{className:"w-4 h-4"})})]})]})]}),d&&c&&c.totalCount>0&&l.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-divider-strong",children:[l.jsxs("div",{className:"text-xs text-content-subtle font-medium mb-2",children:["Queued Tasks (",c.totalCount,")"]}),l.jsx("div",{className:"space-y-2",children:c.items.map((T,P)=>l.jsxs("div",{className:"flex items-center justify-between bg-gray-750 px-3 py-2 rounded text-xs",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[l.jsxs("span",{className:"text-content-muted",children:[P+1,"."]}),l.jsx("span",{className:"text-content font-mono",children:T.payload.issueId||T.payload.message||T.id.substring(0,8)}),l.jsxs("span",{className:`${D[T.priority]} font-medium`,children:["[",T.priority,"]"]}),l.jsx("span",{className:"text-content-muted text-xs",children:T.source})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:$=>E($,P),disabled:P===0||_.isPending,className:"p-1 text-content-subtle hover:text-blue-400 disabled:opacity-30 disabled:cursor-not-allowed",title:"Move up",children:l.jsx(rM,{className:"w-3 h-3"})}),l.jsx("button",{onClick:$=>O($,P),disabled:P===c.items.length-1||_.isPending,className:"p-1 text-content-subtle hover:text-blue-400 disabled:opacity-30 disabled:cursor-not-allowed",title:"Move down",children:l.jsx(sM,{className:"w-3 h-3"})}),l.jsx("button",{onClick:$=>j($,T.id),disabled:b.isPending,className:"p-1 text-content-subtle hover:text-red-400 disabled:opacity-50",title:"Remove from queue",children:l.jsx(ij,{className:"w-3 h-3"})})]})]},T.id))})]}),p&&u&&u.length>0&&l.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-divider-strong",children:[l.jsxs("div",{className:"text-xs text-content-subtle font-medium mb-2",children:["Recent Activity (",u.length,")"]}),l.jsx("div",{className:"space-y-1",children:u.slice().reverse().map((T,P)=>l.jsxs("div",{className:"flex items-center gap-2 bg-gray-750 px-3 py-1.5 rounded text-xs",children:[l.jsx("span",{className:"text-content-muted",children:new Date(T.ts).toLocaleTimeString()}),l.jsx("span",{className:"text-blue-400 font-mono",children:T.tool}),T.action&&l.jsx("span",{className:"text-content-subtle truncate",children:T.action.substring(0,50)})]},P))})]})]})}async function MB(e){const t=await fetch(`/api/agents/${e}/handoff/suggestion`);if(!t.ok)throw new Error("Failed to fetch handoff suggestion");return t.json()}async function LB(e){const t=await fetch(`/api/agents/${e}/cost`);if(!t.ok)throw new Error("Failed to fetch agent cost");return t.json()}function AB(e){return he({queryKey:["handoff-suggestion",e],queryFn:()=>MB(e),refetchInterval:3e4})}function OB(e){return he({queryKey:["agent-cost",e],queryFn:()=>LB(e),refetchInterval:6e4})}async function IB(e,t,n){const s=await fetch(`/api/agents/${e}/handoff`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toModel:t,reason:n})});if(!s.ok){const r=await s.json();throw new Error(r.error||"Failed to execute handoff")}}const FB={opus:"text-purple-400 bg-purple-900/20 border-purple-500/30",sonnet:"text-blue-400 bg-blue-900/20 border-blue-500/30",haiku:"text-green-400 bg-green-900/20 border-green-500/30"};function BB({agentId:e}){const{data:t,isLoading:n}=AB(e),s=Nt(),r=yr(),i=_l(),o=we({mutationFn:({toModel:u,reason:d})=>IB(e,u,d),onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["handoff-suggestion",e]}),i({message:"Handoff completed successfully",variant:"success"})},onError:u=>{i({message:`Handoff failed: ${u.message}`,variant:"error"})}}),a=async u=>{await r({title:"Confirm Handoff",message:`Hand off ${e} to ${u}?`,confirmLabel:"Hand Off"})&&o.mutate({toModel:u,reason:"Manual handoff from dashboard"})},c=async()=>{t!=null&&t.suggestedModel&&await r({title:"Confirm Handoff",message:`${t.reason}
|
|
549
|
-
|
|
550
|
-
Proceed with handoff to ${t.suggestedModel}?`,confirmLabel:"Hand Off"})&&o.mutate({toModel:t.suggestedModel,reason:t.reason})};return n?l.jsx("div",{className:"p-3 bg-surface-raised rounded border border-divider",children:l.jsx("div",{className:"text-sm text-content-subtle",children:"Loading handoff data..."})}):t?l.jsxs("div",{className:"p-3 bg-surface-raised rounded border border-divider space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-content-subtle",children:"Current Model:"}),l.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded border ${FB[t.currentModel]||"text-content-subtle bg-surface-overlay border-divider-strong"}`,children:t.currentModel})]}),t.suggested&&t.suggestedModel&&l.jsxs("div",{className:"flex items-start gap-2 p-2 bg-orange-900/20 border border-orange-500/30 rounded",children:[l.jsx(Uo,{className:"w-4 h-4 text-orange-400 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm font-medium text-orange-400 mb-1",children:"Handoff Suggested"}),l.jsx("div",{className:"text-xs text-content-body mb-2",children:t.reason}),l.jsxs("button",{onClick:c,disabled:o.isPending,className:"flex items-center gap-2 px-3 py-1.5 text-xs font-medium text-content bg-orange-600 hover:bg-orange-500 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:[l.jsx(Cx,{className:"w-3 h-3"}),"Hand off to ",t.suggestedModel]})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-content-subtle mb-2",children:"Manual Handoff:"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>a("haiku"),disabled:o.isPending||t.currentModel==="haiku",className:"flex-1 px-2 py-1.5 text-xs font-medium text-green-400 bg-green-900/20 hover:bg-green-900/40 border border-green-500/30 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:"Haiku"}),l.jsx("button",{onClick:()=>a("sonnet"),disabled:o.isPending||t.currentModel==="sonnet",className:"flex-1 px-2 py-1.5 text-xs font-medium text-blue-400 bg-blue-900/20 hover:bg-blue-900/40 border border-blue-500/30 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:"Sonnet"}),l.jsx("button",{onClick:()=>a("opus"),disabled:o.isPending||t.currentModel==="opus",className:"flex-1 px-2 py-1.5 text-xs font-medium text-purple-400 bg-purple-900/20 hover:bg-purple-900/40 border border-purple-500/30 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:"Opus"})]})]})]}):null}const zB={healthy:"bg-status-healthy",warning:"bg-status-warning",stuck:"bg-status-stuck",dead:"bg-status-dead",stopped:"bg-gray-500"},$B={active:"🟢",stale:"🟡",warning:"🟠",stuck:"🔴",suspended:"⏸️"},HB={active:"Active",stale:"Stale",warning:"Warning",stuck:"Stuck",suspended:"Suspended"},WB={active:"text-green-400",stale:"text-yellow-400",warning:"text-orange-400",stuck:"text-red-400",suspended:"text-blue-400"};async function UB(e){if(!(await fetch(`/api/agents/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to kill agent")}async function qB(e){const t=await fetch(`/api/agents/${e}/poke`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to poke agent")}}async function KB(e,t){const n=await fetch(`/api/agents/${e}/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})});if(!n.ok){const s=await n.json();throw new Error(s.error||"Failed to resume agent")}}async function VB(e){const t=await fetch(`/api/agents/${e}/activity?limit=20`);return t.ok?(await t.json()).activity||[]:[]}function YB(e,t){return he({queryKey:["activity",e],queryFn:()=>VB(e),enabled:t,refetchInterval:1e4})}function XB(e){const t=new Date(e),s=new Date().getTime()-t.getTime(),r=Math.floor(s/6e4),i=Math.floor(r/60);return i>0?`${i}h ${r%60}m`:`${r}m`}function QB(e){if(e===null)return"unknown";const t=Math.floor(e/1e3),n=Math.floor(t/60),s=Math.floor(n/60);return s>0?`${s}h ago`:n>0?`${n}m ago`:`${t}s ago`}function GB({agent:e,health:t,onSelect:n,isSelected:s}){const r=Nt(),i=yr(),o=_l(),[a,c]=v.useState(!1),[u,d]=v.useState(!1),{data:h}=OB(e.id),{data:p}=YB(e.id,(t==null?void 0:t.isRunning)||(t==null?void 0:t.state)==="suspended"),f=we({mutationFn:()=>UB(e.id),onSuccess:()=>{r.invalidateQueries({queryKey:["agents"]})}}),m=we({mutationFn:()=>qB(e.id),onSuccess:()=>{o({message:`Poked ${e.id} successfully`,variant:"success"})},onError:w=>{o({message:`Failed to poke ${e.id}: ${w.message}`,variant:"error"})}}),g=we({mutationFn:w=>KB(e.id,w),onSuccess:()=>{r.invalidateQueries({queryKey:["agents"]})},onError:w=>{o({message:`Failed to resume ${e.id}: ${w.message}`,variant:"error"})}}),y=async w=>{w.stopPropagation(),await i({title:"Kill Agent",message:`Kill agent ${e.id}?`,variant:"destructive",confirmLabel:"Kill"})&&f.mutate()},x=w=>{w.stopPropagation(),m.mutate()},b=w=>{w.stopPropagation(),g.mutate(void 0)},_=w=>{w.stopPropagation(),d(!u)},S=(t==null?void 0:t.state)==="warning"||(t==null?void 0:t.state)==="stuck",C=w=>{w.stopPropagation(),c(!a)};return l.jsxs("div",{onClick:n,className:`p-4 cursor-pointer transition-colors ${s?"bg-surface-overlay":"hover:bg-gray-750"}`,children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:`w-3 h-3 rounded-full ${zB[e.status]}`}),l.jsxs("div",{children:[l.jsxs("div",{className:"font-medium text-content flex items-center gap-2",children:[e.id,t&&l.jsx("span",{className:`text-xs ${WB[t.state]}`,title:`Cloister: ${HB[t.state]}`,children:$B[t.state]})]}),l.jsxs("div",{className:"text-sm text-content-subtle flex items-center gap-2",children:[e.runtime," / ",e.model,h&&h.cost>0&&l.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-400",title:"Agent cost so far",children:[l.jsx(na,{className:"w-3 h-3"}),"$",h.cost.toFixed(4)]}),e.contextPercent!=null&&l.jsxs("span",{className:"flex items-center gap-1.5 text-xs",title:`Context: ${e.contextPercent}%${e.initialContextPercent?` (init: ${e.initialContextPercent}%)`:""}`,children:[l.jsx("span",{className:"w-14 h-1.5 bg-gray-700 rounded-full overflow-hidden inline-block",children:l.jsx("span",{className:`block h-full rounded-full transition-all ${e.contextPercent>80?"bg-red-500":e.contextPercent>50?"bg-yellow-500":"bg-emerald-500"}`,style:{width:`${Math.min(e.contextPercent,100)}%`}})}),l.jsxs("span",{className:e.contextPercent>80?"text-red-400":e.contextPercent>50?"text-yellow-400":"text-content-muted",children:[e.contextPercent,"%"]})]})]})]})]}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("div",{className:"text-right",children:[l.jsxs("div",{className:"flex items-center gap-1 text-sm text-content-subtle",children:[l.jsx(ll,{className:"w-4 h-4"}),XB(e.startedAt)]}),t&&t.timeSinceActivity!==null&&l.jsxs("div",{className:"flex items-center gap-1 text-xs text-content-muted",children:[l.jsx(al,{className:"w-3 h-3"}),QB(t.timeSinceActivity)]}),e.consecutiveFailures>0&&l.jsxs("div",{className:"flex items-center gap-1 text-sm text-orange-400",children:[l.jsx(kn,{className:"w-4 h-4"}),e.consecutiveFailures," failures"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[t&&(t.isRunning||t.state==="suspended")&&p&&p.length>0&&l.jsx("button",{onClick:_,className:"p-2 text-content-subtle hover:text-blue-400 hover:bg-surface-emphasis rounded",title:`Show activity history (${p.length} entries)`,children:l.jsx(al,{className:"w-4 h-4"})}),e.status!=="stopped"&&l.jsx("button",{onClick:C,className:`p-2 hover:bg-surface-emphasis rounded ${a?"text-blue-400":"text-content-subtle hover:text-blue-400"}`,title:"Model handoff controls",children:l.jsx(n0,{className:"w-4 h-4"})}),(t==null?void 0:t.state)==="suspended"&&l.jsx("button",{onClick:b,disabled:g.isPending,className:"p-2 text-content-subtle hover:text-green-400 hover:bg-surface-emphasis rounded disabled:opacity-50",title:"Resume agent",children:l.jsx(Qn,{className:"w-4 h-4"})}),S&&l.jsx("button",{onClick:x,disabled:m.isPending,className:"p-2 text-content-subtle hover:text-yellow-400 hover:bg-surface-emphasis rounded",title:"Poke agent (send nudge message)",children:l.jsx(VN,{className:"w-4 h-4"})}),(t==null?void 0:t.state)!=="suspended"&&e.status!=="stopped"&&l.jsx("button",{onClick:y,disabled:f.isPending,className:"p-2 text-content-subtle hover:text-red-400 hover:bg-surface-emphasis rounded",title:"Kill agent",children:l.jsx(ou,{className:"w-4 h-4"})})]})]})]}),a&&l.jsx("div",{className:"mt-3 pt-3 border-t border-divider",children:l.jsx(BB,{agentId:e.id})}),u&&p&&p.length>0&&l.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-divider-strong",children:[l.jsxs("div",{className:"text-xs text-content-subtle font-medium mb-2",children:["Recent Activity (",p.length,")"]}),l.jsx("div",{className:"space-y-1",children:p.slice().reverse().map((w,j)=>l.jsxs("div",{className:"flex items-center gap-2 bg-gray-750 px-3 py-1.5 rounded text-xs",children:[l.jsx("span",{className:"text-content-muted",children:new Date(w.ts).toLocaleTimeString()}),l.jsx("span",{className:"text-blue-400 font-mono",children:w.tool}),w.action&&l.jsx("span",{className:"text-content-subtle truncate",children:w.action.substring(0,50)})]},j))})]})]})}async function JB(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function ZB(){const e=await fetch("/api/specialists");if(!e.ok)throw new Error("Failed to fetch specialists");const t=await e.json();return t.specialists??t}async function e6(){const e=await fetch("/api/cloister/agents/health");if(!e.ok)throw new Error("Failed to fetch Cloister health");return e.json()}async function t6(){const e=await fetch("/api/cloister/status");if(!e.ok)throw new Error("Failed to fetch Cloister status");return e.json()}async function n6(){const e=await fetch("/api/activity");return e.ok?e.json():[]}async function s6(){const e=await fetch("/api/issues");return e.ok?(await e.json()).issues||[]:[]}async function r6(){if(!(await fetch("/api/cloister/start",{method:"POST"})).ok)throw new Error("Failed to start Cloister")}async function i6(){if(!(await fetch("/api/cloister/stop",{method:"POST"})).ok)throw new Error("Failed to stop Cloister")}function o6(e){if(!e)return"Never";const t=new Date(e),s=new Date().getTime()-t.getTime(),r=Math.floor(s/1e3),i=Math.floor(r/60);return r<60?`${r}s ago`:i<60?`${i}m ago`:`${Math.floor(i/60)}h ago`}async function a6(){const e=await fetch("/api/specialists/reset-all",{method:"POST",headers:{"Content-Type":"application/json"}});if(!e.ok){const t=await e.json();throw new Error(t.error||"Failed to reset specialists")}}function l6({selectedAgent:e,onSelectAgent:t}){const n=Nt(),s=yr(),r=_l(),{data:i,isLoading:o,error:a}=he({queryKey:["agents"],queryFn:JB,refetchInterval:3e3}),{data:c,isLoading:u}=he({queryKey:["specialists"],queryFn:ZB,refetchInterval:5e3}),{data:d}=he({queryKey:["cloister-health"],queryFn:e6,refetchInterval:5e3}),{data:h}=he({queryKey:["cloister-status"],queryFn:t6,refetchInterval:5e3}),{data:p}=he({queryKey:["activity"],queryFn:n6,refetchInterval:5e3}),{data:f}=he({queryKey:["issues"],queryFn:s6,refetchInterval:3e4}),m=we({mutationFn:r6,onSuccess:()=>{n.invalidateQueries({queryKey:["cloister-status"]})}}),g=we({mutationFn:i6,onSuccess:()=>{n.invalidateQueries({queryKey:["cloister-status"]})}}),y=we({mutationFn:a6,onSuccess:()=>{n.invalidateQueries({queryKey:["specialists"]}),n.invalidateQueries({queryKey:["agents"]})},onError:E=>{r({message:`Failed to reset specialists: ${E.message}`,variant:"error"})}}),x=async()=>{await s({title:"Reset Specialists",message:`Reset ALL specialist agents?
|
|
551
|
-
|
|
552
|
-
This will kill any running specialists and clear their session files.`,variant:"destructive",confirmLabel:"Reset All"})&&y.mutate()},b=E=>{if(!E||!f)return;const O=f.find(R=>R.identifier.toLowerCase()===E.toLowerCase());if(O)return{id:O.id,identifier:O.identifier,title:O.title}},_=(c==null?void 0:c.some(E=>E.isRunning))||!1,S=(h==null?void 0:h.running)||!1,C=(p||[]).slice(-5).reverse();if(o||u)return l.jsx("div",{className:"bg-surface-raised rounded-lg p-6",children:l.jsx("div",{className:"text-content-subtle",children:"Loading agents..."})});if(a)return l.jsx("div",{className:"bg-surface-raised rounded-lg p-6",children:l.jsxs("div",{className:"text-red-400",children:["Error: ",a.message]})});const w=(i==null?void 0:i.filter(E=>E.status!=="dead"))||[],j=(c==null?void 0:c.filter(E=>E.enabled))||[];return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[l.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[l.jsx(ll,{className:"w-5 h-5 text-blue-400"}),"Cloister Deacon"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`text-xs px-2 py-1 rounded ${_?"bg-green-900/50 text-green-400":"bg-surface-overlay text-content-subtle"}`,children:_?"● Specialists Active":"○ Specialists Idle"}),S?l.jsxs("button",{onClick:()=>g.mutate(),disabled:g.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs text-red-400 hover:bg-surface-overlay rounded transition-colors disabled:opacity-50",title:"Stop patrol loop",children:[l.jsx(ou,{className:"w-3 h-3"}),"Stop Patrol"]}):l.jsxs("button",{onClick:()=>m.mutate(),disabled:m.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs text-green-400 hover:bg-surface-overlay rounded transition-colors disabled:opacity-50",title:"Start patrol loop (health monitoring)",children:[l.jsx(Qn,{className:"w-3 h-3"}),"Start Patrol"]})]})]}),l.jsx("div",{className:"p-4",children:l.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-content-subtle",children:"Patrol Status:"})," ",l.jsx("span",{className:S?"text-green-400":"text-content-muted",children:S?"● Running":"○ Stopped"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-content-subtle",children:"Last Check:"})," ",l.jsx("span",{className:"text-content-body",children:o6((h==null?void 0:h.lastCheck)||null)})]}),(h==null?void 0:h.summary)&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(po,{className:"w-4 h-4 text-green-400"}),l.jsxs("span",{className:"text-content-body",children:[h.summary.active," active"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[h.summary.stuck>0?l.jsx(Uo,{className:"w-4 h-4 text-red-400"}):l.jsx(Uo,{className:"w-4 h-4 text-content-muted"}),l.jsxs("span",{className:h.summary.stuck>0?"text-red-400":"text-content-subtle",children:[h.summary.stuck," stuck"]})]})]})]})})]}),C.length>0&&l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[l.jsx(al,{className:"w-5 h-5 text-cyan-400"}),"Recent Activity"]})}),l.jsx("div",{className:"divide-y divide-gray-700",children:C.map(E=>l.jsxs("div",{className:"px-4 py-2 flex items-center gap-3 text-sm",children:[l.jsx("span",{className:"text-content-muted text-xs w-16",children:new Date(E.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),l.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs ${E.type==="spawn"?"bg-green-900/50 text-green-400":E.type==="complete"?"bg-blue-900/50 text-blue-400":E.type==="error"?"bg-red-900/50 text-red-400":E.type==="deacon"?"bg-purple-900/50 text-purple-400":"bg-surface-overlay text-content-body"}`,children:E.type}),l.jsxs("span",{className:"text-content-body truncate flex-1",children:[E.type==="deacon"?E.command:E.source,E.issueId&&E.type!=="deacon"&&l.jsxs("span",{className:"text-cyan-400 ml-1",children:["(",E.issueId,")"]})]})]},E.id))})]}),l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[l.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[l.jsx(ep,{className:"w-5 h-5 text-purple-400"}),"Specialist Agents (",j.length,")"]}),l.jsxs("button",{onClick:x,disabled:y.isPending,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-content-subtle hover:text-yellow-400 hover:bg-surface-overlay rounded transition-colors disabled:opacity-50",title:"Reset all specialists (kill & clear sessions)",children:[y.isPending?l.jsx(_e,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(Lu,{className:"w-3.5 h-3.5"}),"Reset All"]})]}),l.jsx("div",{className:"divide-y divide-gray-700",children:j.length===0?l.jsx("div",{className:"p-8 text-center text-content-muted",children:"No specialist agents configured."}):j.map(E=>l.jsx(DB,{specialist:E,issueInfo:b(E.currentIssue),onSelect:()=>t(E.tmuxSession===e?null:E.tmuxSession),isSelected:E.tmuxSession===e},E.name))})]}),l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[l.jsx(JN,{className:"w-5 h-5"}),"Issue Agents (",w.length,")"]})}),l.jsx("div",{className:"divide-y divide-gray-700",children:w.length===0?l.jsxs("div",{className:"p-8 text-center text-content-muted",children:["No agents running. Use"," ",l.jsx("code",{className:"bg-surface-overlay px-2 py-1 rounded",children:"/work-issue"})," to spawn one."]}):w.map(E=>{const O=d==null?void 0:d.agents.find(R=>R.agentId===E.id);return l.jsx(GB,{agent:E,health:O,onSelect:()=>t(E.id===e?null:E.id),isSelected:E.id===e},E.id)})})]})]})}async function c6(e){const t=await fetch(`/api/agents/${e}/output`);if(!t.ok)throw new Error("Failed to fetch output");return(await t.json()).output||""}async function u6(e,t){if(!(await fetch(`/api/agents/${e}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})})).ok)throw new Error("Failed to send message")}function d6({agentId:e}){const[t,n]=v.useState(""),s=v.useRef(null),{data:r,isLoading:i,refetch:o}=he({queryKey:["agent-output",e],queryFn:()=>c6(e),refetchInterval:2e3}),a=we({mutationFn:u=>u6(e,u),onSuccess:()=>{n(""),setTimeout(()=>o(),500)}});v.useEffect(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[r]);const c=u=>{u.preventDefault(),t.trim()&&a.mutate(t.trim())};return l.jsxs("div",{className:"bg-gray-800 rounded-lg flex flex-col h-[600px]",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[l.jsxs("h2",{className:"font-semibold text-white flex items-center gap-2",children:[l.jsx(Vo,{className:"w-5 h-5"}),e]}),l.jsx("button",{onClick:()=>o(),className:"p-2 text-gray-400 hover:text-white hover:bg-gray-700 rounded",title:"Refresh",children:l.jsx(Ar,{className:"w-4 h-4"})})]}),l.jsx("pre",{ref:s,className:"flex-1 overflow-auto p-4 terminal-output text-gray-300 bg-gray-900",children:i?l.jsx("span",{className:"text-gray-500",children:"Loading..."}):r||l.jsx("span",{className:"text-gray-500",children:"No output yet"})}),l.jsx("form",{onSubmit:c,className:"p-3 border-t border-gray-700",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"text",value:t,onChange:u=>n(u.target.value),placeholder:"Send message to agent...",className:"flex-1 bg-gray-700 border border-gray-600 rounded px-3 py-2 text-white placeholder-gray-400 focus:outline-none focus:border-blue-500"}),l.jsxs("button",{type:"submit",disabled:!t.trim()||a.isPending,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[l.jsx(sj,{className:"w-4 h-4"}),"Send"]})]})})]})}async function h6(){const e=await fetch("/api/services/tldr/status");if(!e.ok)throw new Error("Failed to fetch TLDR status");return e.json()}function AE(){const{data:e,isLoading:t,error:n}=he({queryKey:["tldr-status"],queryFn:h6,refetchInterval:1e4});if(t)return l.jsx("div",{className:"bg-surface-raised rounded-lg p-4 border border-divider",children:l.jsxs("div",{className:"flex items-center gap-2 text-content-subtle",children:[l.jsx(_e,{className:"w-4 h-4 animate-spin"}),l.jsx("span",{className:"text-sm",children:"Loading TLDR status..."})]})});if(n)return l.jsx("div",{className:"bg-surface-raised rounded-lg p-4 border border-divider",children:l.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[l.jsx(Kr,{className:"w-4 h-4"}),l.jsx("span",{className:"text-sm",children:"TLDR status unavailable"})]})});if(!e||e.daemons.length===0)return l.jsx("div",{className:"bg-surface-raised rounded-lg p-4 border border-divider",children:l.jsxs("div",{className:"flex items-center gap-2 text-content-subtle",children:[l.jsx(Kr,{className:"w-4 h-4"}),l.jsx("span",{className:"text-sm",children:"TLDR not configured"}),l.jsx("span",{className:"text-xs text-content-muted ml-auto",children:"Run pan setup to enable"})]})});const s=e.daemons.find(i=>i.workspace==="main"),r=e.daemons.filter(i=>i.workspace!=="main");return l.jsxs("div",{className:"space-y-3",children:[s&&l.jsx(g1,{daemon:s,label:"Main Index"}),r.length>0&&l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:r.map(i=>l.jsx(g1,{daemon:i,label:i.workspace},i.workspace))})]})}function g1({daemon:e,label:t}){const n=e.running&&e.healthy;return l.jsx("div",{className:`rounded-lg p-4 border ${n?"bg-green-900/30 border-green-800/30":"bg-surface-raised border-divider"}`,children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[n?l.jsx(mr,{className:"w-5 h-5 text-green-400"}):l.jsx(Kr,{className:"w-5 h-5 text-gray-400"}),l.jsxs("div",{children:[l.jsx("div",{className:"font-medium text-content",children:t}),l.jsxs("div",{className:"text-sm text-content-subtle",children:[e.running?"Running":"Stopped",e.running&&e.pid&&` (PID ${e.pid})`]})]})]}),l.jsxs("div",{className:"text-right",children:[e.fileCount!=null&&l.jsxs("div",{className:"flex items-center gap-1 text-sm text-content",children:[l.jsx(jx,{className:"w-3.5 h-3.5 text-content-subtle"}),l.jsxs("span",{children:[e.fileCount.toLocaleString()," files",e.edgeCount!=null&&`, ${e.edgeCount.toLocaleString()} edges`]})]}),e.indexAge&&l.jsxs("div",{className:"text-xs text-content-muted",children:["Updated ",e.indexAge]})]})]})})}async function f6(){const e=await fetch("/api/health/agents");if(!e.ok)throw new Error("Failed to fetch health");return e.json()}const x1={healthy:{icon:mr,color:"text-green-400",bg:"bg-green-900/30"},warning:{icon:kn,color:"text-yellow-400",bg:"bg-yellow-900/30"},stuck:{icon:ll,color:"text-orange-400",bg:"bg-orange-900/30"},dead:{icon:Kr,color:"text-red-400",bg:"bg-red-900/30"}};function p6(){const{data:e,isLoading:t,error:n}=he({queryKey:["health"],queryFn:f6,refetchInterval:5e3});if(t)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("div",{className:"text-content-subtle",children:"Loading health data..."})});if(n)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsxs("div",{className:"text-red-400",children:["Error: ",n.message]})});if(!e||e.length===0)return l.jsxs("div",{className:"bg-surface-raised rounded-lg p-8 text-center",children:[l.jsx(al,{className:"w-12 h-12 text-gray-600 mx-auto mb-4"}),l.jsx("h3",{className:"text-lg font-medium text-content-subtle",children:"No agents to monitor"}),l.jsx("p",{className:"text-sm text-content-muted mt-2",children:"Health data will appear here when agents are running"})]});const s=e.reduce((r,i)=>(r[i.status]=(r[i.status]||0)+1,r),{});return l.jsxs("div",{className:"space-y-6",children:[l.jsx(AE,{}),l.jsx("div",{className:"grid grid-cols-4 gap-4",children:["healthy","warning","stuck","dead"].map(r=>{const i=x1[r],o=i.icon;return l.jsx("div",{className:`${i.bg} rounded-lg p-4 border border-divider`,children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(o,{className:`w-8 h-8 ${i.color}`}),l.jsxs("div",{children:[l.jsx("div",{className:"text-2xl font-bold text-content",children:s[r]||0}),l.jsx("div",{className:"text-sm text-content-subtle capitalize",children:r})]})]})},r)})}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(r=>{const i=x1[r.status],o=i.icon;return l.jsxs("div",{className:`${i.bg} rounded-lg p-4 border border-divider`,children:[l.jsx("div",{className:"flex items-start justify-between",children:l.jsxs("div",{children:[l.jsx("div",{className:"font-medium text-content",children:r.agentId}),l.jsxs("div",{className:`flex items-center gap-1 text-sm ${i.color} mt-1`,children:[l.jsx(o,{className:"w-4 h-4"}),l.jsx("span",{className:"capitalize",children:r.status})]})]})}),r.reason&&l.jsx("div",{className:"mt-2 text-sm text-content-subtle italic",children:r.reason}),l.jsxs("div",{className:"mt-4 space-y-2 text-sm",children:[r.lastPing&&l.jsxs("div",{className:"flex justify-between text-content-subtle",children:[l.jsx("span",{children:"Last ping:"}),l.jsx("span",{children:new Date(r.lastPing).toLocaleTimeString()})]}),l.jsxs("div",{className:"flex justify-between text-content-subtle",children:[l.jsx("span",{children:"Failures:"}),l.jsx("span",{className:r.consecutiveFailures>0?"text-orange-400":"",children:r.consecutiveFailures})]}),l.jsxs("div",{className:"flex justify-between text-content-subtle",children:[l.jsx("span",{children:"Kill count:"}),l.jsx("span",{className:r.killCount>0?"text-red-400":"",children:r.killCount})]}),r.contextPercent!=null&&l.jsxs("div",{className:"flex justify-between text-content-subtle",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(ep,{className:"w-3.5 h-3.5"}),"Context:"]}),l.jsxs("span",{className:r.contextPercent>=80?"text-red-400":r.contextPercent>=60?"text-yellow-400":"text-green-400",children:[r.contextPercent,"%"]})]})]})]},r.agentId)})})]})}function m6(){const[e,t]=v.useState([]),[n,s]=v.useState(!0),[r,i]=v.useState(null),o=async()=>{try{s(!0);const u=await fetch("/api/skills");if(!u.ok)throw new Error("Failed to fetch skills");const d=await u.json();t(d),i(null)}catch(u){i(u instanceof Error?u.message:"Unknown error")}finally{s(!1)}};if(v.useEffect(()=>{o()},[]),n)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx(Ar,{className:"w-6 h-6 text-content-subtle animate-spin"})});if(r)return l.jsxs("div",{className:"bg-red-900/20 border border-red-800 rounded-lg p-4 text-red-400",children:[l.jsx(Uo,{className:"w-5 h-5 inline mr-2"}),r]});const a=e.filter(u=>u.source==="panopticon"),c=e.filter(u=>u.source==="claude");return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h2",{className:"text-lg font-semibold text-content",children:"Skills"}),l.jsxs("button",{onClick:o,className:"flex items-center gap-2 px-3 py-1.5 text-sm text-content-subtle hover:text-content hover:bg-surface-overlay rounded-lg transition-colors",children:[l.jsx(Ar,{className:"w-4 h-4"}),"Refresh"]})]}),e.length===0?l.jsxs("div",{className:"bg-surface-raised rounded-lg p-8 text-center text-content-subtle",children:[l.jsx(Ex,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),l.jsx("p",{children:"No skills found"}),l.jsx("p",{className:"text-sm mt-2",children:"Add skills to ~/.panopticon/skills/ or ~/.claude/skills/"})]}):l.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[l.jsxs("div",{className:"bg-surface-raised rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"}),l.jsxs("h3",{className:"font-medium text-content",children:["Panopticon (",a.length,")"]})]}),l.jsxs("div",{className:"space-y-2",children:[a.map(u=>l.jsx(v1,{skill:u},u.path)),a.length===0&&l.jsx("p",{className:"text-content-muted text-sm",children:"No Panopticon skills"})]})]}),l.jsxs("div",{className:"bg-surface-raised rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx("div",{className:"w-2 h-2 rounded-full bg-purple-500"}),l.jsxs("h3",{className:"font-medium text-content",children:["Claude (",c.length,")"]})]}),l.jsxs("div",{className:"space-y-2",children:[c.map(u=>l.jsx(v1,{skill:u},u.path)),c.length===0&&l.jsx("p",{className:"text-content-muted text-sm",children:"No Claude skills"})]})]})]}),l.jsxs("div",{className:"bg-surface-raised rounded-lg p-4",children:[l.jsx("h3",{className:"font-medium text-content mb-2",children:"Skill Locations"}),l.jsxs("div",{className:"text-sm text-content-subtle space-y-1",children:[l.jsxs("p",{children:[l.jsx("span",{className:"text-blue-400",children:"Panopticon:"})," ","~/.panopticon/skills/"]}),l.jsxs("p",{children:[l.jsx("span",{className:"text-purple-400",children:"Claude:"})," ~/.claude/skills/"]})]})]})]})}function v1({skill:e}){return l.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-3 hover:bg-surface-overlay transition-colors",children:[l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(YN,{className:"w-4 h-4 text-content-subtle"}),l.jsx("span",{className:"font-medium text-content",children:e.name})]}),e.hasSkillMd?l.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-400",children:[l.jsx(Ec,{className:"w-3 h-3"}),"SKILL.md"]}):l.jsxs("span",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[l.jsx(Uo,{className:"w-3 h-3"}),"No SKILL.md"]})]}),e.description&&l.jsx("p",{className:"mt-2 text-sm text-content-subtle line-clamp-2",children:e.description}),l.jsx("p",{className:"mt-2 text-xs text-content-muted truncate",children:e.path})]})}function g6(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const x6=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,v6=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,y6={};function y1(e,t){return(y6.jsx?v6:x6).test(e)}const b6=/[ \t\n\f\r]/g;function _6(e){return typeof e=="object"?e.type==="text"?b1(e.value):!1:b1(e)}function b1(e){return e.replace(b6,"")===""}class Wu{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Wu.prototype.normal={};Wu.prototype.property={};Wu.prototype.space=void 0;function OE(e,t){const n={},s={};for(const r of e)Object.assign(n,r.property),Object.assign(s,r.normal);return new Wu(n,s,t)}function bv(e){return e.toLowerCase()}class es{constructor(t,n){this.attribute=n,this.property=t}}es.prototype.attribute="";es.prototype.booleanish=!1;es.prototype.boolean=!1;es.prototype.commaOrSpaceSeparated=!1;es.prototype.commaSeparated=!1;es.prototype.defined=!1;es.prototype.mustUseProperty=!1;es.prototype.number=!1;es.prototype.overloadedBoolean=!1;es.prototype.property="";es.prototype.spaceSeparated=!1;es.prototype.space=void 0;let w6=0;const Ce=ia(),Pt=ia(),_v=ia(),ne=ia(),Ze=ia(),za=ia(),is=ia();function ia(){return 2**++w6}const wv=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ce,booleanish:Pt,commaOrSpaceSeparated:is,commaSeparated:za,number:ne,overloadedBoolean:_v,spaceSeparated:Ze},Symbol.toStringTag,{value:"Module"})),Tm=Object.keys(wv);class D0 extends es{constructor(t,n,s,r){let i=-1;if(super(t,n),_1(this,"space",r),typeof s=="number")for(;++i<Tm.length;){const o=Tm[i];_1(this,Tm[i],(s&wv[o])===wv[o])}}}D0.prototype.defined=!0;function _1(e,t,n){n&&(e[t]=n)}function Nl(e){const t={},n={};for(const[s,r]of Object.entries(e.properties)){const i=new D0(s,e.transform(e.attributes||{},s),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[bv(s)]=s,n[bv(i.attribute)]=s}return new Wu(t,n,e.space)}const IE=Nl({properties:{ariaActiveDescendant:null,ariaAtomic:Pt,ariaAutoComplete:null,ariaBusy:Pt,ariaChecked:Pt,ariaColCount:ne,ariaColIndex:ne,ariaColSpan:ne,ariaControls:Ze,ariaCurrent:null,ariaDescribedBy:Ze,ariaDetails:null,ariaDisabled:Pt,ariaDropEffect:Ze,ariaErrorMessage:null,ariaExpanded:Pt,ariaFlowTo:Ze,ariaGrabbed:Pt,ariaHasPopup:null,ariaHidden:Pt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ze,ariaLevel:ne,ariaLive:null,ariaModal:Pt,ariaMultiLine:Pt,ariaMultiSelectable:Pt,ariaOrientation:null,ariaOwns:Ze,ariaPlaceholder:null,ariaPosInSet:ne,ariaPressed:Pt,ariaReadOnly:Pt,ariaRelevant:null,ariaRequired:Pt,ariaRoleDescription:Ze,ariaRowCount:ne,ariaRowIndex:ne,ariaRowSpan:ne,ariaSelected:Pt,ariaSetSize:ne,ariaSort:null,ariaValueMax:ne,ariaValueMin:ne,ariaValueNow:ne,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function FE(e,t){return t in e?e[t]:t}function BE(e,t){return FE(e,t.toLowerCase())}const S6=Nl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:za,acceptCharset:Ze,accessKey:Ze,action:null,allow:null,allowFullScreen:Ce,allowPaymentRequest:Ce,allowUserMedia:Ce,alt:null,as:null,async:Ce,autoCapitalize:null,autoComplete:Ze,autoFocus:Ce,autoPlay:Ce,blocking:Ze,capture:null,charSet:null,checked:Ce,cite:null,className:Ze,cols:ne,colSpan:null,content:null,contentEditable:Pt,controls:Ce,controlsList:Ze,coords:ne|za,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ce,defer:Ce,dir:null,dirName:null,disabled:Ce,download:_v,draggable:Pt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ce,formTarget:null,headers:Ze,height:ne,hidden:_v,high:ne,href:null,hrefLang:null,htmlFor:Ze,httpEquiv:Ze,id:null,imageSizes:null,imageSrcSet:null,inert:Ce,inputMode:null,integrity:null,is:null,isMap:Ce,itemId:null,itemProp:Ze,itemRef:Ze,itemScope:Ce,itemType:Ze,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ce,low:ne,manifest:null,max:null,maxLength:ne,media:null,method:null,min:null,minLength:ne,multiple:Ce,muted:Ce,name:null,nonce:null,noModule:Ce,noValidate:Ce,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:Ce,optimum:ne,pattern:null,ping:Ze,placeholder:null,playsInline:Ce,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ce,referrerPolicy:null,rel:Ze,required:Ce,reversed:Ce,rows:ne,rowSpan:ne,sandbox:Ze,scope:null,scoped:Ce,seamless:Ce,selected:Ce,shadowRootClonable:Ce,shadowRootDelegatesFocus:Ce,shadowRootMode:null,shape:null,size:ne,sizes:null,slot:null,span:ne,spellCheck:Pt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ne,step:null,style:null,tabIndex:ne,target:null,title:null,translate:null,type:null,typeMustMatch:Ce,useMap:null,value:Pt,width:ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ze,axis:null,background:null,bgColor:null,border:ne,borderColor:null,bottomMargin:ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ce,declare:Ce,event:null,face:null,frame:null,frameBorder:null,hSpace:ne,leftMargin:ne,link:null,longDesc:null,lowSrc:null,marginHeight:ne,marginWidth:ne,noResize:Ce,noHref:Ce,noShade:Ce,noWrap:Ce,object:null,profile:null,prompt:null,rev:null,rightMargin:ne,rules:null,scheme:null,scrolling:Pt,standby:null,summary:null,text:null,topMargin:ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ce,disableRemotePlayback:Ce,prefix:null,property:null,results:ne,security:null,unselectable:null},space:"html",transform:BE}),k6=Nl({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:is,accentHeight:ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ne,amplitude:ne,arabicForm:null,ascent:ne,attributeName:null,attributeType:null,azimuth:ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ne,by:null,calcMode:null,capHeight:ne,className:Ze,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:ne,diffuseConstant:ne,direction:null,display:null,dur:null,divisor:ne,dominantBaseline:null,download:Ce,dx:null,dy:null,edgeMode:null,editable:null,elevation:ne,enableBackground:null,end:null,event:null,exponent:ne,externalResourcesRequired:null,fill:null,fillOpacity:ne,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:ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ne,horizOriginX:ne,horizOriginY:ne,id:null,ideographic:ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ne,k:ne,k1:ne,k2:ne,k3:ne,k4:ne,kernelMatrix:is,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ne,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:ne,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:ne,overlineThickness:ne,paintOrder:null,panose1:null,path:null,pathLength:ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ze,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ne,pointsAtY:ne,pointsAtZ:ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:is,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:is,rev:is,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:is,requiredFeatures:is,requiredFonts:is,requiredFormats:is,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:ne,specularExponent:ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ne,strikethroughThickness:ne,string:null,stroke:null,strokeDashArray:is,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ne,strokeOpacity:ne,strokeWidth:null,style:null,surfaceScale:ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:is,tabIndex:ne,tableValues:null,target:null,targetX:ne,targetY:ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:is,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ne,underlineThickness:ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ne,values:null,vAlphabetic:ne,vMathematical:ne,vectorEffect:null,vHanging:ne,vIdeographic:ne,version:null,vertAdvY:ne,vertOriginX:ne,vertOriginY:ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:FE}),zE=Nl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),$E=Nl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:BE}),HE=Nl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),C6={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"},N6=/[A-Z]/g,w1=/-[a-z]/g,j6=/^data[-\w.:]+$/i;function E6(e,t){const n=bv(t);let s=t,r=es;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&j6.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(w1,T6);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!w1.test(i)){let o=i.replace(N6,P6);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=D0}return new r(s,t)}function P6(e){return"-"+e.toLowerCase()}function T6(e){return e.charAt(1).toUpperCase()}const R6=OE([IE,S6,zE,$E,HE],"html"),M0=OE([IE,k6,zE,$E,HE],"svg");function D6(e){return e.join(" ").trim()}var L0={},S1=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,M6=/\n/g,L6=/^\s*/,A6=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,O6=/^:\s*/,I6=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,F6=/^[;\s]*/,B6=/^\s+|\s+$/g,z6=`
|
|
553
|
-
`,k1="/",C1="*",mo="",$6="comment",H6="declaration";function W6(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,s=1;function r(m){var g=m.match(M6);g&&(n+=g.length);var y=m.lastIndexOf(z6);s=~y?m.length-y:s+m.length}function i(){var m={line:n,column:s};return function(g){return g.position=new o(m),u(),g}}function o(m){this.start=m,this.end={line:n,column:s},this.source=t.source}o.prototype.content=e;function a(m){var g=new Error(t.source+":"+n+":"+s+": "+m);if(g.reason=m,g.filename=t.source,g.line=n,g.column=s,g.source=e,!t.silent)throw g}function c(m){var g=m.exec(e);if(g){var y=g[0];return r(y),e=e.slice(y.length),g}}function u(){c(L6)}function d(m){var g;for(m=m||[];g=h();)g!==!1&&m.push(g);return m}function h(){var m=i();if(!(k1!=e.charAt(0)||C1!=e.charAt(1))){for(var g=2;mo!=e.charAt(g)&&(C1!=e.charAt(g)||k1!=e.charAt(g+1));)++g;if(g+=2,mo===e.charAt(g-1))return a("End of comment missing");var y=e.slice(2,g-2);return s+=2,r(y),e=e.slice(g),s+=2,m({type:$6,comment:y})}}function p(){var m=i(),g=c(A6);if(g){if(h(),!c(O6))return a("property missing ':'");var y=c(I6),x=m({type:H6,property:N1(g[0].replace(S1,mo)),value:y?N1(y[0].replace(S1,mo)):mo});return c(F6),x}}function f(){var m=[];d(m);for(var g;g=p();)g!==!1&&(m.push(g),d(m));return m}return u(),f()}function N1(e){return e?e.replace(B6,mo):mo}var U6=W6,q6=Oh&&Oh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(L0,"__esModule",{value:!0});L0.default=V6;const K6=q6(U6);function V6(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,K6.default)(e),r=typeof t=="function";return s.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:a}=i;r?t(o,a,i):a&&(n=n||{},n[o]=a)}),n}var pp={};Object.defineProperty(pp,"__esModule",{value:!0});pp.camelCase=void 0;var Y6=/^--[a-zA-Z0-9_-]+$/,X6=/-([a-z])/g,Q6=/^[^-]+$/,G6=/^-(webkit|moz|ms|o|khtml)-/,J6=/^-(ms)-/,Z6=function(e){return!e||Q6.test(e)||Y6.test(e)},ez=function(e,t){return t.toUpperCase()},j1=function(e,t){return"".concat(t,"-")},tz=function(e,t){return t===void 0&&(t={}),Z6(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(J6,j1):e=e.replace(G6,j1),e.replace(X6,ez))};pp.camelCase=tz;var nz=Oh&&Oh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},sz=nz(L0),rz=pp;function Sv(e,t){var n={};return!e||typeof e!="string"||(0,sz.default)(e,function(s,r){s&&r&&(n[(0,rz.camelCase)(s,t)]=r)}),n}Sv.default=Sv;var iz=Sv;const oz=ml(iz),WE=UE("end"),A0=UE("start");function UE(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function az(e){const t=A0(e),n=WE(e);if(t&&n)return{start:t,end:n}}function Mc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?E1(e.position):"start"in e||"end"in e?E1(e):"line"in e||"column"in e?kv(e):""}function kv(e){return P1(e&&e.line)+":"+P1(e&&e.column)}function E1(e){return kv(e&&e.start)+"-"+kv(e&&e.end)}function P1(e){return e&&typeof e=="number"?e:1}class jn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let r="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?r=t:!i.cause&&t&&(o=!0,r=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?i.ruleId=s:(i.source=s.slice(0,c),i.ruleId=s.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=a?a.line:void 0,this.name=Mc(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}jn.prototype.file="";jn.prototype.name="";jn.prototype.reason="";jn.prototype.message="";jn.prototype.stack="";jn.prototype.column=void 0;jn.prototype.line=void 0;jn.prototype.ancestors=void 0;jn.prototype.cause=void 0;jn.prototype.fatal=void 0;jn.prototype.place=void 0;jn.prototype.ruleId=void 0;jn.prototype.source=void 0;const O0={}.hasOwnProperty,lz=new Map,cz=/[A-Z]/g,uz=new Set(["table","tbody","thead","tfoot","tr"]),dz=new Set(["td","th"]),qE="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hz(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=bz(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=yz(n,t.jsx,t.jsxs)}const r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?M0:R6,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=KE(r,e,void 0);return i&&typeof i!="string"?i:r.create(e,r.Fragment,{children:i||void 0},void 0)}function KE(e,t,n){if(t.type==="element")return fz(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return pz(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return gz(e,t,n);if(t.type==="mdxjsEsm")return mz(e,t);if(t.type==="root")return xz(e,t,n);if(t.type==="text")return vz(e,t)}function fz(e,t,n){const s=e.schema;let r=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(r=M0,e.schema=r),e.ancestors.push(t);const i=YE(e,t.tagName,!1),o=_z(e,t);let a=F0(e,t);return uz.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!_6(c):!0})),VE(e,o,i,t),I0(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function pz(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}pu(e,t.position)}function mz(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);pu(e,t.position)}function gz(e,t,n){const s=e.schema;let r=s;t.name==="svg"&&s.space==="html"&&(r=M0,e.schema=r),e.ancestors.push(t);const i=t.name===null?e.Fragment:YE(e,t.name,!0),o=wz(e,t),a=F0(e,t);return VE(e,o,i,t),I0(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function xz(e,t,n){const s={};return I0(s,F0(e,t)),e.create(t,e.Fragment,s,n)}function vz(e,t){return t.value}function VE(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function I0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function yz(e,t,n){return s;function s(r,i,o,a){const u=Array.isArray(o.children)?n:t;return a?u(i,o,a):u(i,o)}}function bz(e,t){return n;function n(s,r,i,o){const a=Array.isArray(i.children),c=A0(s);return t(r,i,o,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function _z(e,t){const n={};let s,r;for(r in t.properties)if(r!=="children"&&O0.call(t.properties,r)){const i=Sz(e,r,t.properties[r]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&dz.has(t.tagName)?s=a:n[o]=a}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function wz(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else pu(e,t.position);else{const r=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const a=s.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else pu(e,t.position);else i=s.value===null?!0:s.value;n[r]=i}return n}function F0(e,t){const n=[];let s=-1;const r=e.passKeys?new Map:lz;for(;++s<t.children.length;){const i=t.children[s];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=r.get(c)||0;o=c+"-"+u,r.set(c,u+1)}}const a=KE(e,i,o);a!==void 0&&n.push(a)}return n}function Sz(e,t,n){const s=E6(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?g6(n):D6(n)),s.property==="style"){let r=typeof n=="object"?n:kz(e,String(n));return e.stylePropertyNameCase==="css"&&(r=Cz(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&s.space?C6[s.property]||s.property:s.attribute,n]}}function kz(e,t){try{return oz(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,r=new jn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=qE+"#cannot-parse-style-attribute",r}}function YE(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const r=t.split(".");let i=-1,o;for(;++i<r.length;){const a=y1(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}s=o}else s=y1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const r=s.value;return O0.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(s);pu(e)}function pu(e,t){const n=new jn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=qE+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Cz(e){const t={};let n;for(n in e)O0.call(e,n)&&(t[Nz(n)]=e[n]);return t}function Nz(e){let t=e.replace(cz,jz);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function jz(e){return"-"+e.toLowerCase()}const Rm={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"]},Ez={};function B0(e,t){const n=Ez,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,r=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return XE(e,s,r)}function XE(e,t,n){if(Pz(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return T1(e.children,t,n)}return Array.isArray(e)?T1(e,t,n):""}function T1(e,t,n){const s=[];let r=-1;for(;++r<e.length;)s[r]=XE(e[r],t,n);return s.join("")}function Pz(e){return!!(e&&typeof e=="object")}const R1=document.createElement("i");function z0(e){const t="&"+e+";";R1.innerHTML=t;const n=R1.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function us(e,t,n,s){const r=e.length;let i=0,o;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,n=n>0?n:0,s.length<1e4)o=Array.from(s),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<s.length;)o=s.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function ks(e,t){return e.length>0?(us(e,e.length,0,t),e):t}const D1={}.hasOwnProperty;function QE(e){const t={};let n=-1;for(;++n<e.length;)Tz(t,e[n]);return t}function Tz(e,t){let n;for(n in t){const r=(D1.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){D1.call(r,o)||(r[o]=[]);const a=i[o];Rz(r[o],Array.isArray(a)?a:a?[a]:[])}}}function Rz(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);us(e,0,0,s)}function GE(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Us(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ln=Zi(/[A-Za-z]/),Sn=Zi(/[\dA-Za-z]/),Dz=Zi(/[#-'*+\--9=?A-Z^-~]/);function wf(e){return e!==null&&(e<32||e===127)}const Cv=Zi(/\d/),Mz=Zi(/[\dA-Fa-f]/),Lz=Zi(/[!-/:-@[-`{-~]/);function xe(e){return e!==null&&e<-2}function Qe(e){return e!==null&&(e<0||e===32)}function Me(e){return e===-2||e===-1||e===32}const mp=Zi(new RegExp("\\p{P}|\\p{S}","u")),Qo=Zi(/\s/);function Zi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function jl(e){const t=[];let n=-1,s=0,r=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&Sn(e.charCodeAt(n+1))&&Sn(e.charCodeAt(n+2)))r=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),r=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(s,n),encodeURIComponent(o)),s=n+r+1,o=""),r&&(n+=r,r=0)}return t.join("")+e.slice(s)}function Be(e,t,n,s){const r=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Me(c)?(e.enter(n),a(c)):t(c)}function a(c){return Me(c)&&i++<r?(e.consume(c),a):(e.exit(n),t(c))}}const Az={tokenize:Oz};function Oz(e){const t=e.attempt(this.parser.constructs.contentInitial,s,r);let n;return t;function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Be(e,t,"linePrefix")}function r(a){return e.enter("paragraph"),i(a)}function i(a){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return xe(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const Iz={tokenize:Fz},M1={tokenize:Bz};function Fz(e){const t=this,n=[];let s=0,r,i,o;return a;function a(_){if(s<n.length){const S=n[s];return t.containerState=S[1],e.attempt(S[0].continuation,c,u)(_)}return u(_)}function c(_){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&b();const S=t.events.length;let C=S,w;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){w=t.events[C][1].end;break}x(s);let j=S;for(;j<t.events.length;)t.events[j][1].end={...w},j++;return us(t.events,C+1,0,t.events.slice(S)),t.events.length=j,u(_)}return a(_)}function u(_){if(s===n.length){if(!r)return p(_);if(r.currentConstruct&&r.currentConstruct.concrete)return m(_);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(M1,d,h)(_)}function d(_){return r&&b(),x(s),p(_)}function h(_){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,m(_)}function p(_){return t.containerState={},e.attempt(M1,f,m)(_)}function f(_){return s++,n.push([t.currentConstruct,t.containerState]),p(_)}function m(_){if(_===null){r&&b(),x(0),e.consume(_);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),g(_)}function g(_){if(_===null){y(e.exit("chunkFlow"),!0),x(0),e.consume(_);return}return xe(_)?(e.consume(_),y(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(_),g)}function y(_,S){const C=t.sliceStream(_);if(S&&C.push(null),_.previous=i,i&&(i.next=_),i=_,r.defineSkip(_.start),r.write(C),t.parser.lazy[_.start.line]){let w=r.events.length;for(;w--;)if(r.events[w][1].start.offset<o&&(!r.events[w][1].end||r.events[w][1].end.offset>o))return;const j=t.events.length;let E=j,O,R;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){if(O){R=t.events[E][1].end;break}O=!0}for(x(s),w=j;w<t.events.length;)t.events[w][1].end={...R},w++;us(t.events,E+1,0,t.events.slice(j)),t.events.length=w}}function x(_){let S=n.length;for(;S-- >_;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=_}function b(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function Bz(e,t,n){return Be(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ul(e){if(e===null||Qe(e)||Qo(e))return 1;if(mp(e))return 2}function gp(e,t,n){const s=[];let r=-1;for(;++r<e.length;){const i=e[r].resolveAll;i&&!s.includes(i)&&(t=i(t,n),s.push(i))}return t}const Nv={name:"attention",resolveAll:zz,tokenize:$z};function zz(e,t){let n=-1,s,r,i,o,a,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[s][1].end},p={...e[n][1].start};L1(h,-c),L1(p,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[s][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},r={type:c>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[s][1].end={...o.start},e[n][1].start={...a.end},u=[],e[s][1].end.offset-e[s][1].start.offset&&(u=ks(u,[["enter",e[s][1],t],["exit",e[s][1],t]])),u=ks(u,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=ks(u,gp(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),u=ks(u,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=ks(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,us(e,s-1,n-s+3,u),n=s+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function $z(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,r=ul(s);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===i)return e.consume(c),a;const u=e.exit("attentionSequence"),d=ul(c),h=!d||d===2&&r||n.includes(c),p=!r||r===2&&d||n.includes(s);return u._open=!!(i===42?h:h&&(r||!p)),u._close=!!(i===42?p:p&&(d||!h)),t(c)}}function L1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Hz={name:"autolink",tokenize:Wz};function Wz(e,t,n){let s=0;return r;function r(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(f){return Ln(f)?(e.consume(f),o):f===64?n(f):u(f)}function o(f){return f===43||f===45||f===46||Sn(f)?(s=1,a(f)):u(f)}function a(f){return f===58?(e.consume(f),s=0,c):(f===43||f===45||f===46||Sn(f))&&s++<32?(e.consume(f),a):(s=0,u(f))}function c(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||wf(f)?n(f):(e.consume(f),c)}function u(f){return f===64?(e.consume(f),d):Dz(f)?(e.consume(f),u):n(f)}function d(f){return Sn(f)?h(f):n(f)}function h(f){return f===46?(e.consume(f),s=0,d):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||Sn(f))&&s++<63){const m=f===45?p:h;return e.consume(f),m}return n(f)}}const Uu={partial:!0,tokenize:Uz};function Uz(e,t,n){return s;function s(i){return Me(i)?Be(e,r,"linePrefix")(i):r(i)}function r(i){return i===null||xe(i)?t(i):n(i)}}const JE={continuation:{tokenize:Kz},exit:Vz,name:"blockQuote",tokenize:qz};function qz(e,t,n){const s=this;return r;function r(o){if(o===62){const a=s.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Me(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Kz(e,t,n){const s=this;return r;function r(o){return Me(o)?Be(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(JE,t,n)(o)}}function Vz(e){e.exit("blockQuote")}const ZE={name:"characterEscape",tokenize:Yz};function Yz(e,t,n){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),r}function r(i){return Lz(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const e5={name:"characterReference",tokenize:Xz};function Xz(e,t,n){const s=this;let r=0,i,o;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=Sn,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Mz,d):(e.enter("characterReferenceValue"),i=7,o=Cv,d(h))}function d(h){if(h===59&&r){const p=e.exit("characterReferenceValue");return o===Sn&&!z0(s.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&r++<i?(e.consume(h),d):n(h)}}const A1={partial:!0,tokenize:Gz},O1={concrete:!0,name:"codeFenced",tokenize:Qz};function Qz(e,t,n){const s=this,r={partial:!0,tokenize:C};let i=0,o=0,a;return c;function c(w){return u(w)}function u(w){const j=s.events[s.events.length-1];return i=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,a=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(w)}function d(w){return w===a?(o++,e.consume(w),d):o<3?n(w):(e.exit("codeFencedFenceSequence"),Me(w)?Be(e,h,"whitespace")(w):h(w))}function h(w){return w===null||xe(w)?(e.exit("codeFencedFence"),s.interrupt?t(w):e.check(A1,g,S)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||xe(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(w)):Me(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Be(e,f,"whitespace")(w)):w===96&&w===a?n(w):(e.consume(w),p)}function f(w){return w===null||xe(w)?h(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||xe(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(w)):w===96&&w===a?n(w):(e.consume(w),m)}function g(w){return e.attempt(r,S,y)(w)}function y(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),x}function x(w){return i>0&&Me(w)?Be(e,b,"linePrefix",i+1)(w):b(w)}function b(w){return w===null||xe(w)?e.check(A1,g,S)(w):(e.enter("codeFlowValue"),_(w))}function _(w){return w===null||xe(w)?(e.exit("codeFlowValue"),b(w)):(e.consume(w),_)}function S(w){return e.exit("codeFenced"),t(w)}function C(w,j,E){let O=0;return R;function R(P){return w.enter("lineEnding"),w.consume(P),w.exit("lineEnding"),B}function B(P){return w.enter("codeFencedFence"),Me(P)?Be(w,L,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):L(P)}function L(P){return P===a?(w.enter("codeFencedFenceSequence"),D(P)):E(P)}function D(P){return P===a?(O++,w.consume(P),D):O>=o?(w.exit("codeFencedFenceSequence"),Me(P)?Be(w,T,"whitespace")(P):T(P)):E(P)}function T(P){return P===null||xe(P)?(w.exit("codeFencedFence"),j(P)):E(P)}}}function Gz(e,t,n){const s=this;return r;function r(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}const Dm={name:"codeIndented",tokenize:Zz},Jz={partial:!0,tokenize:e$};function Zz(e,t,n){const s=this;return r;function r(u){return e.enter("codeIndented"),Be(e,i,"linePrefix",5)(u)}function i(u){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):xe(u)?e.attempt(Jz,o,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||xe(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function e$(e,t,n){const s=this;return r;function r(o){return s.parser.lazy[s.now().line]?n(o):xe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):Be(e,i,"linePrefix",5)(o)}function i(o){const a=s.events[s.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):xe(o)?r(o):n(o)}}const t$={name:"codeText",previous:s$,resolve:n$,tokenize:r$};function n$(e){let t=e.length-4,n=3,s,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)r===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(r=s):(s===t||e[s][1].type==="lineEnding")&&(e[r][1].type="codeTextData",s!==r+2&&(e[r][1].end=e[s-1][1].end,e.splice(r+2,s-r-2),t-=s-r-2,s=r+2),r=void 0);return e}function s$(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function r$(e,t,n){let s=0,r,i;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),a(h)}function a(h){return h===96?(e.consume(h),s++,a):(e.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(i=e.enter("codeTextSequence"),r=0,d(h)):xe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||xe(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),r++,d):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class i${constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const r=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return s&&Xl(this.left,s),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Xl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Xl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Xl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Xl(this.left,n.reverse())}}}function Xl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function t5(e){const t={};let n=-1,s,r,i,o,a,c,u;const d=new i$(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(s=d.get(n),n&&s[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=s[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,o$(d,n)),n=t[n],u=!0);else if(s[1]._container){for(i=n,r=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(r&&(d.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;r&&(s[1].end={...d.get(r)[1].start},a=d.slice(r,n),a.unshift(s),d.splice(r,n-r+1,a))}}return us(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function o$(e,t){const n=e.get(t)[1],s=e.get(t)[2];let r=t-1;const i=[];let o=n._tokenizer;o||(o=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,c=[],u={};let d,h,p=-1,f=n,m=0,g=0;const y=[g];for(;f;){for(;e.get(++r)[1]!==f;);i.push(r),f._tokenizer||(d=s.sliceStream(f),f.next||d.push(null),h&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=f,f=f.next}for(f=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(g=p+1,y.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):y.pop(),p=y.length;p--;){const x=a.slice(y[p],y[p+1]),b=i.pop();c.push([b,b+x.length-1]),e.splice(b,2,x)}for(c.reverse(),p=-1;++p<c.length;)u[m+c[p][0]]=m+c[p][1],m+=c[p][1]-c[p][0]-1;return u}const a$={resolve:c$,tokenize:u$},l$={partial:!0,tokenize:d$};function c$(e){return t5(e),e}function u$(e,t){let n;return s;function s(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(a)}function r(a){return a===null?i(a):xe(a)?e.check(l$,o,i)(a):(e.consume(a),r)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}function d$(e,t,n){const s=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Be(e,i,"linePrefix")}function i(o){if(o===null||xe(o))return n(o);const a=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(s.parser.constructs.flow,n,t)(o)}}function n5(e,t,n,s,r,i,o,a,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(x){return x===60?(e.enter(s),e.enter(r),e.enter(i),e.consume(x),e.exit(i),p):x===null||x===32||x===41||wf(x)?n(x):(e.enter(s),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),g(x))}function p(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(r),e.exit(s),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(x))}function f(x){return x===62?(e.exit("chunkString"),e.exit(a),p(x)):x===null||x===60||xe(x)?n(x):(e.consume(x),x===92?m:f)}function m(x){return x===60||x===62||x===92?(e.consume(x),f):f(x)}function g(x){return!d&&(x===null||x===41||Qe(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(s),t(x)):d<u&&x===40?(e.consume(x),d++,g):x===41?(e.consume(x),d--,g):x===null||x===32||x===40||wf(x)?n(x):(e.consume(x),x===92?y:g)}function y(x){return x===40||x===41||x===92?(e.consume(x),g):g(x)}}function s5(e,t,n,s,r,i){const o=this;let a=0,c;return u;function u(f){return e.enter(s),e.enter(r),e.consume(f),e.exit(r),e.enter(i),d}function d(f){return a>999||f===null||f===91||f===93&&!c||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(i),e.enter(r),e.consume(f),e.exit(r),e.exit(s),t):xe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||xe(f)||a++>999?(e.exit("chunkString"),d(f)):(e.consume(f),c||(c=!Me(f)),f===92?p:h)}function p(f){return f===91||f===92||f===93?(e.consume(f),a++,h):h(f)}}function r5(e,t,n,s,r,i){let o;return a;function a(p){return p===34||p===39||p===40?(e.enter(s),e.enter(r),e.consume(p),e.exit(r),o=p===40?41:p,c):n(p)}function c(p){return p===o?(e.enter(r),e.consume(p),e.exit(r),e.exit(s),t):(e.enter(i),u(p))}function u(p){return p===o?(e.exit(i),c(o)):p===null?n(p):xe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Be(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===o||p===null||xe(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===o||p===92?(e.consume(p),d):d(p)}}function Lc(e,t){let n;return s;function s(r){return xe(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,s):Me(r)?Be(e,s,n?"linePrefix":"lineSuffix")(r):t(r)}}const h$={name:"definition",tokenize:p$},f$={partial:!0,tokenize:m$};function p$(e,t,n){const s=this;let r;return i;function i(f){return e.enter("definition"),o(f)}function o(f){return s5.call(s,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return r=Us(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),c):n(f)}function c(f){return Qe(f)?Lc(e,u)(f):u(f)}function u(f){return n5(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(f$,h,h)(f)}function h(f){return Me(f)?Be(e,p,"whitespace")(f):p(f)}function p(f){return f===null||xe(f)?(e.exit("definition"),s.parser.defined.push(r),t(f)):n(f)}}function m$(e,t,n){return s;function s(a){return Qe(a)?Lc(e,r)(a):n(a)}function r(a){return r5(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Me(a)?Be(e,o,"whitespace")(a):o(a)}function o(a){return a===null||xe(a)?t(a):n(a)}}const g$={name:"hardBreakEscape",tokenize:x$};function x$(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),r}function r(i){return xe(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const v$={name:"headingAtx",resolve:y$,tokenize:b$};function y$(e,t){let n=e.length-2,s=3,r,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(r={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},us(e,s,n-s+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]])),e}function b$(e,t,n){let s=0;return r;function r(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&s++<6?(e.consume(d),o):d===null||Qe(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||xe(d)?(e.exit("atxHeading"),t(d)):Me(d)?Be(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||Qe(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const _$=["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"],I1=["pre","script","style","textarea"],w$={concrete:!0,name:"htmlFlow",resolveTo:C$,tokenize:N$},S$={partial:!0,tokenize:E$},k$={partial:!0,tokenize:j$};function C$(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function N$(e,t,n){const s=this;let r,i,o,a,c;return u;function u(N){return d(N)}function d(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),h}function h(N){return N===33?(e.consume(N),p):N===47?(e.consume(N),i=!0,g):N===63?(e.consume(N),r=3,s.interrupt?t:k):Ln(N)?(e.consume(N),o=String.fromCharCode(N),y):n(N)}function p(N){return N===45?(e.consume(N),r=2,f):N===91?(e.consume(N),r=5,a=0,m):Ln(N)?(e.consume(N),r=4,s.interrupt?t:k):n(N)}function f(N){return N===45?(e.consume(N),s.interrupt?t:k):n(N)}function m(N){const z="CDATA[";return N===z.charCodeAt(a++)?(e.consume(N),a===z.length?s.interrupt?t:L:m):n(N)}function g(N){return Ln(N)?(e.consume(N),o=String.fromCharCode(N),y):n(N)}function y(N){if(N===null||N===47||N===62||Qe(N)){const z=N===47,U=o.toLowerCase();return!z&&!i&&I1.includes(U)?(r=1,s.interrupt?t(N):L(N)):_$.includes(o.toLowerCase())?(r=6,z?(e.consume(N),x):s.interrupt?t(N):L(N)):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(N):i?b(N):_(N))}return N===45||Sn(N)?(e.consume(N),o+=String.fromCharCode(N),y):n(N)}function x(N){return N===62?(e.consume(N),s.interrupt?t:L):n(N)}function b(N){return Me(N)?(e.consume(N),b):R(N)}function _(N){return N===47?(e.consume(N),R):N===58||N===95||Ln(N)?(e.consume(N),S):Me(N)?(e.consume(N),_):R(N)}function S(N){return N===45||N===46||N===58||N===95||Sn(N)?(e.consume(N),S):C(N)}function C(N){return N===61?(e.consume(N),w):Me(N)?(e.consume(N),C):_(N)}function w(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),c=N,j):Me(N)?(e.consume(N),w):E(N)}function j(N){return N===c?(e.consume(N),c=null,O):N===null||xe(N)?n(N):(e.consume(N),j)}function E(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||Qe(N)?C(N):(e.consume(N),E)}function O(N){return N===47||N===62||Me(N)?_(N):n(N)}function R(N){return N===62?(e.consume(N),B):n(N)}function B(N){return N===null||xe(N)?L(N):Me(N)?(e.consume(N),B):n(N)}function L(N){return N===45&&r===2?(e.consume(N),$):N===60&&r===1?(e.consume(N),W):N===62&&r===4?(e.consume(N),F):N===63&&r===3?(e.consume(N),k):N===93&&r===5?(e.consume(N),H):xe(N)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(S$,M,D)(N)):N===null||xe(N)?(e.exit("htmlFlowData"),D(N)):(e.consume(N),L)}function D(N){return e.check(k$,T,M)(N)}function T(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),P}function P(N){return N===null||xe(N)?D(N):(e.enter("htmlFlowData"),L(N))}function $(N){return N===45?(e.consume(N),k):L(N)}function W(N){return N===47?(e.consume(N),o="",I):L(N)}function I(N){if(N===62){const z=o.toLowerCase();return I1.includes(z)?(e.consume(N),F):L(N)}return Ln(N)&&o.length<8?(e.consume(N),o+=String.fromCharCode(N),I):L(N)}function H(N){return N===93?(e.consume(N),k):L(N)}function k(N){return N===62?(e.consume(N),F):N===45&&r===2?(e.consume(N),k):L(N)}function F(N){return N===null||xe(N)?(e.exit("htmlFlowData"),M(N)):(e.consume(N),F)}function M(N){return e.exit("htmlFlow"),t(N)}}function j$(e,t,n){const s=this;return r;function r(o){return xe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}function E$(e,t,n){return s;function s(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Uu,t,n)}}const P$={name:"htmlText",tokenize:T$};function T$(e,t,n){const s=this;let r,i,o;return a;function a(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),c}function c(k){return k===33?(e.consume(k),u):k===47?(e.consume(k),C):k===63?(e.consume(k),_):Ln(k)?(e.consume(k),E):n(k)}function u(k){return k===45?(e.consume(k),d):k===91?(e.consume(k),i=0,m):Ln(k)?(e.consume(k),b):n(k)}function d(k){return k===45?(e.consume(k),f):n(k)}function h(k){return k===null?n(k):k===45?(e.consume(k),p):xe(k)?(o=h,W(k)):(e.consume(k),h)}function p(k){return k===45?(e.consume(k),f):h(k)}function f(k){return k===62?$(k):k===45?p(k):h(k)}function m(k){const F="CDATA[";return k===F.charCodeAt(i++)?(e.consume(k),i===F.length?g:m):n(k)}function g(k){return k===null?n(k):k===93?(e.consume(k),y):xe(k)?(o=g,W(k)):(e.consume(k),g)}function y(k){return k===93?(e.consume(k),x):g(k)}function x(k){return k===62?$(k):k===93?(e.consume(k),x):g(k)}function b(k){return k===null||k===62?$(k):xe(k)?(o=b,W(k)):(e.consume(k),b)}function _(k){return k===null?n(k):k===63?(e.consume(k),S):xe(k)?(o=_,W(k)):(e.consume(k),_)}function S(k){return k===62?$(k):_(k)}function C(k){return Ln(k)?(e.consume(k),w):n(k)}function w(k){return k===45||Sn(k)?(e.consume(k),w):j(k)}function j(k){return xe(k)?(o=j,W(k)):Me(k)?(e.consume(k),j):$(k)}function E(k){return k===45||Sn(k)?(e.consume(k),E):k===47||k===62||Qe(k)?O(k):n(k)}function O(k){return k===47?(e.consume(k),$):k===58||k===95||Ln(k)?(e.consume(k),R):xe(k)?(o=O,W(k)):Me(k)?(e.consume(k),O):$(k)}function R(k){return k===45||k===46||k===58||k===95||Sn(k)?(e.consume(k),R):B(k)}function B(k){return k===61?(e.consume(k),L):xe(k)?(o=B,W(k)):Me(k)?(e.consume(k),B):O(k)}function L(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),r=k,D):xe(k)?(o=L,W(k)):Me(k)?(e.consume(k),L):(e.consume(k),T)}function D(k){return k===r?(e.consume(k),r=void 0,P):k===null?n(k):xe(k)?(o=D,W(k)):(e.consume(k),D)}function T(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||Qe(k)?O(k):(e.consume(k),T)}function P(k){return k===47||k===62||Qe(k)?O(k):n(k)}function $(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):n(k)}function W(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),I}function I(k){return Me(k)?Be(e,H,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):H(k)}function H(k){return e.enter("htmlTextData"),o(k)}}const $0={name:"labelEnd",resolveAll:L$,resolveTo:A$,tokenize:O$},R$={tokenize:I$},D$={tokenize:F$},M$={tokenize:B$};function L$(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const r=s.type==="labelImage"?4:2;s.type="data",t+=r}}return e.length!==n.length&&us(e,0,e.length,n),e}function A$(e,t){let n=e.length,s=0,r,i,o,a;for(;n--;)if(r=e[n][1],i){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[n][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(i=n,r.type!=="labelLink")){s=2;break}}else r.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[i+s+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",c,t],["enter",u,t]],a=ks(a,e.slice(i+1,i+s+3)),a=ks(a,[["enter",d,t]]),a=ks(a,gp(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),a=ks(a,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),a=ks(a,e.slice(o+1)),a=ks(a,[["exit",c,t]]),us(e,i,e.length,a),e}function O$(e,t,n){const s=this;let r=s.events.length,i,o;for(;r--;)if((s.events[r][1].type==="labelImage"||s.events[r][1].type==="labelLink")&&!s.events[r][1]._balanced){i=s.events[r][1];break}return a;function a(p){return i?i._inactive?h(p):(o=s.parser.defined.includes(Us(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(R$,d,o?d:h)(p):p===91?e.attempt(D$,d,o?u:h)(p):o?d(p):h(p)}function u(p){return e.attempt(M$,d,h)(p)}function d(p){return t(p)}function h(p){return i._balanced=!0,n(p)}}function I$(e,t,n){return s;function s(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),r}function r(h){return Qe(h)?Lc(e,i)(h):i(h)}function i(h){return h===41?d(h):n5(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Qe(h)?Lc(e,c)(h):d(h)}function a(h){return n(h)}function c(h){return h===34||h===39||h===40?r5(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Qe(h)?Lc(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function F$(e,t,n){const s=this;return r;function r(a){return s5.call(s,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return s.parser.defined.includes(Us(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function B$(e,t,n){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),r}function r(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const z$={name:"labelStartImage",resolveAll:$0.resolveAll,tokenize:$$};function $$(e,t,n){const s=this;return r;function r(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(a):t(a)}}const H$={name:"labelStartLink",resolveAll:$0.resolveAll,tokenize:W$};function W$(e,t,n){const s=this;return r;function r(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(o):t(o)}}const Mm={name:"lineEnding",tokenize:U$};function U$(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Be(e,t,"linePrefix")}}const kh={name:"thematicBreak",tokenize:q$};function q$(e,t,n){let s=0,r;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return r=u,a(u)}function a(u){return u===r?(e.enter("thematicBreakSequence"),c(u)):s>=3&&(u===null||xe(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===r?(e.consume(u),s++,c):(e.exit("thematicBreakSequence"),Me(u)?Be(e,a,"whitespace")(u):a(u))}}const Wn={continuation:{tokenize:X$},exit:G$,name:"list",tokenize:Y$},K$={partial:!0,tokenize:J$},V$={partial:!0,tokenize:Q$};function Y$(e,t,n){const s=this,r=s.events[s.events.length-1];let i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return a;function a(f){const m=s.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!s.containerState.marker||f===s.containerState.marker:Cv(f)){if(s.containerState.type||(s.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(kh,n,u)(f):u(f);if(!s.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(f)}return n(f)}function c(f){return Cv(f)&&++o<10?(e.consume(f),c):(!s.interrupt||o<2)&&(s.containerState.marker?f===s.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||f,e.check(Uu,s.interrupt?n:d,e.attempt(K$,p,h))}function d(f){return s.containerState.initialBlankLine=!0,i++,p(f)}function h(f){return Me(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function X$(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Uu,r,i);function r(a){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Be(e,t,"listItemIndent",s.containerState.size+1)(a)}function i(a){return s.containerState.furtherBlankLines||!Me(a)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(a)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(V$,t,o)(a))}function o(a){return s.containerState._closeFlow=!0,s.interrupt=void 0,Be(e,e.attempt(Wn,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Q$(e,t,n){const s=this;return Be(e,r,"listItemIndent",s.containerState.size+1);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?t(i):n(i)}}function G$(e){e.exit(this.containerState.type)}function J$(e,t,n){const s=this;return Be(e,r,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(i){const o=s.events[s.events.length-1];return!Me(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const F1={name:"setextUnderline",resolveTo:Z$,tokenize:e8};function Z$(e,t){let n=e.length,s,r,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(r=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[s][1],t]),e[s][1].end={...e[i][1].end}):e[s][1]=o,e.push(["exit",o,t]),e}function e8(e,t,n){const s=this;let r;return i;function i(u){let d=s.events.length,h;for(;d--;)if(s.events[d][1].type!=="lineEnding"&&s.events[d][1].type!=="linePrefix"&&s.events[d][1].type!=="content"){h=s.events[d][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||h)?(e.enter("setextHeadingLine"),r=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===r?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),Me(u)?Be(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||xe(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const t8={tokenize:n8};function n8(e){const t=this,n=e.attempt(Uu,s,e.attempt(this.parser.constructs.flowInitial,r,Be(e,e.attempt(this.parser.constructs.flow,r,e.attempt(a$,r)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function r(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const s8={resolveAll:o5()},r8=i5("string"),i8=i5("text");function i5(e){return{resolveAll:o5(e==="text"?o8:void 0),tokenize:t};function t(n){const s=this,r=this.parser.constructs[e],i=n.attempt(r,o,a);return o;function o(d){return u(d)?i(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const h=r[d];let p=-1;if(h)for(;++p<h.length;){const f=h[p];if(!f.previous||f.previous.call(s,s.previous))return!0}return!1}}}function o5(e){return t;function t(n,s){let r=-1,i;for(;++r<=n.length;)i===void 0?n[r]&&n[r][1].type==="data"&&(i=r,r++):(!n[r]||n[r][1].type!=="data")&&(r!==i+2&&(n[i][1].end=n[r-1][1].end,n.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(n,s):n}}function o8(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],r=t.sliceStream(s);let i=r.length,o=-1,a=0,c;for(;i--;){const u=r[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)c=!0,a++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-a,offset:s.end.offset-a},end:{...s.end}};s.end={...u.start},s.start.offset===s.end.offset?Object.assign(s,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const a8={42:Wn,43:Wn,45:Wn,48:Wn,49:Wn,50:Wn,51:Wn,52:Wn,53:Wn,54:Wn,55:Wn,56:Wn,57:Wn,62:JE},l8={91:h$},c8={[-2]:Dm,[-1]:Dm,32:Dm},u8={35:v$,42:kh,45:[F1,kh],60:w$,61:F1,95:kh,96:O1,126:O1},d8={38:e5,92:ZE},h8={[-5]:Mm,[-4]:Mm,[-3]:Mm,33:z$,38:e5,42:Nv,60:[Hz,P$],91:H$,92:[g$,ZE],93:$0,95:Nv,96:t$},f8={null:[Nv,s8]},p8={null:[42,95]},m8={null:[]},g8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:p8,contentInitial:l8,disable:m8,document:a8,flow:u8,flowInitial:c8,insideSpan:f8,string:d8,text:h8},Symbol.toStringTag,{value:"Module"}));function x8(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},i=[];let o=[],a=[];const c={attempt:j(C),check:j(w),consume:b,enter:_,exit:S,interrupt:j(w,{interrupt:!0})},u={code:null,containerState:{},defineSkip:g,events:[],now:m,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:h};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function h(B){return o=ks(o,B),y(),o[o.length-1]!==null?[]:(E(t,0),u.events=gp(i,u.events,u),u.events)}function p(B,L){return y8(f(B),L)}function f(B){return v8(o,B)}function m(){const{_bufferIndex:B,_index:L,line:D,column:T,offset:P}=s;return{_bufferIndex:B,_index:L,line:D,column:T,offset:P}}function g(B){r[B.line]=B.column,R()}function y(){let B;for(;s._index<o.length;){const L=o[s._index];if(typeof L=="string")for(B=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===B&&s._bufferIndex<L.length;)x(L.charCodeAt(s._bufferIndex));else x(L)}}function x(B){d=d(B)}function b(B){xe(B)?(s.line++,s.column=1,s.offset+=B===-3?2:1,R()):B!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),u.previous=B}function _(B,L){const D=L||{};return D.type=B,D.start=m(),u.events.push(["enter",D,u]),a.push(D),D}function S(B){const L=a.pop();return L.end=m(),u.events.push(["exit",L,u]),L}function C(B,L){E(B,L.from)}function w(B,L){L.restore()}function j(B,L){return D;function D(T,P,$){let W,I,H,k;return Array.isArray(T)?M(T):"tokenize"in T?M([T]):F(T);function F(K){return Q;function Q(Y){const Z=Y!==null&&K[Y],ue=Y!==null&&K.null,Oe=[...Array.isArray(Z)?Z:Z?[Z]:[],...Array.isArray(ue)?ue:ue?[ue]:[]];return M(Oe)(Y)}}function M(K){return W=K,I=0,K.length===0?$:N(K[I])}function N(K){return Q;function Q(Y){return k=O(),H=K,K.partial||(u.currentConstruct=K),K.name&&u.parser.constructs.disable.null.includes(K.name)?U():K.tokenize.call(L?Object.assign(Object.create(u),L):u,c,z,U)(Y)}}function z(K){return B(H,k),P}function U(K){return k.restore(),++I<W.length?N(W[I]):$}}}function E(B,L){B.resolveAll&&!i.includes(B)&&i.push(B),B.resolve&&us(u.events,L,u.events.length-L,B.resolve(u.events.slice(L),u)),B.resolveTo&&(u.events=B.resolveTo(u.events,u))}function O(){const B=m(),L=u.previous,D=u.currentConstruct,T=u.events.length,P=Array.from(a);return{from:T,restore:$};function $(){s=B,u.previous=L,u.currentConstruct=D,u.events.length=T,a=P,R()}}function R(){s.line in r&&s.column<2&&(s.column=r[s.line],s.offset+=r[s.line]-1)}}function v8(e,t){const n=t.start._index,s=t.start._bufferIndex,r=t.end._index,i=t.end._bufferIndex;let o;if(n===r)o=[e[n].slice(s,i)];else{if(o=e.slice(n,r),s>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(s):o.shift()}i>0&&o.push(e[r].slice(0,i))}return o}function y8(e,t){let n=-1;const s=[];let r;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
554
|
-
`;break}case-3:{o=`\r
|
|
555
|
-
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&r)continue;o=" ";break}default:o=String.fromCharCode(i)}r=i===-2,s.push(o)}return s.join("")}function b8(e){const s={constructs:QE([g8,...(e||{}).extensions||[]]),content:r(Az),defined:[],document:r(Iz),flow:r(t8),lazy:{},string:r(r8),text:r(i8)};return s;function r(i){return o;function o(a){return x8(s,i,a)}}}function _8(e){for(;!t5(e););return e}const B1=/[\0\t\n\r]/g;function w8(){let e=1,t="",n=!0,s;return r;function r(i,o,a){const c=[];let u,d,h,p,f;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(B1.lastIndex=h,u=B1.exec(i),p=u&&u.index!==void 0?u.index:i.length,f=i.charCodeAt(p),!u){t=i.slice(h);break}if(f===10&&h===p&&s)c.push(-3),s=void 0;else switch(s&&(c.push(-5),s=void 0),h<p&&(c.push(i.slice(h,p)),e+=p-h),f){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:s=!0,e=1}h=p+1}return a&&(s&&c.push(-5),t&&c.push(t),c.push(null)),c}}const S8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function k8(e){return e.replace(S8,C8)}function C8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),i=r===120||r===88;return GE(n.slice(i?2:1),i?16:10)}return z0(n)||e}const a5={}.hasOwnProperty;function N8(e,t,n){return typeof t!="string"&&(n=t,t=void 0),j8(n)(_8(b8(n).document().write(w8()(e,t,!0))))}function j8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ee),autolinkProtocol:O,autolinkEmail:O,atxHeading:i(Ut),blockQuote:i(ue),characterEscape:O,characterReference:O,codeFenced:i(Oe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(Oe,o),codeText:i(Re,o),codeTextData:O,data:O,codeFlowValue:O,definition:i(fe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ie),hardBreakEscape:i(sn),hardBreakTrailing:i(sn),htmlFlow:i(se,o),htmlFlowData:O,htmlText:i(se,o),htmlTextData:O,image:i(de),label:o,link:i(Ee),listItem:i(Ue),listItemValue:p,listOrdered:i(We,h),listUnordered:i(We),paragraph:i(wt),reference:N,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Ut),strong:i(ft),thematicBreak:i(Sr)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:Z,autolinkProtocol:Y,blockQuote:c(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:K,characterReference:Q,codeFenced:c(y),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:R,codeIndented:c(x),codeText:c(P),codeTextData:R,data:R,definition:c(),definitionDestinationString:S,definitionLabelString:b,definitionTitleString:_,emphasis:c(),hardBreakEscape:c(L),hardBreakTrailing:c(L),htmlFlow:c(D),htmlFlowData:R,htmlText:c(T),htmlTextData:R,image:c(W),label:H,labelText:I,lineEnding:B,link:c($),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:z,resourceDestinationString:k,resourceTitleString:F,resource:M,setextHeading:c(E),setextHeadingLineSequence:j,setextHeadingText:w,strong:c(),thematicBreak:c()}};l5(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(q){let ee={type:"root",children:[]};const ge={stack:[ee],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:d,data:n},ye=[];let ke=-1;for(;++ke<q.length;)if(q[ke][1].type==="listOrdered"||q[ke][1].type==="listUnordered")if(q[ke][0]==="enter")ye.push(ke);else{const it=ye.pop();ke=r(q,it,ke)}for(ke=-1;++ke<q.length;){const it=t[q[ke][0]];a5.call(it,q[ke][1].type)&&it[q[ke][1].type].call(Object.assign({sliceSerialize:q[ke][2].sliceSerialize},ge),q[ke][1])}if(ge.tokenStack.length>0){const it=ge.tokenStack[ge.tokenStack.length-1];(it[1]||z1).call(ge,void 0,it[0])}for(ee.position={start:ii(q.length>0?q[0][1].start:{line:1,column:1,offset:0}),end:ii(q.length>0?q[q.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke<t.transforms.length;)ee=t.transforms[ke](ee)||ee;return ee}function r(q,ee,ge){let ye=ee-1,ke=-1,it=!1,rn,qt,on,En;for(;++ye<=ge;){const Ge=q[ye];switch(Ge[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ge[0]==="enter"?ke++:ke--,En=void 0;break}case"lineEndingBlank":{Ge[0]==="enter"&&(rn&&!En&&!ke&&!on&&(on=ye),En=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:En=void 0}if(!ke&&Ge[0]==="enter"&&Ge[1].type==="listItemPrefix"||ke===-1&&Ge[0]==="exit"&&(Ge[1].type==="listUnordered"||Ge[1].type==="listOrdered")){if(rn){let ts=ye;for(qt=void 0;ts--;){const an=q[ts];if(an[1].type==="lineEnding"||an[1].type==="lineEndingBlank"){if(an[0]==="exit")continue;qt&&(q[qt][1].type="lineEndingBlank",it=!0),an[1].type="lineEnding",qt=ts}else if(!(an[1].type==="linePrefix"||an[1].type==="blockQuotePrefix"||an[1].type==="blockQuotePrefixWhitespace"||an[1].type==="blockQuoteMarker"||an[1].type==="listItemIndent"))break}on&&(!qt||on<qt)&&(rn._spread=!0),rn.end=Object.assign({},qt?q[qt][1].start:Ge[1].end),q.splice(qt||ye,0,["exit",rn,Ge[2]]),ye++,ge++}if(Ge[1].type==="listItemPrefix"){const ts={type:"listItem",_spread:!1,start:Object.assign({},Ge[1].start),end:void 0};rn=ts,q.splice(ye,0,["enter",ts,Ge[2]]),ye++,ge++,on=void 0,En=!0}}}return q[ee][1]._spread=it,ge}function i(q,ee){return ge;function ge(ye){a.call(this,q(ye),ye),ee&&ee.call(this,ye)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(q,ee,ge){this.stack[this.stack.length-1].children.push(q),this.stack.push(q),this.tokenStack.push([ee,ge||void 0]),q.position={start:ii(ee.start),end:void 0}}function c(q){return ee;function ee(ge){q&&q.call(this,ge),u.call(this,ge)}}function u(q,ee){const ge=this.stack.pop(),ye=this.tokenStack.pop();if(ye)ye[0].type!==q.type&&(ee?ee.call(this,q,ye[0]):(ye[1]||z1).call(this,q,ye[0]));else throw new Error("Cannot close `"+q.type+"` ("+Mc({start:q.start,end:q.end})+"): it’s not open");ge.position.end=ii(q.end)}function d(){return B0(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(q){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(q),10),this.data.expectingFirstListItemValue=void 0}}function f(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=q}function m(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=q}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.value=q.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.value=q.replace(/(\r?\n|\r)$/g,"")}function b(q){const ee=this.resume(),ge=this.stack[this.stack.length-1];ge.label=ee,ge.identifier=Us(this.sliceSerialize(q)).toLowerCase()}function _(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.title=q}function S(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.url=q}function C(q){const ee=this.stack[this.stack.length-1];if(!ee.depth){const ge=this.sliceSerialize(q).length;ee.depth=ge}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function j(q){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(q).codePointAt(0)===61?1:2}function E(){this.data.setextHeadingSlurpLineEnding=void 0}function O(q){const ge=this.stack[this.stack.length-1].children;let ye=ge[ge.length-1];(!ye||ye.type!=="text")&&(ye=pn(),ye.position={start:ii(q.start),end:void 0},ge.push(ye)),this.stack.push(ye)}function R(q){const ee=this.stack.pop();ee.value+=this.sliceSerialize(q),ee.position.end=ii(q.end)}function B(q){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ge=ee.children[ee.children.length-1];ge.position.end=ii(q.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ee.type)&&(O.call(this,q),R.call(this,q))}function L(){this.data.atHardBreak=!0}function D(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.value=q}function T(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.value=q}function P(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.value=q}function $(){const q=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";q.type+="Reference",q.referenceType=ee,delete q.url,delete q.title}else delete q.identifier,delete q.label;this.data.referenceType=void 0}function W(){const q=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";q.type+="Reference",q.referenceType=ee,delete q.url,delete q.title}else delete q.identifier,delete q.label;this.data.referenceType=void 0}function I(q){const ee=this.sliceSerialize(q),ge=this.stack[this.stack.length-2];ge.label=k8(ee),ge.identifier=Us(ee).toLowerCase()}function H(){const q=this.stack[this.stack.length-1],ee=this.resume(),ge=this.stack[this.stack.length-1];if(this.data.inReference=!0,ge.type==="link"){const ye=q.children;ge.children=ye}else ge.alt=ee}function k(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.url=q}function F(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.title=q}function M(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function z(q){const ee=this.resume(),ge=this.stack[this.stack.length-1];ge.label=ee,ge.identifier=Us(this.sliceSerialize(q)).toLowerCase(),this.data.referenceType="full"}function U(q){this.data.characterReferenceType=q.type}function K(q){const ee=this.sliceSerialize(q),ge=this.data.characterReferenceType;let ye;ge?(ye=GE(ee,ge==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ye=z0(ee);const ke=this.stack[this.stack.length-1];ke.value+=ye}function Q(q){const ee=this.stack.pop();ee.position.end=ii(q.end)}function Y(q){R.call(this,q);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(q)}function Z(q){R.call(this,q);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(q)}function ue(){return{type:"blockquote",children:[]}}function Oe(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function fe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ie(){return{type:"emphasis",children:[]}}function Ut(){return{type:"heading",depth:0,children:[]}}function sn(){return{type:"break"}}function se(){return{type:"html",value:""}}function de(){return{type:"image",title:null,url:"",alt:null}}function Ee(){return{type:"link",title:null,url:"",children:[]}}function We(q){return{type:"list",ordered:q.type==="listOrdered",start:null,spread:q._spread,children:[]}}function Ue(q){return{type:"listItem",spread:q._spread,checked:null,children:[]}}function wt(){return{type:"paragraph",children:[]}}function ft(){return{type:"strong",children:[]}}function pn(){return{type:"text",value:""}}function Sr(){return{type:"thematicBreak"}}}function ii(e){return{line:e.line,column:e.column,offset:e.offset}}function l5(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?l5(e,s):E8(e,s)}}function E8(e,t){let n;for(n in t)if(a5.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function z1(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Mc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Mc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Mc({start:t.start,end:t.end})+") is still open")}function P8(e){const t=this;t.parser=n;function n(s){return N8(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function T8(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function R8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
556
|
-
`}]}function D8(e,t){const n=t.value?t.value+`
|
|
557
|
-
`:"",s={},r=t.lang?t.lang.split(/\s+/):[];r.length>0&&(s.className=["language-"+r[0]]);let i={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function M8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function L8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function A8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),r=jl(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let o,a=e.footnoteCounts.get(s);a===void 0?(a=0,e.footnoteOrder.push(s),o=e.footnoteOrder.length):o=i+1,a+=1,e.footnoteCounts.set(s,a);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function O8(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function I8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function c5(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const r=e.all(t),i=r[0];i&&i.type==="text"?i.value="["+i.value:r.unshift({type:"text",value:"["});const o=r[r.length-1];return o&&o.type==="text"?o.value+=s:r.push({type:"text",value:s}),r}function F8(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return c5(e,t);const r={src:jl(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,i),e.applyData(t,i)}function B8(e,t){const n={src:jl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function z8(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function $8(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return c5(e,t);const r={href:jl(s.url||"")};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function H8(e,t){const n={href:jl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function W8(e,t,n){const s=e.all(t),r=n?U8(n):u5(t),i={},o=[];if(typeof t.checked=="boolean"){const d=s[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},s.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<s.length;){const d=s[a];(r||a!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
|
|
558
|
-
`}),d.type==="element"&&d.tagName==="p"&&!r?o.push(...d.children):o.push(d)}const c=s[s.length-1];c&&(r||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
|
|
559
|
-
`});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function U8(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=u5(n[s])}return t}function u5(e){const t=e.spread;return t??e.children.length>1}function q8(e,t){const n={},s=e.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++r<s.length;){const o=s[r];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function K8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function V8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Y8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function X8(e,t){const n=e.all(t),s=n.shift(),r=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],o),r.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=A0(t.children[1]),c=WE(t.children[t.children.length-1]);a&&c&&(o.position={start:a,end:c}),r.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function Q8(e,t,n){const s=n?n.children:void 0,i=(s?s.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<a;){const h=t.children[c],p={},f=o?o[c]:void 0;f&&(p.align=f);let m={type:"element",tagName:i,properties:p,children:[]};h&&(m.children=e.all(h),e.patch(h,m),m=e.applyData(h,m)),u.push(m)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function G8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const $1=9,H1=32;function J8(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),r=0;const i=[];for(;s;)i.push(W1(t.slice(r,s.index),r>0,!0),s[0]),r=s.index+s[0].length,s=n.exec(t);return i.push(W1(t.slice(r),r>0,!1)),i.join("")}function W1(e,t,n){let s=0,r=e.length;if(t){let i=e.codePointAt(s);for(;i===$1||i===H1;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(r-1);for(;i===$1||i===H1;)r--,i=e.codePointAt(r-1)}return r>s?e.slice(s,r):""}function Z8(e,t){const n={type:"text",value:J8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function e9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const t9={blockquote:T8,break:R8,code:D8,delete:M8,emphasis:L8,footnoteReference:A8,heading:O8,html:I8,imageReference:F8,image:B8,inlineCode:z8,linkReference:$8,link:H8,listItem:W8,list:q8,paragraph:K8,root:V8,strong:Y8,table:X8,tableCell:G8,tableRow:Q8,text:Z8,thematicBreak:e9,toml:Ed,yaml:Ed,definition:Ed,footnoteDefinition:Ed};function Ed(){}const d5=-1,xp=0,Ac=1,Sf=2,H0=3,W0=4,U0=5,q0=6,h5=7,f5=8,U1=typeof self=="object"?self:globalThis,n9=(e,t)=>{const n=(r,i)=>(e.set(i,r),r),s=r=>{if(e.has(r))return e.get(r);const[i,o]=t[r];switch(i){case xp:case d5:return n(o,r);case Ac:{const a=n([],r);for(const c of o)a.push(s(c));return a}case Sf:{const a=n({},r);for(const[c,u]of o)a[s(c)]=s(u);return a}case H0:return n(new Date(o),r);case W0:{const{source:a,flags:c}=o;return n(new RegExp(a,c),r)}case U0:{const a=n(new Map,r);for(const[c,u]of o)a.set(s(c),s(u));return a}case q0:{const a=n(new Set,r);for(const c of o)a.add(s(c));return a}case h5:{const{name:a,message:c}=o;return n(new U1[a](c),r)}case f5:return n(BigInt(o),r);case"BigInt":return n(Object(BigInt(o)),r);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new U1[i](o),r)};return s},q1=e=>n9(new Map,e)(0),da="",{toString:s9}={},{keys:r9}=Object,Ql=e=>{const t=typeof e;if(t!=="object"||!e)return[xp,t];const n=s9.call(e).slice(8,-1);switch(n){case"Array":return[Ac,da];case"Object":return[Sf,da];case"Date":return[H0,da];case"RegExp":return[W0,da];case"Map":return[U0,da];case"Set":return[q0,da];case"DataView":return[Ac,n]}return n.includes("Array")?[Ac,n]:n.includes("Error")?[h5,n]:[Sf,n]},Pd=([e,t])=>e===xp&&(t==="function"||t==="symbol"),i9=(e,t,n,s)=>{const r=(o,a)=>{const c=s.push(o)-1;return n.set(a,c),c},i=o=>{if(n.has(o))return n.get(o);let[a,c]=Ql(o);switch(a){case xp:{let d=o;switch(c){case"bigint":a=f5,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return r([d5],o)}return r([a,d],o)}case Ac:{if(c){let p=o;return c==="DataView"?p=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(o)),r([c,[...p]],o)}const d=[],h=r([a,d],o);for(const p of o)d.push(i(p));return h}case Sf:{if(c)switch(c){case"BigInt":return r([c,o.toString()],o);case"Boolean":case"Number":case"String":return r([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],h=r([a,d],o);for(const p of r9(o))(e||!Pd(Ql(o[p])))&&d.push([i(p),i(o[p])]);return h}case H0:return r([a,o.toISOString()],o);case W0:{const{source:d,flags:h}=o;return r([a,{source:d,flags:h}],o)}case U0:{const d=[],h=r([a,d],o);for(const[p,f]of o)(e||!(Pd(Ql(p))||Pd(Ql(f))))&&d.push([i(p),i(f)]);return h}case q0:{const d=[],h=r([a,d],o);for(const p of o)(e||!Pd(Ql(p)))&&d.push(i(p));return h}}const{message:u}=o;return r([a,{name:c,message:u}],o)};return i},K1=(e,{json:t,lossy:n}={})=>{const s=[];return i9(!(t||n),!!t,new Map,s)(e),s},kf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?q1(K1(e,t)):structuredClone(e):(e,t)=>q1(K1(e,t));function o9(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function a9(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function l9(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||o9,s=e.options.footnoteBackLabel||a9,r=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),p=jl(h.toLowerCase());let f=0;const m=[],g=e.footnoteCounts.get(h);for(;g!==void 0&&++f<=g;){m.length>0&&m.push({type:"text",value:" "});let b=typeof n=="string"?n:n(c,f);typeof b=="string"&&(b={type:"text",value:b}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(c,f),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const y=d[d.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const b=y.children[y.children.length-1];b&&b.type==="text"?b.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...m)}else d.push(...m);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(u,x),a.push(x)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...kf(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
|
|
560
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
561
|
-
`}]}}const vp=function(e){if(e==null)return h9;if(typeof e=="function")return yp(e);if(typeof e=="object")return Array.isArray(e)?c9(e):u9(e);if(typeof e=="string")return d9(e);throw new Error("Expected function, string, or object as test")};function c9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=vp(e[n]);return yp(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function u9(e){const t=e;return yp(n);function n(s){const r=s;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function d9(e){return yp(t);function t(n){return n&&n.type===e}}function yp(e){return t;function t(n,s,r){return!!(f9(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function h9(){return!0}function f9(e){return e!==null&&typeof e=="object"&&"type"in e}const p5=[],p9=!0,jv=!1,m9="skip";function m5(e,t,n,s){let r;typeof t=="function"&&typeof n!="function"?(s=n,n=t):r=t;const i=vp(r),o=s?-1:1;a(e,void 0,[])();function a(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const f=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=p5,m,g,y;if((!t||i(c,u,d[d.length-1]||void 0))&&(f=g9(n(c,d)),f[0]===jv))return f;if("children"in c&&c.children){const x=c;if(x.children&&f[0]!==m9)for(g=(s?x.children.length:-1)+o,y=d.concat(x);g>-1&&g<x.children.length;){const b=x.children[g];if(m=a(b,g,y)(),m[0]===jv)return m;g=typeof m[1]=="number"?m[1]:g+o}}return f}}}function g9(e){return Array.isArray(e)?e:typeof e=="number"?[p9,e]:e==null?p5:[e]}function K0(e,t,n,s){let r,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,r=n):(i=t,o=n,r=s),m5(e,i,a,r);function a(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return o(c,h,d)}}const Ev={}.hasOwnProperty,x9={};function v9(e,t){const n=t||x9,s=new Map,r=new Map,i=new Map,o={...t9,...n.handlers},a={all:u,applyData:b9,definitionById:s,footnoteById:r,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:y9,wrap:w9};return K0(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?s:r,p=String(d.identifier).toUpperCase();h.has(p)||h.set(p,d)}}),a;function c(d,h){const p=d.type,f=a.handlers[p];if(Ev.call(a.handlers,p)&&f)return f(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(p)){if("children"in d){const{children:g,...y}=d,x=kf(y);return x.children=a.all(d),x}return kf(d)}return(a.options.unknownHandler||_9)(a,d,h)}function u(d){const h=[];if("children"in d){const p=d.children;let f=-1;for(;++f<p.length;){const m=a.one(p[f],d);if(m){if(f&&p[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=V1(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=V1(g.value))}Array.isArray(m)?h.push(...m):h.push(m)}}}return h}}function y9(e,t){e.position&&(t.position=az(e))}function b9(e,t){let n=t;if(e&&e.data){const s=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const o="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,kf(i)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function _9(e,t){const n=t.data||{},s="value"in t&&!(Ev.call(n,"hProperties")||Ev.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function w9(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
562
|
-
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
563
|
-
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
564
|
-
`}),n}function V1(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Y1(e,t){const n=v9(e,t),s=n.one(e,void 0),r=l9(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
|
|
565
|
-
`},r),i}function S9(e,t){return e&&"run"in e?async function(n,s){const r=Y1(n,{file:s,...t});await e.run(r,s)}:function(n,s){return Y1(n,{file:s,...e||t})}}function X1(e){if(e)throw e}var Ch=Object.prototype.hasOwnProperty,g5=Object.prototype.toString,Q1=Object.defineProperty,G1=Object.getOwnPropertyDescriptor,J1=function(t){return typeof Array.isArray=="function"?Array.isArray(t):g5.call(t)==="[object Array]"},Z1=function(t){if(!t||g5.call(t)!=="[object Object]")return!1;var n=Ch.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&Ch.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var r;for(r in t);return typeof r>"u"||Ch.call(t,r)},eS=function(t,n){Q1&&n.name==="__proto__"?Q1(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},tS=function(t,n){if(n==="__proto__")if(Ch.call(t,n)){if(G1)return G1(t,n).value}else return;return t[n]},k9=function e(){var t,n,s,r,i,o,a=arguments[0],c=1,u=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},c=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)s=tS(a,n),r=tS(t,n),a!==r&&(d&&r&&(Z1(r)||(i=J1(r)))?(i?(i=!1,o=s&&J1(s)?s:[]):o=s&&Z1(s)?s:{},eS(a,{name:n,newValue:e(d,o,r)})):typeof r<"u"&&eS(a,{name:n,newValue:r}));return a};const Lm=ml(k9);function Pv(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function C9(){const e=[],t={run:n,use:s};return t;function n(...r){let i=-1;const o=r.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...r);function a(c,...u){const d=e[++i];let h=-1;if(c){o(c);return}for(;++h<r.length;)(u[h]===null||u[h]===void 0)&&(u[h]=r[h]);r=u,d?N9(d,a)(...u):o(null,...u)}}function s(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function N9(e,t){let n;return s;function s(...o){const a=e.length>o.length;let c;a&&o.push(r);try{c=e.apply(this,o)}catch(u){const d=u;if(a&&n)throw d;return r(d)}a||(c&&c.then&&typeof c.then=="function"?c.then(i,r):c instanceof Error?r(c):i(c))}function r(o,...a){n||(n=!0,t(o,...a))}function i(o){r(null,o)}}const tr={basename:j9,dirname:E9,extname:P9,join:T9,sep:"/"};function j9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');qu(e);let n=0,s=-1,r=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else s<0&&(i=!0,s=r+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let o=-1,a=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else o<0&&(i=!0,o=r+1),a>-1&&(e.codePointAt(r)===t.codePointAt(a--)?a<0&&(s=r):(a=-1,s=o));return n===s?s=o:s<0&&(s=e.length),e.slice(n,s)}function E9(e){if(qu(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function P9(e){qu(e);let t=e.length,n=-1,s=0,r=-1,i=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){s=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?r<0?r=t:i!==1&&(i=1):r>-1&&(i=-1)}return r<0||n<0||i===0||i===1&&r===n-1&&r===s+1?"":e.slice(r,n)}function T9(...e){let t=-1,n;for(;++t<e.length;)qu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":R9(n)}function R9(e){qu(e);const t=e.codePointAt(0)===47;let n=D9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function D9(e,t){let n="",s=0,r=-1,i=0,o=-1,a,c;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(r===o-1||i===1))if(r!==o-1&&i===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),r=o,i=0;continue}}else if(n.length>0){n="",s=0,r=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(r+1,o):n=e.slice(r+1,o),s=o-r-1;r=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function qu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const M9={cwd:L9};function L9(){return"/"}function Tv(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function A9(e){if(typeof e=="string")e=new URL(e);else if(!Tv(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return O9(e)}function O9(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(t)}const Am=["history","path","basename","stem","extname","dirname"];class x5{constructor(t){let n;t?Tv(t)?n={path:t}:typeof t=="string"||I9(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":M9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Am.length;){const i=Am[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let r;for(r in n)Am.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?tr.basename(this.path):void 0}set basename(t){Im(t,"basename"),Om(t,"basename"),this.path=tr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?tr.dirname(this.path):void 0}set dirname(t){nS(this.basename,"dirname"),this.path=tr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?tr.extname(this.path):void 0}set extname(t){if(Om(t,"extname"),nS(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=tr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Tv(t)&&(t=A9(t)),Im(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?tr.basename(this.path,this.extname):void 0}set stem(t){Im(t,"stem"),Om(t,"stem"),this.path=tr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const r=this.message(t,n,s);throw r.fatal=!0,r}info(t,n,s){const r=this.message(t,n,s);return r.fatal=void 0,r}message(t,n,s){const r=new jn(t,n,s);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Om(e,t){if(e&&e.includes(tr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+tr.sep+"`")}function Im(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function nS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function I9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const F9=function(e){const s=this.constructor.prototype,r=s[e],i=function(){return r.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},B9={}.hasOwnProperty;class V0 extends F9{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=C9()}copy(){const t=new V0;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Lm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(zm("data",this.frozen),this.namespace[t]=n,this):B9.call(this.namespace,t)&&this.namespace[t]||void 0:t?(zm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const r=n.call(t,...s);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Td(t),s=this.parser||this.Parser;return Fm("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Fm("process",this.parser||this.Parser),Bm("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(i,o){const a=Td(t),c=s.parse(a);s.run(c,a,function(d,h,p){if(d||!h||!p)return u(d);const f=h,m=s.stringify(f,p);H9(m)?p.value=m:p.result=m,u(d,p)});function u(d,h){d||!h?o(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,s;return this.freeze(),Fm("processSync",this.parser||this.Parser),Bm("processSync",this.compiler||this.Compiler),this.process(t,r),rS("processSync","process",n),s;function r(i,o){n=!0,X1(i),s=o}}run(t,n,s){sS(t),this.freeze();const r=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(o,a){const c=Td(n);r.run(t,c,u);function u(d,h,p){const f=h||t;d?a(d):o?o(f):s(void 0,f,p)}}}runSync(t,n){let s=!1,r;return this.run(t,n,i),rS("runSync","run",s),r;function i(o,a){X1(o),r=a,s=!0}}stringify(t,n){this.freeze();const s=Td(n),r=this.compiler||this.Compiler;return Bm("stringify",r),sS(t),r(t,s)}use(t,...n){const s=this.attachers,r=this.namespace;if(zm("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(d,h)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))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");a(u.plugins),u.settings&&(r.settings=Lm(!0,r.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,p=-1;for(;++h<s.length;)if(s[h][0]===u){p=h;break}if(p===-1)s.push([u,...d]);else if(d.length>0){let[f,...m]=d;const g=s[p][1];Pv(g)&&Pv(f)&&(f=Lm(!0,g,f)),s[p]=[u,f,...m]}}}}const z9=new V0().freeze();function Fm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Bm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function zm(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function sS(e){if(!Pv(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function rS(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Td(e){return $9(e)?e:new x5(e)}function $9(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function H9(e){return typeof e=="string"||W9(e)}function W9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const U9="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",iS=[],oS={allowDangerousHtml:!0},q9=/^(https?|ircs?|mailto|xmpp)$/i,K9=[{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 Rv(e){const t=V9(e),n=Y9(e);return X9(t.runSync(t.parse(n),n),e)}function V9(e){const t=e.rehypePlugins||iS,n=e.remarkPlugins||iS,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...oS}:oS;return z9().use(P8).use(n).use(S9,s).use(t)}function Y9(e){const t=e.children||"",n=new x5;return typeof t=="string"&&(n.value=t),n}function X9(e,t){const n=t.allowedElements,s=t.allowElement,r=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||Q9;for(const d of K9)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+U9+d.id,void 0);return K0(e,u),hz(e,{Fragment:l.Fragment,components:r,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,h,p){if(d.type==="raw"&&p&&typeof h=="number")return o?p.children.splice(h,1):p.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let f;for(f in Rm)if(Object.hasOwn(Rm,f)&&Object.hasOwn(d.properties,f)){const m=d.properties[f],g=Rm[f];(g===null||g.includes(d.tagName))&&(d.properties[f]=c(String(m||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!f&&s&&typeof h=="number"&&(f=!s(d,h,p)),f&&p&&typeof h=="number")return a&&d.children?p.children.splice(h,1,...d.children):p.children.splice(h,1),h}}}function Q9(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),r=e.indexOf("/");return t===-1||r!==-1&&t>r||n!==-1&&t>n||s!==-1&&t>s||q9.test(e.slice(0,t))?e:""}function Nh(e){const t=Date.now(),n=new Date(e).getTime(),s=t-n;if(s<0)return"just now";const r=Math.floor(s/1e3);if(r<60)return"just now";const i=Math.floor(r/60);if(i<60)return`${i}m ago`;const o=Math.floor(i/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Rd(e,t=30){return Date.now()-new Date(e).getTime()>t*60*1e3}function G9(e){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(e),!0;const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),document.body.removeChild(t),!0}catch{return document.body.removeChild(t),!1}}function Gl(e){return e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:e>0?`$${e.toFixed(3)}`:"$0.00"}function Dd(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Md(e){return e.includes("opus-4-6")||e.includes("opus-4.6")?"Opus 4.6":e.includes("opus-4-5")||e.includes("opus-4.5")?"Opus 4.5":e.includes("opus-4-1")?"Opus 4.1":e.includes("opus-4")||e.includes("opus")?"Opus 4":e.includes("sonnet-4-5")||e.includes("sonnet-4.5")?"Sonnet 4.5":e.includes("sonnet-4")||e.includes("sonnet")?"Sonnet 4":e.includes("haiku-4-5")||e.includes("haiku-4.5")?"Haiku 4.5":e.includes("haiku-3")?"Haiku 3":e.includes("haiku")?"Haiku 4.5":e}async function J9(e){const t=await fetch(`/api/agents/${e}/output?lines=200`);if(!t.ok)throw new Error("Failed to fetch output");return(await t.json()).output||""}async function Z9(e){try{const t=await fetch(`/api/mission-control/planning/${e}`);return t.ok&&(await t.json()).prd||null}catch{return null}}function eH({history:e}){const[t,n]=v.useState(!1),s=[...e].reverse();return l.jsxs("div",{className:"mt-2 border-t border-border/30 pt-1.5",children:[l.jsxs("button",{onClick:()=>n(!t),className:"flex items-center gap-1 text-[10px] text-content-muted hover:text-content-subtle",children:[l.jsx("span",{children:t?"▾":"▸"}),l.jsxs("span",{children:["History (",e.length,")"]})]}),t&&l.jsx("div",{className:"mt-1 space-y-0.5",children:s.map((r,i)=>l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[l.jsx("span",{className:"text-content-muted w-12 shrink-0",children:Nh(r.timestamp)}),l.jsx("span",{className:r.type==="review"?"text-blue-400":r.type==="test"?"text-purple-400":"text-green-400",children:r.type}),l.jsx("span",{className:r.status==="passed"?"text-green-400":r.status==="failed"||r.status==="blocked"?"text-red-400":["reviewing","testing","merging"].includes(r.status)?"text-yellow-400":"text-content-muted",children:r.status}),r.notes&&l.jsxs("span",{className:"text-content-muted truncate",title:r.notes,children:["— ",r.notes.slice(0,60),r.notes.length>60?"...":""]})]},i))})]})}function tH({agent:e,issueId:t,issueUrl:n,issue:s,onClose:r}){var En,Ge,ts,an,to;const i=Nt(),o=yr(),[a,c]=v.useState(""),[u,d]=v.useState(!1),[h,p]=v.useState("logs"),f=v.useRef(null),m=v.useRef(null),[g,y]=v.useState(!0),x=e?`tmux attach -t ${e.id}`:"",[b,_]=v.useState(!1),[S,C]=v.useState(!1),{data:w,refetch:j}=he({queryKey:["agent-output",e==null?void 0:e.id],queryFn:()=>J9(e.id),refetchInterval:(e==null?void 0:e.status)==="stopped"?!1:1e3,enabled:!!e}),[E,O]=v.useState(!1),[R,B]=v.useState(!1),[L,D]=v.useState(0),{data:T}=he({queryKey:["workspace",t],queryFn:async()=>{const X=await fetch(`/api/workspaces/${t}`);if(!X.ok)throw new Error("Failed to fetch workspace info");const ae=await X.json();if(ae.exists&&E&&O(!1),R&&ae.containers){const De=Object.values(ae.containers),He=De.every(Se=>Se.running),pe=Date.now()-L>2e4,be=De.some(Se=>{var tt;return(tt=Se.status)==null?void 0:tt.startsWith("exited")});(He||pe&&be)&&B(!1)}return ae},refetchInterval:E||R?2e3:5e3}),{data:P}=he({queryKey:["review-status",t],queryFn:async()=>{const X=await fetch(`/api/workspaces/${t}/review-status`);if(!X.ok)throw new Error("Failed to fetch review status");return X.json()},refetchInterval:3e4}),{data:$}=he({queryKey:["prd",t],queryFn:()=>Z9(t),staleTime:6e4}),{data:W}=he({queryKey:["issueCosts",t],queryFn:async()=>{const X=await fetch(`/api/issues/${t}/costs`);if(!X.ok)throw new Error("Failed to fetch costs");return X.json()},refetchInterval:3e4,staleTime:1e4}),I=we({mutationFn:async()=>{var ae;const X=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:t,projectId:(ae=s==null?void 0:s.project)==null?void 0:ae.id})});if(!X.ok)throw new Error("Failed to start agent");return X.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["agents"]})},2e3)}}),H=we({mutationFn:async()=>{var ae;const X=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:t,projectId:(ae=s==null?void 0:s.project)==null?void 0:ae.id})});if(!X.ok)throw new Error("Failed to create workspace");return X.json()},onSuccess:()=>{O(!0),i.invalidateQueries({queryKey:["workspace",t]})}}),k=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to start containers")}return X.json()},onSuccess:()=>{B(!0),D(Date.now()),setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},5e3),setTimeout(()=>B(!1),9e4)}}),[F,M]=v.useState(null);v.useEffect(()=>{const X=()=>M(null);if(F)return document.addEventListener("click",X),()=>document.removeEventListener("click",X)},[F]);const N=we({mutationFn:async({containerName:X,action:ae})=>{const De=await fetch(`/api/workspaces/${t}/containers/${X}/${ae}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!De.ok){const He=await De.json();throw new Error(He.error||`Failed to ${ae} container`)}return De.json()},onSuccess:()=>{M(null),setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},2e3)}}),z=(X,ae,De)=>{X.preventDefault(),M({x:X.clientX,y:X.clientY,containerName:ae,isRunning:De})},U=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/containerize`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to containerize workspace")}return X.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},3e3)}}),K=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/review`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to start review")}return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["review-status",t]})}}),Q=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/merge`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to merge")}return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]}),i.invalidateQueries({queryKey:["issues"]}),i.invalidateQueries({queryKey:["review-status",t]}),r()}}),Y=we({mutationFn:async()=>{const X=await fetch(`/api/issues/${t}/close`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Closed manually"})});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to close issue")}return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]}),i.invalidateQueries({queryKey:["issues"]}),r()}}),Z=we({mutationFn:async X=>{const ae=await fetch(`/api/issues/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:X})});if(!ae.ok){const De=await ae.json();throw new Error(De.error||"Failed to reopen issue")}return ae.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["review-status",t]}),i.invalidateQueries({queryKey:["issues"]})}}),ue=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/reset-review`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to reset review cycles")}return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["review-status",t]}),i.invalidateQueries({queryKey:["issues"]})}}),Oe=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/pending`,{method:"DELETE"});if(!X.ok)throw new Error("Failed to dismiss");return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]})}}),Re=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/clean`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to clean workspace")}return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]})}}),fe=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/sync-main`,{method:"POST",headers:{"Content-Type":"application/json"}}),ae=await X.json();if(!X.ok)throw new Error(ae.error||"Sync failed");return ae},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]})}}),Ie=async()=>{await o({title:"Sync Main",message:`Sync main into ${t}?
|
|
566
|
-
|
|
567
|
-
This will:
|
|
568
|
-
- Auto-commit any uncommitted changes
|
|
569
|
-
- Fetch and merge the latest main into the feature branch
|
|
570
|
-
- Use the merge agent to resolve any conflicts`,confirmLabel:"Sync"})&&fe.mutate()},Ut=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/refresh-db`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to refresh database")}return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]})}}),sn=async()=>{await o({title:"Clean Workspace",message:`Clean and recreate corrupted workspace for ${t}?
|
|
571
|
-
|
|
572
|
-
This will:
|
|
573
|
-
- Remove the corrupted workspace directory
|
|
574
|
-
- Create a fresh workspace`,variant:"destructive",confirmLabel:"Clean & Recreate"})&&Re.mutate()},se=()=>{k.mutate()},de=()=>{U.mutate()},Ee=async()=>{const X=(P==null?void 0:P.readyForMerge)||(P==null?void 0:P.reviewStatus)==="passed"||(P==null?void 0:P.testStatus)==="passed",ae=X?`Re-run review & test pipeline for ${t}?
|
|
575
|
-
|
|
576
|
-
This will reset the current status and:
|
|
577
|
-
- Run strict code review (review-agent)
|
|
578
|
-
- Run tests (test-agent)
|
|
579
|
-
|
|
580
|
-
MERGE button will appear when both pass.`:`Start review & test pipeline for ${t}?
|
|
581
|
-
|
|
582
|
-
This will:
|
|
583
|
-
- Run strict code review (review-agent)
|
|
584
|
-
- Run tests (test-agent)
|
|
585
|
-
|
|
586
|
-
MERGE button will appear when both pass.`;await o({title:X?"Re-run Review":"Start Review",message:ae,confirmLabel:X?"Re-run":"Start Review"})&&K.mutate()},We=async()=>{await o({title:"Merge to Main",message:`Merge ${t} to main?
|
|
587
|
-
|
|
588
|
-
Review and tests have passed. This will:
|
|
589
|
-
- Merge the feature branch to main
|
|
590
|
-
- Run final verification tests
|
|
591
|
-
- Clean up workspace`,confirmLabel:"Merge"})&&Q.mutate()},Ue=async()=>{await o({title:"Close Without Merging",message:`Close ${t} without merging? This will:
|
|
592
|
-
- Close the issue (no merge)
|
|
593
|
-
- Stop any running agent
|
|
594
|
-
- Remove the workspace
|
|
595
|
-
(Feature branch is preserved for history)`,variant:"destructive",confirmLabel:"Close"})&&Y.mutate()},wt=()=>{const X=prompt(`Reopen ${t} for re-work?
|
|
596
|
-
|
|
597
|
-
This will:
|
|
598
|
-
- Move the issue to "In Progress"
|
|
599
|
-
- Reset review/test/merge status to pending
|
|
600
|
-
- Remove any queued specialist tasks
|
|
601
|
-
- Append a "Reopened" section to STATE.md
|
|
602
|
-
|
|
603
|
-
Optional: enter a reason (or leave blank):`,"");X!==null&&Z.mutate(X||void 0)},ft=async()=>{await o({title:"Reset Review Cycles",message:`Reset all review/test/merge cycles for ${t}?
|
|
604
|
-
|
|
605
|
-
This will:
|
|
606
|
-
- Clear review, test, and merge status
|
|
607
|
-
- Reset the circuit breaker counter
|
|
608
|
-
- Remove queued specialist tasks
|
|
609
|
-
|
|
610
|
-
The agent can then request review when ready.
|
|
611
|
-
Tracker status will NOT change.`,confirmLabel:"Reset Cycles"})&&ue.mutate()},pn=we({mutationFn:async X=>{if(!e)throw new Error("No agent");if(!(await fetch(`/api/agents/${e.id}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:X})})).ok)throw new Error("Failed to send")},onSuccess:()=>{c(""),setTimeout(()=>j(),500)}}),Sr=we({mutationFn:async()=>{if(!e)throw new Error("No agent");if(!(await fetch(`/api/agents/${e.id}`,{method:"DELETE"})).ok)throw new Error("Failed to kill")},onSuccess:()=>{i.invalidateQueries({queryKey:["agents"]}),r()}}),q=v.useCallback(()=>{G9(x),d(!0),setTimeout(()=>d(!1),2e3)},[x]);v.useEffect(()=>{g&&m.current&&m.current.scrollIntoView({behavior:"auto"})},[w,g]);const ee=v.useCallback(()=>{if(f.current){const{scrollTop:X,scrollHeight:ae,clientHeight:De}=f.current,He=ae-X-De<50;y(He)}},[]),ge=()=>{a.trim()&&pn.mutate(a.trim())},ye=async()=>{e&&await o({title:"Kill Agent",message:`Kill agent ${e.id}?`,variant:"destructive",confirmLabel:"Kill"})&&Sr.mutate()},ke=e?new Date(e.startedAt):null,it=ke?Date.now()-ke.getTime():0,rn=Math.floor(it/6e4),qt=Math.floor(rn/60),on=qt>0?`${qt}h ${rn%60}m`:`${rn}m`;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex h-full bg-surface-raised border-l border-divider","data-testid":"workspace-panel",children:[l.jsxs("div",{className:"w-64 border-r border-divider flex flex-col overflow-y-auto","data-testid":"workspace-sidebar",children:[l.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[e?l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"flex gap-0.5",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"0ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"150ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"300ms"}})]}),l.jsx("span",{className:"text-xs text-content-subtle",children:e.status==="stopped"?"Agent Stopped":"Agent Running"})]}):l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-content-muted"}),l.jsx("span",{className:"text-xs text-content-subtle",children:"No Agent"})]}),l.jsx("h2",{className:"font-mono text-sm text-content font-medium mt-1",children:t.toUpperCase()}),s&&l.jsx("p",{className:"text-xs text-content-subtle mt-1 line-clamp-2",title:s.title,children:s.title})]}),s&&l.jsx("div",{className:"px-3 py-2 border-b border-divider text-xs",children:l.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[l.jsx("span",{className:"px-1.5 py-0.5 bg-surface-overlay text-content rounded text-[10px]",children:s.status}),s.priority>0&&l.jsx("span",{className:`text-[10px] ${s.priority===1?"text-red-400":s.priority===2?"text-orange-400":s.priority===3?"text-yellow-400":"text-blue-400"}`,children:s.priority===1?"Urgent":s.priority===2?"High":s.priority===3?"Medium":"Low"}),s.labels.slice(0,3).map(X=>l.jsx("span",{className:"px-1.5 py-0.5 bg-surface-overlay text-content-muted rounded text-[10px]",children:X},X))]})}),e&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Agent"}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Model"}),l.jsx("span",{className:"text-content",children:Md(e.model)})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Runtime"}),l.jsx("span",{className:"text-content",children:e.runtime})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Uptime"}),l.jsx("span",{className:"text-content",children:on})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Session"}),l.jsx("span",{className:"text-content font-mono text-[10px]",children:e.id})]})]})]}),(e==null?void 0:e.git)&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs","data-testid":"git-status",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Git Status"}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-content",children:[l.jsx(ZN,{className:"w-3 h-3"}),l.jsx("span",{className:"font-mono flex-1",children:e.git.branch}),l.jsxs("button",{onClick:Ie,disabled:fe.isPending,title:e.git.uncommittedFiles>0?"Will auto-commit changes before syncing":"Sync with main",className:"flex items-center gap-1 px-1.5 py-0.5 text-[10px] bg-surface-overlay/50 text-content-subtle rounded hover:bg-surface-overlay hover:text-content disabled:opacity-40 disabled:cursor-not-allowed",children:[fe.isPending?l.jsx(_e,{className:"w-2.5 h-2.5 animate-spin"}):l.jsx(Px,{className:"w-2.5 h-2.5"}),"Sync"]})]}),e.git.uncommittedFiles>0&&l.jsxs("div",{className:"text-yellow-400 text-[10px] ml-4",children:[e.git.uncommittedFiles," uncommitted files"]}),l.jsx("div",{className:"text-content-subtle text-[10px] mt-1 truncate",title:e.git.latestCommit,children:e.git.latestCommit})]})]}),(e==null?void 0:e.workspace)&&l.jsx("div",{className:"px-3 py-2 border-b border-divider text-xs",children:l.jsxs("div",{className:"flex items-center gap-1.5 text-content-subtle",children:[l.jsx(Ex,{className:"w-3 h-3"}),l.jsx("span",{className:"font-mono truncate text-[10px]",title:e.workspace,children:e.workspace})]})}),!e&&(T==null?void 0:T.exists)&&T.path&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Workspace"}),l.jsxs("div",{className:"flex items-center gap-1.5 text-content-subtle",children:[l.jsx(Ex,{className:"w-3 h-3"}),l.jsx("span",{className:"font-mono truncate text-[10px]",title:T.path,children:T.path})]}),T.location&&l.jsxs("span",{className:`mt-1.5 inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${T.location==="remote"?"bg-cyan-900/50 text-cyan-400":"bg-surface-overlay text-content-subtle"}`,children:[T.location==="remote"?l.jsx(Nx,{className:"w-3 h-3"}):l.jsx(Tx,{className:"w-3 h-3"}),T.location]})]}),l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Links"}),l.jsxs("div",{className:"space-y-1.5",children:[n&&l.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(gr,{className:"w-3 h-3"}),l.jsx("span",{children:n.includes("github.com")?"GitHub Issue":"Linear Issue"})]}),$&&l.jsxs("button",{onClick:()=>_(!0),className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(qo,{className:"w-3 h-3"}),l.jsx("span",{children:"PRD"})]}),l.jsxs("button",{onClick:()=>C(!0),className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(nj,{className:"w-3 h-3"}),l.jsx("span",{children:"Beads Tasks"})]})]})]}),W&&(W.totalCost>0||(((En=W.sessions)==null?void 0:En.length)??0)>0)&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Cost"}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Total"}),l.jsx("span",{className:"text-green-400 font-medium",children:Gl(W.totalCost)})]}),W.totalTokens>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Tokens"}),l.jsx("span",{className:"text-content",children:Dd(W.totalTokens)})]}),Object.keys(W.byModel).length>0&&l.jsx("div",{className:"border-t border-divider pt-1.5 mt-1.5",children:Object.entries(W.byModel).sort(([,X],[,ae])=>ae.cost-X.cost).map(([X,ae])=>l.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[l.jsx("span",{className:"text-content-subtle truncate",title:X,children:Md(X)}),l.jsx("span",{className:"text-content-body",children:Gl(ae.cost)})]},X))})]})]}),(T==null?void 0:T.corrupted)&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-2 text-yellow-500 mb-2",children:[l.jsx(kn,{className:"w-4 h-4"}),l.jsx("span",{className:"text-xs font-medium",children:"Workspace Corrupted"}),T.location&&l.jsxs("span",{className:`flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${T.location==="remote"?"bg-cyan-900/50 text-cyan-400":"bg-surface-overlay text-content-subtle"}`,title:T.location==="remote"?"Running on remote VM (exe.dev)":"Running locally",children:[T.location==="remote"?l.jsx(Nx,{className:"w-3 h-3"}):l.jsx(Tx,{className:"w-3 h-3"}),T.location]})]}),l.jsx("p",{className:"text-xs text-content-subtle mb-2",children:T.message||"The workspace exists but is not a valid git worktree."}),l.jsx("button",{onClick:sn,disabled:Re.isPending,className:"flex items-center gap-1 px-2 py-1 bg-yellow-600 hover:bg-yellow-500 disabled:bg-yellow-800 text-content text-xs rounded transition-colors w-full justify-center",children:Re.isPending?l.jsxs(l.Fragment,{children:[l.jsx(_e,{className:"w-3 h-3 animate-spin"}),"Cleaning..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Ar,{className:"w-3 h-3"}),"Clean & Recreate"]})}),Re.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:Re.error instanceof Error?Re.error.message:"Failed to clean workspace"}),Re.isSuccess&&l.jsx("div",{className:"text-xs text-green-400 bg-green-900/20 px-2 py-1 rounded mt-2",children:"Workspace cleaned! Recreating..."})]}),(T==null?void 0:T.hasDocker)&&((T==null?void 0:T.frontendUrl)||(T==null?void 0:T.apiUrl))&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Services"}),l.jsxs("div",{className:"space-y-1.5",children:[T.frontendUrl&&l.jsxs("a",{href:T.frontendUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(q_,{className:"w-3 h-3"}),l.jsx("span",{children:"Frontend"})]}),T.apiUrl&&l.jsxs("a",{href:T.apiUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(q_,{className:"w-3 h-3"}),l.jsx("span",{children:"API"})]})]})]}),(T==null?void 0:T.hasDocker)&&T.containers&&Object.values(T.containers).some(X=>!X.running)&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-yellow-500",children:R?"Starting containers...":"Some containers stopped"}),l.jsx("button",{onClick:se,disabled:k.isPending||R,className:"flex items-center gap-1 px-2 py-1 bg-green-600 hover:bg-green-500 disabled:bg-green-800 text-content text-xs rounded transition-colors",children:k.isPending||R?l.jsxs(l.Fragment,{children:[l.jsx(_e,{className:"w-3 h-3 animate-spin"}),"Starting..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Qn,{className:"w-3 h-3"}),"Start Containers"]})})]}),k.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:k.error instanceof Error?k.error.message:"Failed to start containers"})]}),(T==null?void 0:T.exists)&&!T.hasDocker&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider text-xs mb-2",children:"Containers"}),T.canContainerize?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-content-muted",children:"Git-only workspace"}),l.jsx("button",{onClick:de,disabled:U.isPending,className:"flex items-center gap-1 px-2 py-1 bg-purple-600 hover:bg-purple-500 disabled:bg-purple-800 text-content text-xs rounded transition-colors",children:U.isPending?l.jsxs(l.Fragment,{children:[l.jsx(_e,{className:"w-3 h-3 animate-spin"}),"Setting up..."]}):l.jsxs(l.Fragment,{children:[l.jsx(W_,{className:"w-3 h-3"}),"Containerize"]})})]}),U.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded",children:U.error instanceof Error?U.error.message:"Failed to containerize workspace"})]}):l.jsxs("div",{className:"text-xs text-content-subtle bg-surface-raised px-2 py-2 rounded",children:[l.jsx("span",{className:"text-content-muted",children:"No Docker support."})," This workspace doesn't have container infrastructure set up yet."]})]}),(T==null?void 0:T.containers)&&Object.keys(T.containers).length>0&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsxs("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:["Containers",l.jsx("span",{className:"text-gray-600 font-normal ml-2",children:"(right-click for options)"})]}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(T.containers).map(([X,ae])=>{var pe;const De=(k.isPending||R)&&!ae.running,He=N.isPending&&(F==null?void 0:F.containerName)===X,jt=((pe=ae.status)==null?void 0:pe.startsWith("exited"))&&!ae.running;return l.jsxs("span",{onContextMenu:be=>z(be,X,ae.running),className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] cursor-context-menu select-none ${ae.running?"bg-green-900/30 text-green-400 hover:bg-green-900/50":jt?"bg-red-900/30 text-red-400 hover:bg-red-900/50":De||He?"bg-yellow-900/30 text-yellow-400 animate-pulse":"bg-surface-overlay text-content-muted hover:bg-surface-emphasis"}`,title:jt?`Container ${ae.status} — right-click for options`:"Right-click for start/stop/restart options",children:[De||He?l.jsx(_e,{className:"w-2.5 h-2.5 animate-spin"}):X==="postgres"||X==="redis"?l.jsx(jx,{className:"w-2.5 h-2.5"}):l.jsx(W_,{className:"w-2.5 h-2.5"}),X,ae.running&&ae.uptime&&l.jsx("span",{className:"text-content-subtle ml-1",children:ae.uptime}),jt&&l.jsx("span",{className:"text-red-500 ml-1",children:ae.status}),(De||He)&&l.jsx("span",{className:"text-yellow-500 ml-1",children:"..."})]},X)})})]}),e&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Attach Command"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"flex-1 flex items-center gap-1.5 px-2 py-1.5 bg-surface rounded font-mono text-[11px] text-content-body overflow-hidden",children:[l.jsx(Vo,{className:"w-3 h-3 shrink-0 text-blue-400"}),l.jsx("span",{className:"truncate",children:x})]}),l.jsx("button",{onClick:q,className:`p-1.5 rounded transition-colors ${u?"bg-green-900/30 text-green-400":"bg-surface-overlay hover:bg-surface-emphasis text-content-subtle hover:text-content"}`,title:"Copy to clipboard",children:u?l.jsx(Ec,{className:"w-3.5 h-3.5"}):l.jsx(XD,{className:"w-3.5 h-3.5"})})]})]}),l.jsxs("div",{className:"px-3 py-2 border-b border-divider","data-testid":"workspace-actions",children:[l.jsx("div",{className:"text-xs text-content-muted uppercase tracking-wider mb-2",children:"Actions"}),((Ge=T==null?void 0:T.pendingOperation)==null?void 0:Ge.type)==="approve"&&T.pendingOperation.status==="running"&&l.jsxs("div",{className:"flex items-center gap-2 text-xs text-blue-400 bg-blue-900/20 px-2 py-1.5 rounded mb-2",children:[l.jsx(_e,{className:"w-3 h-3 animate-spin"}),l.jsx("span",{children:"Merging in progress... (survives tab switches)"})]}),((ts=T==null?void 0:T.pendingOperation)==null?void 0:ts.status)==="failed"&&l.jsxs("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1.5 rounded mb-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"font-medium",children:"Operation failed"}),l.jsx("button",{onClick:()=>Oe.mutate(),className:"text-content-subtle hover:text-content",title:"Dismiss",children:l.jsx(yt,{className:"w-3 h-3"})})]}),l.jsx("div",{className:"mt-1 text-content-subtle whitespace-pre-wrap",children:T.pendingOperation.error})]}),P&&(P.reviewStatus!=="pending"||P.testStatus!=="pending")&&l.jsxs("div",{className:`mb-2 p-2 rounded text-xs ${P.updatedAt&&Rd(P.updatedAt)?"bg-amber-900/20 border border-amber-700/30":"bg-surface/50"}`,children:[P.updatedAt&&Rd(P.updatedAt)&&l.jsxs("div",{className:"flex items-center gap-1 mb-1.5 text-amber-400 text-[10px]",children:[l.jsx(kn,{className:"w-3 h-3"}),l.jsxs("span",{children:["Status may be stale (",Nh(P.updatedAt),")"]})]}),l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("span",{className:"text-content-subtle",children:"Review:"}),l.jsx("span",{className:P.reviewStatus==="passed"?"text-green-400":P.reviewStatus==="blocked"||P.reviewStatus==="failed"?"text-red-400":P.reviewStatus==="reviewing"?"text-yellow-400":"text-content-muted",children:P.reviewStatus==="passed"?"✓ Passed":P.reviewStatus==="blocked"?"✗ Blocked":P.reviewStatus==="failed"?"✗ Failed":P.reviewStatus==="reviewing"?"⟳ Reviewing...":"Pending"}),P.updatedAt&&P.reviewStatus!=="pending"&&!Rd(P.updatedAt)&&l.jsx("span",{className:"text-content-muted text-[10px]",children:Nh(P.updatedAt)})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-content-subtle",children:"Tests:"}),l.jsx("span",{className:P.testStatus==="passed"?"text-green-400":P.testStatus==="failed"?"text-red-400":P.testStatus==="testing"?"text-yellow-400":"text-content-muted",children:P.testStatus==="passed"?"✓ Passed":P.testStatus==="failed"?"✗ Failed":P.testStatus==="testing"?"⟳ Testing...":P.testStatus==="skipped"?"⊘ Skipped":"Pending"}),P.updatedAt&&P.testStatus!=="pending"&&!Rd(P.updatedAt)&&l.jsx("span",{className:"text-content-muted text-[10px]",children:Nh(P.updatedAt)})]}),(P.autoRequeueCount??0)>0&&l.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[l.jsx("span",{className:"text-content-subtle",children:"Review cycles:"}),l.jsxs("span",{className:(P.autoRequeueCount??0)>=7?"text-red-400 font-medium":"text-content-body",children:[P.autoRequeueCount,"/7"]}),(P.autoRequeueCount??0)>=7&&l.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400 bg-amber-900/20 px-1.5 py-0.5 rounded",children:[l.jsx(kn,{className:"w-2.5 h-2.5"}),"Human intervention needed"]})]}),P.reviewNotes&&l.jsx("div",{className:"mt-1 text-content-subtle text-xs",children:P.reviewNotes}),P.testNotes&&l.jsx("div",{className:"mt-1 text-content-subtle text-xs",children:P.testNotes}),P.history&&P.history.length>0&&l.jsx(eH,{history:P.history})]}),l.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[(P==null?void 0:P.readyForMerge)&&(P==null?void 0:P.mergeStatus)!=="merged"&&l.jsxs("button",{"data-testid":"merge-btn",onClick:We,disabled:Q.isPending||(P==null?void 0:P.mergeStatus)==="merging",className:"flex items-center gap-1 px-2 py-1 text-xs bg-green-600 text-content rounded hover:bg-green-500 disabled:opacity-50 font-medium",children:[Q.isPending||(P==null?void 0:P.mergeStatus)==="merging"?l.jsx(_e,{className:"w-3 h-3 animate-spin"}):l.jsx(mr,{className:"w-3 h-3"}),(P==null?void 0:P.mergeStatus)==="merging"?"MERGING...":"MERGE"]}),(P==null?void 0:P.mergeStatus)==="merged"&&l.jsxs("span",{className:"flex items-center gap-1 px-2 py-1 text-xs bg-green-900/30 text-green-400 rounded font-medium",children:[l.jsx(mr,{className:"w-3 h-3"}),"MERGED"]}),l.jsxs("button",{"data-testid":"sync-with-main-btn",onClick:Ie,disabled:fe.isPending,title:(((an=e==null?void 0:e.git)==null?void 0:an.uncommittedFiles)??0)>0?"Will auto-commit changes before syncing with main":"Sync latest main into this workspace",className:"flex items-center gap-1 px-2 py-1 text-xs bg-surface-overlay/50 text-content-subtle rounded hover:bg-surface-overlay hover:text-content disabled:opacity-50 disabled:cursor-not-allowed",children:[fe.isPending?l.jsx(_e,{className:"w-3 h-3 animate-spin"}):l.jsx(Px,{className:"w-3 h-3"}),fe.isPending?"Syncing...":"Sync with Main"]}),l.jsxs("button",{"data-testid":"review-test-btn",onClick:Ee,disabled:K.isPending||(P==null?void 0:P.reviewStatus)==="reviewing"||(P==null?void 0:P.testStatus)==="testing",className:`flex items-center gap-1 px-2 py-1 text-xs rounded disabled:opacity-50 ${P!=null&&P.readyForMerge?"bg-surface-overlay/50 text-content-body hover:bg-surface-overlay":"bg-blue-900/30 text-blue-400 hover:bg-blue-900/50"}`,children:[K.isPending||(P==null?void 0:P.reviewStatus)==="reviewing"||(P==null?void 0:P.testStatus)==="testing"?l.jsx(_e,{className:"w-3 h-3 animate-spin"}):l.jsx(Ar,{className:"w-3 h-3"}),P!=null&&P.readyForMerge?"Re-Review":"Review & Test"]}),e&&e.status!=="stopped"&&l.jsxs("button",{onClick:ye,disabled:Sr.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs bg-red-900/30 text-red-400 rounded hover:bg-red-900/50",children:[l.jsx(ou,{className:"w-3 h-3"}),"Stop Agent"]}),l.jsxs("button",{onClick:Ue,disabled:Y.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs bg-orange-900/30 text-orange-400 rounded hover:bg-orange-900/50 disabled:opacity-50",children:[Y.isPending?l.jsx(_e,{className:"w-3 h-3 animate-spin"}):l.jsx(Kr,{className:"w-3 h-3"}),"Close (No Merge)"]}),P&&(P.reviewStatus==="passed"||P.reviewStatus==="failed"||P.reviewStatus==="blocked"||P.testStatus==="passed"||P.testStatus==="failed"||P.mergeStatus==="merged")&&l.jsxs("button",{"data-testid":"reopen-btn",onClick:wt,disabled:Z.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs bg-purple-900/30 text-purple-400 rounded hover:bg-purple-900/50 disabled:opacity-50",children:[Z.isPending?l.jsx(_e,{className:"w-3 h-3 animate-spin"}):l.jsx(Ar,{className:"w-3 h-3"}),Z.isPending?"Reopening...":"Reopen"]}),P&&(P.reviewStatus!=="pending"||P.testStatus!=="pending")&&l.jsxs("button",{onClick:ft,disabled:ue.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs bg-amber-900/30 text-amber-400 rounded hover:bg-amber-900/50 disabled:opacity-50",children:[ue.isPending?l.jsx(_e,{className:"w-3 h-3 animate-spin"}):l.jsx(Lu,{className:"w-3 h-3"}),ue.isPending?"Resetting...":"Reset Reviews"]}),(!e||e.status==="stopped")&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:()=>I.mutate(),disabled:I.isPending||I.isSuccess,className:"flex items-center gap-1 px-2 py-1 text-xs bg-blue-600 text-content rounded hover:bg-blue-500 disabled:opacity-50 font-medium",children:[I.isPending?l.jsx(_e,{className:"w-3 h-3 animate-spin"}):I.isSuccess?l.jsx(Ec,{className:"w-3 h-3"}):l.jsx(Qn,{className:"w-3 h-3"}),I.isPending?"Starting...":I.isSuccess?"Started!":"Start Agent"]}),!(T!=null&&T.exists)&&l.jsxs("button",{onClick:()=>H.mutate(),disabled:H.isPending||H.isSuccess,className:"flex items-center gap-1 px-2 py-1 text-xs bg-surface-overlay text-content rounded hover:bg-surface-emphasis disabled:opacity-50 border border-divider-strong",children:[H.isPending||H.isSuccess?l.jsx(_e,{className:"w-3 h-3 animate-spin"}):l.jsx(U_,{className:"w-3 h-3"}),H.isPending?"Creating...":H.isSuccess?"Setting up...":"Create Workspace"]})]})]}),K.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:K.error instanceof Error?K.error.message:"Failed to start review"}),Q.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:Q.error instanceof Error?Q.error.message:"Failed to merge"}),Y.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:Y.error instanceof Error?Y.error.message:"Failed to close"}),fe.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:fe.error instanceof Error?fe.error.message:"Sync with main failed"}),fe.isSuccess&&fe.data&&l.jsx("div",{className:"text-xs text-green-400 bg-green-900/20 px-2 py-1 rounded mt-2",children:fe.data.alreadyUpToDate?"Already up to date with main":`Synced ${fe.data.commitCount??0} commit(s) from main`})]}),l.jsx("div",{className:"flex-1"})]}),l.jsx("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 overflow-hidden",children:e?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>p("logs"),className:`px-2 py-1 text-xs rounded transition-colors ${h==="logs"?"bg-surface-overlay text-content":"text-content-subtle hover:text-content"}`,children:"Logs"}),l.jsx("button",{onClick:()=>p("status"),className:`px-2 py-1 text-xs rounded transition-colors ${h==="status"?"bg-surface-overlay text-content":"text-content-subtle hover:text-content"}`,children:"Status"})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>j(),className:"p-1 text-content-subtle hover:text-content",title:"Refresh",children:l.jsx(Ar,{className:"w-3.5 h-3.5"})}),l.jsx("button",{onClick:r,className:"p-1 text-content-subtle hover:text-content",children:l.jsx(yt,{className:"w-3.5 h-3.5"})})]})]}),h==="logs"?l.jsxs(l.Fragment,{children:[l.jsxs("pre",{ref:f,onScroll:ee,className:"flex-1 min-h-0 overflow-auto p-3 bg-surface text-content font-mono text-xs leading-relaxed m-0 whitespace-pre",children:[w||(e.status==="stopped"?"No saved output available.":"Connecting to agent..."),l.jsx("div",{ref:m})]}),e.status!=="stopped"&&l.jsx("div",{className:"p-2 border-t border-divider bg-surface-raised",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:a,onChange:X=>c(X.target.value),onKeyDown:X=>X.key==="Enter"&&ge(),placeholder:"Send message to agent...",className:"flex-1 px-3 py-2 bg-surface-overlay border border-divider-strong rounded text-sm text-content placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500"}),l.jsxs("button",{onClick:ge,disabled:!a.trim()||pn.isPending,className:"px-3 py-2 bg-blue-600 text-content rounded text-sm font-medium hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[l.jsx(sj,{className:"w-4 h-4"}),"Send"]})]})})]}):l.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 bg-surface",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Agent Summary"}),l.jsxs("div",{className:"text-xs text-content-body space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Issue:"})," ",e.issueId]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Session:"})," ",l.jsx("span",{className:"font-mono text-[10px]",children:e.id})]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Model:"})," ",Md(e.model)]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Runtime:"})," ",e.runtime]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Started:"})," ",ke==null?void 0:ke.toLocaleString()]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Uptime:"})," ",on]})]})]}),e.workspace&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Workspace"}),l.jsx("div",{className:"text-xs text-content-body space-y-1",children:l.jsx("p",{className:"font-mono text-[10px] break-all",children:e.workspace})})]}),e.git&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Git Status"}),l.jsxs("div",{className:"text-xs text-content-body space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Branch:"})," ",l.jsx("span",{className:"font-mono",children:e.git.branch})]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Uncommitted:"})," ",e.git.uncommittedFiles," files"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Latest:"})," ",e.git.latestCommit]})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Health"}),l.jsxs("div",{className:"text-xs text-content-body space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Status:"})," ",l.jsx("span",{className:"text-green-400",children:e.status})]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Consecutive Failures:"})," ",e.consecutiveFailures]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Total Restarts:"})," ",e.killCount]})]})]})]})})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-divider",children:[l.jsx("span",{className:"text-xs text-content-subtle",children:"Issue Details"}),l.jsx("button",{onClick:r,className:"p-1 text-content-subtle hover:text-content",children:l.jsx(yt,{className:"w-3.5 h-3.5"})})]}),l.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 bg-surface",children:[s&&l.jsx("h2",{className:"text-lg font-medium text-content mb-4",children:s.title}),s&&l.jsxs("div",{className:"space-y-3 mb-6",children:[s.assignee&&l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx(o0,{className:"w-4 h-4 text-content-subtle"}),l.jsx("span",{className:"text-content-body",children:s.assignee.name}),s.assignee.email&&l.jsx("span",{className:"text-content-muted text-xs",children:s.assignee.email})]}),s.labels.length>0&&l.jsxs("div",{className:"flex items-center gap-2 text-sm flex-wrap",children:[l.jsx(r0,{className:"w-4 h-4 text-content-subtle shrink-0"}),s.labels.map(X=>l.jsx("span",{className:"px-2 py-0.5 bg-surface-overlay text-content-body text-xs rounded",children:X},X))]}),l.jsxs("div",{className:"flex items-center gap-2 text-sm text-content-subtle",children:[l.jsx(qD,{className:"w-4 h-4"}),l.jsxs("span",{children:["Updated ",new Date(s.updatedAt).toLocaleDateString()]})]})]}),(s==null?void 0:s.description)&&l.jsxs("div",{className:"mb-6",children:[l.jsx("h3",{className:"text-sm font-medium text-content-subtle mb-2",children:"Description"}),l.jsx("div",{className:"text-sm text-content-body bg-surface-raised rounded p-3 max-h-64 overflow-y-auto prose prose-sm prose-invert prose-p:my-2 prose-headings:my-2 prose-ul:my-1 prose-li:my-0",children:l.jsx(Rv,{children:s.description})})]}),W&&(W.totalCost>0||(((to=W.sessions)==null?void 0:to.length)??0)>0)&&l.jsxs("div",{className:"mb-6",children:[l.jsxs("h3",{className:"text-sm font-medium text-content-subtle mb-2 flex items-center gap-2",children:[l.jsx(na,{className:"w-4 h-4"}),"Cost Summary"]}),l.jsxs("div",{className:"bg-surface-raised rounded p-3 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Total Cost"}),l.jsx("span",{className:"text-xl font-semibold text-green-400",children:Gl(W.totalCost)})]}),W.totalTokens>0&&l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsxs("span",{className:"text-content-muted flex items-center gap-1",children:[l.jsx(JN,{className:"w-3 h-3"}),"Total Tokens"]}),l.jsx("span",{className:"text-content-body",children:Dd(W.totalTokens)})]}),Object.keys(W.byModel).length>0&&l.jsxs("div",{className:"border-t border-divider pt-2",children:[l.jsx("p",{className:"text-xs text-content-muted uppercase tracking-wider mb-2",children:"By Model"}),l.jsx("div",{className:"space-y-1",children:Object.entries(W.byModel).sort(([,X],[,ae])=>ae.cost-X.cost).map(([X,ae])=>l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsx("span",{className:"text-content-subtle truncate",title:X,children:Md(X)}),l.jsxs("div",{className:"text-right",children:[l.jsx("span",{className:"text-content-body",children:Gl(ae.cost)}),l.jsxs("span",{className:"text-content-muted text-xs ml-1",children:["(",Dd(ae.tokens),")"]})]})]},X))})]}),W.byStage&&Object.keys(W.byStage).length>0&&l.jsxs("div",{className:"border-t border-divider pt-2",children:[l.jsx("p",{className:"text-xs text-content-muted uppercase tracking-wider mb-2",children:"By Stage"}),l.jsx("div",{className:"space-y-1",children:Object.entries(W.byStage).sort(([,X],[,ae])=>ae.cost-X.cost).map(([X,ae])=>l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsx("span",{className:"text-content-subtle truncate",title:X,children:X.charAt(0).toUpperCase()+X.slice(1)}),l.jsxs("div",{className:"text-right",children:[l.jsx("span",{className:"text-content-body",children:Gl(ae.cost)}),l.jsxs("span",{className:"text-content-muted text-xs ml-1",children:["(",Dd(ae.tokens),")"]})]})]},X))})]})]})]}),l.jsxs("div",{className:"space-y-3 mt-6",children:[l.jsx("button",{onClick:()=>I.mutate(),disabled:I.isPending||I.isSuccess,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-blue-600 text-content rounded-lg hover:bg-blue-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:I.isPending?l.jsxs(l.Fragment,{children:[l.jsx(_e,{className:"w-5 h-5 animate-spin"}),l.jsx("span",{className:"font-medium",children:"Starting..."})]}):I.isSuccess?l.jsxs(l.Fragment,{children:[l.jsx(Ec,{className:"w-5 h-5"}),l.jsx("span",{className:"font-medium",children:"Agent Started!"})]}):l.jsxs(l.Fragment,{children:[l.jsx(Qn,{className:"w-5 h-5"}),l.jsx("span",{className:"font-medium",children:T!=null&&T.exists?"Start Agent in Workspace":"Start Agent"})]})}),!(T!=null&&T.exists)&&l.jsx("button",{onClick:()=>H.mutate(),disabled:H.isPending||H.isSuccess,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-surface-overlay text-content rounded-lg hover:bg-surface-emphasis transition-colors border border-divider-strong disabled:opacity-50 disabled:cursor-not-allowed",children:H.isPending||H.isSuccess?l.jsxs(l.Fragment,{children:[l.jsx(_e,{className:"w-5 h-5 animate-spin"}),l.jsx("span",{className:"font-medium",children:H.isPending?"Creating workspace...":"Setting up git worktree & skills..."})]}):l.jsxs(l.Fragment,{children:[l.jsx(U_,{className:"w-5 h-5"}),l.jsx("span",{className:"font-medium",children:"Create Workspace Only"})]})}),I.isError&&l.jsx("p",{className:"text-red-400 text-xs",children:"Failed to start agent. Check server logs."}),H.isError&&l.jsx("p",{className:"text-red-400 text-xs",children:"Failed to create workspace. Check server logs."})]}),l.jsxs("div",{className:"text-xs text-content-muted mt-3 space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Start Agent:"})," ",T!=null&&T.exists?"Starts autonomous agent in existing workspace":"Creates workspace + starts autonomous agent"]}),!(T!=null&&T.exists)&&l.jsxs("p",{children:[l.jsx("strong",{children:"Create Workspace:"})," Creates git worktree for manual work"]})]})]})]})})]}),F&&l.jsxs("div",{className:"fixed z-50 bg-surface-raised border border-divider-strong rounded shadow-lg py-1 min-w-[140px]",style:{left:F.x,top:F.y},onClick:X=>X.stopPropagation(),children:[l.jsx("div",{className:"px-3 py-1 text-xs text-content-subtle border-b border-divider mb-1",children:F.containerName}),F.isRunning?l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:()=>N.mutate({containerName:F.containerName,action:"restart"}),disabled:N.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-content hover:bg-surface-overlay flex items-center gap-2 disabled:opacity-50",children:[l.jsx(Ar,{className:"w-3 h-3"}),"Restart"]}),l.jsxs("button",{onClick:()=>N.mutate({containerName:F.containerName,action:"stop"}),disabled:N.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-red-400 hover:bg-surface-overlay flex items-center gap-2 disabled:opacity-50",children:[l.jsx(ou,{className:"w-3 h-3"}),"Stop"]}),F.containerName==="postgres"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"border-t border-divider my-1"}),l.jsxs("button",{onClick:async()=>{await o({title:"Refresh Database",message:`Drop and reload database from seed file?
|
|
612
|
-
|
|
613
|
-
This will:
|
|
614
|
-
- Stop the API container
|
|
615
|
-
- Drop the existing database
|
|
616
|
-
- Reload from seed-cleaned.sql
|
|
617
|
-
- Restart the API
|
|
618
|
-
|
|
619
|
-
All workspace data will be replaced.`,variant:"destructive",confirmLabel:"Refresh DB"})&&(Ut.mutate(),M(null))},disabled:Ut.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-amber-400 hover:bg-surface-overlay flex items-center gap-2 disabled:opacity-50",children:[l.jsx(jx,{className:"w-3 h-3"}),Ut.isPending?"Refreshing DB...":"Refresh DB"]})]})]}):l.jsxs("button",{onClick:()=>N.mutate({containerName:F.containerName,action:"start"}),disabled:N.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-green-400 hover:bg-surface-overlay flex items-center gap-2 disabled:opacity-50",children:[l.jsx(Qn,{className:"w-3 h-3"}),"Start"]}),N.isError&&l.jsx("div",{className:"px-3 py-1 text-xs text-red-400 border-t border-divider mt-1",children:N.error instanceof Error?N.error.message:"Action failed"})]}),S&&l.jsx(T0,{issueId:t,isOpen:S,onClose:()=>C(!1)}),b&&$&&l.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50",onClick:()=>_(!1),children:l.jsxs("div",{className:"border border-divider rounded-lg shadow-xl w-[700px] max-h-[80vh] flex flex-col",style:{backgroundColor:"#1a1d23"},onClick:X=>X.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[l.jsxs("h2",{className:"text-sm font-medium text-content",children:["PRD — ",t.toUpperCase()]}),l.jsx("button",{onClick:()=>_(!1),className:"text-content-muted hover:text-content",children:l.jsx(yt,{size:18})})]}),l.jsx("div",{className:"overflow-y-auto px-4 py-3 text-xs prose prose-invert prose-sm max-w-none",children:l.jsx(Rv,{children:$})})]})})]})}async function nH(){const e=await fetch("/api/activity");if(!e.ok)throw new Error("Failed to fetch activity");return e.json()}function sH({status:e}){switch(e){case"running":return l.jsx(_e,{className:"w-4 h-4 text-blue-400 animate-spin"});case"completed":return l.jsx(mr,{className:"w-4 h-4 text-green-400"});case"failed":return l.jsx(Kr,{className:"w-4 h-4 text-red-400"})}}function rH(e){return new Date(e).toLocaleTimeString()}function iH({onClose:e}){const{data:t,isLoading:n}=he({queryKey:["activity"],queryFn:nH,refetchInterval:2e3});return l.jsxs("div",{className:"flex flex-col h-full bg-surface-raised border-l border-divider",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Vo,{className:"w-5 h-5 text-blue-400"}),l.jsx("h2",{className:"font-medium text-content",children:"Activity Log"})]}),l.jsx("button",{onClick:e,className:"text-content-subtle hover:text-content p-1",children:l.jsx(yt,{className:"w-4 h-4"})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:n?l.jsx("div",{className:"flex items-center justify-center h-32 text-content-subtle",children:l.jsx(_e,{className:"w-6 h-6 animate-spin"})}):!t||t.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-content-muted",children:[l.jsx(Vo,{className:"w-8 h-8 mb-2 opacity-50"}),l.jsx("p",{className:"text-sm",children:"No activity yet"}),l.jsx("p",{className:"text-xs mt-1",children:"Start an agent or create a workspace to see output here"})]}):l.jsx("div",{className:"divide-y divide-gray-700",children:t.map(s=>l.jsxs("div",{className:"p-3",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(sH,{status:s.status}),l.jsx("code",{className:"text-sm text-content font-mono flex-1 truncate",children:s.command}),l.jsx("span",{className:"text-xs text-content-muted",children:rH(s.timestamp)})]}),l.jsx("pre",{className:"bg-surface rounded p-2 text-xs text-content-body font-mono overflow-x-auto max-h-96 overflow-y-auto",children:s.output.length>0?s.output.join(`
|
|
620
|
-
`):s.status==="running"?"Waiting for output...":"No output"}),l.jsx("div",{className:"mt-2 flex items-center gap-2",children:l.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${s.status==="running"?"bg-blue-900/50 text-blue-400":s.status==="completed"?"bg-green-900/50 text-green-400":"bg-red-900/50 text-red-400"}`,children:s.status})})]},s.id))})})]})}async function oH(){const e=await fetch("/api/convoys");if(!e.ok)throw new Error("Failed to fetch convoys");return(await e.json()).convoys}async function aH(e){const t=await fetch(`/api/convoys/${e}`);if(!t.ok)throw new Error("Failed to fetch convoy status");return t.json()}async function lH(e){const t=await fetch(`/api/convoys/${e}/output`);if(!t.ok)throw new Error("Failed to fetch convoy output");return(await t.json()).outputs}function cH(){return he({queryKey:["convoys"],queryFn:oH,refetchInterval:5e3})}function uH(e){return he({queryKey:["convoy",e],queryFn:()=>aH(e),enabled:!!e,refetchInterval:2e3})}function dH(e){return he({queryKey:["convoy-output",e],queryFn:()=>lH(e),enabled:!!e,refetchInterval:5e3})}function v5({status:e}){switch(e){case"running":return l.jsx(_e,{className:"w-4 h-4 text-blue-400 animate-spin"});case"completed":return l.jsx(mr,{className:"w-4 h-4 text-green-400"});case"failed":return l.jsx(Kr,{className:"w-4 h-4 text-red-400"});case"partial":return l.jsx(Uo,{className:"w-4 h-4 text-yellow-400"})}}function hH({status:e}){const t={pending:"bg-surface/50 text-content-subtle",running:"bg-blue-900/50 text-blue-400",completed:"bg-green-900/50 text-green-400",failed:"bg-red-900/50 text-red-400"};return l.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${t[e]||t.pending}`,children:e})}function Dv(e){return new Date(e).toLocaleString()}function y5(e,t){const n=new Date(e).getTime(),s=t?new Date(t).getTime():Date.now(),r=Math.floor((s-n)/1e3),i=Math.floor(r/3600),o=Math.floor(r%3600/60),a=r%60;return i>0?`${i}h ${o}m ${a}s`:o>0?`${o}m ${a}s`:`${a}s`}function fH({convoy:e}){const{data:t}=dH(e.id);return l.jsxs("div",{className:"border-t border-divider p-4 bg-surface/50",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-content-muted",children:"Template:"}),l.jsx("span",{className:"ml-2 text-content",children:e.template})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-content-muted",children:"Duration:"}),l.jsx("span",{className:"ml-2 text-content",children:y5(e.startedAt,e.completedAt)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-content-muted",children:"Output:"}),l.jsxs("a",{href:`file://${e.outputDir}`,className:"ml-2 text-blue-400 hover:text-blue-300 inline-flex items-center gap-1",children:[e.outputDir,l.jsx(gr,{className:"w-3 h-3"})]})]}),e.context.prUrl&&l.jsxs("div",{children:[l.jsx("span",{className:"text-content-muted",children:"PR:"}),l.jsxs("a",{href:e.context.prUrl,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-blue-400 hover:text-blue-300 inline-flex items-center gap-1",children:["View PR",l.jsx(gr,{className:"w-3 h-3"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-sm font-medium text-content mb-2",children:"Agents"}),e.agents.map(n=>l.jsxs("div",{className:"bg-surface-raised rounded p-3",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(v5,{status:n.status}),l.jsx("span",{className:"font-medium text-content",children:n.role}),l.jsxs("span",{className:"text-xs text-content-muted",children:["(",n.subagent,")"]})]}),l.jsx(hH,{status:n.status})]}),n.startedAt&&l.jsxs("div",{className:"text-xs text-content-muted mb-1",children:["Started: ",Dv(n.startedAt),n.completedAt&&` • Completed: ${Dv(n.completedAt)}`]}),n.status==="running"&&l.jsxs("div",{className:"text-xs text-content-muted",children:["Tmux: ",l.jsx("code",{className:"text-content-subtle",children:n.tmuxSession})]}),n.status==="completed"&&t&&t[n.role]&&l.jsx("div",{className:"mt-2",children:l.jsxs("details",{className:"text-xs",children:[l.jsx("summary",{className:"cursor-pointer text-blue-400 hover:text-blue-300",children:"View output"}),l.jsxs("pre",{className:"mt-2 bg-surface rounded p-2 text-content-body font-mono overflow-x-auto max-h-64 overflow-y-auto",children:[t[n.role].substring(0,1e3),t[n.role].length>1e3&&`
|
|
621
|
-
... (truncated)`]})]})})]},n.role))]})]})}function pH({onClose:e}){const{data:t,isLoading:n}=cH(),[s,r]=v.useState(null),{data:i}=uH(s||void 0),o=i||s&&(t==null?void 0:t.find(a=>a.id===s));return l.jsxs("div",{className:"flex flex-col h-full bg-surface-raised border-l border-divider",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(au,{className:"w-5 h-5 text-purple-400"}),l.jsx("h2",{className:"font-medium text-content",children:"Convoys"}),t&&t.length>0&&l.jsxs("span",{className:"text-xs text-content-muted",children:["(",t.length,")"]})]}),l.jsx("button",{onClick:e,className:"text-content-subtle hover:text-content p-1",children:l.jsx(yt,{className:"w-4 h-4"})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:n?l.jsx("div",{className:"flex items-center justify-center h-32 text-content-subtle",children:l.jsx(_e,{className:"w-6 h-6 animate-spin"})}):!t||t.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-content-muted",children:[l.jsx(au,{className:"w-8 h-8 mb-2 opacity-50"}),l.jsx("p",{className:"text-sm",children:"No convoys yet"}),l.jsx("p",{className:"text-xs mt-1",children:"Start a convoy to see it here"})]}):l.jsx("div",{className:"divide-y divide-gray-700",children:t.map(a=>l.jsxs("div",{className:"p-3",children:[l.jsxs("button",{onClick:()=>r(s===a.id?null:a.id),className:"w-full text-left",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(v5,{status:a.status}),l.jsx("code",{className:"text-sm text-content font-mono flex-1 truncate",children:a.id}),l.jsx("span",{className:"text-xs text-content-muted",children:y5(a.startedAt,a.completedAt)})]}),l.jsxs("div",{className:"flex items-center gap-3 text-xs text-content-subtle mb-2",children:[l.jsx("span",{className:"text-purple-400",children:a.template}),l.jsx("span",{children:"•"}),l.jsxs("span",{children:[a.agents.filter(c=>c.status==="completed").length,"/",a.agents.length," agents"]}),l.jsx("span",{children:"•"}),l.jsx("span",{children:Dv(a.startedAt)})]}),l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${a.status==="running"?"bg-blue-900/50 text-blue-400":a.status==="completed"?"bg-green-900/50 text-green-400":a.status==="failed"?"bg-red-900/50 text-red-400":"bg-yellow-900/50 text-yellow-400"}`,children:a.status})})]}),s===a.id&&o&&l.jsx(fH,{convoy:o})]},a.id))})})]})}async function mH(){const e=await fetch("/api/cloister/status");if(!e.ok)throw new Error("Failed to fetch Cloister status");return e.json()}async function gH(){const e=await fetch("/api/cloister/config");if(!e.ok)throw new Error("Failed to fetch Cloister config");return e.json()}async function xH(e){if(!(await fetch("/api/cloister/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to update Cloister config")}async function vH(){if(!(await fetch("/api/cloister/start",{method:"POST"})).ok)throw new Error("Failed to start Cloister")}async function yH(){if(!(await fetch("/api/cloister/stop",{method:"POST"})).ok)throw new Error("Failed to stop Cloister")}async function bH(){const e=await fetch("/api/cloister/emergency-stop",{method:"POST"});if(!e.ok)throw new Error("Failed to execute emergency stop");return e.json()}function _H(){const[e,t]=v.useState(!1),[n,s]=v.useState(!1),[r,i]=v.useState(!1),o=Nt(),{data:a,refetch:c}=he({queryKey:["cloister-status"],queryFn:mH,refetchInterval:1e4}),{data:u}=he({queryKey:["cloister-config"],queryFn:gH}),d=we({mutationFn:xH,onSuccess:()=>{o.invalidateQueries({queryKey:["cloister-config"]})}}),h=async()=>{i(!0);try{a!=null&&a.running?await yH():await vH(),await c()}finally{i(!1)}},p=async()=>{await bH(),t(!1),c()},f=()=>{u&&d.mutate({startup:{auto_start:!u.startup.auto_start}})};if(!a)return null;const m=a.summary.warning>0||a.summary.stuck>0,g=a.agentsNeedingAttention.length;return l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("div",{className:"flex items-center gap-1",title:a.running?"Cloister: Running":"Cloister: Stopped",children:a.running?l.jsx(VN,{className:"w-3.5 h-3.5 text-green-400"}):l.jsx(UD,{className:"w-3.5 h-3.5 text-content-muted"})}),a.running&&a.summary.total>0&&l.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[a.summary.active>0&&l.jsx("span",{className:"text-green-400",children:a.summary.active}),a.summary.warning>0&&l.jsx("span",{className:"text-orange-400",children:a.summary.warning}),a.summary.stuck>0&&l.jsx("span",{className:"text-red-400",children:a.summary.stuck})]}),m&&l.jsx("span",{title:`${g} agent${g!==1?"s":""} need attention`,children:l.jsx(kn,{className:"w-3.5 h-3.5 text-orange-400"})}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:h,disabled:r,className:`px-2 py-0.5 rounded text-xs transition-colors ${r?"bg-surface-emphasis text-content-subtle cursor-wait":a.running?"bg-surface-overlay text-content-body hover:bg-surface-emphasis":"bg-blue-600 text-content hover:bg-blue-700"}`,children:r?(a.running,"..."):a.running?"Pause":"Start"}),e?l.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 bg-red-600/20 rounded border border-red-600/30",children:[l.jsx("span",{className:"text-xs text-red-300",children:"Kill all?"}),l.jsx("button",{onClick:p,className:"px-1.5 py-0.5 rounded text-xs bg-red-600 text-content hover:bg-red-700",children:"Yes"}),l.jsx("button",{onClick:()=>t(!1),className:"px-1.5 py-0.5 rounded text-xs bg-surface-overlay text-content-body hover:bg-surface-emphasis",children:"No"})]}):l.jsx("button",{onClick:()=>t(!0),className:"p-1 rounded text-xs bg-red-600/20 text-red-400 border border-red-600/30 hover:bg-red-600/30 transition-colors",title:"Emergency stop - kill all agents",children:l.jsx(VD,{className:"w-3.5 h-3.5"})}),l.jsxs("div",{className:"relative",children:[l.jsx("button",{onClick:()=>s(!n),className:`p-1 rounded text-xs transition-colors ${n?"bg-surface-emphasis text-content":"bg-surface-overlay text-content-body hover:bg-surface-emphasis"}`,title:"Cloister settings",children:l.jsx(rj,{className:"w-3.5 h-3.5"})}),n&&l.jsx("div",{className:"absolute right-0 top-full mt-2 w-56 bg-surface-raised border border-divider rounded-lg shadow-lg z-50",children:l.jsxs("div",{className:"p-3",children:[l.jsx("div",{className:"text-xs text-content-subtle font-medium mb-2",children:"Settings"}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer hover:bg-surface-overlay/50 rounded px-2 py-1.5 -mx-2",children:[l.jsx("input",{type:"checkbox",checked:(u==null?void 0:u.startup.auto_start)??!0,onChange:f,disabled:d.isPending,className:"w-4 h-4 rounded border-divider-strong bg-surface-overlay text-blue-500 focus:ring-blue-500 focus:ring-offset-gray-800"}),l.jsx("span",{className:"text-sm text-content-body",children:"Auto-start on dashboard launch"})]})]})})]})]})]})}function aS(e){const t=new Date(e),n=t.toLocaleString("default",{month:"short"}),s=t.getDate(),r=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0"),o=t.getSeconds().toString().padStart(2,"0");return`${n} ${s}, ${r}:${i}:${o}`}async function wH(e=50){const t=await fetch(`/api/handoffs?limit=${e}`);if(!t.ok)throw new Error("Failed to fetch handoffs");return t.json()}async function SH(){const e=await fetch("/api/handoffs/stats");if(!e.ok)throw new Error("Failed to fetch handoff stats");return e.json()}async function kH(e=50){const t=await fetch(`/api/specialist-handoffs?limit=${e}`);if(!t.ok)throw new Error("Failed to fetch specialist handoffs");return t.json()}async function CH(){const e=await fetch("/api/specialist-handoffs/stats");if(!e.ok)throw new Error("Failed to fetch specialist handoff stats");return e.json()}const lS={opus:"text-purple-400 bg-purple-900/20 border-purple-500/30",sonnet:"text-blue-400 bg-blue-900/20 border-blue-500/30",haiku:"text-green-400 bg-green-900/20 border-green-500/30"},NH={stuck_escalation:"Stuck Escalation",test_failure:"Test Failure",task_complete:"Task Complete",manual:"Manual"},jH={stuck_escalation:"text-red-400",test_failure:"text-orange-400",task_complete:"text-blue-400",manual:"text-content-subtle"},cS={"review-agent":"text-purple-400 bg-purple-900/20 border-purple-500/30","test-agent":"text-green-400 bg-green-900/20 border-green-500/30","merge-agent":"text-blue-400 bg-blue-900/20 border-blue-500/30","issue-agent":"text-cyan-400 bg-cyan-900/20 border-cyan-500/30"},EH={queued:"text-yellow-400",processing:"text-blue-400",completed:"text-green-400",failed:"text-red-400"},PH={urgent:"text-red-400",high:"text-orange-400",normal:"text-blue-400",low:"text-content-subtle"};function TH(){var c,u,d,h,p;const{data:e,isLoading:t}=he({queryKey:["handoffs"],queryFn:()=>wH(50),refetchInterval:1e4}),{data:n,isLoading:s}=he({queryKey:["handoff-stats"],queryFn:SH,refetchInterval:3e4}),{data:r,isLoading:i}=he({queryKey:["specialist-handoffs"],queryFn:()=>kH(50),refetchInterval:1e4}),{data:o,isLoading:a}=he({queryKey:["specialist-handoff-stats"],queryFn:CH,refetchInterval:3e4});return t||s||i||a?l.jsx("div",{className:"p-6",children:l.jsx("div",{className:"text-content-subtle",children:"Loading handoff data..."})}):l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-2xl font-bold text-content mb-2",children:"Model Handoffs"}),l.jsx("p",{className:"text-content-subtle",children:"History of automatic and manual model handoffs across agents"})]}),n&&l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Total Handoffs"}),l.jsx("div",{className:"text-2xl font-bold text-content",children:n.totalHandoffs})]}),l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Success Rate"}),l.jsxs("div",{className:"text-2xl font-bold text-green-400",children:[(n.successRate*100).toFixed(0),"%"]})]}),l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Most Common Trigger"}),l.jsx("div",{className:"text-sm font-medium text-content",children:((c=Object.entries(n.byTrigger).sort((f,m)=>m[1]-f[1])[0])==null?void 0:c[0])||"N/A"}),l.jsxs("div",{className:"text-xs text-content-muted",children:[((u=Object.entries(n.byTrigger).sort((f,m)=>m[1]-f[1])[0])==null?void 0:u[1])||0," times"]})]}),l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Most Popular Target"}),l.jsx("div",{className:"text-sm font-medium text-content",children:((d=Object.entries(n.byModel.to).sort((f,m)=>m[1]-f[1])[0])==null?void 0:d[0])||"N/A"}),l.jsxs("div",{className:"text-xs text-content-muted",children:[((h=Object.entries(n.byModel.to).sort((f,m)=>m[1]-f[1])[0])==null?void 0:h[1])||0," handoffs"]})]})]}),l.jsxs("div",{className:"bg-surface-raised rounded-lg border border-divider overflow-hidden",children:[l.jsx("div",{className:"p-4 border-b border-divider",children:l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Recent Handoffs"})}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-gray-750 text-left text-sm text-content-subtle",children:[l.jsx("th",{className:"px-4 py-3",children:"Timestamp"}),l.jsx("th",{className:"px-4 py-3",children:"Agent"}),l.jsx("th",{className:"px-4 py-3",children:"Transition"}),l.jsx("th",{className:"px-4 py-3",children:"Trigger"}),l.jsx("th",{className:"px-4 py-3",children:"Reason"}),l.jsx("th",{className:"px-4 py-3",children:"Cost"}),l.jsx("th",{className:"px-4 py-3",children:"Status"})]})}),l.jsx("tbody",{className:"text-sm",children:e&&e.handoffs.length>0?e.handoffs.map((f,m)=>l.jsxs("tr",{className:"border-t border-divider hover:bg-gray-750",children:[l.jsx("td",{className:"px-4 py-3 text-content-subtle",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(ll,{className:"w-3 h-3"}),aS(f.timestamp)]})}),l.jsxs("td",{className:"px-4 py-3",children:[l.jsx("div",{className:"font-medium text-content",children:f.agentId}),l.jsx("div",{className:"text-xs text-content-muted",children:f.issueId})]}),l.jsx("td",{className:"px-4 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${lS[f.from.model]||"text-content-subtle bg-surface-overlay"}`,children:f.from.model}),l.jsx(Cx,{className:"w-3 h-3 text-content-muted"}),l.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${lS[f.to.model]||"text-content-subtle bg-surface-overlay"}`,children:f.to.model})]})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("span",{className:`text-xs ${jH[f.trigger]||"text-content-subtle"}`,children:NH[f.trigger]||f.trigger})}),l.jsx("td",{className:"px-4 py-3 text-content-body max-w-xs truncate",children:f.reason}),l.jsx("td",{className:"px-4 py-3 text-emerald-400",children:f.context.costAtHandoff!==void 0?`$${f.context.costAtHandoff.toFixed(4)}`:"-"}),l.jsx("td",{className:"px-4 py-3",children:f.success?l.jsx("span",{className:"text-green-400 text-xs",children:"✓ Success"}):l.jsx("span",{className:"text-red-400 text-xs",title:f.errorMessage,children:"✗ Failed"})})]},`${f.timestamp}-${m}`)):l.jsx("tr",{children:l.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-content-muted",children:"No handoffs recorded yet"})})})]})})]}),l.jsxs("div",{className:"mt-12",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("h2",{className:"text-2xl font-bold text-content mb-2",children:"Specialist Handoffs"}),l.jsx("p",{className:"text-content-subtle",children:"Queue-based work handoffs between specialist agents (review, test, merge)"})]}),o&&l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Today's Handoffs"}),l.jsx("div",{className:"text-2xl font-bold text-content",children:o.todayCount})]}),l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Queue Depth"}),l.jsx("div",{className:"text-2xl font-bold text-orange-400",children:o.queueDepth})]}),l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Success Rate"}),l.jsxs("div",{className:"text-2xl font-bold text-green-400",children:[(o.successRate*100).toFixed(0),"%"]})]}),l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Most Active"}),l.jsx("div",{className:"text-sm font-medium text-content",children:((p=Object.entries(o.bySpecialist).map(([f,m])=>({name:f,total:m.sent+m.received})).sort((f,m)=>m.total-f.total)[0])==null?void 0:p.name)||"N/A"})]})]}),l.jsxs("div",{className:"bg-surface-raised rounded-lg border border-divider overflow-hidden mt-6",children:[l.jsx("div",{className:"p-4 border-b border-divider",children:l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Recent Specialist Handoffs"})}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-gray-750 text-left text-sm text-content-subtle",children:[l.jsx("th",{className:"px-4 py-3",children:"Timestamp"}),l.jsx("th",{className:"px-4 py-3",children:"Issue"}),l.jsx("th",{className:"px-4 py-3",children:"Transition"}),l.jsx("th",{className:"px-4 py-3",children:"Priority"}),l.jsx("th",{className:"px-4 py-3",children:"Status"}),l.jsx("th",{className:"px-4 py-3",children:"Workspace"})]})}),l.jsx("tbody",{className:"text-sm",children:r&&r.handoffs.length>0?r.handoffs.map(f=>{var m,g;return l.jsxs("tr",{className:"border-t border-divider hover:bg-gray-750",children:[l.jsx("td",{className:"px-4 py-3 text-content-subtle",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(ll,{className:"w-3 h-3"}),aS(f.timestamp)]})}),l.jsxs("td",{className:"px-4 py-3",children:[l.jsx("div",{className:"font-medium text-content",children:f.issueId}),((m=f.context)==null?void 0:m.branch)&&l.jsx("div",{className:"text-xs text-content-muted",children:f.context.branch})]}),l.jsx("td",{className:"px-4 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${cS[f.fromSpecialist]||"text-content-subtle bg-surface-overlay"}`,children:f.fromSpecialist}),l.jsx(Cx,{className:"w-3 h-3 text-content-muted"}),l.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${cS[f.toSpecialist]||"text-content-subtle bg-surface-overlay"}`,children:f.toSpecialist})]})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("span",{className:`text-xs ${PH[f.priority]}`,children:f.priority})}),l.jsxs("td",{className:"px-4 py-3",children:[l.jsx("span",{className:`text-xs ${EH[f.status]}`,children:f.status}),f.result&&l.jsxs("span",{className:"ml-2 text-xs text-content-muted",children:["(",f.result,")"]})]}),l.jsx("td",{className:"px-4 py-3 text-content-subtle text-xs",children:((g=f.context)==null?void 0:g.workspace)||"-"})]},f.id)}):l.jsx("tr",{children:l.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-content-muted",children:"No specialist handoffs recorded yet"})})})]})})]})]})]})}function RH({request:e,isOpen:t,onConfirm:n,onDeny:s,onClose:r}){return!t||!e?null:l.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg shadow-2xl w-full max-w-md mx-4",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(kn,{className:"w-5 h-5 text-orange-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Confirmation Required"})]}),l.jsx("button",{onClick:r,className:"text-content-subtle hover:text-content-body transition-colors",children:l.jsx(yt,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"p-4 space-y-3",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm text-content-subtle mb-1",children:"Agent:"}),l.jsx("p",{className:"text-base text-content font-medium",children:e.agentId})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm text-content-subtle mb-1",children:"Action:"}),l.jsx("p",{className:"text-base text-content font-medium",children:e.action})]}),e.details&&l.jsxs("div",{children:[l.jsx("p",{className:"text-sm text-content-subtle mb-1",children:"Details:"}),l.jsx("p",{className:"text-sm text-content-body bg-surface/50 p-2 rounded border border-divider",children:e.details})]}),l.jsx("div",{className:"mt-4 p-3 bg-orange-500/10 border border-orange-500/30 rounded",children:l.jsx("p",{className:"text-sm text-orange-200",children:"⚠️ This action cannot be undone. Please confirm that you want to proceed."})})]}),l.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-divider bg-surface/30",children:[l.jsx("button",{onClick:s,className:"px-4 py-2 rounded text-sm bg-surface-overlay text-content-body hover:bg-surface-emphasis transition-colors",children:"Deny"}),l.jsx("button",{onClick:n,className:"px-4 py-2 rounded text-sm bg-orange-600 text-content hover:bg-orange-700 transition-colors font-medium",children:"Confirm"})]})]})})}async function DH(){const e=await fetch("/api/metrics/summary");if(!e.ok)throw new Error("Failed to fetch metrics summary");return e.json()}async function MH(){const e=await fetch("/api/handoffs/stats");if(!e.ok)throw new Error("Failed to fetch handoff stats");return e.json()}async function LH(){const e=await fetch("/api/specialist-handoffs/stats");if(!e.ok)throw new Error("Failed to fetch specialist handoff stats");return e.json()}function AH(){const{data:e}=he({queryKey:["metrics-summary"],queryFn:DH,refetchInterval:3e4}),{data:t}=he({queryKey:["handoff-stats"],queryFn:MH,refetchInterval:3e4}),{data:n}=he({queryKey:["specialist-handoff-stats"],queryFn:LH,refetchInterval:3e4});if(!e)return null;const s=t?Object.values(t.byTrigger).reduce((r,i)=>r+i,0):0;return l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:[l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(na,{className:"w-5 h-5 text-green-400"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Cost Today (UTC)"})]})}),l.jsxs("div",{className:"text-2xl font-bold text-content",children:["$",e.today.totalCost.toFixed(2)]}),e.topSpenders.agents.length>0&&l.jsxs("div",{className:"mt-2 text-xs text-content-muted",children:["Top: ",e.topSpenders.agents[0].agentId," ($",e.topSpenders.agents[0].cost.toFixed(2),")"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(au,{className:"w-5 h-5 text-blue-400"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Agents"})]})}),l.jsxs("div",{className:"text-2xl font-bold text-content",children:[e.today.activeCount," / ",e.today.agentCount]}),l.jsxs("div",{className:"mt-2 text-xs text-content-muted",children:[e.today.activeCount," active, ",e.today.agentCount-e.today.activeCount," ","idle"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(kn,{className:"w-5 h-5 text-red-400"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Stuck Agents"})]})}),l.jsx("div",{className:"text-2xl font-bold text-content",children:e.today.stuckCount}),l.jsxs("div",{className:"mt-2 text-xs text-content-muted",children:[e.today.warningCount," warnings"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ZN,{className:"w-5 h-5 text-cyan-400"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Specialist Handoffs"})]})}),l.jsx("div",{className:"text-2xl font-bold text-content",children:(n==null?void 0:n.todayCount)??0}),l.jsx("div",{className:"mt-2 text-xs text-content-muted",children:n?`${(n.successRate*100).toFixed(0)}% success rate`:"No data"})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(i0,{className:"w-5 h-5 text-purple-400"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Cost Escalations"})]})}),l.jsx("div",{className:"text-2xl font-bold text-content",children:s}),l.jsx("div",{className:"mt-2 text-xs text-content-muted",children:t?`${(t.successRate*100).toFixed(0)}% success rate`:"No data"})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(tj,{className:"w-5 h-5 text-orange-400"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Queue Depth"})]})}),l.jsx("div",{className:"text-2xl font-bold text-content",children:(n==null?void 0:n.queueDepth)??0}),l.jsx("div",{className:"mt-2 text-xs text-content-muted",children:(n==null?void 0:n.queueDepth)===0?"All clear":`${n==null?void 0:n.queueDepth} pending`})]})]})}async function OH(){const e=await fetch("/api/metrics/summary");if(!e.ok)throw new Error("Failed to fetch metrics summary");return e.json()}async function IH(){const e=await fetch("/api/metrics/costs");if(!e.ok)throw new Error("Failed to fetch cost metrics");return e.json()}function FH(){const{data:e}=he({queryKey:["metrics-summary"],queryFn:OH,refetchInterval:3e4}),{data:t}=he({queryKey:["metrics-costs"],queryFn:IH,refetchInterval:3e4});return l.jsxs("div",{className:"p-6 overflow-auto h-full",children:[l.jsx("h1",{className:"text-3xl font-bold text-content mb-6",children:"Metrics Dashboard"}),e&&l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(na,{className:"w-6 h-6 text-green-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Cost Today (UTC)"})]}),l.jsxs("div",{className:"text-3xl font-bold text-content mb-2",children:["$",e.today.totalCost.toFixed(2)]}),l.jsx("div",{className:"text-sm text-content-subtle",children:"Daily total"})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(i0,{className:"w-6 h-6 text-blue-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Active Agents"})]}),l.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:e.today.activeCount}),l.jsxs("div",{className:"text-sm text-content-subtle",children:["of ",e.today.agentCount," total"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(kn,{className:"w-6 h-6 text-red-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Stuck Agents"})]}),l.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:e.today.stuckCount}),l.jsxs("div",{className:"text-sm text-content-subtle",children:[e.today.warningCount," warnings"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(n0,{className:"w-6 h-6 text-purple-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Handoffs Today"})]}),l.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:"-"}),l.jsx("div",{className:"text-sm text-content-subtle",children:"Coming soon"})]})]}),t&&l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8",children:[l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Top Agents by Cost"}),l.jsxs("div",{className:"space-y-3",children:[t.topAgents.slice(0,10).map((n,s)=>l.jsxs("div",{className:"flex items-center justify-between p-3 bg-surface/50 rounded",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("span",{className:"text-lg font-bold text-content-muted",children:["#",s+1]}),l.jsx("span",{className:"text-content font-mono text-sm",children:n.agentId})]}),l.jsxs("span",{className:"text-green-400 font-semibold",children:["$",n.cost.toFixed(2)]})]},n.agentId)),t.topAgents.length===0&&l.jsx("div",{className:"text-center text-content-muted py-8",children:"No cost data yet"})]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Top Issues by Cost"}),l.jsxs("div",{className:"space-y-3",children:[t.topIssues.slice(0,10).map((n,s)=>l.jsxs("div",{className:"flex items-center justify-between p-3 bg-surface/50 rounded",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("span",{className:"text-lg font-bold text-content-muted",children:["#",s+1]}),l.jsx("span",{className:"text-content font-mono text-sm",children:n.issueId})]}),l.jsxs("span",{className:"text-green-400 font-semibold",children:["$",n.cost.toFixed(2)]})]},n.issueId)),t.topIssues.length===0&&l.jsx("div",{className:"text-center text-content-muted py-8",children:"No cost data yet"})]})]})]}),l.jsxs("div",{className:"mb-8",children:[l.jsx("h2",{className:"text-xl font-semibold text-content mb-4",children:"Services"}),l.jsx(AE,{})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Historical Trends"}),l.jsxs("div",{className:"text-center text-content-muted py-16",children:[l.jsx("p",{className:"mb-2",children:"Charts coming soon"}),l.jsx("p",{className:"text-sm",children:"Cost over time, handoff success rates, and more"})]})]})]})}async function BH(){const e=await fetch("/api/costs/by-issue");if(!e.ok)throw new Error("Failed to fetch costs");return e.json()}function zH(){const[e,t]=v.useState(null),{data:n,isLoading:s}=he({queryKey:["costs-by-issue"],queryFn:BH,refetchInterval:1e4});if(s)return l.jsx("div",{className:"p-6 h-full flex items-center justify-center",children:l.jsx("div",{className:"text-content-subtle",children:"Loading costs..."})});if(!n)return l.jsx("div",{className:"p-6 h-full flex items-center justify-center",children:l.jsx("div",{className:"text-red-400",children:"Failed to load costs"})});const r=n.issues.reduce((c,u)=>c+u.totalCost,0),i=n.issues.filter(c=>c.budget),o=i.filter(c=>c.totalCost>(c.budget||0)),a=e?n.issues.find(c=>c.issueId===e):null;return l.jsxs("div",{className:"p-6 overflow-auto h-full",children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsx("h1",{className:"text-3xl font-bold text-content",children:"Cost Tracking"}),l.jsx("div",{className:"flex items-center gap-3",children:l.jsx("div",{className:`px-3 py-1 rounded text-sm ${n.status==="live"?"bg-green-900/30 text-green-400":n.status==="migrating"?"bg-yellow-900/30 text-yellow-400":"bg-red-900/30 text-red-400"}`,children:n.status==="live"?"● Live":n.status==="migrating"?"⟳ Migrating":"⚠ Stale"})})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(na,{className:"w-6 h-6 text-green-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Total Cost"})]}),l.jsxs("div",{className:"text-3xl font-bold text-content mb-2",children:["$",r.toFixed(2)]}),l.jsxs("div",{className:"text-sm text-content-subtle",children:[n.issues.length," issues tracked"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(i0,{className:"w-6 h-6 text-blue-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Event Count"})]}),l.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:n.eventCount.toLocaleString()}),l.jsx("div",{className:"text-sm text-content-subtle",children:"Total events logged"})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(kn,{className:"w-6 h-6 text-yellow-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Budget Warnings"})]}),l.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:n.issues.filter(c=>c.budgetWarning).length}),l.jsxs("div",{className:"text-sm text-content-subtle",children:[i.length," with budgets"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(dM,{className:"w-6 h-6 text-purple-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Over Budget"})]}),l.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:o.length}),l.jsx("div",{className:"text-sm text-content-subtle",children:"Exceeded limit"})]})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Costs by Issue"}),l.jsx("div",{className:"space-y-2 max-h-[600px] overflow-auto",children:n.issues.map(c=>{const u=c.budget?c.totalCost/c.budget*100:0;return l.jsxs("div",{onClick:()=>t(c.issueId),className:`p-4 rounded-lg cursor-pointer transition-colors ${e===c.issueId?"bg-blue-900/30 border border-blue-500":"bg-surface/50 hover:bg-surface"}`,children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-content font-mono font-semibold",children:c.issueId}),c.budgetWarning&&l.jsx(kn,{className:"w-4 h-4 text-yellow-400"})]}),l.jsxs("span",{className:"text-green-400 font-bold",children:["$",c.totalCost.toFixed(2)]})]}),c.budget&&l.jsxs("div",{className:"mb-2",children:[l.jsxs("div",{className:"flex items-center justify-between text-xs text-content-subtle mb-1",children:[l.jsxs("span",{children:["Budget: $",c.budget.toFixed(2)]}),l.jsxs("span",{children:[u.toFixed(0),"%"]})]}),l.jsx("div",{className:"w-full bg-surface-overlay rounded-full h-2",children:l.jsx("div",{className:`h-2 rounded-full transition-all ${u>=100?"bg-red-500":u>=80?"bg-yellow-500":"bg-green-500"}`,style:{width:`${Math.min(u,100)}%`}})})]}),l.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-subtle",children:[l.jsxs("span",{children:[c.tokenCount.toLocaleString()," tokens"]}),l.jsxs("span",{children:[Object.keys(c.models).length," models"]})]})]},c.issueId)})})]}),l.jsx("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:a?l.jsxs(l.Fragment,{children:[l.jsxs("h3",{className:"text-xl font-semibold text-content mb-4",children:[a.issueId," Details"]}),l.jsxs("div",{className:"mb-6",children:[l.jsx("h4",{className:"text-sm font-semibold text-content-subtle mb-3",children:"Token Usage"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[l.jsx("div",{className:"text-xs text-content-subtle",children:"Input"}),l.jsx("div",{className:"text-lg font-semibold text-content",children:a.inputTokens.toLocaleString()})]}),l.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[l.jsx("div",{className:"text-xs text-content-subtle",children:"Output"}),l.jsx("div",{className:"text-lg font-semibold text-content",children:a.outputTokens.toLocaleString()})]}),l.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[l.jsx("div",{className:"text-xs text-content-subtle",children:"Cache Read"}),l.jsx("div",{className:"text-lg font-semibold text-content",children:a.cacheReadTokens.toLocaleString()})]}),l.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[l.jsx("div",{className:"text-xs text-content-subtle",children:"Cache Write"}),l.jsx("div",{className:"text-lg font-semibold text-content",children:a.cacheWriteTokens.toLocaleString()})]})]})]}),l.jsxs("div",{className:"mb-6",children:[l.jsx("h4",{className:"text-sm font-semibold text-content-subtle mb-3",children:"By Model"}),l.jsx("div",{className:"space-y-2",children:Object.entries(a.models).map(([c,u])=>l.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:"text-sm text-content font-mono",children:c}),l.jsxs("span",{className:"text-sm text-green-400 font-semibold",children:["$",u.cost.toFixed(4)]})]}),l.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-subtle",children:[l.jsxs("span",{children:[u.calls," calls"]}),l.jsxs("span",{children:[u.tokens.toLocaleString()," tokens"]})]})]},c))})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-sm font-semibold text-content-subtle mb-3",children:"By Provider"}),l.jsx("div",{className:"space-y-2",children:Object.entries(a.providers).filter(([c,u])=>u>0).map(([c,u])=>l.jsx("div",{className:"bg-surface/50 rounded p-3",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-sm text-content capitalize",children:c}),l.jsxs("span",{className:"text-sm text-green-400 font-semibold",children:["$",u.toFixed(4)]})]})},c))})]})]}):l.jsx("div",{className:"h-full flex items-center justify-center text-content-muted",children:"Select an issue to view details"})})]})]})}const Y0={anthropic:{name:"Anthropic",models:[{id:"claude-opus-4-6",name:"Claude Opus 4.6",icon:"diamond",tier:"premium",capabilities:["reasoning","code","vision","agentic"],description:"Most capable, best for complex tasks"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",icon:"auto_awesome",tier:"balanced",capabilities:["reasoning","code","vision","agentic"],description:"Latest Sonnet — fast, capable, great for implementation"},{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",icon:"auto_awesome",tier:"balanced",capabilities:["reasoning","code","vision","agentic"],description:"Previous gen Sonnet, strong coding performance"},{id:"claude-haiku-4-5",name:"Claude Haiku 4.5",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient","code"],description:"Fastest, ideal for simple tasks"}]},openai:{name:"OpenAI",models:[{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",icon:"code",tier:"premium",capabilities:["reasoning","code","complex-math"],description:"80% SWE-bench, premium coding"},{id:"o3-deep-research",name:"O3 Deep Research",icon:"psychology",tier:"premium",capabilities:["reasoning","complex-math"],description:"Deep reasoning model for debugging"},{id:"gpt-4o",name:"GPT-4o",icon:"science",tier:"balanced",capabilities:["reasoning","code","vision"],description:"Versatile multimodal model"},{id:"gpt-4o-mini",name:"GPT-4o Mini",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient"],description:"Budget option for simple tasks"}]},google:{name:"Google",models:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",icon:"model_training",tier:"premium",capabilities:["reasoning","large-context","code"],description:"1M context, first >1500 Elo on LMArena"},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient","large-context"],description:"Extremely fast with 1M context"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",icon:"model_training",tier:"balanced",capabilities:["reasoning","large-context","code"],description:"Advanced reasoning, 1M context"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient","large-context"],description:"Fast and efficient with large context"}]},kimi:{name:"Kimi (Moonshot)",models:[{id:"kimi-k2.5",name:"Kimi K2.5",icon:"model_training",tier:"premium",capabilities:["reasoning","code","agentic","large-context"],description:"Best open-source coding, 256K context, 76.8% SWE-bench"},{id:"kimi-k2",name:"Kimi K2",icon:"token",tier:"balanced",capabilities:["reasoning","code","agentic","large-context"],description:"Strong value, 65.8% SWE-bench, 128K context"}]},zai:{name:"Zhipu (GLM)",models:[{id:"glm-4.7",name:"GLM 4.7",icon:"hub",tier:"premium",capabilities:["reasoning","code","agentic","large-context"],description:"Top open-source for agentic coding, 73.8% SWE-bench, 200K context"},{id:"glm-4.7-flash",name:"GLM 4.7 Flash",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient","code"],description:"Fast and affordable, good for quick iterations"}]}},X0={"issue-agent:exploration":["reasoning","large-context"],"issue-agent:implementation":["code","reasoning","agentic"],"issue-agent:testing":["code","reasoning"],"issue-agent:documentation":["reasoning"],"issue-agent:review-response":["reasoning","code"],"specialist-review-agent":["reasoning","code"],"specialist-test-agent":["code","reasoning"],"specialist-merge-agent":["code"],"convoy:security-reviewer":["reasoning","code"],"convoy:performance-reviewer":["reasoning","code"],"convoy:correctness-reviewer":["reasoning","code"],"convoy:synthesis-agent":["reasoning"],"subagent:explore":["fast","reasoning"],"subagent:plan":["reasoning"],"subagent:bash":["fast","code"],"subagent:general-purpose":["reasoning","code"],"prd-agent":["reasoning"],"decomposition-agent":["reasoning"],"triage-agent":["fast","reasoning"],"cli:interactive":["reasoning","code"],"cli:quick-command":["fast"]},$H={"issue-agent:exploration":"Exploration Phase","issue-agent:implementation":"Implementation Phase","issue-agent:testing":"Testing Phase","issue-agent:documentation":"Documentation Phase","issue-agent:review-response":"Review Response Phase","specialist-review-agent":"Review Agent","specialist-test-agent":"Test Agent","specialist-merge-agent":"Merge Agent","convoy:security-reviewer":"Security Reviewer","convoy:performance-reviewer":"Performance Reviewer","convoy:correctness-reviewer":"Correctness Reviewer","convoy:synthesis-agent":"Synthesis Agent","subagent:explore":"Explore Subagent","subagent:plan":"Plan Subagent","subagent:bash":"Bash Subagent","subagent:general-purpose":"General Purpose Subagent","prd-agent":"PRD Agent","decomposition-agent":"Decomposition Agent","triage-agent":"Triage Agent","cli:interactive":"CLI Interactive","cli:quick-command":"CLI Quick Command"},pi={reasoning:{name:"Reasoning",icon:"psychology",description:"Complex problem solving"},code:{name:"Code",icon:"code",description:"Code generation & analysis"},vision:{name:"Vision",icon:"visibility",description:"Image understanding"},fast:{name:"Fast",icon:"bolt",description:"Quick response times"},"cost-efficient":{name:"Cheap",icon:"savings",description:"Low token cost"},"large-context":{name:"Large Context",icon:"unfold_more",description:"100K+ token window"},"complex-math":{name:"Math",icon:"calculate",description:"Advanced mathematics"},efficiency:{name:"Efficient",icon:"eco",description:"Good value for capability"},agentic:{name:"Agentic",icon:"smart_toy",description:"Multi-step tool use"}};function HH(){return Object.values(Y0).flatMap(e=>e.models)}function b5(e){const t=HH(),n=t.find(r=>r.id===e);if(n)return n;const s=e.toLowerCase();if(s.includes("opus")&&s.includes("4"))return t.find(r=>r.id==="claude-opus-4-6");if(s.includes("sonnet")&&s.includes("4"))return t.find(r=>r.id==="claude-sonnet-4-5");if(s.includes("haiku"))return t.find(r=>r.id==="claude-haiku-4-5");if(s.includes("claude")&&!s.includes("opus")&&!s.includes("haiku"))return t.find(r=>r.id==="claude-sonnet-4-5");if(s.includes("gpt-4o")||s==="gpt4o")return t.find(r=>r.id==="gpt-4o");if(s.includes("o1")&&!s.includes("o3"))return t.find(r=>r.id==="o1");if(s.includes("o3"))return t.find(r=>r.id==="o3-mini");if(s.includes("gemini")&&s.includes("flash"))return t.find(r=>r.id==="gemini-2.5-flash");if(s.includes("gemini"))return t.find(r=>r.id==="gemini-2.5-pro");if(s.includes("kimi")||s.includes("moonshot"))return s.includes("k2.5")||s.includes("2.5")?t.find(r=>r.id==="kimi-k2.5"):t.find(r=>r.id==="kimi-k2");if(s.includes("glm")||s.includes("zhipu")||s.includes("chatglm"))return s.includes("flash")?t.find(r=>r.id==="glm-4-flash"):s.includes("air")?t.find(r=>r.id==="glm-4-air"):s.includes("long")||s.includes("1m")?t.find(r=>r.id==="glm-4-long"):t.find(r=>r.id==="glm-4-plus")}function WH(e,t){const n=b5(e),s=X0[t]||["reasoning"];if(!n)return{score:0,matched:[],missing:s};const r=s.filter(o=>n.capabilities.includes(o)),i=s.filter(o=>!n.capabilities.includes(o));return{score:s.length>0?r.length/s.length:0,matched:r,missing:i}}function UH({workType:e,currentModel:t,isOverride:n,enabledProviders:s,onApply:r,onRemove:i,onClose:o}){const[a,c]=v.useState(t),u=$H[e]||e,d=X0[e]||["reasoning"],h=v.useMemo(()=>Object.entries(Y0).filter(([g])=>g==="anthropic"||s.includes(g)),[s]),p=v.useMemo(()=>{let g=null;for(const[y,x]of h)for(const b of x.models){const S=b.capabilities.filter(j=>d.includes(j)).length/d.length,C=b.tier==="balanced"?.1:0,w=S+C;(!g||w>g.score)&&(g={id:b.id,score:w})}return g==null?void 0:g.id},[h,d]),f=()=>{r(a),o()},m=a!==t;return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm p-4",children:[l.jsxs("div",{className:"w-full max-w-[680px] bg-surface border border-divider rounded-xl shadow-2xl flex flex-col overflow-hidden",children:[l.jsx("div",{className:"p-6 border-b border-divider",children:l.jsxs("div",{className:"flex justify-between items-start gap-3",children:[l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("h1",{className:"text-content tracking-tight text-2xl font-bold",children:"Select Model"}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-content-muted text-sm",children:"Task:"}),l.jsx("span",{className:"text-blue-400 font-medium",children:u})]}),l.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[l.jsx("span",{className:"text-content-muted text-xs",children:"Needs:"}),d.map(g=>l.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded bg-blue-500/20 text-blue-300 font-medium",children:pi[g].name},g))]})]}),l.jsx("button",{onClick:o,className:"text-content-muted hover:text-content transition-colors p-1",children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar max-h-[450px]",children:h.map(([g,y],x)=>l.jsxs("div",{className:"flex flex-col",children:[x>0&&l.jsx("div",{className:"h-px bg-divider mx-6 my-2"}),l.jsx("h3",{className:"text-content-muted text-xs font-bold uppercase tracking-widest px-6 pb-2 pt-5",children:y.name}),y.models.map(b=>{const _=a===b.id,S=b.id===p,C=b.capabilities.filter(j=>d.includes(j)),w=C.length/d.length;return l.jsxs("div",{onClick:()=>c(b.id),title:b.description,className:`group flex items-center gap-4 px-6 py-3.5 cursor-pointer transition-all border-l-2 ${_?"bg-blue-500/10 border-blue-400 shadow-[0_0_15px_rgba(59,130,246,0.1)]":S?"bg-blue-500/5 border-blue-400/50 hover:bg-blue-500/10":"border-transparent hover:bg-surface-overlay"}`,children:[l.jsx("div",{className:`flex items-center justify-center rounded-lg shrink-0 size-10 transition-colors ${_||S?"bg-blue-500/20":"bg-surface-emphasis group-hover:bg-divider"}`,children:l.jsx("span",{className:`material-symbols-outlined text-xl ${_||S?"text-blue-400":"text-content-muted"}`,children:b.icon})}),l.jsxs("div",{className:"flex flex-1 flex-col justify-center min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("p",{className:`text-content text-sm ${_?"font-bold":"font-medium"} truncate`,children:b.name}),S&&l.jsx("span",{className:"px-2 py-0.5 rounded-full bg-blue-500 text-[9px] text-content font-bold uppercase tracking-tight shrink-0",children:"Best Fit"}),b.tier==="premium"&&!S&&l.jsx("span",{className:"px-2 py-0.5 rounded-full bg-amber-500/20 text-[9px] text-amber-400 font-bold uppercase tracking-tight shrink-0",children:"Premium"}),b.tier==="fast"&&l.jsx("span",{className:"px-2 py-0.5 rounded-full bg-emerald-500/20 text-[9px] text-emerald-400 font-bold uppercase tracking-tight shrink-0",children:"Fast"})]}),l.jsx("div",{className:"flex gap-1.5 mt-1.5 flex-wrap",children:b.capabilities.map(j=>{const E=C.includes(j);return l.jsx("span",{title:pi[j].description,className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${E?"bg-blue-500/20 text-blue-300":"bg-surface-emphasis text-content-subtle border border-divider"}`,children:pi[j].name},j)})})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[w===1?l.jsx("span",{className:"text-emerald-400 text-xs font-bold",children:"100%"}):w>=.5?l.jsxs("span",{className:"text-amber-400 text-xs font-bold",children:[Math.round(w*100),"%"]}):l.jsxs("span",{className:"text-content-muted text-xs font-bold",children:[Math.round(w*100),"%"]}),_&&l.jsx("span",{className:"material-symbols-outlined text-blue-400",children:"check_circle"})]})]},b.id)})]},g))}),l.jsxs("div",{className:"p-5 border-t border-divider bg-surface flex justify-between items-center",children:[l.jsx("div",{children:n&&l.jsx("button",{onClick:()=>{i(),o()},className:"text-rose-400 hover:text-rose-300 text-sm font-medium transition-colors",children:"Remove Override"})}),l.jsxs("div",{className:"flex gap-3",children:[l.jsx("button",{onClick:o,className:"px-5 py-2 rounded-lg text-content-muted font-medium hover:text-content hover:bg-surface-overlay transition-all text-sm",children:"Cancel"}),l.jsx("button",{onClick:f,disabled:!m&&n,className:"px-6 py-2 rounded-lg bg-blue-500 text-content font-bold hover:bg-blue-400 active:scale-95 transition-all shadow-lg shadow-blue-500/20 disabled:opacity-50 disabled:cursor-not-allowed text-sm",children:"Apply Selection"})]})]})]}),l.jsx("style",{children:`
|
|
622
|
-
.custom-scrollbar::-webkit-scrollbar {
|
|
623
|
-
width: 4px;
|
|
624
|
-
}
|
|
625
|
-
.custom-scrollbar::-webkit-scrollbar-track {
|
|
626
|
-
background: transparent;
|
|
627
|
-
}
|
|
628
|
-
.custom-scrollbar::-webkit-scrollbar-thumb {
|
|
629
|
-
background: var(--color-overlay);
|
|
630
|
-
border-radius: 10px;
|
|
631
|
-
}
|
|
632
|
-
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
633
|
-
background: #3b82f6;
|
|
634
|
-
}
|
|
635
|
-
`})]})}async function qH(){const e=await fetch("/api/settings");if(!e.ok)throw new Error("Failed to fetch settings");return e.json()}async function KH(e){const t=await fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.text();throw new Error(n||"Failed to save settings")}return t.json()}async function VH(){const e=await fetch("/api/settings/optimal-defaults");if(!e.ok)throw new Error("Failed to fetch optimal defaults");return e.json()}async function uS(e,t,n){const s=await fetch("/api/settings/test-api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,apiKey:t,model:n})});if(!s.ok)throw new Error("Failed to test API key");return s.json()}const $m=[{id:"anthropic",name:"Anthropic",icon:"deployed_code",placeholder:"sk-ant-..."},{id:"openai",name:"OpenAI",icon:"auto_awesome",placeholder:"sk-..."},{id:"google",name:"Google",icon:"cloud",placeholder:"AIza..."},{id:"kimi",name:"Kimi (Moonshot)",icon:"token",placeholder:"sk-kimi-..."},{id:"zai",name:"Zhipu (GLM)",icon:"hub",placeholder:"sk-zai-..."}],dS=[{id:"linear",name:"Linear",icon:"view_kanban",envVar:"LINEAR_API_KEY",placeholder:"lin_api_..."},{id:"github",name:"GitHub",icon:"code",envVar:"GITHUB_TOKEN",placeholder:"ghp_..."},{id:"gitlab",name:"GitLab",icon:"commit",envVar:"GITLAB_TOKEN",placeholder:"glpat-..."},{id:"rally",name:"Rally",icon:"flag",envVar:"RALLY_API_KEY",placeholder:"_abc123..."}],YH=[{name:"Issue Agent Phases",icon:"list_alt",agents:[{id:"issue-agent:exploration",name:"Exploration",icon:"search",description:"Codebase discovery"},{id:"issue-agent:implementation",name:"Implementation",icon:"code",description:"Write the code"},{id:"issue-agent:testing",name:"Testing",icon:"science",description:"Write & run tests"},{id:"issue-agent:documentation",name:"Documentation",icon:"description",description:"Update docs"},{id:"issue-agent:review-response",name:"Review Response",icon:"reply",description:"Address PR feedback"}]},{name:"Specialist Agents",icon:"psychology",agents:[{id:"specialist-review-agent",name:"Review Agent",icon:"rate_review",description:"Automated code reviews"},{id:"specialist-test-agent",name:"Test Agent",icon:"science",description:"Test generation"},{id:"specialist-merge-agent",name:"Merge Agent",icon:"call_merge",description:"Merge conflict resolution"}]},{name:"Convoy Reviewers",icon:"groups",agents:[{id:"convoy:security-reviewer",name:"Security",icon:"shield",description:"Security analysis"},{id:"convoy:performance-reviewer",name:"Performance",icon:"speed",description:"Performance review"},{id:"convoy:correctness-reviewer",name:"Correctness",icon:"check_circle",description:"Logic validation"},{id:"convoy:synthesis-agent",name:"Synthesis",icon:"merge",description:"Combine reviews"}]},{name:"Subagents",icon:"account_tree",agents:[{id:"subagent:explore",name:"Explore",icon:"explore",description:"Codebase exploration"},{id:"subagent:plan",name:"Plan",icon:"event_note",description:"Task breakdown"},{id:"subagent:bash",name:"Bash",icon:"terminal",description:"CLI commands"},{id:"subagent:general-purpose",name:"General",icon:"psychology",description:"General tasks"}]},{name:"Workflow Agents",icon:"route",agents:[{id:"prd-agent",name:"PRD Agent",icon:"article",description:"Product requirements"},{id:"decomposition-agent",name:"Decomposition",icon:"account_tree",description:"Break down epics"},{id:"triage-agent",name:"Triage",icon:"filter_list",description:"Prioritize issues"},{id:"status-review",name:"Status Review",icon:"assessment",description:"AI status reviews (executive-facing)"}]},{name:"CLI Modes",icon:"terminal",agents:[{id:"cli:interactive",name:"Interactive",icon:"chat",description:"Conversation mode"},{id:"cli:quick-command",name:"Quick Command",icon:"bolt",description:"One-shot queries"}]}],hS="claude-sonnet-4-5";function XH(e){const t=b5(e);return t?t.name:e.includes("claude")?e.includes("opus")?"Opus 4.6":e.includes("haiku")?"Haiku":"Sonnet 4.5":e.includes("gpt")?"GPT-4o":e.includes("gemini")?e.includes("flash")?"Gemini Flash":"Gemini Pro":e.includes("kimi")?e.includes("k2.5")||e.includes("2.5")?"Kimi K2.5":"Kimi K2":e.includes("glm")?"GLM-4":e}function QH(){var H,k;const e=Nt(),t=_l(),{data:n,isLoading:s,error:r}=he({queryKey:["settings"],queryFn:qH}),[i,o]=v.useState(null),[a,c]=v.useState({}),[u,d]=v.useState({}),[h,p]=v.useState(null),[f,m]=v.useState(null),[g,y]=v.useState({}),[x,b]=v.useState(null),[_,S]=v.useState(null),[C,w]=v.useState({});v.useEffect(()=>{if(n&&!i&&(o(n),n.deprecation_warnings&&n.deprecation_warnings.length>0)){const F=n.deprecation_warnings.length;uc.warning(`${F} deprecated model${F>1?"s":""} detected. Click "Save" to migrate automatically.`,{duration:1e4})}},[n,i]);const j=we({mutationFn:KH,onSuccess:F=>{e.invalidateQueries({queryKey:["settings"]}),e.invalidateQueries({queryKey:["tracker-status"]}),uc.success("Settings saved successfully"),F.warnings&&F.warnings.length>0&&F.warnings.forEach(M=>{uc.warning(M,{duration:8e3})})},onError:F=>{uc.error(`Failed to save settings: ${F.message}`)}});if(s)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx(_e,{className:"w-8 h-8 text-blue-400 animate-spin"})});if(r||!i)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsxs("div",{className:"text-red-400",children:["Error: ",(r==null?void 0:r.message)||"Failed to load settings"]})});const E=JSON.stringify(i)!==JSON.stringify(n),O=F=>{F!=="anthropic"&&o({...i,models:{...i.models,providers:{...i.models.providers,[F]:!i.models.providers[F]}}})},R=(F,M)=>{F!=="anthropic"&&o({...i,api_keys:{...i.api_keys,[F]:M||void 0}})},B=(F,M)=>{o({...i,tracker_keys:{...i.tracker_keys,[F]:M||void 0}})},L=(F,M)=>{o({...i,models:{...i.models,overrides:{...i.models.overrides,[F]:M}}})},D=F=>{const{[F]:M,...N}=i.models.overrides;o({...i,models:{...i.models,overrides:N}})},T=()=>j.mutate(i),P=()=>o(n||null),$=async()=>{try{const F=await VH(),M={models:{providers:{...(i==null?void 0:i.models.providers)||F.models.providers},overrides:{...F.models.overrides},gemini_thinking_level:F.models.gemini_thinking_level},api_keys:{...(i==null?void 0:i.api_keys)||{}},tracker_keys:{...(i==null?void 0:i.tracker_keys)||{}}};o(M)}catch(F){console.error("Failed to fetch optimal defaults:",F),t({message:"Failed to load optimal defaults: "+F.message,variant:"error"})}},W=async F=>{const M=i==null?void 0:i.api_keys[F];if(M){m(F),y({...g,[F]:null});try{const N=await uS(F,M);y({...g,[F]:N})}catch{y({...g,[F]:{success:!1,error:"Test failed",response:null,latencyMs:0}})}finally{m(null)}}},I=async(F,M)=>{const N=i==null?void 0:i.api_keys[F];if(!N)return;const z=`${F}:${M}`;S(z),w({...C,[z]:null});try{const U=await uS(F,N,M);w({...C,[z]:U})}catch{w({...C,[z]:{success:!1,error:"Test failed",response:null,latencyMs:0}})}finally{S(null)}};return l.jsxs("div",{className:"max-w-[1200px] mx-auto px-6 md:px-10 py-8 pb-32",children:[l.jsx("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4 mb-8",children:l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("span",{className:"material-symbols-outlined text-blue-400 text-2xl",children:"settings"}),l.jsx("h1",{className:"text-content text-4xl font-black tracking-tight",children:"Settings"})]}),l.jsx("p",{className:"text-content-muted text-base",children:"Configure AI model orchestration and agent permissions."})]})}),i.deprecation_warnings&&i.deprecation_warnings.length>0&&l.jsx("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-xl px-4 py-3 mb-6",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:"material-symbols-outlined text-amber-400 text-xl shrink-0 mt-0.5",children:"warning"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-amber-400 font-semibold mb-2",children:"Deprecated Model IDs Detected"}),l.jsx("div",{className:"space-y-1",children:i.deprecation_warnings.map((F,M)=>l.jsxs("p",{className:"text-amber-400/90 text-sm",children:[l.jsx("span",{className:"font-mono text-xs bg-amber-500/20 px-1.5 py-0.5 rounded",children:F.workType}),": ",l.jsx("span",{className:"font-mono text-xs bg-amber-500/20 px-1.5 py-0.5 rounded line-through",children:F.from})," → ",l.jsx("span",{className:"font-mono text-xs bg-amber-500/20 px-1.5 py-0.5 rounded",children:F.to})]},M))}),l.jsxs("p",{className:"text-amber-400/80 text-xs mt-3",children:["Click ",l.jsx("span",{className:"font-semibold",children:"Save"})," to automatically migrate to current model IDs. A backup will be created before migration."]})]})]})}),l.jsx("section",{className:"mb-10",children:l.jsx("div",{className:"bg-surface-raised border border-divider rounded-xl overflow-hidden",children:l.jsxs("div",{className:"flex flex-col lg:flex-row",children:[l.jsxs("div",{className:"lg:w-2/5 bg-surface p-8 flex flex-col justify-center items-center border-b lg:border-b-0 lg:border-r border-divider relative overflow-hidden",children:[l.jsx("div",{className:"absolute inset-0 opacity-10 pointer-events-none bg-[radial-gradient(circle_at_50%_50%,#3b82f6_0%,transparent_70%)]"}),l.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6 w-full max-w-xs",children:[l.jsxs("div",{className:"flex items-center justify-between w-full",children:[l.jsx("div",{className:"size-12 rounded-lg bg-surface-emphasis border border-divider-strong flex items-center justify-center shadow-sm",children:l.jsx("span",{className:"material-symbols-outlined text-content-subtle",children:"terminal"})}),l.jsx("div",{className:"flex-1 h-px bg-gradient-to-r from-divider-strong via-blue-500 to-divider-strong mx-2"}),l.jsx("div",{className:"size-12 rounded-lg bg-surface-emphasis border border-divider-strong flex items-center justify-center shadow-sm",children:l.jsx("span",{className:"material-symbols-outlined text-blue-400",children:"account_tree"})}),l.jsx("div",{className:"flex-1 h-px bg-gradient-to-r from-divider via-blue-500 to-divider mx-2"}),l.jsx("div",{className:"size-12 rounded-lg bg-blue-500 flex items-center justify-center shadow-[0_0_20px_rgba(59,130,246,0.4)]",children:l.jsx("span",{className:"material-symbols-outlined text-content",children:"bolt"})})]}),l.jsxs("div",{className:"flex justify-between w-full px-2 text-[10px] uppercase tracking-widest font-bold text-content-muted",children:[l.jsx("span",{children:"Task"}),l.jsx("span",{children:"Capability"}),l.jsx("span",{children:"Model"})]})]})]}),l.jsxs("div",{className:"lg:w-3/5 p-8",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx("span",{className:"px-2 py-0.5 bg-blue-500/10 text-blue-400 text-[10px] font-bold uppercase tracking-wider rounded border border-blue-500/20",children:"Active"}),l.jsx("h3",{className:"text-content text-xl font-bold",children:"Smart Model Selection"})]}),l.jsx("p",{className:"text-content-muted mb-6 leading-relaxed",children:"Panopticon automatically routes tasks to the optimal model based on capabilities, token budget, and latency requirements."}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:"material-symbols-outlined text-blue-400 text-sm mt-1",children:"check_circle"}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-semibold text-content",children:"Capability Matching"}),l.jsx("p",{className:"text-xs text-content-muted",children:"Best model for each task type"})]})]}),l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:"material-symbols-outlined text-blue-400 text-sm mt-1",children:"check_circle"}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-semibold text-content",children:"Cost Optimization"}),l.jsx("p",{className:"text-xs text-content-muted",children:"Balance performance vs spend"})]})]})]})]})]})})}),l.jsxs("section",{className:"mb-12",children:[l.jsxs("h2",{className:"text-content text-2xl font-bold mb-6 flex items-center gap-3",children:["Provider Configuration",l.jsx("div",{className:"h-px flex-1 bg-divider-strong"})]}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:$m.map(F=>{var U,K,Q,Y,Z;const M=F.id==="anthropic",N=M||i.models.providers[F.id],z=i.api_keys[F.id]||"";return l.jsxs("div",{className:`bg-surface-raised border rounded-xl p-5 relative transition-colors shadow-sm ${M?"border-blue-500/50 shadow-lg shadow-blue-500/5":"border-divider hover:border-divider-strong"}`,children:[M&&l.jsx("div",{className:"absolute -top-3 right-4",children:l.jsx("span",{className:"bg-blue-500 text-content text-[10px] font-black px-2 py-0.5 rounded uppercase tracking-tighter",children:"Default"})}),l.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[l.jsx("div",{className:"size-10 rounded-lg bg-surface-emphasis border border-divider flex items-center justify-center",children:l.jsx("span",{className:"material-symbols-outlined text-content-subtle",children:F.icon})}),l.jsx("span",{className:"font-bold text-content",children:F.name}),l.jsx("div",{className:"ml-auto",children:l.jsx("button",{onClick:()=>O(F.id),disabled:M,className:`w-10 h-5 rounded-full relative transition-colors ${N?"bg-blue-500":"bg-surface-emphasis"} ${M?"cursor-not-allowed":"cursor-pointer"}`,children:l.jsx("div",{className:`absolute top-0.5 size-4 bg-white rounded-full transition-all ${N?"right-0.5":"left-0.5"}`})})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"relative",children:[l.jsx("label",{className:"text-[10px] uppercase font-bold text-content-muted mb-1 block",children:"API Key"}),z.startsWith("$")?l.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg px-3 py-2",children:[l.jsxs("div",{className:"flex items-center gap-2 text-amber-400 text-xs",children:[l.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),l.jsxs("span",{children:["Configured via ",l.jsx("code",{className:"font-mono bg-surface-overlay px-1 rounded",children:z})]})]}),l.jsx("p",{className:"text-[10px] text-amber-400/70 mt-1",children:"Set this environment variable or enter the key directly below"}),l.jsx("input",{type:"text",placeholder:F.placeholder,onChange:ue=>R(F.id,ue.target.value),autoComplete:"off",className:"w-full bg-input-bg border border-divider-strong rounded-lg px-3 py-2 text-xs font-mono mt-2 focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-content-body"})]}):l.jsxs("div",{className:"relative",children:[l.jsx("input",{type:a[F.id]?"text":"password",value:z,onChange:ue=>R(F.id,ue.target.value),disabled:M,placeholder:F.placeholder,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"data-lpignore":"true","data-1p-ignore":"true","data-form-type":"other",className:`w-full bg-input-bg border border-divider-strong rounded-lg px-3 py-2 pr-16 text-xs font-mono focus:ring-1 focus:ring-blue-500 focus:border-blue-500 ${M?"cursor-not-allowed text-content-muted":"text-content-body"}`}),!M&&l.jsx("button",{onClick:()=>c({...a,[F.id]:!a[F.id]}),className:"absolute right-8 top-1/2 -translate-y-1/2 text-content-muted hover:text-content-body",children:l.jsx("span",{className:"material-symbols-outlined text-[16px]",children:a[F.id]?"visibility_off":"visibility"})})]})]}),!M&&l.jsxs("div",{className:"flex flex-col gap-2",children:[z&&!z.startsWith("$")&&l.jsxs("button",{onClick:()=>b(F.id),className:"flex items-center justify-center gap-1.5 px-3 py-1.5 bg-blue-500/10 hover:bg-blue-500/20 border border-blue-500/30 rounded-lg text-xs text-blue-400 transition-colors w-full",children:[l.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"view_list"}),"View Models"]}),z&&!z.startsWith("$")&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>W(F.id),disabled:f===F.id,className:"flex items-center gap-1.5 px-3 py-1.5 bg-surface-emphasis hover:bg-divider-strong border border-divider-strong rounded-lg text-xs text-content-body transition-colors disabled:opacity-50",children:[f===F.id?l.jsx(_e,{className:"w-3 h-3 animate-spin"}):l.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"quiz"}),"Test 2+3"]}),g[F.id]&&l.jsxs("div",{className:`flex items-center gap-1 text-xs ${(U=g[F.id])!=null&&U.success?"text-green-400":"text-red-400"}`,children:[l.jsx("span",{className:"material-symbols-outlined text-[14px]",children:(K=g[F.id])!=null&&K.success?"check_circle":"error"}),(Q=g[F.id])!=null&&Q.success?`${(Y=g[F.id])==null?void 0:Y.latencyMs}ms`:(Z=g[F.id])==null?void 0:Z.error]})]})]})]})]},F.id)})})]}),l.jsxs("section",{className:"mb-12",children:[l.jsxs("h2",{className:"text-content text-2xl font-bold mb-6 flex items-center gap-3",children:["Tracker API Keys",l.jsx("div",{className:"h-px flex-1 bg-divider-strong"})]}),l.jsxs("p",{className:"text-content-muted text-sm mb-6",children:["Configure API keys for your issue trackers. These override environment variables (",dS.map(F=>F.envVar).join(", "),")."]}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:dS.map(F=>{var N;const M=((N=i.tracker_keys)==null?void 0:N[F.id])||"";return l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-xl p-5 relative transition-colors shadow-sm hover:border-divider-strong",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[l.jsx("div",{className:"size-10 rounded-lg bg-surface-emphasis border border-divider flex items-center justify-center",children:l.jsx("span",{className:"material-symbols-outlined text-content-subtle",children:F.icon})}),l.jsxs("div",{children:[l.jsx("span",{className:"font-bold text-content",children:F.name}),l.jsx("p",{className:"text-[10px] text-content-muted font-mono",children:F.envVar})]})]}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{className:"relative",children:[l.jsx("label",{className:"text-[10px] uppercase font-bold text-content-muted mb-1 block",children:"API Key / Token"}),M.startsWith("$")?l.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg px-3 py-2",children:[l.jsxs("div",{className:"flex items-center gap-2 text-amber-400 text-xs",children:[l.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),l.jsxs("span",{children:["Configured via ",l.jsx("code",{className:"font-mono bg-surface-overlay px-1 rounded",children:M})]})]}),l.jsx("input",{type:"text",placeholder:F.placeholder,onChange:z=>B(F.id,z.target.value),autoComplete:"off",className:"w-full bg-input-bg border border-divider-strong rounded-lg px-3 py-2 text-xs font-mono mt-2 focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-content-body"})]}):l.jsxs("div",{className:"relative",children:[l.jsx("input",{type:u[F.id]?"text":"password",value:M,onChange:z=>B(F.id,z.target.value),placeholder:F.placeholder,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"data-lpignore":"true","data-1p-ignore":"true","data-form-type":"other",className:"w-full bg-input-bg border border-divider-strong rounded-lg px-3 py-2 pr-10 text-xs font-mono focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-content-body"}),l.jsx("button",{onClick:()=>d({...u,[F.id]:!u[F.id]}),className:"absolute right-2 top-1/2 -translate-y-1/2 text-content-muted hover:text-content-body",children:l.jsx("span",{className:"material-symbols-outlined text-[16px]",children:u[F.id]?"visibility_off":"visibility"})})]})]})})]},F.id)})})]}),l.jsxs("section",{className:"mb-12",children:[l.jsxs("h2",{className:"text-content text-2xl font-bold mb-6 flex items-center gap-3",children:["Model Assignments",l.jsx("div",{className:"h-px flex-1 bg-divider-strong"})]}),l.jsx("div",{className:"space-y-8",children:YH.map(F=>l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx("span",{className:"material-symbols-outlined text-content-muted text-lg",children:F.icon}),l.jsx("h3",{className:"text-content-body font-semibold text-sm uppercase tracking-wider",children:F.name}),l.jsx("div",{className:"h-px flex-1 bg-divider"})]}),l.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:F.agents.map(M=>{var fe;const N=i.models.overrides[M.id]||hS,z=XH(N),{score:U,matched:K,missing:Q}=WH(N,M.id),Y=X0[M.id]||[],Z=(fe=i.deprecation_warnings)==null?void 0:fe.some(Ie=>Ie.workType===M.id&&Ie.from===N),ue=U>=1&&!Z,Oe=U>=.5&&U<1&&!Z,Re=[`${M.name}: ${M.description}`,`Model: ${z}`,Z?"⚠️ DEPRECATED: Click to update to current model":"",`Needs: ${Y.map(Ie=>pi[Ie].name).join(", ")}`,K.length>0?`✓ Has: ${K.map(Ie=>pi[Ie].name).join(", ")}`:"",Q.length>0?`✗ Missing: ${Q.map(Ie=>pi[Ie].name).join(", ")}`:""].filter(Boolean).join(`
|
|
636
|
-
`);return l.jsxs("div",{onClick:()=>p(M.id),title:Re,className:`p-3 border rounded-lg cursor-pointer transition-all group relative ${Z?"bg-amber-500/10 border-amber-500/50 hover:border-amber-500/70 hover:bg-amber-500/15":ue?"bg-emerald-500/5 border-emerald-500/30 hover:border-emerald-500/50 hover:bg-emerald-500/10":Oe?"bg-amber-500/5 border-amber-500/30 hover:border-amber-500/50 hover:bg-amber-500/10":"bg-rose-500/5 border-rose-500/30 hover:border-rose-500/50 hover:bg-rose-500/10"}`,children:[Z&&l.jsx("div",{className:"absolute top-1 right-1",children:l.jsx("span",{className:"bg-amber-500 text-content text-[8px] font-black px-1 py-0.5 rounded uppercase tracking-tighter",children:"DEPRECATED"})}),l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("span",{className:`material-symbols-outlined text-sm ${Z?"text-amber-400":ue?"text-emerald-400":Oe?"text-amber-400":"text-rose-400"}`,children:M.icon}),l.jsxs("span",{className:`text-[9px] font-bold ${Z?"text-amber-400":ue?"text-emerald-400":Oe?"text-amber-400":"text-rose-400"}`,children:[Math.round(U*100),"%"]})]}),l.jsx("p",{className:"text-xs font-semibold text-content truncate",children:M.name}),l.jsx("p",{className:"text-[10px] text-content-muted truncate mb-2",children:z}),l.jsx("div",{className:"flex gap-1 flex-wrap",children:Y.slice(0,3).map(Ie=>{const Ut=K.includes(Ie);return l.jsx("span",{title:`${pi[Ie].name}: ${Ut?"Model has this":"Model missing this"}`,className:`text-[8px] px-1 py-0.5 rounded ${Ut?"bg-emerald-500/20 text-emerald-400":"bg-rose-500/20 text-rose-400"}`,children:pi[Ie].name},Ie)})})]},M.id)})})]},F.name))})]}),l.jsx("footer",{className:"fixed bottom-0 left-0 right-0 bg-surface backdrop-blur-md border-t border-divider-strong shadow-[0_-2px_10px_rgba(0,0,0,0.05)] px-6 py-4 z-40",children:l.jsxs("div",{className:"max-w-[1200px] mx-auto flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2 text-content-muted text-sm",children:[j.isSuccess&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"material-symbols-outlined text-green-400",children:"check_circle"}),l.jsx("span",{className:"text-green-400",children:"Settings saved!"})]}),j.isError&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"material-symbols-outlined text-red-400",children:"error"}),l.jsx("span",{className:"text-red-400",children:"Error saving settings"})]})]}),l.jsxs("div",{className:"flex gap-4",children:[l.jsxs("button",{onClick:$,className:"px-6 py-2 text-amber-400 hover:text-amber-300 font-semibold text-sm transition-colors flex items-center gap-1.5",title:"Set all model assignments to research-based optimal defaults",children:[l.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"auto_fix_high"}),"Optimal Defaults"]}),l.jsx("button",{onClick:P,disabled:!E,className:"px-6 py-2 text-content-muted hover:text-content font-semibold text-sm transition-colors disabled:opacity-50",children:"Undo Changes"}),l.jsxs("button",{onClick:T,disabled:!E||j.isPending,className:"px-8 py-2 bg-blue-500 hover:bg-blue-400 text-content font-black rounded-lg transition-all shadow-lg shadow-blue-500/20 text-sm disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[j.isPending&&l.jsx(_e,{className:"w-4 h-4 animate-spin"}),"Save Changes"]})]})]})}),h&&l.jsx(UH,{workType:h,currentModel:i.models.overrides[h]||hS,isOverride:!!i.models.overrides[h],enabledProviders:Object.entries(i.models.providers).filter(([F,M])=>M).map(([F])=>F),onApply:F=>L(h,F),onRemove:()=>D(h),onClose:()=>p(null)}),x&&l.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:l.jsxs("div",{className:"bg-surface-raised border border-divider-strong rounded-xl shadow-2xl max-w-2xl w-full max-h-[80vh] overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"material-symbols-outlined text-blue-400",children:(H=$m.find(F=>F.id===x))==null?void 0:H.icon}),l.jsxs("h3",{className:"text-content text-lg font-bold",children:[(k=$m.find(F=>F.id===x))==null?void 0:k.name," Models"]})]}),l.jsx("button",{onClick:()=>b(null),className:"text-content-muted hover:text-content transition-colors",children:l.jsx(yt,{className:"w-5 h-5"})})]}),l.jsx("div",{className:"p-4 overflow-y-auto max-h-[60vh]",children:(()=>{var N;const F=(i==null?void 0:i.api_keys[x])||"",M=F.startsWith("$");return F?M?l.jsxs("div",{className:"text-center py-8",children:[l.jsx("span",{className:"material-symbols-outlined text-4xl text-amber-500 mb-2",children:"warning"}),l.jsx("p",{className:"text-amber-400",children:"API key configured via environment variable"}),l.jsxs("p",{className:"text-content-muted text-sm mt-1",children:[l.jsx("code",{className:"font-mono bg-surface-overlay px-1 rounded",children:F})," is not set"]}),l.jsx("p",{className:"text-content-muted text-xs mt-2",children:"Set the environment variable or enter the key directly in Settings"})]}):l.jsx("div",{className:"space-y-3",children:(((N=Y0[x])==null?void 0:N.models)||[]).map(z=>{var Y;const U=`${x}:${z.id}`,K=C[U],Q=_===U;return l.jsx("div",{className:"bg-surface border border-divider rounded-lg p-4 hover:border-divider-strong transition-colors",children:l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("span",{className:"material-symbols-outlined text-content-muted text-sm",children:z.icon}),l.jsx("h4",{className:"text-content font-semibold",children:z.name}),z.tier&&l.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${z.tier==="premium"?"bg-purple-500/20 text-purple-400":z.tier==="balanced"?"bg-blue-500/20 text-blue-400":"bg-emerald-500/20 text-emerald-400"}`,children:z.tier})]}),z.description&&l.jsx("p",{className:"text-xs text-content-muted mb-2",children:z.description}),l.jsx("div",{className:"flex flex-wrap gap-1",children:z.capabilities.map(Z=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 bg-surface-emphasis text-content-subtle rounded border border-divider",children:Z},Z))})]}),l.jsxs("div",{className:"flex flex-col items-end gap-2",children:[l.jsxs("button",{onClick:()=>I(x,z.id),disabled:Q,className:"flex items-center gap-1.5 px-3 py-1.5 bg-emerald-500/10 hover:bg-emerald-500/20 border border-emerald-500/30 rounded-lg text-xs text-emerald-400 transition-colors disabled:opacity-50 whitespace-nowrap",children:[Q?l.jsx(_e,{className:"w-3 h-3 animate-spin"}):l.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"play_arrow"}),"Test 2+3"]}),K&&l.jsxs("div",{className:`flex items-center gap-1 text-xs ${K.success?"text-green-400":"text-red-400"}`,children:[l.jsx("span",{className:"material-symbols-outlined text-[12px]",children:K.success?"check_circle":"error"}),K.success?`${K.latencyMs}ms`:((Y=K.error)==null?void 0:Y.slice(0,30))||"Failed"]})]})]})},z.id)})}):l.jsxs("div",{className:"text-center py-8",children:[l.jsx("span",{className:"material-symbols-outlined text-4xl text-content-muted mb-2",children:"key_off"}),l.jsx("p",{className:"text-content-muted",children:"Enter an API key to test models"})]})})()}),l.jsx("div",{className:"p-4 border-t border-divider bg-surface",children:l.jsx("p",{className:"text-xs text-content-muted text-center",children:'Test verifies API key and model availability by asking "What is 2+3?"'})})]})})]})}var fS=1,GH=.9,JH=.8,ZH=.17,Hm=.1,Wm=.999,e7=.9999,t7=.99,n7=/[\\\/_+.#"@\[\(\{&]/,s7=/[\\\/_+.#"@\[\(\{&]/g,r7=/[\s-]/,_5=/[\s-]/g;function Mv(e,t,n,s,r,i,o){if(i===t.length)return r===e.length?fS:t7;var a=`${r},${i}`;if(o[a]!==void 0)return o[a];for(var c=s.charAt(i),u=n.indexOf(c,r),d=0,h,p,f,m;u>=0;)h=Mv(e,t,n,s,u+1,i+1,o),h>d&&(u===r?h*=fS:n7.test(e.charAt(u-1))?(h*=JH,f=e.slice(r,u-1).match(s7),f&&r>0&&(h*=Math.pow(Wm,f.length))):r7.test(e.charAt(u-1))?(h*=GH,m=e.slice(r,u-1).match(_5),m&&r>0&&(h*=Math.pow(Wm,m.length))):(h*=ZH,r>0&&(h*=Math.pow(Wm,u-r))),e.charAt(u)!==t.charAt(i)&&(h*=e7)),(h<Hm&&n.charAt(u-1)===s.charAt(i+1)||s.charAt(i+1)===s.charAt(i)&&n.charAt(u-1)!==s.charAt(i))&&(p=Mv(e,t,n,s,u+1,i+2,o),p*Hm>h&&(h=p*Hm)),h>d&&(d=h),u=n.indexOf(c,u+1);return o[a]=d,d}function pS(e){return e.toLowerCase().replace(_5," ")}function i7(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Mv(e,t,pS(e),pS(t),0,0,{})}function Hi(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function mS(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Vi(...e){return t=>{let n=!1;const s=e.map(r=>{const i=mS(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<s.length;r++){const i=s[r];typeof i=="function"?i():mS(e[r],null)}}}}function oa(...e){return v.useCallback(Vi(...e),e)}function o7(e,t){const n=v.createContext(t),s=i=>{const{children:o,...a}=i,c=v.useMemo(()=>a,Object.values(a));return l.jsx(n.Provider,{value:c,children:o})};s.displayName=e+"Provider";function r(i){const o=v.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,r]}function a7(e,t=[]){let n=[];function s(i,o){const a=v.createContext(o),c=n.length;n=[...n,o];const u=h=>{var x;const{scope:p,children:f,...m}=h,g=((x=p==null?void 0:p[e])==null?void 0:x[c])||a,y=v.useMemo(()=>m,Object.values(m));return l.jsx(g.Provider,{value:y,children:f})};u.displayName=i+"Provider";function d(h,p){var g;const f=((g=p==null?void 0:p[e])==null?void 0:g[c])||a,m=v.useContext(f);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,d]}const r=()=>{const i=n.map(o=>v.createContext(o));return function(a){const c=(a==null?void 0:a[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return r.scopeName=e,[s,l7(r,...t)]}function l7(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const o=s.reduce((a,{useScope:c,scopeName:u})=>{const h=c(i)[`__scope${u}`];return{...a,...h}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var mu=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},c7=oy[" useId ".trim().toString()]||(()=>{}),u7=0;function zr(e){const[t,n]=v.useState(c7());return mu(()=>{n(s=>s??String(u7++))},[e]),t?`radix-${t}`:""}var d7=oy[" useInsertionEffect ".trim().toString()]||mu;function h7({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,i,o]=f7({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:r;{const d=v.useRef(e!==void 0);v.useEffect(()=>{const h=d.current;h!==a&&console.warn(`${s} is changing from ${h?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,s])}const u=v.useCallback(d=>{var h;if(a){const p=p7(d)?d(e):d;p!==e&&((h=o.current)==null||h.call(o,p))}else i(d)},[a,e,i,o]);return[c,u]}function f7({defaultProp:e,onChange:t}){const[n,s]=v.useState(e),r=v.useRef(n),i=v.useRef(t);return d7(()=>{i.current=t},[t]),v.useEffect(()=>{var o;r.current!==n&&((o=i.current)==null||o.call(i,n),r.current=n)},[n,r]),[n,s,i]}function p7(e){return typeof e=="function"}function Ku(e){const t=m7(e),n=v.forwardRef((s,r)=>{const{children:i,...o}=s,a=v.Children.toArray(i),c=a.find(x7);if(c){const u=c.props.children,d=a.map(h=>h===c?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:h);return l.jsx(t,{...o,ref:r,children:v.isValidElement(u)?v.cloneElement(u,void 0,d):null})}return l.jsx(t,{...o,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}function m7(e){const t=v.forwardRef((n,s)=>{const{children:r,...i}=n;if(v.isValidElement(r)){const o=y7(r),a=v7(i,r.props);return r.type!==v.Fragment&&(a.ref=s?Vi(s,o):o),v.cloneElement(r,a)}return v.Children.count(r)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var g7=Symbol("radix.slottable");function x7(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===g7}function v7(e,t){const n={...t};for(const s in t){const r=e[s],i=t[s];/^on[A-Z]/.test(s)?r&&i?n[s]=(...a)=>{const c=i(...a);return r(...a),c}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function y7(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var b7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],w5=b7.reduce((e,t)=>{const n=Ku(`Primitive.${t}`),s=v.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function _7(e,t){e&&js.flushSync(()=>e.dispatchEvent(t))}function gu(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function w7(e,t=globalThis==null?void 0:globalThis.document){const n=gu(e);v.useEffect(()=>{const s=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var S7="DismissableLayer",Lv="dismissableLayer.update",k7="dismissableLayer.pointerDownOutside",C7="dismissableLayer.focusOutside",gS,S5=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),k5=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:r,onFocusOutside:i,onInteractOutside:o,onDismiss:a,...c}=e,u=v.useContext(S5),[d,h]=v.useState(null),p=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=v.useState({}),m=oa(t,j=>h(j)),g=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=g.indexOf(y),b=d?g.indexOf(d):-1,_=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=x,C=E7(j=>{const E=j.target,O=[...u.branches].some(R=>R.contains(E));!S||O||(r==null||r(j),o==null||o(j),j.defaultPrevented||a==null||a())},p),w=P7(j=>{const E=j.target;[...u.branches].some(R=>R.contains(E))||(i==null||i(j),o==null||o(j),j.defaultPrevented||a==null||a())},p);return w7(j=>{b===u.layers.size-1&&(s==null||s(j),!j.defaultPrevented&&a&&(j.preventDefault(),a()))},p),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(gS=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),xS(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=gS)}},[d,p,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),xS())},[d,u]),v.useEffect(()=>{const j=()=>f({});return document.addEventListener(Lv,j),()=>document.removeEventListener(Lv,j)},[]),l.jsx(w5.div,{...c,ref:m,style:{pointerEvents:_?S?"auto":"none":void 0,...e.style},onFocusCapture:Hi(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Hi(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Hi(e.onPointerDownCapture,C.onPointerDownCapture)})});k5.displayName=S7;var N7="DismissableLayerBranch",j7=v.forwardRef((e,t)=>{const n=v.useContext(S5),s=v.useRef(null),r=oa(t,s);return v.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),l.jsx(w5.div,{...e,ref:r})});j7.displayName=N7;function E7(e,t=globalThis==null?void 0:globalThis.document){const n=gu(e),s=v.useRef(!1),r=v.useRef(()=>{});return v.useEffect(()=>{const i=a=>{if(a.target&&!s.current){let c=function(){C5(k7,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=c,t.addEventListener("click",r.current,{once:!0})):c()}else t.removeEventListener("click",r.current);s.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function P7(e,t=globalThis==null?void 0:globalThis.document){const n=gu(e),s=v.useRef(!1);return v.useEffect(()=>{const r=i=>{i.target&&!s.current&&C5(C7,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function xS(){const e=new CustomEvent(Lv);document.dispatchEvent(e)}function C5(e,t,n,{discrete:s}){const r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),s?_7(r,i):r.dispatchEvent(i)}var T7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],R7=T7.reduce((e,t)=>{const n=Ku(`Primitive.${t}`),s=v.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),Um="focusScope.autoFocusOnMount",qm="focusScope.autoFocusOnUnmount",vS={bubbles:!1,cancelable:!0},D7="FocusScope",N5=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...o}=e,[a,c]=v.useState(null),u=gu(r),d=gu(i),h=v.useRef(null),p=oa(t,g=>c(g)),f=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(s){let g=function(_){if(f.paused||!a)return;const S=_.target;a.contains(S)?h.current=S:ai(h.current,{select:!0})},y=function(_){if(f.paused||!a)return;const S=_.relatedTarget;S!==null&&(a.contains(S)||ai(h.current,{select:!0}))},x=function(_){if(document.activeElement===document.body)for(const C of _)C.removedNodes.length>0&&ai(a)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const b=new MutationObserver(x);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),b.disconnect()}}},[s,a,f.paused]),v.useEffect(()=>{if(a){bS.add(f);const g=document.activeElement;if(!a.contains(g)){const x=new CustomEvent(Um,vS);a.addEventListener(Um,u),a.dispatchEvent(x),x.defaultPrevented||(M7(F7(j5(a)),{select:!0}),document.activeElement===g&&ai(a))}return()=>{a.removeEventListener(Um,u),setTimeout(()=>{const x=new CustomEvent(qm,vS);a.addEventListener(qm,d),a.dispatchEvent(x),x.defaultPrevented||ai(g??document.body,{select:!0}),a.removeEventListener(qm,d),bS.remove(f)},0)}}},[a,u,d,f]);const m=v.useCallback(g=>{if(!n&&!s||f.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(y&&x){const b=g.currentTarget,[_,S]=L7(b);_&&S?!g.shiftKey&&x===S?(g.preventDefault(),n&&ai(_,{select:!0})):g.shiftKey&&x===_&&(g.preventDefault(),n&&ai(S,{select:!0})):x===b&&g.preventDefault()}},[n,s,f.paused]);return l.jsx(R7.div,{tabIndex:-1,...o,ref:p,onKeyDown:m})});N5.displayName=D7;function M7(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(ai(s,{select:t}),document.activeElement!==n)return}function L7(e){const t=j5(e),n=yS(t,e),s=yS(t.reverse(),e);return[n,s]}function j5(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function yS(e,t){for(const n of e)if(!A7(n,{upTo:t}))return n}function A7(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function O7(e){return e instanceof HTMLInputElement&&"select"in e}function ai(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&O7(e)&&t&&e.select()}}var bS=I7();function I7(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=_S(e,t),e.unshift(t)},remove(t){var n;e=_S(e,t),(n=e[0])==null||n.resume()}}}function _S(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function F7(e){return e.filter(t=>t.tagName!=="A")}var B7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],z7=B7.reduce((e,t)=>{const n=Ku(`Primitive.${t}`),s=v.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),$7="Portal",E5=v.forwardRef((e,t)=>{var a;const{container:n,...s}=e,[r,i]=v.useState(!1);mu(()=>i(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?LN.createPortal(l.jsx(z7.div,{...s,ref:t}),o):null});E5.displayName=$7;function H7(e,t){return v.useReducer((n,s)=>t[n][s]??n,e)}var bp=e=>{const{present:t,children:n}=e,s=W7(t),r=typeof n=="function"?n({present:s.isPresent}):v.Children.only(n),i=oa(s.ref,U7(r));return typeof n=="function"||s.isPresent?v.cloneElement(r,{ref:i}):null};bp.displayName="Presence";function W7(e){const[t,n]=v.useState(),s=v.useRef(null),r=v.useRef(e),i=v.useRef("none"),o=e?"mounted":"unmounted",[a,c]=H7(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=Ld(s.current);i.current=a==="mounted"?u:"none"},[a]),mu(()=>{const u=s.current,d=r.current;if(d!==e){const p=i.current,f=Ld(u);e?c("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&p!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,c]),mu(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,h=f=>{const g=Ld(s.current).includes(CSS.escape(f.animationName));if(f.target===t&&g&&(c("ANIMATION_END"),!r.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},p=f=>{f.target===t&&(i.current=Ld(s.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:v.useCallback(u=>{s.current=u?getComputedStyle(u):null,n(u)},[])}}function Ld(e){return(e==null?void 0:e.animationName)||"none"}function U7(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var q7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vu=q7.reduce((e,t)=>{const n=Ku(`Primitive.${t}`),s=v.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),Km=0;function K7(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??wS()),document.body.insertAdjacentElement("beforeend",e[1]??wS()),Km++,()=>{Km===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Km--}},[])}function wS(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var lr=function(){return lr=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},lr.apply(this,arguments)};function P5(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}function V7(e,t,n){if(n||arguments.length===2)for(var s=0,r=t.length,i;s<r;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var jh="right-scroll-bar-position",Eh="width-before-scroll-bar",Y7="with-scroll-bars-hidden",X7="--removed-body-scroll-bar-size";function Vm(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Q7(e,t){var n=v.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=t,n.facade}var G7=typeof window<"u"?v.useLayoutEffect:v.useEffect,SS=new WeakMap;function J7(e,t){var n=Q7(null,function(s){return e.forEach(function(r){return Vm(r,s)})});return G7(function(){var s=SS.get(n);if(s){var r=new Set(s),i=new Set(e),o=n.current;r.forEach(function(a){i.has(a)||Vm(a,null)}),i.forEach(function(a){r.has(a)||Vm(a,o)})}SS.set(n,e)},[e]),n}function Z7(e){return e}function eW(e,t){t===void 0&&(t=Z7);var n=[],s=!1,r={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,s);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(s=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){s=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var c=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),n}}}};return r}function tW(e){e===void 0&&(e={});var t=eW(null);return t.options=lr({async:!0,ssr:!1},e),t}var T5=function(e){var t=e.sideCar,n=P5(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return v.createElement(s,lr({},n))};T5.isSideCarExport=!0;function nW(e,t){return e.useMedium(t),T5}var R5=tW(),Ym=function(){},_p=v.forwardRef(function(e,t){var n=v.useRef(null),s=v.useState({onScrollCapture:Ym,onWheelCapture:Ym,onTouchMoveCapture:Ym}),r=s[0],i=s[1],o=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,p=e.sideCar,f=e.noRelative,m=e.noIsolation,g=e.inert,y=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,_=e.gapMode,S=P5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,w=J7([n,t]),j=lr(lr({},S),r);return v.createElement(v.Fragment,null,d&&v.createElement(C,{sideCar:R5,removeScrollBar:u,shards:h,noRelative:f,noIsolation:m,inert:g,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:_}),o?v.cloneElement(v.Children.only(a),lr(lr({},j),{ref:w})):v.createElement(b,lr({},j,{className:c,ref:w}),a))});_p.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_p.classNames={fullWidth:Eh,zeroRight:jh};var sW=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function rW(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=sW();return t&&e.setAttribute("nonce",t),e}function iW(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function oW(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var aW=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rW())&&(iW(t,n),oW(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},lW=function(){var e=aW();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},D5=function(){var e=lW(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},cW={left:0,top:0,right:0,gap:0},Xm=function(e){return parseInt(e||"",10)||0},uW=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[Xm(n),Xm(s),Xm(r)]},dW=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return cW;var t=uW(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},hW=D5(),$a="data-scroll-locked",fW=function(e,t,n,s){var r=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
637
|
-
.`.concat(Y7,` {
|
|
638
|
-
overflow: hidden `).concat(s,`;
|
|
639
|
-
padding-right: `).concat(a,"px ").concat(s,`;
|
|
640
|
-
}
|
|
641
|
-
body[`).concat($a,`] {
|
|
642
|
-
overflow: hidden `).concat(s,`;
|
|
643
|
-
overscroll-behavior: contain;
|
|
644
|
-
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
645
|
-
padding-left: `.concat(r,`px;
|
|
646
|
-
padding-top: `).concat(i,`px;
|
|
647
|
-
padding-right: `).concat(o,`px;
|
|
648
|
-
margin-left:0;
|
|
649
|
-
margin-top:0;
|
|
650
|
-
margin-right: `).concat(a,"px ").concat(s,`;
|
|
651
|
-
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
.`).concat(jh,` {
|
|
655
|
-
right: `).concat(a,"px ").concat(s,`;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
.`).concat(Eh,` {
|
|
659
|
-
margin-right: `).concat(a,"px ").concat(s,`;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
.`).concat(jh," .").concat(jh,` {
|
|
663
|
-
right: 0 `).concat(s,`;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
.`).concat(Eh," .").concat(Eh,` {
|
|
667
|
-
margin-right: 0 `).concat(s,`;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
body[`).concat($a,`] {
|
|
671
|
-
`).concat(X7,": ").concat(a,`px;
|
|
672
|
-
}
|
|
673
|
-
`)},kS=function(){var e=parseInt(document.body.getAttribute($a)||"0",10);return isFinite(e)?e:0},pW=function(){v.useEffect(function(){return document.body.setAttribute($a,(kS()+1).toString()),function(){var e=kS()-1;e<=0?document.body.removeAttribute($a):document.body.setAttribute($a,e.toString())}},[])},mW=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;pW();var i=v.useMemo(function(){return dW(r)},[r]);return v.createElement(hW,{styles:fW(i,!t,r,n?"":"!important")})},Av=!1;if(typeof window<"u")try{var Ad=Object.defineProperty({},"passive",{get:function(){return Av=!0,!0}});window.addEventListener("test",Ad,Ad),window.removeEventListener("test",Ad,Ad)}catch{Av=!1}var ha=Av?{passive:!1}:!1,gW=function(e){return e.tagName==="TEXTAREA"},M5=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!gW(e)&&n[t]==="visible")},xW=function(e){return M5(e,"overflowY")},vW=function(e){return M5(e,"overflowX")},CS=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=L5(e,s);if(r){var i=A5(e,s),o=i[1],a=i[2];if(o>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},yW=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},bW=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},L5=function(e,t){return e==="v"?xW(t):vW(t)},A5=function(e,t){return e==="v"?yW(t):bW(t)},_W=function(e,t){return e==="h"&&t==="rtl"?-1:1},wW=function(e,t,n,s,r){var i=_W(e,window.getComputedStyle(t).direction),o=i*s,a=n.target,c=t.contains(a),u=!1,d=o>0,h=0,p=0;do{if(!a)break;var f=A5(e,a),m=f[0],g=f[1],y=f[2],x=g-y-i*m;(m||x)&&L5(e,a)&&(h+=x,p+=m);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(h)<1||!d&&Math.abs(p)<1)&&(u=!0),u},Od=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},NS=function(e){return[e.deltaX,e.deltaY]},jS=function(e){return e&&"current"in e?e.current:e},SW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},kW=function(e){return`
|
|
674
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
675
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
676
|
-
`)},CW=0,fa=[];function NW(e){var t=v.useRef([]),n=v.useRef([0,0]),s=v.useRef(),r=v.useState(CW++)[0],i=v.useState(D5)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var g=V7([e.lockRef.current],(e.shards||[]).map(jS),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var x=Od(g),b=n.current,_="deltaX"in g?g.deltaX:b[0]-x[0],S="deltaY"in g?g.deltaY:b[1]-x[1],C,w=g.target,j=Math.abs(_)>Math.abs(S)?"h":"v";if("touches"in g&&j==="h"&&w.type==="range")return!1;var E=window.getSelection(),O=E&&E.anchorNode,R=O?O===w||O.contains(w):!1;if(R)return!1;var B=CS(j,w);if(!B)return!0;if(B?C=j:(C=j==="v"?"h":"v",B=CS(j,w)),!B)return!1;if(!s.current&&"changedTouches"in g&&(_||S)&&(s.current=C),!C)return!0;var L=s.current||C;return wW(L,y,g,L==="h"?_:S)},[]),c=v.useCallback(function(g){var y=g;if(!(!fa.length||fa[fa.length-1]!==i)){var x="deltaY"in y?NS(y):Od(y),b=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&SW(C.delta,x)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var _=(o.current.shards||[]).map(jS).filter(Boolean).filter(function(C){return C.contains(y.target)}),S=_.length>0?a(y,_[0]):!o.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),u=v.useCallback(function(g,y,x,b){var _={name:g,delta:y,target:x,should:b,shadowParent:jW(x)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(S){return S!==_})},1)},[]),d=v.useCallback(function(g){n.current=Od(g),s.current=void 0},[]),h=v.useCallback(function(g){u(g.type,NS(g),g.target,a(g,e.lockRef.current))},[]),p=v.useCallback(function(g){u(g.type,Od(g),g.target,a(g,e.lockRef.current))},[]);v.useEffect(function(){return fa.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",c,ha),document.addEventListener("touchmove",c,ha),document.addEventListener("touchstart",d,ha),function(){fa=fa.filter(function(g){return g!==i}),document.removeEventListener("wheel",c,ha),document.removeEventListener("touchmove",c,ha),document.removeEventListener("touchstart",d,ha)}},[]);var f=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(i,{styles:kW(r)}):null,f?v.createElement(mW,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function jW(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const EW=nW(R5,NW);var O5=v.forwardRef(function(e,t){return v.createElement(_p,lr({},e,{ref:t,sideCar:EW}))});O5.classNames=_p.classNames;var PW=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},pa=new WeakMap,Id=new WeakMap,Fd={},Qm=0,I5=function(e){return e&&(e.host||I5(e.parentNode))},TW=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=I5(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},RW=function(e,t,n,s){var r=TW(t,Array.isArray(e)?e:[e]);Fd[n]||(Fd[n]=new WeakMap);var i=Fd[n],o=[],a=new Set,c=new Set(r),u=function(h){!h||a.has(h)||(a.add(h),u(h.parentNode))};r.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(p){if(a.has(p))d(p);else try{var f=p.getAttribute(s),m=f!==null&&f!=="false",g=(pa.get(p)||0)+1,y=(i.get(p)||0)+1;pa.set(p,g),i.set(p,y),o.push(p),g===1&&m&&Id.set(p,!0),y===1&&p.setAttribute(n,"true"),m||p.setAttribute(s,"true")}catch(x){console.error("aria-hidden: cannot operate on ",p,x)}})};return d(t),a.clear(),Qm++,function(){o.forEach(function(h){var p=pa.get(h)-1,f=i.get(h)-1;pa.set(h,p),i.set(h,f),p||(Id.has(h)||h.removeAttribute(s),Id.delete(h)),f||h.removeAttribute(n)}),Qm--,Qm||(pa=new WeakMap,pa=new WeakMap,Id=new WeakMap,Fd={})}},DW=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=PW(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),RW(s,r,n,"aria-hidden")):function(){return null}},wp="Dialog",[F5]=a7(wp),[MW,Vs]=F5(wp),B5=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,a=v.useRef(null),c=v.useRef(null),[u,d]=h7({prop:s,defaultProp:r??!1,onChange:i,caller:wp});return l.jsx(MW,{scope:t,triggerRef:a,contentRef:c,contentId:zr(),titleId:zr(),descriptionId:zr(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(h=>!h),[d]),modal:o,children:n})};B5.displayName=wp;var z5="DialogTrigger",LW=v.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(z5,n),i=oa(t,r.triggerRef);return l.jsx(Vu.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":J0(r.open),...s,ref:i,onClick:Hi(e.onClick,r.onOpenToggle)})});LW.displayName=z5;var Q0="DialogPortal",[AW,$5]=F5(Q0,{forceMount:void 0}),H5=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,i=Vs(Q0,t);return l.jsx(AW,{scope:t,forceMount:n,children:v.Children.map(s,o=>l.jsx(bp,{present:n||i.open,children:l.jsx(E5,{asChild:!0,container:r,children:o})}))})};H5.displayName=Q0;var Cf="DialogOverlay",W5=v.forwardRef((e,t)=>{const n=$5(Cf,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=Vs(Cf,e.__scopeDialog);return i.modal?l.jsx(bp,{present:s||i.open,children:l.jsx(IW,{...r,ref:t})}):null});W5.displayName=Cf;var OW=Ku("DialogOverlay.RemoveScroll"),IW=v.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(Cf,n);return l.jsx(O5,{as:OW,allowPinchZoom:!0,shards:[r.contentRef],children:l.jsx(Vu.div,{"data-state":J0(r.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Go="DialogContent",U5=v.forwardRef((e,t)=>{const n=$5(Go,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=Vs(Go,e.__scopeDialog);return l.jsx(bp,{present:s||i.open,children:i.modal?l.jsx(FW,{...r,ref:t}):l.jsx(BW,{...r,ref:t})})});U5.displayName=Go;var FW=v.forwardRef((e,t)=>{const n=Vs(Go,e.__scopeDialog),s=v.useRef(null),r=oa(t,n.contentRef,s);return v.useEffect(()=>{const i=s.current;if(i)return DW(i)},[]),l.jsx(q5,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Hi(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Hi(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:Hi(e.onFocusOutside,i=>i.preventDefault())})}),BW=v.forwardRef((e,t)=>{const n=Vs(Go,e.__scopeDialog),s=v.useRef(!1),r=v.useRef(!1);return l.jsx(q5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),q5=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,...o}=e,a=Vs(Go,n),c=v.useRef(null),u=oa(t,c);return K7(),l.jsxs(l.Fragment,{children:[l.jsx(N5,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:l.jsx(k5,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":J0(a.open),...o,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(WW,{titleId:a.titleId}),l.jsx(qW,{contentRef:c,descriptionId:a.descriptionId})]})]})}),G0="DialogTitle",zW=v.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(G0,n);return l.jsx(Vu.h2,{id:r.titleId,...s,ref:t})});zW.displayName=G0;var K5="DialogDescription",$W=v.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(K5,n);return l.jsx(Vu.p,{id:r.descriptionId,...s,ref:t})});$W.displayName=K5;var V5="DialogClose",HW=v.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(V5,n);return l.jsx(Vu.button,{type:"button",...s,ref:t,onClick:Hi(e.onClick,()=>r.onOpenChange(!1))})});HW.displayName=V5;function J0(e){return e?"open":"closed"}var Y5="DialogTitleWarning",[lte,X5]=o7(Y5,{contentName:Go,titleName:G0,docsSlug:"dialog"}),WW=({titleId:e})=>{const t=X5(Y5),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
677
|
-
|
|
678
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
679
|
-
|
|
680
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},UW="DialogDescriptionWarning",qW=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${X5(UW).contentName}}.`;return v.useEffect(()=>{var i;const r=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},KW=B5,VW=H5,YW=W5,XW=U5,QW=Symbol.for("react.lazy"),Nf=oy[" use ".trim().toString()];function GW(e){return typeof e=="object"&&e!==null&&"then"in e}function Q5(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===QW&&"_payload"in e&&GW(e._payload)}function JW(e){const t=ZW(e),n=v.forwardRef((s,r)=>{let{children:i,...o}=s;Q5(i)&&typeof Nf=="function"&&(i=Nf(i._payload));const a=v.Children.toArray(i),c=a.find(tU);if(c){const u=c.props.children,d=a.map(h=>h===c?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:h);return l.jsx(t,{...o,ref:r,children:v.isValidElement(u)?v.cloneElement(u,void 0,d):null})}return l.jsx(t,{...o,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}function ZW(e){const t=v.forwardRef((n,s)=>{let{children:r,...i}=n;if(Q5(r)&&typeof Nf=="function"&&(r=Nf(r._payload)),v.isValidElement(r)){const o=sU(r),a=nU(i,r.props);return r.type!==v.Fragment&&(a.ref=s?Vi(s,o):o),v.cloneElement(r,a)}return v.Children.count(r)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var eU=Symbol("radix.slottable");function tU(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eU}function nU(e,t){const n={...t};for(const s in t){const r=e[s],i=t[s];/^on[A-Z]/.test(s)?r&&i?n[s]=(...a)=>{const c=i(...a);return r(...a),c}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function sU(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var rU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],eo=rU.reduce((e,t)=>{const n=JW(`Primitive.${t}`),s=v.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),Jl='[cmdk-group=""]',Gm='[cmdk-group-items=""]',iU='[cmdk-group-heading=""]',G5='[cmdk-item=""]',ES=`${G5}:not([aria-disabled="true"])`,Ov="cmdk-item-select",ga="data-value",oU=(e,t,n)=>i7(e,t,n),J5=v.createContext(void 0),Yu=()=>v.useContext(J5),Z5=v.createContext(void 0),Z0=()=>v.useContext(Z5),eP=v.createContext(void 0),tP=v.forwardRef((e,t)=>{let n=xa(()=>{var M,N;return{search:"",value:(N=(M=e.value)!=null?M:e.defaultValue)!=null?N:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=xa(()=>new Set),r=xa(()=>new Map),i=xa(()=>new Map),o=xa(()=>new Set),a=nP(e),{label:c,children:u,value:d,onValueChange:h,filter:p,shouldFilter:f,loop:m,disablePointerSelection:g=!1,vimBindings:y=!0,...x}=e,b=zr(),_=zr(),S=zr(),C=v.useRef(null),w=xU();Jo(()=>{if(d!==void 0){let M=d.trim();n.current.value=M,j.emit()}},[d]),Jo(()=>{w(6,D)},[]);let j=v.useMemo(()=>({subscribe:M=>(o.current.add(M),()=>o.current.delete(M)),snapshot:()=>n.current,setState:(M,N,z)=>{var U,K,Q,Y;if(!Object.is(n.current[M],N)){if(n.current[M]=N,M==="search")L(),R(),w(1,B);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Z=document.getElementById(S);Z?Z.focus():(U=document.getElementById(b))==null||U.focus()}if(w(7,()=>{var Z;n.current.selectedItemId=(Z=T())==null?void 0:Z.id,j.emit()}),z||w(5,D),((K=a.current)==null?void 0:K.value)!==void 0){let Z=N??"";(Y=(Q=a.current).onValueChange)==null||Y.call(Q,Z);return}}j.emit()}},emit:()=>{o.current.forEach(M=>M())}}),[]),E=v.useMemo(()=>({value:(M,N,z)=>{var U;N!==((U=i.current.get(M))==null?void 0:U.value)&&(i.current.set(M,{value:N,keywords:z}),n.current.filtered.items.set(M,O(N,z)),w(2,()=>{R(),j.emit()}))},item:(M,N)=>(s.current.add(M),N&&(r.current.has(N)?r.current.get(N).add(M):r.current.set(N,new Set([M]))),w(3,()=>{L(),R(),n.current.value||B(),j.emit()}),()=>{i.current.delete(M),s.current.delete(M),n.current.filtered.items.delete(M);let z=T();w(4,()=>{L(),(z==null?void 0:z.getAttribute("id"))===M&&B(),j.emit()})}),group:M=>(r.current.has(M)||r.current.set(M,new Set),()=>{i.current.delete(M),r.current.delete(M)}),filter:()=>a.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:b,inputId:S,labelId:_,listInnerRef:C}),[]);function O(M,N){var z,U;let K=(U=(z=a.current)==null?void 0:z.filter)!=null?U:oU;return M?K(M,n.current.search,N):0}function R(){if(!n.current.search||a.current.shouldFilter===!1)return;let M=n.current.filtered.items,N=[];n.current.filtered.groups.forEach(U=>{let K=r.current.get(U),Q=0;K.forEach(Y=>{let Z=M.get(Y);Q=Math.max(Z,Q)}),N.push([U,Q])});let z=C.current;P().sort((U,K)=>{var Q,Y;let Z=U.getAttribute("id"),ue=K.getAttribute("id");return((Q=M.get(ue))!=null?Q:0)-((Y=M.get(Z))!=null?Y:0)}).forEach(U=>{let K=U.closest(Gm);K?K.appendChild(U.parentElement===K?U:U.closest(`${Gm} > *`)):z.appendChild(U.parentElement===z?U:U.closest(`${Gm} > *`))}),N.sort((U,K)=>K[1]-U[1]).forEach(U=>{var K;let Q=(K=C.current)==null?void 0:K.querySelector(`${Jl}[${ga}="${encodeURIComponent(U[0])}"]`);Q==null||Q.parentElement.appendChild(Q)})}function B(){let M=P().find(z=>z.getAttribute("aria-disabled")!=="true"),N=M==null?void 0:M.getAttribute(ga);j.setState("value",N||void 0)}function L(){var M,N,z,U;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let K=0;for(let Q of s.current){let Y=(N=(M=i.current.get(Q))==null?void 0:M.value)!=null?N:"",Z=(U=(z=i.current.get(Q))==null?void 0:z.keywords)!=null?U:[],ue=O(Y,Z);n.current.filtered.items.set(Q,ue),ue>0&&K++}for(let[Q,Y]of r.current)for(let Z of Y)if(n.current.filtered.items.get(Z)>0){n.current.filtered.groups.add(Q);break}n.current.filtered.count=K}function D(){var M,N,z;let U=T();U&&(((M=U.parentElement)==null?void 0:M.firstChild)===U&&((z=(N=U.closest(Jl))==null?void 0:N.querySelector(iU))==null||z.scrollIntoView({block:"nearest"})),U.scrollIntoView({block:"nearest"}))}function T(){var M;return(M=C.current)==null?void 0:M.querySelector(`${G5}[aria-selected="true"]`)}function P(){var M;return Array.from(((M=C.current)==null?void 0:M.querySelectorAll(ES))||[])}function $(M){let N=P()[M];N&&j.setState("value",N.getAttribute(ga))}function W(M){var N;let z=T(),U=P(),K=U.findIndex(Y=>Y===z),Q=U[K+M];(N=a.current)!=null&&N.loop&&(Q=K+M<0?U[U.length-1]:K+M===U.length?U[0]:U[K+M]),Q&&j.setState("value",Q.getAttribute(ga))}function I(M){let N=T(),z=N==null?void 0:N.closest(Jl),U;for(;z&&!U;)z=M>0?mU(z,Jl):gU(z,Jl),U=z==null?void 0:z.querySelector(ES);U?j.setState("value",U.getAttribute(ga)):W(M)}let H=()=>$(P().length-1),k=M=>{M.preventDefault(),M.metaKey?H():M.altKey?I(1):W(1)},F=M=>{M.preventDefault(),M.metaKey?$(0):M.altKey?I(-1):W(-1)};return v.createElement(eo.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:M=>{var N;(N=x.onKeyDown)==null||N.call(x,M);let z=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||z))switch(M.key){case"n":case"j":{y&&M.ctrlKey&&k(M);break}case"ArrowDown":{k(M);break}case"p":case"k":{y&&M.ctrlKey&&F(M);break}case"ArrowUp":{F(M);break}case"Home":{M.preventDefault(),$(0);break}case"End":{M.preventDefault(),H();break}case"Enter":{M.preventDefault();let U=T();if(U){let K=new Event(Ov);U.dispatchEvent(K)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:yU},c),Sp(e,M=>v.createElement(Z5.Provider,{value:j},v.createElement(J5.Provider,{value:E},M))))}),aU=v.forwardRef((e,t)=>{var n,s;let r=zr(),i=v.useRef(null),o=v.useContext(eP),a=Yu(),c=nP(e),u=(s=(n=c.current)==null?void 0:n.forceMount)!=null?s:o==null?void 0:o.forceMount;Jo(()=>{if(!u)return a.item(r,o==null?void 0:o.id)},[u]);let d=sP(r,i,[e.value,e.children,i],e.keywords),h=Z0(),p=Yi(w=>w.value&&w.value===d.current),f=Yi(w=>u||a.filter()===!1?!0:w.search?w.filtered.items.get(r)>0:!0);v.useEffect(()=>{let w=i.current;if(!(!w||e.disabled))return w.addEventListener(Ov,m),()=>w.removeEventListener(Ov,m)},[f,e.onSelect,e.disabled]);function m(){var w,j;g(),(j=(w=c.current).onSelect)==null||j.call(w,d.current)}function g(){h.setState("value",d.current,!0)}if(!f)return null;let{disabled:y,value:x,onSelect:b,forceMount:_,keywords:S,...C}=e;return v.createElement(eo.div,{ref:Vi(i,t),...C,id:r,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!p,"data-disabled":!!y,"data-selected":!!p,onPointerMove:y||a.getDisablePointerSelection()?void 0:g,onClick:y?void 0:m},e.children)}),lU=v.forwardRef((e,t)=>{let{heading:n,children:s,forceMount:r,...i}=e,o=zr(),a=v.useRef(null),c=v.useRef(null),u=zr(),d=Yu(),h=Yi(f=>r||d.filter()===!1?!0:f.search?f.filtered.groups.has(o):!0);Jo(()=>d.group(o),[]),sP(o,a,[e.value,e.heading,c]);let p=v.useMemo(()=>({id:o,forceMount:r}),[r]);return v.createElement(eo.div,{ref:Vi(a,t),...i,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},n&&v.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),Sp(e,f=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},v.createElement(eP.Provider,{value:p},f))))}),cU=v.forwardRef((e,t)=>{let{alwaysRender:n,...s}=e,r=v.useRef(null),i=Yi(o=>!o.search);return!n&&!i?null:v.createElement(eo.div,{ref:Vi(r,t),...s,"cmdk-separator":"",role:"separator"})}),uU=v.forwardRef((e,t)=>{let{onValueChange:n,...s}=e,r=e.value!=null,i=Z0(),o=Yi(u=>u.search),a=Yi(u=>u.selectedItemId),c=Yu();return v.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),v.createElement(eo.input,{ref:t,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":a,id:c.inputId,type:"text",value:r?e.value:o,onChange:u=>{r||i.setState("search",u.target.value),n==null||n(u.target.value)}})}),dU=v.forwardRef((e,t)=>{let{children:n,label:s="Suggestions",...r}=e,i=v.useRef(null),o=v.useRef(null),a=Yi(u=>u.selectedItemId),c=Yu();return v.useEffect(()=>{if(o.current&&i.current){let u=o.current,d=i.current,h,p=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let f=u.offsetHeight;d.style.setProperty("--cmdk-list-height",f.toFixed(1)+"px")})});return p.observe(u),()=>{cancelAnimationFrame(h),p.unobserve(u)}}},[]),v.createElement(eo.div,{ref:Vi(i,t),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":s,id:c.listId},Sp(e,u=>v.createElement("div",{ref:Vi(o,c.listInnerRef),"cmdk-list-sizer":""},u)))}),hU=v.forwardRef((e,t)=>{let{open:n,onOpenChange:s,overlayClassName:r,contentClassName:i,container:o,...a}=e;return v.createElement(KW,{open:n,onOpenChange:s},v.createElement(VW,{container:o},v.createElement(YW,{"cmdk-overlay":"",className:r}),v.createElement(XW,{"aria-label":e.label,"cmdk-dialog":"",className:i},v.createElement(tP,{ref:t,...a}))))}),fU=v.forwardRef((e,t)=>Yi(n=>n.filtered.count===0)?v.createElement(eo.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),pU=v.forwardRef((e,t)=>{let{progress:n,children:s,label:r="Loading...",...i}=e;return v.createElement(eo.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r},Sp(e,o=>v.createElement("div",{"aria-hidden":!0},o)))}),Oc=Object.assign(tP,{List:dU,Item:aU,Input:uU,Group:lU,Separator:cU,Dialog:hU,Empty:fU,Loading:pU});function mU(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function gU(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function nP(e){let t=v.useRef(e);return Jo(()=>{t.current=e}),t}var Jo=typeof window>"u"?v.useEffect:v.useLayoutEffect;function xa(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function Yi(e){let t=Z0(),n=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,n,n)}function sP(e,t,n,s=[]){let r=v.useRef(),i=Yu();return Jo(()=>{var o;let a=(()=>{var u;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(u=d.current.textContent)==null?void 0:u.trim():r.current}})(),c=s.map(u=>u.trim());i.value(e,a,c),(o=t.current)==null||o.setAttribute(ga,a),r.current=a}),r}var xU=()=>{let[e,t]=v.useState(),n=xa(()=>new Map);return Jo(()=>{n.current.forEach(s=>s()),n.current=new Map},[e]),(s,r)=>{n.current.set(s,r),t({})}};function vU(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Sp({asChild:e,children:t},n){return e&&v.isValidElement(t)?v.cloneElement(vU(t),{ref:t.ref},n(t.props.children)):n(t)}var yU={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function bU(e,t,n={}){const{cycleFilter:s="current",includeCompletedFilter:r=!1,minQueryLength:i=2,maxResults:o=20,debounceMs:a=150}=n,c=Nt(),[u,d]=v.useState(e);v.useEffect(()=>{const m=setTimeout(()=>{d(e)},a);return()=>clearTimeout(m)},[e,a]);const h=c.getQueryData(["issues",s,r]),p=v.useMemo(()=>{if(!u||u.trim().length<i)return[];if(!h||h.length===0)return[];const m=u.toLowerCase().trim(),g=[];for(const y of h){if(t.sources.size>0&&y.source&&!t.sources.has(y.source)||!t.includeCompleted&&(y.status==="Done"||y.status==="Completed"||y.status==="Closed"))continue;let x=0,b=null;const _=y.identifier.toLowerCase();_===m?(x=100,b="identifier"):_.startsWith(m)?(x=80,b="identifier"):_.includes(m)&&(x=60,b="identifier");const S=y.title.toLowerCase();if(S.includes(m)){const C=S.startsWith(m)?70:50;C>x&&(x=C,b="title")}t.deepSearch&&y.description&&y.description.toLowerCase().includes(m)&&20>x&&(x=20,b="description"),x>0&&b&&g.push({issue:y,score:x,matchType:b})}return g.sort((y,x)=>x.score!==y.score?x.score-y.score:y.issue.identifier.localeCompare(x.issue.identifier)),g.slice(0,o)},[u,h,t,i,o]),f=v.useMemo(()=>{const m={};for(const g of p){const y=g.issue.source||"unknown";m[y]||(m[y]=[]),m[y].push(g)}return m},[p]);return{results:p,groupedResults:f,isSearching:e!==u,hasResults:p.length>0,resultCount:p.length}}const _U={linear:"Linear",github:"GitHub",rally:"Rally",gitlab:"GitLab",jira:"Jira",unknown:"Unknown"},wU={0:"text-content-muted",1:"text-red-500",2:"text-orange-500",3:"text-yellow-500",4:"text-blue-500"},SU={backlog:"bg-surface-emphasis",todo:"bg-blue-600",in_progress:"bg-yellow-600",in_review:"bg-pink-600",done:"bg-green-600",canceled:"bg-gray-500"};function kU({groupedResults:e,onSelect:t,onExternalLink:n}){const s=Object.keys(e).sort();return l.jsx(l.Fragment,{children:s.map(r=>l.jsx(Oc.Group,{heading:_U[r]||r,children:e[r].map(i=>{const{issue:o,matchType:a}=i,c=Bt[o.status]||"backlog";return l.jsx(Oc.Item,{value:o.identifier,onSelect:()=>t(o.identifier),className:"px-4 py-3 cursor-pointer hover:bg-surface-overlay transition-colors border-b border-gray-750 last:border-b-0 aria-selected:bg-surface-overlay",children:l.jsxs("div",{className:"flex items-start gap-3",children:[o.project&&l.jsx("span",{className:"w-2 h-2 rounded-full shrink-0 mt-1.5",style:{backgroundColor:o.project.color||"#6b7280"},title:o.project.name}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsxs("span",{className:"text-sm font-medium text-content flex items-center gap-1",children:[o.source==="github"&&l.jsx(s0,{className:"w-3 h-3 text-content-subtle"}),l.jsx("span",{className:"text-content-subtle",children:o.identifier})]}),l.jsx("span",{className:`px-2 py-0.5 rounded text-xs text-content ${SU[c]||"bg-surface-emphasis"}`,children:o.status}),l.jsx("span",{title:`Priority ${o.priority}`,children:l.jsx(QN,{className:`w-2 h-2 fill-current ${wU[o.priority]||"text-content-muted"}`})}),a&&l.jsxs("span",{className:"text-xs text-content-muted",children:["(",a," match)"]})]}),l.jsx("p",{className:"text-sm text-content-body mt-1 line-clamp-2",children:o.title}),o.labels.length>0&&l.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[o.labels.slice(0,3).map(u=>l.jsx("span",{className:"text-xs bg-surface-overlay text-content-subtle px-2 py-0.5 rounded",children:u},u)),o.labels.length>3&&l.jsxs("span",{className:"text-xs text-content-muted",children:["+",o.labels.length-3," more"]})]})]}),l.jsx("button",{onClick:u=>n(o.url,u),className:"p-1 text-content-subtle hover:text-blue-400 hover:bg-surface-emphasis rounded transition-colors shrink-0",title:"Open in tracker",children:l.jsx(gr,{className:"w-4 h-4"})})]})},o.id)})},r))})}function CU({isOpen:e,onClose:t,onSelectIssue:n,cycleFilter:s="current",includeCompletedFilter:r=!1}){const[i,o]=v.useState(""),[a,c]=v.useState({sources:new Set,includeCompleted:!1,deepSearch:!1}),{groupedResults:u,isSearching:d,hasResults:h,resultCount:p}=bU(i,a,{cycleFilter:s,includeCompletedFilter:r});v.useEffect(()=>{e||(o(""),c({sources:new Set,includeCompleted:!1,deepSearch:!1}))},[e]),v.useEffect(()=>{const y=x=>{x.key==="Escape"&&t()};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,t]);const f=y=>{c(x=>{const b=new Set(x.sources);return b.has(y)?b.delete(y):b.add(y),{...x,sources:b}})},m=y=>{n(y),t()},g=(y,x)=>{x.stopPropagation(),window.open(y,"_blank","noopener,noreferrer")};return e?l.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),l.jsx("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[70vh] overflow-hidden flex flex-col border border-divider",children:l.jsxs(Oc,{className:"flex flex-col h-full",shouldFilter:!1,children:[l.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-divider",children:[l.jsx(aM,{className:"w-5 h-5 text-content-subtle shrink-0"}),l.jsx(Oc.Input,{value:i,onValueChange:o,placeholder:"Search issues...",className:"flex-1 bg-transparent text-content placeholder-gray-400 focus:outline-none text-base",autoFocus:!0}),l.jsx("button",{onClick:t,className:"p-1 text-content-subtle hover:text-content hover:bg-surface-overlay rounded transition-colors shrink-0",children:l.jsx(yt,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-divider bg-gray-850 flex-wrap",children:[l.jsx("span",{className:"text-xs text-content-subtle",children:"Filters:"}),["linear","github","rally"].map(y=>l.jsxs("button",{onClick:()=>f(y),className:`px-2 py-1 text-xs rounded transition-colors ${a.sources.size===0||a.sources.has(y)?"bg-blue-600 text-content":"bg-surface-overlay text-content-subtle hover:text-content"}`,children:[y==="github"&&l.jsx(s0,{className:"w-3 h-3 inline mr-1"}),y.charAt(0).toUpperCase()+y.slice(1)]},y)),l.jsx("div",{className:"w-px h-4 bg-surface-emphasis"}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:a.includeCompleted,onChange:y=>c(x=>({...x,includeCompleted:y.target.checked})),className:"w-3 h-3 rounded border-divider-strong bg-surface-overlay text-blue-600 focus:ring-blue-500 focus:ring-offset-gray-800"}),l.jsx("span",{className:"text-xs text-content-subtle",children:"Show completed"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:a.deepSearch,onChange:y=>c(x=>({...x,deepSearch:y.target.checked})),className:"w-3 h-3 rounded border-divider-strong bg-surface-overlay text-blue-600 focus:ring-blue-500 focus:ring-offset-gray-800"}),l.jsx("span",{className:"text-xs text-content-subtle",children:"Deep search"})]})]}),l.jsxs(Oc.List,{className:"flex-1 overflow-y-auto",children:[i.length>0&&i.length<2&&l.jsx("div",{className:"px-4 py-8 text-center text-sm text-content-subtle",children:"Type at least 2 characters to search"}),i.length>=2&&d&&l.jsx("div",{className:"px-4 py-8 text-center text-sm text-content-subtle",children:"Searching..."}),i.length>=2&&!d&&!h&&l.jsx("div",{className:"px-4 py-8 text-center text-sm text-content-subtle",children:"No issues found"}),i.length>=2&&!d&&h&&l.jsx(kU,{groupedResults:u,onSelect:m,onExternalLink:g})]}),p>0&&l.jsxs("div",{className:"px-4 py-2 border-t border-divider bg-gray-850 text-xs text-content-subtle flex items-center justify-between",children:[l.jsxs("span",{children:[p," result",p!==1?"s":""]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay rounded text-xs",children:"↑"}),l.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay rounded text-xs",children:"↓"}),"navigate"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay rounded text-xs",children:"Enter"}),"select"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay rounded text-xs",children:"Esc"}),"close"]})]})]})]})})]}):null}const NU="_missionControl_1fx9v_4",jU="_layout_1fx9v_53",EU="_sidebar_1fx9v_60",PU="_resizeHandle_1fx9v_69",TU="_sidebarHeader_1fx9v_83",RU="_sidebarTitle_1fx9v_88",DU="_sidebarSubtitle_1fx9v_94",MU="_projectTree_1fx9v_100",LU="_projectNode_1fx9v_107",AU="_projectHeader_1fx9v_111",OU="_chevron_1fx9v_131",IU="_chevronOpen_1fx9v_137",FU="_projectName_1fx9v_141",BU="_featureCount_1fx9v_148",zU="_featureItem_1fx9v_155",$U="_featureItemSelected_1fx9v_174",HU="_featureStatus_1fx9v_178",WU="_featureLabel_1fx9v_187",UU="_featureId_sidebar_1fx9v_194",qU="_featureState_1fx9v_202",KU="_featureCost_1fx9v_212",VU="_emptyProject_1fx9v_218",YU="_content_1fx9v_226",XU="_contentEmpty_1fx9v_234",QU="_featureHeader_1fx9v_244",GU="_featureTitle_1fx9v_253",JU="_featureId_1fx9v_194",ZU="_badgeBar_1fx9v_267",eq="_badge_1fx9v_267",tq="_badgeDisabled_1fx9v_294",nq="_activityContainer_1fx9v_305",sq="_agentSection_1fx9v_315",rq="_agentSectionExpanded_1fx9v_327",iq="_sectionHeader_1fx9v_331",oq="_sectionChevron_1fx9v_350",aq="_sectionType_1fx9v_356",lq="_typeWork_1fx9v_370",cq="_typeReview_1fx9v_375",uq="_typeTest_1fx9v_380",dq="_typeMerge_1fx9v_385",hq="_sectionModel_1fx9v_392",fq="_sectionTime_1fx9v_398",pq="_sectionCost_1fx9v_404",mq="_costSummary_1fx9v_411",gq="_sectionStatus_1fx9v_419",xq="_statusRunning_1fx9v_426",vq="_statusCompleted_1fx9v_431",yq="_statusFailed_1fx9v_435",bq="_sectionPreview_1fx9v_445",_q="_sectionContent_1fx9v_458",wq="_sectionContentConstrained_1fx9v_474",Sq="_sectionResizeHandle_1fx9v_479",kq="_unreadDot_1fx9v_498",Cq="_isolationOverlay_1fx9v_507",Nq="_isolationHeader_1fx9v_516",jq="_isolationClose_1fx9v_525",Eq="_isolationContent_1fx9v_541",Pq="_modalOverlay_1fx9v_553",Tq="_modalContent_1fx9v_564",Rq="_modalHeader_1fx9v_575",Dq="_modalTitle_1fx9v_583",Mq="_modalClose_1fx9v_589",Lq="_modalBody_1fx9v_604",Aq="_uploadZone_1fx9v_611",Oq="_uploadZoneActive_1fx9v_622",Iq="_uploadIcon_1fx9v_628",Fq="_uploadText_1fx9v_632",Bq="_uploadHint_1fx9v_637",zq="_syncButton_1fx9v_678",$q="_spinning_1fx9v_707",Hq="_markdownContent_1fx9v_739",Wq="_kbdHint_1fx9v_793",Uq="_deaconPanel_1fx9v_810",qq="_deaconHeader_1fx9v_815",Kq="_deaconTitle_1fx9v_828",Vq="_deaconMeta_1fx9v_836",Yq="_deaconActionCount_1fx9v_842",Xq="_deaconSpecialists_1fx9v_853",Qq="_deaconSpecRow_1fx9v_859",Gq="_deaconSpecDot_1fx9v_865",Jq="_deaconSpecName_1fx9v_872",Zq="_deaconSpecFailures_1fx9v_877",eK="_deaconActions_1fx9v_883",tK="_deaconAction_1fx9v_842",nK="_deaconLogToggle_1fx9v_900",sK="_deaconLogViewer_1fx9v_917",rK="_deaconLogEmpty_1fx9v_928",iK="_deaconLogEntry_1fx9v_934",oK="_deaconLogTime_1fx9v_941",aK="_deaconLogLevel_1fx9v_947",lK="_deaconLogMessage_1fx9v_954",cK="_sidebarFooter_1fx9v_962",uK="_versionLabel_1fx9v_971",V={missionControl:NU,layout:jU,sidebar:EU,resizeHandle:PU,sidebarHeader:TU,sidebarTitle:RU,sidebarSubtitle:DU,projectTree:MU,projectNode:LU,projectHeader:AU,chevron:OU,chevronOpen:IU,projectName:FU,featureCount:BU,featureItem:zU,featureItemSelected:$U,featureStatus:HU,featureLabel:WU,featureId_sidebar:UU,featureState:qU,featureCost:KU,emptyProject:VU,content:YU,contentEmpty:XU,featureHeader:QU,featureTitle:GU,featureId:JU,badgeBar:ZU,badge:eq,badgeDisabled:tq,activityContainer:nq,agentSection:sq,agentSectionExpanded:rq,sectionHeader:iq,sectionChevron:oq,sectionType:aq,typeWork:lq,typeReview:cq,typeTest:uq,typeMerge:dq,sectionModel:hq,sectionTime:fq,sectionCost:pq,costSummary:mq,sectionStatus:gq,statusRunning:xq,statusCompleted:vq,statusFailed:yq,sectionPreview:bq,sectionContent:_q,sectionContentConstrained:wq,sectionResizeHandle:Sq,unreadDot:kq,isolationOverlay:Cq,isolationHeader:Nq,isolationClose:jq,isolationContent:Eq,modalOverlay:Pq,modalContent:Tq,modalHeader:Rq,modalTitle:Dq,modalClose:Mq,modalBody:Lq,uploadZone:Aq,uploadZoneActive:Oq,uploadIcon:Iq,uploadText:Fq,uploadHint:Bq,syncButton:zq,spinning:$q,markdownContent:Hq,kbdHint:Wq,deaconPanel:Uq,deaconHeader:qq,deaconTitle:Kq,deaconMeta:Vq,deaconActionCount:Yq,deaconSpecialists:Xq,deaconSpecRow:Qq,deaconSpecDot:Gq,deaconSpecName:Jq,deaconSpecFailures:Zq,deaconActions:eK,deaconAction:tK,deaconLogToggle:nK,deaconLogViewer:sK,deaconLogEmpty:rK,deaconLogEntry:iK,deaconLogTime:oK,deaconLogLevel:aK,deaconLogMessage:lK,sidebarFooter:cK,versionLabel:uK};function dK({status:e,agentStatus:t,stateLabel:n,isRally:s}){if(s){const r=n==="Done"?"var(--mc-success)":n==="In Progress"?"var(--mc-warning)":"var(--mc-text-muted)";return l.jsx(tj,{size:14,style:{color:r}})}return e==="running"?l.jsx(_e,{size:14,className:V.spinning,style:{color:"var(--mc-success)"}}):t==="suspended"||n==="In Progress"||n==="Suspended"?l.jsx(kn,{size:14,style:{color:"var(--mc-warning)"}}):e==="has_state"?l.jsx(po,{size:14,style:{color:"var(--mc-text-muted)"}}):l.jsx(QN,{size:14,style:{color:"var(--mc-text-muted)"}})}function hK(e){return e<.01?"<$0.01":e<1?`$${e.toFixed(2)}`:`$${e.toFixed(2)}`}function fK({feature:e,isSelected:t,onSelect:n,title:s,cost:r}){const i=e.isRally&&e.childCount&&e.childCount>0?Math.round((e.completedCount||0)/e.childCount*100):null;return l.jsxs("button",{className:`${V.featureItem} ${t?V.featureItemSelected:""}`,onClick:n,children:[l.jsx("span",{className:V.featureStatus,children:e.isShadow?l.jsx(Lo,{size:14,style:{color:"var(--mc-accent)"}}):l.jsx(dK,{status:e.status,agentStatus:e.agentStatus,stateLabel:e.stateLabel,isRally:e.isRally})}),l.jsx("span",{className:V.featureId_sidebar,children:e.issueId}),l.jsx("span",{className:V.featureLabel,children:s||e.issueId}),e.isRally&&e.childCount!=null&&e.childCount>0?l.jsxs("span",{className:V.featureState,title:`${e.completedCount||0}/${e.childCount} stories done${e.inProgressCount?`, ${e.inProgressCount} active`:""}`,children:[e.completedCount||0,"/",e.childCount,i!==null&&l.jsx("span",{style:{display:"inline-block",width:24,height:4,marginLeft:4,background:"var(--mc-border)",borderRadius:2,overflow:"hidden",verticalAlign:"middle"},children:l.jsx("span",{style:{display:"block",width:`${i}%`,height:"100%",background:i===100?"var(--mc-success)":"var(--mc-warning)",borderRadius:2}})})]}):l.jsx("span",{className:V.featureState,children:e.stateLabel}),r!==void 0&&r>0&&l.jsx("span",{className:V.featureCost,children:hK(r)})]})}function pK({name:e,features:t,selectedFeature:n,onSelectFeature:s,issueTitles:r,issueCosts:i}){const[o,a]=v.useState(t.length>0);return l.jsxs("div",{className:V.projectNode,children:[l.jsxs("button",{className:V.projectHeader,onClick:()=>a(!o),children:[l.jsx(bl,{className:`${V.chevron} ${o?V.chevronOpen:""}`,size:14}),l.jsx("span",{className:V.projectName,children:e}),l.jsx("span",{className:V.featureCount,children:t.length})]}),o&&(t.length>0?t.map(c=>l.jsx(fK,{feature:c,isSelected:n===c.issueId,onSelect:()=>s(c.issueId),title:(r==null?void 0:r[c.issueId.toLowerCase()])||(r==null?void 0:r[c.issueId])||c.title,cost:(i==null?void 0:i[c.issueId.toLowerCase()])||(i==null?void 0:i[c.issueId])},c.issueId)):l.jsx("div",{className:V.emptyProject,children:"(no active features)"}))]})}const mK={work:V.typeWork,review:V.typeReview,test:V.typeTest,merge:V.typeMerge},gK={running:V.statusRunning,completed:V.statusCompleted,failed:V.statusFailed},xK={work:"#10B981",review:"#F59E0B",test:"#6366F1",merge:"#EC4899"};function vK(e){return e===null?"":e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function yK(e){if(!e)return"";try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function PS(e){return!e||e==="unknown"?"":e.replace("claude-opus-4-6","Opus 4.6").replace("claude-sonnet-4-5-20250929","Sonnet 4.5").replace("claude-haiku-4-5-20251001","Haiku 4.5").replace("claude-","").replace("specialist","")}function bK(e){return e<.01?"<$0.01":`$${e.toFixed(2)}`}function _K(e){if(!e)return"(no output yet)";const t=e.split(`
|
|
681
|
-
`).filter(s=>s.trim().length>0);if(t.length===0)return"(no output yet)";const n=t[t.length-1].trim();return n.length>120?n.slice(0,120)+"...":n}function wK({section:e,isUnread:t,onClick:n,cost:s,defaultExpanded:r=!1}){const i=v.useRef(null),[o,a]=v.useState(r),[c,u]=v.useState(null),d=v.useRef(!1),h=v.useRef(0),p=v.useRef(0);v.useEffect(()=>{e.status==="running"&&a(!0)},[e.status]),v.useEffect(()=>{i.current&&o&&e.status==="running"&&requestAnimationFrame(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)})},[e.transcript,e.status,o]);const f=v.useCallback(S=>{var C;S.preventDefault(),S.stopPropagation(),d.current=!0,h.current=S.clientY,p.current=((C=i.current)==null?void 0:C.offsetHeight)||300,document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[]);v.useEffect(()=>{const S=w=>{if(!d.current)return;const j=w.clientY-h.current,E=Math.max(80,Math.min(2e3,p.current+j));u(E)},C=()=>{d.current&&(d.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",S),document.addEventListener("mouseup",C),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",C)}},[]);const m=v.useCallback(()=>{u(S=>S===null?400:null)},[]),g=S=>{if(S.button===1||S.ctrlKey){n();return}a(!o)},y=xK[e.type]||"var(--mc-border)",x=c!==null,b={};x&&o&&(b.maxHeight=`${c}px`);const _=x?`${V.sectionContent} ${V.sectionContentConstrained}`:V.sectionContent;return l.jsxs("div",{className:`${V.agentSection} ${o?V.agentSectionExpanded:""}`,style:{borderLeftColor:y},children:[l.jsxs("div",{className:V.sectionHeader,onClick:g,title:"Click to expand/collapse, Ctrl+click to isolate",children:[l.jsx("span",{className:V.sectionChevron,children:o?l.jsx(Mu,{size:12,style:{color:"var(--mc-text-muted)"}}):l.jsx(bl,{size:12,style:{color:"var(--mc-text-muted)"}})}),e.status==="running"?l.jsx(_e,{size:12,className:V.spinning,style:{color:"var(--mc-success)",flexShrink:0}}):l.jsx("div",{className:`${V.sectionStatus} ${gK[e.status]||V.statusCompleted}`}),l.jsx("span",{className:`${V.sectionType} ${mK[e.type]||""}`,children:e.type}),PS(e.model)&&l.jsx("span",{className:V.sectionModel,children:PS(e.model)}),l.jsxs("span",{className:V.sectionTime,children:[yK(e.startedAt),e.duration!==null&&` (${vK(e.duration)})`]}),s!==void 0&&s>0&&l.jsx("span",{className:V.sectionCost,children:bK(s)}),t&&l.jsx("div",{className:V.unreadDot})]}),!o&&l.jsx("div",{className:V.sectionPreview,children:_K(e.transcript)}),o&&l.jsxs(l.Fragment,{children:[l.jsx("div",{ref:i,className:_,style:b,children:e.transcript||"(no output yet)"}),l.jsx("div",{className:V.sectionResizeHandle,onMouseDown:f,onDoubleClick:m,title:x?"Drag to resize, double-click to unconstrain":"Drag to constrain height, double-click to set default",children:l.jsx(GD,{size:12,style:{color:"var(--mc-text-muted)",opacity:x?.8:.4}})})]})]})}const SK={work:V.typeWork,review:V.typeReview,test:V.typeTest,merge:V.typeMerge};function TS(e){return!e||e==="unknown"?"":e.replace("claude-opus-4-6","Opus 4.6").replace("claude-sonnet-4-5-20250929","Sonnet 4.5").replace("claude-haiku-4-5-20251001","Haiku 4.5").replace("claude-","").replace("specialist","")}function kK({section:e,onClose:t}){const n=v.useRef(null);return v.useEffect(()=>{e.status==="running"&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.transcript,e.status]),v.useEffect(()=>{history.pushState({isolation:!0},"");const s=()=>{t()};return window.addEventListener("popstate",s),()=>{window.removeEventListener("popstate",s)}},[t]),l.jsxs("div",{className:V.isolationOverlay,children:[l.jsxs("div",{className:V.isolationHeader,children:[l.jsxs("button",{className:V.isolationClose,onClick:t,children:[l.jsx("kbd",{className:V.kbdHint,children:"Esc"})," Close"]}),l.jsx("span",{className:`${V.sectionType} ${SK[e.type]||""}`,children:e.type}),TS(e.model)&&l.jsx("span",{className:V.sectionModel,children:TS(e.model)}),l.jsx("span",{className:V.sectionTime,children:e.sessionId})]}),l.jsx("div",{ref:n,className:V.isolationContent,children:e.transcript||"(no output)"})]})}async function CK(e){const t=await fetch(`/api/mission-control/activity/${e}`);if(!t.ok)throw new Error("Failed to fetch activity");return t.json()}function NK(e){return e==="Done"||e==="Completed"||e==="Closed"?"var(--mc-success)":e==="In Progress"||e==="Started"||e==="Active"?"var(--mc-warning)":e==="In Review"||e==="Review"||e==="QA"||e==="Testing"?"#ec4899":"var(--mc-text-muted)"}function RS({feature:e,issues:t}){const n=t.filter(c=>c.source==="rally"&&c.parentRef===e.issueId),s=t.find(c=>c.source==="rally"&&c.identifier===e.issueId);if(n.length===0&&!s)return null;const r=e.completedCount||0,i=e.childCount||n.length,o=e.inProgressCount||0,a=i>0?Math.round(r/i*100):0;return l.jsxs("div",{style:{marginBottom:16},children:[l.jsxs("div",{style:{background:"var(--mc-bg-secondary)",border:"1px solid var(--mc-border)",borderLeft:"3px solid #6366f1",borderRadius:6,padding:"12px 16px",marginBottom:12},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[l.jsx("span",{style:{fontWeight:600,color:"var(--mc-text-primary)",fontSize:"var(--mc-font-size-sm)"},children:e.issueId}),(s==null?void 0:s.url)&&l.jsx("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--mc-text-muted)"},children:l.jsx(gr,{size:12})}),e.rawTrackerState&&l.jsxs("span",{style:{fontSize:11,padding:"1px 6px",borderRadius:3,background:"rgba(107,114,128,0.15)",color:"var(--mc-text-muted)"},children:["Rally: ",e.rawTrackerState]}),e.stateLabel&&e.stateLabel!==e.rawTrackerState&&l.jsxs("span",{style:{fontSize:11,padding:"1px 6px",borderRadius:3,background:e.stateLabel==="In Progress"?"rgba(168,85,247,0.15)":"rgba(34,197,94,0.15)",color:e.stateLabel==="In Progress"?"#a855f7":"#22c55e"},children:["Derived: ",e.stateLabel]})]}),i>0&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[l.jsx("div",{style:{flex:1,height:6,background:"var(--mc-border)",borderRadius:3,overflow:"hidden"},children:l.jsx("div",{style:{width:`${a}%`,height:"100%",background:a===100?"var(--mc-success)":"#6366f1",borderRadius:3,transition:"width 0.3s ease"}})}),l.jsxs("span",{style:{fontSize:11,color:"var(--mc-text-muted)",whiteSpace:"nowrap"},children:[r,"/",i," done",o>0?`, ${o} active`:""]})]})]}),n.length>0&&l.jsxs("div",{style:{background:"var(--mc-bg-secondary)",border:"1px solid var(--mc-border)",borderRadius:6,overflow:"hidden"},children:[l.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--mc-border)",fontSize:"var(--mc-font-size-xs)",fontWeight:600,color:"var(--mc-text-muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:["User Stories (",n.length,")"]}),n.map(c=>{var u;return l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",borderBottom:"1px solid var(--mc-border)",fontSize:"var(--mc-font-size-sm)"},children:[l.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:NK(c.status),flexShrink:0}}),l.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",style:{color:"#6366f1",textDecoration:"none",fontFamily:"monospace",fontSize:11,flexShrink:0},children:c.identifier}),l.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--mc-text-primary)"},children:c.title}),((u=c.assignee)==null?void 0:u.name)&&l.jsx("span",{style:{fontSize:11,color:"var(--mc-text-muted)",flexShrink:0},children:c.assignee.name}),c.rawTrackerState&&l.jsx("span",{style:{fontSize:10,padding:"1px 5px",borderRadius:3,background:"rgba(107,114,128,0.12)",color:"var(--mc-text-muted)",flexShrink:0},children:c.rawTrackerState})]},c.id)})]})]})}function jK({issueId:e,issues:t=[],featureData:n}){const[s,r]=v.useState(null),[i,o]=v.useState(new Set),a=v.useRef([]),c=v.useRef(null),{data:u,isLoading:d}=he({queryKey:["mission-control-activity",e],queryFn:()=>CK(e),refetchInterval:5e3}),h=(u==null?void 0:u.sections)||[],p=(u==null?void 0:u.costByStage)||{},f=(u==null?void 0:u.totalCost)||0;v.useEffect(()=>{const _=h.map(C=>C.sessionId);_.filter(C=>!a.current.includes(C)).length>0&&a.current.length>0&&o(C=>new Set(C)),a.current=_},[h]);const m=_=>{r(_),o(S=>new Set([...S,_.sessionId]))},g=()=>{r(null)},y=v.useRef(null),x=v.useRef(!1);if(v.useEffect(()=>{y.current!==e&&(y.current=e,x.current=!1),h.length>0&&c.current&&!x.current&&(x.current=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight)})}))},[e,h]),v.useEffect(()=>{const _=S=>{S.key==="Escape"&&s&&g()};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[s]),d&&h.length===0)return l.jsx("div",{className:V.activityContainer,children:l.jsx("div",{style:{color:"var(--mc-text-muted)",fontSize:"var(--mc-font-size-sm)"},children:"Loading activity..."})});if(h.length===0){const _=(n==null?void 0:n.isRally)===!0;return l.jsxs("div",{className:V.activityContainer,children:[_&&n&&l.jsx(RS,{feature:n,issues:t}),l.jsx("div",{style:{color:"var(--mc-text-muted)",fontSize:"var(--mc-font-size-sm)"},children:"No agent activity yet for this feature."})]})}const b=(n==null?void 0:n.isRally)===!0;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{ref:c,className:V.activityContainer,children:[b&&n&&l.jsx(RS,{feature:n,issues:t}),f>0&&l.jsxs("div",{className:V.costSummary,children:["Total: $",f<.01?"<0.01":f.toFixed(2)]}),h.map((_,S)=>{const j=({work:["implementation"],review:["review"],test:["test"],merge:["merge"]}[_.type]||[_.type]).reduce((R,B)=>{var L;return R+(((L=p[B])==null?void 0:L.cost)||0)},0)||void 0,E=S===h.length-1,O=_.status==="running"||E;return l.jsx(wK,{section:_,isUnread:!i.has(_.sessionId)&&a.current.length>0,onClick:()=>m(_),cost:j,defaultExpanded:O},_.sessionId)})]}),s&&l.jsx(kK,{section:s,onClose:g})]})}function DS(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,r=n.indexOf(t);for(;r!==-1;)s++,r=n.indexOf(t,r+t.length);return s}function EK(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function PK(e,t,n){const r=vp((n||{}).ignore||[]),i=TK(t);let o=-1;for(;++o<i.length;)m5(e,"text",a);function a(u,d){let h=-1,p;for(;++h<d.length;){const f=d[h],m=p?p.children:void 0;if(r(f,m?m.indexOf(f):void 0,p))return;p=f}if(p)return c(u,d)}function c(u,d){const h=d[d.length-1],p=i[o][0],f=i[o][1];let m=0;const y=h.children.indexOf(u);let x=!1,b=[];p.lastIndex=0;let _=p.exec(u.value);for(;_;){const S=_.index,C={index:_.index,input:_.input,stack:[...d,u]};let w=f(..._,C);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?p.lastIndex=S+1:(m!==S&&b.push({type:"text",value:u.value.slice(m,S)}),Array.isArray(w)?b.push(...w):w&&b.push(w),m=S+_[0].length,x=!0),!p.global)break;_=p.exec(u.value)}return x?(m<u.value.length&&b.push({type:"text",value:u.value.slice(m)}),h.children.splice(y,1,...b)):b=[u],y+b.length}}function TK(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const r=n[s];t.push([RK(r[0]),DK(r[1])])}return t}function RK(e){return typeof e=="string"?new RegExp(EK(e),"g"):e}function DK(e){return typeof e=="function"?e:function(){return e}}const Jm="phrasing",Zm=["autolink","link","image","label"];function MK(){return{transforms:[zK],enter:{literalAutolink:AK,literalAutolinkEmail:eg,literalAutolinkHttp:eg,literalAutolinkWww:eg},exit:{literalAutolink:BK,literalAutolinkEmail:FK,literalAutolinkHttp:OK,literalAutolinkWww:IK}}}function LK(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Jm,notInConstruct:Zm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Jm,notInConstruct:Zm},{character:":",before:"[ps]",after:"\\/",inConstruct:Jm,notInConstruct:Zm}]}}function AK(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function eg(e){this.config.enter.autolinkProtocol.call(this,e)}function OK(e){this.config.exit.autolinkProtocol.call(this,e)}function IK(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function FK(e){this.config.exit.autolinkEmail.call(this,e)}function BK(e){this.exit(e)}function zK(e){PK(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,$K],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),HK]],{ignore:["link","linkReference"]})}function $K(e,t,n,s,r){let i="";if(!rP(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!WK(n)))return!1;const o=UK(n+s);if(!o[0])return!1;const a={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function HK(e,t,n,s){return!rP(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function WK(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function UK(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const r=DS(e,"(");let i=DS(e,")");for(;s!==-1&&r>i;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),i++;return[e,n]}function rP(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Qo(n)||mp(n))&&(!t||n!==47)}iP.peek=ZK;function qK(){this.buffer()}function KK(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function VK(){this.buffer()}function YK(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function XK(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Us(this.sliceSerialize(e)).toLowerCase(),n.label=t}function QK(e){this.exit(e)}function GK(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Us(this.sliceSerialize(e)).toLowerCase(),n.label=t}function JK(e){this.exit(e)}function ZK(){return"["}function iP(e,t,n,s){const r=n.createTracker(s);let i=r.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=r.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),o(),i+=r.move("]"),i}function eV(){return{enter:{gfmFootnoteCallString:qK,gfmFootnoteCall:KK,gfmFootnoteDefinitionLabelString:VK,gfmFootnoteDefinition:YK},exit:{gfmFootnoteCallString:XK,gfmFootnoteCall:QK,gfmFootnoteDefinitionLabelString:GK,gfmFootnoteDefinition:JK}}}function tV(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:iP},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,r,i,o){const a=i.createTracker(o);let c=a.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=a.move(i.safe(i.associationId(s),{before:c,after:"]"})),d(),c+=a.move("]:"),s.children&&s.children.length>0&&(a.shift(4),c+=a.move((t?`
|
|
682
|
-
`:" ")+i.indentLines(i.containerFlow(s,a.current()),t?oP:nV))),u(),c}}function nV(e,t,n){return t===0?e:oP(e,t,n)}function oP(e,t,n){return(n?"":" ")+e}const sV=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];aP.peek=lV;function rV(){return{canContainEols:["delete"],enter:{strikethrough:oV},exit:{strikethrough:aV}}}function iV(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:sV}],handlers:{delete:aP}}}function oV(e){this.enter({type:"delete",children:[]},e)}function aV(e){this.exit(e)}function aP(e,t,n,s){const r=n.createTracker(s),i=n.enter("strikethrough");let o=r.move("~~");return o+=n.containerPhrasing(e,{...r.current(),before:o,after:"~"}),o+=r.move("~~"),i(),o}function lV(){return"~"}function cV(e){return e.length}function uV(e,t){const n=t||{},s=(n.align||[]).concat(),r=n.stringLength||cV,i=[],o=[],a=[],c=[];let u=0,d=-1;for(;++d<e.length;){const g=[],y=[];let x=-1;for(e[d].length>u&&(u=e[d].length);++x<e[d].length;){const b=dV(e[d][x]);if(n.alignDelimiters!==!1){const _=r(b);y[x]=_,(c[x]===void 0||_>c[x])&&(c[x]=_)}g.push(b)}o[d]=g,a[d]=y}let h=-1;if(typeof s=="object"&&"length"in s)for(;++h<u;)i[h]=MS(s[h]);else{const g=MS(s);for(;++h<u;)i[h]=g}h=-1;const p=[],f=[];for(;++h<u;){const g=i[h];let y="",x="";g===99?(y=":",x=":"):g===108?y=":":g===114&&(x=":");let b=n.alignDelimiters===!1?1:Math.max(1,c[h]-y.length-x.length);const _=y+"-".repeat(b)+x;n.alignDelimiters!==!1&&(b=y.length+b+x.length,b>c[h]&&(c[h]=b),f[h]=b),p[h]=_}o.splice(1,0,p),a.splice(1,0,f),d=-1;const m=[];for(;++d<o.length;){const g=o[d],y=a[d];h=-1;const x=[];for(;++h<u;){const b=g[h]||"";let _="",S="";if(n.alignDelimiters!==!1){const C=c[h]-(y[h]||0),w=i[h];w===114?_=" ".repeat(C):w===99?C%2?(_=" ".repeat(C/2+.5),S=" ".repeat(C/2-.5)):(_=" ".repeat(C/2),S=_):S=" ".repeat(C)}n.delimiterStart!==!1&&!h&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&b==="")&&(n.delimiterStart!==!1||h)&&x.push(" "),n.alignDelimiters!==!1&&x.push(_),x.push(b),n.alignDelimiters!==!1&&x.push(S),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||h!==u-1)&&x.push("|")}m.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return m.join(`
|
|
683
|
-
`)}function dV(e){return e==null?"":String(e)}function MS(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function hV(e,t,n,s){const r=n.enter("blockquote"),i=n.createTracker(s);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),fV);return r(),o}function fV(e,t,n){return">"+(n?"":" ")+e}function pV(e,t){return LS(e,t.inConstruct,!0)&&!LS(e,t.notInConstruct,!1)}function LS(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function AS(e,t,n,s){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
|
|
684
|
-
`&&pV(n.stack,n.unsafe[r]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
685
|
-
`}function mV(e,t){const n=String(e);let s=n.indexOf(t),r=s,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===r?++i>o&&(o=i):i=1,r=s+t.length,s=n.indexOf(t,r);return o}function gV(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function xV(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function vV(e,t,n,s){const r=xV(n),i=e.value||"",o=r==="`"?"GraveAccent":"Tilde";if(gV(e,n)){const h=n.enter("codeIndented"),p=n.indentLines(i,yV);return h(),p}const a=n.createTracker(s),c=r.repeat(Math.max(mV(i,r)+1,3)),u=n.enter("codeFenced");let d=a.move(c);if(e.lang){const h=n.enter(`codeFencedLang${o}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${o}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:`
|
|
686
|
-
`,encode:["`"],...a.current()})),h()}return d+=a.move(`
|
|
687
|
-
`),i&&(d+=a.move(i+`
|
|
688
|
-
`)),d+=a.move(c),u(),d}function yV(e,t,n){return(n?"":" ")+e}function eb(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function bV(e,t,n,s){const r=eb(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const c=n.createTracker(s);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(a=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
|
|
689
|
-
`,...c.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),a()),o(),u}function _V(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function xu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function jf(e,t,n){const s=ul(e),r=ul(t);return s===void 0?r===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}lP.peek=wV;function lP(e,t,n,s){const r=_V(n),i=n.enter("emphasis"),o=n.createTracker(s),a=o.move(r);let c=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const u=c.charCodeAt(0),d=jf(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=xu(u)+c.slice(1));const h=c.charCodeAt(c.length-1),p=jf(s.after.charCodeAt(0),h,r);p.inside&&(c=c.slice(0,-1)+xu(h));const f=o.move(r);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},a+c+f}function wV(e,t,n){return n.options.emphasis||"*"}function SV(e,t){let n=!1;return K0(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,jv}),!!((!e.depth||e.depth<3)&&B0(e)&&(t.options.setext||n))}function kV(e,t,n,s){const r=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(s);if(SV(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),p=n.containerPhrasing(e,{...i.current(),before:`
|
|
690
|
-
`,after:`
|
|
691
|
-
`});return h(),d(),p+`
|
|
692
|
-
`+(r===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
|
|
693
|
-
`))+1))}const o="#".repeat(r),a=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
|
|
694
|
-
`,...i.current()});return/^[\t ]/.test(u)&&(u=xu(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),a(),u}cP.peek=CV;function cP(e){return e.value||""}function CV(){return"<"}uP.peek=NV;function uP(e,t,n,s){const r=eb(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const c=n.createTracker(s);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(a=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),a()),u+=c.move(")"),o(),u}function NV(){return"!"}dP.peek=jV;function dP(e,t,n,s){const r=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(s);let c=a.move("![");const u=n.safe(e.alt,{before:c,after:"]",...a.current()});c+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==h?c+=a.move(h+"]"):r==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function jV(){return"!"}hP.peek=EV;function hP(e,t,n){let s=e.value||"",r="`",i=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(s);)r+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let c;if(o.atBreak)for(;c=a.exec(s);){let u=c.index;s.charCodeAt(u)===10&&s.charCodeAt(u-1)===13&&u--,s=s.slice(0,u)+" "+s.slice(c.index+1)}}return r+s+r}function EV(){return"`"}function fP(e,t){const n=B0(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}pP.peek=PV;function pP(e,t,n,s){const r=eb(n),i=r==='"'?"Quote":"Apostrophe",o=n.createTracker(s);let a,c;if(fP(e,n)){const d=n.stack;n.stack=[],a=n.enter("autolink");let h=o.move("<");return h+=o.move(n.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),a(),n.stack=d,h}a=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=o.move(" "+r),u+=o.move(n.safe(e.title,{before:u,after:r,...o.current()})),u+=o.move(r),c()),u+=o.move(")"),a(),u}function PV(e,t,n){return fP(e,n)?"<":"["}mP.peek=TV;function mP(e,t,n,s){const r=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(s);let c=a.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...a.current()});c+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==h?c+=a.move(h+"]"):r==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function TV(){return"["}function tb(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function RV(e){const t=tb(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function DV(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function gP(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function MV(e,t,n,s){const r=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?DV(n):tb(n);const a=e.ordered?o==="."?")":".":RV(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),gP(n)===o&&d){let h=-1;for(;++h<e.children.length;){const p=e.children[h];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=a),n.bulletCurrent=o;const u=n.containerFlow(e,s);return n.bulletLastUsed=o,n.bulletCurrent=i,r(),u}function LV(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function AV(e,t,n,s){const r=LV(n);let i=n.bulletCurrent||tb(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(r==="tab"||r==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(s);a.move(i+" ".repeat(o-i.length)),a.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),d);return c(),u;function d(h,p,f){return p?(f?"":" ".repeat(o))+h:(f?i:i+" ".repeat(o-i.length))+h}}function OV(e,t,n,s){const r=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,s);return i(),r(),o}const IV=vp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function FV(e,t,n,s){return(e.children.some(function(o){return IV(o)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function BV(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}xP.peek=zV;function xP(e,t,n,s){const r=BV(n),i=n.enter("strong"),o=n.createTracker(s),a=o.move(r+r);let c=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const u=c.charCodeAt(0),d=jf(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=xu(u)+c.slice(1));const h=c.charCodeAt(c.length-1),p=jf(s.after.charCodeAt(0),h,r);p.inside&&(c=c.slice(0,-1)+xu(h));const f=o.move(r+r);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},a+c+f}function zV(e,t,n){return n.options.strong||"*"}function $V(e,t,n,s){return n.safe(e.value,s)}function HV(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function WV(e,t,n){const s=(gP(n)+(n.options.ruleSpaces?" ":"")).repeat(HV(n));return n.options.ruleSpaces?s.slice(0,-1):s}const vP={blockquote:hV,break:AS,code:vV,definition:bV,emphasis:lP,hardBreak:AS,heading:kV,html:cP,image:uP,imageReference:dP,inlineCode:hP,link:pP,linkReference:mP,list:MV,listItem:AV,paragraph:OV,root:FV,strong:xP,text:$V,thematicBreak:WV};function UV(){return{enter:{table:qV,tableData:OS,tableHeader:OS,tableRow:VV},exit:{codeText:YV,table:KV,tableData:tg,tableHeader:tg,tableRow:tg}}}function qV(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function KV(e){this.exit(e),this.data.inTable=void 0}function VV(e){this.enter({type:"tableRow",children:[]},e)}function tg(e){this.exit(e)}function OS(e){this.enter({type:"tableCell",children:[]},e)}function YV(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,XV));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function XV(e,t){return t==="|"?t:e}function QV(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,r=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
695
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:o,tableCell:c,tableRow:a}};function o(f,m,g,y){return u(d(f,g,y),f.align)}function a(f,m,g,y){const x=h(f,g,y),b=u([x]);return b.slice(0,b.indexOf(`
|
|
696
|
-
`))}function c(f,m,g,y){const x=g.enter("tableCell"),b=g.enter("phrasing"),_=g.containerPhrasing(f,{...y,before:i,after:i});return b(),x(),_}function u(f,m){return uV(f,{align:m,alignDelimiters:s,padding:n,stringLength:r})}function d(f,m,g){const y=f.children;let x=-1;const b=[],_=m.enter("table");for(;++x<y.length;)b[x]=h(y[x],m,g);return _(),b}function h(f,m,g){const y=f.children;let x=-1;const b=[],_=m.enter("tableRow");for(;++x<y.length;)b[x]=c(y[x],f,m,g);return _(),b}function p(f,m,g){let y=vP.inlineCode(f,m,g);return g.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function GV(){return{exit:{taskListCheckValueChecked:IS,taskListCheckValueUnchecked:IS,paragraph:ZV}}}function JV(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:eY}}}function IS(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function ZV(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const r=t.children;let i=-1,o;for(;++i<r.length;){const a=r[i];if(a.type==="paragraph"){o=a;break}}o===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function eY(e,t,n,s){const r=e.children[0],i=typeof e.checked=="boolean"&&r&&r.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(s);i&&a.move(o);let c=vP.listItem(e,t,n,{...s,...a.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function tY(){return[MK(),eV(),rV(),UV(),GV()]}function nY(e){return{extensions:[LK(),tV(e),iV(),QV(e),JV()]}}const sY={tokenize:cY,partial:!0},yP={tokenize:uY,partial:!0},bP={tokenize:dY,partial:!0},_P={tokenize:hY,partial:!0},rY={tokenize:fY,partial:!0},wP={name:"wwwAutolink",tokenize:aY,previous:kP},SP={name:"protocolAutolink",tokenize:lY,previous:CP},Gr={name:"emailAutolink",tokenize:oY,previous:NP},wr={};function iY(){return{text:wr}}let so=48;for(;so<123;)wr[so]=Gr,so++,so===58?so=65:so===91&&(so=97);wr[43]=Gr;wr[45]=Gr;wr[46]=Gr;wr[95]=Gr;wr[72]=[Gr,SP];wr[104]=[Gr,SP];wr[87]=[Gr,wP];wr[119]=[Gr,wP];function oY(e,t,n){const s=this;let r,i;return o;function o(h){return!Iv(h)||!NP.call(s,s.previous)||nb(s.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(h))}function a(h){return Iv(h)?(e.consume(h),a):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(rY,d,u)(h):h===45||h===95||Sn(h)?(i=!0,e.consume(h),c):d(h)}function u(h){return e.consume(h),r=!0,c}function d(h){return i&&r&&Ln(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function aY(e,t,n){const s=this;return r;function r(o){return o!==87&&o!==119||!kP.call(s,s.previous)||nb(s.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(sY,e.attempt(yP,e.attempt(bP,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function lY(e,t,n){const s=this;let r="",i=!1;return o;function o(h){return(h===72||h===104)&&CP.call(s,s.previous)&&!nb(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(h),e.consume(h),a):n(h)}function a(h){if(Ln(h)&&r.length<5)return r+=String.fromCodePoint(h),e.consume(h),a;if(h===58){const p=r.toLowerCase();if(p==="http"||p==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),i?u:(i=!0,c)):n(h)}function u(h){return h===null||wf(h)||Qe(h)||Qo(h)||mp(h)?n(h):e.attempt(yP,e.attempt(bP,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function cY(e,t,n){let s=0;return r;function r(o){return(o===87||o===119)&&s<3?(s++,e.consume(o),r):o===46&&s===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function uY(e,t,n){let s,r,i;return o;function o(u){return u===46||u===95?e.check(_P,c,a)(u):u===null||Qe(u)||Qo(u)||u!==45&&mp(u)?c(u):(i=!0,e.consume(u),o)}function a(u){return u===95?s=!0:(r=s,s=void 0),e.consume(u),o}function c(u){return r||s||!i?n(u):t(u)}}function dY(e,t){let n=0,s=0;return r;function r(o){return o===40?(n++,e.consume(o),r):o===41&&s<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(_P,t,i)(o):o===null||Qe(o)||Qo(o)?t(o):(e.consume(o),r)}function i(o){return o===41&&s++,e.consume(o),r}}function hY(e,t,n){return s;function s(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),s):a===38?(e.consume(a),i):a===93?(e.consume(a),r):a===60||a===null||Qe(a)||Qo(a)?t(a):n(a)}function r(a){return a===null||a===40||a===91||Qe(a)||Qo(a)?t(a):s(a)}function i(a){return Ln(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),s):Ln(a)?(e.consume(a),o):n(a)}}function fY(e,t,n){return s;function s(i){return e.consume(i),r}function r(i){return Sn(i)?n(i):t(i)}}function kP(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Qe(e)}function CP(e){return!Ln(e)}function NP(e){return!(e===47||Iv(e))}function Iv(e){return e===43||e===45||e===46||e===95||Sn(e)}function nb(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const pY={tokenize:wY,partial:!0};function mY(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:yY,continuation:{tokenize:bY},exit:_Y}},text:{91:{name:"gfmFootnoteCall",tokenize:vY},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:gY,resolveTo:xY}}}}function gY(e,t,n){const s=this;let r=s.events.length;const i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o;for(;r--;){const c=s.events[r][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return a;function a(c){if(!o||!o._balanced)return n(c);const u=Us(s.sliceSerialize({start:o.end,end:s.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function xY(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},r={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};r.end.column++,r.end.offset++,r.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},r.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",r,t],["exit",r,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...a),e}function vY(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i=0,o;return a;function a(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(h){if(i>999||h===93&&!o||h===null||h===91||Qe(h))return n(h);if(h===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return r.includes(Us(s.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Qe(h)||(o=!0),i++,e.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(e.consume(h),i++,u):u(h)}}function yY(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i,o=0,a;return c;function c(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(m)}function d(m){if(o>999||m===93&&!a||m===null||m===91||Qe(m))return n(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=Us(s.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return Qe(m)||(a=!0),o++,e.consume(m),m===92?h:d}function h(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}function p(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),r.includes(i)||r.push(i),Be(e,f,"gfmFootnoteDefinitionWhitespace")):n(m)}function f(m){return t(m)}}function bY(e,t,n){return e.check(Uu,t,e.attempt(pY,t,n))}function _Y(e){e.exit("gfmFootnoteDefinition")}function wY(e,t,n){const s=this;return Be(e,r,"gfmFootnoteDefinitionIndent",5);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function SY(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:i,resolveAll:r};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function r(o,a){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},h={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},p=[["enter",d,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",h,a]],f=a.parser.constructs.insideSpan.null;f&&us(p,p.length,0,gp(f,o.slice(u+1,c),a)),us(p,p.length,0,[["exit",h,a],["enter",o[c][1],a],["exit",o[c][1],a],["exit",d,a]]),us(o,u-1,c-u+3,p),c=u+p.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,a,c){const u=this.previous,d=this.events;let h=0;return p;function p(m){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(m):(o.enter("strikethroughSequenceTemporary"),f(m))}function f(m){const g=ul(u);if(m===126)return h>1?c(m):(o.consume(m),h++,f);if(h<2&&!n)return c(m);const y=o.exit("strikethroughSequenceTemporary"),x=ul(m);return y._open=!x||x===2&&!!g,y._close=!g||g===2&&!!x,a(m)}}}class kY{constructor(){this.map=[]}add(t,n,s){CY(this,t,n,s)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let r=s.pop();for(;r;){for(const i of r)t.push(i);r=s.pop()}this.map.length=0}}function CY(e,t,n,s){let r=0;if(!(n===0&&s.length===0)){for(;r<e.map.length;){if(e.map[r][0]===t){e.map[r][1]+=n,e.map[r][2].push(...s);return}r+=1}e.map.push([t,n,s])}}function NY(e,t){let n=!1;const s=[];for(;t<e.length;){const r=e[t];if(n){if(r[0]==="enter")r[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=s.length-1;s[i]=s[i]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function jY(){return{flow:{null:{name:"table",tokenize:EY,resolveAll:PY}}}}function EY(e,t,n){const s=this;let r=0,i=0,o;return a;function a(R){let B=s.events.length-1;for(;B>-1;){const T=s.events[B][1].type;if(T==="lineEnding"||T==="linePrefix")B--;else break}const L=B>-1?s.events[B][1].type:null,D=L==="tableHead"||L==="tableRow"?w:c;return D===w&&s.parser.lazy[s.now().line]?n(R):D(R)}function c(R){return e.enter("tableHead"),e.enter("tableRow"),u(R)}function u(R){return R===124||(o=!0,i+=1),d(R)}function d(R){return R===null?n(R):xe(R)?i>1?(i=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),f):n(R):Me(R)?Be(e,d,"whitespace")(R):(i+=1,o&&(o=!1,r+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(R)))}function h(R){return R===null||R===124||Qe(R)?(e.exit("data"),d(R)):(e.consume(R),R===92?p:h)}function p(R){return R===92||R===124?(e.consume(R),h):h(R)}function f(R){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(R):(e.enter("tableDelimiterRow"),o=!1,Me(R)?Be(e,m,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):m(R))}function m(R){return R===45||R===58?y(R):R===124?(o=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),g):C(R)}function g(R){return Me(R)?Be(e,y,"whitespace")(R):y(R)}function y(R){return R===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),x):R===45?(i+=1,x(R)):R===null||xe(R)?S(R):C(R)}function x(R){return R===45?(e.enter("tableDelimiterFiller"),b(R)):C(R)}function b(R){return R===45?(e.consume(R),b):R===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(R))}function _(R){return Me(R)?Be(e,S,"whitespace")(R):S(R)}function S(R){return R===124?m(R):R===null||xe(R)?!o||r!==i?C(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):C(R)}function C(R){return n(R)}function w(R){return e.enter("tableRow"),j(R)}function j(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),j):R===null||xe(R)?(e.exit("tableRow"),t(R)):Me(R)?Be(e,j,"whitespace")(R):(e.enter("data"),E(R))}function E(R){return R===null||R===124||Qe(R)?(e.exit("data"),j(R)):(e.consume(R),R===92?O:E)}function O(R){return R===92||R===124?(e.consume(R),E):E(R)}}function PY(e,t){let n=-1,s=!0,r=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,c=0,u,d,h;const p=new kY;for(;++n<e.length;){const f=e[n],m=f[1];f[0]==="enter"?m.type==="tableHead"?(a=!1,c!==0&&(FS(p,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(s=!0,h=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",d,t]])),r=m.type==="tableDelimiterRow"?2:d?3:1):r&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(s=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],h=Bd(p,t,i,r,void 0,h),i=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(s?s=!1:(i[1]!==0&&(o[0]=o[1],h=Bd(p,t,i,r,void 0,h)),i=o,o=[i[1],n,0,0])):m.type==="tableHead"?(a=!0,c=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],h=Bd(p,t,i,r,n,h)):o[1]!==0&&(h=Bd(p,t,o,r,n,h)),r=0):r&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&FS(p,t,c,u,d),p.consume(t.events),n=-1;++n<t.events.length;){const f=t.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=NY(t.events,n))}return e}function Bd(e,t,n,s,r,i){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},va(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=va(t.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=va(t.events,n[2]),d=va(t.events,n[3]),h={type:a,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),s!==2){const p=t.events[n[2]],f=t.events[n[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,g=n[3]-n[2]-1;e.add(m,g,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return r!==void 0&&(i.end=Object.assign({},va(t.events,r)),e.add(r,0,[["exit",i,t]]),i=void 0),i}function FS(e,t,n,s,r){const i=[],o=va(t.events,n);r&&(r.end=Object.assign({},o),i.push(["exit",r,t])),s.end=Object.assign({},o),i.push(["exit",s,t]),e.add(n+1,0,i)}function va(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const TY={name:"tasklistCheck",tokenize:DY};function RY(){return{text:{91:TY}}}function DY(e,t,n){const s=this;return r;function r(c){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Qe(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(c)}function a(c){return xe(c)?t(c):Me(c)?e.check({tokenize:MY},t,n)(c):n(c)}}function MY(e,t,n){return Be(e,s,"whitespace");function s(r){return r===null?n(r):t(r)}}function LY(e){return QE([iY(),mY(),SY(e),jY(),RY()])}const AY={};function OY(e){const t=this,n=e||AY,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(LY(n)),i.push(tY()),o.push(nY(n))}function IY({title:e,content:t,onClose:n}){return v.useEffect(()=>{const s=r=>{r.key==="Escape"&&n()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n]),l.jsx("div",{className:V.modalOverlay,onClick:n,children:l.jsxs("div",{className:V.modalContent,onClick:s=>s.stopPropagation(),children:[l.jsxs("div",{className:V.modalHeader,children:[l.jsx("h2",{className:V.modalTitle,children:e}),l.jsx("button",{className:V.modalClose,onClick:n,children:l.jsx(yt,{size:18})})]}),l.jsx("div",{className:V.modalBody,children:l.jsx("div",{className:V.markdownContent,children:l.jsx(Rv,{remarkPlugins:[OY],children:t})})})]})})}function FY({issueId:e,onClose:t}){const[n,s]=v.useState(!1),[r,i]=v.useState("transcript"),[o,a]=v.useState(!1),[c,u]=v.useState(null),d=v.useRef(null),h=v.useCallback(async y=>{if(!y.name.endsWith(".md")&&!y.name.endsWith(".txt")&&!y.name.endsWith(".vtt")){u("Only .md, .txt, and .vtt files are supported");return}a(!0),u(null);try{const x=await y.text(),b=await fetch(`/api/mission-control/planning/${e}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:r,filename:y.name,content:x})});if(!b.ok){const _=await b.json();throw new Error(_.error||"Upload failed")}u(`Uploaded ${y.name} as ${r}`),setTimeout(()=>t(),1500)}catch(x){u(`Error: ${x.message}`)}finally{a(!1)}},[e,r,t]),p=v.useCallback(y=>{y.preventDefault(),s(!1);const x=y.dataTransfer.files[0];x&&h(x)},[h]),f=v.useCallback(y=>{y.preventDefault(),s(!0)},[]),m=v.useCallback(()=>{s(!1)},[]),g=v.useCallback(y=>{var b;const x=(b=y.target.files)==null?void 0:b[0];x&&h(x)},[h]);return l.jsx("div",{className:V.modalOverlay,onClick:t,children:l.jsxs("div",{className:V.modalContent,onClick:y=>y.stopPropagation(),style:{maxWidth:500},children:[l.jsxs("div",{className:V.modalHeader,children:[l.jsx("h2",{className:V.modalTitle,children:"Upload Artifact"}),l.jsx("button",{className:V.modalClose,onClick:t,children:l.jsx(yt,{size:18})})]}),l.jsxs("div",{className:V.modalBody,children:[l.jsxs("div",{style:{display:"flex",gap:"var(--mc-space-2)",marginBottom:"var(--mc-space-4)"},children:[l.jsx("button",{className:V.badge,style:r==="transcript"?{borderColor:"var(--mc-accent)",color:"var(--mc-accent)"}:{},onClick:()=>i("transcript"),children:"Transcript"}),l.jsx("button",{className:V.badge,style:r==="note"?{borderColor:"var(--mc-accent)",color:"var(--mc-accent)"}:{},onClick:()=>i("note"),children:"Note"})]}),l.jsxs("div",{className:`${V.uploadZone} ${n?V.uploadZoneActive:""}`,onDrop:p,onDragOver:f,onDragLeave:m,onClick:()=>{var y;return(y=d.current)==null?void 0:y.click()},children:[l.jsx("div",{className:V.uploadIcon,children:o?l.jsx(qo,{size:32,className:V.spinning}):l.jsx(aj,{size:32})}),l.jsx("p",{className:V.uploadText,children:o?"Uploading...":"Drop a file here or click to browse"}),l.jsx("p",{className:V.uploadHint,children:"Accepts .md, .txt, and .vtt files"})]}),l.jsx("input",{ref:d,type:"file",accept:".md,.txt,.vtt",onChange:g,style:{display:"none"}}),c&&l.jsx("p",{style:{fontSize:"var(--mc-font-size-sm)",marginTop:"var(--mc-space-3)",color:c.startsWith("Error")?"var(--mc-error)":"var(--mc-success)"},children:c})]})]})})}async function BY(e){const t=await fetch(`/api/mission-control/planning/${e}`);if(!t.ok)throw new Error("Failed to fetch planning");return t.json()}function zY({issueId:e,source:t,onOpenBeads:n}){var y,x;const[s,r]=v.useState(null),[i,o]=v.useState(!1),[a,c]=v.useState(!1),[u,d]=v.useState(null),[h,p]=v.useState(!1),{data:f,refetch:m}=he({queryKey:["mission-control-planning",e],queryFn:()=>BY(e),refetchInterval:3e4}),g=async()=>{c(!0),d(null);try{const b=t?[t]:["github","linear","rally"];let _=0,S=null;for(const C of b)try{const w=await fetch(`/api/mission-control/planning/${e}/sync-discussions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tracker:C})});if(w.ok){const j=await w.json();_+=j.synced||0}else t&&(S=(await w.json().catch(()=>({error:"Sync failed"}))).error||`HTTP ${w.status}`)}catch{t&&(S="Network error")}S&&_===0?d({message:S,isError:!0}):_>0?d({message:`Synced ${_} — generating status...`,isError:!1}):d({message:"No new discussions",isError:!1}),p(!0);try{const C=await fetch(`/api/mission-control/planning/${e}/status-review`,{method:"POST"});if(C.ok){const w=await C.json(),j=w.cached;j?d({message:_>0?`Synced ${_} (status unchanged)`:"No changes detected",isError:!1}):_>0?d({message:`Synced ${_} + status updated`,isError:!1}):d({message:"Status updated",isError:!1}),r({title:`Status Review${j?" (cached)":""} — ${new Date(w.reviewedAt).toLocaleString()}`,content:w.statusReview})}else{const w=await C.json().catch(()=>({error:"Status review failed"}));_>0&&d({message:`Synced ${_} (status: ${w.error})`,isError:!1})}}catch(C){console.error("Status review generation failed:",C)}finally{p(!1)}m()}catch(b){console.error("Sync failed:",b),d({message:"Sync failed",isError:!0})}finally{c(!1),setTimeout(()=>d(null),6e3)}};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:V.badgeBar,children:[l.jsxs("button",{className:V.badge,onClick:n,title:"View beads tasks",children:[l.jsx(nj,{size:12}),"Tasks"]}),l.jsxs("button",{className:`${V.badge} ${f!=null&&f.state?"":V.badgeDisabled}`,onClick:()=>(f==null?void 0:f.state)&&r({title:"STATE.md",content:f.state}),title:f!=null&&f.state?"View STATE.md":"No STATE.md available",children:[l.jsx(qo,{size:12}),"STATE"]}),l.jsxs("button",{className:`${V.badge} ${f!=null&&f.prd?"":V.badgeDisabled}`,onClick:()=>(f==null?void 0:f.prd)&&r({title:"PRD",content:f.prd}),title:f!=null&&f.prd?"View PRD":"No PRD available",children:[l.jsx(qo,{size:12}),"PRD"]}),l.jsxs("button",{className:`${V.badge} ${!(f!=null&&f.statusReview)&&!h?V.badgeDisabled:""}`,onClick:async()=>{if(f!=null&&f.statusReview)r({title:`Status Review${f.statusReviewedAt?` (${new Date(f.statusReviewedAt).toLocaleString()})`:""}`,content:f.statusReview});else{p(!0);try{const b=await fetch(`/api/mission-control/planning/${e}/status-review`,{method:"POST"});if(b.ok){const _=await b.json();r({title:"Status Review",content:_.statusReview}),m()}}catch(b){console.error("Failed to generate status review:",b)}finally{p(!1)}}},title:f!=null&&f.statusReview?"View status review (click to refresh)":"Generate status review",children:[l.jsx(YD,{size:12,className:h?V.spinning:""}),h?"Reviewing...":"Status"]}),(f==null?void 0:f.inference)&&l.jsxs("button",{className:V.badge,onClick:()=>r({title:"INFERENCE.md",content:`*The Inference Document is a Shadow Engineering artifact. It analyzes how AI would approach this work — identifying gaps in requirements, risks, and potential implementation strategies — without making any changes. Use it to evaluate readiness before transitioning to AI-driven development.*
|
|
697
|
-
|
|
698
|
-
---
|
|
699
|
-
|
|
700
|
-
${f.inference}`}),title:"View Inference Document (Shadow Engineering)",children:[l.jsx(ep,{size:12}),"Inference"]}),(((y=f==null?void 0:f.discussions)==null?void 0:y.length)??0)>0&&l.jsxs("button",{className:V.badge,onClick:()=>{const b=f.discussions.map(_=>`## ${_.filename}
|
|
701
|
-
|
|
702
|
-
${_.content}`).join(`
|
|
703
|
-
|
|
704
|
-
---
|
|
705
|
-
|
|
706
|
-
`);r({title:"Discussions",content:b})},children:["Discussions (",f.discussions.length,")"]}),(((x=f==null?void 0:f.transcripts)==null?void 0:x.length)??0)>0&&l.jsxs("button",{className:V.badge,onClick:()=>{const b=f.transcripts.map(_=>`## ${_.filename}
|
|
707
|
-
|
|
708
|
-
${_.content}`).join(`
|
|
709
|
-
|
|
710
|
-
---
|
|
711
|
-
|
|
712
|
-
`);r({title:"Transcripts",content:b})},children:["Transcripts (",f.transcripts.length,")"]}),l.jsxs("button",{className:V.badge,onClick:()=>o(!0),title:"Upload transcript or note",children:[l.jsx(aj,{size:12}),"Upload"]}),l.jsxs("button",{className:`${V.syncButton} `,onClick:g,disabled:a||h,title:"Sync discussions and generate AI status review",children:[l.jsx(Ar,{size:12,className:a||h?V.spinning:""}),h?"Reviewing...":a?"Syncing...":"Sync"]}),u&&l.jsx("span",{className:V.badge,style:{color:u.isError?"var(--mc-error, #ef4444)":"var(--mc-success, #22c55e)",fontSize:"0.7rem",opacity:.9},children:u.message})]}),s&&l.jsx(IY,{title:s.title,content:s.content,onClose:()=>r(null)}),i&&l.jsx(FY,{issueId:e,onClose:()=>{o(!1),m()}})]})}async function $Y(){const e=await fetch("/api/deacon/status");if(!e.ok)throw new Error("Failed to fetch deacon status");return e.json()}async function HY(){const e=await fetch("/api/deacon/logs?limit=50");if(!e.ok)throw new Error("Failed to fetch deacon logs");return e.json()}function WY(e){if(!e)return"never";const t=Date.now()-new Date(e).getTime();if(t<0)return"just now";const n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;const s=Math.floor(n/60);return s<60?`${s}m ago`:`${Math.floor(s/60)}h ago`}function UY(e){return e.consecutiveFailures>=3?"var(--mc-error)":e.consecutiveFailures>0||e.lastForceKillTime&&Date.now()-new Date(e.lastForceKillTime).getTime()<5*60*1e3?"var(--mc-warning)":"var(--mc-success)"}function qY(e){return e.replace("-agent","")}function KY(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return""}}const VY={info:"var(--mc-text-muted)",warn:"var(--mc-warning)",action:"var(--mc-accent)",error:"var(--mc-error)"},YY={info:"INF",warn:"WRN",action:"ACT",error:"ERR"};function XY(){var h;const[e,t]=v.useState(!1),[n,s]=v.useState(!1),r=v.useRef(null),{data:i}=he({queryKey:["deacon-status"],queryFn:$Y,refetchInterval:15e3}),{data:o}=he({queryKey:["deacon-logs"],queryFn:HY,refetchInterval:n?5e3:!1,enabled:n});if(v.useEffect(()=>{n&&r.current&&r.current.scrollIntoView({behavior:"smooth"})},[o,n]),!i)return null;const a=Object.values(i.state.specialists||{}),c=((h=i.lastPatrol)==null?void 0:h.actions)||[],u=c.length>0,d=(o==null?void 0:o.logs)||[];return l.jsxs("div",{className:V.deaconPanel,children:[l.jsxs("div",{className:V.deaconHeader,onClick:()=>t(!e),children:[l.jsx(cM,{size:12,style:{color:i.isRunning?"var(--mc-success)":"var(--mc-text-muted)",flexShrink:0}}),l.jsx("span",{className:V.deaconTitle,children:"Deacon"}),l.jsx("span",{className:V.deaconMeta,children:i.isRunning?WY(i.state.lastPatrol):"stopped"}),u&&l.jsx("span",{className:V.deaconActionCount,children:c.length}),e?l.jsx(Mu,{size:12,style:{color:"var(--mc-text-muted)",flexShrink:0}}):l.jsx(bl,{size:12,style:{color:"var(--mc-text-muted)",flexShrink:0}})]}),l.jsx("div",{className:V.deaconSpecialists,children:a.map(p=>l.jsxs("div",{className:V.deaconSpecRow,children:[l.jsx("span",{className:V.deaconSpecDot,style:{background:UY(p)}}),l.jsx("span",{className:V.deaconSpecName,children:qY(p.specialistName)}),p.consecutiveFailures>0&&l.jsxs("span",{className:V.deaconSpecFailures,children:[p.consecutiveFailures,"x"]})]},p.specialistName))}),e&&l.jsxs(l.Fragment,{children:[u&&l.jsx("div",{className:V.deaconActions,children:c.map((p,f)=>l.jsx("div",{className:V.deaconAction,children:p},f))}),l.jsxs("div",{className:V.deaconLogToggle,onClick:p=>{p.stopPropagation(),s(!n)},children:[l.jsx(oM,{size:10,style:{color:"var(--mc-text-muted)",flexShrink:0}}),l.jsx("span",{children:n?"Hide logs":"Show logs"})]}),n&&l.jsxs("div",{className:V.deaconLogViewer,children:[d.length===0?l.jsx("div",{className:V.deaconLogEmpty,children:"No logs yet — waiting for patrol cycle..."}):d.map((p,f)=>l.jsxs("div",{className:V.deaconLogEntry,children:[l.jsx("span",{className:V.deaconLogTime,children:KY(p.timestamp)}),l.jsx("span",{className:V.deaconLogLevel,style:{color:VY[p.level]||"var(--mc-text-muted)"},children:YY[p.level]||p.level}),l.jsx("span",{className:V.deaconLogMessage,children:p.message})]},f)),l.jsx("div",{ref:r})]})]})]})}async function QY(){const e=await fetch("/api/mission-control/projects");if(!e.ok)throw new Error("Failed to fetch projects");return e.json()}async function GY(){const e=await fetch("/api/costs/by-issue");if(!e.ok)throw new Error("Failed to fetch costs");return e.json()}async function JY(){const e=await fetch("/api/version");if(!e.ok)throw new Error("Failed to fetch version");return e.json()}function ZY({issues:e=[]}){var C;const[t,n]=v.useState(null),[s,r]=v.useState(!1),[i,o]=v.useState(()=>{const w=localStorage.getItem("mc-sidebar-width");return w?Number(w):600}),a=v.useRef(!1),c=v.useRef(0),u=v.useRef(0),d=v.useRef(i),{data:h=[],isLoading:p}=he({queryKey:["mission-control-projects"],queryFn:QY,refetchInterval:1e4}),{data:f}=he({queryKey:["costs-by-issue"],queryFn:GY,refetchInterval:15e3}),{data:m}=he({queryKey:["version"],queryFn:JY,staleTime:1/0}),g={},y={};for(const w of e)g[w.identifier.toLowerCase()]=w.title,g[w.identifier]=w.title;for(const w of(f==null?void 0:f.issues)||[])y[w.issueId]=w.totalCost,y[w.issueId.toLowerCase()]=w.totalCost;const x=v.useCallback(w=>{n(w)},[]),b=v.useCallback(w=>{a.current=!0,c.current=w.clientX,u.current=i,document.body.style.cursor="col-resize",document.body.style.userSelect="none",w.preventDefault()},[i]);v.useEffect(()=>{const w=E=>{if(!a.current)return;const O=E.clientX-c.current,R=Math.max(240,Math.min(600,u.current+O));o(R),d.current=R},j=()=>{a.current&&localStorage.setItem("mc-sidebar-width",String(d.current)),a.current=!1,document.body.style.cursor="",document.body.style.userSelect=""};return document.addEventListener("mousemove",w),document.addEventListener("mouseup",j),()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",j)}},[]);const _=t?h.flatMap(w=>w.features).find(w=>w.issueId===t):null,S=t?g[t.toLowerCase()]||g[t]||t:"";return l.jsxs("div",{className:V.missionControl,children:[l.jsxs("div",{className:V.layout,children:[l.jsxs("div",{className:V.sidebar,style:{width:i,minWidth:i},children:[l.jsxs("div",{className:V.sidebarHeader,children:[l.jsx("h2",{className:V.sidebarTitle,children:"Mission Control"}),l.jsx("p",{className:V.sidebarSubtitle,children:"Active features across projects"})]}),l.jsx("div",{className:V.projectTree,children:p&&h.length===0?l.jsx("div",{className:V.emptyProject,children:"Loading projects..."}):h.length===0?l.jsx("div",{className:V.emptyProject,children:"No projects configured"}):h.map(w=>l.jsx(pK,{name:w.name,features:w.features,selectedFeature:t,onSelectFeature:x,issueTitles:g,issueCosts:y},w.path))}),l.jsx(XY,{}),m&&l.jsx("div",{className:V.sidebarFooter,children:l.jsxs("span",{className:V.versionLabel,children:["v",m.version]})})]}),l.jsx("div",{className:V.resizeHandle,onMouseDown:b}),l.jsx("div",{className:V.content,children:t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:V.featureHeader,children:[l.jsx("h1",{className:V.featureTitle,children:S}),l.jsx("span",{className:V.featureId,children:t}),(_==null?void 0:_.isShadow)&&l.jsx("span",{className:V.badge,style:{borderColor:"var(--mc-accent)",color:"var(--mc-accent)"},children:"Shadow"})]}),l.jsx(zY,{issueId:t,source:(C=e.find(w=>w.identifier===t))==null?void 0:C.source,onOpenBeads:()=>r(!0)}),l.jsx(jK,{issueId:t,issues:e,featureData:_})]}):l.jsx("div",{className:V.contentEmpty,children:l.jsxs("div",{style:{textAlign:"center"},children:[l.jsx(GN,{size:48,style:{marginBottom:"var(--mc-space-4)",opacity:.3}}),l.jsx("p",{children:"Select a feature to view activity"})]})})})]}),s&&t&&l.jsx(T0,{issueId:t,isOpen:s,onClose:()=>r(!1)})]})}const vr=Object.create(null);vr.open="0";vr.close="1";vr.ping="2";vr.pong="3";vr.message="4";vr.upgrade="5";vr.noop="6";const Ph=Object.create(null);Object.keys(vr).forEach(e=>{Ph[vr[e]]=e});const Fv={type:"error",data:"parser error"},jP=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",EP=typeof ArrayBuffer=="function",PP=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,sb=({type:e,data:t},n,s)=>jP&&t instanceof Blob?n?s(t):BS(t,s):EP&&(t instanceof ArrayBuffer||PP(t))?n?s(t):BS(new Blob([t]),s):s(vr[e]+(t||"")),BS=(e,t)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];t("b"+(s||""))},n.readAsDataURL(e)};function zS(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let ng;function eX(e,t){if(jP&&e.data instanceof Blob)return e.data.arrayBuffer().then(zS).then(t);if(EP&&(e.data instanceof ArrayBuffer||PP(e.data)))return t(zS(e.data));sb(e,!1,n=>{ng||(ng=new TextEncoder),t(ng.encode(n))})}const $S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gc=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<$S.length;e++)gc[$S.charCodeAt(e)]=e;const tX=e=>{let t=e.length*.75,n=e.length,s,r=0,i,o,a,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),d=new Uint8Array(u);for(s=0;s<n;s+=4)i=gc[e.charCodeAt(s)],o=gc[e.charCodeAt(s+1)],a=gc[e.charCodeAt(s+2)],c=gc[e.charCodeAt(s+3)],d[r++]=i<<2|o>>4,d[r++]=(o&15)<<4|a>>2,d[r++]=(a&3)<<6|c&63;return u},nX=typeof ArrayBuffer=="function",rb=(e,t)=>{if(typeof e!="string")return{type:"message",data:TP(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:sX(e.substring(1),t)}:Ph[n]?e.length>1?{type:Ph[n],data:e.substring(1)}:{type:Ph[n]}:Fv},sX=(e,t)=>{if(nX){const n=tX(e);return TP(n,t)}else return{base64:!0,data:e}},TP=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},RP="",rX=(e,t)=>{const n=e.length,s=new Array(n);let r=0;e.forEach((i,o)=>{sb(i,!1,a=>{s[o]=a,++r===n&&t(s.join(RP))})})},iX=(e,t)=>{const n=e.split(RP),s=[];for(let r=0;r<n.length;r++){const i=rb(n[r],t);if(s.push(i),i.type==="error")break}return s};function oX(){return new TransformStream({transform(e,t){eX(e,n=>{const s=n.length;let r;if(s<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,s);else if(s<65536){r=new Uint8Array(3);const i=new DataView(r.buffer);i.setUint8(0,126),i.setUint16(1,s)}else{r=new Uint8Array(9);const i=new DataView(r.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(s))}e.data&&typeof e.data!="string"&&(r[0]|=128),t.enqueue(r),t.enqueue(n)})}})}let sg;function zd(e){return e.reduce((t,n)=>t+n.length,0)}function $d(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let s=0;for(let r=0;r<t;r++)n[r]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),n}function aX(e,t){sg||(sg=new TextDecoder);const n=[];let s=0,r=-1,i=!1;return new TransformStream({transform(o,a){for(n.push(o);;){if(s===0){if(zd(n)<1)break;const c=$d(n,1);i=(c[0]&128)===128,r=c[0]&127,r<126?s=3:r===126?s=1:s=2}else if(s===1){if(zd(n)<2)break;const c=$d(n,2);r=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),s=3}else if(s===2){if(zd(n)<8)break;const c=$d(n,8),u=new DataView(c.buffer,c.byteOffset,c.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){a.enqueue(Fv);break}r=d*Math.pow(2,32)+u.getUint32(4),s=3}else{if(zd(n)<r)break;const c=$d(n,r);a.enqueue(rb(i?c:sg.decode(c),t)),s=0}if(r===0||r>e){a.enqueue(Fv);break}}}})}const DP=4;function Mt(e){if(e)return lX(e)}function lX(e){for(var t in Mt.prototype)e[t]=Mt.prototype[t];return e}Mt.prototype.on=Mt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Mt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Mt.prototype.off=Mt.prototype.removeListener=Mt.prototype.removeAllListeners=Mt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var s,r=0;r<n.length;r++)if(s=n[r],s===t||s.fn===t){n.splice(r,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Mt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,r=n.length;s<r;++s)n[s].apply(this,t)}return this};Mt.prototype.emitReserved=Mt.prototype.emit;Mt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Mt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const kp=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Cs=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),cX="arraybuffer";function MP(e,...t){return t.reduce((n,s)=>(e.hasOwnProperty(s)&&(n[s]=e[s]),n),{})}const uX=Cs.setTimeout,dX=Cs.clearTimeout;function Cp(e,t){t.useNativeTimers?(e.setTimeoutFn=uX.bind(Cs),e.clearTimeoutFn=dX.bind(Cs)):(e.setTimeoutFn=Cs.setTimeout.bind(Cs),e.clearTimeoutFn=Cs.clearTimeout.bind(Cs))}const hX=1.33;function fX(e){return typeof e=="string"?pX(e):Math.ceil((e.byteLength||e.size)*hX)}function pX(e){let t=0,n=0;for(let s=0,r=e.length;s<r;s++)t=e.charCodeAt(s),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(s++,n+=4);return n}function LP(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function mX(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function gX(e){let t={},n=e.split("&");for(let s=0,r=n.length;s<r;s++){let i=n[s].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class xX extends Error{constructor(t,n,s){super(t),this.description=n,this.context=s,this.type="TransportError"}}class ib extends Mt{constructor(t){super(),this.writable=!1,Cp(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,s){return super.emitReserved("error",new xX(t,n,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=rb(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=mX(t);return n.length?"?"+n:""}}class vX extends ib{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||n()})),this.writable||(s++,this.once("drain",function(){--s||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};iX(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,rX(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=LP()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let AP=!1;try{AP=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const yX=AP;function bX(){}class _X extends vX{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let s=location.port;s||(s=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,n){const s=this.request({method:"POST",data:t});s.on("success",n),s.on("error",(r,i)=>{this.onError("xhr post error",r,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=t}}class fr extends Mt{constructor(t,n,s){super(),this.createRequest=t,Cp(this,s),this._opts=s,this._method=s.method||"GET",this._uri=n,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var t;const n=MP(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(n);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&s.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var r;s.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=fr.requestsCount++,fr.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=bX,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete fr.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}fr.requestsCount=0;fr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",HS);else if(typeof addEventListener=="function"){const e="onpagehide"in Cs?"pagehide":"unload";addEventListener(e,HS,!1)}}function HS(){for(let e in fr.requests)fr.requests.hasOwnProperty(e)&&fr.requests[e].abort()}const wX=function(){const e=OP({xdomain:!1});return e&&e.responseType!==null}();class SX extends _X{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=wX&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new fr(OP,this.uri(),t)}}function OP(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||yX))return new XMLHttpRequest}catch{}if(!t)try{return new Cs[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const IP=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class kX extends ib{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,s=IP?{}:MP(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,s)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],r=n===t.length-1;sb(s,this.supportsBinary,i=>{try{this.doWrite(s,i)}catch{}r&&kp(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=LP()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const rg=Cs.WebSocket||Cs.MozWebSocket;class CX extends kX{createSocket(t,n,s){return IP?new rg(t,n,s):n?new rg(t,n):new rg(t)}doWrite(t,n){this.ws.send(n)}}class NX extends ib{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=aX(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(n).getReader(),r=oX();r.readable.pipeTo(t.writable),this._writer=r.writable.getWriter();const i=()=>{s.read().then(({done:a,value:c})=>{a||(this.onPacket(c),i())}).catch(a=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],r=n===t.length-1;this._writer.write(s).then(()=>{r&&kp(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const jX={websocket:CX,webtransport:NX,polling:SX},EX=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,PX=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Bv(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),s=e.indexOf("]");n!=-1&&s!=-1&&(e=e.substring(0,n)+e.substring(n,s).replace(/:/g,";")+e.substring(s,e.length));let r=EX.exec(e||""),i={},o=14;for(;o--;)i[PX[o]]=r[o]||"";return n!=-1&&s!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=TX(i,i.path),i.queryKey=RX(i,i.query),i}function TX(e,t){const n=/\/{2,9}/g,s=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&s.splice(0,1),t.slice(-1)=="/"&&s.splice(s.length-1,1),s}function RX(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,r,i){r&&(n[r]=i)}),n}const zv=typeof addEventListener=="function"&&typeof removeEventListener=="function",Th=[];zv&&addEventListener("offline",()=>{Th.forEach(e=>e())},!1);class Wi extends Mt{constructor(t,n){if(super(),this.binaryType=cX,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const s=Bv(t);n.hostname=s.host,n.secure=s.protocol==="https"||s.protocol==="wss",n.port=s.port,s.query&&(n.query=s.query)}else n.host&&(n.hostname=Bv(n.host).host);Cp(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(s=>{const r=s.prototype.name;this.transports.push(r),this._transportsByName[r]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=gX(this.opts.query)),zv&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Th.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=DP,n.transport=t,this.id&&(n.sid=this.id);const s=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Wi.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Wi.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let s=0;s<this.writeBuffer.length;s++){const r=this.writeBuffer[s].data;if(r&&(n+=fX(r)),s>0&&n>this._maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,kp(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,s){return this._sendPacket("message",t,n,s),this}send(t,n,s){return this._sendPacket("message",t,n,s),this}_sendPacket(t,n,s,r){if(typeof n=="function"&&(r=n,n=void 0),typeof s=="function"&&(r=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const i={type:t,data:n,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},s=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(Wi.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),zv&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Th.indexOf(this._offlineEventListener);s!==-1&&Th.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Wi.protocol=DP;class DX extends Wi{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),s=!1;Wi.priorWebsocketSuccess=!1;const r=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",h=>{if(!s)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Wi.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const p=new Error("probe error");p.transport=n.name,this.emitReserved("upgradeError",p)}}))};function i(){s||(s=!0,d(),n.close(),n=null)}const o=h=>{const p=new Error("probe error: "+h);p.transport=n.name,i(),this.emitReserved("upgradeError",p)};function a(){o("transport closed")}function c(){o("socket closed")}function u(h){n&&h.name!==n.name&&i()}const d=()=>{n.removeListener("open",r),n.removeListener("error",o),n.removeListener("close",a),this.off("close",c),this.off("upgrading",u)};n.once("open",r),n.once("error",o),n.once("close",a),this.once("close",c),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&n.push(t[s]);return n}}let MX=class extends DX{constructor(t,n={}){const s=typeof t=="object"?t:n;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(r=>jX[r]).filter(r=>!!r)),super(t,s)}};function LX(e,t="",n){let s=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),s=Bv(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const i=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+i+":"+s.port+t,s.href=s.protocol+"://"+i+(n&&n.port===s.port?"":":"+s.port),s}const AX=typeof ArrayBuffer=="function",OX=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,FP=Object.prototype.toString,IX=typeof Blob=="function"||typeof Blob<"u"&&FP.call(Blob)==="[object BlobConstructor]",FX=typeof File=="function"||typeof File<"u"&&FP.call(File)==="[object FileConstructor]";function ob(e){return AX&&(e instanceof ArrayBuffer||OX(e))||IX&&e instanceof Blob||FX&&e instanceof File}function Rh(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,s=e.length;n<s;n++)if(Rh(e[n]))return!0;return!1}if(ob(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Rh(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Rh(e[n]))return!0;return!1}function BX(e){const t=[],n=e.data,s=e;return s.data=$v(n,t),s.attachments=t.length,{packet:s,buffers:t}}function $v(e,t){if(!e)return e;if(ob(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let s=0;s<e.length;s++)n[s]=$v(e[s],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=$v(e[s],t));return n}return e}function zX(e,t){return e.data=Hv(e.data,t),delete e.attachments,e}function Hv(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Hv(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Hv(e[n],t));return e}const BP=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],$X=5;var je;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(je||(je={}));class HX{constructor(t){this.replacer=t}encode(t){return(t.type===je.EVENT||t.type===je.ACK)&&Rh(t)?this.encodeAsBinary({type:t.type===je.EVENT?je.BINARY_EVENT:je.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===je.BINARY_EVENT||t.type===je.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=BX(t),s=this.encodeAsString(n.packet),r=n.buffers;return r.unshift(s),r}}class ab extends Mt{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const s=n.type===je.BINARY_EVENT;s||n.type===je.BINARY_ACK?(n.type=s?je.EVENT:je.ACK,this.reconstructor=new WX(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(ob(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const s={type:Number(t.charAt(0))};if(je[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===je.BINARY_EVENT||s.type===je.BINARY_ACK){const i=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const o=t.substring(i,n);if(o!=Number(o)||t.charAt(n)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););s.nsp=t.substring(i,n)}else s.nsp="/";const r=t.charAt(n+1);if(r!==""&&Number(r)==r){const i=n+1;for(;++n;){const o=t.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===t.length)break}s.id=Number(t.substring(i,n+1))}if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(ab.isPayloadValid(s.type,i))s.data=i;else throw new Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case je.CONNECT:return Ef(n);case je.DISCONNECT:return n===void 0;case je.CONNECT_ERROR:return typeof n=="string"||Ef(n);case je.EVENT:case je.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&BP.indexOf(n[0])===-1);case je.ACK:case je.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class WX{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=zX(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function UX(e){return typeof e=="string"}const qX=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function KX(e){return e===void 0||qX(e)}function Ef(e){return Object.prototype.toString.call(e)==="[object Object]"}function VX(e,t){switch(e){case je.CONNECT:return t===void 0||Ef(t);case je.DISCONNECT:return t===void 0;case je.EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&BP.indexOf(t[0])===-1);case je.ACK:return Array.isArray(t);case je.CONNECT_ERROR:return typeof t=="string"||Ef(t);default:return!1}}function YX(e){return UX(e.nsp)&&KX(e.id)&&VX(e.type,e.data)}const XX=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ab,Encoder:HX,get PacketType(){return je},isPacketValid:YX,protocol:$X},Symbol.toStringTag,{value:"Module"}));function zs(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const QX=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class zP extends Mt{constructor(t,n,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[zs(t,"open",this.onopen.bind(this)),zs(t,"packet",this.onpacket.bind(this)),zs(t,"error",this.onerror.bind(this)),zs(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var s,r,i;if(QX.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const o={type:je.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const d=this.ids++,h=n.pop();this._registerAckCallback(d,h),o.id=d}const a=(r=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||r===void 0?void 0:r.writable,c=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!a||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,n){var s;const r=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(r===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);n.call(this,new Error("operation has timed out"))},r),o=(...a)=>{this.io.clearTimeoutFn(i),n.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((s,r)=>{const i=(o,a)=>o?r(o):s(a);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((r,...i)=>(this._queue[0],r!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(r)):(this._queue.shift(),n&&n(null,...i)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:je.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(s=>String(s.id)===t)){const s=this.acks[t];delete this.acks[t],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case je.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case je.EVENT:case je.BINARY_EVENT:this.onevent(t);break;case je.ACK:case je.BINARY_ACK:this.onack(t);break;case je.DISCONNECT:this.ondisconnect();break;case je.CONNECT_ERROR:this.destroy();const s=new Error(t.data.message);s.data=t.data.data,this.emitReserved("connect_error",s);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const s of n)s.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let s=!1;return function(...r){s||(s=!0,n.packet({type:je.ACK,id:t,data:r}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:je.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const s of n)s.apply(this,t.data)}}}function El(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}El.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};El.prototype.reset=function(){this.attempts=0};El.prototype.setMin=function(e){this.ms=e};El.prototype.setMax=function(e){this.max=e};El.prototype.setJitter=function(e){this.jitter=e};class Wv extends Mt{constructor(t,n){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Cp(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((s=n.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new El({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const r=n.parser||XX;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new MX(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const r=zs(n,"open",function(){s.onopen(),t&&t()}),i=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=zs(n,"error",i);if(this._timeout!==!1){const a=this._timeout,c=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),n.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(r),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(zs(t,"ping",this.onping.bind(this)),zs(t,"data",this.ondata.bind(this)),zs(t,"error",this.onerror.bind(this)),zs(t,"close",this.onclose.bind(this)),zs(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){kp(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new zP(this,t,n),this.nsps[t]=s),s}_destroy(t){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let s=0;s<n.length;s++)this.engine.write(n[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(r=>{r?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",r)):t.onreconnect()}))},n);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Zl={};function Ic(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=LX(e,t.path||"/socket.io"),s=n.source,r=n.id,i=n.path,o=Zl[r]&&i in Zl[r].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let c;return a?c=new Wv(s,t):(Zl[r]||(Zl[r]=new Wv(s,t)),c=Zl[r]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Ic,{Manager:Wv,Socket:zP,io:Ic,connect:Ic});let _o=null,Hd=0;function GX(){return(!_o||!_o.connected)&&(_o=Ic({path:"/socket.io",transports:["websocket","polling"],reconnectionDelay:1e3,reconnectionDelayMax:1e4})),_o}function JX(){const e=Nt();v.useEffect(()=>{const t=GX();Hd++;const n=s=>{e.setQueryData(["resources"],s)};return t.on("resources:updated",n),()=>{t.off("resources:updated",n),Hd--,Hd<=0&&_o&&(_o.disconnect(),_o=null,Hd=0)}},[e])}function ZX(e){return e>=85?"bg-red-500":e>=60?"bg-yellow-400":"bg-green-500"}function Pf({value:e,label:t,showValue:n=!0,className:s=""}){const r=Math.min(100,Math.max(0,e)),i=ZX(r);return l.jsxs("div",{className:`flex flex-col gap-0.5 ${s}`,children:[(t||n)&&l.jsxs("div",{className:"flex justify-between items-center",children:[t&&l.jsx("span",{className:"text-xs text-content-subtle",children:t}),n&&l.jsxs("span",{className:"text-xs text-content-subtle ml-auto",children:[r.toFixed(1),"%"]})]}),l.jsx("div",{className:"h-1.5 bg-surface-overlay rounded-full overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${i}`,style:{width:`${r}%`}})})]})}/*!
|
|
713
|
-
* @kurkle/color v0.3.4
|
|
714
|
-
* https://github.com/kurkle/color#readme
|
|
715
|
-
* (c) 2024 Jukka Kurkela
|
|
716
|
-
* Released under the MIT License
|
|
717
|
-
*/function Xu(e){return e+.5|0}const ji=(e,t,n)=>Math.max(Math.min(e,n),t);function xc(e){return ji(Xu(e*2.55),0,255)}function Ui(e){return ji(Xu(e*255),0,255)}function Pr(e){return ji(Xu(e/2.55)/100,0,1)}function WS(e){return ji(Xu(e*100),0,100)}const gs={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Uv=[..."0123456789ABCDEF"],eQ=e=>Uv[e&15],tQ=e=>Uv[(e&240)>>4]+Uv[e&15],Wd=e=>(e&240)>>4===(e&15),nQ=e=>Wd(e.r)&&Wd(e.g)&&Wd(e.b)&&Wd(e.a);function sQ(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&gs[e[1]]*17,g:255&gs[e[2]]*17,b:255&gs[e[3]]*17,a:t===5?gs[e[4]]*17:255}:(t===7||t===9)&&(n={r:gs[e[1]]<<4|gs[e[2]],g:gs[e[3]]<<4|gs[e[4]],b:gs[e[5]]<<4|gs[e[6]],a:t===9?gs[e[7]]<<4|gs[e[8]]:255})),n}const rQ=(e,t)=>e<255?t(e):"";function iQ(e){var t=nQ(e)?eQ:tQ;return e?"#"+t(e.r)+t(e.g)+t(e.b)+rQ(e.a,t):void 0}const oQ=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function $P(e,t,n){const s=t*Math.min(n,1-n),r=(i,o=(i+e/30)%12)=>n-s*Math.max(Math.min(o-3,9-o,1),-1);return[r(0),r(8),r(4)]}function aQ(e,t,n){const s=(r,i=(r+e/60)%6)=>n-n*t*Math.max(Math.min(i,4-i,1),0);return[s(5),s(3),s(1)]}function lQ(e,t,n){const s=$P(e,1,.5);let r;for(t+n>1&&(r=1/(t+n),t*=r,n*=r),r=0;r<3;r++)s[r]*=1-t-n,s[r]+=t;return s}function cQ(e,t,n,s,r){return e===r?(t-n)/s+(t<n?6:0):t===r?(n-e)/s+2:(e-t)/s+4}function lb(e){const n=e.r/255,s=e.g/255,r=e.b/255,i=Math.max(n,s,r),o=Math.min(n,s,r),a=(i+o)/2;let c,u,d;return i!==o&&(d=i-o,u=a>.5?d/(2-i-o):d/(i+o),c=cQ(n,s,r,d,i),c=c*60+.5),[c|0,u||0,a]}function cb(e,t,n,s){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,s)).map(Ui)}function ub(e,t,n){return cb($P,e,t,n)}function uQ(e,t,n){return cb(lQ,e,t,n)}function dQ(e,t,n){return cb(aQ,e,t,n)}function HP(e){return(e%360+360)%360}function hQ(e){const t=oQ.exec(e);let n=255,s;if(!t)return;t[5]!==s&&(n=t[6]?xc(+t[5]):Ui(+t[5]));const r=HP(+t[2]),i=+t[3]/100,o=+t[4]/100;return t[1]==="hwb"?s=uQ(r,i,o):t[1]==="hsv"?s=dQ(r,i,o):s=ub(r,i,o),{r:s[0],g:s[1],b:s[2],a:n}}function fQ(e,t){var n=lb(e);n[0]=HP(n[0]+t),n=ub(n),e.r=n[0],e.g=n[1],e.b=n[2]}function pQ(e){if(!e)return;const t=lb(e),n=t[0],s=WS(t[1]),r=WS(t[2]);return e.a<255?`hsla(${n}, ${s}%, ${r}%, ${Pr(e.a)})`:`hsl(${n}, ${s}%, ${r}%)`}const US={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},qS={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function mQ(){const e={},t=Object.keys(qS),n=Object.keys(US);let s,r,i,o,a;for(s=0;s<t.length;s++){for(o=a=t[s],r=0;r<n.length;r++)i=n[r],a=a.replace(i,US[i]);i=parseInt(qS[o],16),e[a]=[i>>16&255,i>>8&255,i&255]}return e}let Ud;function gQ(e){Ud||(Ud=mQ(),Ud.transparent=[0,0,0,0]);const t=Ud[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const xQ=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function vQ(e){const t=xQ.exec(e);let n=255,s,r,i;if(t){if(t[7]!==s){const o=+t[7];n=t[8]?xc(o):ji(o*255,0,255)}return s=+t[1],r=+t[3],i=+t[5],s=255&(t[2]?xc(s):ji(s,0,255)),r=255&(t[4]?xc(r):ji(r,0,255)),i=255&(t[6]?xc(i):ji(i,0,255)),{r:s,g:r,b:i,a:n}}}function yQ(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Pr(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const ig=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,ma=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function bQ(e,t,n){const s=ma(Pr(e.r)),r=ma(Pr(e.g)),i=ma(Pr(e.b));return{r:Ui(ig(s+n*(ma(Pr(t.r))-s))),g:Ui(ig(r+n*(ma(Pr(t.g))-r))),b:Ui(ig(i+n*(ma(Pr(t.b))-i))),a:e.a+n*(t.a-e.a)}}function qd(e,t,n){if(e){let s=lb(e);s[t]=Math.max(0,Math.min(s[t]+s[t]*n,t===0?360:1)),s=ub(s),e.r=s[0],e.g=s[1],e.b=s[2]}}function WP(e,t){return e&&Object.assign(t||{},e)}function KS(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=Ui(e[3]))):(t=WP(e,{r:0,g:0,b:0,a:1}),t.a=Ui(t.a)),t}function _Q(e){return e.charAt(0)==="r"?vQ(e):hQ(e)}class vu{constructor(t){if(t instanceof vu)return t;const n=typeof t;let s;n==="object"?s=KS(t):n==="string"&&(s=sQ(t)||gQ(t)||_Q(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=WP(this._rgb);return t&&(t.a=Pr(t.a)),t}set rgb(t){this._rgb=KS(t)}rgbString(){return this._valid?yQ(this._rgb):void 0}hexString(){return this._valid?iQ(this._rgb):void 0}hslString(){return this._valid?pQ(this._rgb):void 0}mix(t,n){if(t){const s=this.rgb,r=t.rgb;let i;const o=n===i?.5:n,a=2*o-1,c=s.a-r.a,u=((a*c===-1?a:(a+c)/(1+a*c))+1)/2;i=1-u,s.r=255&u*s.r+i*r.r+.5,s.g=255&u*s.g+i*r.g+.5,s.b=255&u*s.b+i*r.b+.5,s.a=o*s.a+(1-o)*r.a,this.rgb=s}return this}interpolate(t,n){return t&&(this._rgb=bQ(this._rgb,t._rgb,n)),this}clone(){return new vu(this.rgb)}alpha(t){return this._rgb.a=Ui(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=Xu(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return qd(this._rgb,2,t),this}darken(t){return qd(this._rgb,2,-t),this}saturate(t){return qd(this._rgb,1,t),this}desaturate(t){return qd(this._rgb,1,-t),this}rotate(t){return fQ(this._rgb,t),this}}/*!
|
|
718
|
-
* Chart.js v4.5.1
|
|
719
|
-
* https://www.chartjs.org
|
|
720
|
-
* (c) 2025 Chart.js Contributors
|
|
721
|
-
* Released under the MIT License
|
|
722
|
-
*/const wQ=(()=>{let e=0;return()=>e++})();function vt(e){return e==null}function dn(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function $e(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function Nn(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Gs(e,t){return Nn(e)?e:t}function Ye(e,t){return typeof e>"u"?t:e}const SQ=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function kt(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function _n(e,t,n,s){let r,i,o;if(dn(e))for(i=e.length,r=0;r<i;r++)t.call(n,e[r],r);else if($e(e))for(o=Object.keys(e),i=o.length,r=0;r<i;r++)t.call(n,e[o[r]],o[r])}function VS(e,t){let n,s,r,i;if(!e||!t||e.length!==t.length)return!1;for(n=0,s=e.length;n<s;++n)if(r=e[n],i=t[n],r.datasetIndex!==i.datasetIndex||r.index!==i.index)return!1;return!0}function Tf(e){if(dn(e))return e.map(Tf);if($e(e)){const t=Object.create(null),n=Object.keys(e),s=n.length;let r=0;for(;r<s;++r)t[n[r]]=Tf(e[n[r]]);return t}return e}function UP(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function kQ(e,t,n,s){if(!UP(e))return;const r=t[e],i=n[e];$e(r)&&$e(i)?yu(r,i,s):t[e]=Tf(i)}function yu(e,t,n){const s=dn(t)?t:[t],r=s.length;if(!$e(e))return e;n=n||{};const i=n.merger||kQ;let o;for(let a=0;a<r;++a){if(o=s[a],!$e(o))continue;const c=Object.keys(o);for(let u=0,d=c.length;u<d;++u)i(c[u],e,o,n)}return e}function Fc(e,t){return yu(e,t,{merger:CQ})}function CQ(e,t,n){if(!UP(e))return;const s=t[e],r=n[e];$e(s)&&$e(r)?Fc(s,r):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=Tf(r))}const YS={"":e=>e,x:e=>e.x,y:e=>e.y};function NQ(e){const t=e.split("."),n=[];let s="";for(const r of t)s+=r,s.endsWith("\\")?s=s.slice(0,-1)+".":(n.push(s),s="");return n}function jQ(e){const t=NQ(e);return n=>{for(const s of t){if(s==="")break;n=n&&n[s]}return n}}function Rf(e,t){return(YS[t]||(YS[t]=jQ(t)))(e)}function db(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Df=e=>typeof e<"u",Xi=e=>typeof e=="function",XS=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function EQ(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const hs=Math.PI,pr=2*hs,PQ=pr+hs,Mf=Number.POSITIVE_INFINITY,TQ=hs/180,Ei=hs/2,ro=hs/4,QS=hs*2/3,qP=Math.log10,dl=Math.sign;function Bc(e,t,n){return Math.abs(e-t)<n}function GS(e){const t=Math.round(e);e=Bc(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(qP(e))),s=e/n;return(s<=1?1:s<=2?2:s<=5?5:10)*n}function RQ(e){const t=[],n=Math.sqrt(e);let s;for(s=1;s<n;s++)e%s===0&&(t.push(s),t.push(e/s));return n===(n|0)&&t.push(n),t.sort((r,i)=>r-i).pop(),t}function DQ(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function Lf(e){return!DQ(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function MQ(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function LQ(e,t,n){let s,r,i;for(s=0,r=e.length;s<r;s++)i=e[s][n],isNaN(i)||(t.min=Math.min(t.min,i),t.max=Math.max(t.max,i))}function wo(e){return e*(hs/180)}function AQ(e){return e*(180/hs)}function JS(e){if(!Nn(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function OQ(e,t){const n=t.x-e.x,s=t.y-e.y,r=Math.sqrt(n*n+s*s);let i=Math.atan2(s,n);return i<-.5*hs&&(i+=pr),{angle:i,distance:r}}function ZS(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function IQ(e,t){return(e-t+PQ)%pr-hs}function sr(e){return(e%pr+pr)%pr}function KP(e,t,n,s){const r=sr(e),i=sr(t),o=sr(n),a=sr(i-r),c=sr(o-r),u=sr(r-i),d=sr(r-o);return r===i||r===o||s&&i===o||a>c&&u<d}function Pi(e,t,n){return Math.max(t,Math.min(n,e))}function FQ(e){return Pi(e,-32768,32767)}function VP(e,t,n,s=1e-6){return e>=Math.min(t,n)-s&&e<=Math.max(t,n)+s}function hb(e,t,n){n=n||(o=>e[o]<t);let s=e.length-1,r=0,i;for(;s-r>1;)i=r+s>>1,n(i)?r=i:s=i;return{lo:r,hi:s}}const qv=(e,t,n,s)=>hb(e,n,s?r=>{const i=e[r][t];return i<n||i===n&&e[r+1][t]===n}:r=>e[r][t]<n),BQ=(e,t,n)=>hb(e,n,s=>e[s][t]>=n);function zQ(e,t,n){let s=0,r=e.length;for(;s<r&&e[s]<t;)s++;for(;r>s&&e[r-1]>n;)r--;return s>0||r<e.length?e.slice(s,r):e}const YP=["push","pop","shift","splice","unshift"];function $Q(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),YP.forEach(n=>{const s="_onData"+db(n),r=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...i){const o=r.apply(this,i);return e._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...i)}),o}})})}function ek(e,t){const n=e._chartjs;if(!n)return;const s=n.listeners,r=s.indexOf(t);r!==-1&&s.splice(r,1),!(s.length>0)&&(YP.forEach(i=>{delete e[i]}),delete e._chartjs)}function HQ(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const XP=function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame}();function QP(e,t){let n=[],s=!1;return function(...r){n=r,s||(s=!0,XP.call(window,()=>{s=!1,e.apply(t,n)}))}}function WQ(e,t){let n;return function(...s){return t?(clearTimeout(n),n=setTimeout(e,t,s)):e.apply(this,s),t}}const UQ=e=>e==="start"?"left":e==="end"?"right":"center",tk=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,Kd=e=>e===0||e===1,nk=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*pr/n)),sk=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*pr/n)+1,zc={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*Ei)+1,easeOutSine:e=>Math.sin(e*Ei),easeInOutSine:e=>-.5*(Math.cos(hs*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Kd(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Kd(e)?e:nk(e,.075,.3),easeOutElastic:e=>Kd(e)?e:sk(e,.075,.3),easeInOutElastic(e){return Kd(e)?e:e<.5?.5*nk(e*2,.1125,.45):.5+.5*sk(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-zc.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?zc.easeInBounce(e*2)*.5:zc.easeOutBounce(e*2-1)*.5+.5};function fb(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function rk(e){return fb(e)?e:new vu(e)}function og(e){return fb(e)?e:new vu(e).saturate(.5).darken(.1).hexString()}const qQ=["x","y","borderWidth","radius","tension"],KQ=["color","borderColor","backgroundColor"];function VQ(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:KQ},numbers:{type:"number",properties:qQ}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function YQ(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const ik=new Map;function XQ(e,t){t=t||{};const n=e+JSON.stringify(t);let s=ik.get(n);return s||(s=new Intl.NumberFormat(e,t),ik.set(n,s)),s}function GP(e,t,n){return XQ(t,n).format(e)}const QQ={values(e){return dn(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const s=this.chart.options.locale;let r,i=e;if(n.length>1){const u=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(u<1e-4||u>1e15)&&(r="scientific"),i=GQ(e,n)}const o=qP(Math.abs(i)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),c={notation:r,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(c,this.options.ticks.format),GP(e,s,c)}};function GQ(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var JP={formatters:QQ};function JQ(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:JP.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Zo=Object.create(null),Kv=Object.create(null);function $c(e,t){if(!t)return e;const n=t.split(".");for(let s=0,r=n.length;s<r;++s){const i=n[s];e=e[i]||(e[i]=Object.create(null))}return e}function ag(e,t,n){return typeof t=="string"?yu($c(e,t),n):yu($c(e,""),t)}class ZQ{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,r)=>og(r.backgroundColor),this.hoverBorderColor=(s,r)=>og(r.borderColor),this.hoverColor=(s,r)=>og(r.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return ag(this,t,n)}get(t){return $c(this,t)}describe(t,n){return ag(Kv,t,n)}override(t,n){return ag(Zo,t,n)}route(t,n,s,r){const i=$c(this,t),o=$c(this,s),a="_"+n;Object.defineProperties(i,{[a]:{value:i[n],writable:!0},[n]:{enumerable:!0,get(){const c=this[a],u=o[r];return $e(c)?Object.assign({},u,c):Ye(c,u)},set(c){this[a]=c}}})}apply(t){t.forEach(n=>n(this))}}var Lt=new ZQ({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[VQ,YQ,JQ]);function eG(e){return!e||vt(e.size)||vt(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function ok(e,t,n,s,r){let i=t[r];return i||(i=t[r]=e.measureText(r).width,n.push(r)),i>s&&(s=i),s}function io(e,t,n){const s=e.currentDevicePixelRatio,r=n!==0?Math.max(n/2,.5):0;return Math.round((t-r)*s)/s+r}function ak(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function tG(e,t,n,s){nG(e,t,n,s)}function nG(e,t,n,s,r){let i,o,a,c,u,d,h,p;const f=t.pointStyle,m=t.rotation,g=t.radius;let y=(m||0)*TQ;if(f&&typeof f=="object"&&(i=f.toString(),i==="[object HTMLImageElement]"||i==="[object HTMLCanvasElement]")){e.save(),e.translate(n,s),e.rotate(y),e.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),e.restore();return}if(!(isNaN(g)||g<=0)){switch(e.beginPath(),f){default:e.arc(n,s,g,0,pr),e.closePath();break;case"triangle":d=g,e.moveTo(n+Math.sin(y)*d,s-Math.cos(y)*g),y+=QS,e.lineTo(n+Math.sin(y)*d,s-Math.cos(y)*g),y+=QS,e.lineTo(n+Math.sin(y)*d,s-Math.cos(y)*g),e.closePath();break;case"rectRounded":u=g*.516,c=g-u,o=Math.cos(y+ro)*c,h=Math.cos(y+ro)*c,a=Math.sin(y+ro)*c,p=Math.sin(y+ro)*c,e.arc(n-h,s-a,u,y-hs,y-Ei),e.arc(n+p,s-o,u,y-Ei,y),e.arc(n+h,s+a,u,y,y+Ei),e.arc(n-p,s+o,u,y+Ei,y+hs),e.closePath();break;case"rect":if(!m){c=Math.SQRT1_2*g,d=c,e.rect(n-d,s-c,2*d,2*c);break}y+=ro;case"rectRot":h=Math.cos(y)*g,o=Math.cos(y)*g,a=Math.sin(y)*g,p=Math.sin(y)*g,e.moveTo(n-h,s-a),e.lineTo(n+p,s-o),e.lineTo(n+h,s+a),e.lineTo(n-p,s+o),e.closePath();break;case"crossRot":y+=ro;case"cross":h=Math.cos(y)*g,o=Math.cos(y)*g,a=Math.sin(y)*g,p=Math.sin(y)*g,e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+p,s-o),e.lineTo(n-p,s+o);break;case"star":h=Math.cos(y)*g,o=Math.cos(y)*g,a=Math.sin(y)*g,p=Math.sin(y)*g,e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+p,s-o),e.lineTo(n-p,s+o),y+=ro,h=Math.cos(y)*g,o=Math.cos(y)*g,a=Math.sin(y)*g,p=Math.sin(y)*g,e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+p,s-o),e.lineTo(n-p,s+o);break;case"line":o=Math.cos(y)*g,a=Math.sin(y)*g,e.moveTo(n-o,s-a),e.lineTo(n+o,s+a);break;case"dash":e.moveTo(n,s),e.lineTo(n+Math.cos(y)*g,s+Math.sin(y)*g);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function bu(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function pb(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function mb(e){e.restore()}function sG(e,t,n,s,r){if(!t)return e.lineTo(n.x,n.y);if(r==="middle"){const i=(t.x+n.x)/2;e.lineTo(i,t.y),e.lineTo(i,n.y)}else r==="after"!=!!s?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function rG(e,t,n,s){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(s?t.cp1x:t.cp2x,s?t.cp1y:t.cp2y,s?n.cp2x:n.cp1x,s?n.cp2y:n.cp1y,n.x,n.y)}function iG(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),vt(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function oG(e,t,n,s,r){if(r.strikethrough||r.underline){const i=e.measureText(s),o=t-i.actualBoundingBoxLeft,a=t+i.actualBoundingBoxRight,c=n-i.actualBoundingBoxAscent,u=n+i.actualBoundingBoxDescent,d=r.strikethrough?(c+u)/2:u;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=r.decorationWidth||2,e.moveTo(o,d),e.lineTo(a,d),e.stroke()}}function aG(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function lk(e,t,n,s,r,i={}){const o=dn(t)?t:[t],a=i.strokeWidth>0&&i.strokeColor!=="";let c,u;for(e.save(),e.font=r.string,iG(e,i),c=0;c<o.length;++c)u=o[c],i.backdrop&&aG(e,i.backdrop),a&&(i.strokeColor&&(e.strokeStyle=i.strokeColor),vt(i.strokeWidth)||(e.lineWidth=i.strokeWidth),e.strokeText(u,n,s,i.maxWidth)),e.fillText(u,n,s,i.maxWidth),oG(e,n,s,u,i),s+=Number(r.lineHeight);e.restore()}const lG=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,cG=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function uG(e,t){const n=(""+e).match(lG);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const dG=e=>+e||0;function hG(e,t){const n={},s=$e(t),r=s?Object.keys(t):t,i=$e(e)?s?o=>Ye(e[o],e[t[o]]):o=>e[o]:()=>e;for(const o of r)n[o]=dG(i(o));return n}function fG(e){return hG(e,{top:"y",right:"x",bottom:"y",left:"x"})}function _u(e){const t=fG(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Vv(e,t){e=e||{},t=t||Lt.font;let n=Ye(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let s=Ye(e.style,t.style);s&&!(""+s).match(cG)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const r={family:Ye(e.family,t.family),lineHeight:uG(Ye(e.lineHeight,t.lineHeight),n),size:n,style:s,weight:Ye(e.weight,t.weight),string:""};return r.string=eG(r),r}function Vd(e,t,n,s){let r,i,o;for(r=0,i=e.length;r<i;++r)if(o=e[r],o!==void 0&&o!==void 0)return o}function pG(e,t,n){const{min:s,max:r}=e,i=SQ(t,(r-s)/2),o=(a,c)=>n&&a===0?0:a+c;return{min:o(s,-Math.abs(i)),max:o(r,i)}}function Pl(e,t){return Object.assign(Object.create(e),t)}function gb(e,t=[""],n,s,r=()=>e[0]){const i=n||e;typeof s>"u"&&(s=n4("_fallback",e));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:i,_fallback:s,_getTarget:r,override:a=>gb([a,...e],t,i,s)};return new Proxy(o,{deleteProperty(a,c){return delete a[c],delete a._keys,delete e[0][c],!0},get(a,c){return e4(a,c,()=>wG(c,t,e,a))},getOwnPropertyDescriptor(a,c){return Reflect.getOwnPropertyDescriptor(a._scopes[0],c)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,c){return uk(a).includes(c)},ownKeys(a){return uk(a)},set(a,c,u){const d=a._storage||(a._storage=r());return a[c]=d[c]=u,delete a._keys,!0}})}function hl(e,t,n,s){const r={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:ZP(e,s),setContext:i=>hl(e,i,n,s),override:i=>hl(e.override(i),t,n,s)};return new Proxy(r,{deleteProperty(i,o){return delete i[o],delete e[o],!0},get(i,o,a){return e4(i,o,()=>gG(i,o,a))},getOwnPropertyDescriptor(i,o){return i._descriptors.allKeys?Reflect.has(e,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,o)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(i,o){return Reflect.has(e,o)},ownKeys(){return Reflect.ownKeys(e)},set(i,o,a){return e[o]=a,delete i[o],!0}})}function ZP(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:s=t.indexable,_allKeys:r=t.allKeys}=e;return{allKeys:r,scriptable:n,indexable:s,isScriptable:Xi(n)?n:()=>n,isIndexable:Xi(s)?s:()=>s}}const mG=(e,t)=>e?e+db(t):t,xb=(e,t)=>$e(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function e4(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const s=n();return e[t]=s,s}function gG(e,t,n){const{_proxy:s,_context:r,_subProxy:i,_descriptors:o}=e;let a=s[t];return Xi(a)&&o.isScriptable(t)&&(a=xG(t,a,e,n)),dn(a)&&a.length&&(a=vG(t,a,e,o.isIndexable)),xb(t,a)&&(a=hl(a,r,i&&i[t],o)),a}function xG(e,t,n,s){const{_proxy:r,_context:i,_subProxy:o,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let c=t(i,o||s);return a.delete(e),xb(e,c)&&(c=vb(r._scopes,r,e,c)),c}function vG(e,t,n,s){const{_proxy:r,_context:i,_subProxy:o,_descriptors:a}=n;if(typeof i.index<"u"&&s(e))return t[i.index%t.length];if($e(t[0])){const c=t,u=r._scopes.filter(d=>d!==c);t=[];for(const d of c){const h=vb(u,r,e,d);t.push(hl(h,i,o&&o[e],a))}}return t}function t4(e,t,n){return Xi(e)?e(t,n):e}const yG=(e,t)=>e===!0?t:typeof e=="string"?Rf(t,e):void 0;function bG(e,t,n,s,r){for(const i of t){const o=yG(n,i);if(o){e.add(o);const a=t4(o._fallback,n,r);if(typeof a<"u"&&a!==n&&a!==s)return a}else if(o===!1&&typeof s<"u"&&n!==s)return null}return!1}function vb(e,t,n,s){const r=t._rootScopes,i=t4(t._fallback,n,s),o=[...e,...r],a=new Set;a.add(s);let c=ck(a,o,n,i||n,s);return c===null||typeof i<"u"&&i!==n&&(c=ck(a,o,i,c,s),c===null)?!1:gb(Array.from(a),[""],r,i,()=>_G(t,n,s))}function ck(e,t,n,s,r){for(;n;)n=bG(e,t,n,s,r);return n}function _G(e,t,n){const s=e._getTarget();t in s||(s[t]={});const r=s[t];return dn(r)&&$e(n)?n:r||{}}function wG(e,t,n,s){let r;for(const i of t)if(r=n4(mG(i,e),n),typeof r<"u")return xb(e,r)?vb(n,s,e,r):r}function n4(e,t){for(const n of t){if(!n)continue;const s=n[e];if(typeof s<"u")return s}}function uk(e){let t=e._keys;return t||(t=e._keys=SG(e._scopes)),t}function SG(e){const t=new Set;for(const n of e)for(const s of Object.keys(n).filter(r=>!r.startsWith("_")))t.add(s);return Array.from(t)}const kG=Number.EPSILON||1e-14,fl=(e,t)=>t<e.length&&!e[t].skip&&e[t],s4=e=>e==="x"?"y":"x";function CG(e,t,n,s){const r=e.skip?t:e,i=t,o=n.skip?t:n,a=ZS(i,r),c=ZS(o,i);let u=a/(a+c),d=c/(a+c);u=isNaN(u)?0:u,d=isNaN(d)?0:d;const h=s*u,p=s*d;return{previous:{x:i.x-h*(o.x-r.x),y:i.y-h*(o.y-r.y)},next:{x:i.x+p*(o.x-r.x),y:i.y+p*(o.y-r.y)}}}function NG(e,t,n){const s=e.length;let r,i,o,a,c,u=fl(e,0);for(let d=0;d<s-1;++d)if(c=u,u=fl(e,d+1),!(!c||!u)){if(Bc(t[d],0,kG)){n[d]=n[d+1]=0;continue}r=n[d]/t[d],i=n[d+1]/t[d],a=Math.pow(r,2)+Math.pow(i,2),!(a<=9)&&(o=3/Math.sqrt(a),n[d]=r*o*t[d],n[d+1]=i*o*t[d])}}function jG(e,t,n="x"){const s=s4(n),r=e.length;let i,o,a,c=fl(e,0);for(let u=0;u<r;++u){if(o=a,a=c,c=fl(e,u+1),!a)continue;const d=a[n],h=a[s];o&&(i=(d-o[n])/3,a[`cp1${n}`]=d-i,a[`cp1${s}`]=h-i*t[u]),c&&(i=(c[n]-d)/3,a[`cp2${n}`]=d+i,a[`cp2${s}`]=h+i*t[u])}}function EG(e,t="x"){const n=s4(t),s=e.length,r=Array(s).fill(0),i=Array(s);let o,a,c,u=fl(e,0);for(o=0;o<s;++o)if(a=c,c=u,u=fl(e,o+1),!!c){if(u){const d=u[t]-c[t];r[o]=d!==0?(u[n]-c[n])/d:0}i[o]=a?u?dl(r[o-1])!==dl(r[o])?0:(r[o-1]+r[o])/2:r[o-1]:r[o]}NG(e,r,i),jG(e,i,t)}function Yd(e,t,n){return Math.max(Math.min(e,n),t)}function PG(e,t){let n,s,r,i,o,a=bu(e[0],t);for(n=0,s=e.length;n<s;++n)o=i,i=a,a=n<s-1&&bu(e[n+1],t),i&&(r=e[n],o&&(r.cp1x=Yd(r.cp1x,t.left,t.right),r.cp1y=Yd(r.cp1y,t.top,t.bottom)),a&&(r.cp2x=Yd(r.cp2x,t.left,t.right),r.cp2y=Yd(r.cp2y,t.top,t.bottom)))}function TG(e,t,n,s,r){let i,o,a,c;if(t.spanGaps&&(e=e.filter(u=>!u.skip)),t.cubicInterpolationMode==="monotone")EG(e,r);else{let u=s?e[e.length-1]:e[0];for(i=0,o=e.length;i<o;++i)a=e[i],c=CG(u,a,e[Math.min(i+1,o-(s?0:1))%o],t.tension),a.cp1x=c.previous.x,a.cp1y=c.previous.y,a.cp2x=c.next.x,a.cp2y=c.next.y,u=a}t.capBezierPoints&&PG(e,n)}function yb(){return typeof window<"u"&&typeof document<"u"}function bb(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Af(e,t,n){let s;return typeof e=="string"?(s=parseInt(e,10),e.indexOf("%")!==-1&&(s=s/100*t.parentNode[n])):s=e,s}const Np=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function RG(e,t){return Np(e).getPropertyValue(t)}const DG=["top","right","bottom","left"];function Oo(e,t,n){const s={};n=n?"-"+n:"";for(let r=0;r<4;r++){const i=DG[r];s[i]=parseFloat(e[t+"-"+i+n])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const MG=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function LG(e,t){const n=e.touches,s=n&&n.length?n[0]:e,{offsetX:r,offsetY:i}=s;let o=!1,a,c;if(MG(r,i,e.target))a=r,c=i;else{const u=t.getBoundingClientRect();a=s.clientX-u.left,c=s.clientY-u.top,o=!0}return{x:a,y:c,box:o}}function ho(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:s}=t,r=Np(n),i=r.boxSizing==="border-box",o=Oo(r,"padding"),a=Oo(r,"border","width"),{x:c,y:u,box:d}=LG(e,n),h=o.left+(d&&a.left),p=o.top+(d&&a.top);let{width:f,height:m}=t;return i&&(f-=o.width+a.width,m-=o.height+a.height),{x:Math.round((c-h)/f*n.width/s),y:Math.round((u-p)/m*n.height/s)}}function AG(e,t,n){let s,r;if(t===void 0||n===void 0){const i=e&&bb(e);if(!i)t=e.clientWidth,n=e.clientHeight;else{const o=i.getBoundingClientRect(),a=Np(i),c=Oo(a,"border","width"),u=Oo(a,"padding");t=o.width-u.width-c.width,n=o.height-u.height-c.height,s=Af(a.maxWidth,i,"clientWidth"),r=Af(a.maxHeight,i,"clientHeight")}}return{width:t,height:n,maxWidth:s||Mf,maxHeight:r||Mf}}const Ti=e=>Math.round(e*10)/10;function OG(e,t,n,s){const r=Np(e),i=Oo(r,"margin"),o=Af(r.maxWidth,e,"clientWidth")||Mf,a=Af(r.maxHeight,e,"clientHeight")||Mf,c=AG(e,t,n);let{width:u,height:d}=c;if(r.boxSizing==="content-box"){const p=Oo(r,"border","width"),f=Oo(r,"padding");u-=f.width+p.width,d-=f.height+p.height}return u=Math.max(0,u-i.width),d=Math.max(0,s?u/s:d-i.height),u=Ti(Math.min(u,o,c.maxWidth)),d=Ti(Math.min(d,a,c.maxHeight)),u&&!d&&(d=Ti(u/2)),(t!==void 0||n!==void 0)&&s&&c.height&&d>c.height&&(d=c.height,u=Ti(Math.floor(d*s))),{width:u,height:d}}function dk(e,t,n){const s=t||1,r=Ti(e.height*s),i=Ti(e.width*s);e.height=Ti(e.height),e.width=Ti(e.width);const o=e.canvas;return o.style&&(n||!o.style.height&&!o.style.width)&&(o.style.height=`${e.height}px`,o.style.width=`${e.width}px`),e.currentDevicePixelRatio!==s||o.height!==r||o.width!==i?(e.currentDevicePixelRatio=s,o.height=r,o.width=i,e.ctx.setTransform(s,0,0,s,0,0),!0):!1}const IG=function(){let e=!1;try{const t={get passive(){return e=!0,!1}};yb()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e}();function hk(e,t){const n=RG(e,t),s=n&&n.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function fo(e,t,n,s){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function FG(e,t,n,s){return{x:e.x+n*(t.x-e.x),y:s==="middle"?n<.5?e.y:t.y:s==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function BG(e,t,n,s){const r={x:e.cp2x,y:e.cp2y},i={x:t.cp1x,y:t.cp1y},o=fo(e,r,n),a=fo(r,i,n),c=fo(i,t,n),u=fo(o,a,n),d=fo(a,c,n);return fo(u,d,n)}function r4(e){return e==="angle"?{between:KP,compare:IQ,normalize:sr}:{between:VP,compare:(t,n)=>t-n,normalize:t=>t}}function fk({start:e,end:t,count:n,loop:s,style:r}){return{start:e%n,end:t%n,loop:s&&(t-e+1)%n===0,style:r}}function zG(e,t,n){const{property:s,start:r,end:i}=n,{between:o,normalize:a}=r4(s),c=t.length;let{start:u,end:d,loop:h}=e,p,f;if(h){for(u+=c,d+=c,p=0,f=c;p<f&&o(a(t[u%c][s]),r,i);++p)u--,d--;u%=c,d%=c}return d<u&&(d+=c),{start:u,end:d,loop:h,style:e.style}}function i4(e,t,n){if(!n)return[e];const{property:s,start:r,end:i}=n,o=t.length,{compare:a,between:c,normalize:u}=r4(s),{start:d,end:h,loop:p,style:f}=zG(e,t,n),m=[];let g=!1,y=null,x,b,_;const S=()=>c(r,_,x)&&a(r,_)!==0,C=()=>a(i,x)===0||c(i,_,x),w=()=>g||S(),j=()=>!g||C();for(let E=d,O=d;E<=h;++E)b=t[E%o],!b.skip&&(x=u(b[s]),x!==_&&(g=c(x,r,i),y===null&&w()&&(y=a(x,r)===0?E:O),y!==null&&j()&&(m.push(fk({start:y,end:E,loop:p,count:o,style:f})),y=null),O=E,_=x));return y!==null&&m.push(fk({start:y,end:h,loop:p,count:o,style:f})),m}function o4(e,t){const n=[],s=e.segments;for(let r=0;r<s.length;r++){const i=i4(s[r],e.points,t);i.length&&n.push(...i)}return n}function $G(e,t,n,s){let r=0,i=t-1;if(n&&!s)for(;r<t&&!e[r].skip;)r++;for(;r<t&&e[r].skip;)r++;for(r%=t,n&&(i+=r);i>r&&e[i%t].skip;)i--;return i%=t,{start:r,end:i}}function HG(e,t,n,s){const r=e.length,i=[];let o=t,a=e[t],c;for(c=t+1;c<=n;++c){const u=e[c%r];u.skip||u.stop?a.skip||(s=!1,i.push({start:t%r,end:(c-1)%r,loop:s}),t=o=u.stop?c:null):(o=c,a.skip&&(t=c)),a=u}return o!==null&&i.push({start:t%r,end:o%r,loop:s}),i}function WG(e,t){const n=e.points,s=e.options.spanGaps,r=n.length;if(!r)return[];const i=!!e._loop,{start:o,end:a}=$G(n,r,i,s);if(s===!0)return pk(e,[{start:o,end:a,loop:i}],n,t);const c=a<o?a+r:a,u=!!e._fullLoop&&o===0&&a===r-1;return pk(e,HG(n,o,c,u),n,t)}function pk(e,t,n,s){return!s||!s.setContext||!n?t:UG(e,t,n,s)}function UG(e,t,n,s){const r=e._chart.getContext(),i=mk(e.options),{_datasetIndex:o,options:{spanGaps:a}}=e,c=n.length,u=[];let d=i,h=t[0].start,p=h;function f(m,g,y,x){const b=a?-1:1;if(m!==g){for(m+=c;n[m%c].skip;)m-=b;for(;n[g%c].skip;)g+=b;m%c!==g%c&&(u.push({start:m%c,end:g%c,loop:y,style:x}),d=x,h=g%c)}}for(const m of t){h=a?h:m.start;let g=n[h%c],y;for(p=h+1;p<=m.end;p++){const x=n[p%c];y=mk(s.setContext(Pl(r,{type:"segment",p0:g,p1:x,p0DataIndex:(p-1)%c,p1DataIndex:p%c,datasetIndex:o}))),qG(y,d)&&f(h,p-1,m.loop,d),g=x,d=y}h<p-1&&f(h,p-1,m.loop,d)}return u}function mk(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function qG(e,t){if(!t)return!1;const n=[],s=function(r,i){return fb(i)?(n.includes(i)||n.push(i),n.indexOf(i)):i};return JSON.stringify(e,s)!==JSON.stringify(t,s)}function Xd(e,t,n){return e.options.clip?e[n]:t[n]}function KG(e,t){const{xScale:n,yScale:s}=e;return n&&s?{left:Xd(n,t,"left"),right:Xd(n,t,"right"),top:Xd(s,t,"top"),bottom:Xd(s,t,"bottom")}:t}function a4(e,t){const n=t._clip;if(n.disabled)return!1;const s=KG(t,e.chartArea);return{left:n.left===!1?0:s.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:s.right+(n.right===!0?0:n.right),top:n.top===!1?0:s.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:s.bottom+(n.bottom===!0?0:n.bottom)}}/*!
|
|
723
|
-
* Chart.js v4.5.1
|
|
724
|
-
* https://www.chartjs.org
|
|
725
|
-
* (c) 2025 Chart.js Contributors
|
|
726
|
-
* Released under the MIT License
|
|
727
|
-
*/class VG{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,s,r){const i=n.listeners[r],o=n.duration;i.forEach(a=>a({chart:t,initial:n.initial,numSteps:o,currentStep:Math.min(s-n.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=XP.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((s,r)=>{if(!s.running||!s.items.length)return;const i=s.items;let o=i.length-1,a=!1,c;for(;o>=0;--o)c=i[o],c._active?(c._total>s.duration&&(s.duration=c._total),c.tick(t),a=!0):(i[o]=i[i.length-1],i.pop());a&&(r.draw(),this._notify(r,s,t,"progress")),i.length||(s.running=!1,this._notify(r,s,t,"complete"),s.initial=!1),n+=i.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let s=n.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,s)),s}listen(t,n,s){this._getAnims(t).listeners[n].push(s)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((s,r)=>Math.max(s,r._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const s=n.items;let r=s.length-1;for(;r>=0;--r)s[r].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Nr=new VG;const gk="transparent",YG={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const s=rk(e||gk),r=s.valid&&rk(t||gk);return r&&r.valid?r.mix(s,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class XG{constructor(t,n,s,r){const i=n[s];r=Vd([t.to,r,i,t.from]);const o=Vd([t.from,i,r]);this._active=!0,this._fn=t.fn||YG[t.type||typeof o],this._easing=zc[t.easing]||zc.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=s,this._from=o,this._to=r,this._promises=void 0}active(){return this._active}update(t,n,s){if(this._active){this._notify(!1);const r=this._target[this._prop],i=s-this._start,o=this._duration-i;this._start=s,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=i,this._loop=!!t.loop,this._to=Vd([t.to,n,r,t.from]),this._from=Vd([t.from,r,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,s=this._duration,r=this._prop,i=this._from,o=this._loop,a=this._to;let c;if(this._active=i!==a&&(o||n<s),!this._active){this._target[r]=a,this._notify(!0);return}if(n<0){this._target[r]=i;return}c=n/s%2,c=o&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[r]=this._fn(i,a,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,s)=>{t.push({res:n,rej:s})})}_notify(t){const n=t?"res":"rej",s=this._promises||[];for(let r=0;r<s.length;r++)s[r][n]()}}class QG{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!$e(t))return;const n=Object.keys(Lt.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(r=>{const i=t[r];if(!$e(i))return;const o={};for(const a of n)o[a]=i[a];(dn(i.properties)&&i.properties||[r]).forEach(a=>{(a===r||!s.has(a))&&s.set(a,o)})})}_animateOptions(t,n){const s=n.options,r=JG(t,s);if(!r)return[];const i=this._createAnimations(r,s);return s.$shared&&GG(t.options.$animations,s).then(()=>{t.options=s},()=>{}),i}_createAnimations(t,n){const s=this._properties,r=[],i=t.$animations||(t.$animations={}),o=Object.keys(n),a=Date.now();let c;for(c=o.length-1;c>=0;--c){const u=o[c];if(u.charAt(0)==="$")continue;if(u==="options"){r.push(...this._animateOptions(t,n));continue}const d=n[u];let h=i[u];const p=s.get(u);if(h)if(p&&h.active()){h.update(p,d,a);continue}else h.cancel();if(!p||!p.duration){t[u]=d;continue}i[u]=h=new XG(p,t,u,d),r.push(h)}return r}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const s=this._createAnimations(t,n);if(s.length)return Nr.add(this._chart,s),!0}}function GG(e,t){const n=[],s=Object.keys(t);for(let r=0;r<s.length;r++){const i=e[s[r]];i&&i.active()&&n.push(i.wait())}return Promise.all(n)}function JG(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function xk(e,t){const n=e&&e.options||{},s=n.reverse,r=n.min===void 0?t:0,i=n.max===void 0?t:0;return{start:s?i:r,end:s?r:i}}function ZG(e,t,n){if(n===!1)return!1;const s=xk(e,n),r=xk(t,n);return{top:r.end,right:s.end,bottom:r.start,left:s.start}}function eJ(e){let t,n,s,r;return $e(e)?(t=e.top,n=e.right,s=e.bottom,r=e.left):t=n=s=r=e,{top:t,right:n,bottom:s,left:r,disabled:e===!1}}function l4(e,t){const n=[],s=e._getSortedDatasetMetas(t);let r,i;for(r=0,i=s.length;r<i;++r)n.push(s[r].index);return n}function vk(e,t,n,s={}){const r=e.keys,i=s.mode==="single";let o,a,c,u;if(t===null)return;let d=!1;for(o=0,a=r.length;o<a;++o){if(c=+r[o],c===n){if(d=!0,s.all)continue;break}u=e.values[c],Nn(u)&&(i||t===0||dl(t)===dl(u))&&(t+=u)}return!d&&!s.all?0:t}function tJ(e,t){const{iScale:n,vScale:s}=t,r=n.axis==="x"?"x":"y",i=s.axis==="x"?"x":"y",o=Object.keys(e),a=new Array(o.length);let c,u,d;for(c=0,u=o.length;c<u;++c)d=o[c],a[c]={[r]:d,[i]:e[d]};return a}function lg(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function nJ(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function sJ(e){const{min:t,max:n,minDefined:s,maxDefined:r}=e.getUserBounds();return{min:s?t:Number.NEGATIVE_INFINITY,max:r?n:Number.POSITIVE_INFINITY}}function rJ(e,t,n){const s=e[t]||(e[t]={});return s[n]||(s[n]={})}function yk(e,t,n,s){for(const r of t.getMatchingVisibleMetas(s).reverse()){const i=e[r.index];if(n&&i>0||!n&&i<0)return r.index}return null}function bk(e,t){const{chart:n,_cachedMeta:s}=e,r=n._stacks||(n._stacks={}),{iScale:i,vScale:o,index:a}=s,c=i.axis,u=o.axis,d=nJ(i,o,s),h=t.length;let p;for(let f=0;f<h;++f){const m=t[f],{[c]:g,[u]:y}=m,x=m._stacks||(m._stacks={});p=x[u]=rJ(r,d,g),p[a]=y,p._top=yk(p,o,!0,s.type),p._bottom=yk(p,o,!1,s.type);const b=p._visualValues||(p._visualValues={});b[a]=y}}function cg(e,t){const n=e.scales;return Object.keys(n).filter(s=>n[s].axis===t).shift()}function iJ(e,t){return Pl(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function oJ(e,t,n){return Pl(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function ec(e,t){const n=e.controller.index,s=e.vScale&&e.vScale.axis;if(s){t=t||e._parsed;for(const r of t){const i=r._stacks;if(!i||i[s]===void 0||i[s][n]===void 0)return;delete i[s][n],i[s]._visualValues!==void 0&&i[s]._visualValues[n]!==void 0&&delete i[s]._visualValues[n]}}}const ug=e=>e==="reset"||e==="none",_k=(e,t)=>t?e:Object.assign({},e),aJ=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:l4(n,!0),values:null};class Dh{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=lg(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&ec(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,s=this.getDataset(),r=(h,p,f,m)=>h==="x"?p:h==="r"?m:f,i=n.xAxisID=Ye(s.xAxisID,cg(t,"x")),o=n.yAxisID=Ye(s.yAxisID,cg(t,"y")),a=n.rAxisID=Ye(s.rAxisID,cg(t,"r")),c=n.indexAxis,u=n.iAxisID=r(c,i,o,a),d=n.vAxisID=r(c,o,i,a);n.xScale=this.getScaleForId(i),n.yScale=this.getScaleForId(o),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(u),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&ek(this._data,this),t._stacked&&ec(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),s=this._data;if($e(n)){const r=this._cachedMeta;this._data=tJ(n,r)}else if(s!==n){if(s){ek(s,this);const r=this._cachedMeta;ec(r),r._parsed=[]}n&&Object.isExtensible(n)&&$Q(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,s=this.getDataset();let r=!1;this._dataCheck();const i=n._stacked;n._stacked=lg(n.vScale,n),n.stack!==s.stack&&(r=!0,ec(n),n.stack=s.stack),this._resyncElements(t),(r||i!==n._stacked)&&(bk(this,n._parsed),n._stacked=lg(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:s,_data:r}=this,{iScale:i,_stacked:o}=s,a=i.axis;let c=t===0&&n===r.length?!0:s._sorted,u=t>0&&s._parsed[t-1],d,h,p;if(this._parsing===!1)s._parsed=r,s._sorted=!0,p=r;else{dn(r[t])?p=this.parseArrayData(s,r,t,n):$e(r[t])?p=this.parseObjectData(s,r,t,n):p=this.parsePrimitiveData(s,r,t,n);const f=()=>h[a]===null||u&&h[a]<u[a];for(d=0;d<n;++d)s._parsed[d+t]=h=p[d],c&&(f()&&(c=!1),u=h);s._sorted=c}o&&bk(this,p)}parsePrimitiveData(t,n,s,r){const{iScale:i,vScale:o}=t,a=i.axis,c=o.axis,u=i.getLabels(),d=i===o,h=new Array(r);let p,f,m;for(p=0,f=r;p<f;++p)m=p+s,h[p]={[a]:d||i.parse(u[m],m),[c]:o.parse(n[m],m)};return h}parseArrayData(t,n,s,r){const{xScale:i,yScale:o}=t,a=new Array(r);let c,u,d,h;for(c=0,u=r;c<u;++c)d=c+s,h=n[d],a[c]={x:i.parse(h[0],d),y:o.parse(h[1],d)};return a}parseObjectData(t,n,s,r){const{xScale:i,yScale:o}=t,{xAxisKey:a="x",yAxisKey:c="y"}=this._parsing,u=new Array(r);let d,h,p,f;for(d=0,h=r;d<h;++d)p=d+s,f=n[p],u[d]={x:i.parse(Rf(f,a),p),y:o.parse(Rf(f,c),p)};return u}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,s){const r=this.chart,i=this._cachedMeta,o=n[t.axis],a={keys:l4(r,!0),values:n._stacks[t.axis]._visualValues};return vk(a,o,i.index,{mode:s})}updateRangeFromParsed(t,n,s,r){const i=s[n.axis];let o=i===null?NaN:i;const a=r&&s._stacks[n.axis];r&&a&&(r.values=a,o=vk(r,i,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,n){const s=this._cachedMeta,r=s._parsed,i=s._sorted&&t===s.iScale,o=r.length,a=this._getOtherScale(t),c=aJ(n,s,this.chart),u={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:h}=sJ(a);let p,f;function m(){f=r[p];const g=f[a.axis];return!Nn(f[t.axis])||d>g||h<g}for(p=0;p<o&&!(!m()&&(this.updateRangeFromParsed(u,t,f,c),i));++p);if(i){for(p=o-1;p>=0;--p)if(!m()){this.updateRangeFromParsed(u,t,f,c);break}}return u}getAllParsedValues(t){const n=this._cachedMeta._parsed,s=[];let r,i,o;for(r=0,i=n.length;r<i;++r)o=n[r][t.axis],Nn(o)&&s.push(o);return s}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,s=n.iScale,r=n.vScale,i=this.getParsed(t);return{label:s?""+s.getLabelForValue(i[s.axis]):"",value:r?""+r.getLabelForValue(i[r.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=eJ(Ye(this.options.clip,ZG(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,s=this._cachedMeta,r=s.data||[],i=n.chartArea,o=[],a=this._drawStart||0,c=this._drawCount||r.length-a,u=this.options.drawActiveElementsOnTop;let d;for(s.dataset&&s.dataset.draw(t,i,a,c),d=a;d<a+c;++d){const h=r[d];h.hidden||(h.active&&u?o.push(h):h.draw(t,i))}for(d=0;d<o.length;++d)o[d].draw(t,i)}getStyle(t,n){const s=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(t||0,s)}getContext(t,n,s){const r=this.getDataset();let i;if(t>=0&&t<this._cachedMeta.data.length){const o=this._cachedMeta.data[t];i=o.$context||(o.$context=oJ(this.getContext(),t,o)),i.parsed=this.getParsed(t),i.raw=r.data[t],i.index=i.dataIndex=t}else i=this.$context||(this.$context=iJ(this.chart.getContext(),this.index)),i.dataset=r,i.index=i.datasetIndex=this.index;return i.active=!!n,i.mode=s,i}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",s){const r=n==="active",i=this._cachedDataOpts,o=t+"-"+n,a=i[o],c=this.enableOptionSharing&&Df(s);if(a)return _k(a,c);const u=this.chart.config,d=u.datasetElementScopeKeys(this._type,t),h=r?[`${t}Hover`,"hover",t,""]:[t,""],p=u.getOptionScopes(this.getDataset(),d),f=Object.keys(Lt.elements[t]),m=()=>this.getContext(s,r,n),g=u.resolveNamedOptions(p,f,m,h);return g.$shared&&(g.$shared=c,i[o]=Object.freeze(_k(g,c))),g}_resolveAnimations(t,n,s){const r=this.chart,i=this._cachedDataOpts,o=`animation-${n}`,a=i[o];if(a)return a;let c;if(r.options.animation!==!1){const d=this.chart.config,h=d.datasetAnimationScopeKeys(this._type,n),p=d.getOptionScopes(this.getDataset(),h);c=d.createResolver(p,this.getContext(t,s,n))}const u=new QG(r,c&&c.animations);return c&&c._cacheable&&(i[o]=Object.freeze(u)),u}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||ug(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const s=this.resolveDataElementOptions(t,n),r=this._sharedOptions,i=this.getSharedOptions(s),o=this.includeOptions(n,i)||i!==r;return this.updateSharedOptions(i,n,s),{sharedOptions:i,includeOptions:o}}updateElement(t,n,s,r){ug(r)?Object.assign(t,s):this._resolveAnimations(n,r).update(t,s)}updateSharedOptions(t,n,s){t&&!ug(n)&&this._resolveAnimations(void 0,n).update(t,s)}_setStyle(t,n,s,r){t.active=r;const i=this.getStyle(n,r);this._resolveAnimations(n,s,r).update(t,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(t,n,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,n,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,s=this._cachedMeta.data;for(const[a,c,u]of this._syncList)this[a](c,u);this._syncList=[];const r=s.length,i=n.length,o=Math.min(i,r);o&&this.parse(0,o),i>r?this._insertElements(r,i-r,t):i<r&&this._removeElements(i,r-i)}_insertElements(t,n,s=!0){const r=this._cachedMeta,i=r.data,o=t+n;let a;const c=u=>{for(u.length+=n,a=u.length-1;a>=o;a--)u[a]=u[a-n]};for(c(i),a=t;a<o;++a)i[a]=new this.dataElementType;this._parsing&&c(r._parsed),this.parse(t,n),s&&this.updateElements(i,t,n,"reset")}updateElements(t,n,s,r){}_removeElements(t,n){const s=this._cachedMeta;if(this._parsing){const r=s._parsed.splice(t,n);s._stacked&&ec(s,r)}s.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,s,r]=t;this[n](s,r)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const s=arguments.length-2;s&&this._sync(["_insertElements",t,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}Ae(Dh,"defaults",{}),Ae(Dh,"datasetElementType",null),Ae(Dh,"dataElementType",null);function oo(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class _b{constructor(t){Ae(this,"options");this.options=t||{}}static override(t){Object.assign(_b.prototype,t)}init(){}formats(){return oo()}parse(){return oo()}format(){return oo()}add(){return oo()}diff(){return oo()}startOf(){return oo()}endOf(){return oo()}}var lJ={_date:_b};function cJ(e,t,n,s){const{controller:r,data:i,_sorted:o}=e,a=r._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&o&&i.length){const u=a._reversePixels?BQ:qv;if(s){if(r._sharedOptions){const d=i[0],h=typeof d.getRange=="function"&&d.getRange(t);if(h){const p=u(i,t,n-h),f=u(i,t,n+h);return{lo:p.lo,hi:f.hi}}}}else{const d=u(i,t,n);if(c){const{vScale:h}=r._cachedMeta,{_parsed:p}=e,f=p.slice(0,d.lo+1).reverse().findIndex(g=>!vt(g[h.axis]));d.lo-=Math.max(0,f);const m=p.slice(d.hi).findIndex(g=>!vt(g[h.axis]));d.hi+=Math.max(0,m)}return d}}return{lo:0,hi:i.length-1}}function jp(e,t,n,s,r){const i=e.getSortedVisibleDatasetMetas(),o=n[t];for(let a=0,c=i.length;a<c;++a){const{index:u,data:d}=i[a],{lo:h,hi:p}=cJ(i[a],t,o,r);for(let f=h;f<=p;++f){const m=d[f];m.skip||s(m,u,f)}}}function uJ(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(s,r){const i=t?Math.abs(s.x-r.x):0,o=n?Math.abs(s.y-r.y):0;return Math.sqrt(Math.pow(i,2)+Math.pow(o,2))}}function dg(e,t,n,s,r){const i=[];return!r&&!e.isPointInArea(t)||jp(e,n,t,function(a,c,u){!r&&!bu(a,e.chartArea,0)||a.inRange(t.x,t.y,s)&&i.push({element:a,datasetIndex:c,index:u})},!0),i}function dJ(e,t,n,s){let r=[];function i(o,a,c){const{startAngle:u,endAngle:d}=o.getProps(["startAngle","endAngle"],s),{angle:h}=OQ(o,{x:t.x,y:t.y});KP(h,u,d)&&r.push({element:o,datasetIndex:a,index:c})}return jp(e,n,t,i),r}function hJ(e,t,n,s,r,i){let o=[];const a=uJ(n);let c=Number.POSITIVE_INFINITY;function u(d,h,p){const f=d.inRange(t.x,t.y,r);if(s&&!f)return;const m=d.getCenterPoint(r);if(!(!!i||e.isPointInArea(m))&&!f)return;const y=a(t,m);y<c?(o=[{element:d,datasetIndex:h,index:p}],c=y):y===c&&o.push({element:d,datasetIndex:h,index:p})}return jp(e,n,t,u),o}function hg(e,t,n,s,r,i){return!i&&!e.isPointInArea(t)?[]:n==="r"&&!s?dJ(e,t,n,r):hJ(e,t,n,s,r,i)}function wk(e,t,n,s,r){const i=[],o=n==="x"?"inXRange":"inYRange";let a=!1;return jp(e,n,t,(c,u,d)=>{c[o]&&c[o](t[n],r)&&(i.push({element:c,datasetIndex:u,index:d}),a=a||c.inRange(t.x,t.y,r))}),s&&!a?[]:i}var fJ={modes:{index(e,t,n,s){const r=ho(t,e),i=n.axis||"x",o=n.includeInvisible||!1,a=n.intersect?dg(e,r,i,s,o):hg(e,r,i,!1,s,o),c=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(u=>{const d=a[0].index,h=u.data[d];h&&!h.skip&&c.push({element:h,datasetIndex:u.index,index:d})}),c):[]},dataset(e,t,n,s){const r=ho(t,e),i=n.axis||"xy",o=n.includeInvisible||!1;let a=n.intersect?dg(e,r,i,s,o):hg(e,r,i,!1,s,o);if(a.length>0){const c=a[0].datasetIndex,u=e.getDatasetMeta(c).data;a=[];for(let d=0;d<u.length;++d)a.push({element:u[d],datasetIndex:c,index:d})}return a},point(e,t,n,s){const r=ho(t,e),i=n.axis||"xy",o=n.includeInvisible||!1;return dg(e,r,i,s,o)},nearest(e,t,n,s){const r=ho(t,e),i=n.axis||"xy",o=n.includeInvisible||!1;return hg(e,r,i,n.intersect,s,o)},x(e,t,n,s){const r=ho(t,e);return wk(e,r,"x",n.intersect,s)},y(e,t,n,s){const r=ho(t,e);return wk(e,r,"y",n.intersect,s)}}};const c4=["left","top","right","bottom"];function tc(e,t){return e.filter(n=>n.pos===t)}function Sk(e,t){return e.filter(n=>c4.indexOf(n.pos)===-1&&n.box.axis===t)}function nc(e,t){return e.sort((n,s)=>{const r=t?s:n,i=t?n:s;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function pJ(e){const t=[];let n,s,r,i,o,a;for(n=0,s=(e||[]).length;n<s;++n)r=e[n],{position:i,options:{stack:o,stackWeight:a=1}}=r,t.push({index:n,box:r,pos:i,horizontal:r.isHorizontal(),weight:r.weight,stack:o&&i+o,stackWeight:a});return t}function mJ(e){const t={};for(const n of e){const{stack:s,pos:r,stackWeight:i}=n;if(!s||!c4.includes(r))continue;const o=t[s]||(t[s]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=i}return t}function gJ(e,t){const n=mJ(e),{vBoxMaxWidth:s,hBoxMaxHeight:r}=t;let i,o,a;for(i=0,o=e.length;i<o;++i){a=e[i];const{fullSize:c}=a.box,u=n[a.stack],d=u&&a.stackWeight/u.weight;a.horizontal?(a.width=d?d*s:c&&t.availableWidth,a.height=r):(a.width=s,a.height=d?d*r:c&&t.availableHeight)}return n}function xJ(e){const t=pJ(e),n=nc(t.filter(u=>u.box.fullSize),!0),s=nc(tc(t,"left"),!0),r=nc(tc(t,"right")),i=nc(tc(t,"top"),!0),o=nc(tc(t,"bottom")),a=Sk(t,"x"),c=Sk(t,"y");return{fullSize:n,leftAndTop:s.concat(i),rightAndBottom:r.concat(c).concat(o).concat(a),chartArea:tc(t,"chartArea"),vertical:s.concat(r).concat(c),horizontal:i.concat(o).concat(a)}}function kk(e,t,n,s){return Math.max(e[n],t[n])+Math.max(e[s],t[s])}function u4(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function vJ(e,t,n,s){const{pos:r,box:i}=n,o=e.maxPadding;if(!$e(r)){n.size&&(e[r]-=n.size);const h=s[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?i.height:i.width),n.size=h.size/h.count,e[r]+=n.size}i.getPadding&&u4(o,i.getPadding());const a=Math.max(0,t.outerWidth-kk(o,e,"left","right")),c=Math.max(0,t.outerHeight-kk(o,e,"top","bottom")),u=a!==e.w,d=c!==e.h;return e.w=a,e.h=c,n.horizontal?{same:u,other:d}:{same:d,other:u}}function yJ(e){const t=e.maxPadding;function n(s){const r=Math.max(t[s]-e[s],0);return e[s]+=r,r}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function bJ(e,t){const n=t.maxPadding;function s(r){const i={left:0,top:0,right:0,bottom:0};return r.forEach(o=>{i[o]=Math.max(t[o],n[o])}),i}return s(e?["left","right"]:["top","bottom"])}function vc(e,t,n,s){const r=[];let i,o,a,c,u,d;for(i=0,o=e.length,u=0;i<o;++i){a=e[i],c=a.box,c.update(a.width||t.w,a.height||t.h,bJ(a.horizontal,t));const{same:h,other:p}=vJ(t,n,a,s);u|=h&&r.length,d=d||p,c.fullSize||r.push(a)}return u&&vc(r,t,n,s)||d}function Qd(e,t,n,s,r){e.top=n,e.left=t,e.right=t+s,e.bottom=n+r,e.width=s,e.height=r}function Ck(e,t,n,s){const r=n.padding;let{x:i,y:o}=t;for(const a of e){const c=a.box,u=s[a.stack]||{placed:0,weight:1},d=a.stackWeight/u.weight||1;if(a.horizontal){const h=t.w*d,p=u.size||c.height;Df(u.start)&&(o=u.start),c.fullSize?Qd(c,r.left,o,n.outerWidth-r.right-r.left,p):Qd(c,t.left+u.placed,o,h,p),u.start=o,u.placed+=h,o=c.bottom}else{const h=t.h*d,p=u.size||c.width;Df(u.start)&&(i=u.start),c.fullSize?Qd(c,i,r.top,p,n.outerHeight-r.bottom-r.top):Qd(c,i,t.top+u.placed,p,h),u.start=i,u.placed+=h,i=c.right}}t.x=i,t.y=o}var Gd={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,s){if(!e)return;const r=_u(e.options.layout.padding),i=Math.max(t-r.width,0),o=Math.max(n-r.height,0),a=xJ(e.boxes),c=a.vertical,u=a.horizontal;_n(e.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const d=c.reduce((g,y)=>y.box.options&&y.box.options.display===!1?g:g+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:r,availableWidth:i,availableHeight:o,vBoxMaxWidth:i/2/d,hBoxMaxHeight:o/2}),p=Object.assign({},r);u4(p,_u(s));const f=Object.assign({maxPadding:p,w:i,h:o,x:r.left,y:r.top},r),m=gJ(c.concat(u),h);vc(a.fullSize,f,h,m),vc(c,f,h,m),vc(u,f,h,m)&&vc(c,f,h,m),yJ(f),Ck(a.leftAndTop,f,h,m),f.x+=f.w,f.y+=f.h,Ck(a.rightAndBottom,f,h,m),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},_n(a.chartArea,g=>{const y=g.box;Object.assign(y,e.chartArea),y.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class d4{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,s){}removeEventListener(t,n,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,s,r){return n=Math.max(0,n||t.width),s=s||t.height,{width:n,height:Math.max(0,r?Math.floor(n/r):s)}}isAttached(t){return!0}updateConfig(t){}}class _J extends d4{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Mh="$chartjs",wJ={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Nk=e=>e===null||e==="";function SJ(e,t){const n=e.style,s=e.getAttribute("height"),r=e.getAttribute("width");if(e[Mh]={initial:{height:s,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Nk(r)){const i=hk(e,"width");i!==void 0&&(e.width=i)}if(Nk(s))if(e.style.height==="")e.height=e.width/(t||2);else{const i=hk(e,"height");i!==void 0&&(e.height=i)}return e}const h4=IG?{passive:!0}:!1;function kJ(e,t,n){e&&e.addEventListener(t,n,h4)}function CJ(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,h4)}function NJ(e,t){const n=wJ[e.type]||e.type,{x:s,y:r}=ho(e,t);return{type:n,chart:t,native:e,x:s!==void 0?s:null,y:r!==void 0?r:null}}function Of(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function jJ(e,t,n){const s=e.canvas,r=new MutationObserver(i=>{let o=!1;for(const a of i)o=o||Of(a.addedNodes,s),o=o&&!Of(a.removedNodes,s);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function EJ(e,t,n){const s=e.canvas,r=new MutationObserver(i=>{let o=!1;for(const a of i)o=o||Of(a.removedNodes,s),o=o&&!Of(a.addedNodes,s);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const wu=new Map;let jk=0;function f4(){const e=window.devicePixelRatio;e!==jk&&(jk=e,wu.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function PJ(e,t){wu.size||window.addEventListener("resize",f4),wu.set(e,t)}function TJ(e){wu.delete(e),wu.size||window.removeEventListener("resize",f4)}function RJ(e,t,n){const s=e.canvas,r=s&&bb(s);if(!r)return;const i=QP((a,c)=>{const u=r.clientWidth;n(a,c),u<r.clientWidth&&n()},window),o=new ResizeObserver(a=>{const c=a[0],u=c.contentRect.width,d=c.contentRect.height;u===0&&d===0||i(u,d)});return o.observe(r),PJ(e,i),o}function fg(e,t,n){n&&n.disconnect(),t==="resize"&&TJ(e)}function DJ(e,t,n){const s=e.canvas,r=QP(i=>{e.ctx!==null&&n(NJ(i,e))},e);return kJ(s,t,r),r}class MJ extends d4{acquireContext(t,n){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(SJ(t,n),s):null}releaseContext(t){const n=t.canvas;if(!n[Mh])return!1;const s=n[Mh].initial;["height","width"].forEach(i=>{const o=s[i];vt(o)?n.removeAttribute(i):n.setAttribute(i,o)});const r=s.style||{};return Object.keys(r).forEach(i=>{n.style[i]=r[i]}),n.width=n.width,delete n[Mh],!0}addEventListener(t,n,s){this.removeEventListener(t,n);const r=t.$proxies||(t.$proxies={}),o={attach:jJ,detach:EJ,resize:RJ}[n]||DJ;r[n]=o(t,n,s)}removeEventListener(t,n){const s=t.$proxies||(t.$proxies={}),r=s[n];if(!r)return;({attach:fg,detach:fg,resize:fg}[n]||CJ)(t,n,r),s[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,s,r){return OG(t,n,s,r)}isAttached(t){const n=t&&bb(t);return!!(n&&n.isConnected)}}function LJ(e){return!yb()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?_J:MJ}var sh;let Ep=(sh=class{constructor(){Ae(this,"x");Ae(this,"y");Ae(this,"active",!1);Ae(this,"options");Ae(this,"$animations")}tooltipPosition(t){const{x:n,y:s}=this.getProps(["x","y"],t);return{x:n,y:s}}hasValue(){return Lf(this.x)&&Lf(this.y)}getProps(t,n){const s=this.$animations;if(!n||!s)return this;const r={};return t.forEach(i=>{r[i]=s[i]&&s[i].active()?s[i]._to:this[i]}),r}},Ae(sh,"defaults",{}),Ae(sh,"defaultRoutes"),sh);function AJ(e,t){const n=e.options.ticks,s=OJ(e),r=Math.min(n.maxTicksLimit||s,s),i=n.major.enabled?FJ(t):[],o=i.length,a=i[0],c=i[o-1],u=[];if(o>r)return BJ(t,u,i,o/r),u;const d=IJ(i,t,r);if(o>0){let h,p;const f=o>1?Math.round((c-a)/(o-1)):null;for(Jd(t,u,d,vt(f)?0:a-f,a),h=0,p=o-1;h<p;h++)Jd(t,u,d,i[h],i[h+1]);return Jd(t,u,d,c,vt(f)?t.length:c+f),u}return Jd(t,u,d),u}function OJ(e){const t=e.options.offset,n=e._tickSize(),s=e._length/n+(t?0:1),r=e._maxLength/n;return Math.floor(Math.min(s,r))}function IJ(e,t,n){const s=zJ(e),r=t.length/n;if(!s)return Math.max(r,1);const i=RQ(s);for(let o=0,a=i.length-1;o<a;o++){const c=i[o];if(c>r)return c}return Math.max(r,1)}function FJ(e){const t=[];let n,s;for(n=0,s=e.length;n<s;n++)e[n].major&&t.push(n);return t}function BJ(e,t,n,s){let r=0,i=n[0],o;for(s=Math.ceil(s),o=0;o<e.length;o++)o===i&&(t.push(e[o]),r++,i=n[r*s])}function Jd(e,t,n,s,r){const i=Ye(s,0),o=Math.min(Ye(r,e.length),e.length);let a=0,c,u,d;for(n=Math.ceil(n),r&&(c=r-s,n=c/Math.floor(c/n)),d=i;d<0;)a++,d=Math.round(i+a*n);for(u=Math.max(i,0);u<o;u++)u===d&&(t.push(e[u]),a++,d=Math.round(i+a*n))}function zJ(e){const t=e.length;let n,s;if(t<2)return!1;for(s=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==s)return!1;return s}const $J=e=>e==="left"?"right":e==="right"?"left":e,Ek=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Pk=(e,t)=>Math.min(t||e,e);function Tk(e,t){const n=[],s=e.length/t,r=e.length;let i=0;for(;i<r;i+=s)n.push(e[Math.floor(i)]);return n}function HJ(e,t,n){const s=e.ticks.length,r=Math.min(t,s-1),i=e._startPixel,o=e._endPixel,a=1e-6;let c=e.getPixelForTick(r),u;if(!(n&&(s===1?u=Math.max(c-i,o-c):t===0?u=(e.getPixelForTick(1)-c)/2:u=(c-e.getPixelForTick(r-1))/2,c+=r<t?u:-u,c<i-a||c>o+a)))return c}function WJ(e,t){_n(e,n=>{const s=n.gc,r=s.length/2;let i;if(r>t){for(i=0;i<r;++i)delete n.data[s[i]];s.splice(0,r)}})}function sc(e){return e.drawTicks?e.tickLength:0}function Rk(e,t){if(!e.display)return 0;const n=Vv(e.font,t),s=_u(e.padding);return(dn(e.text)?e.text.length:1)*n.lineHeight+s.height}function UJ(e,t){return Pl(e,{scale:t,type:"scale"})}function qJ(e,t,n){return Pl(e,{tick:n,index:t,type:"tick"})}function KJ(e,t,n){let s=UQ(e);return(n&&t!=="right"||!n&&t==="right")&&(s=$J(s)),s}function VJ(e,t,n,s){const{top:r,left:i,bottom:o,right:a,chart:c}=e,{chartArea:u,scales:d}=c;let h=0,p,f,m;const g=o-r,y=a-i;if(e.isHorizontal()){if(f=tk(s,i,a),$e(n)){const x=Object.keys(n)[0],b=n[x];m=d[x].getPixelForValue(b)+g-t}else n==="center"?m=(u.bottom+u.top)/2+g-t:m=Ek(e,n,t);p=a-i}else{if($e(n)){const x=Object.keys(n)[0],b=n[x];f=d[x].getPixelForValue(b)-y+t}else n==="center"?f=(u.left+u.right)/2-y+t:f=Ek(e,n,t);m=tk(s,o,r),h=n==="left"?-Ei:Ei}return{titleX:f,titleY:m,maxWidth:p,rotation:h}}class Tl extends Ep{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:s,_suggestedMax:r}=this;return t=Gs(t,Number.POSITIVE_INFINITY),n=Gs(n,Number.NEGATIVE_INFINITY),s=Gs(s,Number.POSITIVE_INFINITY),r=Gs(r,Number.NEGATIVE_INFINITY),{min:Gs(t,s),max:Gs(n,r),minDefined:Nn(t),maxDefined:Nn(n)}}getMinMax(t){let{min:n,max:s,minDefined:r,maxDefined:i}=this.getUserBounds(),o;if(r&&i)return{min:n,max:s};const a=this.getMatchingVisibleMetas();for(let c=0,u=a.length;c<u;++c)o=a[c].controller.getMinMax(this,t),r||(n=Math.min(n,o.min)),i||(s=Math.max(s,o.max));return n=i&&n>s?s:n,s=r&&n>s?n:s,{min:Gs(n,Gs(s,n)),max:Gs(s,Gs(n,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){kt(this.options.beforeUpdate,[this])}update(t,n,s){const{beginAtZero:r,grace:i,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=pG(this,i,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=a<this.ticks.length;this._convertTicksToLabels(c?Tk(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=AJ(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,s;this.isHorizontal()?(n=this.left,s=this.right):(n=this.top,s=this.bottom,t=!t),this._startPixel=n,this._endPixel=s,this._reversePixels=t,this._length=s-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){kt(this.options.afterUpdate,[this])}beforeSetDimensions(){kt(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){kt(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),kt(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){kt(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let s,r,i;for(s=0,r=t.length;s<r;s++)i=t[s],i.label=kt(n.callback,[i.value,s,t],this)}afterTickToLabelConversion(){kt(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){kt(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,s=Pk(this.ticks.length,t.ticks.maxTicksLimit),r=n.minRotation||0,i=n.maxRotation;let o=r,a,c,u;if(!this._isVisible()||!n.display||r>=i||s<=1||!this.isHorizontal()){this.labelRotation=r;return}const d=this._getLabelSizes(),h=d.widest.width,p=d.highest.height,f=Pi(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/s:f/(s-1),h+6>a&&(a=f/(s-(t.offset?.5:1)),c=this.maxHeight-sc(t.grid)-n.padding-Rk(t.title,this.chart.options.font),u=Math.sqrt(h*h+p*p),o=AQ(Math.min(Math.asin(Pi((d.highest.height+6)/a,-1,1)),Math.asin(Pi(c/u,-1,1))-Math.asin(Pi(p/u,-1,1)))),o=Math.max(r,Math.min(i,o))),this.labelRotation=o}afterCalculateLabelRotation(){kt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){kt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:s,title:r,grid:i}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const c=Rk(r,n.options.font);if(a?(t.width=this.maxWidth,t.height=sc(i)+c):(t.height=this.maxHeight,t.width=sc(i)+c),s.display&&this.ticks.length){const{first:u,last:d,widest:h,highest:p}=this._getLabelSizes(),f=s.padding*2,m=wo(this.labelRotation),g=Math.cos(m),y=Math.sin(m);if(a){const x=s.mirror?0:y*h.width+g*p.height;t.height=Math.min(this.maxHeight,t.height+x+f)}else{const x=s.mirror?0:g*h.width+y*p.height;t.width=Math.min(this.maxWidth,t.width+x+f)}this._calculatePadding(u,d,y,g)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,s,r){const{ticks:{align:i,padding:o},position:a}=this.options,c=this.labelRotation!==0,u=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let p=0,f=0;c?u?(p=r*t.width,f=s*n.height):(p=s*t.height,f=r*n.width):i==="start"?f=n.width:i==="end"?p=t.width:i!=="inner"&&(p=t.width/2,f=n.width/2),this.paddingLeft=Math.max((p-d+o)*this.width/(this.width-d),0),this.paddingRight=Math.max((f-h+o)*this.width/(this.width-h),0)}else{let d=n.height/2,h=t.height/2;i==="start"?(d=0,h=t.height):i==="end"&&(d=n.height,h=0),this.paddingTop=d+o,this.paddingBottom=h+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){kt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,s;for(n=0,s=t.length;n<s;n++)vt(t[n].label)&&(t.splice(n,1),s--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let s=this.ticks;n<s.length&&(s=Tk(s,n)),this._labelSizes=t=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,s){const{ctx:r,_longestTextCache:i}=this,o=[],a=[],c=Math.floor(n/Pk(n,s));let u=0,d=0,h,p,f,m,g,y,x,b,_,S,C;for(h=0;h<n;h+=c){if(m=t[h].label,g=this._resolveTickFontOptions(h),r.font=y=g.string,x=i[y]=i[y]||{data:{},gc:[]},b=g.lineHeight,_=S=0,!vt(m)&&!dn(m))_=ok(r,x.data,x.gc,_,m),S=b;else if(dn(m))for(p=0,f=m.length;p<f;++p)C=m[p],!vt(C)&&!dn(C)&&(_=ok(r,x.data,x.gc,_,C),S+=b);o.push(_),a.push(S),u=Math.max(_,u),d=Math.max(S,d)}WJ(i,n);const w=o.indexOf(u),j=a.indexOf(d),E=O=>({width:o[O]||0,height:a[O]||0});return{first:E(0),last:E(n-1),widest:E(w),highest:E(j),widths:o,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return FQ(this._alignToPixels?io(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const s=n[t];return s.$context||(s.$context=qJ(this.getContext(),t,s))}return this.$context||(this.$context=UJ(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=wo(this.labelRotation),s=Math.abs(Math.cos(n)),r=Math.abs(Math.sin(n)),i=this._getLabelSizes(),o=t.autoSkipPadding||0,a=i?i.widest.width+o:0,c=i?i.highest.height+o:0;return this.isHorizontal()?c*s>a*r?a/s:c/r:c*r<a*s?c/s:a/r}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,s=this.chart,r=this.options,{grid:i,position:o,border:a}=r,c=i.offset,u=this.isHorizontal(),h=this.ticks.length+(c?1:0),p=sc(i),f=[],m=a.setContext(this.getContext()),g=m.display?m.width:0,y=g/2,x=function($){return io(s,$,g)};let b,_,S,C,w,j,E,O,R,B,L,D;if(o==="top")b=x(this.bottom),j=this.bottom-p,O=b-y,B=x(t.top)+y,D=t.bottom;else if(o==="bottom")b=x(this.top),B=t.top,D=x(t.bottom)-y,j=b+y,O=this.top+p;else if(o==="left")b=x(this.right),w=this.right-p,E=b-y,R=x(t.left)+y,L=t.right;else if(o==="right")b=x(this.left),R=t.left,L=x(t.right)-y,w=b+y,E=this.left+p;else if(n==="x"){if(o==="center")b=x((t.top+t.bottom)/2+.5);else if($e(o)){const $=Object.keys(o)[0],W=o[$];b=x(this.chart.scales[$].getPixelForValue(W))}B=t.top,D=t.bottom,j=b+y,O=j+p}else if(n==="y"){if(o==="center")b=x((t.left+t.right)/2);else if($e(o)){const $=Object.keys(o)[0],W=o[$];b=x(this.chart.scales[$].getPixelForValue(W))}w=b-y,E=w-p,R=t.left,L=t.right}const T=Ye(r.ticks.maxTicksLimit,h),P=Math.max(1,Math.ceil(h/T));for(_=0;_<h;_+=P){const $=this.getContext(_),W=i.setContext($),I=a.setContext($),H=W.lineWidth,k=W.color,F=I.dash||[],M=I.dashOffset,N=W.tickWidth,z=W.tickColor,U=W.tickBorderDash||[],K=W.tickBorderDashOffset;S=HJ(this,_,c),S!==void 0&&(C=io(s,S,H),u?w=E=R=L=C:j=O=B=D=C,f.push({tx1:w,ty1:j,tx2:E,ty2:O,x1:R,y1:B,x2:L,y2:D,width:H,color:k,borderDash:F,borderDashOffset:M,tickWidth:N,tickColor:z,tickBorderDash:U,tickBorderDashOffset:K}))}return this._ticksLength=h,this._borderValue=b,f}_computeLabelItems(t){const n=this.axis,s=this.options,{position:r,ticks:i}=s,o=this.isHorizontal(),a=this.ticks,{align:c,crossAlign:u,padding:d,mirror:h}=i,p=sc(s.grid),f=p+d,m=h?-d:f,g=-wo(this.labelRotation),y=[];let x,b,_,S,C,w,j,E,O,R,B,L,D="middle";if(r==="top")w=this.bottom-m,j=this._getXAxisLabelAlignment();else if(r==="bottom")w=this.top+m,j=this._getXAxisLabelAlignment();else if(r==="left"){const P=this._getYAxisLabelAlignment(p);j=P.textAlign,C=P.x}else if(r==="right"){const P=this._getYAxisLabelAlignment(p);j=P.textAlign,C=P.x}else if(n==="x"){if(r==="center")w=(t.top+t.bottom)/2+f;else if($e(r)){const P=Object.keys(r)[0],$=r[P];w=this.chart.scales[P].getPixelForValue($)+f}j=this._getXAxisLabelAlignment()}else if(n==="y"){if(r==="center")C=(t.left+t.right)/2-f;else if($e(r)){const P=Object.keys(r)[0],$=r[P];C=this.chart.scales[P].getPixelForValue($)}j=this._getYAxisLabelAlignment(p).textAlign}n==="y"&&(c==="start"?D="top":c==="end"&&(D="bottom"));const T=this._getLabelSizes();for(x=0,b=a.length;x<b;++x){_=a[x],S=_.label;const P=i.setContext(this.getContext(x));E=this.getPixelForTick(x)+i.labelOffset,O=this._resolveTickFontOptions(x),R=O.lineHeight,B=dn(S)?S.length:1;const $=B/2,W=P.color,I=P.textStrokeColor,H=P.textStrokeWidth;let k=j;o?(C=E,j==="inner"&&(x===b-1?k=this.options.reverse?"left":"right":x===0?k=this.options.reverse?"right":"left":k="center"),r==="top"?u==="near"||g!==0?L=-B*R+R/2:u==="center"?L=-T.highest.height/2-$*R+R:L=-T.highest.height+R/2:u==="near"||g!==0?L=R/2:u==="center"?L=T.highest.height/2-$*R:L=T.highest.height-B*R,h&&(L*=-1),g!==0&&!P.showLabelBackdrop&&(C+=R/2*Math.sin(g))):(w=E,L=(1-B)*R/2);let F;if(P.showLabelBackdrop){const M=_u(P.backdropPadding),N=T.heights[x],z=T.widths[x];let U=L-M.top,K=0-M.left;switch(D){case"middle":U-=N/2;break;case"bottom":U-=N;break}switch(j){case"center":K-=z/2;break;case"right":K-=z;break;case"inner":x===b-1?K-=z:x>0&&(K-=z/2);break}F={left:K,top:U,width:z+M.width,height:N+M.height,color:P.backdropColor}}y.push({label:S,font:O,textOffset:L,options:{rotation:g,color:W,strokeColor:I,strokeWidth:H,textAlign:k,textBaseline:D,translation:[C,w],backdrop:F}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-wo(this.labelRotation))return t==="top"?"left":"right";let r="center";return n.align==="start"?r="left":n.align==="end"?r="right":n.align==="inner"&&(r="inner"),r}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:s,mirror:r,padding:i}}=this.options,o=this._getLabelSizes(),a=t+i,c=o.widest.width;let u,d;return n==="left"?r?(d=this.right+i,s==="near"?u="left":s==="center"?(u="center",d+=c/2):(u="right",d+=c)):(d=this.right-a,s==="near"?u="right":s==="center"?(u="center",d-=c/2):(u="left",d=this.left)):n==="right"?r?(d=this.left+i,s==="near"?u="right":s==="center"?(u="center",d-=c/2):(u="left",d-=c)):(d=this.left+a,s==="near"?u="left":s==="center"?(u="center",d+=c/2):(u="right",d=this.right)):u="right",{textAlign:u,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:s,top:r,width:i,height:o}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(s,r,i,o),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const r=this.ticks.findIndex(i=>i.value===t);return r>=0?n.setContext(this.getContext(r)).lineWidth:0}drawGrid(t){const n=this.options.grid,s=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let i,o;const a=(c,u,d)=>{!d.width||!d.color||(s.save(),s.lineWidth=d.width,s.strokeStyle=d.color,s.setLineDash(d.borderDash||[]),s.lineDashOffset=d.borderDashOffset,s.beginPath(),s.moveTo(c.x,c.y),s.lineTo(u.x,u.y),s.stroke(),s.restore())};if(n.display)for(i=0,o=r.length;i<o;++i){const c=r[i];n.drawOnChartArea&&a({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),n.drawTicks&&a({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:s,grid:r}}=this,i=s.setContext(this.getContext()),o=s.display?i.width:0;if(!o)return;const a=r.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let u,d,h,p;this.isHorizontal()?(u=io(t,this.left,o)-o/2,d=io(t,this.right,a)+a/2,h=p=c):(h=io(t,this.top,o)-o/2,p=io(t,this.bottom,a)+a/2,u=d=c),n.save(),n.lineWidth=i.width,n.strokeStyle=i.color,n.beginPath(),n.moveTo(u,h),n.lineTo(d,p),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,r=this._computeLabelArea();r&&pb(s,r);const i=this.getLabelItems(t);for(const o of i){const a=o.options,c=o.font,u=o.label,d=o.textOffset;lk(s,u,0,d,c,a)}r&&mb(s)}drawTitle(){const{ctx:t,options:{position:n,title:s,reverse:r}}=this;if(!s.display)return;const i=Vv(s.font),o=_u(s.padding),a=s.align;let c=i.lineHeight/2;n==="bottom"||n==="center"||$e(n)?(c+=o.bottom,dn(s.text)&&(c+=i.lineHeight*(s.text.length-1))):c+=o.top;const{titleX:u,titleY:d,maxWidth:h,rotation:p}=VJ(this,c,n,a);lk(t,s.text,0,0,i,{color:s.color,maxWidth:h,rotation:p,textAlign:KJ(a,n,r),textBaseline:"middle",translation:[u,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,s=Ye(t.grid&&t.grid.z,-1),r=Ye(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Tl.prototype.draw?[{z:n,draw:i=>{this.draw(i)}}]:[{z:s,draw:i=>{this.drawBackground(),this.drawGrid(i),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:n,draw:i=>{this.drawLabels(i)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",r=[];let i,o;for(i=0,o=n.length;i<o;++i){const a=n[i];a[s]===this.id&&(!t||a.type===t)&&r.push(a)}return r}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return Vv(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Zd{constructor(t,n,s){this.type=t,this.scope=n,this.override=s,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let s;QJ(n)&&(s=this.register(n));const r=this.items,i=t.id,o=this.scope+"."+i;if(!i)throw new Error("class does not have id: "+t);return i in r||(r[i]=t,YJ(t,o,s),this.override&&Lt.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const n=this.items,s=t.id,r=this.scope;s in n&&delete n[s],r&&s in Lt[r]&&(delete Lt[r][s],this.override&&delete Zo[s])}}function YJ(e,t,n){const s=yu(Object.create(null),[n?Lt.get(n):{},Lt.get(t),e.defaults]);Lt.set(t,s),e.defaultRoutes&&XJ(t,e.defaultRoutes),e.descriptors&&Lt.describe(t,e.descriptors)}function XJ(e,t){Object.keys(t).forEach(n=>{const s=n.split("."),r=s.pop(),i=[e].concat(s).join("."),o=t[n].split("."),a=o.pop(),c=o.join(".");Lt.route(i,r,c,a)})}function QJ(e){return"id"in e&&"defaults"in e}class GJ{constructor(){this.controllers=new Zd(Dh,"datasets",!0),this.elements=new Zd(Ep,"elements"),this.plugins=new Zd(Object,"plugins"),this.scales=new Zd(Tl,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,s){[...n].forEach(r=>{const i=s||this._getRegistryForType(r);s||i.isForType(r)||i===this.plugins&&r.id?this._exec(t,i,r):_n(r,o=>{const a=s||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,n,s){const r=db(t);kt(s["before"+r],[],s),n[t](s),kt(s["after"+r],[],s)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const s=this._typedRegistries[n];if(s.isForType(t))return s}return this.plugins}_get(t,n,s){const r=n.get(t);if(r===void 0)throw new Error('"'+t+'" is not a registered '+s+".");return r}}var nr=new GJ;class JJ{constructor(){this._init=void 0}notify(t,n,s,r){if(n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const i=r?this._descriptors(t).filter(r):this._descriptors(t),o=this._notify(i,t,n,s);return n==="afterDestroy"&&(this._notify(i,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),o}_notify(t,n,s,r){r=r||{};for(const i of t){const o=i.plugin,a=o[s],c=[n,r,i.options];if(kt(a,c,o)===!1&&r.cancelable)return!1}return!0}invalidate(){vt(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const s=t&&t.config,r=Ye(s.options&&s.options.plugins,{}),i=ZJ(s);return r===!1&&!n?[]:tZ(t,i,r,n)}_notifyStateChanges(t){const n=this._oldCache||[],s=this._cache,r=(i,o)=>i.filter(a=>!o.some(c=>a.plugin.id===c.plugin.id));this._notify(r(n,s),t,"stop"),this._notify(r(s,n),t,"start")}}function ZJ(e){const t={},n=[],s=Object.keys(nr.plugins.items);for(let i=0;i<s.length;i++)n.push(nr.getPlugin(s[i]));const r=e.plugins||[];for(let i=0;i<r.length;i++){const o=r[i];n.indexOf(o)===-1&&(n.push(o),t[o.id]=!0)}return{plugins:n,localIds:t}}function eZ(e,t){return!t&&e===!1?null:e===!0?{}:e}function tZ(e,{plugins:t,localIds:n},s,r){const i=[],o=e.getContext();for(const a of t){const c=a.id,u=eZ(s[c],r);u!==null&&i.push({plugin:a,options:nZ(e.config,{plugin:a,local:n[c]},u,o)})}return i}function nZ(e,{plugin:t,local:n},s,r){const i=e.pluginScopeKeys(t),o=e.getOptionScopes(s,i);return n&&t.defaults&&o.push(t.defaults),e.createResolver(o,r,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Yv(e,t){const n=Lt.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function sZ(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function rZ(e,t){return e===t?"_index_":"_value_"}function Dk(e){if(e==="x"||e==="y"||e==="r")return e}function iZ(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Xv(e,...t){if(Dk(e))return e;for(const n of t){const s=n.axis||iZ(n.position)||e.length>1&&Dk(e[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Mk(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function oZ(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(s=>s.xAxisID===e||s.yAxisID===e);if(n.length)return Mk(e,"x",n[0])||Mk(e,"y",n[0])}return{}}function aZ(e,t){const n=Zo[e.type]||{scales:{}},s=t.scales||{},r=Yv(e.type,t),i=Object.create(null);return Object.keys(s).forEach(o=>{const a=s[o];if(!$e(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const c=Xv(o,a,oZ(o,e),Lt.scales[a.type]),u=rZ(c,r),d=n.scales||{};i[o]=Fc(Object.create(null),[{axis:c},a,d[c],d[u]])}),e.data.datasets.forEach(o=>{const a=o.type||e.type,c=o.indexAxis||Yv(a,t),d=(Zo[a]||{}).scales||{};Object.keys(d).forEach(h=>{const p=sZ(h,c),f=o[p+"AxisID"]||p;i[f]=i[f]||Object.create(null),Fc(i[f],[{axis:p},s[f],d[h]])})}),Object.keys(i).forEach(o=>{const a=i[o];Fc(a,[Lt.scales[a.type],Lt.scale])}),i}function p4(e){const t=e.options||(e.options={});t.plugins=Ye(t.plugins,{}),t.scales=aZ(e,t)}function m4(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function lZ(e){return e=e||{},e.data=m4(e.data),p4(e),e}const Lk=new Map,g4=new Set;function eh(e,t){let n=Lk.get(e);return n||(n=t(),Lk.set(e,n),g4.add(n)),n}const rc=(e,t,n)=>{const s=Rf(t,n);s!==void 0&&e.add(s)};class cZ{constructor(t){this._config=lZ(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=m4(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),p4(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return eh(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return eh(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return eh(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,s=this.type;return eh(`${s}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const s=this._scopeCache;let r=s.get(t);return(!r||n)&&(r=new Map,s.set(t,r)),r}getOptionScopes(t,n,s){const{options:r,type:i}=this,o=this._cachedScopes(t,s),a=o.get(n);if(a)return a;const c=new Set;n.forEach(d=>{t&&(c.add(t),d.forEach(h=>rc(c,t,h))),d.forEach(h=>rc(c,r,h)),d.forEach(h=>rc(c,Zo[i]||{},h)),d.forEach(h=>rc(c,Lt,h)),d.forEach(h=>rc(c,Kv,h))});const u=Array.from(c);return u.length===0&&u.push(Object.create(null)),g4.has(n)&&o.set(n,u),u}chartOptionScopes(){const{options:t,type:n}=this;return[t,Zo[n]||{},Lt.datasets[n]||{},{type:n},Lt,Kv]}resolveNamedOptions(t,n,s,r=[""]){const i={$shared:!0},{resolver:o,subPrefixes:a}=Ak(this._resolverCache,t,r);let c=o;if(dZ(o,n)){i.$shared=!1,s=Xi(s)?s():s;const u=this.createResolver(t,s,a);c=hl(o,s,u)}for(const u of n)i[u]=c[u];return i}createResolver(t,n,s=[""],r){const{resolver:i}=Ak(this._resolverCache,t,s);return $e(n)?hl(i,n,void 0,r):i}}function Ak(e,t,n){let s=e.get(t);s||(s=new Map,e.set(t,s));const r=n.join();let i=s.get(r);return i||(i={resolver:gb(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},s.set(r,i)),i}const uZ=e=>$e(e)&&Object.getOwnPropertyNames(e).some(t=>Xi(e[t]));function dZ(e,t){const{isScriptable:n,isIndexable:s}=ZP(e);for(const r of t){const i=n(r),o=s(r),a=(o||i)&&e[r];if(i&&(Xi(a)||uZ(a))||o&&dn(a))return!0}return!1}var hZ="4.5.1";const fZ=["top","bottom","left","right","chartArea"];function Ok(e,t){return e==="top"||e==="bottom"||fZ.indexOf(e)===-1&&t==="x"}function Ik(e,t){return function(n,s){return n[e]===s[e]?n[t]-s[t]:n[e]-s[e]}}function Fk(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),kt(n&&n.onComplete,[e],t)}function pZ(e){const t=e.chart,n=t.options.animation;kt(n&&n.onProgress,[e],t)}function x4(e){return yb()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Lh={},Bk=e=>{const t=x4(e);return Object.values(Lh).filter(n=>n.canvas===t).pop()};function mZ(e,t,n){const s=Object.keys(e);for(const r of s){const i=+r;if(i>=t){const o=e[r];delete e[r],(n>0||i>t)&&(e[i+n]=o)}}}function gZ(e,t,n,s){return!n||e.type==="mouseout"?null:s?t:e}class Tr{static register(...t){nr.add(...t),zk()}static unregister(...t){nr.remove(...t),zk()}constructor(t,n){const s=this.config=new cZ(n),r=x4(t),i=Bk(r);if(i)throw new Error("Canvas is already in use. Chart with ID '"+i.id+"' must be destroyed before the canvas with ID '"+i.canvas.id+"' can be reused.");const o=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||LJ(r)),this.platform.updateConfig(s);const a=this.platform.acquireContext(r,o.aspectRatio),c=a&&a.canvas,u=c&&c.height,d=c&&c.width;if(this.id=wQ(),this.ctx=a,this.canvas=c,this.width=d,this.height=u,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new JJ,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=WQ(h=>this.update(h),o.resizeDelay||0),this._dataChanges=[],Lh[this.id]=this,!a||!c){console.error("Failed to create chart: can't acquire context from the given item");return}Nr.listen(this,"complete",Fk),Nr.listen(this,"progress",pZ),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:s,height:r,_aspectRatio:i}=this;return vt(t)?n&&i?i:r?s/r:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return nr}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():dk(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ak(this.canvas,this.ctx),this}stop(){return Nr.stop(this),this}resize(t,n){Nr.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const s=this.options,r=this.canvas,i=s.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(r,t,n,i),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,dk(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),kt(s.onResize,[this,o],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};_n(n,(s,r)=>{s.id=r})}buildOrUpdateScales(){const t=this.options,n=t.scales,s=this.scales,r=Object.keys(s).reduce((o,a)=>(o[a]=!1,o),{});let i=[];n&&(i=i.concat(Object.keys(n).map(o=>{const a=n[o],c=Xv(o,a),u=c==="r",d=c==="x";return{options:a,dposition:u?"chartArea":d?"bottom":"left",dtype:u?"radialLinear":d?"category":"linear"}}))),_n(i,o=>{const a=o.options,c=a.id,u=Xv(c,a),d=Ye(a.type,o.dtype);(a.position===void 0||Ok(a.position,u)!==Ok(o.dposition))&&(a.position=o.dposition),r[c]=!0;let h=null;if(c in s&&s[c].type===d)h=s[c];else{const p=nr.getScale(d);h=new p({id:c,type:d,ctx:this.ctx,chart:this}),s[h.id]=h}h.init(a,t)}),_n(r,(o,a)=>{o||delete s[a]}),_n(s,o=>{Gd.configure(this,o,o.options),Gd.addBox(this,o)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,s=t.length;if(t.sort((r,i)=>r.index-i.index),s>n){for(let r=n;r<s;++r)this._destroyDatasetMeta(r);t.splice(n,s-n)}this._sortedMetasets=t.slice(0).sort(Ik("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((s,r)=>{n.filter(i=>i===s._dataset).length===0&&this._destroyDatasetMeta(r)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let s,r;for(this._removeUnreferencedMetasets(),s=0,r=n.length;s<r;s++){const i=n[s];let o=this.getDatasetMeta(s);const a=i.type||this.config.type;if(o.type&&o.type!==a&&(this._destroyDatasetMeta(s),o=this.getDatasetMeta(s)),o.type=a,o.indexAxis=i.indexAxis||Yv(a,this.options),o.order=i.order||0,o.index=s,o.label=""+i.label,o.visible=this.isDatasetVisible(s),o.controller)o.controller.updateIndex(s),o.controller.linkScales();else{const c=nr.getController(a),{datasetElementType:u,dataElementType:d}=Lt.datasets[a];Object.assign(c,{dataElementType:nr.getElement(d),datasetElementType:u&&nr.getElement(u)}),o.controller=new c(this,s),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){_n(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const s=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const i=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let u=0,d=this.data.datasets.length;u<d;u++){const{controller:h}=this.getDatasetMeta(u),p=!r&&i.indexOf(h)===-1;h.buildOrUpdateElements(p),o=Math.max(+h.getMaxOverflow(),o)}o=this._minPadding=s.layout.autoPadding?o:0,this._updateLayout(o),r||_n(i,u=>{u.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ik("z","_idx"));const{_active:a,_lastEvent:c}=this;c?this._eventHandler(c,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){_n(this.scales,t=>{Gd.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!XS(n,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:s,start:r,count:i}of n){const o=s==="_removeElements"?-i:i;mZ(t,r,o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,s=i=>new Set(t.filter(o=>o[0]===i).map((o,a)=>a+","+o.splice(1).join(","))),r=s(0);for(let i=1;i<n;i++)if(!XS(r,s(i)))return;return Array.from(r).map(i=>i.split(",")).map(i=>({method:i[1],start:+i[2],count:+i[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Gd.update(this,this.width,this.height,t);const n=this.chartArea,s=n.width<=0||n.height<=0;this._layers=[],_n(this.boxes,r=>{s&&r.position==="chartArea"||(r.configure&&r.configure(),this._layers.push(...r._layers()))},this),this._layers.forEach((r,i)=>{r._idx=i}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,s=this.data.datasets.length;n<s;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,s=this.data.datasets.length;n<s;++n)this._updateDataset(n,Xi(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const s=this.getDatasetMeta(t),r={meta:s,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",r)!==!1&&(s.controller._update(n),r.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",r))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Nr.has(this)?this.attached&&!Nr.running(this)&&Nr.start(this):(this.draw(),Fk({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:s,height:r}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,r)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,s=[];let r,i;for(r=0,i=n.length;r<i;++r){const o=n[r];(!t||o.visible)&&s.push(o)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,s={meta:t,index:t.index,cancelable:!0},r=a4(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(r&&pb(n,r),t.controller.draw(),r&&mb(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return bu(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,s,r){const i=fJ.modes[n];return typeof i=="function"?i(this,t,s,r):[]}getDatasetMeta(t){const n=this.data.datasets[t],s=this._metasets;let r=s.filter(i=>i&&i._dataset===n).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},s.push(r)),r}getContext(){return this.$context||(this.$context=Pl(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!n.hidden}setDatasetVisibility(t,n){const s=this.getDatasetMeta(t);s.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,s){const r=s?"show":"hide",i=this.getDatasetMeta(t),o=i.controller._resolveAnimations(void 0,r);Df(n)?(i.data[n].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),o.update(i,{visible:s}),this.update(a=>a.datasetIndex===t?r:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Nr.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),ak(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Lh[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,s=(i,o)=>{n.addEventListener(this,i,o),t[i]=o},r=(i,o,a)=>{i.offsetX=o,i.offsetY=a,this._eventHandler(i)};_n(this.options.events,i=>s(i,r))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,s=(c,u)=>{n.addEventListener(this,c,u),t[c]=u},r=(c,u)=>{t[c]&&(n.removeEventListener(this,c,u),delete t[c])},i=(c,u)=>{this.canvas&&this.resize(c,u)};let o;const a=()=>{r("attach",a),this.attached=!0,this.resize(),s("resize",i),s("detach",o)};o=()=>{this.attached=!1,r("resize",i),this._stop(),this._resize(0,0),s("attach",a)},n.isAttached(this.canvas)?a():o()}unbindEvents(){_n(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},_n(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,s){const r=s?"set":"remove";let i,o,a,c;for(n==="dataset"&&(i=this.getDatasetMeta(t[0].datasetIndex),i.controller["_"+r+"DatasetHoverStyle"]()),a=0,c=t.length;a<c;++a){o=t[a];const u=o&&this.getDatasetMeta(o.datasetIndex).controller;u&&u[r+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],s=t.map(({datasetIndex:i,index:o})=>{const a=this.getDatasetMeta(i);if(!a)throw new Error("No dataset found at index "+i);return{datasetIndex:i,element:a.data[o],index:o}});!VS(s,n)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,n))}notifyPlugins(t,n,s){return this._plugins.notify(this,t,n,s)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,s){const r=this.options.hover,i=(c,u)=>c.filter(d=>!u.some(h=>d.datasetIndex===h.datasetIndex&&d.index===h.index)),o=i(n,t),a=s?t:i(t,n);o.length&&this.updateHoverStyle(o,r.mode,!1),a.length&&r.mode&&this.updateHoverStyle(a,r.mode,!0)}_eventHandler(t,n){const s={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},r=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,r)===!1)return;const i=this._handleEvent(t,n,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,r),(i||s.changed)&&this.render(),this}_handleEvent(t,n,s){const{_active:r=[],options:i}=this,o=n,a=this._getActiveElements(t,r,s,o),c=EQ(t),u=gZ(t,this._lastEvent,s,c);s&&(this._lastEvent=null,kt(i.onHover,[t,a,this],this),c&&kt(i.onClick,[t,a,this],this));const d=!VS(a,r);return(d||n)&&(this._active=a,this._updateHoverStyles(a,r,n)),this._lastEvent=u,d}_getActiveElements(t,n,s,r){if(t.type==="mouseout")return[];if(!s)return n;const i=this.options.hover;return this.getElementsAtEventForMode(t,i.mode,i,r)}}Ae(Tr,"defaults",Lt),Ae(Tr,"instances",Lh),Ae(Tr,"overrides",Zo),Ae(Tr,"registry",nr),Ae(Tr,"version",hZ),Ae(Tr,"getChart",Bk);function zk(){return _n(Tr.instances,e=>e._plugins.invalidate())}function v4(e,t,n=t){e.lineCap=Ye(n.borderCapStyle,t.borderCapStyle),e.setLineDash(Ye(n.borderDash,t.borderDash)),e.lineDashOffset=Ye(n.borderDashOffset,t.borderDashOffset),e.lineJoin=Ye(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=Ye(n.borderWidth,t.borderWidth),e.strokeStyle=Ye(n.borderColor,t.borderColor)}function xZ(e,t,n){e.lineTo(n.x,n.y)}function vZ(e){return e.stepped?sG:e.tension||e.cubicInterpolationMode==="monotone"?rG:xZ}function y4(e,t,n={}){const s=e.length,{start:r=0,end:i=s-1}=n,{start:o,end:a}=t,c=Math.max(r,o),u=Math.min(i,a),d=r<o&&i<o||r>a&&i>a;return{count:s,start:c,loop:t.loop,ilen:u<c&&!d?s+u-c:u-c}}function yZ(e,t,n,s){const{points:r,options:i}=t,{count:o,start:a,loop:c,ilen:u}=y4(r,n,s),d=vZ(i);let{move:h=!0,reverse:p}=s||{},f,m,g;for(f=0;f<=u;++f)m=r[(a+(p?u-f:f))%o],!m.skip&&(h?(e.moveTo(m.x,m.y),h=!1):d(e,g,m,p,i.stepped),g=m);return c&&(m=r[(a+(p?u:0))%o],d(e,g,m,p,i.stepped)),!!c}function bZ(e,t,n,s){const r=t.points,{count:i,start:o,ilen:a}=y4(r,n,s),{move:c=!0,reverse:u}=s||{};let d=0,h=0,p,f,m,g,y,x;const b=S=>(o+(u?a-S:S))%i,_=()=>{g!==y&&(e.lineTo(d,y),e.lineTo(d,g),e.lineTo(d,x))};for(c&&(f=r[b(0)],e.moveTo(f.x,f.y)),p=0;p<=a;++p){if(f=r[b(p)],f.skip)continue;const S=f.x,C=f.y,w=S|0;w===m?(C<g?g=C:C>y&&(y=C),d=(h*d+S)/++h):(_(),e.lineTo(S,C),m=w,h=0,g=y=C),x=C}_()}function Qv(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?bZ:yZ}function _Z(e){return e.stepped?FG:e.tension||e.cubicInterpolationMode==="monotone"?BG:fo}function wZ(e,t,n,s){let r=t._path;r||(r=t._path=new Path2D,t.path(r,n,s)&&r.closePath()),v4(e,t.options),e.stroke(r)}function SZ(e,t,n,s){const{segments:r,options:i}=t,o=Qv(t);for(const a of r)v4(e,i,a.style),e.beginPath(),o(e,t,a,{start:n,end:n+s-1})&&e.closePath(),e.stroke()}const kZ=typeof Path2D=="function";function CZ(e,t,n,s){kZ&&!t.options.segment?wZ(e,t,n,s):SZ(e,t,n,s)}class Ri extends Ep{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const r=s.spanGaps?this._loop:this._fullLoop;TG(this._points,s,t,r,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=WG(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,s=t.length;return s&&n[t[s-1].end]}interpolate(t,n){const s=this.options,r=t[n],i=this.points,o=o4(this,{property:n,start:r,end:r});if(!o.length)return;const a=[],c=_Z(s);let u,d;for(u=0,d=o.length;u<d;++u){const{start:h,end:p}=o[u],f=i[h],m=i[p];if(f===m){a.push(f);continue}const g=Math.abs((r-f[n])/(m[n]-f[n])),y=c(f,m,g,s.stepped);y[n]=t[n],a.push(y)}return a.length===1?a[0]:a}pathSegment(t,n,s){return Qv(this)(t,this,n,s)}path(t,n,s){const r=this.segments,i=Qv(this);let o=this._loop;n=n||0,s=s||this.points.length-n;for(const a of r)o&=i(t,this,a,{start:n,end:n+s-1});return!!o}draw(t,n,s,r){const i=this.options||{};(this.points||[]).length&&i.borderWidth&&(t.save(),CZ(t,this,s,r),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}Ae(Ri,"id","line"),Ae(Ri,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),Ae(Ri,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),Ae(Ri,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function $k(e,t,n,s){const r=e.options,{[n]:i}=e.getProps([n],s);return Math.abs(t-i)<r.radius+r.hitRadius}class Ah extends Ep{constructor(n){super();Ae(this,"parsed");Ae(this,"skip");Ae(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,n&&Object.assign(this,n)}inRange(n,s,r){const i=this.options,{x:o,y:a}=this.getProps(["x","y"],r);return Math.pow(n-o,2)+Math.pow(s-a,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(n,s){return $k(this,n,"x",s)}inYRange(n,s){return $k(this,n,"y",s)}getCenterPoint(n){const{x:s,y:r}=this.getProps(["x","y"],n);return{x:s,y:r}}size(n){n=n||this.options||{};let s=n.radius||0;s=Math.max(s,s&&n.hoverRadius||0);const r=s&&n.borderWidth||0;return(s+r)*2}draw(n,s){const r=this.options;this.skip||r.radius<.1||!bu(this,s,this.size(r)/2)||(n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.fillStyle=r.backgroundColor,tG(n,r,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}Ae(Ah,"id","point"),Ae(Ah,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),Ae(Ah,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function NZ(e,t,n){const s=e.segments,r=e.points,i=t.points,o=[];for(const a of s){let{start:c,end:u}=a;u=Pp(c,u,r);const d=Gv(n,r[c],r[u],a.loop);if(!t.segments){o.push({source:a,target:d,start:r[c],end:r[u]});continue}const h=o4(t,d);for(const p of h){const f=Gv(n,i[p.start],i[p.end],p.loop),m=i4(a,r,f);for(const g of m)o.push({source:g,target:p,start:{[n]:Hk(d,f,"start",Math.max)},end:{[n]:Hk(d,f,"end",Math.min)}})}}return o}function Gv(e,t,n,s){if(s)return;let r=t[e],i=n[e];return e==="angle"&&(r=sr(r),i=sr(i)),{property:e,start:r,end:i}}function jZ(e,t){const{x:n=null,y:s=null}=e||{},r=t.points,i=[];return t.segments.forEach(({start:o,end:a})=>{a=Pp(o,a,r);const c=r[o],u=r[a];s!==null?(i.push({x:c.x,y:s}),i.push({x:u.x,y:s})):n!==null&&(i.push({x:n,y:c.y}),i.push({x:n,y:u.y}))}),i}function Pp(e,t,n){for(;t>e;t--){const s=n[t];if(!isNaN(s.x)&&!isNaN(s.y))break}return t}function Hk(e,t,n,s){return e&&t?s(e[n],t[n]):e?e[n]:t?t[n]:0}function b4(e,t){let n=[],s=!1;return dn(e)?(s=!0,n=e):n=jZ(e,t),n.length?new Ri({points:n,options:{tension:0},_loop:s,_fullLoop:s}):null}function Wk(e){return e&&e.fill!==!1}function EZ(e,t,n){let r=e[t].fill;const i=[t];let o;if(!n)return r;for(;r!==!1&&i.indexOf(r)===-1;){if(!Nn(r))return r;if(o=e[r],!o)return!1;if(o.visible)return r;i.push(r),r=o.fill}return!1}function PZ(e,t,n){const s=MZ(e);if($e(s))return isNaN(s.value)?!1:s;let r=parseFloat(s);return Nn(r)&&Math.floor(r)===r?TZ(s[0],t,r,n):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function TZ(e,t,n,s){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=s?!1:n}function RZ(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:$e(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function DZ(e,t,n){let s;return e==="start"?s=n:e==="end"?s=t.options.reverse?t.min:t.max:$e(e)?s=e.value:s=t.getBaseValue(),s}function MZ(e){const t=e.options,n=t.fill;let s=Ye(n&&n.target,n);return s===void 0&&(s=!!t.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function LZ(e){const{scale:t,index:n,line:s}=e,r=[],i=s.segments,o=s.points,a=AZ(t,n);a.push(b4({x:null,y:t.bottom},s));for(let c=0;c<i.length;c++){const u=i[c];for(let d=u.start;d<=u.end;d++)OZ(r,o[d],a)}return new Ri({points:r,options:{}})}function AZ(e,t){const n=[],s=e.getMatchingVisibleMetas("line");for(let r=0;r<s.length;r++){const i=s[r];if(i.index===t)break;i.hidden||n.unshift(i.dataset)}return n}function OZ(e,t,n){const s=[];for(let r=0;r<n.length;r++){const i=n[r],{first:o,last:a,point:c}=IZ(i,t,"x");if(!(!c||o&&a)){if(o)s.unshift(c);else if(e.push(c),!a)break}}e.push(...s)}function IZ(e,t,n){const s=e.interpolate(t,n);if(!s)return{};const r=s[n],i=e.segments,o=e.points;let a=!1,c=!1;for(let u=0;u<i.length;u++){const d=i[u],h=o[d.start][n],p=o[d.end][n];if(VP(r,h,p)){a=r===h,c=r===p;break}}return{first:a,last:c,point:s}}class _4{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,s){const{x:r,y:i,radius:o}=this;return n=n||{start:0,end:pr},t.arc(r,i,o,n.end,n.start,!0),!s.bounds}interpolate(t){const{x:n,y:s,radius:r}=this,i=t.angle;return{x:n+Math.cos(i)*r,y:s+Math.sin(i)*r,angle:i}}}function FZ(e){const{chart:t,fill:n,line:s}=e;if(Nn(n))return BZ(t,n);if(n==="stack")return LZ(e);if(n==="shape")return!0;const r=zZ(e);return r instanceof _4?r:b4(r,s)}function BZ(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function zZ(e){return(e.scale||{}).getPointPositionForValue?HZ(e):$Z(e)}function $Z(e){const{scale:t={},fill:n}=e,s=RZ(n,t);if(Nn(s)){const r=t.isHorizontal();return{x:r?s:null,y:r?null:s}}return null}function HZ(e){const{scale:t,fill:n}=e,s=t.options,r=t.getLabels().length,i=s.reverse?t.max:t.min,o=DZ(n,t,i),a=[];if(s.grid.circular){const c=t.getPointPositionForValue(0,i);return new _4({x:c.x,y:c.y,radius:t.getDistanceFromCenterForValue(o)})}for(let c=0;c<r;++c)a.push(t.getPointPositionForValue(c,o));return a}function pg(e,t,n){const s=FZ(t),{chart:r,index:i,line:o,scale:a,axis:c}=t,u=o.options,d=u.fill,h=u.backgroundColor,{above:p=h,below:f=h}=d||{},m=r.getDatasetMeta(i),g=a4(r,m);s&&o.points.length&&(pb(e,n),WZ(e,{line:o,target:s,above:p,below:f,area:n,scale:a,axis:c,clip:g}),mb(e))}function WZ(e,t){const{line:n,target:s,above:r,below:i,area:o,scale:a,clip:c}=t,u=n._loop?"angle":t.axis;e.save();let d=i;i!==r&&(u==="x"?(Uk(e,s,o.top),mg(e,{line:n,target:s,color:r,scale:a,property:u,clip:c}),e.restore(),e.save(),Uk(e,s,o.bottom)):u==="y"&&(qk(e,s,o.left),mg(e,{line:n,target:s,color:i,scale:a,property:u,clip:c}),e.restore(),e.save(),qk(e,s,o.right),d=r)),mg(e,{line:n,target:s,color:d,scale:a,property:u,clip:c}),e.restore()}function Uk(e,t,n){const{segments:s,points:r}=t;let i=!0,o=!1;e.beginPath();for(const a of s){const{start:c,end:u}=a,d=r[c],h=r[Pp(c,u,r)];i?(e.moveTo(d.x,d.y),i=!1):(e.lineTo(d.x,n),e.lineTo(d.x,d.y)),o=!!t.pathSegment(e,a,{move:o}),o?e.closePath():e.lineTo(h.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function qk(e,t,n){const{segments:s,points:r}=t;let i=!0,o=!1;e.beginPath();for(const a of s){const{start:c,end:u}=a,d=r[c],h=r[Pp(c,u,r)];i?(e.moveTo(d.x,d.y),i=!1):(e.lineTo(n,d.y),e.lineTo(d.x,d.y)),o=!!t.pathSegment(e,a,{move:o}),o?e.closePath():e.lineTo(n,h.y)}e.lineTo(n,t.first().y),e.closePath(),e.clip()}function mg(e,t){const{line:n,target:s,property:r,color:i,scale:o,clip:a}=t,c=NZ(n,s,r);for(const{source:u,target:d,start:h,end:p}of c){const{style:{backgroundColor:f=i}={}}=u,m=s!==!0;e.save(),e.fillStyle=f,UZ(e,o,a,m&&Gv(r,h,p)),e.beginPath();const g=!!n.pathSegment(e,u);let y;if(m){g?e.closePath():Kk(e,s,p,r);const x=!!s.pathSegment(e,d,{move:g,reverse:!0});y=g&&x,y||Kk(e,s,h,r)}e.closePath(),e.fill(y?"evenodd":"nonzero"),e.restore()}}function UZ(e,t,n,s){const r=t.chart.chartArea,{property:i,start:o,end:a}=s||{};if(i==="x"||i==="y"){let c,u,d,h;i==="x"?(c=o,u=r.top,d=a,h=r.bottom):(c=r.left,u=o,d=r.right,h=a),e.beginPath(),n&&(c=Math.max(c,n.left),d=Math.min(d,n.right),u=Math.max(u,n.top),h=Math.min(h,n.bottom)),e.rect(c,u,d-c,h-u),e.clip()}}function Kk(e,t,n,s){const r=t.interpolate(n,s);r&&e.lineTo(r.x,r.y)}var qZ={id:"filler",afterDatasetsUpdate(e,t,n){const s=(e.data.datasets||[]).length,r=[];let i,o,a,c;for(o=0;o<s;++o)i=e.getDatasetMeta(o),a=i.dataset,c=null,a&&a.options&&a instanceof Ri&&(c={visible:e.isDatasetVisible(o),index:o,fill:PZ(a,o,s),chart:e,axis:i.controller.options.indexAxis,scale:i.vScale,line:a}),i.$filler=c,r.push(c);for(o=0;o<s;++o)c=r[o],!(!c||c.fill===!1)&&(c.fill=EZ(r,o,n.propagate))},beforeDraw(e,t,n){const s=n.drawTime==="beforeDraw",r=e.getSortedVisibleDatasetMetas(),i=e.chartArea;for(let o=r.length-1;o>=0;--o){const a=r[o].$filler;a&&(a.line.updateControlPoints(i,a.axis),s&&a.fill&&pg(e.ctx,a,i))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const s=e.getSortedVisibleDatasetMetas();for(let r=s.length-1;r>=0;--r){const i=s[r].$filler;Wk(i)&&pg(e.ctx,i,e.chartArea)}},beforeDatasetDraw(e,t,n){const s=t.meta.$filler;!Wk(s)||n.drawTime!=="beforeDatasetDraw"||pg(e.ctx,s,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const KZ=(e,t,n,s)=>(typeof t=="string"?(n=e.push(t)-1,s.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function VZ(e,t,n,s){const r=e.indexOf(t);if(r===-1)return KZ(e,t,n,s);const i=e.lastIndexOf(t);return r!==i?n:r}const YZ=(e,t)=>e===null?null:Pi(Math.round(e),0,t);function Vk(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Jv extends Tl{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const s=this.getLabels();for(const{index:r,label:i}of n)s[r]===i&&s.splice(r,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(vt(t))return null;const s=this.getLabels();return n=isFinite(n)&&s[n]===t?n:VZ(s,t,Ye(n,t),this._addedLabels),YZ(n,s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:s,max:r}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(s=0),n||(r=this.getLabels().length-1)),this.min=s,this.max=r}buildTicks(){const t=this.min,n=this.max,s=this.options.offset,r=[];let i=this.getLabels();i=t===0&&n===i.length-1?i:i.slice(t,n+1),this._valueRange=Math.max(i.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let o=t;o<=n;o++)r.push({value:o});return r}getLabelForValue(t){return Vk.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}Ae(Jv,"id","category"),Ae(Jv,"defaults",{ticks:{callback:Vk}});function XZ(e,t){const n=[],{bounds:r,step:i,min:o,max:a,precision:c,count:u,maxTicks:d,maxDigits:h,includeBounds:p}=e,f=i||1,m=d-1,{min:g,max:y}=t,x=!vt(o),b=!vt(a),_=!vt(u),S=(y-g)/(h+1);let C=GS((y-g)/m/f)*f,w,j,E,O;if(C<1e-14&&!x&&!b)return[{value:g},{value:y}];O=Math.ceil(y/C)-Math.floor(g/C),O>m&&(C=GS(O*C/m/f)*f),vt(c)||(w=Math.pow(10,c),C=Math.ceil(C*w)/w),r==="ticks"?(j=Math.floor(g/C)*C,E=Math.ceil(y/C)*C):(j=g,E=y),x&&b&&i&&MQ((a-o)/i,C/1e3)?(O=Math.round(Math.min((a-o)/C,d)),C=(a-o)/O,j=o,E=a):_?(j=x?o:j,E=b?a:E,O=u-1,C=(E-j)/O):(O=(E-j)/C,Bc(O,Math.round(O),C/1e3)?O=Math.round(O):O=Math.ceil(O));const R=Math.max(JS(C),JS(j));w=Math.pow(10,vt(c)?R:c),j=Math.round(j*w)/w,E=Math.round(E*w)/w;let B=0;for(x&&(p&&j!==o?(n.push({value:o}),j<o&&B++,Bc(Math.round((j+B*C)*w)/w,o,Yk(o,S,e))&&B++):j<o&&B++);B<O;++B){const L=Math.round((j+B*C)*w)/w;if(b&&L>a)break;n.push({value:L})}return b&&p&&E!==a?n.length&&Bc(n[n.length-1].value,a,Yk(a,S,e))?n[n.length-1].value=a:n.push({value:a}):(!b||E===a)&&n.push({value:E}),n}function Yk(e,t,{horizontal:n,minRotation:s}){const r=wo(s),i=(n?Math.sin(r):Math.cos(r))||.001,o=.75*t*(""+e).length;return Math.min(t/i,o)}class QZ extends Tl{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return vt(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:s}=this.getUserBounds();let{min:r,max:i}=this;const o=c=>r=n?r:c,a=c=>i=s?i:c;if(t){const c=dl(r),u=dl(i);c<0&&u<0?a(0):c>0&&u>0&&o(0)}if(r===i){let c=i===0?1:Math.abs(i*.05);a(i+c),t||o(r-c)}this.min=r,this.max=i}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:s}=t,r;return s?(r=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const r={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},i=this._range||this,o=XZ(r,i);return t.bounds==="ticks"&&LQ(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let n=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const r=(s-n)/Math.max(t.length-1,1)/2;n-=r,s+=r}this._startValue=n,this._endValue=s,this._valueRange=s-n}getLabelForValue(t){return GP(t,this.chart.options.locale,this.options.ticks.format)}}class Zv extends QZ{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Nn(t)?t:0,this.max=Nn(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,s=wo(this.options.ticks.minRotation),r=(t?Math.sin(s):Math.cos(s))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/r))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}Ae(Zv,"id","linear"),Ae(Zv,"defaults",{ticks:{callback:JP.formatters.numeric}});const Tp={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Yn=Object.keys(Tp);function Xk(e,t){return e-t}function Qk(e,t){if(vt(t))return null;const n=e._adapter,{parser:s,round:r,isoWeekday:i}=e._parseOpts;let o=t;return typeof s=="function"&&(o=s(o)),Nn(o)||(o=typeof s=="string"?n.parse(o,s):n.parse(o)),o===null?null:(r&&(o=r==="week"&&(Lf(i)||i===!0)?n.startOf(o,"isoWeek",i):n.startOf(o,r)),+o)}function Gk(e,t,n,s){const r=Yn.length;for(let i=Yn.indexOf(e);i<r-1;++i){const o=Tp[Yn[i]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((n-t)/(a*o.size))<=s)return Yn[i]}return Yn[r-1]}function GZ(e,t,n,s,r){for(let i=Yn.length-1;i>=Yn.indexOf(n);i--){const o=Yn[i];if(Tp[o].common&&e._adapter.diff(r,s,o)>=t-1)return o}return Yn[n?Yn.indexOf(n):0]}function JZ(e){for(let t=Yn.indexOf(e)+1,n=Yn.length;t<n;++t)if(Tp[Yn[t]].common)return Yn[t]}function Jk(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:s,hi:r}=hb(n,t),i=n[s]>=t?n[s]:n[r];e[i]=!0}}function ZZ(e,t,n,s){const r=e._adapter,i=+r.startOf(t[0].value,s),o=t[t.length-1].value;let a,c;for(a=i;a<=o;a=+r.add(a,1,s))c=n[a],c>=0&&(t[c].major=!0);return t}function Zk(e,t,n){const s=[],r={},i=t.length;let o,a;for(o=0;o<i;++o)a=t[o],r[a]=o,s.push({value:a,major:!1});return i===0||!n?s:ZZ(e,s,r,n)}class If extends Tl{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const s=t.time||(t.time={}),r=this._adapter=new lJ._date(t.adapters.date);r.init(n),Fc(s.displayFormats,r.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:Qk(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,s=t.time.unit||"day";let{min:r,max:i,minDefined:o,maxDefined:a}=this.getUserBounds();function c(u){!o&&!isNaN(u.min)&&(r=Math.min(r,u.min)),!a&&!isNaN(u.max)&&(i=Math.max(i,u.max))}(!o||!a)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),r=Nn(r)&&!isNaN(r)?r:+n.startOf(Date.now(),s),i=Nn(i)&&!isNaN(i)?i:+n.endOf(Date.now(),s)+1,this.min=Math.min(r,i-1),this.max=Math.max(r+1,i)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],s=t[t.length-1]),{min:n,max:s}}buildTicks(){const t=this.options,n=t.time,s=t.ticks,r=s.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);const i=this.min,o=this.max,a=zQ(r,i,o);return this._unit=n.unit||(s.autoSkip?Gk(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):GZ(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:JZ(this._unit),this.initOffsets(r),t.reverse&&a.reverse(),Zk(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,s=0,r,i;this.options.offset&&t.length&&(r=this.getDecimalForValue(t[0]),t.length===1?n=1-r:n=(this.getDecimalForValue(t[1])-r)/2,i=this.getDecimalForValue(t[t.length-1]),t.length===1?s=i:s=(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;n=Pi(n,0,o),s=Pi(s,0,o),this._offsets={start:n,end:s,factor:1/(n+1+s)}}_generate(){const t=this._adapter,n=this.min,s=this.max,r=this.options,i=r.time,o=i.unit||Gk(i.minUnit,n,s,this._getLabelCapacity(n)),a=Ye(r.ticks.stepSize,1),c=o==="week"?i.isoWeekday:!1,u=Lf(c)||c===!0,d={};let h=n,p,f;if(u&&(h=+t.startOf(h,"isoWeek",c)),h=+t.startOf(h,u?"day":o),t.diff(s,n,o)>1e5*a)throw new Error(n+" and "+s+" are too far apart with stepSize of "+a+" "+o);const m=r.ticks.source==="data"&&this.getDataTimestamps();for(p=h,f=0;p<s;p=+t.add(p,a,o),f++)Jk(d,p,m);return(p===s||r.bounds==="ticks"||f===1)&&Jk(d,p,m),Object.keys(d).sort(Xk).map(g=>+g)}getLabelForValue(t){const n=this._adapter,s=this.options.time;return s.tooltipFormat?n.format(t,s.tooltipFormat):n.format(t,s.displayFormats.datetime)}format(t,n){const r=this.options.time.displayFormats,i=this._unit,o=n||r[i];return this._adapter.format(t,o)}_tickFormatFunction(t,n,s,r){const i=this.options,o=i.ticks.callback;if(o)return kt(o,[t,n,s],this);const a=i.time.displayFormats,c=this._unit,u=this._majorUnit,d=c&&a[c],h=u&&a[u],p=s[n],f=u&&h&&p&&p.major;return this._adapter.format(t,r||(f?h:d))}generateTickLabels(t){let n,s,r;for(n=0,s=t.length;n<s;++n)r=t[n],r.label=this._tickFormatFunction(r.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+s)*n.factor)}getValueForPixel(t){const n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,s=this.ctx.measureText(t).width,r=wo(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(r),o=Math.sin(r),a=this._resolveTickFontOptions(0).size;return{w:s*i+a*o,h:s*o+a*i}}_getLabelCapacity(t){const n=this.options.time,s=n.displayFormats,r=s[n.unit]||s.millisecond,i=this._tickFormatFunction(t,0,Zk(this,[t],this._majorUnit),r),o=this._getLabelSize(i),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,s;if(t.length)return t;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,s=r.length;n<s;++n)t=t.concat(r[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,s;if(t.length)return t;const r=this.getLabels();for(n=0,s=r.length;n<s;++n)t.push(Qk(this,r[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return HQ(t.sort(Xk))}}Ae(If,"id","time"),Ae(If,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function th(e,t,n){let s=0,r=e.length-1,i,o,a,c;n?(t>=e[s].pos&&t<=e[r].pos&&({lo:s,hi:r}=qv(e,"pos",t)),{pos:i,time:a}=e[s],{pos:o,time:c}=e[r]):(t>=e[s].time&&t<=e[r].time&&({lo:s,hi:r}=qv(e,"time",t)),{time:i,pos:a}=e[s],{time:o,pos:c}=e[r]);const u=o-i;return u?a+(c-a)*(t-i)/u:a}class eC extends If{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=th(n,this.min),this._tableRange=th(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:s}=this,r=[],i=[];let o,a,c,u,d;for(o=0,a=t.length;o<a;++o)u=t[o],u>=n&&u<=s&&r.push(u);if(r.length<2)return[{time:n,pos:0},{time:s,pos:1}];for(o=0,a=r.length;o<a;++o)d=r[o+1],c=r[o-1],u=r[o],Math.round((d+c)/2)!==u&&i.push({time:u,pos:o/(a-1)});return i}_generate(){const t=this.min,n=this.max;let s=super.getDataTimestamps();return(!s.includes(t)||!s.length)&&s.splice(0,0,t),(!s.includes(n)||s.length===1)&&s.push(n),s.sort((r,i)=>r-i)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),s=this.getLabelTimestamps();return n.length&&s.length?t=this.normalize(n.concat(s)):t=n.length?n:s,t=this._cache.all=t,t}getDecimalForValue(t){return(th(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return th(this._table,s*this._tableRange+this._minPos,!0)}}Ae(eC,"id","timeseries"),Ae(eC,"defaults",If.defaults);Tr.register(Jv,Zv,Ah,Ri,qZ);function ey({data:e,color:t="rgba(59,130,246,0.8)",height:n=32,maxValue:s=100}){const r=v.useRef(null),i=v.useRef(null);return v.useEffect(()=>{const o=r.current;if(!o)return;const a={labels:e.map(()=>""),datasets:[{data:e,borderColor:t,borderWidth:1.5,fill:!0,backgroundColor:t.replace(/[\d.]+\)$/,"0.15)"),pointRadius:0,tension:.3}]},c={responsive:!1,animation:!1,plugins:{legend:{display:!1},tooltip:{enabled:!1}},scales:{x:{display:!1},y:{display:!1,min:0,max:s}}};return i.current?(i.current.data=a,i.current.update("none")):i.current=new Tr(o,{type:"line",data:a,options:c}),()=>{var u;(u=i.current)==null||u.destroy(),i.current=null}},[]),v.useEffect(()=>{i.current&&(i.current.data.labels=e.map(()=>""),i.current.data.datasets[0].data=e,i.current.update("none"))},[e]),l.jsx("canvas",{ref:r,width:80,height:n,style:{display:"block"}})}function tC(e){return e>=1024**3?`${(e/1024**3).toFixed(1)}GiB`:e>=1024**2?`${(e/1024**2).toFixed(0)}MiB`:e>=1024?`${(e/1024).toFixed(0)}KiB`:`${e}B`}const eee={running:"bg-green-500",stopped:"bg-red-500",unhealthy:"bg-yellow-400",restarting:"bg-orange-400"},tee={running:"running",stopped:"stopped",unhealthy:"unhealthy",restarting:"restarting"},nee={healthy:"bg-green-500",warning:"bg-yellow-400",stuck:"bg-orange-400",dead:"bg-red-500",stopped:"bg-surface-overlay"};function see({container:e,history:t,onClick:n}){const s=e.cpuPercent>=85?"rgba(239,68,68,0.8)":e.cpuPercent>=60?"rgba(234,179,8,0.8)":"rgba(59,130,246,0.8)";return l.jsxs("button",{onClick:()=>n(e),className:"w-full text-left bg-surface-raised border border-divider rounded-lg p-3 hover:border-blue-500/50 hover:bg-surface-overlay transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${eee[e.status]}`}),l.jsx("span",{className:"text-xs font-medium text-content truncate flex-1",title:e.name,children:e.name}),l.jsx("span",{className:"text-xs text-content-subtle shrink-0",children:tee[e.status]})]}),l.jsxs("div",{className:"flex gap-2 items-end",children:[l.jsxs("div",{className:"flex-1 space-y-1.5",children:[l.jsx(Pf,{value:e.cpuPercent,label:"CPU"}),l.jsx(Pf,{value:e.memoryPercent,label:"MEM"}),e.memoryLimit>0&&l.jsxs("div",{className:"text-xs text-content-subtle",children:[tC(e.memoryUsage)," / ",tC(e.memoryLimit)]})]}),t&&t.cpuPercent.length>1&&l.jsx("div",{className:"shrink-0",children:l.jsx(ey,{data:t.cpuPercent,color:s,height:36})})]})]})}function ree({agent:e,onNavigate:t}){return l.jsxs("button",{onClick:()=>t(e.id),className:"w-full text-left bg-surface-raised border border-divider rounded-lg p-3 hover:border-blue-500/50 hover:bg-surface-overlay transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${nee[e.status]}`}),l.jsx("span",{className:"text-xs font-medium text-content truncate flex-1",title:e.issueId??e.id,children:e.issueId??e.id}),l.jsx("span",{className:"text-xs text-content-subtle shrink-0",children:e.status})]}),l.jsxs("div",{className:"text-xs text-content-subtle space-y-0.5",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Model"}),l.jsx("span",{className:"text-content",children:e.model})]}),l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Runtime"}),l.jsx("span",{className:"text-content",children:e.runtime})]}),e.consecutiveFailures>0&&l.jsxs("div",{className:"flex justify-between text-orange-400",children:[l.jsx("span",{children:"Failures"}),l.jsx("span",{children:e.consecutiveFailures})]})]}),l.jsx("div",{className:"mt-1.5 text-xs text-blue-400",children:"Click to view in Agents →"})]})}function iee({container:e,onRemove:t}){var n;return l.jsxs("div",{className:"w-full text-left bg-surface-raised border border-divider rounded-lg p-3 opacity-70",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full shrink-0 bg-red-500/60"}),l.jsx("span",{className:"text-xs font-medium text-content truncate flex-1",title:e.name,children:e.name}),l.jsx("button",{onClick:s=>{s.stopPropagation(),t(e.id)},className:"text-xs text-red-400 hover:text-red-300 shrink-0",title:"Remove container",children:"Remove"})]}),l.jsxs("div",{className:"text-xs text-content-subtle space-y-0.5",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Image"}),l.jsx("span",{className:"text-content truncate ml-2",title:e.image,children:(n=e.image.split(":")[0])==null?void 0:n.split("/").pop()})]}),l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Status"}),l.jsx("span",{className:"text-content",children:e.status})]}),e.size&&l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Size"}),l.jsx("span",{className:"text-content",children:e.size})]})]})]})}function oee({network:e,onRemove:t}){const n=e.containers===0;return l.jsxs("div",{className:"w-full text-left bg-surface-raised border border-divider rounded-lg p-3",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${e.containers>0?"bg-blue-400":"bg-surface-overlay"}`}),l.jsx("span",{className:"text-xs font-medium text-content truncate flex-1",title:e.name,children:e.name}),n&&l.jsx("button",{onClick:()=>t(e.name),className:"text-xs text-red-400 hover:text-red-300 shrink-0",title:"Remove network",children:"Remove"})]}),l.jsxs("div",{className:"text-xs text-content-subtle space-y-0.5",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Driver"}),l.jsx("span",{className:"text-content",children:e.driver})]}),l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Containers"}),l.jsx("span",{className:"text-content",children:e.containers})]})]})]})}function aee({volume:e,onRemove:t}){const n=e.name.length>40?e.name.slice(0,37)+"...":e.name;return l.jsxs("div",{className:"w-full text-left bg-surface-raised border border-divider rounded-lg p-3",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full shrink-0 bg-purple-400/60"}),l.jsx("span",{className:"text-xs font-medium text-content truncate flex-1",title:e.name,children:n}),l.jsx("button",{onClick:()=>t(e.name),className:"text-xs text-red-400 hover:text-red-300 shrink-0",title:"Remove volume",children:"Remove"})]}),l.jsxs("div",{className:"text-xs text-content-subtle space-y-0.5",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Driver"}),l.jsx("span",{className:"text-content",children:e.driver})]}),e.size&&l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Size"}),l.jsx("span",{className:"text-content",children:e.size})]})]})]})}function nh(e){return e>=1024**3?`${(e/1024**3).toFixed(1)}GiB`:e>=1024**2?`${(e/1024**2).toFixed(0)}MiB`:e>=1024?`${(e/1024).toFixed(0)}KiB`:`${e}B`}async function lee(e){const t=await fetch(`/api/resources/${e}/details`);if(!t.ok)throw new Error("Failed to fetch container details");return t.json()}function cee({container:e,history:t,onClose:n}){var a,c;const[s,r]=v.useState("overview"),{data:i}=he({queryKey:["container-details",e.id],queryFn:()=>lee(e.id),refetchInterval:s==="logs"?5e3:3e4});v.useEffect(()=>{const u=d=>{d.key==="Escape"&&n()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[n]);const o=[{id:"overview",label:"Overview"},{id:"logs",label:"Logs"},{id:"ports-env",label:"Ports & Env"}];return l.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",children:[l.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:n}),l.jsxs("div",{className:"relative w-full max-w-lg bg-surface-raised border-l border-divider flex flex-col shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-divider shrink-0",children:[l.jsx("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${e.status==="running"?"bg-green-500":e.status==="unhealthy"?"bg-yellow-400":e.status==="restarting"?"bg-orange-400":"bg-red-500"}`}),l.jsx("h2",{className:"font-semibold text-content text-sm flex-1 truncate",title:e.name,children:e.name}),(i==null?void 0:i.image)&&l.jsx("span",{className:"text-xs text-content-subtle truncate max-w-[160px]",title:i.image,children:i.image}),l.jsx("button",{onClick:n,className:"p-1 rounded hover:bg-surface-overlay text-content-subtle hover:text-content",children:l.jsx(yt,{className:"w-4 h-4"})})]}),l.jsx("div",{className:"flex border-b border-divider shrink-0",children:o.map(u=>l.jsx("button",{onClick:()=>r(u.id),className:`px-4 py-2 text-xs transition-colors ${s===u.id?"text-blue-400 border-b-2 border-blue-500 -mb-px":"text-content-subtle hover:text-content"}`,children:u.label},u.id))}),l.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[s==="overview"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"Current Usage"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Pf,{value:e.cpuPercent,label:"CPU"}),l.jsx(Pf,{value:e.memoryPercent,label:"Memory"}),e.memoryLimit>0&&l.jsxs("div",{className:"text-xs text-content-subtle text-right",children:[nh(e.memoryUsage)," / ",nh(e.memoryLimit)]})]})]}),t.cpuPercent.length>1&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"5-Min History"}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-content-subtle mb-1",children:"CPU %"}),l.jsx("div",{className:"w-full",children:l.jsx(ey,{data:t.cpuPercent,color:"rgba(59,130,246,0.8)",height:40})})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-content-subtle mb-1",children:"Memory %"}),l.jsx("div",{className:"w-full",children:l.jsx(ey,{data:t.memoryPercent,color:"rgba(168,85,247,0.8)",height:40})})]})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"Network I/O"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsxs("div",{className:"bg-surface p-2 rounded",children:[l.jsx("div",{className:"text-xs text-content-subtle",children:"In"}),l.jsx("div",{className:"text-sm font-medium text-content",children:nh(e.networkIn)})]}),l.jsxs("div",{className:"bg-surface p-2 rounded",children:[l.jsx("div",{className:"text-xs text-content-subtle",children:"Out"}),l.jsx("div",{className:"text-sm font-medium text-content",children:nh(e.networkOut)})]})]})]}),i&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"Container Info"}),l.jsxs("dl",{className:"space-y-1 text-xs",children:[i.uptime&&l.jsxs("div",{className:"flex justify-between",children:[l.jsx("dt",{className:"text-content-subtle",children:"Uptime"}),l.jsx("dd",{className:"text-content",children:i.uptime})]}),i.created&&l.jsxs("div",{className:"flex justify-between",children:[l.jsx("dt",{className:"text-content-subtle",children:"Created"}),l.jsx("dd",{className:"text-content",children:new Date(i.created).toLocaleString()})]}),l.jsxs("div",{className:"flex justify-between",children:[l.jsx("dt",{className:"text-content-subtle",children:"Status"}),l.jsx("dd",{className:"text-content",children:i.status})]})]})]})]}),s==="logs"&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"Recent Logs (tail 100)"}),i!=null&&i.logs?l.jsx("pre",{className:"text-xs text-content bg-surface p-3 rounded overflow-auto max-h-[600px] font-mono whitespace-pre-wrap break-all",children:i.logs}):l.jsx("div",{className:"text-xs text-content-subtle text-center py-8",children:"Loading logs…"})]}),s==="ports-env"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"Port Mappings"}),(a=i==null?void 0:i.ports)!=null&&a.length?l.jsx("div",{className:"space-y-1",children:i.ports.map((u,d)=>l.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[l.jsx("span",{className:"text-content font-mono",children:u.host}),l.jsx("span",{className:"text-content-subtle",children:"→"}),l.jsxs("span",{className:"text-content font-mono",children:[u.container,"/",u.protocol]})]},d))}):l.jsx("div",{className:"text-xs text-content-subtle",children:"No port mappings"})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"Environment Variables"}),(c=i==null?void 0:i.env)!=null&&c.length?l.jsx("div",{className:"space-y-0.5 max-h-80 overflow-auto",children:i.env.map((u,d)=>{const[h,...p]=u.split("="),f=p.join("="),m=/token|secret|key|pass|pwd|auth/i.test(h??"");return l.jsxs("div",{className:"text-xs font-mono flex gap-1 flex-wrap",children:[l.jsx("span",{className:"text-blue-400",children:h}),l.jsx("span",{className:"text-content-subtle",children:"="}),l.jsx("span",{className:"text-content break-all",children:m?"***":f})]},d)})}):l.jsx("div",{className:"text-xs text-content-subtle",children:"No environment variables"})]})]})]})]})]})}async function uee(){const e=await fetch("/api/resources");if(!e.ok)throw new Error("Failed to fetch resources");return e.json()}async function dee(e){const t=await fetch(`/api/resources/${e}/history`);if(!t.ok)throw new Error("Failed to fetch history");return t.json()}function hee(e,t,n){if(n==="issue"){const r=new Map;for(const i of e){const o=i.name.match(/(?:feature[_-])?([A-Z]+-\d+)/i),a=o?o[1].toUpperCase():"__ungrouped__",c=o?o[1].toUpperCase():"Ungrouped";r.has(a)||r.set(a,{key:a,label:c,containers:[],agents:[]}),r.get(a).containers.push(i)}for(const i of t){const o=i.issueId??"__ungrouped__",a=i.issueId??"Ungrouped";r.has(o)||r.set(o,{key:o,label:a,containers:[],agents:[]}),r.get(o).agents.push(i)}return Array.from(r.values()).sort((i,o)=>i.label.localeCompare(o.label))}if(n==="type")return[{key:"containers",label:"Containers",containers:e,agents:[]},{key:"agents",label:"Agents",containers:[],agents:t}].filter(o=>o.containers.length+o.agents.length>0);const s=new Map;for(const r of e)s.has(r.status)||s.set(r.status,{key:r.status,label:r.status.charAt(0).toUpperCase()+r.status.slice(1),containers:[],agents:[]}),s.get(r.status).containers.push(r);for(const r of t)s.has(r.status)||s.set(r.status,{key:r.status,label:r.status.charAt(0).toUpperCase()+r.status.slice(1),containers:[],agents:[]}),s.get(r.status).agents.push(r);return Array.from(s.values())}function gg({title:e,count:t,defaultOpen:n=!1,children:s}){const[r,i]=v.useState(n);return t===0?null:l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>i(!r),className:"flex items-center gap-2 mb-3 group",children:[l.jsx("span",{className:"text-xs text-content-subtle transition-transform",style:{transform:r?"rotate(90deg)":"rotate(0deg)"},children:"▶"}),l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider group-hover:text-content transition-colors",children:e}),l.jsxs("span",{className:"text-xs font-normal text-content-subtle/60",children:["(",t,")"]})]}),r&&s]})}function fee({onNavigateToAgents:e}){const[t,n]=v.useState("issue"),[s,r]=v.useState("all"),[i,o]=v.useState(null),[a,c]=v.useState(null),u=Nt();JX();const{data:d,isLoading:h,error:p}=he({queryKey:["resources"],queryFn:uee,refetchInterval:5e3}),{data:f}=he({queryKey:["container-history",i==null?void 0:i.id],queryFn:()=>dee(i.id),enabled:!!i,refetchInterval:5e3});async function m(E,O,R){if(!a){c(R);try{const B=await fetch(E,{method:O});if(!B.ok){const L=await B.json().catch(()=>({error:"Unknown error"}));console.error(`${R} failed:`,L.error)}u.invalidateQueries({queryKey:["resources"]})}catch(B){console.error(`${R} failed:`,B)}finally{c(null)}}}if(h)return l.jsx("div",{className:"p-6 text-content-subtle text-sm",children:"Loading resources…"});if(p)return l.jsxs("div",{className:"p-6 text-red-400 text-sm",children:["Failed to load resources: ",p.message]});const g=(d==null?void 0:d.containers)??[],y=(d==null?void 0:d.agents)??[],x=(d==null?void 0:d.stoppedContainers)??[],b=(d==null?void 0:d.networks)??[],_=(d==null?void 0:d.volumes)??[],S=s==="running"?g.filter(E=>E.status==="running"):g,C=hee(S,y,t),j=S.length+y.length+x.length+b.length+_.length;return l.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-3 px-6 py-3 border-b border-divider shrink-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-content",children:"Resources"}),l.jsxs("span",{className:"text-xs text-content-subtle",children:[j," items"]}),l.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[l.jsx("span",{className:"text-xs text-content-subtle mr-1",children:"Group by:"}),["issue","type","status"].map(E=>l.jsx("button",{onClick:()=>n(E),className:`px-2 py-0.5 rounded text-xs transition-colors ${t===E?"bg-blue-600 text-white":"text-content-subtle hover:text-content hover:bg-surface-overlay"}`,children:E.charAt(0).toUpperCase()+E.slice(1)},E))]}),l.jsx("div",{className:"flex items-center gap-1",children:["all","running"].map(E=>l.jsx("button",{onClick:()=>r(E),className:`px-2 py-0.5 rounded text-xs transition-colors ${s===E?"bg-surface-overlay text-content":"text-content-subtle hover:text-content hover:bg-surface-overlay"}`,children:E==="all"?"All":"Running only"},E))}),(d==null?void 0:d.updatedAt)&&l.jsxs("span",{className:"ml-auto text-xs text-content-subtle",children:["Updated ",new Date(d.updatedAt).toLocaleTimeString()]})]}),l.jsx("div",{className:"flex-1 overflow-auto p-6",children:j===0?l.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-content-subtle",children:[l.jsx("div",{className:"text-4xl mb-3",children:"📦"}),l.jsx("div",{className:"text-sm",children:"No containers or agents found"}),l.jsx("div",{className:"text-xs mt-1",children:"Docker may not be running or no workspaces are active"})]}):l.jsxs("div",{className:"space-y-6",children:[C.map(E=>l.jsxs("div",{children:[l.jsxs("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-3",children:[E.label,l.jsxs("span",{className:"ml-2 font-normal text-content-subtle/60",children:["(",E.containers.length+E.agents.length,")"]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:[E.containers.map(O=>l.jsx(see,{container:O,history:(d!=null&&d.containers,void 0),onClick:o},O.id)),E.agents.map(O=>l.jsx(ree,{agent:O,onNavigate:e},O.id))]})]},E.key)),l.jsxs(gg,{title:"Stopped Containers",count:x.length,children:[l.jsx("div",{className:"flex items-center gap-2 mb-3",children:l.jsx("button",{onClick:()=>m("/api/resources/docker/prune-containers","POST","Prune containers"),disabled:!!a,className:"px-2 py-1 rounded text-xs bg-red-500/10 text-red-400 hover:bg-red-500/20 disabled:opacity-50 transition-colors",children:a==="Prune containers"?"Pruning...":"Prune All Stopped"})}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:x.map(E=>l.jsx(iee,{container:E,onRemove:O=>m(`/api/resources/docker/container/${O}`,"DELETE",`Remove ${E.name}`)},E.id))})]}),l.jsx(gg,{title:"Docker Networks",count:b.length,children:l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:b.map(E=>l.jsx(oee,{network:E,onRemove:O=>m(`/api/resources/docker/network/${O}`,"DELETE",`Remove ${O}`)},E.id))})}),l.jsxs(gg,{title:"Docker Volumes",count:_.length,children:[l.jsx("div",{className:"flex items-center gap-2 mb-3",children:l.jsx("button",{onClick:()=>m("/api/resources/docker/prune-volumes","POST","Prune volumes"),disabled:!!a,className:"px-2 py-1 rounded text-xs bg-red-500/10 text-red-400 hover:bg-red-500/20 disabled:opacity-50 transition-colors",children:a==="Prune volumes"?"Pruning...":"Prune Unused Volumes"})}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:_.map(E=>l.jsx(aee,{volume:E,onRemove:O=>m(`/api/resources/docker/volume/${O}`,"DELETE",`Remove ${O}`)},E.name))})]})]})}),i&&l.jsx(cee,{container:i,history:f??{timestamps:[],cpuPercent:[],memoryPercent:[]},onClose:()=>o(null)})]})}const pee={},nC=e=>{let t;const n=new Set,s=(d,h)=>{const p=typeof d=="function"?d(t):d;if(!Object.is(p,t)){const f=t;t=h??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(m=>m(t,f))}},r=()=>t,c={setState:s,getState:r,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(pee?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(s,r,c);return c},mee=e=>e?nC(e):nC;var w4={exports:{}},S4={},k4={exports:{}},C4={};/**
|
|
728
|
-
* @license React
|
|
729
|
-
* use-sync-external-store-shim.production.js
|
|
730
|
-
*
|
|
731
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
732
|
-
*
|
|
733
|
-
* This source code is licensed under the MIT license found in the
|
|
734
|
-
* LICENSE file in the root directory of this source tree.
|
|
735
|
-
*/var pl=v;function gee(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xee=typeof Object.is=="function"?Object.is:gee,vee=pl.useState,yee=pl.useEffect,bee=pl.useLayoutEffect,_ee=pl.useDebugValue;function wee(e,t){var n=t(),s=vee({inst:{value:n,getSnapshot:t}}),r=s[0].inst,i=s[1];return bee(function(){r.value=n,r.getSnapshot=t,xg(r)&&i({inst:r})},[e,n,t]),yee(function(){return xg(r)&&i({inst:r}),e(function(){xg(r)&&i({inst:r})})},[e]),_ee(n),n}function xg(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xee(e,n)}catch{return!0}}function See(e,t){return t()}var kee=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?See:wee;C4.useSyncExternalStore=pl.useSyncExternalStore!==void 0?pl.useSyncExternalStore:kee;k4.exports=C4;var Cee=k4.exports;/**
|
|
736
|
-
* @license React
|
|
737
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
738
|
-
*
|
|
739
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
740
|
-
*
|
|
741
|
-
* This source code is licensed under the MIT license found in the
|
|
742
|
-
* LICENSE file in the root directory of this source tree.
|
|
743
|
-
*/var Rp=v,Nee=Cee;function jee(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Eee=typeof Object.is=="function"?Object.is:jee,Pee=Nee.useSyncExternalStore,Tee=Rp.useRef,Ree=Rp.useEffect,Dee=Rp.useMemo,Mee=Rp.useDebugValue;S4.useSyncExternalStoreWithSelector=function(e,t,n,s,r){var i=Tee(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=Dee(function(){function c(f){if(!u){if(u=!0,d=f,f=s(f),r!==void 0&&o.hasValue){var m=o.value;if(r(m,f))return h=m}return h=f}if(m=h,Eee(d,f))return m;var g=s(f);return r!==void 0&&r(m,g)?(d=f,m):(d=f,h=g)}var u=!1,d,h,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,s,r]);var a=Pee(e,i[0],i[1]);return Ree(function(){o.hasValue=!0,o.value=a},[a]),Mee(a),a};w4.exports=S4;var Lee=w4.exports;const Aee=ml(Lee),N4={},{useDebugValue:Oee}=J,{useSyncExternalStoreWithSelector:Iee}=Aee;let sC=!1;const Fee=e=>e;function Bee(e,t=Fee,n){(N4?"production":void 0)!=="production"&&n&&!sC&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),sC=!0);const s=Iee(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Oee(s),s}const rC=e=>{(N4?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?mee(e):e,n=(s,r)=>Bee(t,s,r);return Object.assign(n,t),n},zee=e=>e?rC(e):rC,$ee=zee((e,t)=>({theme:"dark",toggleTheme:()=>{const n=t().theme==="dark"?"light":"dark";n==="light"?document.documentElement.classList.add("light"):document.documentElement.classList.remove("light"),localStorage.setItem("panopticon.ui.theme",n),e({theme:n})},initTheme:()=>{const n=localStorage.getItem("panopticon.ui.theme"),s=n==="light"||n==="dark"?n:null,r=s||"dark";s||localStorage.setItem("panopticon.ui.theme",r),r==="light"?document.documentElement.classList.add("light"):document.documentElement.classList.remove("light"),e({theme:r})}}));function Hee(){const e=Nt(),t=v.useRef(null);v.useEffect(()=>{const n=Ic({path:"/socket.io",transports:["websocket","polling"],reconnectionDelay:1e3,reconnectionDelayMax:1e4});t.current=n,n.on("connect",()=>{console.log("[socket.io] Connected for real-time issue updates")}),n.on("disconnect",i=>{console.log("[socket.io] Disconnected:",i)});const s=i=>{e.setQueriesData({queryKey:["issues"]},i)};n.on("issues:snapshot",s),n.on("issues:updated",s),n.on("agents:changed",()=>{e.invalidateQueries({queryKey:["agents"]})}),n.on("pipeline:status",i=>{i!=null&&i.issueId&&e.setQueryData(["review-status",i.issueId],i)});const r=()=>{document.visibilityState==="visible"&&n.connected&&n.emit("issues:request-snapshot")};return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r),n.disconnect(),t.current=null}},[e])}const j4={"mission-control":"/",kanban:"/kanban",agents:"/agents",resources:"/resources",convoys:"/convoys",handoffs:"/handoffs",activity:"/activity",metrics:"/metrics",costs:"/costs",skills:"/skills",health:"/health",settings:"/settings"},Wee=Object.fromEntries(Object.entries(j4).map(([e,t])=>[t,e]));function iC(){const e=window.location.pathname;return Wee[e]||"mission-control"}const Uee=400,qee=1200,Kee=700;async function Vee(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function Yee(){const e=await fetch("/api/issues");if(!e.ok)throw new Error("Failed to fetch issues");return e.json()}async function Xee(){const e=await fetch("/api/tracker-status");if(!e.ok)throw new Error("Failed to fetch tracker status");return e.json()}async function Qee(){const e=await fetch("/api/confirmations");if(!e.ok)throw new Error("Failed to fetch confirmations");return e.json()}async function oC(e,t){if(!(await fetch(`/api/confirmations/${e}/respond`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirmed:t})})).ok)throw new Error("Failed to respond to confirmation")}function Gee(){const[e,t]=v.useState(iC),[n,s]=v.useState(null),[r,i]=v.useState(null),[o,a]=v.useState(Kee),[c,u]=v.useState(!1),[d,h]=v.useState(!1),[p,f]=v.useState(null),[m,g]=v.useState(!1),[y,x]=v.useState(!1),b=v.useRef(null),{theme:_,toggleTheme:S,initTheme:C}=$ee();Hee();const{data:w}=he({queryKey:["tracker-status"],queryFn:Xee,refetchInterval:6e4,retry:!1}),j=(w==null?void 0:w.configured.filter(z=>!z.hasKey))||[];v.useEffect(()=>{C()},[C]);const E=v.useCallback(z=>{t(z);const U=j4[z];window.location.pathname!==U&&window.history.pushState({tab:z},"",U)},[]);v.useEffect(()=>{const z=()=>{t(iC())};return window.addEventListener("popstate",z),()=>window.removeEventListener("popstate",z)},[]);const{data:O=[]}=he({queryKey:["agents"],queryFn:Vee,refetchInterval:5e3}),{data:R=[]}=he({queryKey:["issues"],queryFn:Yee}),{data:B=[]}=he({queryKey:["confirmations"],queryFn:Qee,refetchInterval:2e3});v.useEffect(()=>{B.length>0&&!p&&f(B[0])},[B,p]);const L=v.useRef(new Set);v.useEffect(()=>{const z=O.filter(U=>U.agentPhase==="planning"&&U.hasPendingQuestion&&U.status!=="stopped");for(const U of z){const K=`${U.id}-input`;L.current.has(K)||(L.current.add(K),uc.info(`Planning agent needs input for ${U.issueId||U.id}`,{description:"The planning agent has a question for you. Open the Plan dialog to respond.",duration:1e4}))}for(const U of L.current){const K=U.replace("-input",""),Q=O.find(Y=>Y.id===K);(!Q||!Q.hasPendingQuestion||Q.status==="stopped")&&L.current.delete(U)}},[O]);const D=r?O.find(z=>{var U;return((U=z.issueId)==null?void 0:U.toLowerCase())===r.toLowerCase()}):null,T=r?R.find(z=>z.identifier.toLowerCase()===r.toLowerCase()):null,P=v.useCallback(z=>{z.preventDefault(),u(!0)},[]),$=v.useCallback(z=>{if(!c||!b.current)return;const K=b.current.getBoundingClientRect().right-z.clientX;a(Math.min(qee,Math.max(Uee,K)))},[c]),W=v.useCallback(()=>{u(!1)},[]);v.useEffect(()=>(c&&(document.addEventListener("mousemove",$),document.addEventListener("mouseup",W),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",W),document.body.style.cursor="",document.body.style.userSelect=""}),[c,$,W]);const I=v.useCallback(()=>{h(z=>!z)},[]),H=v.useCallback(async()=>{if(p)try{await oC(p.id,!0),f(null)}catch(z){console.error("Failed to confirm:",z)}},[p]),k=v.useCallback(async()=>{if(p)try{await oC(p.id,!1),f(null)}catch(z){console.error("Failed to deny:",z)}},[p]),F=v.useCallback(()=>{f(null)},[]);v.useEffect(()=>{const z=U=>{U.key==="/"&&!["INPUT","TEXTAREA"].includes(U.target.tagName)&&(U.preventDefault(),g(!0))};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[]);const M=v.useCallback(z=>{i(z),E("kanban")},[]),N=d?"calc(100% - 300px)":`${o}px`;return l.jsxs("div",{className:"h-screen bg-surface flex flex-col overflow-hidden transition-colors duration-150",children:[l.jsx("header",{className:"bg-surface-raised border-b border-divider px-4 py-2 shrink-0",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("button",{onClick:()=>E("mission-control"),className:"flex items-center gap-2 shrink-0 hover:opacity-80 transition-opacity",title:"Go to Mission Control",children:[l.jsx(Lo,{className:"w-5 h-5 text-blue-400"}),l.jsx("h1",{className:"text-lg font-bold text-content whitespace-nowrap",children:"Panopticon"})]}),l.jsx(_H,{}),l.jsx("nav",{className:"flex gap-0.5 overflow-x-auto min-w-0 scrollbar-hide",children:[{id:"mission-control",label:"Mission Control",icon:GN},{id:"kanban",label:"Board",icon:JD},{id:"agents",label:"Agents",icon:au},{id:"resources",label:"Resources",icon:lM},{id:"convoys",label:"Convoys",icon:au},{id:"handoffs",label:"Handoffs",icon:n0},{id:"activity",label:"Activity",icon:Vo},{id:"metrics",label:"Metrics",icon:WD},{id:"costs",label:"Costs",icon:na},{id:"skills",label:"Skills",icon:YN},{id:"health",label:"Health",icon:al},{id:"settings",label:"Settings",icon:rj}].map(({id:z,label:U,icon:K})=>l.jsxs("button",{onClick:()=>E(z),className:`flex items-center gap-1 px-2.5 py-1.5 rounded-md text-xs whitespace-nowrap transition-colors ${e===z?"bg-blue-600 text-white":"text-content-subtle hover:text-content hover:bg-surface-overlay"}`,children:[l.jsx(K,{className:"w-3.5 h-3.5"}),U]},z))}),l.jsx("button",{onClick:S,className:"ml-auto px-2.5 py-1.5 rounded-md text-xs whitespace-nowrap transition-colors text-content-subtle hover:text-content hover:bg-surface-overlay",title:`Switch to ${_==="dark"?"light":"dark"} mode`,children:_==="dark"?l.jsx(uM,{className:"w-3.5 h-3.5"}):l.jsx(nM,{className:"w-3.5 h-3.5"})})]})}),j.length>0&&!y&&l.jsxs("div",{className:"bg-amber-500/10 border-b border-amber-500/30 px-4 py-2 flex items-center gap-3 shrink-0",children:[l.jsx(kn,{className:"w-4 h-4 text-amber-400 shrink-0"}),l.jsxs("p",{className:"text-amber-400 text-sm flex-1",children:[l.jsxs("span",{className:"font-semibold",children:["Missing API key",j.length>1?"s":"",":"]})," ",j.map(z=>l.jsxs("span",{children:[z.name," (",l.jsx("code",{className:"font-mono text-xs bg-amber-500/20 px-1 rounded",children:z.envVar}),")"]},z.type)).reduce((z,U,K)=>K===0?[U]:[...z,", ",U],[]),"."," ",l.jsx("button",{onClick:()=>E("settings"),className:"underline hover:text-amber-300 font-semibold",children:"Configure in Settings"})]}),l.jsx("button",{onClick:()=>x(!0),className:"text-amber-400/60 hover:text-amber-400 shrink-0",title:"Dismiss",children:l.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),l.jsxs("main",{ref:b,className:"flex-1 flex overflow-hidden",children:[e==="mission-control"&&l.jsx("div",{className:"w-full h-full",children:l.jsx(ZY,{issues:R})}),e==="kanban"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`flex-1 overflow-auto p-6 ${r?"":"w-full"}`,children:[l.jsx(AH,{}),l.jsx(nB,{selectedIssue:r,onSelectIssue:i})]}),r&&T&&l.jsxs(l.Fragment,{children:[l.jsx("div",{onMouseDown:P,className:`w-1 hover:w-1.5 bg-surface-overlay hover:bg-blue-500 cursor-col-resize transition-colors shrink-0 ${c?"bg-blue-500":""}`}),l.jsxs("div",{style:{width:N},className:"relative shrink-0 h-full flex flex-col",children:[l.jsx("button",{onClick:I,className:"absolute top-2 left-2 z-10 p-1.5 bg-surface-overlay hover:bg-surface-emphasis rounded text-content-subtle hover:text-content",title:d?"Collapse panel":"Expand panel",children:d?l.jsx(tM,{className:"w-4 h-4"}):l.jsx(ZD,{className:"w-4 h-4"})}),l.jsx(tH,{agent:D??void 0,issueId:r,issueUrl:T.url,issue:T,onClose:()=>i(null)})]})]})]}),e==="agents"&&l.jsx("div",{className:"p-6 w-full",children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsx(l6,{selectedAgent:n,onSelectAgent:s}),n&&l.jsx(d6,{agentId:n})]})}),e==="resources"&&l.jsx("div",{className:"w-full h-full overflow-hidden",children:l.jsx(fee,{onNavigateToAgents:z=>{s(z),E("agents")}})}),e==="skills"&&l.jsx("div",{className:"p-6 w-full overflow-auto",children:l.jsx(m6,{})}),e==="health"&&l.jsx("div",{className:"p-6 w-full overflow-auto",children:l.jsx(p6,{})}),e==="activity"&&l.jsx("div",{className:"w-full h-full",children:l.jsx(iH,{onClose:()=>E("kanban")})}),e==="convoys"&&l.jsx("div",{className:"w-full h-full",children:l.jsx(pH,{onClose:()=>E("kanban")})}),e==="metrics"&&l.jsx("div",{className:"w-full overflow-auto",children:l.jsx(FH,{})}),e==="costs"&&l.jsx("div",{className:"w-full overflow-auto",children:l.jsx(zH,{})}),e==="handoffs"&&l.jsx("div",{className:"w-full overflow-auto",children:l.jsx(TH,{})}),e==="settings"&&l.jsx("div",{className:"p-6 w-full overflow-auto",children:l.jsx(QH,{})})]}),l.jsx(RH,{request:p,isOpen:!!p,onConfirm:H,onDeny:k,onClose:F}),l.jsx(CU,{isOpen:m,onClose:()=>g(!1),onSelectIssue:M,cycleFilter:"current",includeCompletedFilter:!1}),l.jsx($M,{})]})}function aC(e){if(e instanceof TypeError){const t=e.message.toLowerCase();return t.includes("failed to fetch")||t.includes("networkerror")||t.includes("network request failed")}return!1}const Jee=new ND({defaultOptions:{queries:{refetchInterval:6e4,staleTime:3e4,refetchIntervalInBackground:!1,retry:(e,t)=>aC(t)&&e<3},mutations:{retry:(e,t)=>aC(t)&&e<3,retryDelay:e=>Math.min(1e3*2**e,8e3)}}});vg.createRoot(document.getElementById("root")).render(l.jsx(J.StrictMode,{children:l.jsx(jD,{client:Jee,children:l.jsx(pM,{children:l.jsx(Gee,{})})})}));
|