panopticon-cli 0.4.5 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/README.md +84 -2695
  2. package/dist/{agents-B5NRTVHK.js → agents-54LDKMHR.js} +8 -3
  3. package/dist/chunk-44EOY2ZL.js +58 -0
  4. package/dist/chunk-44EOY2ZL.js.map +1 -0
  5. package/dist/chunk-BWGFN44T.js +224 -0
  6. package/dist/chunk-BWGFN44T.js.map +1 -0
  7. package/dist/chunk-F7NQZD6H.js +49 -0
  8. package/dist/chunk-F7NQZD6H.js.map +1 -0
  9. package/dist/chunk-HCTJFIJJ.js +159 -0
  10. package/dist/chunk-HCTJFIJJ.js.map +1 -0
  11. package/dist/chunk-JM6V62LT.js +650 -0
  12. package/dist/chunk-JM6V62LT.js.map +1 -0
  13. package/dist/chunk-K45YD6A3.js +254 -0
  14. package/dist/chunk-K45YD6A3.js.map +1 -0
  15. package/dist/chunk-KGPRXDMX.js +137 -0
  16. package/dist/chunk-KGPRXDMX.js.map +1 -0
  17. package/dist/chunk-KQAEUOML.js +278 -0
  18. package/dist/chunk-KQAEUOML.js.map +1 -0
  19. package/dist/chunk-NYVQC3D7.js +90 -0
  20. package/dist/chunk-NYVQC3D7.js.map +1 -0
  21. package/dist/chunk-PUR532O7.js +1556 -0
  22. package/dist/chunk-PUR532O7.js.map +1 -0
  23. package/dist/chunk-VTDDVLCK.js +1977 -0
  24. package/dist/chunk-VTDDVLCK.js.map +1 -0
  25. package/dist/chunk-Z24TY3XN.js +916 -0
  26. package/dist/chunk-Z24TY3XN.js.map +1 -0
  27. package/dist/chunk-ZHC57RCV.js +44 -0
  28. package/dist/chunk-ZHC57RCV.js.map +1 -0
  29. package/dist/{chunk-ITI4IC5A.js → chunk-ZZ3477GY.js} +69 -100
  30. package/dist/chunk-ZZ3477GY.js.map +1 -0
  31. package/dist/cli/index.js +4664 -2912
  32. package/dist/cli/index.js.map +1 -1
  33. package/dist/dashboard/public/assets/index-CRqsEkmn.css +32 -0
  34. package/dist/dashboard/public/assets/index-DPSUbu4A.js +645 -0
  35. package/dist/dashboard/public/index.html +15 -3
  36. package/dist/dashboard/server.js +45663 -17860
  37. package/dist/dns-L3L2BB27.js +30 -0
  38. package/dist/dns-L3L2BB27.js.map +1 -0
  39. package/dist/index.d.ts +63 -3
  40. package/dist/index.js +42 -18
  41. package/dist/index.js.map +1 -1
  42. package/dist/projects-ESIB34QQ.js +43 -0
  43. package/dist/projects-ESIB34QQ.js.map +1 -0
  44. package/dist/remote-agents-Z3R2A5BN.js +25 -0
  45. package/dist/remote-agents-Z3R2A5BN.js.map +1 -0
  46. package/dist/remote-workspace-HI4VML6H.js +179 -0
  47. package/dist/remote-workspace-HI4VML6H.js.map +1 -0
  48. package/dist/specialist-context-SNCJ7O7G.js +256 -0
  49. package/dist/specialist-context-SNCJ7O7G.js.map +1 -0
  50. package/dist/specialist-logs-A7ODEK2T.js +43 -0
  51. package/dist/specialist-logs-A7ODEK2T.js.map +1 -0
  52. package/dist/specialists-C7XLNSXQ.js +121 -0
  53. package/dist/specialists-C7XLNSXQ.js.map +1 -0
  54. package/dist/traefik-WI3KSRGG.js +12 -0
  55. package/dist/traefik-WI3KSRGG.js.map +1 -0
  56. package/package.json +2 -1
  57. package/skills/beads/README.md +120 -0
  58. package/skills/beads/SKILL.md +214 -0
  59. package/skills/beads/adr/0001-bd-prime-as-source-of-truth.md +59 -0
  60. package/skills/beads/resources/AGENTS.md +62 -0
  61. package/skills/beads/resources/ASYNC_GATES.md +168 -0
  62. package/skills/beads/resources/BOUNDARIES.md +469 -0
  63. package/skills/beads/resources/CHEMISTRY_PATTERNS.md +197 -0
  64. package/skills/beads/resources/CLI_REFERENCE.md +558 -0
  65. package/skills/beads/resources/DEPENDENCIES.md +747 -0
  66. package/skills/beads/resources/INTEGRATION_PATTERNS.md +407 -0
  67. package/skills/beads/resources/ISSUE_CREATION.md +139 -0
  68. package/skills/beads/resources/MOLECULES.md +354 -0
  69. package/skills/beads/resources/PATTERNS.md +341 -0
  70. package/skills/beads/resources/RESUMABILITY.md +207 -0
  71. package/skills/beads/resources/STATIC_DATA.md +54 -0
  72. package/skills/beads/resources/TROUBLESHOOTING.md +489 -0
  73. package/skills/beads/resources/WORKFLOWS.md +623 -0
  74. package/skills/beads/resources/WORKTREES.md +94 -0
  75. package/skills/beads-completion-check/SKILL.md +90 -0
  76. package/skills/beads-panopticon-guide/SKILL.md +171 -0
  77. package/skills/bug-fix/SKILL.md +32 -0
  78. package/skills/clear-writing/SKILL.md +105 -0
  79. package/skills/clear-writing/references/elements-of-style/01-introductory.md +3 -0
  80. package/skills/clear-writing/references/elements-of-style/02-elementary-rules-of-usage.md +214 -0
  81. package/skills/clear-writing/references/elements-of-style/03-elementary-principles-of-composition.md +398 -0
  82. package/skills/clear-writing/references/elements-of-style/04-a-few-matters-of-form.md +89 -0
  83. package/skills/clear-writing/references/elements-of-style/05-words-and-expressions-commonly-misused.md +342 -0
  84. package/skills/clear-writing/references/signs-of-ai-writing.md +901 -0
  85. package/skills/code-review/SKILL.md +37 -0
  86. package/skills/code-review-performance/SKILL.md +53 -0
  87. package/skills/code-review-security/SKILL.md +35 -0
  88. package/skills/dependency-update/SKILL.md +30 -0
  89. package/skills/feature-work/SKILL.md +39 -0
  90. package/skills/incident-response/SKILL.md +32 -0
  91. package/skills/knowledge-capture/SKILL.md +463 -0
  92. package/skills/onboard-codebase/SKILL.md +34 -0
  93. package/skills/opus-plan/SKILL.md +400 -0
  94. package/skills/pan-approve/SKILL.md +136 -0
  95. package/skills/pan-code-review/SKILL.md +249 -0
  96. package/skills/pan-config/SKILL.md +164 -0
  97. package/skills/pan-convoy-synthesis/SKILL.md +249 -0
  98. package/skills/pan-diagnose/SKILL.md +360 -0
  99. package/skills/pan-docker/SKILL.md +279 -0
  100. package/skills/pan-docs/SKILL.md +113 -0
  101. package/skills/pan-down/SKILL.md +434 -0
  102. package/skills/pan-health/SKILL.md +240 -0
  103. package/skills/pan-help/SKILL.md +237 -0
  104. package/skills/pan-install/SKILL.md +339 -0
  105. package/skills/pan-issue/SKILL.md +596 -0
  106. package/skills/pan-kill/SKILL.md +172 -0
  107. package/skills/pan-logs/SKILL.md +255 -0
  108. package/skills/pan-network/SKILL.md +320 -0
  109. package/skills/pan-oversee/SKILL.md +290 -0
  110. package/skills/pan-plan/SKILL.md +521 -0
  111. package/skills/pan-projects/SKILL.md +239 -0
  112. package/skills/pan-quickstart/SKILL.md +440 -0
  113. package/skills/pan-reload/SKILL.md +44 -0
  114. package/skills/pan-rescue/SKILL.md +271 -0
  115. package/skills/pan-restart/SKILL.md +53 -0
  116. package/skills/pan-setup/SKILL.md +478 -0
  117. package/skills/pan-skill-creator/SKILL.md +168 -0
  118. package/skills/pan-skill-creator/references/output-patterns.md +141 -0
  119. package/skills/pan-skill-creator/references/workflows.md +90 -0
  120. package/skills/pan-skill-creator/scripts/init_skill.py +176 -0
  121. package/skills/pan-status/SKILL.md +493 -0
  122. package/skills/pan-subagent-creator/SKILL.md +295 -0
  123. package/skills/pan-subagent-creator/assets/validate-readonly-query.sh +35 -0
  124. package/skills/pan-subagent-creator/references/example-agents.md +308 -0
  125. package/skills/pan-subagent-creator/scripts/init_agent.py +126 -0
  126. package/skills/pan-sync/SKILL.md +272 -0
  127. package/skills/pan-tell/SKILL.md +157 -0
  128. package/skills/pan-test-config/SKILL.md +208 -0
  129. package/skills/pan-tracker/SKILL.md +288 -0
  130. package/skills/pan-up/SKILL.md +458 -0
  131. package/skills/pan-workspace-config/SKILL.md +303 -0
  132. package/skills/refactor/SKILL.md +30 -0
  133. package/skills/refactor-radar/SKILL.md +475 -0
  134. package/skills/release/SKILL.md +25 -0
  135. package/skills/send-feedback-to-agent/SKILL.md +98 -0
  136. package/skills/session-health/SKILL.md +76 -0
  137. package/skills/session-health/scripts/check_sessions.py +166 -0
  138. package/skills/skill-creator/SKILL.md +92 -0
  139. package/skills/skill-creator/scripts/init_skill.py +152 -0
  140. package/skills/skill-creator/scripts/package_skill.py +123 -0
  141. package/skills/stitch-design-md/README.md +34 -0
  142. package/skills/stitch-design-md/SKILL.md +172 -0
  143. package/skills/stitch-design-md/examples/DESIGN.md +154 -0
  144. package/skills/stitch-react-components/README.md +36 -0
  145. package/skills/stitch-react-components/SKILL.md +47 -0
  146. package/skills/stitch-react-components/examples/gold-standard-card.tsx +80 -0
  147. package/skills/stitch-react-components/package-lock.json +231 -0
  148. package/skills/stitch-react-components/package.json +16 -0
  149. package/skills/stitch-react-components/resources/architecture-checklist.md +15 -0
  150. package/skills/stitch-react-components/resources/component-template.tsx +37 -0
  151. package/skills/stitch-react-components/resources/stitch-api-reference.md +14 -0
  152. package/skills/stitch-react-components/resources/style-guide.json +27 -0
  153. package/skills/stitch-react-components/scripts/fetch-stitch.sh +30 -0
  154. package/skills/stitch-react-components/scripts/validate.js +68 -0
  155. package/skills/stitch-setup/SKILL.md +94 -0
  156. package/skills/web-design-guidelines/SKILL.md +39 -0
  157. package/skills/work-complete/SKILL.md +79 -0
  158. package/templates/traefik/docker-compose.yml +1 -1
  159. package/templates/traefik/dynamic/panopticon.yml.template +41 -0
  160. package/templates/traefik/traefik.yml +8 -0
  161. package/dist/chunk-7HHDVXBM.js +0 -349
  162. package/dist/chunk-7HHDVXBM.js.map +0 -1
  163. package/dist/chunk-H45CLB7E.js +0 -2044
  164. package/dist/chunk-H45CLB7E.js.map +0 -1
  165. package/dist/chunk-ITI4IC5A.js.map +0 -1
  166. package/dist/dashboard/public/assets/index-BDd8hGYb.css +0 -32
  167. package/dist/dashboard/public/assets/index-sFwLPko-.js +0 -556
  168. package/templates/traefik/dynamic/panopticon.yml +0 -51
  169. /package/dist/{agents-B5NRTVHK.js.map → agents-54LDKMHR.js.map} +0 -0
@@ -1,556 +0,0 @@
1
- var ng=e=>{throw TypeError(e)};var Ku=(e,t,r)=>t.has(e)||ng("Cannot "+r);var T=(e,t,r)=>(Ku(e,t,"read from private field"),r?r.call(e):t.get(e)),ne=(e,t,r)=>t.has(e)?ng("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),J=(e,t,r,n)=>(Ku(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),he=(e,t,r)=>(Ku(e,t,"access private method"),r);var xl=(e,t,r,n)=>({set _(i){J(e,t,i,r)},get _(){return T(e,t,n)}});function w1(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var jc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function b1(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var ox={exports:{}},du={},ax={exports:{}},ge={};/**
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 nl=Symbol.for("react.element"),S1=Symbol.for("react.portal"),C1=Symbol.for("react.fragment"),k1=Symbol.for("react.strict_mode"),N1=Symbol.for("react.profiler"),E1=Symbol.for("react.provider"),j1=Symbol.for("react.context"),P1=Symbol.for("react.forward_ref"),R1=Symbol.for("react.suspense"),M1=Symbol.for("react.memo"),T1=Symbol.for("react.lazy"),ig=Symbol.iterator;function D1(e){return e===null||typeof e!="object"?null:(e=ig&&e[ig]||e["@@iterator"],typeof e=="function"?e:null)}var lx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},cx=Object.assign,ux={};function ko(e,t,r){this.props=e,this.context=t,this.refs=ux,this.updater=r||lx}ko.prototype.isReactComponent={};ko.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")};ko.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function hx(){}hx.prototype=ko.prototype;function yp(e,t,r){this.props=e,this.context=t,this.refs=ux,this.updater=r||lx}var vp=yp.prototype=new hx;vp.constructor=yp;cx(vp,ko.prototype);vp.isPureReactComponent=!0;var sg=Array.isArray,dx=Object.prototype.hasOwnProperty,xp={current:null},fx={key:!0,ref:!0,__self:!0,__source:!0};function px(e,t,r){var n,i={},s=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)dx.call(t,n)&&!fx.hasOwnProperty(n)&&(i[n]=t[n]);var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){for(var u=Array(l),c=0;c<l;c++)u[c]=arguments[c+2];i.children=u}if(e&&e.defaultProps)for(n in l=e.defaultProps,l)i[n]===void 0&&(i[n]=l[n]);return{$$typeof:nl,type:e,key:s,ref:o,props:i,_owner:xp.current}}function L1(e,t){return{$$typeof:nl,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function _p(e){return typeof e=="object"&&e!==null&&e.$$typeof===nl}function A1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var og=/\/+/g;function qu(e,t){return typeof e=="object"&&e!==null&&e.key!=null?A1(""+e.key):t.toString(36)}function nc(e,t,r,n,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case nl:case S1:o=!0}}if(o)return o=e,i=i(o),e=n===""?"."+qu(o,0):n,sg(i)?(r="",e!=null&&(r=e.replace(og,"$&/")+"/"),nc(i,t,r,"",function(c){return c})):i!=null&&(_p(i)&&(i=L1(i,r+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(og,"$&/")+"/")+e)),t.push(i)),1;if(o=0,n=n===""?".":n+":",sg(e))for(var l=0;l<e.length;l++){s=e[l];var u=n+qu(s,l);o+=nc(s,t,r,u,i)}else if(u=D1(e),typeof u=="function")for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=n+qu(s,l++),o+=nc(s,t,r,u,i);else if(s==="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 _l(e,t,r){if(e==null)return e;var n=[],i=0;return nc(e,n,"","",function(s){return t.call(r,s,i++)}),n}function O1(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ot={current:null},ic={transition:null},I1={ReactCurrentDispatcher:Ot,ReactCurrentBatchConfig:ic,ReactCurrentOwner:xp};function mx(){throw Error("act(...) is not supported in production builds of React.")}ge.Children={map:_l,forEach:function(e,t,r){_l(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return _l(e,function(){t++}),t},toArray:function(e){return _l(e,function(t){return t})||[]},only:function(e){if(!_p(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ge.Component=ko;ge.Fragment=C1;ge.Profiler=N1;ge.PureComponent=yp;ge.StrictMode=k1;ge.Suspense=R1;ge.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I1;ge.act=mx;ge.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=cx({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=xp.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(u in t)dx.call(t,u)&&!fx.hasOwnProperty(u)&&(n[u]=t[u]===void 0&&l!==void 0?l[u]:t[u])}var u=arguments.length-2;if(u===1)n.children=r;else if(1<u){l=Array(u);for(var c=0;c<u;c++)l[c]=arguments[c+2];n.children=l}return{$$typeof:nl,type:e.type,key:i,ref:s,props:n,_owner:o}};ge.createContext=function(e){return e={$$typeof:j1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:E1,_context:e},e.Consumer=e};ge.createElement=px;ge.createFactory=function(e){var t=px.bind(null,e);return t.type=e,t};ge.createRef=function(){return{current:null}};ge.forwardRef=function(e){return{$$typeof:P1,render:e}};ge.isValidElement=_p;ge.lazy=function(e){return{$$typeof:T1,_payload:{_status:-1,_result:e},_init:O1}};ge.memo=function(e,t){return{$$typeof:M1,type:e,compare:t===void 0?null:t}};ge.startTransition=function(e){var t=ic.transition;ic.transition={};try{e()}finally{ic.transition=t}};ge.unstable_act=mx;ge.useCallback=function(e,t){return Ot.current.useCallback(e,t)};ge.useContext=function(e){return Ot.current.useContext(e)};ge.useDebugValue=function(){};ge.useDeferredValue=function(e){return Ot.current.useDeferredValue(e)};ge.useEffect=function(e,t){return Ot.current.useEffect(e,t)};ge.useId=function(){return Ot.current.useId()};ge.useImperativeHandle=function(e,t,r){return Ot.current.useImperativeHandle(e,t,r)};ge.useInsertionEffect=function(e,t){return Ot.current.useInsertionEffect(e,t)};ge.useLayoutEffect=function(e,t){return Ot.current.useLayoutEffect(e,t)};ge.useMemo=function(e,t){return Ot.current.useMemo(e,t)};ge.useReducer=function(e,t,r){return Ot.current.useReducer(e,t,r)};ge.useRef=function(e){return Ot.current.useRef(e)};ge.useState=function(e){return Ot.current.useState(e)};ge.useSyncExternalStore=function(e,t,r){return Ot.current.useSyncExternalStore(e,t,r)};ge.useTransition=function(){return Ot.current.useTransition()};ge.version="18.3.1";ax.exports=ge;var w=ax.exports;const gx=rl(w),wp=w1({__proto__:null,default:gx},[w]);/**
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 F1=w,B1=Symbol.for("react.element"),z1=Symbol.for("react.fragment"),$1=Object.prototype.hasOwnProperty,H1=F1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,W1={key:!0,ref:!0,__self:!0,__source:!0};function yx(e,t,r){var n,i={},s=null,o=null;r!==void 0&&(s=""+r),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)$1.call(t,n)&&!W1.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:B1,type:e,key:s,ref:o,props:i,_owner:H1.current}}du.Fragment=z1;du.jsx=yx;du.jsxs=yx;ox.exports=du;var a=ox.exports,sd={},vx={exports:{}},fr={},xx={exports:{}},_x={};/**
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(E,F){var k=E.length;E.push(F);e:for(;0<k;){var V=k-1>>>1,M=E[V];if(0<i(M,F))E[V]=F,E[k]=M,k=V;else break e}}function r(E){return E.length===0?null:E[0]}function n(E){if(E.length===0)return null;var F=E[0],k=E.pop();if(k!==F){E[0]=k;e:for(var V=0,M=E.length,b=M>>>1;V<b;){var H=2*(V+1)-1,K=E[H],X=H+1,ie=E[X];if(0>i(K,k))X<M&&0>i(ie,K)?(E[V]=ie,E[X]=k,V=X):(E[V]=K,E[H]=k,V=H);else if(X<M&&0>i(ie,k))E[V]=ie,E[X]=k,V=X;else break e}}return F}function i(E,F){var k=E.sortIndex-F.sortIndex;return k!==0?k:E.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var u=[],c=[],h=1,d=null,f=3,p=!1,m=!1,x=!1,C=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(E){for(var F=r(c);F!==null;){if(F.callback===null)n(c);else if(F.startTime<=E)n(c),F.sortIndex=F.expirationTime,t(u,F);else break;F=r(c)}}function _(E){if(x=!1,g(E),!m)if(r(u)!==null)m=!0,B(N);else{var F=r(c);F!==null&&O(_,F.startTime-E)}}function N(E,F){m=!1,x&&(x=!1,y(A),A=-1),p=!0;var k=f;try{for(g(F),d=r(u);d!==null&&(!(d.expirationTime>F)||E&&!I());){var V=d.callback;if(typeof V=="function"){d.callback=null,f=d.priorityLevel;var M=V(d.expirationTime<=F);F=e.unstable_now(),typeof M=="function"?d.callback=M:d===r(u)&&n(u),g(F)}else n(u);d=r(u)}if(d!==null)var b=!0;else{var H=r(c);H!==null&&O(_,H.startTime-F),b=!1}return b}finally{d=null,f=k,p=!1}}var S=!1,j=null,A=-1,$=5,z=-1;function I(){return!(e.unstable_now()-z<$)}function P(){if(j!==null){var E=e.unstable_now();z=E;var F=!0;try{F=j(!0,E)}finally{F?R():(S=!1,j=null)}}else S=!1}var R;if(typeof v=="function")R=function(){v(P)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,L=D.port2;D.port1.onmessage=P,R=function(){L.postMessage(null)}}else R=function(){C(P,0)};function B(E){j=E,S||(S=!0,R())}function O(E,F){A=C(function(){E(e.unstable_now())},F)}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(E){E.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,B(N))},e.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<E?Math.floor(1e3/E):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(u)},e.unstable_next=function(E){switch(f){case 1:case 2:case 3:var F=3;break;default:F=f}var k=f;f=F;try{return E()}finally{f=k}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(E,F){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var k=f;f=E;try{return F()}finally{f=k}},e.unstable_scheduleCallback=function(E,F,k){var V=e.unstable_now();switch(typeof k=="object"&&k!==null?(k=k.delay,k=typeof k=="number"&&0<k?V+k:V):k=V,E){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,E={id:h++,callback:F,priorityLevel:E,startTime:k,expirationTime:M,sortIndex:-1},k>V?(E.sortIndex=k,t(c,E),r(u)===null&&E===r(c)&&(x?(y(A),A=-1):x=!0,O(_,k-V))):(E.sortIndex=M,t(u,E),m||p||(m=!0,B(N))),E},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(E){var F=f;return function(){var k=f;f=F;try{return E.apply(this,arguments)}finally{f=k}}}})(_x);xx.exports=_x;var U1=xx.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 K1=w,dr=U1;function q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);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 wx=new Set,Ca={};function fs(e,t){mo(e,t),mo(e+"Capture",t)}function mo(e,t){for(Ca[e]=t,e=0;e<t.length;e++)wx.add(t[e])}var jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),od=Object.prototype.hasOwnProperty,q1=/^[: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]*$/,ag={},lg={};function V1(e){return od.call(lg,e)?!0:od.call(ag,e)?!1:q1.test(e)?lg[e]=!0:(ag[e]=!0,!1)}function Q1(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Y1(e,t,r,n){if(t===null||typeof t>"u"||Q1(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.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 It(e,t,r,n,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var xt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){xt[e]=new It(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];xt[t]=new It(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){xt[e]=new It(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){xt[e]=new It(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){xt[e]=new It(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){xt[e]=new It(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){xt[e]=new It(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){xt[e]=new It(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){xt[e]=new It(e,5,!1,e.toLowerCase(),null,!1,!1)});var bp=/[\-:]([a-z])/g;function Sp(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(bp,Sp);xt[t]=new It(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(bp,Sp);xt[t]=new It(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(bp,Sp);xt[t]=new It(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){xt[e]=new It(e,1,!1,e.toLowerCase(),null,!1,!1)});xt.xlinkHref=new It("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){xt[e]=new It(e,1,!1,e.toLowerCase(),null,!0,!0)});function Cp(e,t,r,n){var i=xt.hasOwnProperty(t)?xt[t]:null;(i!==null?i.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Y1(t,r,i,n)&&(r=null),n||i===null?V1(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):i.mustUseProperty?e[i.propertyName]=r===null?i.type===3?!1:"":r:(t=i.attributeName,n=i.attributeNamespace,r===null?e.removeAttribute(t):(i=i.type,r=i===3||i===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var Dn=K1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,wl=Symbol.for("react.element"),Ts=Symbol.for("react.portal"),Ds=Symbol.for("react.fragment"),kp=Symbol.for("react.strict_mode"),ad=Symbol.for("react.profiler"),bx=Symbol.for("react.provider"),Sx=Symbol.for("react.context"),Np=Symbol.for("react.forward_ref"),ld=Symbol.for("react.suspense"),cd=Symbol.for("react.suspense_list"),Ep=Symbol.for("react.memo"),Kn=Symbol.for("react.lazy"),Cx=Symbol.for("react.offscreen"),cg=Symbol.iterator;function Ao(e){return e===null||typeof e!="object"?null:(e=cg&&e[cg]||e["@@iterator"],typeof e=="function"?e:null)}var ze=Object.assign,Vu;function Zo(e){if(Vu===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Vu=t&&t[1]||""}return`
34
- `+Vu+e}var Qu=!1;function Yu(e,t){if(!e||Qu)return"";Qu=!0;var r=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(c){var n=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){n=c}e.call(t.prototype)}else{try{throw Error()}catch(c){n=c}e()}}catch(c){if(c&&n&&typeof c.stack=="string"){for(var i=c.stack.split(`
35
- `),s=n.stack.split(`
36
- `),o=i.length-1,l=s.length-1;1<=o&&0<=l&&i[o]!==s[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==s[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==s[l]){var u=`
37
- `+i[o].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=o&&0<=l);break}}}finally{Qu=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Zo(e):""}function G1(e){switch(e.tag){case 5:return Zo(e.type);case 16:return Zo("Lazy");case 13:return Zo("Suspense");case 19:return Zo("SuspenseList");case 0:case 2:case 15:return e=Yu(e.type,!1),e;case 11:return e=Yu(e.type.render,!1),e;case 1:return e=Yu(e.type,!0),e;default:return""}}function ud(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 Ds:return"Fragment";case Ts:return"Portal";case ad:return"Profiler";case kp:return"StrictMode";case ld:return"Suspense";case cd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Sx:return(e.displayName||"Context")+".Consumer";case bx:return(e._context.displayName||"Context")+".Provider";case Np:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ep:return t=e.displayName||null,t!==null?t:ud(e.type)||"Memo";case Kn:t=e._payload,e=e._init;try{return ud(e(t))}catch{}}return null}function X1(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 ud(t);case 8:return t===kp?"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 _i(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function kx(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function J1(e){var t=kx(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function bl(e){e._valueTracker||(e._valueTracker=J1(e))}function Nx(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=kx(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Pc(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 hd(e,t){var r=t.checked;return ze({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function ug(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=_i(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ex(e,t){t=t.checked,t!=null&&Cp(e,"checked",t,!1)}function dd(e,t){Ex(e,t);var r=_i(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?fd(e,t.type,r):t.hasOwnProperty("defaultValue")&&fd(e,t.type,_i(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function hg(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function fd(e,t,r){(t!=="number"||Pc(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var ea=Array.isArray;function Vs(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i<r.length;i++)t["$"+r[i]]=!0;for(r=0;r<e.length;r++)i=t.hasOwnProperty("$"+e[r].value),e[r].selected!==i&&(e[r].selected=i),i&&n&&(e[r].defaultSelected=!0)}else{for(r=""+_i(r),t=null,i=0;i<e.length;i++){if(e[i].value===r){e[i].selected=!0,n&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function pd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(q(91));return ze({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function dg(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(q(92));if(ea(r)){if(1<r.length)throw Error(q(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:_i(r)}}function jx(e,t){var r=_i(t.value),n=_i(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function fg(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Px(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 md(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Px(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Sl,Rx=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,i){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Sl=Sl||document.createElement("div"),Sl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Sl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ka(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var ca={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},Z1=["Webkit","ms","Moz","O"];Object.keys(ca).forEach(function(e){Z1.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ca[t]=ca[e]})});function Mx(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||ca.hasOwnProperty(e)&&ca[e]?(""+t).trim():t+"px"}function Tx(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=Mx(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var eC=ze({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 gd(e,t){if(t){if(eC[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(q(62))}}function yd(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 vd=null;function jp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xd=null,Qs=null,Ys=null;function pg(e){if(e=ol(e)){if(typeof xd!="function")throw Error(q(280));var t=e.stateNode;t&&(t=yu(t),xd(e.stateNode,e.type,t))}}function Dx(e){Qs?Ys?Ys.push(e):Ys=[e]:Qs=e}function Lx(){if(Qs){var e=Qs,t=Ys;if(Ys=Qs=null,pg(e),t)for(e=0;e<t.length;e++)pg(t[e])}}function Ax(e,t){return e(t)}function Ox(){}var Gu=!1;function Ix(e,t,r){if(Gu)return e(t,r);Gu=!0;try{return Ax(e,t,r)}finally{Gu=!1,(Qs!==null||Ys!==null)&&(Ox(),Lx())}}function Na(e,t){var r=e.stateNode;if(r===null)return null;var n=yu(r);if(n===null)return null;r=n[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":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(q(231,t,typeof r));return r}var _d=!1;if(jn)try{var Oo={};Object.defineProperty(Oo,"passive",{get:function(){_d=!0}}),window.addEventListener("test",Oo,Oo),window.removeEventListener("test",Oo,Oo)}catch{_d=!1}function tC(e,t,r,n,i,s,o,l,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(r,c)}catch(h){this.onError(h)}}var ua=!1,Rc=null,Mc=!1,wd=null,rC={onError:function(e){ua=!0,Rc=e}};function nC(e,t,r,n,i,s,o,l,u){ua=!1,Rc=null,tC.apply(rC,arguments)}function iC(e,t,r,n,i,s,o,l,u){if(nC.apply(this,arguments),ua){if(ua){var c=Rc;ua=!1,Rc=null}else throw Error(q(198));Mc||(Mc=!0,wd=c)}}function ps(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function Fx(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 mg(e){if(ps(e)!==e)throw Error(q(188))}function sC(e){var t=e.alternate;if(!t){if(t=ps(e),t===null)throw Error(q(188));return t!==e?null:e}for(var r=e,n=t;;){var i=r.return;if(i===null)break;var s=i.alternate;if(s===null){if(n=i.return,n!==null){r=n;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===r)return mg(i),e;if(s===n)return mg(i),t;s=s.sibling}throw Error(q(188))}if(r.return!==n.return)r=i,n=s;else{for(var o=!1,l=i.child;l;){if(l===r){o=!0,r=i,n=s;break}if(l===n){o=!0,n=i,r=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===r){o=!0,r=s,n=i;break}if(l===n){o=!0,n=s,r=i;break}l=l.sibling}if(!o)throw Error(q(189))}}if(r.alternate!==n)throw Error(q(190))}if(r.tag!==3)throw Error(q(188));return r.stateNode.current===r?e:t}function Bx(e){return e=sC(e),e!==null?zx(e):null}function zx(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=zx(e);if(t!==null)return t;e=e.sibling}return null}var $x=dr.unstable_scheduleCallback,gg=dr.unstable_cancelCallback,oC=dr.unstable_shouldYield,aC=dr.unstable_requestPaint,Ve=dr.unstable_now,lC=dr.unstable_getCurrentPriorityLevel,Pp=dr.unstable_ImmediatePriority,Hx=dr.unstable_UserBlockingPriority,Tc=dr.unstable_NormalPriority,cC=dr.unstable_LowPriority,Wx=dr.unstable_IdlePriority,fu=null,rn=null;function uC(e){if(rn&&typeof rn.onCommitFiberRoot=="function")try{rn.onCommitFiberRoot(fu,e,void 0,(e.current.flags&128)===128)}catch{}}var Ir=Math.clz32?Math.clz32:fC,hC=Math.log,dC=Math.LN2;function fC(e){return e>>>=0,e===0?32:31-(hC(e)/dC|0)|0}var Cl=64,kl=4194304;function ta(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 Dc(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,s=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~i;l!==0?n=ta(l):(s&=o,s!==0&&(n=ta(s)))}else o=r&~i,o!==0?n=ta(o):s!==0&&(n=ta(s));if(n===0)return 0;if(t!==0&&t!==n&&!(t&i)&&(i=n&-n,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-Ir(t),i=1<<r,n|=e[r],t&=~i;return n}function pC(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 mC(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Ir(s),l=1<<o,u=i[o];u===-1?(!(l&r)||l&n)&&(i[o]=pC(l,t)):u<=t&&(e.expiredLanes|=l),s&=~l}}function bd(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Ux(){var e=Cl;return Cl<<=1,!(Cl&4194240)&&(Cl=64),e}function Xu(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function il(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ir(t),e[t]=r}function gC(e,t){var r=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 n=e.eventTimes;for(e=e.expirationTimes;0<r;){var i=31-Ir(r),s=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~s}}function Rp(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Ir(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var ke=0;function Kx(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var qx,Mp,Vx,Qx,Yx,Sd=!1,Nl=[],ci=null,ui=null,hi=null,Ea=new Map,ja=new Map,Qn=[],yC="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 yg(e,t){switch(e){case"focusin":case"focusout":ci=null;break;case"dragenter":case"dragleave":ui=null;break;case"mouseover":case"mouseout":hi=null;break;case"pointerover":case"pointerout":Ea.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ja.delete(t.pointerId)}}function Io(e,t,r,n,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:s,targetContainers:[i]},t!==null&&(t=ol(t),t!==null&&Mp(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function vC(e,t,r,n,i){switch(t){case"focusin":return ci=Io(ci,e,t,r,n,i),!0;case"dragenter":return ui=Io(ui,e,t,r,n,i),!0;case"mouseover":return hi=Io(hi,e,t,r,n,i),!0;case"pointerover":var s=i.pointerId;return Ea.set(s,Io(Ea.get(s)||null,e,t,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,ja.set(s,Io(ja.get(s)||null,e,t,r,n,i)),!0}return!1}function Gx(e){var t=Ii(e.target);if(t!==null){var r=ps(t);if(r!==null){if(t=r.tag,t===13){if(t=Fx(r),t!==null){e.blockedOn=t,Yx(e.priority,function(){Vx(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function sc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Cd(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);vd=n,r.target.dispatchEvent(n),vd=null}else return t=ol(r),t!==null&&Mp(t),e.blockedOn=r,!1;t.shift()}return!0}function vg(e,t,r){sc(e)&&r.delete(t)}function xC(){Sd=!1,ci!==null&&sc(ci)&&(ci=null),ui!==null&&sc(ui)&&(ui=null),hi!==null&&sc(hi)&&(hi=null),Ea.forEach(vg),ja.forEach(vg)}function Fo(e,t){e.blockedOn===t&&(e.blockedOn=null,Sd||(Sd=!0,dr.unstable_scheduleCallback(dr.unstable_NormalPriority,xC)))}function Pa(e){function t(i){return Fo(i,e)}if(0<Nl.length){Fo(Nl[0],e);for(var r=1;r<Nl.length;r++){var n=Nl[r];n.blockedOn===e&&(n.blockedOn=null)}}for(ci!==null&&Fo(ci,e),ui!==null&&Fo(ui,e),hi!==null&&Fo(hi,e),Ea.forEach(t),ja.forEach(t),r=0;r<Qn.length;r++)n=Qn[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Qn.length&&(r=Qn[0],r.blockedOn===null);)Gx(r),r.blockedOn===null&&Qn.shift()}var Gs=Dn.ReactCurrentBatchConfig,Lc=!0;function _C(e,t,r,n){var i=ke,s=Gs.transition;Gs.transition=null;try{ke=1,Tp(e,t,r,n)}finally{ke=i,Gs.transition=s}}function wC(e,t,r,n){var i=ke,s=Gs.transition;Gs.transition=null;try{ke=4,Tp(e,t,r,n)}finally{ke=i,Gs.transition=s}}function Tp(e,t,r,n){if(Lc){var i=Cd(e,t,r,n);if(i===null)ah(e,t,n,Ac,r),yg(e,n);else if(vC(i,e,t,r,n))n.stopPropagation();else if(yg(e,n),t&4&&-1<yC.indexOf(e)){for(;i!==null;){var s=ol(i);if(s!==null&&qx(s),s=Cd(e,t,r,n),s===null&&ah(e,t,n,Ac,r),s===i)break;i=s}i!==null&&n.stopPropagation()}else ah(e,t,n,null,r)}}var Ac=null;function Cd(e,t,r,n){if(Ac=null,e=jp(n),e=Ii(e),e!==null)if(t=ps(e),t===null)e=null;else if(r=t.tag,r===13){if(e=Fx(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ac=e,null}function Xx(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(lC()){case Pp:return 1;case Hx:return 4;case Tc:case cC:return 16;case Wx:return 536870912;default:return 16}default:return 16}}var oi=null,Dp=null,oc=null;function Jx(){if(oc)return oc;var e,t=Dp,r=t.length,n,i="value"in oi?oi.value:oi.textContent,s=i.length;for(e=0;e<r&&t[e]===i[e];e++);var o=r-e;for(n=1;n<=o&&t[r-n]===i[s-n];n++);return oc=i.slice(e,1<n?1-n:void 0)}function ac(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 El(){return!0}function xg(){return!1}function pr(e){function t(r,n,i,s,o){this._reactName=r,this._targetInst=i,this.type=n,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?El:xg,this.isPropagationStopped=xg,this}return ze(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=El)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=El)},persist:function(){},isPersistent:El}),t}var No={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Lp=pr(No),sl=ze({},No,{view:0,detail:0}),bC=pr(sl),Ju,Zu,Bo,pu=ze({},sl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ap,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!==Bo&&(Bo&&e.type==="mousemove"?(Ju=e.screenX-Bo.screenX,Zu=e.screenY-Bo.screenY):Zu=Ju=0,Bo=e),Ju)},movementY:function(e){return"movementY"in e?e.movementY:Zu}}),_g=pr(pu),SC=ze({},pu,{dataTransfer:0}),CC=pr(SC),kC=ze({},sl,{relatedTarget:0}),eh=pr(kC),NC=ze({},No,{animationName:0,elapsedTime:0,pseudoElement:0}),EC=pr(NC),jC=ze({},No,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),PC=pr(jC),RC=ze({},No,{data:0}),wg=pr(RC),MC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},TC={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"},DC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function LC(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=DC[e])?!!t[e]:!1}function Ap(){return LC}var AC=ze({},sl,{key:function(e){if(e.key){var t=MC[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ac(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?TC[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ap,charCode:function(e){return e.type==="keypress"?ac(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ac(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),OC=pr(AC),IC=ze({},pu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bg=pr(IC),FC=ze({},sl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ap}),BC=pr(FC),zC=ze({},No,{propertyName:0,elapsedTime:0,pseudoElement:0}),$C=pr(zC),HC=ze({},pu,{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}),WC=pr(HC),UC=[9,13,27,32],Op=jn&&"CompositionEvent"in window,ha=null;jn&&"documentMode"in document&&(ha=document.documentMode);var KC=jn&&"TextEvent"in window&&!ha,Zx=jn&&(!Op||ha&&8<ha&&11>=ha),Sg=" ",Cg=!1;function e_(e,t){switch(e){case"keyup":return UC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function t_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ls=!1;function qC(e,t){switch(e){case"compositionend":return t_(t);case"keypress":return t.which!==32?null:(Cg=!0,Sg);case"textInput":return e=t.data,e===Sg&&Cg?null:e;default:return null}}function VC(e,t){if(Ls)return e==="compositionend"||!Op&&e_(e,t)?(e=Jx(),oc=Dp=oi=null,Ls=!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 Zx&&t.locale!=="ko"?null:t.data;default:return null}}var QC={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 kg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!QC[e.type]:t==="textarea"}function r_(e,t,r,n){Dx(n),t=Oc(t,"onChange"),0<t.length&&(r=new Lp("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var da=null,Ra=null;function YC(e){f_(e,0)}function mu(e){var t=Is(e);if(Nx(t))return e}function GC(e,t){if(e==="change")return t}var n_=!1;if(jn){var th;if(jn){var rh="oninput"in document;if(!rh){var Ng=document.createElement("div");Ng.setAttribute("oninput","return;"),rh=typeof Ng.oninput=="function"}th=rh}else th=!1;n_=th&&(!document.documentMode||9<document.documentMode)}function Eg(){da&&(da.detachEvent("onpropertychange",i_),Ra=da=null)}function i_(e){if(e.propertyName==="value"&&mu(Ra)){var t=[];r_(t,Ra,e,jp(e)),Ix(YC,t)}}function XC(e,t,r){e==="focusin"?(Eg(),da=t,Ra=r,da.attachEvent("onpropertychange",i_)):e==="focusout"&&Eg()}function JC(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return mu(Ra)}function ZC(e,t){if(e==="click")return mu(t)}function ek(e,t){if(e==="input"||e==="change")return mu(t)}function tk(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Br=typeof Object.is=="function"?Object.is:tk;function Ma(e,t){if(Br(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var i=r[n];if(!od.call(t,i)||!Br(e[i],t[i]))return!1}return!0}function jg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Pg(e,t){var r=jg(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=jg(r)}}function s_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?s_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function o_(){for(var e=window,t=Pc();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Pc(e.document)}return t}function Ip(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 rk(e){var t=o_(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&s_(r.ownerDocument.documentElement,r)){if(n!==null&&Ip(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!e.extend&&s>n&&(i=n,n=s,s=i),i=Pg(r,s);var o=Pg(r,n);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var nk=jn&&"documentMode"in document&&11>=document.documentMode,As=null,kd=null,fa=null,Nd=!1;function Rg(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Nd||As==null||As!==Pc(n)||(n=As,"selectionStart"in n&&Ip(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),fa&&Ma(fa,n)||(fa=n,n=Oc(kd,"onSelect"),0<n.length&&(t=new Lp("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=As)))}function jl(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Os={animationend:jl("Animation","AnimationEnd"),animationiteration:jl("Animation","AnimationIteration"),animationstart:jl("Animation","AnimationStart"),transitionend:jl("Transition","TransitionEnd")},nh={},a_={};jn&&(a_=document.createElement("div").style,"AnimationEvent"in window||(delete Os.animationend.animation,delete Os.animationiteration.animation,delete Os.animationstart.animation),"TransitionEvent"in window||delete Os.transitionend.transition);function gu(e){if(nh[e])return nh[e];if(!Os[e])return e;var t=Os[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in a_)return nh[e]=t[r];return e}var l_=gu("animationend"),c_=gu("animationiteration"),u_=gu("animationstart"),h_=gu("transitionend"),d_=new Map,Mg="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 ki(e,t){d_.set(e,t),fs(t,[e])}for(var ih=0;ih<Mg.length;ih++){var sh=Mg[ih],ik=sh.toLowerCase(),sk=sh[0].toUpperCase()+sh.slice(1);ki(ik,"on"+sk)}ki(l_,"onAnimationEnd");ki(c_,"onAnimationIteration");ki(u_,"onAnimationStart");ki("dblclick","onDoubleClick");ki("focusin","onFocus");ki("focusout","onBlur");ki(h_,"onTransitionEnd");mo("onMouseEnter",["mouseout","mouseover"]);mo("onMouseLeave",["mouseout","mouseover"]);mo("onPointerEnter",["pointerout","pointerover"]);mo("onPointerLeave",["pointerout","pointerover"]);fs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));fs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));fs("onBeforeInput",["compositionend","keypress","textInput","paste"]);fs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));fs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));fs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ra="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(" "),ok=new Set("cancel close invalid load scroll toggle".split(" ").concat(ra));function Tg(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,iC(n,t,void 0,e),e.currentTarget=null}function f_(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],i=n.event;n=n.listeners;e:{var s=void 0;if(t)for(var o=n.length-1;0<=o;o--){var l=n[o],u=l.instance,c=l.currentTarget;if(l=l.listener,u!==s&&i.isPropagationStopped())break e;Tg(i,l,c),s=u}else for(o=0;o<n.length;o++){if(l=n[o],u=l.instance,c=l.currentTarget,l=l.listener,u!==s&&i.isPropagationStopped())break e;Tg(i,l,c),s=u}}}if(Mc)throw e=wd,Mc=!1,wd=null,e}function Me(e,t){var r=t[Md];r===void 0&&(r=t[Md]=new Set);var n=e+"__bubble";r.has(n)||(p_(t,e,2,!1),r.add(n))}function oh(e,t,r){var n=0;t&&(n|=4),p_(r,e,n,t)}var Pl="_reactListening"+Math.random().toString(36).slice(2);function Ta(e){if(!e[Pl]){e[Pl]=!0,wx.forEach(function(r){r!=="selectionchange"&&(ok.has(r)||oh(r,!1,e),oh(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Pl]||(t[Pl]=!0,oh("selectionchange",!1,t))}}function p_(e,t,r,n){switch(Xx(t)){case 1:var i=_C;break;case 4:i=wC;break;default:i=Tp}r=i.bind(null,t,r,e),i=void 0,!_d||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),n?i!==void 0?e.addEventListener(t,r,{capture:!0,passive:i}):e.addEventListener(t,r,!0):i!==void 0?e.addEventListener(t,r,{passive:i}):e.addEventListener(t,r,!1)}function ah(e,t,r,n,i){var s=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var l=n.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=n.return;o!==null;){var u=o.tag;if((u===3||u===4)&&(u=o.stateNode.containerInfo,u===i||u.nodeType===8&&u.parentNode===i))return;o=o.return}for(;l!==null;){if(o=Ii(l),o===null)return;if(u=o.tag,u===5||u===6){n=s=o;continue e}l=l.parentNode}}n=n.return}Ix(function(){var c=s,h=jp(r),d=[];e:{var f=d_.get(e);if(f!==void 0){var p=Lp,m=e;switch(e){case"keypress":if(ac(r)===0)break e;case"keydown":case"keyup":p=OC;break;case"focusin":m="focus",p=eh;break;case"focusout":m="blur",p=eh;break;case"beforeblur":case"afterblur":p=eh;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=_g;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=CC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=BC;break;case l_:case c_:case u_:p=EC;break;case h_:p=$C;break;case"scroll":p=bC;break;case"wheel":p=WC;break;case"copy":case"cut":case"paste":p=PC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=bg}var x=(t&4)!==0,C=!x&&e==="scroll",y=x?f!==null?f+"Capture":null:f;x=[];for(var v=c,g;v!==null;){g=v;var _=g.stateNode;if(g.tag===5&&_!==null&&(g=_,y!==null&&(_=Na(v,y),_!=null&&x.push(Da(v,_,g)))),C)break;v=v.return}0<x.length&&(f=new p(f,m,null,r,h),d.push({event:f,listeners:x}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==vd&&(m=r.relatedTarget||r.fromElement)&&(Ii(m)||m[Pn]))break e;if((p||f)&&(f=h.window===h?h:(f=h.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=r.relatedTarget||r.toElement,p=c,m=m?Ii(m):null,m!==null&&(C=ps(m),m!==C||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(x=_g,_="onMouseLeave",y="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(x=bg,_="onPointerLeave",y="onPointerEnter",v="pointer"),C=p==null?f:Is(p),g=m==null?f:Is(m),f=new x(_,v+"leave",p,r,h),f.target=C,f.relatedTarget=g,_=null,Ii(h)===c&&(x=new x(y,v+"enter",m,r,h),x.target=g,x.relatedTarget=C,_=x),C=_,p&&m)t:{for(x=p,y=m,v=0,g=x;g;g=ws(g))v++;for(g=0,_=y;_;_=ws(_))g++;for(;0<v-g;)x=ws(x),v--;for(;0<g-v;)y=ws(y),g--;for(;v--;){if(x===y||y!==null&&x===y.alternate)break t;x=ws(x),y=ws(y)}x=null}else x=null;p!==null&&Dg(d,f,p,x,!1),m!==null&&C!==null&&Dg(d,C,m,x,!0)}}e:{if(f=c?Is(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var N=GC;else if(kg(f))if(n_)N=ek;else{N=JC;var S=XC}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(N=ZC);if(N&&(N=N(e,c))){r_(d,N,r,h);break e}S&&S(e,f,c),e==="focusout"&&(S=f._wrapperState)&&S.controlled&&f.type==="number"&&fd(f,"number",f.value)}switch(S=c?Is(c):window,e){case"focusin":(kg(S)||S.contentEditable==="true")&&(As=S,kd=c,fa=null);break;case"focusout":fa=kd=As=null;break;case"mousedown":Nd=!0;break;case"contextmenu":case"mouseup":case"dragend":Nd=!1,Rg(d,r,h);break;case"selectionchange":if(nk)break;case"keydown":case"keyup":Rg(d,r,h)}var j;if(Op)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else Ls?e_(e,r)&&(A="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(A="onCompositionStart");A&&(Zx&&r.locale!=="ko"&&(Ls||A!=="onCompositionStart"?A==="onCompositionEnd"&&Ls&&(j=Jx()):(oi=h,Dp="value"in oi?oi.value:oi.textContent,Ls=!0)),S=Oc(c,A),0<S.length&&(A=new wg(A,e,null,r,h),d.push({event:A,listeners:S}),j?A.data=j:(j=t_(r),j!==null&&(A.data=j)))),(j=KC?qC(e,r):VC(e,r))&&(c=Oc(c,"onBeforeInput"),0<c.length&&(h=new wg("onBeforeInput","beforeinput",null,r,h),d.push({event:h,listeners:c}),h.data=j))}f_(d,t)})}function Da(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Oc(e,t){for(var r=t+"Capture",n=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=Na(e,r),s!=null&&n.unshift(Da(e,s,i)),s=Na(e,t),s!=null&&n.push(Da(e,s,i))),e=e.return}return n}function ws(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Dg(e,t,r,n,i){for(var s=t._reactName,o=[];r!==null&&r!==n;){var l=r,u=l.alternate,c=l.stateNode;if(u!==null&&u===n)break;l.tag===5&&c!==null&&(l=c,i?(u=Na(r,s),u!=null&&o.unshift(Da(r,u,l))):i||(u=Na(r,s),u!=null&&o.push(Da(r,u,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var ak=/\r\n?/g,lk=/\u0000|\uFFFD/g;function Lg(e){return(typeof e=="string"?e:""+e).replace(ak,`
38
- `).replace(lk,"")}function Rl(e,t,r){if(t=Lg(t),Lg(e)!==t&&r)throw Error(q(425))}function Ic(){}var Ed=null,jd=null;function Pd(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 Rd=typeof setTimeout=="function"?setTimeout:void 0,ck=typeof clearTimeout=="function"?clearTimeout:void 0,Ag=typeof Promise=="function"?Promise:void 0,uk=typeof queueMicrotask=="function"?queueMicrotask:typeof Ag<"u"?function(e){return Ag.resolve(null).then(e).catch(hk)}:Rd;function hk(e){setTimeout(function(){throw e})}function lh(e,t){var r=t,n=0;do{var i=r.nextSibling;if(e.removeChild(r),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(n===0){e.removeChild(i),Pa(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=i}while(r);Pa(t)}function di(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 Og(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var Eo=Math.random().toString(36).slice(2),Jr="__reactFiber$"+Eo,La="__reactProps$"+Eo,Pn="__reactContainer$"+Eo,Md="__reactEvents$"+Eo,dk="__reactListeners$"+Eo,fk="__reactHandles$"+Eo;function Ii(e){var t=e[Jr];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Pn]||r[Jr]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Og(e);e!==null;){if(r=e[Jr])return r;e=Og(e)}return t}e=r,r=e.parentNode}return null}function ol(e){return e=e[Jr]||e[Pn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Is(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(q(33))}function yu(e){return e[La]||null}var Td=[],Fs=-1;function Ni(e){return{current:e}}function De(e){0>Fs||(e.current=Td[Fs],Td[Fs]=null,Fs--)}function Pe(e,t){Fs++,Td[Fs]=e.current,e.current=t}var wi={},Et=Ni(wi),Yt=Ni(!1),es=wi;function go(e,t){var r=e.type.contextTypes;if(!r)return wi;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Gt(e){return e=e.childContextTypes,e!=null}function Fc(){De(Yt),De(Et)}function Ig(e,t,r){if(Et.current!==wi)throw Error(q(168));Pe(Et,t),Pe(Yt,r)}function m_(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(q(108,X1(e)||"Unknown",i));return ze({},r,n)}function Bc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||wi,es=Et.current,Pe(Et,e),Pe(Yt,Yt.current),!0}function Fg(e,t,r){var n=e.stateNode;if(!n)throw Error(q(169));r?(e=m_(e,t,es),n.__reactInternalMemoizedMergedChildContext=e,De(Yt),De(Et),Pe(Et,e)):De(Yt),Pe(Yt,r)}var gn=null,vu=!1,ch=!1;function g_(e){gn===null?gn=[e]:gn.push(e)}function pk(e){vu=!0,g_(e)}function Ei(){if(!ch&&gn!==null){ch=!0;var e=0,t=ke;try{var r=gn;for(ke=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}gn=null,vu=!1}catch(i){throw gn!==null&&(gn=gn.slice(e+1)),$x(Pp,Ei),i}finally{ke=t,ch=!1}}return null}var Bs=[],zs=0,zc=null,$c=0,_r=[],wr=0,ts=null,wn=1,bn="";function Ti(e,t){Bs[zs++]=$c,Bs[zs++]=zc,zc=e,$c=t}function y_(e,t,r){_r[wr++]=wn,_r[wr++]=bn,_r[wr++]=ts,ts=e;var n=wn;e=bn;var i=32-Ir(n)-1;n&=~(1<<i),r+=1;var s=32-Ir(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,wn=1<<32-Ir(t)+i|r<<i|n,bn=s+e}else wn=1<<s|r<<i|n,bn=e}function Fp(e){e.return!==null&&(Ti(e,1),y_(e,1,0))}function Bp(e){for(;e===zc;)zc=Bs[--zs],Bs[zs]=null,$c=Bs[--zs],Bs[zs]=null;for(;e===ts;)ts=_r[--wr],_r[wr]=null,bn=_r[--wr],_r[wr]=null,wn=_r[--wr],_r[wr]=null}var ur=null,lr=null,Le=!1,Or=null;function v_(e,t){var r=Sr(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function Bg(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,ur=e,lr=di(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ur=e,lr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=ts!==null?{id:wn,overflow:bn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Sr(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,ur=e,lr=null,!0):!1;default:return!1}}function Dd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ld(e){if(Le){var t=lr;if(t){var r=t;if(!Bg(e,t)){if(Dd(e))throw Error(q(418));t=di(r.nextSibling);var n=ur;t&&Bg(e,t)?v_(n,r):(e.flags=e.flags&-4097|2,Le=!1,ur=e)}}else{if(Dd(e))throw Error(q(418));e.flags=e.flags&-4097|2,Le=!1,ur=e}}}function zg(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ur=e}function Ml(e){if(e!==ur)return!1;if(!Le)return zg(e),Le=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Pd(e.type,e.memoizedProps)),t&&(t=lr)){if(Dd(e))throw x_(),Error(q(418));for(;t;)v_(e,t),t=di(t.nextSibling)}if(zg(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){lr=di(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}lr=null}}else lr=ur?di(e.stateNode.nextSibling):null;return!0}function x_(){for(var e=lr;e;)e=di(e.nextSibling)}function yo(){lr=ur=null,Le=!1}function zp(e){Or===null?Or=[e]:Or.push(e)}var mk=Dn.ReactCurrentBatchConfig;function zo(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(q(309));var n=r.stateNode}if(!n)throw Error(q(147,e));var i=n,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var l=i.refs;o===null?delete l[s]:l[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(q(284));if(!r._owner)throw Error(q(290,e))}return e}function Tl(e,t){throw e=Object.prototype.toString.call(t),Error(q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function $g(e){var t=e._init;return t(e._payload)}function __(e){function t(y,v){if(e){var g=y.deletions;g===null?(y.deletions=[v],y.flags|=16):g.push(v)}}function r(y,v){if(!e)return null;for(;v!==null;)t(y,v),v=v.sibling;return null}function n(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function i(y,v){return y=gi(y,v),y.index=0,y.sibling=null,y}function s(y,v,g){return y.index=g,e?(g=y.alternate,g!==null?(g=g.index,g<v?(y.flags|=2,v):g):(y.flags|=2,v)):(y.flags|=1048576,v)}function o(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,v,g,_){return v===null||v.tag!==6?(v=gh(g,y.mode,_),v.return=y,v):(v=i(v,g),v.return=y,v)}function u(y,v,g,_){var N=g.type;return N===Ds?h(y,v,g.props.children,_,g.key):v!==null&&(v.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Kn&&$g(N)===v.type)?(_=i(v,g.props),_.ref=zo(y,v,g),_.return=y,_):(_=pc(g.type,g.key,g.props,null,y.mode,_),_.ref=zo(y,v,g),_.return=y,_)}function c(y,v,g,_){return v===null||v.tag!==4||v.stateNode.containerInfo!==g.containerInfo||v.stateNode.implementation!==g.implementation?(v=yh(g,y.mode,_),v.return=y,v):(v=i(v,g.children||[]),v.return=y,v)}function h(y,v,g,_,N){return v===null||v.tag!==7?(v=Ji(g,y.mode,_,N),v.return=y,v):(v=i(v,g),v.return=y,v)}function d(y,v,g){if(typeof v=="string"&&v!==""||typeof v=="number")return v=gh(""+v,y.mode,g),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case wl:return g=pc(v.type,v.key,v.props,null,y.mode,g),g.ref=zo(y,null,v),g.return=y,g;case Ts:return v=yh(v,y.mode,g),v.return=y,v;case Kn:var _=v._init;return d(y,_(v._payload),g)}if(ea(v)||Ao(v))return v=Ji(v,y.mode,g,null),v.return=y,v;Tl(y,v)}return null}function f(y,v,g,_){var N=v!==null?v.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return N!==null?null:l(y,v,""+g,_);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case wl:return g.key===N?u(y,v,g,_):null;case Ts:return g.key===N?c(y,v,g,_):null;case Kn:return N=g._init,f(y,v,N(g._payload),_)}if(ea(g)||Ao(g))return N!==null?null:h(y,v,g,_,null);Tl(y,g)}return null}function p(y,v,g,_,N){if(typeof _=="string"&&_!==""||typeof _=="number")return y=y.get(g)||null,l(v,y,""+_,N);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case wl:return y=y.get(_.key===null?g:_.key)||null,u(v,y,_,N);case Ts:return y=y.get(_.key===null?g:_.key)||null,c(v,y,_,N);case Kn:var S=_._init;return p(y,v,g,S(_._payload),N)}if(ea(_)||Ao(_))return y=y.get(g)||null,h(v,y,_,N,null);Tl(v,_)}return null}function m(y,v,g,_){for(var N=null,S=null,j=v,A=v=0,$=null;j!==null&&A<g.length;A++){j.index>A?($=j,j=null):$=j.sibling;var z=f(y,j,g[A],_);if(z===null){j===null&&(j=$);break}e&&j&&z.alternate===null&&t(y,j),v=s(z,v,A),S===null?N=z:S.sibling=z,S=z,j=$}if(A===g.length)return r(y,j),Le&&Ti(y,A),N;if(j===null){for(;A<g.length;A++)j=d(y,g[A],_),j!==null&&(v=s(j,v,A),S===null?N=j:S.sibling=j,S=j);return Le&&Ti(y,A),N}for(j=n(y,j);A<g.length;A++)$=p(j,y,A,g[A],_),$!==null&&(e&&$.alternate!==null&&j.delete($.key===null?A:$.key),v=s($,v,A),S===null?N=$:S.sibling=$,S=$);return e&&j.forEach(function(I){return t(y,I)}),Le&&Ti(y,A),N}function x(y,v,g,_){var N=Ao(g);if(typeof N!="function")throw Error(q(150));if(g=N.call(g),g==null)throw Error(q(151));for(var S=N=null,j=v,A=v=0,$=null,z=g.next();j!==null&&!z.done;A++,z=g.next()){j.index>A?($=j,j=null):$=j.sibling;var I=f(y,j,z.value,_);if(I===null){j===null&&(j=$);break}e&&j&&I.alternate===null&&t(y,j),v=s(I,v,A),S===null?N=I:S.sibling=I,S=I,j=$}if(z.done)return r(y,j),Le&&Ti(y,A),N;if(j===null){for(;!z.done;A++,z=g.next())z=d(y,z.value,_),z!==null&&(v=s(z,v,A),S===null?N=z:S.sibling=z,S=z);return Le&&Ti(y,A),N}for(j=n(y,j);!z.done;A++,z=g.next())z=p(j,y,A,z.value,_),z!==null&&(e&&z.alternate!==null&&j.delete(z.key===null?A:z.key),v=s(z,v,A),S===null?N=z:S.sibling=z,S=z);return e&&j.forEach(function(P){return t(y,P)}),Le&&Ti(y,A),N}function C(y,v,g,_){if(typeof g=="object"&&g!==null&&g.type===Ds&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case wl:e:{for(var N=g.key,S=v;S!==null;){if(S.key===N){if(N=g.type,N===Ds){if(S.tag===7){r(y,S.sibling),v=i(S,g.props.children),v.return=y,y=v;break e}}else if(S.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Kn&&$g(N)===S.type){r(y,S.sibling),v=i(S,g.props),v.ref=zo(y,S,g),v.return=y,y=v;break e}r(y,S);break}else t(y,S);S=S.sibling}g.type===Ds?(v=Ji(g.props.children,y.mode,_,g.key),v.return=y,y=v):(_=pc(g.type,g.key,g.props,null,y.mode,_),_.ref=zo(y,v,g),_.return=y,y=_)}return o(y);case Ts:e:{for(S=g.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===g.containerInfo&&v.stateNode.implementation===g.implementation){r(y,v.sibling),v=i(v,g.children||[]),v.return=y,y=v;break e}else{r(y,v);break}else t(y,v);v=v.sibling}v=yh(g,y.mode,_),v.return=y,y=v}return o(y);case Kn:return S=g._init,C(y,v,S(g._payload),_)}if(ea(g))return m(y,v,g,_);if(Ao(g))return x(y,v,g,_);Tl(y,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,v!==null&&v.tag===6?(r(y,v.sibling),v=i(v,g),v.return=y,y=v):(r(y,v),v=gh(g,y.mode,_),v.return=y,y=v),o(y)):r(y,v)}return C}var vo=__(!0),w_=__(!1),Hc=Ni(null),Wc=null,$s=null,$p=null;function Hp(){$p=$s=Wc=null}function Wp(e){var t=Hc.current;De(Hc),e._currentValue=t}function Ad(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Xs(e,t){Wc=e,$p=$s=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Qt=!0),e.firstContext=null)}function Nr(e){var t=e._currentValue;if($p!==e)if(e={context:e,memoizedValue:t,next:null},$s===null){if(Wc===null)throw Error(q(308));$s=e,Wc.dependencies={lanes:0,firstContext:e}}else $s=$s.next=e;return t}var Fi=null;function Up(e){Fi===null?Fi=[e]:Fi.push(e)}function b_(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,Up(t)):(r.next=i.next,i.next=r),t.interleaved=r,Rn(e,n)}function Rn(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var qn=!1;function Kp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function S_(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 kn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function fi(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,we&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,Rn(e,r)}return i=n.interleaved,i===null?(t.next=t,Up(n)):(t.next=i.next,i.next=t),n.interleaved=t,Rn(e,r)}function lc(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Rp(e,r)}}function Hg(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?i=s=t:s=s.next=t}else i=s=t;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Uc(e,t,r,n){var i=e.updateQueue;qn=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var u=l,c=u.next;u.next=null,o===null?s=c:o.next=c,o=u;var h=e.alternate;h!==null&&(h=h.updateQueue,l=h.lastBaseUpdate,l!==o&&(l===null?h.firstBaseUpdate=c:l.next=c,h.lastBaseUpdate=u))}if(s!==null){var d=i.baseState;o=0,h=c=u=null,l=s;do{var f=l.lane,p=l.eventTime;if((n&f)===f){h!==null&&(h=h.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,x=l;switch(f=t,p=r,x.tag){case 1:if(m=x.payload,typeof m=="function"){d=m.call(p,d,f);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=x.payload,f=typeof m=="function"?m.call(p,d,f):m,f==null)break e;d=ze({},d,f);break e;case 2:qn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(c=h=p,u=d):h=h.next=p,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;f=l,l=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(h===null&&(u=d),i.baseState=u,i.firstBaseUpdate=c,i.lastBaseUpdate=h,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);ns|=o,e.lanes=o,e.memoizedState=d}}function Wg(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],i=n.callback;if(i!==null){if(n.callback=null,n=r,typeof i!="function")throw Error(q(191,i));i.call(n)}}}var al={},nn=Ni(al),Aa=Ni(al),Oa=Ni(al);function Bi(e){if(e===al)throw Error(q(174));return e}function qp(e,t){switch(Pe(Oa,t),Pe(Aa,e),Pe(nn,al),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:md(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=md(t,e)}De(nn),Pe(nn,t)}function xo(){De(nn),De(Aa),De(Oa)}function C_(e){Bi(Oa.current);var t=Bi(nn.current),r=md(t,e.type);t!==r&&(Pe(Aa,e),Pe(nn,r))}function Vp(e){Aa.current===e&&(De(nn),De(Aa))}var Fe=Ni(0);function Kc(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.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 uh=[];function Qp(){for(var e=0;e<uh.length;e++)uh[e]._workInProgressVersionPrimary=null;uh.length=0}var cc=Dn.ReactCurrentDispatcher,hh=Dn.ReactCurrentBatchConfig,rs=0,Be=null,nt=null,ct=null,qc=!1,pa=!1,Ia=0,gk=0;function _t(){throw Error(q(321))}function Yp(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Br(e[r],t[r]))return!1;return!0}function Gp(e,t,r,n,i,s){if(rs=s,Be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,cc.current=e===null||e.memoizedState===null?_k:wk,e=r(n,i),pa){s=0;do{if(pa=!1,Ia=0,25<=s)throw Error(q(301));s+=1,ct=nt=null,t.updateQueue=null,cc.current=bk,e=r(n,i)}while(pa)}if(cc.current=Vc,t=nt!==null&&nt.next!==null,rs=0,ct=nt=Be=null,qc=!1,t)throw Error(q(300));return e}function Xp(){var e=Ia!==0;return Ia=0,e}function qr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ct===null?Be.memoizedState=ct=e:ct=ct.next=e,ct}function Er(){if(nt===null){var e=Be.alternate;e=e!==null?e.memoizedState:null}else e=nt.next;var t=ct===null?Be.memoizedState:ct.next;if(t!==null)ct=t,nt=e;else{if(e===null)throw Error(q(310));nt=e,e={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},ct===null?Be.memoizedState=ct=e:ct=ct.next=e}return ct}function Fa(e,t){return typeof t=="function"?t(e):t}function dh(e){var t=Er(),r=t.queue;if(r===null)throw Error(q(311));r.lastRenderedReducer=e;var n=nt,i=n.baseQueue,s=r.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}n.baseQueue=i=s,r.pending=null}if(i!==null){s=i.next,n=n.baseState;var l=o=null,u=null,c=s;do{var h=c.lane;if((rs&h)===h)u!==null&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),n=c.hasEagerState?c.eagerState:e(n,c.action);else{var d={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};u===null?(l=u=d,o=n):u=u.next=d,Be.lanes|=h,ns|=h}c=c.next}while(c!==null&&c!==s);u===null?o=n:u.next=l,Br(n,t.memoizedState)||(Qt=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=u,r.lastRenderedState=n}if(e=r.interleaved,e!==null){i=e;do s=i.lane,Be.lanes|=s,ns|=s,i=i.next;while(i!==e)}else i===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function fh(e){var t=Er(),r=t.queue;if(r===null)throw Error(q(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,s=t.memoizedState;if(i!==null){r.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);Br(s,t.memoizedState)||(Qt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function k_(){}function N_(e,t){var r=Be,n=Er(),i=t(),s=!Br(n.memoizedState,i);if(s&&(n.memoizedState=i,Qt=!0),n=n.queue,Jp(P_.bind(null,r,n,e),[e]),n.getSnapshot!==t||s||ct!==null&&ct.memoizedState.tag&1){if(r.flags|=2048,Ba(9,j_.bind(null,r,n,i,t),void 0,null),ft===null)throw Error(q(349));rs&30||E_(r,t,i)}return i}function E_(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Be.updateQueue,t===null?(t={lastEffect:null,stores:null},Be.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function j_(e,t,r,n){t.value=r,t.getSnapshot=n,R_(t)&&M_(e)}function P_(e,t,r){return r(function(){R_(t)&&M_(e)})}function R_(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Br(e,r)}catch{return!0}}function M_(e){var t=Rn(e,1);t!==null&&Fr(t,e,1,-1)}function Ug(e){var t=qr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:e},t.queue=e,e=e.dispatch=xk.bind(null,Be,e),[t.memoizedState,e]}function Ba(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=Be.updateQueue,t===null?(t={lastEffect:null,stores:null},Be.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function T_(){return Er().memoizedState}function uc(e,t,r,n){var i=qr();Be.flags|=e,i.memoizedState=Ba(1|t,r,void 0,n===void 0?null:n)}function xu(e,t,r,n){var i=Er();n=n===void 0?null:n;var s=void 0;if(nt!==null){var o=nt.memoizedState;if(s=o.destroy,n!==null&&Yp(n,o.deps)){i.memoizedState=Ba(t,r,s,n);return}}Be.flags|=e,i.memoizedState=Ba(1|t,r,s,n)}function Kg(e,t){return uc(8390656,8,e,t)}function Jp(e,t){return xu(2048,8,e,t)}function D_(e,t){return xu(4,2,e,t)}function L_(e,t){return xu(4,4,e,t)}function A_(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 O_(e,t,r){return r=r!=null?r.concat([e]):null,xu(4,4,A_.bind(null,t,e),r)}function Zp(){}function I_(e,t){var r=Er();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Yp(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function F_(e,t){var r=Er();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Yp(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function B_(e,t,r){return rs&21?(Br(r,t)||(r=Ux(),Be.lanes|=r,ns|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Qt=!0),e.memoizedState=r)}function yk(e,t){var r=ke;ke=r!==0&&4>r?r:4,e(!0);var n=hh.transition;hh.transition={};try{e(!1),t()}finally{ke=r,hh.transition=n}}function z_(){return Er().memoizedState}function vk(e,t,r){var n=mi(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},$_(e))H_(t,r);else if(r=b_(e,t,r,n),r!==null){var i=At();Fr(r,e,n,i),W_(r,t,n)}}function xk(e,t,r){var n=mi(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if($_(e))H_(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,r);if(i.hasEagerState=!0,i.eagerState=l,Br(l,o)){var u=t.interleaved;u===null?(i.next=i,Up(t)):(i.next=u.next,u.next=i),t.interleaved=i;return}}catch{}finally{}r=b_(e,t,i,n),r!==null&&(i=At(),Fr(r,e,n,i),W_(r,t,n))}}function $_(e){var t=e.alternate;return e===Be||t!==null&&t===Be}function H_(e,t){pa=qc=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function W_(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Rp(e,r)}}var Vc={readContext:Nr,useCallback:_t,useContext:_t,useEffect:_t,useImperativeHandle:_t,useInsertionEffect:_t,useLayoutEffect:_t,useMemo:_t,useReducer:_t,useRef:_t,useState:_t,useDebugValue:_t,useDeferredValue:_t,useTransition:_t,useMutableSource:_t,useSyncExternalStore:_t,useId:_t,unstable_isNewReconciler:!1},_k={readContext:Nr,useCallback:function(e,t){return qr().memoizedState=[e,t===void 0?null:t],e},useContext:Nr,useEffect:Kg,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,uc(4194308,4,A_.bind(null,t,e),r)},useLayoutEffect:function(e,t){return uc(4194308,4,e,t)},useInsertionEffect:function(e,t){return uc(4,2,e,t)},useMemo:function(e,t){var r=qr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=qr();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=vk.bind(null,Be,e),[n.memoizedState,e]},useRef:function(e){var t=qr();return e={current:e},t.memoizedState=e},useState:Ug,useDebugValue:Zp,useDeferredValue:function(e){return qr().memoizedState=e},useTransition:function(){var e=Ug(!1),t=e[0];return e=yk.bind(null,e[1]),qr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Be,i=qr();if(Le){if(r===void 0)throw Error(q(407));r=r()}else{if(r=t(),ft===null)throw Error(q(349));rs&30||E_(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,Kg(P_.bind(null,n,s,e),[e]),n.flags|=2048,Ba(9,j_.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=qr(),t=ft.identifierPrefix;if(Le){var r=bn,n=wn;r=(n&~(1<<32-Ir(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Ia++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=gk++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},wk={readContext:Nr,useCallback:I_,useContext:Nr,useEffect:Jp,useImperativeHandle:O_,useInsertionEffect:D_,useLayoutEffect:L_,useMemo:F_,useReducer:dh,useRef:T_,useState:function(){return dh(Fa)},useDebugValue:Zp,useDeferredValue:function(e){var t=Er();return B_(t,nt.memoizedState,e)},useTransition:function(){var e=dh(Fa)[0],t=Er().memoizedState;return[e,t]},useMutableSource:k_,useSyncExternalStore:N_,useId:z_,unstable_isNewReconciler:!1},bk={readContext:Nr,useCallback:I_,useContext:Nr,useEffect:Jp,useImperativeHandle:O_,useInsertionEffect:D_,useLayoutEffect:L_,useMemo:F_,useReducer:fh,useRef:T_,useState:function(){return fh(Fa)},useDebugValue:Zp,useDeferredValue:function(e){var t=Er();return nt===null?t.memoizedState=e:B_(t,nt.memoizedState,e)},useTransition:function(){var e=fh(Fa)[0],t=Er().memoizedState;return[e,t]},useMutableSource:k_,useSyncExternalStore:N_,useId:z_,unstable_isNewReconciler:!1};function Tr(e,t){if(e&&e.defaultProps){t=ze({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function Od(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:ze({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var _u={isMounted:function(e){return(e=e._reactInternals)?ps(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=At(),i=mi(e),s=kn(n,i);s.payload=t,r!=null&&(s.callback=r),t=fi(e,s,i),t!==null&&(Fr(t,e,i,n),lc(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=At(),i=mi(e),s=kn(n,i);s.tag=1,s.payload=t,r!=null&&(s.callback=r),t=fi(e,s,i),t!==null&&(Fr(t,e,i,n),lc(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=At(),n=mi(e),i=kn(r,n);i.tag=2,t!=null&&(i.callback=t),t=fi(e,i,n),t!==null&&(Fr(t,e,n,r),lc(t,e,n))}};function qg(e,t,r,n,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,s,o):t.prototype&&t.prototype.isPureReactComponent?!Ma(r,n)||!Ma(i,s):!0}function U_(e,t,r){var n=!1,i=wi,s=t.contextType;return typeof s=="object"&&s!==null?s=Nr(s):(i=Gt(t)?es:Et.current,n=t.contextTypes,s=(n=n!=null)?go(e,i):wi),t=new t(r,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=_u,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function Vg(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&_u.enqueueReplaceState(t,t.state,null)}function Id(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs={},Kp(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Nr(s):(s=Gt(t)?es:Et.current,i.context=go(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Od(e,t,s,r),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&_u.enqueueReplaceState(i,i.state,null),Uc(e,r,i,n),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function _o(e,t){try{var r="",n=t;do r+=G1(n),n=n.return;while(n);var i=r}catch(s){i=`
39
- Error generating stack: `+s.message+`
40
- `+s.stack}return{value:e,source:t,stack:i,digest:null}}function ph(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Fd(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var Sk=typeof WeakMap=="function"?WeakMap:Map;function K_(e,t,r){r=kn(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Yc||(Yc=!0,Qd=n),Fd(e,t)},r}function q_(e,t,r){r=kn(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var i=t.value;r.payload=function(){return n(i)},r.callback=function(){Fd(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){Fd(e,t),typeof n!="function"&&(pi===null?pi=new Set([this]):pi.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function Qg(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new Sk;var i=new Set;n.set(t,i)}else i=n.get(t),i===void 0&&(i=new Set,n.set(t,i));i.has(r)||(i.add(r),e=Ik.bind(null,e,t,r),t.then(e,e))}function Yg(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 Gg(e,t,r,n,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=kn(-1,1),t.tag=2,fi(r,t,1))),r.lanes|=1),e)}var Ck=Dn.ReactCurrentOwner,Qt=!1;function Tt(e,t,r,n){t.child=e===null?w_(t,null,r,n):vo(t,e.child,r,n)}function Xg(e,t,r,n,i){r=r.render;var s=t.ref;return Xs(t,i),n=Gp(e,t,r,n,s,i),r=Xp(),e!==null&&!Qt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Mn(e,t,i)):(Le&&r&&Fp(t),t.flags|=1,Tt(e,t,n,i),t.child)}function Jg(e,t,r,n,i){if(e===null){var s=r.type;return typeof s=="function"&&!am(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=s,V_(e,t,s,n,i)):(e=pc(r.type,null,n,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:Ma,r(o,n)&&e.ref===t.ref)return Mn(e,t,i)}return t.flags|=1,e=gi(s,n),e.ref=t.ref,e.return=t,t.child=e}function V_(e,t,r,n,i){if(e!==null){var s=e.memoizedProps;if(Ma(s,n)&&e.ref===t.ref)if(Qt=!1,t.pendingProps=n=s,(e.lanes&i)!==0)e.flags&131072&&(Qt=!0);else return t.lanes=e.lanes,Mn(e,t,i)}return Bd(e,t,r,n,i)}function Q_(e,t,r){var n=t.pendingProps,i=n.children,s=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Pe(Ws,ar),ar|=r;else{if(!(r&1073741824))return e=s!==null?s.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Pe(Ws,ar),ar|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,Pe(Ws,ar),ar|=n}else s!==null?(n=s.baseLanes|r,t.memoizedState=null):n=r,Pe(Ws,ar),ar|=n;return Tt(e,t,i,r),t.child}function Y_(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Bd(e,t,r,n,i){var s=Gt(r)?es:Et.current;return s=go(t,s),Xs(t,i),r=Gp(e,t,r,n,s,i),n=Xp(),e!==null&&!Qt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Mn(e,t,i)):(Le&&n&&Fp(t),t.flags|=1,Tt(e,t,r,i),t.child)}function Zg(e,t,r,n,i){if(Gt(r)){var s=!0;Bc(t)}else s=!1;if(Xs(t,i),t.stateNode===null)hc(e,t),U_(t,r,n),Id(t,r,n,i),n=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var u=o.context,c=r.contextType;typeof c=="object"&&c!==null?c=Nr(c):(c=Gt(r)?es:Et.current,c=go(t,c));var h=r.getDerivedStateFromProps,d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||u!==c)&&Vg(t,o,n,c),qn=!1;var f=t.memoizedState;o.state=f,Uc(t,n,o,i),u=t.memoizedState,l!==n||f!==u||Yt.current||qn?(typeof h=="function"&&(Od(t,r,h,n),u=t.memoizedState),(l=qn||qg(t,r,l,n,f,u,c))?(d||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=n,t.memoizedState=u),o.props=n,o.state=u,o.context=c,n=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,S_(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Tr(t.type,l),o.props=c,d=t.pendingProps,f=o.context,u=r.contextType,typeof u=="object"&&u!==null?u=Nr(u):(u=Gt(r)?es:Et.current,u=go(t,u));var p=r.getDerivedStateFromProps;(h=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==d||f!==u)&&Vg(t,o,n,u),qn=!1,f=t.memoizedState,o.state=f,Uc(t,n,o,i);var m=t.memoizedState;l!==d||f!==m||Yt.current||qn?(typeof p=="function"&&(Od(t,r,p,n),m=t.memoizedState),(c=qn||qg(t,r,c,n,f,m,u)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,m,u),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,m,u)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=m),o.props=n,o.state=m,o.context=u,n=c):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),n=!1)}return zd(e,t,r,n,s,i)}function zd(e,t,r,n,i,s){Y_(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return i&&Fg(t,r,!1),Mn(e,t,s);n=t.stateNode,Ck.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=vo(t,e.child,null,s),t.child=vo(t,null,l,s)):Tt(e,t,l,s),t.memoizedState=n.state,i&&Fg(t,r,!0),t.child}function G_(e){var t=e.stateNode;t.pendingContext?Ig(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ig(e,t.context,!1),qp(e,t.containerInfo)}function e0(e,t,r,n,i){return yo(),zp(i),t.flags|=256,Tt(e,t,r,n),t.child}var $d={dehydrated:null,treeContext:null,retryLane:0};function Hd(e){return{baseLanes:e,cachePool:null,transitions:null}}function X_(e,t,r){var n=t.pendingProps,i=Fe.current,s=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Pe(Fe,i&1),e===null)return Ld(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=n.children,e=n.fallback,s?(n=t.mode,s=t.child,o={mode:"hidden",children:o},!(n&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Su(o,n,0,null),e=Ji(e,n,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Hd(r),t.memoizedState=$d,e):em(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return kk(e,t,o,n,l,i,r);if(s){s=n.fallback,o=t.mode,i=e.child,l=i.sibling;var u={mode:"hidden",children:n.children};return!(o&1)&&t.child!==i?(n=t.child,n.childLanes=0,n.pendingProps=u,t.deletions=null):(n=gi(i,u),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=gi(l,s):(s=Ji(s,o,r,null),s.flags|=2),s.return=t,n.return=t,n.sibling=s,t.child=n,n=s,s=t.child,o=e.child.memoizedState,o=o===null?Hd(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~r,t.memoizedState=$d,n}return s=e.child,e=s.sibling,n=gi(s,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function em(e,t){return t=Su({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Dl(e,t,r,n){return n!==null&&zp(n),vo(t,e.child,null,r),e=em(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function kk(e,t,r,n,i,s,o){if(r)return t.flags&256?(t.flags&=-257,n=ph(Error(q(422))),Dl(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=n.fallback,i=t.mode,n=Su({mode:"visible",children:n.children},i,0,null),s=Ji(s,i,o,null),s.flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,t.mode&1&&vo(t,e.child,null,o),t.child.memoizedState=Hd(o),t.memoizedState=$d,s);if(!(t.mode&1))return Dl(e,t,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var l=n.dgst;return n=l,s=Error(q(419)),n=ph(s,n,void 0),Dl(e,t,o,n)}if(l=(o&e.childLanes)!==0,Qt||l){if(n=ft,n!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Rn(e,i),Fr(n,e,i,-1))}return om(),n=ph(Error(q(421))),Dl(e,t,o,n)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Fk.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,lr=di(i.nextSibling),ur=t,Le=!0,Or=null,e!==null&&(_r[wr++]=wn,_r[wr++]=bn,_r[wr++]=ts,wn=e.id,bn=e.overflow,ts=t),t=em(t,n.children),t.flags|=4096,t)}function t0(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Ad(e.return,t,r)}function mh(e,t,r,n,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function J_(e,t,r){var n=t.pendingProps,i=n.revealOrder,s=n.tail;if(Tt(e,t,n.children,r),n=Fe.current,n&2)n=n&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&&t0(e,r,t);else if(e.tag===19)t0(e,r,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}n&=1}if(Pe(Fe,n),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;r!==null;)e=r.alternate,e!==null&&Kc(e)===null&&(i=r),r=r.sibling;r=i,r===null?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),mh(t,!1,i,r,s);break;case"backwards":for(r=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Kc(e)===null){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}mh(t,!0,r,null,s);break;case"together":mh(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function hc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Mn(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),ns|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(q(153));if(t.child!==null){for(e=t.child,r=gi(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=gi(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Nk(e,t,r){switch(t.tag){case 3:G_(t),yo();break;case 5:C_(t);break;case 1:Gt(t.type)&&Bc(t);break;case 4:qp(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;Pe(Hc,n._currentValue),n._currentValue=i;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(Pe(Fe,Fe.current&1),t.flags|=128,null):r&t.child.childLanes?X_(e,t,r):(Pe(Fe,Fe.current&1),e=Mn(e,t,r),e!==null?e.sibling:null);Pe(Fe,Fe.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return J_(e,t,r);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Pe(Fe,Fe.current),n)break;return null;case 22:case 23:return t.lanes=0,Q_(e,t,r)}return Mn(e,t,r)}var Z_,Wd,ew,tw;Z_=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Wd=function(){};ew=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,Bi(nn.current);var s=null;switch(r){case"input":i=hd(e,i),n=hd(e,n),s=[];break;case"select":i=ze({},i,{value:void 0}),n=ze({},n,{value:void 0}),s=[];break;case"textarea":i=pd(e,i),n=pd(e,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Ic)}gd(r,n);var o;r=null;for(c in i)if(!n.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var l=i[c];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Ca.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in n){var u=n[c];if(l=i!=null?i[c]:void 0,n.hasOwnProperty(c)&&u!==l&&(u!=null||l!=null))if(c==="style")if(l){for(o in l)!l.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in u)u.hasOwnProperty(o)&&l[o]!==u[o]&&(r||(r={}),r[o]=u[o])}else r||(s||(s=[]),s.push(c,r)),r=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,l=l?l.__html:void 0,u!=null&&l!==u&&(s=s||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(s=s||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Ca.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&Me("scroll",e),s||l===u||(s=[])):(s=s||[]).push(c,u))}r&&(s=s||[]).push("style",r);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};tw=function(e,t,r,n){r!==n&&(t.flags|=4)};function $o(e,t){if(!Le)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function wt(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function Ek(e,t,r){var n=t.pendingProps;switch(Bp(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return wt(t),null;case 1:return Gt(t.type)&&Fc(),wt(t),null;case 3:return n=t.stateNode,xo(),De(Yt),De(Et),Qp(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ml(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Or!==null&&(Xd(Or),Or=null))),Wd(e,t),wt(t),null;case 5:Vp(t);var i=Bi(Oa.current);if(r=t.type,e!==null&&t.stateNode!=null)ew(e,t,r,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(q(166));return wt(t),null}if(e=Bi(nn.current),Ml(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[Jr]=t,n[La]=s,e=(t.mode&1)!==0,r){case"dialog":Me("cancel",n),Me("close",n);break;case"iframe":case"object":case"embed":Me("load",n);break;case"video":case"audio":for(i=0;i<ra.length;i++)Me(ra[i],n);break;case"source":Me("error",n);break;case"img":case"image":case"link":Me("error",n),Me("load",n);break;case"details":Me("toggle",n);break;case"input":ug(n,s),Me("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},Me("invalid",n);break;case"textarea":dg(n,s),Me("invalid",n)}gd(r,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?n.textContent!==l&&(s.suppressHydrationWarning!==!0&&Rl(n.textContent,l,e),i=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&Rl(n.textContent,l,e),i=["children",""+l]):Ca.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Me("scroll",n)}switch(r){case"input":bl(n),hg(n,s,!0);break;case"textarea":bl(n),fg(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=Ic)}n=i,t.updateQueue=n,n!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Px(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[Jr]=t,e[La]=n,Z_(e,t,!1,!1),t.stateNode=e;e:{switch(o=yd(r,n),r){case"dialog":Me("cancel",e),Me("close",e),i=n;break;case"iframe":case"object":case"embed":Me("load",e),i=n;break;case"video":case"audio":for(i=0;i<ra.length;i++)Me(ra[i],e);i=n;break;case"source":Me("error",e),i=n;break;case"img":case"image":case"link":Me("error",e),Me("load",e),i=n;break;case"details":Me("toggle",e),i=n;break;case"input":ug(e,n),i=hd(e,n),Me("invalid",e);break;case"option":i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=ze({},n,{value:void 0}),Me("invalid",e);break;case"textarea":dg(e,n),i=pd(e,n),Me("invalid",e);break;default:i=n}gd(r,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var u=l[s];s==="style"?Tx(e,u):s==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Rx(e,u)):s==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&ka(e,u):typeof u=="number"&&ka(e,""+u):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Ca.hasOwnProperty(s)?u!=null&&s==="onScroll"&&Me("scroll",e):u!=null&&Cp(e,s,u,o))}switch(r){case"input":bl(e),hg(e,n,!1);break;case"textarea":bl(e),fg(e);break;case"option":n.value!=null&&e.setAttribute("value",""+_i(n.value));break;case"select":e.multiple=!!n.multiple,s=n.value,s!=null?Vs(e,!!n.multiple,s,!1):n.defaultValue!=null&&Vs(e,!!n.multiple,n.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Ic)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return wt(t),null;case 6:if(e&&t.stateNode!=null)tw(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(q(166));if(r=Bi(Oa.current),Bi(nn.current),Ml(t)){if(n=t.stateNode,r=t.memoizedProps,n[Jr]=t,(s=n.nodeValue!==r)&&(e=ur,e!==null))switch(e.tag){case 3:Rl(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Rl(n.nodeValue,r,(e.mode&1)!==0)}s&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Jr]=t,t.stateNode=n}return wt(t),null;case 13:if(De(Fe),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Le&&lr!==null&&t.mode&1&&!(t.flags&128))x_(),yo(),t.flags|=98560,s=!1;else if(s=Ml(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(q(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(q(317));s[Jr]=t}else yo(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;wt(t),s=!1}else Or!==null&&(Xd(Or),Or=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||Fe.current&1?st===0&&(st=3):om())),t.updateQueue!==null&&(t.flags|=4),wt(t),null);case 4:return xo(),Wd(e,t),e===null&&Ta(t.stateNode.containerInfo),wt(t),null;case 10:return Wp(t.type._context),wt(t),null;case 17:return Gt(t.type)&&Fc(),wt(t),null;case 19:if(De(Fe),s=t.memoizedState,s===null)return wt(t),null;if(n=(t.flags&128)!==0,o=s.rendering,o===null)if(n)$o(s,!1);else{if(st!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Kc(e),o!==null){for(t.flags|=128,$o(s,!1),n=o.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)s=r,e=n,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Pe(Fe,Fe.current&1|2),t.child}e=e.sibling}s.tail!==null&&Ve()>wo&&(t.flags|=128,n=!0,$o(s,!1),t.lanes=4194304)}else{if(!n)if(e=Kc(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),$o(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Le)return wt(t),null}else 2*Ve()-s.renderingStartTime>wo&&r!==1073741824&&(t.flags|=128,n=!0,$o(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(r=s.last,r!==null?r.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Ve(),t.sibling=null,r=Fe.current,Pe(Fe,n?r&1|2:r&1),t):(wt(t),null);case 22:case 23:return sm(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?ar&1073741824&&(wt(t),t.subtreeFlags&6&&(t.flags|=8192)):wt(t),null;case 24:return null;case 25:return null}throw Error(q(156,t.tag))}function jk(e,t){switch(Bp(t),t.tag){case 1:return Gt(t.type)&&Fc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xo(),De(Yt),De(Et),Qp(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Vp(t),null;case 13:if(De(Fe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(q(340));yo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return De(Fe),null;case 4:return xo(),null;case 10:return Wp(t.type._context),null;case 22:case 23:return sm(),null;case 24:return null;default:return null}}var Ll=!1,kt=!1,Pk=typeof WeakSet=="function"?WeakSet:Set,te=null;function Hs(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){We(e,t,n)}else r.current=null}function Ud(e,t,r){try{r()}catch(n){We(e,t,n)}}var r0=!1;function Rk(e,t){if(Ed=Lc,e=o_(),Ip(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,l=-1,u=-1,c=0,h=0,d=e,f=null;t:for(;;){for(var p;d!==r||i!==0&&d.nodeType!==3||(l=o+i),d!==s||n!==0&&d.nodeType!==3||(u=o+n),d.nodeType===3&&(o+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===e)break t;if(f===r&&++c===i&&(l=o),f===s&&++h===n&&(u=o),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}r=l===-1||u===-1?null:{start:l,end:u}}else r=null}r=r||{start:0,end:0}}else r=null;for(jd={focusedElem:e,selectionRange:r},Lc=!1,te=t;te!==null;)if(t=te,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,te=e;else for(;te!==null;){t=te;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 x=m.memoizedProps,C=m.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?x:Tr(t.type,x),C);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(_){We(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,te=e;break}te=t.return}return m=r0,r0=!1,m}function ma(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Ud(t,r,s)}i=i.next}while(i!==n)}}function wu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function Kd(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function rw(e){var t=e.alternate;t!==null&&(e.alternate=null,rw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Jr],delete t[La],delete t[Md],delete t[dk],delete t[fk])),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 nw(e){return e.tag===5||e.tag===3||e.tag===4}function n0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||nw(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 qd(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Ic));else if(n!==4&&(e=e.child,e!==null))for(qd(e,t,r),e=e.sibling;e!==null;)qd(e,t,r),e=e.sibling}function Vd(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Vd(e,t,r),e=e.sibling;e!==null;)Vd(e,t,r),e=e.sibling}var mt=null,Ar=!1;function On(e,t,r){for(r=r.child;r!==null;)iw(e,t,r),r=r.sibling}function iw(e,t,r){if(rn&&typeof rn.onCommitFiberUnmount=="function")try{rn.onCommitFiberUnmount(fu,r)}catch{}switch(r.tag){case 5:kt||Hs(r,t);case 6:var n=mt,i=Ar;mt=null,On(e,t,r),mt=n,Ar=i,mt!==null&&(Ar?(e=mt,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):mt.removeChild(r.stateNode));break;case 18:mt!==null&&(Ar?(e=mt,r=r.stateNode,e.nodeType===8?lh(e.parentNode,r):e.nodeType===1&&lh(e,r),Pa(e)):lh(mt,r.stateNode));break;case 4:n=mt,i=Ar,mt=r.stateNode.containerInfo,Ar=!0,On(e,t,r),mt=n,Ar=i;break;case 0:case 11:case 14:case 15:if(!kt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Ud(r,t,o),i=i.next}while(i!==n)}On(e,t,r);break;case 1:if(!kt&&(Hs(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){We(r,t,l)}On(e,t,r);break;case 21:On(e,t,r);break;case 22:r.mode&1?(kt=(n=kt)||r.memoizedState!==null,On(e,t,r),kt=n):On(e,t,r);break;default:On(e,t,r)}}function i0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Pk),t.forEach(function(n){var i=Bk.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Pr(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var i=r[n];try{var s=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:mt=l.stateNode,Ar=!1;break e;case 3:mt=l.stateNode.containerInfo,Ar=!0;break e;case 4:mt=l.stateNode.containerInfo,Ar=!0;break e}l=l.return}if(mt===null)throw Error(q(160));iw(s,o,i),mt=null,Ar=!1;var u=i.alternate;u!==null&&(u.return=null),i.return=null}catch(c){We(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)sw(t,e),t=t.sibling}function sw(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pr(t,e),Hr(e),n&4){try{ma(3,e,e.return),wu(3,e)}catch(x){We(e,e.return,x)}try{ma(5,e,e.return)}catch(x){We(e,e.return,x)}}break;case 1:Pr(t,e),Hr(e),n&512&&r!==null&&Hs(r,r.return);break;case 5:if(Pr(t,e),Hr(e),n&512&&r!==null&&Hs(r,r.return),e.flags&32){var i=e.stateNode;try{ka(i,"")}catch(x){We(e,e.return,x)}}if(n&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=r!==null?r.memoizedProps:s,l=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&Ex(i,s),yd(l,o);var c=yd(l,s);for(o=0;o<u.length;o+=2){var h=u[o],d=u[o+1];h==="style"?Tx(i,d):h==="dangerouslySetInnerHTML"?Rx(i,d):h==="children"?ka(i,d):Cp(i,h,d,c)}switch(l){case"input":dd(i,s);break;case"textarea":jx(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?Vs(i,!!s.multiple,p,!1):f!==!!s.multiple&&(s.defaultValue!=null?Vs(i,!!s.multiple,s.defaultValue,!0):Vs(i,!!s.multiple,s.multiple?[]:"",!1))}i[La]=s}catch(x){We(e,e.return,x)}}break;case 6:if(Pr(t,e),Hr(e),n&4){if(e.stateNode===null)throw Error(q(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(x){We(e,e.return,x)}}break;case 3:if(Pr(t,e),Hr(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Pa(t.containerInfo)}catch(x){We(e,e.return,x)}break;case 4:Pr(t,e),Hr(e);break;case 13:Pr(t,e),Hr(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(nm=Ve())),n&4&&i0(e);break;case 22:if(h=r!==null&&r.memoizedState!==null,e.mode&1?(kt=(c=kt)||h,Pr(t,e),kt=c):Pr(t,e),Hr(e),n&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!h&&e.mode&1)for(te=e,h=e.child;h!==null;){for(d=te=h;te!==null;){switch(f=te,p=f.child,f.tag){case 0:case 11:case 14:case 15:ma(4,f,f.return);break;case 1:Hs(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){n=f,r=f.return;try{t=n,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(x){We(n,r,x)}}break;case 5:Hs(f,f.return);break;case 22:if(f.memoizedState!==null){o0(d);continue}}p!==null?(p.return=f,te=p):o0(d)}h=h.sibling}e:for(h=null,d=e;;){if(d.tag===5){if(h===null){h=d;try{i=d.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=d.stateNode,u=d.memoizedProps.style,o=u!=null&&u.hasOwnProperty("display")?u.display:null,l.style.display=Mx("display",o))}catch(x){We(e,e.return,x)}}}else if(d.tag===6){if(h===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(x){We(e,e.return,x)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;h===d&&(h=null),d=d.return}h===d&&(h=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Pr(t,e),Hr(e),n&4&&i0(e);break;case 21:break;default:Pr(t,e),Hr(e)}}function Hr(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(nw(r)){var n=r;break e}r=r.return}throw Error(q(160))}switch(n.tag){case 5:var i=n.stateNode;n.flags&32&&(ka(i,""),n.flags&=-33);var s=n0(e);Vd(e,s,i);break;case 3:case 4:var o=n.stateNode.containerInfo,l=n0(e);qd(e,l,o);break;default:throw Error(q(161))}}catch(u){We(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Mk(e,t,r){te=e,ow(e)}function ow(e,t,r){for(var n=(e.mode&1)!==0;te!==null;){var i=te,s=i.child;if(i.tag===22&&n){var o=i.memoizedState!==null||Ll;if(!o){var l=i.alternate,u=l!==null&&l.memoizedState!==null||kt;l=Ll;var c=kt;if(Ll=o,(kt=u)&&!c)for(te=i;te!==null;)o=te,u=o.child,o.tag===22&&o.memoizedState!==null?a0(i):u!==null?(u.return=o,te=u):a0(i);for(;s!==null;)te=s,ow(s),s=s.sibling;te=i,Ll=l,kt=c}s0(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,te=s):s0(e)}}function s0(e){for(;te!==null;){var t=te;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:kt||wu(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!kt)if(r===null)n.componentDidMount();else{var i=t.elementType===t.type?r.memoizedProps:Tr(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Wg(t,s,n);break;case 3:var o=t.updateQueue;if(o!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}Wg(t,o,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&r.focus();break;case"img":u.src&&(r.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var h=c.memoizedState;if(h!==null){var d=h.dehydrated;d!==null&&Pa(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(q(163))}kt||t.flags&512&&Kd(t)}catch(f){We(t,t.return,f)}}if(t===e){te=null;break}if(r=t.sibling,r!==null){r.return=t.return,te=r;break}te=t.return}}function o0(e){for(;te!==null;){var t=te;if(t===e){te=null;break}var r=t.sibling;if(r!==null){r.return=t.return,te=r;break}te=t.return}}function a0(e){for(;te!==null;){var t=te;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{wu(4,t)}catch(u){We(t,r,u)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var i=t.return;try{n.componentDidMount()}catch(u){We(t,i,u)}}var s=t.return;try{Kd(t)}catch(u){We(t,s,u)}break;case 5:var o=t.return;try{Kd(t)}catch(u){We(t,o,u)}}}catch(u){We(t,t.return,u)}if(t===e){te=null;break}var l=t.sibling;if(l!==null){l.return=t.return,te=l;break}te=t.return}}var Tk=Math.ceil,Qc=Dn.ReactCurrentDispatcher,tm=Dn.ReactCurrentOwner,Cr=Dn.ReactCurrentBatchConfig,we=0,ft=null,Je=null,vt=0,ar=0,Ws=Ni(0),st=0,za=null,ns=0,bu=0,rm=0,ga=null,Vt=null,nm=0,wo=1/0,pn=null,Yc=!1,Qd=null,pi=null,Al=!1,ai=null,Gc=0,ya=0,Yd=null,dc=-1,fc=0;function At(){return we&6?Ve():dc!==-1?dc:dc=Ve()}function mi(e){return e.mode&1?we&2&&vt!==0?vt&-vt:mk.transition!==null?(fc===0&&(fc=Ux()),fc):(e=ke,e!==0||(e=window.event,e=e===void 0?16:Xx(e.type)),e):1}function Fr(e,t,r,n){if(50<ya)throw ya=0,Yd=null,Error(q(185));il(e,r,n),(!(we&2)||e!==ft)&&(e===ft&&(!(we&2)&&(bu|=r),st===4&&Yn(e,vt)),Xt(e,n),r===1&&we===0&&!(t.mode&1)&&(wo=Ve()+500,vu&&Ei()))}function Xt(e,t){var r=e.callbackNode;mC(e,t);var n=Dc(e,e===ft?vt:0);if(n===0)r!==null&&gg(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&gg(r),t===1)e.tag===0?pk(l0.bind(null,e)):g_(l0.bind(null,e)),uk(function(){!(we&6)&&Ei()}),r=null;else{switch(Kx(n)){case 1:r=Pp;break;case 4:r=Hx;break;case 16:r=Tc;break;case 536870912:r=Wx;break;default:r=Tc}r=pw(r,aw.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function aw(e,t){if(dc=-1,fc=0,we&6)throw Error(q(327));var r=e.callbackNode;if(Js()&&e.callbackNode!==r)return null;var n=Dc(e,e===ft?vt:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Xc(e,n);else{t=n;var i=we;we|=2;var s=cw();(ft!==e||vt!==t)&&(pn=null,wo=Ve()+500,Xi(e,t));do try{Ak();break}catch(l){lw(e,l)}while(!0);Hp(),Qc.current=s,we=i,Je!==null?t=0:(ft=null,vt=0,t=st)}if(t!==0){if(t===2&&(i=bd(e),i!==0&&(n=i,t=Gd(e,i))),t===1)throw r=za,Xi(e,0),Yn(e,n),Xt(e,Ve()),r;if(t===6)Yn(e,n);else{if(i=e.current.alternate,!(n&30)&&!Dk(i)&&(t=Xc(e,n),t===2&&(s=bd(e),s!==0&&(n=s,t=Gd(e,s))),t===1))throw r=za,Xi(e,0),Yn(e,n),Xt(e,Ve()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(q(345));case 2:Di(e,Vt,pn);break;case 3:if(Yn(e,n),(n&130023424)===n&&(t=nm+500-Ve(),10<t)){if(Dc(e,0)!==0)break;if(i=e.suspendedLanes,(i&n)!==n){At(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Rd(Di.bind(null,e,Vt,pn),t);break}Di(e,Vt,pn);break;case 4:if(Yn(e,n),(n&4194240)===n)break;for(t=e.eventTimes,i=-1;0<n;){var o=31-Ir(n);s=1<<o,o=t[o],o>i&&(i=o),n&=~s}if(n=i,n=Ve()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Tk(n/1960))-n,10<n){e.timeoutHandle=Rd(Di.bind(null,e,Vt,pn),n);break}Di(e,Vt,pn);break;case 5:Di(e,Vt,pn);break;default:throw Error(q(329))}}}return Xt(e,Ve()),e.callbackNode===r?aw.bind(null,e):null}function Gd(e,t){var r=ga;return e.current.memoizedState.isDehydrated&&(Xi(e,t).flags|=256),e=Xc(e,t),e!==2&&(t=Vt,Vt=r,t!==null&&Xd(t)),e}function Xd(e){Vt===null?Vt=e:Vt.push.apply(Vt,e)}function Dk(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var i=r[n],s=i.getSnapshot;i=i.value;try{if(!Br(s(),i))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;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 Yn(e,t){for(t&=~rm,t&=~bu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Ir(t),n=1<<r;e[r]=-1,t&=~n}}function l0(e){if(we&6)throw Error(q(327));Js();var t=Dc(e,0);if(!(t&1))return Xt(e,Ve()),null;var r=Xc(e,t);if(e.tag!==0&&r===2){var n=bd(e);n!==0&&(t=n,r=Gd(e,n))}if(r===1)throw r=za,Xi(e,0),Yn(e,t),Xt(e,Ve()),r;if(r===6)throw Error(q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Di(e,Vt,pn),Xt(e,Ve()),null}function im(e,t){var r=we;we|=1;try{return e(t)}finally{we=r,we===0&&(wo=Ve()+500,vu&&Ei())}}function is(e){ai!==null&&ai.tag===0&&!(we&6)&&Js();var t=we;we|=1;var r=Cr.transition,n=ke;try{if(Cr.transition=null,ke=1,e)return e()}finally{ke=n,Cr.transition=r,we=t,!(we&6)&&Ei()}}function sm(){ar=Ws.current,De(Ws)}function Xi(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,ck(r)),Je!==null)for(r=Je.return;r!==null;){var n=r;switch(Bp(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Fc();break;case 3:xo(),De(Yt),De(Et),Qp();break;case 5:Vp(n);break;case 4:xo();break;case 13:De(Fe);break;case 19:De(Fe);break;case 10:Wp(n.type._context);break;case 22:case 23:sm()}r=r.return}if(ft=e,Je=e=gi(e.current,null),vt=ar=t,st=0,za=null,rm=bu=ns=0,Vt=ga=null,Fi!==null){for(t=0;t<Fi.length;t++)if(r=Fi[t],n=r.interleaved,n!==null){r.interleaved=null;var i=n.next,s=r.pending;if(s!==null){var o=s.next;s.next=i,n.next=o}r.pending=n}Fi=null}return e}function lw(e,t){do{var r=Je;try{if(Hp(),cc.current=Vc,qc){for(var n=Be.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}qc=!1}if(rs=0,ct=nt=Be=null,pa=!1,Ia=0,tm.current=null,r===null||r.return===null){st=1,za=t,Je=null;break}e:{var s=e,o=r.return,l=r,u=t;if(t=vt,l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var c=u,h=l,d=h.tag;if(!(h.mode&1)&&(d===0||d===11||d===15)){var f=h.alternate;f?(h.updateQueue=f.updateQueue,h.memoizedState=f.memoizedState,h.lanes=f.lanes):(h.updateQueue=null,h.memoizedState=null)}var p=Yg(o);if(p!==null){p.flags&=-257,Gg(p,o,l,s,t),p.mode&1&&Qg(s,c,t),t=p,u=c;var m=t.updateQueue;if(m===null){var x=new Set;x.add(u),t.updateQueue=x}else m.add(u);break e}else{if(!(t&1)){Qg(s,c,t),om();break e}u=Error(q(426))}}else if(Le&&l.mode&1){var C=Yg(o);if(C!==null){!(C.flags&65536)&&(C.flags|=256),Gg(C,o,l,s,t),zp(_o(u,l));break e}}s=u=_o(u,l),st!==4&&(st=2),ga===null?ga=[s]:ga.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var y=K_(s,u,t);Hg(s,y);break e;case 1:l=u;var v=s.type,g=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(pi===null||!pi.has(g)))){s.flags|=65536,t&=-t,s.lanes|=t;var _=q_(s,l,t);Hg(s,_);break e}}s=s.return}while(s!==null)}hw(r)}catch(N){t=N,Je===r&&r!==null&&(Je=r=r.return);continue}break}while(!0)}function cw(){var e=Qc.current;return Qc.current=Vc,e===null?Vc:e}function om(){(st===0||st===3||st===2)&&(st=4),ft===null||!(ns&268435455)&&!(bu&268435455)||Yn(ft,vt)}function Xc(e,t){var r=we;we|=2;var n=cw();(ft!==e||vt!==t)&&(pn=null,Xi(e,t));do try{Lk();break}catch(i){lw(e,i)}while(!0);if(Hp(),we=r,Qc.current=n,Je!==null)throw Error(q(261));return ft=null,vt=0,st}function Lk(){for(;Je!==null;)uw(Je)}function Ak(){for(;Je!==null&&!oC();)uw(Je)}function uw(e){var t=fw(e.alternate,e,ar);e.memoizedProps=e.pendingProps,t===null?hw(e):Je=t,tm.current=null}function hw(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=jk(r,t),r!==null){r.flags&=32767,Je=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{st=6,Je=null;return}}else if(r=Ek(r,t,ar),r!==null){Je=r;return}if(t=t.sibling,t!==null){Je=t;return}Je=t=e}while(t!==null);st===0&&(st=5)}function Di(e,t,r){var n=ke,i=Cr.transition;try{Cr.transition=null,ke=1,Ok(e,t,r,n)}finally{Cr.transition=i,ke=n}return null}function Ok(e,t,r,n){do Js();while(ai!==null);if(we&6)throw Error(q(327));r=e.finishedWork;var i=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(q(177));e.callbackNode=null,e.callbackPriority=0;var s=r.lanes|r.childLanes;if(gC(e,s),e===ft&&(Je=ft=null,vt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Al||(Al=!0,pw(Tc,function(){return Js(),null})),s=(r.flags&15990)!==0,r.subtreeFlags&15990||s){s=Cr.transition,Cr.transition=null;var o=ke;ke=1;var l=we;we|=4,tm.current=null,Rk(e,r),sw(r,e),rk(jd),Lc=!!Ed,jd=Ed=null,e.current=r,Mk(r),aC(),we=l,ke=o,Cr.transition=s}else e.current=r;if(Al&&(Al=!1,ai=e,Gc=i),s=e.pendingLanes,s===0&&(pi=null),uC(r.stateNode),Xt(e,Ve()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)i=t[r],n(i.value,{componentStack:i.stack,digest:i.digest});if(Yc)throw Yc=!1,e=Qd,Qd=null,e;return Gc&1&&e.tag!==0&&Js(),s=e.pendingLanes,s&1?e===Yd?ya++:(ya=0,Yd=e):ya=0,Ei(),null}function Js(){if(ai!==null){var e=Kx(Gc),t=Cr.transition,r=ke;try{if(Cr.transition=null,ke=16>e?16:e,ai===null)var n=!1;else{if(e=ai,ai=null,Gc=0,we&6)throw Error(q(331));var i=we;for(we|=4,te=e.current;te!==null;){var s=te,o=s.child;if(te.flags&16){var l=s.deletions;if(l!==null){for(var u=0;u<l.length;u++){var c=l[u];for(te=c;te!==null;){var h=te;switch(h.tag){case 0:case 11:case 15:ma(8,h,s)}var d=h.child;if(d!==null)d.return=h,te=d;else for(;te!==null;){h=te;var f=h.sibling,p=h.return;if(rw(h),h===c){te=null;break}if(f!==null){f.return=p,te=f;break}te=p}}}var m=s.alternate;if(m!==null){var x=m.child;if(x!==null){m.child=null;do{var C=x.sibling;x.sibling=null,x=C}while(x!==null)}}te=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,te=o;else e:for(;te!==null;){if(s=te,s.flags&2048)switch(s.tag){case 0:case 11:case 15:ma(9,s,s.return)}var y=s.sibling;if(y!==null){y.return=s.return,te=y;break e}te=s.return}}var v=e.current;for(te=v;te!==null;){o=te;var g=o.child;if(o.subtreeFlags&2064&&g!==null)g.return=o,te=g;else e:for(o=v;te!==null;){if(l=te,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:wu(9,l)}}catch(N){We(l,l.return,N)}if(l===o){te=null;break e}var _=l.sibling;if(_!==null){_.return=l.return,te=_;break e}te=l.return}}if(we=i,Ei(),rn&&typeof rn.onPostCommitFiberRoot=="function")try{rn.onPostCommitFiberRoot(fu,e)}catch{}n=!0}return n}finally{ke=r,Cr.transition=t}}return!1}function c0(e,t,r){t=_o(r,t),t=K_(e,t,1),e=fi(e,t,1),t=At(),e!==null&&(il(e,1,t),Xt(e,t))}function We(e,t,r){if(e.tag===3)c0(e,e,r);else for(;t!==null;){if(t.tag===3){c0(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(pi===null||!pi.has(n))){e=_o(r,e),e=q_(t,e,1),t=fi(t,e,1),e=At(),t!==null&&(il(t,1,e),Xt(t,e));break}}t=t.return}}function Ik(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=At(),e.pingedLanes|=e.suspendedLanes&r,ft===e&&(vt&r)===r&&(st===4||st===3&&(vt&130023424)===vt&&500>Ve()-nm?Xi(e,0):rm|=r),Xt(e,t)}function dw(e,t){t===0&&(e.mode&1?(t=kl,kl<<=1,!(kl&130023424)&&(kl=4194304)):t=1);var r=At();e=Rn(e,t),e!==null&&(il(e,t,r),Xt(e,r))}function Fk(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),dw(e,r)}function Bk(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(q(314))}n!==null&&n.delete(t),dw(e,r)}var fw;fw=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Yt.current)Qt=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Qt=!1,Nk(e,t,r);Qt=!!(e.flags&131072)}else Qt=!1,Le&&t.flags&1048576&&y_(t,$c,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;hc(e,t),e=t.pendingProps;var i=go(t,Et.current);Xs(t,r),i=Gp(null,t,n,e,i,r);var s=Xp();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Gt(n)?(s=!0,Bc(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Kp(t),i.updater=_u,t.stateNode=i,i._reactInternals=t,Id(t,n,e,r),t=zd(null,t,n,!0,s,r)):(t.tag=0,Le&&s&&Fp(t),Tt(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(hc(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=$k(n),e=Tr(n,e),i){case 0:t=Bd(null,t,n,e,r);break e;case 1:t=Zg(null,t,n,e,r);break e;case 11:t=Xg(null,t,n,e,r);break e;case 14:t=Jg(null,t,n,Tr(n.type,e),r);break e}throw Error(q(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Tr(n,i),Bd(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Tr(n,i),Zg(e,t,n,i,r);case 3:e:{if(G_(t),e===null)throw Error(q(387));n=t.pendingProps,s=t.memoizedState,i=s.element,S_(e,t),Uc(t,n,null,r);var o=t.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=_o(Error(q(423)),t),t=e0(e,t,n,r,i);break e}else if(n!==i){i=_o(Error(q(424)),t),t=e0(e,t,n,r,i);break e}else for(lr=di(t.stateNode.containerInfo.firstChild),ur=t,Le=!0,Or=null,r=w_(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(yo(),n===i){t=Mn(e,t,r);break e}Tt(e,t,n,r)}t=t.child}return t;case 5:return C_(t),e===null&&Ld(t),n=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Pd(n,i)?o=null:s!==null&&Pd(n,s)&&(t.flags|=32),Y_(e,t),Tt(e,t,o,r),t.child;case 6:return e===null&&Ld(t),null;case 13:return X_(e,t,r);case 4:return qp(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=vo(t,null,n,r):Tt(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Tr(n,i),Xg(e,t,n,i,r);case 7:return Tt(e,t,t.pendingProps,r),t.child;case 8:return Tt(e,t,t.pendingProps.children,r),t.child;case 12:return Tt(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Pe(Hc,n._currentValue),n._currentValue=o,s!==null)if(Br(s.value,o)){if(s.children===i.children&&!Yt.current){t=Mn(e,t,r);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var u=l.firstContext;u!==null;){if(u.context===n){if(s.tag===1){u=kn(-1,r&-r),u.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var h=c.pending;h===null?u.next=u:(u.next=h.next,h.next=u),c.pending=u}}s.lanes|=r,u=s.alternate,u!==null&&(u.lanes|=r),Ad(s.return,r,t),l.lanes|=r;break}u=u.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(q(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),Ad(o,r,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Tt(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,Xs(t,r),i=Nr(i),n=n(i),t.flags|=1,Tt(e,t,n,r),t.child;case 14:return n=t.type,i=Tr(n,t.pendingProps),i=Tr(n.type,i),Jg(e,t,n,i,r);case 15:return V_(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Tr(n,i),hc(e,t),t.tag=1,Gt(n)?(e=!0,Bc(t)):e=!1,Xs(t,r),U_(t,n,i),Id(t,n,i,r),zd(null,t,n,!0,e,r);case 19:return J_(e,t,r);case 22:return Q_(e,t,r)}throw Error(q(156,t.tag))};function pw(e,t){return $x(e,t)}function zk(e,t,r,n){this.tag=e,this.key=r,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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(e,t,r,n){return new zk(e,t,r,n)}function am(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $k(e){if(typeof e=="function")return am(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Np)return 11;if(e===Ep)return 14}return 2}function gi(e,t){var r=e.alternate;return r===null?(r=Sr(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function pc(e,t,r,n,i,s){var o=2;if(n=e,typeof e=="function")am(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ds:return Ji(r.children,i,s,t);case kp:o=8,i|=8;break;case ad:return e=Sr(12,r,t,i|2),e.elementType=ad,e.lanes=s,e;case ld:return e=Sr(13,r,t,i),e.elementType=ld,e.lanes=s,e;case cd:return e=Sr(19,r,t,i),e.elementType=cd,e.lanes=s,e;case Cx:return Su(r,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case bx:o=10;break e;case Sx:o=9;break e;case Np:o=11;break e;case Ep:o=14;break e;case Kn:o=16,n=null;break e}throw Error(q(130,e==null?e:typeof e,""))}return t=Sr(o,r,t,i),t.elementType=e,t.type=n,t.lanes=s,t}function Ji(e,t,r,n){return e=Sr(7,e,n,t),e.lanes=r,e}function Su(e,t,r,n){return e=Sr(22,e,n,t),e.elementType=Cx,e.lanes=r,e.stateNode={isHidden:!1},e}function gh(e,t,r){return e=Sr(6,e,null,t),e.lanes=r,e}function yh(e,t,r){return t=Sr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Hk(e,t,r,n,i){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=Xu(0),this.expirationTimes=Xu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xu(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function lm(e,t,r,n,i,s,o,l,u){return e=new Hk(e,t,r,l,u),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Sr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Kp(s),e}function Wk(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ts,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function mw(e){if(!e)return wi;e=e._reactInternals;e:{if(ps(e)!==e||e.tag!==1)throw Error(q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Gt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(q(171))}if(e.tag===1){var r=e.type;if(Gt(r))return m_(e,r,t)}return t}function gw(e,t,r,n,i,s,o,l,u){return e=lm(r,n,!0,e,i,s,o,l,u),e.context=mw(null),r=e.current,n=At(),i=mi(r),s=kn(n,i),s.callback=t??null,fi(r,s,i),e.current.lanes=i,il(e,i,n),Xt(e,n),e}function Cu(e,t,r,n){var i=t.current,s=At(),o=mi(i);return r=mw(r),t.context===null?t.context=r:t.pendingContext=r,t=kn(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=fi(i,t,o),e!==null&&(Fr(e,i,o,s),lc(e,i,o)),o}function Jc(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 u0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function cm(e,t){u0(e,t),(e=e.alternate)&&u0(e,t)}function Uk(){return null}var yw=typeof reportError=="function"?reportError:function(e){console.error(e)};function um(e){this._internalRoot=e}ku.prototype.render=um.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(q(409));Cu(e,t,null,null)};ku.prototype.unmount=um.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;is(function(){Cu(null,e,null,null)}),t[Pn]=null}};function ku(e){this._internalRoot=e}ku.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qx();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Qn.length&&t!==0&&t<Qn[r].priority;r++);Qn.splice(r,0,e),r===0&&Gx(e)}};function hm(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Nu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function h0(){}function Kk(e,t,r,n,i){if(i){if(typeof n=="function"){var s=n;n=function(){var c=Jc(o);s.call(c)}}var o=gw(t,n,e,0,null,!1,!1,"",h0);return e._reactRootContainer=o,e[Pn]=o.current,Ta(e.nodeType===8?e.parentNode:e),is(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof n=="function"){var l=n;n=function(){var c=Jc(u);l.call(c)}}var u=lm(e,0,!1,null,null,!1,!1,"",h0);return e._reactRootContainer=u,e[Pn]=u.current,Ta(e.nodeType===8?e.parentNode:e),is(function(){Cu(t,u,r,n)}),u}function Eu(e,t,r,n,i){var s=r._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var l=i;i=function(){var u=Jc(o);l.call(u)}}Cu(t,o,e,i)}else o=Kk(r,t,e,i,n);return Jc(o)}qx=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=ta(t.pendingLanes);r!==0&&(Rp(t,r|1),Xt(t,Ve()),!(we&6)&&(wo=Ve()+500,Ei()))}break;case 13:is(function(){var n=Rn(e,1);if(n!==null){var i=At();Fr(n,e,1,i)}}),cm(e,1)}};Mp=function(e){if(e.tag===13){var t=Rn(e,134217728);if(t!==null){var r=At();Fr(t,e,134217728,r)}cm(e,134217728)}};Vx=function(e){if(e.tag===13){var t=mi(e),r=Rn(e,t);if(r!==null){var n=At();Fr(r,e,t,n)}cm(e,t)}};Qx=function(){return ke};Yx=function(e,t){var r=ke;try{return ke=e,t()}finally{ke=r}};xd=function(e,t,r){switch(t){case"input":if(dd(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var i=yu(n);if(!i)throw Error(q(90));Nx(n),dd(n,i)}}}break;case"textarea":jx(e,r);break;case"select":t=r.value,t!=null&&Vs(e,!!r.multiple,t,!1)}};Ax=im;Ox=is;var qk={usingClientEntryPoint:!1,Events:[ol,Is,yu,Dx,Lx,im]},Ho={findFiberByHostInstance:Ii,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Vk={bundleType:Ho.bundleType,version:Ho.version,rendererPackageName:Ho.rendererPackageName,rendererConfig:Ho.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Dn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Bx(e),e===null?null:e.stateNode},findFiberByHostInstance:Ho.findFiberByHostInstance||Uk,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 Ol=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ol.isDisabled&&Ol.supportsFiber)try{fu=Ol.inject(Vk),rn=Ol}catch{}}fr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qk;fr.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!hm(t))throw Error(q(200));return Wk(e,t,null,r)};fr.createRoot=function(e,t){if(!hm(e))throw Error(q(299));var r=!1,n="",i=yw;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=lm(e,1,!1,null,null,r,!1,n,i),e[Pn]=t.current,Ta(e.nodeType===8?e.parentNode:e),new um(t)};fr.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(q(188)):(e=Object.keys(e).join(","),Error(q(268,e)));return e=Bx(t),e=e===null?null:e.stateNode,e};fr.flushSync=function(e){return is(e)};fr.hydrate=function(e,t,r){if(!Nu(t))throw Error(q(200));return Eu(null,e,t,!0,r)};fr.hydrateRoot=function(e,t,r){if(!hm(e))throw Error(q(405));var n=r!=null&&r.hydratedSources||null,i=!1,s="",o=yw;if(r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(s=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=gw(t,null,e,1,r??null,i,!1,s,o),e[Pn]=t.current,Ta(e),n)for(e=0;e<n.length;e++)r=n[e],i=r._getVersion,i=i(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,i]:t.mutableSourceEagerHydrationData.push(r,i);return new ku(t)};fr.render=function(e,t,r){if(!Nu(t))throw Error(q(200));return Eu(null,e,t,!1,r)};fr.unmountComponentAtNode=function(e){if(!Nu(e))throw Error(q(40));return e._reactRootContainer?(is(function(){Eu(null,null,e,!1,function(){e._reactRootContainer=null,e[Pn]=null})}),!0):!1};fr.unstable_batchedUpdates=im;fr.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Nu(r))throw Error(q(200));if(e==null||e._reactInternals===void 0)throw Error(q(38));return Eu(e,t,r,!1,n)};fr.version="18.3.1-next-f1338f8080-20240426";function vw(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vw)}catch(e){console.error(e)}}vw(),vx.exports=fr;var ms=vx.exports;const Qk=rl(ms);var d0=ms;sd.createRoot=d0.createRoot,sd.hydrateRoot=d0.hydrateRoot;var jo=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(){}},Yk={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Xn,gp,qv,Gk=(qv=class{constructor(){ne(this,Xn,Yk);ne(this,gp,!1)}setTimeoutProvider(e){J(this,Xn,e)}setTimeout(e,t){return T(this,Xn).setTimeout(e,t)}clearTimeout(e){T(this,Xn).clearTimeout(e)}setInterval(e,t){return T(this,Xn).setInterval(e,t)}clearInterval(e){T(this,Xn).clearInterval(e)}},Xn=new WeakMap,gp=new WeakMap,qv),zi=new Gk;function Xk(e){setTimeout(e,0)}var ss=typeof window>"u"||"Deno"in globalThis;function Dt(){}function Jk(e,t){return typeof e=="function"?e(t):e}function Jd(e){return typeof e=="number"&&e>=0&&e!==1/0}function xw(e,t){return Math.max(e+(t||0)-Date.now(),0)}function yi(e,t){return typeof e=="function"?e(t):e}function vr(e,t){return typeof e=="function"?e(t):e}function f0(e,t){const{type:r="all",exact:n,fetchStatus:i,predicate:s,queryKey:o,stale:l}=e;if(o){if(n){if(t.queryHash!==dm(o,t.options))return!1}else if(!$a(t.queryKey,o))return!1}if(r!=="all"){const u=t.isActive();if(r==="active"&&!u||r==="inactive"&&u)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||i&&i!==t.state.fetchStatus||s&&!s(t))}function p0(e,t){const{exact:r,status:n,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(r){if(os(t.options.mutationKey)!==os(s))return!1}else if(!$a(t.options.mutationKey,s))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function dm(e,t){return((t==null?void 0:t.queryKeyHashFn)||os)(e)}function os(e){return JSON.stringify(e,(t,r)=>Zd(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):r)}function $a(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>$a(e[r],t[r])):!1}var Zk=Object.prototype.hasOwnProperty;function _w(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=m0(e)&&m0(t);if(!n&&!(Zd(e)&&Zd(t)))return t;const s=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),l=o.length,u=n?new Array(l):{};let c=0;for(let h=0;h<l;h++){const d=n?h:o[h],f=e[d],p=t[d];if(f===p){u[d]=f,(n?h<s:Zk.call(e,d))&&c++;continue}if(f===null||p===null||typeof f!="object"||typeof p!="object"){u[d]=p;continue}const m=_w(f,p,r+1);u[d]=m,m===f&&c++}return s===l&&c===s?e:u}function Zc(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function m0(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Zd(e){if(!g0(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!g0(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function g0(e){return Object.prototype.toString.call(e)==="[object Object]"}function e2(e){return new Promise(t=>{zi.setTimeout(t,e)})}function ef(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?_w(e,t):t}function t2(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function r2(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var fm=Symbol();function ww(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===fm?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function pm(e,t){return typeof e=="function"?e(...t):!!e}function n2(e,t,r){let n=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),n||(n=!0,i.aborted?r():i.addEventListener("abort",r,{once:!0})),i)}),e}var Hi,Jn,ro,Vv,i2=(Vv=class extends jo{constructor(){super();ne(this,Hi);ne(this,Jn);ne(this,ro);J(this,ro,t=>{if(!ss&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){T(this,Jn)||this.setEventListener(T(this,ro))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,Jn))==null||t.call(this),J(this,Jn,void 0))}setEventListener(t){var r;J(this,ro,t),(r=T(this,Jn))==null||r.call(this),J(this,Jn,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){T(this,Hi)!==t&&(J(this,Hi,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof T(this,Hi)=="boolean"?T(this,Hi):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Hi=new WeakMap,Jn=new WeakMap,ro=new WeakMap,Vv),mm=new i2;function tf(){let e,t;const r=new Promise((i,s)=>{e=i,t=s});r.status="pending",r.catch(()=>{});function n(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{n({status:"fulfilled",value:i}),e(i)},r.reject=i=>{n({status:"rejected",reason:i}),t(i)},r}var s2=Xk;function o2(){let e=[],t=0,r=l=>{l()},n=l=>{l()},i=s2;const s=l=>{t?e.push(l):i(()=>{r(l)})},o=()=>{const l=e;e=[],l.length&&i(()=>{n(()=>{l.forEach(u=>{r(u)})})})};return{batch:l=>{let u;t++;try{u=l()}finally{t--,t||o()}return u},batchCalls:l=>(...u)=>{s(()=>{l(...u)})},schedule:s,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{i=l}}}var it=o2(),no,Zn,io,Qv,a2=(Qv=class extends jo{constructor(){super();ne(this,no,!0);ne(this,Zn);ne(this,io);J(this,io,t=>{if(!ss&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){T(this,Zn)||this.setEventListener(T(this,io))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,Zn))==null||t.call(this),J(this,Zn,void 0))}setEventListener(t){var r;J(this,io,t),(r=T(this,Zn))==null||r.call(this),J(this,Zn,t(this.setOnline.bind(this)))}setOnline(t){T(this,no)!==t&&(J(this,no,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return T(this,no)}},no=new WeakMap,Zn=new WeakMap,io=new WeakMap,Qv),eu=new a2;function l2(e){return Math.min(1e3*2**e,3e4)}function bw(e){return(e??"online")==="online"?eu.isOnline():!0}var rf=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Sw(e){let t=!1,r=0,n;const i=tf(),s=()=>i.status!=="pending",o=x=>{var C;if(!s()){const y=new rf(x);f(y),(C=e.onCancel)==null||C.call(e,y)}},l=()=>{t=!0},u=()=>{t=!1},c=()=>mm.isFocused()&&(e.networkMode==="always"||eu.isOnline())&&e.canRun(),h=()=>bw(e.networkMode)&&e.canRun(),d=x=>{s()||(n==null||n(),i.resolve(x))},f=x=>{s()||(n==null||n(),i.reject(x))},p=()=>new Promise(x=>{var C;n=y=>{(s()||c())&&x(y)},(C=e.onPause)==null||C.call(e)}).then(()=>{var x;n=void 0,s()||(x=e.onContinue)==null||x.call(e)}),m=()=>{if(s())return;let x;const C=r===0?e.initialPromise:void 0;try{x=C??e.fn()}catch(y){x=Promise.reject(y)}Promise.resolve(x).then(d).catch(y=>{var S;if(s())return;const v=e.retry??(ss?0:3),g=e.retryDelay??l2,_=typeof g=="function"?g(r,y):g,N=v===!0||typeof v=="number"&&r<v||typeof v=="function"&&v(r,y);if(t||!N){f(y);return}r++,(S=e.onFail)==null||S.call(e,r,y),e2(_).then(()=>c()?void 0:p()).then(()=>{t?f(y):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(n==null||n(),i),cancelRetry:l,continueRetry:u,canStart:h,start:()=>(h()?m():p().then(m),i)}}var Wi,Yv,Cw=(Yv=class{constructor(){ne(this,Wi)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jd(this.gcTime)&&J(this,Wi,zi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ss?1/0:5*60*1e3))}clearGcTimeout(){T(this,Wi)&&(zi.clearTimeout(T(this,Wi)),J(this,Wi,void 0))}},Wi=new WeakMap,Yv),Ui,so,yr,Ki,at,Xa,qi,Dr,fn,Gv,c2=(Gv=class extends Cw{constructor(t){super();ne(this,Dr);ne(this,Ui);ne(this,so);ne(this,yr);ne(this,Ki);ne(this,at);ne(this,Xa);ne(this,qi);J(this,qi,!1),J(this,Xa,t.defaultOptions),this.setOptions(t.options),this.observers=[],J(this,Ki,t.client),J(this,yr,T(this,Ki).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,J(this,Ui,v0(this.options)),this.state=t.state??T(this,Ui),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=T(this,at))==null?void 0:t.promise}setOptions(t){if(this.options={...T(this,Xa),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=v0(this.options);r.data!==void 0&&(this.setState(y0(r.data,r.dataUpdatedAt)),J(this,Ui,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&T(this,yr).remove(this)}setData(t,r){const n=ef(this.state.data,t,this.options);return he(this,Dr,fn).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){he(this,Dr,fn).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,i;const r=(n=T(this,at))==null?void 0:n.promise;return(i=T(this,at))==null||i.cancel(t),r?r.then(Dt).catch(Dt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(T(this,Ui))}isActive(){return this.observers.some(t=>vr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===fm||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>yi(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:!xw(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=T(this,at))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=T(this,at))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),T(this,yr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(T(this,at)&&(T(this,qi)?T(this,at).cancel({revert:!0}):T(this,at).cancelRetry()),this.scheduleGc()),T(this,yr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,Dr,fn).call(this,{type:"invalidate"})}async fetch(t,r){var u,c,h,d,f,p,m,x,C,y,v,g;if(this.state.fetchStatus!=="idle"&&((u=T(this,at))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(T(this,at))return T(this,at).continueRetry(),T(this,at).promise}if(t&&this.setOptions(t),!this.options.queryFn){const _=this.observers.find(N=>N.options.queryFn);_&&this.setOptions(_.options)}const n=new AbortController,i=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(J(this,qi,!0),n.signal)})},s=()=>{const _=ww(this.options,r),S=(()=>{const j={client:T(this,Ki),queryKey:this.queryKey,meta:this.meta};return i(j),j})();return J(this,qi,!1),this.options.persister?this.options.persister(_,S,this):_(S)},l=(()=>{const _={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:T(this,Ki),state:this.state,fetchFn:s};return i(_),_})();(c=this.options.behavior)==null||c.onFetch(l,this),J(this,so,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=l.fetchOptions)==null?void 0:h.meta))&&he(this,Dr,fn).call(this,{type:"fetch",meta:(d=l.fetchOptions)==null?void 0:d.meta}),J(this,at,Sw({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,onCancel:_=>{_ instanceof rf&&_.revert&&this.setState({...T(this,so),fetchStatus:"idle"}),n.abort()},onFail:(_,N)=>{he(this,Dr,fn).call(this,{type:"failed",failureCount:_,error:N})},onPause:()=>{he(this,Dr,fn).call(this,{type:"pause"})},onContinue:()=>{he(this,Dr,fn).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const _=await T(this,at).start();if(_===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(_),(p=(f=T(this,yr).config).onSuccess)==null||p.call(f,_,this),(x=(m=T(this,yr).config).onSettled)==null||x.call(m,_,this.state.error,this),_}catch(_){if(_ instanceof rf){if(_.silent)return T(this,at).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw he(this,Dr,fn).call(this,{type:"error",error:_}),(y=(C=T(this,yr).config).onError)==null||y.call(C,_,this),(g=(v=T(this,yr).config).onSettled)==null||g.call(v,this.state.data,_,this),_}finally{this.scheduleGc()}}},Ui=new WeakMap,so=new WeakMap,yr=new WeakMap,Ki=new WeakMap,at=new WeakMap,Xa=new WeakMap,qi=new WeakMap,Dr=new WeakSet,fn=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...kw(n.data,this.options),fetchMeta:t.meta??null};case"success":const i={...n,...y0(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return J(this,so,t.manual?i:void 0),i;case"error":const s=t.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),it.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),T(this,yr).notify({query:this,type:"updated",action:t})})},Gv);function kw(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:bw(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function y0(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function v0(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Kt,xe,Ja,Mt,Vi,oo,yn,ei,Za,ao,lo,Qi,Yi,ti,co,Ce,na,nf,sf,of,af,lf,cf,uf,Nw,Xv,u2=(Xv=class extends jo{constructor(t,r){super();ne(this,Ce);ne(this,Kt);ne(this,xe);ne(this,Ja);ne(this,Mt);ne(this,Vi);ne(this,oo);ne(this,yn);ne(this,ei);ne(this,Za);ne(this,ao);ne(this,lo);ne(this,Qi);ne(this,Yi);ne(this,ti);ne(this,co,new Set);this.options=r,J(this,Kt,t),J(this,ei,null),J(this,yn,tf()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(T(this,xe).addObserver(this),x0(T(this,xe),this.options)?he(this,Ce,na).call(this):this.updateResult(),he(this,Ce,af).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return hf(T(this,xe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return hf(T(this,xe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,Ce,lf).call(this),he(this,Ce,cf).call(this),T(this,xe).removeObserver(this)}setOptions(t){const r=this.options,n=T(this,xe);if(this.options=T(this,Kt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof vr(this.options.enabled,T(this,xe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,Ce,uf).call(this),T(this,xe).setOptions(this.options),r._defaulted&&!Zc(this.options,r)&&T(this,Kt).getQueryCache().notify({type:"observerOptionsUpdated",query:T(this,xe),observer:this});const i=this.hasListeners();i&&_0(T(this,xe),n,this.options,r)&&he(this,Ce,na).call(this),this.updateResult(),i&&(T(this,xe)!==n||vr(this.options.enabled,T(this,xe))!==vr(r.enabled,T(this,xe))||yi(this.options.staleTime,T(this,xe))!==yi(r.staleTime,T(this,xe)))&&he(this,Ce,nf).call(this);const s=he(this,Ce,sf).call(this);i&&(T(this,xe)!==n||vr(this.options.enabled,T(this,xe))!==vr(r.enabled,T(this,xe))||s!==T(this,ti))&&he(this,Ce,of).call(this,s)}getOptimisticResult(t){const r=T(this,Kt).getQueryCache().build(T(this,Kt),t),n=this.createResult(r,t);return d2(this,n)&&(J(this,Mt,n),J(this,oo,this.options),J(this,Vi,T(this,xe).state)),n}getCurrentResult(){return T(this,Mt)}trackResult(t,r){return new Proxy(t,{get:(n,i)=>(this.trackProp(i),r==null||r(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&T(this,yn).status==="pending"&&T(this,yn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,i))})}trackProp(t){T(this,co).add(t)}getCurrentQuery(){return T(this,xe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=T(this,Kt).defaultQueryOptions(t),n=T(this,Kt).getQueryCache().build(T(this,Kt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return he(this,Ce,na).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),T(this,Mt)))}createResult(t,r){var $;const n=T(this,xe),i=this.options,s=T(this,Mt),o=T(this,Vi),l=T(this,oo),c=t!==n?t.state:T(this,Ja),{state:h}=t;let d={...h},f=!1,p;if(r._optimisticResults){const z=this.hasListeners(),I=!z&&x0(t,r),P=z&&_0(t,n,r,i);(I||P)&&(d={...d,...kw(h.data,t.options)}),r._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:x,status:C}=d;p=d.data;let y=!1;if(r.placeholderData!==void 0&&p===void 0&&C==="pending"){let z;s!=null&&s.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(z=s.data,y=!0):z=typeof r.placeholderData=="function"?r.placeholderData(($=T(this,lo))==null?void 0:$.state.data,T(this,lo)):r.placeholderData,z!==void 0&&(C="success",p=ef(s==null?void 0:s.data,z,r),f=!0)}if(r.select&&p!==void 0&&!y)if(s&&p===(o==null?void 0:o.data)&&r.select===T(this,Za))p=T(this,ao);else try{J(this,Za,r.select),p=r.select(p),p=ef(s==null?void 0:s.data,p,r),J(this,ao,p),J(this,ei,null)}catch(z){J(this,ei,z)}T(this,ei)&&(m=T(this,ei),p=T(this,ao),x=Date.now(),C="error");const v=d.fetchStatus==="fetching",g=C==="pending",_=C==="error",N=g&&v,S=p!==void 0,A={status:C,fetchStatus:d.fetchStatus,isPending:g,isSuccess:C==="success",isError:_,isInitialLoading:N,isLoading:N,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:x,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:v,isRefetching:v&&!g,isLoadingError:_&&!S,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:_&&S,isStale:gm(t,r),refetch:this.refetch,promise:T(this,yn),isEnabled:vr(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const z=A.data!==void 0,I=A.status==="error"&&!z,P=L=>{I?L.reject(A.error):z&&L.resolve(A.data)},R=()=>{const L=J(this,yn,A.promise=tf());P(L)},D=T(this,yn);switch(D.status){case"pending":t.queryHash===n.queryHash&&P(D);break;case"fulfilled":(I||A.data!==D.value)&&R();break;case"rejected":(!I||A.error!==D.reason)&&R();break}}return A}updateResult(){const t=T(this,Mt),r=this.createResult(T(this,xe),this.options);if(J(this,Vi,T(this,xe).state),J(this,oo,this.options),T(this,Vi).data!==void 0&&J(this,lo,T(this,xe)),Zc(r,t))return;J(this,Mt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!T(this,co).size)return!0;const o=new Set(s??T(this,co));return this.options.throwOnError&&o.add("error"),Object.keys(T(this,Mt)).some(l=>{const u=l;return T(this,Mt)[u]!==t[u]&&o.has(u)})};he(this,Ce,Nw).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,Ce,af).call(this)}},Kt=new WeakMap,xe=new WeakMap,Ja=new WeakMap,Mt=new WeakMap,Vi=new WeakMap,oo=new WeakMap,yn=new WeakMap,ei=new WeakMap,Za=new WeakMap,ao=new WeakMap,lo=new WeakMap,Qi=new WeakMap,Yi=new WeakMap,ti=new WeakMap,co=new WeakMap,Ce=new WeakSet,na=function(t){he(this,Ce,uf).call(this);let r=T(this,xe).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Dt)),r},nf=function(){he(this,Ce,lf).call(this);const t=yi(this.options.staleTime,T(this,xe));if(ss||T(this,Mt).isStale||!Jd(t))return;const n=xw(T(this,Mt).dataUpdatedAt,t)+1;J(this,Qi,zi.setTimeout(()=>{T(this,Mt).isStale||this.updateResult()},n))},sf=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(T(this,xe)):this.options.refetchInterval)??!1},of=function(t){he(this,Ce,cf).call(this),J(this,ti,t),!(ss||vr(this.options.enabled,T(this,xe))===!1||!Jd(T(this,ti))||T(this,ti)===0)&&J(this,Yi,zi.setInterval(()=>{(this.options.refetchIntervalInBackground||mm.isFocused())&&he(this,Ce,na).call(this)},T(this,ti)))},af=function(){he(this,Ce,nf).call(this),he(this,Ce,of).call(this,he(this,Ce,sf).call(this))},lf=function(){T(this,Qi)&&(zi.clearTimeout(T(this,Qi)),J(this,Qi,void 0))},cf=function(){T(this,Yi)&&(zi.clearInterval(T(this,Yi)),J(this,Yi,void 0))},uf=function(){const t=T(this,Kt).getQueryCache().build(T(this,Kt),this.options);if(t===T(this,xe))return;const r=T(this,xe);J(this,xe,t),J(this,Ja,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},Nw=function(t){it.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(T(this,Mt))}),T(this,Kt).getQueryCache().notify({query:T(this,xe),type:"observerResultsUpdated"})})},Xv);function h2(e,t){return vr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function x0(e,t){return h2(e,t)||e.state.data!==void 0&&hf(e,t,t.refetchOnMount)}function hf(e,t,r){if(vr(t.enabled,e)!==!1&&yi(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&gm(e,t)}return!1}function _0(e,t,r,n){return(e!==t||vr(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&gm(e,r)}function gm(e,t){return vr(t.enabled,e)!==!1&&e.isStaleByTime(yi(t.staleTime,e))}function d2(e,t){return!Zc(e.getCurrentResult(),t)}function w0(e){return{onFetch:(t,r)=>{var h,d,f,p,m;const n=t.options,i=(f=(d=(h=t.fetchOptions)==null?void 0:h.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,s=((p=t.state.data)==null?void 0:p.pages)||[],o=((m=t.state.data)==null?void 0:m.pageParams)||[];let l={pages:[],pageParams:[]},u=0;const c=async()=>{let x=!1;const C=g=>{n2(g,()=>t.signal,()=>x=!0)},y=ww(t.options,t.fetchOptions),v=async(g,_,N)=>{if(x)return Promise.reject();if(_==null&&g.pages.length)return Promise.resolve(g);const j=(()=>{const I={client:t.client,queryKey:t.queryKey,pageParam:_,direction:N?"backward":"forward",meta:t.options.meta};return C(I),I})(),A=await y(j),{maxPages:$}=t.options,z=N?r2:t2;return{pages:z(g.pages,A,$),pageParams:z(g.pageParams,_,$)}};if(i&&s.length){const g=i==="backward",_=g?f2:b0,N={pages:s,pageParams:o},S=_(n,N);l=await v(N,S,g)}else{const g=e??s.length;do{const _=u===0?o[0]??n.initialPageParam:b0(n,l);if(u>0&&_==null)break;l=await v(l,_),u++}while(u<g)}return l};t.options.persister?t.fetchFn=()=>{var x,C;return(C=(x=t.options).persister)==null?void 0:C.call(x,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=c}}}function b0(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function f2(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var el,Yr,Ct,Gi,Gr,Wn,Jv,p2=(Jv=class extends Cw{constructor(t){super();ne(this,Gr);ne(this,el);ne(this,Yr);ne(this,Ct);ne(this,Gi);J(this,el,t.client),this.mutationId=t.mutationId,J(this,Ct,t.mutationCache),J(this,Yr,[]),this.state=t.state||Ew(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){T(this,Yr).includes(t)||(T(this,Yr).push(t),this.clearGcTimeout(),T(this,Ct).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){J(this,Yr,T(this,Yr).filter(r=>r!==t)),this.scheduleGc(),T(this,Ct).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){T(this,Yr).length||(this.state.status==="pending"?this.scheduleGc():T(this,Ct).remove(this))}continue(){var t;return((t=T(this,Gi))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,u,c,h,d,f,p,m,x,C,y,v,g,_,N,S,j;const r=()=>{he(this,Gr,Wn).call(this,{type:"continue"})},n={client:T(this,el),meta:this.options.meta,mutationKey:this.options.mutationKey};J(this,Gi,Sw({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(A,$)=>{he(this,Gr,Wn).call(this,{type:"failed",failureCount:A,error:$})},onPause:()=>{he(this,Gr,Wn).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>T(this,Ct).canRun(this)}));const i=this.state.status==="pending",s=!T(this,Gi).canStart();try{if(i)r();else{he(this,Gr,Wn).call(this,{type:"pending",variables:t,isPaused:s}),T(this,Ct).config.onMutate&&await T(this,Ct).config.onMutate(t,this,n);const $=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,n));$!==this.state.context&&he(this,Gr,Wn).call(this,{type:"pending",context:$,variables:t,isPaused:s})}const A=await T(this,Gi).start();return await((c=(u=T(this,Ct).config).onSuccess)==null?void 0:c.call(u,A,t,this.state.context,this,n)),await((d=(h=this.options).onSuccess)==null?void 0:d.call(h,A,t,this.state.context,n)),await((p=(f=T(this,Ct).config).onSettled)==null?void 0:p.call(f,A,null,this.state.variables,this.state.context,this,n)),await((x=(m=this.options).onSettled)==null?void 0:x.call(m,A,null,t,this.state.context,n)),he(this,Gr,Wn).call(this,{type:"success",data:A}),A}catch(A){try{await((y=(C=T(this,Ct).config).onError)==null?void 0:y.call(C,A,t,this.state.context,this,n))}catch($){Promise.reject($)}try{await((g=(v=this.options).onError)==null?void 0:g.call(v,A,t,this.state.context,n))}catch($){Promise.reject($)}try{await((N=(_=T(this,Ct).config).onSettled)==null?void 0:N.call(_,void 0,A,this.state.variables,this.state.context,this,n))}catch($){Promise.reject($)}try{await((j=(S=this.options).onSettled)==null?void 0:j.call(S,void 0,A,t,this.state.context,n))}catch($){Promise.reject($)}throw he(this,Gr,Wn).call(this,{type:"error",error:A}),A}finally{T(this,Ct).runNext(this)}}},el=new WeakMap,Yr=new WeakMap,Ct=new WeakMap,Gi=new WeakMap,Gr=new WeakSet,Wn=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,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{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),it.batch(()=>{T(this,Yr).forEach(n=>{n.onMutationUpdate(t)}),T(this,Ct).notify({mutation:this,type:"updated",action:t})})},Jv);function Ew(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var vn,Lr,tl,Zv,m2=(Zv=class extends jo{constructor(t={}){super();ne(this,vn);ne(this,Lr);ne(this,tl);this.config=t,J(this,vn,new Set),J(this,Lr,new Map),J(this,tl,0)}build(t,r,n){const i=new p2({client:t,mutationCache:this,mutationId:++xl(this,tl)._,options:t.defaultMutationOptions(r),state:n});return this.add(i),i}add(t){T(this,vn).add(t);const r=Il(t);if(typeof r=="string"){const n=T(this,Lr).get(r);n?n.push(t):T(this,Lr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(T(this,vn).delete(t)){const r=Il(t);if(typeof r=="string"){const n=T(this,Lr).get(r);if(n)if(n.length>1){const i=n.indexOf(t);i!==-1&&n.splice(i,1)}else n[0]===t&&T(this,Lr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Il(t);if(typeof r=="string"){const n=T(this,Lr).get(r),i=n==null?void 0:n.find(s=>s.state.status==="pending");return!i||i===t}else return!0}runNext(t){var n;const r=Il(t);if(typeof r=="string"){const i=(n=T(this,Lr).get(r))==null?void 0:n.find(s=>s!==t&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){it.batch(()=>{T(this,vn).forEach(t=>{this.notify({type:"removed",mutation:t})}),T(this,vn).clear(),T(this,Lr).clear()})}getAll(){return Array.from(T(this,vn))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>p0(r,n))}findAll(t={}){return this.getAll().filter(r=>p0(t,r))}notify(t){it.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return it.batch(()=>Promise.all(t.map(r=>r.continue().catch(Dt))))}},vn=new WeakMap,Lr=new WeakMap,tl=new WeakMap,Zv);function Il(e){var t;return(t=e.options.scope)==null?void 0:t.id}var xn,ri,qt,_n,En,mc,df,ex,g2=(ex=class extends jo{constructor(r,n){super();ne(this,En);ne(this,xn);ne(this,ri);ne(this,qt);ne(this,_n);J(this,xn,r),this.setOptions(n),this.bindMethods(),he(this,En,mc).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var i;const n=this.options;this.options=T(this,xn).defaultMutationOptions(r),Zc(this.options,n)||T(this,xn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:T(this,qt),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&os(n.mutationKey)!==os(this.options.mutationKey)?this.reset():((i=T(this,qt))==null?void 0:i.state.status)==="pending"&&T(this,qt).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=T(this,qt))==null||r.removeObserver(this)}onMutationUpdate(r){he(this,En,mc).call(this),he(this,En,df).call(this,r)}getCurrentResult(){return T(this,ri)}reset(){var r;(r=T(this,qt))==null||r.removeObserver(this),J(this,qt,void 0),he(this,En,mc).call(this),he(this,En,df).call(this)}mutate(r,n){var i;return J(this,_n,n),(i=T(this,qt))==null||i.removeObserver(this),J(this,qt,T(this,xn).getMutationCache().build(T(this,xn),this.options)),T(this,qt).addObserver(this),T(this,qt).execute(r)}},xn=new WeakMap,ri=new WeakMap,qt=new WeakMap,_n=new WeakMap,En=new WeakSet,mc=function(){var n;const r=((n=T(this,qt))==null?void 0:n.state)??Ew();J(this,ri,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},df=function(r){it.batch(()=>{var n,i,s,o,l,u,c,h;if(T(this,_n)&&this.hasListeners()){const d=T(this,ri).variables,f=T(this,ri).context,p={client:T(this,xn),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(i=(n=T(this,_n)).onSuccess)==null||i.call(n,r.data,d,f,p)}catch(m){Promise.reject(m)}try{(o=(s=T(this,_n)).onSettled)==null||o.call(s,r.data,null,d,f,p)}catch(m){Promise.reject(m)}}else if((r==null?void 0:r.type)==="error"){try{(u=(l=T(this,_n)).onError)==null||u.call(l,r.error,d,f,p)}catch(m){Promise.reject(m)}try{(h=(c=T(this,_n)).onSettled)==null||h.call(c,void 0,r.error,d,f,p)}catch(m){Promise.reject(m)}}}this.listeners.forEach(d=>{d(T(this,ri))})})},ex),Xr,tx,y2=(tx=class extends jo{constructor(t={}){super();ne(this,Xr);this.config=t,J(this,Xr,new Map)}build(t,r,n){const i=r.queryKey,s=r.queryHash??dm(i,r);let o=this.get(s);return o||(o=new c2({client:t,queryKey:i,queryHash:s,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){T(this,Xr).has(t.queryHash)||(T(this,Xr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=T(this,Xr).get(t.queryHash);r&&(t.destroy(),r===t&&T(this,Xr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){it.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return T(this,Xr).get(t)}getAll(){return[...T(this,Xr).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>f0(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>f0(t,n)):r}notify(t){it.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){it.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){it.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Xr=new WeakMap,tx),$e,ni,ii,uo,ho,si,fo,po,rx,v2=(rx=class{constructor(e={}){ne(this,$e);ne(this,ni);ne(this,ii);ne(this,uo);ne(this,ho);ne(this,si);ne(this,fo);ne(this,po);J(this,$e,e.queryCache||new y2),J(this,ni,e.mutationCache||new m2),J(this,ii,e.defaultOptions||{}),J(this,uo,new Map),J(this,ho,new Map),J(this,si,0)}mount(){xl(this,si)._++,T(this,si)===1&&(J(this,fo,mm.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,$e).onFocus())})),J(this,po,eu.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,$e).onOnline())})))}unmount(){var e,t;xl(this,si)._--,T(this,si)===0&&((e=T(this,fo))==null||e.call(this),J(this,fo,void 0),(t=T(this,po))==null||t.call(this),J(this,po,void 0))}isFetching(e){return T(this,$e).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return T(this,ni).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=T(this,$e).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=T(this,$e).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(yi(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return T(this,$e).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=T(this,$e).get(n.queryHash),s=i==null?void 0:i.state.data,o=Jk(t,s);if(o!==void 0)return T(this,$e).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return it.batch(()=>T(this,$e).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=T(this,$e).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=T(this,$e);it.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=T(this,$e);return it.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=it.batch(()=>T(this,$e).findAll(e).map(i=>i.cancel(r)));return Promise.all(n).then(Dt).catch(Dt)}invalidateQueries(e,t={}){return it.batch(()=>(T(this,$e).findAll(e).forEach(r=>{r.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 r={...t,cancelRefetch:t.cancelRefetch??!0},n=it.batch(()=>T(this,$e).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,r);return r.throwOnError||(s=s.catch(Dt)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(n).then(Dt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=T(this,$e).build(this,t);return r.isStaleByTime(yi(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Dt).catch(Dt)}fetchInfiniteQuery(e){return e.behavior=w0(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Dt).catch(Dt)}ensureInfiniteQueryData(e){return e.behavior=w0(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return eu.isOnline()?T(this,ni).resumePausedMutations():Promise.resolve()}getQueryCache(){return T(this,$e)}getMutationCache(){return T(this,ni)}getDefaultOptions(){return T(this,ii)}setDefaultOptions(e){J(this,ii,e)}setQueryDefaults(e,t){T(this,uo).set(os(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...T(this,uo).values()],r={};return t.forEach(n=>{$a(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){T(this,ho).set(os(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...T(this,ho).values()],r={};return t.forEach(n=>{$a(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...T(this,ii).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=dm(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===fm&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...T(this,ii).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){T(this,$e).clear(),T(this,ni).clear()}},$e=new WeakMap,ni=new WeakMap,ii=new WeakMap,uo=new WeakMap,ho=new WeakMap,si=new WeakMap,fo=new WeakMap,po=new WeakMap,rx),jw=w.createContext(void 0),Ft=e=>{const t=w.useContext(jw);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},x2=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(jw.Provider,{value:e,children:t})),Pw=w.createContext(!1),_2=()=>w.useContext(Pw);Pw.Provider;function w2(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var b2=w.createContext(w2()),S2=()=>w.useContext(b2),C2=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?pm(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},k2=e=>{w.useEffect(()=>{e.clearReset()},[e])},N2=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&e.data===void 0||pm(r,[e.error,n])),E2=e=>{if(e.suspense){const r=i=>i==="static"?i:Math.max(i??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...i)=>r(n(...i)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},j2=(e,t)=>e.isLoading&&e.isFetching&&!t,P2=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,S0=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function R2(e,t,r){var f,p,m,x;const n=_2(),i=S2(),s=Ft(),o=s.defaultQueryOptions(e);(p=(f=s.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||p.call(f,o);const l=s.getQueryCache().get(o.queryHash);o._optimisticResults=n?"isRestoring":"optimistic",E2(o),C2(o,i,l),k2(i);const u=!s.getQueryCache().get(o.queryHash),[c]=w.useState(()=>new t(s,o)),h=c.getOptimisticResult(o),d=!n&&e.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(C=>{const y=d?c.subscribe(it.batchCalls(C)):Dt;return c.updateResult(),y},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),w.useEffect(()=>{c.setOptions(o)},[o,c]),P2(o,h))throw S0(o,c,i);if(N2({result:h,errorResetBoundary:i,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw h.error;if((x=(m=s.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||x.call(m,o,h),o.experimental_prefetchInRender&&!ss&&j2(h,n)){const C=u?S0(o,c,i):l==null?void 0:l.promise;C==null||C.catch(Dt).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?h:c.trackResult(h)}function ae(e,t){return R2(e,u2)}function ue(e,t){const r=Ft(),[n]=w.useState(()=>new g2(r,e));w.useEffect(()=>{n.setOptions(e)},[n,e]);const i=w.useSyncExternalStore(w.useCallback(o=>n.subscribe(it.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),s=w.useCallback((o,l)=>{n.mutate(o,l).catch(Dt)},[n]);if(i.error&&pm(n.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}const C0=["backlog","todo","planning","in_progress","in_review","done"],mn={Backlog:"backlog",Triage:"backlog",Unknown:"backlog",Todo:"todo","To Do":"todo",Ready:"todo",Unstarted:"todo","In Planning":"planning",Planning:"planning",Planned:"planning",Discovery:"planning","In Progress":"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"};/**
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 M2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Rw=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).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 T2={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 D2=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...l},u)=>w.createElement("svg",{ref:u,...T2,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Rw("lucide",i),...l},[...o.map(([c,h])=>w.createElement(c,h)),...Array.isArray(s)?s:[s]]));/**
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 re=(e,t)=>{const r=w.forwardRef(({className:n,...i},s)=>w.createElement(D2,{ref:s,iconNode:t,className:Rw(`lucide-${M2(e)}`,n),...i}));return r.displayName=`${e}`,r};/**
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 bo=re("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 ym=re("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 ff=re("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 L2=re("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"}]]);/**
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 A2=re("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"}]]);/**
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 Mw=re("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"}]]);/**
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 Tw=re("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"}]]);/**
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 O2=re("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
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 tu=re("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 Dw=re("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 I2=re("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 F2=re("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 Us=re("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 B2=re("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 z2=re("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 as=re("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 So=re("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 Ps=re("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 $2=re("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 H2=re("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 ll=re("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 W2=re("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 Ha=re("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
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 Lw=re("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"}]]);/**
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 Aw=re("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"}]]);/**
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 Ow=re("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"}]]);/**
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 cl=re("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"}]]);/**
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 ls=re("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"}]]);/**
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 Iw=re("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"}]]);/**
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 gc=re("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"}]]);/**
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 U2=re("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
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 K2=re("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"}]]);/**
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 vm=re("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"}]]);/**
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 va=re("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"}]]);/**
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 q2=re("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"}]]);/**
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 xm=re("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"}]]);/**
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 pf=re("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"}]]);/**
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 V2=re("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"}]]);/**
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 Q2=re("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"}]]);/**
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 yc=re("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"}]]);/**
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 ye=re("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
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 Y2=re("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"}]]);/**
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 G2=re("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
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 X2=re("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"}]]);/**
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 J2=re("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
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 Z2=re("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
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 Lt=re("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
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 eN=re("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
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 Sn=re("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"}]]);/**
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 _m=re("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"}]]);/**
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 tN=re("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
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 Fw=re("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
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 rN=re("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"}]]);/**
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 Bw=re("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"}]]);/**
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 mf=re("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"}]]);/**
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 Wa=re("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
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 zw=re("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"}]]);/**
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 bi=re("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
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 $w=re("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"}]]);/**
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 Hw=re("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"}]]);/**
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 Tn=re("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"}]]);/**
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 Ww=re("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"}]]);/**
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 Ua=re("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"}]]);/**
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 Nt=re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var ju={exports:{}},Uw={},Kw={exports:{}},nN="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",iN=nN,sN=iN;function qw(){}function Vw(){}Vw.resetWarningCache=qw;var oN=function(){function e(n,i,s,o,l,u){if(u!==sN){var c=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 c.name="Invariant Violation",c}}e.isRequired=e;function t(){return e}var r={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:Vw,resetWarningCache:qw};return r.PropTypes=r,r};Kw.exports=oN();var Qw=Kw.exports;function Yw(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=Yw(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function k0(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=Yw(e))&&(n&&(n+=" "),n+=t);return n}const aN=Object.freeze(Object.defineProperty({__proto__:null,clsx:k0,default:k0},Symbol.toStringTag,{value:"Module"})),lN=b1(aN);var Ue={},ln={};Object.defineProperty(ln,"__esModule",{value:!0});ln.dontSetMe=fN;ln.findInArray=cN;ln.int=dN;ln.isFunction=uN;ln.isNum=hN;function cN(e,t){for(let r=0,n=e.length;r<n;r++)if(t.apply(t,[e[r],r,e]))return e[r]}function uN(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function hN(e){return typeof e=="number"&&!isNaN(e)}function dN(e){return parseInt(e,10)}function fN(e,t,r){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(r," - do not set this, set it on the child."))}var gs={};Object.defineProperty(gs,"__esModule",{value:!0});gs.browserPrefixToKey=Xw;gs.browserPrefixToStyle=pN;gs.default=void 0;gs.getPrefix=Gw;const vh=["Moz","Webkit","O","ms"];function Gw(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const r=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!r||t in r)return"";for(let n=0;n<vh.length;n++)if(Xw(t,vh[n])in r)return vh[n];return""}function Xw(e,t){return t?"".concat(t).concat(mN(e)):e}function pN(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function mN(e){let t="",r=!0;for(let n=0;n<e.length;n++)r?(t+=e[n].toUpperCase(),r=!1):e[n]==="-"?r=!0:t+=e[n];return t}gs.default=Gw();Object.defineProperty(Ue,"__esModule",{value:!0});Ue.addClassName=eb;Ue.addEvent=vN;Ue.addUserSelectStyles=PN;Ue.createCSSTransform=kN;Ue.createSVGTransform=NN;Ue.getTouch=EN;Ue.getTouchIdentifier=jN;Ue.getTranslation=wm;Ue.innerHeight=bN;Ue.innerWidth=SN;Ue.matchesSelector=Zw;Ue.matchesSelectorAndParentsTo=yN;Ue.offsetXYFromParent=CN;Ue.outerHeight=_N;Ue.outerWidth=wN;Ue.removeClassName=tb;Ue.removeEvent=xN;Ue.removeUserSelectStyles=RN;var hr=ln,N0=gN(gs);function Jw(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Jw=function(n){return n?r:t})(e)}function gN(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Jw(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&&Object.prototype.hasOwnProperty.call(e,s)){var o=i?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=e[s]}return n.default=e,r&&r.set(e,n),n}let Fl="";function Zw(e,t){return Fl||(Fl=(0,hr.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(r){return(0,hr.isFunction)(e[r])})),(0,hr.isFunction)(e[Fl])?e[Fl](t):!1}function yN(e,t,r){let n=e;do{if(Zw(n,t))return!0;if(n===r)return!1;n=n.parentNode}while(n);return!1}function vN(e,t,r,n){if(!e)return;const i={capture:!0,...n};e.addEventListener?e.addEventListener(t,r,i):e.attachEvent?e.attachEvent("on"+t,r):e["on"+t]=r}function xN(e,t,r,n){if(!e)return;const i={capture:!0,...n};e.removeEventListener?e.removeEventListener(t,r,i):e.detachEvent?e.detachEvent("on"+t,r):e["on"+t]=null}function _N(e){let t=e.clientHeight;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,hr.int)(r.borderTopWidth),t+=(0,hr.int)(r.borderBottomWidth),t}function wN(e){let t=e.clientWidth;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,hr.int)(r.borderLeftWidth),t+=(0,hr.int)(r.borderRightWidth),t}function bN(e){let t=e.clientHeight;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,hr.int)(r.paddingTop),t-=(0,hr.int)(r.paddingBottom),t}function SN(e){let t=e.clientWidth;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,hr.int)(r.paddingLeft),t-=(0,hr.int)(r.paddingRight),t}function CN(e,t,r){const i=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),s=(e.clientX+t.scrollLeft-i.left)/r,o=(e.clientY+t.scrollTop-i.top)/r;return{x:s,y:o}}function kN(e,t){const r=wm(e,t,"px");return{[(0,N0.browserPrefixToKey)("transform",N0.default)]:r}}function NN(e,t){return wm(e,t,"")}function wm(e,t,r){let{x:n,y:i}=e,s="translate(".concat(n).concat(r,",").concat(i).concat(r,")");if(t){const o="".concat(typeof t.x=="string"?t.x:t.x+r),l="".concat(typeof t.y=="string"?t.y:t.y+r);s="translate(".concat(o,", ").concat(l,")")+s}return s}function EN(e,t){return e.targetTouches&&(0,hr.findInArray)(e.targetTouches,r=>t===r.identifier)||e.changedTouches&&(0,hr.findInArray)(e.changedTouches,r=>t===r.identifier)}function jN(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function PN(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;}
381
- `,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
382
- `,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&eb(e.body,"react-draggable-transparent-selection")}function RN(e){if(e)try{if(e.body&&tb(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 eb(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function tb(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var cn={};Object.defineProperty(cn,"__esModule",{value:!0});cn.canDragX=DN;cn.canDragY=LN;cn.createCoreData=ON;cn.createDraggableData=IN;cn.getBoundPosition=MN;cn.getControlPosition=AN;cn.snapToGrid=TN;var sr=ln,Ks=Ue;function MN(e,t,r){if(!e.props.bounds)return[t,r];let{bounds:n}=e.props;n=typeof n=="string"?n:FN(n);const i=bm(e);if(typeof n=="string"){const{ownerDocument:s}=i,o=s.defaultView;let l;if(n==="parent"?l=i.parentNode:l=s.querySelector(n),!(l instanceof o.HTMLElement))throw new Error('Bounds selector "'+n+'" could not find an element.');const u=l,c=o.getComputedStyle(i),h=o.getComputedStyle(u);n={left:-i.offsetLeft+(0,sr.int)(h.paddingLeft)+(0,sr.int)(c.marginLeft),top:-i.offsetTop+(0,sr.int)(h.paddingTop)+(0,sr.int)(c.marginTop),right:(0,Ks.innerWidth)(u)-(0,Ks.outerWidth)(i)-i.offsetLeft+(0,sr.int)(h.paddingRight)-(0,sr.int)(c.marginRight),bottom:(0,Ks.innerHeight)(u)-(0,Ks.outerHeight)(i)-i.offsetTop+(0,sr.int)(h.paddingBottom)-(0,sr.int)(c.marginBottom)}}return(0,sr.isNum)(n.right)&&(t=Math.min(t,n.right)),(0,sr.isNum)(n.bottom)&&(r=Math.min(r,n.bottom)),(0,sr.isNum)(n.left)&&(t=Math.max(t,n.left)),(0,sr.isNum)(n.top)&&(r=Math.max(r,n.top)),[t,r]}function TN(e,t,r){const n=Math.round(t/e[0])*e[0],i=Math.round(r/e[1])*e[1];return[n,i]}function DN(e){return e.props.axis==="both"||e.props.axis==="x"}function LN(e){return e.props.axis==="both"||e.props.axis==="y"}function AN(e,t,r){const n=typeof t=="number"?(0,Ks.getTouch)(e,t):null;if(typeof t=="number"&&!n)return null;const i=bm(r),s=r.props.offsetParent||i.offsetParent||i.ownerDocument.body;return(0,Ks.offsetXYFromParent)(n||e,s,r.props.scale)}function ON(e,t,r){const n=!(0,sr.isNum)(e.lastX),i=bm(e);return n?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:r,x:t,y:r}:{node:i,deltaX:t-e.lastX,deltaY:r-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:r}}function IN(e,t){const r=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/r,y:e.state.y+t.deltaY/r,deltaX:t.deltaX/r,deltaY:t.deltaY/r,lastX:e.state.x,lastY:e.state.y}}function FN(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function bm(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var Pu={},Ru={};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.default=BN;function BN(){}Object.defineProperty(Pu,"__esModule",{value:!0});Pu.default=void 0;var xh=$N(w),Ht=Sm(Qw),zN=Sm(ms),bt=Ue,In=cn,_h=ln,Wo=Sm(Ru);function Sm(e){return e&&e.__esModule?e:{default:e}}function rb(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(rb=function(n){return n?r:t})(e)}function $N(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=rb(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&&Object.prototype.hasOwnProperty.call(e,s)){var o=i?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=e[s]}return n.default=e,r&&r.set(e,n),n}function Rt(e,t,r){return t=HN(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function HN(e){var t=WN(e,"string");return typeof t=="symbol"?t:String(t)}function WN(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Rr={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Fn=Rr.mouse,Mu=class extends xh.Component{constructor(){super(...arguments),Rt(this,"dragging",!1),Rt(this,"lastX",NaN),Rt(this,"lastY",NaN),Rt(this,"touchIdentifier",null),Rt(this,"mounted",!1),Rt(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const r=this.findDOMNode();if(!r||!r.ownerDocument||!r.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=r;if(this.props.disabled||!(t.target instanceof n.defaultView.Node)||this.props.handle&&!(0,bt.matchesSelectorAndParentsTo)(t.target,this.props.handle,r)||this.props.cancel&&(0,bt.matchesSelectorAndParentsTo)(t.target,this.props.cancel,r))return;t.type==="touchstart"&&t.preventDefault();const i=(0,bt.getTouchIdentifier)(t);this.touchIdentifier=i;const s=(0,In.getControlPosition)(t,i,this);if(s==null)return;const{x:o,y:l}=s,u=(0,In.createCoreData)(this,o,l);(0,Wo.default)("DraggableCore: handleDragStart: %j",u),(0,Wo.default)("calling",this.props.onStart),!(this.props.onStart(t,u)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,bt.addUserSelectStyles)(n),this.dragging=!0,this.lastX=o,this.lastY=l,(0,bt.addEvent)(n,Fn.move,this.handleDrag),(0,bt.addEvent)(n,Fn.stop,this.handleDragStop))}),Rt(this,"handleDrag",t=>{const r=(0,In.getControlPosition)(t,this.touchIdentifier,this);if(r==null)return;let{x:n,y:i}=r;if(Array.isArray(this.props.grid)){let l=n-this.lastX,u=i-this.lastY;if([l,u]=(0,In.snapToGrid)(this.props.grid,l,u),!l&&!u)return;n=this.lastX+l,i=this.lastY+u}const s=(0,In.createCoreData)(this,n,i);if((0,Wo.default)("DraggableCore: handleDrag: %j",s),this.props.onDrag(t,s)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const u=document.createEvent("MouseEvents");u.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(u)}return}this.lastX=n,this.lastY=i}),Rt(this,"handleDragStop",t=>{if(!this.dragging)return;const r=(0,In.getControlPosition)(t,this.touchIdentifier,this);if(r==null)return;let{x:n,y:i}=r;if(Array.isArray(this.props.grid)){let u=n-this.lastX||0,c=i-this.lastY||0;[u,c]=(0,In.snapToGrid)(this.props.grid,u,c),n=this.lastX+u,i=this.lastY+c}const s=(0,In.createCoreData)(this,n,i);if(this.props.onStop(t,s)===!1||this.mounted===!1)return!1;const l=this.findDOMNode();l&&this.props.enableUserSelectHack&&(0,bt.removeUserSelectStyles)(l.ownerDocument),(0,Wo.default)("DraggableCore: handleDragStop: %j",s),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,l&&((0,Wo.default)("DraggableCore: Removing handlers"),(0,bt.removeEvent)(l.ownerDocument,Fn.move,this.handleDrag),(0,bt.removeEvent)(l.ownerDocument,Fn.stop,this.handleDragStop))}),Rt(this,"onMouseDown",t=>(Fn=Rr.mouse,this.handleDragStart(t))),Rt(this,"onMouseUp",t=>(Fn=Rr.mouse,this.handleDragStop(t))),Rt(this,"onTouchStart",t=>(Fn=Rr.touch,this.handleDragStart(t))),Rt(this,"onTouchEnd",t=>(Fn=Rr.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,bt.addEvent)(t,Rr.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:r}=t;(0,bt.removeEvent)(r,Rr.mouse.move,this.handleDrag),(0,bt.removeEvent)(r,Rr.touch.move,this.handleDrag),(0,bt.removeEvent)(r,Rr.mouse.stop,this.handleDragStop),(0,bt.removeEvent)(r,Rr.touch.stop,this.handleDragStop),(0,bt.removeEvent)(t,Rr.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,bt.removeUserSelectStyles)(r)}}findDOMNode(){var t,r;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(r=this.props)===null||r===void 0||(r=r.nodeRef)===null||r===void 0?void 0:r.current:zN.default.findDOMNode(this)}render(){return xh.cloneElement(xh.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Pu.default=Mu;Rt(Mu,"displayName","DraggableCore");Rt(Mu,"propTypes",{allowAnyClick:Ht.default.bool,children:Ht.default.node.isRequired,disabled:Ht.default.bool,enableUserSelectHack:Ht.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:Ht.default.arrayOf(Ht.default.number),handle:Ht.default.string,cancel:Ht.default.string,nodeRef:Ht.default.object,onStart:Ht.default.func,onDrag:Ht.default.func,onStop:Ht.default.func,onMouseDown:Ht.default.func,scale:Ht.default.number,className:_h.dontSetMe,style:_h.dontSetMe,transform:_h.dontSetMe});Rt(Mu,"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 u.default}}),e.default=void 0;var t=f(w),r=h(Qw),n=h(ms),i=h(lN),s=Ue,o=cn,l=ln,u=h(Pu),c=h(Ru);function h(v){return v&&v.__esModule?v:{default:v}}function d(v){if(typeof WeakMap!="function")return null;var g=new WeakMap,_=new WeakMap;return(d=function(N){return N?_:g})(v)}function f(v,g){if(v&&v.__esModule)return v;if(v===null||typeof v!="object"&&typeof v!="function")return{default:v};var _=d(g);if(_&&_.has(v))return _.get(v);var N={},S=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var j in v)if(j!=="default"&&Object.prototype.hasOwnProperty.call(v,j)){var A=S?Object.getOwnPropertyDescriptor(v,j):null;A&&(A.get||A.set)?Object.defineProperty(N,j,A):N[j]=v[j]}return N.default=v,_&&_.set(v,N),N}function p(){return p=Object.assign?Object.assign.bind():function(v){for(var g=1;g<arguments.length;g++){var _=arguments[g];for(var N in _)Object.prototype.hasOwnProperty.call(_,N)&&(v[N]=_[N])}return v},p.apply(this,arguments)}function m(v,g,_){return g=x(g),g in v?Object.defineProperty(v,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):v[g]=_,v}function x(v){var g=C(v,"string");return typeof g=="symbol"?g:String(g)}function C(v,g){if(typeof v!="object"||v===null)return v;var _=v[Symbol.toPrimitive];if(_!==void 0){var N=_.call(v,g);if(typeof N!="object")return N;throw new TypeError("@@toPrimitive must return a primitive value.")}return(g==="string"?String:Number)(v)}class y extends t.Component{static getDerivedStateFromProps(g,_){let{position:N}=g,{prevPropsPosition:S}=_;return N&&(!S||N.x!==S.x||N.y!==S.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:N,prevPropsPosition:S}),{x:N.x,y:N.y,prevPropsPosition:{...N}}):null}constructor(g){super(g),m(this,"onDragStart",(_,N)=>{if((0,c.default)("Draggable: onDragStart: %j",N),this.props.onStart(_,(0,o.createDraggableData)(this,N))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),m(this,"onDrag",(_,N)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",N);const S=(0,o.createDraggableData)(this,N),j={x:S.x,y:S.y,slackX:0,slackY:0};if(this.props.bounds){const{x:$,y:z}=j;j.x+=this.state.slackX,j.y+=this.state.slackY;const[I,P]=(0,o.getBoundPosition)(this,j.x,j.y);j.x=I,j.y=P,j.slackX=this.state.slackX+($-j.x),j.slackY=this.state.slackY+(z-j.y),S.x=j.x,S.y=j.y,S.deltaX=j.x-this.state.x,S.deltaY=j.y-this.state.y}if(this.props.onDrag(_,S)===!1)return!1;this.setState(j)}),m(this,"onDragStop",(_,N)=>{if(!this.state.dragging||this.props.onStop(_,(0,o.createDraggableData)(this,N))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",N);const j={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:$,y:z}=this.props.position;j.x=$,j.y=z}this.setState(j)}),this.state={dragging:!1,dragged:!1,x:g.position?g.position.x:g.defaultPosition.x,y:g.position?g.position.y:g.defaultPosition.y,prevPropsPosition:{...g.position},slackX:0,slackY:0,isElementSVG:!1},g.position&&!(g.onDrag||g.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 g,_;return(g=(_=this.props)===null||_===void 0||(_=_.nodeRef)===null||_===void 0?void 0:_.current)!==null&&g!==void 0?g:n.default.findDOMNode(this)}render(){const{axis:g,bounds:_,children:N,defaultPosition:S,defaultClassName:j,defaultClassNameDragging:A,defaultClassNameDragged:$,position:z,positionOffset:I,scale:P,...R}=this.props;let D={},L=null;const O=!!!z||this.state.dragging,E=z||S,F={x:(0,o.canDragX)(this)&&O?this.state.x:E.x,y:(0,o.canDragY)(this)&&O?this.state.y:E.y};this.state.isElementSVG?L=(0,s.createSVGTransform)(F,I):D=(0,s.createCSSTransform)(F,I);const k=(0,i.default)(N.props.className||"",j,{[A]:this.state.dragging,[$]:this.state.dragged});return t.createElement(u.default,p({},R,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(N),{className:k,style:{...N.props.style,...D},transform:L}))}}e.default=y,m(y,"displayName","Draggable"),m(y,"propTypes",{...u.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),m(y,"defaultProps",{...u.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(Uw);const{default:nb,DraggableCore:UN}=Uw;ju.exports=nb;ju.exports.default=nb;ju.exports.DraggableCore=UN;var KN=ju.exports;const qN=rl(KN);var Qe=function(){return Qe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Qe.apply(this,arguments)},E0={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},j0={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},Bl={width:"20px",height:"20px",position:"absolute",zIndex:1},VN={top:Qe(Qe({},E0),{top:"-5px"}),right:Qe(Qe({},j0),{left:void 0,right:"-5px"}),bottom:Qe(Qe({},E0),{top:void 0,bottom:"-5px"}),left:Qe(Qe({},j0),{left:"-5px"}),topRight:Qe(Qe({},Bl),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:Qe(Qe({},Bl),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:Qe(Qe({},Bl),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:Qe(Qe({},Bl),{left:"-10px",top:"-10px",cursor:"nw-resize"})},QN=w.memo(function(e){var t=e.onResizeStart,r=e.direction,n=e.children,i=e.replaceStyles,s=e.className,o=w.useCallback(function(c){t(c,r)},[t,r]),l=w.useCallback(function(c){t(c,r)},[t,r]),u=w.useMemo(function(){return Qe(Qe({position:"absolute",userSelect:"none"},VN[r]),i??{})},[i,r]);return a.jsx("div",{className:s||void 0,style:u,onMouseDown:o,onTouchStart:l,children:n})}),YN=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Vr=function(){return Vr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Vr.apply(this,arguments)},GN={width:"auto",height:"auto"},zl=function(e,t,r){return Math.max(Math.min(e,r),t)},P0=function(e,t,r){var n=Math.round(e/t);return n*t+r*(n-1)},bs=function(e,t){return new RegExp(e,"i").test(t)},$l=function(e){return!!(e.touches&&e.touches.length)},XN=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},R0=function(e,t,r){r===void 0&&(r=0);var n=t.reduce(function(s,o,l){return Math.abs(o-e)<Math.abs(t[s]-e)?l:s},0),i=Math.abs(t[n]-e);return r===0||i<r?t[n]:e},wh=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")},Hl=function(e,t,r,n){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var i=Number(e.replace("%",""))/100;return t*i}if(e.endsWith("vw")){var i=Number(e.replace("vw",""))/100;return r*i}if(e.endsWith("vh")){var i=Number(e.replace("vh",""))/100;return n*i}}return e},JN=function(e,t,r,n,i,s,o){return n=Hl(n,e.width,t,r),i=Hl(i,e.height,t,r),s=Hl(s,e.width,t,r),o=Hl(o,e.height,t,r),{maxWidth:typeof n>"u"?void 0:Number(n),maxHeight:typeof i>"u"?void 0:Number(i),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof o>"u"?void 0:Number(o)}},ZN=function(e){return Array.isArray(e)?e:[e,e]},eE=["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"],M0="__resizable_base__",tE=function(e){YN(t,e);function t(r){var n,i,s,o,l=e.call(this,r)||this;return l.ratio=1,l.resizable=null,l.parentLeft=0,l.parentTop=0,l.resizableLeft=0,l.resizableRight=0,l.resizableTop=0,l.resizableBottom=0,l.targetLeft=0,l.targetTop=0,l.delta={width:0,height:0},l.appendBase=function(){if(!l.resizable||!l.window)return null;var u=l.parentNode;if(!u)return null;var c=l.window.document.createElement("div");return c.style.width="100%",c.style.height="100%",c.style.position="absolute",c.style.transform="scale(0, 0)",c.style.left="0",c.style.flex="0 0 100%",c.classList?c.classList.add(M0):c.className+=M0,u.appendChild(c),c},l.removeBase=function(u){var c=l.parentNode;c&&c.removeChild(u)},l.state={isResizing:!1,width:(i=(n=l.propsSize)===null||n===void 0?void 0:n.width)!==null&&i!==void 0?i:"auto",height:(o=(s=l.propsSize)===null||s===void 0?void 0:s.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},l.onResizeStart=l.onResizeStart.bind(l),l.onMouseMove=l.onMouseMove.bind(l),l.onMouseUp=l.onMouseUp.bind(l),l}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||GN},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var r=0,n=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,s=this.resizable.offsetHeight,o=this.resizable.style.position;o!=="relative"&&(this.resizable.style.position="relative"),r=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:i,n=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=o}return{width:r,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var r=this,n=this.props.size,i=function(l){var u;if(typeof r.state[l]>"u"||r.state[l]==="auto")return"auto";if(r.propsSize&&r.propsSize[l]&&(!((u=r.propsSize[l])===null||u===void 0)&&u.toString().endsWith("%"))){if(r.state[l].toString().endsWith("%"))return r.state[l].toString();var c=r.getParentSize(),h=Number(r.state[l].toString().replace("px","")),d=h/c[l]*100;return"".concat(d,"%")}return wh(r.state[l])},s=n&&typeof n.width<"u"&&!this.state.isResizing?wh(n.width):i("width"),o=n&&typeof n.height<"u"&&!this.state.isResizing?wh(n.height):i("height");return{width:s,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 r=this.appendBase();if(!r)return{width:0,height:0};var n=!1,i=this.parentNode.style.flexWrap;i!=="wrap"&&(n=!0,this.parentNode.style.flexWrap="wrap"),r.style.position="relative",r.style.minWidth="100%",r.style.minHeight="100%";var s={width:r.offsetWidth,height:r.offsetHeight};return n&&(this.parentNode.style.flexWrap=i),this.removeBase(r),s},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 r=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:r.flexBasis!=="auto"?r.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(r,n){var i=this.propsSize&&this.propsSize[n];return this.state[n]==="auto"&&this.state.original[n]===r&&(typeof i>"u"||i==="auto")?"auto":r},t.prototype.calculateNewMaxFromBoundary=function(r,n){var i=this.props.boundsByDirection,s=this.state.direction,o=i&&bs("left",s),l=i&&bs("top",s),u,c;if(this.props.bounds==="parent"){var h=this.parentNode;h&&(u=o?this.resizableRight-this.parentLeft:h.offsetWidth+(this.parentLeft-this.resizableLeft),c=l?this.resizableBottom-this.parentTop:h.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(u=o?this.resizableRight:this.window.innerWidth-this.resizableLeft,c=l?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(u=o?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),c=l?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return u&&Number.isFinite(u)&&(r=r&&r<u?r:u),c&&Number.isFinite(c)&&(n=n&&n<c?n:c),{maxWidth:r,maxHeight:n}},t.prototype.calculateNewSizeFromDirection=function(r,n){var i=this.props.scale||1,s=ZN(this.props.resizeRatio||1),o=s[0],l=s[1],u=this.state,c=u.direction,h=u.original,d=this.props,f=d.lockAspectRatio,p=d.lockAspectRatioExtraHeight,m=d.lockAspectRatioExtraWidth,x=h.width,C=h.height,y=p||0,v=m||0;return bs("right",c)&&(x=h.width+(r-h.x)*o/i,f&&(C=(x-v)/this.ratio+y)),bs("left",c)&&(x=h.width-(r-h.x)*o/i,f&&(C=(x-v)/this.ratio+y)),bs("bottom",c)&&(C=h.height+(n-h.y)*l/i,f&&(x=(C-y)*this.ratio+v)),bs("top",c)&&(C=h.height-(n-h.y)*l/i,f&&(x=(C-y)*this.ratio+v)),{newWidth:x,newHeight:C}},t.prototype.calculateNewSizeFromAspectRatio=function(r,n,i,s){var o=this.props,l=o.lockAspectRatio,u=o.lockAspectRatioExtraHeight,c=o.lockAspectRatioExtraWidth,h=typeof s.width>"u"?10:s.width,d=typeof i.width>"u"||i.width<0?r:i.width,f=typeof s.height>"u"?10:s.height,p=typeof i.height>"u"||i.height<0?n:i.height,m=u||0,x=c||0;if(l){var C=(f-m)*this.ratio+x,y=(p-m)*this.ratio+x,v=(h-x)/this.ratio+m,g=(d-x)/this.ratio+m,_=Math.max(h,C),N=Math.min(d,y),S=Math.max(f,v),j=Math.min(p,g);r=zl(r,_,N),n=zl(n,S,j)}else r=zl(r,h,d),n=zl(n,f,p);return{newWidth:r,newHeight:n}},t.prototype.setBoundingClientRect=function(){var r=1/(this.props.scale||1);if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var i=n.getBoundingClientRect();this.parentLeft=i.left*r,this.parentTop=i.top*r}}if(this.props.bounds&&typeof this.props.bounds!="string"){var s=this.props.bounds.getBoundingClientRect();this.targetLeft=s.left*r,this.targetTop=s.top*r}if(this.resizable){var o=this.resizable.getBoundingClientRect(),l=o.left,u=o.top,c=o.right,h=o.bottom;this.resizableLeft=l*r,this.resizableRight=c*r,this.resizableTop=u*r,this.resizableBottom=h*r}},t.prototype.onResizeStart=function(r,n){if(!(!this.resizable||!this.window)){var i=0,s=0;if(r.nativeEvent&&XN(r.nativeEvent)?(i=r.nativeEvent.clientX,s=r.nativeEvent.clientY):r.nativeEvent&&$l(r.nativeEvent)&&(i=r.nativeEvent.touches[0].clientX,s=r.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var o=this.props.onResizeStart(r,n,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 l,u=this.window.getComputedStyle(this.resizable);if(u.flexBasis!=="auto"){var c=this.parentNode;if(c){var h=this.window.getComputedStyle(c).flexDirection;this.flexDir=h.startsWith("row")?"row":"column",l=u.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:i,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Vr(Vr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(r.target).cursor||"auto"}),direction:n,flexBasis:l};this.setState(d)}},t.prototype.onMouseMove=function(r){var n=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&$l(r))try{r.preventDefault(),r.stopPropagation()}catch{}var i=this.props,s=i.maxWidth,o=i.maxHeight,l=i.minWidth,u=i.minHeight,c=$l(r)?r.touches[0].clientX:r.clientX,h=$l(r)?r.touches[0].clientY:r.clientY,d=this.state,f=d.direction,p=d.original,m=d.width,x=d.height,C=this.getParentSize(),y=JN(C,this.window.innerWidth,this.window.innerHeight,s,o,l,u);s=y.maxWidth,o=y.maxHeight,l=y.minWidth,u=y.minHeight;var v=this.calculateNewSizeFromDirection(c,h),g=v.newHeight,_=v.newWidth,N=this.calculateNewMaxFromBoundary(s,o);this.props.snap&&this.props.snap.x&&(_=R0(_,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(g=R0(g,this.props.snap.y,this.props.snapGap));var S=this.calculateNewSizeFromAspectRatio(_,g,{width:N.maxWidth,height:N.maxHeight},{width:l,height:u});if(_=S.newWidth,g=S.newHeight,this.props.grid){var j=P0(_,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),A=P0(g,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),$=this.props.snapGap||0,z=$===0||Math.abs(j-_)<=$?j:_,I=$===0||Math.abs(A-g)<=$?A:g;_=z,g=I}var P={width:_-p.width,height:g-p.height};if(this.delta=P,m&&typeof m=="string"){if(m.endsWith("%")){var R=_/C.width*100;_="".concat(R,"%")}else if(m.endsWith("vw")){var D=_/this.window.innerWidth*100;_="".concat(D,"vw")}else if(m.endsWith("vh")){var L=_/this.window.innerHeight*100;_="".concat(L,"vh")}}if(x&&typeof x=="string"){if(x.endsWith("%")){var R=g/C.height*100;g="".concat(R,"%")}else if(x.endsWith("vw")){var D=g/this.window.innerWidth*100;g="".concat(D,"vw")}else if(x.endsWith("vh")){var L=g/this.window.innerHeight*100;g="".concat(L,"vh")}}var B={width:this.createSizeForCssProperty(_,"width"),height:this.createSizeForCssProperty(g,"height")};this.flexDir==="row"?B.flexBasis=B.width:this.flexDir==="column"&&(B.flexBasis=B.height);var O=this.state.width!==B.width,E=this.state.height!==B.height,F=this.state.flexBasis!==B.flexBasis,k=O||E||F;k&&ms.flushSync(function(){n.setState(B)}),this.props.onResize&&k&&this.props.onResize(r,f,this.resizable,P)}},t.prototype.onMouseUp=function(r){var n,i,s=this.state,o=s.isResizing,l=s.direction;s.original,!(!o||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(r,l,this.resizable,this.delta),this.props.size&&this.setState({width:(n=this.props.size.width)!==null&&n!==void 0?n:"auto",height:(i=this.props.size.height)!==null&&i!==void 0?i:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Vr(Vr({},this.state.backgroundStyle),{cursor:"auto"})}))},t.prototype.updateSize=function(r){var n,i;this.setState({width:(n=r.width)!==null&&n!==void 0?n:"auto",height:(i=r.height)!==null&&i!==void 0?i:"auto"})},t.prototype.renderResizer=function(){var r=this,n=this.props,i=n.enable,s=n.handleStyles,o=n.handleClasses,l=n.handleWrapperStyle,u=n.handleWrapperClass,c=n.handleComponent;if(!i)return null;var h=Object.keys(i).map(function(d){return i[d]!==!1?a.jsx(QN,{direction:d,onResizeStart:r.onResizeStart,replaceStyles:s&&s[d],className:o&&o[d],children:c&&c[d]?c[d]:null},d):null});return a.jsx("div",{className:u,style:l,children:h})},t.prototype.render=function(){var r=this,n=Object.keys(this.props).reduce(function(o,l){return eE.indexOf(l)!==-1||(o[l]=r.props[l]),o},{}),i=Vr(Vr(Vr({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&&(i.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return a.jsxs(s,Vr({style:i,className:this.props.className},n,{ref:function(o){o&&(r.resizable=o)},children:[this.state.isResizing&&a.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}(w.PureComponent);/*! *****************************************************************************
383
- Copyright (c) Microsoft Corporation. All rights reserved.
384
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
385
- this file except in compliance with the License. You may obtain a copy of the
386
- License at http://www.apache.org/licenses/LICENSE-2.0
387
-
388
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
389
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
390
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
391
- MERCHANTABLITY OR NON-INFRINGEMENT.
392
-
393
- See the Apache Version 2.0 License for specific language governing permissions
394
- and limitations under the License.
395
- ***************************************************************************** */var gf=function(e,t){return gf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},gf(e,t)};function rE(e,t){gf(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var rt=function(){return rt=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},rt.apply(this,arguments)};function nE(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}var iE={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},sE=function(e){return{bottom:e,bottomLeft:e,bottomRight:e,left:e,right:e,top:e,topLeft:e,topRight:e}},oE=function(e){rE(t,e);function t(r){var n=e.call(this,r)||this;return n.resizingPosition={x:0,y:0},n.offsetFromParent={left:0,top:0},n.resizableElement={current:null},n.originalPosition={x:0,y:0},n.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:r.maxWidth,maxHeight:r.maxHeight},n.onResizeStart=n.onResizeStart.bind(n),n.onResize=n.onResize.bind(n),n.onResizeStop=n.onResizeStop.bind(n),n.onDragStart=n.onDragStart.bind(n),n.onDrag=n.onDrag.bind(n),n.onDragStop=n.onDragStop.bind(n),n.getMaxSizesFromProps=n.getMaxSizesFromProps.bind(n),n}return t.prototype.componentDidMount=function(){this.updateOffsetFromParent();var r=this.offsetFromParent,n=r.left,i=r.top,s=this.getDraggablePosition(),o=s.x,l=s.y;this.draggable.setState({x:o-n,y:l-i}),this.forceUpdate()},t.prototype.getDraggablePosition=function(){var r=this.draggable.state,n=r.x,i=r.y;return{x:n,y:i}},t.prototype.getParent=function(){return this.resizable&&this.resizable.parentNode},t.prototype.getParentSize=function(){return this.resizable.getParentSize()},t.prototype.getMaxSizesFromProps=function(){var r=typeof this.props.maxWidth>"u"?Number.MAX_SAFE_INTEGER:this.props.maxWidth,n=typeof this.props.maxHeight>"u"?Number.MAX_SAFE_INTEGER:this.props.maxHeight;return{maxWidth:r,maxHeight:n}},t.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},t.prototype.getOffsetHeight=function(r){var n=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/n;case"body":return document.body.offsetHeight/n;default:return r.offsetHeight}},t.prototype.getOffsetWidth=function(r){var n=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/n;case"body":return document.body.offsetWidth/n;default:return r.offsetWidth}},t.prototype.onDragStart=function(r,n){this.props.onDragStart&&this.props.onDragStart(r,n);var i=this.getDraggablePosition();if(this.originalPosition=i,!!this.props.bounds){var s=this.getParent(),o=this.props.scale,l;if(this.props.bounds==="parent")l=s;else if(this.props.bounds==="body"){var u=s.getBoundingClientRect(),c=u.left,h=u.top,d=document.body.getBoundingClientRect(),f=-(c-s.offsetLeft*o-d.left)/o,p=-(h-s.offsetTop*o-d.top)/o,m=(document.body.offsetWidth-this.resizable.size.width*o)/o+f,x=(document.body.offsetHeight-this.resizable.size.height*o)/o+p;return this.setState({bounds:{top:p,right:m,bottom:x,left:f}})}else if(this.props.bounds==="window"){if(!this.resizable)return;var C=s.getBoundingClientRect(),y=C.left,v=C.top,g=-(y-s.offsetLeft*o)/o,_=-(v-s.offsetTop*o)/o,m=(window.innerWidth-this.resizable.size.width*o)/o+g,x=(window.innerHeight-this.resizable.size.height*o)/o+_;return this.setState({bounds:{top:_,right:m,bottom:x,left:g}})}else typeof this.props.bounds=="string"?l=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(l=this.props.bounds);if(!(!(l instanceof HTMLElement)||!(s instanceof HTMLElement))){var N=l.getBoundingClientRect(),S=N.left,j=N.top,A=s.getBoundingClientRect(),$=A.left,z=A.top,I=(S-$)/o,P=j-z;if(this.resizable){this.updateOffsetFromParent();var R=this.offsetFromParent;this.setState({bounds:{top:P-R.top,right:I+(l.offsetWidth-this.resizable.size.width)-R.left/o,bottom:P+(l.offsetHeight-this.resizable.size.height)-R.top,left:I-R.left/o}})}}}},t.prototype.onDrag=function(r,n){if(this.props.onDrag){var i=this.offsetFromParent,s=i.left,o=i.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDrag(r,rt(rt({},n),{x:n.x+s,y:n.y+o}));if(this.props.dragAxis==="x")return this.props.onDrag(r,rt(rt({},n),{x:n.x+s,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDrag(r,rt(rt({},n),{x:this.originalPosition.x+s,y:n.y+o,deltaX:0}))}},t.prototype.onDragStop=function(r,n){if(this.props.onDragStop){var i=this.offsetFromParent,s=i.left,o=i.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDragStop(r,rt(rt({},n),{x:n.x+s,y:n.y+o}));if(this.props.dragAxis==="x")return this.props.onDragStop(r,rt(rt({},n),{x:n.x+s,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDragStop(r,rt(rt({},n),{x:this.originalPosition.x+s,y:n.y+o,deltaX:0}))}},t.prototype.onResizeStart=function(r,n,i){r.stopPropagation(),this.setState({resizing:!0});var s=this.props.scale,o=this.offsetFromParent,l=this.getDraggablePosition();if(this.resizingPosition={x:l.x+o.left,y:l.y+o.top},this.originalPosition=l,this.props.bounds){var u=this.getParent(),c=void 0;this.props.bounds==="parent"?c=u:this.props.bounds==="body"?c=document.body:this.props.bounds==="window"?c=window:typeof this.props.bounds=="string"?c=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(c=this.props.bounds);var h=this.getSelfElement();if(h instanceof Element&&(c instanceof HTMLElement||c===window)&&u instanceof HTMLElement){var d=this.getMaxSizesFromProps(),f=d.maxWidth,p=d.maxHeight,m=this.getParentSize();if(f&&typeof f=="string")if(f.endsWith("%")){var x=Number(f.replace("%",""))/100;f=m.width*x}else f.endsWith("px")&&(f=Number(f.replace("px","")));if(p&&typeof p=="string")if(p.endsWith("%")){var x=Number(p.replace("%",""))/100;p=m.height*x}else p.endsWith("px")&&(p=Number(p.replace("px","")));var C=h.getBoundingClientRect(),y=C.left,v=C.top,g=this.props.bounds==="window"?{left:0,top:0}:c.getBoundingClientRect(),_=g.left,N=g.top,S=this.getOffsetWidth(c),j=this.getOffsetHeight(c),A=n.toLowerCase().endsWith("left"),$=n.toLowerCase().endsWith("right"),z=n.startsWith("top"),I=n.startsWith("bottom");if((A||z)&&this.resizable){var P=(y-_)/s+this.resizable.size.width;this.setState({maxWidth:P>Number(f)?f:P})}if($||this.props.lockAspectRatio&&!A&&!z){var P=S+(_-y)/s;this.setState({maxWidth:P>Number(f)?f:P})}if((z||A)&&this.resizable){var P=(v-N)/s+this.resizable.size.height;this.setState({maxHeight:P>Number(p)?p:P})}if(I||this.props.lockAspectRatio&&!z&&!A){var P=j+(N-v)/s;this.setState({maxHeight:P>Number(p)?p:P})}}}else this.setState({maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight});this.props.onResizeStart&&this.props.onResizeStart(r,n,i)},t.prototype.onResize=function(r,n,i,s){var o=this,l={x:this.originalPosition.x,y:this.originalPosition.y},u=-s.width,c=-s.height,h=["top","left","topLeft","bottomLeft","topRight"];h.includes(n)&&(n==="bottomLeft"?l.x+=u:(n==="topRight"||(l.x+=u),l.y+=c));var d=this.draggable.state;(l.x!==d.x||l.y!==d.y)&&ms.flushSync(function(){o.draggable.setState(l)}),this.updateOffsetFromParent();var f=this.offsetFromParent,p=this.getDraggablePosition().x+f.left,m=this.getDraggablePosition().y+f.top;this.resizingPosition={x:p,y:m},this.props.onResize&&this.props.onResize(r,n,i,s,{x:p,y:m})},t.prototype.onResizeStop=function(r,n,i,s){this.setState({resizing:!1});var o=this.getMaxSizesFromProps(),l=o.maxWidth,u=o.maxHeight;this.setState({maxWidth:l,maxHeight:u}),this.props.onResizeStop&&this.props.onResizeStop(r,n,i,s,this.resizingPosition)},t.prototype.updateSize=function(r){this.resizable&&this.resizable.updateSize({width:r.width,height:r.height})},t.prototype.updatePosition=function(r){this.draggable.setState(r)},t.prototype.updateOffsetFromParent=function(){var r=this.props.scale,n=this.getParent(),i=this.getSelfElement();if(!n||i===null)return{top:0,left:0};var s=n.getBoundingClientRect(),o=s.left,l=s.top,u=i.getBoundingClientRect(),c=this.getDraggablePosition(),h=n.scrollLeft,d=n.scrollTop;this.offsetFromParent={left:u.left-o+h-c.x*r,top:u.top-l+d-c.y*r}},t.prototype.render=function(){var r=this,n=this.props,i=n.disableDragging,s=n.style,o=n.dragHandleClassName,l=n.position,u=n.onMouseDown,c=n.onMouseUp,h=n.dragAxis,d=n.dragGrid,f=n.bounds,p=n.enableUserSelectHack,m=n.cancel,x=n.children;n.onResizeStart,n.onResize,n.onResizeStop,n.onDragStart,n.onDrag,n.onDragStop;var C=n.resizeHandleStyles,y=n.resizeHandleClasses,v=n.resizeHandleComponent,g=n.enableResizing,_=n.resizeGrid,N=n.resizeHandleWrapperClass,S=n.resizeHandleWrapperStyle,j=n.scale,A=n.allowAnyClick,$=n.dragPositionOffset,z=nE(n,["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"]),I=this.props.default?rt({},this.props.default):void 0;delete z.default;var P=i||o?{cursor:"auto"}:{cursor:"move"},R=rt(rt(rt({},iE),P),s),D=this.offsetFromParent,L=D.left,B=D.top,O;l&&(O={x:l.x-L,y:l.y-B});var E=this.state.resizing?void 0:O,F=this.state.resizing?"both":h;return w.createElement(qN,{ref:function(k){k&&(r.draggable=k)},handle:o?".".concat(o):void 0,defaultPosition:I,onMouseDown:u,onMouseUp:c,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,axis:F,disabled:i,grid:d,bounds:f?this.state.bounds:void 0,position:E,enableUserSelectHack:p,cancel:m,scale:j,allowAnyClick:A,nodeRef:this.resizableElement,positionOffset:$},w.createElement(tE,rt({},z,{ref:function(k){k&&(r.resizable=k,r.resizableElement.current=k.resizable)},defaultSize:I,size:this.props.size,enable:typeof g=="boolean"?sE(g):g,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,style:R,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:_,handleWrapperClass:N,handleWrapperStyle:S,lockAspectRatio:this.props.lockAspectRatio,lockAspectRatioExtraWidth:this.props.lockAspectRatioExtraWidth,lockAspectRatioExtraHeight:this.props.lockAspectRatioExtraHeight,handleStyles:C,handleClasses:y,handleComponent:v,scale:this.props.scale}),x))},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}(w.PureComponent);/**
396
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
397
- * @license MIT
398
- *
399
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
400
- * @license MIT
401
- *
402
- * Originally forked from (with the author's permission):
403
- * Fabrice Bellard's javascript vt100 for jslinux:
404
- * http://bellard.org/jslinux/
405
- * Copyright (c) 2011 Fabrice Bellard
406
- */var ib=Object.defineProperty,aE=Object.getOwnPropertyDescriptor,lE=(e,t)=>{for(var r in t)ib(e,r,{get:t[r],enumerable:!0})},Ke=(e,t,r,n)=>{for(var i=n>1?void 0:n?aE(t,r):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&ib(t,r,i),i},Z=(e,t)=>(r,n)=>t(r,n,e),T0="Terminal input",yf={get:()=>T0,set:e=>T0=e},D0="Too much output to announce, navigate to rows manually to read",vf={get:()=>D0,set:e=>D0=e};function cE(e){return e.replace(/\r?\n/g,"\r")}function uE(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function hE(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function dE(e,t,r,n){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");sb(i,t,r,n)}}function sb(e,t,r,n){e=cE(e),e=uE(e,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function ob(e,t,r){let n=r.getBoundingClientRect(),i=e.clientX-n.left-10,s=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function L0(e,t,r,n,i){ob(e,t,r),i&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function Vn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Tu(e,t=0,r=e.length){let n="";for(let i=t;i<r;++i){let s=e[i];s>65535?(s-=65536,n+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):n+=String.fromCharCode(s)}return n}var fE=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let n=0,i=0;if(this._interim){let s=e.charCodeAt(i++);56320<=s&&s<=57343?t[n++]=(this._interim-55296)*1024+s-56320+65536:(t[n++]=this._interim,t[n++]=s),this._interim=0}for(let s=i;s<r;++s){let o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=r)return this._interim=o,n;let l=e.charCodeAt(s);56320<=l&&l<=57343?t[n++]=(o-55296)*1024+l-56320+65536:(t[n++]=o,t[n++]=l);continue}o!==65279&&(t[n++]=o)}return n}},pE=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let n=0,i,s,o,l,u=0,c=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let m=0,x;for(;(x=this.interim[++m]&63)&&m<4;)p<<=6,p|=x;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,y=C-m;for(;c<y;){if(c>=r)return 0;if(x=e[c++],(x&192)!==128){c--,f=!0;break}else this.interim[m++]=x,p<<=6,p|=x&63}f||(C===2?p<128?c--:t[n++]=p:C===3?p<2048||p>=55296&&p<=57343||p===65279||(t[n++]=p):p<65536||p>1114111||(t[n++]=p)),this.interim.fill(0)}let h=r-4,d=c;for(;d<r;){for(;d<h&&!((i=e[d])&128)&&!((s=e[d+1])&128)&&!((o=e[d+2])&128)&&!((l=e[d+3])&128);)t[n++]=i,t[n++]=s,t[n++]=o,t[n++]=l,d+=4;if(i=e[d++],i<128)t[n++]=i;else if((i&224)===192){if(d>=r)return this.interim[0]=i,n;if(s=e[d++],(s&192)!==128){d--;continue}if(u=(i&31)<<6|s&63,u<128){d--;continue}t[n++]=u}else if((i&240)===224){if(d>=r)return this.interim[0]=i,n;if(s=e[d++],(s&192)!==128){d--;continue}if(d>=r)return this.interim[0]=i,this.interim[1]=s,n;if(o=e[d++],(o&192)!==128){d--;continue}if(u=(i&15)<<12|(s&63)<<6|o&63,u<2048||u>=55296&&u<=57343||u===65279)continue;t[n++]=u}else if((i&248)===240){if(d>=r)return this.interim[0]=i,n;if(s=e[d++],(s&192)!==128){d--;continue}if(d>=r)return this.interim[0]=i,this.interim[1]=s,n;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=r)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=o,n;if(l=e[d++],(l&192)!==128){d--;continue}if(u=(i&7)<<18|(s&63)<<12|(o&63)<<6|l&63,u<65536||u>1114111)continue;t[n++]=u}}return n}},ab="",li=" ",ul=class lb{constructor(){this.fg=0,this.bg=0,this.extended=new ru}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 lb;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}},ru=class cb{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}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 cb(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},kr=class ub extends ul{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ru,this.combinedData=""}static fromCharData(t){let r=new ub;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Vn(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 r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},A0="di$target",xf="di$dependencies",bh=new Map;function mE(e){return e[xf]||[]}function pt(e){if(bh.has(e))return bh.get(e);let t=function(r,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");gE(t,r,i)};return t._id=e,bh.set(e,t),t}function gE(e,t,r){t[A0]===t?t[xf].push({id:e,index:r}):(t[xf]=[{id:e,index:r}],t[A0]=t)}var Bt=pt("BufferService"),hb=pt("CoreMouseService"),ys=pt("CoreService"),yE=pt("CharsetService"),Cm=pt("InstantiationService"),db=pt("LogService"),zt=pt("OptionsService"),fb=pt("OscLinkService"),vE=pt("UnicodeService"),hl=pt("DecorationService"),_f=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var h;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,s=new kr,o=r.getTrimmedLength(),l=-1,u=-1,c=!1;for(let d=0;d<o;d++)if(!(u===-1&&!r.hasContent(d))){if(r.loadCell(d,s),s.hasExtendedAttrs()&&s.extended.urlId)if(u===-1){u=d,l=s.extended.urlId;continue}else c=s.extended.urlId!==l;else u!==-1&&(c=!0);if(c||u!==-1&&d===o-1){let f=(h=this._oscLinkService.getLinkData(l))==null?void 0:h.uri;if(f){let p={start:{x:u+1,y:e},end:{x:d+(!c&&d===o-1?1:0),y:e}},m=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let x=new URL(f);["http:","https:"].includes(x.protocol)||(m=!0)}catch{m=!0}m||n.push({text:f,range:p,activate:(x,C)=>i?i.activate(x,C,p):xE(x,C),hover:(x,C)=>{var y;return(y=i==null?void 0:i.hover)==null?void 0:y.call(i,x,C,p)},leave:(x,C)=>{var y;return(y=i==null?void 0:i.leave)==null?void 0:y.call(i,x,C,p)}})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(u=d,l=s.extended.urlId):(u=-1,l=-1)}}t(n)}};_f=Ke([Z(0,Bt),Z(1,zt),Z(2,fb)],_f);function xE(e,t){if(confirm(`Do you want to navigate to ${t}?
407
-
408
- WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Du=pt("CharSizeService"),Ln=pt("CoreBrowserService"),km=pt("MouseService"),An=pt("RenderService"),_E=pt("SelectionService"),pb=pt("CharacterJoinerService"),Po=pt("ThemeService"),mb=pt("LinkProviderService"),wE=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?O0.isErrorNoTelemetry(e)?new O0(e.message+`
409
-
410
- `+e.stack):new Error(e.message+`
411
-
412
- `+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)}},bE=new wE;function vc(e){SE(e)||bE.onUnexpectedError(e)}var wf="Canceled";function SE(e){return e instanceof CE?!0:e instanceof Error&&e.name===wf&&e.message===wf}var CE=class extends Error{constructor(){super(wf),this.name=this.message}};function kE(e){return new Error(`Illegal argument: ${e}`)}var O0=class bf extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof bf)return t;let r=new bf;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Sf=class gb extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,gb.prototype)}};function nr(e,t=0){return e[e.length-(1+t)]}var NE;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function n(s){return s>0}e.isGreaterThan=n;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(NE||(NE={}));function EE(e,t){let r=this,n=!1,i;return function(){return n||(n=!0,t||(i=e.apply(r,arguments))),i}}var yb;(e=>{function t(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*i(_){yield _}e.single=i;function s(_){return t(_)?_:i(_)}e.wrap=s;function o(_){return _||r}e.from=o;function*l(_){for(let N=_.length-1;N>=0;N--)yield _[N]}e.reverse=l;function u(_){return!_||_[Symbol.iterator]().next().done===!0}e.isEmpty=u;function c(_){return _[Symbol.iterator]().next().value}e.first=c;function h(_,N){let S=0;for(let j of _)if(N(j,S++))return!0;return!1}e.some=h;function d(_,N){for(let S of _)if(N(S))return S}e.find=d;function*f(_,N){for(let S of _)N(S)&&(yield S)}e.filter=f;function*p(_,N){let S=0;for(let j of _)yield N(j,S++)}e.map=p;function*m(_,N){let S=0;for(let j of _)yield*N(j,S++)}e.flatMap=m;function*x(..._){for(let N of _)yield*N}e.concat=x;function C(_,N,S){let j=S;for(let A of _)j=N(j,A);return j}e.reduce=C;function*y(_,N,S=_.length){for(N<0&&(N+=_.length),S<0?S+=_.length:S>_.length&&(S=_.length);N<S;N++)yield _[N]}e.slice=y;function v(_,N=Number.POSITIVE_INFINITY){let S=[];if(N===0)return[S,_];let j=_[Symbol.iterator]();for(let A=0;A<N;A++){let $=j.next();if($.done)return[S,e.empty()];S.push($.value)}return[S,{[Symbol.iterator](){return j}}]}e.consume=v;async function g(_){let N=[];for await(let S of _)N.push(S);return Promise.resolve(N)}e.asyncToArray=g})(yb||(yb={}));function cs(e){if(yb.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(n){t.push(n)}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 jE(...e){return Ae(()=>cs(e))}function Ae(e){return{dispose:EE(()=>{e()})}}var vb=class xb{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{cs(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?xb.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)}};vb.DISABLE_DISPOSED_WARNING=!1;var vi=vb,pe=class{constructor(){this._store=new vi,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)}};pe.None=Object.freeze({dispose(){}});var Co=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var r;this._isDisposed||t===this._value||((r=this._value)==null||r.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}},Cn=typeof window=="object"?window:globalThis,Cf=class kf{constructor(t){this.element=t,this.next=kf.Undefined,this.prev=kf.Undefined}};Cf.Undefined=new Cf(void 0);var Oe=Cf,I0=class{constructor(){this._first=Oe.Undefined,this._last=Oe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Oe.Undefined}clear(){let e=this._first;for(;e!==Oe.Undefined;){let t=e.next;e.prev=Oe.Undefined,e.next=Oe.Undefined,e=t}this._first=Oe.Undefined,this._last=Oe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Oe(e);if(this._first===Oe.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==Oe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Oe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Oe.Undefined&&e.next!==Oe.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Oe.Undefined&&e.next===Oe.Undefined?(this._first=Oe.Undefined,this._last=Oe.Undefined):e.next===Oe.Undefined?(this._last=this._last.prev,this._last.next=Oe.Undefined):e.prev===Oe.Undefined&&(this._first=this._first.next,this._first.prev=Oe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Oe.Undefined;)yield e.element,e=e.next}},PE=globalThis.performance&&typeof globalThis.performance.now=="function",RE=class _b{static create(t){return new _b(t)}constructor(t){this._now=PE&&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}},yt;(e=>{e.None=()=>pe.None;function t(P,R){return d(P,()=>{},0,void 0,!0,void 0,R)}e.defer=t;function r(P){return(R,D=null,L)=>{let B=!1,O;return O=P(E=>{if(!B)return O?O.dispose():B=!0,R.call(D,E)},null,L),B&&O.dispose(),O}}e.once=r;function n(P,R,D){return c((L,B=null,O)=>P(E=>L.call(B,R(E)),null,O),D)}e.map=n;function i(P,R,D){return c((L,B=null,O)=>P(E=>{R(E),L.call(B,E)},null,O),D)}e.forEach=i;function s(P,R,D){return c((L,B=null,O)=>P(E=>R(E)&&L.call(B,E),null,O),D)}e.filter=s;function o(P){return P}e.signal=o;function l(...P){return(R,D=null,L)=>{let B=jE(...P.map(O=>O(E=>R.call(D,E))));return h(B,L)}}e.any=l;function u(P,R,D,L){let B=D;return n(P,O=>(B=R(B,O),B),L)}e.reduce=u;function c(P,R){let D,L={onWillAddFirstListener(){D=P(B.fire,B)},onDidRemoveLastListener(){D==null||D.dispose()}},B=new Y(L);return R==null||R.add(B),B.event}function h(P,R){return R instanceof Array?R.push(P):R&&R.add(P),P}function d(P,R,D=100,L=!1,B=!1,O,E){let F,k,V,M=0,b,H={leakWarningThreshold:O,onWillAddFirstListener(){F=P(X=>{M++,k=R(k,X),L&&!V&&(K.fire(k),k=void 0),b=()=>{let ie=k;k=void 0,V=void 0,(!L||M>1)&&K.fire(ie),M=0},typeof D=="number"?(clearTimeout(V),V=setTimeout(b,D)):V===void 0&&(V=0,queueMicrotask(b))})},onWillRemoveListener(){B&&M>0&&(b==null||b())},onDidRemoveLastListener(){b=void 0,F.dispose()}},K=new Y(H);return E==null||E.add(K),K.event}e.debounce=d;function f(P,R=0,D){return e.debounce(P,(L,B)=>L?(L.push(B),L):[B],R,void 0,!0,void 0,D)}e.accumulate=f;function p(P,R=(L,B)=>L===B,D){let L=!0,B;return s(P,O=>{let E=L||!R(O,B);return L=!1,B=O,E},D)}e.latch=p;function m(P,R,D){return[e.filter(P,R,D),e.filter(P,L=>!R(L),D)]}e.split=m;function x(P,R=!1,D=[],L){let B=D.slice(),O=P(k=>{B?B.push(k):F.fire(k)});L&&L.add(O);let E=()=>{B==null||B.forEach(k=>F.fire(k)),B=null},F=new Y({onWillAddFirstListener(){O||(O=P(k=>F.fire(k)),L&&L.add(O))},onDidAddFirstListener(){B&&(R?setTimeout(E):E())},onDidRemoveLastListener(){O&&O.dispose(),O=null}});return L&&L.add(F),F.event}e.buffer=x;function C(P,R){return(D,L,B)=>{let O=R(new v);return P(function(E){let F=O.evaluate(E);F!==y&&D.call(L,F)},void 0,B)}}e.chain=C;let y=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(D=>(R(D),D)),this}filter(R){return this.steps.push(D=>R(D)?D:y),this}reduce(R,D){let L=D;return this.steps.push(B=>(L=R(L,B),L)),this}latch(R=(D,L)=>D===L){let D=!0,L;return this.steps.push(B=>{let O=D||!R(B,L);return D=!1,L=B,O?B:y}),this}evaluate(R){for(let D of this.steps)if(R=D(R),R===y)break;return R}}function g(P,R,D=L=>L){let L=(...F)=>E.fire(D(...F)),B=()=>P.on(R,L),O=()=>P.removeListener(R,L),E=new Y({onWillAddFirstListener:B,onDidRemoveLastListener:O});return E.event}e.fromNodeEventEmitter=g;function _(P,R,D=L=>L){let L=(...F)=>E.fire(D(...F)),B=()=>P.addEventListener(R,L),O=()=>P.removeEventListener(R,L),E=new Y({onWillAddFirstListener:B,onDidRemoveLastListener:O});return E.event}e.fromDOMEventEmitter=_;function N(P){return new Promise(R=>r(P)(R))}e.toPromise=N;function S(P){let R=new Y;return P.then(D=>{R.fire(D)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=S;function j(P,R){return P(D=>R.fire(D))}e.forward=j;function A(P,R,D){return R(D),P(L=>R(L))}e.runAndSubscribe=A;class ${constructor(R,D){this._observable=R,this._counter=0,this._hasChanged=!1;let L={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};this.emitter=new Y(L),D&&D.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,D){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function z(P,R){return new $(P,R).emitter.event}e.fromObservable=z;function I(P){return(R,D,L)=>{let B=0,O=!1,E={beginUpdate(){B++},endUpdate(){B--,B===0&&(P.reportChanges(),O&&(O=!1,R.call(D)))},handlePossibleChange(){},handleChange(){O=!0}};P.addObserver(E),P.reportChanges();let F={dispose(){P.removeObserver(E)}};return L instanceof vi?L.add(F):Array.isArray(L)&&L.push(F),F}}e.fromObservableLight=I})(yt||(yt={}));var Nf=class Ef{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Ef._idPool++}`,Ef.all.add(this)}start(t){this._stopWatch=new RE,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}}};Nf.all=new Set,Nf._idPool=0;var ME=Nf,TE=-1,wb=class bb{constructor(t,r,n=(bb._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let n=this.threshold;if(n<=0||r<n)return;this._stacks||(this._stacks=new Map);let i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[s,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(s);let u=new AE(l,s);this._errorHandler(u)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[n,i]of this._stacks)(!t||r<i)&&(t=[n,i],r=i);return t}};wb._idPool=1;var DE=wb,LE=class Sb{constructor(t){this.value=t}static create(){let t=new Error;return new Sb(t.stack??"")}print(){console.warn(this.value.split(`
413
- `).slice(2).join(`
414
- `))}},AE=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},OE=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},IE=0,Sh=class{constructor(e){this.value=e,this.id=IE++}},FE=2,BE,Y=class{constructor(e){var t,r,n,i;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new DE((e==null?void 0:e.onListenerError)??vc,((r=this._options)==null?void 0:r.leakWarningThreshold)??TE):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new ME(this._options._profName):void 0,this._deliveryQueue=(i=this._options)==null?void 0:i.deliveryQueue}dispose(){var e,t,r,n;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),(r=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t),(n=this._leakageMon)==null||n.dispose())}get event(){return this._event??(this._event=(e,t,r)=>{var o,l,u,c,h;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new OE(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((o=this._options)==null?void 0:o.onListenerError)||vc)(p),pe.None}if(this._disposed)return pe.None;t&&(e=e.bind(t));let n=new Sh(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=LE.create(),i=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof Sh?(this._deliveryQueue??(this._deliveryQueue=new zE),this._listeners=[this._listeners,n]):this._listeners.push(n):((u=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||u.call(l,this),this._listeners=n,(h=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||h.call(c,this)),this._size++;let s=Ae(()=>{i==null||i(),this._removeListener(n)});return r instanceof vi?r.add(s):Array.isArray(r)&&r.push(s),s}),this._event}_removeListener(e){var i,s,o,l;if((s=(i=this._options)==null?void 0:i.onWillRemoveListener)==null||s.call(i,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||l.call(o,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-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[r]=void 0;let n=this._deliveryQueue.current===this;if(this._size*FE<=t.length){let u=0;for(let c=0;c<t.length;c++)t[c]?t[u++]=t[c]:n&&(this._deliveryQueue.end--,u<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=u}}_deliver(e,t){var n;if(!e)return;let r=((n=this._options)==null?void 0:n.onListenerError)||vc;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}_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,r,n,i;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(n=this._perfMon)==null||n.start(this._size),this._listeners)if(this._listeners instanceof Sh)this._deliver(this._listeners,e);else{let s=this._deliveryQueue;s.enqueue(this,e,this._listeners.length),this._deliverQueue(s)}(i=this._perfMon)==null||i.stop()}hasListeners(){return this._size>0}},zE=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},jf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Y,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Y,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};jf.INSTANCE=new jf;var Nm=jf;function $E(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}Nm.INSTANCE.onDidChangeZoomLevel;function HE(e){return Nm.INSTANCE.getZoomFactor(e)}Nm.INSTANCE.onDidChangeFullscreen;var Ro=typeof navigator=="object"?navigator.userAgent:"",Pf=Ro.indexOf("Firefox")>=0,WE=Ro.indexOf("AppleWebKit")>=0,Em=Ro.indexOf("Chrome")>=0,UE=!Em&&Ro.indexOf("Safari")>=0;Ro.indexOf("Electron/")>=0;Ro.indexOf("Android")>=0;var Ch=!1;if(typeof Cn.matchMedia=="function"){let e=Cn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Cn.matchMedia("(display-mode: fullscreen)");Ch=e.matches,$E(Cn,e,({matches:r})=>{Ch&&t.matches||(Ch=r)})}var qs="en",Rf=!1,Mf=!1,xc=!1,Cb=!1,Wl,_c=qs,F0=qs,KE,Mr,Zi=globalThis,gt,nx;typeof Zi.vscode<"u"&&typeof Zi.vscode.process<"u"?gt=Zi.vscode.process:typeof process<"u"&&typeof((nx=process==null?void 0:process.versions)==null?void 0:nx.node)=="string"&&(gt=process);var ix,qE=typeof((ix=gt==null?void 0:gt.versions)==null?void 0:ix.electron)=="string",VE=qE&&(gt==null?void 0:gt.type)==="renderer",sx;if(typeof gt=="object"){Rf=gt.platform==="win32",Mf=gt.platform==="darwin",xc=gt.platform==="linux",xc&&gt.env.SNAP&&gt.env.SNAP_REVISION,gt.env.CI||gt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Wl=qs,_c=qs;let e=gt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Wl=t.userLocale,F0=t.osLocale,_c=t.resolvedLanguage||qs,KE=(sx=t.languagePack)==null?void 0:sx.translationsConfigFile}catch{}Cb=!0}else typeof navigator=="object"&&!VE?(Mr=navigator.userAgent,Rf=Mr.indexOf("Windows")>=0,Mf=Mr.indexOf("Macintosh")>=0,(Mr.indexOf("Macintosh")>=0||Mr.indexOf("iPad")>=0||Mr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,xc=Mr.indexOf("Linux")>=0,(Mr==null?void 0:Mr.indexOf("Mobi"))>=0,_c=globalThis._VSCODE_NLS_LANGUAGE||qs,Wl=navigator.language.toLowerCase(),F0=Wl):console.error("Unable to resolve platform.");var kb=Rf,sn=Mf,QE=xc,B0=Cb,on=Mr,Bn=_c,YE;(e=>{function t(){return Bn}e.value=t;function r(){return Bn.length===2?Bn==="en":Bn.length>=3?Bn[0]==="e"&&Bn[1]==="n"&&Bn[2]==="-":!1}e.isDefaultVariant=r;function n(){return Bn==="en"}e.isDefault=n})(YE||(YE={}));var GE=typeof Zi.postMessage=="function"&&!Zi.importScripts;(()=>{if(GE){let e=[];Zi.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let n=0,i=e.length;n<i;n++){let s=e[n];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(n,1),s.callback();return}}});let t=0;return r=>{let n=++t;e.push({id:n,callback:r}),Zi.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var XE=!!(on&&on.indexOf("Chrome")>=0);on&&on.indexOf("Firefox")>=0;!XE&&on&&on.indexOf("Safari")>=0;on&&on.indexOf("Edg/")>=0;on&&on.indexOf("Android")>=0;var Ss=typeof navigator=="object"?navigator:{};B0||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ss&&Ss.clipboard&&Ss.clipboard.writeText,B0||Ss&&Ss.clipboard&&Ss.clipboard.readText;var jm=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}},kh=new jm,z0=new jm,$0=new jm,JE=new Array(230),Nb;(e=>{function t(l){return kh.keyCodeToStr(l)}e.toString=t;function r(l){return kh.strToKeyCode(l)}e.fromString=r;function n(l){return z0.keyCodeToStr(l)}e.toUserSettingsUS=n;function i(l){return $0.keyCodeToStr(l)}e.toUserSettingsGeneral=i;function s(l){return z0.strToKeyCode(l)||$0.strToKeyCode(l)}e.fromUserSettings=s;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return kh.keyCodeToStr(l)}e.toElectronAccelerator=o})(Nb||(Nb={}));var ZE=class Eb{constructor(t,r,n,i,s){this.ctrlKey=t,this.shiftKey=r,this.altKey=n,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof Eb&&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",r=this.shiftKey?"1":"0",n=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${r}${n}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new ej([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},ej=class{constructor(e){if(e.length===0)throw kE("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;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 tj(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return Nb.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Pf)switch(t){case 59:return 85;case 60:if(QE)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(sn)return 57;break}else if(WE&&(sn&&t===93||!sn&&t===92))return 57;return JE[t]||0}var rj=sn?256:2048,nj=512,ij=1024,sj=sn?2048:256,H0=class{constructor(e){var r;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=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=tj(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|=rj),this.altKey&&(t|=nj),this.shiftKey&&(t|=ij),this.metaKey&&(t|=sj),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new ZE(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},W0=new WeakMap;function oj(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var aj=class{static getSameOriginWindowChain(e){let t=W0.get(e);if(!t){t=[],W0.set(e,t);let r=e,n;do n=oj(r),n?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=n;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,n=0,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(r+=(o==null?void 0:o.scrollY)??0,n+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let l=s.iframeElement.getBoundingClientRect();r+=l.top,n+=l.left}return{top:r,left:n}}},Ul=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 r=aj.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},U0=class{constructor(e,t=0,r=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let n=!1;if(Em){let s=navigator.userAgent.match(/Chrome\/(\d+)/);n=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,l=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")n?this.deltaY=s.wheelDeltaY/(120*l):this.deltaY=s.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 u=e;u.deltaMode===u.DOM_DELTA_LINE?Pf&&!sn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")UE&&kb?this.deltaX=-(s.wheelDeltaX/120):n?this.deltaX=s.wheelDeltaX/(120*l):this.deltaX=s.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 u=e;u.deltaMode===u.DOM_DELTA_LINE?Pf&&!sn?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},jb=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),lj;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof cj?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:yt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:jb})})(lj||(lj={}));var cj=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?jb:(this._emitter||(this._emitter=new Y),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Pm=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 Sf("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Sf("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},uj=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,r=globalThis){if(this.isDisposed)throw new Sf("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=Ae(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},hj;(e=>{async function t(n){let i,s=await Promise.all(n.map(o=>o.then(l=>l,l=>{i||(i=l)})));if(typeof i<"u")throw i;return s}e.settled=t;function r(n){return new Promise(async(i,s)=>{try{await n(i,s)}catch(o){s(o)}})}e.withAsyncBody=r})(hj||(hj={}));var K0=class gr{static fromArray(t){return new gr(r=>{r.emitMany(t)})}static fromPromise(t){return new gr(async r=>{r.emitMany(await t)})}static fromPromises(t){return new gr(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new gr(async r=>{await Promise.all(t.map(async n=>{for await(let i of n)r.emitOne(i)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Y,queueMicrotask(async()=>{let n={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(n)),this.resolve()}catch(i){this.reject(i)}finally{n.emitOne=void 0,n.emitMany=void 0,n.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 yt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new gr(async n=>{for await(let i of t)n.emitOne(r(i))})}map(t){return gr.map(this,t)}static filter(t,r){return new gr(async n=>{for await(let i of t)r(i)&&n.emitOne(i)})}filter(t){return gr.filter(this,t)}static coalesce(t){return gr.filter(t,r=>!!r)}coalesce(){return gr.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return gr.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())}};K0.EMPTY=K0.fromArray([]);var{getWindow:tn,getWindowId:dj,onDidRegisterWindow:fj}=function(){let e=new Map,t={window:Cn,disposables:new vi};e.set(Cn.vscodeWindowId,t);let r=new Y,n=new Y,i=new Y;function s(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:n.event,registerWindow(o){if(e.has(o.vscodeWindowId))return pe.None;let l=new vi,u={window:o,disposables:l.add(new vi)};return e.set(o.vscodeWindowId,u),l.add(Ae(()=>{e.delete(o.vscodeWindowId),n.fire(o)})),l.add(se(o,lt.BEFORE_UNLOAD,()=>{i.fire(o)})),r.fire(u),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){var c;let l=o;if((c=l==null?void 0:l.ownerDocument)!=null&&c.defaultView)return l.ownerDocument.defaultView.window;let u=o;return u!=null&&u.view?u.view.window:Cn},getDocument(o){return tn(o).document}}}(),pj=class{constructor(e,t,r,n){this._node=e,this._type=t,this._handler=r,this._options=n||!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 se(e,t,r,n){return new pj(e,t,r,n)}var q0=function(e,t,r,n){return se(e,t,r,n)},Rm,mj=class extends uj{constructor(e){super(),this.defaultTarget=e&&tn(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},V0=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){vc(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,n=new Map,i=s=>{r.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),n.set(s,!0);o.length>0;)o.sort(V0.sort),o.shift().execute();n.set(s,!1)};Rm=(s,o,l=0)=>{let u=dj(s),c=new V0(o,l),h=e.get(u);return h||(h=[],e.set(u,h)),h.push(c),r.get(u)||(r.set(u,!0),s.requestAnimationFrame(()=>i(u))),c}})();function gj(e){let t=e.getBoundingClientRect(),r=tn(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var lt={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"},yj=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=Wt(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Wt(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Wt(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Wt(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Wt(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Wt(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Wt(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Wt(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Wt(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Wt(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Wt(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=Wt(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=Wt(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Wt(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 Wt(e){return typeof e=="number"?`${e}px`:e}function xa(e){return new yj(e)}var Pb=class{constructor(){this._hooks=new vi,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 r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,n,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(Ae(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=tn(e)}this._hooks.add(se(s,lt.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(se(s,lt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function vj(e,t,r){let n=null,i=null;if(typeof r.value=="function"?(n="value",i=r.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(n="get",i=r.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;r[n]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var Kr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Kr||(Kr={}));var ia=class St extends pe{constructor(){super(),this.dispatched=!1,this.targets=new I0,this.ignoreTargets=new I0,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(yt.runAndSubscribe(fj,({window:t,disposables:r})=>{r.add(se(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(se(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(se(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:Cn,disposables:this._store}))}static addTarget(t){if(!St.isTouchDevice())return pe.None;St.INSTANCE||(St.INSTANCE=new St);let r=St.INSTANCE.targets.push(t);return Ae(r)}static ignoreTarget(t){if(!St.isTouchDevice())return pe.None;St.INSTANCE||(St.INSTANCE=new St);let r=St.INSTANCE.ignoreTargets.push(t);return Ae(r)}static isTouchDevice(){return"ontouchstart"in Cn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,i=t.targetTouches.length;n<i;n++){let s=t.targetTouches.item(n);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:r,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[r],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent(Kr.Start,s.target);o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let n=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=r.changedTouches.length;s<o;s++){let l=r.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let u=this.activeTouches[l.identifier],c=Date.now()-u.initialTimeStamp;if(c<St.HOLD_DELAY&&Math.abs(u.initialPageX-nr(u.rollingPageX))<30&&Math.abs(u.initialPageY-nr(u.rollingPageY))<30){let h=this.newGestureEvent(Kr.Tap,u.initialTarget);h.pageX=nr(u.rollingPageX),h.pageY=nr(u.rollingPageY),this.dispatchEvent(h)}else if(c>=St.HOLD_DELAY&&Math.abs(u.initialPageX-nr(u.rollingPageX))<30&&Math.abs(u.initialPageY-nr(u.rollingPageY))<30){let h=this.newGestureEvent(Kr.Contextmenu,u.initialTarget);h.pageX=nr(u.rollingPageX),h.pageY=nr(u.rollingPageY),this.dispatchEvent(h)}else if(i===1){let h=nr(u.rollingPageX),d=nr(u.rollingPageY),f=nr(u.rollingTimestamps)-u.rollingTimestamps[0],p=h-u.rollingPageX[0],m=d-u.rollingPageY[0],x=[...this.targets].filter(C=>u.initialTarget instanceof Node&&C.contains(u.initialTarget));this.inertia(t,x,n,Math.abs(p)/f,p>0?1:-1,h,Math.abs(m)/f,m>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(Kr.End,u.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=r,n.tapCount=0,n}dispatchEvent(t){if(t.type===Kr.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>St.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===Kr.Change||t.type===Kr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let r=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let i=0,s=t.initialTarget;for(;s&&s!==n;)i++,s=s.parentElement;r.push([i,n])}r.sort((n,i)=>n[0]-i[0]);for(let[n,i]of r)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,n,i,s,o,l,u,c){this.handle=Rm(t,()=>{let h=Date.now(),d=h-n,f=0,p=0,m=!0;i+=St.SCROLL_FRICTION*d,l+=St.SCROLL_FRICTION*d,i>0&&(m=!1,f=s*i*d),l>0&&(m=!1,p=u*l*d);let x=this.newGestureEvent(Kr.Change);x.translationX=f,x.translationY=p,r.forEach(C=>C.dispatchEvent(x)),m||this.inertia(t,r,h,i,s,o+f,l,u,c+p)})}onTouchMove(t){let r=Date.now();for(let n=0,i=t.changedTouches.length;n<i;n++){let s=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let o=this.activeTouches[s.identifier],l=this.newGestureEvent(Kr.Change,o.initialTarget);l.translationX=s.pageX-nr(o.rollingPageX),l.translationY=s.pageY-nr(o.rollingPageY),l.pageX=s.pageX,l.pageY=s.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};ia.SCROLL_FRICTION=-.005,ia.HOLD_DELAY=700,ia.CLEAR_TAP_COUNT_TIME=400,Ke([vj],ia,"isTouchDevice",1);var xj=ia,Mm=class extends pe{onclick(e,t){this._register(se(e,lt.CLICK,r=>t(new Ul(tn(e),r))))}onmousedown(e,t){this._register(se(e,lt.MOUSE_DOWN,r=>t(new Ul(tn(e),r))))}onmouseover(e,t){this._register(se(e,lt.MOUSE_OVER,r=>t(new Ul(tn(e),r))))}onmouseleave(e,t){this._register(se(e,lt.MOUSE_LEAVE,r=>t(new Ul(tn(e),r))))}onkeydown(e,t){this._register(se(e,lt.KEY_DOWN,r=>t(new H0(r))))}onkeyup(e,t){this._register(se(e,lt.KEY_UP,r=>t(new H0(r))))}oninput(e,t){this._register(se(e,lt.INPUT,t))}onblur(e,t){this._register(se(e,lt.BLUR,t))}onfocus(e,t){this._register(se(e,lt.FOCUS,t))}onchange(e,t){this._register(se(e,lt.CHANGE,t))}ignoreGesture(e){return xj.ignoreTarget(e)}},Q0=11,_j=class extends Mm{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=Q0+"px",this.domNode.style.height=Q0+"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 Pb),this._register(q0(this.bgDomNode,lt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(q0(this.domNode,lt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new mj),this._pointerdownScheduleRepeatTimer=this._register(new Pm)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,tn(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},wj=class Tf{constructor(t,r,n,i,s,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,n=n|0,i=i|0,s=s|0,o=o|0,l=l|0),this.rawScrollLeft=i,this.rawScrollTop=l,r<0&&(r=0),i+r>n&&(i=n-r),i<0&&(i=0),s<0&&(s=0),l+s>o&&(l=o-s),l<0&&(l=0),this.width=r,this.scrollWidth=n,this.scrollLeft=i,this.height=s,this.scrollHeight=o,this.scrollTop=l}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,r){return new Tf(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Tf(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,r){let n=this.width!==t.width,i=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,u=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,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:n,scrollWidthChanged:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:u}}},bj=class extends pe{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Y),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new wj(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 n;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(n=this._smoothScrolling)==null||n.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 r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let n;t?n=new G0(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=G0.start(this._state,r,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 r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},Y0=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function Nh(e,t){let r=t-e;return function(n){return e+r*kj(n)}}function Sj(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var G0=class Df{constructor(t,r,n,i){this.from=t,this.to=r,this.duration=i,this.startTime=n,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,r,n){if(Math.abs(t-r)>2.5*n){let i,s;return t<r?(i=t+.75*n,s=r-.75*n):(i=t-.75*n,s=r+.75*n),Sj(Nh(t,i),Nh(s,r),.33)}return Nh(t,r)}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 r=(t-this.startTime)/this.duration;if(r<1){let n=this.scrollLeft(r),i=this.scrollTop(r);return new Y0(n,i,!1)}return new Y0(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,n){return Df.start(t,r,n)}static start(t,r,n){n=n+10;let i=Date.now()-10;return new Df(t,r,i,n)}};function Cj(e){return Math.pow(e,3)}function kj(e){return 1-Cj(1-e)}var Nj=class extends pe{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Pm)}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":"")))}},Ej=140,Rb=class extends Mm{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 Nj(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Pb),this._shouldRender=!0,this.domNode=xa(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(se(this.domNode.domNode,lt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new _j(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=xa(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(se(this.slider.domNode,lt.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.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,r=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);r<=i&&i<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let i=gj(this.domNode.domNode);t=e.pageX-i.left,r=e.pageY-i.top}let n=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{let s=this._sliderOrthogonalPointerPosition(i),o=Math.abs(s-r);if(kb&&o>Ej){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let l=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(l))},()=>{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()}},Mb=class Lf{constructor(t,r,n,i,s,o){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Lf(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,n,i,s){let o=Math.max(0,n-t),l=Math.max(0,o-2*r),u=i>0&&i>n;if(!u)return{computedAvailableSize:Math.round(o),computedIsNeeded:u,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*l/i))),h=(l-c)/(i-n),d=s*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:u,computedSliderSize:Math.round(c),computedSliderRatio:h,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=Lf._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 r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,n=this._scrollPosition;return r<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},jj=class extends Rb{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Mb(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,i.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}},Pj=class extends Rb{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Mb(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,i.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}},Rj=500,X0=50,Mj=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Af=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,r=0,n=1,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-n);if(t-=s,r+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,n++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(Em){let r=tn(t.browserEvent),n=HE(r);this.accept(Date.now(),t.deltaX*n,t.deltaY*n)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,n){let i=null,s=new Mj(t,r,n);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(i=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]=s),s.score=this._computeScore(s,i)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),r){let i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(r.deltaX),l=Math.abs(r.deltaY),u=Math.max(Math.min(i,o),1),c=Math.max(Math.min(s,l),1),h=Math.max(i,o),d=Math.max(s,l);h%u===0&&d%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Af.INSTANCE=new Af;var Tj=Af,Dj=class extends Mm{constructor(e,t,r){super(),this._onScroll=this._register(new Y),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Y),this.onWillScroll=this._onWillScroll.event,this._options=Aj(t),this._scrollable=r,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let n={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Pj(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new jj(this._scrollable,this._options,n)),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=xa(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=xa(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=xa(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,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new Pm),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=cs(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,sn&&(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 U0(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=cs(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new U0(r))};this._mouseWheelToDispose.push(se(this._listenOnDomNode,lt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=Tj.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let l=!sn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let u=this._scrollable.getFutureScrollPosition(),c={};if(s){let h=X0*s,d=u.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(c,d)}if(o){let h=X0*o,d=u.scrollLeft-(h<0?Math.floor(h):Math.ceil(h));this._horizontalScrollbar.writeScrollPosition(c,d)}c=this._scrollable.validateScrollPosition(c),(u.scrollLeft!==c.scrollLeft||u.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),r=!0)}let n=r;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(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,r=e.scrollLeft>0,n=r?" left":"",i=t?" top":"",s=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${n}`)}}_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(),Rj)}},Lj=class extends Dj{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Aj(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,sn&&(t.className+=" mac"),t}var Of=class extends pe{constructor(e,t,r,n,i,s,o,l){super(),this._bufferService=r,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new Y),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let u=this._register(new bj({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>Rm(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{u.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Lj(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},u)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(yt.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ae(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ae(()=>this._styleElement.remove())),this._register(yt.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
415
- `)})),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(c=>this._handleScroll(c)))}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),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Of=Ke([Z(2,Bt),Z(3,Ln),Z(4,hb),Z(5,Po),Z(6,zt),Z(7,An)],Of);var If=class extends pe{constructor(e,t,r,n,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=n,this._renderService=i,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(s=>this._removeDecoration(s))),this._register(Ae(()=>{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 n;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((n=e==null?void 0:e.options)==null?void 0:n.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 r=e.options.x??0;return r&&r>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 r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*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()}};If=Ke([Z(1,Bt),Z(2,Ln),Z(3,hl),Z(4,An)],If);var Oj=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,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Wr={full:0,left:0,center:0,right:0},zn={full:0,left:0,center:0,right:0},Uo={full:0,left:0,center:0,right:0},nu=class extends pe{constructor(e,t,r,n,i,s,o,l){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=n,this._renderService=i,this._optionsService=s,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new Oj,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(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(Ae(()=>{var h;return(h=this._canvas)==null?void 0:h.remove()}));let u=this._canvas.getContext("2d");if(u)this._ctx=u;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);zn.full=this._canvas.width,zn.left=e,zn.center=t,zn.right=e,this._refreshDrawHeightConstants(),Uo.full=1,Uo.left=1,Uo.center=1+zn.left,Uo.right=1+zn.left+zn.center}_refreshDrawHeightConstants(){Wr.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);Wr.left=t,Wr.center=t,Wr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Wr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Wr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Wr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Wr.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(Uo[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Wr[e.position||"full"]/2),zn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Wr[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}))}};nu=Ke([Z(2,Bt),Z(3,hl),Z(4,An),Z(5,zt),Z(6,Po),Z(7,Ln)],nu);var U;(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=`
416
- `,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=""))(U||(U={}));var wc;(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="Ÿ"))(wc||(wc={}));var Tb;(e=>e.ST=`${U.ESC}\\`)(Tb||(Tb={}));var Ff=class{constructor(e,t,r,n,i,s){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=n,this._coreService=i,this._renderService=s,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 r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!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,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${U.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),r=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Ff=Ke([Z(2,Bt),Z(3,zt),Z(4,ys),Z(5,An)],Ff);var ut=0,ht=0,dt=0,He=0,J0={css:"#00000000",rgba:0},Xe;(e=>{function t(i,s,o,l){return l!==void 0?`#${Mi(i)}${Mi(s)}${Mi(o)}${Mi(l)}`:`#${Mi(i)}${Mi(s)}${Mi(o)}`}e.toCss=t;function r(i,s,o,l=255){return(i<<24|s<<16|o<<8|l)>>>0}e.toRgba=r;function n(i,s,o,l){return{css:e.toCss(i,s,o,l),rgba:e.toRgba(i,s,o,l)}}e.toColor=n})(Xe||(Xe={}));var Te;(e=>{function t(u,c){if(He=(c.rgba&255)/255,He===1)return{css:c.css,rgba:c.rgba};let h=c.rgba>>24&255,d=c.rgba>>16&255,f=c.rgba>>8&255,p=u.rgba>>24&255,m=u.rgba>>16&255,x=u.rgba>>8&255;ut=p+Math.round((h-p)*He),ht=m+Math.round((d-m)*He),dt=x+Math.round((f-x)*He);let C=Xe.toCss(ut,ht,dt),y=Xe.toRgba(ut,ht,dt);return{css:C,rgba:y}}e.blend=t;function r(u){return(u.rgba&255)===255}e.isOpaque=r;function n(u,c,h){let d=bc.ensureContrastRatio(u.rgba,c.rgba,h);if(d)return Xe.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=n;function i(u){let c=(u.rgba|255)>>>0;return[ut,ht,dt]=bc.toChannels(c),{css:Xe.toCss(ut,ht,dt),rgba:c}}e.opaque=i;function s(u,c){return He=Math.round(c*255),[ut,ht,dt]=bc.toChannels(u.rgba),{css:Xe.toCss(ut,ht,dt,He),rgba:Xe.toRgba(ut,ht,dt,He)}}e.opacity=s;function o(u,c){return He=u.rgba&255,s(u,He*c/255)}e.multiplyOpacity=o;function l(u){return[u.rgba>>24&255,u.rgba>>16&255,u.rgba>>8&255]}e.toColorRGB=l})(Te||(Te={}));var Ie;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let s=i.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return ut=parseInt(i.slice(1,2).repeat(2),16),ht=parseInt(i.slice(2,3).repeat(2),16),dt=parseInt(i.slice(3,4).repeat(2),16),Xe.toColor(ut,ht,dt);case 5:return ut=parseInt(i.slice(1,2).repeat(2),16),ht=parseInt(i.slice(2,3).repeat(2),16),dt=parseInt(i.slice(3,4).repeat(2),16),He=parseInt(i.slice(4,5).repeat(2),16),Xe.toColor(ut,ht,dt,He);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let s=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return ut=parseInt(s[1]),ht=parseInt(s[2]),dt=parseInt(s[3]),He=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),Xe.toColor(ut,ht,dt,He);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ut,ht,dt,He]=t.getImageData(0,0,1,1).data,He!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Xe.toRgba(ut,ht,dt,He),css:i}}e.toColor=n})(Ie||(Ie={}));var Pt;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,i,s){let o=n/255,l=i/255,u=s/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),d=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4);return c*.2126+h*.7152+d*.0722}e.relativeLuminance2=r})(Pt||(Pt={}));var bc;(e=>{function t(o,l){if(He=(l&255)/255,He===1)return l;let u=l>>24&255,c=l>>16&255,h=l>>8&255,d=o>>24&255,f=o>>16&255,p=o>>8&255;return ut=d+Math.round((u-d)*He),ht=f+Math.round((c-f)*He),dt=p+Math.round((h-p)*He),Xe.toRgba(ut,ht,dt)}e.blend=t;function r(o,l,u){let c=Pt.relativeLuminance(o>>8),h=Pt.relativeLuminance(l>>8);if(dn(c,h)<u){if(h<c){let p=n(o,l,u),m=dn(c,Pt.relativeLuminance(p>>8));if(m<u){let x=i(o,l,u),C=dn(c,Pt.relativeLuminance(x>>8));return m>C?p:x}return p}let d=i(o,l,u),f=dn(c,Pt.relativeLuminance(d>>8));if(f<u){let p=n(o,l,u),m=dn(c,Pt.relativeLuminance(p>>8));return f>m?d:p}return d}}e.ensureContrastRatio=r;function n(o,l,u){let c=o>>24&255,h=o>>16&255,d=o>>8&255,f=l>>24&255,p=l>>16&255,m=l>>8&255,x=dn(Pt.relativeLuminance2(f,p,m),Pt.relativeLuminance2(c,h,d));for(;x<u&&(f>0||p>0||m>0);)f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m-=Math.max(0,Math.ceil(m*.1)),x=dn(Pt.relativeLuminance2(f,p,m),Pt.relativeLuminance2(c,h,d));return(f<<24|p<<16|m<<8|255)>>>0}e.reduceLuminance=n;function i(o,l,u){let c=o>>24&255,h=o>>16&255,d=o>>8&255,f=l>>24&255,p=l>>16&255,m=l>>8&255,x=dn(Pt.relativeLuminance2(f,p,m),Pt.relativeLuminance2(c,h,d));for(;x<u&&(f<255||p<255||m<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),x=dn(Pt.relativeLuminance2(f,p,m),Pt.relativeLuminance2(c,h,d));return(f<<24|p<<16|m<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(bc||(bc={}));function Mi(e){let t=e.toString(16);return t.length<2?"0"+t:t}function dn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Ij=class extends ul{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}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()]}},iu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new kr}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 r=[],n=t.translateToString(!0),i=0,s=0,o=0,l=t.getFg(0),u=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==u){if(c-i>1){let h=this._getJoinedRanges(n,o,s,t,i);for(let d=0;d<h.length;d++)r.push(h[d])}i=c,o=s,l=this._workCell.fg,u=this._workCell.bg}s+=this._workCell.getChars().length||li.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(n,o,s,t,i);for(let h=0;h<c.length;h++)r.push(c[h])}return r}_getJoinedRanges(e,t,r,n,i){let s=e.substring(t,r),o=[];try{o=this._characterJoiners[0].handler(s)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let u=this._characterJoiners[l].handler(s);for(let c=0;c<u.length;c++)iu._mergeRanges(o,u[c])}catch(u){console.error(u)}return this._stringRangesToCellRanges(o,n,i),o}_stringRangesToCellRanges(e,t,r){let n=0,i=!1,s=0,o=e[n];if(o){for(let l=r;l<this._bufferService.cols;l++){let u=t.getWidth(l),c=t.getString(l).length||li.length;if(u!==0){if(!i&&o[0]<=s&&(o[0]=l,i=!0),o[1]<=s){if(o[1]=l,o=e[++n],!o)break;o[0]<=s?(o[0]=l,i=!0):i=!1}s+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(r){if(t[1]<=i[0])return e[n-1][1]=t[1],e;if(t[1]<=i[1])return e[n-1][1]=Math.max(t[1],i[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=i[0])return e.splice(n,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};iu=Ke([Z(0,Bt)],iu);function Fj(e){return 57508<=e&&e<=57558}function Bj(e){return 9472<=e&&e<=9631}function zj(e){return Fj(e)||Bj(e)}function $j(){return{css:{canvas:Kl(),cell:Kl()},device:{canvas:Kl(),cell:Kl(),char:{width:0,height:0,left:0,top:0}}}}function Kl(){return{width:0,height:0}}var Bf=class{constructor(e,t,r,n,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=n,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new kr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,n,i,s,o,l,u,c,h){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();r&&m<s+1&&(m=s+1);let x,C=0,y="",v=0,g=0,_=0,N=0,S=!1,j=0,A=!1,$=0,z=0,I=[],P=c!==-1&&h!==-1;for(let R=0;R<m;R++){e.loadCell(R,this._workCell);let D=this._workCell.getWidth();if(D===0)continue;let L=!1,B=R>=z,O=R,E=this._workCell;if(f.length>0&&R===f[0][0]&&B){let _e=f.shift(),ee=this._isCellInSelection(_e[0],t);for(v=_e[0]+1;v<_e[1];v++)B&&(B=ee===this._isCellInSelection(v,t));B&&(B=!r||s<_e[0]||s>=_e[1]),B?(L=!0,E=new Ij(this._workCell,e.translateToString(!0,_e[0],_e[1]),_e[1]-_e[0]),O=_e[1]-1,D=E.getWidth()):z=_e[1]}let F=this._isCellInSelection(R,t),k=r&&R===s,V=P&&R>=c&&R<=h,M=!1;this._decorationService.forEachDecorationAtCell(R,t,void 0,_e=>{M=!0});let b=E.getChars()||li;if(b===" "&&(E.isUnderline()||E.isOverline())&&(b=" "),$=D*l-u.get(b,E.isBold(),E.isItalic()),!x)x=this._document.createElement("span");else if(C&&(F&&A||!F&&!A&&E.bg===g)&&(F&&A&&p.selectionForeground||E.fg===_)&&E.extended.ext===N&&V===S&&$===j&&!k&&!L&&!M&&B){E.isInvisible()?y+=li:y+=b,C++;continue}else C&&(x.textContent=y),x=this._document.createElement("span"),C=0,y="";if(g=E.bg,_=E.fg,N=E.extended.ext,S=V,j=$,A=F,L&&s>=R&&s<=O&&(s=R),!this._coreService.isCursorHidden&&k&&this._coreService.isCursorInitialized){if(I.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&I.push("xterm-cursor-blink"),I.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":I.push("xterm-cursor-outline");break;case"block":I.push("xterm-cursor-block");break;case"bar":I.push("xterm-cursor-bar");break;case"underline":I.push("xterm-cursor-underline");break}}if(E.isBold()&&I.push("xterm-bold"),E.isItalic()&&I.push("xterm-italic"),E.isDim()&&I.push("xterm-dim"),E.isInvisible()?y=li:y=E.getChars()||li,E.isUnderline()&&(I.push(`xterm-underline-${E.extended.underlineStyle}`),y===" "&&(y=" "),!E.isUnderlineColorDefault()))if(E.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${ul.toColorRGB(E.getUnderlineColor()).join(",")})`;else{let _e=E.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&E.isBold()&&_e<8&&(_e+=8),x.style.textDecorationColor=p.ansi[_e].css}E.isOverline()&&(I.push("xterm-overline"),y===" "&&(y=" ")),E.isStrikethrough()&&I.push("xterm-strikethrough"),V&&(x.style.textDecoration="underline");let H=E.getFgColor(),K=E.getFgColorMode(),X=E.getBgColor(),ie=E.getBgColorMode(),de=!!E.isInverse();if(de){let _e=H;H=X,X=_e;let ee=K;K=ie,ie=ee}let me,Ze,er=!1;this._decorationService.forEachDecorationAtCell(R,t,void 0,_e=>{_e.options.layer!=="top"&&er||(_e.backgroundColorRGB&&(ie=50331648,X=_e.backgroundColorRGB.rgba>>8&16777215,me=_e.backgroundColorRGB),_e.foregroundColorRGB&&(K=50331648,H=_e.foregroundColorRGB.rgba>>8&16777215,Ze=_e.foregroundColorRGB),er=_e.options.layer==="top")}),!er&&F&&(me=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,X=me.rgba>>8&16777215,ie=50331648,er=!0,p.selectionForeground&&(K=50331648,H=p.selectionForeground.rgba>>8&16777215,Ze=p.selectionForeground)),er&&I.push("xterm-decoration-top");let tr;switch(ie){case 16777216:case 33554432:tr=p.ansi[X],I.push(`xterm-bg-${X}`);break;case 50331648:tr=Xe.toColor(X>>16,X>>8&255,X&255),this._addStyle(x,`background-color:#${Z0((X>>>0).toString(16),"0",6)}`);break;case 0:default:de?(tr=p.foreground,I.push("xterm-bg-257")):tr=p.background}switch(me||E.isDim()&&(me=Te.multiplyOpacity(tr,.5)),K){case 16777216:case 33554432:E.isBold()&&H<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(H+=8),this._applyMinimumContrast(x,tr,p.ansi[H],E,me,void 0)||I.push(`xterm-fg-${H}`);break;case 50331648:let _e=Xe.toColor(H>>16&255,H>>8&255,H&255);this._applyMinimumContrast(x,tr,_e,E,me,Ze)||this._addStyle(x,`color:#${Z0(H.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(x,tr,p.foreground,E,me,Ze)||de&&I.push("xterm-fg-257")}I.length&&(x.className=I.join(" "),I.length=0),!k&&!L&&!M&&B?C++:x.textContent=y,$!==this.defaultSpacing&&(x.style.letterSpacing=`${$}px`),d.push(x),R=O}return x&&C&&(x.textContent=y),d}_applyMinimumContrast(e,t,r,n,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||zj(n.getCode()))return!1;let o=this._getContrastCache(n),l;if(!i&&!s&&(l=o.getColor(t.rgba,r.rgba)),l===void 0){let u=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);l=Te.ensureContrastRatio(i||t,s||r,u),o.setColor((i||t).rgba,(s||r).rgba,l??null)}return l?(this._addStyle(e,`color:${l.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 r=this._selectionStart,n=this._selectionEnd;return!r||!n?!1:this._columnSelectMode?r[0]<=n[0]?e>=r[0]&&t>=r[1]&&e<n[0]&&t<=n[1]:e<r[0]&&t>=r[1]&&e>=n[0]&&t<=n[1]:t>r[1]&&t<n[1]||r[1]===n[1]&&t===r[1]&&e>=r[0]&&e<n[0]||r[1]<n[1]&&t===n[1]&&e<n[0]||r[1]<n[1]&&t===r[1]&&e>=r[0]}};Bf=Ke([Z(1,pb),Z(2,zt),Z(3,Ln),Z(4,ys),Z(5,hl),Z(6,Po)],Bf);function Z0(e,t,r){for(;e.length<r;)e=t+e;return e}var Hj=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 r=e.createElement("span");r.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[r,n,i,s],this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(s),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,r,n){e===this._font&&t===this._fontSize&&r===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,r){let n=0;if(!t&&!r&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let o=this._measure(e,0);return o>0&&(this._flat[n]=o),o}let i=e;t&&(i+="B"),r&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),r&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},Wj=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,r,n=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let i=e.buffers.active.ydisp,s=t[1]-i,o=r[1]-i,l=Math.max(s,0),u=Math.min(o,e.rows-1);if(l>=e.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=u,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function Uj(){return new Wj}var Eh="xterm-dom-renderer-owner-",mr="xterm-rows",ql="xterm-fg-",ey="xterm-bg-",Ko="xterm-focus",Vl="xterm-selection",Kj=1,zf=class extends pe{constructor(e,t,r,n,i,s,o,l,u,c,h,d,f,p){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=n,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=u,this._optionsService=c,this._bufferService=h,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=Kj++,this._rowElements=[],this._selectionRenderModel=Uj(),this.onRequestRedraw=this._register(new Y).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(mr),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(Vl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=$j(),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=l.createInstance(Bf,document),this._element.classList.add(Eh+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(Ae(()=>{this._element.classList.remove(Eh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Hj(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 r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${mr} 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} .${mr} { 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} .${mr} .xterm-dim { color: ${Te.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 r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${mr}.${Ko} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${mr}.${Ko} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${mr}.${Ko} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Vl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Vl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Vl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${ql}${s} { color: ${o.css}; }${this._terminalSelector} .${ql}${s}.xterm-dim { color: ${Te.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${ey}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${ql}257 { color: ${Te.opaque(e.background).css}; }${this._terminalSelector} .${ql}257.xterm-dim { color: ${Te.multiplyOpacity(Te.opaque(e.background),.5).css}; }${this._terminalSelector} .${ey}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 r=this._rowElements.length;r<=t;r++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}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(Ko),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ko),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let u=e[0]>t[0];l.appendChild(this._createSelectionElement(s,u?t[0]:e[0],u?e[0]:t[0],o-s+1))}else{let u=n===s?e[0]:0,c=s===i?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(s,u,c));let h=o-s-1;if(l.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,h)),s!==o){let d=i===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,d))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,r,n=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(r-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${n*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${s}px`,i.style.width=`${o}px`,i}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 r=this._bufferService.buffer,n=r.ybase+r.y,i=Math.min(r.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let u=e;u<=t;u++){let c=u+r.ydisp,h=this._rowElements[u],d=r.lines.get(c);if(!h||!d)break;h.replaceChildren(...this._rowFactory.createRow(d,c,c===n,o,l,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Eh}${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,r,n,i,s){r<0&&(e=0),n<0&&(t=0);let o=this._bufferService.rows-1;r=Math.max(Math.min(r,o),0),n=Math.max(Math.min(n,o),0),i=Math.min(i,this._bufferService.cols);let l=this._bufferService.buffer,u=l.ybase+l.y,c=Math.min(l.x,i-1),h=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=r;p<=n;++p){let m=p+l.ydisp,x=this._rowElements[p],C=l.lines.get(m);if(!x||!C)break;x.replaceChildren(...this._rowFactory.createRow(C,m,m===u,d,f,c,h,this.dimensions.css.cell.width,this._widthCache,s?p===r?e:0:-1,s?(p===n?t:i)-1:-1))}}};zf=Ke([Z(7,Cm),Z(8,Du),Z(9,zt),Z(10,Bt),Z(11,ys),Z(12,Ln),Z(13,Po)],zf);var $f=class extends pe{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Y),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Vj(this._optionsService))}catch{this._measureStrategy=this._register(new qj(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())}};$f=Ke([Z(2,zt)],$f);var Db=class extends pe{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)}},qj=class extends Db{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,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}},Vj=class extends Db{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}},Qj=class extends pe{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Yj(this._window)),this._onDprChange=this._register(new Y),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Y),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(yt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(se(this._textarea,"focus",()=>this._isFocused=!0)),this._register(se(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}},Yj=class extends pe{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Co),this._onDprChange=this._register(new Y),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ae(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=se(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)}},Gj=class extends pe{constructor(){super(),this.linkProviders=[],this._register(Ae(()=>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 Tm(e,t,r){let n=r.getBoundingClientRect(),i=e.getComputedStyle(r),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-n.left-s,t.clientY-n.top-o]}function Xj(e,t,r,n,i,s,o,l,u){if(!s)return;let c=Tm(e,t,r);if(c)return c[0]=Math.ceil((c[0]+(u?o/2:0))/o),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),n+(u?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var Hf=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,i){return Xj(window,e,t,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let r=Tm(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};Hf=Ke([Z(0,An),Z(1,Du)],Hf);var Jj=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,r){this._rowCount=r,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=[]}},Lb={};lE(Lb,{getSafariVersion:()=>e4,isChromeOS:()=>Fb,isFirefox:()=>Ab,isIpad:()=>t4,isIphone:()=>r4,isLegacyEdge:()=>Zj,isLinux:()=>Dm,isMac:()=>su,isNode:()=>Lu,isSafari:()=>Ob,isWindows:()=>Ib});var Lu=typeof process<"u"&&"title"in process,dl=Lu?"node":navigator.userAgent,fl=Lu?"node":navigator.platform,Ab=dl.includes("Firefox"),Zj=dl.includes("Edge"),Ob=/^((?!chrome|android).)*safari/i.test(dl);function e4(){if(!Ob)return 0;let e=dl.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var su=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(fl),t4=fl==="iPad",r4=fl==="iPhone",Ib=["Windows","Win16","Win32","WinCE"].includes(fl),Dm=fl.indexOf("Linux")>=0,Fb=/\bCrOS\b/.test(dl),Bb=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,r=0,n=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),i=e.timeRemaining(),r*1.5>i){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=i}this.clear()}},n4=class extends Bb{_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())}}},i4=class extends Bb{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ou=!Lu&&"requestIdleCallback"in window?i4:n4,s4=class{constructor(){this._queue=new ou}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Wf=class extends pe{constructor(e,t,r,n,i,s,o,l,u){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=i,this._coreBrowserService=l,this._renderer=this._register(new Co),this._pausedResizeTask=new s4,this._observerDisposable=this._register(new Co),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 Y),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Y),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Y),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Y),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Jj((c,h)=>this._renderRows(c,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new o4(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ae(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.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(u.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=Ae(()=>r.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,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),r||(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 r;return(r=this._renderer.value)==null?void 0:r.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,r){var n;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(n=this._renderer.value)==null||n.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Wf=Ke([Z(2,zt),Z(3,Du),Z(4,ys),Z(5,hl),Z(6,Bt),Z(7,Ln),Z(8,Po)],Wf);var o4=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,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 a4(e,t,r,n){let i=r.buffer.x,s=r.buffer.y;if(!r.buffer.hasScrollback)return u4(i,s,e,t,r,n)+Au(s,t,r,n)+h4(i,s,e,t,r,n);let o;if(s===t)return o=i>e?"D":"C",qa(Math.abs(i-e),Ka(o,n));o=s>t?"D":"C";let l=Math.abs(s-t),u=c4(s>t?e:i,r)+(l-1)*r.cols+1+l4(s>t?i:e);return qa(u,Ka(o,n))}function l4(e,t){return e-1}function c4(e,t){return t.cols-e}function u4(e,t,r,n,i,s){return Au(t,n,i,s).length===0?"":qa($b(e,t,e,t-us(t,i),!1,i).length,Ka("D",s))}function Au(e,t,r,n){let i=e-us(e,r),s=t-us(t,r),o=Math.abs(i-s)-d4(e,t,r);return qa(o,Ka(zb(e,t),n))}function h4(e,t,r,n,i,s){let o;Au(t,n,i,s).length>0?o=n-us(n,i):o=t;let l=n,u=f4(e,t,r,n,i,s);return qa($b(e,o,r,l,u==="C",i).length,Ka(u,s))}function d4(e,t,r){var o;let n=0,i=e-us(e,r),s=t-us(t,r);for(let l=0;l<Math.abs(i-s);l++){let u=zb(e,t)==="A"?-1:1;(o=r.buffer.lines.get(i+u*l))!=null&&o.isWrapped&&n++}return n}function us(e,t){let r=0,n=t.buffer.lines.get(e),i=n==null?void 0:n.isWrapped;for(;i&&e>=0&&e<t.rows;)r++,n=t.buffer.lines.get(--e),i=n==null?void 0:n.isWrapped;return r}function f4(e,t,r,n,i,s){let o;return Au(r,n,i,s).length>0?o=n-us(n,i):o=t,e<r&&o<=n||e>=r&&o<n?"C":"D"}function zb(e,t){return e>t?"A":"B"}function $b(e,t,r,n,i,s){let o=e,l=t,u="";for(;(o!==r||l!==n)&&l>=0&&l<s.buffer.lines.length;)o+=i?1:-1,i&&o>s.cols-1?(u+=s.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!i&&o<0&&(u+=s.buffer.translateBufferLineToString(l,!1,0,e+1),o=s.cols-1,e=o,l--);return u+s.buffer.translateBufferLineToString(l,!1,e,o)}function Ka(e,t){let r=t?"O":"[";return U.ESC+r+e}function qa(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var p4=class{constructor(e){this._bufferService=e,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 e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function ty(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 jh=50,m4=15,g4=50,y4=500,v4=" ",x4=new RegExp(v4,"g"),Uf=class extends pe{constructor(e,t,r,n,i,s,o,l,u){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=l,this._coreBrowserService=u,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new kr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Y),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Y),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Y),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Y),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new p4(this._bufferService),this._activeSelectionMode=0,this._register(Ae(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.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 r=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let i=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=r.translateBufferLineToString(o,!0,i,s);n.push(l)}}else{let i=e[1]===t[1]?t[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=r.lines.get(s),l=r.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?n[n.length-1]+=l:n.push(l)}if(e[1]!==t[1]){let s=r.lines.get(t[1]),o=r.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?n[n.length-1]+=o:n.push(o)}}return n.map(i=>i.replace(x4," ")).join(Ib?`\r
417
- `:`
418
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Dm&&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),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n||!t?!1:this._areCoordsInSelection(t,r,n)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n?!1:this._areCoordsInSelection([e,t],r,n)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let r=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=ty(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,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=Tm(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-jh),jh),t/=jh,t/Math.abs(t)+Math.round(t*(m4-1)))}shouldForceSelection(e){return su?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(),g4)}_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&&!(su&&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 r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let n=r.lines.get(this._model.selectionEnd[1]);n&&n.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<y4&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let n=a4(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);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,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let n=0;t>=n;n++){let i=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:i>1&&t!==n&&(r+=i-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,s=i.lines.get(e[1]);if(!s)return;let o=i.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(s,e[0]),u=l,c=e[0]-l,h=0,d=0,f=0,p=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;u<o.length&&o.charAt(u+1)===" ";)u++}else{let C=e[0],y=e[0];s.getWidth(C)===0&&(h++,C--),s.getWidth(y)===2&&(d++,y++);let v=s.getString(y).length;for(v>1&&(p+=v-1,u+=v-1);C>0&&l>0&&!this._isCharWordSeparator(s.loadCell(C-1,this._workCell));){s.loadCell(C-1,this._workCell);let g=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,C--):g>1&&(f+=g-1,l-=g-1),l--,C--}for(;y<s.length&&u+1<o.length&&!this._isCharWordSeparator(s.loadCell(y+1,this._workCell));){s.loadCell(y+1,this._workCell);let g=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,y++):g>1&&(p+=g-1,u+=g-1),u++,y++}}u++;let m=l+c-h+f,x=Math.min(this._bufferService.cols,u-l+h+d-f-p);if(!(!t&&o.slice(l,u).trim()==="")){if(r&&m===0&&s.getCodePoint(0)!==32){let C=i.lines.get(e[1]-1);if(C&&s.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let y=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(y){let v=this._bufferService.cols-y.start;m-=v,x+=v}}}if(n&&m+x===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let C=i.lines.get(e[1]+1);if(C!=null&&C.isWrapped&&C.getCodePoint(0)!==32){let y=this._getWordAt([0,e[1]+1],!1,!1,!0);y&&(x+=y.length)}}return{start:m,length:x}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={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=ty(r,this._bufferService.cols)}};Uf=Ke([Z(3,Bt),Z(4,ys),Z(5,km),Z(6,zt),Z(7,An),Z(8,Ln)],Uf);var ry=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},ny=class{constructor(){this._color=new ry,this._css=new ry}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},et=Object.freeze((()=>{let e=[Ie.toColor("#2e3436"),Ie.toColor("#cc0000"),Ie.toColor("#4e9a06"),Ie.toColor("#c4a000"),Ie.toColor("#3465a4"),Ie.toColor("#75507b"),Ie.toColor("#06989a"),Ie.toColor("#d3d7cf"),Ie.toColor("#555753"),Ie.toColor("#ef2929"),Ie.toColor("#8ae234"),Ie.toColor("#fce94f"),Ie.toColor("#729fcf"),Ie.toColor("#ad7fa8"),Ie.toColor("#34e2e2"),Ie.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],i=t[r/6%6|0],s=t[r%6];e.push({css:Xe.toCss(n,i,s),rgba:Xe.toRgba(n,i,s)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:Xe.toCss(n,n,n),rgba:Xe.toRgba(n,n,n)})}return e})()),Li=Ie.toColor("#ffffff"),sa=Ie.toColor("#000000"),iy=Ie.toColor("#ffffff"),sy=sa,qo={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},_4=Li,Kf=class extends pe{constructor(e){super(),this._optionsService=e,this._contrastCache=new ny,this._halfContrastCache=new ny,this._onChangeColors=this._register(new Y),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Li,background:sa,cursor:iy,cursorAccent:sy,selectionForeground:void 0,selectionBackgroundTransparent:qo,selectionBackgroundOpaque:Te.blend(sa,qo),selectionInactiveBackgroundTransparent:qo,selectionInactiveBackgroundOpaque:Te.blend(sa,qo),scrollbarSliderBackground:Te.opacity(Li,.2),scrollbarSliderHoverBackground:Te.opacity(Li,.4),scrollbarSliderActiveBackground:Te.opacity(Li,.5),overviewRulerBorder:Li,ansi:et.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=Ne(e.foreground,Li),t.background=Ne(e.background,sa),t.cursor=Te.blend(t.background,Ne(e.cursor,iy)),t.cursorAccent=Te.blend(t.background,Ne(e.cursorAccent,sy)),t.selectionBackgroundTransparent=Ne(e.selectionBackground,qo),t.selectionBackgroundOpaque=Te.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ne(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Te.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ne(e.selectionForeground,J0):void 0,t.selectionForeground===J0&&(t.selectionForeground=void 0),Te.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Te.opacity(t.selectionBackgroundTransparent,.3)),Te.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Te.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ne(e.scrollbarSliderBackground,Te.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ne(e.scrollbarSliderHoverBackground,Te.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ne(e.scrollbarSliderActiveBackground,Te.opacity(t.foreground,.5)),t.overviewRulerBorder=Ne(e.overviewRulerBorder,_4),t.ansi=et.slice(),t.ansi[0]=Ne(e.black,et[0]),t.ansi[1]=Ne(e.red,et[1]),t.ansi[2]=Ne(e.green,et[2]),t.ansi[3]=Ne(e.yellow,et[3]),t.ansi[4]=Ne(e.blue,et[4]),t.ansi[5]=Ne(e.magenta,et[5]),t.ansi[6]=Ne(e.cyan,et[6]),t.ansi[7]=Ne(e.white,et[7]),t.ansi[8]=Ne(e.brightBlack,et[8]),t.ansi[9]=Ne(e.brightRed,et[9]),t.ansi[10]=Ne(e.brightGreen,et[10]),t.ansi[11]=Ne(e.brightYellow,et[11]),t.ansi[12]=Ne(e.brightBlue,et[12]),t.ansi[13]=Ne(e.brightMagenta,et[13]),t.ansi[14]=Ne(e.brightCyan,et[14]),t.ansi[15]=Ne(e.brightWhite,et[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<r;n++)t.ansi[n+16]=Ne(e.extendedAnsi[n],et[n+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()}}};Kf=Ke([Z(0,zt)],Kf);function Ne(e,t){if(e!==void 0)try{return Ie.toColor(e)}catch{}return t}var w4=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},b4=class{constructor(){this._services=new w4,this._services.set(Cm,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=mE(e).sort((s,o)=>s.index-o.index),n=[];for(let s of r){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);n.push(o)}let i=r.length>0?r[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},S4={trace:0,debug:1,info:2,warn:3,error:4,off:5},C4="xterm.js: ",qf=class extends pe{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=S4[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,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":C4)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};qf=Ke([Z(0,zt)],qf);var oy=class extends pe{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Y),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Y),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Y),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 r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];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,...r){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<r.length;n++)this._array[this._getCyclicIndex(e+n)]=r[n];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let n=this._length+r.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let i=t-1;i>=0;i--)this.set(e+i+r,this.get(e+i));let n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+r,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},fe=3,Ge=Object.freeze(new ul),Ql=0,Ph=2,oa=class Hb{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*fe);let i=r||kr.fromCharData([0,ab,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let r=this._data[t*fe+0],n=r&2097151;return[this._data[t*fe+1],r&2097152?this._combined[t]:n?Vn(n):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*fe+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*fe+0]=t|2097152|r[2]<<22):this._data[t*fe+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*fe+0]>>22}hasWidth(t){return this._data[t*fe+0]&12582912}getFg(t){return this._data[t*fe+1]}getBg(t){return this._data[t*fe+2]}hasContent(t){return this._data[t*fe+0]&4194303}getCodePoint(t){let r=this._data[t*fe+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*fe+0]&2097152}getString(t){let r=this._data[t*fe+0];return r&2097152?this._combined[t]:r&2097151?Vn(r&2097151):""}isProtected(t){return this._data[t*fe+2]&536870912}loadCell(t,r){return Ql=t*fe,r.content=this._data[Ql+0],r.fg=this._data[Ql+1],r.bg=this._data[Ql+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*fe+0]=r.content,this._data[t*fe+1]=r.fg,this._data[t*fe+2]=r.bg}setCellFromCodepoint(t,r,n,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*fe+0]=r|n<<22,this._data[t*fe+1]=i.fg,this._data[t*fe+2]=i.bg}addCodepointToCell(t,r,n){let i=this._data[t*fe+0];i&2097152?this._combined[t]+=Vn(r):i&2097151?(this._combined[t]=Vn(i&2097151)+Vn(r),i&=-2097152,i|=2097152):i=r|1<<22,n&&(i&=-12582913,i|=n<<22),this._data[t*fe+0]=i}insertCells(t,r,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length-t){let i=new kr;for(let s=this.length-t-r-1;s>=0;--s)this.setCell(t+r+s,this.loadCell(t+s,i));for(let s=0;s<r;++s)this.setCell(t+s,n)}else for(let i=t;i<this.length;++i)this.setCell(i,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(t,r,n){if(t%=this.length,r<this.length-t){let i=new kr;for(let s=0;s<this.length-t-r;++s)this.setCell(t+s,this.loadCell(t+r+s,i));for(let s=this.length-r;s<this.length;++s)this.setCell(s,n)}else for(let i=t;i<this.length;++i)this.setCell(i,n);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,n)}replaceCells(t,r,n,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,n);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,n),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,n);t<r&&t<this.length;)this.setCell(t++,n)}resize(t,r){if(t===this.length)return this._data.length*4*Ph<this._data.buffer.byteLength;let n=t*fe;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let i=new Uint32Array(n);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,r)}else{this._data=this._data.subarray(0,n);let i=Object.keys(this._combined);for(let o=0;o<i.length;o++){let l=parseInt(i[o],10);l>=t&&delete this._combined[l]}let s=Object.keys(this._extendedAttrs);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,n*4*Ph<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Ph<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,t);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,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 r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new Hb(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*fe+0]&4194303)return t+(this._data[t*fe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*fe+0]&4194303||this._data[t*fe+2]&50331648)return t+(this._data[t*fe+0]>>22);return 0}copyCellsFrom(t,r,n,i,s){let o=t._data;if(s)for(let u=i-1;u>=0;u--){for(let c=0;c<fe;c++)this._data[(n+u)*fe+c]=o[(r+u)*fe+c];o[(r+u)*fe+2]&268435456&&(this._extendedAttrs[n+u]=t._extendedAttrs[r+u])}else for(let u=0;u<i;u++){for(let c=0;c<fe;c++)this._data[(n+u)*fe+c]=o[(r+u)*fe+c];o[(r+u)*fe+2]&268435456&&(this._extendedAttrs[n+u]=t._extendedAttrs[r+u])}let l=Object.keys(t._combined);for(let u=0;u<l.length;u++){let c=parseInt(l[u],10);c>=r&&(this._combined[c-r+n]=t._combined[c])}}translateToString(t,r,n,i){r=r??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;r<n;){let o=this._data[r*fe+0],l=o&2097151,u=o&2097152?this._combined[r]:l?Vn(l):li;if(s+=u,i)for(let c=0;c<u.length;++c)i.push(r);r+=o>>22||1}return i&&i.push(r),s}};function k4(e,t,r,n,i,s){let o=[];for(let l=0;l<e.length-1;l++){let u=l,c=e.get(++u);if(!c.isWrapped)continue;let h=[e.get(l)];for(;u<e.length&&c.isWrapped;)h.push(c),c=e.get(++u);if(!s&&n>=l&&n<u){l+=h.length-1;continue}let d=0,f=Va(h,d,t),p=1,m=0;for(;p<h.length;){let C=Va(h,p,t),y=C-m,v=r-f,g=Math.min(y,v);h[d].copyCellsFrom(h[p],m,f,g,!1),f+=g,f===r&&(d++,f=0),m+=g,m===C&&(p++,m=0),f===0&&d!==0&&h[d-1].getWidth(r-1)===2&&(h[d].copyCellsFrom(h[d-1],r-1,f++,1,!1),h[d-1].setCell(r-1,i))}h[d].replaceCells(f,r,i);let x=0;for(let C=h.length-1;C>0&&(C>d||h[C].getTrimmedLength()===0);C--)x++;x>0&&(o.push(l+h.length-x),o.push(x)),l+=h.length-1}return o}function N4(e,t){let r=[],n=0,i=t[n],s=0;for(let o=0;o<e.length;o++)if(i===o){let l=t[++n];e.onDeleteEmitter.fire({index:o-s,amount:l}),o+=l-1,s+=l,i=t[++n]}else r.push(o);return{layout:r,countRemoved:s}}function E4(e,t){let r=[];for(let n=0;n<t.length;n++)r.push(e.get(t[n]));for(let n=0;n<r.length;n++)e.set(n,r[n]);e.length=t.length}function j4(e,t,r){let n=[],i=e.map((u,c)=>Va(e,c,t)).reduce((u,c)=>u+c),s=0,o=0,l=0;for(;l<i;){if(i-l<r){n.push(i-l);break}s+=r;let u=Va(e,o,t);s>u&&(s-=u,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let h=c?r-1:r;n.push(h),l+=h}return n}function Va(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,i=e[t+1].getWidth(0)===2;return n&&i?r-1:r}var Wb=class Ub{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Ub._nextId++,this._onDispose=this.register(new Y),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),cs(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Wb._nextId=1;var P4=Wb,ot={},Ai=ot.B;ot[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ot.A={"#":"£"};ot.B=void 0;ot[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ot.C=ot[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ot.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ot.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ot.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ot.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ot.E=ot[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ot.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ot.H=ot[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ot["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var ay=4294967295,ly=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Ge.clone(),this.savedCharset=Ai,this.markers=[],this._nullCell=kr.fromCharData([0,ab,1,0]),this._whitespaceCell=kr.fromCharData([0,li,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ou,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new oy(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 ru),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 ru),this._whitespaceCell}getBlankLine(e,t){return new oa(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>ay?ay:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Ge);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 oy(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(Ge),n=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)n+=+this.lines.get(o).resize(e,r);let s=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 oa(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new oa(e,r)));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(i<this.lines.maxLength){let o=this.lines.length-i;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=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),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 s=0;s<this.lines.length;s++)n+=+this.lines.get(s).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.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 r=this._optionsService.rawOptions.reflowCursorLine,n=k4(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Ge),r);if(n.length>0){let i=N4(this.lines,n);E4(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(Ge),i=r;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new oa(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(Ge),i=[],s=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let u=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),u.unshift(l);if(!r){let g=this.ybase+this.y;if(g>=o&&g<o+u.length)continue}let c=u[u.length-1].getTrimmedLength(),h=j4(u,this._cols,e),d=h.length-u.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+d):f=Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let g=0;g<d;g++){let _=this.getBlankLine(Ge,!0);p.push(_)}p.length>0&&(i.push({start:o+u.length+s,newLines:p}),s+=p.length),u.push(...p);let m=h.length-1,x=h[m];x===0&&(m--,x=h[m]);let C=u.length-d-1,y=c;for(;C>=0;){let g=Math.min(y,x);if(u[m]===void 0)break;if(u[m].copyCellsFrom(u[C],y-g,x-g,g,!0),x-=g,x===0&&(m--,x=h[m]),y-=g,y===0){C--;let _=Math.max(C,0);y=Va(u,_,this._cols)}}for(let g=0;g<u.length;g++)h[g]<e&&u[g].setCell(h[g],n);let v=d-f;for(;v-- >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+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let o=[],l=[];for(let x=0;x<this.lines.length;x++)l.push(this.lines.get(x));let u=this.lines.length,c=u-1,h=0,d=i[h];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let f=0;for(let x=Math.min(this.lines.maxLength-1,u+s-1);x>=0;x--)if(d&&d.start>c+f){for(let C=d.newLines.length-1;C>=0;C--)this.lines.set(x--,d.newLines[C]);x++,o.push({index:c+1,amount:d.newLines.length}),f+=d.newLines.length,d=i[++h]}else this.lines.set(x,l[c--]);let p=0;for(let x=o.length-1;x>=0;x--)o[x].index+=p,this.lines.onInsertEmitter.fire(o[x]),p+=o[x].amount;let m=Math.max(0,u+s-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,r=0,n){let i=this.lines.get(e);return i?i.translateToString(t,r,n):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}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 P4(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},R4=class extends pe{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Y),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 ly(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new ly(!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)}},Kb=2,qb=1,Vf=class extends pe{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Y),this.onResize=this._onResize.event,this._onScroll=this._register(new Y),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Kb),this.rows=Math.max(e.rawOptions.rows||0,qb),this.buffers=this._register(new R4(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=r.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let i=r.ybase+r.scrollTop,s=r.ybase+r.scrollBottom;if(r.scrollTop===0){let o=r.lines.isFull;s===r.lines.length-1?o?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(s+1,0,n.clone()),o?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let o=s-i+1;r.lines.shiftElements(i+1,o-1,-1),r.lines.set(s,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};Vf=Ke([Z(0,zt)],Vf);var Cs={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:su,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},M4=["normal","bold","100","200","300","400","500","600","700","800","900"],T4=class extends pe{constructor(e){super(),this._onOptionChange=this._register(new Y),this.onOptionChange=this._onOptionChange.event;let t={...Cs};for(let r in e)if(r in t)try{let n=e[r];t[r]=this._sanitizeAndValidateOption(r,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ae(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in Cs))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in Cs))throw new Error(`No option with key "${r}"`);n=this._sanitizeAndValidateOption(r,n),this.rawOptions[r]!==n&&(this.rawOptions[r]=n,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let n={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Cs[e]),!D4(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Cs[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=M4.includes(t)?t:Cs[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 D4(e){return e==="block"||e==="underline"||e==="bar"}function aa(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let n in e)r[n]=t<=1?e[n]:e[n]&&aa(e[n],t-1);return r}var cy=Object.freeze({insertMode:!1}),uy=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Qf=class extends pe{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Y),this.onData=this._onData.event,this._onUserInput=this._register(new Y),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Y),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Y),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=aa(cy),this.decPrivateModes=aa(uy)}reset(){this.modes=aa(cy),this.decPrivateModes=aa(uy)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.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))}};Qf=Ke([Z(0,Bt),Z(1,db),Z(2,zt)],Qf);var hy={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 Rh(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var Mh=String.fromCharCode,dy={DEFAULT:e=>{let t=[Rh(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Mh(t[0])}${Mh(t[1])}${Mh(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Rh(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Rh(e,!0)};${e.x};${e.y}${t}`}},Yf=class extends pe{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Y),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(hy))this.addProtocol(n,hy[n]);for(let n of Object.keys(dy))this.addEncoding(n,dy[n]);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,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let n=t/r,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=n+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_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,r){if(r){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)}};Yf=Ke([Z(0,Bt),Z(1,ys),Z(2,zt)],Yf);var Th=[[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]],L4=[[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]],tt;function A4(e,t){let r=0,n=t.length-1,i;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(i=r+n>>1,e>t[i][1])r=i+1;else if(e<t[i][0])n=i-1;else return!0;return!1}var O4=class{constructor(){if(this.version="6",!tt){tt=new Uint8Array(65536),tt.fill(1),tt[0]=0,tt.fill(0,1,32),tt.fill(0,127,160),tt.fill(2,4352,4448),tt[9001]=2,tt[9002]=2,tt.fill(2,11904,42192),tt[12351]=1,tt.fill(2,44032,55204),tt.fill(2,63744,64256),tt.fill(2,65040,65050),tt.fill(2,65072,65136),tt.fill(2,65280,65377),tt.fill(2,65504,65511);for(let e=0;e<Th.length;++e)tt.fill(0,Th[e][0],Th[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?tt[e]:A4(e,L4)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let i=$i.extractWidth(t);i===0?n=!1:i>r&&(r=i)}return $i.createPropertyValue(0,r,n)}},$i=class Sc{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Y,this.onChange=this._onChange.event;let t=new O4;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,r,n=!1){return(t&16777215)<<3|(r&3)<<1|(n?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 r=0,n=0,i=t.length;for(let s=0;s<i;++s){let o=t.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=i)return r+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:r+=this.wcwidth(c)}let l=this.charProperties(o,n),u=Sc.extractWidth(l);Sc.extractShouldJoin(l)&&(u-=Sc.extractWidth(n)),r+=u,n=l}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},I4=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 fy(e){var n;let t=(n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:n.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var Vo=2147483647,F4=256,Vb=class Gf{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>F4)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new Gf;if(!t.length)return r;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let i=t[n];if(Array.isArray(i))for(let s=0;s<i.length;++s)r.addSubParam(i[s]);else r.addParam(i)}return r}clone(){let t=new Gf(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 r=0;r<this.length;++r){t.push(this.params[r]);let n=this._subParamsIdx[r]>>8,i=this._subParamsIdx[r]&255;i-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,i))}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>Vo?Vo: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>Vo?Vo:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-r>0?this._subParams.subarray(r,n):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let n=this._subParamsIdx[r]>>8,i=this._subParamsIdx[r]&255;i-n>0&&(t[r]=this._subParams.slice(n,i))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,i=n[r-1];n[r-1]=~i?Math.min(i*10+t,Vo):t}},Qo=[],B4=class{constructor(){this._state=0,this._active=Qo,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 r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,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=Qo}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=Qo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Qo,!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,r){if(!this._active.length)this._handlerFb(this._id,"PUT",Tu(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&r-t>0&&this._put(e,t,r)}}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 r=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&r===!1){for(;n>=0&&(r=this._active[n].end(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=Qo,this._id=-1,this._state=0}}},ir=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,r,n){this._hitLimit||(this._data+=Tu(t,r,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let r=!1;if(this._hitLimit)r=!1;else if(t&&(r=this._handler(this._data),r instanceof Promise))return r.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,r}},Yo=[],z4=class{constructor(){this._handlers=Object.create(null),this._active=Yo,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Yo}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,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=Yo,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Yo,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",Tu(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&r===!1){for(;n>=0&&(r=this._active[n].unhook(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=Yo,this._ident=0}},la=new Vb;la.addParam(0);var py=class{constructor(e){this._handler=e,this._data="",this._params=la,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():la,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Tu(e,t,r),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(r=>(this._params=la,this._data="",this._hitLimit=!1,r));return this._params=la,this._data="",this._hitLimit=!1,t}},$4=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,n){this.table[t<<8|e]=r<<4|n}addMany(e,t,r,n){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=r<<4|n}},xr=160,H4=function(){let e=new $4(4095),t=Array.apply(null,Array(256)).map((l,u)=>u),r=(l,u)=>t.slice(l,u),n=r(32,127),i=r(0,24);i.push(25),i.push.apply(i,r(28,32));let s=r(0,14),o;e.setDefault(1,0),e.addMany(n,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(r(128,144),o,3,0),e.addMany(r(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(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(xr,0,2,0),e.add(xr,8,5,8),e.add(xr,6,0,6),e.add(xr,11,0,11),e.add(xr,13,13,13),e}(),W4=class extends pe{constructor(e=H4){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 Vb,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},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(Ae(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new B4),this._dcsParser=this._register(new z4),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>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 i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=n,r}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 r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let n=this._escHandlers[r];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,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 r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let n=this._csiHandlers[r];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,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,r,n,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=i}parse(e,t,r){let n=0,i=0,s=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,u=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&u>-1){for(;u>=0&&(o=l[u](this._params),o!==!0);u--)if(o instanceof Promise)return this._parseStack.handlerPos=u,o}this._parseStack.handlers=[];break;case 4:if(r===!1&&u>-1){for(;u>=0&&(o=l[u](),o!==!0);u--)if(o instanceof Promise)return this._parseStack.handlerPos=u,o}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(n!==24&&n!==26,r),o)return o;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],o=this._oscParser.end(n!==24&&n!==26,r),o)return o;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=s;l<t;++l){switch(n=e[l],i=this._transitions.table[this.currentState<<8|(n<160?n:xr)],i>>4){case 2:for(let f=l+1;;++f){if(f>=t||(n=e[f])<32||n>126&&n<xr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<xr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<xr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<xr){this._printHandler(e,l,f),l=f-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let u=this._csiHandlers[this._collect<<8|n],c=u?u.length-1:-1;for(;c>=0&&(o=u[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,u,c,i,l),o;c<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++l<t&&(n=e[l])>47&&n<60);l--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let h=this._escHandlers[this._collect<<8|n],d=h?h.length-1:-1;for(;d>=0&&(o=h[d](),o!==!0);d--)if(o instanceof Promise)return this._preserveStack(4,h,d,i,l),o;d<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let f=l+1;;++f)if(f>=t||(n=e[f])===24||n===26||n===27||n>127&&n<xr){this._dcsParser.put(e,l,f),l=f-1;break}break;case 14:if(o=this._dcsParser.unhook(n!==24&&n!==26),o)return this._preserveStack(6,[],0,i,l),o;n===27&&(i|=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 f=l+1;;f++)if(f>=t||(n=e[f])<32||n>127&&n<xr){this._oscParser.put(e,l,f),l=f-1;break}break;case 6:if(o=this._oscParser.end(n!==24&&n!==26),o)return this._preserveStack(5,[],0,i,l),o;n===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},U4=/^([\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})$/,K4=/^[\da-f]+$/;function my(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=U4.exec(t);if(r){let n=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/n*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/n*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/n*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),K4.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,n=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(r*i,r*i+r),16);n[i]=r===1?s<<4:r===2?s:r===3?s>>4:s>>8}return n}}function Dh(e,t){let r=e.toString(16),n=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function q4(e,t=16){let[r,n,i]=e;return`rgb:${Dh(r,t)}/${Dh(n,t)}/${Dh(i,t)}`}var V4={"(":0,")":1,"*":2,"+":3,"-":1,".":2},$n=131072,gy=10;function yy(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 vy=5e3,xy=0,Q4=class extends pe{constructor(e,t,r,n,i,s,o,l,u=new W4){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=l,this._parser=u,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new fE,this._utf8Decoder=new pE,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Ge.clone(),this._eraseAttrDataInternal=Ge.clone(),this._onRequestBell=this._register(new Y),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Y),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Y),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Y),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Y),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Y),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Y),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Y),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Y),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Y),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Y),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Y),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Y),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 Xf(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,h)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:h.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,h,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:h,data:d})}),this._parser.setDcsHandlerFallback((c,h,d)=>{h==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:h,payload:d})}),this._parser.setPrintHandler((c,h,d)=>this.print(c,h,d)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(U.BEL,()=>this.bell()),this._parser.setExecuteHandler(U.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(U.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(U.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(U.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(U.BS,()=>this.backspace()),this._parser.setExecuteHandler(U.HT,()=>this.tab()),this._parser.setExecuteHandler(U.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(U.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(wc.IND,()=>this.index()),this._parser.setExecuteHandler(wc.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(wc.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ir(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new ir(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new ir(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new ir(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new ir(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new ir(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new ir(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new ir(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new ir(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new ir(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new ir(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new ir(c=>this.restoreCursorColor(c))),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 c in ot)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new py((c,h)=>this.requestStatusString(c,h)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),vy))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${vy} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,i=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>$n&&(s=this._parseStack.position+$n)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<$n&&(this._parseBuffer=new Uint32Array(Math.min(e.length,$n))),o||this._dirtyRowTracker.clearRange(),e.length>$n)for(let c=s;c<e.length;c+=$n){let h=c+$n<e.length?c+$n:e.length,d=typeof e=="string"?this._stringDecoder.decode(e.substring(c,h),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,h),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,d))return this._preserveStack(n,i,d,c),this._logSlowResolvingAsync(r),r}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,c))return this._preserveStack(n,i,c,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==n||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),u=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);u<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(u,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,r){let n,i,s=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,u=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,h=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let f=this._parser.precedingJoinState;for(let p=t;p<r;++p){if(n=e[p],n<127&&s){let y=s[String.fromCharCode(n)];y&&(n=y.charCodeAt(0))}let m=this._unicodeService.charProperties(n,f);i=$i.extractWidth(m);let x=$i.extractShouldJoin(m),C=x?$i.extractWidth(f):0;if(f=m,o&&this._onA11yChar.fire(Vn(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-C>l){if(u){let y=d,v=this._activeBuffer.x-C;for(this._activeBuffer.x=C,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&d instanceof oa&&d.copyCellsFrom(y,v,0,C,!1);v<l;)y.setCellFromCodepoint(v++,0,1,h)}else if(this._activeBuffer.x=l-1,i===2)continue}if(x&&this._activeBuffer.x){let y=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-y,n,i);for(let v=i-C;--v>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(d.insertCells(this._activeBuffer.x,i-C,this._activeBuffer.getNullCell(h)),d.getWidth(l-1)===2&&d.setCellFromCodepoint(l-1,0,1,h)),d.setCellFromCodepoint(this._activeBuffer.x++,n,i,h),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&r-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>yy(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new py(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ir(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,r,n=!1,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),i),n&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var n;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&n.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,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 r=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(r,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 r=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(r,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}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(Ge));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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 r=e.params[0]||1,n=$i.extractWidth(t),i=this._activeBuffer.x-n,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*r),l=0;for(let c=0;c<s.length;){let h=s.codePointAt(c)||0;o[l++]=h,c+=h>65535?2:1}let u=l;for(let c=1;c<r;++c)o.copyWithin(u,0,l),u+=l;return this.print(o,0,u),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(U.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(U.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(U.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(U.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(U.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,Ai),this._charsetService.setgCharset(1,Ai),this._charsetService.setgCharset(2,Ai),this._charsetService.setgCharset(3,Ai);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){(x=>(x[x.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",x[x.SET=1]="SET",x[x.RESET=2]="RESET",x[x.PERMANENTLY_SET=3]="PERMANENTLY_SET",x[x.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let n=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:s}=this._coreMouseService,o=this._coreService,{buffers:l,cols:u}=this._bufferService,{active:c,alt:h}=l,d=this._optionsService.rawOptions,f=(x,C)=>(o.triggerDataEvent(`${U.ESC}[${t?"":"?"}${x};${C}$y`),!0),p=x=>x?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(n.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?u===80?2:u===132?1:0:0):m===6?f(m,p(n.origin)):m===7?f(m,p(n.wraparound)):m===8?f(m,3):m===9?f(m,p(i==="X10")):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(n.reverseWraparound)):m===66?f(m,p(n.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i==="VT200")):m===1002?f(m,p(i==="DRAG")):m===1003?f(m,p(i==="ANY")):m===1004?f(m,p(n.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(s==="SGR")):m===1015?f(m,4):m===1016?f(m,p(s==="SGR_PIXELS")):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(c===h)):m===2004?f(m,p(n.bracketedPasteMode)):m===2026?f(m,p(n.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,r,n,i){return t===2?(e|=50331648,e&=-16777216,e|=ul.fromColorRGB([r,n,i])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let n=[0,0,-1,0,0,0],i=0,s=0;do{if(n[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),l=0;do n[1]===5&&(i=1),n[s+l+1+i]=o[l];while(++l<o.length&&l+s+1+i<n.length);break}if(n[1]===5&&s+i>=2||n[1]===2&&s+i>=5)break;n[1]&&(i=1)}while(++s+t<e.length&&s+i<n.length);for(let o=2;o<n.length;++o)n[o]===-1&&(n[o]=0);switch(n[0]){case 38:r.fg=this._updateAttrColor(r.fg,n[1],n[3],n[4],n[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,n[1],n[3],n[4],n[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,n[1],n[3],n[4],n[5])}return s}_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=Ge.fg,e.bg=Ge.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,r,n=this._curAttrData;for(let i=0;i<t;i++)r=e.params[i],r>=30&&r<=37?(n.fg&=-50331904,n.fg|=16777216|r-30):r>=40&&r<=47?(n.bg&=-50331904,n.bg|=16777216|r-40):r>=90&&r<=97?(n.fg&=-50331904,n.fg|=16777216|r-90|8):r>=100&&r<=107?(n.bg&=-50331904,n.bg|=16777216|r-100|8):r===0?this._processSGR0(n):r===1?n.fg|=134217728:r===3?n.bg|=67108864:r===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,n)):r===5?n.fg|=536870912:r===7?n.fg|=67108864:r===8?n.fg|=1073741824:r===9?n.fg|=2147483648:r===2?n.bg|=134217728:r===21?this._processUnderline(2,n):r===22?(n.fg&=-134217729,n.bg&=-134217729):r===23?n.bg&=-67108865:r===24?(n.fg&=-268435457,this._processUnderline(0,n)):r===25?n.fg&=-536870913:r===27?n.fg&=-67108865:r===28?n.fg&=-1073741825:r===29?n.fg&=2147483647:r===39?(n.fg&=-67108864,n.fg|=Ge.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=Ge.bg&16777215):r===38||r===48||r===58?i+=this._extractColor(e,i,n):r===53?n.bg|=1073741824:r===55?n.bg&=-1073741825:r===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):r===100?(n.fg&=-67108864,n.fg|=Ge.fg&16777215,n.bg&=-67108864,n.bg|=Ge.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${U.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${U.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${U.ESC}[?${t};${r}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=Ge.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 r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!yy(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(`${U.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>gy&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>gy&&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=[],r=e.split(";");for(;r.length>1;){let n=r.shift(),i=r.shift();if(/^\d+$/.exec(n)){let s=parseInt(n);if(_y(s))if(i==="?")t.push({type:0,index:s});else{let o=my(i);o&&t.push({type:1,index:s,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(r,n):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,i=r.findIndex(s=>s.startsWith("id="));return i!==-1&&(n=r[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,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 r=e.split(";");for(let n=0;n<r.length&&!(t>=this._specialColors.length);++n,++t)if(r[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=my(r[n]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}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=[],r=e.split(";");for(let n=0;n<r.length;++n)if(/^\d+$/.exec(r[n])){let i=parseInt(r[n]);_y(i)&&t.push({type:2,index:i})}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,Ai),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(V4[e[0]],ot[e[1]]||Ai),!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=Ge.clone(),this._eraseAttrDataInternal=Ge.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 kr;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 r=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(r);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=o=>(this._coreService.triggerDataEvent(`${U.ESC}${o}${U.ESC}\\`),!0),n=this._bufferService.buffer,i=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Xf=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&&(xy=e,e=t,t=xy),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Xf=Ke([Z(0,Bt)],Xf);function _y(e){return 0<=e&&e<256}var Y4=5e7,wy=12,G4=50,X4=class extends pe{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 Y),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 r;for(;r=this._writeBuffer.shift();){this._action(r);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Y4)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 r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],i=this._action(n,t);if(i){let o=l=>performance.now()-r>=wy?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);i.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=wy)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>G4&&(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()}},Jf=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 l=t.addMarker(t.ybase+t.y),u={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._dataByLinkId.set(u.id,u),u.id}let r=e,n=this._getEntryIdKey(r),i=this._entriesWithId.get(n);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let s=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);r.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(r,n))}}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 r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Jf=Ke([Z(0,Bt)],Jf);var by=!1,J4=class extends pe{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Co),this._onBinary=this._register(new Y),this.onBinary=this._onBinary.event,this._onData=this._register(new Y),this.onData=this._onData.event,this._onLineFeed=this._register(new Y),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Y),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Y),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Y),this._instantiationService=new b4,this.optionsService=this._register(new T4(e)),this._instantiationService.setService(zt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Vf)),this._instantiationService.setService(Bt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(qf)),this._instantiationService.setService(db,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Qf)),this._instantiationService.setService(ys,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Yf)),this._instantiationService.setService(hb,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance($i)),this._instantiationService.setService(vE,this.unicodeService),this._charsetService=this._instantiationService.createInstance(I4),this._instantiationService.setService(yE,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Jf),this._instantiationService.setService(fb,this._oscLinkService),this._inputHandler=this._register(new Q4(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(yt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(yt.forward(this._bufferService.onResize,this._onResize)),this._register(yt.forward(this.coreService.onData,this._onData)),this._register(yt.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 X4((t,r)=>this._inputHandler.parse(t,r))),this._register(yt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Y),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&&!by&&(this._logService.warn("writeSync is unreliable and will be removed soon."),by=!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,Kb),t=Math.max(t,qb),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(fy.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(fy(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ae(()=>{for(let t of e)t.dispose()})}}},Z4={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 e3(e,t,r,n){var o;let i={type:0,cancel:!1,key:void 0},s=(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?i.key=U.ESC+"OA":i.key=U.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=U.ESC+"OD":i.key=U.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=U.ESC+"OC":i.key=U.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=U.ESC+"OB":i.key=U.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":U.DEL,e.altKey&&(i.key=U.ESC+i.key);break;case 9:if(e.shiftKey){i.key=U.ESC+"[Z";break}i.key=U.HT,i.cancel=!0;break;case 13:i.key=e.altKey?U.ESC+U.CR:U.CR,i.cancel=!0;break;case 27:i.key=U.ESC,e.altKey&&(i.key=U.ESC+U.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=U.ESC+"[1;"+(s+1)+"D":t?i.key=U.ESC+"OD":i.key=U.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=U.ESC+"[1;"+(s+1)+"C":t?i.key=U.ESC+"OC":i.key=U.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=U.ESC+"[1;"+(s+1)+"A":t?i.key=U.ESC+"OA":i.key=U.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=U.ESC+"[1;"+(s+1)+"B":t?i.key=U.ESC+"OB":i.key=U.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=U.ESC+"[2~");break;case 46:s?i.key=U.ESC+"[3;"+(s+1)+"~":i.key=U.ESC+"[3~";break;case 36:s?i.key=U.ESC+"[1;"+(s+1)+"H":t?i.key=U.ESC+"OH":i.key=U.ESC+"[H";break;case 35:s?i.key=U.ESC+"[1;"+(s+1)+"F":t?i.key=U.ESC+"OF":i.key=U.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=U.ESC+"[5;"+(s+1)+"~":i.key=U.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=U.ESC+"[6;"+(s+1)+"~":i.key=U.ESC+"[6~";break;case 112:s?i.key=U.ESC+"[1;"+(s+1)+"P":i.key=U.ESC+"OP";break;case 113:s?i.key=U.ESC+"[1;"+(s+1)+"Q":i.key=U.ESC+"OQ";break;case 114:s?i.key=U.ESC+"[1;"+(s+1)+"R":i.key=U.ESC+"OR";break;case 115:s?i.key=U.ESC+"[1;"+(s+1)+"S":i.key=U.ESC+"OS";break;case 116:s?i.key=U.ESC+"[15;"+(s+1)+"~":i.key=U.ESC+"[15~";break;case 117:s?i.key=U.ESC+"[17;"+(s+1)+"~":i.key=U.ESC+"[17~";break;case 118:s?i.key=U.ESC+"[18;"+(s+1)+"~":i.key=U.ESC+"[18~";break;case 119:s?i.key=U.ESC+"[19;"+(s+1)+"~":i.key=U.ESC+"[19~";break;case 120:s?i.key=U.ESC+"[20;"+(s+1)+"~":i.key=U.ESC+"[20~";break;case 121:s?i.key=U.ESC+"[21;"+(s+1)+"~":i.key=U.ESC+"[21~";break;case 122:s?i.key=U.ESC+"[23;"+(s+1)+"~":i.key=U.ESC+"[23~";break;case 123:s?i.key=U.ESC+"[24;"+(s+1)+"~":i.key=U.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=U.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=U.DEL:e.keyCode===219?i.key=U.ESC:e.keyCode===220?i.key=U.FS:e.keyCode===221&&(i.key=U.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let l=(o=Z4[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)i.key=U.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let u=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(u);e.shiftKey&&(c=c.toUpperCase()),i.key=U.ESC+c}else if(e.keyCode===32)i.key=U.ESC+(e.ctrlKey?U.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let u=e.code.slice(3,4);e.shiftKey||(u=u.toLowerCase()),i.key=U.ESC+u,i.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=U.US),e.key==="@"&&(i.key=U.NUL));break}return i}var qe=0,t3=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ou,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ou,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((i,s)=>this._getKey(i)-this._getKey(s)),t=0,r=0,n=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<n.length;i++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(n[i]=e[t],t++):n[i]=this._array[r++];this._array=n,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||(qe=this._search(t),qe===-1)||this._getKey(this._array[qe])!==t)return!1;do if(this._array[qe]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(qe),!0;while(++qe<this._array.length&&this._getKey(this._array[qe])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,r=new Array(this._array.length-e.length),n=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:r[n++]=this._array[i];this._array=r,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&&(qe=this._search(e),!(qe<0||qe>=this._array.length)&&this._getKey(this._array[qe])===e))do yield this._array[qe];while(++qe<this._array.length&&this._getKey(this._array[qe])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(qe=this._search(e),!(qe<0||qe>=this._array.length)&&this._getKey(this._array[qe])===e))do t(this._array[qe]);while(++qe<this._array.length&&this._getKey(this._array[qe])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let n=t+r>>1,i=this._getKey(this._array[n]);if(i>e)r=n-1;else if(i<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},Lh=0,Sy=0,r3=class extends pe{constructor(){super(),this._decorations=new t3(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new Y),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Y),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ae(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new n3(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.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,r){let n=0,i=0;for(let s of this._decorations.getKeyIterator(t))n=s.options.x??0,i=n+(s.options.width??1),e>=n&&e<i&&(!r||(s.options.layer??"bottom")===r)&&(yield s)}forEachDecorationAtCell(e,t,r,n){this._decorations.forEachByKey(t,i=>{Lh=i.options.x??0,Sy=Lh+(i.options.width??1),e>=Lh&&e<Sy&&(!r||(i.options.layer??"bottom")===r)&&n(i)})}},n3=class extends vi{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Y),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Y),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=Ie.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ie.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},i3=1e3,s3=class{constructor(e,t=i3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,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 n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=n-this._lastRefreshMs,s=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_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)}},Cy=20,au=class extends pe{constructor(e,t,r,n){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,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=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new s3(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(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
419
- `))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(se(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ae(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Cy+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
420
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Cy+1&&(this._liveRegion.textContent+=vf.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 r=this._terminal.buffer,n=r.lines.length.toString();for(let i=e;i<=t;i++){let s=r.lines.get(r.ydisp+i),o=[],l=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",u=(r.ydisp+i+1).toString(),c=this._rowElements[i];c&&(l.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=l,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",u),c.setAttribute("aria-setsize",n),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],i=r.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==n)return;let o,l;if(t===0?(o=r,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=r,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{let u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}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 l;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},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,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 n=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:n,offset:((l=n.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(r.node))return;let i=({node:u,offset:c})=>{let h=u instanceof Text?u.parentNode:u,d=parseInt(h==null?void 0:h.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(h);if(!f)return console.warn("columns is null. Race condition?"),null;let p=c<f.length?f[c]:f.slice(-1)[0]+1;return p>=this._terminal.cols&&(++d,p=0),{row:d,column:p}},s=i(t),o=i(r);if(!(!s||!o)){if(s.row>o.row||s.row===o.row&&s.column>=o.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(o.row-s.row)*this._terminal.cols-s.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 i,s;e.style.transform="";let t=e.getBoundingClientRect().width,r=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};au=Ke([Z(1,Cm),Z(2,Ln),Z(3,An)],au);var Zf=class extends pe{constructor(e,t,r,n,i){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=n,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Y),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Y),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ae(()=>{var s;cs(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(se(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(se(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(se(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(se(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 r=e.composedPath();for(let n=0;n<r.length;n++){let i=r[n];if(i.classList.contains("xterm"))break;if(i.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 n,i;(!this._activeProviderReplies||!t)&&((n=this._activeProviderReplies)==null||n.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(r=this._checkLinkProviderResult(s,e,r)):o.provideLinks(e.y,l=>{var c,h;if(this._isMouseOut)return;let u=l==null?void 0:l.map(d=>({link:d}));(c=this._activeProviderReplies)==null||c.set(s,u),r=this._checkLinkProviderResult(s,e,r),((h=this._activeProviderReplies)==null?void 0:h.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let n=0;n<t.size;n++){let i=t.get(n);if(i)for(let s=0;s<i.length;s++){let o=i[s],l=o.link.range.start.y<e?0:o.link.range.start.x,u=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=l;c<=u;c++){if(r.has(c)){i.splice(s--,1);break}r.add(c)}}}}_checkLinkProviderResult(e,t,r){var s;if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),i=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(i=!0);if(!i&&n){let o=n.find(l=>this._linkAtPosition(l.link,t));o&&(r=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(s=this._activeProviderReplies.get(o))==null?void 0:s.find(u=>this._linkAtPosition(u.link,t));if(l){r=!0,this._handleNewLink(l);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&o3(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,cs(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 r,n;return(n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.pointerCursor},set:r=>{var n;(n=this._currentLink)!=null&&n.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,n;return(n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline},set:r=>{var n,i,s;(n=this._currentLink)!=null&&n.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let n=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(n,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,r){var n;(n=this._currentLink)!=null&&n.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(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,n=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,r){var n;(n=this._currentLink)!=null&&n.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(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return r<=i&&i<=n}_positionFromMouseEvent(e,t,r){let n=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,n,i){return{x1:e,y1:t,x2:r,y2:n,cols:this._bufferService.cols,fg:i}}};Zf=Ke([Z(1,km),Z(2,An),Z(3,Bt),Z(4,mb)],Zf);function o3(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 a3=class extends J4{constructor(e={}){super(e),this._linkifier=this._register(new Co),this.browser=Lb,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Co),this._onCursorMove=this._register(new Y),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Y),this.onKey=this._onKey.event,this._onRender=this._register(new Y),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Y),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Y),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Y),this.onBell=this._onBell.event,this._onFocus=this._register(new Y),this._onBlur=this._register(new Y),this._onA11yCharEmitter=this._register(new Y),this._onA11yTabEmitter=this._register(new Y),this._onWillOpen=this._register(new Y),this._setup(),this._decorationService=this._instantiationService.createInstance(r3),this._instantiationService.setService(hl,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Gj),this._instantiationService.setService(mb,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_f)),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(yt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(yt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(yt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(yt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ae(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.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 r,n="";switch(t.index){case 256:r="foreground",n="10";break;case 257:r="background",n="11";break;case 258:r="cursor",n="12";break;default:r="ansi",n="4;"+t.index}switch(t.type){case 0:let i=Te.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${U.ESC}]${n};${q4(i)}${Tb.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=Xe.toColor(...t.color));else{let s=r;this._themeService.modifyColors(o=>o[s]=Xe.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(au,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(U.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(U.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 r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,i=t.getWidth(r),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=s+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(se(this.element,"copy",t=>{this.hasSelection()&&hE(t,this._selectionService)}));let e=t=>dE(t,this.textarea,this.coreService,this.optionsService);this._register(se(this.textarea,"paste",e)),this._register(se(this.element,"paste",e)),Ab?this._register(se(this.element,"mousedown",t=>{t.button===2&&L0(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(se(this.element,"contextmenu",t=>{L0(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Dm&&this._register(se(this.element,"auxclick",t=>{t.button===1&&ob(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(se(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(se(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(se(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(se(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(se(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(se(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(se(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;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"),((i=this.element)==null?void 0:i.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(se(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",yf.get()),Fb||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",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Qj,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Ln,this._coreBrowserService),this._register(se(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(se(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance($f,this._document,this._helperContainer),this._instantiationService.setService(Du,this._charSizeService),this._themeService=this._instantiationService.createInstance(Kf),this._instantiationService.setService(Po,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(iu),this._instantiationService.setService(pb,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Wf,this.rows,this.screenElement)),this._instantiationService.setService(An,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Ff,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Hf),this._instantiationService.setService(km,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(Zf,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(Of,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Uf,this.element,this.screenElement,n)),this._instantiationService.setService(_E,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(yt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(If,this.screenElement)),this._register(se(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),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(au,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(nu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(nu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(zf,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(s){var c,h,d,f,p;let o=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!o)return!1;let l,u;switch(s.overrideType||s.type){case"mousemove":u=32,s.buttons===void 0?(l=3,s.button!==void 0&&(l=s.button<3?s.button:3)):l=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":u=0,l=s.button<3?s.button:3;break;case"mousedown":u=1,l=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let m=s.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(s,(f=(d=(h=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:h.device)==null?void 0:d.cell)==null?void 0:f.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return!1;u=m<0?0:1,l=4;break;default:return!1}return u===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:u,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(r(s),s.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(s)),wheel:s=>(r(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&r(s)},mousemove:s=>{s.buttons||r(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),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()),s&8?n.mousemove||(t.addEventListener("mousemove",i.mousemove),n.mousemove=i.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),s&16?n.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),n.wheel=i.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),s&2?n.mouseup||(n.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),s&4?n.mousedrag||(n.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(se(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return r(s),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(s)})),this._register(se(t,"wheel",s=>{var o,l,u,c,h;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(c=(u=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:u.cell)==null?void 0:c.height,(h=e._coreBrowserService)==null?void 0:h.dpr)===0)return this.cancel(s,!0);let d=U.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.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){sb(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,r){this._selectionService.setSelection(e,t,r)}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 r;(r=this._selectionService)==null||r.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 r=e3(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let n=this.rows-1;return this.scrollLines(r.type===2?-n:n),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.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((r.key===U.ETX||r.key===U.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=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"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(l3(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 r;(r=this._charSizeService)==null||r.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(Ge));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(U.ESC+"[I"):this.coreService.triggerDataEvent(U.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${U.ESC}[4;${r};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${U.ESC}[6;${i};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function l3(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var c3=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;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)}},u3=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 kr)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},ky=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 u3(t)}getNullCell(){return new kr}},h3=class extends pe{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Y),this.onBufferChange=this._onBufferChange.event,this._normal=new ky(this._core.buffers.normal,"normal"),this._alternate=new ky(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)}},d3=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,n)=>t(r,n.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)}},f3=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}},p3=["cols","rows"],Ur=0,m3=class extends pe{constructor(e){super(),this._core=this._register(new a3(e)),this._addonManager=this._register(new c3),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],r=(n,i)=>{this._checkReadonlyOptions(n),this._core.options[n]=i};for(let n in this._core.options){let i={get:t.bind(this,n),set:r.bind(this,n)};Object.defineProperty(this._publicOptions,n,i)}}_checkReadonlyOptions(e){if(p3.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 d3(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new f3(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 h3(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,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}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
421
- `,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 yf.get()},set promptLabel(e){yf.set(e)},get tooMuchOutput(){return vf.get()},set tooMuchOutput(e){vf.set(e)}}}_verifyIntegers(...e){for(Ur of e)if(Ur===1/0||isNaN(Ur)||Ur%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ur of e)if(Ur&&(Ur===1/0||isNaN(Ur)||Ur%1!==0||Ur<0))throw new Error("This API only accepts positive integers")}};/**
422
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
423
- * @license MIT
424
- *
425
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
426
- * @license MIT
427
- *
428
- * Originally forked from (with the author's permission):
429
- * Fabrice Bellard's javascript vt100 for jslinux:
430
- * http://bellard.org/jslinux/
431
- * Copyright (c) 2011 Fabrice Bellard
432
- */var g3=2,y3=1,v3=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 d;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:((d=this._terminal.options.overviewRuler)==null?void 0:d.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),i=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),o={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},l=o.top+o.bottom,u=o.right+o.left,c=n-l,h=i-u-t;return{cols:Math.max(g3,Math.floor(h/e.css.cell.width)),rows:Math.max(y3,Math.floor(c/e.css.cell.height))}}};function Ny(e,t){let r;return(...n)=>{r&&clearTimeout(r),r=setTimeout(()=>e(...n),t)}}const Ey="panopticon.terminal.autoCopyOnSelect",Ah=navigator.platform.toLowerCase().includes("mac");function jy({sessionName:e,onDisconnect:t,autoCopyOnSelect:r}){const n=w.useRef(null),i=w.useRef(null),s=w.useRef(null),o=w.useRef(null),l=w.useRef(0),u=w.useRef(null),c=5,[h,d]=w.useState(!0),[f,p]=w.useState(()=>{if(r!==void 0)return r;const R=localStorage.getItem(Ey);return R===null?!0:R==="true"}),[m,x]=w.useState({visible:!1,x:0,y:0,canCopy:!1}),[C,y]=w.useState(!1),v=w.useRef(t);v.current=t,w.useEffect(()=>{try{localStorage.setItem(Ey,String(f))}catch(R){console.error("Failed to save auto-copy setting:",R)}},[f]);const g=R=>Math.min(1e3*Math.pow(2,R),3e4),_=w.useCallback(async()=>{const R=i.current;if(!R||!R.hasSelection())return;const D=R.getSelection();try{await navigator.clipboard.writeText(D)}catch(L){console.error("Failed to copy to clipboard:",L);const B=document.createElement("textarea");B.value=D,B.style.position="fixed",B.style.opacity="0",document.body.appendChild(B),B.select();try{document.execCommand("copy")}catch(O){console.error("Fallback copy failed:",O)}document.body.removeChild(B)}},[]),N=w.useCallback(async()=>{var D;if(i.current)try{const L=await navigator.clipboard.readText();((D=o.current)==null?void 0:D.readyState)===WebSocket.OPEN&&o.current.send(L)}catch(L){console.error("Failed to read from clipboard:",L)}},[]),S=w.useCallback(R=>{const D=i.current;if(!D)return;const L=Ah?R.metaKey:R.ctrlKey;L&&R.key.toLowerCase()==="c"&&D.hasSelection()&&(R.preventDefault(),_()),L&&R.key.toLowerCase()==="v"&&(R.preventDefault(),N())},[_,N]),j=w.useCallback(R=>{R.preventDefault();const D=i.current;D&&x({visible:!0,x:R.clientX,y:R.clientY,canCopy:D.hasSelection()})},[]),A=w.useCallback(()=>{x(R=>({...R,visible:!1}))},[]),$=w.useCallback(()=>{_(),A()},[_,A]),z=w.useCallback(()=>{N(),A()},[N,A]);w.useEffect(()=>{if(!m.visible)return;const R=()=>{A()};return document.addEventListener("click",R),()=>document.removeEventListener("click",R)},[m.visible,A]);const I=w.useCallback(()=>{if(!n.current||!e)return;u.current&&(clearTimeout(u.current),u.current=null);const R=n.current;if(R.clientWidth===0||R.clientHeight===0){console.warn("XTerminal: Container has no size, retrying in 100ms"),setTimeout(()=>I(),100);return}console.log("XTerminal: Creating terminal, container size:",R.clientWidth,"x",R.clientHeight);let D=i.current,L=s.current;if(!D){D=new m3({cursorBlink:!0,cursorStyle:"block",fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',cols:120,rows:30,scrollback:1e4,convertEol:!0,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"}}),L=new v3,D.loadAddon(L),D.open(n.current),L.fit(),i.current=D,s.current=L;let V=null;D.onSelectionChange(()=>{!f||!D||(V&&clearTimeout(V),V=setTimeout(()=>{if(D&&D.hasSelection()){const M=D.getSelection();M&&navigator.clipboard.writeText(M).catch(b=>{console.error("Auto-copy failed:",b)})}},300))}),n.current.addEventListener("keydown",S),n.current.addEventListener("contextmenu",j)}const E=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.hostname}:3011/ws/terminal?session=${encodeURIComponent(e)}`,F=new WebSocket(E);o.current=F,F.onopen=()=>{console.log("XTerminal: WebSocket opened"),l.current=0,D.clear(),setTimeout(()=>{F.readyState===WebSocket.OPEN&&(L==null||L.fit(),console.log("XTerminal: After fit, size:",D.cols,"x",D.rows),F.send(JSON.stringify({type:"resize",cols:D.cols,rows:D.rows})))},100)},F.onmessage=V=>{const M=b=>{D.write(b),D.scrollToBottom()};typeof V.data=="string"?M(V.data):V.data instanceof ArrayBuffer?M(new Uint8Array(V.data)):V.data instanceof Blob&&V.data.text().then(b=>M(b))},F.onclose=V=>{var M,b;if(console.log("XTerminal: WebSocket closed",V.code,V.reason),!h||V.code===1e3){D.writeln(`\r
433
- \x1B[33m● Session disconnected\x1B[0m`),(M=v.current)==null||M.call(v);return}if(l.current<c){const H=g(l.current);l.current+=1,D.writeln(`\r
434
- \x1B[33m● Connection lost. Reconnecting in ${H/1e3}s (attempt ${l.current}/${c})...\x1B[0m`),u.current=setTimeout(()=>{I()},H)}else D.writeln(`\r
435
- \x1B[31m● Connection lost after multiple attempts.\x1B[0m`),(b=v.current)==null||b.call(v)},F.onerror=V=>{console.error("WebSocket error:",V)},D.onData(V=>{F.readyState===WebSocket.OPEN&&F.send(V)}),D.onResize(({cols:V,rows:M})=>{F.readyState===WebSocket.OPEN&&F.send(JSON.stringify({type:"resize",cols:V,rows:M}))});const k=Ny(()=>{F.readyState===WebSocket.OPEN&&(L==null||L.fit())},200);return window.addEventListener("resize",k),()=>{window.removeEventListener("resize",k),d(!1),u.current&&clearTimeout(u.current),F.close(),D==null||D.dispose(),i.current=null,s.current=null}},[e,h,f,S,j]);w.useEffect(()=>{let R=!1,D;const L=setTimeout(()=>{R||(D=I())},50);return()=>{R=!0,clearTimeout(L),D==null||D()}},[I]),w.useEffect(()=>{const R=Ny(()=>{var L,B;((L=o.current)==null?void 0:L.readyState)===WebSocket.OPEN&&((B=s.current)==null||B.fit())},200),D=new ResizeObserver(R);return n.current&&D.observe(n.current),()=>{D.disconnect()}},[]);const P=()=>{var R;(R=i.current)==null||R.focus()};return a.jsxs("div",{className:"relative w-full h-full",children:[a.jsx("div",{className:"absolute top-2 right-2 z-10 flex gap-2",children:a.jsx("button",{onClick:()=>y(!C),className:"p-1.5 rounded bg-slate-700/80 hover:bg-slate-600/80 text-slate-300 transition-colors",title:"Terminal settings",children:a.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[a.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"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})}),C&&a.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:[a.jsx("h3",{className:"text-sm font-semibold text-slate-200 mb-3",children:"Terminal Settings"}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:f,onChange:R=>p(R.target.checked),className:"w-4 h-4 rounded border-slate-600 bg-slate-700 text-blue-500 focus:ring-blue-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Auto-copy on selection"})]}),a.jsx("p",{className:"text-xs text-slate-500 mt-2",children:"Automatically copy selected text to clipboard"})]}),a.jsx("div",{ref:n,className:"absolute inset-0",onClick:P,tabIndex:0,style:{padding:"8px",backgroundColor:"#1a1a2e",overflow:"hidden",outline:"none"}}),m.visible&&a.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:R=>R.stopPropagation(),children:[m.canCopy&&a.jsxs("button",{onClick:$,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:[a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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",a.jsx("span",{className:"ml-auto text-xs text-slate-500",children:Ah?"⌘C":"Ctrl+C"})]}),a.jsxs("button",{onClick:z,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:[a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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",a.jsx("span",{className:"ml-auto text-xs text-slate-500",children:Ah?"⌘V":"Ctrl+V"})]})]})]})}const x3=()=>{const e=localStorage.getItem("panopticon.planning.startDocker");return e!==null?e==="true":!0};function _3({issue:e,isOpen:t,onClose:r,onComplete:n}){var O;const[i,s]=w.useState("checking"),[o,l]=w.useState(null),[u,c]=w.useState(null),[h,d]=w.useState(!1),[f,p]=w.useState({x:-1,y:-1}),[m,x]=w.useState({width:900,height:600}),[C,y]=w.useState(x3),v=w.useRef(!1),g=Ft(),_=ue({mutationFn:async()=>{const E=await fetch(`/api/issues/${e.identifier}/start-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({startDocker:C})});if(!E.ok){const F=await E.json();throw new Error(F.error||"Failed to start planning")}return E.json()},onSuccess:E=>{l(E),E.planningAgent.started?(v.current=!0,s("planning")):E.planningAgent.error&&(c(E.planningAgent.error),s("error"))},onError:E=>{c(E.message),s("error")}}),N=ae({queryKey:["planningStatus",e.identifier],queryFn:async()=>{const E=await fetch(`/api/planning/${e.identifier}/status`);if(!E.ok)throw new Error("Failed to get status");return E.json()},enabled:i==="planning",refetchInterval:i==="planning"?2e3:!1}),S=ue({mutationFn:async()=>{const E=await fetch(`/api/planning/${e.identifier}`,{method:"DELETE"});if(!E.ok)throw new Error("Failed to stop planning");const F=await E.json();return(await fetch(`/api/issues/${e.identifier}/complete-planning`,{method:"POST"})).ok||console.warn("Failed to mark planning complete, continuing anyway"),F},onSuccess:()=>{g.invalidateQueries({queryKey:["issues"]}),s("complete")},onError:E=>{console.error("Stop planning failed:",E),c(E.message),s("error")}}),j=ue({mutationFn:async()=>{const E=await fetch(`/api/issues/${e.identifier}/abort-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:!1})});if(!E.ok){const F=await E.json();throw new Error(F.error||"Failed to abort planning")}return E.json()},onSuccess:()=>{n(),r()},onError:E=>{c(E.message)}}),A=ue({mutationFn:async()=>{const E=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier})});if(!E.ok){const F=await E.json();throw new Error(F.error||"Failed to start agent")}return E.json()},onSuccess:()=>{g.invalidateQueries({queryKey:["agents"]}),g.invalidateQueries({queryKey:["issues"]}),n(),r()},onError:E=>{c(`Failed to start agent: ${E.message}`)}}),$=w.useRef(null);w.useEffect(()=>{const E=$.current!==null&&$.current!==e.identifier;$.current=e.identifier,t?E?(s("checking"),l(null),c(null),d(!1),v.current=!1,g.invalidateQueries({queryKey:["planningStatus",e.identifier]})):(g.invalidateQueries({queryKey:["planningStatus",e.identifier]}),v.current=!1):(s("checking"),l(null),c(null),d(!1),v.current=!1)},[t,e.identifier,g]),w.useEffect(()=>{t&&i==="checking"&&fetch(`/api/planning/${e.identifier}/status`).then(E=>E.json()).then(E=>{E.active?(v.current=!0,s("planning")):E.planningCompleted?s("complete"):s("ready")}).catch(()=>{s("ready")})},[t,e.identifier,i]),w.useEffect(()=>{i==="planning"&&N.data&&!N.data.active&&v.current&&s("complete")},[i,N.data]);const z=()=>{s("starting"),_.mutate()},I=()=>{S.mutate()},P=()=>{confirm(`Abort planning and return to Todo?
436
-
437
- This will:
438
- • Stop the planning agent
439
- • Move the issue back to "Todo"
440
- • Keep the workspace (can be deleted separately)
441
-
442
- Any planning artifacts in the workspace will be preserved.`)&&j.mutate()},R=()=>{A.mutate()};if(!t)return null;const D=f.x===-1?(window.innerWidth-m.width)/2:f.x,L=f.y===-1?(window.innerHeight-m.height)/2:f.y,B=()=>{var F,k;const E=((F=o==null?void 0:o.workspace)==null?void 0:F.path)||((k=N.data)==null?void 0:k.workspacePath);return E?`${E}/docs/${e.identifier}-plan.md`:null};return h?a.jsxs("div",{className:"fixed bottom-4 right-4 z-50 bg-gray-800 rounded-lg shadow-2xl border border-gray-700 px-4 py-2 flex items-center gap-3 cursor-pointer hover:bg-gray-700 transition-colors",onClick:()=>d(!1),children:[a.jsx("div",{className:"w-6 h-6 rounded bg-gradient-to-br from-purple-500 to-blue-500 flex items-center justify-center",children:a.jsx(mf,{className:"w-3 h-3 text-white"})}),a.jsxs("span",{className:"text-sm text-white font-medium",children:["Plan: ",e.identifier]}),i==="planning"&&a.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-pulse"})]}):a.jsxs("div",{className:"fixed inset-0 z-50",children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:()=>d(!0)}),a.jsx(oE,{position:{x:D,y:L},size:m,onDragStop:(E,F)=>p({x:F.x,y:F.y}),onResizeStop:(E,F,k,V,M)=>{x({width:k.offsetWidth,height:k.offsetHeight}),p({x:M.x,y:M.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:a.jsxs("div",{className:"w-full h-full bg-gray-800 rounded-xl shadow-2xl border border-gray-700 overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"drag-handle flex items-center justify-between px-6 py-4 border-b border-gray-700 cursor-move",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.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:a.jsx(mf,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsxs("h2",{className:"text-lg font-semibold text-white",children:["Plan: ",e.identifier]}),a.jsx("p",{className:"text-sm text-gray-400 line-clamp-1",children:e.title})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[i==="planning"&&a.jsxs(a.Fragment,{children:[a.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:[a.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-pulse"}),"Planning Active"]}),a.jsxs("button",{onClick:I,disabled:S.isPending,className:"flex items-center gap-1 px-3 py-1.5 bg-red-600 hover:bg-red-500 text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50",title:"Stop the planning agent",children:[a.jsx(Wa,{className:"w-4 h-4"}),"Stop"]})]}),a.jsx("button",{onClick:()=>d(!0),className:"p-2 text-gray-400 hover:text-white hover:bg-gray-700 rounded-lg transition-colors",title:"Hide (planning continues in background)",children:a.jsx(Nt,{className:"w-5 h-5"})})]})]}),a.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[i==="checking"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[a.jsx(ye,{className:"w-12 h-12 text-purple-400 animate-spin mb-4"}),a.jsx("p",{className:"text-gray-300",children:"Checking session status..."})]}),i==="ready"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[a.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:a.jsx(bi,{className:"w-10 h-10 text-purple-400"})}),["In Planning","Planning","Planned","Discovery"].includes(e.status)?a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"Resume Planning Session"}),a.jsxs("p",{className:"text-gray-400 text-center max-w-md mb-6",children:["This issue is in ",a.jsx("span",{className:"text-purple-400 font-medium",children:'"In Planning"'})," state. You can resume planning or abort to return to Todo."]}),a.jsxs("div",{className:"bg-gray-700/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-300 mb-2",children:"Options:"}),a.jsxs("ul",{className:"space-y-2 text-sm text-gray-400",children:[a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Lt,{className:"w-4 h-4 text-purple-400"}),a.jsxs("span",{children:[a.jsx("strong",{className:"text-purple-400",children:"Resume"})," - Start a new planning agent session"]})]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Nt,{className:"w-4 h-4 text-orange-400"}),a.jsxs("span",{children:[a.jsx("strong",{className:"text-orange-400",children:"Abort"})," - Return issue to Todo (keeps workspace)"]})]})]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{onClick:P,disabled:j.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:[a.jsx(Nt,{className:"w-5 h-5"}),j.isPending?"Aborting...":"Abort Planning"]}),a.jsxs("button",{onClick:z,className:"flex items-center gap-2 px-6 py-3 bg-purple-600 hover:bg-purple-500 text-white rounded-lg transition-colors font-medium",children:[a.jsx(Lt,{className:"w-5 h-5"}),"Resume Planning"]})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"Start Planning Session"}),a.jsxs("p",{className:"text-gray-400 text-center max-w-md mb-6",children:["This will move the issue to ",a.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."]}),a.jsxs("div",{className:"bg-gray-700/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-300 mb-2",children:"What happens:"}),a.jsxs("ul",{className:"space-y-2 text-sm text-gray-400",children:[a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Ps,{className:"w-4 h-4 text-green-400"}),'Issue moves to "In Planning" in Linear']}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Ps,{className:"w-4 h-4 text-green-400"}),"Git worktree created for feature branch"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Ps,{className:"w-4 h-4 text-green-400"}),"Opus agent starts discovery conversation"]})]})]}),a.jsxs("label",{className:"flex items-center gap-3 mb-6 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:C,onChange:E=>{y(E.target.checked),localStorage.setItem("panopticon.planning.startDocker",String(E.target.checked))},className:"w-4 h-4 rounded border-gray-500 bg-gray-700 text-purple-500 focus:ring-purple-500 focus:ring-offset-gray-800"}),a.jsxs("span",{className:"text-sm text-gray-300",children:["Start Docker containers",a.jsx("span",{className:"text-gray-500 ml-1",children:"(dev environment ready for testing)"})]})]}),a.jsxs("button",{onClick:z,className:"flex items-center gap-2 px-6 py-3 bg-purple-600 hover:bg-purple-500 text-white rounded-lg transition-colors font-medium",children:[a.jsx(Lt,{className:"w-5 h-5"}),"Start Planning"]})]})]}),i==="starting"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[a.jsx(ye,{className:"w-12 h-12 text-purple-400 animate-spin mb-4"}),a.jsx("p",{className:"text-gray-300",children:"Starting planning session..."}),a.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Moving to In Planning, creating workspace, spawning agent"})]}),i==="planning"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex-1 bg-black relative overflow-hidden",style:{minHeight:"400px"},children:o!=null&&o.planningAgent.sessionName?a.jsx(jy,{sessionName:o.planningAgent.sessionName,onDisconnect:()=>{N.refetch().then(({data:E})=>{E!=null&&E.active||s("complete")})}}):(O=N.data)!=null&&O.sessionName?a.jsx(jy,{sessionName:N.data.sessionName,onDisconnect:()=>{N.refetch().then(({data:E})=>{E!=null&&E.active||s("complete")})}}):a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"flex items-center gap-2 text-gray-500",children:[a.jsx(ye,{className:"w-4 h-4 animate-spin"}),"Connecting to terminal..."]})})}),a.jsxs("div",{className:"border-t border-gray-700 px-4 py-2 flex items-center justify-between bg-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[a.jsx(bi,{className:"w-4 h-4"}),"Interactive planning session"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:P,disabled:j.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:[a.jsx(Nt,{className:"w-4 h-4"}),"Abort"]}),a.jsxs("button",{onClick:()=>{S.mutate(),N.refetch()},disabled:S.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:[a.jsx(Ps,{className:"w-4 h-4"}),"Done"]})]})]})]}),i==="complete"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-green-500/20 flex items-center justify-center mb-4",children:a.jsx(Ps,{className:"w-10 h-10 text-green-400"})}),a.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"Planning Complete"}),a.jsx("p",{className:"text-gray-400 text-center max-w-md mb-6",children:"The planning session has ended. Review the plan and start the execution agent."}),B()&&a.jsx("div",{className:"bg-purple-500/10 border border-purple-500/30 rounded-lg p-4 mb-6 max-w-md w-full",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(gc,{className:"w-8 h-8 text-purple-400"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-sm text-gray-300 font-medium",children:"Feature Plan"}),a.jsx("p",{className:"text-xs text-gray-500 font-mono truncate",children:B()})]}),a.jsxs("a",{href:`vscode://file${B()}`,className:"flex items-center gap-1 px-3 py-1.5 bg-purple-600 hover:bg-purple-500 text-white text-sm rounded-lg transition-colors",title:"Open in VS Code",children:[a.jsx(ls,{className:"w-4 h-4"}),"Open"]})]})}),o&&a.jsxs("div",{className:"bg-gray-700/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[a.jsx("p",{className:"text-sm text-gray-400 mb-2",children:"Summary:"}),a.jsxs("ul",{className:"space-y-1 text-sm",children:[a.jsxs("li",{className:"text-gray-300",children:[a.jsx("span",{className:"text-gray-500",children:"Issue:"})," ",o.issue.identifier]}),a.jsxs("li",{className:"text-gray-300",children:[a.jsx("span",{className:"text-gray-500",children:"State:"})," ",a.jsx("span",{className:"text-purple-400",children:o.issue.newState})]}),o.workspace.created&&a.jsxs("li",{className:"text-gray-300",children:[a.jsx("span",{className:"text-gray-500",children:"Workspace:"})," ",a.jsx("span",{className:"text-blue-400 font-mono text-xs",children:o.workspace.path})]})]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:r,disabled:A.isPending,className:"px-4 py-2 bg-gray-700 hover:bg-gray-600 text-white rounded-lg transition-colors disabled:opacity-50",children:"Close"}),a.jsxs("button",{onClick:R,disabled:A.isPending,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-500 text-white rounded-lg transition-colors disabled:opacity-50",children:[A.isPending?a.jsx(ye,{className:"w-5 h-5 animate-spin"}):a.jsx(Lt,{className:"w-5 h-5"}),A.isPending?"Starting Agent...":"Start Agent"]})]})]}),i==="error"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-red-500/20 flex items-center justify-center mb-4",children:a.jsx(as,{className:"w-10 h-10 text-red-400"})}),a.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"Planning Failed"}),a.jsx("p",{className:"text-red-400 text-center max-w-md mb-6",children:u}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:r,className:"px-4 py-2 bg-gray-700 hover:bg-gray-600 text-white rounded-lg transition-colors",children:"Close"}),a.jsx("button",{onClick:()=>{s("ready"),c(null)},className:"px-4 py-2 bg-purple-600 hover:bg-purple-500 text-white rounded-lg transition-colors",children:"Try Again"})]})]})]})]})})]})}function w3(e){const t=e.find(i=>i.startsWith("difficulty:"));if(!t)return null;const r=t.split(":")[1];return["trivial","simple","medium","complex","expert"].includes(r)?r:null}const b3={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 S3({level:e}){const t=b3[e];return a.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${t}`,children:e})}const C3={work:"🤖",planning:"📋",review:"👁️",test:"🧪",merge:"🔀"};function k3({type:e,name:t,isConflict:r}){const n=C3[e],i=r?"animate-[pulse_2s_ease-in-out_infinite]":"";return a.jsxs("span",{className:`inline-flex items-center gap-1 text-xs text-blue-400 ${i}`,children:[a.jsx("span",{children:n}),a.jsx("span",{children:t})]})}async function N3(){try{const e=await fetch("/api/costs/by-issue");if(!e.ok)return{};const t=await e.json(),r={};for(const n of t.issues||[])r[n.issueId.toLowerCase()]=n;return r}catch{return{}}}function E3(e){return e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:e>0?`$${e.toFixed(2)}`:""}function j3(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 P3(e="current",t=!1){const r=new URLSearchParams;r.set("cycle",e),t&&r.set("includeCompleted","true");const n=await fetch(`/api/issues?${r}`);if(!n.ok)throw new Error("Failed to fetch issues");return n.json()}async function R3(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function M3(){const e=await fetch("/api/specialists");if(!e.ok)throw new Error("Failed to fetch specialists");return e.json()}function T3(e){const t={backlog:[],todo:[],planning:[],in_progress:[],in_review:[],done:[]};for(const r of e){const n=mn[r.status]||"backlog";n==="canceled"?t.done.push(r):t[n]?t[n].push(r):t.backlog.push(r)}return t}const Py={backlog:"border-gray-600",todo:"border-blue-600",planning:"border-purple-600",in_progress:"border-yellow-500",in_review:"border-pink-500",done:"border-green-500"},D3={backlog:"Backlog",todo:"To Do",planning:"Planning",in_progress:"In Progress",in_review:"In Review",done:"Done"};function L3({selectedIssue:e,onSelectIssue:t}){const r=Ft(),[n,i]=w.useState(null),[s,o]=w.useState(new Set),[l,u]=w.useState(null),[c,h]=w.useState(null),[d,f]=w.useState("current"),[p,m]=w.useState(!1),x=e!==void 0?e:n,C=t||i,{data:y,isLoading:v,error:g}=ae({queryKey:["issues",d,p],queryFn:()=>P3(d,p)}),{data:_=[]}=ae({queryKey:["agents"],queryFn:R3,refetchInterval:5e3}),{data:N=[]}=ae({queryKey:["specialists"],queryFn:M3,refetchInterval:5e3}),{data:S={}}=ae({queryKey:["issueCosts"],queryFn:N3,refetchInterval:3e4,staleTime:1e4}),j=w.useMemo(()=>{if(!y)return[];const I=new Map;for(const P of y)P.project&&!I.has(P.project.id)&&I.set(P.project.id,P.project);return Array.from(I.values()).sort((P,R)=>P.name.localeCompare(R.name))},[y]),A=w.useMemo(()=>y?s.size===0?y:y.filter(I=>I.project&&s.has(I.project.id)):[],[y,s]),$=I=>{o(P=>{const R=new Set(P);return R.has(I)?R.delete(I):R.add(I),R})};if(v)return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 animate-pulse",children:[a.jsx("div",{className:"w-4 h-4 bg-gray-700 rounded"}),a.jsx("div",{className:"w-16 h-4 bg-gray-700 rounded"}),a.jsx("div",{className:"w-24 h-6 bg-gray-700 rounded"}),a.jsx("div",{className:"w-20 h-6 bg-gray-700 rounded"}),a.jsx("div",{className:"w-28 h-6 bg-gray-700 rounded"})]}),a.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:C0.map(I=>a.jsx("div",{className:"flex-shrink-0 w-80",children:a.jsxs("div",{className:`border-t-4 ${Py[I]} bg-gray-800 rounded-lg`,children:[a.jsx("div",{className:"px-4 py-3 border-b border-gray-700",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"h-5 bg-gray-700 rounded w-24 animate-pulse"}),a.jsx("div",{className:"h-4 bg-gray-700 rounded w-6 animate-pulse"})]})}),a.jsx("div",{className:"p-2 space-y-2",children:[1,2,3].map(P=>a.jsxs("div",{className:"bg-gray-700 rounded-lg p-3 border-l-4 border-l-gray-600 animate-pulse",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("div",{className:"w-2 h-2 bg-gray-600 rounded-full"}),a.jsx("div",{className:"h-4 bg-gray-600 rounded w-16"})]}),a.jsx("div",{className:"h-4 bg-gray-600 rounded w-full mb-1"}),a.jsx("div",{className:"h-4 bg-gray-600 rounded w-3/4"}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsx("div",{className:"h-5 bg-gray-600 rounded w-16"}),a.jsx("div",{className:"h-5 bg-gray-600 rounded w-12"})]})]},P))})]})},I))})]});if(g)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-red-400",children:["Error loading issues: ",g.message]})});const z=T3(A);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(U2,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm text-gray-400",children:"Cycle:"}),a.jsx("div",{className:"flex rounded-lg overflow-hidden border border-gray-600",children:["current","all","backlog"].map(I=>a.jsx("button",{onClick:()=>f(I),className:`px-3 py-1 text-xs transition-colors ${d===I?"bg-blue-600 text-white":"bg-gray-800 text-gray-400 hover:text-white hover:bg-gray-700"}`,children:I==="current"?"Current":I==="all"?"All":"Backlog"},I))})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:p,onChange:I=>m(I.target.checked),className:"w-4 h-4 rounded border-gray-600 bg-gray-800 text-blue-600 focus:ring-blue-500 focus:ring-offset-gray-900"}),a.jsx("span",{className:"text-sm text-gray-400",children:"Include completed"})]}),a.jsxs("span",{className:"text-sm text-gray-500",children:[(y==null?void 0:y.length)||0," issues"]}),j.length>1&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-6 bg-gray-700"}),a.jsx("span",{className:"text-sm text-gray-400",children:"Projects:"}),j.map(I=>a.jsxs("button",{onClick:()=>$(I.id),className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${s.size===0||s.has(I.id)?"bg-gray-700 text-white":"bg-gray-800 text-gray-500 hover:text-gray-300"}`,children:[a.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:I.color||"#6b7280"}}),I.name]},I.id)),s.size>0&&a.jsx("button",{onClick:()=>o(new Set),className:"text-xs text-gray-400 hover:text-white",children:"Clear"})]})]}),a.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:C0.map(I=>a.jsx("div",{className:"flex-shrink-0 w-80",children:a.jsxs("div",{className:`border-t-4 ${Py[I]} bg-gray-800 rounded-lg`,children:[a.jsx("div",{className:"px-4 py-3 border-b border-gray-700",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-semibold text-white",children:D3[I]}),a.jsx("span",{className:"text-sm text-gray-400",children:z[I].length})]})}),a.jsxs("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:[z[I].map(P=>{const R=P.identifier.toLowerCase(),D=_.find(O=>{var E;return((E=O.issueId)==null?void 0:E.toLowerCase())===R&&O.type==="planning"}),L=_.find(O=>{var E;return((E=O.issueId)==null?void 0:E.toLowerCase())===R&&O.type!=="planning"}),B=N.filter(O=>{var E;return((E=O.currentIssue)==null?void 0:E.toLowerCase())===R});return a.jsx(O3,{issue:P,planningAgent:D,workAgent:L,specialists:B,cost:S[P.identifier.toLowerCase()],isSelected:x===P.identifier,onSelect:()=>C(x===P.identifier?null:P.identifier),onPlan:()=>u(P),onViewBeads:O=>h(O)},P.id)}),z[I].length===0&&a.jsx("div",{className:"text-center text-gray-500 py-8 text-sm",children:"No issues"})]})]})},I))}),l&&a.jsx(_3,{issue:l,isOpen:!0,onClose:()=>u(null),onComplete:()=>{u(null),r.invalidateQueries({queryKey:["issues"]})}}),c&&a.jsx(A3,{issue:c,onClose:()=>h(null)})]})}function A3({issue:e,onClose:t}){var s,o;const{data:r,isLoading:n,error:i}=ae({queryKey:["beads",e.identifier],queryFn:async()=>{const l=await fetch(`/api/issues/${e.identifier}/beads`);if(!l.ok)throw new Error("Failed to fetch tasks");return l.json()}});return a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),a.jsxs("div",{className:"relative bg-gray-800 rounded-xl shadow-2xl w-full max-w-lg mx-4 max-h-[70vh] overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(yc,{className:"w-5 h-5 text-green-400"}),a.jsxs("h2",{className:"font-semibold text-white",children:["Tasks: ",e.identifier]})]}),a.jsx("button",{onClick:t,className:"p-1 text-gray-400 hover:text-white hover:bg-gray-700 rounded transition-colors",children:a.jsx(Nt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[n&&a.jsxs("div",{className:"flex items-center justify-center py-8 text-gray-400",children:[a.jsx(ye,{className:"w-5 h-5 animate-spin mr-2"}),"Loading tasks..."]}),i&&a.jsx("div",{className:"text-red-400 text-center py-8",children:"Failed to load tasks"}),r&&((s=r.tasks)==null?void 0:s.length)===0&&a.jsx("div",{className:"text-gray-500 text-center py-8",children:"No tasks created yet"}),r&&((o=r.tasks)==null?void 0:o.length)>0&&a.jsx("div",{className:"space-y-2",children:r.tasks.map(l=>a.jsxs("div",{className:`flex items-start gap-3 p-3 rounded-lg ${l.status==="closed"?"bg-green-900/20":l.status==="in_progress"?"bg-blue-900/20":"bg-gray-700/50"}`,children:[a.jsx("div",{className:`mt-0.5 ${l.status==="closed"?"text-green-400":l.status==="in_progress"?"text-blue-400":"text-gray-400"}`,children:l.status==="closed"?a.jsx(So,{className:"w-4 h-4"}):l.status==="in_progress"?a.jsx(ye,{className:"w-4 h-4 animate-spin"}):a.jsx("div",{className:"w-4 h-4 border-2 border-current rounded-full"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm text-white",children:l.title}),a.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[l.id," · ",l.status]})]})]},l.id))})]}),a.jsxs("div",{className:"px-4 py-3 border-t border-gray-700 text-xs text-gray-500",children:[(r==null?void 0:r.count)||0," task",(r==null?void 0:r.count)!==1?"s":""," · Beads"]})]})]})}function O3({issue:e,planningAgent:t,workAgent:r,specialists:n=[],cost:i,isSelected:s,onSelect:o,onPlan:l,onViewBeads:u}){const c=Ft(),d=mn[e.status]==="planning"?t:r,f=d&&d.status!=="dead",p=d,[m,x]=w.useState(!1),[C,y]=w.useState(!1),v=e.labels.some(M=>M.toLowerCase()==="review ready"),g={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"},_=ue({mutationFn:async M=>{const b=await fetch(`/api/agents/${M}`,{method:"DELETE"});if(!b.ok)throw new Error("Failed to kill agent");return b.json()},onSuccess:()=>{c.invalidateQueries({queryKey:["agents"]})}}),[N,S]=w.useState(""),[j,A]=w.useState(!1),$=ue({mutationFn:async({agentId:M,message:b})=>{const H=await fetch(`/api/agents/${M}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:b})});if(!H.ok)throw new Error("Failed to send message");return H.json()},onSuccess:()=>{S(""),A(!1)}}),z=M=>{M.stopPropagation(),p&&confirm(`Kill agent ${p.id}?`)&&_.mutate(p.id)},I=M=>{M.stopPropagation(),o()},P=M=>{M.stopPropagation(),A(!j)},R=M=>{M.preventDefault(),M.stopPropagation(),p&&N.trim()&&$.mutate({agentId:p.id,message:N.trim()})},D=ue({mutationFn:async()=>{const M=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier})});if(!M.ok){const b=await M.json();throw new Error(b.error||"Failed to start agent")}return M.json()},onSuccess:()=>{c.invalidateQueries({queryKey:["agents"]}),c.invalidateQueries({queryKey:["issues"]})},onError:M=>{alert(`Failed to start agent: ${M.message}`)}}),L=M=>{M.stopPropagation(),confirm(`Start agent for ${e.identifier}?`)&&D.mutate()},B=M=>{M.stopPropagation(),l()},O=ue({mutationFn:async M=>{const b=await fetch(`/api/issues/${e.identifier}/abort-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:M.deleteWorkspace})});if(!b.ok){const H=await b.json();throw new Error(H.error||"Failed to abort planning")}return b.json()},onSuccess:()=>{x(!1),y(!1),c.invalidateQueries({queryKey:["issues"]}),c.invalidateQueries({queryKey:["agents"]})}}),E=ue({mutationFn:async M=>{const b=await fetch(`/api/issues/${e.identifier}/deep-wipe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:M.deleteWorkspace})});if(!b.ok){const H=await b.json();throw new Error(H.error||"Deep wipe failed")}return b.json()},onSuccess:M=>{x(!1),y(!1),c.invalidateQueries({queryKey:["issues"]}),c.invalidateQueries({queryKey:["agents"]}),console.log("Deep wipe completed:",M.cleanupLog)}}),F=M=>{M.stopPropagation(),x(!0)},k=M=>{M.stopPropagation(),O.mutate({deleteWorkspace:C})},V=M=>{M.stopPropagation(),x(!1),y(!1)};return a.jsxs("div",{onClick:o,className:`bg-gray-700 rounded-lg p-3 border-l-4 cursor-pointer transition-all ${g[e.priority]||"border-l-gray-500"} ${s?"ring-2 ring-blue-500 bg-gray-650":"hover:bg-gray-650"} ${f?"bg-blue-900/20":""}`,children:[a.jsx("div",{className:"flex items-start justify-between gap-2",children:a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[e.project&&a.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.project.color||"#6b7280"},title:e.project.name}),f&&a.jsxs("div",{className:"flex gap-0.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"0ms"}}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"150ms"}}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"300ms"}})]}),a.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:M=>M.stopPropagation(),className:"text-sm font-medium text-white hover:text-blue-400 flex items-center gap-1",children:[e.source==="github"&&a.jsx("span",{title:"GitHub Issue",children:a.jsx(xm,{className:"w-3 h-3 text-gray-400"})}),a.jsx("span",{className:"text-gray-400",children:e.identifier}),a.jsx(ls,{className:"w-3 h-3 opacity-50"})]}),(()=>{const M=[],b=(!!r||!!t)&&n.length>0||!!r&&!!t||n.length>1;r&&M.push({type:"work",name:r.issueId||r.id.split("-").pop()||r.id}),t&&M.push({type:"planning",name:t.issueId||t.id.split("-").pop()||t.id});for(const H of n){const K=H.name.replace("-agent","");M.push({type:K,name:K})}return M.map((H,K)=>a.jsx(k3,{type:H.type,name:H.name,isConflict:b},K))})(),v&&a.jsxs("span",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-green-600 text-white animate-pulse",title:"Agent completed work - ready for human review",children:[a.jsx(F2,{className:"w-3 h-3"}),"Ready"]}),(p==null?void 0:p.hasPendingQuestion)&&a.jsxs("span",{onClick:M=>{M.stopPropagation(),p.type==="planning"?l():o()},className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-amber-600 text-white animate-pulse cursor-pointer hover:bg-amber-500",title:`Agent is waiting for user input - click to respond (${p.pendingQuestionCount||1} question${(p.pendingQuestionCount||1)>1?"s":""})`,children:[a.jsx($2,{className:"w-3 h-3"}),"Input"]}),(()=>{const M=w3(e.labels);return M?a.jsx(S3,{level:M}):null})(),i&&i.totalCost>0&&a.jsxs("span",{className:`ml-auto px-1.5 py-0.5 rounded text-xs font-medium ${j3(i.totalCost)}`,title:`${(i.tokenCount/1e6).toFixed(2)}M tokens${i.model?` • ${i.model.replace("claude-","").replace(/-20[0-9]{6}$/,"")}`:""}${i.durationMinutes?` • ${Math.round(i.durationMinutes)}min`:""}`,children:[a.jsx(cl,{className:"w-3 h-3 inline -mt-0.5"}),E3(i.totalCost).slice(1)]})]}),a.jsx("p",{className:"text-sm text-gray-300 mt-1 line-clamp-2",children:e.title})]})}),a.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[e.assignee&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-gray-400",children:[a.jsx(Ww,{className:"w-3 h-3"}),e.assignee.name.split(" ")[0]]}),e.labels.filter(M=>M.toLowerCase()!=="review ready").slice(0,2).map(M=>a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs bg-gray-600 text-gray-300 px-2 py-0.5 rounded",children:[a.jsx(zw,{className:"w-3 h-3"}),M]},M))]}),f&&a.jsxs("div",{className:`flex items-center gap-3 mt-3 pt-3 border-t ${(p==null?void 0:p.type)==="planning"?"border-purple-600/50":"border-gray-600"}`,children:[a.jsxs("button",{onClick:(p==null?void 0:p.type)==="planning"?B:I,className:`flex items-center gap-1 text-xs transition-colors ${(p==null?void 0:p.type)==="planning"?"text-purple-400 hover:text-purple-300":s?"text-blue-400":"text-gray-400 hover:text-white"}`,children:[(p==null?void 0:p.type)==="planning"?a.jsx(mf,{className:"w-3.5 h-3.5"}):a.jsx(Iw,{className:"w-3.5 h-3.5"}),(p==null?void 0:p.type)==="planning"?"Continue Planning":"Watch"]}),a.jsxs("button",{onClick:()=>u&&u(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:[a.jsx(yc,{className:"w-3.5 h-3.5"}),"Tasks"]}),a.jsxs("button",{onClick:P,className:`flex items-center gap-1 text-xs transition-colors ${j?"text-blue-400":"text-gray-400 hover:text-white"}`,children:[a.jsx(G2,{className:"w-3.5 h-3.5"}),"Tell"]}),a.jsxs("button",{onClick:z,disabled:_.isPending,className:"flex items-center gap-1 text-xs text-red-400 hover:text-red-300 transition-colors ml-auto",children:[_.isPending?a.jsx(ye,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(Nt,{className:"w-3.5 h-3.5"}),"Kill"]})]}),j&&p&&a.jsx("form",{onSubmit:R,className:"mt-2",onClick:M=>M.stopPropagation(),children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:N,onChange:M=>S(M.target.value),placeholder:"Type a message...",className:"flex-1 bg-gray-800 text-white text-sm px-3 py-1.5 rounded border border-gray-600 focus:border-blue-500 focus:outline-none",autoFocus:!0}),a.jsx("button",{type:"submit",disabled:!N.trim()||$.isPending,className:"px-3 py-1.5 bg-blue-600 text-white text-sm rounded hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:$.isPending?"...":"Send"})]})}),!f&&(mn[e.status]==="backlog"||mn[e.status]==="todo")&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-gray-600 flex-wrap",children:[a.jsxs("button",{onClick:B,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[a.jsx(gc,{className:"w-3.5 h-3.5"}),"Plan"]}),a.jsxs("button",{onClick:L,disabled:D.isPending,className:"flex items-center gap-1 text-xs text-gray-500 hover:text-gray-400 transition-colors disabled:opacity-50",title:"Plan first recommended",children:[D.isPending?a.jsx(ye,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(Lt,{className:"w-3.5 h-3.5"}),D.isPending?"Starting...":"Start Agent"]}),a.jsxs("button",{onClick:M=>{M.stopPropagation(),confirm(`Deep wipe ${e.identifier}? This will clean up any stale state:
443
- • Kill agents
444
- • Delete agent state
445
- • Delete workspace & branches`)&&E.mutate({deleteWorkspace:!0})},disabled:E.isPending,className:"flex items-center gap-1 text-xs text-red-400/60 hover:text-red-400 transition-colors disabled:opacity-50",title:"Clean up stale workspace, branches, and state",children:[E.isPending?a.jsx(ye,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx($w,{className:"w-3.5 h-3.5"}),E.isPending?"Wiping...":"Reset"]})]}),!f&&mn[e.status]==="planning"&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-purple-600/50 flex-wrap",children:[a.jsxs("button",{onClick:B,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[a.jsx(gc,{className:"w-3.5 h-3.5"}),"Resume Planning"]}),a.jsxs("button",{onClick:()=>u&&u(e),className:"flex items-center gap-1 text-xs text-green-400 hover:text-green-300 transition-colors",title:"View tasks created during planning",children:[a.jsx(yc,{className:"w-3.5 h-3.5"}),"Tasks"]}),a.jsxs("button",{onClick:L,className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors",children:[a.jsx(Lt,{className:"w-3.5 h-3.5"}),"Start Agent"]}),a.jsxs("button",{onClick:F,disabled:O.isPending,className:"flex items-center gap-1 text-xs text-orange-400 hover:text-orange-300 transition-colors disabled:opacity-50",title:"Return to Todo",children:[a.jsx(Nt,{className:"w-3.5 h-3.5"}),O.isPending?"Aborting...":"Abort"]})]}),m&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-orange-600/50 bg-orange-950/30 -mx-3 -mb-3 px-3 pb-3 rounded-b-lg",children:[a.jsx("p",{className:"text-xs text-orange-300 mb-2",children:"Abort planning and return to Backlog?"}),a.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-400 mb-3 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:C,onChange:M=>y(M.target.checked),onClick:M=>M.stopPropagation(),className:"rounded border-gray-600 bg-gray-700 text-orange-500 focus:ring-orange-500"}),"Also delete workspace (git worktree)"]}),a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsx("button",{onClick:V,className:"px-2 py-1 text-xs text-gray-400 hover:text-white transition-colors",children:"Cancel"}),a.jsx("button",{onClick:k,disabled:O.isPending||E.isPending,className:"px-2 py-1 text-xs bg-orange-600 hover:bg-orange-500 text-white rounded transition-colors disabled:opacity-50",children:O.isPending?"Aborting...":"Abort"}),a.jsx("button",{onClick:M=>{M.stopPropagation(),confirm(`Deep wipe ${e.identifier}? This will:
446
- • Kill all agents
447
- • Delete all state
448
- • Reset to Backlog
449
- • Remove labels${C?`
450
- • Delete workspace`:""}`)&&E.mutate({deleteWorkspace:C})},disabled:O.isPending||E.isPending,className:"px-2 py-1 text-xs bg-red-700 hover:bg-red-600 text-white rounded transition-colors disabled:opacity-50",title:"Complete reset - kills agents, deletes state, resets Linear",children:E.isPending?"Wiping...":"🔥 Deep Wipe"})]})]}),!f&&mn[e.status]==="in_progress"&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-gray-600 flex-wrap",children:[a.jsxs("button",{onClick:B,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[a.jsx(gc,{className:"w-3.5 h-3.5"}),"Re-plan"]}),a.jsxs("button",{onClick:()=>u&&u(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:[a.jsx(yc,{className:"w-3.5 h-3.5"}),"Tasks"]}),a.jsxs("button",{onClick:L,className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors",children:[a.jsx(Lt,{className:"w-3.5 h-3.5"}),"Resume Agent"]})]}),!f&&(mn[e.status]==="done"||mn[e.status]==="in_review")&&a.jsx(I3,{issue:e})]})}function I3({issue:e}){const t=Ft(),r=ue({mutationFn:async()=>{const i=await fetch(`/api/issues/${e.identifier}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!i.ok){const s=await i.json();throw new Error(s.error||"Failed to reopen issue")}return i.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["issues"]})}}),n=i=>{i.stopPropagation(),confirm(`Reopen ${e.identifier} and start planning?`)&&r.mutate()};return a.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-green-600/30",children:[a.jsxs("button",{onClick:n,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?a.jsx(ye,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(_m,{className:"w-3.5 h-3.5"}),r.isPending?"Reopening...":"Reopen"]}),r.isError&&a.jsx("span",{className:"text-xs text-red-400",children:r.error.message})]})}const F3={sleeping:"😴",active:"🟢",uninitialized:"⚪",suspended:"⏸️"},B3={sleeping:"Sleeping",active:"Active",uninitialized:"Not Initialized",suspended:"Suspended"},z3={sleeping:"text-blue-400",active:"text-green-400",uninitialized:"text-gray-500",suspended:"text-yellow-400"};async function $3(e){const t=await fetch(`/api/specialists/${e}/wake`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const r=await t.json();throw new Error(r.error||"Failed to wake specialist")}}async function H3(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 r=await t.json();throw new Error(r.error||"Failed to reset specialist")}}async function W3(e){if(!(await fetch(`/api/agents/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to kill specialist")}async function U3(e,t){const r=await fetch(`/api/agents/${e}/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})});if(!r.ok){const n=await r.json();throw new Error(n.error||"Failed to resume agent")}}async function K3(e){const t=await fetch(`/api/agents/${e}/activity?limit=20`);return t.ok?(await t.json()).activity||[]:[]}async function q3(e){const t=await fetch(`/api/specialists/${e}/cost`);return t.ok?t.json():{cost:0,inputTokens:0,outputTokens:0}}function V3(e,t){return ae({queryKey:["specialist-cost",e],queryFn:()=>q3(e),enabled:t,refetchInterval:1e4})}async function Q3(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 Y3(e,t){const r=await fetch(`/api/specialists/${e}/queue/${t}`,{method:"DELETE"});if(!r.ok){const n=await r.json();throw new Error(n.error||"Failed to remove queue item")}}async function G3(e,t){const r=await fetch(`/api/specialists/${e}/queue/reorder`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({itemIds:t})});if(!r.ok){const n=await r.json();throw new Error(n.error||"Failed to reorder queue")}}function X3(e){return ae({queryKey:["specialist-queue",e],queryFn:()=>Q3(e),refetchInterval:5e3})}function J3(e,t){return ae({queryKey:["activity",e],queryFn:()=>K3(e),enabled:t,refetchInterval:1e4})}function Z3(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function e5(e){if(!e)return"Never";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),s=Math.floor(i/60),o=Math.floor(s/24);return o>0?`${o}d ago`:s>0?`${s}h ago`:i>0?`${i}m ago`:"Just now"}function t5({specialist:e,issueInfo:t,onSelect:r,isSelected:n}){const i=Ft(),{data:s}=V3(e.name,e.state!=="uninitialized"),{data:o}=X3(e.name),{data:l}=J3(e.tmuxSession,e.state!=="uninitialized"),[u,c]=w.useState(!1),[h,d]=w.useState(!1),f=ue({mutationFn:()=>$3(e.name),onSuccess:()=>{i.invalidateQueries({queryKey:["specialists"]}),i.invalidateQueries({queryKey:["agents"]})},onError:P=>{alert(`Failed to wake ${e.displayName}: ${P.message}`)}}),p=ue({mutationFn:()=>H3(e.name),onSuccess:()=>{i.invalidateQueries({queryKey:["specialists"]})},onError:P=>{alert(`Failed to reset ${e.displayName}: ${P.message}`)}}),m=ue({mutationFn:()=>W3(e.tmuxSession),onSuccess:()=>{i.invalidateQueries({queryKey:["specialists"]}),i.invalidateQueries({queryKey:["agents"]})}}),x=ue({mutationFn:P=>U3(e.tmuxSession,P),onSuccess:()=>{i.invalidateQueries({queryKey:["specialists"]}),i.invalidateQueries({queryKey:["agents"]})},onError:P=>{alert(`Failed to resume ${e.displayName}: ${P.message}`)}}),C=ue({mutationFn:P=>Y3(e.name,P),onSuccess:()=>{i.invalidateQueries({queryKey:["specialist-queue",e.name]})},onError:P=>{alert(`Failed to remove queue item: ${P.message}`)}}),y=ue({mutationFn:P=>G3(e.name,P),onSuccess:()=>{i.invalidateQueries({queryKey:["specialist-queue",e.name]})},onError:P=>{alert(`Failed to reorder queue: ${P.message}`)}}),v=P=>{P.stopPropagation(),f.mutate()},g=P=>{P.stopPropagation(),confirm(`Reset ${e.displayName}? This will clear the session file and context.`)&&p.mutate()},_=P=>{P.stopPropagation(),confirm(`Kill ${e.displayName}?`)&&m.mutate()},N=(P,R)=>{P.stopPropagation(),C.mutate(R)},S=(P,R)=>{if(P.stopPropagation(),!o||R===0)return;const D=[...o.items];[D[R-1],D[R]]=[D[R],D[R-1]],y.mutate(D.map(L=>L.id))},j=(P,R)=>{if(P.stopPropagation(),!o||R===o.items.length-1)return;const D=[...o.items];[D[R],D[R+1]]=[D[R+1],D[R]],y.mutate(D.map(L=>L.id))},A=P=>{P.stopPropagation(),c(!u)},$=P=>{P.stopPropagation(),d(!h)},z=P=>{P.stopPropagation(),x.mutate(void 0)},I={urgent:"text-red-400",high:"text-orange-400",normal:"text-blue-400",low:"text-gray-400"};return a.jsxs("div",{onClick:r,className:`p-4 cursor-pointer transition-colors ${n?"bg-gray-700":"hover:bg-gray-750"}`,children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Dw,{className:"w-5 h-5 text-purple-400"}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-white flex items-center gap-2",children:[e.displayName,e.state==="active"?a.jsx(ye,{className:"w-4 h-4 text-green-400 animate-spin"}):a.jsx("span",{className:`text-xs ${z3[e.state]}`,children:F3[e.state]}),o&&o.totalCount>0&&a.jsxs("button",{onClick:A,className:"text-xs text-yellow-400 hover:text-yellow-300 flex items-center gap-1",title:`${o.totalCount} queued task${o.totalCount>1?"s":""}`,children:["(",o.totalCount,")",u?a.jsx(B2,{className:"w-3 h-3"}):a.jsx(z2,{className:"w-3 h-3"})]})]}),a.jsx("div",{className:"text-sm text-gray-400",children:e.description}),e.currentIssue&&a.jsxs("div",{className:"text-xs text-cyan-400 mt-1 flex items-center gap-1",children:[a.jsx("span",{className:"text-gray-500",children:"Working on:"}),a.jsx("span",{className:"font-mono",children:e.currentIssue}),t&&a.jsxs("span",{className:"text-gray-400 truncate max-w-[200px]",title:t.title,children:["- ",t.title]})]}),e.sessionId&&!e.currentIssue&&a.jsxs("div",{className:"text-xs text-gray-500 font-mono mt-1",children:["Session: ",e.sessionId.slice(0,8),"..."]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"text-right",children:[a.jsx("div",{className:"text-sm text-gray-400",children:B3[e.state]}),s&&s.cost>0&&a.jsxs("div",{className:"text-xs text-green-400 font-medium",title:"Total cost",children:["$",s.cost.toFixed(4)]}),e.contextTokens&&a.jsxs("div",{className:"text-xs text-gray-500",children:[Z3(e.contextTokens)," tokens"]}),e.lastWake&&a.jsxs("div",{className:"text-xs text-gray-500",children:["Last wake: ",e5(e.lastWake)]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[e.state!=="uninitialized"&&l&&l.length>0&&a.jsx("button",{onClick:$,className:"p-2 text-gray-400 hover:text-blue-400 hover:bg-gray-600 rounded",title:`Show activity history (${l.length} entries)`,children:a.jsx(bo,{className:"w-4 h-4"})}),e.state==="suspended"&&a.jsx("button",{onClick:z,disabled:x.isPending,className:"p-2 text-gray-400 hover:text-green-400 hover:bg-gray-600 rounded disabled:opacity-50",title:"Resume specialist",children:a.jsx(Lt,{className:"w-4 h-4"})}),(e.state==="sleeping"||e.state==="uninitialized")&&a.jsx("button",{onClick:v,disabled:f.isPending||e.state==="uninitialized",className:"p-2 text-gray-400 hover:text-green-400 hover:bg-gray-600 rounded disabled:opacity-50 disabled:cursor-not-allowed",title:e.state==="uninitialized"?"Specialist not initialized - needs session ID":"Wake specialist",children:a.jsx(eN,{className:"w-4 h-4"})}),e.state==="active"&&a.jsx("button",{onClick:_,disabled:m.isPending,className:"p-2 text-gray-400 hover:text-red-400 hover:bg-gray-600 rounded",title:"Kill specialist",children:a.jsx(ll,{className:"w-4 h-4"})}),(e.state==="sleeping"||e.state==="uninitialized")&&a.jsx("button",{onClick:g,disabled:p.isPending,className:"p-2 text-gray-400 hover:text-yellow-400 hover:bg-gray-600 rounded",title:"Reset specialist (clear session)",children:a.jsx(_m,{className:"w-4 h-4"})})]})]})]}),u&&o&&o.totalCount>0&&a.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-gray-600",children:[a.jsxs("div",{className:"text-xs text-gray-400 font-medium mb-2",children:["Queued Tasks (",o.totalCount,")"]}),a.jsx("div",{className:"space-y-2",children:o.items.map((P,R)=>a.jsxs("div",{className:"flex items-center justify-between bg-gray-750 px-3 py-2 rounded text-xs",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsxs("span",{className:"text-gray-500",children:[R+1,"."]}),a.jsx("span",{className:"text-white font-mono",children:P.payload.issueId||P.payload.message||P.id.substring(0,8)}),a.jsxs("span",{className:`${I[P.priority]} font-medium`,children:["[",P.priority,"]"]}),a.jsx("span",{className:"text-gray-500 text-xs",children:P.source})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:D=>S(D,R),disabled:R===0||y.isPending,className:"p-1 text-gray-400 hover:text-blue-400 disabled:opacity-30 disabled:cursor-not-allowed",title:"Move up",children:a.jsx(Z2,{className:"w-3 h-3"})}),a.jsx("button",{onClick:D=>j(D,R),disabled:R===o.items.length-1||y.isPending,className:"p-1 text-gray-400 hover:text-blue-400 disabled:opacity-30 disabled:cursor-not-allowed",title:"Move down",children:a.jsx(J2,{className:"w-3 h-3"})}),a.jsx("button",{onClick:D=>N(D,P.id),disabled:C.isPending,className:"p-1 text-gray-400 hover:text-red-400 disabled:opacity-50",title:"Remove from queue",children:a.jsx($w,{className:"w-3 h-3"})})]})]},P.id))})]}),h&&l&&l.length>0&&a.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-gray-600",children:[a.jsxs("div",{className:"text-xs text-gray-400 font-medium mb-2",children:["Recent Activity (",l.length,")"]}),a.jsx("div",{className:"space-y-1",children:l.slice().reverse().map((P,R)=>a.jsxs("div",{className:"flex items-center gap-2 bg-gray-750 px-3 py-1.5 rounded text-xs",children:[a.jsx("span",{className:"text-gray-500",children:new Date(P.ts).toLocaleTimeString()}),a.jsx("span",{className:"text-blue-400 font-mono",children:P.tool}),P.action&&a.jsx("span",{className:"text-gray-400 truncate",children:P.action.substring(0,50)})]},R))})]})]})}async function r5(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 n5(e){const t=await fetch(`/api/agents/${e}/cost`);if(!t.ok)throw new Error("Failed to fetch agent cost");return t.json()}function i5(e){return ae({queryKey:["handoff-suggestion",e],queryFn:()=>r5(e),refetchInterval:3e4})}function s5(e){return ae({queryKey:["agent-cost",e],queryFn:()=>n5(e),refetchInterval:6e4})}async function o5(e,t,r){const n=await fetch(`/api/agents/${e}/handoff`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toModel:t,reason:r})});if(!n.ok){const i=await n.json();throw new Error(i.error||"Failed to execute handoff")}}const a5={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 l5({agentId:e}){const{data:t,isLoading:r}=i5(e),n=Ft(),i=ue({mutationFn:({toModel:l,reason:u})=>o5(e,l,u),onSuccess:()=>{n.invalidateQueries({queryKey:["agents"]}),n.invalidateQueries({queryKey:["handoff-suggestion",e]}),alert("Handoff completed successfully")},onError:l=>{alert(`Handoff failed: ${l.message}`)}}),s=l=>{confirm(`Hand off ${e} to ${l}?`)&&i.mutate({toModel:l,reason:"Manual handoff from dashboard"})},o=()=>{t!=null&&t.suggestedModel&&confirm(`${t.reason}
451
-
452
- Proceed with handoff to ${t.suggestedModel}?`)&&i.mutate({toModel:t.suggestedModel,reason:t.reason})};return r?a.jsx("div",{className:"p-3 bg-gray-800 rounded border border-gray-700",children:a.jsx("div",{className:"text-sm text-gray-400",children:"Loading handoff data..."})}):t?a.jsxs("div",{className:"p-3 bg-gray-800 rounded border border-gray-700 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-gray-400",children:"Current Model:"}),a.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded border ${a5[t.currentModel]||"text-gray-400 bg-gray-700 border-gray-600"}`,children:t.currentModel})]}),t.suggested&&t.suggestedModel&&a.jsxs("div",{className:"flex items-start gap-2 p-2 bg-orange-900/20 border border-orange-500/30 rounded",children:[a.jsx(as,{className:"w-4 h-4 text-orange-400 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm font-medium text-orange-400 mb-1",children:"Handoff Suggested"}),a.jsx("div",{className:"text-xs text-gray-300 mb-2",children:t.reason}),a.jsxs("button",{onClick:o,disabled:i.isPending,className:"flex items-center gap-2 px-3 py-1.5 text-xs font-medium text-white bg-orange-600 hover:bg-orange-500 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(ff,{className:"w-3 h-3"}),"Hand off to ",t.suggestedModel]})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-gray-400 mb-2",children:"Manual Handoff:"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>s("haiku"),disabled:i.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"}),a.jsx("button",{onClick:()=>s("sonnet"),disabled:i.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"}),a.jsx("button",{onClick:()=>s("opus"),disabled:i.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 c5={healthy:"bg-status-healthy",warning:"bg-status-warning",stuck:"bg-status-stuck",dead:"bg-status-dead"},u5={active:"🟢",stale:"🟡",warning:"🟠",stuck:"🔴",suspended:"⏸️"},h5={active:"Active",stale:"Stale",warning:"Warning",stuck:"Stuck",suspended:"Suspended"},d5={active:"text-green-400",stale:"text-yellow-400",warning:"text-orange-400",stuck:"text-red-400",suspended:"text-blue-400"};async function f5(e){if(!(await fetch(`/api/agents/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to kill agent")}async function p5(e){const t=await fetch(`/api/agents/${e}/poke`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const r=await t.json();throw new Error(r.error||"Failed to poke agent")}}async function m5(e,t){const r=await fetch(`/api/agents/${e}/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})});if(!r.ok){const n=await r.json();throw new Error(n.error||"Failed to resume agent")}}async function g5(e){const t=await fetch(`/api/agents/${e}/activity?limit=20`);return t.ok?(await t.json()).activity||[]:[]}function y5(e,t){return ae({queryKey:["activity",e],queryFn:()=>g5(e),enabled:t,refetchInterval:1e4})}function v5(e){const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),s=Math.floor(i/60);return s>0?`${s}h ${i%60}m`:`${i}m`}function x5(e){if(e===null)return"unknown";const t=Math.floor(e/1e3),r=Math.floor(t/60),n=Math.floor(r/60);return n>0?`${n}h ago`:r>0?`${r}m ago`:`${t}s ago`}function _5({agent:e,health:t,onSelect:r,isSelected:n}){const i=Ft(),[s,o]=w.useState(!1),[l,u]=w.useState(!1),{data:c}=s5(e.id),{data:h}=y5(e.id,(t==null?void 0:t.isRunning)||(t==null?void 0:t.state)==="suspended"),d=ue({mutationFn:()=>f5(e.id),onSuccess:()=>{i.invalidateQueries({queryKey:["agents"]})}}),f=ue({mutationFn:()=>p5(e.id),onSuccess:()=>{alert(`Poked ${e.id} successfully`)},onError:_=>{alert(`Failed to poke ${e.id}: ${_.message}`)}}),p=ue({mutationFn:_=>m5(e.id,_),onSuccess:()=>{i.invalidateQueries({queryKey:["agents"]})},onError:_=>{alert(`Failed to resume ${e.id}: ${_.message}`)}}),m=_=>{_.stopPropagation(),confirm(`Kill agent ${e.id}?`)&&d.mutate()},x=_=>{_.stopPropagation(),f.mutate()},C=_=>{_.stopPropagation(),p.mutate(void 0)},y=_=>{_.stopPropagation(),u(!l)},v=(t==null?void 0:t.state)==="warning"||(t==null?void 0:t.state)==="stuck",g=_=>{_.stopPropagation(),o(!s)};return a.jsxs("div",{onClick:r,className:`p-4 cursor-pointer transition-colors ${n?"bg-gray-700":"hover:bg-gray-750"}`,children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${c5[e.status]}`}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-white flex items-center gap-2",children:[e.id,t&&a.jsx("span",{className:`text-xs ${d5[t.state]}`,title:`Cloister: ${h5[t.state]}`,children:u5[t.state]})]}),a.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.runtime," / ",e.model,c&&c.cost>0&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-400",title:"Agent cost so far",children:[a.jsx(cl,{className:"w-3 h-3"}),"$",c.cost.toFixed(4)]})]})]})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"text-right",children:[a.jsxs("div",{className:"flex items-center gap-1 text-sm text-gray-400",children:[a.jsx(Ha,{className:"w-4 h-4"}),v5(e.startedAt)]}),t&&t.timeSinceActivity!==null&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-500",children:[a.jsx(bo,{className:"w-3 h-3"}),x5(t.timeSinceActivity)]}),e.consecutiveFailures>0&&a.jsxs("div",{className:"flex items-center gap-1 text-sm text-orange-400",children:[a.jsx(Tn,{className:"w-4 h-4"}),e.consecutiveFailures," failures"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[t&&(t.isRunning||t.state==="suspended")&&h&&h.length>0&&a.jsx("button",{onClick:y,className:"p-2 text-gray-400 hover:text-blue-400 hover:bg-gray-600 rounded",title:`Show activity history (${h.length} entries)`,children:a.jsx(bo,{className:"w-4 h-4"})}),a.jsx("button",{onClick:g,className:`p-2 hover:bg-gray-600 rounded ${s?"text-blue-400":"text-gray-400 hover:text-blue-400"}`,title:"Model handoff controls",children:a.jsx(ym,{className:"w-4 h-4"})}),(t==null?void 0:t.state)==="suspended"&&a.jsx("button",{onClick:C,disabled:p.isPending,className:"p-2 text-gray-400 hover:text-green-400 hover:bg-gray-600 rounded disabled:opacity-50",title:"Resume agent",children:a.jsx(Lt,{className:"w-4 h-4"})}),v&&a.jsx("button",{onClick:x,disabled:f.isPending,className:"p-2 text-gray-400 hover:text-yellow-400 hover:bg-gray-600 rounded",title:"Poke agent (send nudge message)",children:a.jsx(Mw,{className:"w-4 h-4"})}),(t==null?void 0:t.state)!=="suspended"&&a.jsx("button",{onClick:m,disabled:d.isPending,className:"p-2 text-gray-400 hover:text-red-400 hover:bg-gray-600 rounded",title:"Kill agent",children:a.jsx(Wa,{className:"w-4 h-4"})})]})]})]}),s&&a.jsx("div",{className:"mt-3 pt-3 border-t border-gray-700",children:a.jsx(l5,{agentId:e.id})}),l&&h&&h.length>0&&a.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-gray-600",children:[a.jsxs("div",{className:"text-xs text-gray-400 font-medium mb-2",children:["Recent Activity (",h.length,")"]}),a.jsx("div",{className:"space-y-1",children:h.slice().reverse().map((_,N)=>a.jsxs("div",{className:"flex items-center gap-2 bg-gray-750 px-3 py-1.5 rounded text-xs",children:[a.jsx("span",{className:"text-gray-500",children:new Date(_.ts).toLocaleTimeString()}),a.jsx("span",{className:"text-blue-400 font-mono",children:_.tool}),_.action&&a.jsx("span",{className:"text-gray-400 truncate",children:_.action.substring(0,50)})]},N))})]})]})}async function w5(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function b5(){const e=await fetch("/api/specialists");if(!e.ok)throw new Error("Failed to fetch specialists");return e.json()}async function S5(){const e=await fetch("/api/cloister/agents/health");if(!e.ok)throw new Error("Failed to fetch Cloister health");return e.json()}async function C5(){const e=await fetch("/api/cloister/status");if(!e.ok)throw new Error("Failed to fetch Cloister status");return e.json()}async function k5(){const e=await fetch("/api/activity");return e.ok?e.json():[]}async function N5(){const e=await fetch("/api/issues");return e.ok?(await e.json()).issues||[]:[]}async function E5(){if(!(await fetch("/api/cloister/start",{method:"POST"})).ok)throw new Error("Failed to start Cloister")}async function j5(){if(!(await fetch("/api/cloister/stop",{method:"POST"})).ok)throw new Error("Failed to stop Cloister")}function P5(e){if(!e)return"Never";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/1e3),s=Math.floor(i/60);return i<60?`${i}s ago`:s<60?`${s}m ago`:`${Math.floor(s/60)}h ago`}async function R5(){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 M5({selectedAgent:e,onSelectAgent:t}){const r=Ft(),{data:n,isLoading:i,error:s}=ae({queryKey:["agents"],queryFn:w5,refetchInterval:3e3}),{data:o,isLoading:l}=ae({queryKey:["specialists"],queryFn:b5,refetchInterval:5e3}),{data:u}=ae({queryKey:["cloister-health"],queryFn:S5,refetchInterval:5e3}),{data:c}=ae({queryKey:["cloister-status"],queryFn:C5,refetchInterval:5e3}),{data:h}=ae({queryKey:["activity"],queryFn:k5,refetchInterval:5e3}),{data:d}=ae({queryKey:["issues"],queryFn:N5,refetchInterval:3e4}),f=ue({mutationFn:E5,onSuccess:()=>{r.invalidateQueries({queryKey:["cloister-status"]})}}),p=ue({mutationFn:j5,onSuccess:()=>{r.invalidateQueries({queryKey:["cloister-status"]})}}),m=ue({mutationFn:R5,onSuccess:()=>{r.invalidateQueries({queryKey:["specialists"]}),r.invalidateQueries({queryKey:["agents"]})},onError:S=>{alert(`Failed to reset specialists: ${S.message}`)}}),x=()=>{confirm(`Reset ALL specialist agents?
453
-
454
- This will kill any running specialists and clear their session files.`)&&m.mutate()},C=S=>{if(!S||!d)return;const j=d.find(A=>A.identifier.toLowerCase()===S.toLowerCase());if(j)return{id:j.id,identifier:j.identifier,title:j.title}},y=(o==null?void 0:o.some(S=>S.isRunning))||!1,v=(c==null?void 0:c.running)||!1,g=(h||[]).slice(-5).reverse();if(i||l)return a.jsx("div",{className:"bg-gray-800 rounded-lg p-6",children:a.jsx("div",{className:"text-gray-400",children:"Loading agents..."})});if(s)return a.jsx("div",{className:"bg-gray-800 rounded-lg p-6",children:a.jsxs("div",{className:"text-red-400",children:["Error: ",s.message]})});const _=(n==null?void 0:n.filter(S=>S.status!=="dead"))||[],N=(o==null?void 0:o.filter(S=>S.enabled))||[];return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"bg-gray-800 rounded-lg",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[a.jsxs("h2",{className:"font-semibold text-white flex items-center gap-2",children:[a.jsx(Ha,{className:"w-5 h-5 text-blue-400"}),"Cloister Deacon"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`text-xs px-2 py-1 rounded ${y?"bg-green-900/50 text-green-400":"bg-gray-700 text-gray-400"}`,children:y?"● Specialists Active":"○ Specialists Idle"}),v?a.jsxs("button",{onClick:()=>p.mutate(),disabled:p.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs text-red-400 hover:bg-gray-700 rounded transition-colors disabled:opacity-50",title:"Stop patrol loop",children:[a.jsx(Wa,{className:"w-3 h-3"}),"Stop Patrol"]}):a.jsxs("button",{onClick:()=>f.mutate(),disabled:f.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs text-green-400 hover:bg-gray-700 rounded transition-colors disabled:opacity-50",title:"Start patrol loop (health monitoring)",children:[a.jsx(Lt,{className:"w-3 h-3"}),"Start Patrol"]})]})]}),a.jsx("div",{className:"p-4",children:a.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-400",children:"Patrol Status:"})," ",a.jsx("span",{className:v?"text-green-400":"text-gray-500",children:v?"● Running":"○ Stopped"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-400",children:"Last Check:"})," ",a.jsx("span",{className:"text-gray-300",children:P5((c==null?void 0:c.lastCheck)||null)})]}),(c==null?void 0:c.summary)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ps,{className:"w-4 h-4 text-green-400"}),a.jsxs("span",{className:"text-gray-300",children:[c.summary.active," active"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[c.summary.stuck>0?a.jsx(as,{className:"w-4 h-4 text-red-400"}):a.jsx(as,{className:"w-4 h-4 text-gray-500"}),a.jsxs("span",{className:c.summary.stuck>0?"text-red-400":"text-gray-400",children:[c.summary.stuck," stuck"]})]})]})]})})]}),g.length>0&&a.jsxs("div",{className:"bg-gray-800 rounded-lg",children:[a.jsx("div",{className:"px-4 py-3 border-b border-gray-700",children:a.jsxs("h2",{className:"font-semibold text-white flex items-center gap-2",children:[a.jsx(bo,{className:"w-5 h-5 text-cyan-400"}),"Recent Activity"]})}),a.jsx("div",{className:"divide-y divide-gray-700",children:g.map(S=>a.jsxs("div",{className:"px-4 py-2 flex items-center gap-3 text-sm",children:[a.jsx("span",{className:"text-gray-500 text-xs w-16",children:new Date(S.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),a.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs ${S.type==="spawn"?"bg-green-900/50 text-green-400":S.type==="complete"?"bg-blue-900/50 text-blue-400":S.type==="error"?"bg-red-900/50 text-red-400":S.type==="deacon"?"bg-purple-900/50 text-purple-400":"bg-gray-700 text-gray-300"}`,children:S.type}),a.jsxs("span",{className:"text-gray-300 truncate flex-1",children:[S.type==="deacon"?S.command:S.source,S.issueId&&S.type!=="deacon"&&a.jsxs("span",{className:"text-cyan-400 ml-1",children:["(",S.issueId,")"]})]})]},S.id))})]}),a.jsxs("div",{className:"bg-gray-800 rounded-lg",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[a.jsxs("h2",{className:"font-semibold text-white flex items-center gap-2",children:[a.jsx(Dw,{className:"w-5 h-5 text-purple-400"}),"Specialist Agents (",N.length,")"]}),a.jsxs("button",{onClick:x,disabled:m.isPending,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-gray-400 hover:text-yellow-400 hover:bg-gray-700 rounded transition-colors disabled:opacity-50",title:"Reset all specialists (kill & clear sessions)",children:[m.isPending?a.jsx(ye,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(_m,{className:"w-3.5 h-3.5"}),"Reset All"]})]}),a.jsx("div",{className:"divide-y divide-gray-700",children:N.length===0?a.jsx("div",{className:"p-8 text-center text-gray-500",children:"No specialist agents configured."}):N.map(S=>a.jsx(t5,{specialist:S,issueInfo:C(S.currentIssue),onSelect:()=>t(S.tmuxSession===e?null:S.tmuxSession),isSelected:S.tmuxSession===e},S.name))})]}),a.jsxs("div",{className:"bg-gray-800 rounded-lg",children:[a.jsx("div",{className:"px-4 py-3 border-b border-gray-700",children:a.jsxs("h2",{className:"font-semibold text-white flex items-center gap-2",children:[a.jsx(Aw,{className:"w-5 h-5"}),"Issue Agents (",_.length,")"]})}),a.jsx("div",{className:"divide-y divide-gray-700",children:_.length===0?a.jsxs("div",{className:"p-8 text-center text-gray-500",children:["No agents running. Use"," ",a.jsx("code",{className:"bg-gray-700 px-2 py-1 rounded",children:"/work-issue"})," to spawn one."]}):_.map(S=>{const j=u==null?void 0:u.agents.find(A=>A.agentId===S.id);return a.jsx(_5,{agent:S,health:j,onSelect:()=>t(S.id===e?null:S.id),isSelected:S.id===e},S.id)})})]})]})}async function T5(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 D5(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 L5({agentId:e}){const[t,r]=w.useState(""),n=w.useRef(null),{data:i,isLoading:s,refetch:o}=ae({queryKey:["agent-output",e],queryFn:()=>T5(e),refetchInterval:2e3}),l=ue({mutationFn:c=>D5(e,c),onSuccess:()=>{r(""),setTimeout(()=>o(),500)}});w.useEffect(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[i]);const u=c=>{c.preventDefault(),t.trim()&&l.mutate(t.trim())};return a.jsxs("div",{className:"bg-gray-800 rounded-lg flex flex-col h-[600px]",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[a.jsxs("h2",{className:"font-semibold text-white flex items-center gap-2",children:[a.jsx(bi,{className:"w-5 h-5"}),e]}),a.jsx("button",{onClick:()=>o(),className:"p-2 text-gray-400 hover:text-white hover:bg-gray-700 rounded",title:"Refresh",children:a.jsx(Sn,{className:"w-4 h-4"})})]}),a.jsx("pre",{ref:n,className:"flex-1 overflow-auto p-4 terminal-output text-gray-300 bg-gray-900",children:s?a.jsx("span",{className:"text-gray-500",children:"Loading..."}):i||a.jsx("span",{className:"text-gray-500",children:"No output yet"})}),a.jsx("form",{onSubmit:u,className:"p-3 border-t border-gray-700",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:t,onChange:c=>r(c.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"}),a.jsxs("button",{type:"submit",disabled:!t.trim()||l.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:[a.jsx(Fw,{className:"w-4 h-4"}),"Send"]})]})})]})}async function A5(){const e=await fetch("/api/health/agents");if(!e.ok)throw new Error("Failed to fetch health");return e.json()}const Ry={healthy:{icon:So,color:"text-green-400",bg:"bg-green-900/30"},warning:{icon:Tn,color:"text-yellow-400",bg:"bg-yellow-900/30"},stuck:{icon:Ha,color:"text-orange-400",bg:"bg-orange-900/30"},dead:{icon:ll,color:"text-red-400",bg:"bg-red-900/30"}};function O5(){const{data:e,isLoading:t,error:r}=ae({queryKey:["health"],queryFn:A5,refetchInterval:5e3});if(t)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"text-gray-400",children:"Loading health data..."})});if(r)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-red-400",children:["Error: ",r.message]})});if(!e||e.length===0)return a.jsxs("div",{className:"bg-gray-800 rounded-lg p-8 text-center",children:[a.jsx(bo,{className:"w-12 h-12 text-gray-600 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-gray-400",children:"No agents to monitor"}),a.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Health data will appear here when agents are running"})]});const n=e.reduce((i,s)=>(i[s.status]=(i[s.status]||0)+1,i),{});return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"grid grid-cols-4 gap-4",children:["healthy","warning","stuck","dead"].map(i=>{const s=Ry[i],o=s.icon;return a.jsx("div",{className:`${s.bg} rounded-lg p-4 border border-gray-700`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(o,{className:`w-8 h-8 ${s.color}`}),a.jsxs("div",{children:[a.jsx("div",{className:"text-2xl font-bold text-white",children:n[i]||0}),a.jsx("div",{className:"text-sm text-gray-400 capitalize",children:i})]})]})},i)})}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(i=>{const s=Ry[i.status],o=s.icon;return a.jsxs("div",{className:`${s.bg} rounded-lg p-4 border border-gray-700`,children:[a.jsx("div",{className:"flex items-start justify-between",children:a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-white",children:i.agentId}),a.jsxs("div",{className:`flex items-center gap-1 text-sm ${s.color} mt-1`,children:[a.jsx(o,{className:"w-4 h-4"}),a.jsx("span",{className:"capitalize",children:i.status})]})]})}),i.reason&&a.jsx("div",{className:"mt-2 text-sm text-gray-400 italic",children:i.reason}),a.jsxs("div",{className:"mt-4 space-y-2 text-sm",children:[i.lastPing&&a.jsxs("div",{className:"flex justify-between text-gray-400",children:[a.jsx("span",{children:"Last ping:"}),a.jsx("span",{children:new Date(i.lastPing).toLocaleTimeString()})]}),a.jsxs("div",{className:"flex justify-between text-gray-400",children:[a.jsx("span",{children:"Failures:"}),a.jsx("span",{className:i.consecutiveFailures>0?"text-orange-400":"",children:i.consecutiveFailures})]}),a.jsxs("div",{className:"flex justify-between text-gray-400",children:[a.jsx("span",{children:"Kill count:"}),a.jsx("span",{className:i.killCount>0?"text-red-400":"",children:i.killCount})]})]})]},i.agentId)})})]})}function I5(){const[e,t]=w.useState([]),[r,n]=w.useState(!0),[i,s]=w.useState(null),o=async()=>{try{n(!0);const c=await fetch("/api/skills");if(!c.ok)throw new Error("Failed to fetch skills");const h=await c.json();t(h),s(null)}catch(c){s(c instanceof Error?c.message:"Unknown error")}finally{n(!1)}};if(w.useEffect(()=>{o()},[]),r)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(Sn,{className:"w-6 h-6 text-gray-400 animate-spin"})});if(i)return a.jsxs("div",{className:"bg-red-900/20 border border-red-800 rounded-lg p-4 text-red-400",children:[a.jsx(as,{className:"w-5 h-5 inline mr-2"}),i]});const l=e.filter(c=>c.source==="panopticon"),u=e.filter(c=>c.source==="claude");return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-lg font-semibold text-white",children:"Skills"}),a.jsxs("button",{onClick:o,className:"flex items-center gap-2 px-3 py-1.5 text-sm text-gray-400 hover:text-white hover:bg-gray-700 rounded-lg transition-colors",children:[a.jsx(Sn,{className:"w-4 h-4"}),"Refresh"]})]}),e.length===0?a.jsxs("div",{className:"bg-gray-800 rounded-lg p-8 text-center text-gray-400",children:[a.jsx(vm,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),a.jsx("p",{children:"No skills found"}),a.jsx("p",{className:"text-sm mt-2",children:"Add skills to ~/.panopticon/skills/ or ~/.claude/skills/"})]}):a.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[a.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"}),a.jsxs("h3",{className:"font-medium text-white",children:["Panopticon (",l.length,")"]})]}),a.jsxs("div",{className:"space-y-2",children:[l.map(c=>a.jsx(My,{skill:c},c.path)),l.length===0&&a.jsx("p",{className:"text-gray-500 text-sm",children:"No Panopticon skills"})]})]}),a.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-purple-500"}),a.jsxs("h3",{className:"font-medium text-white",children:["Claude (",u.length,")"]})]}),a.jsxs("div",{className:"space-y-2",children:[u.map(c=>a.jsx(My,{skill:c},c.path)),u.length===0&&a.jsx("p",{className:"text-gray-500 text-sm",children:"No Claude skills"})]})]})]}),a.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[a.jsx("h3",{className:"font-medium text-white mb-2",children:"Skill Locations"}),a.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[a.jsxs("p",{children:[a.jsx("span",{className:"text-blue-400",children:"Panopticon:"})," ","~/.panopticon/skills/"]}),a.jsxs("p",{children:[a.jsx("span",{className:"text-purple-400",children:"Claude:"})," ~/.claude/skills/"]})]})]})]})}function My({skill:e}){return a.jsxs("div",{className:"bg-gray-700/50 rounded-lg p-3 hover:bg-gray-700 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Tw,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"font-medium text-white",children:e.name})]}),e.hasSkillMd?a.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-400",children:[a.jsx(Us,{className:"w-3 h-3"}),"SKILL.md"]}):a.jsxs("span",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[a.jsx(as,{className:"w-3 h-3"}),"No SKILL.md"]})]}),e.description&&a.jsx("p",{className:"mt-2 text-sm text-gray-400 line-clamp-2",children:e.description}),a.jsx("p",{className:"mt-2 text-xs text-gray-500 truncate",children:e.path})]})}function F5(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}}async function B5(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||""}function z5({agent:e,issueId:t,issueUrl:r,onClose:n}){var tr,_e;const i=Ft(),[s,o]=w.useState(""),[l,u]=w.useState(!1),[c,h]=w.useState("logs"),d=w.useRef(null),f=w.useRef(null),[p,m]=w.useState(!0),x=`tmux attach -t ${e.id}`,{data:C,refetch:y}=ae({queryKey:["agent-output",e.id],queryFn:()=>B5(e.id),refetchInterval:1e3}),{data:v}=ae({queryKey:["workspace",t],queryFn:async()=>{const ee=await fetch(`/api/workspaces/${t}`);if(!ee.ok)throw new Error("Failed to fetch workspace info");return ee.json()},refetchInterval:5e3}),{data:g}=ae({queryKey:["review-status",t],queryFn:async()=>{const ee=await fetch(`/api/workspaces/${t}/review-status`);if(!ee.ok)throw new Error("Failed to fetch review status");return ee.json()},refetchInterval:3e3}),_=ue({mutationFn:async()=>{const ee=await fetch(`/api/workspaces/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!ee.ok){const be=await ee.json();throw new Error(be.error||"Failed to start containers")}return ee.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},5e3)}}),[N,S]=w.useState(null);w.useEffect(()=>{const ee=()=>S(null);if(N)return document.addEventListener("click",ee),()=>document.removeEventListener("click",ee)},[N]);const j=ue({mutationFn:async({containerName:ee,action:be})=>{const $t=await fetch(`/api/workspaces/${t}/containers/${ee}/${be}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!$t.ok){const $r=await $t.json();throw new Error($r.error||`Failed to ${be} container`)}return $t.json()},onSuccess:()=>{S(null),setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},2e3)}}),A=(ee,be,$t)=>{ee.preventDefault(),S({x:ee.clientX,y:ee.clientY,containerName:be,isRunning:$t})},$=ue({mutationFn:async()=>{const ee=await fetch(`/api/workspaces/${t}/containerize`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!ee.ok){const be=await ee.json();throw new Error(be.error||"Failed to containerize workspace")}return ee.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},3e3)}}),z=ue({mutationFn:async()=>{const ee=await fetch(`/api/workspaces/${t}/review`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!ee.ok){const be=await ee.json();throw new Error(be.error||"Failed to start review")}return ee.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["review-status",t]})}}),I=ue({mutationFn:async()=>{const ee=await fetch(`/api/workspaces/${t}/merge`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!ee.ok){const be=await ee.json();throw new Error(be.error||"Failed to merge")}return ee.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]}),i.invalidateQueries({queryKey:["issues"]}),i.invalidateQueries({queryKey:["review-status",t]}),n()}}),P=ue({mutationFn:async()=>{const ee=await fetch(`/api/issues/${t}/close`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Closed manually"})});if(!ee.ok){const be=await ee.json();throw new Error(be.error||"Failed to close issue")}return ee.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]}),i.invalidateQueries({queryKey:["issues"]}),n()}}),R=ue({mutationFn:async()=>{const ee=await fetch(`/api/workspaces/${t}/pending`,{method:"DELETE"});if(!ee.ok)throw new Error("Failed to dismiss");return ee.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]})}}),D=ue({mutationFn:async()=>{const ee=await fetch(`/api/workspaces/${t}/clean`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!ee.ok){const be=await ee.json();throw new Error(be.error||"Failed to clean workspace")}return ee.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]})}}),L=()=>{confirm(`Clean and recreate corrupted workspace for ${t}?
455
-
456
- This will:
457
- - Remove the corrupted workspace directory
458
- - Create a fresh workspace`)&&D.mutate()},B=()=>{_.mutate()},O=()=>{$.mutate()},E=()=>{const be=(g==null?void 0:g.readyForMerge)||(g==null?void 0:g.reviewStatus)==="passed"||(g==null?void 0:g.testStatus)==="passed"?`Re-run review & test pipeline for ${t}?
459
-
460
- This will reset the current status and:
461
- - Run strict code review (review-agent)
462
- - Run tests (test-agent)
463
-
464
- MERGE button will appear when both pass.`:`Start review & test pipeline for ${t}?
465
-
466
- This will:
467
- - Run strict code review (review-agent)
468
- - Run tests (test-agent)
469
-
470
- MERGE button will appear when both pass.`;confirm(be)&&z.mutate()},F=()=>{confirm(`Merge ${t} to main?
471
-
472
- Review and tests have passed. This will:
473
- - Merge the feature branch to main
474
- - Run final verification tests
475
- - Clean up workspace`)&&I.mutate()},k=()=>{confirm(`Close ${t} without merging? This will:
476
- - Close the issue (no merge)
477
- - Stop any running agent
478
- - Remove the workspace
479
- (Feature branch is preserved for history)`)&&P.mutate()},V=ue({mutationFn:async ee=>{if(!(await fetch(`/api/agents/${e.id}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:ee})})).ok)throw new Error("Failed to send")},onSuccess:()=>{o(""),setTimeout(()=>y(),500)}}),M=ue({mutationFn:async()=>{if(!(await fetch(`/api/agents/${e.id}`,{method:"DELETE"})).ok)throw new Error("Failed to kill")},onSuccess:()=>{i.invalidateQueries({queryKey:["agents"]}),n()}}),b=w.useCallback(()=>{F5(x),u(!0),setTimeout(()=>u(!1),2e3)},[x]);w.useEffect(()=>{p&&f.current&&f.current.scrollIntoView({behavior:"auto"})},[C,p]);const H=w.useCallback(()=>{if(d.current){const{scrollTop:ee,scrollHeight:be,clientHeight:$t}=d.current,$r=be-ee-$t<50;m($r)}},[]),K=()=>{s.trim()&&V.mutate(s.trim())},X=()=>{confirm(`Kill agent ${e.id}?`)&&M.mutate()},ie=new Date(e.startedAt),de=Date.now()-ie.getTime(),me=Math.floor(de/6e4),Ze=Math.floor(me/60),er=Ze>0?`${Ze}h ${me%60}m`:`${me}m`;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex h-full bg-gray-800 border-l border-gray-700",children:[a.jsxs("div",{className:"w-64 border-r border-gray-700 flex flex-col overflow-y-auto",children:[a.jsxs("div",{className:"px-3 py-2 border-b border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex gap-0.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"0ms"}}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"150ms"}}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"300ms"}})]}),a.jsx("span",{className:"text-xs text-gray-400",children:"Agent Running"})]}),a.jsx("h2",{className:"font-mono text-sm text-white font-medium mt-1",children:e.issueId})]}),a.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:[a.jsx("div",{className:"text-gray-500 uppercase tracking-wider mb-2",children:"Agent"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Model"}),a.jsx("span",{className:"text-white",children:e.model})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Runtime"}),a.jsx("span",{className:"text-white",children:e.runtime})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Uptime"}),a.jsx("span",{className:"text-white",children:er})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Session"}),a.jsx("span",{className:"text-white font-mono text-[10px]",children:e.id})]})]})]}),e.git&&a.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:[a.jsx("div",{className:"text-gray-500 uppercase tracking-wider mb-2",children:"Git Status"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-white",children:[a.jsx(va,{className:"w-3 h-3"}),a.jsx("span",{className:"font-mono",children:e.git.branch})]}),e.git.uncommittedFiles>0&&a.jsxs("div",{className:"text-yellow-400 text-[10px] ml-4",children:[e.git.uncommittedFiles," uncommitted files"]}),a.jsx("div",{className:"text-gray-400 text-[10px] mt-1 truncate",title:e.git.latestCommit,children:e.git.latestCommit})]})]}),e.workspace&&a.jsx("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:a.jsxs("div",{className:"flex items-center gap-1.5 text-gray-400",children:[a.jsx(vm,{className:"w-3 h-3"}),a.jsx("span",{className:"font-mono truncate text-[10px]",title:e.workspace,children:e.workspace})]})}),a.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:[a.jsx("div",{className:"text-gray-500 uppercase tracking-wider mb-2",children:"Links"}),a.jsx("div",{className:"space-y-1.5",children:r&&a.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(ls,{className:"w-3 h-3"}),a.jsx("span",{children:"Linear Issue"})]})})]}),(v==null?void 0:v.corrupted)&&a.jsxs("div",{className:"px-3 py-2 border-b border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-2 text-yellow-500 mb-2",children:[a.jsx(Tn,{className:"w-4 h-4"}),a.jsx("span",{className:"text-xs font-medium",children:"Workspace Corrupted"})]}),a.jsx("p",{className:"text-xs text-gray-400 mb-2",children:v.message||"The workspace exists but is not a valid git worktree."}),a.jsx("button",{onClick:L,disabled:D.isPending,className:"flex items-center gap-1 px-2 py-1 bg-yellow-600 hover:bg-yellow-500 disabled:bg-yellow-800 text-white text-xs rounded transition-colors w-full justify-center",children:D.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-3 h-3 animate-spin"}),"Cleaning..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Clean & Recreate"]})}),D.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:D.error instanceof Error?D.error.message:"Failed to clean workspace"}),D.isSuccess&&a.jsx("div",{className:"text-xs text-green-400 bg-green-900/20 px-2 py-1 rounded mt-2",children:"Workspace cleaned! Recreating..."})]}),(v==null?void 0:v.hasDocker)&&((v==null?void 0:v.frontendUrl)||(v==null?void 0:v.apiUrl))&&a.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:[a.jsx("div",{className:"text-gray-500 uppercase tracking-wider mb-2",children:"Services"}),a.jsxs("div",{className:"space-y-1.5",children:[v.frontendUrl&&a.jsxs("a",{href:v.frontendUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(pf,{className:"w-3 h-3"}),a.jsx("span",{children:"Frontend"})]}),v.apiUrl&&a.jsxs("a",{href:v.apiUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(pf,{className:"w-3 h-3"}),a.jsx("span",{children:"API"})]})]})]}),(v==null?void 0:v.hasDocker)&&v.containers&&Object.values(v.containers).some(ee=>!ee.running)&&a.jsxs("div",{className:"px-3 py-2 border-b border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-yellow-500",children:"Some containers stopped"}),a.jsx("button",{onClick:B,disabled:_.isPending,className:"flex items-center gap-1 px-2 py-1 bg-green-600 hover:bg-green-500 disabled:bg-green-800 text-white text-xs rounded transition-colors",children:_.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-3 h-3 animate-spin"}),"Starting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Lt,{className:"w-3 h-3"}),"Start Containers"]})})]}),_.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:_.error instanceof Error?_.error.message:"Failed to start containers"})]}),(v==null?void 0:v.exists)&&!v.hasDocker&&a.jsxs("div",{className:"px-3 py-2 border-b border-gray-700",children:[a.jsx("div",{className:"text-gray-500 uppercase tracking-wider text-xs mb-2",children:"Containers"}),v.canContainerize?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-gray-500",children:"Git-only workspace"}),a.jsx("button",{onClick:O,disabled:$.isPending,className:"flex items-center gap-1 px-2 py-1 bg-purple-600 hover:bg-purple-500 disabled:bg-purple-800 text-white text-xs rounded transition-colors",children:$.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-3 h-3 animate-spin"}),"Setting up..."]}):a.jsxs(a.Fragment,{children:[a.jsx(tu,{className:"w-3 h-3"}),"Containerize"]})})]}),$.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded",children:$.error instanceof Error?$.error.message:"Failed to containerize workspace"})]}):a.jsxs("div",{className:"text-xs text-gray-400 bg-gray-800 px-2 py-2 rounded",children:[a.jsx("span",{className:"text-gray-500",children:"No Docker support."})," This workspace doesn't have container infrastructure set up yet."]})]}),(v==null?void 0:v.containers)&&Object.keys(v.containers).length>0&&a.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:[a.jsxs("div",{className:"text-gray-500 uppercase tracking-wider mb-2",children:["Containers",a.jsx("span",{className:"text-gray-600 font-normal ml-2",children:"(right-click for options)"})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(v.containers).map(([ee,be])=>{const $t=_.isPending&&!be.running,$r=j.isPending&&(N==null?void 0:N.containerName)===ee;return a.jsxs("span",{onContextMenu:Uu=>A(Uu,ee,be.running),className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] cursor-context-menu select-none ${be.running?"bg-green-900/30 text-green-400 hover:bg-green-900/50":$t||$r?"bg-yellow-900/30 text-yellow-400 animate-pulse":"bg-gray-700 text-gray-500 hover:bg-gray-600"}`,title:"Right-click for start/stop/restart options",children:[$t||$r?a.jsx(ye,{className:"w-2.5 h-2.5 animate-spin"}):ee==="postgres"||ee==="redis"?a.jsx(Ow,{className:"w-2.5 h-2.5"}):a.jsx(tu,{className:"w-2.5 h-2.5"}),ee,be.running&&be.uptime&&a.jsx("span",{className:"text-gray-400 ml-1",children:be.uptime}),($t||$r)&&a.jsx("span",{className:"text-yellow-500 ml-1",children:"..."})]},ee)})})]}),a.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:[a.jsx("div",{className:"text-gray-500 uppercase tracking-wider mb-2",children:"Attach Command"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex-1 flex items-center gap-1.5 px-2 py-1.5 bg-gray-900 rounded font-mono text-[11px] text-gray-300 overflow-hidden",children:[a.jsx(bi,{className:"w-3 h-3 shrink-0 text-blue-400"}),a.jsx("span",{className:"truncate",children:x})]}),a.jsx("button",{onClick:b,className:`p-1.5 rounded transition-colors ${l?"bg-green-900/30 text-green-400":"bg-gray-700 hover:bg-gray-600 text-gray-400 hover:text-white"}`,title:"Copy to clipboard",children:l?a.jsx(Us,{className:"w-3.5 h-3.5"}):a.jsx(Lw,{className:"w-3.5 h-3.5"})})]})]}),a.jsxs("div",{className:"px-3 py-2 border-b border-gray-700",children:[a.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider mb-2",children:"Actions"}),((tr=v==null?void 0:v.pendingOperation)==null?void 0:tr.type)==="approve"&&v.pendingOperation.status==="running"&&a.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:[a.jsx(ye,{className:"w-3 h-3 animate-spin"}),a.jsx("span",{children:"Merging in progress... (survives tab switches)"})]}),((_e=v==null?void 0:v.pendingOperation)==null?void 0:_e.status)==="failed"&&a.jsxs("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1.5 rounded mb-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-medium",children:"Operation failed"}),a.jsx("button",{onClick:()=>R.mutate(),className:"text-gray-400 hover:text-white",title:"Dismiss",children:a.jsx(Nt,{className:"w-3 h-3"})})]}),a.jsx("div",{className:"mt-1 text-gray-400 whitespace-pre-wrap",children:v.pendingOperation.error})]}),g&&(g.reviewStatus!=="pending"||g.testStatus!=="pending")&&a.jsxs("div",{className:"mb-2 p-2 bg-gray-900/50 rounded text-xs",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"text-gray-400",children:"Review:"}),a.jsx("span",{className:g.reviewStatus==="passed"?"text-green-400":g.reviewStatus==="blocked"||g.reviewStatus==="failed"?"text-red-400":g.reviewStatus==="reviewing"?"text-yellow-400":"text-gray-500",children:g.reviewStatus==="passed"?"✓ Passed":g.reviewStatus==="blocked"?"✗ Blocked":g.reviewStatus==="failed"?"✗ Failed":g.reviewStatus==="reviewing"?"⟳ Reviewing...":"Pending"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-400",children:"Tests:"}),a.jsx("span",{className:g.testStatus==="passed"?"text-green-400":g.testStatus==="failed"?"text-red-400":g.testStatus==="testing"?"text-yellow-400":"text-gray-500",children:g.testStatus==="passed"?"✓ Passed":g.testStatus==="failed"?"✗ Failed":g.testStatus==="testing"?"⟳ Testing...":g.testStatus==="skipped"?"⊘ Skipped":"Pending"})]}),g.reviewNotes&&a.jsx("div",{className:"mt-1 text-gray-400 text-xs",children:g.reviewNotes}),g.testNotes&&a.jsx("div",{className:"mt-1 text-gray-400 text-xs",children:g.testNotes})]}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[(g==null?void 0:g.readyForMerge)&&(g==null?void 0:g.mergeStatus)!=="merged"&&a.jsxs("button",{onClick:F,disabled:I.isPending||(g==null?void 0:g.mergeStatus)==="merging",className:"flex items-center gap-1 px-2 py-1 text-xs bg-green-600 text-white rounded hover:bg-green-500 disabled:opacity-50 font-medium",children:[I.isPending||(g==null?void 0:g.mergeStatus)==="merging"?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx(So,{className:"w-3 h-3"}),(g==null?void 0:g.mergeStatus)==="merging"?"MERGING...":"MERGE"]}),(g==null?void 0:g.mergeStatus)==="merged"&&a.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:[a.jsx(So,{className:"w-3 h-3"}),"MERGED"]}),a.jsxs("button",{onClick:E,disabled:z.isPending||(g==null?void 0:g.reviewStatus)==="reviewing"||(g==null?void 0:g.testStatus)==="testing",className:`flex items-center gap-1 px-2 py-1 text-xs rounded disabled:opacity-50 ${g!=null&&g.readyForMerge?"bg-gray-700/50 text-gray-300 hover:bg-gray-700":"bg-blue-900/30 text-blue-400 hover:bg-blue-900/50"}`,children:[z.isPending||(g==null?void 0:g.reviewStatus)==="reviewing"||(g==null?void 0:g.testStatus)==="testing"?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx(Sn,{className:"w-3 h-3"}),g!=null&&g.readyForMerge?"Re-Review":"Review & Test"]}),a.jsxs("button",{onClick:X,disabled:M.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:[a.jsx(Wa,{className:"w-3 h-3"}),"Stop Agent"]}),a.jsxs("button",{onClick:k,disabled:P.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:[P.isPending?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx(ll,{className:"w-3 h-3"}),"Close (No Merge)"]})]}),z.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:z.error instanceof Error?z.error.message:"Failed to start review"}),I.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:I.error instanceof Error?I.error.message:"Failed to merge"}),P.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:P.error instanceof Error?P.error.message:"Failed to close"})]}),a.jsx("div",{className:"flex-1"})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>h("logs"),className:`px-2 py-1 text-xs rounded transition-colors ${c==="logs"?"bg-gray-700 text-white":"text-gray-400 hover:text-white"}`,children:"Logs"}),a.jsx("button",{onClick:()=>h("status"),className:`px-2 py-1 text-xs rounded transition-colors ${c==="status"?"bg-gray-700 text-white":"text-gray-400 hover:text-white"}`,children:"Status"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>y(),className:"p-1 text-gray-400 hover:text-white",title:"Refresh",children:a.jsx(Sn,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:n,className:"p-1 text-gray-400 hover:text-white",children:a.jsx(Nt,{className:"w-3.5 h-3.5"})})]})]}),c==="logs"?a.jsxs(a.Fragment,{children:[a.jsxs("pre",{ref:d,onScroll:H,className:"flex-1 min-h-0 overflow-auto p-3 bg-gray-900 text-gray-200 font-mono text-xs leading-relaxed m-0 whitespace-pre",children:[C||"Connecting to agent...",a.jsx("div",{ref:f})]}),a.jsx("div",{className:"p-2 border-t border-gray-700 bg-gray-800",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:s,onChange:ee=>o(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&K(),placeholder:"Send message to agent...",className:"flex-1 px-3 py-2 bg-gray-700 border border-gray-600 rounded text-sm text-white placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500"}),a.jsxs("button",{onClick:K,disabled:!s.trim()||V.isPending,className:"px-3 py-2 bg-blue-600 text-white rounded text-sm font-medium hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[a.jsx(Fw,{className:"w-4 h-4"}),"Send"]})]})})]}):a.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 bg-gray-900",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-white mb-2",children:"Agent Summary"}),a.jsxs("div",{className:"text-xs text-gray-300 space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Issue:"})," ",e.issueId]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Session:"})," ",a.jsx("span",{className:"font-mono text-[10px]",children:e.id})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Model:"})," ",e.model]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Runtime:"})," ",e.runtime]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Started:"})," ",ie.toLocaleString()]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Uptime:"})," ",er]})]})]}),e.workspace&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-white mb-2",children:"Workspace"}),a.jsx("div",{className:"text-xs text-gray-300 space-y-1",children:a.jsx("p",{className:"font-mono text-[10px] break-all",children:e.workspace})})]}),e.git&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-white mb-2",children:"Git Status"}),a.jsxs("div",{className:"text-xs text-gray-300 space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Branch:"})," ",a.jsx("span",{className:"font-mono",children:e.git.branch})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Uncommitted:"})," ",e.git.uncommittedFiles," files"]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Latest:"})," ",e.git.latestCommit]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-white mb-2",children:"Health"}),a.jsxs("div",{className:"text-xs text-gray-300 space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Status:"})," ",a.jsx("span",{className:"text-green-400",children:e.status})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Consecutive Failures:"})," ",e.consecutiveFailures]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Total Restarts:"})," ",e.killCount]})]})]})]})})]})]}),N&&a.jsxs("div",{className:"fixed z-50 bg-gray-800 border border-gray-600 rounded shadow-lg py-1 min-w-[140px]",style:{left:N.x,top:N.y},onClick:ee=>ee.stopPropagation(),children:[a.jsx("div",{className:"px-3 py-1 text-xs text-gray-400 border-b border-gray-700 mb-1",children:N.containerName}),N.isRunning?a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>j.mutate({containerName:N.containerName,action:"restart"}),disabled:j.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-gray-200 hover:bg-gray-700 flex items-center gap-2 disabled:opacity-50",children:[a.jsx(Sn,{className:"w-3 h-3"}),"Restart"]}),a.jsxs("button",{onClick:()=>j.mutate({containerName:N.containerName,action:"stop"}),disabled:j.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-red-400 hover:bg-gray-700 flex items-center gap-2 disabled:opacity-50",children:[a.jsx(Wa,{className:"w-3 h-3"}),"Stop"]})]}):a.jsxs("button",{onClick:()=>j.mutate({containerName:N.containerName,action:"start"}),disabled:j.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-green-400 hover:bg-gray-700 flex items-center gap-2 disabled:opacity-50",children:[a.jsx(Lt,{className:"w-3 h-3"}),"Start"]}),j.isError&&a.jsx("div",{className:"px-3 py-1 text-xs text-red-400 border-t border-gray-700 mt-1",children:j.error instanceof Error?j.error.message:"Action failed"})]})]})}function $5(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const H5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,W5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,U5={};function Ty(e,t){return(U5.jsx?W5:H5).test(e)}const K5=/[ \t\n\f\r]/g;function q5(e){return typeof e=="object"?e.type==="text"?Dy(e.value):!1:Dy(e)}function Dy(e){return e.replace(K5,"")===""}class pl{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}pl.prototype.normal={};pl.prototype.property={};pl.prototype.space=void 0;function Qb(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new pl(r,n,t)}function ep(e){return e.toLowerCase()}class Zt{constructor(t,r){this.attribute=r,this.property=t}}Zt.prototype.attribute="";Zt.prototype.booleanish=!1;Zt.prototype.boolean=!1;Zt.prototype.commaOrSpaceSeparated=!1;Zt.prototype.commaSeparated=!1;Zt.prototype.defined=!1;Zt.prototype.mustUseProperty=!1;Zt.prototype.number=!1;Zt.prototype.overloadedBoolean=!1;Zt.prototype.property="";Zt.prototype.spaceSeparated=!1;Zt.prototype.space=void 0;let V5=0;const ce=vs(),Ye=vs(),tp=vs(),Q=vs(),je=vs(),Zs=vs(),or=vs();function vs(){return 2**++V5}const rp=Object.freeze(Object.defineProperty({__proto__:null,boolean:ce,booleanish:Ye,commaOrSpaceSeparated:or,commaSeparated:Zs,number:Q,overloadedBoolean:tp,spaceSeparated:je},Symbol.toStringTag,{value:"Module"})),Oh=Object.keys(rp);class Lm extends Zt{constructor(t,r,n,i){let s=-1;if(super(t,r),Ly(this,"space",i),typeof n=="number")for(;++s<Oh.length;){const o=Oh[s];Ly(this,Oh[s],(n&rp[o])===rp[o])}}}Lm.prototype.defined=!0;function Ly(e,t,r){r&&(e[t]=r)}function Mo(e){const t={},r={};for(const[n,i]of Object.entries(e.properties)){const s=new Lm(n,e.transform(e.attributes||{},n),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),t[n]=s,r[ep(n)]=n,r[ep(s.attribute)]=n}return new pl(t,r,e.space)}const Yb=Mo({properties:{ariaActiveDescendant:null,ariaAtomic:Ye,ariaAutoComplete:null,ariaBusy:Ye,ariaChecked:Ye,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:je,ariaCurrent:null,ariaDescribedBy:je,ariaDetails:null,ariaDisabled:Ye,ariaDropEffect:je,ariaErrorMessage:null,ariaExpanded:Ye,ariaFlowTo:je,ariaGrabbed:Ye,ariaHasPopup:null,ariaHidden:Ye,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:je,ariaLevel:Q,ariaLive:null,ariaModal:Ye,ariaMultiLine:Ye,ariaMultiSelectable:Ye,ariaOrientation:null,ariaOwns:je,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:Ye,ariaReadOnly:Ye,ariaRelevant:null,ariaRequired:Ye,ariaRoleDescription:je,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:Ye,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Gb(e,t){return t in e?e[t]:t}function Xb(e,t){return Gb(e,t.toLowerCase())}const Q5=Mo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Zs,acceptCharset:je,accessKey:je,action:null,allow:null,allowFullScreen:ce,allowPaymentRequest:ce,allowUserMedia:ce,alt:null,as:null,async:ce,autoCapitalize:null,autoComplete:je,autoFocus:ce,autoPlay:ce,blocking:je,capture:null,charSet:null,checked:ce,cite:null,className:je,cols:Q,colSpan:null,content:null,contentEditable:Ye,controls:ce,controlsList:je,coords:Q|Zs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ce,defer:ce,dir:null,dirName:null,disabled:ce,download:tp,draggable:Ye,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ce,formTarget:null,headers:je,height:Q,hidden:tp,high:Q,href:null,hrefLang:null,htmlFor:je,httpEquiv:je,id:null,imageSizes:null,imageSrcSet:null,inert:ce,inputMode:null,integrity:null,is:null,isMap:ce,itemId:null,itemProp:je,itemRef:je,itemScope:ce,itemType:je,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ce,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,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:Q,pattern:null,ping:je,placeholder:null,playsInline:ce,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ce,referrerPolicy:null,rel:je,required:ce,reversed:ce,rows:Q,rowSpan:Q,sandbox:je,scope:null,scoped:ce,seamless:ce,selected:ce,shadowRootClonable:ce,shadowRootDelegatesFocus:ce,shadowRootMode:null,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:Ye,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:ce,useMap:null,value:Ye,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:je,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,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:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:ce,noHref:ce,noShade:ce,noWrap:ce,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:Ye,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ce,disableRemotePlayback:ce,prefix:null,property:null,results:Q,security:null,unselectable:null},space:"html",transform:Xb}),Y5=Mo({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:or,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:je,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:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:ce,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,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:Zs,g2:Zs,glyphName:Zs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:or,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,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:Q,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:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:je,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:or,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:or,rev:or,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:or,requiredFeatures:or,requiredFonts:or,requiredFormats:or,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:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:or,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:or,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:or,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Gb}),Jb=Mo({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()}}),Zb=Mo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Xb}),eS=Mo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),G5={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"},X5=/[A-Z]/g,Ay=/-[a-z]/g,J5=/^data[-\w.:]+$/i;function Z5(e,t){const r=ep(t);let n=t,i=Zt;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&J5.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Ay,tP);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Ay.test(s)){let o=s.replace(X5,eP);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Lm}return new i(n,t)}function eP(e){return"-"+e.toLowerCase()}function tP(e){return e.charAt(1).toUpperCase()}const rP=Qb([Yb,Q5,Jb,Zb,eS],"html"),Am=Qb([Yb,Y5,Jb,Zb,eS],"svg");function nP(e){return e.join(" ").trim()}var Om={},Oy=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,iP=/\n/g,sP=/^\s*/,oP=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,aP=/^:\s*/,lP=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,cP=/^[;\s]*/,uP=/^\s+|\s+$/g,hP=`
480
- `,Iy="/",Fy="*",Oi="",dP="comment",fP="declaration";function pP(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,n=1;function i(m){var x=m.match(iP);x&&(r+=x.length);var C=m.lastIndexOf(hP);n=~C?m.length-C:n+m.length}function s(){var m={line:r,column:n};return function(x){return x.position=new o(m),c(),x}}function o(m){this.start=m,this.end={line:r,column:n},this.source=t.source}o.prototype.content=e;function l(m){var x=new Error(t.source+":"+r+":"+n+": "+m);if(x.reason=m,x.filename=t.source,x.line=r,x.column=n,x.source=e,!t.silent)throw x}function u(m){var x=m.exec(e);if(x){var C=x[0];return i(C),e=e.slice(C.length),x}}function c(){u(sP)}function h(m){var x;for(m=m||[];x=d();)x!==!1&&m.push(x);return m}function d(){var m=s();if(!(Iy!=e.charAt(0)||Fy!=e.charAt(1))){for(var x=2;Oi!=e.charAt(x)&&(Fy!=e.charAt(x)||Iy!=e.charAt(x+1));)++x;if(x+=2,Oi===e.charAt(x-1))return l("End of comment missing");var C=e.slice(2,x-2);return n+=2,i(C),e=e.slice(x),n+=2,m({type:dP,comment:C})}}function f(){var m=s(),x=u(oP);if(x){if(d(),!u(aP))return l("property missing ':'");var C=u(lP),y=m({type:fP,property:By(x[0].replace(Oy,Oi)),value:C?By(C[0].replace(Oy,Oi)):Oi});return u(cP),y}}function p(){var m=[];h(m);for(var x;x=f();)x!==!1&&(m.push(x),h(m));return m}return c(),p()}function By(e){return e?e.replace(uP,Oi):Oi}var mP=pP,gP=jc&&jc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Om,"__esModule",{value:!0});Om.default=vP;const yP=gP(mP);function vP(e,t){let r=null;if(!e||typeof e!="string")return r;const n=(0,yP.default)(e),i=typeof t=="function";return n.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;i?t(o,l,s):l&&(r=r||{},r[o]=l)}),r}var Ou={};Object.defineProperty(Ou,"__esModule",{value:!0});Ou.camelCase=void 0;var xP=/^--[a-zA-Z0-9_-]+$/,_P=/-([a-z])/g,wP=/^[^-]+$/,bP=/^-(webkit|moz|ms|o|khtml)-/,SP=/^-(ms)-/,CP=function(e){return!e||wP.test(e)||xP.test(e)},kP=function(e,t){return t.toUpperCase()},zy=function(e,t){return"".concat(t,"-")},NP=function(e,t){return t===void 0&&(t={}),CP(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(SP,zy):e=e.replace(bP,zy),e.replace(_P,kP))};Ou.camelCase=NP;var EP=jc&&jc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},jP=EP(Om),PP=Ou;function np(e,t){var r={};return!e||typeof e!="string"||(0,jP.default)(e,function(n,i){n&&i&&(r[(0,PP.camelCase)(n,t)]=i)}),r}np.default=np;var RP=np;const MP=rl(RP),tS=rS("end"),Im=rS("start");function rS(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function TP(e){const t=Im(e),r=tS(e);if(t&&r)return{start:t,end:r}}function _a(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?$y(e.position):"start"in e||"end"in e?$y(e):"line"in e||"column"in e?ip(e):""}function ip(e){return Hy(e&&e.line)+":"+Hy(e&&e.column)}function $y(e){return ip(e&&e.start)+"-"+ip(e&&e.end)}function Hy(e){return e&&typeof e=="number"?e:1}class jt extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof n=="string"){const u=n.indexOf(":");u===-1?s.ruleId=n:(s.source=n.slice(0,u),s.ruleId=n.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=_a(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}jt.prototype.file="";jt.prototype.name="";jt.prototype.reason="";jt.prototype.message="";jt.prototype.stack="";jt.prototype.column=void 0;jt.prototype.line=void 0;jt.prototype.ancestors=void 0;jt.prototype.cause=void 0;jt.prototype.fatal=void 0;jt.prototype.place=void 0;jt.prototype.ruleId=void 0;jt.prototype.source=void 0;const Fm={}.hasOwnProperty,DP=new Map,LP=/[A-Z]/g,AP=new Set(["table","tbody","thead","tfoot","tr"]),OP=new Set(["td","th"]),nS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function IP(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=KP(r,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");n=UP(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Am:rP,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=iS(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function iS(e,t,r){if(t.type==="element")return FP(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return BP(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return $P(e,t,r);if(t.type==="mdxjsEsm")return zP(e,t);if(t.type==="root")return HP(e,t,r);if(t.type==="text")return WP(e,t)}function FP(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Am,e.schema=i),e.ancestors.push(t);const s=oS(e,t.tagName,!1),o=qP(e,t);let l=zm(e,t);return AP.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!q5(u):!0})),sS(e,o,s,t),Bm(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function BP(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Qa(e,t.position)}function zP(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Qa(e,t.position)}function $P(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=Am,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:oS(e,t.name,!0),o=VP(e,t),l=zm(e,t);return sS(e,o,s,t),Bm(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function HP(e,t,r){const n={};return Bm(n,zm(e,t)),e.create(t,e.Fragment,n,r)}function WP(e,t){return t.value}function sS(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function Bm(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function UP(e,t,r){return n;function n(i,s,o,l){const c=Array.isArray(o.children)?r:t;return l?c(s,o,l):c(s,o)}}function KP(e,t){return r;function r(n,i,s,o){const l=Array.isArray(s.children),u=Im(n);return t(i,s,o,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function qP(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&Fm.call(t.properties,i)){const s=QP(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&OP.has(t.tagName)?n=l:r[o]=l}}if(n){const s=r.style||(r.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function VP(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const s=n.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,e.evaluater.evaluateExpression(l.argument))}else Qa(e,t.position);else{const i=n.name;let s;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const l=n.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else Qa(e,t.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function zm(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:DP;for(;++n<t.children.length;){const s=t.children[n];let o;if(e.passKeys){const u=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(u){const c=i.get(u)||0;o=u+"-"+c,i.set(u,c+1)}}const l=iS(e,s,o);l!==void 0&&r.push(l)}return r}function QP(e,t,r){const n=Z5(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?$5(r):nP(r)),n.property==="style"){let i=typeof r=="object"?r:YP(e,String(r));return e.stylePropertyNameCase==="css"&&(i=GP(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&n.space?G5[n.property]||n.property:n.attribute,r]}}function YP(e,t){try{return MP(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,i=new jt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=nS+"#cannot-parse-style-attribute",i}}function oS(e,t,r){let n;if(!r)n={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const l=Ty(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}n=o}else n=Ty(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const i=n.value;return Fm.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(n);Qa(e)}function Qa(e,t){const r=new jt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=nS+"#cannot-handle-mdx-estrees-without-createevaluater",r}function GP(e){const t={};let r;for(r in e)Fm.call(e,r)&&(t[XP(r)]=e[r]);return t}function XP(e){let t=e.replace(LP,JP);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function JP(e){return"-"+e.toLowerCase()}const Ih={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"]},ZP={};function eR(e,t){const r=ZP,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return aS(e,n,i)}function aS(e,t,r){if(tR(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Wy(e.children,t,r)}return Array.isArray(e)?Wy(e,t,r):""}function Wy(e,t,r){const n=[];let i=-1;for(;++i<e.length;)n[i]=aS(e[i],t,r);return n.join("")}function tR(e){return!!(e&&typeof e=="object")}const Uy=document.createElement("i");function $m(e){const t="&"+e+";";Uy.innerHTML=t;const r=Uy.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function an(e,t,r,n){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function br(e,t){return e.length>0?(an(e,e.length,0,t),e):t}const Ky={}.hasOwnProperty;function rR(e){const t={};let r=-1;for(;++r<e.length;)nR(t,e[r]);return t}function nR(e,t){let r;for(r in t){const i=(Ky.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];let o;if(s)for(o in s){Ky.call(i,o)||(i[o]=[]);const l=s[o];iR(i[o],Array.isArray(l)?l:l?[l]:[])}}}function iR(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);an(e,0,0,n)}function lS(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function eo(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Zr=ji(/[A-Za-z]/),cr=ji(/[\dA-Za-z]/),sR=ji(/[#-'*+\--9=?A-Z^-~]/);function sp(e){return e!==null&&(e<32||e===127)}const op=ji(/\d/),oR=ji(/[\dA-Fa-f]/),aR=ji(/[!-/:-@[-`{-~]/);function oe(e){return e!==null&&e<-2}function Jt(e){return e!==null&&(e<0||e===32)}function Se(e){return e===-2||e===-1||e===32}const lR=ji(new RegExp("\\p{P}|\\p{S}","u")),cR=ji(/\s/);function ji(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function To(e){const t=[];let r=-1,n=0,i=0;for(;++r<e.length;){const s=e.charCodeAt(r);let o="";if(s===37&&cr(e.charCodeAt(r+1))&&cr(e.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(r+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function Re(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(u){return Se(u)?(e.enter(r),l(u)):t(u)}function l(u){return Se(u)&&s++<i?(e.consume(u),l):(e.exit(r),t(u))}}const uR={tokenize:hR};function hR(e){const t=e.attempt(this.parser.constructs.contentInitial,n,i);let r;return t;function n(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Re(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),s(l)}function s(l){const u=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=u),r=u,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return oe(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const dR={tokenize:fR},qy={tokenize:pR};function fR(e){const t=this,r=[];let n=0,i,s,o;return l;function l(g){if(n<r.length){const _=r[n];return t.containerState=_[1],e.attempt(_[0].continuation,u,c)(g)}return c(g)}function u(g){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const _=t.events.length;let N=_,S;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){S=t.events[N][1].end;break}y(n);let j=_;for(;j<t.events.length;)t.events[j][1].end={...S},j++;return an(t.events,N+1,0,t.events.slice(_)),t.events.length=j,c(g)}return l(g)}function c(g){if(n===r.length){if(!i)return f(g);if(i.currentConstruct&&i.currentConstruct.concrete)return m(g);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(qy,h,d)(g)}function h(g){return i&&v(),y(n),f(g)}function d(g){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,m(g)}function f(g){return t.containerState={},e.attempt(qy,p,m)(g)}function p(g){return n++,r.push([t.currentConstruct,t.containerState]),f(g)}function m(g){if(g===null){i&&v(),y(0),e.consume(g);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),x(g)}function x(g){if(g===null){C(e.exit("chunkFlow"),!0),y(0),e.consume(g);return}return oe(g)?(e.consume(g),C(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(g),x)}function C(g,_){const N=t.sliceStream(g);if(_&&N.push(null),g.previous=s,s&&(s.next=g),s=g,i.defineSkip(g.start),i.write(N),t.parser.lazy[g.start.line]){let S=i.events.length;for(;S--;)if(i.events[S][1].start.offset<o&&(!i.events[S][1].end||i.events[S][1].end.offset>o))return;const j=t.events.length;let A=j,$,z;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if($){z=t.events[A][1].end;break}$=!0}for(y(n),S=j;S<t.events.length;)t.events[S][1].end={...z},S++;an(t.events,A+1,0,t.events.slice(j)),t.events.length=S}}function y(g){let _=r.length;for(;_-- >g;){const N=r[_];t.containerState=N[1],N[0].exit.call(t,e)}r.length=g}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function pR(e,t,r){return Re(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Vy(e){if(e===null||Jt(e)||cR(e))return 1;if(lR(e))return 2}function Hm(e,t,r){const n=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!n.includes(s)&&(t=s(t,r),n.push(s))}return t}const ap={name:"attention",resolveAll:mR,tokenize:gR};function mR(e,t){let r=-1,n,i,s,o,l,u,c,h;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(n=r;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[n][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;u=e[n][1].end.offset-e[n][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const d={...e[n][1].end},f={...e[r][1].start};Qy(d,-u),Qy(f,u),o={type:u>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:f},s={type:u>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:u>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[n][1].end={...o.start},e[r][1].start={...l.end},c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=br(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=br(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=br(c,Hm(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=br(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(h=2,c=br(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):h=0,an(e,n-1,r-n+3,c),r=n+c.length-h-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function gR(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=Vy(n);let s;return o;function o(u){return s=u,e.enter("attentionSequence"),l(u)}function l(u){if(u===s)return e.consume(u),l;const c=e.exit("attentionSequence"),h=Vy(u),d=!h||h===2&&i||r.includes(u),f=!i||i===2&&h||r.includes(n);return c._open=!!(s===42?d:d&&(i||!f)),c._close=!!(s===42?f:f&&(h||!d)),t(u)}}function Qy(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const yR={name:"autolink",tokenize:vR};function vR(e,t,r){let n=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return Zr(p)?(e.consume(p),o):p===64?r(p):c(p)}function o(p){return p===43||p===45||p===46||cr(p)?(n=1,l(p)):c(p)}function l(p){return p===58?(e.consume(p),n=0,u):(p===43||p===45||p===46||cr(p))&&n++<32?(e.consume(p),l):(n=0,c(p))}function u(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||sp(p)?r(p):(e.consume(p),u)}function c(p){return p===64?(e.consume(p),h):sR(p)?(e.consume(p),c):r(p)}function h(p){return cr(p)?d(p):r(p)}function d(p){return p===46?(e.consume(p),n=0,h):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||cr(p))&&n++<63){const m=p===45?f:d;return e.consume(p),m}return r(p)}}const Iu={partial:!0,tokenize:xR};function xR(e,t,r){return n;function n(s){return Se(s)?Re(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||oe(s)?t(s):r(s)}}const cS={continuation:{tokenize:wR},exit:bR,name:"blockQuote",tokenize:_R};function _R(e,t,r){const n=this;return i;function i(o){if(o===62){const l=n.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return r(o)}function s(o){return Se(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function wR(e,t,r){const n=this;return i;function i(o){return Se(o)?Re(e,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(cS,t,r)(o)}}function bR(e){e.exit("blockQuote")}const uS={name:"characterEscape",tokenize:SR};function SR(e,t,r){return n;function n(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return aR(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(s)}}const hS={name:"characterReference",tokenize:CR};function CR(e,t,r){const n=this;let i=0,s,o;return l;function l(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),u}function u(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=cr,h(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=oR,h):(e.enter("characterReferenceValue"),s=7,o=op,h(d))}function h(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return o===cr&&!$m(n.sliceSerialize(f))?r(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&i++<s?(e.consume(d),h):r(d)}}const Yy={partial:!0,tokenize:NR},Gy={concrete:!0,name:"codeFenced",tokenize:kR};function kR(e,t,r){const n=this,i={partial:!0,tokenize:N};let s=0,o=0,l;return u;function u(S){return c(S)}function c(S){const j=n.events[n.events.length-1];return s=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,l=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(S)}function h(S){return S===l?(o++,e.consume(S),h):o<3?r(S):(e.exit("codeFencedFenceSequence"),Se(S)?Re(e,d,"whitespace")(S):d(S))}function d(S){return S===null||oe(S)?(e.exit("codeFencedFence"),n.interrupt?t(S):e.check(Yy,x,_)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(S))}function f(S){return S===null||oe(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(S)):Se(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Re(e,p,"whitespace")(S)):S===96&&S===l?r(S):(e.consume(S),f)}function p(S){return S===null||oe(S)?d(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||oe(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(S)):S===96&&S===l?r(S):(e.consume(S),m)}function x(S){return e.attempt(i,_,C)(S)}function C(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),y}function y(S){return s>0&&Se(S)?Re(e,v,"linePrefix",s+1)(S):v(S)}function v(S){return S===null||oe(S)?e.check(Yy,x,_)(S):(e.enter("codeFlowValue"),g(S))}function g(S){return S===null||oe(S)?(e.exit("codeFlowValue"),v(S)):(e.consume(S),g)}function _(S){return e.exit("codeFenced"),t(S)}function N(S,j,A){let $=0;return z;function z(L){return S.enter("lineEnding"),S.consume(L),S.exit("lineEnding"),I}function I(L){return S.enter("codeFencedFence"),Se(L)?Re(S,P,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):P(L)}function P(L){return L===l?(S.enter("codeFencedFenceSequence"),R(L)):A(L)}function R(L){return L===l?($++,S.consume(L),R):$>=o?(S.exit("codeFencedFenceSequence"),Se(L)?Re(S,D,"whitespace")(L):D(L)):A(L)}function D(L){return L===null||oe(L)?(S.exit("codeFencedFence"),j(L)):A(L)}}}function NR(e,t,r){const n=this;return i;function i(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}const Fh={name:"codeIndented",tokenize:jR},ER={partial:!0,tokenize:PR};function jR(e,t,r){const n=this;return i;function i(c){return e.enter("codeIndented"),Re(e,s,"linePrefix",5)(c)}function s(c){const h=n.events[n.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?u(c):oe(c)?e.attempt(ER,o,u)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||oe(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function u(c){return e.exit("codeIndented"),t(c)}}function PR(e,t,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):oe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Re(e,s,"linePrefix",5)(o)}function s(o){const l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):oe(o)?i(o):r(o)}}const RR={name:"codeText",previous:TR,resolve:MR,tokenize:DR};function MR(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)i===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(i=n):(n===t||e[n][1].type==="lineEnding")&&(e[i][1].type="codeTextData",n!==i+2&&(e[i][1].end=e[n-1][1].end,e.splice(i+2,n-i-2),t-=n-i-2,n=i+2),i=void 0);return e}function TR(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function DR(e,t,r){let n=0,i,s;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),l(d)}function l(d){return d===96?(e.consume(d),n++,l):(e.exit("codeTextSequence"),u(d))}function u(d){return d===null?r(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),u):d===96?(s=e.enter("codeTextSequence"),i=0,h(d)):oe(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||oe(d)?(e.exit("codeTextData"),u(d)):(e.consume(d),c)}function h(d){return d===96?(e.consume(d),i++,h):i===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(s.type="codeTextData",c(d))}}class LR{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,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const i=r||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&Go(this.left,n),s.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),Go(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Go(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 r=this.left.splice(t,Number.POSITIVE_INFINITY);Go(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Go(this.left,r.reverse())}}}function Go(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function dS(e){const t={};let r=-1,n,i,s,o,l,u,c;const h=new LR(e);for(;++r<h.length;){for(;r in t;)r=t[r];if(n=h.get(r),r&&n[1].type==="chunkFlow"&&h.get(r-1)[1].type==="listItemPrefix"&&(u=n[1]._tokenizer.events,s=0,s<u.length&&u[s][1].type==="lineEndingBlank"&&(s+=2),s<u.length&&u[s][1].type==="content"))for(;++s<u.length&&u[s][1].type!=="content";)u[s][1].type==="chunkText"&&(u[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,AR(h,r)),r=t[r],c=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=h.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(n[1].end={...h.get(i)[1].start},l=h.slice(i,r),l.unshift(n),h.splice(i,r-i+1,l))}}return an(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function AR(e,t){const r=e.get(t)[1],n=e.get(t)[2];let i=t-1;const s=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,u=[],c={};let h,d,f=-1,p=r,m=0,x=0;const C=[x];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(h=n.sliceStream(p),p.next||h.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(h),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=r;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(x=f+1,C.push(x),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):C.pop(),f=C.length;f--;){const y=l.slice(C[f],C[f+1]),v=s.pop();u.push([v,v+y.length-1]),e.splice(v,2,y)}for(u.reverse(),f=-1;++f<u.length;)c[m+u[f][0]]=m+u[f][1],m+=u[f][1]-u[f][0]-1;return c}const OR={resolve:FR,tokenize:BR},IR={partial:!0,tokenize:zR};function FR(e){return dS(e),e}function BR(e,t){let r;return n;function n(l){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):oe(l)?e.check(IR,o,s)(l):(e.consume(l),i)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function zR(e,t,r){const n=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Re(e,s,"linePrefix")}function s(o){if(o===null||oe(o))return r(o);const l=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(n.parser.constructs.flow,r,t)(o)}}function fS(e,t,r,n,i,s,o,l,u){const c=u||Number.POSITIVE_INFINITY;let h=0;return d;function d(y){return y===60?(e.enter(n),e.enter(i),e.enter(s),e.consume(y),e.exit(s),f):y===null||y===32||y===41||sp(y)?r(y):(e.enter(n),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),x(y))}function f(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(i),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(l),f(y)):y===null||y===60||oe(y)?r(y):(e.consume(y),y===92?m:p)}function m(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function x(y){return!h&&(y===null||y===41||Jt(y))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(n),t(y)):h<c&&y===40?(e.consume(y),h++,x):y===41?(e.consume(y),h--,x):y===null||y===32||y===40||sp(y)?r(y):(e.consume(y),y===92?C:x)}function C(y){return y===40||y===41||y===92?(e.consume(y),x):x(y)}}function pS(e,t,r,n,i,s){const o=this;let l=0,u;return c;function c(p){return e.enter(n),e.enter(i),e.consume(p),e.exit(i),e.enter(s),h}function h(p){return l>999||p===null||p===91||p===93&&!u||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(n),t):oe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||oe(p)||l++>999?(e.exit("chunkString"),h(p)):(e.consume(p),u||(u=!Se(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),l++,d):d(p)}}function mS(e,t,r,n,i,s){let o;return l;function l(f){return f===34||f===39||f===40?(e.enter(n),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,u):r(f)}function u(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(n),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),u(o)):f===null?r(f):oe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Re(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===o||f===null||oe(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:h)}function d(f){return f===o||f===92?(e.consume(f),h):h(f)}}function wa(e,t){let r;return n;function n(i){return oe(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):Se(i)?Re(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const $R={name:"definition",tokenize:WR},HR={partial:!0,tokenize:UR};function WR(e,t,r){const n=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return pS.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=eo(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):r(p)}function u(p){return Jt(p)?wa(e,c)(p):c(p)}function c(p){return fS(e,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function h(p){return e.attempt(HR,d,d)(p)}function d(p){return Se(p)?Re(e,f,"whitespace")(p):f(p)}function f(p){return p===null||oe(p)?(e.exit("definition"),n.parser.defined.push(i),t(p)):r(p)}}function UR(e,t,r){return n;function n(l){return Jt(l)?wa(e,i)(l):r(l)}function i(l){return mS(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Se(l)?Re(e,o,"whitespace")(l):o(l)}function o(l){return l===null||oe(l)?t(l):r(l)}}const KR={name:"hardBreakEscape",tokenize:qR};function qR(e,t,r){return n;function n(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return oe(s)?(e.exit("hardBreakEscape"),t(s)):r(s)}}const VR={name:"headingAtx",resolve:QR,tokenize:YR};function QR(e,t){let r=e.length-2,n=3,i,s;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},s={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},an(e,n,r-n+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function YR(e,t,r){let n=0;return i;function i(h){return e.enter("atxHeading"),s(h)}function s(h){return e.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&n++<6?(e.consume(h),o):h===null||Jt(h)?(e.exit("atxHeadingSequence"),l(h)):r(h)}function l(h){return h===35?(e.enter("atxHeadingSequence"),u(h)):h===null||oe(h)?(e.exit("atxHeading"),t(h)):Se(h)?Re(e,l,"whitespace")(h):(e.enter("atxHeadingText"),c(h))}function u(h){return h===35?(e.consume(h),u):(e.exit("atxHeadingSequence"),l(h))}function c(h){return h===null||h===35||Jt(h)?(e.exit("atxHeadingText"),l(h)):(e.consume(h),c)}}const GR=["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"],Xy=["pre","script","style","textarea"],XR={concrete:!0,name:"htmlFlow",resolveTo:eM,tokenize:tM},JR={partial:!0,tokenize:nM},ZR={partial:!0,tokenize:rM};function eM(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 tM(e,t,r){const n=this;let i,s,o,l,u;return c;function c(b){return h(b)}function h(b){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(b),d}function d(b){return b===33?(e.consume(b),f):b===47?(e.consume(b),s=!0,x):b===63?(e.consume(b),i=3,n.interrupt?t:k):Zr(b)?(e.consume(b),o=String.fromCharCode(b),C):r(b)}function f(b){return b===45?(e.consume(b),i=2,p):b===91?(e.consume(b),i=5,l=0,m):Zr(b)?(e.consume(b),i=4,n.interrupt?t:k):r(b)}function p(b){return b===45?(e.consume(b),n.interrupt?t:k):r(b)}function m(b){const H="CDATA[";return b===H.charCodeAt(l++)?(e.consume(b),l===H.length?n.interrupt?t:P:m):r(b)}function x(b){return Zr(b)?(e.consume(b),o=String.fromCharCode(b),C):r(b)}function C(b){if(b===null||b===47||b===62||Jt(b)){const H=b===47,K=o.toLowerCase();return!H&&!s&&Xy.includes(K)?(i=1,n.interrupt?t(b):P(b)):GR.includes(o.toLowerCase())?(i=6,H?(e.consume(b),y):n.interrupt?t(b):P(b)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(b):s?v(b):g(b))}return b===45||cr(b)?(e.consume(b),o+=String.fromCharCode(b),C):r(b)}function y(b){return b===62?(e.consume(b),n.interrupt?t:P):r(b)}function v(b){return Se(b)?(e.consume(b),v):z(b)}function g(b){return b===47?(e.consume(b),z):b===58||b===95||Zr(b)?(e.consume(b),_):Se(b)?(e.consume(b),g):z(b)}function _(b){return b===45||b===46||b===58||b===95||cr(b)?(e.consume(b),_):N(b)}function N(b){return b===61?(e.consume(b),S):Se(b)?(e.consume(b),N):g(b)}function S(b){return b===null||b===60||b===61||b===62||b===96?r(b):b===34||b===39?(e.consume(b),u=b,j):Se(b)?(e.consume(b),S):A(b)}function j(b){return b===u?(e.consume(b),u=null,$):b===null||oe(b)?r(b):(e.consume(b),j)}function A(b){return b===null||b===34||b===39||b===47||b===60||b===61||b===62||b===96||Jt(b)?N(b):(e.consume(b),A)}function $(b){return b===47||b===62||Se(b)?g(b):r(b)}function z(b){return b===62?(e.consume(b),I):r(b)}function I(b){return b===null||oe(b)?P(b):Se(b)?(e.consume(b),I):r(b)}function P(b){return b===45&&i===2?(e.consume(b),B):b===60&&i===1?(e.consume(b),O):b===62&&i===4?(e.consume(b),V):b===63&&i===3?(e.consume(b),k):b===93&&i===5?(e.consume(b),F):oe(b)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(JR,M,R)(b)):b===null||oe(b)?(e.exit("htmlFlowData"),R(b)):(e.consume(b),P)}function R(b){return e.check(ZR,D,M)(b)}function D(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),L}function L(b){return b===null||oe(b)?R(b):(e.enter("htmlFlowData"),P(b))}function B(b){return b===45?(e.consume(b),k):P(b)}function O(b){return b===47?(e.consume(b),o="",E):P(b)}function E(b){if(b===62){const H=o.toLowerCase();return Xy.includes(H)?(e.consume(b),V):P(b)}return Zr(b)&&o.length<8?(e.consume(b),o+=String.fromCharCode(b),E):P(b)}function F(b){return b===93?(e.consume(b),k):P(b)}function k(b){return b===62?(e.consume(b),V):b===45&&i===2?(e.consume(b),k):P(b)}function V(b){return b===null||oe(b)?(e.exit("htmlFlowData"),M(b)):(e.consume(b),V)}function M(b){return e.exit("htmlFlow"),t(b)}}function rM(e,t,r){const n=this;return i;function i(o){return oe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}function nM(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Iu,t,r)}}const iM={name:"htmlText",tokenize:sM};function sM(e,t,r){const n=this;let i,s,o;return l;function l(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),u}function u(k){return k===33?(e.consume(k),c):k===47?(e.consume(k),N):k===63?(e.consume(k),g):Zr(k)?(e.consume(k),A):r(k)}function c(k){return k===45?(e.consume(k),h):k===91?(e.consume(k),s=0,m):Zr(k)?(e.consume(k),v):r(k)}function h(k){return k===45?(e.consume(k),p):r(k)}function d(k){return k===null?r(k):k===45?(e.consume(k),f):oe(k)?(o=d,O(k)):(e.consume(k),d)}function f(k){return k===45?(e.consume(k),p):d(k)}function p(k){return k===62?B(k):k===45?f(k):d(k)}function m(k){const V="CDATA[";return k===V.charCodeAt(s++)?(e.consume(k),s===V.length?x:m):r(k)}function x(k){return k===null?r(k):k===93?(e.consume(k),C):oe(k)?(o=x,O(k)):(e.consume(k),x)}function C(k){return k===93?(e.consume(k),y):x(k)}function y(k){return k===62?B(k):k===93?(e.consume(k),y):x(k)}function v(k){return k===null||k===62?B(k):oe(k)?(o=v,O(k)):(e.consume(k),v)}function g(k){return k===null?r(k):k===63?(e.consume(k),_):oe(k)?(o=g,O(k)):(e.consume(k),g)}function _(k){return k===62?B(k):g(k)}function N(k){return Zr(k)?(e.consume(k),S):r(k)}function S(k){return k===45||cr(k)?(e.consume(k),S):j(k)}function j(k){return oe(k)?(o=j,O(k)):Se(k)?(e.consume(k),j):B(k)}function A(k){return k===45||cr(k)?(e.consume(k),A):k===47||k===62||Jt(k)?$(k):r(k)}function $(k){return k===47?(e.consume(k),B):k===58||k===95||Zr(k)?(e.consume(k),z):oe(k)?(o=$,O(k)):Se(k)?(e.consume(k),$):B(k)}function z(k){return k===45||k===46||k===58||k===95||cr(k)?(e.consume(k),z):I(k)}function I(k){return k===61?(e.consume(k),P):oe(k)?(o=I,O(k)):Se(k)?(e.consume(k),I):$(k)}function P(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(e.consume(k),i=k,R):oe(k)?(o=P,O(k)):Se(k)?(e.consume(k),P):(e.consume(k),D)}function R(k){return k===i?(e.consume(k),i=void 0,L):k===null?r(k):oe(k)?(o=R,O(k)):(e.consume(k),R)}function D(k){return k===null||k===34||k===39||k===60||k===61||k===96?r(k):k===47||k===62||Jt(k)?$(k):(e.consume(k),D)}function L(k){return k===47||k===62||Jt(k)?$(k):r(k)}function B(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):r(k)}function O(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),E}function E(k){return Se(k)?Re(e,F,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):F(k)}function F(k){return e.enter("htmlTextData"),o(k)}}const Wm={name:"labelEnd",resolveAll:cM,resolveTo:uM,tokenize:hM},oM={tokenize:dM},aM={tokenize:fM},lM={tokenize:pM};function cM(e){let t=-1;const r=[];for(;++t<e.length;){const n=e[t][1];if(r.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const i=n.type==="labelImage"?4:2;n.type="data",t+=i}}return e.length!==r.length&&an(e,0,e.length,r),e}function uM(e,t){let r=e.length,n=0,i,s,o,l;for(;r--;)if(i=e[r][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);const u={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},h={type:"labelText",start:{...e[s+n+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",u,t],["enter",c,t]],l=br(l,e.slice(s+1,s+n+3)),l=br(l,[["enter",h,t]]),l=br(l,Hm(t.parser.constructs.insideSpan.null,e.slice(s+n+4,o-3),t)),l=br(l,[["exit",h,t],e[o-2],e[o-1],["exit",c,t]]),l=br(l,e.slice(o+1)),l=br(l,[["exit",u,t]]),an(e,s,e.length,l),e}function hM(e,t,r){const n=this;let i=n.events.length,s,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){s=n.events[i][1];break}return l;function l(f){return s?s._inactive?d(f):(o=n.parser.defined.includes(eo(n.sliceSerialize({start:s.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),u):r(f)}function u(f){return f===40?e.attempt(oM,h,o?h:d)(f):f===91?e.attempt(aM,h,o?c:d)(f):o?h(f):d(f)}function c(f){return e.attempt(lM,h,d)(f)}function h(f){return t(f)}function d(f){return s._balanced=!0,r(f)}}function dM(e,t,r){return n;function n(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return Jt(d)?wa(e,s)(d):s(d)}function s(d){return d===41?h(d):fS(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Jt(d)?wa(e,u)(d):h(d)}function l(d){return r(d)}function u(d){return d===34||d===39||d===40?mS(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):h(d)}function c(d){return Jt(d)?wa(e,h)(d):h(d)}function h(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):r(d)}}function fM(e,t,r){const n=this;return i;function i(l){return pS.call(n,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return n.parser.defined.includes(eo(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function pM(e,t,r){return n;function n(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):r(s)}}const mM={name:"labelStartImage",resolveAll:Wm.resolveAll,tokenize:gM};function gM(e,t,r){const n=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(l):t(l)}}const yM={name:"labelStartLink",resolveAll:Wm.resolveAll,tokenize:vM};function vM(e,t,r){const n=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):t(o)}}const Bh={name:"lineEnding",tokenize:xM};function xM(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Re(e,t,"linePrefix")}}const Cc={name:"thematicBreak",tokenize:_M};function _M(e,t,r){let n=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,l(c)}function l(c){return c===i?(e.enter("thematicBreakSequence"),u(c)):n>=3&&(c===null||oe(c))?(e.exit("thematicBreak"),t(c)):r(c)}function u(c){return c===i?(e.consume(c),n++,u):(e.exit("thematicBreakSequence"),Se(c)?Re(e,l,"whitespace")(c):l(c))}}const Ut={continuation:{tokenize:CM},exit:NM,name:"list",tokenize:SM},wM={partial:!0,tokenize:EM},bM={partial:!0,tokenize:kM};function SM(e,t,r){const n=this,i=n.events[n.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(p){const m=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:op(p)){if(n.containerState.type||(n.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Cc,r,c)(p):c(p);if(!n.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return r(p)}function u(p){return op(p)&&++o<10?(e.consume(p),u):(!n.interrupt||o<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):r(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,e.check(Iu,n.interrupt?r:h,e.attempt(wM,f,d))}function h(p){return n.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return Se(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):r(p)}function f(p){return n.containerState.size=s+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function CM(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(Iu,i,s);function i(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Re(e,t,"listItemIndent",n.containerState.size+1)(l)}function s(l){return n.containerState.furtherBlankLines||!Se(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(bM,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Re(e,e.attempt(Ut,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function kM(e,t,r){const n=this;return Re(e,i,"listItemIndent",n.containerState.size+1);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?t(s):r(s)}}function NM(e){e.exit(this.containerState.type)}function EM(e,t,r){const n=this;return Re(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=n.events[n.events.length-1];return!Se(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):r(s)}}const Jy={name:"setextUnderline",resolveTo:jM,tokenize:PM};function jM(e,t){let r=e.length,n,i,s;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!s&&e[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[n][1],t]),e[n][1].end={...e[s][1].end}):e[n][1]=o,e.push(["exit",o,t]),e}function PM(e,t,r){const n=this;let i;return s;function s(c){let h=n.events.length,d;for(;h--;)if(n.events[h][1].type!=="lineEnding"&&n.events[h][1].type!=="linePrefix"&&n.events[h][1].type!=="content"){d=n.events[h][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(e.enter("setextHeadingLine"),i=c,o(c)):r(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),Se(c)?Re(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||oe(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const RM={tokenize:MM};function MM(e){const t=this,r=e.attempt(Iu,n,e.attempt(this.parser.constructs.flowInitial,i,Re(e,e.attempt(this.parser.constructs.flow,i,e.attempt(OR,i)),"linePrefix")));return r;function n(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const TM={resolveAll:yS()},DM=gS("string"),LM=gS("text");function gS(e){return{resolveAll:yS(e==="text"?AM:void 0),tokenize:t};function t(r){const n=this,i=this.parser.constructs[e],s=r.attempt(i,o,l);return o;function o(h){return c(h)?s(h):l(h)}function l(h){if(h===null){r.consume(h);return}return r.enter("data"),r.consume(h),u}function u(h){return c(h)?(r.exit("data"),s(h)):(r.consume(h),u)}function c(h){if(h===null)return!0;const d=i[h];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function yS(e){return t;function t(r,n){let i=-1,s;for(;++i<=r.length;)s===void 0?r[i]&&r[i][1].type==="data"&&(s=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==s+2&&(r[s][1].end=r[i-1][1].end,r.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(r,n):r}}function AM(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const n=e[r-1][1],i=t.sliceStream(n);let s=i.length,o=-1,l=0,u;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(c===-2)u=!0,l++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){const c={type:r===e.length||u||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:n.start._bufferIndex+o,_index:n.start._index+s,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...c.start},n.start.offset===n.end.offset?Object.assign(n,c):(e.splice(r,0,["enter",c,t],["exit",c,t]),r+=2)}r++}return e}const OM={42:Ut,43:Ut,45:Ut,48:Ut,49:Ut,50:Ut,51:Ut,52:Ut,53:Ut,54:Ut,55:Ut,56:Ut,57:Ut,62:cS},IM={91:$R},FM={[-2]:Fh,[-1]:Fh,32:Fh},BM={35:VR,42:Cc,45:[Jy,Cc],60:XR,61:Jy,95:Cc,96:Gy,126:Gy},zM={38:hS,92:uS},$M={[-5]:Bh,[-4]:Bh,[-3]:Bh,33:mM,38:hS,42:ap,60:[yR,iM],91:yM,92:[KR,uS],93:Wm,95:ap,96:RR},HM={null:[ap,TM]},WM={null:[42,95]},UM={null:[]},KM=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:WM,contentInitial:IM,disable:UM,document:OM,flow:BM,flowInitial:FM,insideSpan:HM,string:zM,text:$M},Symbol.toStringTag,{value:"Module"}));function qM(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},s=[];let o=[],l=[];const u={attempt:j(N),check:j(S),consume:v,enter:g,exit:_,interrupt:j(S,{interrupt:!0})},c={code:null,containerState:{},defineSkip:x,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d};let h=t.tokenize.call(c,u);return t.resolveAll&&s.push(t),c;function d(I){return o=br(o,I),C(),o[o.length-1]!==null?[]:(A(t,0),c.events=Hm(s,c.events,c),c.events)}function f(I,P){return QM(p(I),P)}function p(I){return VM(o,I)}function m(){const{_bufferIndex:I,_index:P,line:R,column:D,offset:L}=n;return{_bufferIndex:I,_index:P,line:R,column:D,offset:L}}function x(I){i[I.line]=I.column,z()}function C(){let I;for(;n._index<o.length;){const P=o[n._index];if(typeof P=="string")for(I=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===I&&n._bufferIndex<P.length;)y(P.charCodeAt(n._bufferIndex));else y(P)}}function y(I){h=h(I)}function v(I){oe(I)?(n.line++,n.column=1,n.offset+=I===-3?2:1,z()):I!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=I}function g(I,P){const R=P||{};return R.type=I,R.start=m(),c.events.push(["enter",R,c]),l.push(R),R}function _(I){const P=l.pop();return P.end=m(),c.events.push(["exit",P,c]),P}function N(I,P){A(I,P.from)}function S(I,P){P.restore()}function j(I,P){return R;function R(D,L,B){let O,E,F,k;return Array.isArray(D)?M(D):"tokenize"in D?M([D]):V(D);function V(X){return ie;function ie(de){const me=de!==null&&X[de],Ze=de!==null&&X.null,er=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(Ze)?Ze:Ze?[Ze]:[]];return M(er)(de)}}function M(X){return O=X,E=0,X.length===0?B:b(X[E])}function b(X){return ie;function ie(de){return k=$(),F=X,X.partial||(c.currentConstruct=X),X.name&&c.parser.constructs.disable.null.includes(X.name)?K():X.tokenize.call(P?Object.assign(Object.create(c),P):c,u,H,K)(de)}}function H(X){return I(F,k),L}function K(X){return k.restore(),++E<O.length?b(O[E]):B}}}function A(I,P){I.resolveAll&&!s.includes(I)&&s.push(I),I.resolve&&an(c.events,P,c.events.length-P,I.resolve(c.events.slice(P),c)),I.resolveTo&&(c.events=I.resolveTo(c.events,c))}function $(){const I=m(),P=c.previous,R=c.currentConstruct,D=c.events.length,L=Array.from(l);return{from:D,restore:B};function B(){n=I,c.previous=P,c.currentConstruct=R,c.events.length=D,l=L,z()}}function z(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function VM(e,t){const r=t.start._index,n=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(r===i)o=[e[r].slice(n,s)];else{if(o=e.slice(r,i),n>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(n):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function QM(e,t){let r=-1;const n=[];let i;for(;++r<e.length;){const s=e[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
481
- `;break}case-3:{o=`\r
482
- `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function YM(e){const n={constructs:rR([KM,...(e||{}).extensions||[]]),content:i(uR),defined:[],document:i(dR),flow:i(RM),lazy:{},string:i(DM),text:i(LM)};return n;function i(s){return o;function o(l){return qM(n,s,l)}}}function GM(e){for(;!dS(e););return e}const Zy=/[\0\t\n\r]/g;function XM(){let e=1,t="",r=!0,n;return i;function i(s,o,l){const u=[];let c,h,d,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,t="",r&&(s.charCodeAt(0)===65279&&d++,r=void 0);d<s.length;){if(Zy.lastIndex=d,c=Zy.exec(s),f=c&&c.index!==void 0?c.index:s.length,p=s.charCodeAt(f),!c){t=s.slice(d);break}if(p===10&&d===f&&n)u.push(-3),n=void 0;else switch(n&&(u.push(-5),n=void 0),d<f&&(u.push(s.slice(d,f)),e+=f-d),p){case 0:{u.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,u.push(-2);e++<h;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:n=!0,e=1}d=f+1}return l&&(n&&u.push(-5),t&&u.push(t),u.push(null)),u}}const JM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ZM(e){return e.replace(JM,eT)}function eT(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return lS(r.slice(s?2:1),s?16:10)}return $m(r)||e}const vS={}.hasOwnProperty;function tT(e,t,r){return typeof t!="string"&&(r=t,t=void 0),rT(r)(GM(YM(r).document().write(XM()(e,t,!0))))}function rT(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(tg),autolinkProtocol:$,autolinkEmail:$,atxHeading:s(be),blockQuote:s(Ze),characterEscape:$,characterReference:$,codeFenced:s(er),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(er,o),codeText:s(tr,o),codeTextData:$,data:$,codeFlowValue:$,definition:s(_e),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(ee),hardBreakEscape:s($t),hardBreakTrailing:s($t),htmlFlow:s($r,o),htmlFlowData:$,htmlText:s($r,o),htmlTextData:$,image:s(Uu),label:o,link:s(tg),listItem:s(g1),listItemValue:f,listOrdered:s(rg,d),listUnordered:s(rg),paragraph:s(y1),reference:b,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(be),strong:s(v1),thematicBreak:s(_1)},exit:{atxHeading:u(),atxHeadingSequence:N,autolink:u(),autolinkEmail:me,autolinkProtocol:de,blockQuote:u(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:K,characterReferenceMarkerNumeric:K,characterReferenceValue:X,characterReference:ie,codeFenced:u(C),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:z,codeIndented:u(y),codeText:u(L),codeTextData:z,data:z,definition:u(),definitionDestinationString:_,definitionLabelString:v,definitionTitleString:g,emphasis:u(),hardBreakEscape:u(P),hardBreakTrailing:u(P),htmlFlow:u(R),htmlFlowData:z,htmlText:u(D),htmlTextData:z,image:u(O),label:F,labelText:E,lineEnding:I,link:u(B),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:H,resourceDestinationString:k,resourceTitleString:V,resource:M,setextHeading:u(A),setextHeadingLineSequence:j,setextHeadingText:S,strong:u(),thematicBreak:u()}};xS(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(W){let G={type:"root",children:[]};const le={stack:[G],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:h,data:r},ve=[];let Ee=-1;for(;++Ee<W.length;)if(W[Ee][1].type==="listOrdered"||W[Ee][1].type==="listUnordered")if(W[Ee][0]==="enter")ve.push(Ee);else{const jr=ve.pop();Ee=i(W,jr,Ee)}for(Ee=-1;++Ee<W.length;){const jr=t[W[Ee][0]];vS.call(jr,W[Ee][1].type)&&jr[W[Ee][1].type].call(Object.assign({sliceSerialize:W[Ee][2].sliceSerialize},le),W[Ee][1])}if(le.tokenStack.length>0){const jr=le.tokenStack[le.tokenStack.length-1];(jr[1]||ev).call(le,void 0,jr[0])}for(G.position={start:Hn(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:Hn(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<t.transforms.length;)G=t.transforms[Ee](G)||G;return G}function i(W,G,le){let ve=G-1,Ee=-1,jr=!1,Ri,un,Do,Lo;for(;++ve<=le;){const rr=W[ve];switch(rr[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{rr[0]==="enter"?Ee++:Ee--,Lo=void 0;break}case"lineEndingBlank":{rr[0]==="enter"&&(Ri&&!Lo&&!Ee&&!Do&&(Do=ve),Lo=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Lo=void 0}if(!Ee&&rr[0]==="enter"&&rr[1].type==="listItemPrefix"||Ee===-1&&rr[0]==="exit"&&(rr[1].type==="listUnordered"||rr[1].type==="listOrdered")){if(Ri){let _s=ve;for(un=void 0;_s--;){const hn=W[_s];if(hn[1].type==="lineEnding"||hn[1].type==="lineEndingBlank"){if(hn[0]==="exit")continue;un&&(W[un][1].type="lineEndingBlank",jr=!0),hn[1].type="lineEnding",un=_s}else if(!(hn[1].type==="linePrefix"||hn[1].type==="blockQuotePrefix"||hn[1].type==="blockQuotePrefixWhitespace"||hn[1].type==="blockQuoteMarker"||hn[1].type==="listItemIndent"))break}Do&&(!un||Do<un)&&(Ri._spread=!0),Ri.end=Object.assign({},un?W[un][1].start:rr[1].end),W.splice(un||ve,0,["exit",Ri,rr[2]]),ve++,le++}if(rr[1].type==="listItemPrefix"){const _s={type:"listItem",_spread:!1,start:Object.assign({},rr[1].start),end:void 0};Ri=_s,W.splice(ve,0,["enter",_s,rr[2]]),ve++,le++,Do=void 0,Lo=!0}}}return W[G][1]._spread=jr,le}function s(W,G){return le;function le(ve){l.call(this,W(ve),ve),G&&G.call(this,ve)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(W,G,le){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([G,le||void 0]),W.position={start:Hn(G.start),end:void 0}}function u(W){return G;function G(le){W&&W.call(this,le),c.call(this,le)}}function c(W,G){const le=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==W.type&&(G?G.call(this,W,ve[0]):(ve[1]||ev).call(this,W,ve[0]));else throw new Error("Cannot close `"+W.type+"` ("+_a({start:W.start,end:W.end})+"): it’s not open");le.position.end=Hn(W.end)}function h(){return eR(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(W){if(this.data.expectingFirstListItemValue){const G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function p(){const W=this.resume(),G=this.stack[this.stack.length-1];G.lang=W}function m(){const W=this.resume(),G=this.stack[this.stack.length-1];G.meta=W}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const W=this.resume(),G=this.stack[this.stack.length-1];G.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const W=this.resume(),G=this.stack[this.stack.length-1];G.value=W.replace(/(\r?\n|\r)$/g,"")}function v(W){const G=this.resume(),le=this.stack[this.stack.length-1];le.label=G,le.identifier=eo(this.sliceSerialize(W)).toLowerCase()}function g(){const W=this.resume(),G=this.stack[this.stack.length-1];G.title=W}function _(){const W=this.resume(),G=this.stack[this.stack.length-1];G.url=W}function N(W){const G=this.stack[this.stack.length-1];if(!G.depth){const le=this.sliceSerialize(W).length;G.depth=le}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function j(W){const G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function $(W){const le=this.stack[this.stack.length-1].children;let ve=le[le.length-1];(!ve||ve.type!=="text")&&(ve=x1(),ve.position={start:Hn(W.start),end:void 0},le.push(ve)),this.stack.push(ve)}function z(W){const G=this.stack.pop();G.value+=this.sliceSerialize(W),G.position.end=Hn(W.end)}function I(W){const G=this.stack[this.stack.length-1];if(this.data.atHardBreak){const le=G.children[G.children.length-1];le.position.end=Hn(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(G.type)&&($.call(this,W),z.call(this,W))}function P(){this.data.atHardBreak=!0}function R(){const W=this.resume(),G=this.stack[this.stack.length-1];G.value=W}function D(){const W=this.resume(),G=this.stack[this.stack.length-1];G.value=W}function L(){const W=this.resume(),G=this.stack[this.stack.length-1];G.value=W}function B(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=G,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function O(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=G,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function E(W){const G=this.sliceSerialize(W),le=this.stack[this.stack.length-2];le.label=ZM(G),le.identifier=eo(G).toLowerCase()}function F(){const W=this.stack[this.stack.length-1],G=this.resume(),le=this.stack[this.stack.length-1];if(this.data.inReference=!0,le.type==="link"){const ve=W.children;le.children=ve}else le.alt=G}function k(){const W=this.resume(),G=this.stack[this.stack.length-1];G.url=W}function V(){const W=this.resume(),G=this.stack[this.stack.length-1];G.title=W}function M(){this.data.inReference=void 0}function b(){this.data.referenceType="collapsed"}function H(W){const G=this.resume(),le=this.stack[this.stack.length-1];le.label=G,le.identifier=eo(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function K(W){this.data.characterReferenceType=W.type}function X(W){const G=this.sliceSerialize(W),le=this.data.characterReferenceType;let ve;le?(ve=lS(G,le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=$m(G);const Ee=this.stack[this.stack.length-1];Ee.value+=ve}function ie(W){const G=this.stack.pop();G.position.end=Hn(W.end)}function de(W){z.call(this,W);const G=this.stack[this.stack.length-1];G.url=this.sliceSerialize(W)}function me(W){z.call(this,W);const G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize(W)}function Ze(){return{type:"blockquote",children:[]}}function er(){return{type:"code",lang:null,meta:null,value:""}}function tr(){return{type:"inlineCode",value:""}}function _e(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ee(){return{type:"emphasis",children:[]}}function be(){return{type:"heading",depth:0,children:[]}}function $t(){return{type:"break"}}function $r(){return{type:"html",value:""}}function Uu(){return{type:"image",title:null,url:"",alt:null}}function tg(){return{type:"link",title:null,url:"",children:[]}}function rg(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function g1(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function y1(){return{type:"paragraph",children:[]}}function v1(){return{type:"strong",children:[]}}function x1(){return{type:"text",value:""}}function _1(){return{type:"thematicBreak"}}}function Hn(e){return{line:e.line,column:e.column,offset:e.offset}}function xS(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?xS(e,n):nT(e,n)}}function nT(e,t){let r;for(r in t)if(vS.call(t,r))switch(r){case"canContainEols":{const n=t[r];n&&e[r].push(...n);break}case"transforms":{const n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{const n=t[r];n&&Object.assign(e[r],n);break}}}function ev(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+_a({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+_a({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+_a({start:t.start,end:t.end})+") is still open")}function iT(e){const t=this;t.parser=r;function r(n){return tT(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function sT(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function oT(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
483
- `}]}function aT(e,t){const r=t.value?t.value+`
484
- `:"",n={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function lT(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function cT(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function uT(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),i=To(n.toLowerCase()),s=e.footnoteOrder.indexOf(n);let o,l=e.footnoteCounts.get(n);l===void 0?(l=0,e.footnoteOrder.push(n),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(n,l);const u={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function hT(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function dT(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function _S(e,t){const r=t.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function fT(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return _S(e,t);const i={src:To(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function pT(e,t){const r={src:To(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)}function mT(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)}function gT(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return _S(e,t);const i={href:To(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function yT(e,t){const r={href:To(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vT(e,t,r){const n=e.all(t),i=r?xT(r):wS(t),s={},o=[];if(typeof t.checked=="boolean"){const h=n[0];let d;h&&h.type==="element"&&h.tagName==="p"?d=h:(d={type:"element",tagName:"p",properties:{},children:[]},n.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<n.length;){const h=n[l];(i||l!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
485
- `}),h.type==="element"&&h.tagName==="p"&&!i?o.push(...h.children):o.push(h)}const u=n[n.length-1];u&&(i||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
486
- `});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)}function xT(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let n=-1;for(;!t&&++n<r.length;)t=wS(r[n])}return t}function wS(e){const t=e.spread;return t??e.children.length>1}function _T(e,t){const r={},n=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++i<n.length;){const o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,s),e.applyData(t,s)}function wT(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function bT(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function ST(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function CT(e,t){const r=e.all(t),n=r.shift(),i=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],o),i.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},l=Im(t.children[1]),u=tS(t.children[t.children.length-1]);l&&u&&(o.position={start:l,end:u}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function kT(e,t,r){const n=r?r.children:void 0,s=(n?n.indexOf(t):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:t.children.length;let u=-1;const c=[];for(;++u<l;){const d=t.children[u],f={},p=o?o[u]:void 0;p&&(f.align=p);let m={type:"element",tagName:s,properties:f,children:[]};d&&(m.children=e.all(d),e.patch(d,m),m=e.applyData(d,m)),c.push(m)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function NT(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const tv=9,rv=32;function ET(e){const t=String(e),r=/\r?\n|\r/g;let n=r.exec(t),i=0;const s=[];for(;n;)s.push(nv(t.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return s.push(nv(t.slice(i),i>0,!1)),s.join("")}function nv(e,t,r){let n=0,i=e.length;if(t){let s=e.codePointAt(n);for(;s===tv||s===rv;)n++,s=e.codePointAt(n)}if(r){let s=e.codePointAt(i-1);for(;s===tv||s===rv;)i--,s=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}function jT(e,t){const r={type:"text",value:ET(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function PT(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const RT={blockquote:sT,break:oT,code:aT,delete:lT,emphasis:cT,footnoteReference:uT,heading:hT,html:dT,imageReference:fT,image:pT,inlineCode:mT,linkReference:gT,link:yT,listItem:vT,list:_T,paragraph:wT,root:bT,strong:ST,table:CT,tableCell:NT,tableRow:kT,text:jT,thematicBreak:PT,toml:Yl,yaml:Yl,definition:Yl,footnoteDefinition:Yl};function Yl(){}const bS=-1,Fu=0,ba=1,lu=2,Um=3,Km=4,qm=5,Vm=6,SS=7,CS=8,iv=typeof self=="object"?self:globalThis,MT=(e,t)=>{const r=(i,s)=>(e.set(s,i),i),n=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case Fu:case bS:return r(o,i);case ba:{const l=r([],i);for(const u of o)l.push(n(u));return l}case lu:{const l=r({},i);for(const[u,c]of o)l[n(u)]=n(c);return l}case Um:return r(new Date(o),i);case Km:{const{source:l,flags:u}=o;return r(new RegExp(l,u),i)}case qm:{const l=r(new Map,i);for(const[u,c]of o)l.set(n(u),n(c));return l}case Vm:{const l=r(new Set,i);for(const u of o)l.add(n(u));return l}case SS:{const{name:l,message:u}=o;return r(new iv[l](u),i)}case CS:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return r(new DataView(l),o)}}return r(new iv[s](o),i)};return n},sv=e=>MT(new Map,e)(0),ks="",{toString:TT}={},{keys:DT}=Object,Xo=e=>{const t=typeof e;if(t!=="object"||!e)return[Fu,t];const r=TT.call(e).slice(8,-1);switch(r){case"Array":return[ba,ks];case"Object":return[lu,ks];case"Date":return[Um,ks];case"RegExp":return[Km,ks];case"Map":return[qm,ks];case"Set":return[Vm,ks];case"DataView":return[ba,r]}return r.includes("Array")?[ba,r]:r.includes("Error")?[SS,r]:[lu,r]},Gl=([e,t])=>e===Fu&&(t==="function"||t==="symbol"),LT=(e,t,r,n)=>{const i=(o,l)=>{const u=n.push(o)-1;return r.set(l,u),u},s=o=>{if(r.has(o))return r.get(o);let[l,u]=Xo(o);switch(l){case Fu:{let h=o;switch(u){case"bigint":l=CS,h=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);h=null;break;case"undefined":return i([bS],o)}return i([l,h],o)}case ba:{if(u){let f=o;return u==="DataView"?f=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(f=new Uint8Array(o)),i([u,[...f]],o)}const h=[],d=i([l,h],o);for(const f of o)h.push(s(f));return d}case lu:{if(u)switch(u){case"BigInt":return i([u,o.toString()],o);case"Boolean":case"Number":case"String":return i([u,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const h=[],d=i([l,h],o);for(const f of DT(o))(e||!Gl(Xo(o[f])))&&h.push([s(f),s(o[f])]);return d}case Um:return i([l,o.toISOString()],o);case Km:{const{source:h,flags:d}=o;return i([l,{source:h,flags:d}],o)}case qm:{const h=[],d=i([l,h],o);for(const[f,p]of o)(e||!(Gl(Xo(f))||Gl(Xo(p))))&&h.push([s(f),s(p)]);return d}case Vm:{const h=[],d=i([l,h],o);for(const f of o)(e||!Gl(Xo(f)))&&h.push(s(f));return d}}const{message:c}=o;return i([l,{name:u,message:c}],o)};return s},ov=(e,{json:t,lossy:r}={})=>{const n=[];return LT(!(t||r),!!t,new Map,n)(e),n},cu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?sv(ov(e,t)):structuredClone(e):(e,t)=>sv(ov(e,t));function AT(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function OT(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function IT(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||AT,n=e.options.footnoteBackLabel||OT,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let u=-1;for(;++u<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[u]);if(!c)continue;const h=e.all(c),d=String(c.identifier).toUpperCase(),f=To(d.toLowerCase());let p=0;const m=[],x=e.footnoteCounts.get(d);for(;x!==void 0&&++p<=x;){m.length>0&&m.push({type:"text",value:" "});let v=typeof r=="string"?r:r(u,p);typeof v=="string"&&(v={type:"text",value:v}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(u,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const C=h[h.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const v=C.children[C.children.length-1];v&&v.type==="text"?v.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...m)}else h.push(...m);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(h,!0)};e.patch(c,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...cu(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
487
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
488
- `}]}}const kS=function(e){if(e==null)return $T;if(typeof e=="function")return Bu(e);if(typeof e=="object")return Array.isArray(e)?FT(e):BT(e);if(typeof e=="string")return zT(e);throw new Error("Expected function, string, or object as test")};function FT(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=kS(e[r]);return Bu(n);function n(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function BT(e){const t=e;return Bu(r);function r(n){const i=n;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function zT(e){return Bu(t);function t(r){return r&&r.type===e}}function Bu(e){return t;function t(r,n,i){return!!(HT(r)&&e.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function $T(){return!0}function HT(e){return e!==null&&typeof e=="object"&&"type"in e}const NS=[],WT=!0,av=!1,UT="skip";function KT(e,t,r,n){let i;typeof t=="function"&&typeof r!="function"?(n=r,r=t):i=t;const s=kS(i),o=n?-1:1;l(e,void 0,[])();function l(u,c,h){const d=u&&typeof u=="object"?u:{};if(typeof d.type=="string"){const p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(u.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=NS,m,x,C;if((!t||s(u,c,h[h.length-1]||void 0))&&(p=qT(r(u,h)),p[0]===av))return p;if("children"in u&&u.children){const y=u;if(y.children&&p[0]!==UT)for(x=(n?y.children.length:-1)+o,C=h.concat(y);x>-1&&x<y.children.length;){const v=y.children[x];if(m=l(v,x,C)(),m[0]===av)return m;x=typeof m[1]=="number"?m[1]:x+o}}return p}}}function qT(e){return Array.isArray(e)?e:typeof e=="number"?[WT,e]:e==null?NS:[e]}function ES(e,t,r,n){let i,s,o;typeof t=="function"&&typeof r!="function"?(s=void 0,o=t,i=r):(s=t,o=r,i=n),KT(e,s,l,i);function l(u,c){const h=c[c.length-1],d=h?h.children.indexOf(u):void 0;return o(u,d,h)}}const lp={}.hasOwnProperty,VT={};function QT(e,t){const r=t||VT,n=new Map,i=new Map,s=new Map,o={...RT,...r.handlers},l={all:c,applyData:GT,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:u,options:r,patch:YT,wrap:JT};return ES(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const d=h.type==="definition"?n:i,f=String(h.identifier).toUpperCase();d.has(f)||d.set(f,h)}}),l;function u(h,d){const f=h.type,p=l.handlers[f];if(lp.call(l.handlers,f)&&p)return p(l,h,d);if(l.options.passThrough&&l.options.passThrough.includes(f)){if("children"in h){const{children:x,...C}=h,y=cu(C);return y.children=l.all(h),y}return cu(h)}return(l.options.unknownHandler||XT)(l,h,d)}function c(h){const d=[];if("children"in h){const f=h.children;let p=-1;for(;++p<f.length;){const m=l.one(f[p],h);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=lv(m.value)),!Array.isArray(m)&&m.type==="element")){const x=m.children[0];x&&x.type==="text"&&(x.value=lv(x.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function YT(e,t){e.position&&(t.position=TP(e))}function GT(e,t){let r=t;if(e&&e.data){const n=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&s&&Object.assign(r.properties,cu(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function XT(e,t){const r=t.data||{},n="value"in t&&!(lp.call(r,"hProperties")||lp.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function JT(e,t){const r=[];let n=-1;for(t&&r.push({type:"text",value:`
489
- `});++n<e.length;)n&&r.push({type:"text",value:`
490
- `}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:`
491
- `}),r}function lv(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function cv(e,t){const r=QT(e,t),n=r.one(e,void 0),i=IT(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
492
- `},i),s}function ZT(e,t){return e&&"run"in e?async function(r,n){const i=cv(r,{file:n,...t});await e.run(i,n)}:function(r,n){return cv(r,{file:n,...e||t})}}function uv(e){if(e)throw e}var kc=Object.prototype.hasOwnProperty,jS=Object.prototype.toString,hv=Object.defineProperty,dv=Object.getOwnPropertyDescriptor,fv=function(t){return typeof Array.isArray=="function"?Array.isArray(t):jS.call(t)==="[object Array]"},pv=function(t){if(!t||jS.call(t)!=="[object Object]")return!1;var r=kc.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&kc.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var i;for(i in t);return typeof i>"u"||kc.call(t,i)},mv=function(t,r){hv&&r.name==="__proto__"?hv(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},gv=function(t,r){if(r==="__proto__")if(kc.call(t,r)){if(dv)return dv(t,r).value}else return;return t[r]},eD=function e(){var t,r,n,i,s,o,l=arguments[0],u=1,c=arguments.length,h=!1;for(typeof l=="boolean"&&(h=l,l=arguments[1]||{},u=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});u<c;++u)if(t=arguments[u],t!=null)for(r in t)n=gv(l,r),i=gv(t,r),l!==i&&(h&&i&&(pv(i)||(s=fv(i)))?(s?(s=!1,o=n&&fv(n)?n:[]):o=n&&pv(n)?n:{},mv(l,{name:r,newValue:e(h,o,i)})):typeof i<"u"&&mv(l,{name:r,newValue:i}));return l};const zh=rl(eD);function cp(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 tD(){const e=[],t={run:r,use:n};return t;function r(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...i);function l(u,...c){const h=e[++s];let d=-1;if(u){o(u);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,h?rD(h,l)(...c):o(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function rD(e,t){let r;return n;function n(...o){const l=e.length>o.length;let u;l&&o.push(i);try{u=e.apply(this,o)}catch(c){const h=c;if(l&&r)throw h;return i(h)}l||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(o,...l){r||(r=!0,t(o,...l))}function s(o){i(null,o)}}const Qr={basename:nD,dirname:iD,extname:sD,join:oD,sep:"/"};function nD(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ml(e);let r=0,n=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){r=i+1;break}}else n<0&&(s=!0,n=i+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){r=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(n=i):(l=-1,n=o));return r===n?n=o:n<0&&(n=e.length),e.slice(r,n)}function iD(e){if(ml(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function sD(e){ml(e);let t=e.length,r=-1,n=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){n=t+1;break}continue}r<0&&(o=!0,r=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||r<0||s===0||s===1&&i===r-1&&i===n+1?"":e.slice(i,r)}function oD(...e){let t=-1,r;for(;++t<e.length;)ml(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":aD(r)}function aD(e){ml(e);const t=e.codePointAt(0)===47;let r=lD(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function lD(e,t){let r="",n=0,i=-1,s=0,o=-1,l,u;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(u=r.lastIndexOf("/"),u!==r.length-1){u<0?(r="",n=0):(r=r.slice(0,u),n=r.length-1-r.lastIndexOf("/")),i=o,s=0;continue}}else if(r.length>0){r="",n=0,i=o,s=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(i+1,o):r=e.slice(i+1,o),n=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return r}function ml(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const cD={cwd:uD};function uD(){return"/"}function up(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function hD(e){if(typeof e=="string")e=new URL(e);else if(!up(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 dD(e)}function dD(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const n=t.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const $h=["history","path","basename","stem","extname","dirname"];class PS{constructor(t){let r;t?up(t)?r={path:t}:typeof t=="string"||fD(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":cD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<$h.length;){const s=$h[n];s in r&&r[s]!==void 0&&r[s]!==null&&(this[s]=s==="history"?[...r[s]]:r[s])}let i;for(i in r)$h.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Qr.basename(this.path):void 0}set basename(t){Wh(t,"basename"),Hh(t,"basename"),this.path=Qr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Qr.dirname(this.path):void 0}set dirname(t){yv(this.basename,"dirname"),this.path=Qr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Qr.extname(this.path):void 0}set extname(t){if(Hh(t,"extname"),yv(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=Qr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){up(t)&&(t=hD(t)),Wh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Qr.basename(this.path,this.extname):void 0}set stem(t){Wh(t,"stem"),Hh(t,"stem"),this.path=Qr.join(this.dirname||"",t+(this.extname||""))}fail(t,r,n){const i=this.message(t,r,n);throw i.fatal=!0,i}info(t,r,n){const i=this.message(t,r,n);return i.fatal=void 0,i}message(t,r,n){const i=new jt(t,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Hh(e,t){if(e&&e.includes(Qr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Qr.sep+"`")}function Wh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function yv(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function fD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pD=function(e){const n=this.constructor.prototype,i=n[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s},mD={}.hasOwnProperty;class Qm extends pD{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=tD()}copy(){const t=new Qm;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];t.use(...n)}return t.data(zh(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(qh("data",this.frozen),this.namespace[t]=r,this):mD.call(this.namespace,t)&&this.namespace[t]||void 0:t?(qh("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[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const i=r.call(t,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=Xl(t),n=this.parser||this.Parser;return Uh("parse",n),n(String(r),r)}process(t,r){const n=this;return this.freeze(),Uh("process",this.parser||this.Parser),Kh("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const l=Xl(t),u=n.parse(l);n.run(u,l,function(h,d,f){if(h||!d||!f)return c(h);const p=d,m=n.stringify(p,f);vD(m)?f.value=m:f.result=m,c(h,f)});function c(h,d){h||!d?o(h):s?s(d):r(void 0,d)}}}processSync(t){let r=!1,n;return this.freeze(),Uh("processSync",this.parser||this.Parser),Kh("processSync",this.compiler||this.Compiler),this.process(t,i),xv("processSync","process",r),n;function i(s,o){r=!0,uv(s),n=o}}run(t,r,n){vv(t),this.freeze();const i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?s(void 0,n):new Promise(s);function s(o,l){const u=Xl(r);i.run(t,u,c);function c(h,d,f){const p=d||t;h?l(h):o?o(p):n(void 0,p,f)}}}runSync(t,r){let n=!1,i;return this.run(t,r,s),xv("runSync","run",n),i;function s(o,l){uv(o),i=l,n=!0}}stringify(t,r){this.freeze();const n=Xl(r),i=this.compiler||this.Compiler;return Kh("stringify",i),vv(t),i(t,n)}use(t,...r){const n=this.attachers,i=this.namespace;if(qh("use",this.frozen),t!=null)if(typeof t=="function")u(t,r);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(c){if(typeof c=="function")u(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[h,...d]=c;u(h,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))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");l(c.plugins),c.settings&&(i.settings=zh(!0,i.settings,c.settings))}function l(c){let h=-1;if(c!=null)if(Array.isArray(c))for(;++h<c.length;){const d=c[h];s(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function u(c,h){let d=-1,f=-1;for(;++d<n.length;)if(n[d][0]===c){f=d;break}if(f===-1)n.push([c,...h]);else if(h.length>0){let[p,...m]=h;const x=n[f][1];cp(x)&&cp(p)&&(p=zh(!0,x,p)),n[f]=[c,p,...m]}}}}const gD=new Qm().freeze();function Uh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Kh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function qh(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 vv(e){if(!cp(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function xv(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Xl(e){return yD(e)?e:new PS(e)}function yD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function vD(e){return typeof e=="string"||xD(e)}function xD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const _D="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",_v=[],wv={allowDangerousHtml:!0},wD=/^(https?|ircs?|mailto|xmpp)$/i,bD=[{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 SD(e){const t=CD(e),r=kD(e);return ND(t.runSync(t.parse(r),r),e)}function CD(e){const t=e.rehypePlugins||_v,r=e.remarkPlugins||_v,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...wv}:wv;return gD().use(iT).use(r).use(ZT,n).use(t)}function kD(e){const t=e.children||"",r=new PS;return typeof t=="string"&&(r.value=t),r}function ND(e,t){const r=t.allowedElements,n=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||ED;for(const h of bD)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+_D+h.id,void 0);return ES(e,c),IP(e,{Fragment:a.Fragment,components:i,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function c(h,d,f){if(h.type==="raw"&&f&&typeof d=="number")return o?f.children.splice(d,1):f.children[d]={type:"text",value:h.value},d;if(h.type==="element"){let p;for(p in Ih)if(Object.hasOwn(Ih,p)&&Object.hasOwn(h.properties,p)){const m=h.properties[p],x=Ih[p];(x===null||x.includes(h.tagName))&&(h.properties[p]=u(String(m||""),p,h))}}if(h.type==="element"){let p=r?!r.includes(h.tagName):s?s.includes(h.tagName):!1;if(!p&&n&&typeof d=="number"&&(p=!n(h,d,f)),p&&f&&typeof d=="number")return l&&h.children?f.children.splice(d,1,...h.children):f.children.splice(d,1),d}}}function ED(e){const t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||r!==-1&&t>r||n!==-1&&t>n||wD.test(e.slice(0,t))?e:""}async function jD(e){const t=await fetch(`/api/issues/${e}/costs`);if(!t.ok)throw new Error("Failed to fetch costs");return t.json()}function Vh(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 bv(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function PD(e){return 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}function Sv(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 RD({issue:e,onClose:t,onStartAgent:r}){var B,O,E,F,k,V,M;const n=Ft(),[i,s]=w.useState(!1),[o,l]=w.useState(!1),[u,c]=w.useState(!1),[h,d]=w.useState(!0),{data:f,isLoading:p}=ae({queryKey:["workspace",e.identifier],queryFn:async()=>{const b=await fetch(`/api/workspaces/${e.identifier}`);if(!b.ok)throw new Error("Failed to fetch workspace info");return b.json()},refetchInterval:5e3}),{data:m}=ae({queryKey:["issueCosts",e.identifier],queryFn:()=>jD(e.identifier),refetchInterval:3e4,staleTime:1e4}),x=()=>{Sv(e.identifier),s(!0),setTimeout(()=>s(!1),2e3)},C=()=>{f!=null&&f.path&&(Sv(`cd ${f.path}`),l(!0),setTimeout(()=>l(!1),2e3))},y=ue({mutationKey:["startAgent",e.identifier],mutationFn:async()=>{var H;const b=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier,projectId:(H=e.project)==null?void 0:H.id})});if(!b.ok)throw new Error("Failed to start agent");return b.json()},onSuccess:()=>{setTimeout(()=>{n.invalidateQueries({queryKey:["agents"]})},2e3),r==null||r()}}),v=ue({mutationFn:async()=>{var H;const b=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier,projectId:(H=e.project)==null?void 0:H.id})});if(!b.ok)throw new Error("Failed to create workspace");return b.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["workspace",e.identifier]})}}),g=ue({mutationFn:async()=>{const b=await fetch(`/api/workspaces/${e.identifier}/containerize`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!b.ok){const H=await b.json();throw new Error(H.error||"Failed to containerize workspace")}return b.json()},onSuccess:()=>{setTimeout(()=>{n.invalidateQueries({queryKey:["workspace",e.identifier]})},3e3)}}),_=ue({mutationFn:async()=>{const b=await fetch(`/api/workspaces/${e.identifier}/start`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!b.ok){const H=await b.json();throw new Error(H.error||"Failed to start containers")}return b.json()},onSuccess:()=>{setTimeout(()=>{n.invalidateQueries({queryKey:["workspace",e.identifier]})},5e3)}}),{data:N,isLoading:S}=ae({queryKey:["workspace-clean-preview",e.identifier],queryFn:async()=>{const b=await fetch(`/api/workspaces/${e.identifier}/clean/preview`);if(!b.ok)throw new Error("Failed to fetch preview");return b.json()},enabled:u&&(f==null?void 0:f.corrupted)===!0}),j=ue({mutationFn:async b=>{const H=await fetch(`/api/workspaces/${e.identifier}/clean`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({createBackup:b.createBackup})});if(!H.ok){const K=await H.json();throw new Error(K.error||"Failed to clean workspace")}return H.json()},onSuccess:b=>{c(!1),n.invalidateQueries({queryKey:["workspace",e.identifier]}),b.backupPath&&alert(`Workspace backed up to:
493
- ${b.backupPath}
494
-
495
- You can restore files from there after the new workspace is created.`)}}),A=()=>{y.mutate()},$=()=>{v.mutate()},z=()=>{g.mutate()},I=()=>{_.mutate()},P=()=>{c(!0)},R=()=>{j.mutate({createBackup:h})},D={0:{label:"No priority",color:"text-gray-400"},1:{label:"Urgent",color:"text-red-400"},2:{label:"High",color:"text-orange-400"},3:{label:"Medium",color:"text-yellow-400"},4:{label:"Low",color:"text-blue-400"}},L=D[e.priority]||D[0];return a.jsxs("div",{className:"flex flex-col h-full bg-gray-800 border-l border-gray-700",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:x,className:`font-mono text-sm font-medium transition-colors ${i?"text-green-400":"text-white hover:text-blue-400"}`,title:"Click to copy",children:[e.identifier,i?a.jsx(Us,{className:"w-3 h-3 inline ml-1"}):a.jsx(Lw,{className:"w-3 h-3 inline ml-1 opacity-50"})]}),a.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-blue-400",children:a.jsx(ls,{className:"w-4 h-4"})})]}),a.jsx("button",{onClick:t,className:"text-gray-400 hover:text-white p-1",children:a.jsx(Nt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[a.jsx("h2",{className:"text-lg font-medium text-white mb-4",children:e.title}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsx("span",{className:"px-2 py-1 bg-gray-700 text-white text-xs rounded",children:e.status}),a.jsx("span",{className:`text-xs ${L.color}`,children:L.label})]}),a.jsxs("div",{className:"space-y-3 mb-6",children:[e.assignee&&a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(Ww,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-gray-300",children:e.assignee.name}),a.jsx("span",{className:"text-gray-500 text-xs",children:e.assignee.email})]}),e.labels.length>0&&a.jsxs("div",{className:"flex items-center gap-2 text-sm flex-wrap",children:[a.jsx(zw,{className:"w-4 h-4 text-gray-400 shrink-0"}),e.labels.map(b=>a.jsx("span",{className:"px-2 py-0.5 bg-gray-700 text-gray-300 text-xs rounded",children:b},b))]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[a.jsx(I2,{className:"w-4 h-4"}),a.jsxs("span",{children:["Updated ",new Date(e.updatedAt).toLocaleDateString()]})]})]}),e.description&&a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-2",children:"Description"}),a.jsx("div",{className:"text-sm text-gray-300 bg-gray-900 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:a.jsx(SD,{children:e.description})})]}),m&&(m.totalCost>0||m.sessions.length>0)&&a.jsxs("div",{className:"mb-6",children:[a.jsxs("h3",{className:"text-sm font-medium text-gray-400 mb-2 flex items-center gap-2",children:[a.jsx(cl,{className:"w-4 h-4"}),"Cost Summary"]}),a.jsxs("div",{className:"bg-gray-900 rounded p-3 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Total Cost"}),a.jsx("span",{className:"text-xl font-semibold text-green-400",children:Vh(m.totalCost)})]}),m.totalTokens>0&&a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("span",{className:"text-gray-500 flex items-center gap-1",children:[a.jsx(Aw,{className:"w-3 h-3"}),"Total Tokens"]}),a.jsx("span",{className:"text-gray-300",children:bv(m.totalTokens)})]}),Object.keys(m.byModel).length>0&&a.jsxs("div",{className:"border-t border-gray-700 pt-2",children:[a.jsx("p",{className:"text-xs text-gray-500 uppercase tracking-wider mb-2",children:"By Model"}),a.jsx("div",{className:"space-y-1",children:Object.entries(m.byModel).sort(([,b],[,H])=>H-b).map(([b,H])=>a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{className:"text-gray-400 truncate",title:b,children:PD(b)}),a.jsx("span",{className:"text-gray-300",children:Vh(H)})]},b))})]}),m.sessions.length>0&&a.jsxs("div",{className:"border-t border-gray-700 pt-2",children:[a.jsxs("p",{className:"text-xs text-gray-500 uppercase tracking-wider mb-2",children:["Sessions (",m.sessions.length,")"]}),a.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto",children:m.sessions.map(b=>a.jsxs("div",{className:"flex items-center justify-between text-xs bg-gray-800 rounded px-2 py-1",children:[a.jsxs("div",{className:"flex items-center gap-2 truncate",children:[a.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700 rounded text-gray-400",children:b.type}),a.jsx("span",{className:"text-gray-500 truncate",children:b.model})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[b.tokenCount&&a.jsx("span",{className:"text-gray-500",children:bv(b.tokenCount)}),b.cost?a.jsx("span",{className:"text-green-400",children:Vh(b.cost)}):a.jsx("span",{className:"text-gray-600",children:"-"})]})]},b.id))})]})]})]}),p&&a.jsx("div",{className:"bg-gray-700/30 border border-gray-600/50 rounded-lg p-4 mb-4 animate-pulse",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-gray-600 rounded-full shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-3",children:[a.jsx("div",{className:"h-4 bg-gray-600 rounded w-32"}),a.jsx("div",{className:"h-3 bg-gray-600 rounded w-full"}),a.jsx("div",{className:"h-3 bg-gray-600 rounded w-3/4"}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsx("div",{className:"h-6 bg-gray-600 rounded w-20"}),a.jsx("div",{className:"h-6 bg-gray-600 rounded w-16"}),a.jsx("div",{className:"h-6 bg-gray-600 rounded w-24"})]})]})]})}),!p&&(f==null?void 0:f.exists)&&(f==null?void 0:f.corrupted)&&a.jsx("div",{className:"bg-yellow-900/20 border border-yellow-700/50 rounded-lg p-4 mb-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-yellow-900/50 rounded-full flex items-center justify-center shrink-0",children:a.jsx(Tn,{className:"w-4 h-4 text-yellow-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h4",{className:"text-sm font-medium text-yellow-400",children:"Workspace Corrupted"}),a.jsx("p",{className:"text-sm text-gray-400 mt-1",children:f.message||"The workspace exists but is not a valid git worktree."}),a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Path: ",a.jsx("code",{className:"bg-gray-800 px-1 rounded",children:f.path})]}),a.jsx("button",{onClick:P,disabled:j.isPending,className:"mt-3 flex items-center gap-2 px-3 py-1.5 bg-yellow-600 hover:bg-yellow-500 disabled:bg-yellow-800 text-white text-sm rounded transition-colors",children:j.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-4 h-4 animate-spin"}),"Cleaning..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-4 h-4"}),"Clean & Recreate"]})}),j.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:j.error instanceof Error?j.error.message:"Failed to clean workspace"}),j.isSuccess&&a.jsx("div",{className:"text-xs text-green-400 bg-green-900/20 px-2 py-1 rounded mt-2",children:"Workspace cleaned! Recreating..."})]})]})}),!p&&(f==null?void 0:f.exists)&&!(f!=null&&f.corrupted)&&a.jsx("div",{className:"bg-green-900/20 border border-green-700/50 rounded-lg p-4 mb-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-green-900/50 rounded-full flex items-center justify-center shrink-0",children:a.jsx(vm,{className:"w-4 h-4 text-green-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("h4",{className:"text-sm font-medium text-green-400",children:"Workspace Ready"}),!f.hasDocker&&a.jsx("span",{className:"px-2 py-0.5 bg-gray-700 text-gray-400 text-xs rounded",children:"Git only"}),f.hasDocker&&a.jsx("span",{className:"px-2 py-0.5 bg-purple-900/50 text-purple-400 text-xs rounded",children:"Containerized"}),f.hasAgent&&a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 bg-blue-900/50 text-blue-400 text-xs rounded",title:f.agentModelFull||f.agentModel||"Unknown model",children:[a.jsx(O2,{className:"w-3 h-3"}),f.agentModel||"Agent"]})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsx("code",{className:"text-xs text-gray-300 bg-gray-800 px-2 py-1 rounded truncate flex-1",children:f.path}),a.jsx("button",{onClick:C,className:"text-gray-400 hover:text-white p-1",title:"Copy cd command",children:o?a.jsx(Us,{className:"w-4 h-4 text-green-400"}):a.jsx(bi,{className:"w-4 h-4"})})]}),f.containers&&Object.values(f.containers).some(b=>b.running)&&a.jsxs("div",{className:"mt-3 space-y-1",children:[a.jsx("p",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Services"}),f.frontendUrl&&((O=(B=f.containers)==null?void 0:B.frontend)==null?void 0:O.running)&&a.jsxs("a",{href:f.frontendUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-blue-400 hover:text-blue-300",children:[a.jsx(pf,{className:"w-3 h-3"}),"Frontend: ",f.frontendUrl]}),f.apiUrl&&((F=(E=f.containers)==null?void 0:E.api)==null?void 0:F.running)&&a.jsxs("a",{href:f.apiUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-blue-400 hover:text-blue-300",children:[a.jsx(rN,{className:"w-3 h-3"}),"API: ",f.apiUrl]})]}),f.mrUrl&&a.jsx("div",{className:"mt-3",children:a.jsxs("a",{href:f.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-purple-400 hover:text-purple-300",children:[a.jsx(q2,{className:"w-3 h-3"}),"Merge Request"]})}),f.hasDocker&&f.containers&&Object.values(f.containers).some(b=>!b.running)&&a.jsxs("div",{className:"mt-3 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-xs text-yellow-500",children:"Some containers stopped."}),a.jsx("button",{onClick:I,disabled:_.isPending,className:"flex items-center gap-1 px-2 py-1 bg-green-600 hover:bg-green-500 disabled:bg-green-800 text-white text-xs rounded transition-colors",children:_.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-3 h-3 animate-spin"}),"Starting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Lt,{className:"w-3 h-3"}),"Start Containers"]})})]}),_.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded",children:_.error instanceof Error?_.error.message:"Failed to start containers"})]}),!f.hasDocker&&a.jsx("div",{className:"mt-3",children:f.canContainerize?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-xs text-gray-500",children:"Git-only workspace."}),a.jsx("button",{onClick:z,disabled:g.isPending,className:"flex items-center gap-1 px-2 py-1 bg-purple-600 hover:bg-purple-500 disabled:bg-purple-800 text-white text-xs rounded transition-colors",children:g.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-3 h-3 animate-spin"}),"Setting up..."]}):a.jsxs(a.Fragment,{children:[a.jsx(tu,{className:"w-3 h-3"}),"Containerize"]})})]}),g.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded",children:g.error instanceof Error?g.error.message:"Failed to containerize workspace"})]}):a.jsx("div",{className:"text-xs text-gray-500",children:"This is a git-only workspace (no containers)."})}),f.containers&&a.jsxs("div",{className:"mt-3",children:[a.jsx("p",{className:"text-xs text-gray-500 uppercase tracking-wider mb-1",children:"Containers"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(f.containers).map(([b,H])=>{const K=_.isPending&&!H.running;return a.jsxs("span",{className:`flex items-center gap-1 px-2 py-0.5 rounded text-xs ${H.running?"bg-green-900/30 text-green-400":K?"bg-yellow-900/30 text-yellow-400 animate-pulse":"bg-gray-700 text-gray-500"}`,children:[K?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):b==="postgres"||b==="redis"?a.jsx(Ow,{className:"w-3 h-3"}):a.jsx(tu,{className:"w-3 h-3"}),b,H.running&&H.uptime&&a.jsx("span",{className:"text-gray-400 ml-1",children:H.uptime}),K&&a.jsx("span",{className:"text-yellow-500 ml-1",children:"starting..."})]},b)})})]}),f.repoGit&&(f.repoGit.frontend||f.repoGit.api)&&a.jsxs("div",{className:"mt-3 space-y-2",children:[a.jsx("p",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Git Status"}),f.repoGit.frontend&&a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"text-gray-400",children:"Frontend:"}),a.jsxs("span",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx(va,{className:"w-3 h-3 text-gray-500"}),a.jsx("span",{className:"text-gray-300",children:f.repoGit.frontend.branch}),f.repoGit.frontend.uncommittedFiles>0&&a.jsxs("span",{className:"text-yellow-400",children:[f.repoGit.frontend.uncommittedFiles," uncommitted"]})]})]}),f.repoGit.api&&a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"text-gray-400",children:"API:"}),a.jsxs("span",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx(va,{className:"w-3 h-3 text-gray-500"}),a.jsx("span",{className:"text-gray-300",children:f.repoGit.api.branch}),f.repoGit.api.uncommittedFiles>0&&a.jsxs("span",{className:"text-yellow-400",children:[f.repoGit.api.uncommittedFiles," uncommitted"]})]})]})]}),f.git&&!((k=f.repoGit)!=null&&k.frontend)&&!((V=f.repoGit)!=null&&V.api)&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 text-xs",children:[a.jsxs("span",{className:"flex items-center gap-1 text-gray-400",children:[a.jsx(va,{className:"w-3 h-3"}),f.git.branch]}),f.git.uncommittedFiles>0&&a.jsxs("span",{className:"text-yellow-400",children:[f.git.uncommittedFiles," uncommitted"]})]})]})]})}),!(f!=null&&f.exists)&&!p&&a.jsx("div",{className:"bg-yellow-900/20 border border-yellow-700/50 rounded-lg p-4 mb-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 bg-yellow-900/50 rounded-full flex items-center justify-center shrink-0",children:a.jsx(Lt,{className:"w-4 h-4 text-yellow-400"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-yellow-400",children:"No Workspace"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Create a workspace or start an agent to begin work."})]})]})}),p&&a.jsxs("div",{className:"space-y-3 animate-pulse",children:[a.jsx("div",{className:"h-12 bg-gray-600 rounded-lg w-full"}),a.jsx("div",{className:"h-12 bg-gray-700 rounded-lg w-full"})]}),!p&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("button",{onClick:A,disabled:y.isPending||y.isSuccess,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:y.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-5 h-5 animate-spin"}),a.jsx("span",{className:"font-medium",children:"Starting..."})]}):y.isSuccess?a.jsxs(a.Fragment,{children:[a.jsx(Us,{className:"w-5 h-5"}),a.jsx("span",{className:"font-medium",children:"Agent Started!"})]}):a.jsxs(a.Fragment,{children:[a.jsx(Lt,{className:"w-5 h-5"}),a.jsx("span",{className:"font-medium",children:f!=null&&f.exists?"Start Agent in Workspace":"Start Agent"})]})}),!(f!=null&&f.exists)&&a.jsx("button",{onClick:$,disabled:v.isPending||v.isSuccess,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-gray-700 text-white rounded-lg hover:bg-gray-600 transition-colors border border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:v.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-5 h-5 animate-spin"}),a.jsx("span",{className:"font-medium",children:"Creating..."})]}):v.isSuccess?a.jsxs(a.Fragment,{children:[a.jsx(Us,{className:"w-5 h-5"}),a.jsx("span",{className:"font-medium",children:"Workspace Created!"})]}):a.jsxs(a.Fragment,{children:[a.jsx(K2,{className:"w-5 h-5"}),a.jsx("span",{className:"font-medium",children:"Create Workspace Only"})]})}),y.isError&&a.jsx("p",{className:"text-red-400 text-xs",children:"Failed to start agent. Check server logs."}),v.isError&&a.jsx("p",{className:"text-red-400 text-xs",children:"Failed to create workspace. Check server logs."})]}),!p&&a.jsxs("div",{className:"text-xs text-gray-500 mt-3 space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Start Agent:"})," ",f!=null&&f.exists?"Starts autonomous agent in existing workspace":"Creates workspace + starts autonomous agent"]}),!(f!=null&&f.exists)&&a.jsxs("p",{children:[a.jsx("strong",{children:"Create Workspace:"})," Creates git worktree for manual work"]})]})]}),u&&a.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-gray-800 rounded-lg max-w-2xl w-full max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[a.jsxs("h3",{className:"text-lg font-medium text-white flex items-center gap-2",children:[a.jsx(Tn,{className:"w-5 h-5 text-yellow-500"}),"Clean Corrupted Workspace"]}),a.jsx("button",{onClick:()=>c(!1),className:"text-gray-400 hover:text-white",children:a.jsx(Nt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-4 overflow-y-auto flex-1",children:S?a.jsxs("div",{className:"flex items-center justify-center py-8",children:[a.jsx(ye,{className:"w-6 h-6 animate-spin text-gray-400"}),a.jsx("span",{className:"ml-2 text-gray-400",children:"Scanning workspace..."})]}):N?a.jsxs("div",{className:"space-y-4",children:[N.diffAnalysis&&!N.diffAnalysis.error&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("p",{className:"text-xs text-gray-500",children:["Compared against: ",a.jsx("code",{className:"bg-gray-900 px-1 rounded",children:N.diffAnalysis.comparedAgainst})]}),N.diffAnalysis.modifiedFiles.length>0&&a.jsxs("div",{className:"bg-red-900/30 border border-red-700/50 rounded p-3",children:[a.jsxs("h4",{className:"text-sm font-medium text-red-400 flex items-center gap-2",children:[a.jsx("span",{className:"w-2 h-2 bg-red-500 rounded-full"}),N.diffAnalysis.modifiedFiles.length," Modified Files (WILL BE LOST)"]}),a.jsxs("p",{className:"text-xs text-gray-400 mt-1 mb-2",children:["These files have changes that differ from ",a.jsx("code",{children:N.diffAnalysis.comparedAgainst})]}),a.jsx("div",{className:"bg-gray-900 rounded p-2 max-h-32 overflow-y-auto",children:a.jsxs("ul",{className:"text-xs text-red-300 font-mono space-y-0.5",children:[N.diffAnalysis.modifiedFiles.slice(0,20).map((b,H)=>a.jsxs("li",{className:"truncate",children:["• ",b]},H)),N.diffAnalysis.modifiedFiles.length>20&&a.jsxs("li",{className:"text-gray-500",children:["...and ",N.diffAnalysis.modifiedFiles.length-20," more"]})]})})]}),N.diffAnalysis.newFiles.length>0&&a.jsxs("div",{className:"bg-orange-900/30 border border-orange-700/50 rounded p-3",children:[a.jsxs("h4",{className:"text-sm font-medium text-orange-400 flex items-center gap-2",children:[a.jsx("span",{className:"w-2 h-2 bg-orange-500 rounded-full"}),N.diffAnalysis.newFiles.length," New Files (WILL BE LOST)"]}),a.jsxs("p",{className:"text-xs text-gray-400 mt-1 mb-2",children:["These files don't exist in ",a.jsx("code",{children:N.diffAnalysis.comparedAgainst})]}),a.jsx("div",{className:"bg-gray-900 rounded p-2 max-h-24 overflow-y-auto",children:a.jsxs("ul",{className:"text-xs text-orange-300 font-mono space-y-0.5",children:[N.diffAnalysis.newFiles.slice(0,15).map((b,H)=>a.jsxs("li",{className:"truncate",children:["+ ",b]},H)),N.diffAnalysis.newFiles.length>15&&a.jsxs("li",{className:"text-gray-500",children:["...and ",N.diffAnalysis.newFiles.length-15," more"]})]})})]}),N.diffAnalysis.unchangedFiles.length>0&&a.jsxs("div",{className:"bg-green-900/30 border border-green-700/50 rounded p-3",children:[a.jsxs("h4",{className:"text-sm font-medium text-green-400 flex items-center gap-2",children:[a.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full"}),N.diffAnalysis.unchangedFiles.length," Unchanged Files (safe to delete)"]}),a.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["These files are identical to ",a.jsx("code",{children:N.diffAnalysis.comparedAgainst})," and will be recreated."]})]}),N.diffAnalysis.modifiedFiles.length===0&&N.diffAnalysis.newFiles.length===0&&a.jsxs("div",{className:"bg-green-900/30 border border-green-700/50 rounded p-3",children:[a.jsx("p",{className:"text-green-400 text-sm font-medium",children:"✓ No unique changes detected"}),a.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["All analyzed files match ",a.jsx("code",{children:N.diffAnalysis.comparedAgainst}),". Safe to clean without backup."]})]})]}),((M=N.diffAnalysis)==null?void 0:M.error)&&a.jsxs("div",{className:"bg-yellow-900/30 border border-yellow-700/50 rounded p-3",children:[a.jsx("p",{className:"text-yellow-400 text-sm font-medium",children:"⚠️ Could not analyze changes"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:N.diffAnalysis.error}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Recommend creating a backup to be safe."})]}),a.jsxs("div",{className:"bg-gray-900/50 border border-gray-700 rounded p-3",children:[a.jsxs("p",{className:"text-gray-400 text-xs",children:[a.jsx("strong",{children:"Path:"})," ",a.jsx("code",{className:"bg-gray-800 px-1 rounded",children:N.workspacePath})]}),a.jsxs("p",{className:"text-gray-400 text-xs mt-1",children:[a.jsx("strong",{children:"Size:"})," ",N.totalSize," • ",N.fileCount," files analyzed"]})]}),a.jsx("div",{className:"border-t border-gray-700 pt-4",children:a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:h,onChange:b=>d(b.target.checked),className:"mt-1 w-4 h-4 rounded border-gray-600 bg-gray-700 text-blue-500 focus:ring-blue-500"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-white text-sm font-medium",children:"Create backup before cleaning"}),a.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:["Files will be copied to: ",a.jsxs("code",{className:"bg-gray-900 px-1 rounded",children:[".backup-feature-",e.identifier.toLowerCase(),"-*"]})]}),a.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"You can manually restore files from the backup after the new workspace is created."})]})]})}),a.jsxs("details",{className:"group",children:[a.jsx("summary",{className:"text-xs text-gray-500 cursor-pointer hover:text-gray-400",children:"What causes corrupted workspaces?"}),a.jsx("div",{className:"mt-2 bg-blue-900/30 border border-blue-700/50 rounded p-3",children:a.jsxs("ul",{className:"text-xs text-gray-400 space-y-1 list-disc list-inside",children:[a.jsxs("li",{children:["Interrupted ",a.jsx("code",{children:"pan workspace create"})," command"]}),a.jsxs("li",{children:["Manual deletion of the ",a.jsx("code",{children:".git"})," file"]}),a.jsx("li",{children:"Disk space issues during workspace creation"}),a.jsx("li",{children:"Git worktree pruning from the main repository"})]})})]})]}):a.jsx("p",{className:"text-gray-400",children:"Failed to load preview"})}),a.jsxs("div",{className:"px-4 py-3 border-t border-gray-700 flex justify-end gap-3",children:[a.jsx("button",{onClick:()=>c(!1),className:"px-4 py-2 text-gray-400 hover:text-white text-sm",children:"Cancel"}),a.jsx("button",{onClick:R,disabled:j.isPending||S,className:"px-4 py-2 bg-yellow-600 hover:bg-yellow-500 disabled:bg-yellow-800 text-white text-sm rounded flex items-center gap-2",children:j.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-4 h-4 animate-spin"}),h?"Backing up & Cleaning...":"Cleaning..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-4 h-4"}),h?"Backup & Recreate":"Delete & Recreate"]})})]}),j.isError&&a.jsx("div",{className:"px-4 py-2 bg-red-900/30 border-t border-red-700",children:a.jsx("p",{className:"text-red-400 text-sm",children:j.error instanceof Error?j.error.message:"Failed to clean workspace"})})]})})]})}async function MD(){const e=await fetch("/api/activity");if(!e.ok)throw new Error("Failed to fetch activity");return e.json()}function TD({status:e}){switch(e){case"running":return a.jsx(ye,{className:"w-4 h-4 text-blue-400 animate-spin"});case"completed":return a.jsx(So,{className:"w-4 h-4 text-green-400"});case"failed":return a.jsx(ll,{className:"w-4 h-4 text-red-400"})}}function DD(e){return new Date(e).toLocaleTimeString()}function LD({onClose:e}){const{data:t,isLoading:r}=ae({queryKey:["activity"],queryFn:MD,refetchInterval:1e3});return a.jsxs("div",{className:"flex flex-col h-full bg-gray-800 border-l border-gray-700",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(bi,{className:"w-5 h-5 text-blue-400"}),a.jsx("h2",{className:"font-medium text-white",children:"Activity Log"})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white p-1",children:a.jsx(Nt,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:r?a.jsx("div",{className:"flex items-center justify-center h-32 text-gray-400",children:a.jsx(ye,{className:"w-6 h-6 animate-spin"})}):!t||t.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500",children:[a.jsx(bi,{className:"w-8 h-8 mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"No activity yet"}),a.jsx("p",{className:"text-xs mt-1",children:"Start an agent or create a workspace to see output here"})]}):a.jsx("div",{className:"divide-y divide-gray-700",children:t.map(n=>a.jsxs("div",{className:"p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(TD,{status:n.status}),a.jsx("code",{className:"text-sm text-white font-mono flex-1 truncate",children:n.command}),a.jsx("span",{className:"text-xs text-gray-500",children:DD(n.timestamp)})]}),a.jsx("pre",{className:"bg-gray-900 rounded p-2 text-xs text-gray-300 font-mono overflow-x-auto max-h-96 overflow-y-auto",children:n.output.length>0?n.output.join(`
496
- `):n.status==="running"?"Waiting for output...":"No output"}),a.jsx("div",{className:"mt-2 flex items-center gap-2",children:a.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${n.status==="running"?"bg-blue-900/50 text-blue-400":n.status==="completed"?"bg-green-900/50 text-green-400":"bg-red-900/50 text-red-400"}`,children:n.status})})]},n.id))})})]})}async function AD(){const e=await fetch("/api/convoys");if(!e.ok)throw new Error("Failed to fetch convoys");return(await e.json()).convoys}async function OD(e){const t=await fetch(`/api/convoys/${e}`);if(!t.ok)throw new Error("Failed to fetch convoy status");return t.json()}async function ID(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 FD(){return ae({queryKey:["convoys"],queryFn:AD,refetchInterval:5e3})}function BD(e){return ae({queryKey:["convoy",e],queryFn:()=>OD(e),enabled:!!e,refetchInterval:2e3})}function zD(e){return ae({queryKey:["convoy-output",e],queryFn:()=>ID(e),enabled:!!e,refetchInterval:5e3})}function RS({status:e}){switch(e){case"running":return a.jsx(ye,{className:"w-4 h-4 text-blue-400 animate-spin"});case"completed":return a.jsx(So,{className:"w-4 h-4 text-green-400"});case"failed":return a.jsx(ll,{className:"w-4 h-4 text-red-400"});case"partial":return a.jsx(as,{className:"w-4 h-4 text-yellow-400"})}}function $D({status:e}){const t={pending:"bg-gray-900/50 text-gray-400",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 a.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${t[e]||t.pending}`,children:e})}function hp(e){return new Date(e).toLocaleString()}function MS(e,t){const r=new Date(e).getTime(),n=t?new Date(t).getTime():Date.now(),i=Math.floor((n-r)/1e3),s=Math.floor(i/3600),o=Math.floor(i%3600/60),l=i%60;return s>0?`${s}h ${o}m ${l}s`:o>0?`${o}m ${l}s`:`${l}s`}function HD({convoy:e}){const{data:t}=zD(e.id);return a.jsxs("div",{className:"border-t border-gray-700 p-4 bg-gray-900/50",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-500",children:"Template:"}),a.jsx("span",{className:"ml-2 text-white",children:e.template})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-500",children:"Duration:"}),a.jsx("span",{className:"ml-2 text-white",children:MS(e.startedAt,e.completedAt)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-500",children:"Output:"}),a.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,a.jsx(ls,{className:"w-3 h-3"})]})]}),e.context.prUrl&&a.jsxs("div",{children:[a.jsx("span",{className:"text-gray-500",children:"PR:"}),a.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",a.jsx(ls,{className:"w-3 h-3"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-medium text-white mb-2",children:"Agents"}),e.agents.map(r=>a.jsxs("div",{className:"bg-gray-800 rounded p-3",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(RS,{status:r.status}),a.jsx("span",{className:"font-medium text-white",children:r.role}),a.jsxs("span",{className:"text-xs text-gray-500",children:["(",r.subagent,")"]})]}),a.jsx($D,{status:r.status})]}),r.startedAt&&a.jsxs("div",{className:"text-xs text-gray-500 mb-1",children:["Started: ",hp(r.startedAt),r.completedAt&&` • Completed: ${hp(r.completedAt)}`]}),r.status==="running"&&a.jsxs("div",{className:"text-xs text-gray-500",children:["Tmux: ",a.jsx("code",{className:"text-gray-400",children:r.tmuxSession})]}),r.status==="completed"&&t&&t[r.role]&&a.jsx("div",{className:"mt-2",children:a.jsxs("details",{className:"text-xs",children:[a.jsx("summary",{className:"cursor-pointer text-blue-400 hover:text-blue-300",children:"View output"}),a.jsxs("pre",{className:"mt-2 bg-gray-900 rounded p-2 text-gray-300 font-mono overflow-x-auto max-h-64 overflow-y-auto",children:[t[r.role].substring(0,1e3),t[r.role].length>1e3&&`
497
- ... (truncated)`]})]})})]},r.role))]})]})}function WD({onClose:e}){const{data:t,isLoading:r}=FD(),[n,i]=w.useState(null),{data:s}=BD(n||void 0),o=s||n&&(t==null?void 0:t.find(l=>l.id===n));return a.jsxs("div",{className:"flex flex-col h-full bg-gray-800 border-l border-gray-700",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ua,{className:"w-5 h-5 text-purple-400"}),a.jsx("h2",{className:"font-medium text-white",children:"Convoys"}),t&&t.length>0&&a.jsxs("span",{className:"text-xs text-gray-500",children:["(",t.length,")"]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white p-1",children:a.jsx(Nt,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:r?a.jsx("div",{className:"flex items-center justify-center h-32 text-gray-400",children:a.jsx(ye,{className:"w-6 h-6 animate-spin"})}):!t||t.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500",children:[a.jsx(Ua,{className:"w-8 h-8 mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"No convoys yet"}),a.jsx("p",{className:"text-xs mt-1",children:"Start a convoy to see it here"})]}):a.jsx("div",{className:"divide-y divide-gray-700",children:t.map(l=>a.jsxs("div",{className:"p-3",children:[a.jsxs("button",{onClick:()=>i(n===l.id?null:l.id),className:"w-full text-left",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(RS,{status:l.status}),a.jsx("code",{className:"text-sm text-white font-mono flex-1 truncate",children:l.id}),a.jsx("span",{className:"text-xs text-gray-500",children:MS(l.startedAt,l.completedAt)})]}),a.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-400 mb-2",children:[a.jsx("span",{className:"text-purple-400",children:l.template}),a.jsx("span",{children:"•"}),a.jsxs("span",{children:[l.agents.filter(u=>u.status==="completed").length,"/",l.agents.length," agents"]}),a.jsx("span",{children:"•"}),a.jsx("span",{children:hp(l.startedAt)})]}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${l.status==="running"?"bg-blue-900/50 text-blue-400":l.status==="completed"?"bg-green-900/50 text-green-400":l.status==="failed"?"bg-red-900/50 text-red-400":"bg-yellow-900/50 text-yellow-400"}`,children:l.status})})]}),n===l.id&&o&&a.jsx(HD,{convoy:o})]},l.id))})})]})}async function UD(){const e=await fetch("/api/cloister/status");if(!e.ok)throw new Error("Failed to fetch Cloister status");return e.json()}async function KD(){const e=await fetch("/api/cloister/config");if(!e.ok)throw new Error("Failed to fetch Cloister config");return e.json()}async function qD(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 VD(){if(!(await fetch("/api/cloister/start",{method:"POST"})).ok)throw new Error("Failed to start Cloister")}async function QD(){if(!(await fetch("/api/cloister/stop",{method:"POST"})).ok)throw new Error("Failed to stop Cloister")}async function YD(){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 GD(){const[e,t]=w.useState(!1),[r,n]=w.useState(!1),[i,s]=w.useState(!1),o=Ft(),{data:l,refetch:u}=ae({queryKey:["cloister-status"],queryFn:UD,refetchInterval:1e4}),{data:c}=ae({queryKey:["cloister-config"],queryFn:KD}),h=ue({mutationFn:qD,onSuccess:()=>{o.invalidateQueries({queryKey:["cloister-config"]})}}),d=async()=>{s(!0);try{l!=null&&l.running?await QD():await VD(),await u()}finally{s(!1)}},f=async()=>{await YD(),t(!1),u()},p=()=>{c&&h.mutate({startup:{auto_start:!c.startup.auto_start}})};if(!l)return null;const m=l.summary.warning>0||l.summary.stuck>0,x=l.agentsNeedingAttention.length;return a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[l.running?a.jsx(Mw,{className:"w-5 h-5 text-green-400"}):a.jsx(A2,{className:"w-5 h-5 text-gray-500"}),a.jsx("span",{className:"text-sm text-gray-300",children:l.running?"Cloister: Running":"Cloister: Stopped"})]}),l.running&&l.summary.total>0&&a.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[l.summary.active>0&&a.jsxs("span",{className:"text-green-400",children:["🟢 ",l.summary.active]}),l.summary.stale>0&&a.jsxs("span",{className:"text-yellow-400",children:["🟡 ",l.summary.stale]}),l.summary.warning>0&&a.jsxs("span",{className:"text-orange-400",children:["🟠 ",l.summary.warning]}),l.summary.stuck>0&&a.jsxs("span",{className:"text-red-400",children:["🔴 ",l.summary.stuck]})]}),m&&a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 bg-orange-500/20 rounded-lg border border-orange-500/30",children:[a.jsx(Tn,{className:"w-4 h-4 text-orange-400"}),a.jsxs("span",{className:"text-xs text-orange-300",children:[x," agent",x!==1?"s":""," need attention"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:d,disabled:i,className:`px-3 py-1 rounded text-xs transition-colors ${i?"bg-gray-600 text-gray-400 cursor-wait":l.running?"bg-gray-700 text-gray-300 hover:bg-gray-600":"bg-blue-600 text-white hover:bg-blue-700"}`,children:i?l.running?"Stopping...":"Starting...":l.running?"Pause":"Start"}),e?a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 bg-red-600/20 rounded border border-red-600/30",children:[a.jsx("span",{className:"text-xs text-red-300",children:"Confirm?"}),a.jsx("button",{onClick:f,className:"px-2 py-0.5 rounded text-xs bg-red-600 text-white hover:bg-red-700",children:"Yes"}),a.jsx("button",{onClick:()=>t(!1),className:"px-2 py-0.5 rounded text-xs bg-gray-700 text-gray-300 hover:bg-gray-600",children:"No"})]}):a.jsx("button",{onClick:()=>t(!0),className:"px-3 py-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:a.jsx(H2,{className:"w-4 h-4"})}),a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>n(!r),className:`px-2 py-1 rounded text-xs transition-colors ${r?"bg-gray-600 text-white":"bg-gray-700 text-gray-300 hover:bg-gray-600"}`,title:"Cloister settings",children:a.jsx(Bw,{className:"w-4 h-4"})}),r&&a.jsx("div",{className:"absolute right-0 top-full mt-2 w-56 bg-gray-800 border border-gray-700 rounded-lg shadow-lg z-50",children:a.jsxs("div",{className:"p-3",children:[a.jsx("div",{className:"text-xs text-gray-400 font-medium mb-2",children:"Settings"}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer hover:bg-gray-700/50 rounded px-2 py-1.5 -mx-2",children:[a.jsx("input",{type:"checkbox",checked:(c==null?void 0:c.startup.auto_start)??!0,onChange:p,disabled:h.isPending,className:"w-4 h-4 rounded border-gray-600 bg-gray-700 text-blue-500 focus:ring-blue-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-sm text-gray-300",children:"Auto-start on dashboard launch"})]})]})})]})]})]})}function Cv(e){const t=new Date(e),r=t.toLocaleString("default",{month:"short"}),n=t.getDate(),i=t.getHours().toString().padStart(2,"0"),s=t.getMinutes().toString().padStart(2,"0"),o=t.getSeconds().toString().padStart(2,"0");return`${r} ${n}, ${i}:${s}:${o}`}async function XD(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 JD(){const e=await fetch("/api/handoffs/stats");if(!e.ok)throw new Error("Failed to fetch handoff stats");return e.json()}async function ZD(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 eL(){const e=await fetch("/api/specialist-handoffs/stats");if(!e.ok)throw new Error("Failed to fetch specialist handoff stats");return e.json()}const kv={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"},tL={stuck_escalation:"Stuck Escalation",planning_complete:"Planning Complete",test_failure:"Test Failure",task_complete:"Task Complete",manual:"Manual"},rL={stuck_escalation:"text-red-400",planning_complete:"text-green-400",test_failure:"text-orange-400",task_complete:"text-blue-400",manual:"text-gray-400"},Nv={"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"},nL={queued:"text-yellow-400",processing:"text-blue-400",completed:"text-green-400",failed:"text-red-400"},iL={urgent:"text-red-400",high:"text-orange-400",normal:"text-blue-400",low:"text-gray-400"};function sL(){var u,c,h,d,f;const{data:e,isLoading:t}=ae({queryKey:["handoffs"],queryFn:()=>XD(50),refetchInterval:1e4}),{data:r,isLoading:n}=ae({queryKey:["handoff-stats"],queryFn:JD,refetchInterval:3e4}),{data:i,isLoading:s}=ae({queryKey:["specialist-handoffs"],queryFn:()=>ZD(50),refetchInterval:1e4}),{data:o,isLoading:l}=ae({queryKey:["specialist-handoff-stats"],queryFn:eL,refetchInterval:3e4});return t||n||s||l?a.jsx("div",{className:"p-6",children:a.jsx("div",{className:"text-gray-400",children:"Loading handoff data..."})}):a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold text-white mb-2",children:"Model Handoffs"}),a.jsx("p",{className:"text-gray-400",children:"History of automatic and manual model handoffs across agents"})]}),r&&a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"p-4 bg-gray-800 rounded-lg border border-gray-700",children:[a.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Total Handoffs"}),a.jsx("div",{className:"text-2xl font-bold text-white",children:r.totalHandoffs})]}),a.jsxs("div",{className:"p-4 bg-gray-800 rounded-lg border border-gray-700",children:[a.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Success Rate"}),a.jsxs("div",{className:"text-2xl font-bold text-green-400",children:[(r.successRate*100).toFixed(0),"%"]})]}),a.jsxs("div",{className:"p-4 bg-gray-800 rounded-lg border border-gray-700",children:[a.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Most Common Trigger"}),a.jsx("div",{className:"text-sm font-medium text-white",children:((u=Object.entries(r.byTrigger).sort((p,m)=>m[1]-p[1])[0])==null?void 0:u[0])||"N/A"}),a.jsxs("div",{className:"text-xs text-gray-500",children:[((c=Object.entries(r.byTrigger).sort((p,m)=>m[1]-p[1])[0])==null?void 0:c[1])||0," times"]})]}),a.jsxs("div",{className:"p-4 bg-gray-800 rounded-lg border border-gray-700",children:[a.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Most Popular Target"}),a.jsx("div",{className:"text-sm font-medium text-white",children:((h=Object.entries(r.byModel.to).sort((p,m)=>m[1]-p[1])[0])==null?void 0:h[0])||"N/A"}),a.jsxs("div",{className:"text-xs text-gray-500",children:[((d=Object.entries(r.byModel.to).sort((p,m)=>m[1]-p[1])[0])==null?void 0:d[1])||0," handoffs"]})]})]}),a.jsxs("div",{className:"bg-gray-800 rounded-lg border border-gray-700 overflow-hidden",children:[a.jsx("div",{className:"p-4 border-b border-gray-700",children:a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Recent Handoffs"})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-gray-750 text-left text-sm text-gray-400",children:[a.jsx("th",{className:"px-4 py-3",children:"Timestamp"}),a.jsx("th",{className:"px-4 py-3",children:"Agent"}),a.jsx("th",{className:"px-4 py-3",children:"Transition"}),a.jsx("th",{className:"px-4 py-3",children:"Trigger"}),a.jsx("th",{className:"px-4 py-3",children:"Reason"}),a.jsx("th",{className:"px-4 py-3",children:"Cost"}),a.jsx("th",{className:"px-4 py-3",children:"Status"})]})}),a.jsx("tbody",{className:"text-sm",children:e&&e.handoffs.length>0?e.handoffs.map((p,m)=>a.jsxs("tr",{className:"border-t border-gray-700 hover:bg-gray-750",children:[a.jsx("td",{className:"px-4 py-3 text-gray-400",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ha,{className:"w-3 h-3"}),Cv(p.timestamp)]})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"font-medium text-white",children:p.agentId}),a.jsx("div",{className:"text-xs text-gray-500",children:p.issueId})]}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${kv[p.from.model]||"text-gray-400 bg-gray-700"}`,children:p.from.model}),a.jsx(ff,{className:"w-3 h-3 text-gray-500"}),a.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${kv[p.to.model]||"text-gray-400 bg-gray-700"}`,children:p.to.model})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`text-xs ${rL[p.trigger]||"text-gray-400"}`,children:tL[p.trigger]||p.trigger})}),a.jsx("td",{className:"px-4 py-3 text-gray-300 max-w-xs truncate",children:p.reason}),a.jsx("td",{className:"px-4 py-3 text-emerald-400",children:p.context.costAtHandoff!==void 0?`$${p.context.costAtHandoff.toFixed(4)}`:"-"}),a.jsx("td",{className:"px-4 py-3",children:p.success?a.jsx("span",{className:"text-green-400 text-xs",children:"✓ Success"}):a.jsx("span",{className:"text-red-400 text-xs",title:p.errorMessage,children:"✗ Failed"})})]},`${p.timestamp}-${m}`)):a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-gray-500",children:"No handoffs recorded yet"})})})]})})]}),a.jsxs("div",{className:"mt-12",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h2",{className:"text-2xl font-bold text-white mb-2",children:"Specialist Handoffs"}),a.jsx("p",{className:"text-gray-400",children:"Queue-based work handoffs between specialist agents (review, test, merge)"})]}),o&&a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"p-4 bg-gray-800 rounded-lg border border-gray-700",children:[a.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Today's Handoffs"}),a.jsx("div",{className:"text-2xl font-bold text-white",children:o.todayCount})]}),a.jsxs("div",{className:"p-4 bg-gray-800 rounded-lg border border-gray-700",children:[a.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Queue Depth"}),a.jsx("div",{className:"text-2xl font-bold text-orange-400",children:o.queueDepth})]}),a.jsxs("div",{className:"p-4 bg-gray-800 rounded-lg border border-gray-700",children:[a.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Success Rate"}),a.jsxs("div",{className:"text-2xl font-bold text-green-400",children:[(o.successRate*100).toFixed(0),"%"]})]}),a.jsxs("div",{className:"p-4 bg-gray-800 rounded-lg border border-gray-700",children:[a.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Most Active"}),a.jsx("div",{className:"text-sm font-medium text-white",children:((f=Object.entries(o.bySpecialist).map(([p,m])=>({name:p,total:m.sent+m.received})).sort((p,m)=>m.total-p.total)[0])==null?void 0:f.name)||"N/A"})]})]}),a.jsxs("div",{className:"bg-gray-800 rounded-lg border border-gray-700 overflow-hidden mt-6",children:[a.jsx("div",{className:"p-4 border-b border-gray-700",children:a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Recent Specialist Handoffs"})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-gray-750 text-left text-sm text-gray-400",children:[a.jsx("th",{className:"px-4 py-3",children:"Timestamp"}),a.jsx("th",{className:"px-4 py-3",children:"Issue"}),a.jsx("th",{className:"px-4 py-3",children:"Transition"}),a.jsx("th",{className:"px-4 py-3",children:"Priority"}),a.jsx("th",{className:"px-4 py-3",children:"Status"}),a.jsx("th",{className:"px-4 py-3",children:"Workspace"})]})}),a.jsx("tbody",{className:"text-sm",children:i&&i.handoffs.length>0?i.handoffs.map(p=>{var m,x;return a.jsxs("tr",{className:"border-t border-gray-700 hover:bg-gray-750",children:[a.jsx("td",{className:"px-4 py-3 text-gray-400",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ha,{className:"w-3 h-3"}),Cv(p.timestamp)]})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"font-medium text-white",children:p.issueId}),((m=p.context)==null?void 0:m.branch)&&a.jsx("div",{className:"text-xs text-gray-500",children:p.context.branch})]}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${Nv[p.fromSpecialist]||"text-gray-400 bg-gray-700"}`,children:p.fromSpecialist}),a.jsx(ff,{className:"w-3 h-3 text-gray-500"}),a.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${Nv[p.toSpecialist]||"text-gray-400 bg-gray-700"}`,children:p.toSpecialist})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`text-xs ${iL[p.priority]}`,children:p.priority})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:`text-xs ${nL[p.status]}`,children:p.status}),p.result&&a.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:["(",p.result,")"]})]}),a.jsx("td",{className:"px-4 py-3 text-gray-400 text-xs",children:((x=p.context)==null?void 0:x.workspace)||"-"})]},p.id)}):a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-gray-500",children:"No specialist handoffs recorded yet"})})})]})})]})]})]})}function oL({request:e,isOpen:t,onConfirm:r,onDeny:n,onClose:i}){return!t||!e?null:a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg shadow-2xl w-full max-w-md mx-4",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Tn,{className:"w-5 h-5 text-orange-400"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Confirmation Required"})]}),a.jsx("button",{onClick:i,className:"text-gray-400 hover:text-gray-300 transition-colors",children:a.jsx(Nt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-400 mb-1",children:"Agent:"}),a.jsx("p",{className:"text-base text-white font-medium",children:e.agentId})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-400 mb-1",children:"Action:"}),a.jsx("p",{className:"text-base text-white font-medium",children:e.action})]}),e.details&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-400 mb-1",children:"Details:"}),a.jsx("p",{className:"text-sm text-gray-300 bg-gray-900/50 p-2 rounded border border-gray-700",children:e.details})]}),a.jsx("div",{className:"mt-4 p-3 bg-orange-500/10 border border-orange-500/30 rounded",children:a.jsx("p",{className:"text-sm text-orange-200",children:"⚠️ This action cannot be undone. Please confirm that you want to proceed."})})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-gray-700 bg-gray-900/30",children:[a.jsx("button",{onClick:n,className:"px-4 py-2 rounded text-sm bg-gray-700 text-gray-300 hover:bg-gray-600 transition-colors",children:"Deny"}),a.jsx("button",{onClick:r,className:"px-4 py-2 rounded text-sm bg-orange-600 text-white hover:bg-orange-700 transition-colors font-medium",children:"Confirm"})]})]})})}async function aL(){const e=await fetch("/api/metrics/summary");if(!e.ok)throw new Error("Failed to fetch metrics summary");return e.json()}async function lL(){const e=await fetch("/api/handoffs/stats");if(!e.ok)throw new Error("Failed to fetch handoff stats");return e.json()}async function cL(){const e=await fetch("/api/specialist-handoffs/stats");if(!e.ok)throw new Error("Failed to fetch specialist handoff stats");return e.json()}function uL(){const{data:e}=ae({queryKey:["metrics-summary"],queryFn:aL,refetchInterval:3e4}),{data:t}=ae({queryKey:["handoff-stats"],queryFn:lL,refetchInterval:3e4}),{data:r}=ae({queryKey:["specialist-handoff-stats"],queryFn:cL,refetchInterval:3e4});if(!e)return null;const n=t?Object.values(t.byTrigger).reduce((i,s)=>i+s,0):0;return a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:[a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(cl,{className:"w-5 h-5 text-green-400"}),a.jsx("span",{className:"text-sm text-gray-400",children:"Cost Today"})]})}),a.jsxs("div",{className:"text-2xl font-bold text-white",children:["$",e.today.totalCost.toFixed(2)]}),e.topSpenders.agents.length>0&&a.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:["Top: ",e.topSpenders.agents[0].agentId," ($",e.topSpenders.agents[0].cost.toFixed(2),")"]})]}),a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ua,{className:"w-5 h-5 text-blue-400"}),a.jsx("span",{className:"text-sm text-gray-400",children:"Agents"})]})}),a.jsxs("div",{className:"text-2xl font-bold text-white",children:[e.today.activeCount," / ",e.today.agentCount]}),a.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:[e.today.activeCount," active, ",e.today.agentCount-e.today.activeCount," ","idle"]})]}),a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Tn,{className:"w-5 h-5 text-red-400"}),a.jsx("span",{className:"text-sm text-gray-400",children:"Stuck Agents"})]})}),a.jsx("div",{className:"text-2xl font-bold text-white",children:e.today.stuckCount}),a.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:[e.today.warningCount," warnings"]})]}),a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(va,{className:"w-5 h-5 text-cyan-400"}),a.jsx("span",{className:"text-sm text-gray-400",children:"Specialist Handoffs"})]})}),a.jsx("div",{className:"text-2xl font-bold text-white",children:(r==null?void 0:r.todayCount)??0}),a.jsx("div",{className:"mt-2 text-xs text-gray-500",children:r?`${(r.successRate*100).toFixed(0)}% success rate`:"No data"})]}),a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Hw,{className:"w-5 h-5 text-purple-400"}),a.jsx("span",{className:"text-sm text-gray-400",children:"Cost Escalations"})]})}),a.jsx("div",{className:"text-2xl font-bold text-white",children:n}),a.jsx("div",{className:"mt-2 text-xs text-gray-500",children:t?`${(t.successRate*100).toFixed(0)}% success rate`:"No data"})]}),a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(V2,{className:"w-5 h-5 text-orange-400"}),a.jsx("span",{className:"text-sm text-gray-400",children:"Queue Depth"})]})}),a.jsx("div",{className:"text-2xl font-bold text-white",children:(r==null?void 0:r.queueDepth)??0}),a.jsx("div",{className:"mt-2 text-xs text-gray-500",children:(r==null?void 0:r.queueDepth)===0?"All clear":`${r==null?void 0:r.queueDepth} pending`})]})]})}async function hL(){const e=await fetch("/api/metrics/summary");if(!e.ok)throw new Error("Failed to fetch metrics summary");return e.json()}async function dL(){const e=await fetch("/api/metrics/costs");if(!e.ok)throw new Error("Failed to fetch cost metrics");return e.json()}function fL(){const{data:e}=ae({queryKey:["metrics-summary"],queryFn:hL,refetchInterval:3e4}),{data:t}=ae({queryKey:["metrics-costs"],queryFn:dL,refetchInterval:3e4});return a.jsxs("div",{className:"p-6 overflow-auto h-full",children:[a.jsx("h1",{className:"text-3xl font-bold text-white mb-6",children:"Metrics Dashboard"}),e&&a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(cl,{className:"w-6 h-6 text-green-400"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Cost Today"})]}),a.jsxs("div",{className:"text-3xl font-bold text-white mb-2",children:["$",e.today.totalCost.toFixed(2)]}),a.jsx("div",{className:"text-sm text-gray-400",children:"Daily total"})]}),a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(Hw,{className:"w-6 h-6 text-blue-400"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Active Agents"})]}),a.jsx("div",{className:"text-3xl font-bold text-white mb-2",children:e.today.activeCount}),a.jsxs("div",{className:"text-sm text-gray-400",children:["of ",e.today.agentCount," total"]})]}),a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(Tn,{className:"w-6 h-6 text-red-400"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Stuck Agents"})]}),a.jsx("div",{className:"text-3xl font-bold text-white mb-2",children:e.today.stuckCount}),a.jsxs("div",{className:"text-sm text-gray-400",children:[e.today.warningCount," warnings"]})]}),a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(ym,{className:"w-6 h-6 text-purple-400"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Handoffs Today"})]}),a.jsx("div",{className:"text-3xl font-bold text-white mb-2",children:"-"}),a.jsx("div",{className:"text-sm text-gray-400",children:"Coming soon"})]})]}),t&&a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8",children:[a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-6",children:[a.jsx("h3",{className:"text-xl font-semibold text-white mb-4",children:"Top Agents by Cost"}),a.jsxs("div",{className:"space-y-3",children:[t.topAgents.slice(0,10).map((r,n)=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-900/50 rounded",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"text-lg font-bold text-gray-500",children:["#",n+1]}),a.jsx("span",{className:"text-white font-mono text-sm",children:r.agentId})]}),a.jsxs("span",{className:"text-green-400 font-semibold",children:["$",r.cost.toFixed(2)]})]},r.agentId)),t.topAgents.length===0&&a.jsx("div",{className:"text-center text-gray-500 py-8",children:"No cost data yet"})]})]}),a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-6",children:[a.jsx("h3",{className:"text-xl font-semibold text-white mb-4",children:"Top Issues by Cost"}),a.jsxs("div",{className:"space-y-3",children:[t.topIssues.slice(0,10).map((r,n)=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-900/50 rounded",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"text-lg font-bold text-gray-500",children:["#",n+1]}),a.jsx("span",{className:"text-white font-mono text-sm",children:r.issueId})]}),a.jsxs("span",{className:"text-green-400 font-semibold",children:["$",r.cost.toFixed(2)]})]},r.issueId)),t.topIssues.length===0&&a.jsx("div",{className:"text-center text-gray-500 py-8",children:"No cost data yet"})]})]})]}),a.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg p-6",children:[a.jsx("h3",{className:"text-xl font-semibold text-white mb-4",children:"Historical Trends"}),a.jsxs("div",{className:"text-center text-gray-500 py-16",children:[a.jsx("p",{className:"mb-2",children:"Charts coming soon"}),a.jsx("p",{className:"text-sm",children:"Cost over time, handoff success rates, and more"})]})]})]})}const Ym={anthropic:{name:"Anthropic",models:[{id:"claude-opus-4-5",name:"Claude Opus 4.5",icon:"diamond",tier:"premium",capabilities:["reasoning","code","vision","agentic"],description:"Most capable, best for complex tasks"},{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",icon:"auto_awesome",tier:"balanced",capabilities:["reasoning","code","vision","agentic"],description:"Great balance of speed and capability"},{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-4o",name:"GPT-4o",icon:"science",tier:"balanced",capabilities:["reasoning","code","vision"],description:"Versatile multimodal model"},{id:"o1",name:"o1",icon:"psychology",tier:"premium",capabilities:["reasoning","complex-math"],description:"Deep reasoning, slower responses"},{id:"o3-mini",name:"o3-mini",icon:"bolt",tier:"fast",capabilities:["fast","reasoning","code"],description:"Fast reasoning model"}]},google:{name:"Google",models:[{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",icon:"model_training",tier:"premium",capabilities:["reasoning","large-context","code"],description:"1M context, great for large codebases"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient","reasoning"],description:"Fast and affordable"}]},kimi:{name:"Kimi (Moonshot)",models:[{id:"kimi-k2",name:"Kimi K2",icon:"token",tier:"premium",capabilities:["reasoning","code","agentic","large-context"],description:"Top-tier coding, 128K context"},{id:"kimi-k2-turbo",name:"Kimi K2 Turbo",icon:"bolt",tier:"fast",capabilities:["fast","code","efficiency"],description:"Fast coding assistant"}]},zai:{name:"Zhipu (GLM)",models:[{id:"glm-4-plus",name:"GLM-4 Plus",icon:"hub",tier:"premium",capabilities:["reasoning","code"],description:"Flagship reasoning model"},{id:"glm-4-air",name:"GLM-4 Air",icon:"cloud",tier:"balanced",capabilities:["reasoning","code","efficiency"],description:"Balanced speed and quality"},{id:"glm-4-flash",name:"GLM-4 Flash",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient"],description:"Ultra-fast responses"},{id:"glm-4-long",name:"GLM-4 Long",icon:"format_list_bulleted",tier:"balanced",capabilities:["large-context","reasoning"],description:"1M token context window"}]}},Gm={"issue-agent:exploration":["reasoning","large-context"],"issue-agent:planning":["reasoning","code"],"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"],"planning-agent":["reasoning","code"],"cli:interactive":["reasoning","code"],"cli:quick-command":["fast"]},pL={"issue-agent:exploration":"Exploration Phase","issue-agent:planning":"Planning 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","planning-agent":"Planning Agent","cli:interactive":"CLI Interactive","cli:quick-command":"CLI Quick Command"},Gn={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 mL(){return Object.values(Ym).flatMap(e=>e.models)}function TS(e){const t=mL(),r=t.find(i=>i.id===e);if(r)return r;const n=e.toLowerCase();if(n.includes("opus")&&n.includes("4"))return t.find(i=>i.id==="claude-opus-4-5");if(n.includes("sonnet")&&n.includes("4"))return t.find(i=>i.id==="claude-sonnet-4-5");if(n.includes("haiku"))return t.find(i=>i.id==="claude-haiku-4-5");if(n.includes("claude")&&!n.includes("opus")&&!n.includes("haiku"))return t.find(i=>i.id==="claude-sonnet-4-5");if(n.includes("gpt-4o")||n==="gpt4o")return t.find(i=>i.id==="gpt-4o");if(n.includes("o1")&&!n.includes("o3"))return t.find(i=>i.id==="o1");if(n.includes("o3"))return t.find(i=>i.id==="o3-mini");if(n.includes("gemini")&&n.includes("flash"))return t.find(i=>i.id==="gemini-2.5-flash");if(n.includes("gemini"))return t.find(i=>i.id==="gemini-2.5-pro");if(n.includes("kimi")||n.includes("moonshot"))return n.includes("turbo")||n.includes("fast")?t.find(i=>i.id==="kimi-k2-turbo"):t.find(i=>i.id==="kimi-k2");if(n.includes("glm")||n.includes("zhipu")||n.includes("chatglm"))return n.includes("flash")?t.find(i=>i.id==="glm-4-flash"):n.includes("air")?t.find(i=>i.id==="glm-4-air"):n.includes("long")||n.includes("1m")?t.find(i=>i.id==="glm-4-long"):t.find(i=>i.id==="glm-4-plus")}function gL(e,t){const r=TS(e),n=Gm[t]||["reasoning"];if(!r)return{score:0,matched:[],missing:n};const i=n.filter(o=>r.capabilities.includes(o)),s=n.filter(o=>!r.capabilities.includes(o));return{score:n.length>0?i.length/n.length:0,matched:i,missing:s}}function yL({workType:e,currentModel:t,isOverride:r,enabledProviders:n,onApply:i,onRemove:s,onClose:o}){const[l,u]=w.useState(t),c=pL[e]||e,h=Gm[e]||["reasoning"],d=w.useMemo(()=>Object.entries(Ym).filter(([x])=>x==="anthropic"||n.includes(x)),[n]),f=w.useMemo(()=>{let x=null;for(const[C,y]of d)for(const v of y.models){const _=v.capabilities.filter(j=>h.includes(j)).length/h.length,N=v.tier==="balanced"?.1:0,S=_+N;(!x||S>x.score)&&(x={id:v.id,score:S})}return x==null?void 0:x.id},[d,h]),p=()=>{i(l),o()},m=l!==t;return a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm p-4",children:[a.jsxs("div",{className:"w-full max-w-[680px] bg-[#0f172a] border border-slate-800 rounded-xl shadow-2xl flex flex-col overflow-hidden",children:[a.jsx("div",{className:"p-6 border-b border-slate-800",children:a.jsxs("div",{className:"flex justify-between items-start gap-3",children:[a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx("h1",{className:"text-white tracking-tight text-2xl font-bold",children:"Select Model"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-slate-400 text-sm",children:"Task:"}),a.jsx("span",{className:"text-blue-400 font-medium",children:c})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("span",{className:"text-slate-500 text-xs",children:"Needs:"}),h.map(x=>a.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded bg-blue-500/20 text-blue-300 font-medium",children:Gn[x].name},x))]})]}),a.jsx("button",{onClick:o,className:"text-slate-400 hover:text-white transition-colors p-1",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar max-h-[450px]",children:d.map(([x,C],y)=>a.jsxs("div",{className:"flex flex-col",children:[y>0&&a.jsx("div",{className:"h-px bg-slate-800 mx-6 my-2"}),a.jsx("h3",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest px-6 pb-2 pt-5",children:C.name}),C.models.map(v=>{const g=l===v.id,_=v.id===f,N=v.capabilities.filter(j=>h.includes(j)),S=N.length/h.length;return a.jsxs("div",{onClick:()=>u(v.id),title:v.description,className:`group flex items-center gap-4 px-6 py-3.5 cursor-pointer transition-all border-l-2 ${g?"bg-blue-500/10 border-blue-400 shadow-[0_0_15px_rgba(59,130,246,0.1)]":_?"bg-blue-500/5 border-blue-400/50 hover:bg-blue-500/10":"border-transparent hover:bg-slate-800/50"}`,children:[a.jsx("div",{className:`flex items-center justify-center rounded-lg shrink-0 size-10 transition-colors ${g||_?"bg-blue-500/20":"bg-slate-800 group-hover:bg-slate-700"}`,children:a.jsx("span",{className:`material-symbols-outlined text-xl ${g||_?"text-blue-400":"text-slate-400"}`,children:v.icon})}),a.jsxs("div",{className:"flex flex-1 flex-col justify-center min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:`text-white text-sm ${g?"font-bold":"font-medium"} truncate`,children:v.name}),_&&a.jsx("span",{className:"px-2 py-0.5 rounded-full bg-blue-500 text-[9px] text-white font-bold uppercase tracking-tight shrink-0",children:"Best Fit"}),v.tier==="premium"&&!_&&a.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"}),v.tier==="fast"&&a.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"})]}),a.jsx("div",{className:"flex gap-1.5 mt-1.5 flex-wrap",children:v.capabilities.map(j=>{const A=N.includes(j);return a.jsx("span",{title:Gn[j].description,className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${A?"bg-blue-500/20 text-blue-300":"bg-slate-800 text-slate-500"}`,children:Gn[j].name},j)})})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[S===1?a.jsx("span",{className:"text-emerald-400 text-xs font-bold",children:"100%"}):S>=.5?a.jsxs("span",{className:"text-amber-400 text-xs font-bold",children:[Math.round(S*100),"%"]}):a.jsxs("span",{className:"text-slate-500 text-xs font-bold",children:[Math.round(S*100),"%"]}),g&&a.jsx("span",{className:"material-symbols-outlined text-blue-400",children:"check_circle"})]})]},v.id)})]},x))}),a.jsxs("div",{className:"p-5 border-t border-slate-800 bg-slate-900/50 flex justify-between items-center",children:[a.jsx("div",{children:r&&a.jsx("button",{onClick:()=>{s(),o()},className:"text-rose-400 hover:text-rose-300 text-sm font-medium transition-colors",children:"Remove Override"})}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:o,className:"px-5 py-2 rounded-lg text-slate-400 font-medium hover:text-white hover:bg-slate-800 transition-all text-sm",children:"Cancel"}),a.jsx("button",{onClick:p,disabled:!m&&r,className:"px-6 py-2 rounded-lg bg-blue-500 text-white 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"})]})]})]}),a.jsx("style",{children:`
498
- .custom-scrollbar::-webkit-scrollbar {
499
- width: 4px;
500
- }
501
- .custom-scrollbar::-webkit-scrollbar-track {
502
- background: transparent;
503
- }
504
- .custom-scrollbar::-webkit-scrollbar-thumb {
505
- background: #1e293b;
506
- border-radius: 10px;
507
- }
508
- .custom-scrollbar::-webkit-scrollbar-thumb:hover {
509
- background: #3b82f6;
510
- }
511
- `})]})}async function vL(){const e=await fetch("/api/settings");if(!e.ok)throw new Error("Failed to fetch settings");return e.json()}async function xL(e){const t=await fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.text();throw new Error(r||"Failed to save settings")}}async function _L(){const e=await fetch("/api/settings/optimal-defaults");if(!e.ok)throw new Error("Failed to fetch optimal defaults");return e.json()}async function Ev(e,t,r){const n=await fetch("/api/settings/test-api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,apiKey:t,model:r})});if(!n.ok)throw new Error("Failed to test API key");return n.json()}const Qh=[{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-..."}],wL=[{name:"Issue Agent Phases",icon:"list_alt",agents:[{id:"issue-agent:exploration",name:"Exploration",icon:"search",description:"Codebase discovery"},{id:"issue-agent:planning",name:"Planning",icon:"event_note",description:"Implementation design"},{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:"planning-agent",name:"Planning",icon:"event",description:"Sprint planning"}]},{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"}]}],jv="claude-sonnet-4-5";function bL(e){const t=TS(e);return t?t.name:e.includes("claude")?e.includes("opus")?"Opus 4.5":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")?"Kimi K2":e.includes("glm")?"GLM-4":e}function SL(){var L,B;const e=Ft(),{data:t,isLoading:r,error:n}=ae({queryKey:["settings"],queryFn:vL}),[i,s]=w.useState(null),[o,l]=w.useState({}),[u,c]=w.useState(null),[h,d]=w.useState(null),[f,p]=w.useState({}),[m,x]=w.useState(null),[C,y]=w.useState(null),[v,g]=w.useState({});w.useEffect(()=>{t&&!i&&s(t)},[t,i]);const _=ue({mutationFn:xL,onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]})}});if(r)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(ye,{className:"w-8 h-8 text-blue-400 animate-spin"})});if(n||!i)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-red-400",children:["Error: ",(n==null?void 0:n.message)||"Failed to load settings"]})});const N=JSON.stringify(i)!==JSON.stringify(t),S=O=>{O!=="anthropic"&&s({...i,models:{...i.models,providers:{...i.models.providers,[O]:!i.models.providers[O]}}})},j=(O,E)=>{O!=="anthropic"&&s({...i,api_keys:{...i.api_keys,[O]:E||void 0}})},A=(O,E)=>{s({...i,models:{...i.models,overrides:{...i.models.overrides,[O]:E}}})},$=O=>{const{[O]:E,...F}=i.models.overrides;s({...i,models:{...i.models,overrides:F}})},z=()=>_.mutate(i),I=()=>s(t||null),P=async()=>{try{const O=await _L(),E={models:{providers:{...(i==null?void 0:i.models.providers)||O.models.providers},overrides:{...O.models.overrides},gemini_thinking_level:O.models.gemini_thinking_level},api_keys:{...(i==null?void 0:i.api_keys)||{}}};s(E)}catch(O){console.error("Failed to fetch optimal defaults:",O),alert("Failed to load optimal defaults: "+O.message)}},R=async O=>{const E=i==null?void 0:i.api_keys[O];if(E){d(O),p({...f,[O]:null});try{const F=await Ev(O,E);p({...f,[O]:F})}catch{p({...f,[O]:{success:!1,error:"Test failed",response:null,latencyMs:0}})}finally{d(null)}}},D=async(O,E)=>{const F=i==null?void 0:i.api_keys[O];if(!F)return;const k=`${O}:${E}`;y(k),g({...v,[k]:null});try{const V=await Ev(O,F,E);g({...v,[k]:V})}catch{g({...v,[k]:{success:!1,error:"Test failed",response:null,latencyMs:0}})}finally{y(null)}};return a.jsxs("div",{className:"max-w-[1200px] mx-auto px-6 md:px-10 py-8 pb-32",children:[a.jsx("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4 mb-8",children:a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"material-symbols-outlined text-blue-400 text-2xl",children:"settings"}),a.jsx("h1",{className:"text-white text-4xl font-black tracking-tight",children:"Settings"})]}),a.jsx("p",{className:"text-slate-400 text-base",children:"Configure AI model orchestration and agent permissions."})]})}),a.jsx("section",{className:"mb-10",children:a.jsx("div",{className:"bg-slate-800/50 border border-slate-700 rounded-xl overflow-hidden",children:a.jsxs("div",{className:"flex flex-col lg:flex-row",children:[a.jsxs("div",{className:"lg:w-2/5 bg-slate-900/50 p-8 flex flex-col justify-center items-center border-b lg:border-b-0 lg:border-r border-slate-700 relative overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 opacity-10 pointer-events-none bg-[radial-gradient(circle_at_50%_50%,#3b82f6_0%,transparent_70%)]"}),a.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6 w-full max-w-xs",children:[a.jsxs("div",{className:"flex items-center justify-between w-full",children:[a.jsx("div",{className:"size-12 rounded-lg bg-slate-800 border border-slate-700 flex items-center justify-center",children:a.jsx("span",{className:"material-symbols-outlined text-slate-400",children:"terminal"})}),a.jsx("div",{className:"flex-1 h-px bg-gradient-to-r from-slate-700 via-blue-500 to-slate-700 mx-2"}),a.jsx("div",{className:"size-12 rounded-lg bg-slate-800 border border-slate-700 flex items-center justify-center",children:a.jsx("span",{className:"material-symbols-outlined text-blue-400",children:"account_tree"})}),a.jsx("div",{className:"flex-1 h-px bg-gradient-to-r from-slate-700 via-blue-500 to-slate-700 mx-2"}),a.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:a.jsx("span",{className:"material-symbols-outlined text-white",children:"bolt"})})]}),a.jsxs("div",{className:"flex justify-between w-full px-2 text-[10px] uppercase tracking-widest font-bold text-slate-500",children:[a.jsx("span",{children:"Task"}),a.jsx("span",{children:"Capability"}),a.jsx("span",{children:"Model"})]})]})]}),a.jsxs("div",{className:"lg:w-3/5 p-8",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.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"}),a.jsx("h3",{className:"text-white text-xl font-bold",children:"Smart Model Selection"})]}),a.jsx("p",{className:"text-slate-400 mb-6 leading-relaxed",children:"Panopticon automatically routes tasks to the optimal model based on capabilities, token budget, and latency requirements."}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("span",{className:"material-symbols-outlined text-blue-400 text-sm mt-1",children:"check_circle"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-slate-200",children:"Capability Matching"}),a.jsx("p",{className:"text-xs text-slate-500",children:"Best model for each task type"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("span",{className:"material-symbols-outlined text-blue-400 text-sm mt-1",children:"check_circle"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-slate-200",children:"Cost Optimization"}),a.jsx("p",{className:"text-xs text-slate-500",children:"Balance performance vs spend"})]})]})]})]})]})})}),a.jsxs("section",{className:"mb-12",children:[a.jsxs("h2",{className:"text-white text-2xl font-bold mb-6 flex items-center gap-3",children:["Provider Configuration",a.jsx("div",{className:"h-px flex-1 bg-slate-700"})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:Qh.map(O=>{var V,M,b,H,K;const E=O.id==="anthropic",F=E||i.models.providers[O.id],k=i.api_keys[O.id]||"";return a.jsxs("div",{className:`bg-slate-800/50 border rounded-xl p-5 relative transition-colors ${E?"border-blue-500/50 shadow-lg shadow-blue-500/5":"border-slate-700 hover:border-slate-600"}`,children:[E&&a.jsx("div",{className:"absolute -top-3 right-4",children:a.jsx("span",{className:"bg-blue-500 text-white text-[10px] font-black px-2 py-0.5 rounded uppercase tracking-tighter",children:"Default"})}),a.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[a.jsx("div",{className:"size-10 rounded-lg bg-slate-800 flex items-center justify-center",children:a.jsx("span",{className:"material-symbols-outlined text-slate-400",children:O.icon})}),a.jsx("span",{className:"font-bold text-white",children:O.name}),a.jsx("div",{className:"ml-auto",children:a.jsx("button",{onClick:()=>S(O.id),disabled:E,className:`w-10 h-5 rounded-full relative transition-colors ${F?"bg-blue-500":"bg-slate-700"} ${E?"cursor-not-allowed":"cursor-pointer"}`,children:a.jsx("div",{className:`absolute top-0.5 size-4 bg-white rounded-full transition-all ${F?"right-0.5":"left-0.5"}`})})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"text-[10px] uppercase font-bold text-slate-400 mb-1 block",children:"API Key"}),k.startsWith("$")?a.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg px-3 py-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-amber-400 text-xs",children:[a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),a.jsxs("span",{children:["Configured via ",a.jsx("code",{className:"font-mono bg-slate-800 px-1 rounded",children:k})]})]}),a.jsx("p",{className:"text-[10px] text-amber-400/70 mt-1",children:"Set this environment variable or enter the key directly below"}),a.jsx("input",{type:"text",placeholder:O.placeholder,onChange:X=>j(O.id,X.target.value),autoComplete:"off",className:"w-full bg-slate-900/50 border border-slate-700 rounded-lg px-3 py-2 text-xs font-mono mt-2 focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-slate-300"})]}):a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:o[O.id]?"text":"password",value:k,onChange:X=>j(O.id,X.target.value),disabled:E,placeholder:O.placeholder,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"data-lpignore":"true","data-1p-ignore":"true","data-form-type":"other",className:`w-full bg-slate-900/50 border border-slate-700 rounded-lg px-3 py-2 pr-16 text-xs font-mono focus:ring-1 focus:ring-blue-500 focus:border-blue-500 ${E?"cursor-not-allowed text-slate-500":"text-slate-300"}`}),!E&&a.jsx("button",{onClick:()=>l({...o,[O.id]:!o[O.id]}),className:"absolute right-8 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-300",children:a.jsx("span",{className:"material-symbols-outlined text-[16px]",children:o[O.id]?"visibility_off":"visibility"})})]})]}),!E&&a.jsxs("div",{className:"flex flex-col gap-2",children:[k&&!k.startsWith("$")&&a.jsxs("button",{onClick:()=>x(O.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:[a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"view_list"}),"View Models"]}),k&&!k.startsWith("$")&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>R(O.id),disabled:h===O.id,className:"flex items-center gap-1.5 px-3 py-1.5 bg-slate-700/50 hover:bg-slate-600/50 border border-slate-600 rounded-lg text-xs text-slate-300 transition-colors disabled:opacity-50",children:[h===O.id?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"quiz"}),"Test 2+3"]}),f[O.id]&&a.jsxs("div",{className:`flex items-center gap-1 text-xs ${(V=f[O.id])!=null&&V.success?"text-green-400":"text-red-400"}`,children:[a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:(M=f[O.id])!=null&&M.success?"check_circle":"error"}),(b=f[O.id])!=null&&b.success?`${(H=f[O.id])==null?void 0:H.latencyMs}ms`:(K=f[O.id])==null?void 0:K.error]})]})]})]})]},O.id)})})]}),a.jsxs("section",{className:"mb-12",children:[a.jsxs("h2",{className:"text-white text-2xl font-bold mb-6 flex items-center gap-3",children:["Model Assignments",a.jsx("div",{className:"h-px flex-1 bg-slate-700"})]}),a.jsx("div",{className:"space-y-8",children:wL.map(O=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx("span",{className:"material-symbols-outlined text-slate-500 text-lg",children:O.icon}),a.jsx("h3",{className:"text-slate-300 font-semibold text-sm uppercase tracking-wider",children:O.name}),a.jsx("div",{className:"h-px flex-1 bg-slate-800"})]}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:O.agents.map(E=>{const F=i.models.overrides[E.id]||jv,k=bL(F),{score:V,matched:M,missing:b}=gL(F,E.id),H=Gm[E.id]||[],K=V>=1,X=V>=.5&&V<1,ie=[`${E.name}: ${E.description}`,`Model: ${k}`,`Needs: ${H.map(de=>Gn[de].name).join(", ")}`,M.length>0?`✓ Has: ${M.map(de=>Gn[de].name).join(", ")}`:"",b.length>0?`✗ Missing: ${b.map(de=>Gn[de].name).join(", ")}`:""].filter(Boolean).join(`
512
- `);return a.jsxs("div",{onClick:()=>c(E.id),title:ie,className:`p-3 border rounded-lg cursor-pointer transition-all group ${K?"bg-emerald-500/5 border-emerald-500/30 hover:border-emerald-500/50 hover:bg-emerald-500/10":X?"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:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:`material-symbols-outlined text-sm ${K?"text-emerald-400":X?"text-amber-400":"text-rose-400"}`,children:E.icon}),a.jsxs("span",{className:`text-[9px] font-bold ${K?"text-emerald-400":X?"text-amber-400":"text-rose-400"}`,children:[Math.round(V*100),"%"]})]}),a.jsx("p",{className:"text-xs font-semibold text-white truncate",children:E.name}),a.jsx("p",{className:"text-[10px] text-slate-400 truncate mb-2",children:k}),a.jsx("div",{className:"flex gap-1 flex-wrap",children:H.slice(0,3).map(de=>{const me=M.includes(de);return a.jsx("span",{title:`${Gn[de].name}: ${me?"Model has this":"Model missing this"}`,className:`text-[8px] px-1 py-0.5 rounded ${me?"bg-emerald-500/20 text-emerald-400":"bg-rose-500/20 text-rose-400"}`,children:Gn[de].name},de)})})]},E.id)})})]},O.name))})]}),a.jsx("footer",{className:"fixed bottom-0 left-0 right-0 bg-slate-900/95 backdrop-blur-md border-t border-slate-700 px-6 py-4 z-40",children:a.jsxs("div",{className:"max-w-[1200px] mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2 text-slate-400 text-sm",children:[_.isSuccess&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"material-symbols-outlined text-green-400",children:"check_circle"}),a.jsx("span",{className:"text-green-400",children:"Settings saved!"})]}),_.isError&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"material-symbols-outlined text-red-400",children:"error"}),a.jsx("span",{className:"text-red-400",children:"Error saving settings"})]})]}),a.jsxs("div",{className:"flex gap-4",children:[a.jsxs("button",{onClick:P,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:[a.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"auto_fix_high"}),"Optimal Defaults"]}),a.jsx("button",{onClick:I,disabled:!N,className:"px-6 py-2 text-slate-400 hover:text-white font-semibold text-sm transition-colors disabled:opacity-50",children:"Undo Changes"}),a.jsxs("button",{onClick:z,disabled:!N||_.isPending,className:"px-8 py-2 bg-blue-500 hover:bg-blue-400 text-white 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:[_.isPending&&a.jsx(ye,{className:"w-4 h-4 animate-spin"}),"Save Changes"]})]})]})}),u&&a.jsx(yL,{workType:u,currentModel:i.models.overrides[u]||jv,isOverride:!!i.models.overrides[u],enabledProviders:Object.entries(i.models.providers).filter(([O,E])=>E).map(([O])=>O),onApply:O=>A(u,O),onRemove:()=>$(u),onClose:()=>c(null)}),m&&a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-slate-800 border border-slate-700 rounded-xl shadow-2xl max-w-2xl w-full max-h-[80vh] overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"material-symbols-outlined text-blue-400",children:(L=Qh.find(O=>O.id===m))==null?void 0:L.icon}),a.jsxs("h3",{className:"text-white text-lg font-bold",children:[(B=Qh.find(O=>O.id===m))==null?void 0:B.name," Models"]})]}),a.jsx("button",{onClick:()=>x(null),className:"text-slate-400 hover:text-white transition-colors",children:a.jsx(Nt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-4 overflow-y-auto max-h-[60vh]",children:(()=>{var F;const O=(i==null?void 0:i.api_keys[m])||"",E=O.startsWith("$");return O?E?a.jsxs("div",{className:"text-center py-8",children:[a.jsx("span",{className:"material-symbols-outlined text-4xl text-amber-500 mb-2",children:"warning"}),a.jsx("p",{className:"text-amber-400",children:"API key configured via environment variable"}),a.jsxs("p",{className:"text-slate-500 text-sm mt-1",children:[a.jsx("code",{className:"font-mono bg-slate-800 px-1 rounded",children:O})," is not set"]}),a.jsx("p",{className:"text-slate-500 text-xs mt-2",children:"Set the environment variable or enter the key directly in Settings"})]}):a.jsx("div",{className:"space-y-3",children:(((F=Ym[m])==null?void 0:F.models)||[]).map(k=>{var H;const V=`${m}:${k.id}`,M=v[V],b=C===V;return a.jsx("div",{className:"bg-slate-900/50 border border-slate-700 rounded-lg p-4 hover:border-slate-600 transition-colors",children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"material-symbols-outlined text-slate-400 text-sm",children:k.icon}),a.jsx("h4",{className:"text-white font-semibold",children:k.name}),k.tier&&a.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${k.tier==="premium"?"bg-purple-500/20 text-purple-400":k.tier==="balanced"?"bg-blue-500/20 text-blue-400":"bg-emerald-500/20 text-emerald-400"}`,children:k.tier})]}),k.description&&a.jsx("p",{className:"text-xs text-slate-400 mb-2",children:k.description}),a.jsx("div",{className:"flex flex-wrap gap-1",children:k.capabilities.map(K=>a.jsx("span",{className:"text-[9px] px-1.5 py-0.5 bg-slate-700/50 text-slate-400 rounded",children:K},K))})]}),a.jsxs("div",{className:"flex flex-col items-end gap-2",children:[a.jsxs("button",{onClick:()=>D(m,k.id),disabled:b,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:[b?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"play_arrow"}),"Test 2+3"]}),M&&a.jsxs("div",{className:`flex items-center gap-1 text-xs ${M.success?"text-green-400":"text-red-400"}`,children:[a.jsx("span",{className:"material-symbols-outlined text-[12px]",children:M.success?"check_circle":"error"}),M.success?`${M.latencyMs}ms`:((H=M.error)==null?void 0:H.slice(0,30))||"Failed"]})]})]})},k.id)})}):a.jsxs("div",{className:"text-center py-8",children:[a.jsx("span",{className:"material-symbols-outlined text-4xl text-slate-500 mb-2",children:"key_off"}),a.jsx("p",{className:"text-slate-400",children:"Enter an API key to test models"})]})})()}),a.jsx("div",{className:"p-4 border-t border-slate-700 bg-slate-900/50",children:a.jsx("p",{className:"text-xs text-slate-500 text-center",children:'Test verifies API key and model availability by asking "What is 2+3?"'})})]})})]})}var Pv=1,CL=.9,kL=.8,NL=.17,Yh=.1,Gh=.999,EL=.9999,jL=.99,PL=/[\\\/_+.#"@\[\(\{&]/,RL=/[\\\/_+.#"@\[\(\{&]/g,ML=/[\s-]/,DS=/[\s-]/g;function dp(e,t,r,n,i,s,o){if(s===t.length)return i===e.length?Pv:jL;var l=`${i},${s}`;if(o[l]!==void 0)return o[l];for(var u=n.charAt(s),c=r.indexOf(u,i),h=0,d,f,p,m;c>=0;)d=dp(e,t,r,n,c+1,s+1,o),d>h&&(c===i?d*=Pv:PL.test(e.charAt(c-1))?(d*=kL,p=e.slice(i,c-1).match(RL),p&&i>0&&(d*=Math.pow(Gh,p.length))):ML.test(e.charAt(c-1))?(d*=CL,m=e.slice(i,c-1).match(DS),m&&i>0&&(d*=Math.pow(Gh,m.length))):(d*=NL,i>0&&(d*=Math.pow(Gh,c-i))),e.charAt(c)!==t.charAt(s)&&(d*=EL)),(d<Yh&&r.charAt(c-1)===n.charAt(s+1)||n.charAt(s+1)===n.charAt(s)&&r.charAt(c-1)!==n.charAt(s))&&(f=dp(e,t,r,n,c+1,s+2,o),f*Yh>d&&(d=f*Yh)),d>h&&(h=d),c=r.indexOf(u,c+1);return o[l]=h,h}function Rv(e){return e.toLowerCase().replace(DS," ")}function TL(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,dp(e,t,Rv(e),Rv(t),0,0,{})}function xi(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e==null||e(i),r===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Mv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Si(...e){return t=>{let r=!1;const n=e.map(i=>{const s=Mv(i,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let i=0;i<n.length;i++){const s=n[i];typeof s=="function"?s():Mv(e[i],null)}}}}function xs(...e){return w.useCallback(Si(...e),e)}function DL(e,t){const r=w.createContext(t),n=s=>{const{children:o,...l}=s,u=w.useMemo(()=>l,Object.values(l));return a.jsx(r.Provider,{value:u,children:o})};n.displayName=e+"Provider";function i(s){const o=w.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[n,i]}function LL(e,t=[]){let r=[];function n(s,o){const l=w.createContext(o),u=r.length;r=[...r,o];const c=d=>{var y;const{scope:f,children:p,...m}=d,x=((y=f==null?void 0:f[e])==null?void 0:y[u])||l,C=w.useMemo(()=>m,Object.values(m));return a.jsx(x.Provider,{value:C,children:p})};c.displayName=s+"Provider";function h(d,f){var x;const p=((x=f==null?void 0:f[e])==null?void 0:x[u])||l,m=w.useContext(p);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,h]}const i=()=>{const s=r.map(o=>w.createContext(o));return function(l){const u=(l==null?void 0:l[e])||s;return w.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return i.scopeName=e,[n,AL(i,...t)]}function AL(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((l,{useScope:u,scopeName:c})=>{const d=u(s)[`__scope${c}`];return{...l,...d}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Ya=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},OL=wp[" useId ".trim().toString()]||(()=>{}),IL=0;function Nn(e){const[t,r]=w.useState(OL());return Ya(()=>{r(n=>n??String(IL++))},[e]),t?`radix-${t}`:""}var FL=wp[" useInsertionEffect ".trim().toString()]||Ya;function BL({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[i,s,o]=zL({defaultProp:t,onChange:r}),l=e!==void 0,u=l?e:i;{const h=w.useRef(e!==void 0);w.useEffect(()=>{const d=h.current;d!==l&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${l?"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.`),h.current=l},[l,n])}const c=w.useCallback(h=>{var d;if(l){const f=$L(h)?h(e):h;f!==e&&((d=o.current)==null||d.call(o,f))}else s(h)},[l,e,s,o]);return[u,c]}function zL({defaultProp:e,onChange:t}){const[r,n]=w.useState(e),i=w.useRef(r),s=w.useRef(t);return FL(()=>{s.current=t},[t]),w.useEffect(()=>{var o;i.current!==r&&((o=s.current)==null||o.call(s,r),i.current=r)},[r,i]),[r,n,s]}function $L(e){return typeof e=="function"}function gl(e){const t=HL(e),r=w.forwardRef((n,i)=>{const{children:s,...o}=n,l=w.Children.toArray(s),u=l.find(UL);if(u){const c=u.props.children,h=l.map(d=>d===u?w.Children.count(c)>1?w.Children.only(null):w.isValidElement(c)?c.props.children:null:d);return a.jsx(t,{...o,ref:i,children:w.isValidElement(c)?w.cloneElement(c,void 0,h):null})}return a.jsx(t,{...o,ref:i,children:s})});return r.displayName=`${e}.Slot`,r}function HL(e){const t=w.forwardRef((r,n)=>{const{children:i,...s}=r;if(w.isValidElement(i)){const o=qL(i),l=KL(s,i.props);return i.type!==w.Fragment&&(l.ref=n?Si(n,o):o),w.cloneElement(i,l)}return w.Children.count(i)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var WL=Symbol("radix.slottable");function UL(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WL}function KL(e,t){const r={...t};for(const n in t){const i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...l)=>{const u=s(...l);return i(...l),u}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}function qL(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var VL=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],LS=VL.reduce((e,t)=>{const r=gl(`Primitive.${t}`),n=w.forwardRef((i,s)=>{const{asChild:o,...l}=i,u=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function QL(e,t){e&&ms.flushSync(()=>e.dispatchEvent(t))}function Ga(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function YL(e,t=globalThis==null?void 0:globalThis.document){const r=Ga(e);w.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var GL="DismissableLayer",fp="dismissableLayer.update",XL="dismissableLayer.pointerDownOutside",JL="dismissableLayer.focusOutside",Tv,AS=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),OS=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:l,...u}=e,c=w.useContext(AS),[h,d]=w.useState(null),f=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=w.useState({}),m=xs(t,j=>d(j)),x=Array.from(c.layers),[C]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=x.indexOf(C),v=h?x.indexOf(h):-1,g=c.layersWithOutsidePointerEventsDisabled.size>0,_=v>=y,N=tA(j=>{const A=j.target,$=[...c.branches].some(z=>z.contains(A));!_||$||(i==null||i(j),o==null||o(j),j.defaultPrevented||l==null||l())},f),S=rA(j=>{const A=j.target;[...c.branches].some(z=>z.contains(A))||(s==null||s(j),o==null||o(j),j.defaultPrevented||l==null||l())},f);return YL(j=>{v===c.layers.size-1&&(n==null||n(j),!j.defaultPrevented&&l&&(j.preventDefault(),l()))},f),w.useEffect(()=>{if(h)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Tv=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(h)),c.layers.add(h),Dv(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Tv)}},[h,f,r,c]),w.useEffect(()=>()=>{h&&(c.layers.delete(h),c.layersWithOutsidePointerEventsDisabled.delete(h),Dv())},[h,c]),w.useEffect(()=>{const j=()=>p({});return document.addEventListener(fp,j),()=>document.removeEventListener(fp,j)},[]),a.jsx(LS.div,{...u,ref:m,style:{pointerEvents:g?_?"auto":"none":void 0,...e.style},onFocusCapture:xi(e.onFocusCapture,S.onFocusCapture),onBlurCapture:xi(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:xi(e.onPointerDownCapture,N.onPointerDownCapture)})});OS.displayName=GL;var ZL="DismissableLayerBranch",eA=w.forwardRef((e,t)=>{const r=w.useContext(AS),n=w.useRef(null),i=xs(t,n);return w.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),a.jsx(LS.div,{...e,ref:i})});eA.displayName=ZL;function tA(e,t=globalThis==null?void 0:globalThis.document){const r=Ga(e),n=w.useRef(!1),i=w.useRef(()=>{});return w.useEffect(()=>{const s=l=>{if(l.target&&!n.current){let u=function(){IS(XL,r,c,{discrete:!0})};const c={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function rA(e,t=globalThis==null?void 0:globalThis.document){const r=Ga(e),n=w.useRef(!1);return w.useEffect(()=>{const i=s=>{s.target&&!n.current&&IS(JL,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Dv(){const e=new CustomEvent(fp);document.dispatchEvent(e)}function IS(e,t,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?QL(i,s):i.dispatchEvent(s)}var nA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],iA=nA.reduce((e,t)=>{const r=gl(`Primitive.${t}`),n=w.forwardRef((i,s)=>{const{asChild:o,...l}=i,u=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Xh="focusScope.autoFocusOnMount",Jh="focusScope.autoFocusOnUnmount",Lv={bubbles:!1,cancelable:!0},sA="FocusScope",FS=w.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[l,u]=w.useState(null),c=Ga(i),h=Ga(s),d=w.useRef(null),f=xs(t,x=>u(x)),p=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(n){let x=function(g){if(p.paused||!l)return;const _=g.target;l.contains(_)?d.current=_:Un(d.current,{select:!0})},C=function(g){if(p.paused||!l)return;const _=g.relatedTarget;_!==null&&(l.contains(_)||Un(d.current,{select:!0}))},y=function(g){if(document.activeElement===document.body)for(const N of g)N.removedNodes.length>0&&Un(l)};document.addEventListener("focusin",x),document.addEventListener("focusout",C);const v=new MutationObserver(y);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",C),v.disconnect()}}},[n,l,p.paused]),w.useEffect(()=>{if(l){Ov.add(p);const x=document.activeElement;if(!l.contains(x)){const y=new CustomEvent(Xh,Lv);l.addEventListener(Xh,c),l.dispatchEvent(y),y.defaultPrevented||(oA(hA(BS(l)),{select:!0}),document.activeElement===x&&Un(l))}return()=>{l.removeEventListener(Xh,c),setTimeout(()=>{const y=new CustomEvent(Jh,Lv);l.addEventListener(Jh,h),l.dispatchEvent(y),y.defaultPrevented||Un(x??document.body,{select:!0}),l.removeEventListener(Jh,h),Ov.remove(p)},0)}}},[l,c,h,p]);const m=w.useCallback(x=>{if(!r&&!n||p.paused)return;const C=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,y=document.activeElement;if(C&&y){const v=x.currentTarget,[g,_]=aA(v);g&&_?!x.shiftKey&&y===_?(x.preventDefault(),r&&Un(g,{select:!0})):x.shiftKey&&y===g&&(x.preventDefault(),r&&Un(_,{select:!0})):y===v&&x.preventDefault()}},[r,n,p.paused]);return a.jsx(iA.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});FS.displayName=sA;function oA(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Un(n,{select:t}),document.activeElement!==r)return}function aA(e){const t=BS(e),r=Av(t,e),n=Av(t.reverse(),e);return[r,n]}function BS(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Av(e,t){for(const r of e)if(!lA(r,{upTo:t}))return r}function lA(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 cA(e){return e instanceof HTMLInputElement&&"select"in e}function Un(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&cA(e)&&t&&e.select()}}var Ov=uA();function uA(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Iv(e,t),e.unshift(t)},remove(t){var r;e=Iv(e,t),(r=e[0])==null||r.resume()}}}function Iv(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function hA(e){return e.filter(t=>t.tagName!=="A")}var dA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fA=dA.reduce((e,t)=>{const r=gl(`Primitive.${t}`),n=w.forwardRef((i,s)=>{const{asChild:o,...l}=i,u=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),pA="Portal",zS=w.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[i,s]=w.useState(!1);Ya(()=>s(!0),[]);const o=r||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?Qk.createPortal(a.jsx(fA.div,{...n,ref:t}),o):null});zS.displayName=pA;function mA(e,t){return w.useReducer((r,n)=>t[r][n]??r,e)}var zu=e=>{const{present:t,children:r}=e,n=gA(t),i=typeof r=="function"?r({present:n.isPresent}):w.Children.only(r),s=xs(n.ref,yA(i));return typeof r=="function"||n.isPresent?w.cloneElement(i,{ref:s}):null};zu.displayName="Presence";function gA(e){const[t,r]=w.useState(),n=w.useRef(null),i=w.useRef(e),s=w.useRef("none"),o=e?"mounted":"unmounted",[l,u]=mA(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const c=Jl(n.current);s.current=l==="mounted"?c:"none"},[l]),Ya(()=>{const c=n.current,h=i.current;if(h!==e){const f=s.current,p=Jl(c);e?u("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?u("UNMOUNT"):u(h&&f!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Ya(()=>{if(t){let c;const h=t.ownerDocument.defaultView??window,d=p=>{const x=Jl(n.current).includes(CSS.escape(p.animationName));if(p.target===t&&x&&(u("ANIMATION_END"),!i.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",c=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},f=p=>{p.target===t&&(s.current=Jl(n.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{h.clearTimeout(c),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:w.useCallback(c=>{n.current=c?getComputedStyle(c):null,r(c)},[])}}function Jl(e){return(e==null?void 0:e.animationName)||"none"}function yA(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var vA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yl=vA.reduce((e,t)=>{const r=gl(`Primitive.${t}`),n=w.forwardRef((i,s)=>{const{asChild:o,...l}=i,u=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Zh=0;function xA(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Fv()),document.body.insertAdjacentElement("beforeend",e[1]??Fv()),Zh++,()=>{Zh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Zh--}},[])}function Fv(){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 en=function(){return en=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},en.apply(this,arguments)};function $S(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function _A(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,s;n<i;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}var Nc="right-scroll-bar-position",Ec="width-before-scroll-bar",wA="with-scroll-bars-hidden",bA="--removed-body-scroll-bar-size";function ed(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function SA(e,t){var r=w.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=t,r.facade}var CA=typeof window<"u"?w.useLayoutEffect:w.useEffect,Bv=new WeakMap;function kA(e,t){var r=SA(null,function(n){return e.forEach(function(i){return ed(i,n)})});return CA(function(){var n=Bv.get(r);if(n){var i=new Set(n),s=new Set(e),o=r.current;i.forEach(function(l){s.has(l)||ed(l,null)}),s.forEach(function(l){i.has(l)||ed(l,o)})}Bv.set(r,e)},[e]),r}function NA(e){return e}function EA(e,t){t===void 0&&(t=NA);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var o=t(s,n);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(s){for(n=!0;r.length;){var o=r;r=[],o.forEach(s)}r={push:function(l){return s(l)},filter:function(){return r}}},assignMedium:function(s){n=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(s),o=r}var u=function(){var h=o;o=[],h.forEach(s)},c=function(){return Promise.resolve().then(u)};c(),r={push:function(h){o.push(h),c()},filter:function(h){return o=o.filter(h),r}}}};return i}function jA(e){e===void 0&&(e={});var t=EA(null);return t.options=en({async:!0,ssr:!1},e),t}var HS=function(e){var t=e.sideCar,r=$S(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return w.createElement(n,en({},r))};HS.isSideCarExport=!0;function PA(e,t){return e.useMedium(t),HS}var WS=jA(),td=function(){},$u=w.forwardRef(function(e,t){var r=w.useRef(null),n=w.useState({onScrollCapture:td,onWheelCapture:td,onTouchMoveCapture:td}),i=n[0],s=n[1],o=e.forwardProps,l=e.children,u=e.className,c=e.removeScrollBar,h=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,x=e.inert,C=e.allowPinchZoom,y=e.as,v=y===void 0?"div":y,g=e.gapMode,_=$S(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=f,S=kA([r,t]),j=en(en({},_),i);return w.createElement(w.Fragment,null,h&&w.createElement(N,{sideCar:WS,removeScrollBar:c,shards:d,noRelative:p,noIsolation:m,inert:x,setCallbacks:s,allowPinchZoom:!!C,lockRef:r,gapMode:g}),o?w.cloneElement(w.Children.only(l),en(en({},j),{ref:S})):w.createElement(v,en({},j,{className:u,ref:S}),l))});$u.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};$u.classNames={fullWidth:Ec,zeroRight:Nc};var RA=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function MA(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=RA();return t&&e.setAttribute("nonce",t),e}function TA(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function DA(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var LA=function(){var e=0,t=null;return{add:function(r){e==0&&(t=MA())&&(TA(t,r),DA(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},AA=function(){var e=LA();return function(t,r){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},US=function(){var e=AA(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},OA={left:0,top:0,right:0,gap:0},rd=function(e){return parseInt(e||"",10)||0},IA=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[rd(r),rd(n),rd(i)]},FA=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return OA;var t=IA(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},BA=US(),to="data-scroll-locked",zA=function(e,t,r,n){var i=e.left,s=e.top,o=e.right,l=e.gap;return r===void 0&&(r="margin"),`
513
- .`.concat(wA,` {
514
- overflow: hidden `).concat(n,`;
515
- padding-right: `).concat(l,"px ").concat(n,`;
516
- }
517
- body[`).concat(to,`] {
518
- overflow: hidden `).concat(n,`;
519
- overscroll-behavior: contain;
520
- `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
521
- padding-left: `.concat(i,`px;
522
- padding-top: `).concat(s,`px;
523
- padding-right: `).concat(o,`px;
524
- margin-left:0;
525
- margin-top:0;
526
- margin-right: `).concat(l,"px ").concat(n,`;
527
- `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
528
- }
529
-
530
- .`).concat(Nc,` {
531
- right: `).concat(l,"px ").concat(n,`;
532
- }
533
-
534
- .`).concat(Ec,` {
535
- margin-right: `).concat(l,"px ").concat(n,`;
536
- }
537
-
538
- .`).concat(Nc," .").concat(Nc,` {
539
- right: 0 `).concat(n,`;
540
- }
541
-
542
- .`).concat(Ec," .").concat(Ec,` {
543
- margin-right: 0 `).concat(n,`;
544
- }
545
-
546
- body[`).concat(to,`] {
547
- `).concat(bA,": ").concat(l,`px;
548
- }
549
- `)},zv=function(){var e=parseInt(document.body.getAttribute(to)||"0",10);return isFinite(e)?e:0},$A=function(){w.useEffect(function(){return document.body.setAttribute(to,(zv()+1).toString()),function(){var e=zv()-1;e<=0?document.body.removeAttribute(to):document.body.setAttribute(to,e.toString())}},[])},HA=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;$A();var s=w.useMemo(function(){return FA(i)},[i]);return w.createElement(BA,{styles:zA(s,!t,i,r?"":"!important")})},pp=!1;if(typeof window<"u")try{var Zl=Object.defineProperty({},"passive",{get:function(){return pp=!0,!0}});window.addEventListener("test",Zl,Zl),window.removeEventListener("test",Zl,Zl)}catch{pp=!1}var Ns=pp?{passive:!1}:!1,WA=function(e){return e.tagName==="TEXTAREA"},KS=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!WA(e)&&r[t]==="visible")},UA=function(e){return KS(e,"overflowY")},KA=function(e){return KS(e,"overflowX")},$v=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=qS(e,n);if(i){var s=VS(e,n),o=s[1],l=s[2];if(o>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},qA=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},VA=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},qS=function(e,t){return e==="v"?UA(t):KA(t)},VS=function(e,t){return e==="v"?qA(t):VA(t)},QA=function(e,t){return e==="h"&&t==="rtl"?-1:1},YA=function(e,t,r,n,i){var s=QA(e,window.getComputedStyle(t).direction),o=s*n,l=r.target,u=t.contains(l),c=!1,h=o>0,d=0,f=0;do{if(!l)break;var p=VS(e,l),m=p[0],x=p[1],C=p[2],y=x-C-s*m;(m||y)&&qS(e,l)&&(d+=y,f+=m);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(h&&Math.abs(d)<1||!h&&Math.abs(f)<1)&&(c=!0),c},ec=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Hv=function(e){return[e.deltaX,e.deltaY]},Wv=function(e){return e&&"current"in e?e.current:e},GA=function(e,t){return e[0]===t[0]&&e[1]===t[1]},XA=function(e){return`
550
- .block-interactivity-`.concat(e,` {pointer-events: none;}
551
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
552
- `)},JA=0,Es=[];function ZA(e){var t=w.useRef([]),r=w.useRef([0,0]),n=w.useRef(),i=w.useState(JA++)[0],s=w.useState(US)[0],o=w.useRef(e);w.useEffect(function(){o.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var x=_A([e.lockRef.current],(e.shards||[]).map(Wv),!0).filter(Boolean);return x.forEach(function(C){return C.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),x.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=w.useCallback(function(x,C){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!o.current.allowPinchZoom;var y=ec(x),v=r.current,g="deltaX"in x?x.deltaX:v[0]-y[0],_="deltaY"in x?x.deltaY:v[1]-y[1],N,S=x.target,j=Math.abs(g)>Math.abs(_)?"h":"v";if("touches"in x&&j==="h"&&S.type==="range")return!1;var A=window.getSelection(),$=A&&A.anchorNode,z=$?$===S||$.contains(S):!1;if(z)return!1;var I=$v(j,S);if(!I)return!0;if(I?N=j:(N=j==="v"?"h":"v",I=$v(j,S)),!I)return!1;if(!n.current&&"changedTouches"in x&&(g||_)&&(n.current=N),!N)return!0;var P=n.current||N;return YA(P,C,x,P==="h"?g:_)},[]),u=w.useCallback(function(x){var C=x;if(!(!Es.length||Es[Es.length-1]!==s)){var y="deltaY"in C?Hv(C):ec(C),v=t.current.filter(function(N){return N.name===C.type&&(N.target===C.target||C.target===N.shadowParent)&&GA(N.delta,y)})[0];if(v&&v.should){C.cancelable&&C.preventDefault();return}if(!v){var g=(o.current.shards||[]).map(Wv).filter(Boolean).filter(function(N){return N.contains(C.target)}),_=g.length>0?l(C,g[0]):!o.current.noIsolation;_&&C.cancelable&&C.preventDefault()}}},[]),c=w.useCallback(function(x,C,y,v){var g={name:x,delta:C,target:y,should:v,shadowParent:eO(y)};t.current.push(g),setTimeout(function(){t.current=t.current.filter(function(_){return _!==g})},1)},[]),h=w.useCallback(function(x){r.current=ec(x),n.current=void 0},[]),d=w.useCallback(function(x){c(x.type,Hv(x),x.target,l(x,e.lockRef.current))},[]),f=w.useCallback(function(x){c(x.type,ec(x),x.target,l(x,e.lockRef.current))},[]);w.useEffect(function(){return Es.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,Ns),document.addEventListener("touchmove",u,Ns),document.addEventListener("touchstart",h,Ns),function(){Es=Es.filter(function(x){return x!==s}),document.removeEventListener("wheel",u,Ns),document.removeEventListener("touchmove",u,Ns),document.removeEventListener("touchstart",h,Ns)}},[]);var p=e.removeScrollBar,m=e.inert;return w.createElement(w.Fragment,null,m?w.createElement(s,{styles:XA(i)}):null,p?w.createElement(HA,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function eO(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const tO=PA(WS,ZA);var QS=w.forwardRef(function(e,t){return w.createElement($u,en({},e,{ref:t,sideCar:tO}))});QS.classNames=$u.classNames;var rO=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},js=new WeakMap,tc=new WeakMap,rc={},nd=0,YS=function(e){return e&&(e.host||YS(e.parentNode))},nO=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=YS(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},iO=function(e,t,r,n){var i=nO(t,Array.isArray(e)?e:[e]);rc[r]||(rc[r]=new WeakMap);var s=rc[r],o=[],l=new Set,u=new Set(i),c=function(d){!d||l.has(d)||(l.add(d),c(d.parentNode))};i.forEach(c);var h=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(f){if(l.has(f))h(f);else try{var p=f.getAttribute(n),m=p!==null&&p!=="false",x=(js.get(f)||0)+1,C=(s.get(f)||0)+1;js.set(f,x),s.set(f,C),o.push(f),x===1&&m&&tc.set(f,!0),C===1&&f.setAttribute(r,"true"),m||f.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",f,y)}})};return h(t),l.clear(),nd++,function(){o.forEach(function(d){var f=js.get(d)-1,p=s.get(d)-1;js.set(d,f),s.set(d,p),f||(tc.has(d)||d.removeAttribute(n),tc.delete(d)),p||d.removeAttribute(r)}),nd--,nd||(js=new WeakMap,js=new WeakMap,tc=new WeakMap,rc={})}},sO=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=rO(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),iO(n,i,r,"aria-hidden")):function(){return null}},Hu="Dialog",[GS]=LL(Hu),[oO,zr]=GS(Hu),XS=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:s,modal:o=!0}=e,l=w.useRef(null),u=w.useRef(null),[c,h]=BL({prop:n,defaultProp:i??!1,onChange:s,caller:Hu});return a.jsx(oO,{scope:t,triggerRef:l,contentRef:u,contentId:Nn(),titleId:Nn(),descriptionId:Nn(),open:c,onOpenChange:h,onOpenToggle:w.useCallback(()=>h(d=>!d),[h]),modal:o,children:r})};XS.displayName=Hu;var JS="DialogTrigger",aO=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=zr(JS,r),s=xs(t,i.triggerRef);return a.jsx(yl.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Zm(i.open),...n,ref:s,onClick:xi(e.onClick,i.onOpenToggle)})});aO.displayName=JS;var Xm="DialogPortal",[lO,ZS]=GS(Xm,{forceMount:void 0}),e1=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:i}=e,s=zr(Xm,t);return a.jsx(lO,{scope:t,forceMount:r,children:w.Children.map(n,o=>a.jsx(zu,{present:r||s.open,children:a.jsx(zS,{asChild:!0,container:i,children:o})}))})};e1.displayName=Xm;var uu="DialogOverlay",t1=w.forwardRef((e,t)=>{const r=ZS(uu,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,s=zr(uu,e.__scopeDialog);return s.modal?a.jsx(zu,{present:n||s.open,children:a.jsx(uO,{...i,ref:t})}):null});t1.displayName=uu;var cO=gl("DialogOverlay.RemoveScroll"),uO=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=zr(uu,r);return a.jsx(QS,{as:cO,allowPinchZoom:!0,shards:[i.contentRef],children:a.jsx(yl.div,{"data-state":Zm(i.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),hs="DialogContent",r1=w.forwardRef((e,t)=>{const r=ZS(hs,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,s=zr(hs,e.__scopeDialog);return a.jsx(zu,{present:n||s.open,children:s.modal?a.jsx(hO,{...i,ref:t}):a.jsx(dO,{...i,ref:t})})});r1.displayName=hs;var hO=w.forwardRef((e,t)=>{const r=zr(hs,e.__scopeDialog),n=w.useRef(null),i=xs(t,r.contentRef,n);return w.useEffect(()=>{const s=n.current;if(s)return sO(s)},[]),a.jsx(n1,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xi(e.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:xi(e.onPointerDownOutside,s=>{const o=s.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&s.preventDefault()}),onFocusOutside:xi(e.onFocusOutside,s=>s.preventDefault())})}),dO=w.forwardRef((e,t)=>{const r=zr(hs,e.__scopeDialog),n=w.useRef(!1),i=w.useRef(!1);return a.jsx(n1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:s=>{var u,c;(u=e.onInteractOutside)==null||u.call(e,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=r.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),n1=w.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=e,l=zr(hs,r),u=w.useRef(null),c=xs(t,u);return xA(),a.jsxs(a.Fragment,{children:[a.jsx(FS,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s,children:a.jsx(OS,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Zm(l.open),...o,ref:c,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(gO,{titleId:l.titleId}),a.jsx(vO,{contentRef:u,descriptionId:l.descriptionId})]})]})}),Jm="DialogTitle",fO=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=zr(Jm,r);return a.jsx(yl.h2,{id:i.titleId,...n,ref:t})});fO.displayName=Jm;var i1="DialogDescription",pO=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=zr(i1,r);return a.jsx(yl.p,{id:i.descriptionId,...n,ref:t})});pO.displayName=i1;var s1="DialogClose",mO=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=zr(s1,r);return a.jsx(yl.button,{type:"button",...n,ref:t,onClick:xi(e.onClick,()=>i.onOpenChange(!1))})});mO.displayName=s1;function Zm(e){return e?"open":"closed"}var o1="DialogTitleWarning",[m6,a1]=DL(o1,{contentName:hs,titleName:Jm,docsSlug:"dialog"}),gO=({titleId:e})=>{const t=a1(o1),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
553
-
554
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
555
-
556
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return w.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},yO="DialogDescriptionWarning",vO=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${a1(yO).contentName}}.`;return w.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},xO=XS,_O=e1,wO=t1,bO=r1,SO=Symbol.for("react.lazy"),hu=wp[" use ".trim().toString()];function CO(e){return typeof e=="object"&&e!==null&&"then"in e}function l1(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===SO&&"_payload"in e&&CO(e._payload)}function kO(e){const t=NO(e),r=w.forwardRef((n,i)=>{let{children:s,...o}=n;l1(s)&&typeof hu=="function"&&(s=hu(s._payload));const l=w.Children.toArray(s),u=l.find(jO);if(u){const c=u.props.children,h=l.map(d=>d===u?w.Children.count(c)>1?w.Children.only(null):w.isValidElement(c)?c.props.children:null:d);return a.jsx(t,{...o,ref:i,children:w.isValidElement(c)?w.cloneElement(c,void 0,h):null})}return a.jsx(t,{...o,ref:i,children:s})});return r.displayName=`${e}.Slot`,r}function NO(e){const t=w.forwardRef((r,n)=>{let{children:i,...s}=r;if(l1(i)&&typeof hu=="function"&&(i=hu(i._payload)),w.isValidElement(i)){const o=RO(i),l=PO(s,i.props);return i.type!==w.Fragment&&(l.ref=n?Si(n,o):o),w.cloneElement(i,l)}return w.Children.count(i)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var EO=Symbol("radix.slottable");function jO(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===EO}function PO(e,t){const r={...t};for(const n in t){const i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...l)=>{const u=s(...l);return i(...l),u}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}function RO(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var MO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pi=MO.reduce((e,t)=>{const r=kO(`Primitive.${t}`),n=w.forwardRef((i,s)=>{const{asChild:o,...l}=i,u=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Jo='[cmdk-group=""]',id='[cmdk-group-items=""]',TO='[cmdk-group-heading=""]',c1='[cmdk-item=""]',Uv=`${c1}:not([aria-disabled="true"])`,mp="cmdk-item-select",Rs="data-value",DO=(e,t,r)=>TL(e,t,r),u1=w.createContext(void 0),vl=()=>w.useContext(u1),h1=w.createContext(void 0),eg=()=>w.useContext(h1),d1=w.createContext(void 0),f1=w.forwardRef((e,t)=>{let r=Ms(()=>{var M,b;return{search:"",value:(b=(M=e.value)!=null?M:e.defaultValue)!=null?b:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=Ms(()=>new Set),i=Ms(()=>new Map),s=Ms(()=>new Map),o=Ms(()=>new Set),l=p1(e),{label:u,children:c,value:h,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:x=!1,vimBindings:C=!0,...y}=e,v=Nn(),g=Nn(),_=Nn(),N=w.useRef(null),S=UO();ds(()=>{if(h!==void 0){let M=h.trim();r.current.value=M,j.emit()}},[h]),ds(()=>{S(6,R)},[]);let j=w.useMemo(()=>({subscribe:M=>(o.current.add(M),()=>o.current.delete(M)),snapshot:()=>r.current,setState:(M,b,H)=>{var K,X,ie,de;if(!Object.is(r.current[M],b)){if(r.current[M]=b,M==="search")P(),z(),S(1,I);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let me=document.getElementById(_);me?me.focus():(K=document.getElementById(v))==null||K.focus()}if(S(7,()=>{var me;r.current.selectedItemId=(me=D())==null?void 0:me.id,j.emit()}),H||S(5,R),((X=l.current)==null?void 0:X.value)!==void 0){let me=b??"";(de=(ie=l.current).onValueChange)==null||de.call(ie,me);return}}j.emit()}},emit:()=>{o.current.forEach(M=>M())}}),[]),A=w.useMemo(()=>({value:(M,b,H)=>{var K;b!==((K=s.current.get(M))==null?void 0:K.value)&&(s.current.set(M,{value:b,keywords:H}),r.current.filtered.items.set(M,$(b,H)),S(2,()=>{z(),j.emit()}))},item:(M,b)=>(n.current.add(M),b&&(i.current.has(b)?i.current.get(b).add(M):i.current.set(b,new Set([M]))),S(3,()=>{P(),z(),r.current.value||I(),j.emit()}),()=>{s.current.delete(M),n.current.delete(M),r.current.filtered.items.delete(M);let H=D();S(4,()=>{P(),(H==null?void 0:H.getAttribute("id"))===M&&I(),j.emit()})}),group:M=>(i.current.has(M)||i.current.set(M,new Set),()=>{s.current.delete(M),i.current.delete(M)}),filter:()=>l.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:v,inputId:_,labelId:g,listInnerRef:N}),[]);function $(M,b){var H,K;let X=(K=(H=l.current)==null?void 0:H.filter)!=null?K:DO;return M?X(M,r.current.search,b):0}function z(){if(!r.current.search||l.current.shouldFilter===!1)return;let M=r.current.filtered.items,b=[];r.current.filtered.groups.forEach(K=>{let X=i.current.get(K),ie=0;X.forEach(de=>{let me=M.get(de);ie=Math.max(me,ie)}),b.push([K,ie])});let H=N.current;L().sort((K,X)=>{var ie,de;let me=K.getAttribute("id"),Ze=X.getAttribute("id");return((ie=M.get(Ze))!=null?ie:0)-((de=M.get(me))!=null?de:0)}).forEach(K=>{let X=K.closest(id);X?X.appendChild(K.parentElement===X?K:K.closest(`${id} > *`)):H.appendChild(K.parentElement===H?K:K.closest(`${id} > *`))}),b.sort((K,X)=>X[1]-K[1]).forEach(K=>{var X;let ie=(X=N.current)==null?void 0:X.querySelector(`${Jo}[${Rs}="${encodeURIComponent(K[0])}"]`);ie==null||ie.parentElement.appendChild(ie)})}function I(){let M=L().find(H=>H.getAttribute("aria-disabled")!=="true"),b=M==null?void 0:M.getAttribute(Rs);j.setState("value",b||void 0)}function P(){var M,b,H,K;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let X=0;for(let ie of n.current){let de=(b=(M=s.current.get(ie))==null?void 0:M.value)!=null?b:"",me=(K=(H=s.current.get(ie))==null?void 0:H.keywords)!=null?K:[],Ze=$(de,me);r.current.filtered.items.set(ie,Ze),Ze>0&&X++}for(let[ie,de]of i.current)for(let me of de)if(r.current.filtered.items.get(me)>0){r.current.filtered.groups.add(ie);break}r.current.filtered.count=X}function R(){var M,b,H;let K=D();K&&(((M=K.parentElement)==null?void 0:M.firstChild)===K&&((H=(b=K.closest(Jo))==null?void 0:b.querySelector(TO))==null||H.scrollIntoView({block:"nearest"})),K.scrollIntoView({block:"nearest"}))}function D(){var M;return(M=N.current)==null?void 0:M.querySelector(`${c1}[aria-selected="true"]`)}function L(){var M;return Array.from(((M=N.current)==null?void 0:M.querySelectorAll(Uv))||[])}function B(M){let b=L()[M];b&&j.setState("value",b.getAttribute(Rs))}function O(M){var b;let H=D(),K=L(),X=K.findIndex(de=>de===H),ie=K[X+M];(b=l.current)!=null&&b.loop&&(ie=X+M<0?K[K.length-1]:X+M===K.length?K[0]:K[X+M]),ie&&j.setState("value",ie.getAttribute(Rs))}function E(M){let b=D(),H=b==null?void 0:b.closest(Jo),K;for(;H&&!K;)H=M>0?HO(H,Jo):WO(H,Jo),K=H==null?void 0:H.querySelector(Uv);K?j.setState("value",K.getAttribute(Rs)):O(M)}let F=()=>B(L().length-1),k=M=>{M.preventDefault(),M.metaKey?F():M.altKey?E(1):O(1)},V=M=>{M.preventDefault(),M.metaKey?B(0):M.altKey?E(-1):O(-1)};return w.createElement(Pi.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:M=>{var b;(b=y.onKeyDown)==null||b.call(y,M);let H=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||H))switch(M.key){case"n":case"j":{C&&M.ctrlKey&&k(M);break}case"ArrowDown":{k(M);break}case"p":case"k":{C&&M.ctrlKey&&V(M);break}case"ArrowUp":{V(M);break}case"Home":{M.preventDefault(),B(0);break}case"End":{M.preventDefault(),F();break}case"Enter":{M.preventDefault();let K=D();if(K){let X=new Event(mp);K.dispatchEvent(X)}}}}},w.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:qO},u),Wu(e,M=>w.createElement(h1.Provider,{value:j},w.createElement(u1.Provider,{value:A},M))))}),LO=w.forwardRef((e,t)=>{var r,n;let i=Nn(),s=w.useRef(null),o=w.useContext(d1),l=vl(),u=p1(e),c=(n=(r=u.current)==null?void 0:r.forceMount)!=null?n:o==null?void 0:o.forceMount;ds(()=>{if(!c)return l.item(i,o==null?void 0:o.id)},[c]);let h=m1(i,s,[e.value,e.children,s],e.keywords),d=eg(),f=Ci(S=>S.value&&S.value===h.current),p=Ci(S=>c||l.filter()===!1?!0:S.search?S.filtered.items.get(i)>0:!0);w.useEffect(()=>{let S=s.current;if(!(!S||e.disabled))return S.addEventListener(mp,m),()=>S.removeEventListener(mp,m)},[p,e.onSelect,e.disabled]);function m(){var S,j;x(),(j=(S=u.current).onSelect)==null||j.call(S,h.current)}function x(){d.setState("value",h.current,!0)}if(!p)return null;let{disabled:C,value:y,onSelect:v,forceMount:g,keywords:_,...N}=e;return w.createElement(Pi.div,{ref:Si(s,t),...N,id:i,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!f,"data-disabled":!!C,"data-selected":!!f,onPointerMove:C||l.getDisablePointerSelection()?void 0:x,onClick:C?void 0:m},e.children)}),AO=w.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:i,...s}=e,o=Nn(),l=w.useRef(null),u=w.useRef(null),c=Nn(),h=vl(),d=Ci(p=>i||h.filter()===!1?!0:p.search?p.filtered.groups.has(o):!0);ds(()=>h.group(o),[]),m1(o,l,[e.value,e.heading,u]);let f=w.useMemo(()=>({id:o,forceMount:i}),[i]);return w.createElement(Pi.div,{ref:Si(l,t),...s,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},r&&w.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),Wu(e,p=>w.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},w.createElement(d1.Provider,{value:f},p))))}),OO=w.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,i=w.useRef(null),s=Ci(o=>!o.search);return!r&&!s?null:w.createElement(Pi.div,{ref:Si(i,t),...n,"cmdk-separator":"",role:"separator"})}),IO=w.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,i=e.value!=null,s=eg(),o=Ci(c=>c.search),l=Ci(c=>c.selectedItemId),u=vl();return w.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),w.createElement(Pi.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":l,id:u.inputId,type:"text",value:i?e.value:o,onChange:c=>{i||s.setState("search",c.target.value),r==null||r(c.target.value)}})}),FO=w.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...i}=e,s=w.useRef(null),o=w.useRef(null),l=Ci(c=>c.selectedItemId),u=vl();return w.useEffect(()=>{if(o.current&&s.current){let c=o.current,h=s.current,d,f=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let p=c.offsetHeight;h.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return f.observe(c),()=>{cancelAnimationFrame(d),f.unobserve(c)}}},[]),w.createElement(Pi.div,{ref:Si(s,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":n,id:u.listId},Wu(e,c=>w.createElement("div",{ref:Si(o,u.listInnerRef),"cmdk-list-sizer":""},c)))}),BO=w.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:i,contentClassName:s,container:o,...l}=e;return w.createElement(xO,{open:r,onOpenChange:n},w.createElement(_O,{container:o},w.createElement(wO,{"cmdk-overlay":"",className:i}),w.createElement(bO,{"aria-label":e.label,"cmdk-dialog":"",className:s},w.createElement(f1,{ref:t,...l}))))}),zO=w.forwardRef((e,t)=>Ci(r=>r.filtered.count===0)?w.createElement(Pi.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),$O=w.forwardRef((e,t)=>{let{progress:r,children:n,label:i="Loading...",...s}=e;return w.createElement(Pi.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Wu(e,o=>w.createElement("div",{"aria-hidden":!0},o)))}),Sa=Object.assign(f1,{List:FO,Item:LO,Input:IO,Group:AO,Separator:OO,Dialog:BO,Empty:zO,Loading:$O});function HO(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function WO(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function p1(e){let t=w.useRef(e);return ds(()=>{t.current=e}),t}var ds=typeof window>"u"?w.useEffect:w.useLayoutEffect;function Ms(e){let t=w.useRef();return t.current===void 0&&(t.current=e()),t}function Ci(e){let t=eg(),r=()=>e(t.snapshot());return w.useSyncExternalStore(t.subscribe,r,r)}function m1(e,t,r,n=[]){let i=w.useRef(),s=vl();return ds(()=>{var o;let l=(()=>{var c;for(let h of r){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(c=h.current.textContent)==null?void 0:c.trim():i.current}})(),u=n.map(c=>c.trim());s.value(e,l,u),(o=t.current)==null||o.setAttribute(Rs,l),i.current=l}),i}var UO=()=>{let[e,t]=w.useState(),r=Ms(()=>new Map);return ds(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,i)=>{r.current.set(n,i),t({})}};function KO(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Wu({asChild:e,children:t},r){return e&&w.isValidElement(t)?w.cloneElement(KO(t),{ref:t.ref},r(t.props.children)):r(t)}var qO={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function VO(e,t,r={}){const{cycleFilter:n="current",includeCompletedFilter:i=!1,minQueryLength:s=2,maxResults:o=20,debounceMs:l=150}=r,u=Ft(),[c,h]=w.useState(e);w.useEffect(()=>{const m=setTimeout(()=>{h(e)},l);return()=>clearTimeout(m)},[e,l]);const d=u.getQueryData(["issues",n,i]),f=w.useMemo(()=>{if(!c||c.trim().length<s)return[];if(!d||d.length===0)return[];const m=c.toLowerCase().trim(),x=[];for(const C of d){if(t.sources.size>0&&C.source&&!t.sources.has(C.source)||!t.includeCompleted&&(C.status==="Done"||C.status==="Completed"||C.status==="Closed"))continue;let y=0,v=null;const g=C.identifier.toLowerCase();g===m?(y=100,v="identifier"):g.startsWith(m)?(y=80,v="identifier"):g.includes(m)&&(y=60,v="identifier");const _=C.title.toLowerCase();if(_.includes(m)){const N=_.startsWith(m)?70:50;N>y&&(y=N,v="title")}t.deepSearch&&C.description&&C.description.toLowerCase().includes(m)&&20>y&&(y=20,v="description"),y>0&&v&&x.push({issue:C,score:y,matchType:v})}return x.sort((C,y)=>y.score!==C.score?y.score-C.score:C.issue.identifier.localeCompare(y.issue.identifier)),x.slice(0,o)},[c,d,t,s,o]),p=w.useMemo(()=>{const m={};for(const x of f){const C=x.issue.source||"unknown";m[C]||(m[C]=[]),m[C].push(x)}return m},[f]);return{results:f,groupedResults:p,isSearching:e!==c,hasResults:f.length>0,resultCount:f.length}}const QO={linear:"Linear",github:"GitHub",rally:"Rally",gitlab:"GitLab",jira:"Jira",unknown:"Unknown"},YO={0:"text-gray-500",1:"text-red-500",2:"text-orange-500",3:"text-yellow-500",4:"text-blue-500"},GO={backlog:"bg-gray-600",todo:"bg-blue-600",planning:"bg-purple-600",in_progress:"bg-yellow-600",in_review:"bg-pink-600",done:"bg-green-600",canceled:"bg-gray-500"};function XO({groupedResults:e,onSelect:t,onExternalLink:r}){const n=Object.keys(e).sort();return a.jsx(a.Fragment,{children:n.map(i=>a.jsx(Sa.Group,{heading:QO[i]||i,children:e[i].map(s=>{const{issue:o,matchType:l}=s,u=mn[o.status]||"backlog";return a.jsx(Sa.Item,{value:o.identifier,onSelect:()=>t(o.identifier),className:"px-4 py-3 cursor-pointer hover:bg-gray-700 transition-colors border-b border-gray-750 last:border-b-0 aria-selected:bg-gray-700",children:a.jsxs("div",{className:"flex items-start gap-3",children:[o.project&&a.jsx("span",{className:"w-2 h-2 rounded-full shrink-0 mt-1.5",style:{backgroundColor:o.project.color||"#6b7280"},title:o.project.name}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:"text-sm font-medium text-white flex items-center gap-1",children:[o.source==="github"&&a.jsx(xm,{className:"w-3 h-3 text-gray-400"}),a.jsx("span",{className:"text-gray-400",children:o.identifier})]}),a.jsx("span",{className:`px-2 py-0.5 rounded text-xs text-white ${GO[u]||"bg-gray-600"}`,children:o.status}),a.jsx("span",{title:`Priority ${o.priority}`,children:a.jsx(W2,{className:`w-2 h-2 fill-current ${YO[o.priority]||"text-gray-500"}`})}),l&&a.jsxs("span",{className:"text-xs text-gray-500",children:["(",l," match)"]})]}),a.jsx("p",{className:"text-sm text-gray-300 mt-1 line-clamp-2",children:o.title}),o.labels.length>0&&a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[o.labels.slice(0,3).map(c=>a.jsx("span",{className:"text-xs bg-gray-700 text-gray-400 px-2 py-0.5 rounded",children:c},c)),o.labels.length>3&&a.jsxs("span",{className:"text-xs text-gray-500",children:["+",o.labels.length-3," more"]})]})]}),a.jsx("button",{onClick:c=>r(o.url,c),className:"p-1 text-gray-400 hover:text-blue-400 hover:bg-gray-600 rounded transition-colors shrink-0",title:"Open in tracker",children:a.jsx(ls,{className:"w-4 h-4"})})]})},o.id)})},i))})}function JO({isOpen:e,onClose:t,onSelectIssue:r,cycleFilter:n="current",includeCompletedFilter:i=!1}){const[s,o]=w.useState(""),[l,u]=w.useState({sources:new Set,includeCompleted:!1,deepSearch:!1}),{groupedResults:c,isSearching:h,hasResults:d,resultCount:f}=VO(s,l,{cycleFilter:n,includeCompletedFilter:i});w.useEffect(()=>{e||(o(""),u({sources:new Set,includeCompleted:!1,deepSearch:!1}))},[e]),w.useEffect(()=>{const C=y=>{y.key==="Escape"&&t()};if(e)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[e,t]);const p=C=>{u(y=>{const v=new Set(y.sources);return v.has(C)?v.delete(C):v.add(C),{...y,sources:v}})},m=C=>{r(C),t()},x=(C,y)=>{y.stopPropagation(),window.open(C,"_blank","noopener,noreferrer")};return e?a.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),a.jsx("div",{className:"relative bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[70vh] overflow-hidden flex flex-col border border-gray-700",children:a.jsxs(Sa,{className:"flex flex-col h-full",shouldFilter:!1,children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-700",children:[a.jsx(tN,{className:"w-5 h-5 text-gray-400 shrink-0"}),a.jsx(Sa.Input,{value:s,onValueChange:o,placeholder:"Search issues...",className:"flex-1 bg-transparent text-white placeholder-gray-400 focus:outline-none text-base",autoFocus:!0}),a.jsx("button",{onClick:t,className:"p-1 text-gray-400 hover:text-white hover:bg-gray-700 rounded transition-colors shrink-0",children:a.jsx(Nt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-gray-700 bg-gray-850 flex-wrap",children:[a.jsx("span",{className:"text-xs text-gray-400",children:"Filters:"}),["linear","github","rally"].map(C=>a.jsxs("button",{onClick:()=>p(C),className:`px-2 py-1 text-xs rounded transition-colors ${l.sources.size===0||l.sources.has(C)?"bg-blue-600 text-white":"bg-gray-700 text-gray-400 hover:text-white"}`,children:[C==="github"&&a.jsx(xm,{className:"w-3 h-3 inline mr-1"}),C.charAt(0).toUpperCase()+C.slice(1)]},C)),a.jsx("div",{className:"w-px h-4 bg-gray-600"}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:l.includeCompleted,onChange:C=>u(y=>({...y,includeCompleted:C.target.checked})),className:"w-3 h-3 rounded border-gray-600 bg-gray-700 text-blue-600 focus:ring-blue-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-xs text-gray-400",children:"Show completed"})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:l.deepSearch,onChange:C=>u(y=>({...y,deepSearch:C.target.checked})),className:"w-3 h-3 rounded border-gray-600 bg-gray-700 text-blue-600 focus:ring-blue-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-xs text-gray-400",children:"Deep search"})]})]}),a.jsxs(Sa.List,{className:"flex-1 overflow-y-auto",children:[s.length>0&&s.length<2&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400",children:"Type at least 2 characters to search"}),s.length>=2&&h&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400",children:"Searching..."}),s.length>=2&&!h&&!d&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400",children:"No issues found"}),s.length>=2&&!h&&d&&a.jsx(XO,{groupedResults:c,onSelect:m,onExternalLink:x})]}),f>0&&a.jsxs("div",{className:"px-4 py-2 border-t border-gray-700 bg-gray-850 text-xs text-gray-400 flex items-center justify-between",children:[a.jsxs("span",{children:[f," result",f!==1?"s":""]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-700 rounded text-xs",children:"↑"}),a.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-700 rounded text-xs",children:"↓"}),"navigate"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-700 rounded text-xs",children:"Enter"}),"select"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-gray-700 rounded text-xs",children:"Esc"}),"close"]})]})]})]})})]}):null}const ZO=400,e6=1200,t6=700;async function r6(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function n6(){const e=await fetch("/api/issues");if(!e.ok)throw new Error("Failed to fetch issues");return e.json()}async function i6(){const e=await fetch("/api/confirmations");if(!e.ok)throw new Error("Failed to fetch confirmations");return e.json()}async function Kv(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 s6(){const[e,t]=w.useState("kanban"),[r,n]=w.useState(null),[i,s]=w.useState(null),[o,l]=w.useState(t6),[u,c]=w.useState(!1),[h,d]=w.useState(!1),[f,p]=w.useState(null),[m,x]=w.useState(!1),C=w.useRef(null),{data:y=[]}=ae({queryKey:["agents"],queryFn:r6,refetchInterval:5e3}),{data:v=[]}=ae({queryKey:["issues"],queryFn:n6}),{data:g=[]}=ae({queryKey:["confirmations"],queryFn:i6,refetchInterval:2e3});w.useEffect(()=>{g.length>0&&!f&&p(g[0])},[g,f]);const _=i?y.find(L=>{var B;return((B=L.issueId)==null?void 0:B.toLowerCase())===i.toLowerCase()}):null,N=i?v.find(L=>L.identifier.toLowerCase()===i.toLowerCase()):null,S=w.useCallback(L=>{L.preventDefault(),c(!0)},[]),j=w.useCallback(L=>{if(!u||!C.current)return;const O=C.current.getBoundingClientRect().right-L.clientX;l(Math.min(e6,Math.max(ZO,O)))},[u]),A=w.useCallback(()=>{c(!1)},[]);w.useEffect(()=>(u&&(document.addEventListener("mousemove",j),document.addEventListener("mouseup",A),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",A),document.body.style.cursor="",document.body.style.userSelect=""}),[u,j,A]);const $=w.useCallback(()=>{d(L=>!L)},[]),z=w.useCallback(async()=>{if(f)try{await Kv(f.id,!0),p(null)}catch(L){console.error("Failed to confirm:",L)}},[f]),I=w.useCallback(async()=>{if(f)try{await Kv(f.id,!1),p(null)}catch(L){console.error("Failed to deny:",L)}},[f]),P=w.useCallback(()=>{p(null)},[]);w.useEffect(()=>{const L=B=>{B.key==="/"&&!["INPUT","TEXTAREA"].includes(B.target.tagName)&&(B.preventDefault(),x(!0))};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[]);const R=w.useCallback(L=>{s(L),t("kanban")},[]),D=h?"calc(100% - 300px)":`${o}px`;return a.jsxs("div",{className:"h-screen bg-gray-900 flex flex-col overflow-hidden",children:[a.jsx("header",{className:"bg-gray-800 border-b border-gray-700 px-6 py-4 shrink-0",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Iw,{className:"w-6 h-6 text-blue-400"}),a.jsx("h1",{className:"text-xl font-bold text-white",children:"Panopticon"})]}),a.jsx(GD,{})]}),a.jsx("nav",{className:"flex gap-2",children:[{id:"kanban",label:"Board",icon:Q2},{id:"agents",label:"Agents",icon:Ua},{id:"convoys",label:"Convoys",icon:Ua},{id:"handoffs",label:"Handoffs",icon:ym},{id:"activity",label:"Activity",icon:bi},{id:"metrics",label:"Metrics",icon:L2},{id:"skills",label:"Skills",icon:Tw},{id:"health",label:"Health",icon:bo},{id:"settings",label:"Settings",icon:Bw}].map(({id:L,label:B,icon:O})=>a.jsxs("button",{onClick:()=>t(L),className:`flex items-center gap-2 px-4 py-2 rounded-lg transition-colors ${e===L?"bg-blue-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-700"}`,children:[a.jsx(O,{className:"w-4 h-4"}),B]},L))})]})}),a.jsxs("main",{ref:C,className:"flex-1 flex overflow-hidden",children:[e==="kanban"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`flex-1 overflow-auto p-6 ${i?"":"w-full"}`,children:[a.jsx(uL,{}),a.jsx(L3,{selectedIssue:i,onSelectIssue:s})]}),i&&_&&a.jsxs(a.Fragment,{children:[a.jsx("div",{onMouseDown:S,className:`w-1 hover:w-1.5 bg-gray-700 hover:bg-blue-500 cursor-col-resize transition-colors shrink-0 ${u?"bg-blue-500":""}`}),a.jsxs("div",{style:{width:D},className:"relative shrink-0 h-full flex flex-col",children:[a.jsx("button",{onClick:$,className:"absolute top-2 left-2 z-10 p-1.5 bg-gray-700 hover:bg-gray-600 rounded text-gray-400 hover:text-white",title:h?"Collapse panel":"Expand panel",children:h?a.jsx(X2,{className:"w-4 h-4"}):a.jsx(Y2,{className:"w-4 h-4"})}),a.jsx(z5,{agent:_,issueId:i,issueUrl:N==null?void 0:N.url,onClose:()=>s(null)})]})]}),i&&!_&&N&&a.jsx("div",{className:"w-[400px] shrink-0 h-full",children:a.jsx(RD,{issue:N,onClose:()=>s(null)})})]}),e==="agents"&&a.jsx("div",{className:"p-6 w-full",children:a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsx(M5,{selectedAgent:r,onSelectAgent:n}),r&&a.jsx(L5,{agentId:r})]})}),e==="skills"&&a.jsx("div",{className:"p-6 w-full overflow-auto",children:a.jsx(I5,{})}),e==="health"&&a.jsx("div",{className:"p-6 w-full overflow-auto",children:a.jsx(O5,{})}),e==="activity"&&a.jsx("div",{className:"w-full h-full",children:a.jsx(LD,{onClose:()=>t("kanban")})}),e==="convoys"&&a.jsx("div",{className:"w-full h-full",children:a.jsx(WD,{onClose:()=>t("kanban")})}),e==="metrics"&&a.jsx("div",{className:"w-full overflow-auto",children:a.jsx(fL,{})}),e==="handoffs"&&a.jsx("div",{className:"w-full overflow-auto",children:a.jsx(sL,{})}),e==="settings"&&a.jsx("div",{className:"p-6 w-full overflow-auto",children:a.jsx(SL,{})})]}),a.jsx(oL,{request:f,isOpen:!!f,onConfirm:z,onDeny:I,onClose:P}),a.jsx(JO,{isOpen:m,onClose:()=>x(!1),onSelectIssue:R,cycleFilter:"current",includeCompletedFilter:!1})]})}const o6=new v2({defaultOptions:{queries:{refetchInterval:5e3,staleTime:2e3}}});sd.createRoot(document.getElementById("root")).render(a.jsx(gx.StrictMode,{children:a.jsx(x2,{client:o6,children:a.jsx(s6,{})})}));