panopticon-cli 0.4.32 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +96 -210
  2. package/dist/{agents-BDFHF4T3.js → agents-E43Y3HNU.js} +10 -7
  3. package/dist/chunk-7SN4L4PH.js +150 -0
  4. package/dist/chunk-7SN4L4PH.js.map +1 -0
  5. package/dist/{chunk-2NIAOCIC.js → chunk-AAFQANKW.js} +358 -97
  6. package/dist/chunk-AAFQANKW.js.map +1 -0
  7. package/dist/chunk-AQXETQHW.js +113 -0
  8. package/dist/chunk-AQXETQHW.js.map +1 -0
  9. package/dist/chunk-B3PF6JPQ.js +212 -0
  10. package/dist/chunk-B3PF6JPQ.js.map +1 -0
  11. package/dist/chunk-CFCUOV3Q.js +669 -0
  12. package/dist/chunk-CFCUOV3Q.js.map +1 -0
  13. package/dist/chunk-CWELWPWQ.js +32 -0
  14. package/dist/chunk-CWELWPWQ.js.map +1 -0
  15. package/dist/chunk-DI7ABPNQ.js +352 -0
  16. package/dist/chunk-DI7ABPNQ.js.map +1 -0
  17. package/dist/{chunk-VU4FLXV5.js → chunk-FQ66DECN.js} +31 -4
  18. package/dist/chunk-FQ66DECN.js.map +1 -0
  19. package/dist/{chunk-VIWUCJ4V.js → chunk-FTCPTHIJ.js} +57 -432
  20. package/dist/chunk-FTCPTHIJ.js.map +1 -0
  21. package/dist/{review-status-GWQYY77L.js → chunk-GFP3PIPB.js} +14 -7
  22. package/dist/chunk-GFP3PIPB.js.map +1 -0
  23. package/dist/chunk-GR6ZZMCX.js +816 -0
  24. package/dist/chunk-GR6ZZMCX.js.map +1 -0
  25. package/dist/chunk-HJSM6E6U.js +1038 -0
  26. package/dist/chunk-HJSM6E6U.js.map +1 -0
  27. package/dist/{chunk-XP2DXWYP.js → chunk-HZT2AOPN.js} +164 -39
  28. package/dist/chunk-HZT2AOPN.js.map +1 -0
  29. package/dist/chunk-JQBV3Q2W.js +29 -0
  30. package/dist/chunk-JQBV3Q2W.js.map +1 -0
  31. package/dist/{chunk-BWGFN44T.js → chunk-JT4O4YVM.js} +28 -16
  32. package/dist/chunk-JT4O4YVM.js.map +1 -0
  33. package/dist/chunk-NTO3EDB3.js +600 -0
  34. package/dist/chunk-NTO3EDB3.js.map +1 -0
  35. package/dist/{chunk-JY7R7V4G.js → chunk-OMNXYPXC.js} +2 -2
  36. package/dist/chunk-OMNXYPXC.js.map +1 -0
  37. package/dist/chunk-PELXV435.js +215 -0
  38. package/dist/chunk-PELXV435.js.map +1 -0
  39. package/dist/chunk-PPRFKTVC.js +154 -0
  40. package/dist/chunk-PPRFKTVC.js.map +1 -0
  41. package/dist/chunk-WQG2TYCB.js +677 -0
  42. package/dist/chunk-WQG2TYCB.js.map +1 -0
  43. package/dist/{chunk-HCTJFIJJ.js → chunk-YLPSQAM2.js} +2 -2
  44. package/dist/{chunk-HCTJFIJJ.js.map → chunk-YLPSQAM2.js.map} +1 -1
  45. package/dist/{chunk-6HXKTOD7.js → chunk-ZTFNYOC7.js} +53 -38
  46. package/dist/chunk-ZTFNYOC7.js.map +1 -0
  47. package/dist/cli/index.js +5103 -3165
  48. package/dist/cli/index.js.map +1 -1
  49. package/dist/{config-BOAMSKTF.js → config-4CJNUE3O.js} +7 -3
  50. package/dist/dashboard/prompts/merge-agent.md +217 -0
  51. package/dist/dashboard/prompts/review-agent.md +409 -0
  52. package/dist/dashboard/prompts/sync-main.md +84 -0
  53. package/dist/dashboard/prompts/test-agent.md +283 -0
  54. package/dist/dashboard/prompts/work-agent.md +249 -0
  55. package/dist/dashboard/public/assets/index-BxpjweAL.css +32 -0
  56. package/dist/dashboard/public/assets/index-DQHkwvvJ.js +743 -0
  57. package/dist/dashboard/public/index.html +2 -2
  58. package/dist/dashboard/server.js +17619 -4044
  59. package/dist/{dns-L3L2BB27.js → dns-7BDJSD3E.js} +4 -2
  60. package/dist/{feedback-writer-AAKF5BTK.js → feedback-writer-LVZ5TFYZ.js} +8 -4
  61. package/dist/feedback-writer-LVZ5TFYZ.js.map +1 -0
  62. package/dist/hume-WMAUBBV2.js +13 -0
  63. package/dist/index.d.ts +162 -40
  64. package/dist/index.js +67 -23
  65. package/dist/index.js.map +1 -1
  66. package/dist/{projects-VXRUCMLM.js → projects-JEIVIYC6.js} +3 -3
  67. package/dist/rally-RKFSWC7E.js +10 -0
  68. package/dist/{remote-agents-Z3R2A5BN.js → remote-agents-TFSMW7GN.js} +2 -2
  69. package/dist/{remote-workspace-2G6V2KNP.js → remote-workspace-AHVHQEES.js} +8 -8
  70. package/dist/review-status-EPFG4XM7.js +19 -0
  71. package/dist/shadow-state-5MDP6YXH.js +30 -0
  72. package/dist/shadow-state-5MDP6YXH.js.map +1 -0
  73. package/dist/{specialist-context-N32QBNNQ.js → specialist-context-ZC6A4M3I.js} +8 -7
  74. package/dist/{specialist-context-N32QBNNQ.js.map → specialist-context-ZC6A4M3I.js.map} +1 -1
  75. package/dist/{specialist-logs-GF3YV4KL.js → specialist-logs-KLGJCEUL.js} +7 -6
  76. package/dist/specialist-logs-KLGJCEUL.js.map +1 -0
  77. package/dist/{specialists-JBIW6MP4.js → specialists-O4HWDJL5.js} +7 -6
  78. package/dist/specialists-O4HWDJL5.js.map +1 -0
  79. package/dist/tldr-daemon-T3THOUGT.js +21 -0
  80. package/dist/tldr-daemon-T3THOUGT.js.map +1 -0
  81. package/dist/traefik-QN7R5I6V.js +19 -0
  82. package/dist/traefik-QN7R5I6V.js.map +1 -0
  83. package/dist/tunnel-W2GZBLEV.js +13 -0
  84. package/dist/tunnel-W2GZBLEV.js.map +1 -0
  85. package/dist/workspace-manager-IE4JL2JP.js +22 -0
  86. package/dist/workspace-manager-IE4JL2JP.js.map +1 -0
  87. package/package.json +2 -2
  88. package/scripts/heartbeat-hook +37 -10
  89. package/scripts/patches/llm-tldr-tsx-support.py +109 -0
  90. package/scripts/pre-tool-hook +26 -15
  91. package/scripts/record-cost-event.js +177 -43
  92. package/scripts/record-cost-event.ts +87 -3
  93. package/scripts/statusline.sh +169 -0
  94. package/scripts/stop-hook +21 -11
  95. package/scripts/tldr-post-edit +72 -0
  96. package/scripts/tldr-read-enforcer +275 -0
  97. package/scripts/work-agent-stop-hook +137 -0
  98. package/skills/check-merged/SKILL.md +143 -0
  99. package/skills/crash-investigation/SKILL.md +301 -0
  100. package/skills/github-cli/SKILL.md +185 -0
  101. package/skills/myn-standards/SKILL.md +351 -0
  102. package/skills/pan-reopen/SKILL.md +65 -0
  103. package/skills/pan-sync-main/SKILL.md +87 -0
  104. package/skills/pan-tldr/SKILL.md +149 -0
  105. package/skills/react-best-practices/SKILL.md +125 -0
  106. package/skills/spec-readiness/REPORT-TEMPLATE.md +158 -0
  107. package/skills/spec-readiness/SCORING-REFERENCE.md +369 -0
  108. package/skills/spec-readiness/SKILL.md +400 -0
  109. package/skills/spec-readiness-setup/SKILL.md +361 -0
  110. package/skills/workspace-status/SKILL.md +56 -0
  111. package/skills/write-spec/SKILL.md +138 -0
  112. package/templates/traefik/dynamic/panopticon.yml.template +0 -5
  113. package/templates/traefik/traefik.yml +0 -8
  114. package/dist/chunk-2NIAOCIC.js.map +0 -1
  115. package/dist/chunk-3XAB4IXF.js +0 -51
  116. package/dist/chunk-3XAB4IXF.js.map +0 -1
  117. package/dist/chunk-6HXKTOD7.js.map +0 -1
  118. package/dist/chunk-BBCUK6N2.js +0 -241
  119. package/dist/chunk-BBCUK6N2.js.map +0 -1
  120. package/dist/chunk-BWGFN44T.js.map +0 -1
  121. package/dist/chunk-ELK6Q7QI.js +0 -545
  122. package/dist/chunk-ELK6Q7QI.js.map +0 -1
  123. package/dist/chunk-JY7R7V4G.js.map +0 -1
  124. package/dist/chunk-LYSBSZYV.js +0 -1523
  125. package/dist/chunk-LYSBSZYV.js.map +0 -1
  126. package/dist/chunk-VIWUCJ4V.js.map +0 -1
  127. package/dist/chunk-VU4FLXV5.js.map +0 -1
  128. package/dist/chunk-XP2DXWYP.js.map +0 -1
  129. package/dist/dashboard/public/assets/index-C7X6LP5Z.css +0 -32
  130. package/dist/dashboard/public/assets/index-ClYqpcAJ.js +0 -645
  131. package/dist/feedback-writer-AAKF5BTK.js.map +0 -1
  132. package/dist/review-status-GWQYY77L.js.map +0 -1
  133. package/dist/traefik-CUJM6K5Z.js +0 -12
  134. /package/dist/{agents-BDFHF4T3.js.map → agents-E43Y3HNU.js.map} +0 -0
  135. /package/dist/{config-BOAMSKTF.js.map → config-4CJNUE3O.js.map} +0 -0
  136. /package/dist/{dns-L3L2BB27.js.map → dns-7BDJSD3E.js.map} +0 -0
  137. /package/dist/{projects-VXRUCMLM.js.map → hume-WMAUBBV2.js.map} +0 -0
  138. /package/dist/{remote-agents-Z3R2A5BN.js.map → projects-JEIVIYC6.js.map} +0 -0
  139. /package/dist/{specialist-logs-GF3YV4KL.js.map → rally-RKFSWC7E.js.map} +0 -0
  140. /package/dist/{specialists-JBIW6MP4.js.map → remote-agents-TFSMW7GN.js.map} +0 -0
  141. /package/dist/{remote-workspace-2G6V2KNP.js.map → remote-workspace-AHVHQEES.js.map} +0 -0
  142. /package/dist/{traefik-CUJM6K5Z.js.map → review-status-EPFG4XM7.js.map} +0 -0
@@ -1,645 +0,0 @@
1
- var Ix=e=>{throw TypeError(e)};var Oh=(e,t,n)=>t.has(e)||Ix("Cannot "+n);var M=(e,t,n)=>(Oh(e,t,"read from private field"),n?n.call(e):t.get(e)),ce=(e,t,n)=>t.has(e)?Ix("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),re=(e,t,n,r)=>(Oh(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ve=(e,t,n)=>(Oh(e,t,"access private method"),n);var Ac=(e,t,n,r)=>({set _(s){re(e,t,s,n)},get _(){return M(e,t,r)}});function $N(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Zu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function HN(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var yw={exports:{}},qd={},_w={exports:{}},Ne={};/**
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 fc=Symbol.for("react.element"),WN=Symbol.for("react.portal"),UN=Symbol.for("react.fragment"),qN=Symbol.for("react.strict_mode"),KN=Symbol.for("react.profiler"),VN=Symbol.for("react.provider"),YN=Symbol.for("react.context"),QN=Symbol.for("react.forward_ref"),XN=Symbol.for("react.suspense"),GN=Symbol.for("react.memo"),JN=Symbol.for("react.lazy"),Bx=Symbol.iterator;function ZN(e){return e===null||typeof e!="object"?null:(e=Bx&&e[Bx]||e["@@iterator"],typeof e=="function"?e:null)}var bw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ww=Object.assign,Sw={};function Sa(e,t,n){this.props=e,this.context=t,this.refs=Sw,this.updater=n||bw}Sa.prototype.isReactComponent={};Sa.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")};Sa.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function kw(){}kw.prototype=Sa.prototype;function Dg(e,t,n){this.props=e,this.context=t,this.refs=Sw,this.updater=n||bw}var Mg=Dg.prototype=new kw;Mg.constructor=Dg;ww(Mg,Sa.prototype);Mg.isPureReactComponent=!0;var Fx=Array.isArray,Cw=Object.prototype.hasOwnProperty,Ag={current:null},Nw={key:!0,ref:!0,__self:!0,__source:!0};function Ew(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)Cw.call(t,r)&&!Nw.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:fc,type:e,key:i,ref:o,props:s,_owner:Ag.current}}function eE(e,t){return{$$typeof:fc,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Lg(e){return typeof e=="object"&&e!==null&&e.$$typeof===fc}function tE(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var zx=/\/+/g;function Ih(e,t){return typeof e=="object"&&e!==null&&e.key!=null?tE(""+e.key):t.toString(36)}function ku(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case fc:case WN:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Ih(o,0):r,Fx(s)?(n="",e!=null&&(n=e.replace(zx,"$&/")+"/"),ku(s,t,n,"",function(u){return u})):s!=null&&(Lg(s)&&(s=eE(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(zx,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",Fx(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Ih(i,l);o+=ku(i,t,n,c,s)}else if(c=ZN(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Ih(i,l++),o+=ku(i,t,n,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Lc(e,t,n){if(e==null)return e;var r=[],s=0;return ku(e,r,"","",function(i){return t.call(n,i,s++)}),r}function nE(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var cn={current:null},Cu={transition:null},rE={ReactCurrentDispatcher:cn,ReactCurrentBatchConfig:Cu,ReactCurrentOwner:Ag};function jw(){throw Error("act(...) is not supported in production builds of React.")}Ne.Children={map:Lc,forEach:function(e,t,n){Lc(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Lc(e,function(){t++}),t},toArray:function(e){return Lc(e,function(t){return t})||[]},only:function(e){if(!Lg(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ne.Component=Sa;Ne.Fragment=UN;Ne.Profiler=KN;Ne.PureComponent=Dg;Ne.StrictMode=qN;Ne.Suspense=XN;Ne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rE;Ne.act=jw;Ne.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=ww({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Ag.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Cw.call(t,c)&&!Nw.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:fc,type:e.type,key:s,ref:i,props:r,_owner:o}};Ne.createContext=function(e){return e={$$typeof:YN,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:VN,_context:e},e.Consumer=e};Ne.createElement=Ew;Ne.createFactory=function(e){var t=Ew.bind(null,e);return t.type=e,t};Ne.createRef=function(){return{current:null}};Ne.forwardRef=function(e){return{$$typeof:QN,render:e}};Ne.isValidElement=Lg;Ne.lazy=function(e){return{$$typeof:JN,_payload:{_status:-1,_result:e},_init:nE}};Ne.memo=function(e,t){return{$$typeof:GN,type:e,compare:t===void 0?null:t}};Ne.startTransition=function(e){var t=Cu.transition;Cu.transition={};try{e()}finally{Cu.transition=t}};Ne.unstable_act=jw;Ne.useCallback=function(e,t){return cn.current.useCallback(e,t)};Ne.useContext=function(e){return cn.current.useContext(e)};Ne.useDebugValue=function(){};Ne.useDeferredValue=function(e){return cn.current.useDeferredValue(e)};Ne.useEffect=function(e,t){return cn.current.useEffect(e,t)};Ne.useId=function(){return cn.current.useId()};Ne.useImperativeHandle=function(e,t,n){return cn.current.useImperativeHandle(e,t,n)};Ne.useInsertionEffect=function(e,t){return cn.current.useInsertionEffect(e,t)};Ne.useLayoutEffect=function(e,t){return cn.current.useLayoutEffect(e,t)};Ne.useMemo=function(e,t){return cn.current.useMemo(e,t)};Ne.useReducer=function(e,t,n){return cn.current.useReducer(e,t,n)};Ne.useRef=function(e){return cn.current.useRef(e)};Ne.useState=function(e){return cn.current.useState(e)};Ne.useSyncExternalStore=function(e,t,n){return cn.current.useSyncExternalStore(e,t,n)};Ne.useTransition=function(){return cn.current.useTransition()};Ne.version="18.3.1";_w.exports=Ne;var x=_w.exports;const qe=wa(x),Og=$N({__proto__:null,default:qe},[x]);/**
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 sE=x,iE=Symbol.for("react.element"),oE=Symbol.for("react.fragment"),aE=Object.prototype.hasOwnProperty,lE=sE.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,cE={key:!0,ref:!0,__self:!0,__source:!0};function Rw(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)aE.call(t,r)&&!cE.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:iE,type:e,key:i,ref:o,props:s,_owner:lE.current}}qd.Fragment=oE;qd.jsx=Rw;qd.jsxs=Rw;yw.exports=qd;var a=yw.exports,lp={},Pw={exports:{}},Un={},Tw={exports:{}},Dw={};/**
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(A,H){var S=A.length;A.push(H);e:for(;0<S;){var Y=S-1>>>1,B=A[Y];if(0<s(B,H))A[Y]=H,A[S]=B,S=Y;else break e}}function n(A){return A.length===0?null:A[0]}function r(A){if(A.length===0)return null;var H=A[0],S=A.pop();if(S!==H){A[0]=S;e:for(var Y=0,B=A.length,C=B>>>1;Y<C;){var U=2*(Y+1)-1,I=A[U],q=U+1,z=A[q];if(0>s(I,S))q<B&&0>s(z,I)?(A[Y]=z,A[q]=S,Y=q):(A[Y]=I,A[U]=S,Y=U);else if(q<B&&0>s(z,S))A[Y]=z,A[q]=S,Y=q;else break e}}return H}function s(A,H){var S=A.sortIndex-H.sortIndex;return S!==0?S:A.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],h=1,d=null,p=3,f=!1,m=!1,g=!1,w=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(A){for(var H=n(u);H!==null;){if(H.callback===null)r(u);else if(H.startTime<=A)r(u),H.sortIndex=H.expirationTime,t(c,H);else break;H=n(u)}}function b(A){if(g=!1,_(A),!m)if(n(c)!==null)m=!0,$(N);else{var H=n(u);H!==null&&K(b,H.startTime-A)}}function N(A,H){m=!1,g&&(g=!1,v(D),D=-1),f=!0;var S=p;try{for(_(H),d=n(c);d!==null&&(!(d.expirationTime>H)||A&&!O());){var Y=d.callback;if(typeof Y=="function"){d.callback=null,p=d.priorityLevel;var B=Y(d.expirationTime<=H);H=e.unstable_now(),typeof B=="function"?d.callback=B:d===n(c)&&r(c),_(H)}else r(c);d=n(c)}if(d!==null)var C=!0;else{var U=n(u);U!==null&&K(b,U.startTime-H),C=!1}return C}finally{d=null,p=S,f=!1}}var k=!1,j=null,D=-1,F=5,P=-1;function O(){return!(e.unstable_now()-P<F)}function T(){if(j!==null){var A=e.unstable_now();P=A;var H=!0;try{H=j(!0,A)}finally{H?E():(k=!1,j=null)}}else k=!1}var E;if(typeof y=="function")E=function(){y(T)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,L=R.port2;R.port1.onmessage=T,E=function(){L.postMessage(null)}}else E=function(){w(T,0)};function $(A){j=A,k||(k=!0,E())}function K(A,H){D=w(function(){A(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(A){A.callback=null},e.unstable_continueExecution=function(){m||f||(m=!0,$(N))},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(A){switch(p){case 1:case 2:case 3:var H=3;break;default:H=p}var S=p;p=H;try{return A()}finally{p=S}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(A,H){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var S=p;p=A;try{return H()}finally{p=S}},e.unstable_scheduleCallback=function(A,H,S){var Y=e.unstable_now();switch(typeof S=="object"&&S!==null?(S=S.delay,S=typeof S=="number"&&0<S?Y+S:Y):S=Y,A){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=S+B,A={id:h++,callback:H,priorityLevel:A,startTime:S,expirationTime:B,sortIndex:-1},S>Y?(A.sortIndex=S,t(u,A),n(c)===null&&A===n(u)&&(g?(v(D),D=-1):g=!0,K(b,S-Y))):(A.sortIndex=B,t(c,A),m||f||(m=!0,$(N))),A},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(A){var H=p;return function(){var S=p;p=H;try{return A.apply(this,arguments)}finally{p=S}}}})(Dw);Tw.exports=Dw;var uE=Tw.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 dE=x,Hn=uE;function G(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Mw=new Set,Dl={};function lo(e,t){ua(e,t),ua(e+"Capture",t)}function ua(e,t){for(Dl[e]=t,e=0;e<t.length;e++)Mw.add(t[e])}var ds=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cp=Object.prototype.hasOwnProperty,hE=/^[: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]*$/,$x={},Hx={};function fE(e){return cp.call(Hx,e)?!0:cp.call($x,e)?!1:hE.test(e)?Hx[e]=!0:($x[e]=!0,!1)}function pE(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function mE(e,t,n,r){if(t===null||typeof t>"u"||pE(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function un(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var Wt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Wt[e]=new un(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Wt[t]=new un(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Wt[e]=new un(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Wt[e]=new un(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){Wt[e]=new un(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Wt[e]=new un(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Wt[e]=new un(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Wt[e]=new un(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Wt[e]=new un(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ig=/[\-:]([a-z])/g;function Bg(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(Ig,Bg);Wt[t]=new un(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(Ig,Bg);Wt[t]=new un(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(Ig,Bg);Wt[t]=new un(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Wt[e]=new un(e,1,!1,e.toLowerCase(),null,!1,!1)});Wt.xlinkHref=new un("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Wt[e]=new un(e,1,!1,e.toLowerCase(),null,!0,!0)});function Fg(e,t,n,r){var s=Wt.hasOwnProperty(t)?Wt[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(mE(t,n,s,r)&&(n=null),r||s===null?fE(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var vs=dE.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Oc=Symbol.for("react.element"),Ro=Symbol.for("react.portal"),Po=Symbol.for("react.fragment"),zg=Symbol.for("react.strict_mode"),up=Symbol.for("react.profiler"),Aw=Symbol.for("react.provider"),Lw=Symbol.for("react.context"),$g=Symbol.for("react.forward_ref"),dp=Symbol.for("react.suspense"),hp=Symbol.for("react.suspense_list"),Hg=Symbol.for("react.memo"),Ms=Symbol.for("react.lazy"),Ow=Symbol.for("react.offscreen"),Wx=Symbol.iterator;function Ia(e){return e===null||typeof e!="object"?null:(e=Wx&&e[Wx]||e["@@iterator"],typeof e=="function"?e:null)}var Je=Object.assign,Bh;function rl(e){if(Bh===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Bh=t&&t[1]||""}return`
34
- `+Bh+e}var Fh=!1;function zh(e,t){if(!e||Fh)return"";Fh=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
35
- `),i=r.stack.split(`
36
- `),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=`
37
- `+s[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Fh=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?rl(e):""}function gE(e){switch(e.tag){case 5:return rl(e.type);case 16:return rl("Lazy");case 13:return rl("Suspense");case 19:return rl("SuspenseList");case 0:case 2:case 15:return e=zh(e.type,!1),e;case 11:return e=zh(e.type.render,!1),e;case 1:return e=zh(e.type,!0),e;default:return""}}function fp(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 Po:return"Fragment";case Ro:return"Portal";case up:return"Profiler";case zg:return"StrictMode";case dp:return"Suspense";case hp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Lw:return(e.displayName||"Context")+".Consumer";case Aw:return(e._context.displayName||"Context")+".Provider";case $g:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Hg:return t=e.displayName||null,t!==null?t:fp(e.type)||"Memo";case Ms:t=e._payload,e=e._init;try{return fp(e(t))}catch{}}return null}function vE(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 fp(t);case 8:return t===zg?"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 fi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Iw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function xE(e){var t=Iw(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ic(e){e._valueTracker||(e._valueTracker=xE(e))}function Bw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Iw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ed(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 pp(e,t){var n=t.checked;return Je({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ux(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=fi(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Fw(e,t){t=t.checked,t!=null&&Fg(e,"checked",t,!1)}function mp(e,t){Fw(e,t);var n=fi(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?gp(e,t.type,n):t.hasOwnProperty("defaultValue")&&gp(e,t.type,fi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function qx(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function gp(e,t,n){(t!=="number"||ed(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var sl=Array.isArray;function Wo(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+fi(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function vp(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(G(91));return Je({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Kx(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(G(92));if(sl(n)){if(1<n.length)throw Error(G(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:fi(n)}}function zw(e,t){var n=fi(t.value),r=fi(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Vx(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function $w(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 xp(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?$w(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Bc,Hw=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Bc=Bc||document.createElement("div"),Bc.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Bc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ml(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var pl={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},yE=["Webkit","ms","Moz","O"];Object.keys(pl).forEach(function(e){yE.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),pl[t]=pl[e]})});function Ww(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||pl.hasOwnProperty(e)&&pl[e]?(""+t).trim():t+"px"}function Uw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Ww(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var _E=Je({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 yp(e,t){if(t){if(_E[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(G(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(G(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(G(61))}if(t.style!=null&&typeof t.style!="object")throw Error(G(62))}}function _p(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 bp=null;function Wg(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wp=null,Uo=null,qo=null;function Yx(e){if(e=gc(e)){if(typeof wp!="function")throw Error(G(280));var t=e.stateNode;t&&(t=Xd(t),wp(e.stateNode,e.type,t))}}function qw(e){Uo?qo?qo.push(e):qo=[e]:Uo=e}function Kw(){if(Uo){var e=Uo,t=qo;if(qo=Uo=null,Yx(e),t)for(e=0;e<t.length;e++)Yx(t[e])}}function Vw(e,t){return e(t)}function Yw(){}var $h=!1;function Qw(e,t,n){if($h)return e(t,n);$h=!0;try{return Vw(e,t,n)}finally{$h=!1,(Uo!==null||qo!==null)&&(Yw(),Kw())}}function Al(e,t){var n=e.stateNode;if(n===null)return null;var r=Xd(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(G(231,t,typeof n));return n}var Sp=!1;if(ds)try{var Ba={};Object.defineProperty(Ba,"passive",{get:function(){Sp=!0}}),window.addEventListener("test",Ba,Ba),window.removeEventListener("test",Ba,Ba)}catch{Sp=!1}function bE(e,t,n,r,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(h){this.onError(h)}}var ml=!1,td=null,nd=!1,kp=null,wE={onError:function(e){ml=!0,td=e}};function SE(e,t,n,r,s,i,o,l,c){ml=!1,td=null,bE.apply(wE,arguments)}function kE(e,t,n,r,s,i,o,l,c){if(SE.apply(this,arguments),ml){if(ml){var u=td;ml=!1,td=null}else throw Error(G(198));nd||(nd=!0,kp=u)}}function co(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Xw(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 Qx(e){if(co(e)!==e)throw Error(G(188))}function CE(e){var t=e.alternate;if(!t){if(t=co(e),t===null)throw Error(G(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Qx(s),e;if(i===r)return Qx(s),t;i=i.sibling}throw Error(G(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(G(189))}}if(n.alternate!==r)throw Error(G(190))}if(n.tag!==3)throw Error(G(188));return n.stateNode.current===n?e:t}function Gw(e){return e=CE(e),e!==null?Jw(e):null}function Jw(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Jw(e);if(t!==null)return t;e=e.sibling}return null}var Zw=Hn.unstable_scheduleCallback,Xx=Hn.unstable_cancelCallback,NE=Hn.unstable_shouldYield,EE=Hn.unstable_requestPaint,ct=Hn.unstable_now,jE=Hn.unstable_getCurrentPriorityLevel,Ug=Hn.unstable_ImmediatePriority,e1=Hn.unstable_UserBlockingPriority,rd=Hn.unstable_NormalPriority,RE=Hn.unstable_LowPriority,t1=Hn.unstable_IdlePriority,Kd=null,$r=null;function PE(e){if($r&&typeof $r.onCommitFiberRoot=="function")try{$r.onCommitFiberRoot(Kd,e,void 0,(e.current.flags&128)===128)}catch{}}var _r=Math.clz32?Math.clz32:ME,TE=Math.log,DE=Math.LN2;function ME(e){return e>>>=0,e===0?32:31-(TE(e)/DE|0)|0}var Fc=64,zc=4194304;function il(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 sd(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=il(l):(i&=o,i!==0&&(r=il(i)))}else o=n&~s,o!==0?r=il(o):i!==0&&(r=il(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-_r(t),s=1<<n,r|=e[n],t&=~s;return r}function AE(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 LE(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-_r(i),l=1<<o,c=s[o];c===-1?(!(l&n)||l&r)&&(s[o]=AE(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Cp(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function n1(){var e=Fc;return Fc<<=1,!(Fc&4194240)&&(Fc=64),e}function Hh(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function pc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-_r(t),e[t]=n}function OE(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-_r(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function qg(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-_r(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Ae=0;function r1(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var s1,Kg,i1,o1,a1,Np=!1,$c=[],Zs=null,ei=null,ti=null,Ll=new Map,Ol=new Map,Is=[],IE="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 Gx(e,t){switch(e){case"focusin":case"focusout":Zs=null;break;case"dragenter":case"dragleave":ei=null;break;case"mouseover":case"mouseout":ti=null;break;case"pointerover":case"pointerout":Ll.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ol.delete(t.pointerId)}}function Fa(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=gc(t),t!==null&&Kg(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function BE(e,t,n,r,s){switch(t){case"focusin":return Zs=Fa(Zs,e,t,n,r,s),!0;case"dragenter":return ei=Fa(ei,e,t,n,r,s),!0;case"mouseover":return ti=Fa(ti,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Ll.set(i,Fa(Ll.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Ol.set(i,Fa(Ol.get(i)||null,e,t,n,r,s)),!0}return!1}function l1(e){var t=Ti(e.target);if(t!==null){var n=co(t);if(n!==null){if(t=n.tag,t===13){if(t=Xw(n),t!==null){e.blockedOn=t,a1(e.priority,function(){i1(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Nu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ep(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);bp=r,n.target.dispatchEvent(r),bp=null}else return t=gc(n),t!==null&&Kg(t),e.blockedOn=n,!1;t.shift()}return!0}function Jx(e,t,n){Nu(e)&&n.delete(t)}function FE(){Np=!1,Zs!==null&&Nu(Zs)&&(Zs=null),ei!==null&&Nu(ei)&&(ei=null),ti!==null&&Nu(ti)&&(ti=null),Ll.forEach(Jx),Ol.forEach(Jx)}function za(e,t){e.blockedOn===t&&(e.blockedOn=null,Np||(Np=!0,Hn.unstable_scheduleCallback(Hn.unstable_NormalPriority,FE)))}function Il(e){function t(s){return za(s,e)}if(0<$c.length){za($c[0],e);for(var n=1;n<$c.length;n++){var r=$c[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Zs!==null&&za(Zs,e),ei!==null&&za(ei,e),ti!==null&&za(ti,e),Ll.forEach(t),Ol.forEach(t),n=0;n<Is.length;n++)r=Is[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Is.length&&(n=Is[0],n.blockedOn===null);)l1(n),n.blockedOn===null&&Is.shift()}var Ko=vs.ReactCurrentBatchConfig,id=!0;function zE(e,t,n,r){var s=Ae,i=Ko.transition;Ko.transition=null;try{Ae=1,Vg(e,t,n,r)}finally{Ae=s,Ko.transition=i}}function $E(e,t,n,r){var s=Ae,i=Ko.transition;Ko.transition=null;try{Ae=4,Vg(e,t,n,r)}finally{Ae=s,Ko.transition=i}}function Vg(e,t,n,r){if(id){var s=Ep(e,t,n,r);if(s===null)Jh(e,t,r,od,n),Gx(e,r);else if(BE(s,e,t,n,r))r.stopPropagation();else if(Gx(e,r),t&4&&-1<IE.indexOf(e)){for(;s!==null;){var i=gc(s);if(i!==null&&s1(i),i=Ep(e,t,n,r),i===null&&Jh(e,t,r,od,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Jh(e,t,r,null,n)}}var od=null;function Ep(e,t,n,r){if(od=null,e=Wg(r),e=Ti(e),e!==null)if(t=co(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Xw(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return od=e,null}function c1(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(jE()){case Ug:return 1;case e1:return 4;case rd:case RE:return 16;case t1:return 536870912;default:return 16}default:return 16}}var Qs=null,Yg=null,Eu=null;function u1(){if(Eu)return Eu;var e,t=Yg,n=t.length,r,s="value"in Qs?Qs.value:Qs.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return Eu=s.slice(e,1<r?1-r:void 0)}function ju(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 Hc(){return!0}function Zx(){return!1}function qn(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Hc:Zx,this.isPropagationStopped=Zx,this}return Je(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Hc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Hc)},persist:function(){},isPersistent:Hc}),t}var ka={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qg=qn(ka),mc=Je({},ka,{view:0,detail:0}),HE=qn(mc),Wh,Uh,$a,Vd=Je({},mc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xg,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!==$a&&($a&&e.type==="mousemove"?(Wh=e.screenX-$a.screenX,Uh=e.screenY-$a.screenY):Uh=Wh=0,$a=e),Wh)},movementY:function(e){return"movementY"in e?e.movementY:Uh}}),ey=qn(Vd),WE=Je({},Vd,{dataTransfer:0}),UE=qn(WE),qE=Je({},mc,{relatedTarget:0}),qh=qn(qE),KE=Je({},ka,{animationName:0,elapsedTime:0,pseudoElement:0}),VE=qn(KE),YE=Je({},ka,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),QE=qn(YE),XE=Je({},ka,{data:0}),ty=qn(XE),GE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},JE={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"},ZE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ej(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ZE[e])?!!t[e]:!1}function Xg(){return ej}var tj=Je({},mc,{key:function(e){if(e.key){var t=GE[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ju(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?JE[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xg,charCode:function(e){return e.type==="keypress"?ju(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ju(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),nj=qn(tj),rj=Je({},Vd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ny=qn(rj),sj=Je({},mc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xg}),ij=qn(sj),oj=Je({},ka,{propertyName:0,elapsedTime:0,pseudoElement:0}),aj=qn(oj),lj=Je({},Vd,{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}),cj=qn(lj),uj=[9,13,27,32],Gg=ds&&"CompositionEvent"in window,gl=null;ds&&"documentMode"in document&&(gl=document.documentMode);var dj=ds&&"TextEvent"in window&&!gl,d1=ds&&(!Gg||gl&&8<gl&&11>=gl),ry=" ",sy=!1;function h1(e,t){switch(e){case"keyup":return uj.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function f1(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var To=!1;function hj(e,t){switch(e){case"compositionend":return f1(t);case"keypress":return t.which!==32?null:(sy=!0,ry);case"textInput":return e=t.data,e===ry&&sy?null:e;default:return null}}function fj(e,t){if(To)return e==="compositionend"||!Gg&&h1(e,t)?(e=u1(),Eu=Yg=Qs=null,To=!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 d1&&t.locale!=="ko"?null:t.data;default:return null}}var pj={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 iy(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!pj[e.type]:t==="textarea"}function p1(e,t,n,r){qw(r),t=ad(t,"onChange"),0<t.length&&(n=new Qg("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var vl=null,Bl=null;function mj(e){C1(e,0)}function Yd(e){var t=Ao(e);if(Bw(t))return e}function gj(e,t){if(e==="change")return t}var m1=!1;if(ds){var Kh;if(ds){var Vh="oninput"in document;if(!Vh){var oy=document.createElement("div");oy.setAttribute("oninput","return;"),Vh=typeof oy.oninput=="function"}Kh=Vh}else Kh=!1;m1=Kh&&(!document.documentMode||9<document.documentMode)}function ay(){vl&&(vl.detachEvent("onpropertychange",g1),Bl=vl=null)}function g1(e){if(e.propertyName==="value"&&Yd(Bl)){var t=[];p1(t,Bl,e,Wg(e)),Qw(mj,t)}}function vj(e,t,n){e==="focusin"?(ay(),vl=t,Bl=n,vl.attachEvent("onpropertychange",g1)):e==="focusout"&&ay()}function xj(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Yd(Bl)}function yj(e,t){if(e==="click")return Yd(t)}function _j(e,t){if(e==="input"||e==="change")return Yd(t)}function bj(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Sr=typeof Object.is=="function"?Object.is:bj;function Fl(e,t){if(Sr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!cp.call(t,s)||!Sr(e[s],t[s]))return!1}return!0}function ly(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function cy(e,t){var n=ly(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ly(n)}}function v1(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?v1(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function x1(){for(var e=window,t=ed();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ed(e.document)}return t}function Jg(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 wj(e){var t=x1(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&v1(n.ownerDocument.documentElement,n)){if(r!==null&&Jg(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=cy(n,i);var o=cy(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Sj=ds&&"documentMode"in document&&11>=document.documentMode,Do=null,jp=null,xl=null,Rp=!1;function uy(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Rp||Do==null||Do!==ed(r)||(r=Do,"selectionStart"in r&&Jg(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),xl&&Fl(xl,r)||(xl=r,r=ad(jp,"onSelect"),0<r.length&&(t=new Qg("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Do)))}function Wc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Mo={animationend:Wc("Animation","AnimationEnd"),animationiteration:Wc("Animation","AnimationIteration"),animationstart:Wc("Animation","AnimationStart"),transitionend:Wc("Transition","TransitionEnd")},Yh={},y1={};ds&&(y1=document.createElement("div").style,"AnimationEvent"in window||(delete Mo.animationend.animation,delete Mo.animationiteration.animation,delete Mo.animationstart.animation),"TransitionEvent"in window||delete Mo.transitionend.transition);function Qd(e){if(Yh[e])return Yh[e];if(!Mo[e])return e;var t=Mo[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in y1)return Yh[e]=t[n];return e}var _1=Qd("animationend"),b1=Qd("animationiteration"),w1=Qd("animationstart"),S1=Qd("transitionend"),k1=new Map,dy="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 xi(e,t){k1.set(e,t),lo(t,[e])}for(var Qh=0;Qh<dy.length;Qh++){var Xh=dy[Qh],kj=Xh.toLowerCase(),Cj=Xh[0].toUpperCase()+Xh.slice(1);xi(kj,"on"+Cj)}xi(_1,"onAnimationEnd");xi(b1,"onAnimationIteration");xi(w1,"onAnimationStart");xi("dblclick","onDoubleClick");xi("focusin","onFocus");xi("focusout","onBlur");xi(S1,"onTransitionEnd");ua("onMouseEnter",["mouseout","mouseover"]);ua("onMouseLeave",["mouseout","mouseover"]);ua("onPointerEnter",["pointerout","pointerover"]);ua("onPointerLeave",["pointerout","pointerover"]);lo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));lo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));lo("onBeforeInput",["compositionend","keypress","textInput","paste"]);lo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));lo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));lo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ol="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(" "),Nj=new Set("cancel close invalid load scroll toggle".split(" ").concat(ol));function hy(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,kE(r,t,void 0,e),e.currentTarget=null}function C1(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;hy(s,l,u),i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;hy(s,l,u),i=c}}}if(nd)throw e=kp,nd=!1,kp=null,e}function He(e,t){var n=t[Ap];n===void 0&&(n=t[Ap]=new Set);var r=e+"__bubble";n.has(r)||(N1(t,e,2,!1),n.add(r))}function Gh(e,t,n){var r=0;t&&(r|=4),N1(n,e,r,t)}var Uc="_reactListening"+Math.random().toString(36).slice(2);function zl(e){if(!e[Uc]){e[Uc]=!0,Mw.forEach(function(n){n!=="selectionchange"&&(Nj.has(n)||Gh(n,!1,e),Gh(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uc]||(t[Uc]=!0,Gh("selectionchange",!1,t))}}function N1(e,t,n,r){switch(c1(t)){case 1:var s=zE;break;case 4:s=$E;break;default:s=Vg}n=s.bind(null,t,n,e),s=void 0,!Sp||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function Jh(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=Ti(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}Qw(function(){var u=i,h=Wg(n),d=[];e:{var p=k1.get(e);if(p!==void 0){var f=Qg,m=e;switch(e){case"keypress":if(ju(n)===0)break e;case"keydown":case"keyup":f=nj;break;case"focusin":m="focus",f=qh;break;case"focusout":m="blur",f=qh;break;case"beforeblur":case"afterblur":f=qh;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=ey;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=UE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=ij;break;case _1:case b1:case w1:f=VE;break;case S1:f=aj;break;case"scroll":f=HE;break;case"wheel":f=cj;break;case"copy":case"cut":case"paste":f=QE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=ny}var g=(t&4)!==0,w=!g&&e==="scroll",v=g?p!==null?p+"Capture":null:p;g=[];for(var y=u,_;y!==null;){_=y;var b=_.stateNode;if(_.tag===5&&b!==null&&(_=b,v!==null&&(b=Al(y,v),b!=null&&g.push($l(y,b,_)))),w)break;y=y.return}0<g.length&&(p=new f(p,m,null,n,h),d.push({event:p,listeners:g}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",p&&n!==bp&&(m=n.relatedTarget||n.fromElement)&&(Ti(m)||m[hs]))break e;if((f||p)&&(p=h.window===h?h:(p=h.ownerDocument)?p.defaultView||p.parentWindow:window,f?(m=n.relatedTarget||n.toElement,f=u,m=m?Ti(m):null,m!==null&&(w=co(m),m!==w||m.tag!==5&&m.tag!==6)&&(m=null)):(f=null,m=u),f!==m)){if(g=ey,b="onMouseLeave",v="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(g=ny,b="onPointerLeave",v="onPointerEnter",y="pointer"),w=f==null?p:Ao(f),_=m==null?p:Ao(m),p=new g(b,y+"leave",f,n,h),p.target=w,p.relatedTarget=_,b=null,Ti(h)===u&&(g=new g(v,y+"enter",m,n,h),g.target=_,g.relatedTarget=w,b=g),w=b,f&&m)t:{for(g=f,v=m,y=0,_=g;_;_=xo(_))y++;for(_=0,b=v;b;b=xo(b))_++;for(;0<y-_;)g=xo(g),y--;for(;0<_-y;)v=xo(v),_--;for(;y--;){if(g===v||v!==null&&g===v.alternate)break t;g=xo(g),v=xo(v)}g=null}else g=null;f!==null&&fy(d,p,f,g,!1),m!==null&&w!==null&&fy(d,w,m,g,!0)}}e:{if(p=u?Ao(u):window,f=p.nodeName&&p.nodeName.toLowerCase(),f==="select"||f==="input"&&p.type==="file")var N=gj;else if(iy(p))if(m1)N=_j;else{N=xj;var k=vj}else(f=p.nodeName)&&f.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(N=yj);if(N&&(N=N(e,u))){p1(d,N,n,h);break e}k&&k(e,p,u),e==="focusout"&&(k=p._wrapperState)&&k.controlled&&p.type==="number"&&gp(p,"number",p.value)}switch(k=u?Ao(u):window,e){case"focusin":(iy(k)||k.contentEditable==="true")&&(Do=k,jp=u,xl=null);break;case"focusout":xl=jp=Do=null;break;case"mousedown":Rp=!0;break;case"contextmenu":case"mouseup":case"dragend":Rp=!1,uy(d,n,h);break;case"selectionchange":if(Sj)break;case"keydown":case"keyup":uy(d,n,h)}var j;if(Gg)e:{switch(e){case"compositionstart":var D="onCompositionStart";break e;case"compositionend":D="onCompositionEnd";break e;case"compositionupdate":D="onCompositionUpdate";break e}D=void 0}else To?h1(e,n)&&(D="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(D="onCompositionStart");D&&(d1&&n.locale!=="ko"&&(To||D!=="onCompositionStart"?D==="onCompositionEnd"&&To&&(j=u1()):(Qs=h,Yg="value"in Qs?Qs.value:Qs.textContent,To=!0)),k=ad(u,D),0<k.length&&(D=new ty(D,e,null,n,h),d.push({event:D,listeners:k}),j?D.data=j:(j=f1(n),j!==null&&(D.data=j)))),(j=dj?hj(e,n):fj(e,n))&&(u=ad(u,"onBeforeInput"),0<u.length&&(h=new ty("onBeforeInput","beforeinput",null,n,h),d.push({event:h,listeners:u}),h.data=j))}C1(d,t)})}function $l(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ad(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Al(e,n),i!=null&&r.unshift($l(e,i,s)),i=Al(e,t),i!=null&&r.push($l(e,i,s))),e=e.return}return r}function xo(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function fy(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,s?(c=Al(n,i),c!=null&&o.unshift($l(n,c,l))):s||(c=Al(n,i),c!=null&&o.push($l(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Ej=/\r\n?/g,jj=/\u0000|\uFFFD/g;function py(e){return(typeof e=="string"?e:""+e).replace(Ej,`
38
- `).replace(jj,"")}function qc(e,t,n){if(t=py(t),py(e)!==t&&n)throw Error(G(425))}function ld(){}var Pp=null,Tp=null;function Dp(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 Mp=typeof setTimeout=="function"?setTimeout:void 0,Rj=typeof clearTimeout=="function"?clearTimeout:void 0,my=typeof Promise=="function"?Promise:void 0,Pj=typeof queueMicrotask=="function"?queueMicrotask:typeof my<"u"?function(e){return my.resolve(null).then(e).catch(Tj)}:Mp;function Tj(e){setTimeout(function(){throw e})}function Zh(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),Il(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Il(t)}function ni(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 gy(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Ca=Math.random().toString(36).slice(2),Br="__reactFiber$"+Ca,Hl="__reactProps$"+Ca,hs="__reactContainer$"+Ca,Ap="__reactEvents$"+Ca,Dj="__reactListeners$"+Ca,Mj="__reactHandles$"+Ca;function Ti(e){var t=e[Br];if(t)return t;for(var n=e.parentNode;n;){if(t=n[hs]||n[Br]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=gy(e);e!==null;){if(n=e[Br])return n;e=gy(e)}return t}e=n,n=e.parentNode}return null}function gc(e){return e=e[Br]||e[hs],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ao(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(G(33))}function Xd(e){return e[Hl]||null}var Lp=[],Lo=-1;function yi(e){return{current:e}}function Ue(e){0>Lo||(e.current=Lp[Lo],Lp[Lo]=null,Lo--)}function ze(e,t){Lo++,Lp[Lo]=e.current,e.current=t}var pi={},Jt=yi(pi),kn=yi(!1),Yi=pi;function da(e,t){var n=e.type.contextTypes;if(!n)return pi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Cn(e){return e=e.childContextTypes,e!=null}function cd(){Ue(kn),Ue(Jt)}function vy(e,t,n){if(Jt.current!==pi)throw Error(G(168));ze(Jt,t),ze(kn,n)}function E1(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(G(108,vE(e)||"Unknown",s));return Je({},n,r)}function ud(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pi,Yi=Jt.current,ze(Jt,e),ze(kn,kn.current),!0}function xy(e,t,n){var r=e.stateNode;if(!r)throw Error(G(169));n?(e=E1(e,t,Yi),r.__reactInternalMemoizedMergedChildContext=e,Ue(kn),Ue(Jt),ze(Jt,e)):Ue(kn),ze(kn,n)}var es=null,Gd=!1,ef=!1;function j1(e){es===null?es=[e]:es.push(e)}function Aj(e){Gd=!0,j1(e)}function _i(){if(!ef&&es!==null){ef=!0;var e=0,t=Ae;try{var n=es;for(Ae=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}es=null,Gd=!1}catch(s){throw es!==null&&(es=es.slice(e+1)),Zw(Ug,_i),s}finally{Ae=t,ef=!1}}return null}var Oo=[],Io=0,dd=null,hd=0,Zn=[],er=0,Qi=null,is=1,os="";function Ci(e,t){Oo[Io++]=hd,Oo[Io++]=dd,dd=e,hd=t}function R1(e,t,n){Zn[er++]=is,Zn[er++]=os,Zn[er++]=Qi,Qi=e;var r=is;e=os;var s=32-_r(r)-1;r&=~(1<<s),n+=1;var i=32-_r(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,is=1<<32-_r(t)+s|n<<s|r,os=i+e}else is=1<<i|n<<s|r,os=e}function Zg(e){e.return!==null&&(Ci(e,1),R1(e,1,0))}function ev(e){for(;e===dd;)dd=Oo[--Io],Oo[Io]=null,hd=Oo[--Io],Oo[Io]=null;for(;e===Qi;)Qi=Zn[--er],Zn[er]=null,os=Zn[--er],Zn[er]=null,is=Zn[--er],Zn[er]=null}var Fn=null,Bn=null,Ke=!1,yr=null;function P1(e,t){var n=rr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function yy(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Fn=e,Bn=ni(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Fn=e,Bn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Qi!==null?{id:is,overflow:os}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=rr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Fn=e,Bn=null,!0):!1;default:return!1}}function Op(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ip(e){if(Ke){var t=Bn;if(t){var n=t;if(!yy(e,t)){if(Op(e))throw Error(G(418));t=ni(n.nextSibling);var r=Fn;t&&yy(e,t)?P1(r,n):(e.flags=e.flags&-4097|2,Ke=!1,Fn=e)}}else{if(Op(e))throw Error(G(418));e.flags=e.flags&-4097|2,Ke=!1,Fn=e}}}function _y(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Fn=e}function Kc(e){if(e!==Fn)return!1;if(!Ke)return _y(e),Ke=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Dp(e.type,e.memoizedProps)),t&&(t=Bn)){if(Op(e))throw T1(),Error(G(418));for(;t;)P1(e,t),t=ni(t.nextSibling)}if(_y(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(G(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Bn=ni(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Bn=null}}else Bn=Fn?ni(e.stateNode.nextSibling):null;return!0}function T1(){for(var e=Bn;e;)e=ni(e.nextSibling)}function ha(){Bn=Fn=null,Ke=!1}function tv(e){yr===null?yr=[e]:yr.push(e)}var Lj=vs.ReactCurrentBatchConfig;function Ha(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(G(309));var r=n.stateNode}if(!r)throw Error(G(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(G(284));if(!n._owner)throw Error(G(290,e))}return e}function Vc(e,t){throw e=Object.prototype.toString.call(t),Error(G(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function by(e){var t=e._init;return t(e._payload)}function D1(e){function t(v,y){if(e){var _=v.deletions;_===null?(v.deletions=[y],v.flags|=16):_.push(y)}}function n(v,y){if(!e)return null;for(;y!==null;)t(v,y),y=y.sibling;return null}function r(v,y){for(v=new Map;y!==null;)y.key!==null?v.set(y.key,y):v.set(y.index,y),y=y.sibling;return v}function s(v,y){return v=oi(v,y),v.index=0,v.sibling=null,v}function i(v,y,_){return v.index=_,e?(_=v.alternate,_!==null?(_=_.index,_<y?(v.flags|=2,y):_):(v.flags|=2,y)):(v.flags|=1048576,y)}function o(v){return e&&v.alternate===null&&(v.flags|=2),v}function l(v,y,_,b){return y===null||y.tag!==6?(y=lf(_,v.mode,b),y.return=v,y):(y=s(y,_),y.return=v,y)}function c(v,y,_,b){var N=_.type;return N===Po?h(v,y,_.props.children,b,_.key):y!==null&&(y.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Ms&&by(N)===y.type)?(b=s(y,_.props),b.ref=Ha(v,y,_),b.return=v,b):(b=Lu(_.type,_.key,_.props,null,v.mode,b),b.ref=Ha(v,y,_),b.return=v,b)}function u(v,y,_,b){return y===null||y.tag!==4||y.stateNode.containerInfo!==_.containerInfo||y.stateNode.implementation!==_.implementation?(y=cf(_,v.mode,b),y.return=v,y):(y=s(y,_.children||[]),y.return=v,y)}function h(v,y,_,b,N){return y===null||y.tag!==7?(y=Ki(_,v.mode,b,N),y.return=v,y):(y=s(y,_),y.return=v,y)}function d(v,y,_){if(typeof y=="string"&&y!==""||typeof y=="number")return y=lf(""+y,v.mode,_),y.return=v,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Oc:return _=Lu(y.type,y.key,y.props,null,v.mode,_),_.ref=Ha(v,null,y),_.return=v,_;case Ro:return y=cf(y,v.mode,_),y.return=v,y;case Ms:var b=y._init;return d(v,b(y._payload),_)}if(sl(y)||Ia(y))return y=Ki(y,v.mode,_,null),y.return=v,y;Vc(v,y)}return null}function p(v,y,_,b){var N=y!==null?y.key:null;if(typeof _=="string"&&_!==""||typeof _=="number")return N!==null?null:l(v,y,""+_,b);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Oc:return _.key===N?c(v,y,_,b):null;case Ro:return _.key===N?u(v,y,_,b):null;case Ms:return N=_._init,p(v,y,N(_._payload),b)}if(sl(_)||Ia(_))return N!==null?null:h(v,y,_,b,null);Vc(v,_)}return null}function f(v,y,_,b,N){if(typeof b=="string"&&b!==""||typeof b=="number")return v=v.get(_)||null,l(y,v,""+b,N);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Oc:return v=v.get(b.key===null?_:b.key)||null,c(y,v,b,N);case Ro:return v=v.get(b.key===null?_:b.key)||null,u(y,v,b,N);case Ms:var k=b._init;return f(v,y,_,k(b._payload),N)}if(sl(b)||Ia(b))return v=v.get(_)||null,h(y,v,b,N,null);Vc(y,b)}return null}function m(v,y,_,b){for(var N=null,k=null,j=y,D=y=0,F=null;j!==null&&D<_.length;D++){j.index>D?(F=j,j=null):F=j.sibling;var P=p(v,j,_[D],b);if(P===null){j===null&&(j=F);break}e&&j&&P.alternate===null&&t(v,j),y=i(P,y,D),k===null?N=P:k.sibling=P,k=P,j=F}if(D===_.length)return n(v,j),Ke&&Ci(v,D),N;if(j===null){for(;D<_.length;D++)j=d(v,_[D],b),j!==null&&(y=i(j,y,D),k===null?N=j:k.sibling=j,k=j);return Ke&&Ci(v,D),N}for(j=r(v,j);D<_.length;D++)F=f(j,v,D,_[D],b),F!==null&&(e&&F.alternate!==null&&j.delete(F.key===null?D:F.key),y=i(F,y,D),k===null?N=F:k.sibling=F,k=F);return e&&j.forEach(function(O){return t(v,O)}),Ke&&Ci(v,D),N}function g(v,y,_,b){var N=Ia(_);if(typeof N!="function")throw Error(G(150));if(_=N.call(_),_==null)throw Error(G(151));for(var k=N=null,j=y,D=y=0,F=null,P=_.next();j!==null&&!P.done;D++,P=_.next()){j.index>D?(F=j,j=null):F=j.sibling;var O=p(v,j,P.value,b);if(O===null){j===null&&(j=F);break}e&&j&&O.alternate===null&&t(v,j),y=i(O,y,D),k===null?N=O:k.sibling=O,k=O,j=F}if(P.done)return n(v,j),Ke&&Ci(v,D),N;if(j===null){for(;!P.done;D++,P=_.next())P=d(v,P.value,b),P!==null&&(y=i(P,y,D),k===null?N=P:k.sibling=P,k=P);return Ke&&Ci(v,D),N}for(j=r(v,j);!P.done;D++,P=_.next())P=f(j,v,D,P.value,b),P!==null&&(e&&P.alternate!==null&&j.delete(P.key===null?D:P.key),y=i(P,y,D),k===null?N=P:k.sibling=P,k=P);return e&&j.forEach(function(T){return t(v,T)}),Ke&&Ci(v,D),N}function w(v,y,_,b){if(typeof _=="object"&&_!==null&&_.type===Po&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Oc:e:{for(var N=_.key,k=y;k!==null;){if(k.key===N){if(N=_.type,N===Po){if(k.tag===7){n(v,k.sibling),y=s(k,_.props.children),y.return=v,v=y;break e}}else if(k.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Ms&&by(N)===k.type){n(v,k.sibling),y=s(k,_.props),y.ref=Ha(v,k,_),y.return=v,v=y;break e}n(v,k);break}else t(v,k);k=k.sibling}_.type===Po?(y=Ki(_.props.children,v.mode,b,_.key),y.return=v,v=y):(b=Lu(_.type,_.key,_.props,null,v.mode,b),b.ref=Ha(v,y,_),b.return=v,v=b)}return o(v);case Ro:e:{for(k=_.key;y!==null;){if(y.key===k)if(y.tag===4&&y.stateNode.containerInfo===_.containerInfo&&y.stateNode.implementation===_.implementation){n(v,y.sibling),y=s(y,_.children||[]),y.return=v,v=y;break e}else{n(v,y);break}else t(v,y);y=y.sibling}y=cf(_,v.mode,b),y.return=v,v=y}return o(v);case Ms:return k=_._init,w(v,y,k(_._payload),b)}if(sl(_))return m(v,y,_,b);if(Ia(_))return g(v,y,_,b);Vc(v,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,y!==null&&y.tag===6?(n(v,y.sibling),y=s(y,_),y.return=v,v=y):(n(v,y),y=lf(_,v.mode,b),y.return=v,v=y),o(v)):n(v,y)}return w}var fa=D1(!0),M1=D1(!1),fd=yi(null),pd=null,Bo=null,nv=null;function rv(){nv=Bo=pd=null}function sv(e){var t=fd.current;Ue(fd),e._currentValue=t}function Bp(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Vo(e,t){pd=e,nv=Bo=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(wn=!0),e.firstContext=null)}function ar(e){var t=e._currentValue;if(nv!==e)if(e={context:e,memoizedValue:t,next:null},Bo===null){if(pd===null)throw Error(G(308));Bo=e,pd.dependencies={lanes:0,firstContext:e}}else Bo=Bo.next=e;return t}var Di=null;function iv(e){Di===null?Di=[e]:Di.push(e)}function A1(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,iv(t)):(n.next=s.next,s.next=n),t.interleaved=n,fs(e,r)}function fs(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var As=!1;function ov(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function L1(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 ls(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ri(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Te&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,fs(e,n)}return s=r.interleaved,s===null?(t.next=t,iv(r)):(t.next=s.next,s.next=t),r.interleaved=t,fs(e,n)}function Ru(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qg(e,n)}}function wy(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function md(e,t,n,r){var s=e.updateQueue;As=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var h=e.alternate;h!==null&&(h=h.updateQueue,l=h.lastBaseUpdate,l!==o&&(l===null?h.firstBaseUpdate=u:l.next=u,h.lastBaseUpdate=c))}if(i!==null){var d=s.baseState;o=0,h=u=c=null,l=i;do{var p=l.lane,f=l.eventTime;if((r&p)===p){h!==null&&(h=h.next={eventTime:f,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,g=l;switch(p=t,f=n,g.tag){case 1:if(m=g.payload,typeof m=="function"){d=m.call(f,d,p);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,p=typeof m=="function"?m.call(f,d,p):m,p==null)break e;d=Je({},d,p);break e;case 2:As=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=s.effects,p===null?s.effects=[l]:p.push(l))}else f={eventTime:f,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(u=h=f,c=d):h=h.next=f,o|=p;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(h===null&&(c=d),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=h,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Gi|=o,e.lanes=o,e.memoizedState=d}}function Sy(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(G(191,s));s.call(r)}}}var vc={},Hr=yi(vc),Wl=yi(vc),Ul=yi(vc);function Mi(e){if(e===vc)throw Error(G(174));return e}function av(e,t){switch(ze(Ul,t),ze(Wl,e),ze(Hr,vc),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:xp(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=xp(t,e)}Ue(Hr),ze(Hr,t)}function pa(){Ue(Hr),Ue(Wl),Ue(Ul)}function O1(e){Mi(Ul.current);var t=Mi(Hr.current),n=xp(t,e.type);t!==n&&(ze(Wl,e),ze(Hr,n))}function lv(e){Wl.current===e&&(Ue(Hr),Ue(Wl))}var Xe=yi(0);function gd(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var tf=[];function cv(){for(var e=0;e<tf.length;e++)tf[e]._workInProgressVersionPrimary=null;tf.length=0}var Pu=vs.ReactCurrentDispatcher,nf=vs.ReactCurrentBatchConfig,Xi=0,Ge=null,_t=null,Rt=null,vd=!1,yl=!1,ql=0,Oj=0;function qt(){throw Error(G(321))}function uv(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Sr(e[n],t[n]))return!1;return!0}function dv(e,t,n,r,s,i){if(Xi=i,Ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Pu.current=e===null||e.memoizedState===null?zj:$j,e=n(r,s),yl){i=0;do{if(yl=!1,ql=0,25<=i)throw Error(G(301));i+=1,Rt=_t=null,t.updateQueue=null,Pu.current=Hj,e=n(r,s)}while(yl)}if(Pu.current=xd,t=_t!==null&&_t.next!==null,Xi=0,Rt=_t=Ge=null,vd=!1,t)throw Error(G(300));return e}function hv(){var e=ql!==0;return ql=0,e}function Dr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?Ge.memoizedState=Rt=e:Rt=Rt.next=e,Rt}function lr(){if(_t===null){var e=Ge.alternate;e=e!==null?e.memoizedState:null}else e=_t.next;var t=Rt===null?Ge.memoizedState:Rt.next;if(t!==null)Rt=t,_t=e;else{if(e===null)throw Error(G(310));_t=e,e={memoizedState:_t.memoizedState,baseState:_t.baseState,baseQueue:_t.baseQueue,queue:_t.queue,next:null},Rt===null?Ge.memoizedState=Rt=e:Rt=Rt.next=e}return Rt}function Kl(e,t){return typeof t=="function"?t(e):t}function rf(e){var t=lr(),n=t.queue;if(n===null)throw Error(G(311));n.lastRenderedReducer=e;var r=_t,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,c=null,u=i;do{var h=u.lane;if((Xi&h)===h)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var d={lane:h,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=d,o=r):c=c.next=d,Ge.lanes|=h,Gi|=h}u=u.next}while(u!==null&&u!==i);c===null?o=r:c.next=l,Sr(r,t.memoizedState)||(wn=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Ge.lanes|=i,Gi|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function sf(e){var t=lr(),n=t.queue;if(n===null)throw Error(G(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);Sr(i,t.memoizedState)||(wn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function I1(){}function B1(e,t){var n=Ge,r=lr(),s=t(),i=!Sr(r.memoizedState,s);if(i&&(r.memoizedState=s,wn=!0),r=r.queue,fv($1.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Rt!==null&&Rt.memoizedState.tag&1){if(n.flags|=2048,Vl(9,z1.bind(null,n,r,s,t),void 0,null),Lt===null)throw Error(G(349));Xi&30||F1(n,t,s)}return s}function F1(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ge.updateQueue,t===null?(t={lastEffect:null,stores:null},Ge.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function z1(e,t,n,r){t.value=n,t.getSnapshot=r,H1(t)&&W1(e)}function $1(e,t,n){return n(function(){H1(t)&&W1(e)})}function H1(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Sr(e,n)}catch{return!0}}function W1(e){var t=fs(e,1);t!==null&&br(t,e,1,-1)}function ky(e){var t=Dr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Kl,lastRenderedState:e},t.queue=e,e=e.dispatch=Fj.bind(null,Ge,e),[t.memoizedState,e]}function Vl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ge.updateQueue,t===null?(t={lastEffect:null,stores:null},Ge.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function U1(){return lr().memoizedState}function Tu(e,t,n,r){var s=Dr();Ge.flags|=e,s.memoizedState=Vl(1|t,n,void 0,r===void 0?null:r)}function Jd(e,t,n,r){var s=lr();r=r===void 0?null:r;var i=void 0;if(_t!==null){var o=_t.memoizedState;if(i=o.destroy,r!==null&&uv(r,o.deps)){s.memoizedState=Vl(t,n,i,r);return}}Ge.flags|=e,s.memoizedState=Vl(1|t,n,i,r)}function Cy(e,t){return Tu(8390656,8,e,t)}function fv(e,t){return Jd(2048,8,e,t)}function q1(e,t){return Jd(4,2,e,t)}function K1(e,t){return Jd(4,4,e,t)}function V1(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 Y1(e,t,n){return n=n!=null?n.concat([e]):null,Jd(4,4,V1.bind(null,t,e),n)}function pv(){}function Q1(e,t){var n=lr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&uv(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function X1(e,t){var n=lr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&uv(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function G1(e,t,n){return Xi&21?(Sr(n,t)||(n=n1(),Ge.lanes|=n,Gi|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,wn=!0),e.memoizedState=n)}function Ij(e,t){var n=Ae;Ae=n!==0&&4>n?n:4,e(!0);var r=nf.transition;nf.transition={};try{e(!1),t()}finally{Ae=n,nf.transition=r}}function J1(){return lr().memoizedState}function Bj(e,t,n){var r=ii(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Z1(e))eS(t,n);else if(n=A1(e,t,n,r),n!==null){var s=ln();br(n,e,r,s),tS(n,t,r)}}function Fj(e,t,n){var r=ii(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Z1(e))eS(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,Sr(l,o)){var c=t.interleaved;c===null?(s.next=s,iv(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=A1(e,t,s,r),n!==null&&(s=ln(),br(n,e,r,s),tS(n,t,r))}}function Z1(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function eS(e,t){yl=vd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function tS(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qg(e,n)}}var xd={readContext:ar,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useInsertionEffect:qt,useLayoutEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useMutableSource:qt,useSyncExternalStore:qt,useId:qt,unstable_isNewReconciler:!1},zj={readContext:ar,useCallback:function(e,t){return Dr().memoizedState=[e,t===void 0?null:t],e},useContext:ar,useEffect:Cy,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Tu(4194308,4,V1.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Tu(4194308,4,e,t)},useInsertionEffect:function(e,t){return Tu(4,2,e,t)},useMemo:function(e,t){var n=Dr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Dr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Bj.bind(null,Ge,e),[r.memoizedState,e]},useRef:function(e){var t=Dr();return e={current:e},t.memoizedState=e},useState:ky,useDebugValue:pv,useDeferredValue:function(e){return Dr().memoizedState=e},useTransition:function(){var e=ky(!1),t=e[0];return e=Ij.bind(null,e[1]),Dr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ge,s=Dr();if(Ke){if(n===void 0)throw Error(G(407));n=n()}else{if(n=t(),Lt===null)throw Error(G(349));Xi&30||F1(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Cy($1.bind(null,r,i,e),[e]),r.flags|=2048,Vl(9,z1.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Dr(),t=Lt.identifierPrefix;if(Ke){var n=os,r=is;n=(r&~(1<<32-_r(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ql++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Oj++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},$j={readContext:ar,useCallback:Q1,useContext:ar,useEffect:fv,useImperativeHandle:Y1,useInsertionEffect:q1,useLayoutEffect:K1,useMemo:X1,useReducer:rf,useRef:U1,useState:function(){return rf(Kl)},useDebugValue:pv,useDeferredValue:function(e){var t=lr();return G1(t,_t.memoizedState,e)},useTransition:function(){var e=rf(Kl)[0],t=lr().memoizedState;return[e,t]},useMutableSource:I1,useSyncExternalStore:B1,useId:J1,unstable_isNewReconciler:!1},Hj={readContext:ar,useCallback:Q1,useContext:ar,useEffect:fv,useImperativeHandle:Y1,useInsertionEffect:q1,useLayoutEffect:K1,useMemo:X1,useReducer:sf,useRef:U1,useState:function(){return sf(Kl)},useDebugValue:pv,useDeferredValue:function(e){var t=lr();return _t===null?t.memoizedState=e:G1(t,_t.memoizedState,e)},useTransition:function(){var e=sf(Kl)[0],t=lr().memoizedState;return[e,t]},useMutableSource:I1,useSyncExternalStore:B1,useId:J1,unstable_isNewReconciler:!1};function pr(e,t){if(e&&e.defaultProps){t=Je({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Fp(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Je({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Zd={isMounted:function(e){return(e=e._reactInternals)?co(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ln(),s=ii(e),i=ls(r,s);i.payload=t,n!=null&&(i.callback=n),t=ri(e,i,s),t!==null&&(br(t,e,s,r),Ru(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ln(),s=ii(e),i=ls(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ri(e,i,s),t!==null&&(br(t,e,s,r),Ru(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ln(),r=ii(e),s=ls(n,r);s.tag=2,t!=null&&(s.callback=t),t=ri(e,s,r),t!==null&&(br(t,e,r,n),Ru(t,e,r))}};function Ny(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!Fl(n,r)||!Fl(s,i):!0}function nS(e,t,n){var r=!1,s=pi,i=t.contextType;return typeof i=="object"&&i!==null?i=ar(i):(s=Cn(t)?Yi:Jt.current,r=t.contextTypes,i=(r=r!=null)?da(e,s):pi),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Zd,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function Ey(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Zd.enqueueReplaceState(t,t.state,null)}function zp(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},ov(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=ar(i):(i=Cn(t)?Yi:Jt.current,s.context=da(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Fp(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Zd.enqueueReplaceState(s,s.state,null),md(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function ma(e,t){try{var n="",r=t;do n+=gE(r),r=r.return;while(r);var s=n}catch(i){s=`
39
- Error generating stack: `+i.message+`
40
- `+i.stack}return{value:e,source:t,stack:s,digest:null}}function of(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function $p(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Wj=typeof WeakMap=="function"?WeakMap:Map;function rS(e,t,n){n=ls(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){_d||(_d=!0,Gp=r),$p(e,t)},n}function sS(e,t,n){n=ls(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){$p(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){$p(e,t),typeof r!="function"&&(si===null?si=new Set([this]):si.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function jy(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Wj;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=r4.bind(null,e,t,n),t.then(e,e))}function Ry(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 Py(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=ls(-1,1),t.tag=2,ri(n,t,1))),n.lanes|=1),e)}var Uj=vs.ReactCurrentOwner,wn=!1;function sn(e,t,n,r){t.child=e===null?M1(t,null,n,r):fa(t,e.child,n,r)}function Ty(e,t,n,r,s){n=n.render;var i=t.ref;return Vo(t,s),r=dv(e,t,n,r,i,s),n=hv(),e!==null&&!wn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ps(e,t,s)):(Ke&&n&&Zg(t),t.flags|=1,sn(e,t,r,s),t.child)}function Dy(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!wv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,iS(e,t,i,r,s)):(e=Lu(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Fl,n(o,r)&&e.ref===t.ref)return ps(e,t,s)}return t.flags|=1,e=oi(i,r),e.ref=t.ref,e.return=t,t.child=e}function iS(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(Fl(i,r)&&e.ref===t.ref)if(wn=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(wn=!0);else return t.lanes=e.lanes,ps(e,t,s)}return Hp(e,t,n,r,s)}function oS(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ze(zo,In),In|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ze(zo,In),In|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,ze(zo,In),In|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,ze(zo,In),In|=r;return sn(e,t,s,n),t.child}function aS(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Hp(e,t,n,r,s){var i=Cn(n)?Yi:Jt.current;return i=da(t,i),Vo(t,s),n=dv(e,t,n,r,i,s),r=hv(),e!==null&&!wn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ps(e,t,s)):(Ke&&r&&Zg(t),t.flags|=1,sn(e,t,n,s),t.child)}function My(e,t,n,r,s){if(Cn(n)){var i=!0;ud(t)}else i=!1;if(Vo(t,s),t.stateNode===null)Du(e,t),nS(t,n,r),zp(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=ar(u):(u=Cn(n)?Yi:Jt.current,u=da(t,u));var h=n.getDerivedStateFromProps,d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==u)&&Ey(t,o,r,u),As=!1;var p=t.memoizedState;o.state=p,md(t,r,o,s),c=t.memoizedState,l!==r||p!==c||kn.current||As?(typeof h=="function"&&(Fp(t,n,h,r),c=t.memoizedState),(l=As||Ny(t,n,l,r,p,c,u))?(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=r,t.memoizedState=c),o.props=r,o.state=c,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,L1(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:pr(t.type,l),o.props=u,d=t.pendingProps,p=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=ar(c):(c=Cn(n)?Yi:Jt.current,c=da(t,c));var f=n.getDerivedStateFromProps;(h=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==d||p!==c)&&Ey(t,o,r,c),As=!1,p=t.memoizedState,o.state=p,md(t,r,o,s);var m=t.memoizedState;l!==d||p!==m||kn.current||As?(typeof f=="function"&&(Fp(t,n,f,r),m=t.memoizedState),(u=As||Ny(t,n,u,r,p,m,c)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return Wp(e,t,n,r,i,s)}function Wp(e,t,n,r,s,i){aS(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&xy(t,n,!1),ps(e,t,i);r=t.stateNode,Uj.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=fa(t,e.child,null,i),t.child=fa(t,null,l,i)):sn(e,t,l,i),t.memoizedState=r.state,s&&xy(t,n,!0),t.child}function lS(e){var t=e.stateNode;t.pendingContext?vy(e,t.pendingContext,t.pendingContext!==t.context):t.context&&vy(e,t.context,!1),av(e,t.containerInfo)}function Ay(e,t,n,r,s){return ha(),tv(s),t.flags|=256,sn(e,t,n,r),t.child}var Up={dehydrated:null,treeContext:null,retryLane:0};function qp(e){return{baseLanes:e,cachePool:null,transitions:null}}function cS(e,t,n){var r=t.pendingProps,s=Xe.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),ze(Xe,s&1),e===null)return Ip(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=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=nh(o,r,0,null),e=Ki(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=qp(n),t.memoizedState=Up,e):mv(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return qj(e,t,o,r,l,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=oi(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=oi(l,i):(i=Ki(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?qp(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=Up,r}return i=e.child,e=i.sibling,r=oi(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function mv(e,t){return t=nh({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Yc(e,t,n,r){return r!==null&&tv(r),fa(t,e.child,null,n),e=mv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qj(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=of(Error(G(422))),Yc(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=nh({mode:"visible",children:r.children},s,0,null),i=Ki(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&fa(t,e.child,null,o),t.child.memoizedState=qp(o),t.memoizedState=Up,i);if(!(t.mode&1))return Yc(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(G(419)),r=of(i,r,void 0),Yc(e,t,o,r)}if(l=(o&e.childLanes)!==0,wn||l){if(r=Lt,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,fs(e,s),br(r,e,s,-1))}return bv(),r=of(Error(G(421))),Yc(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=s4.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Bn=ni(s.nextSibling),Fn=t,Ke=!0,yr=null,e!==null&&(Zn[er++]=is,Zn[er++]=os,Zn[er++]=Qi,is=e.id,os=e.overflow,Qi=t),t=mv(t,r.children),t.flags|=4096,t)}function Ly(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Bp(e.return,t,n)}function af(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function uS(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(sn(e,t,r.children,n),r=Xe.current,r&2)r=r&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&&Ly(e,n,t);else if(e.tag===19)Ly(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ze(Xe,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&gd(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),af(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&gd(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}af(t,!0,n,null,i);break;case"together":af(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Du(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ps(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Gi|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(G(153));if(t.child!==null){for(e=t.child,n=oi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=oi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Kj(e,t,n){switch(t.tag){case 3:lS(t),ha();break;case 5:O1(t);break;case 1:Cn(t.type)&&ud(t);break;case 4:av(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;ze(fd,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ze(Xe,Xe.current&1),t.flags|=128,null):n&t.child.childLanes?cS(e,t,n):(ze(Xe,Xe.current&1),e=ps(e,t,n),e!==null?e.sibling:null);ze(Xe,Xe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return uS(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ze(Xe,Xe.current),r)break;return null;case 22:case 23:return t.lanes=0,oS(e,t,n)}return ps(e,t,n)}var dS,Kp,hS,fS;dS=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Kp=function(){};hS=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Mi(Hr.current);var i=null;switch(n){case"input":s=pp(e,s),r=pp(e,r),i=[];break;case"select":s=Je({},s,{value:void 0}),r=Je({},r,{value:void 0}),i=[];break;case"textarea":s=vp(e,s),r=vp(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ld)}yp(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Dl.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Dl.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&He("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};fS=function(e,t,n,r){n!==r&&(t.flags|=4)};function Wa(e,t){if(!Ke)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Kt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Vj(e,t,n){var r=t.pendingProps;switch(ev(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(t),null;case 1:return Cn(t.type)&&cd(),Kt(t),null;case 3:return r=t.stateNode,pa(),Ue(kn),Ue(Jt),cv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Kc(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,yr!==null&&(em(yr),yr=null))),Kp(e,t),Kt(t),null;case 5:lv(t);var s=Mi(Ul.current);if(n=t.type,e!==null&&t.stateNode!=null)hS(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(G(166));return Kt(t),null}if(e=Mi(Hr.current),Kc(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Br]=t,r[Hl]=i,e=(t.mode&1)!==0,n){case"dialog":He("cancel",r),He("close",r);break;case"iframe":case"object":case"embed":He("load",r);break;case"video":case"audio":for(s=0;s<ol.length;s++)He(ol[s],r);break;case"source":He("error",r);break;case"img":case"image":case"link":He("error",r),He("load",r);break;case"details":He("toggle",r);break;case"input":Ux(r,i),He("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},He("invalid",r);break;case"textarea":Kx(r,i),He("invalid",r)}yp(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&qc(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&qc(r.textContent,l,e),s=["children",""+l]):Dl.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&He("scroll",r)}switch(n){case"input":Ic(r),qx(r,i,!0);break;case"textarea":Ic(r),Vx(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=ld)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=$w(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Br]=t,e[Hl]=r,dS(e,t,!1,!1),t.stateNode=e;e:{switch(o=_p(n,r),n){case"dialog":He("cancel",e),He("close",e),s=r;break;case"iframe":case"object":case"embed":He("load",e),s=r;break;case"video":case"audio":for(s=0;s<ol.length;s++)He(ol[s],e);s=r;break;case"source":He("error",e),s=r;break;case"img":case"image":case"link":He("error",e),He("load",e),s=r;break;case"details":He("toggle",e),s=r;break;case"input":Ux(e,r),s=pp(e,r),He("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Je({},r,{value:void 0}),He("invalid",e);break;case"textarea":Kx(e,r),s=vp(e,r),He("invalid",e);break;default:s=r}yp(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?Uw(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Hw(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Ml(e,c):typeof c=="number"&&Ml(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Dl.hasOwnProperty(i)?c!=null&&i==="onScroll"&&He("scroll",e):c!=null&&Fg(e,i,c,o))}switch(n){case"input":Ic(e),qx(e,r,!1);break;case"textarea":Ic(e),Vx(e);break;case"option":r.value!=null&&e.setAttribute("value",""+fi(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Wo(e,!!r.multiple,i,!1):r.defaultValue!=null&&Wo(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=ld)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Kt(t),null;case 6:if(e&&t.stateNode!=null)fS(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(G(166));if(n=Mi(Ul.current),Mi(Hr.current),Kc(t)){if(r=t.stateNode,n=t.memoizedProps,r[Br]=t,(i=r.nodeValue!==n)&&(e=Fn,e!==null))switch(e.tag){case 3:qc(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&qc(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Br]=t,t.stateNode=r}return Kt(t),null;case 13:if(Ue(Xe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ke&&Bn!==null&&t.mode&1&&!(t.flags&128))T1(),ha(),t.flags|=98560,i=!1;else if(i=Kc(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(G(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(G(317));i[Br]=t}else ha(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Kt(t),i=!1}else yr!==null&&(em(yr),yr=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Xe.current&1?St===0&&(St=3):bv())),t.updateQueue!==null&&(t.flags|=4),Kt(t),null);case 4:return pa(),Kp(e,t),e===null&&zl(t.stateNode.containerInfo),Kt(t),null;case 10:return sv(t.type._context),Kt(t),null;case 17:return Cn(t.type)&&cd(),Kt(t),null;case 19:if(Ue(Xe),i=t.memoizedState,i===null)return Kt(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)Wa(i,!1);else{if(St!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=gd(e),o!==null){for(t.flags|=128,Wa(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ze(Xe,Xe.current&1|2),t.child}e=e.sibling}i.tail!==null&&ct()>ga&&(t.flags|=128,r=!0,Wa(i,!1),t.lanes=4194304)}else{if(!r)if(e=gd(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Wa(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Ke)return Kt(t),null}else 2*ct()-i.renderingStartTime>ga&&n!==1073741824&&(t.flags|=128,r=!0,Wa(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ct(),t.sibling=null,n=Xe.current,ze(Xe,r?n&1|2:n&1),t):(Kt(t),null);case 22:case 23:return _v(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?In&1073741824&&(Kt(t),t.subtreeFlags&6&&(t.flags|=8192)):Kt(t),null;case 24:return null;case 25:return null}throw Error(G(156,t.tag))}function Yj(e,t){switch(ev(t),t.tag){case 1:return Cn(t.type)&&cd(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return pa(),Ue(kn),Ue(Jt),cv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return lv(t),null;case 13:if(Ue(Xe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(G(340));ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(Xe),null;case 4:return pa(),null;case 10:return sv(t.type._context),null;case 22:case 23:return _v(),null;case 24:return null;default:return null}}var Qc=!1,Xt=!1,Qj=typeof WeakSet=="function"?WeakSet:Set,le=null;function Fo(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){st(e,t,r)}else n.current=null}function Vp(e,t,n){try{n()}catch(r){st(e,t,r)}}var Oy=!1;function Xj(e,t){if(Pp=id,e=x1(),Jg(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,h=0,d=e,p=null;t:for(;;){for(var f;d!==n||s!==0&&d.nodeType!==3||(l=o+s),d!==i||r!==0&&d.nodeType!==3||(c=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(f=d.firstChild)!==null;)p=d,d=f;for(;;){if(d===e)break t;if(p===n&&++u===s&&(l=o),p===i&&++h===r&&(c=o),(f=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=f}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Tp={focusedElem:e,selectionRange:n},id=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,w=m.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:pr(t.type,g),w);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var _=t.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(G(163))}}catch(b){st(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return m=Oy,Oy=!1,m}function _l(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Vp(t,n,i)}s=s.next}while(s!==r)}}function eh(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Yp(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function pS(e){var t=e.alternate;t!==null&&(e.alternate=null,pS(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Br],delete t[Hl],delete t[Ap],delete t[Dj],delete t[Mj])),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 mS(e){return e.tag===5||e.tag===3||e.tag===4}function Iy(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mS(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 Qp(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ld));else if(r!==4&&(e=e.child,e!==null))for(Qp(e,t,n),e=e.sibling;e!==null;)Qp(e,t,n),e=e.sibling}function Xp(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Xp(e,t,n),e=e.sibling;e!==null;)Xp(e,t,n),e=e.sibling}var Ft=null,vr=!1;function ks(e,t,n){for(n=n.child;n!==null;)gS(e,t,n),n=n.sibling}function gS(e,t,n){if($r&&typeof $r.onCommitFiberUnmount=="function")try{$r.onCommitFiberUnmount(Kd,n)}catch{}switch(n.tag){case 5:Xt||Fo(n,t);case 6:var r=Ft,s=vr;Ft=null,ks(e,t,n),Ft=r,vr=s,Ft!==null&&(vr?(e=Ft,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ft.removeChild(n.stateNode));break;case 18:Ft!==null&&(vr?(e=Ft,n=n.stateNode,e.nodeType===8?Zh(e.parentNode,n):e.nodeType===1&&Zh(e,n),Il(e)):Zh(Ft,n.stateNode));break;case 4:r=Ft,s=vr,Ft=n.stateNode.containerInfo,vr=!0,ks(e,t,n),Ft=r,vr=s;break;case 0:case 11:case 14:case 15:if(!Xt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Vp(n,t,o),s=s.next}while(s!==r)}ks(e,t,n);break;case 1:if(!Xt&&(Fo(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){st(n,t,l)}ks(e,t,n);break;case 21:ks(e,t,n);break;case 22:n.mode&1?(Xt=(r=Xt)||n.memoizedState!==null,ks(e,t,n),Xt=r):ks(e,t,n);break;default:ks(e,t,n)}}function By(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Qj),t.forEach(function(r){var s=i4.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function dr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Ft=l.stateNode,vr=!1;break e;case 3:Ft=l.stateNode.containerInfo,vr=!0;break e;case 4:Ft=l.stateNode.containerInfo,vr=!0;break e}l=l.return}if(Ft===null)throw Error(G(160));gS(i,o,s),Ft=null,vr=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){st(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)vS(t,e),t=t.sibling}function vS(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(dr(t,e),jr(e),r&4){try{_l(3,e,e.return),eh(3,e)}catch(g){st(e,e.return,g)}try{_l(5,e,e.return)}catch(g){st(e,e.return,g)}}break;case 1:dr(t,e),jr(e),r&512&&n!==null&&Fo(n,n.return);break;case 5:if(dr(t,e),jr(e),r&512&&n!==null&&Fo(n,n.return),e.flags&32){var s=e.stateNode;try{Ml(s,"")}catch(g){st(e,e.return,g)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&Fw(s,i),_p(l,o);var u=_p(l,i);for(o=0;o<c.length;o+=2){var h=c[o],d=c[o+1];h==="style"?Uw(s,d):h==="dangerouslySetInnerHTML"?Hw(s,d):h==="children"?Ml(s,d):Fg(s,h,d,u)}switch(l){case"input":mp(s,i);break;case"textarea":zw(s,i);break;case"select":var p=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var f=i.value;f!=null?Wo(s,!!i.multiple,f,!1):p!==!!i.multiple&&(i.defaultValue!=null?Wo(s,!!i.multiple,i.defaultValue,!0):Wo(s,!!i.multiple,i.multiple?[]:"",!1))}s[Hl]=i}catch(g){st(e,e.return,g)}}break;case 6:if(dr(t,e),jr(e),r&4){if(e.stateNode===null)throw Error(G(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(g){st(e,e.return,g)}}break;case 3:if(dr(t,e),jr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Il(t.containerInfo)}catch(g){st(e,e.return,g)}break;case 4:dr(t,e),jr(e);break;case 13:dr(t,e),jr(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(xv=ct())),r&4&&By(e);break;case 22:if(h=n!==null&&n.memoizedState!==null,e.mode&1?(Xt=(u=Xt)||h,dr(t,e),Xt=u):dr(t,e),jr(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!h&&e.mode&1)for(le=e,h=e.child;h!==null;){for(d=le=h;le!==null;){switch(p=le,f=p.child,p.tag){case 0:case 11:case 14:case 15:_l(4,p,p.return);break;case 1:Fo(p,p.return);var m=p.stateNode;if(typeof m.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(g){st(r,n,g)}}break;case 5:Fo(p,p.return);break;case 22:if(p.memoizedState!==null){zy(d);continue}}f!==null?(f.return=p,le=f):zy(d)}h=h.sibling}e:for(h=null,d=e;;){if(d.tag===5){if(h===null){h=d;try{s=d.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=d.stateNode,c=d.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Ww("display",o))}catch(g){st(e,e.return,g)}}}else if(d.tag===6){if(h===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(g){st(e,e.return,g)}}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:dr(t,e),jr(e),r&4&&By(e);break;case 21:break;default:dr(t,e),jr(e)}}function jr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(mS(n)){var r=n;break e}n=n.return}throw Error(G(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Ml(s,""),r.flags&=-33);var i=Iy(e);Xp(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=Iy(e);Qp(e,l,o);break;default:throw Error(G(161))}}catch(c){st(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Gj(e,t,n){le=e,xS(e)}function xS(e,t,n){for(var r=(e.mode&1)!==0;le!==null;){var s=le,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Qc;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Xt;l=Qc;var u=Xt;if(Qc=o,(Xt=c)&&!u)for(le=s;le!==null;)o=le,c=o.child,o.tag===22&&o.memoizedState!==null?$y(s):c!==null?(c.return=o,le=c):$y(s);for(;i!==null;)le=i,xS(i),i=i.sibling;le=s,Qc=l,Xt=u}Fy(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,le=i):Fy(e)}}function Fy(e){for(;le!==null;){var t=le;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Xt||eh(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Xt)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:pr(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Sy(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Sy(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var h=u.memoizedState;if(h!==null){var d=h.dehydrated;d!==null&&Il(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(G(163))}Xt||t.flags&512&&Yp(t)}catch(p){st(t,t.return,p)}}if(t===e){le=null;break}if(n=t.sibling,n!==null){n.return=t.return,le=n;break}le=t.return}}function zy(e){for(;le!==null;){var t=le;if(t===e){le=null;break}var n=t.sibling;if(n!==null){n.return=t.return,le=n;break}le=t.return}}function $y(e){for(;le!==null;){var t=le;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{eh(4,t)}catch(c){st(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){st(t,s,c)}}var i=t.return;try{Yp(t)}catch(c){st(t,i,c)}break;case 5:var o=t.return;try{Yp(t)}catch(c){st(t,o,c)}}}catch(c){st(t,t.return,c)}if(t===e){le=null;break}var l=t.sibling;if(l!==null){l.return=t.return,le=l;break}le=t.return}}var Jj=Math.ceil,yd=vs.ReactCurrentDispatcher,gv=vs.ReactCurrentOwner,ir=vs.ReactCurrentBatchConfig,Te=0,Lt=null,pt=null,Ht=0,In=0,zo=yi(0),St=0,Yl=null,Gi=0,th=0,vv=0,bl=null,bn=null,xv=0,ga=1/0,Zr=null,_d=!1,Gp=null,si=null,Xc=!1,Xs=null,bd=0,wl=0,Jp=null,Mu=-1,Au=0;function ln(){return Te&6?ct():Mu!==-1?Mu:Mu=ct()}function ii(e){return e.mode&1?Te&2&&Ht!==0?Ht&-Ht:Lj.transition!==null?(Au===0&&(Au=n1()),Au):(e=Ae,e!==0||(e=window.event,e=e===void 0?16:c1(e.type)),e):1}function br(e,t,n,r){if(50<wl)throw wl=0,Jp=null,Error(G(185));pc(e,n,r),(!(Te&2)||e!==Lt)&&(e===Lt&&(!(Te&2)&&(th|=n),St===4&&Bs(e,Ht)),Nn(e,r),n===1&&Te===0&&!(t.mode&1)&&(ga=ct()+500,Gd&&_i()))}function Nn(e,t){var n=e.callbackNode;LE(e,t);var r=sd(e,e===Lt?Ht:0);if(r===0)n!==null&&Xx(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Xx(n),t===1)e.tag===0?Aj(Hy.bind(null,e)):j1(Hy.bind(null,e)),Pj(function(){!(Te&6)&&_i()}),n=null;else{switch(r1(r)){case 1:n=Ug;break;case 4:n=e1;break;case 16:n=rd;break;case 536870912:n=t1;break;default:n=rd}n=NS(n,yS.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function yS(e,t){if(Mu=-1,Au=0,Te&6)throw Error(G(327));var n=e.callbackNode;if(Yo()&&e.callbackNode!==n)return null;var r=sd(e,e===Lt?Ht:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=wd(e,r);else{t=r;var s=Te;Te|=2;var i=bS();(Lt!==e||Ht!==t)&&(Zr=null,ga=ct()+500,qi(e,t));do try{t4();break}catch(l){_S(e,l)}while(!0);rv(),yd.current=i,Te=s,pt!==null?t=0:(Lt=null,Ht=0,t=St)}if(t!==0){if(t===2&&(s=Cp(e),s!==0&&(r=s,t=Zp(e,s))),t===1)throw n=Yl,qi(e,0),Bs(e,r),Nn(e,ct()),n;if(t===6)Bs(e,r);else{if(s=e.current.alternate,!(r&30)&&!Zj(s)&&(t=wd(e,r),t===2&&(i=Cp(e),i!==0&&(r=i,t=Zp(e,i))),t===1))throw n=Yl,qi(e,0),Bs(e,r),Nn(e,ct()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(G(345));case 2:Ni(e,bn,Zr);break;case 3:if(Bs(e,r),(r&130023424)===r&&(t=xv+500-ct(),10<t)){if(sd(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){ln(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Mp(Ni.bind(null,e,bn,Zr),t);break}Ni(e,bn,Zr);break;case 4:if(Bs(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-_r(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=ct()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Jj(r/1960))-r,10<r){e.timeoutHandle=Mp(Ni.bind(null,e,bn,Zr),r);break}Ni(e,bn,Zr);break;case 5:Ni(e,bn,Zr);break;default:throw Error(G(329))}}}return Nn(e,ct()),e.callbackNode===n?yS.bind(null,e):null}function Zp(e,t){var n=bl;return e.current.memoizedState.isDehydrated&&(qi(e,t).flags|=256),e=wd(e,t),e!==2&&(t=bn,bn=n,t!==null&&em(t)),e}function em(e){bn===null?bn=e:bn.push.apply(bn,e)}function Zj(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!Sr(i(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Bs(e,t){for(t&=~vv,t&=~th,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-_r(t),r=1<<n;e[n]=-1,t&=~r}}function Hy(e){if(Te&6)throw Error(G(327));Yo();var t=sd(e,0);if(!(t&1))return Nn(e,ct()),null;var n=wd(e,t);if(e.tag!==0&&n===2){var r=Cp(e);r!==0&&(t=r,n=Zp(e,r))}if(n===1)throw n=Yl,qi(e,0),Bs(e,t),Nn(e,ct()),n;if(n===6)throw Error(G(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ni(e,bn,Zr),Nn(e,ct()),null}function yv(e,t){var n=Te;Te|=1;try{return e(t)}finally{Te=n,Te===0&&(ga=ct()+500,Gd&&_i())}}function Ji(e){Xs!==null&&Xs.tag===0&&!(Te&6)&&Yo();var t=Te;Te|=1;var n=ir.transition,r=Ae;try{if(ir.transition=null,Ae=1,e)return e()}finally{Ae=r,ir.transition=n,Te=t,!(Te&6)&&_i()}}function _v(){In=zo.current,Ue(zo)}function qi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Rj(n)),pt!==null)for(n=pt.return;n!==null;){var r=n;switch(ev(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&cd();break;case 3:pa(),Ue(kn),Ue(Jt),cv();break;case 5:lv(r);break;case 4:pa();break;case 13:Ue(Xe);break;case 19:Ue(Xe);break;case 10:sv(r.type._context);break;case 22:case 23:_v()}n=n.return}if(Lt=e,pt=e=oi(e.current,null),Ht=In=t,St=0,Yl=null,vv=th=Gi=0,bn=bl=null,Di!==null){for(t=0;t<Di.length;t++)if(n=Di[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Di=null}return e}function _S(e,t){do{var n=pt;try{if(rv(),Pu.current=xd,vd){for(var r=Ge.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}vd=!1}if(Xi=0,Rt=_t=Ge=null,yl=!1,ql=0,gv.current=null,n===null||n.return===null){St=1,Yl=t,pt=null;break}e:{var i=e,o=n.return,l=n,c=t;if(t=Ht,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,h=l,d=h.tag;if(!(h.mode&1)&&(d===0||d===11||d===15)){var p=h.alternate;p?(h.updateQueue=p.updateQueue,h.memoizedState=p.memoizedState,h.lanes=p.lanes):(h.updateQueue=null,h.memoizedState=null)}var f=Ry(o);if(f!==null){f.flags&=-257,Py(f,o,l,i,t),f.mode&1&&jy(i,u,t),t=f,c=u;var m=t.updateQueue;if(m===null){var g=new Set;g.add(c),t.updateQueue=g}else m.add(c);break e}else{if(!(t&1)){jy(i,u,t),bv();break e}c=Error(G(426))}}else if(Ke&&l.mode&1){var w=Ry(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),Py(w,o,l,i,t),tv(ma(c,l));break e}}i=c=ma(c,l),St!==4&&(St=2),bl===null?bl=[i]:bl.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var v=rS(i,c,t);wy(i,v);break e;case 1:l=c;var y=i.type,_=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(si===null||!si.has(_)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=sS(i,l,t);wy(i,b);break e}}i=i.return}while(i!==null)}SS(n)}catch(N){t=N,pt===n&&n!==null&&(pt=n=n.return);continue}break}while(!0)}function bS(){var e=yd.current;return yd.current=xd,e===null?xd:e}function bv(){(St===0||St===3||St===2)&&(St=4),Lt===null||!(Gi&268435455)&&!(th&268435455)||Bs(Lt,Ht)}function wd(e,t){var n=Te;Te|=2;var r=bS();(Lt!==e||Ht!==t)&&(Zr=null,qi(e,t));do try{e4();break}catch(s){_S(e,s)}while(!0);if(rv(),Te=n,yd.current=r,pt!==null)throw Error(G(261));return Lt=null,Ht=0,St}function e4(){for(;pt!==null;)wS(pt)}function t4(){for(;pt!==null&&!NE();)wS(pt)}function wS(e){var t=CS(e.alternate,e,In);e.memoizedProps=e.pendingProps,t===null?SS(e):pt=t,gv.current=null}function SS(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Yj(n,t),n!==null){n.flags&=32767,pt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{St=6,pt=null;return}}else if(n=Vj(n,t,In),n!==null){pt=n;return}if(t=t.sibling,t!==null){pt=t;return}pt=t=e}while(t!==null);St===0&&(St=5)}function Ni(e,t,n){var r=Ae,s=ir.transition;try{ir.transition=null,Ae=1,n4(e,t,n,r)}finally{ir.transition=s,Ae=r}return null}function n4(e,t,n,r){do Yo();while(Xs!==null);if(Te&6)throw Error(G(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(G(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(OE(e,i),e===Lt&&(pt=Lt=null,Ht=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Xc||(Xc=!0,NS(rd,function(){return Yo(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=ir.transition,ir.transition=null;var o=Ae;Ae=1;var l=Te;Te|=4,gv.current=null,Xj(e,n),vS(n,e),wj(Tp),id=!!Pp,Tp=Pp=null,e.current=n,Gj(n),EE(),Te=l,Ae=o,ir.transition=i}else e.current=n;if(Xc&&(Xc=!1,Xs=e,bd=s),i=e.pendingLanes,i===0&&(si=null),PE(n.stateNode),Nn(e,ct()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(_d)throw _d=!1,e=Gp,Gp=null,e;return bd&1&&e.tag!==0&&Yo(),i=e.pendingLanes,i&1?e===Jp?wl++:(wl=0,Jp=e):wl=0,_i(),null}function Yo(){if(Xs!==null){var e=r1(bd),t=ir.transition,n=Ae;try{if(ir.transition=null,Ae=16>e?16:e,Xs===null)var r=!1;else{if(e=Xs,Xs=null,bd=0,Te&6)throw Error(G(331));var s=Te;for(Te|=4,le=e.current;le!==null;){var i=le,o=i.child;if(le.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(le=u;le!==null;){var h=le;switch(h.tag){case 0:case 11:case 15:_l(8,h,i)}var d=h.child;if(d!==null)d.return=h,le=d;else for(;le!==null;){h=le;var p=h.sibling,f=h.return;if(pS(h),h===u){le=null;break}if(p!==null){p.return=f,le=p;break}le=f}}}var m=i.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var w=g.sibling;g.sibling=null,g=w}while(g!==null)}}le=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,le=o;else e:for(;le!==null;){if(i=le,i.flags&2048)switch(i.tag){case 0:case 11:case 15:_l(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,le=v;break e}le=i.return}}var y=e.current;for(le=y;le!==null;){o=le;var _=o.child;if(o.subtreeFlags&2064&&_!==null)_.return=o,le=_;else e:for(o=y;le!==null;){if(l=le,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:eh(9,l)}}catch(N){st(l,l.return,N)}if(l===o){le=null;break e}var b=l.sibling;if(b!==null){b.return=l.return,le=b;break e}le=l.return}}if(Te=s,_i(),$r&&typeof $r.onPostCommitFiberRoot=="function")try{$r.onPostCommitFiberRoot(Kd,e)}catch{}r=!0}return r}finally{Ae=n,ir.transition=t}}return!1}function Wy(e,t,n){t=ma(n,t),t=rS(e,t,1),e=ri(e,t,1),t=ln(),e!==null&&(pc(e,1,t),Nn(e,t))}function st(e,t,n){if(e.tag===3)Wy(e,e,n);else for(;t!==null;){if(t.tag===3){Wy(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(si===null||!si.has(r))){e=ma(n,e),e=sS(t,e,1),t=ri(t,e,1),e=ln(),t!==null&&(pc(t,1,e),Nn(t,e));break}}t=t.return}}function r4(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ln(),e.pingedLanes|=e.suspendedLanes&n,Lt===e&&(Ht&n)===n&&(St===4||St===3&&(Ht&130023424)===Ht&&500>ct()-xv?qi(e,0):vv|=n),Nn(e,t)}function kS(e,t){t===0&&(e.mode&1?(t=zc,zc<<=1,!(zc&130023424)&&(zc=4194304)):t=1);var n=ln();e=fs(e,t),e!==null&&(pc(e,t,n),Nn(e,n))}function s4(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),kS(e,n)}function i4(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(G(314))}r!==null&&r.delete(t),kS(e,n)}var CS;CS=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||kn.current)wn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return wn=!1,Kj(e,t,n);wn=!!(e.flags&131072)}else wn=!1,Ke&&t.flags&1048576&&R1(t,hd,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Du(e,t),e=t.pendingProps;var s=da(t,Jt.current);Vo(t,n),s=dv(null,t,r,e,s,n);var i=hv();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Cn(r)?(i=!0,ud(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,ov(t),s.updater=Zd,t.stateNode=s,s._reactInternals=t,zp(t,r,e,n),t=Wp(null,t,r,!0,i,n)):(t.tag=0,Ke&&i&&Zg(t),sn(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Du(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=a4(r),e=pr(r,e),s){case 0:t=Hp(null,t,r,e,n);break e;case 1:t=My(null,t,r,e,n);break e;case 11:t=Ty(null,t,r,e,n);break e;case 14:t=Dy(null,t,r,pr(r.type,e),n);break e}throw Error(G(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:pr(r,s),Hp(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:pr(r,s),My(e,t,r,s,n);case 3:e:{if(lS(t),e===null)throw Error(G(387));r=t.pendingProps,i=t.memoizedState,s=i.element,L1(e,t),md(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=ma(Error(G(423)),t),t=Ay(e,t,r,n,s);break e}else if(r!==s){s=ma(Error(G(424)),t),t=Ay(e,t,r,n,s);break e}else for(Bn=ni(t.stateNode.containerInfo.firstChild),Fn=t,Ke=!0,yr=null,n=M1(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ha(),r===s){t=ps(e,t,n);break e}sn(e,t,r,n)}t=t.child}return t;case 5:return O1(t),e===null&&Ip(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Dp(r,s)?o=null:i!==null&&Dp(r,i)&&(t.flags|=32),aS(e,t),sn(e,t,o,n),t.child;case 6:return e===null&&Ip(t),null;case 13:return cS(e,t,n);case 4:return av(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=fa(t,null,r,n):sn(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:pr(r,s),Ty(e,t,r,s,n);case 7:return sn(e,t,t.pendingProps,n),t.child;case 8:return sn(e,t,t.pendingProps.children,n),t.child;case 12:return sn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,ze(fd,r._currentValue),r._currentValue=o,i!==null)if(Sr(i.value,o)){if(i.children===s.children&&!kn.current){t=ps(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=ls(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var h=u.pending;h===null?c.next=c:(c.next=h.next,h.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Bp(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(G(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Bp(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}sn(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Vo(t,n),s=ar(s),r=r(s),t.flags|=1,sn(e,t,r,n),t.child;case 14:return r=t.type,s=pr(r,t.pendingProps),s=pr(r.type,s),Dy(e,t,r,s,n);case 15:return iS(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:pr(r,s),Du(e,t),t.tag=1,Cn(r)?(e=!0,ud(t)):e=!1,Vo(t,n),nS(t,r,s),zp(t,r,s,n),Wp(null,t,r,!0,e,n);case 19:return uS(e,t,n);case 22:return oS(e,t,n)}throw Error(G(156,t.tag))};function NS(e,t){return Zw(e,t)}function o4(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rr(e,t,n,r){return new o4(e,t,n,r)}function wv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function a4(e){if(typeof e=="function")return wv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===$g)return 11;if(e===Hg)return 14}return 2}function oi(e,t){var n=e.alternate;return n===null?(n=rr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Lu(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")wv(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Po:return Ki(n.children,s,i,t);case zg:o=8,s|=8;break;case up:return e=rr(12,n,t,s|2),e.elementType=up,e.lanes=i,e;case dp:return e=rr(13,n,t,s),e.elementType=dp,e.lanes=i,e;case hp:return e=rr(19,n,t,s),e.elementType=hp,e.lanes=i,e;case Ow:return nh(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Aw:o=10;break e;case Lw:o=9;break e;case $g:o=11;break e;case Hg:o=14;break e;case Ms:o=16,r=null;break e}throw Error(G(130,e==null?e:typeof e,""))}return t=rr(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Ki(e,t,n,r){return e=rr(7,e,r,t),e.lanes=n,e}function nh(e,t,n,r){return e=rr(22,e,r,t),e.elementType=Ow,e.lanes=n,e.stateNode={isHidden:!1},e}function lf(e,t,n){return e=rr(6,e,null,t),e.lanes=n,e}function cf(e,t,n){return t=rr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function l4(e,t,n,r,s){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=Hh(0),this.expirationTimes=Hh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hh(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Sv(e,t,n,r,s,i,o,l,c){return e=new l4(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=rr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ov(i),e}function c4(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ro,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function ES(e){if(!e)return pi;e=e._reactInternals;e:{if(co(e)!==e||e.tag!==1)throw Error(G(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Cn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(G(171))}if(e.tag===1){var n=e.type;if(Cn(n))return E1(e,n,t)}return t}function jS(e,t,n,r,s,i,o,l,c){return e=Sv(n,r,!0,e,s,i,o,l,c),e.context=ES(null),n=e.current,r=ln(),s=ii(n),i=ls(r,s),i.callback=t??null,ri(n,i,s),e.current.lanes=s,pc(e,s,r),Nn(e,r),e}function rh(e,t,n,r){var s=t.current,i=ln(),o=ii(s);return n=ES(n),t.context===null?t.context=n:t.pendingContext=n,t=ls(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ri(s,t,o),e!==null&&(br(e,s,o,i),Ru(e,s,o)),o}function Sd(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 Uy(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function kv(e,t){Uy(e,t),(e=e.alternate)&&Uy(e,t)}function u4(){return null}var RS=typeof reportError=="function"?reportError:function(e){console.error(e)};function Cv(e){this._internalRoot=e}sh.prototype.render=Cv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(G(409));rh(e,t,null,null)};sh.prototype.unmount=Cv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ji(function(){rh(null,e,null,null)}),t[hs]=null}};function sh(e){this._internalRoot=e}sh.prototype.unstable_scheduleHydration=function(e){if(e){var t=o1();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Is.length&&t!==0&&t<Is[n].priority;n++);Is.splice(n,0,e),n===0&&l1(e)}};function Nv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ih(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function qy(){}function d4(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=Sd(o);i.call(u)}}var o=jS(t,r,e,0,null,!1,!1,"",qy);return e._reactRootContainer=o,e[hs]=o.current,zl(e.nodeType===8?e.parentNode:e),Ji(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=Sd(c);l.call(u)}}var c=Sv(e,0,!1,null,null,!1,!1,"",qy);return e._reactRootContainer=c,e[hs]=c.current,zl(e.nodeType===8?e.parentNode:e),Ji(function(){rh(t,c,n,r)}),c}function oh(e,t,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=Sd(o);l.call(c)}}rh(t,o,e,s)}else o=d4(n,t,e,s,r);return Sd(o)}s1=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=il(t.pendingLanes);n!==0&&(qg(t,n|1),Nn(t,ct()),!(Te&6)&&(ga=ct()+500,_i()))}break;case 13:Ji(function(){var r=fs(e,1);if(r!==null){var s=ln();br(r,e,1,s)}}),kv(e,1)}};Kg=function(e){if(e.tag===13){var t=fs(e,134217728);if(t!==null){var n=ln();br(t,e,134217728,n)}kv(e,134217728)}};i1=function(e){if(e.tag===13){var t=ii(e),n=fs(e,t);if(n!==null){var r=ln();br(n,e,t,r)}kv(e,t)}};o1=function(){return Ae};a1=function(e,t){var n=Ae;try{return Ae=e,t()}finally{Ae=n}};wp=function(e,t,n){switch(t){case"input":if(mp(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=Xd(r);if(!s)throw Error(G(90));Bw(r),mp(r,s)}}}break;case"textarea":zw(e,n);break;case"select":t=n.value,t!=null&&Wo(e,!!n.multiple,t,!1)}};Vw=yv;Yw=Ji;var h4={usingClientEntryPoint:!1,Events:[gc,Ao,Xd,qw,Kw,yv]},Ua={findFiberByHostInstance:Ti,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},f4={bundleType:Ua.bundleType,version:Ua.version,rendererPackageName:Ua.rendererPackageName,rendererConfig:Ua.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:vs.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Gw(e),e===null?null:e.stateNode},findFiberByHostInstance:Ua.findFiberByHostInstance||u4,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 Gc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gc.isDisabled&&Gc.supportsFiber)try{Kd=Gc.inject(f4),$r=Gc}catch{}}Un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=h4;Un.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Nv(t))throw Error(G(200));return c4(e,t,null,n)};Un.createRoot=function(e,t){if(!Nv(e))throw Error(G(299));var n=!1,r="",s=RS;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Sv(e,1,!1,null,null,n,!1,r,s),e[hs]=t.current,zl(e.nodeType===8?e.parentNode:e),new Cv(t)};Un.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(G(188)):(e=Object.keys(e).join(","),Error(G(268,e)));return e=Gw(t),e=e===null?null:e.stateNode,e};Un.flushSync=function(e){return Ji(e)};Un.hydrate=function(e,t,n){if(!ih(t))throw Error(G(200));return oh(null,e,t,!0,n)};Un.hydrateRoot=function(e,t,n){if(!Nv(e))throw Error(G(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=RS;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=jS(t,null,e,1,n??null,s,!1,i,o),e[hs]=t.current,zl(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new sh(t)};Un.render=function(e,t,n){if(!ih(t))throw Error(G(200));return oh(null,e,t,!1,n)};Un.unmountComponentAtNode=function(e){if(!ih(e))throw Error(G(40));return e._reactRootContainer?(Ji(function(){oh(null,null,e,!1,function(){e._reactRootContainer=null,e[hs]=null})}),!0):!1};Un.unstable_batchedUpdates=yv;Un.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ih(n))throw Error(G(200));if(e==null||e._reactInternals===void 0)throw Error(G(38));return oh(e,t,n,!1,r)};Un.version="18.3.1-next-f1338f8080-20240426";function PS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(PS)}catch(e){console.error(e)}}PS(),Pw.exports=Un;var sr=Pw.exports;const p4=wa(sr);var Ky=sr;lp.createRoot=Ky.createRoot,lp.hydrateRoot=Ky.hydrateRoot;var Na=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(){}},m4={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},zs,Tg,iw,g4=(iw=class{constructor(){ce(this,zs,m4);ce(this,Tg,!1)}setTimeoutProvider(e){re(this,zs,e)}setTimeout(e,t){return M(this,zs).setTimeout(e,t)}clearTimeout(e){M(this,zs).clearTimeout(e)}setInterval(e,t){return M(this,zs).setInterval(e,t)}clearInterval(e){M(this,zs).clearInterval(e)}},zs=new WeakMap,Tg=new WeakMap,iw),Ai=new g4;function v4(e){setTimeout(e,0)}var Zi=typeof window>"u"||"Deno"in globalThis;function on(){}function x4(e,t){return typeof e=="function"?e(t):e}function tm(e){return typeof e=="number"&&e>=0&&e!==1/0}function TS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ai(e,t){return typeof e=="function"?e(t):e}function Xn(e,t){return typeof e=="function"?e(t):e}function Vy(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==Ev(o,t.options))return!1}else if(!Ql(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||i&&!i(t))}function Yy(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(eo(t.options.mutationKey)!==eo(i))return!1}else if(!Ql(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Ev(e,t){return((t==null?void 0:t.queryKeyHashFn)||eo)(e)}function eo(e){return JSON.stringify(e,(t,n)=>nm(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ql(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ql(e[n],t[n])):!1}var y4=Object.prototype.hasOwnProperty;function DS(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Qy(e)&&Qy(t);if(!r&&!(nm(e)&&nm(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,c=r?new Array(l):{};let u=0;for(let h=0;h<l;h++){const d=r?h:o[h],p=e[d],f=t[d];if(p===f){c[d]=p,(r?h<i:y4.call(e,d))&&u++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){c[d]=f;continue}const m=DS(p,f,n+1);c[d]=m,m===p&&u++}return i===l&&u===i?e:c}function kd(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Qy(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function nm(e){if(!Xy(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Xy(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Xy(e){return Object.prototype.toString.call(e)==="[object Object]"}function _4(e){return new Promise(t=>{Ai.setTimeout(t,e)})}function rm(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?DS(e,t):t}function b4(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function w4(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var jv=Symbol();function MS(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===jv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Rv(e,t){return typeof e=="function"?e(...t):!!e}function S4(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Oi,$s,Jo,ow,k4=(ow=class extends Na{constructor(){super();ce(this,Oi);ce(this,$s);ce(this,Jo);re(this,Jo,t=>{if(!Zi&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){M(this,$s)||this.setEventListener(M(this,Jo))}onUnsubscribe(){var t;this.hasListeners()||((t=M(this,$s))==null||t.call(this),re(this,$s,void 0))}setEventListener(t){var n;re(this,Jo,t),(n=M(this,$s))==null||n.call(this),re(this,$s,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){M(this,Oi)!==t&&(re(this,Oi,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof M(this,Oi)=="boolean"?M(this,Oi):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Oi=new WeakMap,$s=new WeakMap,Jo=new WeakMap,ow),Pv=new k4;function sm(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var C4=v4;function N4(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=C4;const i=l=>{t?e.push(l):s(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var wt=N4(),Zo,Hs,ea,aw,E4=(aw=class extends Na{constructor(){super();ce(this,Zo,!0);ce(this,Hs);ce(this,ea);re(this,ea,t=>{if(!Zi&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){M(this,Hs)||this.setEventListener(M(this,ea))}onUnsubscribe(){var t;this.hasListeners()||((t=M(this,Hs))==null||t.call(this),re(this,Hs,void 0))}setEventListener(t){var n;re(this,ea,t),(n=M(this,Hs))==null||n.call(this),re(this,Hs,t(this.setOnline.bind(this)))}setOnline(t){M(this,Zo)!==t&&(re(this,Zo,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return M(this,Zo)}},Zo=new WeakMap,Hs=new WeakMap,ea=new WeakMap,aw),Cd=new E4;function j4(e){return Math.min(1e3*2**e,3e4)}function AS(e){return(e??"online")==="online"?Cd.isOnline():!0}var im=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function LS(e){let t=!1,n=0,r;const s=sm(),i=()=>s.status!=="pending",o=g=>{var w;if(!i()){const v=new im(g);p(v),(w=e.onCancel)==null||w.call(e,v)}},l=()=>{t=!0},c=()=>{t=!1},u=()=>Pv.isFocused()&&(e.networkMode==="always"||Cd.isOnline())&&e.canRun(),h=()=>AS(e.networkMode)&&e.canRun(),d=g=>{i()||(r==null||r(),s.resolve(g))},p=g=>{i()||(r==null||r(),s.reject(g))},f=()=>new Promise(g=>{var w;r=v=>{(i()||u())&&g(v)},(w=e.onPause)==null||w.call(e)}).then(()=>{var g;r=void 0,i()||(g=e.onContinue)==null||g.call(e)}),m=()=>{if(i())return;let g;const w=n===0?e.initialPromise:void 0;try{g=w??e.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(d).catch(v=>{var k;if(i())return;const y=e.retry??(Zi?0:3),_=e.retryDelay??j4,b=typeof _=="function"?_(n,v):_,N=y===!0||typeof y=="number"&&n<y||typeof y=="function"&&y(n,v);if(t||!N){p(v);return}n++,(k=e.onFail)==null||k.call(e,n,v),_4(b).then(()=>u()?void 0:f()).then(()=>{t?p(v):m()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:l,continueRetry:c,canStart:h,start:()=>(h()?m():f().then(m),s)}}var Ii,lw,OS=(lw=class{constructor(){ce(this,Ii)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),tm(this.gcTime)&&re(this,Ii,Ai.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Zi?1/0:5*60*1e3))}clearGcTimeout(){M(this,Ii)&&(Ai.clearTimeout(M(this,Ii)),re(this,Ii,void 0))}},Ii=new WeakMap,lw),Bi,ta,Qn,Fi,Et,lc,zi,mr,Jr,cw,R4=(cw=class extends OS{constructor(t){super();ce(this,mr);ce(this,Bi);ce(this,ta);ce(this,Qn);ce(this,Fi);ce(this,Et);ce(this,lc);ce(this,zi);re(this,zi,!1),re(this,lc,t.defaultOptions),this.setOptions(t.options),this.observers=[],re(this,Fi,t.client),re(this,Qn,M(this,Fi).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,re(this,Bi,Jy(this.options)),this.state=t.state??M(this,Bi),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=M(this,Et))==null?void 0:t.promise}setOptions(t){if(this.options={...M(this,lc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Jy(this.options);n.data!==void 0&&(this.setState(Gy(n.data,n.dataUpdatedAt)),re(this,Bi,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&M(this,Qn).remove(this)}setData(t,n){const r=rm(this.state.data,t,this.options);return ve(this,mr,Jr).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ve(this,mr,Jr).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=M(this,Et))==null?void 0:r.promise;return(s=M(this,Et))==null||s.cancel(t),n?n.then(on).catch(on):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(M(this,Bi))}isActive(){return this.observers.some(t=>Xn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===jv||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ai(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:!TS(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=M(this,Et))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=M(this,Et))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),M(this,Qn).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(M(this,Et)&&(M(this,zi)?M(this,Et).cancel({revert:!0}):M(this,Et).cancelRetry()),this.scheduleGc()),M(this,Qn).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ve(this,mr,Jr).call(this,{type:"invalidate"})}async fetch(t,n){var c,u,h,d,p,f,m,g,w,v,y,_;if(this.state.fetchStatus!=="idle"&&((c=M(this,Et))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(M(this,Et))return M(this,Et).continueRetry(),M(this,Et).promise}if(t&&this.setOptions(t),!this.options.queryFn){const b=this.observers.find(N=>N.options.queryFn);b&&this.setOptions(b.options)}const r=new AbortController,s=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(re(this,zi,!0),r.signal)})},i=()=>{const b=MS(this.options,n),k=(()=>{const j={client:M(this,Fi),queryKey:this.queryKey,meta:this.meta};return s(j),j})();return re(this,zi,!1),this.options.persister?this.options.persister(b,k,this):b(k)},l=(()=>{const b={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:M(this,Fi),state:this.state,fetchFn:i};return s(b),b})();(u=this.options.behavior)==null||u.onFetch(l,this),re(this,ta,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=l.fetchOptions)==null?void 0:h.meta))&&ve(this,mr,Jr).call(this,{type:"fetch",meta:(d=l.fetchOptions)==null?void 0:d.meta}),re(this,Et,LS({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:b=>{b instanceof im&&b.revert&&this.setState({...M(this,ta),fetchStatus:"idle"}),r.abort()},onFail:(b,N)=>{ve(this,mr,Jr).call(this,{type:"failed",failureCount:b,error:N})},onPause:()=>{ve(this,mr,Jr).call(this,{type:"pause"})},onContinue:()=>{ve(this,mr,Jr).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const b=await M(this,Et).start();if(b===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(b),(f=(p=M(this,Qn).config).onSuccess)==null||f.call(p,b,this),(g=(m=M(this,Qn).config).onSettled)==null||g.call(m,b,this.state.error,this),b}catch(b){if(b instanceof im){if(b.silent)return M(this,Et).promise;if(b.revert){if(this.state.data===void 0)throw b;return this.state.data}}throw ve(this,mr,Jr).call(this,{type:"error",error:b}),(v=(w=M(this,Qn).config).onError)==null||v.call(w,b,this),(_=(y=M(this,Qn).config).onSettled)==null||_.call(y,this.state.data,b,this),b}finally{this.scheduleGc()}}},Bi=new WeakMap,ta=new WeakMap,Qn=new WeakMap,Fi=new WeakMap,Et=new WeakMap,lc=new WeakMap,zi=new WeakMap,mr=new WeakSet,Jr=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...IS(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...Gy(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return re(this,ta,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),wt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),M(this,Qn).notify({query:this,type:"updated",action:t})})},cw);function IS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:AS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Gy(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Jy(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var yn,Ee,cc,rn,$i,na,ts,Ws,uc,ra,sa,Hi,Wi,Us,ia,Me,al,om,am,lm,cm,um,dm,hm,BS,uw,P4=(uw=class extends Na{constructor(t,n){super();ce(this,Me);ce(this,yn);ce(this,Ee);ce(this,cc);ce(this,rn);ce(this,$i);ce(this,na);ce(this,ts);ce(this,Ws);ce(this,uc);ce(this,ra);ce(this,sa);ce(this,Hi);ce(this,Wi);ce(this,Us);ce(this,ia,new Set);this.options=n,re(this,yn,t),re(this,Ws,null),re(this,ts,sm()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(M(this,Ee).addObserver(this),Zy(M(this,Ee),this.options)?ve(this,Me,al).call(this):this.updateResult(),ve(this,Me,cm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return fm(M(this,Ee),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return fm(M(this,Ee),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ve(this,Me,um).call(this),ve(this,Me,dm).call(this),M(this,Ee).removeObserver(this)}setOptions(t){const n=this.options,r=M(this,Ee);if(this.options=M(this,yn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Xn(this.options.enabled,M(this,Ee))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ve(this,Me,hm).call(this),M(this,Ee).setOptions(this.options),n._defaulted&&!kd(this.options,n)&&M(this,yn).getQueryCache().notify({type:"observerOptionsUpdated",query:M(this,Ee),observer:this});const s=this.hasListeners();s&&e0(M(this,Ee),r,this.options,n)&&ve(this,Me,al).call(this),this.updateResult(),s&&(M(this,Ee)!==r||Xn(this.options.enabled,M(this,Ee))!==Xn(n.enabled,M(this,Ee))||ai(this.options.staleTime,M(this,Ee))!==ai(n.staleTime,M(this,Ee)))&&ve(this,Me,om).call(this);const i=ve(this,Me,am).call(this);s&&(M(this,Ee)!==r||Xn(this.options.enabled,M(this,Ee))!==Xn(n.enabled,M(this,Ee))||i!==M(this,Us))&&ve(this,Me,lm).call(this,i)}getOptimisticResult(t){const n=M(this,yn).getQueryCache().build(M(this,yn),t),r=this.createResult(n,t);return D4(this,r)&&(re(this,rn,r),re(this,na,this.options),re(this,$i,M(this,Ee).state)),r}getCurrentResult(){return M(this,rn)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&M(this,ts).status==="pending"&&M(this,ts).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){M(this,ia).add(t)}getCurrentQuery(){return M(this,Ee)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=M(this,yn).defaultQueryOptions(t),r=M(this,yn).getQueryCache().build(M(this,yn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ve(this,Me,al).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),M(this,rn)))}createResult(t,n){var F;const r=M(this,Ee),s=this.options,i=M(this,rn),o=M(this,$i),l=M(this,na),u=t!==r?t.state:M(this,cc),{state:h}=t;let d={...h},p=!1,f;if(n._optimisticResults){const P=this.hasListeners(),O=!P&&Zy(t,n),T=P&&e0(t,r,n,s);(O||T)&&(d={...d,...IS(h.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:w}=d;f=d.data;let v=!1;if(n.placeholderData!==void 0&&f===void 0&&w==="pending"){let P;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(P=i.data,v=!0):P=typeof n.placeholderData=="function"?n.placeholderData((F=M(this,sa))==null?void 0:F.state.data,M(this,sa)):n.placeholderData,P!==void 0&&(w="success",f=rm(i==null?void 0:i.data,P,n),p=!0)}if(n.select&&f!==void 0&&!v)if(i&&f===(o==null?void 0:o.data)&&n.select===M(this,uc))f=M(this,ra);else try{re(this,uc,n.select),f=n.select(f),f=rm(i==null?void 0:i.data,f,n),re(this,ra,f),re(this,Ws,null)}catch(P){re(this,Ws,P)}M(this,Ws)&&(m=M(this,Ws),f=M(this,ra),g=Date.now(),w="error");const y=d.fetchStatus==="fetching",_=w==="pending",b=w==="error",N=_&&y,k=f!==void 0,D={status:w,fetchStatus:d.fetchStatus,isPending:_,isSuccess:w==="success",isError:b,isInitialLoading:N,isLoading:N,data:f,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:y,isRefetching:y&&!_,isLoadingError:b&&!k,isPaused:d.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:b&&k,isStale:Tv(t,n),refetch:this.refetch,promise:M(this,ts),isEnabled:Xn(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const P=D.data!==void 0,O=D.status==="error"&&!P,T=L=>{O?L.reject(D.error):P&&L.resolve(D.data)},E=()=>{const L=re(this,ts,D.promise=sm());T(L)},R=M(this,ts);switch(R.status){case"pending":t.queryHash===r.queryHash&&T(R);break;case"fulfilled":(O||D.data!==R.value)&&E();break;case"rejected":(!O||D.error!==R.reason)&&E();break}}return D}updateResult(){const t=M(this,rn),n=this.createResult(M(this,Ee),this.options);if(re(this,$i,M(this,Ee).state),re(this,na,this.options),M(this,$i).data!==void 0&&re(this,sa,M(this,Ee)),kd(n,t))return;re(this,rn,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!M(this,ia).size)return!0;const o=new Set(i??M(this,ia));return this.options.throwOnError&&o.add("error"),Object.keys(M(this,rn)).some(l=>{const c=l;return M(this,rn)[c]!==t[c]&&o.has(c)})};ve(this,Me,BS).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ve(this,Me,cm).call(this)}},yn=new WeakMap,Ee=new WeakMap,cc=new WeakMap,rn=new WeakMap,$i=new WeakMap,na=new WeakMap,ts=new WeakMap,Ws=new WeakMap,uc=new WeakMap,ra=new WeakMap,sa=new WeakMap,Hi=new WeakMap,Wi=new WeakMap,Us=new WeakMap,ia=new WeakMap,Me=new WeakSet,al=function(t){ve(this,Me,hm).call(this);let n=M(this,Ee).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(on)),n},om=function(){ve(this,Me,um).call(this);const t=ai(this.options.staleTime,M(this,Ee));if(Zi||M(this,rn).isStale||!tm(t))return;const r=TS(M(this,rn).dataUpdatedAt,t)+1;re(this,Hi,Ai.setTimeout(()=>{M(this,rn).isStale||this.updateResult()},r))},am=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(M(this,Ee)):this.options.refetchInterval)??!1},lm=function(t){ve(this,Me,dm).call(this),re(this,Us,t),!(Zi||Xn(this.options.enabled,M(this,Ee))===!1||!tm(M(this,Us))||M(this,Us)===0)&&re(this,Wi,Ai.setInterval(()=>{(this.options.refetchIntervalInBackground||Pv.isFocused())&&ve(this,Me,al).call(this)},M(this,Us)))},cm=function(){ve(this,Me,om).call(this),ve(this,Me,lm).call(this,ve(this,Me,am).call(this))},um=function(){M(this,Hi)&&(Ai.clearTimeout(M(this,Hi)),re(this,Hi,void 0))},dm=function(){M(this,Wi)&&(Ai.clearInterval(M(this,Wi)),re(this,Wi,void 0))},hm=function(){const t=M(this,yn).getQueryCache().build(M(this,yn),this.options);if(t===M(this,Ee))return;const n=M(this,Ee);re(this,Ee,t),re(this,cc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},BS=function(t){wt.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(M(this,rn))}),M(this,yn).getQueryCache().notify({query:M(this,Ee),type:"observerResultsUpdated"})})},uw);function T4(e,t){return Xn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Zy(e,t){return T4(e,t)||e.state.data!==void 0&&fm(e,t,t.refetchOnMount)}function fm(e,t,n){if(Xn(t.enabled,e)!==!1&&ai(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Tv(e,t)}return!1}function e0(e,t,n,r){return(e!==t||Xn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Tv(e,n)}function Tv(e,t){return Xn(t.enabled,e)!==!1&&e.isStaleByTime(ai(t.staleTime,e))}function D4(e,t){return!kd(e.getCurrentResult(),t)}function t0(e){return{onFetch:(t,n)=>{var h,d,p,f,m;const r=t.options,s=(p=(d=(h=t.fetchOptions)==null?void 0:h.meta)==null?void 0:d.fetchMore)==null?void 0:p.direction,i=((f=t.state.data)==null?void 0:f.pages)||[],o=((m=t.state.data)==null?void 0:m.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let g=!1;const w=_=>{S4(_,()=>t.signal,()=>g=!0)},v=MS(t.options,t.fetchOptions),y=async(_,b,N)=>{if(g)return Promise.reject();if(b==null&&_.pages.length)return Promise.resolve(_);const j=(()=>{const O={client:t.client,queryKey:t.queryKey,pageParam:b,direction:N?"backward":"forward",meta:t.options.meta};return w(O),O})(),D=await v(j),{maxPages:F}=t.options,P=N?w4:b4;return{pages:P(_.pages,D,F),pageParams:P(_.pageParams,b,F)}};if(s&&i.length){const _=s==="backward",b=_?M4:n0,N={pages:i,pageParams:o},k=b(r,N);l=await y(N,k,_)}else{const _=e??i.length;do{const b=c===0?o[0]??r.initialPageParam:n0(r,l);if(c>0&&b==null)break;l=await y(l,b),c++}while(c<_)}return l};t.options.persister?t.fetchFn=()=>{var g,w;return(w=(g=t.options).persister)==null?void 0:w.call(g,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function n0(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function M4(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var dc,Lr,Qt,Ui,Or,Ts,dw,A4=(dw=class extends OS{constructor(t){super();ce(this,Or);ce(this,dc);ce(this,Lr);ce(this,Qt);ce(this,Ui);re(this,dc,t.client),this.mutationId=t.mutationId,re(this,Qt,t.mutationCache),re(this,Lr,[]),this.state=t.state||FS(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){M(this,Lr).includes(t)||(M(this,Lr).push(t),this.clearGcTimeout(),M(this,Qt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){re(this,Lr,M(this,Lr).filter(n=>n!==t)),this.scheduleGc(),M(this,Qt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){M(this,Lr).length||(this.state.status==="pending"?this.scheduleGc():M(this,Qt).remove(this))}continue(){var t;return((t=M(this,Ui))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,c,u,h,d,p,f,m,g,w,v,y,_,b,N,k,j;const n=()=>{ve(this,Or,Ts).call(this,{type:"continue"})},r={client:M(this,dc),meta:this.options.meta,mutationKey:this.options.mutationKey};re(this,Ui,LS({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(D,F)=>{ve(this,Or,Ts).call(this,{type:"failed",failureCount:D,error:F})},onPause:()=>{ve(this,Or,Ts).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>M(this,Qt).canRun(this)}));const s=this.state.status==="pending",i=!M(this,Ui).canStart();try{if(s)n();else{ve(this,Or,Ts).call(this,{type:"pending",variables:t,isPaused:i}),M(this,Qt).config.onMutate&&await M(this,Qt).config.onMutate(t,this,r);const F=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,r));F!==this.state.context&&ve(this,Or,Ts).call(this,{type:"pending",context:F,variables:t,isPaused:i})}const D=await M(this,Ui).start();return await((u=(c=M(this,Qt).config).onSuccess)==null?void 0:u.call(c,D,t,this.state.context,this,r)),await((d=(h=this.options).onSuccess)==null?void 0:d.call(h,D,t,this.state.context,r)),await((f=(p=M(this,Qt).config).onSettled)==null?void 0:f.call(p,D,null,this.state.variables,this.state.context,this,r)),await((g=(m=this.options).onSettled)==null?void 0:g.call(m,D,null,t,this.state.context,r)),ve(this,Or,Ts).call(this,{type:"success",data:D}),D}catch(D){try{await((v=(w=M(this,Qt).config).onError)==null?void 0:v.call(w,D,t,this.state.context,this,r))}catch(F){Promise.reject(F)}try{await((_=(y=this.options).onError)==null?void 0:_.call(y,D,t,this.state.context,r))}catch(F){Promise.reject(F)}try{await((N=(b=M(this,Qt).config).onSettled)==null?void 0:N.call(b,void 0,D,this.state.variables,this.state.context,this,r))}catch(F){Promise.reject(F)}try{await((j=(k=this.options).onSettled)==null?void 0:j.call(k,void 0,D,t,this.state.context,r))}catch(F){Promise.reject(F)}throw ve(this,Or,Ts).call(this,{type:"error",error:D}),D}finally{M(this,Qt).runNext(this)}}},dc=new WeakMap,Lr=new WeakMap,Qt=new WeakMap,Ui=new WeakMap,Or=new WeakSet,Ts=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,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{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),wt.batch(()=>{M(this,Lr).forEach(r=>{r.onMutationUpdate(t)}),M(this,Qt).notify({mutation:this,type:"updated",action:t})})},dw);function FS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ns,gr,hc,hw,L4=(hw=class extends Na{constructor(t={}){super();ce(this,ns);ce(this,gr);ce(this,hc);this.config=t,re(this,ns,new Set),re(this,gr,new Map),re(this,hc,0)}build(t,n,r){const s=new A4({client:t,mutationCache:this,mutationId:++Ac(this,hc)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){M(this,ns).add(t);const n=Jc(t);if(typeof n=="string"){const r=M(this,gr).get(n);r?r.push(t):M(this,gr).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(M(this,ns).delete(t)){const n=Jc(t);if(typeof n=="string"){const r=M(this,gr).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&M(this,gr).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Jc(t);if(typeof n=="string"){const r=M(this,gr).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=Jc(t);if(typeof n=="string"){const s=(r=M(this,gr).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){wt.batch(()=>{M(this,ns).forEach(t=>{this.notify({type:"removed",mutation:t})}),M(this,ns).clear(),M(this,gr).clear()})}getAll(){return Array.from(M(this,ns))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Yy(n,r))}findAll(t={}){return this.getAll().filter(n=>Yy(t,n))}notify(t){wt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return wt.batch(()=>Promise.all(t.map(n=>n.continue().catch(on))))}},ns=new WeakMap,gr=new WeakMap,hc=new WeakMap,hw);function Jc(e){var t;return(t=e.options.scope)==null?void 0:t.id}var rs,qs,_n,ss,us,Ou,pm,fw,O4=(fw=class extends Na{constructor(n,r){super();ce(this,us);ce(this,rs);ce(this,qs);ce(this,_n);ce(this,ss);re(this,rs,n),this.setOptions(r),this.bindMethods(),ve(this,us,Ou).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=M(this,rs).defaultMutationOptions(n),kd(this.options,r)||M(this,rs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:M(this,_n),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&eo(r.mutationKey)!==eo(this.options.mutationKey)?this.reset():((s=M(this,_n))==null?void 0:s.state.status)==="pending"&&M(this,_n).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=M(this,_n))==null||n.removeObserver(this)}onMutationUpdate(n){ve(this,us,Ou).call(this),ve(this,us,pm).call(this,n)}getCurrentResult(){return M(this,qs)}reset(){var n;(n=M(this,_n))==null||n.removeObserver(this),re(this,_n,void 0),ve(this,us,Ou).call(this),ve(this,us,pm).call(this)}mutate(n,r){var s;return re(this,ss,r),(s=M(this,_n))==null||s.removeObserver(this),re(this,_n,M(this,rs).getMutationCache().build(M(this,rs),this.options)),M(this,_n).addObserver(this),M(this,_n).execute(n)}},rs=new WeakMap,qs=new WeakMap,_n=new WeakMap,ss=new WeakMap,us=new WeakSet,Ou=function(){var r;const n=((r=M(this,_n))==null?void 0:r.state)??FS();re(this,qs,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},pm=function(n){wt.batch(()=>{var r,s,i,o,l,c,u,h;if(M(this,ss)&&this.hasListeners()){const d=M(this,qs).variables,p=M(this,qs).context,f={client:M(this,rs),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(r=M(this,ss)).onSuccess)==null||s.call(r,n.data,d,p,f)}catch(m){Promise.reject(m)}try{(o=(i=M(this,ss)).onSettled)==null||o.call(i,n.data,null,d,p,f)}catch(m){Promise.reject(m)}}else if((n==null?void 0:n.type)==="error"){try{(c=(l=M(this,ss)).onError)==null||c.call(l,n.error,d,p,f)}catch(m){Promise.reject(m)}try{(h=(u=M(this,ss)).onSettled)==null||h.call(u,void 0,n.error,d,p,f)}catch(m){Promise.reject(m)}}}this.listeners.forEach(d=>{d(M(this,qs))})})},fw),Ir,pw,I4=(pw=class extends Na{constructor(t={}){super();ce(this,Ir);this.config=t,re(this,Ir,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??Ev(s,n);let o=this.get(i);return o||(o=new R4({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){M(this,Ir).has(t.queryHash)||(M(this,Ir).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=M(this,Ir).get(t.queryHash);n&&(t.destroy(),n===t&&M(this,Ir).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){wt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return M(this,Ir).get(t)}getAll(){return[...M(this,Ir).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Vy(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Vy(t,r)):n}notify(t){wt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){wt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){wt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ir=new WeakMap,pw),nt,Ks,Vs,oa,aa,Ys,la,ca,mw,B4=(mw=class{constructor(e={}){ce(this,nt);ce(this,Ks);ce(this,Vs);ce(this,oa);ce(this,aa);ce(this,Ys);ce(this,la);ce(this,ca);re(this,nt,e.queryCache||new I4),re(this,Ks,e.mutationCache||new L4),re(this,Vs,e.defaultOptions||{}),re(this,oa,new Map),re(this,aa,new Map),re(this,Ys,0)}mount(){Ac(this,Ys)._++,M(this,Ys)===1&&(re(this,la,Pv.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(this,nt).onFocus())})),re(this,ca,Cd.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(this,nt).onOnline())})))}unmount(){var e,t;Ac(this,Ys)._--,M(this,Ys)===0&&((e=M(this,la))==null||e.call(this),re(this,la,void 0),(t=M(this,ca))==null||t.call(this),re(this,ca,void 0))}isFetching(e){return M(this,nt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return M(this,Ks).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=M(this,nt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=M(this,nt).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ai(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return M(this,nt).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=M(this,nt).get(r.queryHash),i=s==null?void 0:s.state.data,o=x4(t,i);if(o!==void 0)return M(this,nt).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return wt.batch(()=>M(this,nt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=M(this,nt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=M(this,nt);wt.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=M(this,nt);return wt.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=wt.batch(()=>M(this,nt).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(on).catch(on)}invalidateQueries(e,t={}){return wt.batch(()=>(M(this,nt).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=wt.batch(()=>M(this,nt).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(on)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(on)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=M(this,nt).build(this,t);return n.isStaleByTime(ai(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(on).catch(on)}fetchInfiniteQuery(e){return e.behavior=t0(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(on).catch(on)}ensureInfiniteQueryData(e){return e.behavior=t0(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Cd.isOnline()?M(this,Ks).resumePausedMutations():Promise.resolve()}getQueryCache(){return M(this,nt)}getMutationCache(){return M(this,Ks)}getDefaultOptions(){return M(this,Vs)}setDefaultOptions(e){re(this,Vs,e)}setQueryDefaults(e,t){M(this,oa).set(eo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...M(this,oa).values()],n={};return t.forEach(r=>{Ql(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){M(this,aa).set(eo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...M(this,aa).values()],n={};return t.forEach(r=>{Ql(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...M(this,Vs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ev(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===jv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...M(this,Vs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){M(this,nt).clear(),M(this,Ks).clear()}},nt=new WeakMap,Ks=new WeakMap,Vs=new WeakMap,oa=new WeakMap,aa=new WeakMap,Ys=new WeakMap,la=new WeakMap,ca=new WeakMap,mw),zS=x.createContext(void 0),dn=e=>{const t=x.useContext(zS);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},F4=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(zS.Provider,{value:e,children:t})),$S=x.createContext(!1),z4=()=>x.useContext($S);$S.Provider;function $4(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var H4=x.createContext($4()),W4=()=>x.useContext(H4),U4=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Rv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},q4=e=>{x.useEffect(()=>{e.clearReset()},[e])},K4=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Rv(n,[e.error,r])),V4=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Y4=(e,t)=>e.isLoading&&e.isFetching&&!t,Q4=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,r0=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function X4(e,t,n){var p,f,m,g;const r=z4(),s=W4(),i=dn(),o=i.defaultQueryOptions(e);(f=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||f.call(p,o);const l=i.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",V4(o),U4(o,s,l),q4(s);const c=!i.getQueryCache().get(o.queryHash),[u]=x.useState(()=>new t(i,o)),h=u.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(w=>{const v=d?u.subscribe(wt.batchCalls(w)):on;return u.updateResult(),v},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),x.useEffect(()=>{u.setOptions(o)},[o,u]),Q4(o,h))throw r0(o,u,s);if(K4({result:h,errorResetBoundary:s,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw h.error;if((g=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||g.call(m,o,h),o.experimental_prefetchInRender&&!Zi&&Y4(h,r)){const w=c?r0(o,u,s):l==null?void 0:l.promise;w==null||w.catch(on).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?h:u.trackResult(h)}function he(e,t){return X4(e,P4)}function we(e,t){const n=dn(),[r]=x.useState(()=>new O4(n,e));x.useEffect(()=>{r.setOptions(e)},[r,e]);const s=x.useSyncExternalStore(x.useCallback(o=>r.subscribe(wt.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=x.useCallback((o,l)=>{r.mutate(o,l).catch(on)},[r]);if(s.error&&Rv(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}const ah=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ea(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Dv(e){return"nodeType"in e}function hn(e){var t,n;return e?Ea(e)?e:Dv(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Mv(e){const{Document:t}=hn(e);return e instanceof t}function xc(e){return Ea(e)?!1:e instanceof hn(e).HTMLElement}function HS(e){return e instanceof hn(e).SVGElement}function ja(e){return e?Ea(e)?e.document:Dv(e)?Mv(e)?e:xc(e)||HS(e)?e.ownerDocument:document:document:document}const ms=ah?x.useLayoutEffect:x.useEffect;function lh(e){const t=x.useRef(e);return ms(()=>{t.current=e}),x.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function G4(){const e=x.useRef(null),t=x.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=x.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Xl(e,t){t===void 0&&(t=[e]);const n=x.useRef(e);return ms(()=>{n.current!==e&&(n.current=e)},t),n}function yc(e,t){const n=x.useRef();return x.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Nd(e){const t=lh(e),n=x.useRef(null),r=x.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function Ed(e){const t=x.useRef();return x.useEffect(()=>{t.current=e},[e]),t.current}let uf={};function ch(e,t){return x.useMemo(()=>{if(t)return t;const n=uf[e]==null?0:uf[e]+1;return uf[e]=n,e+"-"+n},[e,t])}function WS(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,o)=>{const l=Object.entries(o);for(const[c,u]of l){const h=i[c];h!=null&&(i[c]=h+e*u)}return i},{...t})}}const Qo=WS(1),jd=WS(-1);function J4(e){return"clientX"in e&&"clientY"in e}function Av(e){if(!e)return!1;const{KeyboardEvent:t}=hn(e.target);return t&&e instanceof t}function Z4(e){if(!e)return!1;const{TouchEvent:t}=hn(e.target);return t&&e instanceof t}function Rd(e){if(Z4(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return J4(e)?{x:e.clientX,y:e.clientY}:null}const Gl=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Gl.Translate.toString(e),Gl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),s0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function e3(e){return e.matches(s0)?e:e.querySelector(s0)}const t3={display:"none"};function n3(e){let{id:t,value:n}=e;return qe.createElement("div",{id:t,style:t3},n)}function r3(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return qe.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function s3(){const[e,t]=x.useState("");return{announce:x.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const US=x.createContext(null);function i3(e){const t=x.useContext(US);x.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function o3(){const[e]=x.useState(()=>new Set),t=x.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[x.useCallback(r=>{let{type:s,event:i}=r;e.forEach(o=>{var l;return(l=o[s])==null?void 0:l.call(o,i)})},[e]),t]}const a3={draggable:`
41
- To pick up a draggable item, press the space bar.
42
- While dragging, use the arrow keys to move the item.
43
- Press space again to drop the item in its new position, or press escape to cancel.
44
- `},l3={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function c3(e){let{announcements:t=l3,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=a3}=e;const{announce:i,announcement:o}=s3(),l=ch("DndLiveRegion"),[c,u]=x.useState(!1);if(x.useEffect(()=>{u(!0)},[]),i3(x.useMemo(()=>({onDragStart(d){let{active:p}=d;i(t.onDragStart({active:p}))},onDragMove(d){let{active:p,over:f}=d;t.onDragMove&&i(t.onDragMove({active:p,over:f}))},onDragOver(d){let{active:p,over:f}=d;i(t.onDragOver({active:p,over:f}))},onDragEnd(d){let{active:p,over:f}=d;i(t.onDragEnd({active:p,over:f}))},onDragCancel(d){let{active:p,over:f}=d;i(t.onDragCancel({active:p,over:f}))}}),[i,t])),!c)return null;const h=qe.createElement(qe.Fragment,null,qe.createElement(n3,{id:r,value:s.draggable}),qe.createElement(r3,{id:l,announcement:o}));return n?sr.createPortal(h,n):h}var bt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(bt||(bt={}));function Pd(){}function i0(e,t){return x.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function u3(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return x.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const kr=Object.freeze({x:0,y:0});function d3(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function h3(e,t){const n=Rd(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function f3(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function p3(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function o0(e){let{left:t,top:n,height:r,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+r},{x:t+s,y:n+r}]}function m3(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const g3=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=o0(t),i=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const u=o0(c),h=s.reduce((p,f,m)=>p+d3(u[m],f),0),d=Number((h/4).toFixed(4));i.push({id:l,data:{droppableContainer:o,value:d}})}}return i.sort(f3)};function v3(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-r,l=i-n;if(r<s&&n<i){const c=t.width*t.height,u=e.width*e.height,h=o*l,d=h/(c+u-h);return Number(d.toFixed(4))}return 0}const x3=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const i of r){const{id:o}=i,l=n.get(o);if(l){const c=v3(l,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(p3)};function y3(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function qS(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:kr}function _3(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((o,l)=>({...o,top:o.top+e*l.y,bottom:o.bottom+e*l.y,left:o.left+e*l.x,right:o.right+e*l.x}),{...n})}}const b3=_3(1);function KS(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function w3(e,t,n){const r=KS(t);if(!r)return e;const{scaleX:s,scaleY:i,x:o,y:l}=r,c=e.left-o-(1-s)*parseFloat(n),u=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),h=s?e.width/s:e.width,d=i?e.height/i:e.height;return{width:h,height:d,top:u,right:c+h,bottom:u+d,left:c}}const S3={ignoreTransform:!1};function _c(e,t){t===void 0&&(t=S3);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:h}=hn(e).getComputedStyle(e);u&&(n=w3(n,u,h))}const{top:r,left:s,width:i,height:o,bottom:l,right:c}=n;return{top:r,left:s,width:i,height:o,bottom:l,right:c}}function a0(e){return _c(e,{ignoreTransform:!0})}function k3(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function C3(e,t){return t===void 0&&(t=hn(e).getComputedStyle(e)),t.position==="fixed"}function N3(e,t){t===void 0&&(t=hn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?n.test(i):!1})}function Lv(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(Mv(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!xc(s)||HS(s)||n.includes(s))return n;const i=hn(e).getComputedStyle(s);return s!==e&&N3(s,i)&&n.push(s),C3(s,i)?n:r(s.parentNode)}return e?r(e):n}function VS(e){const[t]=Lv(e,1);return t??null}function df(e){return!ah||!e?null:Ea(e)?e:Dv(e)?Mv(e)||e===ja(e).scrollingElement?window:xc(e)?e:null:null}function YS(e){return Ea(e)?e.scrollX:e.scrollLeft}function QS(e){return Ea(e)?e.scrollY:e.scrollTop}function mm(e){return{x:YS(e),y:QS(e)}}var Pt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Pt||(Pt={}));function XS(e){return!ah||!e?!1:e===document.scrollingElement}function GS(e){const t={x:0,y:0},n=XS(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:o,isRight:l,maxScroll:r,minScroll:t}}const E3={x:.2,y:.2};function j3(e,t,n,r,s){let{top:i,left:o,right:l,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=E3);const{isTop:u,isBottom:h,isLeft:d,isRight:p}=GS(e),f={x:0,y:0},m={x:0,y:0},g={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+g.height?(f.y=Pt.Backward,m.y=r*Math.abs((t.top+g.height-i)/g.height)):!h&&c>=t.bottom-g.height&&(f.y=Pt.Forward,m.y=r*Math.abs((t.bottom-g.height-c)/g.height)),!p&&l>=t.right-g.width?(f.x=Pt.Forward,m.x=r*Math.abs((t.right-g.width-l)/g.width)):!d&&o<=t.left+g.width&&(f.x=Pt.Backward,m.x=r*Math.abs((t.left+g.width-o)/g.width)),{direction:f,speed:m}}function R3(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function JS(e){return e.reduce((t,n)=>Qo(t,mm(n)),kr)}function P3(e){return e.reduce((t,n)=>t+YS(n),0)}function T3(e){return e.reduce((t,n)=>t+QS(n),0)}function ZS(e,t){if(t===void 0&&(t=_c),!e)return;const{top:n,left:r,bottom:s,right:i}=t(e);VS(e)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const D3=[["x",["left","right"],P3],["y",["top","bottom"],T3]];class Ov{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Lv(n),s=JS(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,l]of D3)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=l(r),h=s[i]-u;return this.rect[c]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Sl{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function M3(e){const{EventTarget:t}=hn(e);return e instanceof t?e:ja(e)}function hf(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Gn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Gn||(Gn={}));function l0(e){e.preventDefault()}function A3(e){e.stopPropagation()}var Oe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Oe||(Oe={}));const ek={start:[Oe.Space,Oe.Enter],cancel:[Oe.Esc],end:[Oe.Space,Oe.Enter,Oe.Tab]},L3=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Oe.Right:return{...n,x:n.x+25};case Oe.Left:return{...n,x:n.x-25};case Oe.Down:return{...n,y:n.y+25};case Oe.Up:return{...n,y:n.y-25}}};class Iv{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Sl(ja(n)),this.windowListeners=new Sl(hn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Gn.Resize,this.handleCancel),this.windowListeners.add(Gn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Gn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&ZS(r),n(kr)}handleKeyDown(t){if(Av(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=ek,coordinateGetter:o=L3,scrollBehavior:l="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,h=u?{x:u.left,y:u.top}:kr;this.referenceCoordinates||(this.referenceCoordinates=h);const d=o(t,{active:n,context:r.current,currentCoordinates:h});if(d){const p=jd(d,h),f={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const w=t.code,{isTop:v,isRight:y,isLeft:_,isBottom:b,maxScroll:N,minScroll:k}=GS(g),j=R3(g),D={x:Math.min(w===Oe.Right?j.right-j.width/2:j.right,Math.max(w===Oe.Right?j.left:j.left+j.width/2,d.x)),y:Math.min(w===Oe.Down?j.bottom-j.height/2:j.bottom,Math.max(w===Oe.Down?j.top:j.top+j.height/2,d.y))},F=w===Oe.Right&&!y||w===Oe.Left&&!_,P=w===Oe.Down&&!b||w===Oe.Up&&!v;if(F&&D.x!==d.x){const O=g.scrollLeft+p.x,T=w===Oe.Right&&O<=N.x||w===Oe.Left&&O>=k.x;if(T&&!p.y){g.scrollTo({left:O,behavior:l});return}T?f.x=g.scrollLeft-O:f.x=w===Oe.Right?g.scrollLeft-N.x:g.scrollLeft-k.x,f.x&&g.scrollBy({left:-f.x,behavior:l});break}else if(P&&D.y!==d.y){const O=g.scrollTop+p.y,T=w===Oe.Down&&O<=N.y||w===Oe.Up&&O>=k.y;if(T&&!p.x){g.scrollTo({top:O,behavior:l});return}T?f.y=g.scrollTop-O:f.y=w===Oe.Down?g.scrollTop-N.y:g.scrollTop-k.y,f.y&&g.scrollBy({top:-f.y,behavior:l});break}}this.handleMove(t,Qo(jd(d,this.referenceCoordinates),f))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Iv.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ek,onActivation:s}=t,{active:i}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function c0(e){return!!(e&&"distance"in e)}function u0(e){return!!(e&&"delay"in e)}class Bv{constructor(t,n,r){var s;r===void 0&&(r=M3(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:o}=i;this.props=t,this.events=n,this.document=ja(o),this.documentListeners=new Sl(this.document),this.listeners=new Sl(r),this.windowListeners=new Sl(hn(o)),this.initialCoordinates=(s=Rd(i))!=null?s:kr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Gn.Resize,this.handleCancel),this.windowListeners.add(Gn.DragStart,l0),this.windowListeners.add(Gn.VisibilityChange,this.handleCancel),this.windowListeners.add(Gn.ContextMenu,l0),this.documentListeners.add(Gn.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(u0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(c0(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Gn.Click,A3,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Gn.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:l}}=i;if(!s)return;const c=(n=Rd(t))!=null?n:kr,u=jd(s,c);if(!r&&l){if(c0(l)){if(l.tolerance!=null&&hf(u,l.tolerance))return this.handleCancel();if(hf(u,l.distance))return this.handleStart()}if(u0(l)&&hf(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Oe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const O3={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Fv extends Bv{constructor(t){const{event:n}=t,r=ja(n.target);super(t,O3,r)}}Fv.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const I3={move:{name:"mousemove"},end:{name:"mouseup"}};var gm;(function(e){e[e.RightClick=2]="RightClick"})(gm||(gm={}));class B3 extends Bv{constructor(t){super(t,I3,ja(t.event.target))}}B3.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===gm.RightClick?!1:(r==null||r({event:n}),!0)}}];const ff={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class F3 extends Bv{constructor(t){super(t,ff)}static setup(){return window.addEventListener(ff.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ff.move.name,t)};function t(){}}}F3.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var kl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(kl||(kl={}));var Td;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Td||(Td={}));function z3(e){let{acceleration:t,activator:n=kl.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:o=5,order:l=Td.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:h,delta:d,threshold:p}=e;const f=H3({delta:d,disabled:!i}),[m,g]=G4(),w=x.useRef({x:0,y:0}),v=x.useRef({x:0,y:0}),y=x.useMemo(()=>{switch(n){case kl.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case kl.DraggableRect:return s}},[n,s,c]),_=x.useRef(null),b=x.useCallback(()=>{const k=_.current;if(!k)return;const j=w.current.x*v.current.x,D=w.current.y*v.current.y;k.scrollBy(j,D)},[]),N=x.useMemo(()=>l===Td.TreeOrder?[...u].reverse():u,[l,u]);x.useEffect(()=>{if(!i||!u.length||!y){g();return}for(const k of N){if((r==null?void 0:r(k))===!1)continue;const j=u.indexOf(k),D=h[j];if(!D)continue;const{direction:F,speed:P}=j3(k,D,y,t,p);for(const O of["x","y"])f[O][F[O]]||(P[O]=0,F[O]=0);if(P.x>0||P.y>0){g(),_.current=k,m(b,o),w.current=P,v.current=F;return}}w.current={x:0,y:0},v.current={x:0,y:0},g()},[t,b,r,g,i,o,JSON.stringify(y),JSON.stringify(f),m,u,N,h,JSON.stringify(p)])}const $3={x:{[Pt.Backward]:!1,[Pt.Forward]:!1},y:{[Pt.Backward]:!1,[Pt.Forward]:!1}};function H3(e){let{delta:t,disabled:n}=e;const r=Ed(t);return yc(s=>{if(n||!r||!s)return $3;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Pt.Backward]:s.x[Pt.Backward]||i.x===-1,[Pt.Forward]:s.x[Pt.Forward]||i.x===1},y:{[Pt.Backward]:s.y[Pt.Backward]||i.y===-1,[Pt.Forward]:s.y[Pt.Forward]||i.y===1}}},[n,t,r])}function W3(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return yc(s=>{var i;return t==null?null:(i=r??s)!=null?i:null},[r,t])}function U3(e,t){return x.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,r)}));return[...n,...i]},[]),[e,t])}var Jl;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Jl||(Jl={}));var vm;(function(e){e.Optimized="optimized"})(vm||(vm={}));const d0=new Map;function q3(e,t){let{dragging:n,dependencies:r,config:s}=t;const[i,o]=x.useState(null),{frequency:l,measure:c,strategy:u}=s,h=x.useRef(e),d=w(),p=Xl(d),f=x.useCallback(function(v){v===void 0&&(v=[]),!p.current&&o(y=>y===null?v:y.concat(v.filter(_=>!y.includes(_))))},[p]),m=x.useRef(null),g=yc(v=>{if(d&&!n)return d0;if(!v||v===d0||h.current!==e||i!=null){const y=new Map;for(let _ of e){if(!_)continue;if(i&&i.length>0&&!i.includes(_.id)&&_.rect.current){y.set(_.id,_.rect.current);continue}const b=_.node.current,N=b?new Ov(c(b),b):null;_.rect.current=N,N&&y.set(_.id,N)}return y}return v},[e,i,n,d,c]);return x.useEffect(()=>{h.current=e},[e]),x.useEffect(()=>{d||f()},[n,d]),x.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),x.useEffect(()=>{d||typeof l!="number"||m.current!==null||(m.current=setTimeout(()=>{f(),m.current=null},l))},[l,d,f,...r]),{droppableRects:g,measureDroppableContainers:f,measuringScheduled:i!=null};function w(){switch(u){case Jl.Always:return!1;case Jl.BeforeDragging:return n;default:return!n}}}function zv(e,t){return yc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function K3(e,t){return zv(e,t)}function V3(e){let{callback:t,disabled:n}=e;const r=lh(t),s=x.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return x.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function uh(e){let{callback:t,disabled:n}=e;const r=lh(t),s=x.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return x.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Y3(e){return new Ov(_c(e),e)}function h0(e,t,n){t===void 0&&(t=Y3);const[r,s]=x.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const h=t(e);return JSON.stringify(c)===JSON.stringify(h)?c:h})}const o=V3({callback(c){if(e)for(const u of c){const{type:h,target:d}=u;if(h==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),l=uh({callback:i});return ms(()=>{i(),e?(l==null||l.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),o==null||o.disconnect())},[e]),r}function Q3(e){const t=zv(e);return qS(e,t)}const f0=[];function X3(e){const t=x.useRef(e),n=yc(r=>e?r&&r!==f0&&e&&t.current&&e.parentNode===t.current.parentNode?r:Lv(e):f0,[e]);return x.useEffect(()=>{t.current=e},[e]),n}function G3(e){const[t,n]=x.useState(null),r=x.useRef(e),s=x.useCallback(i=>{const o=df(i.target);o&&n(l=>l?(l.set(o,mm(o)),new Map(l)):null)},[]);return x.useEffect(()=>{const i=r.current;if(e!==i){o(i);const l=e.map(c=>{const u=df(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,mm(u)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{o(e),o(i)};function o(l){l.forEach(c=>{const u=df(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),x.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>Qo(i,o),kr):JS(e):kr,[e,t])}function p0(e,t){t===void 0&&(t=[]);const n=x.useRef(null);return x.useEffect(()=>{n.current=null},t),x.useEffect(()=>{const r=e!==kr;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?jd(e,n.current):kr}function J3(e){x.useEffect(()=>{if(!ah)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Z3(e,t){return x.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=o=>{i(o,t)},n},{}),[e,t])}function tk(e){return x.useMemo(()=>e?k3(e):null,[e])}const m0=[];function eR(e,t){t===void 0&&(t=_c);const[n]=e,r=tk(n?hn(n):null),[s,i]=x.useState(m0);function o(){i(()=>e.length?e.map(c=>XS(c)?r:new Ov(t(c),c)):m0)}const l=uh({callback:o});return ms(()=>{l==null||l.disconnect(),o(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),s}function nk(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return xc(t)?t:e}function tR(e){let{measure:t}=e;const[n,r]=x.useState(null),s=x.useCallback(u=>{for(const{target:h}of u)if(xc(h)){r(d=>{const p=t(h);return d?{...d,width:p.width,height:p.height}:p});break}},[t]),i=uh({callback:s}),o=x.useCallback(u=>{const h=nk(u);i==null||i.disconnect(),h&&(i==null||i.observe(h)),r(h?t(h):null)},[t,i]),[l,c]=Nd(o);return x.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const nR=[{sensor:Fv,options:{}},{sensor:Iv,options:{}}],rR={current:{}},Iu={draggable:{measure:a0},droppable:{measure:a0,strategy:Jl.WhileDragging,frequency:vm.Optimized},dragOverlay:{measure:_c}};class Cl extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const sR={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Cl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Pd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Iu,measureDroppableContainers:Pd,windowRect:null,measuringScheduled:!1},rk={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Pd,draggableNodes:new Map,over:null,measureDroppableContainers:Pd},bc=x.createContext(rk),sk=x.createContext(sR);function iR(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Cl}}}function oR(e,t){switch(t.type){case bt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case bt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case bt.DragEnd:case bt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case bt.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new Cl(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case bt.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Cl(e.droppable.containers);return o.set(n,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case bt.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new Cl(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function aR(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=x.useContext(bc),i=Ed(r),o=Ed(n==null?void 0:n.id);return x.useEffect(()=>{if(!t&&!r&&i&&o!=null){if(!Av(i)||document.activeElement===i.target)return;const l=s.get(o);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const h of[c.current,u.current]){if(!h)continue;const d=e3(h);if(d){d.focus();break}}})}},[r,t,s,o,i]),null}function ik(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...r}),n):n}function lR(e){return x.useMemo(()=>({draggable:{...Iu.draggable,...e==null?void 0:e.draggable},droppable:{...Iu.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Iu.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function cR(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const i=x.useRef(!1),{x:o,y:l}=typeof s=="boolean"?{x:s,y:s}:s;ms(()=>{if(!o&&!l||!t){i.current=!1;return}if(i.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const h=n(u),d=qS(h,r);if(o||(d.x=0),l||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const p=VS(u);p&&p.scrollBy({top:d.y,left:d.x})}},[t,o,l,r,n])}const dh=x.createContext({...kr,scaleX:1,scaleY:1});var Ls;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ls||(Ls={}));const uR=x.memo(function(t){var n,r,s,i;let{id:o,accessibility:l,autoScroll:c=!0,children:u,sensors:h=nR,collisionDetection:d=x3,measuring:p,modifiers:f,...m}=t;const g=x.useReducer(oR,void 0,iR),[w,v]=g,[y,_]=o3(),[b,N]=x.useState(Ls.Uninitialized),k=b===Ls.Initialized,{draggable:{active:j,nodes:D,translate:F},droppable:{containers:P}}=w,O=j!=null?D.get(j):null,T=x.useRef({initial:null,translated:null}),E=x.useMemo(()=>{var Ut;return j!=null?{id:j,data:(Ut=O==null?void 0:O.data)!=null?Ut:rR,rect:T}:null},[j,O]),R=x.useRef(null),[L,$]=x.useState(null),[K,A]=x.useState(null),H=Xl(m,Object.values(m)),S=ch("DndDescribedBy",o),Y=x.useMemo(()=>P.getEnabled(),[P]),B=lR(p),{droppableRects:C,measureDroppableContainers:U,measuringScheduled:I}=q3(Y,{dragging:k,dependencies:[F.x,F.y],config:B.droppable}),q=W3(D,j),z=x.useMemo(()=>K?Rd(K):null,[K]),te=zN(),se=K3(q,B.draggable.measure);cR({activeNode:j!=null?D.get(j):null,config:te.layoutShiftCompensation,initialRect:se,measure:B.draggable.measure});const ye=h0(q,B.draggable.measure,se),De=h0(q?q.parentElement:null),$e=x.useRef({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:C,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),_e=P.getNodeFor((n=$e.current.over)==null?void 0:n.id),ne=tR({measure:B.dragOverlay.measure}),fe=(r=ne.nodeRef.current)!=null?r:q,ke=k?(s=ne.rect)!=null?s:ye:null,Ze=!!(ne.nodeRef.current&&ne.rect),et=Q3(Ze?null:ye),Ct=tk(fe?hn(fe):null),tt=X3(k?_e??q:null),en=eR(tt),jn=ik(f,{transform:{x:F.x-et.x,y:F.y-et.y,scaleX:1,scaleY:1},activatorEvent:K,active:E,activeNodeRect:ye,containerNodeRect:De,draggingNodeRect:ke,over:$e.current.over,overlayNodeRect:ne.rect,scrollableAncestors:tt,scrollableAncestorRects:en,windowRect:Ct}),cr=z?Qo(z,F):null,ur=G3(tt),go=p0(ur),W=p0(ur,[ye]),Z=Qo(jn,go),ue=ke?b3(ke,jn):null,me=E&&ue?d({active:E,collisionRect:ue,droppableRects:C,droppableContainers:Y,pointerCoordinates:cr}):null,Pe=m3(me,"id"),[V,ae]=x.useState(null),Be=Ze?jn:Qo(jn,W),It=y3(Be,(i=V==null?void 0:V.rect)!=null?i:null,ye),mn=x.useRef(null),at=x.useCallback((Ut,Pn)=>{let{sensor:Tn,options:bs}=Pn;if(R.current==null)return;const Kn=D.get(R.current);if(!Kn)return;const Dn=Ut.nativeEvent,Nr=new Tn({active:R.current,activeNode:Kn,event:Dn,options:bs,context:$e,onAbort(Bt){if(!D.get(Bt))return;const{onDragAbort:Er}=H.current,Xr={id:Bt};Er==null||Er(Xr),y({type:"onDragAbort",event:Xr})},onPending(Bt,ws,Er,Xr){if(!D.get(Bt))return;const{onDragPending:La}=H.current,Ss={id:Bt,constraint:ws,initialCoordinates:Er,offset:Xr};La==null||La(Ss),y({type:"onDragPending",event:Ss})},onStart(Bt){const ws=R.current;if(ws==null)return;const Er=D.get(ws);if(!Er)return;const{onDragStart:Xr}=H.current,Aa={activatorEvent:Dn,active:{id:ws,data:Er.data,rect:T}};sr.unstable_batchedUpdates(()=>{Xr==null||Xr(Aa),N(Ls.Initializing),v({type:bt.DragStart,initialCoordinates:Bt,active:ws}),y({type:"onDragStart",event:Aa}),$(mn.current),A(Dn)})},onMove(Bt){v({type:bt.DragMove,coordinates:Bt})},onEnd:vo(bt.DragEnd),onCancel:vo(bt.DragCancel)});mn.current=Nr;function vo(Bt){return async function(){const{active:Er,collisions:Xr,over:Aa,scrollAdjustedTranslate:La}=$e.current;let Ss=null;if(Er&&La){const{cancelDrop:Oa}=H.current;Ss={activatorEvent:Dn,active:Er,collisions:Xr,delta:La,over:Aa},Bt===bt.DragEnd&&typeof Oa=="function"&&await Promise.resolve(Oa(Ss))&&(Bt=bt.DragCancel)}R.current=null,sr.unstable_batchedUpdates(()=>{v({type:Bt}),N(Ls.Uninitialized),ae(null),$(null),A(null),mn.current=null;const Oa=Bt===bt.DragEnd?"onDragEnd":"onDragCancel";if(Ss){const Lh=H.current[Oa];Lh==null||Lh(Ss),y({type:Oa,event:Ss})}})}}},[D]),Rn=x.useCallback((Ut,Pn)=>(Tn,bs)=>{const Kn=Tn.nativeEvent,Dn=D.get(bs);if(R.current!==null||!Dn||Kn.dndKit||Kn.defaultPrevented)return;const Nr={active:Dn};Ut(Tn,Pn.options,Nr)===!0&&(Kn.dndKit={capturedBy:Pn.sensor},R.current=bs,at(Tn,Pn))},[D,at]),Nt=U3(h,Rn);J3(h),ms(()=>{ye&&b===Ls.Initializing&&N(Ls.Initialized)},[ye,b]),x.useEffect(()=>{const{onDragMove:Ut}=H.current,{active:Pn,activatorEvent:Tn,collisions:bs,over:Kn}=$e.current;if(!Pn||!Tn)return;const Dn={active:Pn,activatorEvent:Tn,collisions:bs,delta:{x:Z.x,y:Z.y},over:Kn};sr.unstable_batchedUpdates(()=>{Ut==null||Ut(Dn),y({type:"onDragMove",event:Dn})})},[Z.x,Z.y]),x.useEffect(()=>{const{active:Ut,activatorEvent:Pn,collisions:Tn,droppableContainers:bs,scrollAdjustedTranslate:Kn}=$e.current;if(!Ut||R.current==null||!Pn||!Kn)return;const{onDragOver:Dn}=H.current,Nr=bs.get(Pe),vo=Nr&&Nr.rect.current?{id:Nr.id,rect:Nr.rect.current,data:Nr.data,disabled:Nr.disabled}:null,Bt={active:Ut,activatorEvent:Pn,collisions:Tn,delta:{x:Kn.x,y:Kn.y},over:vo};sr.unstable_batchedUpdates(()=>{ae(vo),Dn==null||Dn(Bt),y({type:"onDragOver",event:Bt})})},[Pe]),ms(()=>{$e.current={activatorEvent:K,active:E,activeNode:q,collisionRect:ue,collisions:me,droppableRects:C,draggableNodes:D,draggingNode:fe,draggingNodeRect:ke,droppableContainers:P,over:V,scrollableAncestors:tt,scrollAdjustedTranslate:Z},T.current={initial:ke,translated:ue}},[E,q,me,ue,D,fe,ke,C,P,V,tt,Z]),z3({...te,delta:F,draggingRect:ue,pointerCoordinates:cr,scrollableAncestors:tt,scrollableAncestorRects:en});const Mc=x.useMemo(()=>({active:E,activeNode:q,activeNodeRect:ye,activatorEvent:K,collisions:me,containerNodeRect:De,dragOverlay:ne,draggableNodes:D,droppableContainers:P,droppableRects:C,over:V,measureDroppableContainers:U,scrollableAncestors:tt,scrollableAncestorRects:en,measuringConfiguration:B,measuringScheduled:I,windowRect:Ct}),[E,q,ye,K,me,De,ne,D,P,C,V,U,tt,en,B,I,Ct]),FN=x.useMemo(()=>({activatorEvent:K,activators:Nt,active:E,activeNodeRect:ye,ariaDescribedById:{draggable:S},dispatch:v,draggableNodes:D,over:V,measureDroppableContainers:U}),[K,Nt,E,ye,v,S,D,V,U]);return qe.createElement(US.Provider,{value:_},qe.createElement(bc.Provider,{value:FN},qe.createElement(sk.Provider,{value:Mc},qe.createElement(dh.Provider,{value:It},u)),qe.createElement(aR,{disabled:(l==null?void 0:l.restoreFocus)===!1})),qe.createElement(c3,{...l,hiddenTextDescribedById:S}));function zN(){const Ut=(L==null?void 0:L.autoScrollEnabled)===!1,Pn=typeof c=="object"?c.enabled===!1:c===!1,Tn=k&&!Ut&&!Pn;return typeof c=="object"?{...c,enabled:Tn}:{enabled:Tn}}}),dR=x.createContext(null),g0="button",hR="Draggable";function fR(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const i=ch(hR),{activators:o,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:h,draggableNodes:d,over:p}=x.useContext(bc),{role:f=g0,roleDescription:m="draggable",tabIndex:g=0}=s??{},w=(c==null?void 0:c.id)===t,v=x.useContext(w?dh:dR),[y,_]=Nd(),[b,N]=Nd(),k=Z3(o,t),j=Xl(n);ms(()=>(d.set(t,{id:t,key:i,node:y,activatorNode:b,data:j}),()=>{const F=d.get(t);F&&F.key===i&&d.delete(t)}),[d,t]);const D=x.useMemo(()=>({role:f,tabIndex:g,"aria-disabled":r,"aria-pressed":w&&f===g0?!0:void 0,"aria-roledescription":m,"aria-describedby":h.draggable}),[r,f,g,w,m,h.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:D,isDragging:w,listeners:r?void 0:k,node:y,over:p,setNodeRef:_,setActivatorNodeRef:N,transform:v}}function pR(){return x.useContext(sk)}const mR="Droppable",gR={timeout:25};function vR(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const i=ch(mR),{active:o,dispatch:l,over:c,measureDroppableContainers:u}=x.useContext(bc),h=x.useRef({disabled:n}),d=x.useRef(!1),p=x.useRef(null),f=x.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:w}={...gR,...s},v=Xl(g??r),y=x.useCallback(()=>{if(!d.current){d.current=!0;return}f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),f.current=null},w)},[w]),_=uh({callback:y,disabled:m||!o}),b=x.useCallback((D,F)=>{_&&(F&&(_.unobserve(F),d.current=!1),D&&_.observe(D))},[_]),[N,k]=Nd(b),j=Xl(t);return x.useEffect(()=>{!_||!N.current||(_.disconnect(),d.current=!1,_.observe(N.current))},[N,_]),x.useEffect(()=>(l({type:bt.RegisterDroppable,element:{id:r,key:i,disabled:n,node:N,rect:p,data:j}}),()=>l({type:bt.UnregisterDroppable,key:i,id:r})),[r]),x.useEffect(()=>{n!==h.current.disabled&&(l({type:bt.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)},[r,i,n,l]),{active:o,rect:p,isOver:(c==null?void 0:c.id)===r,node:N,over:c,setNodeRef:k}}function xR(e){let{animation:t,children:n}=e;const[r,s]=x.useState(null),[i,o]=x.useState(null),l=Ed(n);return!n&&!r&&l&&s(l),ms(()=>{if(!i)return;const c=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(c==null||u==null){s(null);return}Promise.resolve(t(u,i)).then(()=>{s(null)})},[t,r,i]),qe.createElement(qe.Fragment,null,n,r?x.cloneElement(r,{ref:o}):null)}const yR={x:0,y:0,scaleX:1,scaleY:1};function _R(e){let{children:t}=e;return qe.createElement(bc.Provider,{value:rk},qe.createElement(dh.Provider,{value:yR},t))}const bR={position:"fixed",touchAction:"none"},wR=e=>Av(e)?"transform 250ms ease":void 0,SR=x.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:s,children:i,className:o,rect:l,style:c,transform:u,transition:h=wR}=e;if(!l)return null;const d=s?u:{...u,scaleX:1,scaleY:1},p={...bR,width:l.width,height:l.height,top:l.top,left:l.left,transform:Gl.Transform.toString(d),transformOrigin:s&&r?h3(r,l):void 0,transition:typeof h=="function"?h(r):h,...c};return qe.createElement(n,{className:o,style:p,ref:t},i)}),ok=e=>t=>{let{active:n,dragOverlay:r}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[l,c]of Object.entries(i.active))c!==void 0&&(s[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,c));if(i!=null&&i.dragOverlay)for(const[l,c]of Object.entries(i.dragOverlay))c!==void 0&&r.node.style.setProperty(l,c);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[c,u]of Object.entries(s))n.node.style.setProperty(c,u);o!=null&&o.active&&n.node.classList.remove(o.active)}},kR=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Gl.Transform.toString(t)},{transform:Gl.Transform.toString(n)}]},CR={duration:250,easing:"ease",keyframes:kR,sideEffects:ok({styles:{active:{opacity:"0"}}})};function NR(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=e;return lh((i,o)=>{if(t===null)return;const l=n.get(i);if(!l)return;const c=l.node.current;if(!c)return;const u=nk(o);if(!u)return;const{transform:h}=hn(o).getComputedStyle(o),d=KS(h);if(!d)return;const p=typeof t=="function"?t:ER(t);return ZS(c,s.draggable.measure),p({active:{id:i,data:l.data,node:c,rect:s.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:o,rect:s.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:s,transform:d})})}function ER(e){const{duration:t,easing:n,sideEffects:r,keyframes:s}={...CR,...e};return i=>{let{active:o,dragOverlay:l,transform:c,...u}=i;if(!t)return;const h={x:l.rect.left-o.rect.left,y:l.rect.top-o.rect.top},d={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/l.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/l.rect.height:1},p={x:c.x-h.x,y:c.y-h.y,...d},f=s({...u,active:o,dragOverlay:l,transform:{initial:c,final:p}}),[m]=f,g=f[f.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const w=r==null?void 0:r({active:o,dragOverlay:l,...u}),v=l.node.animate(f,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{v.onfinish=()=>{w==null||w(),y()}})}}let v0=0;function jR(e){return x.useMemo(()=>{if(e!=null)return v0++,v0},[e])}const RR=qe.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:s,transition:i,modifiers:o,wrapperElement:l="div",className:c,zIndex:u=999}=e;const{activatorEvent:h,active:d,activeNodeRect:p,containerNodeRect:f,draggableNodes:m,droppableContainers:g,dragOverlay:w,over:v,measuringConfiguration:y,scrollableAncestors:_,scrollableAncestorRects:b,windowRect:N}=pR(),k=x.useContext(dh),j=jR(d==null?void 0:d.id),D=ik(o,{activatorEvent:h,active:d,activeNodeRect:p,containerNodeRect:f,draggingNodeRect:w.rect,over:v,overlayNodeRect:w.rect,scrollableAncestors:_,scrollableAncestorRects:b,transform:k,windowRect:N}),F=zv(p),P=NR({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:y}),O=F?w.setRef:void 0;return qe.createElement(_R,null,qe.createElement(xR,{animation:P},d&&j?qe.createElement(SR,{key:j,id:d.id,ref:O,as:l,activatorEvent:h,adjustScale:t,className:c,transition:i,rect:F,style:{zIndex:u,...s},transform:D},n):null))}),x0=["backlog","todo","planning","in_progress","in_review","done"],Tt={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"};/**
45
- * @license lucide-react v0.400.0 - ISC
46
- *
47
- * This source code is licensed under the ISC license.
48
- * See the LICENSE file in the root directory of this source tree.
49
- */const PR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ak=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/**
50
- * @license lucide-react v0.400.0 - ISC
51
- *
52
- * This source code is licensed under the ISC license.
53
- * See the LICENSE file in the root directory of this source tree.
54
- */var TR={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"};/**
55
- * @license lucide-react v0.400.0 - ISC
56
- *
57
- * This source code is licensed under the ISC license.
58
- * See the LICENSE file in the root directory of this source tree.
59
- */const DR=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>x.createElement("svg",{ref:c,...TR,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ak("lucide",s),...l},[...o.map(([u,h])=>x.createElement(u,h)),...Array.isArray(i)?i:[i]]));/**
60
- * @license lucide-react v0.400.0 - ISC
61
- *
62
- * This source code is licensed under the ISC license.
63
- * See the LICENSE file in the root directory of this source tree.
64
- */const oe=(e,t)=>{const n=x.forwardRef(({className:r,...s},i)=>x.createElement(DR,{ref:i,iconNode:t,className:ak(`lucide-${PR(e)}`,r),...s}));return n.displayName=`${e}`,n};/**
65
- * @license lucide-react v0.400.0 - ISC
66
- *
67
- * This source code is licensed under the ISC license.
68
- * See the LICENSE file in the root directory of this source tree.
69
- */const va=oe("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"}]]);/**
70
- * @license lucide-react v0.400.0 - ISC
71
- *
72
- * This source code is licensed under the ISC license.
73
- * See the LICENSE file in the root directory of this source tree.
74
- */const $v=oe("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"}]]);/**
75
- * @license lucide-react v0.400.0 - ISC
76
- *
77
- * This source code is licensed under the ISC license.
78
- * See the LICENSE file in the root directory of this source tree.
79
- */const xm=oe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
80
- * @license lucide-react v0.400.0 - ISC
81
- *
82
- * This source code is licensed under the ISC license.
83
- * See the LICENSE file in the root directory of this source tree.
84
- */const MR=oe("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"}]]);/**
85
- * @license lucide-react v0.400.0 - ISC
86
- *
87
- * This source code is licensed under the ISC license.
88
- * See the LICENSE file in the root directory of this source tree.
89
- */const AR=oe("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"}]]);/**
90
- * @license lucide-react v0.400.0 - ISC
91
- *
92
- * This source code is licensed under the ISC license.
93
- * See the LICENSE file in the root directory of this source tree.
94
- */const lk=oe("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"}]]);/**
95
- * @license lucide-react v0.400.0 - ISC
96
- *
97
- * This source code is licensed under the ISC license.
98
- * See the LICENSE file in the root directory of this source tree.
99
- */const ck=oe("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"}]]);/**
100
- * @license lucide-react v0.400.0 - ISC
101
- *
102
- * This source code is licensed under the ISC license.
103
- * See the LICENSE file in the root directory of this source tree.
104
- */const y0=oe("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"}]]);/**
105
- * @license lucide-react v0.400.0 - ISC
106
- *
107
- * This source code is licensed under the ISC license.
108
- * See the LICENSE file in the root directory of this source tree.
109
- */const Hv=oe("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"}]]);/**
110
- * @license lucide-react v0.400.0 - ISC
111
- *
112
- * This source code is licensed under the ISC license.
113
- * See the LICENSE file in the root directory of this source tree.
114
- */const LR=oe("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"}]]);/**
115
- * @license lucide-react v0.400.0 - ISC
116
- *
117
- * This source code is licensed under the ISC license.
118
- * See the LICENSE file in the root directory of this source tree.
119
- */const OR=oe("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
120
- * @license lucide-react v0.400.0 - ISC
121
- *
122
- * This source code is licensed under the ISC license.
123
- * See the LICENSE file in the root directory of this source tree.
124
- */const Nl=oe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
125
- * @license lucide-react v0.400.0 - ISC
126
- *
127
- * This source code is licensed under the ISC license.
128
- * See the LICENSE file in the root directory of this source tree.
129
- */const uk=oe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
130
- * @license lucide-react v0.400.0 - ISC
131
- *
132
- * This source code is licensed under the ISC license.
133
- * See the LICENSE file in the root directory of this source tree.
134
- */const Wv=oe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
135
- * @license lucide-react v0.400.0 - ISC
136
- *
137
- * This source code is licensed under the ISC license.
138
- * See the LICENSE file in the root directory of this source tree.
139
- */const to=oe("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"}]]);/**
140
- * @license lucide-react v0.400.0 - ISC
141
- *
142
- * This source code is licensed under the ISC license.
143
- * See the LICENSE file in the root directory of this source tree.
144
- */const mi=oe("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"}]]);/**
145
- * @license lucide-react v0.400.0 - ISC
146
- *
147
- * This source code is licensed under the ISC license.
148
- * See the LICENSE file in the root directory of this source tree.
149
- */const Ri=oe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
150
- * @license lucide-react v0.400.0 - ISC
151
- *
152
- * This source code is licensed under the ISC license.
153
- * See the LICENSE file in the root directory of this source tree.
154
- */const IR=oe("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"}]]);/**
155
- * @license lucide-react v0.400.0 - ISC
156
- *
157
- * This source code is licensed under the ISC license.
158
- * See the LICENSE file in the root directory of this source tree.
159
- */const BR=oe("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{width:"6",height:"6",x:"9",y:"9",key:"1wrtvo"}]]);/**
160
- * @license lucide-react v0.400.0 - ISC
161
- *
162
- * This source code is licensed under the ISC license.
163
- * See the LICENSE file in the root directory of this source tree.
164
- */const wc=oe("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"}]]);/**
165
- * @license lucide-react v0.400.0 - ISC
166
- *
167
- * This source code is licensed under the ISC license.
168
- * See the LICENSE file in the root directory of this source tree.
169
- */const dk=oe("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
170
- * @license lucide-react v0.400.0 - ISC
171
- *
172
- * This source code is licensed under the ISC license.
173
- * See the LICENSE file in the root directory of this source tree.
174
- */const FR=oe("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
175
- * @license lucide-react v0.400.0 - ISC
176
- *
177
- * This source code is licensed under the ISC license.
178
- * See the LICENSE file in the root directory of this source tree.
179
- */const xa=oe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
180
- * @license lucide-react v0.400.0 - ISC
181
- *
182
- * This source code is licensed under the ISC license.
183
- * See the LICENSE file in the root directory of this source tree.
184
- */const ym=oe("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
185
- * @license lucide-react v0.400.0 - ISC
186
- *
187
- * This source code is licensed under the ISC license.
188
- * See the LICENSE file in the root directory of this source tree.
189
- */const hk=oe("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
190
- * @license lucide-react v0.400.0 - ISC
191
- *
192
- * This source code is licensed under the ISC license.
193
- * See the LICENSE file in the root directory of this source tree.
194
- */const zR=oe("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"}]]);/**
195
- * @license lucide-react v0.400.0 - ISC
196
- *
197
- * This source code is licensed under the ISC license.
198
- * See the LICENSE file in the root directory of this source tree.
199
- */const fk=oe("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"}]]);/**
200
- * @license lucide-react v0.400.0 - ISC
201
- *
202
- * This source code is licensed under the ISC license.
203
- * See the LICENSE file in the root directory of this source tree.
204
- */const $R=oe("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"}]]);/**
205
- * @license lucide-react v0.400.0 - ISC
206
- *
207
- * This source code is licensed under the ISC license.
208
- * See the LICENSE file in the root directory of this source tree.
209
- */const uo=oe("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"}]]);/**
210
- * @license lucide-react v0.400.0 - ISC
211
- *
212
- * This source code is licensed under the ISC license.
213
- * See the LICENSE file in the root directory of this source tree.
214
- */const gs=oe("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"}]]);/**
215
- * @license lucide-react v0.400.0 - ISC
216
- *
217
- * This source code is licensed under the ISC license.
218
- * See the LICENSE file in the root directory of this source tree.
219
- */const hh=oe("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"}]]);/**
220
- * @license lucide-react v0.400.0 - ISC
221
- *
222
- * This source code is licensed under the ISC license.
223
- * See the LICENSE file in the root directory of this source tree.
224
- */const li=oe("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"}]]);/**
225
- * @license lucide-react v0.400.0 - ISC
226
- *
227
- * This source code is licensed under the ISC license.
228
- * See the LICENSE file in the root directory of this source tree.
229
- */const HR=oe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
230
- * @license lucide-react v0.400.0 - ISC
231
- *
232
- * This source code is licensed under the ISC license.
233
- * See the LICENSE file in the root directory of this source tree.
234
- */const _0=oe("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"}]]);/**
235
- * @license lucide-react v0.400.0 - ISC
236
- *
237
- * This source code is licensed under the ISC license.
238
- * See the LICENSE file in the root directory of this source tree.
239
- */const _m=oe("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"}]]);/**
240
- * @license lucide-react v0.400.0 - ISC
241
- *
242
- * This source code is licensed under the ISC license.
243
- * See the LICENSE file in the root directory of this source tree.
244
- */const pk=oe("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"}]]);/**
245
- * @license lucide-react v0.400.0 - ISC
246
- *
247
- * This source code is licensed under the ISC license.
248
- * See the LICENSE file in the root directory of this source tree.
249
- */const Uv=oe("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"}]]);/**
250
- * @license lucide-react v0.400.0 - ISC
251
- *
252
- * This source code is licensed under the ISC license.
253
- * See the LICENSE file in the root directory of this source tree.
254
- */const b0=oe("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"}]]);/**
255
- * @license lucide-react v0.400.0 - ISC
256
- *
257
- * This source code is licensed under the ISC license.
258
- * See the LICENSE file in the root directory of this source tree.
259
- */const mk=oe("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"}]]);/**
260
- * @license lucide-react v0.400.0 - ISC
261
- *
262
- * This source code is licensed under the ISC license.
263
- * See the LICENSE file in the root directory of this source tree.
264
- */const WR=oe("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"}]]);/**
265
- * @license lucide-react v0.400.0 - ISC
266
- *
267
- * This source code is licensed under the ISC license.
268
- * See the LICENSE file in the root directory of this source tree.
269
- */const gk=oe("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
270
- * @license lucide-react v0.400.0 - ISC
271
- *
272
- * This source code is licensed under the ISC license.
273
- * See the LICENSE file in the root directory of this source tree.
274
- */const ci=oe("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"}]]);/**
275
- * @license lucide-react v0.400.0 - ISC
276
- *
277
- * This source code is licensed under the ISC license.
278
- * See the LICENSE file in the root directory of this source tree.
279
- */const je=oe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
280
- * @license lucide-react v0.400.0 - ISC
281
- *
282
- * This source code is licensed under the ISC license.
283
- * See the LICENSE file in the root directory of this source tree.
284
- */const UR=oe("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"}]]);/**
285
- * @license lucide-react v0.400.0 - ISC
286
- *
287
- * This source code is licensed under the ISC license.
288
- * See the LICENSE file in the root directory of this source tree.
289
- */const qR=oe("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
290
- * @license lucide-react v0.400.0 - ISC
291
- *
292
- * This source code is licensed under the ISC license.
293
- * See the LICENSE file in the root directory of this source tree.
294
- */const KR=oe("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"}]]);/**
295
- * @license lucide-react v0.400.0 - ISC
296
- *
297
- * This source code is licensed under the ISC license.
298
- * See the LICENSE file in the root directory of this source tree.
299
- */const bm=oe("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
300
- * @license lucide-react v0.400.0 - ISC
301
- *
302
- * This source code is licensed under the ISC license.
303
- * See the LICENSE file in the root directory of this source tree.
304
- */const VR=oe("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
305
- * @license lucide-react v0.400.0 - ISC
306
- *
307
- * This source code is licensed under the ISC license.
308
- * See the LICENSE file in the root directory of this source tree.
309
- */const YR=oe("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
310
- * @license lucide-react v0.400.0 - ISC
311
- *
312
- * This source code is licensed under the ISC license.
313
- * See the LICENSE file in the root directory of this source tree.
314
- */const QR=oe("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
315
- * @license lucide-react v0.400.0 - ISC
316
- *
317
- * This source code is licensed under the ISC license.
318
- * See the LICENSE file in the root directory of this source tree.
319
- */const Sn=oe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
320
- * @license lucide-react v0.400.0 - ISC
321
- *
322
- * This source code is licensed under the ISC license.
323
- * See the LICENSE file in the root directory of this source tree.
324
- */const XR=oe("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
325
- * @license lucide-react v0.400.0 - ISC
326
- *
327
- * This source code is licensed under the ISC license.
328
- * See the LICENSE file in the root directory of this source tree.
329
- */const Gs=oe("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"}]]);/**
330
- * @license lucide-react v0.400.0 - ISC
331
- *
332
- * This source code is licensed under the ISC license.
333
- * See the LICENSE file in the root directory of this source tree.
334
- */const fh=oe("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"}]]);/**
335
- * @license lucide-react v0.400.0 - ISC
336
- *
337
- * This source code is licensed under the ISC license.
338
- * See the LICENSE file in the root directory of this source tree.
339
- */const GR=oe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
340
- * @license lucide-react v0.400.0 - ISC
341
- *
342
- * This source code is licensed under the ISC license.
343
- * See the LICENSE file in the root directory of this source tree.
344
- */const vk=oe("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
345
- * @license lucide-react v0.400.0 - ISC
346
- *
347
- * This source code is licensed under the ISC license.
348
- * See the LICENSE file in the root directory of this source tree.
349
- */const xk=oe("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"}]]);/**
350
- * @license lucide-react v0.400.0 - ISC
351
- *
352
- * This source code is licensed under the ISC license.
353
- * See the LICENSE file in the root directory of this source tree.
354
- */const wm=oe("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"}]]);/**
355
- * @license lucide-react v0.400.0 - ISC
356
- *
357
- * This source code is licensed under the ISC license.
358
- * See the LICENSE file in the root directory of this source tree.
359
- */const Zl=oe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
360
- * @license lucide-react v0.400.0 - ISC
361
- *
362
- * This source code is licensed under the ISC license.
363
- * See the LICENSE file in the root directory of this source tree.
364
- */const JR=oe("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
365
- * @license lucide-react v0.400.0 - ISC
366
- *
367
- * This source code is licensed under the ISC license.
368
- * See the LICENSE file in the root directory of this source tree.
369
- */const yk=oe("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"}]]);/**
370
- * @license lucide-react v0.400.0 - ISC
371
- *
372
- * This source code is licensed under the ISC license.
373
- * See the LICENSE file in the root directory of this source tree.
374
- */const no=oe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
375
- * @license lucide-react v0.400.0 - ISC
376
- *
377
- * This source code is licensed under the ISC license.
378
- * See the LICENSE file in the root directory of this source tree.
379
- */const _k=oe("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"}]]);/**
380
- * @license lucide-react v0.400.0 - ISC
381
- *
382
- * This source code is licensed under the ISC license.
383
- * See the LICENSE file in the root directory of this source tree.
384
- */const qv=oe("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"}]]);/**
385
- * @license lucide-react v0.400.0 - ISC
386
- *
387
- * This source code is licensed under the ISC license.
388
- * See the LICENSE file in the root directory of this source tree.
389
- */const Wn=oe("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"}]]);/**
390
- * @license lucide-react v0.400.0 - ISC
391
- *
392
- * This source code is licensed under the ISC license.
393
- * See the LICENSE file in the root directory of this source tree.
394
- */const bk=oe("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/**
395
- * @license lucide-react v0.400.0 - ISC
396
- *
397
- * This source code is licensed under the ISC license.
398
- * See the LICENSE file in the root directory of this source tree.
399
- */const wk=oe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
400
- * @license lucide-react v0.400.0 - ISC
401
- *
402
- * This source code is licensed under the ISC license.
403
- * See the LICENSE file in the root directory of this source tree.
404
- */const Sk=oe("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"}]]);/**
405
- * @license lucide-react v0.400.0 - ISC
406
- *
407
- * This source code is licensed under the ISC license.
408
- * See the LICENSE file in the root directory of this source tree.
409
- */const ec=oe("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"}]]);/**
410
- * @license lucide-react v0.400.0 - ISC
411
- *
412
- * This source code is licensed under the ISC license.
413
- * See the LICENSE file in the root directory of this source tree.
414
- */const mt=oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
415
- * @license lucide-react v0.400.0 - ISC
416
- *
417
- * This source code is licensed under the ISC license.
418
- * See the LICENSE file in the root directory of this source tree.
419
- */const ZR=oe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var ph={exports:{}},kk={},Ck={exports:{}},eP="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",tP=eP,nP=tP;function Nk(){}function Ek(){}Ek.resetWarningCache=Nk;var rP=function(){function e(r,s,i,o,l,c){if(c!==nP){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Ek,resetWarningCache:Nk};return n.PropTypes=n,n};Ck.exports=rP();var jk=Ck.exports;function Rk(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Rk(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function w0(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Rk(e))&&(r&&(r+=" "),r+=t);return r}const sP=Object.freeze(Object.defineProperty({__proto__:null,clsx:w0,default:w0},Symbol.toStringTag,{value:"Module"})),iP=HN(sP);var it={},Vr={};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.dontSetMe=uP;Vr.findInArray=oP;Vr.int=cP;Vr.isFunction=aP;Vr.isNum=lP;function oP(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function aP(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function lP(e){return typeof e=="number"&&!isNaN(e)}function cP(e){return parseInt(e,10)}function uP(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))}var ho={};Object.defineProperty(ho,"__esModule",{value:!0});ho.browserPrefixToKey=Tk;ho.browserPrefixToStyle=dP;ho.default=void 0;ho.getPrefix=Pk;const pf=["Moz","Webkit","O","ms"];function Pk(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!n||t in n)return"";for(let r=0;r<pf.length;r++)if(Tk(t,pf[r])in n)return pf[r];return""}function Tk(e,t){return t?"".concat(t).concat(hP(e)):e}function dP(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function hP(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]==="-"?n=!0:t+=e[r];return t}ho.default=Pk();Object.defineProperty(it,"__esModule",{value:!0});it.addClassName=Ak;it.addEvent=mP;it.addUserSelectStyles=NP;it.createCSSTransform=wP;it.createSVGTransform=SP;it.getTouch=kP;it.getTouchIdentifier=CP;it.getTranslation=Kv;it.innerHeight=yP;it.innerWidth=_P;it.matchesSelector=Mk;it.matchesSelectorAndParentsTo=pP;it.offsetXYFromParent=bP;it.outerHeight=vP;it.outerWidth=xP;it.removeClassName=Lk;it.removeEvent=gP;it.removeUserSelectStyles=EP;var zn=Vr,S0=fP(ho);function Dk(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Dk=function(r){return r?n:t})(e)}function fP(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Dk(t);if(n&&n.has(e))return n.get(e);var r={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var o=s?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(r,i,o):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}let Zc="";function Mk(e,t){return Zc||(Zc=(0,zn.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,zn.isFunction)(e[n])})),(0,zn.isFunction)(e[Zc])?e[Zc](t):!1}function pP(e,t,n){let r=e;do{if(Mk(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function mP(e,t,n,r){if(!e)return;const s={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,s):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function gP(e,t,n,r){if(!e)return;const s={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,s):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function vP(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,zn.int)(n.borderTopWidth),t+=(0,zn.int)(n.borderBottomWidth),t}function xP(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,zn.int)(n.borderLeftWidth),t+=(0,zn.int)(n.borderRightWidth),t}function yP(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,zn.int)(n.paddingTop),t-=(0,zn.int)(n.paddingBottom),t}function _P(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,zn.int)(n.paddingLeft),t-=(0,zn.int)(n.paddingRight),t}function bP(e,t,n){const s=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),i=(e.clientX+t.scrollLeft-s.left)/n,o=(e.clientY+t.scrollTop-s.top)/n;return{x:i,y:o}}function wP(e,t){const n=Kv(e,t,"px");return{[(0,S0.browserPrefixToKey)("transform",S0.default)]:n}}function SP(e,t){return Kv(e,t,"")}function Kv(e,t,n){let{x:r,y:s}=e,i="translate(".concat(r).concat(n,",").concat(s).concat(n,")");if(t){const o="".concat(typeof t.x=="string"?t.x:t.x+n),l="".concat(typeof t.y=="string"?t.y:t.y+n);i="translate(".concat(o,", ").concat(l,")")+i}return i}function kP(e,t){return e.targetTouches&&(0,zn.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,zn.findInArray)(e.changedTouches,n=>t===n.identifier)}function CP(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function NP(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;}
420
- `,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
421
- `,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&Ak(e.body,"react-draggable-transparent-selection")}function EP(e){if(e)try{if(e.body&&Lk(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 Ak(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Lk(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.canDragX=PP;Yr.canDragY=TP;Yr.createCoreData=MP;Yr.createDraggableData=AP;Yr.getBoundPosition=jP;Yr.getControlPosition=DP;Yr.snapToGrid=RP;var Ln=Vr,$o=it;function jP(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:LP(r);const s=Vv(e);if(typeof r=="string"){const{ownerDocument:i}=s,o=i.defaultView;let l;if(r==="parent"?l=s.parentNode:l=i.querySelector(r),!(l instanceof o.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const c=l,u=o.getComputedStyle(s),h=o.getComputedStyle(c);r={left:-s.offsetLeft+(0,Ln.int)(h.paddingLeft)+(0,Ln.int)(u.marginLeft),top:-s.offsetTop+(0,Ln.int)(h.paddingTop)+(0,Ln.int)(u.marginTop),right:(0,$o.innerWidth)(c)-(0,$o.outerWidth)(s)-s.offsetLeft+(0,Ln.int)(h.paddingRight)-(0,Ln.int)(u.marginRight),bottom:(0,$o.innerHeight)(c)-(0,$o.outerHeight)(s)-s.offsetTop+(0,Ln.int)(h.paddingBottom)-(0,Ln.int)(u.marginBottom)}}return(0,Ln.isNum)(r.right)&&(t=Math.min(t,r.right)),(0,Ln.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,Ln.isNum)(r.left)&&(t=Math.max(t,r.left)),(0,Ln.isNum)(r.top)&&(n=Math.max(n,r.top)),[t,n]}function RP(e,t,n){const r=Math.round(t/e[0])*e[0],s=Math.round(n/e[1])*e[1];return[r,s]}function PP(e){return e.props.axis==="both"||e.props.axis==="x"}function TP(e){return e.props.axis==="both"||e.props.axis==="y"}function DP(e,t,n){const r=typeof t=="number"?(0,$o.getTouch)(e,t):null;if(typeof t=="number"&&!r)return null;const s=Vv(n),i=n.props.offsetParent||s.offsetParent||s.ownerDocument.body;return(0,$o.offsetXYFromParent)(r||e,i,n.props.scale)}function MP(e,t,n){const r=!(0,Ln.isNum)(e.lastX),s=Vv(e);return r?{node:s,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:s,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function AP(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function LP(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Vv(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var mh={},gh={};Object.defineProperty(gh,"__esModule",{value:!0});gh.default=OP;function OP(){}Object.defineProperty(mh,"__esModule",{value:!0});mh.default=void 0;var mf=BP(x),gn=Yv(jk),IP=Yv(sr),Vt=it,Cs=Yr,gf=Vr,qa=Yv(gh);function Yv(e){return e&&e.__esModule?e:{default:e}}function Ok(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Ok=function(r){return r?n:t})(e)}function BP(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Ok(t);if(n&&n.has(e))return n.get(e);var r={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var o=s?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(r,i,o):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function nn(e,t,n){return t=FP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function FP(e){var t=zP(e,"string");return typeof t=="symbol"?t:String(t)}function zP(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const hr={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Ns=hr.mouse,vh=class extends mf.Component{constructor(){super(...arguments),nn(this,"dragging",!1),nn(this,"lastX",NaN),nn(this,"lastY",NaN),nn(this,"touchIdentifier",null),nn(this,"mounted",!1),nn(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=n;if(this.props.disabled||!(t.target instanceof r.defaultView.Node)||this.props.handle&&!(0,Vt.matchesSelectorAndParentsTo)(t.target,this.props.handle,n)||this.props.cancel&&(0,Vt.matchesSelectorAndParentsTo)(t.target,this.props.cancel,n))return;t.type==="touchstart"&&t.preventDefault();const s=(0,Vt.getTouchIdentifier)(t);this.touchIdentifier=s;const i=(0,Cs.getControlPosition)(t,s,this);if(i==null)return;const{x:o,y:l}=i,c=(0,Cs.createCoreData)(this,o,l);(0,qa.default)("DraggableCore: handleDragStart: %j",c),(0,qa.default)("calling",this.props.onStart),!(this.props.onStart(t,c)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,Vt.addUserSelectStyles)(r),this.dragging=!0,this.lastX=o,this.lastY=l,(0,Vt.addEvent)(r,Ns.move,this.handleDrag),(0,Vt.addEvent)(r,Ns.stop,this.handleDragStop))}),nn(this,"handleDrag",t=>{const n=(0,Cs.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:s}=n;if(Array.isArray(this.props.grid)){let l=r-this.lastX,c=s-this.lastY;if([l,c]=(0,Cs.snapToGrid)(this.props.grid,l,c),!l&&!c)return;r=this.lastX+l,s=this.lastY+c}const i=(0,Cs.createCoreData)(this,r,s);if((0,qa.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(t,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const c=document.createEvent("MouseEvents");c.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(c)}return}this.lastX=r,this.lastY=s}),nn(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,Cs.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:s}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX||0,u=s-this.lastY||0;[c,u]=(0,Cs.snapToGrid)(this.props.grid,c,u),r=this.lastX+c,s=this.lastY+u}const i=(0,Cs.createCoreData)(this,r,s);if(this.props.onStop(t,i)===!1||this.mounted===!1)return!1;const l=this.findDOMNode();l&&this.props.enableUserSelectHack&&(0,Vt.removeUserSelectStyles)(l.ownerDocument),(0,qa.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,l&&((0,qa.default)("DraggableCore: Removing handlers"),(0,Vt.removeEvent)(l.ownerDocument,Ns.move,this.handleDrag),(0,Vt.removeEvent)(l.ownerDocument,Ns.stop,this.handleDragStop))}),nn(this,"onMouseDown",t=>(Ns=hr.mouse,this.handleDragStart(t))),nn(this,"onMouseUp",t=>(Ns=hr.mouse,this.handleDragStop(t))),nn(this,"onTouchStart",t=>(Ns=hr.touch,this.handleDragStart(t))),nn(this,"onTouchEnd",t=>(Ns=hr.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,Vt.addEvent)(t,hr.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,Vt.removeEvent)(n,hr.mouse.move,this.handleDrag),(0,Vt.removeEvent)(n,hr.touch.move,this.handleDrag),(0,Vt.removeEvent)(n,hr.mouse.stop,this.handleDragStop),(0,Vt.removeEvent)(n,hr.touch.stop,this.handleDragStop),(0,Vt.removeEvent)(t,hr.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Vt.removeUserSelectStyles)(n)}}findDOMNode(){var t,n;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:IP.default.findDOMNode(this)}render(){return mf.cloneElement(mf.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};mh.default=vh;nn(vh,"displayName","DraggableCore");nn(vh,"propTypes",{allowAnyClick:gn.default.bool,children:gn.default.node.isRequired,disabled:gn.default.bool,enableUserSelectHack:gn.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:gn.default.arrayOf(gn.default.number),handle:gn.default.string,cancel:gn.default.string,nodeRef:gn.default.object,onStart:gn.default.func,onDrag:gn.default.func,onStop:gn.default.func,onMouseDown:gn.default.func,scale:gn.default.number,className:gf.dontSetMe,style:gf.dontSetMe,transform:gf.dontSetMe});nn(vh,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return c.default}}),e.default=void 0;var t=p(x),n=h(jk),r=h(sr),s=h(iP),i=it,o=Yr,l=Vr,c=h(mh),u=h(gh);function h(y){return y&&y.__esModule?y:{default:y}}function d(y){if(typeof WeakMap!="function")return null;var _=new WeakMap,b=new WeakMap;return(d=function(N){return N?b:_})(y)}function p(y,_){if(y&&y.__esModule)return y;if(y===null||typeof y!="object"&&typeof y!="function")return{default:y};var b=d(_);if(b&&b.has(y))return b.get(y);var N={},k=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var j in y)if(j!=="default"&&Object.prototype.hasOwnProperty.call(y,j)){var D=k?Object.getOwnPropertyDescriptor(y,j):null;D&&(D.get||D.set)?Object.defineProperty(N,j,D):N[j]=y[j]}return N.default=y,b&&b.set(y,N),N}function f(){return f=Object.assign?Object.assign.bind():function(y){for(var _=1;_<arguments.length;_++){var b=arguments[_];for(var N in b)Object.prototype.hasOwnProperty.call(b,N)&&(y[N]=b[N])}return y},f.apply(this,arguments)}function m(y,_,b){return _=g(_),_ in y?Object.defineProperty(y,_,{value:b,enumerable:!0,configurable:!0,writable:!0}):y[_]=b,y}function g(y){var _=w(y,"string");return typeof _=="symbol"?_:String(_)}function w(y,_){if(typeof y!="object"||y===null)return y;var b=y[Symbol.toPrimitive];if(b!==void 0){var N=b.call(y,_);if(typeof N!="object")return N;throw new TypeError("@@toPrimitive must return a primitive value.")}return(_==="string"?String:Number)(y)}class v extends t.Component{static getDerivedStateFromProps(_,b){let{position:N}=_,{prevPropsPosition:k}=b;return N&&(!k||N.x!==k.x||N.y!==k.y)?((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:N,prevPropsPosition:k}),{x:N.x,y:N.y,prevPropsPosition:{...N}}):null}constructor(_){super(_),m(this,"onDragStart",(b,N)=>{if((0,u.default)("Draggable: onDragStart: %j",N),this.props.onStart(b,(0,o.createDraggableData)(this,N))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),m(this,"onDrag",(b,N)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",N);const k=(0,o.createDraggableData)(this,N),j={x:k.x,y:k.y,slackX:0,slackY:0};if(this.props.bounds){const{x:F,y:P}=j;j.x+=this.state.slackX,j.y+=this.state.slackY;const[O,T]=(0,o.getBoundPosition)(this,j.x,j.y);j.x=O,j.y=T,j.slackX=this.state.slackX+(F-j.x),j.slackY=this.state.slackY+(P-j.y),k.x=j.x,k.y=j.y,k.deltaX=j.x-this.state.x,k.deltaY=j.y-this.state.y}if(this.props.onDrag(b,k)===!1)return!1;this.setState(j)}),m(this,"onDragStop",(b,N)=>{if(!this.state.dragging||this.props.onStop(b,(0,o.createDraggableData)(this,N))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",N);const j={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:F,y:P}=this.props.position;j.x=F,j.y=P}this.setState(j)}),this.state={dragging:!1,dragged:!1,x:_.position?_.position.x:_.defaultPosition.x,y:_.position?_.position.y:_.defaultPosition.y,prevPropsPosition:{..._.position},slackX:0,slackY:0,isElementSVG:!1},_.position&&!(_.onDrag||_.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var _,b;return(_=(b=this.props)===null||b===void 0||(b=b.nodeRef)===null||b===void 0?void 0:b.current)!==null&&_!==void 0?_:r.default.findDOMNode(this)}render(){const{axis:_,bounds:b,children:N,defaultPosition:k,defaultClassName:j,defaultClassNameDragging:D,defaultClassNameDragged:F,position:P,positionOffset:O,scale:T,...E}=this.props;let R={},L=null;const K=!!!P||this.state.dragging,A=P||k,H={x:(0,o.canDragX)(this)&&K?this.state.x:A.x,y:(0,o.canDragY)(this)&&K?this.state.y:A.y};this.state.isElementSVG?L=(0,i.createSVGTransform)(H,O):R=(0,i.createCSSTransform)(H,O);const S=(0,s.default)(N.props.className||"",j,{[D]:this.state.dragging,[F]:this.state.dragged});return t.createElement(c.default,f({},E,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(N),{className:S,style:{...N.props.style,...R},transform:L}))}}e.default=v,m(v,"displayName","Draggable"),m(v,"propTypes",{...c.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),m(v,"defaultProps",{...c.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(kk);const{default:Ik,DraggableCore:$P}=kk;ph.exports=Ik;ph.exports.default=Ik;ph.exports.DraggableCore=$P;var HP=ph.exports;const WP=wa(HP);var ut=function(){return ut=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},ut.apply(this,arguments)},k0={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},C0={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},eu={width:"20px",height:"20px",position:"absolute",zIndex:1},UP={top:ut(ut({},k0),{top:"-5px"}),right:ut(ut({},C0),{left:void 0,right:"-5px"}),bottom:ut(ut({},k0),{top:void 0,bottom:"-5px"}),left:ut(ut({},C0),{left:"-5px"}),topRight:ut(ut({},eu),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:ut(ut({},eu),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:ut(ut({},eu),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:ut(ut({},eu),{left:"-10px",top:"-10px",cursor:"nw-resize"})},qP=x.memo(function(e){var t=e.onResizeStart,n=e.direction,r=e.children,s=e.replaceStyles,i=e.className,o=x.useCallback(function(u){t(u,n)},[t,n]),l=x.useCallback(function(u){t(u,n)},[t,n]),c=x.useMemo(function(){return ut(ut({position:"absolute",userSelect:"none"},UP[n]),s??{})},[s,n]);return a.jsx("div",{className:i||void 0,style:c,onMouseDown:o,onTouchStart:l,children:r})}),KP=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(r[i]=s[i])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Mr=function(){return Mr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Mr.apply(this,arguments)},VP={width:"auto",height:"auto"},tu=function(e,t,n){return Math.max(Math.min(e,n),t)},N0=function(e,t,n){var r=Math.round(e/t);return r*t+n*(r-1)},yo=function(e,t){return new RegExp(e,"i").test(t)},nu=function(e){return!!(e.touches&&e.touches.length)},YP=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},E0=function(e,t,n){n===void 0&&(n=0);var r=t.reduce(function(i,o,l){return Math.abs(o-e)<Math.abs(t[i]-e)?l:i},0),s=Math.abs(t[r]-e);return n===0||s<n?t[r]:e},vf=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")},ru=function(e,t,n,r){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var s=Number(e.replace("%",""))/100;return t*s}if(e.endsWith("vw")){var s=Number(e.replace("vw",""))/100;return n*s}if(e.endsWith("vh")){var s=Number(e.replace("vh",""))/100;return r*s}}return e},QP=function(e,t,n,r,s,i,o){return r=ru(r,e.width,t,n),s=ru(s,e.height,t,n),i=ru(i,e.width,t,n),o=ru(o,e.height,t,n),{maxWidth:typeof r>"u"?void 0:Number(r),maxHeight:typeof s>"u"?void 0:Number(s),minWidth:typeof i>"u"?void 0:Number(i),minHeight:typeof o>"u"?void 0:Number(o)}},XP=function(e){return Array.isArray(e)?e:[e,e]},GP=["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"],j0="__resizable_base__",JP=function(e){KP(t,e);function t(n){var r,s,i,o,l=e.call(this,n)||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 c=l.parentNode;if(!c)return null;var u=l.window.document.createElement("div");return u.style.width="100%",u.style.height="100%",u.style.position="absolute",u.style.transform="scale(0, 0)",u.style.left="0",u.style.flex="0 0 100%",u.classList?u.classList.add(j0):u.className+=j0,c.appendChild(u),u},l.removeBase=function(c){var u=l.parentNode;u&&u.removeChild(c)},l.state={isResizing:!1,width:(s=(r=l.propsSize)===null||r===void 0?void 0:r.width)!==null&&s!==void 0?s:"auto",height:(o=(i=l.propsSize)===null||i===void 0?void 0:i.height)!==null&&o!==void 0?o:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},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||VP},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var s=this.resizable.offsetWidth,i=this.resizable.offsetHeight,o=this.resizable.style.position;o!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:s,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:i,this.resizable.style.position=o}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,s=function(l){var c;if(typeof n.state[l]>"u"||n.state[l]==="auto")return"auto";if(n.propsSize&&n.propsSize[l]&&(!((c=n.propsSize[l])===null||c===void 0)&&c.toString().endsWith("%"))){if(n.state[l].toString().endsWith("%"))return n.state[l].toString();var u=n.getParentSize(),h=Number(n.state[l].toString().replace("px","")),d=h/u[l]*100;return"".concat(d,"%")}return vf(n.state[l])},i=r&&typeof r.width<"u"&&!this.state.isResizing?vf(r.width):s("width"),o=r&&typeof r.height<"u"&&!this.state.isResizing?vf(r.height):s("height");return{width:i,height:o}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,s=this.parentNode.style.flexWrap;s!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var i={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=s),this.removeBase(n),i},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var s=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof s>"u"||s==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var s=this.props.boundsByDirection,i=this.state.direction,o=s&&yo("left",i),l=s&&yo("top",i),c,u;if(this.props.bounds==="parent"){var h=this.parentNode;h&&(c=o?this.resizableRight-this.parentLeft:h.offsetWidth+(this.parentLeft-this.resizableLeft),u=l?this.resizableBottom-this.parentTop:h.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(c=o?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=l?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(c=o?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=l?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return c&&Number.isFinite(c)&&(n=n&&n<c?n:c),u&&Number.isFinite(u)&&(r=r&&r<u?r:u),{maxWidth:n,maxHeight:r}},t.prototype.calculateNewSizeFromDirection=function(n,r){var s=this.props.scale||1,i=XP(this.props.resizeRatio||1),o=i[0],l=i[1],c=this.state,u=c.direction,h=c.original,d=this.props,p=d.lockAspectRatio,f=d.lockAspectRatioExtraHeight,m=d.lockAspectRatioExtraWidth,g=h.width,w=h.height,v=f||0,y=m||0;return yo("right",u)&&(g=h.width+(n-h.x)*o/s,p&&(w=(g-y)/this.ratio+v)),yo("left",u)&&(g=h.width-(n-h.x)*o/s,p&&(w=(g-y)/this.ratio+v)),yo("bottom",u)&&(w=h.height+(r-h.y)*l/s,p&&(g=(w-v)*this.ratio+y)),yo("top",u)&&(w=h.height-(r-h.y)*l/s,p&&(g=(w-v)*this.ratio+y)),{newWidth:g,newHeight:w}},t.prototype.calculateNewSizeFromAspectRatio=function(n,r,s,i){var o=this.props,l=o.lockAspectRatio,c=o.lockAspectRatioExtraHeight,u=o.lockAspectRatioExtraWidth,h=typeof i.width>"u"?10:i.width,d=typeof s.width>"u"||s.width<0?n:s.width,p=typeof i.height>"u"?10:i.height,f=typeof s.height>"u"||s.height<0?r:s.height,m=c||0,g=u||0;if(l){var w=(p-m)*this.ratio+g,v=(f-m)*this.ratio+g,y=(h-g)/this.ratio+m,_=(d-g)/this.ratio+m,b=Math.max(h,w),N=Math.min(d,v),k=Math.max(p,y),j=Math.min(f,_);n=tu(n,b,N),r=tu(r,k,j)}else n=tu(n,h,d),r=tu(r,p,f);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var r=this.parentNode;if(r){var s=r.getBoundingClientRect();this.parentLeft=s.left*n,this.parentTop=s.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left*n,this.targetTop=i.top*n}if(this.resizable){var o=this.resizable.getBoundingClientRect(),l=o.left,c=o.top,u=o.right,h=o.bottom;this.resizableLeft=l*n,this.resizableRight=u*n,this.resizableTop=c*n,this.resizableBottom=h*n}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var s=0,i=0;if(n.nativeEvent&&YP(n.nativeEvent)?(s=n.nativeEvent.clientX,i=n.nativeEvent.clientY):n.nativeEvent&&nu(n.nativeEvent)&&(s=n.nativeEvent.touches[0].clientX,i=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var o=this.props.onResizeStart(n,r,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,c=this.window.getComputedStyle(this.resizable);if(c.flexBasis!=="auto"){var u=this.parentNode;if(u){var h=this.window.getComputedStyle(u).flexDirection;this.flexDir=h.startsWith("row")?"row":"column",l=c.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:s,y:i,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Mr(Mr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:l};this.setState(d)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&nu(n))try{n.preventDefault(),n.stopPropagation()}catch{}var s=this.props,i=s.maxWidth,o=s.maxHeight,l=s.minWidth,c=s.minHeight,u=nu(n)?n.touches[0].clientX:n.clientX,h=nu(n)?n.touches[0].clientY:n.clientY,d=this.state,p=d.direction,f=d.original,m=d.width,g=d.height,w=this.getParentSize(),v=QP(w,this.window.innerWidth,this.window.innerHeight,i,o,l,c);i=v.maxWidth,o=v.maxHeight,l=v.minWidth,c=v.minHeight;var y=this.calculateNewSizeFromDirection(u,h),_=y.newHeight,b=y.newWidth,N=this.calculateNewMaxFromBoundary(i,o);this.props.snap&&this.props.snap.x&&(b=E0(b,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(_=E0(_,this.props.snap.y,this.props.snapGap));var k=this.calculateNewSizeFromAspectRatio(b,_,{width:N.maxWidth,height:N.maxHeight},{width:l,height:c});if(b=k.newWidth,_=k.newHeight,this.props.grid){var j=N0(b,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),D=N0(_,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),F=this.props.snapGap||0,P=F===0||Math.abs(j-b)<=F?j:b,O=F===0||Math.abs(D-_)<=F?D:_;b=P,_=O}var T={width:b-f.width,height:_-f.height};if(this.delta=T,m&&typeof m=="string"){if(m.endsWith("%")){var E=b/w.width*100;b="".concat(E,"%")}else if(m.endsWith("vw")){var R=b/this.window.innerWidth*100;b="".concat(R,"vw")}else if(m.endsWith("vh")){var L=b/this.window.innerHeight*100;b="".concat(L,"vh")}}if(g&&typeof g=="string"){if(g.endsWith("%")){var E=_/w.height*100;_="".concat(E,"%")}else if(g.endsWith("vw")){var R=_/this.window.innerWidth*100;_="".concat(R,"vw")}else if(g.endsWith("vh")){var L=_/this.window.innerHeight*100;_="".concat(L,"vh")}}var $={width:this.createSizeForCssProperty(b,"width"),height:this.createSizeForCssProperty(_,"height")};this.flexDir==="row"?$.flexBasis=$.width:this.flexDir==="column"&&($.flexBasis=$.height);var K=this.state.width!==$.width,A=this.state.height!==$.height,H=this.state.flexBasis!==$.flexBasis,S=K||A||H;S&&sr.flushSync(function(){r.setState($)}),this.props.onResize&&S&&this.props.onResize(n,p,this.resizable,T)}},t.prototype.onMouseUp=function(n){var r,s,i=this.state,o=i.isResizing,l=i.direction;i.original,!(!o||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(n,l,this.resizable,this.delta),this.props.size&&this.setState({width:(r=this.props.size.width)!==null&&r!==void 0?r:"auto",height:(s=this.props.size.height)!==null&&s!==void 0?s:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Mr(Mr({},this.state.backgroundStyle),{cursor:"auto"})}))},t.prototype.updateSize=function(n){var r,s;this.setState({width:(r=n.width)!==null&&r!==void 0?r:"auto",height:(s=n.height)!==null&&s!==void 0?s:"auto"})},t.prototype.renderResizer=function(){var n=this,r=this.props,s=r.enable,i=r.handleStyles,o=r.handleClasses,l=r.handleWrapperStyle,c=r.handleWrapperClass,u=r.handleComponent;if(!s)return null;var h=Object.keys(s).map(function(d){return s[d]!==!1?a.jsx(qP,{direction:d,onResizeStart:n.onResizeStart,replaceStyles:i&&i[d],className:o&&o[d],children:u&&u[d]?u[d]:null},d):null});return a.jsx("div",{className:c,style:l,children:h})},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(o,l){return GP.indexOf(l)!==-1||(o[l]=n.props[l]),o},{}),s=Mr(Mr(Mr({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&&(s.flexBasis=this.state.flexBasis);var i=this.props.as||"div";return a.jsxs(i,Mr({style:s,className:this.props.className},r,{ref:function(o){o&&(n.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}(x.PureComponent);/*! *****************************************************************************
422
- Copyright (c) Microsoft Corporation. All rights reserved.
423
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
424
- this file except in compliance with the License. You may obtain a copy of the
425
- License at http://www.apache.org/licenses/LICENSE-2.0
426
-
427
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
428
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
429
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
430
- MERCHANTABLITY OR NON-INFRINGEMENT.
431
-
432
- See the Apache Version 2.0 License for specific language governing permissions
433
- and limitations under the License.
434
- ***************************************************************************** */var Sm=function(e,t){return Sm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)r.hasOwnProperty(s)&&(n[s]=r[s])},Sm(e,t)};function ZP(e,t){Sm(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var yt=function(){return yt=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},yt.apply(this,arguments)};function eT(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}var tT={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},nT=function(e){return{bottom:e,bottomLeft:e,bottomRight:e,left:e,right:e,top:e,topLeft:e,topRight:e}},rT=function(e){ZP(t,e);function t(n){var r=e.call(this,n)||this;return r.resizingPosition={x:0,y:0},r.offsetFromParent={left:0,top:0},r.resizableElement={current:null},r.originalPosition={x:0,y:0},r.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:n.maxWidth,maxHeight:n.maxHeight},r.onResizeStart=r.onResizeStart.bind(r),r.onResize=r.onResize.bind(r),r.onResizeStop=r.onResizeStop.bind(r),r.onDragStart=r.onDragStart.bind(r),r.onDrag=r.onDrag.bind(r),r.onDragStop=r.onDragStop.bind(r),r.getMaxSizesFromProps=r.getMaxSizesFromProps.bind(r),r}return t.prototype.componentDidMount=function(){this.updateOffsetFromParent();var n=this.offsetFromParent,r=n.left,s=n.top,i=this.getDraggablePosition(),o=i.x,l=i.y;this.draggable.setState({x:o-r,y:l-s}),this.forceUpdate()},t.prototype.getDraggablePosition=function(){var n=this.draggable.state,r=n.x,s=n.y;return{x:r,y:s}},t.prototype.getParent=function(){return this.resizable&&this.resizable.parentNode},t.prototype.getParentSize=function(){return this.resizable.getParentSize()},t.prototype.getMaxSizesFromProps=function(){var n=typeof this.props.maxWidth>"u"?Number.MAX_SAFE_INTEGER:this.props.maxWidth,r=typeof this.props.maxHeight>"u"?Number.MAX_SAFE_INTEGER:this.props.maxHeight;return{maxWidth:n,maxHeight:r}},t.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},t.prototype.getOffsetHeight=function(n){var r=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/r;case"body":return document.body.offsetHeight/r;default:return n.offsetHeight}},t.prototype.getOffsetWidth=function(n){var r=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/r;case"body":return document.body.offsetWidth/r;default:return n.offsetWidth}},t.prototype.onDragStart=function(n,r){this.props.onDragStart&&this.props.onDragStart(n,r);var s=this.getDraggablePosition();if(this.originalPosition=s,!!this.props.bounds){var i=this.getParent(),o=this.props.scale,l;if(this.props.bounds==="parent")l=i;else if(this.props.bounds==="body"){var c=i.getBoundingClientRect(),u=c.left,h=c.top,d=document.body.getBoundingClientRect(),p=-(u-i.offsetLeft*o-d.left)/o,f=-(h-i.offsetTop*o-d.top)/o,m=(document.body.offsetWidth-this.resizable.size.width*o)/o+p,g=(document.body.offsetHeight-this.resizable.size.height*o)/o+f;return this.setState({bounds:{top:f,right:m,bottom:g,left:p}})}else if(this.props.bounds==="window"){if(!this.resizable)return;var w=i.getBoundingClientRect(),v=w.left,y=w.top,_=-(v-i.offsetLeft*o)/o,b=-(y-i.offsetTop*o)/o,m=(window.innerWidth-this.resizable.size.width*o)/o+_,g=(window.innerHeight-this.resizable.size.height*o)/o+b;return this.setState({bounds:{top:b,right:m,bottom:g,left:_}})}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)||!(i instanceof HTMLElement))){var N=l.getBoundingClientRect(),k=N.left,j=N.top,D=i.getBoundingClientRect(),F=D.left,P=D.top,O=(k-F)/o,T=j-P;if(this.resizable){this.updateOffsetFromParent();var E=this.offsetFromParent;this.setState({bounds:{top:T-E.top,right:O+(l.offsetWidth-this.resizable.size.width)-E.left/o,bottom:T+(l.offsetHeight-this.resizable.size.height)-E.top,left:O-E.left/o}})}}}},t.prototype.onDrag=function(n,r){if(this.props.onDrag){var s=this.offsetFromParent,i=s.left,o=s.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDrag(n,yt(yt({},r),{x:r.x+i,y:r.y+o}));if(this.props.dragAxis==="x")return this.props.onDrag(n,yt(yt({},r),{x:r.x+i,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDrag(n,yt(yt({},r),{x:this.originalPosition.x+i,y:r.y+o,deltaX:0}))}},t.prototype.onDragStop=function(n,r){if(this.props.onDragStop){var s=this.offsetFromParent,i=s.left,o=s.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDragStop(n,yt(yt({},r),{x:r.x+i,y:r.y+o}));if(this.props.dragAxis==="x")return this.props.onDragStop(n,yt(yt({},r),{x:r.x+i,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDragStop(n,yt(yt({},r),{x:this.originalPosition.x+i,y:r.y+o,deltaX:0}))}},t.prototype.onResizeStart=function(n,r,s){n.stopPropagation(),this.setState({resizing:!0});var i=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 c=this.getParent(),u=void 0;this.props.bounds==="parent"?u=c:this.props.bounds==="body"?u=document.body:this.props.bounds==="window"?u=window:typeof this.props.bounds=="string"?u=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(u=this.props.bounds);var h=this.getSelfElement();if(h instanceof Element&&(u instanceof HTMLElement||u===window)&&c instanceof HTMLElement){var d=this.getMaxSizesFromProps(),p=d.maxWidth,f=d.maxHeight,m=this.getParentSize();if(p&&typeof p=="string")if(p.endsWith("%")){var g=Number(p.replace("%",""))/100;p=m.width*g}else p.endsWith("px")&&(p=Number(p.replace("px","")));if(f&&typeof f=="string")if(f.endsWith("%")){var g=Number(f.replace("%",""))/100;f=m.height*g}else f.endsWith("px")&&(f=Number(f.replace("px","")));var w=h.getBoundingClientRect(),v=w.left,y=w.top,_=this.props.bounds==="window"?{left:0,top:0}:u.getBoundingClientRect(),b=_.left,N=_.top,k=this.getOffsetWidth(u),j=this.getOffsetHeight(u),D=r.toLowerCase().endsWith("left"),F=r.toLowerCase().endsWith("right"),P=r.startsWith("top"),O=r.startsWith("bottom");if((D||P)&&this.resizable){var T=(v-b)/i+this.resizable.size.width;this.setState({maxWidth:T>Number(p)?p:T})}if(F||this.props.lockAspectRatio&&!D&&!P){var T=k+(b-v)/i;this.setState({maxWidth:T>Number(p)?p:T})}if((P||D)&&this.resizable){var T=(y-N)/i+this.resizable.size.height;this.setState({maxHeight:T>Number(f)?f:T})}if(O||this.props.lockAspectRatio&&!P&&!D){var T=j+(N-y)/i;this.setState({maxHeight:T>Number(f)?f:T})}}}else this.setState({maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight});this.props.onResizeStart&&this.props.onResizeStart(n,r,s)},t.prototype.onResize=function(n,r,s,i){var o=this,l={x:this.originalPosition.x,y:this.originalPosition.y},c=-i.width,u=-i.height,h=["top","left","topLeft","bottomLeft","topRight"];h.includes(r)&&(r==="bottomLeft"?l.x+=c:(r==="topRight"||(l.x+=c),l.y+=u));var d=this.draggable.state;(l.x!==d.x||l.y!==d.y)&&sr.flushSync(function(){o.draggable.setState(l)}),this.updateOffsetFromParent();var p=this.offsetFromParent,f=this.getDraggablePosition().x+p.left,m=this.getDraggablePosition().y+p.top;this.resizingPosition={x:f,y:m},this.props.onResize&&this.props.onResize(n,r,s,i,{x:f,y:m})},t.prototype.onResizeStop=function(n,r,s,i){this.setState({resizing:!1});var o=this.getMaxSizesFromProps(),l=o.maxWidth,c=o.maxHeight;this.setState({maxWidth:l,maxHeight:c}),this.props.onResizeStop&&this.props.onResizeStop(n,r,s,i,this.resizingPosition)},t.prototype.updateSize=function(n){this.resizable&&this.resizable.updateSize({width:n.width,height:n.height})},t.prototype.updatePosition=function(n){this.draggable.setState(n)},t.prototype.updateOffsetFromParent=function(){var n=this.props.scale,r=this.getParent(),s=this.getSelfElement();if(!r||s===null)return{top:0,left:0};var i=r.getBoundingClientRect(),o=i.left,l=i.top,c=s.getBoundingClientRect(),u=this.getDraggablePosition(),h=r.scrollLeft,d=r.scrollTop;this.offsetFromParent={left:c.left-o+h-u.x*n,top:c.top-l+d-u.y*n}},t.prototype.render=function(){var n=this,r=this.props,s=r.disableDragging,i=r.style,o=r.dragHandleClassName,l=r.position,c=r.onMouseDown,u=r.onMouseUp,h=r.dragAxis,d=r.dragGrid,p=r.bounds,f=r.enableUserSelectHack,m=r.cancel,g=r.children;r.onResizeStart,r.onResize,r.onResizeStop,r.onDragStart,r.onDrag,r.onDragStop;var w=r.resizeHandleStyles,v=r.resizeHandleClasses,y=r.resizeHandleComponent,_=r.enableResizing,b=r.resizeGrid,N=r.resizeHandleWrapperClass,k=r.resizeHandleWrapperStyle,j=r.scale,D=r.allowAnyClick,F=r.dragPositionOffset,P=eT(r,["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"]),O=this.props.default?yt({},this.props.default):void 0;delete P.default;var T=s||o?{cursor:"auto"}:{cursor:"move"},E=yt(yt(yt({},tT),T),i),R=this.offsetFromParent,L=R.left,$=R.top,K;l&&(K={x:l.x-L,y:l.y-$});var A=this.state.resizing?void 0:K,H=this.state.resizing?"both":h;return x.createElement(WP,{ref:function(S){S&&(n.draggable=S)},handle:o?".".concat(o):void 0,defaultPosition:O,onMouseDown:c,onMouseUp:u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,axis:H,disabled:s,grid:d,bounds:p?this.state.bounds:void 0,position:A,enableUserSelectHack:f,cancel:m,scale:j,allowAnyClick:D,nodeRef:this.resizableElement,positionOffset:F},x.createElement(JP,yt({},P,{ref:function(S){S&&(n.resizable=S,n.resizableElement.current=S.resizable)},defaultSize:O,size:this.props.size,enable:typeof _=="boolean"?nT(_):_,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,style:E,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:b,handleWrapperClass:N,handleWrapperStyle:k,lockAspectRatio:this.props.lockAspectRatio,lockAspectRatioExtraWidth:this.props.lockAspectRatioExtraWidth,lockAspectRatioExtraHeight:this.props.lockAspectRatioExtraHeight,handleStyles:w,handleClasses:v,handleComponent:y,scale:this.props.scale}),g))},t.defaultProps={maxWidth:Number.MAX_SAFE_INTEGER,maxHeight:Number.MAX_SAFE_INTEGER,scale:1,onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},onDragStart:function(){},onDrag:function(){},onDragStop:function(){}},t}(x.PureComponent);/**
435
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
436
- * @license MIT
437
- *
438
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
439
- * @license MIT
440
- *
441
- * Originally forked from (with the author's permission):
442
- * Fabrice Bellard's javascript vt100 for jslinux:
443
- * http://bellard.org/jslinux/
444
- * Copyright (c) 2011 Fabrice Bellard
445
- */var Bk=Object.defineProperty,sT=Object.getOwnPropertyDescriptor,iT=(e,t)=>{for(var n in t)Bk(e,n,{get:t[n],enumerable:!0})},ot=(e,t,n,r)=>{for(var s=r>1?void 0:r?sT(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&Bk(t,n,s),s},ie=(e,t)=>(n,r)=>t(n,r,e),R0="Terminal input",km={get:()=>R0,set:e=>R0=e},P0="Too much output to announce, navigate to rows manually to read",Cm={get:()=>P0,set:e=>P0=e};function oT(e){return e.replace(/\r?\n/g,"\r")}function aT(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function lT(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function cT(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");Fk(s,t,n,r)}}function Fk(e,t,n,r){e=oT(e),e=aT(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function zk(e,t,n){let r=n.getBoundingClientRect(),s=e.clientX-r.left-10,i=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${i}px`,t.style.zIndex="1000",t.focus()}function T0(e,t,n,r,s){zk(e,t,n),s&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Os(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function xh(e,t=0,n=e.length){let r="";for(let s=t;s<n;++s){let i=e[s];i>65535?(i-=65536,r+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):r+=String.fromCharCode(i)}return r}var uT=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,s=0;if(this._interim){let i=e.charCodeAt(s++);56320<=i&&i<=57343?t[r++]=(this._interim-55296)*1024+i-56320+65536:(t[r++]=this._interim,t[r++]=i),this._interim=0}for(let i=s;i<n;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=n)return this._interim=o,r;let l=e.charCodeAt(i);56320<=l&&l<=57343?t[r++]=(o-55296)*1024+l-56320+65536:(t[r++]=o,t[r++]=l);continue}o!==65279&&(t[r++]=o)}return r}},dT=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,s,i,o,l,c=0,u=0;if(this.interim[0]){let p=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let m=0,g;for(;(g=this.interim[++m]&63)&&m<4;)f<<=6,f|=g;let w=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,v=w-m;for(;u<v;){if(u>=n)return 0;if(g=e[u++],(g&192)!==128){u--,p=!0;break}else this.interim[m++]=g,f<<=6,f|=g&63}p||(w===2?f<128?u--:t[r++]=f:w===3?f<2048||f>=55296&&f<=57343||f===65279||(t[r++]=f):f<65536||f>1114111||(t[r++]=f)),this.interim.fill(0)}let h=n-4,d=u;for(;d<n;){for(;d<h&&!((s=e[d])&128)&&!((i=e[d+1])&128)&&!((o=e[d+2])&128)&&!((l=e[d+3])&128);)t[r++]=s,t[r++]=i,t[r++]=o,t[r++]=l,d+=4;if(s=e[d++],s<128)t[r++]=s;else if((s&224)===192){if(d>=n)return this.interim[0]=s,r;if(i=e[d++],(i&192)!==128){d--;continue}if(c=(s&31)<<6|i&63,c<128){d--;continue}t[r++]=c}else if((s&240)===224){if(d>=n)return this.interim[0]=s,r;if(i=e[d++],(i&192)!==128){d--;continue}if(d>=n)return this.interim[0]=s,this.interim[1]=i,r;if(o=e[d++],(o&192)!==128){d--;continue}if(c=(s&15)<<12|(i&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((s&248)===240){if(d>=n)return this.interim[0]=s,r;if(i=e[d++],(i&192)!==128){d--;continue}if(d>=n)return this.interim[0]=s,this.interim[1]=i,r;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=n)return this.interim[0]=s,this.interim[1]=i,this.interim[2]=o,r;if(l=e[d++],(l&192)!==128){d--;continue}if(c=(s&7)<<18|(i&63)<<12|(o&63)<<6|l&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},$k="",Js=" ",Sc=class Hk{constructor(){this.fg=0,this.bg=0,this.extended=new Dd}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 Hk;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}},Dd=class Wk{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Wk(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},or=class Uk extends Sc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Dd,this.combinedData=""}static fromCharData(t){let n=new Uk;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Os(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},D0="di$target",Nm="di$dependencies",xf=new Map;function hT(e){return e[Nm]||[]}function Ot(e){if(xf.has(e))return xf.get(e);let t=function(n,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");fT(t,n,s)};return t._id=e,xf.set(e,t),t}function fT(e,t,n){t[D0]===t?t[Nm].push({id:e,index:n}):(t[Nm]=[{id:e,index:n}],t[D0]=t)}var fn=Ot("BufferService"),qk=Ot("CoreMouseService"),fo=Ot("CoreService"),pT=Ot("CharsetService"),Qv=Ot("InstantiationService"),Kk=Ot("LogService"),pn=Ot("OptionsService"),Vk=Ot("OscLinkService"),mT=Ot("UnicodeService"),kc=Ot("DecorationService"),Em=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var h;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],s=this._optionsService.rawOptions.linkHandler,i=new or,o=n.getTrimmedLength(),l=-1,c=-1,u=!1;for(let d=0;d<o;d++)if(!(c===-1&&!n.hasContent(d))){if(n.loadCell(d,i),i.hasExtendedAttrs()&&i.extended.urlId)if(c===-1){c=d,l=i.extended.urlId;continue}else u=i.extended.urlId!==l;else c!==-1&&(u=!0);if(u||c!==-1&&d===o-1){let p=(h=this._oscLinkService.getLinkData(l))==null?void 0:h.uri;if(p){let f={start:{x:c+1,y:e},end:{x:d+(!u&&d===o-1?1:0),y:e}},m=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let g=new URL(p);["http:","https:"].includes(g.protocol)||(m=!0)}catch{m=!0}m||r.push({text:p,range:f,activate:(g,w)=>s?s.activate(g,w,f):gT(g,w),hover:(g,w)=>{var v;return(v=s==null?void 0:s.hover)==null?void 0:v.call(s,g,w,f)},leave:(g,w)=>{var v;return(v=s==null?void 0:s.leave)==null?void 0:v.call(s,g,w,f)}})}u=!1,i.hasExtendedAttrs()&&i.extended.urlId?(c=d,l=i.extended.urlId):(c=-1,l=-1)}}t(r)}};Em=ot([ie(0,fn),ie(1,pn),ie(2,Vk)],Em);function gT(e,t){if(confirm(`Do you want to navigate to ${t}?
446
-
447
- WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var yh=Ot("CharSizeService"),xs=Ot("CoreBrowserService"),Xv=Ot("MouseService"),ys=Ot("RenderService"),vT=Ot("SelectionService"),Yk=Ot("CharacterJoinerService"),Ra=Ot("ThemeService"),Qk=Ot("LinkProviderService"),xT=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?M0.isErrorNoTelemetry(e)?new M0(e.message+`
448
-
449
- `+e.stack):new Error(e.message+`
450
-
451
- `+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)}},yT=new xT;function Bu(e){_T(e)||yT.onUnexpectedError(e)}var jm="Canceled";function _T(e){return e instanceof bT?!0:e instanceof Error&&e.name===jm&&e.message===jm}var bT=class extends Error{constructor(){super(jm),this.name=this.message}};function wT(e){return new Error(`Illegal argument: ${e}`)}var M0=class Rm extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Rm)return t;let n=new Rm;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Pm=class Xk extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Xk.prototype)}};function Mn(e,t=0){return e[e.length-(1+t)]}var ST;(e=>{function t(i){return i<0}e.isLessThan=t;function n(i){return i<=0}e.isLessThanOrEqual=n;function r(i){return i>0}e.isGreaterThan=r;function s(i){return i===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(ST||(ST={}));function kT(e,t){let n=this,r=!1,s;return function(){return r||(r=!0,t||(s=e.apply(n,arguments))),s}}var Gk;(e=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*s(b){yield b}e.single=s;function i(b){return t(b)?b:s(b)}e.wrap=i;function o(b){return b||n}e.from=o;function*l(b){for(let N=b.length-1;N>=0;N--)yield b[N]}e.reverse=l;function c(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=c;function u(b){return b[Symbol.iterator]().next().value}e.first=u;function h(b,N){let k=0;for(let j of b)if(N(j,k++))return!0;return!1}e.some=h;function d(b,N){for(let k of b)if(N(k))return k}e.find=d;function*p(b,N){for(let k of b)N(k)&&(yield k)}e.filter=p;function*f(b,N){let k=0;for(let j of b)yield N(j,k++)}e.map=f;function*m(b,N){let k=0;for(let j of b)yield*N(j,k++)}e.flatMap=m;function*g(...b){for(let N of b)yield*N}e.concat=g;function w(b,N,k){let j=k;for(let D of b)j=N(j,D);return j}e.reduce=w;function*v(b,N,k=b.length){for(N<0&&(N+=b.length),k<0?k+=b.length:k>b.length&&(k=b.length);N<k;N++)yield b[N]}e.slice=v;function y(b,N=Number.POSITIVE_INFINITY){let k=[];if(N===0)return[k,b];let j=b[Symbol.iterator]();for(let D=0;D<N;D++){let F=j.next();if(F.done)return[k,e.empty()];k.push(F.value)}return[k,{[Symbol.iterator](){return j}}]}e.consume=y;async function _(b){let N=[];for await(let k of b)N.push(k);return Promise.resolve(N)}e.asyncToArray=_})(Gk||(Gk={}));function ro(e){if(Gk.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}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 CT(...e){return Ve(()=>ro(e))}function Ve(e){return{dispose:kT(()=>{e()})}}var Jk=class Zk{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{ro(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?Zk.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)}};Jk.DISABLE_DISPOSED_WARNING=!1;var ui=Jk,Se=class{constructor(){this._store=new ui,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)}};Se.None=Object.freeze({dispose(){}});var ya=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var n;this._isDisposed||t===this._value||((n=this._value)==null||n.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},as=typeof window=="object"?window:globalThis,Tm=class Dm{constructor(t){this.element=t,this.next=Dm.Undefined,this.prev=Dm.Undefined}};Tm.Undefined=new Tm(void 0);var Ye=Tm,A0=class{constructor(){this._first=Ye.Undefined,this._last=Ye.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ye.Undefined}clear(){let e=this._first;for(;e!==Ye.Undefined;){let t=e.next;e.prev=Ye.Undefined,e.next=Ye.Undefined,e=t}this._first=Ye.Undefined,this._last=Ye.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Ye(e);if(this._first===Ye.Undefined)this._first=n,this._last=n;else if(t){let s=this._last;this._last=n,n.prev=s,s.next=n}else{let s=this._first;this._first=n,n.next=s,s.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Ye.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ye.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ye.Undefined&&e.next!==Ye.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ye.Undefined&&e.next===Ye.Undefined?(this._first=Ye.Undefined,this._last=Ye.Undefined):e.next===Ye.Undefined?(this._last=this._last.prev,this._last.next=Ye.Undefined):e.prev===Ye.Undefined&&(this._first=this._first.next,this._first.prev=Ye.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ye.Undefined;)yield e.element,e=e.next}},NT=globalThis.performance&&typeof globalThis.performance.now=="function",ET=class eC{static create(t){return new eC(t)}constructor(t){this._now=NT&&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}},$t;(e=>{e.None=()=>Se.None;function t(T,E){return d(T,()=>{},0,void 0,!0,void 0,E)}e.defer=t;function n(T){return(E,R=null,L)=>{let $=!1,K;return K=T(A=>{if(!$)return K?K.dispose():$=!0,E.call(R,A)},null,L),$&&K.dispose(),K}}e.once=n;function r(T,E,R){return u((L,$=null,K)=>T(A=>L.call($,E(A)),null,K),R)}e.map=r;function s(T,E,R){return u((L,$=null,K)=>T(A=>{E(A),L.call($,A)},null,K),R)}e.forEach=s;function i(T,E,R){return u((L,$=null,K)=>T(A=>E(A)&&L.call($,A),null,K),R)}e.filter=i;function o(T){return T}e.signal=o;function l(...T){return(E,R=null,L)=>{let $=CT(...T.map(K=>K(A=>E.call(R,A))));return h($,L)}}e.any=l;function c(T,E,R,L){let $=R;return r(T,K=>($=E($,K),$),L)}e.reduce=c;function u(T,E){let R,L={onWillAddFirstListener(){R=T($.fire,$)},onDidRemoveLastListener(){R==null||R.dispose()}},$=new ee(L);return E==null||E.add($),$.event}function h(T,E){return E instanceof Array?E.push(T):E&&E.add(T),T}function d(T,E,R=100,L=!1,$=!1,K,A){let H,S,Y,B=0,C,U={leakWarningThreshold:K,onWillAddFirstListener(){H=T(q=>{B++,S=E(S,q),L&&!Y&&(I.fire(S),S=void 0),C=()=>{let z=S;S=void 0,Y=void 0,(!L||B>1)&&I.fire(z),B=0},typeof R=="number"?(clearTimeout(Y),Y=setTimeout(C,R)):Y===void 0&&(Y=0,queueMicrotask(C))})},onWillRemoveListener(){$&&B>0&&(C==null||C())},onDidRemoveLastListener(){C=void 0,H.dispose()}},I=new ee(U);return A==null||A.add(I),I.event}e.debounce=d;function p(T,E=0,R){return e.debounce(T,(L,$)=>L?(L.push($),L):[$],E,void 0,!0,void 0,R)}e.accumulate=p;function f(T,E=(L,$)=>L===$,R){let L=!0,$;return i(T,K=>{let A=L||!E(K,$);return L=!1,$=K,A},R)}e.latch=f;function m(T,E,R){return[e.filter(T,E,R),e.filter(T,L=>!E(L),R)]}e.split=m;function g(T,E=!1,R=[],L){let $=R.slice(),K=T(S=>{$?$.push(S):H.fire(S)});L&&L.add(K);let A=()=>{$==null||$.forEach(S=>H.fire(S)),$=null},H=new ee({onWillAddFirstListener(){K||(K=T(S=>H.fire(S)),L&&L.add(K))},onDidAddFirstListener(){$&&(E?setTimeout(A):A())},onDidRemoveLastListener(){K&&K.dispose(),K=null}});return L&&L.add(H),H.event}e.buffer=g;function w(T,E){return(R,L,$)=>{let K=E(new y);return T(function(A){let H=K.evaluate(A);H!==v&&R.call(L,H)},void 0,$)}}e.chain=w;let v=Symbol("HaltChainable");class y{constructor(){this.steps=[]}map(E){return this.steps.push(E),this}forEach(E){return this.steps.push(R=>(E(R),R)),this}filter(E){return this.steps.push(R=>E(R)?R:v),this}reduce(E,R){let L=R;return this.steps.push($=>(L=E(L,$),L)),this}latch(E=(R,L)=>R===L){let R=!0,L;return this.steps.push($=>{let K=R||!E($,L);return R=!1,L=$,K?$:v}),this}evaluate(E){for(let R of this.steps)if(E=R(E),E===v)break;return E}}function _(T,E,R=L=>L){let L=(...H)=>A.fire(R(...H)),$=()=>T.on(E,L),K=()=>T.removeListener(E,L),A=new ee({onWillAddFirstListener:$,onDidRemoveLastListener:K});return A.event}e.fromNodeEventEmitter=_;function b(T,E,R=L=>L){let L=(...H)=>A.fire(R(...H)),$=()=>T.addEventListener(E,L),K=()=>T.removeEventListener(E,L),A=new ee({onWillAddFirstListener:$,onDidRemoveLastListener:K});return A.event}e.fromDOMEventEmitter=b;function N(T){return new Promise(E=>n(T)(E))}e.toPromise=N;function k(T){let E=new ee;return T.then(R=>{E.fire(R)},()=>{E.fire(void 0)}).finally(()=>{E.dispose()}),E.event}e.fromPromise=k;function j(T,E){return T(R=>E.fire(R))}e.forward=j;function D(T,E,R){return E(R),T(L=>E(L))}e.runAndSubscribe=D;class F{constructor(E,R){this._observable=E,this._counter=0,this._hasChanged=!1;let L={onWillAddFirstListener:()=>{E.addObserver(this)},onDidRemoveLastListener:()=>{E.removeObserver(this)}};this.emitter=new ee(L),R&&R.add(this.emitter)}beginUpdate(E){this._counter++}handlePossibleChange(E){}handleChange(E,R){this._hasChanged=!0}endUpdate(E){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function P(T,E){return new F(T,E).emitter.event}e.fromObservable=P;function O(T){return(E,R,L)=>{let $=0,K=!1,A={beginUpdate(){$++},endUpdate(){$--,$===0&&(T.reportChanges(),K&&(K=!1,E.call(R)))},handlePossibleChange(){},handleChange(){K=!0}};T.addObserver(A),T.reportChanges();let H={dispose(){T.removeObserver(A)}};return L instanceof ui?L.add(H):Array.isArray(L)&&L.push(H),H}}e.fromObservableLight=O})($t||($t={}));var Mm=class Am{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Am._idPool++}`,Am.all.add(this)}start(t){this._stopWatch=new ET,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}}};Mm.all=new Set,Mm._idPool=0;var jT=Mm,RT=-1,tC=class nC{constructor(t,n,r=(nC._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[i,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(i);let c=new DT(l,i);this._errorHandler(c)}return()=>{let i=this._stacks.get(t.value)||0;this._stacks.set(t.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,s]of this._stacks)(!t||n<s)&&(t=[r,s],n=s);return t}};tC._idPool=1;var PT=tC,TT=class rC{constructor(t){this.value=t}static create(){let t=new Error;return new rC(t.stack??"")}print(){console.warn(this.value.split(`
452
- `).slice(2).join(`
453
- `))}},DT=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},MT=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},AT=0,yf=class{constructor(e){this.value=e,this.id=AT++}},LT=2,OT,ee=class{constructor(e){var t,n,r,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new PT((e==null?void 0:e.onListenerError)??Bu,((n=this._options)==null?void 0:n.leakWarningThreshold)??RT):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new jT(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,n,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var o,l,c,u,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 p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new MT(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Bu)(f),Se.None}if(this._disposed)return Se.None;t&&(e=e.bind(t));let r=new yf(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=TT.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof yf?(this._deliveryQueue??(this._deliveryQueue=new IT),this._listeners=[this._listeners,r]):this._listeners.push(r):((c=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||c.call(l,this),this._listeners=r,(h=(u=this._options)==null?void 0:u.onDidAddFirstListener)==null||h.call(u,this)),this._size++;let i=Ve(()=>{s==null||s(),this._removeListener(r)});return n instanceof ui?n.add(i):Array.isArray(n)&&n.push(i),i}),this._event}_removeListener(e){var s,i,o,l;if((i=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||i.call(s,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,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*LT<=t.length){let c=0;for(let u=0;u<t.length;u++)t[u]?t[c++]=t[u]:r&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=c}}_deliver(e,t){var r;if(!e)return;let n=((r=this._options)==null?void 0:r.onListenerError)||Bu;if(!n){e.value(t);return}try{e.value(t)}catch(s){n(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,n,r,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof yf)this._deliver(this._listeners,e);else{let i=this._deliveryQueue;i.enqueue(this,e,this._listeners.length),this._deliverQueue(i)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},IT=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Lm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ee,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ee,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Lm.INSTANCE=new Lm;var Gv=Lm;function BT(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Gv.INSTANCE.onDidChangeZoomLevel;function FT(e){return Gv.INSTANCE.getZoomFactor(e)}Gv.INSTANCE.onDidChangeFullscreen;var Pa=typeof navigator=="object"?navigator.userAgent:"",Om=Pa.indexOf("Firefox")>=0,zT=Pa.indexOf("AppleWebKit")>=0,Jv=Pa.indexOf("Chrome")>=0,$T=!Jv&&Pa.indexOf("Safari")>=0;Pa.indexOf("Electron/")>=0;Pa.indexOf("Android")>=0;var _f=!1;if(typeof as.matchMedia=="function"){let e=as.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=as.matchMedia("(display-mode: fullscreen)");_f=e.matches,BT(as,e,({matches:n})=>{_f&&t.matches||(_f=n)})}var Ho="en",Im=!1,Bm=!1,Fu=!1,sC=!1,su,zu=Ho,L0=Ho,HT,fr,Vi=globalThis,zt,gw;typeof Vi.vscode<"u"&&typeof Vi.vscode.process<"u"?zt=Vi.vscode.process:typeof process<"u"&&typeof((gw=process==null?void 0:process.versions)==null?void 0:gw.node)=="string"&&(zt=process);var vw,WT=typeof((vw=zt==null?void 0:zt.versions)==null?void 0:vw.electron)=="string",UT=WT&&(zt==null?void 0:zt.type)==="renderer",xw;if(typeof zt=="object"){Im=zt.platform==="win32",Bm=zt.platform==="darwin",Fu=zt.platform==="linux",Fu&&zt.env.SNAP&&zt.env.SNAP_REVISION,zt.env.CI||zt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,su=Ho,zu=Ho;let e=zt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);su=t.userLocale,L0=t.osLocale,zu=t.resolvedLanguage||Ho,HT=(xw=t.languagePack)==null?void 0:xw.translationsConfigFile}catch{}sC=!0}else typeof navigator=="object"&&!UT?(fr=navigator.userAgent,Im=fr.indexOf("Windows")>=0,Bm=fr.indexOf("Macintosh")>=0,(fr.indexOf("Macintosh")>=0||fr.indexOf("iPad")>=0||fr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Fu=fr.indexOf("Linux")>=0,(fr==null?void 0:fr.indexOf("Mobi"))>=0,zu=globalThis._VSCODE_NLS_LANGUAGE||Ho,su=navigator.language.toLowerCase(),L0=su):console.error("Unable to resolve platform.");var iC=Im,Wr=Bm,qT=Fu,O0=sC,qr=fr,Es=zu,KT;(e=>{function t(){return Es}e.value=t;function n(){return Es.length===2?Es==="en":Es.length>=3?Es[0]==="e"&&Es[1]==="n"&&Es[2]==="-":!1}e.isDefaultVariant=n;function r(){return Es==="en"}e.isDefault=r})(KT||(KT={}));var VT=typeof Vi.postMessage=="function"&&!Vi.importScripts;(()=>{if(VT){let e=[];Vi.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let i=e[r];if(i.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),i.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Vi.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var YT=!!(qr&&qr.indexOf("Chrome")>=0);qr&&qr.indexOf("Firefox")>=0;!YT&&qr&&qr.indexOf("Safari")>=0;qr&&qr.indexOf("Edg/")>=0;qr&&qr.indexOf("Android")>=0;var _o=typeof navigator=="object"?navigator:{};O0||document.queryCommandSupported&&document.queryCommandSupported("copy")||_o&&_o.clipboard&&_o.clipboard.writeText,O0||_o&&_o.clipboard&&_o.clipboard.readText;var Zv=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}},bf=new Zv,I0=new Zv,B0=new Zv,QT=new Array(230),oC;(e=>{function t(l){return bf.keyCodeToStr(l)}e.toString=t;function n(l){return bf.strToKeyCode(l)}e.fromString=n;function r(l){return I0.keyCodeToStr(l)}e.toUserSettingsUS=r;function s(l){return B0.keyCodeToStr(l)}e.toUserSettingsGeneral=s;function i(l){return I0.strToKeyCode(l)||B0.strToKeyCode(l)}e.fromUserSettings=i;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 bf.keyCodeToStr(l)}e.toElectronAccelerator=o})(oC||(oC={}));var XT=class aC{constructor(t,n,r,s,i){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=s,this.keyCode=i}equals(t){return t instanceof aC&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${n}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new GT([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},GT=class{constructor(e){if(e.length===0)throw wT("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function JT(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return oC.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Om)switch(t){case 59:return 85;case 60:if(qT)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Wr)return 57;break}else if(zT&&(Wr&&t===93||!Wr&&t===92))return 57;return QT[t]||0}var ZT=Wr?256:2048,e5=512,t5=1024,n5=Wr?2048:256,F0=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=JT(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|=ZT),this.altKey&&(t|=e5),this.shiftKey&&(t|=t5),this.metaKey&&(t|=n5),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new XT(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},z0=new WeakMap;function r5(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var s5=class{static getSameOriginWindowChain(e){let t=z0.get(e);if(!t){t=[],z0.set(e,t);let n=e,r;do r=r5(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,s=this.getSameOriginWindowChain(e);for(let i of s){let o=i.window.deref();if(n+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===t||!i.iframeElement)break;let l=i.iframeElement.getBoundingClientRect();n+=l.top,r+=l.left}return{top:n,left:r}}},iu=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=s5.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},$0=class{constructor(e,t=0,n=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(Jv){let i=navigator.userAgent.match(/Chrome\/(\d+)/);r=(i?parseInt(i[1]):123)<=122}if(e){let i=e,o=e,l=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof i.wheelDeltaY<"u")r?this.deltaY=i.wheelDeltaY/(120*l):this.deltaY=i.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let c=e;c.deltaMode===c.DOM_DELTA_LINE?Om&&!Wr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof i.wheelDeltaX<"u")$T&&iC?this.deltaX=-(i.wheelDeltaX/120):r?this.deltaX=i.wheelDeltaX/(120*l):this.deltaX=i.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let c=e;c.deltaMode===c.DOM_DELTA_LINE?Om&&!Wr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?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()}},lC=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),i5;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof o5?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:$t.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:lC})})(i5||(i5={}));var o5=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?lC:(this._emitter||(this._emitter=new ee),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},ex=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 Pm("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Pm("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},a5=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Pm("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Ve(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},l5;(e=>{async function t(r){let s,i=await Promise.all(r.map(o=>o.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return i}e.settled=t;function n(r){return new Promise(async(s,i)=>{try{await r(s,i)}catch(o){i(o)}})}e.withAsyncBody=n})(l5||(l5={}));var H0=class Yn{static fromArray(t){return new Yn(n=>{n.emitMany(t)})}static fromPromise(t){return new Yn(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Yn(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Yn(async n=>{await Promise.all(t.map(async r=>{for await(let s of r)n.emitOne(s)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new ee,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.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 $t.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new Yn(async r=>{for await(let s of t)r.emitOne(n(s))})}map(t){return Yn.map(this,t)}static filter(t,n){return new Yn(async r=>{for await(let s of t)n(s)&&r.emitOne(s)})}filter(t){return Yn.filter(this,t)}static coalesce(t){return Yn.filter(t,n=>!!n)}coalesce(){return Yn.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Yn.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())}};H0.EMPTY=H0.fromArray([]);var{getWindow:zr,getWindowId:c5,onDidRegisterWindow:u5}=function(){let e=new Map,t={window:as,disposables:new ui};e.set(as.vscodeWindowId,t);let n=new ee,r=new ee,s=new ee;function i(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return Se.None;let l=new ui,c={window:o,disposables:l.add(new ui)};return e.set(o.vscodeWindowId,c),l.add(Ve(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),l.add(pe(o,jt.BEFORE_UNLOAD,()=>{s.fire(o)})),n.fire(c),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:i,getWindow(o){var u;let l=o;if((u=l==null?void 0:l.ownerDocument)!=null&&u.defaultView)return l.ownerDocument.defaultView.window;let c=o;return c!=null&&c.view?c.view.window:as},getDocument(o){return zr(o).document}}}(),d5=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!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 pe(e,t,n,r){return new d5(e,t,n,r)}var W0=function(e,t,n,r){return pe(e,t,n,r)},tx,h5=class extends a5{constructor(e){super(),this.defaultTarget=e&&zr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},U0=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){Bu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,s=i=>{n.set(i,!1);let o=e.get(i)??[];for(t.set(i,o),e.set(i,[]),r.set(i,!0);o.length>0;)o.sort(U0.sort),o.shift().execute();r.set(i,!1)};tx=(i,o,l=0)=>{let c=c5(i),u=new U0(o,l),h=e.get(c);return h||(h=[],e.set(c,h)),h.push(u),n.get(c)||(n.set(c,!0),i.requestAnimationFrame(()=>s(c))),u}})();function f5(e){let t=e.getBoundingClientRect(),n=zr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var jt={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"},p5=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=vn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=vn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=vn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=vn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=vn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=vn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=vn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=vn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=vn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=vn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=vn(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=vn(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=vn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=vn(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 vn(e){return typeof e=="number"?`${e}px`:e}function El(e){return new p5(e)}var cC=class{constructor(){this._hooks=new ui,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let i=e;try{e.setPointerCapture(t),this._hooks.add(Ve(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{i=zr(e)}this._hooks.add(pe(i,jt.POINTER_MOVE,o=>{if(o.buttons!==n){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(pe(i,jt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function m5(e,t,n){let r=null,s=null;if(typeof n.value=="function"?(r="value",s=n.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",s=n.get),!s)throw new Error("not supported");let i=`$memoize$${t}`;n[r]=function(...o){return this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[i]}}var Tr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Tr||(Tr={}));var ll=class Yt extends Se{constructor(){super(),this.dispatched=!1,this.targets=new A0,this.ignoreTargets=new A0,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register($t.runAndSubscribe(u5,({window:t,disposables:n})=>{n.add(pe(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(pe(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(pe(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:as,disposables:this._store}))}static addTarget(t){if(!Yt.isTouchDevice())return Se.None;Yt.INSTANCE||(Yt.INSTANCE=new Yt);let n=Yt.INSTANCE.targets.push(t);return Ve(n)}static ignoreTarget(t){if(!Yt.isTouchDevice())return Se.None;Yt.INSTANCE||(Yt.INSTANCE=new Yt);let n=Yt.INSTANCE.ignoreTargets.push(t);return Ve(n)}static isTouchDevice(){return"ontouchstart"in as||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=t.targetTouches.length;r<s;r++){let i=t.targetTouches.item(r);this.activeTouches[i.identifier]={id:i.identifier,initialTarget:i.target,initialTimeStamp:n,initialPageX:i.pageX,initialPageY:i.pageY,rollingTimestamps:[n],rollingPageX:[i.pageX],rollingPageY:[i.pageY]};let o=this.newGestureEvent(Tr.Start,i.target);o.pageX=i.pageX,o.pageY=i.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let i=0,o=n.changedTouches.length;i<o;i++){let l=n.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let c=this.activeTouches[l.identifier],u=Date.now()-c.initialTimeStamp;if(u<Yt.HOLD_DELAY&&Math.abs(c.initialPageX-Mn(c.rollingPageX))<30&&Math.abs(c.initialPageY-Mn(c.rollingPageY))<30){let h=this.newGestureEvent(Tr.Tap,c.initialTarget);h.pageX=Mn(c.rollingPageX),h.pageY=Mn(c.rollingPageY),this.dispatchEvent(h)}else if(u>=Yt.HOLD_DELAY&&Math.abs(c.initialPageX-Mn(c.rollingPageX))<30&&Math.abs(c.initialPageY-Mn(c.rollingPageY))<30){let h=this.newGestureEvent(Tr.Contextmenu,c.initialTarget);h.pageX=Mn(c.rollingPageX),h.pageY=Mn(c.rollingPageY),this.dispatchEvent(h)}else if(s===1){let h=Mn(c.rollingPageX),d=Mn(c.rollingPageY),p=Mn(c.rollingTimestamps)-c.rollingTimestamps[0],f=h-c.rollingPageX[0],m=d-c.rollingPageY[0],g=[...this.targets].filter(w=>c.initialTarget instanceof Node&&w.contains(c.initialTarget));this.inertia(t,g,r,Math.abs(f)/p,f>0?1:-1,h,Math.abs(m)/p,m>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(Tr.End,c.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===Tr.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>Yt.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Tr.Change||t.type===Tr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let s=0,i=t.initialTarget;for(;i&&i!==r;)s++,i=i.parentElement;n.push([s,r])}n.sort((r,s)=>r[0]-s[0]);for(let[r,s]of n)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,s,i,o,l,c,u){this.handle=tx(t,()=>{let h=Date.now(),d=h-r,p=0,f=0,m=!0;s+=Yt.SCROLL_FRICTION*d,l+=Yt.SCROLL_FRICTION*d,s>0&&(m=!1,p=i*s*d),l>0&&(m=!1,f=c*l*d);let g=this.newGestureEvent(Tr.Change);g.translationX=p,g.translationY=f,n.forEach(w=>w.dispatchEvent(g)),m||this.inertia(t,n,h,s,i,o+p,l,c,u+f)})}onTouchMove(t){let n=Date.now();for(let r=0,s=t.changedTouches.length;r<s;r++){let i=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(i.identifier))){console.warn("end of an UNKNOWN touch",i);continue}let o=this.activeTouches[i.identifier],l=this.newGestureEvent(Tr.Change,o.initialTarget);l.translationX=i.pageX-Mn(o.rollingPageX),l.translationY=i.pageY-Mn(o.rollingPageY),l.pageX=i.pageX,l.pageY=i.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(i.pageX),o.rollingPageY.push(i.pageY),o.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};ll.SCROLL_FRICTION=-.005,ll.HOLD_DELAY=700,ll.CLEAR_TAP_COUNT_TIME=400,ot([m5],ll,"isTouchDevice",1);var g5=ll,nx=class extends Se{onclick(e,t){this._register(pe(e,jt.CLICK,n=>t(new iu(zr(e),n))))}onmousedown(e,t){this._register(pe(e,jt.MOUSE_DOWN,n=>t(new iu(zr(e),n))))}onmouseover(e,t){this._register(pe(e,jt.MOUSE_OVER,n=>t(new iu(zr(e),n))))}onmouseleave(e,t){this._register(pe(e,jt.MOUSE_LEAVE,n=>t(new iu(zr(e),n))))}onkeydown(e,t){this._register(pe(e,jt.KEY_DOWN,n=>t(new F0(n))))}onkeyup(e,t){this._register(pe(e,jt.KEY_UP,n=>t(new F0(n))))}oninput(e,t){this._register(pe(e,jt.INPUT,t))}onblur(e,t){this._register(pe(e,jt.BLUR,t))}onfocus(e,t){this._register(pe(e,jt.FOCUS,t))}onchange(e,t){this._register(pe(e,jt.CHANGE,t))}ignoreGesture(e){return g5.ignoreTarget(e)}},q0=11,v5=class extends nx{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 cC),this._register(W0(this.bgDomNode,jt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(W0(this.domNode,jt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new h5),this._pointerdownScheduleRepeatTimer=this._register(new ex)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,zr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},x5=class Fm{constructor(t,n,r,s,i,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,s=s|0,i=i|0,o=o|0,l=l|0),this.rawScrollLeft=s,this.rawScrollTop=l,n<0&&(n=0),s+n>r&&(s=r-n),s<0&&(s=0),i<0&&(i=0),l+i>o&&(l=o-i),l<0&&(l=0),this.width=n,this.scrollWidth=r,this.scrollLeft=s,this.height=i,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,n){return new Fm(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Fm(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,i=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,c=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:i,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:c}}},y5=class extends Se{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new x5(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 r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new V0(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=V0.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},K0=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function wf(e,t){let n=t-e;return function(r){return e+n*w5(r)}}function _5(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var V0=class zm{constructor(t,n,r,s){this.from=t,this.to=n,this.duration=s,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let s,i;return t<n?(s=t+.75*r,i=n-.75*r):(s=t-.75*r,i=n+.75*r),_5(wf(t,s),wf(i,n),.33)}return wf(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),s=this.scrollTop(n);return new K0(r,s,!1)}return new K0(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return zm.start(t,n,r)}static start(t,n,r){r=r+10;let s=Date.now()-10;return new zm(t,n,s,r)}};function b5(e){return Math.pow(e,3)}function w5(e){return 1-b5(1-e)}var S5=class extends Se{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new ex)}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":"")))}},k5=140,uC=class extends nx{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 S5(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new cC),this._shouldRender=!0,this.domNode=El(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(pe(this.domNode.domNode,jt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new v5(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=El(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(pe(this.slider.domNode,jt.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);n<=s&&s<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let s=f5(this.domNode.domNode);t=e.pageX-s.left,n=e.pageY-s.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let i=this._sliderOrthogonalPointerPosition(s),o=Math.abs(i-n);if(iC&&o>k5){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let l=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(r.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()}},dC=class $m{constructor(t,n,r,s,i,o){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=i,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new $m(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,s,i){let o=Math.max(0,r-t),l=Math.max(0,o-2*n),c=s>0&&s>r;if(!c)return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let u=Math.round(Math.max(20,Math.floor(r*l/s))),h=(l-u)/(s-r),d=i*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(u),computedSliderRatio:h,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=$m._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},C5=class extends uC{constructor(e,t,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new dC(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,s.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}},N5=class extends uC{constructor(e,t,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new dC(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,s.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}},E5=500,Y0=50,j5=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Hm=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,s=this._rear;do{let i=s===this._front?t:Math.pow(2,-r);if(t-=i,n+=this._memory[s].score*i,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(Jv){let n=zr(t.browserEvent),r=FT(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let s=null,i=new j5(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,s)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let s=Math.abs(t.deltaX),i=Math.abs(t.deltaY),o=Math.abs(n.deltaX),l=Math.abs(n.deltaY),c=Math.max(Math.min(s,o),1),u=Math.max(Math.min(i,l),1),h=Math.max(s,o),d=Math.max(i,l);h%c===0&&d%u===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Hm.INSTANCE=new Hm;var R5=Hm,P5=class extends nx{constructor(e,t,n){super(),this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ee),this.onWillScroll=this._onWillScroll.event,this._options=D5(t),this._scrollable=n,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new N5(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new C5(this._scrollable,this._options,r)),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=El(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=El(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=El(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,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new ex),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ro(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,Wr&&(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 $0(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ro(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new $0(n))};this._mouseWheelToDispose.push(pe(this._listenOnDomNode,jt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=R5.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let i=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+i===0?o=i=0:Math.abs(i)>=Math.abs(o)?o=0:i=0),this._options.flipAxes&&([i,o]=[o,i]);let l=!Wr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=i,i=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,i=i*this._options.fastScrollSensitivity);let c=this._scrollable.getFutureScrollPosition(),u={};if(i){let h=Y0*i,d=c.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(u,d)}if(o){let h=Y0*o,d=c.scrollLeft-(h<0?Math.floor(h):Math.ceil(h));this._horizontalScrollbar.writeScrollPosition(u,d)}u=this._scrollable.validateScrollPosition(u),(c.scrollLeft!==u.scrollLeft||c.scrollTop!==u.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(u):this._scrollable.setScrollPositionNow(u),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",s=t?" top":"",i=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${i}${s}${r}`)}}_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(),E5)}},T5=class extends P5{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function D5(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,Wr&&(t.className+=" mac"),t}var Wm=class extends Se{constructor(e,t,n,r,s,i,o,l){super(),this._bufferService=n,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new ee),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new y5({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:u=>tx(r.window,u)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new T5(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(u=>{this._scrollableElement.updateOptions({handleMouseWheel:!(u&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register($t.runAndSubscribe(i.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=i.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ve(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ve(()=>this._styleElement.remove())),this._register($t.runAndSubscribe(i.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${i.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${i.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${i.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
454
- `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(u=>this._handleScroll(u)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Wm=ot([ie(2,fn),ie(3,xs),ie(4,qk),ie(5,Ra),ie(6,pn),ie(7,ys)],Wm);var Um=class extends Se{constructor(e,t,n,r,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(i=>this._removeDecoration(i))),this._register(Ve(()=>{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 r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Um=ot([ie(1,fn),ie(2,xs),ie(3,kc),ie(4,ys)],Um);var M5=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Rr={full:0,left:0,center:0,right:0},js={full:0,left:0,center:0,right:0},Ka={full:0,left:0,center:0,right:0},Md=class extends Se{constructor(e,t,n,r,s,i,o,l){var u;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=s,this._optionsService=i,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new M5,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(u=this._viewportElement.parentElement)==null||u.insertBefore(this._canvas,this._viewportElement),this._register(Ve(()=>{var h;return(h=this._canvas)==null?void 0:h.remove()}));let c=this._canvas.getContext("2d");if(c)this._ctx=c;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);js.full=this._canvas.width,js.left=e,js.center=t,js.right=e,this._refreshDrawHeightConstants(),Ka.full=1,Ka.left=1,Ka.center=1+js.left,Ka.right=1+js.left+js.center}_refreshDrawHeightConstants(){Rr.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);Rr.left=t,Rr.center=t,Rr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Rr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Rr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Rr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Rr.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(Ka[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Rr[e.position||"full"]/2),js[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Rr[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}))}};Md=ot([ie(2,fn),ie(3,kc),ie(4,ys),ie(5,pn),ie(6,Ra),ie(7,xs)],Md);var Q;(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=`
455
- `,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=""))(Q||(Q={}));var $u;(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="Ÿ"))($u||($u={}));var hC;(e=>e.ST=`${Q.ESC}\\`)(hC||(hC={}));var qm=class{constructor(e,t,n,r,s,i){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=s,this._renderService=i,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Q.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(i.width,1)+"px",this._textarea.style.height=Math.max(i.height,1)+"px",this._textarea.style.lineHeight=i.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};qm=ot([ie(2,fn),ie(3,pn),ie(4,fo),ie(5,ys)],qm);var Dt=0,Mt=0,At=0,rt=0,Q0={css:"#00000000",rgba:0},ft;(e=>{function t(s,i,o,l){return l!==void 0?`#${Si(s)}${Si(i)}${Si(o)}${Si(l)}`:`#${Si(s)}${Si(i)}${Si(o)}`}e.toCss=t;function n(s,i,o,l=255){return(s<<24|i<<16|o<<8|l)>>>0}e.toRgba=n;function r(s,i,o,l){return{css:e.toCss(s,i,o,l),rgba:e.toRgba(s,i,o,l)}}e.toColor=r})(ft||(ft={}));var We;(e=>{function t(c,u){if(rt=(u.rgba&255)/255,rt===1)return{css:u.css,rgba:u.rgba};let h=u.rgba>>24&255,d=u.rgba>>16&255,p=u.rgba>>8&255,f=c.rgba>>24&255,m=c.rgba>>16&255,g=c.rgba>>8&255;Dt=f+Math.round((h-f)*rt),Mt=m+Math.round((d-m)*rt),At=g+Math.round((p-g)*rt);let w=ft.toCss(Dt,Mt,At),v=ft.toRgba(Dt,Mt,At);return{css:w,rgba:v}}e.blend=t;function n(c){return(c.rgba&255)===255}e.isOpaque=n;function r(c,u,h){let d=Hu.ensureContrastRatio(c.rgba,u.rgba,h);if(d)return ft.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=r;function s(c){let u=(c.rgba|255)>>>0;return[Dt,Mt,At]=Hu.toChannels(u),{css:ft.toCss(Dt,Mt,At),rgba:u}}e.opaque=s;function i(c,u){return rt=Math.round(u*255),[Dt,Mt,At]=Hu.toChannels(c.rgba),{css:ft.toCss(Dt,Mt,At,rt),rgba:ft.toRgba(Dt,Mt,At,rt)}}e.opacity=i;function o(c,u){return rt=c.rgba&255,i(c,rt*u/255)}e.multiplyOpacity=o;function l(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}e.toColorRGB=l})(We||(We={}));var Qe;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let i=s.getContext("2d",{willReadFrequently:!0});i&&(t=i,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Dt=parseInt(s.slice(1,2).repeat(2),16),Mt=parseInt(s.slice(2,3).repeat(2),16),At=parseInt(s.slice(3,4).repeat(2),16),ft.toColor(Dt,Mt,At);case 5:return Dt=parseInt(s.slice(1,2).repeat(2),16),Mt=parseInt(s.slice(2,3).repeat(2),16),At=parseInt(s.slice(3,4).repeat(2),16),rt=parseInt(s.slice(4,5).repeat(2),16),ft.toColor(Dt,Mt,At,rt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let i=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(i)return Dt=parseInt(i[1]),Mt=parseInt(i[2]),At=parseInt(i[3]),rt=Math.round((i[5]===void 0?1:parseFloat(i[5]))*255),ft.toColor(Dt,Mt,At,rt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Dt,Mt,At,rt]=t.getImageData(0,0,1,1).data,rt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ft.toRgba(Dt,Mt,At,rt),css:s}}e.toColor=r})(Qe||(Qe={}));var tn;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,s,i){let o=r/255,l=s/255,c=i/255,u=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=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return u*.2126+h*.7152+d*.0722}e.relativeLuminance2=n})(tn||(tn={}));var Hu;(e=>{function t(o,l){if(rt=(l&255)/255,rt===1)return l;let c=l>>24&255,u=l>>16&255,h=l>>8&255,d=o>>24&255,p=o>>16&255,f=o>>8&255;return Dt=d+Math.round((c-d)*rt),Mt=p+Math.round((u-p)*rt),At=f+Math.round((h-f)*rt),ft.toRgba(Dt,Mt,At)}e.blend=t;function n(o,l,c){let u=tn.relativeLuminance(o>>8),h=tn.relativeLuminance(l>>8);if(Gr(u,h)<c){if(h<u){let f=r(o,l,c),m=Gr(u,tn.relativeLuminance(f>>8));if(m<c){let g=s(o,l,c),w=Gr(u,tn.relativeLuminance(g>>8));return m>w?f:g}return f}let d=s(o,l,c),p=Gr(u,tn.relativeLuminance(d>>8));if(p<c){let f=r(o,l,c),m=Gr(u,tn.relativeLuminance(f>>8));return p>m?d:f}return d}}e.ensureContrastRatio=n;function r(o,l,c){let u=o>>24&255,h=o>>16&255,d=o>>8&255,p=l>>24&255,f=l>>16&255,m=l>>8&255,g=Gr(tn.relativeLuminance2(p,f,m),tn.relativeLuminance2(u,h,d));for(;g<c&&(p>0||f>0||m>0);)p-=Math.max(0,Math.ceil(p*.1)),f-=Math.max(0,Math.ceil(f*.1)),m-=Math.max(0,Math.ceil(m*.1)),g=Gr(tn.relativeLuminance2(p,f,m),tn.relativeLuminance2(u,h,d));return(p<<24|f<<16|m<<8|255)>>>0}e.reduceLuminance=r;function s(o,l,c){let u=o>>24&255,h=o>>16&255,d=o>>8&255,p=l>>24&255,f=l>>16&255,m=l>>8&255,g=Gr(tn.relativeLuminance2(p,f,m),tn.relativeLuminance2(u,h,d));for(;g<c&&(p<255||f<255||m<255);)p=Math.min(255,p+Math.ceil((255-p)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),g=Gr(tn.relativeLuminance2(p,f,m),tn.relativeLuminance2(u,h,d));return(p<<24|f<<16|m<<8|255)>>>0}e.increaseLuminance=s;function i(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=i})(Hu||(Hu={}));function Si(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Gr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var A5=class extends Sc{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ad=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new or}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),s=0,i=0,o=0,l=t.getFg(0),c=t.getBg(0);for(let u=0;u<t.getTrimmedLength();u++)if(t.loadCell(u,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==c){if(u-s>1){let h=this._getJoinedRanges(r,o,i,t,s);for(let d=0;d<h.length;d++)n.push(h[d])}s=u,o=i,l=this._workCell.fg,c=this._workCell.bg}i+=this._workCell.getChars().length||Js.length}if(this._bufferService.cols-s>1){let u=this._getJoinedRanges(r,o,i,t,s);for(let h=0;h<u.length;h++)n.push(u[h])}return n}_getJoinedRanges(e,t,n,r,s){let i=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(i)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let c=this._characterJoiners[l].handler(i);for(let u=0;u<c.length;u++)Ad._mergeRanges(o,c[u])}catch(c){console.error(c)}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(e,t,n){let r=0,s=!1,i=0,o=e[r];if(o){for(let l=n;l<this._bufferService.cols;l++){let c=t.getWidth(l),u=t.getString(l).length||Js.length;if(c!==0){if(!s&&o[0]<=i&&(o[0]=l,s=!0),o[1]<=i){if(o[1]=l,o=e[++r],!o)break;o[0]<=i?(o[0]=l,s=!0):s=!1}i+=u}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];if(n){if(t[1]<=s[0])return e[r-1][1]=t[1],e;if(t[1]<=s[1])return e[r-1][1]=Math.max(t[1],s[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=s[0])return e.splice(r,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Ad=ot([ie(0,fn)],Ad);function L5(e){return 57508<=e&&e<=57558}function O5(e){return 9472<=e&&e<=9631}function I5(e){return L5(e)||O5(e)}function B5(){return{css:{canvas:ou(),cell:ou()},device:{canvas:ou(),cell:ou(),char:{width:0,height:0,left:0,top:0}}}}function ou(){return{width:0,height:0}}var Km=class{constructor(e,t,n,r,s,i,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=s,this._decorationService=i,this._themeService=o,this._workCell=new or,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,s,i,o,l,c,u,h){let d=[],p=this._characterJoinerService.getJoinedCharacters(t),f=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<i+1&&(m=i+1);let g,w=0,v="",y=0,_=0,b=0,N=0,k=!1,j=0,D=!1,F=0,P=0,O=[],T=u!==-1&&h!==-1;for(let E=0;E<m;E++){e.loadCell(E,this._workCell);let R=this._workCell.getWidth();if(R===0)continue;let L=!1,$=E>=P,K=E,A=this._workCell;if(p.length>0&&E===p[0][0]&&$){let _e=p.shift(),ne=this._isCellInSelection(_e[0],t);for(y=_e[0]+1;y<_e[1];y++)$&&($=ne===this._isCellInSelection(y,t));$&&($=!n||i<_e[0]||i>=_e[1]),$?(L=!0,A=new A5(this._workCell,e.translateToString(!0,_e[0],_e[1]),_e[1]-_e[0]),K=_e[1]-1,R=A.getWidth()):P=_e[1]}let H=this._isCellInSelection(E,t),S=n&&E===i,Y=T&&E>=u&&E<=h,B=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,_e=>{B=!0});let C=A.getChars()||Js;if(C===" "&&(A.isUnderline()||A.isOverline())&&(C=" "),F=R*l-c.get(C,A.isBold(),A.isItalic()),!g)g=this._document.createElement("span");else if(w&&(H&&D||!H&&!D&&A.bg===_)&&(H&&D&&f.selectionForeground||A.fg===b)&&A.extended.ext===N&&Y===k&&F===j&&!S&&!L&&!B&&$){A.isInvisible()?v+=Js:v+=C,w++;continue}else w&&(g.textContent=v),g=this._document.createElement("span"),w=0,v="";if(_=A.bg,b=A.fg,N=A.extended.ext,k=Y,j=F,D=H,L&&i>=E&&i<=K&&(i=E),!this._coreService.isCursorHidden&&S&&this._coreService.isCursorInitialized){if(O.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&O.push("xterm-cursor-blink"),O.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":O.push("xterm-cursor-outline");break;case"block":O.push("xterm-cursor-block");break;case"bar":O.push("xterm-cursor-bar");break;case"underline":O.push("xterm-cursor-underline");break}}if(A.isBold()&&O.push("xterm-bold"),A.isItalic()&&O.push("xterm-italic"),A.isDim()&&O.push("xterm-dim"),A.isInvisible()?v=Js:v=A.getChars()||Js,A.isUnderline()&&(O.push(`xterm-underline-${A.extended.underlineStyle}`),v===" "&&(v=" "),!A.isUnderlineColorDefault()))if(A.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${Sc.toColorRGB(A.getUnderlineColor()).join(",")})`;else{let _e=A.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&A.isBold()&&_e<8&&(_e+=8),g.style.textDecorationColor=f.ansi[_e].css}A.isOverline()&&(O.push("xterm-overline"),v===" "&&(v=" ")),A.isStrikethrough()&&O.push("xterm-strikethrough"),Y&&(g.style.textDecoration="underline");let U=A.getFgColor(),I=A.getFgColorMode(),q=A.getBgColor(),z=A.getBgColorMode(),te=!!A.isInverse();if(te){let _e=U;U=q,q=_e;let ne=I;I=z,z=ne}let se,ye,De=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,_e=>{_e.options.layer!=="top"&&De||(_e.backgroundColorRGB&&(z=50331648,q=_e.backgroundColorRGB.rgba>>8&16777215,se=_e.backgroundColorRGB),_e.foregroundColorRGB&&(I=50331648,U=_e.foregroundColorRGB.rgba>>8&16777215,ye=_e.foregroundColorRGB),De=_e.options.layer==="top")}),!De&&H&&(se=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,q=se.rgba>>8&16777215,z=50331648,De=!0,f.selectionForeground&&(I=50331648,U=f.selectionForeground.rgba>>8&16777215,ye=f.selectionForeground)),De&&O.push("xterm-decoration-top");let $e;switch(z){case 16777216:case 33554432:$e=f.ansi[q],O.push(`xterm-bg-${q}`);break;case 50331648:$e=ft.toColor(q>>16,q>>8&255,q&255),this._addStyle(g,`background-color:#${X0((q>>>0).toString(16),"0",6)}`);break;case 0:default:te?($e=f.foreground,O.push("xterm-bg-257")):$e=f.background}switch(se||A.isDim()&&(se=We.multiplyOpacity($e,.5)),I){case 16777216:case 33554432:A.isBold()&&U<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(U+=8),this._applyMinimumContrast(g,$e,f.ansi[U],A,se,void 0)||O.push(`xterm-fg-${U}`);break;case 50331648:let _e=ft.toColor(U>>16&255,U>>8&255,U&255);this._applyMinimumContrast(g,$e,_e,A,se,ye)||this._addStyle(g,`color:#${X0(U.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,$e,f.foreground,A,se,ye)||te&&O.push("xterm-fg-257")}O.length&&(g.className=O.join(" "),O.length=0),!S&&!L&&!B&&$?w++:g.textContent=v,F!==this.defaultSpacing&&(g.style.letterSpacing=`${F}px`),d.push(g),E=K}return g&&w&&(g.textContent=v),d}_applyMinimumContrast(e,t,n,r,s,i){if(this._optionsService.rawOptions.minimumContrastRatio===1||I5(r.getCode()))return!1;let o=this._getContrastCache(r),l;if(!s&&!i&&(l=o.getColor(t.rgba,n.rgba)),l===void 0){let c=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);l=We.ensureContrastRatio(s||t,i||n,c),o.setColor((s||t).rgba,(i||n).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 n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};Km=ot([ie(1,Yk),ie(2,pn),ie(3,xs),ie(4,fo),ie(5,kc),ie(6,Ra)],Km);function X0(e,t,n){for(;e.length<n;)e=t+e;return e}var F5=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold",i.style.fontStyle="italic",this._measureElements=[n,r,s,i],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(i),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let s=e;t&&(s+="B"),n&&(s+="I");let i=this._holey.get(s);if(i===void 0){let o=0;t&&(o|=1),n&&(o|=2),i=this._measure(e,o),i>0&&this._holey.set(s,i)}return i}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},z5=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let s=e.buffers.active.ydisp,i=t[1]-s,o=n[1]-s,l=Math.max(i,0),c=Math.min(o,e.rows-1);if(l>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=i,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function $5(){return new z5}var Sf="xterm-dom-renderer-owner-",Vn="xterm-rows",au="xterm-fg-",G0="xterm-bg-",Va="xterm-focus",lu="xterm-selection",H5=1,Vm=class extends Se{constructor(e,t,n,r,s,i,o,l,c,u,h,d,p,f){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=s,this._helperContainer=i,this._linkifier2=o,this._charSizeService=c,this._optionsService=u,this._bufferService=h,this._coreService=d,this._coreBrowserService=p,this._themeService=f,this._terminalClass=H5++,this._rowElements=[],this._selectionRenderModel=$5(),this.onRequestRedraw=this._register(new ee).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Vn),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(lu),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=B5(),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(Km,document),this._element.classList.add(Sf+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(Ve(()=>{this._element.classList.remove(Sf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new F5(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Vn} 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} .${Vn} { 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} .${Vn} .xterm-dim { color: ${We.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Vn}.${Va} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Vn}.${Va} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Vn}.${Va} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Vn} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Vn} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Vn} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Vn} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Vn} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${lu} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${lu} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${lu} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[i,o]of e.ansi.entries())t+=`${this._terminalSelector} .${au}${i} { color: ${o.css}; }${this._terminalSelector} .${au}${i}.xterm-dim { color: ${We.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${G0}${i} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${au}257 { color: ${We.opaque(e.background).css}; }${this._terminalSelector} .${au}257.xterm-dim { color: ${We.multiplyOpacity(We.opaque(e.background),.5).css}; }${this._terminalSelector} .${G0}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(Va),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Va),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,i=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(n){let c=e[0]>t[0];l.appendChild(this._createSelectionElement(i,c?t[0]:e[0],c?e[0]:t[0],o-i+1))}else{let c=r===i?e[0]:0,u=i===s?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(i,c,u));let h=o-i-1;if(l.appendChild(this._createSelectionElement(i+1,0,this._bufferService.cols,h)),i!==o){let d=s===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,d))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,n,r=1){let s=this._document.createElement("div"),i=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return i+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-i),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${i}px`,s.style.width=`${o}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,s=Math.min(n.x,this._bufferService.cols-1),i=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let u=c+n.ydisp,h=this._rowElements[c],d=n.lines.get(u);if(!h||!d)break;h.replaceChildren(...this._rowFactory.createRow(d,u,u===r,o,l,s,i,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Sf}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,s,i){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),s=Math.min(s,this._bufferService.cols);let l=this._bufferService.buffer,c=l.ybase+l.y,u=Math.min(l.x,s-1),h=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=n;f<=r;++f){let m=f+l.ydisp,g=this._rowElements[f],w=l.lines.get(m);if(!g||!w)break;g.replaceChildren(...this._rowFactory.createRow(w,m,m===c,d,p,u,h,this.dimensions.css.cell.width,this._widthCache,i?f===n?e:0:-1,i?(f===r?t:s)-1:-1))}}};Vm=ot([ie(7,Qv),ie(8,yh),ie(9,pn),ie(10,fn),ie(11,fo),ie(12,xs),ie(13,Ra)],Vm);var Ym=class extends Se{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ee),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new U5(this._optionsService))}catch{this._measureStrategy=this._register(new W5(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())}};Ym=ot([ie(2,pn)],Ym);var fC=class extends Se{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)}},W5=class extends fC{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},U5=class extends fC{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}},q5=class extends Se{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new K5(this._window)),this._onDprChange=this._register(new ee),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ee),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register($t.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(pe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(pe(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}},K5=class extends Se{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new ya),this._onDprChange=this._register(new ee),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ve(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=pe(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)}},V5=class extends Se{constructor(){super(),this.linkProviders=[],this._register(Ve(()=>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 rx(e,t,n){let r=n.getBoundingClientRect(),s=e.getComputedStyle(n),i=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-r.left-i,t.clientY-r.top-o]}function Y5(e,t,n,r,s,i,o,l,c){if(!i)return;let u=rx(e,t,n);if(u)return u[0]=Math.ceil((u[0]+(c?o/2:0))/o),u[1]=Math.ceil(u[1]/l),u[0]=Math.min(Math.max(u[0],1),r+(c?1:0)),u[1]=Math.min(Math.max(u[1],1),s),u}var Qm=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,s){return Y5(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let n=rx(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Qm=ot([ie(0,ys),ie(1,yh)],Qm);var Q5=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},pC={};iT(pC,{getSafariVersion:()=>G5,isChromeOS:()=>xC,isFirefox:()=>mC,isIpad:()=>J5,isIphone:()=>Z5,isLegacyEdge:()=>X5,isLinux:()=>sx,isMac:()=>Ld,isNode:()=>_h,isSafari:()=>gC,isWindows:()=>vC});var _h=typeof process<"u"&&"title"in process,Cc=_h?"node":navigator.userAgent,Nc=_h?"node":navigator.platform,mC=Cc.includes("Firefox"),X5=Cc.includes("Edge"),gC=/^((?!chrome|android).)*safari/i.test(Cc);function G5(){if(!gC)return 0;let e=Cc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Ld=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Nc),J5=Nc==="iPad",Z5=Nc==="iPhone",vC=["Windows","Win16","Win32","WinCE"].includes(Nc),sx=Nc.indexOf("Linux")>=0,xC=/\bCrOS\b/.test(Cc),yC=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),s=e.timeRemaining(),n*1.5>s){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=s}this.clear()}},eD=class extends yC{_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())}}},tD=class extends yC{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Od=!_h&&"requestIdleCallback"in window?tD:eD,nD=class{constructor(){this._queue=new Od}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Xm=class extends Se{constructor(e,t,n,r,s,i,o,l,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=s,this._coreBrowserService=l,this._renderer=this._register(new ya),this._pausedResizeTask=new nD,this._observerDisposable=this._register(new ya),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 ee),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ee),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ee),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ee),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Q5((u,h)=>this._renderRows(u,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new rD(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ve(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var u;return(u=this._renderer.value)==null?void 0:u.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(i.onDecorationRegistered(()=>this._fullRefresh())),this._register(i.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(u=>this._registerIntersectionObserver(u,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Ve(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Xm=ot([ie(2,pn),ie(3,yh),ie(4,fo),ie(5,kc),ie(6,fn),ie(7,xs),ie(8,Ra)],Xm);var rD=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function sD(e,t,n,r){let s=n.buffer.x,i=n.buffer.y;if(!n.buffer.hasScrollback)return aD(s,i,e,t,n,r)+bh(i,t,n,r)+lD(s,i,e,t,n,r);let o;if(i===t)return o=s>e?"D":"C",nc(Math.abs(s-e),tc(o,r));o=i>t?"D":"C";let l=Math.abs(i-t),c=oD(i>t?e:s,n)+(l-1)*n.cols+1+iD(i>t?s:e);return nc(c,tc(o,r))}function iD(e,t){return e-1}function oD(e,t){return t.cols-e}function aD(e,t,n,r,s,i){return bh(t,r,s,i).length===0?"":nc(bC(e,t,e,t-so(t,s),!1,s).length,tc("D",i))}function bh(e,t,n,r){let s=e-so(e,n),i=t-so(t,n),o=Math.abs(s-i)-cD(e,t,n);return nc(o,tc(_C(e,t),r))}function lD(e,t,n,r,s,i){let o;bh(t,r,s,i).length>0?o=r-so(r,s):o=t;let l=r,c=uD(e,t,n,r,s,i);return nc(bC(e,o,n,l,c==="C",s).length,tc(c,i))}function cD(e,t,n){var o;let r=0,s=e-so(e,n),i=t-so(t,n);for(let l=0;l<Math.abs(s-i);l++){let c=_C(e,t)==="A"?-1:1;(o=n.buffer.lines.get(s+c*l))!=null&&o.isWrapped&&r++}return r}function so(e,t){let n=0,r=t.buffer.lines.get(e),s=r==null?void 0:r.isWrapped;for(;s&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),s=r==null?void 0:r.isWrapped;return n}function uD(e,t,n,r,s,i){let o;return bh(n,r,s,i).length>0?o=r-so(r,s):o=t,e<n&&o<=r||e>=n&&o<r?"C":"D"}function _C(e,t){return e>t?"A":"B"}function bC(e,t,n,r,s,i){let o=e,l=t,c="";for(;(o!==n||l!==r)&&l>=0&&l<i.buffer.lines.length;)o+=s?1:-1,s&&o>i.cols-1?(c+=i.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!s&&o<0&&(c+=i.buffer.translateBufferLineToString(l,!1,0,e+1),o=i.cols-1,e=o,l--);return c+i.buffer.translateBufferLineToString(l,!1,e,o)}function tc(e,t){let n=t?"O":"[";return Q.ESC+n+e}function nc(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var dD=class{constructor(t){this._bufferService=t,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,n=this.selectionEnd;return!t||!n?!1:t[1]>n[1]||t[1]===n[1]&&t[0]>n[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function J0(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 kf=50,hD=15,fD=50,pD=500,mD=" ",gD=new RegExp(mD,"g"),Gm=class extends Se{constructor(e,t,n,r,s,i,o,l,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=s,this._mouseService=i,this._optionsService=o,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new or,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ee),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ee),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ee),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ee),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=u=>this._handleMouseMove(u),this._mouseUpListener=u=>this._handleMouseUp(u),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(u=>this._handleTrim(u)),this._register(this._bufferService.buffers.onBufferActivate(u=>this._handleBufferActivate(u))),this.enable(),this._model=new dD(this._bufferService),this._activeSelectionMode=0,this._register(Ve(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(u=>{u.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],i=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=n.translateBufferLineToString(o,!0,s,i);r.push(l)}}else{let s=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],s));for(let i=e[1]+1;i<=t[1]-1;i++){let o=n.lines.get(i),l=n.translateBufferLineToString(i,!0);o!=null&&o.isWrapped?r[r.length-1]+=l:r.push(l)}if(e[1]!==t[1]){let i=n.lines.get(t[1]),o=n.translateBufferLineToString(t[1],!0,0,t[0]);i&&i.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(s=>s.replace(gD," ")).join(vC?`\r
456
- `:`
457
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),sx&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var s,i;let n=(i=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:i.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=J0(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,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=rx(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-kf),kf),t/=kf,t/Math.abs(t)+Math.round(t*(hD-1)))}shouldForceSelection(e){return Ld?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(),fD)}_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&&!(Ld&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.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<pD&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=sD(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let s=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:s>1&&t!==r&&(n+=s-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,i=s.lines.get(e[1]);if(!i)return;let o=s.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(i,e[0]),c=l,u=e[0]-l,h=0,d=0,p=0,f=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;c<o.length&&o.charAt(c+1)===" ";)c++}else{let w=e[0],v=e[0];i.getWidth(w)===0&&(h++,w--),i.getWidth(v)===2&&(d++,v++);let y=i.getString(v).length;for(y>1&&(f+=y-1,c+=y-1);w>0&&l>0&&!this._isCharWordSeparator(i.loadCell(w-1,this._workCell));){i.loadCell(w-1,this._workCell);let _=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,w--):_>1&&(p+=_-1,l-=_-1),l--,w--}for(;v<i.length&&c+1<o.length&&!this._isCharWordSeparator(i.loadCell(v+1,this._workCell));){i.loadCell(v+1,this._workCell);let _=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,v++):_>1&&(f+=_-1,c+=_-1),c++,v++}}c++;let m=l+u-h+p,g=Math.min(this._bufferService.cols,c-l+h+d-p-f);if(!(!t&&o.slice(l,c).trim()==="")){if(n&&m===0&&i.getCodePoint(0)!==32){let w=s.lines.get(e[1]-1);if(w&&i.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let v=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(v){let y=this._bufferService.cols-v.start;m-=y,g+=y}}}if(r&&m+g===this._bufferService.cols&&i.getCodePoint(this._bufferService.cols-1)!==32){let w=s.lines.get(e[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let v=this._getWordAt([0,e[1]+1],!1,!1,!0);v&&(g+=v.length)}}return{start:m,length:g}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=J0(n,this._bufferService.cols)}};Gm=ot([ie(3,fn),ie(4,fo),ie(5,Xv),ie(6,pn),ie(7,ys),ie(8,xs)],Gm);var Z0=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},e_=class{constructor(){this._color=new Z0,this._css=new Z0}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},vt=Object.freeze((()=>{let e=[Qe.toColor("#2e3436"),Qe.toColor("#cc0000"),Qe.toColor("#4e9a06"),Qe.toColor("#c4a000"),Qe.toColor("#3465a4"),Qe.toColor("#75507b"),Qe.toColor("#06989a"),Qe.toColor("#d3d7cf"),Qe.toColor("#555753"),Qe.toColor("#ef2929"),Qe.toColor("#8ae234"),Qe.toColor("#fce94f"),Qe.toColor("#729fcf"),Qe.toColor("#ad7fa8"),Qe.toColor("#34e2e2"),Qe.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],s=t[n/6%6|0],i=t[n%6];e.push({css:ft.toCss(r,s,i),rgba:ft.toRgba(r,s,i)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:ft.toCss(r,r,r),rgba:ft.toRgba(r,r,r)})}return e})()),Ei=Qe.toColor("#ffffff"),cl=Qe.toColor("#000000"),t_=Qe.toColor("#ffffff"),n_=cl,Ya={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},vD=Ei,Jm=class extends Se{constructor(e){super(),this._optionsService=e,this._contrastCache=new e_,this._halfContrastCache=new e_,this._onChangeColors=this._register(new ee),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ei,background:cl,cursor:t_,cursorAccent:n_,selectionForeground:void 0,selectionBackgroundTransparent:Ya,selectionBackgroundOpaque:We.blend(cl,Ya),selectionInactiveBackgroundTransparent:Ya,selectionInactiveBackgroundOpaque:We.blend(cl,Ya),scrollbarSliderBackground:We.opacity(Ei,.2),scrollbarSliderHoverBackground:We.opacity(Ei,.4),scrollbarSliderActiveBackground:We.opacity(Ei,.5),overviewRulerBorder:Ei,ansi:vt.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=Le(e.foreground,Ei),t.background=Le(e.background,cl),t.cursor=We.blend(t.background,Le(e.cursor,t_)),t.cursorAccent=We.blend(t.background,Le(e.cursorAccent,n_)),t.selectionBackgroundTransparent=Le(e.selectionBackground,Ya),t.selectionBackgroundOpaque=We.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Le(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=We.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Le(e.selectionForeground,Q0):void 0,t.selectionForeground===Q0&&(t.selectionForeground=void 0),We.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=We.opacity(t.selectionBackgroundTransparent,.3)),We.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=We.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Le(e.scrollbarSliderBackground,We.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Le(e.scrollbarSliderHoverBackground,We.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Le(e.scrollbarSliderActiveBackground,We.opacity(t.foreground,.5)),t.overviewRulerBorder=Le(e.overviewRulerBorder,vD),t.ansi=vt.slice(),t.ansi[0]=Le(e.black,vt[0]),t.ansi[1]=Le(e.red,vt[1]),t.ansi[2]=Le(e.green,vt[2]),t.ansi[3]=Le(e.yellow,vt[3]),t.ansi[4]=Le(e.blue,vt[4]),t.ansi[5]=Le(e.magenta,vt[5]),t.ansi[6]=Le(e.cyan,vt[6]),t.ansi[7]=Le(e.white,vt[7]),t.ansi[8]=Le(e.brightBlack,vt[8]),t.ansi[9]=Le(e.brightRed,vt[9]),t.ansi[10]=Le(e.brightGreen,vt[10]),t.ansi[11]=Le(e.brightYellow,vt[11]),t.ansi[12]=Le(e.brightBlue,vt[12]),t.ansi[13]=Le(e.brightMagenta,vt[13]),t.ansi[14]=Le(e.brightCyan,vt[14]),t.ansi[15]=Le(e.brightWhite,vt[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=Le(e.extendedAnsi[r],vt[r+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()}}};Jm=ot([ie(0,pn)],Jm);function Le(e,t){if(e!==void 0)try{return Qe.toColor(e)}catch{}return t}var xD=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},yD=class{constructor(){this._services=new xD,this._services.set(Qv,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=hT(e).sort((i,o)=>i.index-o.index),r=[];for(let i of n){let o=this._services.get(i.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${i.id._id}.`);r.push(o)}let s=n.length>0?n[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},_D={trace:0,debug:1,info:2,warn:3,error:4,off:5},bD="xterm.js: ",Zm=class extends Se{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=_D[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":bD)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Zm=ot([ie(0,pn)],Zm);var r_=class extends Se{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ee),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ee),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ee),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let s=t-1;s>=0;s--)this.set(e+s+n,this.get(e+s));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},be=3,ht=Object.freeze(new Sc),cu=0,Cf=2,ul=class wC{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*be);let s=n||or.fromCharData([0,$k,1,0]);for(let i=0;i<t;++i)this.setCell(i,s);this.length=t}get(t){let n=this._data[t*be+0],r=n&2097151;return[this._data[t*be+1],n&2097152?this._combined[t]:r?Os(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*be+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*be+0]=t|2097152|n[2]<<22):this._data[t*be+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*be+0]>>22}hasWidth(t){return this._data[t*be+0]&12582912}getFg(t){return this._data[t*be+1]}getBg(t){return this._data[t*be+2]}hasContent(t){return this._data[t*be+0]&4194303}getCodePoint(t){let n=this._data[t*be+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*be+0]&2097152}getString(t){let n=this._data[t*be+0];return n&2097152?this._combined[t]:n&2097151?Os(n&2097151):""}isProtected(t){return this._data[t*be+2]&536870912}loadCell(t,n){return cu=t*be,n.content=this._data[cu+0],n.fg=this._data[cu+1],n.bg=this._data[cu+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*be+0]=n.content,this._data[t*be+1]=n.fg,this._data[t*be+2]=n.bg}setCellFromCodepoint(t,n,r,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*be+0]=n|r<<22,this._data[t*be+1]=s.fg,this._data[t*be+2]=s.bg}addCodepointToCell(t,n,r){let s=this._data[t*be+0];s&2097152?this._combined[t]+=Os(n):s&2097151?(this._combined[t]=Os(s&2097151)+Os(n),s&=-2097152,s|=2097152):s=n|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[t*be+0]=s}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let s=new or;for(let i=this.length-t-n-1;i>=0;--i)this.setCell(t+n+i,this.loadCell(t+i,s));for(let i=0;i<n;++i)this.setCell(t+i,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let s=new or;for(let i=0;i<this.length-t-n;++i)this.setCell(t+i,this.loadCell(t+n+i,s));for(let i=this.length-n;i<this.length;++i)this.setCell(i,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*Cf<this._data.buffer.byteLength;let r=t*be;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=t&&delete this._combined[l]}let i=Object.keys(this._extendedAttrs);for(let o=0;o<i.length;o++){let l=parseInt(i[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,r*4*Cf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Cf<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new wC(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*be+0]&4194303)return t+(this._data[t*be+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*be+0]&4194303||this._data[t*be+2]&50331648)return t+(this._data[t*be+0]>>22);return 0}copyCellsFrom(t,n,r,s,i){let o=t._data;if(i)for(let c=s-1;c>=0;c--){for(let u=0;u<be;u++)this._data[(r+c)*be+u]=o[(n+c)*be+u];o[(n+c)*be+2]&268435456&&(this._extendedAttrs[r+c]=t._extendedAttrs[n+c])}else for(let c=0;c<s;c++){for(let u=0;u<be;u++)this._data[(r+c)*be+u]=o[(n+c)*be+u];o[(n+c)*be+2]&268435456&&(this._extendedAttrs[r+c]=t._extendedAttrs[n+c])}let l=Object.keys(t._combined);for(let c=0;c<l.length;c++){let u=parseInt(l[c],10);u>=n&&(this._combined[u-n+r]=t._combined[u])}}translateToString(t,n,r,s){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let i="";for(;n<r;){let o=this._data[n*be+0],l=o&2097151,c=o&2097152?this._combined[n]:l?Os(l):Js;if(i+=c,s)for(let u=0;u<c.length;++u)s.push(n);n+=o>>22||1}return s&&s.push(n),i}};function wD(e,t,n,r,s,i){let o=[];for(let l=0;l<e.length-1;l++){let c=l,u=e.get(++c);if(!u.isWrapped)continue;let h=[e.get(l)];for(;c<e.length&&u.isWrapped;)h.push(u),u=e.get(++c);if(!i&&r>=l&&r<c){l+=h.length-1;continue}let d=0,p=rc(h,d,t),f=1,m=0;for(;f<h.length;){let w=rc(h,f,t),v=w-m,y=n-p,_=Math.min(v,y);h[d].copyCellsFrom(h[f],m,p,_,!1),p+=_,p===n&&(d++,p=0),m+=_,m===w&&(f++,m=0),p===0&&d!==0&&h[d-1].getWidth(n-1)===2&&(h[d].copyCellsFrom(h[d-1],n-1,p++,1,!1),h[d-1].setCell(n-1,s))}h[d].replaceCells(p,n,s);let g=0;for(let w=h.length-1;w>0&&(w>d||h[w].getTrimmedLength()===0);w--)g++;g>0&&(o.push(l+h.length-g),o.push(g)),l+=h.length-1}return o}function SD(e,t){let n=[],r=0,s=t[r],i=0;for(let o=0;o<e.length;o++)if(s===o){let l=t[++r];e.onDeleteEmitter.fire({index:o-i,amount:l}),o+=l-1,i+=l,s=t[++r]}else n.push(o);return{layout:n,countRemoved:i}}function kD(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function CD(e,t,n){let r=[],s=e.map((c,u)=>rc(e,u,t)).reduce((c,u)=>c+u),i=0,o=0,l=0;for(;l<s;){if(s-l<n){r.push(s-l);break}i+=n;let c=rc(e,o,t);i>c&&(i-=c,o++);let u=e[o].getWidth(i-1)===2;u&&i--;let h=u?n-1:n;r.push(h),l+=h}return r}function rc(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,s=e[t+1].getWidth(0)===2;return r&&s?n-1:n}var SC=class kC{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=kC._nextId++,this._onDispose=this.register(new ee),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ro(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};SC._nextId=1;var ND=SC,kt={},ji=kt.B;kt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};kt.A={"#":"£"};kt.B=void 0;kt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};kt.C=kt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};kt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};kt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};kt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};kt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};kt.E=kt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};kt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};kt.H=kt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};kt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var s_=4294967295,i_=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ht.clone(),this.savedCharset=ji,this.markers=[],this._nullCell=or.fromCharData([0,$k,1,0]),this._whitespaceCell=or.fromCharData([0,Js,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Od,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r_(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 Dd),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 Dd),this._whitespaceCell}getBlankLine(e,t){return new ul(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>s_?s_:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ht);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 r_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(ht),r=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,n);let i=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new ul(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+i+1?(this.ybase--,i++,this.ydisp>0&&this.ydisp--):this.lines.push(new ul(e,n)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;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=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),i&&(this.y+=i),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let i=0;i<this.lines.length;i++)r+=+this.lines.get(i).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=wD(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ht),n);if(r.length>0){let s=SD(this.lines,r);kD(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(ht),s=n;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ul(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(ht),s=[],i=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 c=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),c.unshift(l);if(!n){let _=this.ybase+this.y;if(_>=o&&_<o+c.length)continue}let u=c[c.length-1].getTrimmedLength(),h=CD(c,this._cols,e),d=h.length-c.length,p;this.ybase===0&&this.y!==this.lines.length-1?p=Math.max(0,this.y-this.lines.maxLength+d):p=Math.max(0,this.lines.length-this.lines.maxLength+d);let f=[];for(let _=0;_<d;_++){let b=this.getBlankLine(ht,!0);f.push(b)}f.length>0&&(s.push({start:o+c.length+i,newLines:f}),i+=f.length),c.push(...f);let m=h.length-1,g=h[m];g===0&&(m--,g=h[m]);let w=c.length-d-1,v=u;for(;w>=0;){let _=Math.min(v,g);if(c[m]===void 0)break;if(c[m].copyCellsFrom(c[w],v-_,g-_,_,!0),g-=_,g===0&&(m--,g=h[m]),v-=_,v===0){w--;let b=Math.max(w,0);v=rc(c,b,this._cols)}}for(let _=0;_<c.length;_++)h[_]<e&&c[_].setCell(h[_],r);let y=d-p;for(;y-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+i)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(s.length>0){let o=[],l=[];for(let g=0;g<this.lines.length;g++)l.push(this.lines.get(g));let c=this.lines.length,u=c-1,h=0,d=s[h];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+i);let p=0;for(let g=Math.min(this.lines.maxLength-1,c+i-1);g>=0;g--)if(d&&d.start>u+p){for(let w=d.newLines.length-1;w>=0;w--)this.lines.set(g--,d.newLines[w]);g++,o.push({index:u+1,amount:d.newLines.length}),p+=d.newLines.length,d=s[++h]}else this.lines.set(g,l[u--]);let f=0;for(let g=o.length-1;g>=0;g--)o[g].index+=f,this.lines.onInsertEmitter.fire(o[g]),f+=o[g].amount;let m=Math.max(0,c+i-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,n=0,r){let s=this.lines.get(e);return s?s.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new ND(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},ED=class extends Se{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ee),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 i_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new i_(!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)}},CC=2,NC=1,eg=class extends Se{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ee),this.onResize=this._onResize.event,this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,CC),this.rows=Math.max(e.rawOptions.rows||0,NC),this.buffers=this._register(new ED(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let s=n.ybase+n.scrollTop,i=n.ybase+n.scrollBottom;if(n.scrollTop===0){let o=n.lines.isFull;i===n.lines.length-1?o?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(i+1,0,r.clone()),o?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let o=i-s+1;n.lines.shiftElements(s+1,o-1,-1),n.lines.set(i,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};eg=ot([ie(0,pn)],eg);var bo={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:Ld,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},jD=["normal","bold","100","200","300","400","500","600","700","800","900"],RD=class extends Se{constructor(e){super(),this._onOptionChange=this._register(new ee),this.onOptionChange=this._onOptionChange.event;let t={...bo};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ve(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in bo))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in bo))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=bo[e]),!PD(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=bo[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=jD.includes(t)?t:bo[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 PD(e){return e==="block"||e==="underline"||e==="bar"}function dl(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&dl(e[r],t-1);return n}var o_=Object.freeze({insertMode:!1}),a_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),tg=class extends Se{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ee),this.onData=this._onData.event,this._onUserInput=this._register(new ee),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ee),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ee),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=dl(o_),this.decPrivateModes=dl(a_)}reset(){this.modes=dl(o_),this.decPrivateModes=dl(a_)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.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))}};tg=ot([ie(0,fn),ie(1,Kk),ie(2,pn)],tg);var l_={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 Nf(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Ef=String.fromCharCode,c_={DEFAULT:e=>{let t=[Nf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Ef(t[0])}${Ef(t[1])}${Ef(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Nf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Nf(e,!0)};${e.x};${e.y}${t}`}},ng=class extends Se{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ee),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(l_))this.addProtocol(r,l_[r]);for(let r of Object.keys(c_))this.addEncoding(r,c_[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};ng=ot([ie(0,fn),ie(1,fo),ie(2,pn)],ng);var jf=[[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]],TD=[[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]],xt;function DD(e,t){let n=0,r=t.length-1,s;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(s=n+r>>1,e>t[s][1])n=s+1;else if(e<t[s][0])r=s-1;else return!0;return!1}var MD=class{constructor(){if(this.version="6",!xt){xt=new Uint8Array(65536),xt.fill(1),xt[0]=0,xt.fill(0,1,32),xt.fill(0,127,160),xt.fill(2,4352,4448),xt[9001]=2,xt[9002]=2,xt.fill(2,11904,42192),xt[12351]=1,xt.fill(2,44032,55204),xt.fill(2,63744,64256),xt.fill(2,65040,65050),xt.fill(2,65072,65136),xt.fill(2,65280,65377),xt.fill(2,65504,65511);for(let e=0;e<jf.length;++e)xt.fill(0,jf[e][0],jf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?xt[e]:DD(e,TD)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let s=Li.extractWidth(t);s===0?r=!1:s>n&&(n=s)}return Li.createPropertyValue(0,n,r)}},Li=class Wu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ee,this.onChange=this._onChange.event;let t=new MD;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,s=t.length;for(let i=0;i<s;++i){let o=t.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=s)return n+this.wcwidth(o);let u=t.charCodeAt(i);56320<=u&&u<=57343?o=(o-55296)*1024+u-56320+65536:n+=this.wcwidth(u)}let l=this.charProperties(o,r),c=Wu.extractWidth(l);Wu.extractShouldJoin(l)&&(c-=Wu.extractWidth(r)),n+=c,r=l}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},AD=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 u_(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Qa=2147483647,LD=256,EC=class rg{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>LD)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new rg;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let s=t[r];if(Array.isArray(s))for(let i=0;i<s.length;++i)n.addSubParam(s[i]);else n.addParam(s)}return n}clone(){let t=new rg(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,s=this._subParamsIdx[n]&255;s-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,s))}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>Qa?Qa: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>Qa?Qa:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,s=this._subParamsIdx[n]&255;s-r>0&&(t[n]=this._subParams.slice(r,s))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[n-1];r[n-1]=~s?Math.min(s*10+t,Qa):t}},Xa=[],OD=class{constructor(){this._state=0,this._active=Xa,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=Xa}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=Xa,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Xa,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",xh(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Xa,this._id=-1,this._state=0}}},An=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,n,r){this._hitLimit||(this._data+=xh(t,n,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let n=!1;if(this._hitLimit)n=!1;else if(t&&(n=this._handler(this._data),n instanceof Promise))return n.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,n}},Ga=[],ID=class{constructor(){this._handlers=Object.create(null),this._active=Ga,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ga}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=Ga,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ga,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",xh(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Ga,this._ident=0}},hl=new EC;hl.addParam(0);var d_=class{constructor(e){this._handler=e,this._data="",this._params=hl,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():hl,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=xh(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=hl,this._data="",this._hitLimit=!1,n));return this._params=hl,this._data="",this._hitLimit=!1,t}},BD=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=n<<4|r}},Jn=160,FD=function(){let e=new BD(4095),t=Array.apply(null,Array(256)).map((l,c)=>c),n=(l,c)=>t.slice(l,c),r=n(32,127),s=n(0,24);s.push(25),s.push.apply(s,n(28,32));let i=n(0,14),o;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in i)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Jn,0,2,0),e.add(Jn,8,5,8),e.add(Jn,6,0,6),e.add(Jn,11,0,11),e.add(Jn,13,13,13),e}(),zD=class extends Se{constructor(e=FD){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 EC,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Ve(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new OD),this._dcsParser=this._register(new ID),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let i=e.intermediates.charCodeAt(s);if(32>i||i>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=i}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(e,t,n){let r=0,s=0,i=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,i=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,c=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&c>-1){for(;c>=0&&(o=l[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&c>-1){for(;c>=0&&(o=l[c](),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,i=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=i;l<t;++l){switch(r=e[l],s=this._transitions.table[this.currentState<<8|(r<160?r:Jn)],s>>4){case 2:for(let p=l+1;;++p){if(p>=t||(r=e[p])<32||r>126&&r<Jn){this._printHandler(e,l,p),l=p-1;break}if(++p>=t||(r=e[p])<32||r>126&&r<Jn){this._printHandler(e,l,p),l=p-1;break}if(++p>=t||(r=e[p])<32||r>126&&r<Jn){this._printHandler(e,l,p),l=p-1;break}if(++p>=t||(r=e[p])<32||r>126&&r<Jn){this._printHandler(e,l,p),l=p-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let c=this._csiHandlers[this._collect<<8|r],u=c?c.length-1:-1;for(;u>=0&&(o=c[u](this._params),o!==!0);u--)if(o instanceof Promise)return this._preserveStack(3,c,u,s,l),o;u<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++l<t&&(r=e[l])>47&&r<60);l--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let h=this._escHandlers[this._collect<<8|r],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,s,l),o;d<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let p=l+1;;++p)if(p>=t||(r=e[p])===24||r===26||r===27||r>127&&r<Jn){this._dcsParser.put(e,l,p),l=p-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,s,l),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let p=l+1;;p++)if(p>=t||(r=e[p])<32||r>127&&r<Jn){this._oscParser.put(e,l,p),l=p-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,s,l),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},$D=/^([\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})$/,HD=/^[\da-f]+$/;function h_(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=$D.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),HD.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let s=0;s<3;++s){let i=parseInt(t.slice(n*s,n*s+n),16);r[s]=n===1?i<<4:n===2?i:n===3?i>>4:i>>8}return r}}function Rf(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function WD(e,t=16){let[n,r,s]=e;return`rgb:${Rf(n,t)}/${Rf(r,t)}/${Rf(s,t)}`}var UD={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Rs=131072,f_=10;function p_(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 m_=5e3,g_=0,qD=class extends Se{constructor(e,t,n,r,s,i,o,l,c=new zD){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=s,this._oscLinkService=i,this._coreMouseService=o,this._unicodeService=l,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new uT,this._utf8Decoder=new dT,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ht.clone(),this._eraseAttrDataInternal=ht.clone(),this._onRequestBell=this._register(new ee),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ee),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ee),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ee),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ee),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ee),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ee),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ee),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ee),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ee),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ee),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ee),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 sg(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(u=>this._activeBuffer=u.activeBuffer)),this._parser.setCsiHandlerFallback((u,h)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(u),params:h.toArray()})}),this._parser.setEscHandlerFallback(u=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(u)})}),this._parser.setExecuteHandlerFallback(u=>{this._logService.debug("Unknown EXECUTE code: ",{code:u})}),this._parser.setOscHandlerFallback((u,h,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:u,action:h,data:d})}),this._parser.setDcsHandlerFallback((u,h,d)=>{h==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(u),action:h,payload:d})}),this._parser.setPrintHandler((u,h,d)=>this.print(u,h,d)),this._parser.registerCsiHandler({final:"@"},u=>this.insertChars(u)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},u=>this.scrollLeft(u)),this._parser.registerCsiHandler({final:"A"},u=>this.cursorUp(u)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},u=>this.scrollRight(u)),this._parser.registerCsiHandler({final:"B"},u=>this.cursorDown(u)),this._parser.registerCsiHandler({final:"C"},u=>this.cursorForward(u)),this._parser.registerCsiHandler({final:"D"},u=>this.cursorBackward(u)),this._parser.registerCsiHandler({final:"E"},u=>this.cursorNextLine(u)),this._parser.registerCsiHandler({final:"F"},u=>this.cursorPrecedingLine(u)),this._parser.registerCsiHandler({final:"G"},u=>this.cursorCharAbsolute(u)),this._parser.registerCsiHandler({final:"H"},u=>this.cursorPosition(u)),this._parser.registerCsiHandler({final:"I"},u=>this.cursorForwardTab(u)),this._parser.registerCsiHandler({final:"J"},u=>this.eraseInDisplay(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},u=>this.eraseInDisplay(u,!0)),this._parser.registerCsiHandler({final:"K"},u=>this.eraseInLine(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},u=>this.eraseInLine(u,!0)),this._parser.registerCsiHandler({final:"L"},u=>this.insertLines(u)),this._parser.registerCsiHandler({final:"M"},u=>this.deleteLines(u)),this._parser.registerCsiHandler({final:"P"},u=>this.deleteChars(u)),this._parser.registerCsiHandler({final:"S"},u=>this.scrollUp(u)),this._parser.registerCsiHandler({final:"T"},u=>this.scrollDown(u)),this._parser.registerCsiHandler({final:"X"},u=>this.eraseChars(u)),this._parser.registerCsiHandler({final:"Z"},u=>this.cursorBackwardTab(u)),this._parser.registerCsiHandler({final:"`"},u=>this.charPosAbsolute(u)),this._parser.registerCsiHandler({final:"a"},u=>this.hPositionRelative(u)),this._parser.registerCsiHandler({final:"b"},u=>this.repeatPrecedingCharacter(u)),this._parser.registerCsiHandler({final:"c"},u=>this.sendDeviceAttributesPrimary(u)),this._parser.registerCsiHandler({prefix:">",final:"c"},u=>this.sendDeviceAttributesSecondary(u)),this._parser.registerCsiHandler({final:"d"},u=>this.linePosAbsolute(u)),this._parser.registerCsiHandler({final:"e"},u=>this.vPositionRelative(u)),this._parser.registerCsiHandler({final:"f"},u=>this.hVPosition(u)),this._parser.registerCsiHandler({final:"g"},u=>this.tabClear(u)),this._parser.registerCsiHandler({final:"h"},u=>this.setMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"h"},u=>this.setModePrivate(u)),this._parser.registerCsiHandler({final:"l"},u=>this.resetMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"l"},u=>this.resetModePrivate(u)),this._parser.registerCsiHandler({final:"m"},u=>this.charAttributes(u)),this._parser.registerCsiHandler({final:"n"},u=>this.deviceStatus(u)),this._parser.registerCsiHandler({prefix:"?",final:"n"},u=>this.deviceStatusPrivate(u)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},u=>this.softReset(u)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},u=>this.setCursorStyle(u)),this._parser.registerCsiHandler({final:"r"},u=>this.setScrollRegion(u)),this._parser.registerCsiHandler({final:"s"},u=>this.saveCursor(u)),this._parser.registerCsiHandler({final:"t"},u=>this.windowOptions(u)),this._parser.registerCsiHandler({final:"u"},u=>this.restoreCursor(u)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},u=>this.insertColumns(u)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},u=>this.deleteColumns(u)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},u=>this.selectProtected(u)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},u=>this.requestMode(u,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},u=>this.requestMode(u,!1)),this._parser.setExecuteHandler(Q.BEL,()=>this.bell()),this._parser.setExecuteHandler(Q.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Q.BS,()=>this.backspace()),this._parser.setExecuteHandler(Q.HT,()=>this.tab()),this._parser.setExecuteHandler(Q.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Q.SI,()=>this.shiftIn()),this._parser.setExecuteHandler($u.IND,()=>this.index()),this._parser.setExecuteHandler($u.NEL,()=>this.nextLine()),this._parser.setExecuteHandler($u.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new An(u=>(this.setTitle(u),this.setIconName(u),!0))),this._parser.registerOscHandler(1,new An(u=>this.setIconName(u))),this._parser.registerOscHandler(2,new An(u=>this.setTitle(u))),this._parser.registerOscHandler(4,new An(u=>this.setOrReportIndexedColor(u))),this._parser.registerOscHandler(8,new An(u=>this.setHyperlink(u))),this._parser.registerOscHandler(10,new An(u=>this.setOrReportFgColor(u))),this._parser.registerOscHandler(11,new An(u=>this.setOrReportBgColor(u))),this._parser.registerOscHandler(12,new An(u=>this.setOrReportCursorColor(u))),this._parser.registerOscHandler(104,new An(u=>this.restoreIndexedColor(u))),this._parser.registerOscHandler(110,new An(u=>this.restoreFgColor(u))),this._parser.registerOscHandler(111,new An(u=>this.restoreBgColor(u))),this._parser.registerOscHandler(112,new An(u=>this.restoreCursorColor(u))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let u in kt)this._parser.registerEscHandler({intermediates:"(",final:u},()=>this.selectCharset("("+u)),this._parser.registerEscHandler({intermediates:")",final:u},()=>this.selectCharset(")"+u)),this._parser.registerEscHandler({intermediates:"*",final:u},()=>this.selectCharset("*"+u)),this._parser.registerEscHandler({intermediates:"+",final:u},()=>this.selectCharset("+"+u)),this._parser.registerEscHandler({intermediates:"-",final:u},()=>this.selectCharset("-"+u)),this._parser.registerEscHandler({intermediates:".",final:u},()=>this.selectCharset("."+u)),this._parser.registerEscHandler({intermediates:"/",final:u},()=>this.selectCharset("/"+u));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(u=>(this._logService.error("Parsing error: ",u),u)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new d_((u,h)=>this.requestStatusString(u,h)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),m_))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${m_} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,s=this._activeBuffer.y,i=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Rs&&(i=this._parseStack.position+Rs)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,u=>String.fromCharCode(u)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(u=>u.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Rs&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Rs))),o||this._dirtyRowTracker.clearRange(),e.length>Rs)for(let u=i;u<e.length;u+=Rs){let h=u+Rs<e.length?u+Rs:e.length,d=typeof e=="string"?this._stringDecoder.decode(e.substring(u,h),this._parseBuffer):this._utf8Decoder.decode(e.subarray(u,h),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,s,d,u),this._logSlowResolvingAsync(n),n}else if(!o){let u=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,u))return this._preserveStack(r,s,u,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,n){let r,s,i=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,u=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&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let p=this._parser.precedingJoinState;for(let f=t;f<n;++f){if(r=e[f],r<127&&i){let v=i[String.fromCharCode(r)];v&&(r=v.charCodeAt(0))}let m=this._unicodeService.charProperties(r,p);s=Li.extractWidth(m);let g=Li.extractShouldJoin(m),w=g?Li.extractWidth(p):0;if(p=m,o&&this._onA11yChar.fire(Os(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-w>l){if(c){let v=d,y=this._activeBuffer.x-w;for(this._activeBuffer.x=w,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),w>0&&d instanceof ul&&d.copyCellsFrom(v,y,0,w,!1);y<l;)v.setCellFromCodepoint(y++,0,1,h)}else if(this._activeBuffer.x=l-1,s===2)continue}if(g&&this._activeBuffer.x){let v=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-v,r,s);for(let y=s-w;--y>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(u&&(d.insertCells(this._activeBuffer.x,s-w,this._activeBuffer.getNullCell(h)),d.getWidth(l-1)===2&&d.setCellFromCodepoint(l-1,0,1,h)),d.setCellFromCodepoint(this._activeBuffer.x++,r,s,h),s>0)for(;--s;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=p,this._activeBuffer.x<l&&n-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,n=>p_(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new d_(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new An(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,s=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(i.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,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}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(ht));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Li.extractWidth(t),s=this._activeBuffer.x-r,i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(i.length*n),l=0;for(let u=0;u<i.length;){let h=i.codePointAt(u)||0;o[l++]=h,u+=h>65535?2:1}let c=l;for(let u=1;u<n;++u)o.copyWithin(c,0,l),c+=l;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Q.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Q.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Q.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Q.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Q.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,ji),this._charsetService.setgCharset(1,ji),this._charsetService.setgCharset(2,ji),this._charsetService.setgCharset(3,ji);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:i}=this._coreMouseService,o=this._coreService,{buffers:l,cols:c}=this._bufferService,{active:u,alt:h}=l,d=this._optionsService.rawOptions,p=(g,w)=>(o.triggerDataEvent(`${Q.ESC}[${t?"":"?"}${g};${w}$y`),!0),f=g=>g?1:2,m=e.params[0];return t?m===2?p(m,4):m===4?p(m,f(o.modes.insertMode)):m===12?p(m,3):m===20?p(m,f(d.convertEol)):p(m,0):m===1?p(m,f(r.applicationCursorKeys)):m===3?p(m,d.windowOptions.setWinLines?c===80?2:c===132?1:0:0):m===6?p(m,f(r.origin)):m===7?p(m,f(r.wraparound)):m===8?p(m,3):m===9?p(m,f(s==="X10")):m===12?p(m,f(d.cursorBlink)):m===25?p(m,f(!o.isCursorHidden)):m===45?p(m,f(r.reverseWraparound)):m===66?p(m,f(r.applicationKeypad)):m===67?p(m,4):m===1e3?p(m,f(s==="VT200")):m===1002?p(m,f(s==="DRAG")):m===1003?p(m,f(s==="ANY")):m===1004?p(m,f(r.sendFocus)):m===1005?p(m,4):m===1006?p(m,f(i==="SGR")):m===1015?p(m,4):m===1016?p(m,f(i==="SGR_PIXELS")):m===1048?p(m,1):m===47||m===1047||m===1049?p(m,f(u===h)):m===2004?p(m,f(r.bracketedPasteMode)):m===2026?p(m,f(r.synchronizedOutput)):p(m,0)}_updateAttrColor(e,t,n,r,s){return t===2?(e|=50331648,e&=-16777216,e|=Sc.fromColorRGB([n,r,s])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],s=0,i=0;do{if(r[i+s]=e.params[t+i],e.hasSubParams(t+i)){let o=e.getSubParams(t+i),l=0;do r[1]===5&&(s=1),r[i+l+1+s]=o[l];while(++l<o.length&&l+i+1+s<r.length);break}if(r[1]===5&&i+s>=2||r[1]===2&&i+s>=5)break;r[1]&&(s=1)}while(++i+t<e.length&&i+s<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return i}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=ht.fg,e.bg=ht.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let s=0;s<t;s++)n=e.params[s],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=ht.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=ht.bg&16777215):n===38||n===48||n===58?s+=this._extractColor(e,s,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=ht.fg&16777215,r.bg&=-67108864,r.bg|=ht.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Q.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ht.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!p_(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(`${Q.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>f_&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>f_&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),s=n.shift();if(/^\d+$/.exec(r)){let i=parseInt(r);if(v_(i))if(s==="?")t.push({type:0,index:i});else{let o=h_(s);o&&t.push({type:1,index:i,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,s=n.findIndex(i=>i.startsWith("id="));return s!==-1&&(r=n[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=h_(n[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let s=parseInt(n[r]);v_(s)&&t.push({type:2,index:s})}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,ji),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(UD[e[0]],kt[e[1]]||ji),!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=ht.clone(),this._eraseAttrDataInternal=ht.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 or;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=o=>(this._coreService.triggerDataEvent(`${Q.ESC}${o}${Q.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},sg=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&&(g_=e,e=t,t=g_),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};sg=ot([ie(0,fn)],sg);function v_(e){return 0<=e&&e<256}var KD=5e7,x_=12,VD=50,YD=class extends Se{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 ee),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>KD)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],s=this._action(r,t);if(s){let o=l=>performance.now()-n>=x_?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(n,l);s.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=x_)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>VD&&(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()}},ig=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),c={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(c,l)),this._dataByLinkId.set(c.id,c),c.id}let n=e,r=this._getEntryIdKey(n),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let i=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(o,i)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};ig=ot([ie(0,fn)],ig);var y_=!1,QD=class extends Se{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ya),this._onBinary=this._register(new ee),this.onBinary=this._onBinary.event,this._onData=this._register(new ee),this.onData=this._onData.event,this._onLineFeed=this._register(new ee),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ee),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ee),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ee),this._instantiationService=new yD,this.optionsService=this._register(new RD(e)),this._instantiationService.setService(pn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(eg)),this._instantiationService.setService(fn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Zm)),this._instantiationService.setService(Kk,this._logService),this.coreService=this._register(this._instantiationService.createInstance(tg)),this._instantiationService.setService(fo,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(ng)),this._instantiationService.setService(qk,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Li)),this._instantiationService.setService(mT,this.unicodeService),this._charsetService=this._instantiationService.createInstance(AD),this._instantiationService.setService(pT,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(ig),this._instantiationService.setService(Vk,this._oscLinkService),this._inputHandler=this._register(new qD(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register($t.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register($t.forward(this._bufferService.onResize,this._onResize)),this._register($t.forward(this.coreService.onData,this._onData)),this._register($t.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 YD((t,n)=>this._inputHandler.parse(t,n))),this._register($t.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ee),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&&!y_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),y_=!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,CC),t=Math.max(t,NC),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(u_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(u_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ve(()=>{for(let t of e)t.dispose()})}}},XD={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 GD(e,t,n,r){var o;let s={type:0,cancel:!1,key:void 0},i=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=Q.ESC+"OA":s.key=Q.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=Q.ESC+"OD":s.key=Q.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=Q.ESC+"OC":s.key=Q.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=Q.ESC+"OB":s.key=Q.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":Q.DEL,e.altKey&&(s.key=Q.ESC+s.key);break;case 9:if(e.shiftKey){s.key=Q.ESC+"[Z";break}s.key=Q.HT,s.cancel=!0;break;case 13:s.key=e.altKey?Q.ESC+Q.CR:Q.CR,s.cancel=!0;break;case 27:s.key=Q.ESC,e.altKey&&(s.key=Q.ESC+Q.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;i?s.key=Q.ESC+"[1;"+(i+1)+"D":t?s.key=Q.ESC+"OD":s.key=Q.ESC+"[D";break;case 39:if(e.metaKey)break;i?s.key=Q.ESC+"[1;"+(i+1)+"C":t?s.key=Q.ESC+"OC":s.key=Q.ESC+"[C";break;case 38:if(e.metaKey)break;i?s.key=Q.ESC+"[1;"+(i+1)+"A":t?s.key=Q.ESC+"OA":s.key=Q.ESC+"[A";break;case 40:if(e.metaKey)break;i?s.key=Q.ESC+"[1;"+(i+1)+"B":t?s.key=Q.ESC+"OB":s.key=Q.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=Q.ESC+"[2~");break;case 46:i?s.key=Q.ESC+"[3;"+(i+1)+"~":s.key=Q.ESC+"[3~";break;case 36:i?s.key=Q.ESC+"[1;"+(i+1)+"H":t?s.key=Q.ESC+"OH":s.key=Q.ESC+"[H";break;case 35:i?s.key=Q.ESC+"[1;"+(i+1)+"F":t?s.key=Q.ESC+"OF":s.key=Q.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=Q.ESC+"[5;"+(i+1)+"~":s.key=Q.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=Q.ESC+"[6;"+(i+1)+"~":s.key=Q.ESC+"[6~";break;case 112:i?s.key=Q.ESC+"[1;"+(i+1)+"P":s.key=Q.ESC+"OP";break;case 113:i?s.key=Q.ESC+"[1;"+(i+1)+"Q":s.key=Q.ESC+"OQ";break;case 114:i?s.key=Q.ESC+"[1;"+(i+1)+"R":s.key=Q.ESC+"OR";break;case 115:i?s.key=Q.ESC+"[1;"+(i+1)+"S":s.key=Q.ESC+"OS";break;case 116:i?s.key=Q.ESC+"[15;"+(i+1)+"~":s.key=Q.ESC+"[15~";break;case 117:i?s.key=Q.ESC+"[17;"+(i+1)+"~":s.key=Q.ESC+"[17~";break;case 118:i?s.key=Q.ESC+"[18;"+(i+1)+"~":s.key=Q.ESC+"[18~";break;case 119:i?s.key=Q.ESC+"[19;"+(i+1)+"~":s.key=Q.ESC+"[19~";break;case 120:i?s.key=Q.ESC+"[20;"+(i+1)+"~":s.key=Q.ESC+"[20~";break;case 121:i?s.key=Q.ESC+"[21;"+(i+1)+"~":s.key=Q.ESC+"[21~";break;case 122:i?s.key=Q.ESC+"[23;"+(i+1)+"~":s.key=Q.ESC+"[23~";break;case 123:i?s.key=Q.ESC+"[24;"+(i+1)+"~":s.key=Q.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=Q.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=Q.DEL:e.keyCode===219?s.key=Q.ESC:e.keyCode===220?s.key=Q.FS:e.keyCode===221&&(s.key=Q.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let l=(o=XD[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)s.key=Q.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let c=e.ctrlKey?e.keyCode-64:e.keyCode+32,u=String.fromCharCode(c);e.shiftKey&&(u=u.toUpperCase()),s.key=Q.ESC+u}else if(e.keyCode===32)s.key=Q.ESC+(e.ctrlKey?Q.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let c=e.code.slice(3,4);e.shiftKey||(c=c.toLowerCase()),s.key=Q.ESC+c,s.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=Q.US),e.key==="@"&&(s.key=Q.NUL));break}return s}var lt=0,JD=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Od,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Od,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((s,i)=>this._getKey(s)-this._getKey(i)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[s]=e[t],t++):r[s]=this._array[n++];this._array=r,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||(lt=this._search(t),lt===-1)||this._getKey(this._array[lt])!==t)return!1;do if(this._array[lt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(lt),!0;while(++lt<this._array.length&&this._getKey(this._array[lt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,i)=>s-i),t=0,n=new Array(this._array.length-e.length),r=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:n[r++]=this._array[s];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(lt=this._search(e),!(lt<0||lt>=this._array.length)&&this._getKey(this._array[lt])===e))do yield this._array[lt];while(++lt<this._array.length&&this._getKey(this._array[lt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(lt=this._search(e),!(lt<0||lt>=this._array.length)&&this._getKey(this._array[lt])===e))do t(this._array[lt]);while(++lt<this._array.length&&this._getKey(this._array[lt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,s=this._getKey(this._array[r]);if(s>e)n=r-1;else if(s<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Pf=0,__=0,ZD=class extends Se{constructor(){super(),this._decorations=new JD(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ee),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ee),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ve(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new eM(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,s=0;for(let i of this._decorations.getKeyIterator(t))r=i.options.x??0,s=r+(i.options.width??1),e>=r&&e<s&&(!n||(i.options.layer??"bottom")===n)&&(yield i)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,s=>{Pf=s.options.x??0,__=Pf+(s.options.width??1),e>=Pf&&e<__&&(!n||(s.options.layer??"bottom")===n)&&r(s)})}},eM=class extends ui{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ee),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ee),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=Qe.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Qe.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},tM=1e3,nM=class{constructor(e,t=tM){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=r-this._lastRefreshMs,i=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},i)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},b_=20,Id=class extends Se{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let i=0;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);if(this._topBoundaryFocusListener=i=>this._handleBoundaryFocus(i,0),this._bottomBoundaryFocusListener=i=>this._handleBoundaryFocus(i,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new nM(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(i=>this._handleResize(i.rows))),this._register(this._terminal.onRender(i=>this._refreshRows(i.start,i.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(i=>this._handleChar(i))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
458
- `))),this._register(this._terminal.onA11yTab(i=>this._handleTab(i))),this._register(this._terminal.onKey(i=>this._handleKey(i.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(pe(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ve(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<b_+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
459
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===b_+1&&(this._liveRegion.textContent+=Cm.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let s=e;s<=t;s++){let i=n.lines.get(n.ydisp+s),o=[],l=(i==null?void 0:i.translateToString(!0,void 0,void 0,o))||"",c=(n.ydisp+s+1).toString(),u=this._rowElements[s];u&&(l.length===0?(u.textContent=" ",this._rowColumns.set(u,[0,1])):(u.textContent=l,this._rowColumns.set(u,o)),u.setAttribute("aria-posinset",c),u.setAttribute("aria-setsize",r),this._alignRowWidth(u))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],s=n.getAttribute("aria-posinset"),i=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===i||e.relatedTarget!==r)return;let o,l;if(t===0?(o=n,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=n,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{let c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var 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},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((l=r.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(n.node))return;let s=({node:c,offset:u})=>{let h=c instanceof Text?c.parentNode:c,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 p=this._rowColumns.get(h);if(!p)return console.warn("columns is null. Race condition?"),null;let f=u<p.length?p[u]:p.slice(-1)[0]+1;return f>=this._terminal.cols&&(++d,f=0),{row:d,column:f}},i=s(t),o=s(n);if(!(!i||!o)){if(i.row>o.row||i.row===o.row&&i.column>=o.column)throw new Error("invalid range");this._terminal.select(i.column,i.row,(o.row-i.row)*this._terminal.cols-i.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,i;e.style.transform="";let t=e.getBoundingClientRect().width,n=(i=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:i[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Id=ot([ie(1,Qv),ie(2,xs),ie(3,ys)],Id);var og=class extends Se{constructor(e,t,n,r,s){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ee),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ee),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ve(()=>{var i;ro(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(i=this._activeProviderReplies)==null||i.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(pe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(pe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(pe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(pe(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let s=n[r];if(s.classList.contains("xterm"))break;if(s.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 r,s;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(i=>{i==null||i.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[i,o]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(i)&&(n=this._checkLinkProviderResult(i,e,n)):o.provideLinks(e.y,l=>{var u,h;if(this._isMouseOut)return;let c=l==null?void 0:l.map(d=>({link:d}));(u=this._activeProviderReplies)==null||u.set(i,c),n=this._checkLinkProviderResult(i,e,n),((h=this._activeProviderReplies)==null?void 0:h.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let s=t.get(r);if(s)for(let i=0;i<s.length;i++){let o=s[i],l=o.link.range.start.y<e?0:o.link.range.start.x,c=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let u=l;u<=c;u++){if(n.has(u)){s.splice(i--,1);break}n.add(u)}}}}_checkLinkProviderResult(e,t,n){var i;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),s=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&r){let o=r.find(l=>this._linkAtPosition(l.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(i=this._activeProviderReplies.get(o))==null?void 0:i.find(c=>this._linkAtPosition(c.link,t));if(l){n=!0,this._handleNewLink(l);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&rM(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,ro(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,s,i;(r=this._currentLink)!=null&&r.state&&((i=(s=this._currentLink)==null?void 0:s.state)==null?void 0:i.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._askForLink(i,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return n<=s&&s<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,s){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:s}}};og=ot([ie(1,Xv),ie(2,ys),ie(3,fn),ie(4,Qk)],og);function rM(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 sM=class extends QD{constructor(e={}){super(e),this._linkifier=this._register(new ya),this.browser=pC,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ya),this._onCursorMove=this._register(new ee),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ee),this.onKey=this._onKey.event,this._onRender=this._register(new ee),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ee),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ee),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ee),this.onBell=this._onBell.event,this._onFocus=this._register(new ee),this._onBlur=this._register(new ee),this._onA11yCharEmitter=this._register(new ee),this._onA11yTabEmitter=this._register(new ee),this._onWillOpen=this._register(new ee),this._setup(),this._decorationService=this._instantiationService.createInstance(ZD),this._instantiationService.setService(kc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(V5),this._instantiationService.setService(Qk,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Em)),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($t.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register($t.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register($t.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register($t.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ve(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let s=We.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${Q.ESC}]${r};${WD(s)}${hC.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(i=>i.ansi[t.index]=ft.toColor(...t.color));else{let i=n;this._themeService.modifyColors(o=>o[i]=ft.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(Id,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.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(Q.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,s=t.getWidth(n),i=this._renderService.dimensions.css.cell.width*s,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=i+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(pe(this.element,"copy",t=>{this.hasSelection()&&lT(t,this._selectionService)}));let e=t=>cT(t,this.textarea,this.coreService,this.optionsService);this._register(pe(this.textarea,"paste",e)),this._register(pe(this.element,"paste",e)),mC?this._register(pe(this.element,"mousedown",t=>{t.button===2&&T0(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(pe(this.element,"contextmenu",t=>{T0(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),sx&&this._register(pe(this.element,"auxclick",t=>{t.button===1&&zk(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(pe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(pe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(pe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(pe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(pe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(pe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(pe(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;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"),((s=this.element)==null?void 0:s.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(pe(this.screenElement,"mousemove",i=>this.updateCursorStyle(i))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",km.get()),xC||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(q5,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(xs,this._coreBrowserService),this._register(pe(this.textarea,"focus",i=>this._handleTextAreaFocus(i))),this._register(pe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ym,this._document,this._helperContainer),this._instantiationService.setService(yh,this._charSizeService),this._themeService=this._instantiationService.createInstance(Jm),this._instantiationService.setService(Ra,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ad),this._instantiationService.setService(Yk,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Xm,this.rows,this.screenElement)),this._instantiationService.setService(ys,this._renderService),this._register(this._renderService.onRenderedViewportChange(i=>this._onRender.fire(i))),this.onResize(i=>this._renderService.resize(i.cols,i.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(qm,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Qm),this._instantiationService.setService(Xv,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(og,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(Wm,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(i=>{super.scrollLines(i,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Gm,this.element,this.screenElement,r)),this._instantiationService.setService(vT,this._selectionService),this._register(this._selectionService.onRequestScrollLines(i=>this.scrollLines(i.amount,i.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(i=>this._renderService.handleSelectionChanged(i.start,i.end,i.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(i=>{this.textarea.value=i,this.textarea.focus(),this.textarea.select()})),this._register($t.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var i;this._selectionService.refresh(),(i=this._viewport)==null||i.queueSync()})),this._register(this._instantiationService.createInstance(Um,this.screenElement)),this._register(pe(this.element,"mousedown",i=>this._selectionService.handleMouseDown(i))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Id,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",i=>this._handleScreenReaderModeOptionChange(i))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Md,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",i=>{!this._overviewRulerRenderer&&i&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Md,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Vm,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(i){var u,h,d,p,f;let o=e._mouseService.getMouseReportCoords(i,e.screenElement);if(!o)return!1;let l,c;switch(i.overrideType||i.type){case"mousemove":c=32,i.buttons===void 0?(l=3,i.button!==void 0&&(l=i.button<3?i.button:3)):l=i.buttons&1?0:i.buttons&4?1:i.buttons&2?2:3;break;case"mouseup":c=0,l=i.button<3?i.button:3;break;case"mousedown":c=1,l=i.button<3?i.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(i)===!1)return!1;let m=i.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(i,(p=(d=(h=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:h.device)==null?void 0:d.cell)==null?void 0:p.height,(f=e._coreBrowserService)==null?void 0:f.dpr)===0)return!1;c=m<0?0:1,l=4;break;default:return!1}return c===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:c,ctrl:i.ctrlKey,alt:i.altKey,shift:i.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:i=>(n(i),i.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(i)),wheel:i=>(n(i),this.cancel(i,!0)),mousedrag:i=>{i.buttons&&n(i)},mousemove:i=>{i.buttons||n(i)}};this._register(this.coreMouseService.onProtocolChange(i=>{i?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(i)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),i&8?r.mousemove||(t.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),i&16?r.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),i&2?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),i&4?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(pe(t,"mousedown",i=>{if(i.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(i)))return n(i),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(i)})),this._register(pe(t,"wheel",i=>{var o,l,c,u,h;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(i)===!1)return!1;if(!this.buffer.hasScrollback){if(i.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(i,(u=(c=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:c.cell)==null?void 0:u.height,(h=e._coreBrowserService)==null?void 0:h.dpr)===0)return this.cancel(i,!0);let d=Q.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(i.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(i,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Fk(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=GD(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Q.ETX||n.key===Q.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(iM(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(ht));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(Q.ESC+"[I"):this.coreService.triggerDataEvent(Q.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.ESC}[6;${s};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function iM(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var oM=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},aM=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 or)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},w_=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 aM(t)}getNullCell(){return new or}},lM=class extends Se{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ee),this.onBufferChange=this._onBufferChange.event,this._normal=new w_(this._core.buffers.normal,"normal"),this._alternate=new w_(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)}},cM=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.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)}},uM=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}},dM=["cols","rows"],Pr=0,hM=class extends Se{constructor(e){super(),this._core=this._register(new sM(e)),this._addonManager=this._register(new oM),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(e){if(dM.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 cM(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new uM(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 lM(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
460
- `,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 km.get()},set promptLabel(e){km.set(e)},get tooMuchOutput(){return Cm.get()},set tooMuchOutput(e){Cm.set(e)}}}_verifyIntegers(...e){for(Pr of e)if(Pr===1/0||isNaN(Pr)||Pr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Pr of e)if(Pr&&(Pr===1/0||isNaN(Pr)||Pr%1!==0||Pr<0))throw new Error("This API only accepts positive integers")}};/**
461
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
462
- * @license MIT
463
- *
464
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
465
- * @license MIT
466
- *
467
- * Originally forked from (with the author's permission):
468
- * Fabrice Bellard's javascript vt100 for jslinux:
469
- * http://bellard.org/jslinux/
470
- * Copyright (c) 2011 Fabrice Bellard
471
- */var fM=2,pM=1,mM=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,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),s=Math.max(0,parseInt(n.getPropertyValue("width"))),i=window.getComputedStyle(this._terminal.element),o={top:parseInt(i.getPropertyValue("padding-top")),bottom:parseInt(i.getPropertyValue("padding-bottom")),right:parseInt(i.getPropertyValue("padding-right")),left:parseInt(i.getPropertyValue("padding-left"))},l=o.top+o.bottom,c=o.right+o.left,u=r-l,h=s-c-t;return{cols:Math.max(fM,Math.floor(h/e.css.cell.width)),rows:Math.max(pM,Math.floor(u/e.css.cell.height))}}};function S_(e,t){let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>e(...r),t)}}const k_="panopticon.terminal.autoCopyOnSelect",Tf=navigator.platform.toLowerCase().includes("mac");function C_({sessionName:e,onDisconnect:t,autoCopyOnSelect:n}){const r=x.useRef(null),s=x.useRef(null),i=x.useRef(null),o=x.useRef(null),l=x.useRef(0),c=x.useRef(null),u=5,[h,d]=x.useState(!0),[p,f]=x.useState(()=>{if(n!==void 0)return n;const E=localStorage.getItem(k_);return E===null?!0:E==="true"}),[m,g]=x.useState({visible:!1,x:0,y:0,canCopy:!1}),[w,v]=x.useState(!1),y=x.useRef(t);y.current=t,x.useEffect(()=>{try{localStorage.setItem(k_,String(p))}catch(E){console.error("Failed to save auto-copy setting:",E)}},[p]);const _=E=>Math.min(1e3*Math.pow(2,E),3e4),b=x.useCallback(async()=>{const E=s.current;if(!E||!E.hasSelection())return;const R=E.getSelection();try{await navigator.clipboard.writeText(R)}catch(L){console.error("Failed to copy to clipboard:",L);const $=document.createElement("textarea");$.value=R,$.style.position="fixed",$.style.opacity="0",document.body.appendChild($),$.select();try{document.execCommand("copy")}catch(K){console.error("Fallback copy failed:",K)}document.body.removeChild($)}},[]),N=x.useCallback(async()=>{var R;if(s.current)try{const L=await navigator.clipboard.readText();((R=o.current)==null?void 0:R.readyState)===WebSocket.OPEN&&o.current.send(L)}catch(L){console.error("Failed to read from clipboard:",L)}},[]),k=x.useCallback(E=>{const R=s.current;if(!R)return;const L=Tf?E.metaKey:E.ctrlKey;L&&E.key.toLowerCase()==="c"&&R.hasSelection()&&(E.preventDefault(),b()),L&&E.key.toLowerCase()==="v"&&(E.preventDefault(),N())},[b,N]),j=x.useCallback(E=>{E.preventDefault();const R=s.current;R&&g({visible:!0,x:E.clientX,y:E.clientY,canCopy:R.hasSelection()})},[]),D=x.useCallback(()=>{g(E=>({...E,visible:!1}))},[]),F=x.useCallback(()=>{b(),D()},[b,D]),P=x.useCallback(()=>{N(),D()},[N,D]);x.useEffect(()=>{if(!m.visible)return;const E=()=>{D()};return document.addEventListener("click",E),()=>document.removeEventListener("click",E)},[m.visible,D]);const O=x.useCallback(()=>{if(!r.current||!e)return;c.current&&(clearTimeout(c.current),c.current=null);const E=r.current;if(E.clientWidth===0||E.clientHeight===0){console.warn("XTerminal: Container has no size, retrying in 100ms"),setTimeout(()=>O(),100);return}console.log("XTerminal: Creating terminal, container size:",E.clientWidth,"x",E.clientHeight);let R=s.current,L=i.current;if(!R){R=new hM({cursorBlink:!0,cursorStyle:"block",fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',cols:120,rows:29,scrollback:0,convertEol:!1,scrollOnUserInput:!0,allowProposedApi:!0,theme:{background:"#1a1a2e",foreground:"#eaeaea",cursor:"#eaeaea",cursorAccent:"#1a1a2e",selectionBackground:"#3a3a5e",black:"#1a1a2e",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#6272a4",magenta:"#ff79c6",cyan:"#8be9fd",white:"#f8f8f2",brightBlack:"#6272a4",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"}}),L=new mM,R.loadAddon(L),R.open(r.current),L.fit(),s.current=R,i.current=L;let z=null;R.onSelectionChange(()=>{!p||!R||(z&&clearTimeout(z),z=setTimeout(()=>{if(R&&R.hasSelection()){const te=R.getSelection();te&&navigator.clipboard.writeText(te).catch(se=>{console.error("Auto-copy failed:",se)})}},300))}),r.current.addEventListener("keydown",k),r.current.addEventListener("contextmenu",j)}const K=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal?session=${encodeURIComponent(e)}`,A=new WebSocket(K);A.binaryType="arraybuffer",o.current=A,A.onopen=()=>{console.log("XTerminal: WebSocket opened"),l.current=0,R.clear(),L==null||L.fit(),console.log("XTerminal: Sending initial dimensions:",R.cols,"x",R.rows),A.send(JSON.stringify({type:"resize",cols:R.cols,rows:R.rows}))};const H=localStorage.getItem("DEBUG_TERMINAL")==="1";let S=0;const Y=[],B=z=>z.replace(/[\x00-\x1f\x7f-\xff]/g,te=>{const se=te.charCodeAt(0);return se===27?"\\e":se===10?"\\n":se===13?"\\r":`\\x${se.toString(16).padStart(2,"0")}`});H&&(console.log("XTerminal: Debug logging enabled. Messages will be logged to console and window.terminalDebugLog"),window.terminalDebugLog=Y,window.showTerminalDebug=()=>{Y.forEach(z=>console.log(z))});const C=[];let U=!1;const I=()=>{if(U||C.length===0||!R)return;U=!0;const z=C.shift();H&&console.log(`XTerminal-debug: WRITE len=${z.length}`),R.write(z,()=>{R.scrollToBottom(),U=!1,C.length>0&&setTimeout(I,0)})};A.onmessage=z=>{let te="";if(z.data instanceof ArrayBuffer?te=new TextDecoder().decode(new Uint8Array(z.data)):typeof z.data=="string"&&(te=z.data),H){S++;const se=`[${new Date().toISOString()}] RECV #${S} len=${te.length}
472
- DATA: ${B(te).slice(0,500)}${te.length>500?"...":""}`;Y.push(se),(S<=20||S%100===0)&&console.log(`XTerminal-debug: RECV #${S} len=${te.length}`)}C.push(te),I()},A.onclose=z=>{var te,se;if(console.log("XTerminal: WebSocket closed",z.code,z.reason),!h||z.code===1e3){R.writeln(`\r
473
- \x1B[33m● Session disconnected\x1B[0m`),(te=y.current)==null||te.call(y);return}if(l.current<u){const ye=_(l.current);l.current+=1,R.writeln(`\r
474
- \x1B[33m● Connection lost. Reconnecting in ${ye/1e3}s (attempt ${l.current}/${u})...\x1B[0m`),c.current=setTimeout(()=>{O()},ye)}else R.writeln(`\r
475
- \x1B[31m● Connection lost after multiple attempts.\x1B[0m`),(se=y.current)==null||se.call(y)},A.onerror=z=>{console.error("WebSocket error:",z)},R.onData(z=>{A.readyState===WebSocket.OPEN&&A.send(z)}),R.onResize(({cols:z,rows:te})=>{A.readyState===WebSocket.OPEN&&A.send(JSON.stringify({type:"resize",cols:z,rows:te}))});const q=S_(()=>{A.readyState===WebSocket.OPEN&&(L==null||L.fit())},200);return window.addEventListener("resize",q),()=>{window.removeEventListener("resize",q),d(!1),c.current&&clearTimeout(c.current),A.close(),R==null||R.dispose(),s.current=null,i.current=null}},[e,h,p,k,j]);x.useEffect(()=>{let E=!1,R;const L=setTimeout(()=>{E||(R=O())},50);return()=>{E=!0,clearTimeout(L),R==null||R()}},[O]),x.useEffect(()=>{const E=S_(()=>{var L,$;((L=o.current)==null?void 0:L.readyState)===WebSocket.OPEN&&(($=i.current)==null||$.fit())},200),R=new ResizeObserver(E);return r.current&&R.observe(r.current),()=>{R.disconnect()}},[]);const T=()=>{var E;(E=s.current)==null||E.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:()=>v(!w),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"})]})})}),w&&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:p,onChange:E=>f(E.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:r,className:"absolute inset-0",onClick:T,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:E=>E.stopPropagation(),children:[m.canCopy&&a.jsxs("button",{onClick:F,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:Tf?"⌘C":"Ctrl+C"})]}),a.jsxs("button",{onClick:P,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:Tf?"⌘V":"Ctrl+V"})]})]})]})}function ix({issueId:e,isOpen:t,onClose:n}){var u,h,d,p,f;const{data:r,isLoading:s,isFetching:i,error:o}=he({queryKey:["beads",e],queryFn:async()=>{const m=await fetch(`/api/issues/${e}/beads`);if(!m.ok)throw new Error("Failed to fetch tasks");return m.json()},enabled:t,staleTime:0,refetchOnMount:"always"});if(!t)return null;const l=((u=r==null?void 0:r.tasks)==null?void 0:u.filter(m=>m.status!=="closed"))||[],c=((h=r==null?void 0:r.tasks)==null?void 0:h.filter(m=>m.status==="closed"))||[];return a.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:n}),a.jsxs("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-lg mx-4 max-h-[70vh] overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ci,{className:"w-5 h-5 text-green-400"}),a.jsxs("h2",{className:"font-semibold text-content",children:["Tasks: ",e]})]}),a.jsx("button",{onClick:n,className:"p-1 text-content-subtle hover:text-content hover:bg-surface-overlay rounded transition-colors",children:a.jsx(mt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[(s||i)&&!((d=r==null?void 0:r.tasks)!=null&&d.length)&&a.jsxs("div",{className:"space-y-2",children:[[1,2,3].map(m=>a.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border border-divider bg-surface-overlay/30 animate-pulse",children:[a.jsx("div",{className:"w-4 h-4 bg-surface-emphasis rounded-full mt-0.5"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-3/4"}),a.jsx("div",{className:"h-3 bg-surface-overlay rounded w-1/4"})]})]},m)),a.jsxs("div",{className:"flex items-center justify-center py-2 text-content-muted text-sm",children:[a.jsx(je,{className:"w-4 h-4 animate-spin mr-2"}),"Loading tasks from workspace..."]})]}),o&&a.jsx("div",{className:"text-red-400 text-center py-8",children:"Failed to load tasks"}),r&&((p=r.tasks)==null?void 0:p.length)===0&&!i&&a.jsxs("div",{className:"text-content-muted text-center py-8",children:[a.jsx(ci,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),a.jsx("p",{children:"No tasks created yet"}),a.jsx("p",{className:"text-xs mt-2",children:"Tasks will appear here once the planning agent creates them using beads."})]}),r&&((f=r.tasks)==null?void 0:f.length)>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-subtle mb-3 pb-3 border-b border-divider",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full"}),l.length," open"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(mi,{className:"w-3 h-3 text-green-400"}),c.length," closed"]})]}),l.map(m=>a.jsx(N_,{task:m},m.id)),c.length>0&&l.length>0&&a.jsx("div",{className:"text-xs text-content-muted mt-4 mb-2",children:"Completed"}),c.map(m=>a.jsx(N_,{task:m},m.id))]})]}),a.jsxs("div",{className:"px-4 py-3 border-t border-divider text-xs text-content-muted flex items-center justify-between",children:[a.jsxs("span",{children:[(r==null?void 0:r.count)||0," task",(r==null?void 0:r.count)!==1?"s":""]}),a.jsx("span",{className:"text-gray-600",children:"Beads"})]})]})]})}function N_({task:e}){const t={open:"bg-surface-overlay/50 border-divider-strong",in_progress:"bg-blue-900/20 border-blue-600/50",closed:"bg-green-900/20 border-green-600/30 opacity-60"},n={open:a.jsx("div",{className:"w-4 h-4 border-2 border-gray-400 rounded-full"}),in_progress:a.jsx(je,{className:"w-4 h-4 text-blue-400 animate-spin"}),closed:a.jsx(mi,{className:"w-4 h-4 text-green-400"})};return a.jsxs("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${t[e.status]}`,children:[a.jsx("div",{className:"mt-0.5",children:n[e.status]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm text-content",children:e.title}),a.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[a.jsx("span",{className:"text-xs text-content-muted",children:e.id}),e.blockedBy.length>0&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-orange-400",children:[a.jsx(xa,{className:"w-3 h-3"}),"Blocked"]}),e.labels.filter(r=>r.startsWith("difficulty:")).map(r=>a.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${r.includes("simple")||r.includes("trivial")?"bg-green-900/50 text-green-400":r.includes("medium")?"bg-yellow-900/50 text-yellow-400":r.includes("complex")||r.includes("hard")?"bg-red-900/50 text-red-400":"bg-surface-overlay text-content-body"}`,children:r.replace("difficulty:","")},r))]})]})]})}const gM=()=>{const e=localStorage.getItem("panopticon.planning.startDocker");return e!==null?e==="true":!0},vM=()=>localStorage.getItem("panopticon.planning.workspaceLocation")==="remote"?"remote":"local";function xM({issue:e,isOpen:t,onClose:n,onComplete:r}){var U,I,q;const[s,i]=x.useState("checking"),[o,l]=x.useState(null),[c,u]=x.useState(null),[h,d]=x.useState(!1),[p,f]=x.useState({x:-1,y:-1}),[m,g]=x.useState({width:900,height:600}),[w,v]=x.useState(gM),[y,_]=x.useState(vM),[b,N]=x.useState(!1),[k,j]=x.useState(!1),D=x.useRef(!1),F=dn(),P=we({mutationFn:async()=>{const z=await fetch(`/api/issues/${e.identifier}/start-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({startDocker:w,workspaceLocation:y,shadowMode:b})});if(!z.ok){const te=await z.json();throw new Error(te.error||"Failed to start planning")}return z.json()},onSuccess:z=>{l(z),z.planningAgent.started?(D.current=!0,i("planning")):z.planningAgent.error&&(u(z.planningAgent.error),i("error"))},onError:z=>{u(z.message),i("error")}}),O=he({queryKey:["planningStatus",e.identifier],queryFn:async()=>{const z=await fetch(`/api/planning/${e.identifier}/status`);if(!z.ok)throw new Error("Failed to get status");return z.json()},enabled:s==="planning",refetchInterval:s==="planning"?2e3:!1}),T=we({mutationFn:async()=>{const z=await fetch(`/api/planning/${e.identifier}`,{method:"DELETE"});if(!z.ok)throw new Error("Failed to stop planning");const te=await z.json();return(await fetch(`/api/issues/${e.identifier}/complete-planning`,{method:"POST"})).ok||console.warn("Failed to mark planning complete, continuing anyway"),te},onSuccess:()=>{F.invalidateQueries({queryKey:["issues"]}),i("complete")},onError:z=>{console.error("Stop planning failed:",z),u(z.message),i("error")}}),E=we({mutationFn:async()=>{const z=await fetch(`/api/issues/${e.identifier}/abort-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:!1})});if(!z.ok){const te=await z.json();throw new Error(te.error||"Failed to abort planning")}return z.json()},onSuccess:()=>{r(),n()},onError:z=>{u(z.message)}}),R=we({mutationFn:async()=>{const z=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier})});if(!z.ok){const te=await z.json();throw new Error(te.error||"Failed to start agent")}return z.json()},onSuccess:()=>{F.invalidateQueries({queryKey:["agents"]}),F.invalidateQueries({queryKey:["issues"]}),r(),n()},onError:z=>{u(`Failed to start agent: ${z.message}`)}}),L=x.useRef(null);x.useEffect(()=>{const z=L.current!==null&&L.current!==e.identifier;L.current=e.identifier,t?z?(i("checking"),l(null),u(null),d(!1),D.current=!1,F.invalidateQueries({queryKey:["planningStatus",e.identifier]})):(F.invalidateQueries({queryKey:["planningStatus",e.identifier]}),D.current=!1):(i("checking"),l(null),u(null),d(!1),D.current=!1)},[t,e.identifier,F]),x.useEffect(()=>{t&&s==="checking"&&fetch(`/api/planning/${e.identifier}/status`).then(z=>z.json()).then(z=>{z.active?(D.current=!0,i("planning")):z.planningCompleted?i("complete"):i("ready")}).catch(()=>{i("ready")})},[t,e.identifier,s]);const $=x.useRef(0);x.useEffect(()=>{s==="planning"&&($.current=Date.now())},[s]),x.useEffect(()=>{const z=Date.now()-$.current;s==="planning"&&O.data&&!O.data.active&&D.current&&z>2e3&&i("complete")},[s,O.data]);const K=()=>{i("starting"),P.mutate()},A=()=>{T.mutate()},H=()=>{confirm(`Abort planning and return to Todo?
476
-
477
- This will:
478
- • Stop the planning agent
479
- • Move the issue back to "Todo"
480
- • Keep the workspace (can be deleted separately)
481
-
482
- Any planning artifacts in the workspace will be preserved.`)&&E.mutate()},S=()=>{R.mutate()};if(!t)return null;const Y=p.x===-1?(window.innerWidth-m.width)/2:p.x,B=p.y===-1?(window.innerHeight-m.height)/2:p.y,C=()=>{var te,se;const z=((te=o==null?void 0:o.workspace)==null?void 0:te.path)||((se=O.data)==null?void 0:se.workspacePath);return z?`${z}/docs/${e.identifier}-plan.md`:null};return h?a.jsxs("div",{className:"fixed bottom-4 right-4 z-50 bg-surface-raised rounded-lg shadow-2xl border border-divider px-4 py-2 flex items-center gap-3 cursor-pointer hover:bg-surface-overlay transition-colors",onClick:()=>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(wm,{className:"w-3 h-3 text-content"})}),a.jsxs("span",{className:"text-sm text-content font-medium",children:["Plan: ",e.identifier]}),s==="planning"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-pulse"}),(U=O.data)!=null&&U.isRemote?a.jsx("span",{className:"px-1.5 py-0.5 bg-blue-500/30 text-blue-300 text-xs rounded",children:"Remote"}):a.jsx("span",{className:"px-1.5 py-0.5 bg-gray-500/30 text-content-subtle text-xs rounded",children:"Local"})]})]}):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(rT,{position:{x:Y,y:B},size:m,onDragStop:(z,te)=>f({x:te.x,y:te.y}),onResizeStop:(z,te,se,ye,De)=>{g({width:se.offsetWidth,height:se.offsetHeight}),f({x:De.x,y:De.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-surface-raised rounded-xl shadow-2xl border border-divider overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"drag-handle flex items-center justify-between px-6 py-4 border-b border-divider 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(wm,{className:"w-5 h-5 text-content"})}),a.jsxs("div",{children:[a.jsxs("h2",{className:"text-lg font-semibold text-content",children:["Plan: ",e.identifier]}),a.jsx("p",{className:"text-sm text-content-subtle line-clamp-1",children:e.title})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s==="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"]}),(I=O.data)!=null&&I.isRemote?a.jsx("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs rounded-full",title:O.data.vmName?`VM: ${O.data.vmName}`:void 0,children:"Remote"}):a.jsx("span",{className:"px-2 py-1 bg-gray-500/20 text-content-subtle text-xs rounded-full",children:"Local"}),a.jsxs("button",{onClick:A,disabled:T.isPending,className:"flex items-center gap-1 px-3 py-1.5 bg-red-600 hover:bg-red-500 text-content text-sm font-medium rounded-lg transition-colors disabled:opacity-50",title:"Stop the planning agent",children:[a.jsx(Zl,{className:"w-4 h-4"}),"Stop"]})]}),a.jsx("button",{onClick:()=>d(!0),className:"p-2 text-content-subtle hover:text-content hover:bg-surface-overlay rounded-lg transition-colors",title:"Hide (planning continues in background)",children:a.jsx(mt,{className:"w-5 h-5"})})]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[s==="checking"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[a.jsx(je,{className:"w-12 h-12 text-purple-400 animate-spin mb-4"}),a.jsx("p",{className:"text-content-body",children:"Checking session status..."})]}),s==="ready"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 overflow-y-auto",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(no,{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-content mb-2",children:"Resume Planning Session"}),a.jsxs("p",{className:"text-content-subtle 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-surface-overlay/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[a.jsx("h4",{className:"text-sm font-medium text-content-body mb-2",children:"Options:"}),a.jsxs("ul",{className:"space-y-2 text-sm text-content-subtle",children:[a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Sn,{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(mt,{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:H,disabled:E.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(mt,{className:"w-5 h-5"}),E.isPending?"Aborting...":"Abort Planning"]}),a.jsxs("button",{onClick:K,className:"flex items-center gap-2 px-6 py-3 bg-purple-600 hover:bg-purple-500 text-content rounded-lg transition-colors font-medium",children:[a.jsx(Sn,{className:"w-5 h-5"}),"Resume Planning"]})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Start Planning Session"}),a.jsxs("p",{className:"text-content-subtle 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-surface-overlay/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[a.jsx("h4",{className:"text-sm font-medium text-content-body mb-2",children:"What happens:"}),a.jsxs("ul",{className:"space-y-2 text-sm text-content-subtle",children:[a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Ri,{className:"w-4 h-4 text-green-400"}),'Issue moves to "In Planning" in ',e.source==="github"?"GitHub":"Linear"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Ri,{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(Ri,{className:"w-4 h-4 text-green-400"}),"Planning agent starts discovery conversation"]})]})]}),a.jsxs("div",{className:"mb-4 w-full max-w-md",children:[a.jsx("label",{className:"text-sm font-medium text-content-body mb-2 block",children:"Workspace Location"}),a.jsxs("div",{className:"flex gap-4",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"workspaceLocation",value:"local",checked:y==="local",onChange:()=>{_("local"),localStorage.setItem("panopticon.planning.workspaceLocation","local")},className:"w-4 h-4 border-gray-500 bg-surface-overlay text-purple-500 focus:ring-purple-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-sm text-content-body",children:"Local"})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"workspaceLocation",value:"remote",checked:y==="remote",onChange:()=>{_("remote"),localStorage.setItem("panopticon.planning.workspaceLocation","remote")},className:"w-4 h-4 border-gray-500 bg-surface-overlay text-purple-500 focus:ring-purple-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-sm text-content-body",children:"Remote (exe.dev)"})]})]})]}),a.jsxs("label",{className:"flex items-center gap-3 mb-4 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:b,onChange:z=>N(z.target.checked),className:"w-4 h-4 rounded border-gray-500 bg-surface-overlay text-blue-500 focus:ring-blue-500 focus:ring-offset-gray-800"}),a.jsxs("span",{className:"text-sm text-content-body",children:["Shadow Engineering",a.jsx("span",{className:"text-content-muted ml-1",children:"(AI observes your workflow, doesn't modify code)"})]})]}),a.jsxs("label",{className:"flex items-center gap-3 mb-6 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:w,onChange:z=>{v(z.target.checked),localStorage.setItem("panopticon.planning.startDocker",String(z.target.checked))},className:"w-4 h-4 rounded border-gray-500 bg-surface-overlay text-purple-500 focus:ring-purple-500 focus:ring-offset-gray-800"}),a.jsxs("span",{className:"text-sm text-content-body",children:["Start Docker containers",a.jsx("span",{className:"text-content-muted ml-1",children:"(dev environment ready for testing)"})]})]}),a.jsxs("button",{onClick:K,className:"flex items-center gap-2 px-6 py-3 bg-purple-600 hover:bg-purple-500 text-content rounded-lg transition-colors font-medium",children:[a.jsx(Sn,{className:"w-5 h-5"}),"Start Planning"]})]})]}),s==="starting"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[a.jsx(je,{className:"w-12 h-12 text-purple-400 animate-spin mb-4"}),a.jsx("p",{className:"text-content-body",children:"Starting planning session..."}),a.jsx("p",{className:"text-sm text-content-muted mt-2",children:"Moving to In Planning, creating workspace, spawning agent"})]}),s==="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(C_,{sessionName:o.planningAgent.sessionName,onDisconnect:()=>{O.refetch().then(({data:z})=>{z!=null&&z.active||i("complete")})}}):(q=O.data)!=null&&q.sessionName?a.jsx(C_,{sessionName:O.data.sessionName,onDisconnect:()=>{O.refetch().then(({data:z})=>{z!=null&&z.active||i("complete")})}}):a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"flex items-center gap-2 text-content-muted",children:[a.jsx(je,{className:"w-4 h-4 animate-spin"}),"Connecting to terminal..."]})})}),a.jsxs("div",{className:"border-t border-divider px-4 py-2 flex items-center justify-between bg-surface-raised",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-content-subtle",children:[a.jsx(no,{className:"w-4 h-4"}),"Interactive planning session"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1 px-3 py-1 bg-surface-overlay hover:bg-surface-emphasis text-content-body text-sm rounded transition-colors",title:"View tasks created during planning",children:[a.jsx(ci,{className:"w-4 h-4"}),"Tasks"]}),a.jsxs("button",{onClick:H,disabled:E.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(mt,{className:"w-4 h-4"}),"Abort"]}),a.jsxs("button",{onClick:()=>{T.mutate(),O.refetch()},disabled:T.isPending,className:"flex items-center gap-1 px-3 py-1 bg-green-600/20 hover:bg-green-600/30 text-green-400 text-sm rounded transition-colors disabled:opacity-50",title:"Done - mark planning complete",children:[a.jsx(Ri,{className:"w-4 h-4"}),"Done"]})]})]})]}),s==="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(Ri,{className:"w-10 h-10 text-green-400"})}),a.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Planning Complete"}),a.jsx("p",{className:"text-content-subtle text-center max-w-md mb-6",children:"The planning session has ended. Review the plan and start the execution agent."}),C()&&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(li,{className:"w-8 h-8 text-purple-400"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-sm text-content-body font-medium",children:"Feature Plan"}),a.jsx("p",{className:"text-xs text-content-muted font-mono truncate",children:C()})]}),a.jsxs("a",{href:`vscode://file${C()}`,className:"flex items-center gap-1 px-3 py-1.5 bg-purple-600 hover:bg-purple-500 text-content text-sm rounded-lg transition-colors",title:"Open in VS Code",children:[a.jsx(gs,{className:"w-4 h-4"}),"Open"]})]})}),a.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-2 px-4 py-2 bg-green-600/20 hover:bg-green-600/30 text-green-400 rounded-lg transition-colors mb-6",children:[a.jsx(ci,{className:"w-5 h-5"}),"View Tasks",a.jsx("span",{className:"text-xs text-green-600",children:"(beads created during planning)"})]}),o&&a.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[a.jsx("p",{className:"text-sm text-content-subtle mb-2",children:"Summary:"}),a.jsxs("ul",{className:"space-y-1 text-sm",children:[a.jsxs("li",{className:"text-content-body",children:[a.jsx("span",{className:"text-content-muted",children:"Issue:"})," ",o.issue.identifier]}),a.jsxs("li",{className:"text-content-body",children:[a.jsx("span",{className:"text-content-muted",children:"State:"})," ",a.jsx("span",{className:"text-purple-400",children:o.issue.newState})]}),o.workspace.created&&a.jsxs("li",{className:"text-content-body",children:[a.jsx("span",{className:"text-content-muted",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:n,disabled:R.isPending,className:"px-4 py-2 bg-surface-overlay hover:bg-surface-emphasis text-content rounded-lg transition-colors disabled:opacity-50",children:"Close"}),a.jsxs("button",{onClick:S,disabled:R.isPending,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-500 text-content rounded-lg transition-colors disabled:opacity-50",children:[R.isPending?a.jsx(je,{className:"w-5 h-5 animate-spin"}):a.jsx(Sn,{className:"w-5 h-5"}),R.isPending?"Starting Agent...":"Start Agent"]})]})]}),s==="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(to,{className:"w-10 h-10 text-red-400"})}),a.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Planning Failed"}),a.jsx("p",{className:"text-red-400 text-center max-w-md mb-6",children:c}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:n,className:"px-4 py-2 bg-surface-overlay hover:bg-surface-emphasis text-content rounded-lg transition-colors",children:"Close"}),a.jsx("button",{onClick:()=>{i("ready"),u(null)},className:"px-4 py-2 bg-purple-600 hover:bg-purple-500 text-content rounded-lg transition-colors",children:"Try Again"})]})]})]})]})}),a.jsx(ix,{issueId:e.identifier,isOpen:k,onClose:()=>j(!1)})]})}function yM(e){const t=e.find(s=>s.startsWith("difficulty:"));if(!t)return null;const n=t.split(":")[1];return["trivial","simple","medium","complex","expert"].includes(n)?n:null}function _M(e){return e.includes("opus-4-6")||e.includes("opus-4.6")?"Opus 4.6":e.includes("opus-4-5")||e.includes("opus-4.5")?"Opus 4.5":e.includes("opus-4-1")?"Opus 4.1":e.includes("opus-4")||e.includes("opus")?"Opus":e.includes("sonnet-4-5")||e.includes("sonnet-4.5")?"Sonnet 4.5":e.includes("sonnet-4")||e.includes("sonnet")?"Sonnet":e.includes("haiku-4-5")||e.includes("haiku-4.5")?"Haiku 4.5":e.includes("haiku")?"Haiku":e}const bM={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 wM({level:e}){const t=bM[e];return a.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${t}`,children:e})}const SM={work:"🤖",planning:"📋",review:"👁️",test:"🧪",merge:"🔀"};function kM({type:e,name:t,isConflict:n}){const r=SM[e],s=n?"animate-[pulse_2s_ease-in-out_infinite]":"";return a.jsxs("span",{className:`inline-flex items-center gap-1 text-xs text-blue-400 ${s}`,children:[a.jsx("span",{children:r}),a.jsx("span",{children:t})]})}async function CM(){try{const e=await fetch("/api/costs/by-issue");if(!e.ok)return{};const t=await e.json(),n={};for(const r of t.issues||[])n[r.issueId.toLowerCase()]=r;return n}catch{return{}}}function NM(e){return e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:e>0?`$${e.toFixed(2)}`:""}function EM(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 jM(e="current",t=!1){const n=new URLSearchParams;n.set("cycle",e),t&&n.set("includeCompleted","true");const r=await fetch(`/api/issues?${n}`);if(!r.ok)throw new Error("Failed to fetch issues");return r.json()}async function RM(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function PM(){const e=await fetch("/api/specialists");if(!e.ok)throw new Error("Failed to fetch specialists");const t=await e.json();return t.specialists??t}function TM(e){const t={backlog:[],todo:[],planning:[],in_progress:[],in_review:[],done:[]};for(const n of e){let r;n.targetCanonicalState?r=n.targetCanonicalState:n.shadowStatus?r=n.shadowStatus==="closed"?"done":n.shadowStatus==="in_progress"?Tt[n.status]||"in_progress":Tt[n.status]||"backlog":n.derivedStatus?r=n.derivedStatus==="closed"?"done":n.derivedStatus==="in_progress"?"in_progress":Tt[n.status]||"backlog":r=Tt[n.status]||"backlog",r==="canceled"?t.done.push(n):t[r]?t[r].push(n):t.backlog.push(n)}return t}function DM(e){var l;const t=[],n=[];for(const c of e)(l=c.artifactType)!=null&&l.includes("PortfolioItem")?t.push(c):n.push(c);if(t.length===0)return e.map(c=>({type:"orphan",children:[c]}));const r=new Map;for(const c of t)r.set(c.identifier,c);const s=new Map,i=[];for(const c of n)if(c.parentRef&&r.has(c.parentRef)){const u=s.get(c.parentRef)||[];u.push(c),s.set(c.parentRef,u)}else i.push(c);const o=[];for(const c of t){const u=s.get(c.identifier)||[];o.push({type:"feature",feature:c,children:u})}for(const c of i)o.push({type:"orphan",children:[c]});return o}function ox({issue:e,compact:t=!1}){const n=e.rawTrackerState||e.shadowTrackerStatus,r=e.shadowStatus||e.targetCanonicalState;if(!n||!r)return null;const s=r==="in_progress"?"In Progress":r==="closed"||r==="done"?"Done":r==="in_review"?"In Review":r==="planning"?"Planning":r,i=n.toLowerCase().replace(/[-_\s]/g,""),o=s.toLowerCase().replace(/[-_\s]/g,"");return i===o?null:t?a.jsx("span",{className:"w-2 h-2 rounded-full bg-purple-500 shrink-0",title:`Rally: ${n} → Pan: ${s}`}):a.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-gray-700/50 text-gray-300",children:[a.jsx(gs,{className:"w-2.5 h-2.5"}),n]}),a.jsx("span",{className:"text-content-muted",children:"→"}),a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-purple-900/50 text-purple-300",children:[a.jsx(hh,{className:"w-2.5 h-2.5"}),s]})]})}function MM({feature:e,childCount:t,isExpanded:n,onToggle:r}){const s=e.completedChildCount??0,i=e.inProgressChildCount??0,o=e.totalChildCount??t,l=o>0?Math.round(s/o*100):0,c=e.derivedStatus&&e.rawTrackerState&&(e.derivedStatus==="in_progress"&&e.rawTrackerState!=="Developing"||e.derivedStatus==="closed"&&e.rawTrackerState!=="Done");return a.jsx("div",{className:"bg-surface-overlay rounded-lg border-l-4 border-l-indigo-500 overflow-hidden",children:a.jsxs("div",{onClick:r,className:"flex items-start gap-2 px-3 py-2.5 cursor-pointer hover:bg-indigo-900/20 transition-colors",children:[n?a.jsx(uk,{className:"w-4 h-4 text-indigo-400 shrink-0 mt-0.5"}):a.jsx(Wv,{className:"w-4 h-4 text-indigo-400 shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.project&&a.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.project.color||"#6b7280"}}),a.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:u=>u.stopPropagation(),className:"text-xs font-medium text-indigo-300 hover:text-indigo-200 flex items-center gap-1",children:[a.jsx("span",{children:e.identifier}),a.jsx(gs,{className:"w-2.5 h-2.5 opacity-50"})]}),c&&a.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium bg-amber-900/50 text-amber-400",children:"derived"}),a.jsx(ox,{issue:e})]}),a.jsx("p",{className:"text-sm text-content-body mt-1 line-clamp-1",children:e.title}),o>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"w-full h-1.5 bg-gray-700 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full transition-all",style:{width:`${l}%`}})}),a.jsxs("div",{className:"flex items-center justify-between mt-1",children:[a.jsxs("span",{className:"text-xs text-content-muted",children:[s,"/",o," done",i>0?`, ${i} active`:""]}),a.jsxs("span",{className:"text-xs text-indigo-400",children:[t," in column"]})]})]})]})]})})}function AM({issue:e,agents:t}){const n=Tt[e.status]||"backlog",r=n==="done"?"bg-green-400":n==="in_progress"?"bg-yellow-400":n==="in_review"?"bg-pink-400":"bg-gray-500",s=e.identifier.toLowerCase(),i=t.some(o=>{var l;return((l=o.issueId)==null?void 0:l.toLowerCase())===s&&o.status!=="dead"});return a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-surface-overlay/50 transition-colors group",children:[a.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${r}`}),a.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-content-subtle hover:text-blue-400 shrink-0",children:e.identifier}),a.jsx("span",{className:"text-xs text-content-body truncate flex-1",children:e.title}),a.jsx(ox,{issue:e,compact:!0}),i&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-400 animate-pulse shrink-0",title:"Agent running"})]})}const E_={backlog:"border-divider-strong",todo:"border-blue-600",planning:"border-purple-600",in_progress:"border-yellow-500",in_review:"border-pink-500",done:"border-green-500"},LM={backlog:"Backlog",todo:"To Do",planning:"Planning",in_progress:"In Progress",in_review:"In Review",done:"Done"};function OM({selectedIssue:e,onSelectIssue:t}){const n=dn(),[r,s]=x.useState(null),[i,o]=x.useState(new Set),[l,c]=x.useState(null),[u,h]=x.useState(null),[d,p]=x.useState("current"),[f,m]=x.useState(!1),[g,w]=x.useState(null),[v,y]=x.useState(null),[_,b]=x.useState([]),[N,k]=x.useState(!1),[j,D]=x.useState(null),[F,P]=x.useState({open:!1,issue:null,targetStatus:null}),[O,T]=x.useState({open:!1,issue:null}),E=e!==void 0?e:r,R=t||s,{data:L,isLoading:$,error:K}=he({queryKey:["issues",d,f],queryFn:()=>jM(d,f)}),{data:A=[]}=he({queryKey:["agents"],queryFn:RM,refetchInterval:5e3}),{data:H=[]}=he({queryKey:["specialists"],queryFn:PM,refetchInterval:5e3}),S=u3(i0(Fv,{activationConstraint:{distance:8}}),i0(Iv)),Y=we({mutationFn:async({issueId:ne,targetStatus:fe,syncToTracker:ke})=>{const Ze=await fetch(`/api/issues/${ne}/move-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetStatus:fe,syncToTracker:ke})});if(!Ze.ok){const et=await Ze.json();throw new Error(et.error||"Failed to move issue")}return Ze.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["issues"]})}}),B=x.useCallback(()=>{if(_.length===0)return;const ne=_[_.length-1];Y.mutate({issueId:ne.issueId,targetStatus:ne.fromStatus}),b(fe=>fe.slice(0,-1)),k(!1),j&&(clearTimeout(j),D(null))},[_,Y,j]);x.useEffect(()=>{const ne=fe=>{(fe.metaKey||fe.ctrlKey)&&fe.key==="z"&&(fe.preventDefault(),B())};return window.addEventListener("keydown",ne),()=>window.removeEventListener("keydown",ne)},[B]);const C=x.useCallback((ne,fe,ke)=>{b(et=>[...et,{issueId:ne,fromStatus:fe,toStatus:ke,timestamp:Date.now()}]),k(!0),j&&clearTimeout(j);const Ze=setTimeout(()=>{k(!1)},8e3);D(Ze)},[j]),U=x.useCallback(ne=>{const{active:fe}=ne,ke=fe.id,Ze=L==null?void 0:L.find(et=>et.id===ke);Ze&&(w(Ze),y(Tt[Ze.status]))},[L]),I=x.useCallback(ne=>{const{active:fe,over:ke}=ne;if(w(null),y(null),!ke)return;const Ze=fe.id,et=ke.id,Ct=L==null?void 0:L.find(cr=>cr.id===Ze);if(!Ct)return;const tt=Tt[Ct.status];if(tt===et)return;const en=Ct.identifier.toLowerCase();if(A.some(cr=>{var ur;return((ur=cr.issueId)==null?void 0:ur.toLowerCase())===en&&cr.status!=="dead"})){P({open:!0,issue:Ct,targetStatus:et});return}if(et==="done"){T({open:!0,issue:Ct});return}C(Ct.identifier,tt,et),Y.mutate({issueId:Ct.identifier,targetStatus:et})},[L,A,Y,C]),q=x.useCallback(()=>{const{issue:ne,targetStatus:fe}=F;if(!ne||!fe)return;P({open:!1,issue:null,targetStatus:null});const ke=Tt[ne.status];if(fe==="done"){T({open:!0,issue:ne});return}C(ne.identifier,ke,fe),Y.mutate({issueId:ne.identifier,targetStatus:fe})},[F,Y,C]),z=x.useCallback(async(ne,fe)=>{const{issue:ke}=O;if(!ke)return;T({open:!1,issue:null});const Ze=Tt[ke.status];if(fe!=null&&fe.stopAgents){const et=ke.identifier.toLowerCase(),Ct=A.filter(tt=>{var en;return((en=tt.issueId)==null?void 0:en.toLowerCase())===et});for(const tt of Ct)try{await fetch(`/api/agents/${tt.id}`,{method:"DELETE"})}catch(en){console.error(`Failed to stop agent ${tt.id}:`,en)}}if(fe!=null&&fe.cleanupWorkspace)try{await fetch(`/api/issues/${ke.identifier}/cleanup-workspace`,{method:"POST"})}catch(et){console.error(`Failed to cleanup workspace for ${ke.identifier}:`,et)}C(ke.identifier,Ze,"done"),Y.mutate({issueId:ke.identifier,targetStatus:"done",syncToTracker:ne}),fe!=null&&fe.stopAgents&&n.invalidateQueries({queryKey:["agents"]})},[O,Y,C,A,n]),te={sideEffects:ok({styles:{active:{opacity:"0.5"}}})},{data:se={}}=he({queryKey:["issueCosts"],queryFn:CM,refetchInterval:3e4,staleTime:1e4}),ye=x.useMemo(()=>{if(!L)return[];const ne=new Map;for(const fe of L)fe.project&&!ne.has(fe.project.id)&&ne.set(fe.project.id,fe.project);return Array.from(ne.values()).sort((fe,ke)=>fe.name.localeCompare(ke.name))},[L]),De=x.useMemo(()=>L?i.size===0?L:L.filter(ne=>ne.project&&i.has(ne.project.id)):[],[L,i]),$e=ne=>{o(fe=>{const ke=new Set(fe);return ke.has(ne)?ke.delete(ne):ke.add(ne),ke})};if($)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-surface-overlay rounded"}),a.jsx("div",{className:"w-16 h-4 bg-surface-overlay rounded"}),a.jsx("div",{className:"w-24 h-6 bg-surface-overlay rounded"}),a.jsx("div",{className:"w-20 h-6 bg-surface-overlay rounded"}),a.jsx("div",{className:"w-28 h-6 bg-surface-overlay rounded"})]}),a.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:x0.map(ne=>a.jsx("div",{className:"flex-shrink-0 w-80",children:a.jsxs("div",{className:`border-t-4 ${E_[ne]} bg-surface-raised rounded-lg`,children:[a.jsx("div",{className:"px-4 py-3 border-b border-divider",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"h-5 bg-surface-overlay rounded w-24 animate-pulse"}),a.jsx("div",{className:"h-4 bg-surface-overlay rounded w-6 animate-pulse"})]})}),a.jsx("div",{className:"p-2 space-y-2",children:[1,2,3].map(fe=>a.jsxs("div",{className:"bg-surface-overlay rounded-lg p-3 border-l-4 border-l-divider-strong animate-pulse",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("div",{className:"w-2 h-2 bg-surface-emphasis rounded-full"}),a.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-16"})]}),a.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-full mb-1"}),a.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-3/4"}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsx("div",{className:"h-5 bg-surface-emphasis rounded w-16"}),a.jsx("div",{className:"h-5 bg-surface-emphasis rounded w-12"})]})]},fe))})]})},ne))})]});if(K)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-red-400",children:["Error loading issues: ",K.message]})});const _e=TM(De);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(HR,{className:"w-4 h-4 text-content-subtle"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Cycle:"}),a.jsx("div",{className:"flex rounded-lg overflow-hidden border border-divider-strong",children:["current","all","backlog"].map(ne=>a.jsx("button",{onClick:()=>p(ne),className:`px-3 py-1 text-xs transition-colors ${d===ne?"bg-blue-600 text-content":"bg-surface-raised text-content-subtle hover:text-content hover:bg-surface-overlay"}`,children:ne==="current"?"Current":ne==="all"?"All":"Backlog"},ne))})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:f,onChange:ne=>m(ne.target.checked),className:"w-4 h-4 rounded border-divider-strong bg-surface-raised text-blue-600 focus:ring-blue-500 focus:ring-offset-surface"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Include completed"})]}),a.jsx("button",{onClick:async()=>{try{await fetch("/api/trackers/refresh",{method:"POST"}),n.invalidateQueries({queryKey:["issues"]})}catch(ne){console.error("Refresh failed:",ne)}},className:"flex items-center gap-1 px-2 py-1 text-xs text-content-subtle hover:text-content bg-surface-raised hover:bg-surface-overlay rounded transition-colors",title:"Force refresh all trackers",children:a.jsx(fh,{className:"w-3.5 h-3.5"})}),a.jsxs("span",{className:"text-sm text-content-muted",children:[(L==null?void 0:L.length)||0," issues"]}),ye.length>1&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-6 bg-surface-overlay"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Projects:"}),ye.map(ne=>a.jsxs("button",{onClick:()=>$e(ne.id),className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${i.size===0||i.has(ne.id)?"bg-surface-overlay text-content":"bg-surface-raised text-content-muted hover:text-content-body"}`,children:[a.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:ne.color||"#6b7280"}}),ne.name]},ne.id)),i.size>0&&a.jsx("button",{onClick:()=>o(new Set),className:"text-xs text-content-subtle hover:text-content",children:"Clear"})]})]}),a.jsxs(uR,{sensors:S,collisionDetection:g3,onDragStart:U,onDragEnd:I,children:[a.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:x0.map(ne=>a.jsx(BM,{status:ne,children:a.jsxs("div",{className:`border-t-4 ${E_[ne]} bg-surface-raised rounded-lg transition-colors ${v&&v!==ne?"bg-surface-raised/80":""}`,children:[a.jsx("div",{className:"px-4 py-3 border-b border-divider",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-semibold text-content",children:LM[ne]}),a.jsx("span",{className:"text-sm text-content-subtle",children:_e[ne].length})]})}),a.jsx(IM,{issues:_e[ne],agents:A,specialists:H,issueCosts:se,selectedIssue:E,onSelectIssue:R,onPlan:c,onViewBeads:h})]})},ne))}),a.jsx(RR,{dropAnimation:te,children:g?a.jsx(zM,{issue:g}):null})]}),a.jsx(WM,{isVisible:N,onUndo:B,onClose:()=>k(!1)}),a.jsx($M,{isOpen:F.open,onClose:()=>P({open:!1,issue:null,targetStatus:null}),onConfirm:q,issue:F.issue}),a.jsx(HM,{isOpen:O.open,onClose:()=>T({open:!1,issue:null}),onSync:z,issue:O.issue}),l&&a.jsx(xM,{issue:l,isOpen:!0,onClose:()=>c(null),onComplete:()=>{c(null),n.invalidateQueries({queryKey:["issues"]})}}),u&&a.jsx(UM,{issue:u,onClose:()=>h(null)})]})}function IM({issues:e,agents:t,specialists:n,issueCosts:r,selectedIssue:s,onSelectIssue:i,onPlan:o,onViewBeads:l}){const[c,u]=x.useState(new Set),h=x.useCallback(m=>{u(g=>{const w=new Set(g);return w.has(m)?w.delete(m):w.add(m),w})},[]),p=e.some(m=>{var g;return(g=m.artifactType)==null?void 0:g.includes("PortfolioItem")})?DM(e):null,f=m=>{const g=m.identifier.toLowerCase(),w=t.find(_=>{var b;return((b=_.issueId)==null?void 0:b.toLowerCase())===g&&_.type==="planning"}),v=t.find(_=>{var b;return((b=_.issueId)==null?void 0:b.toLowerCase())===g&&_.type!=="planning"}),y=n.filter(_=>{var b;return((b=_.currentIssue)==null?void 0:b.toLowerCase())===g});return a.jsx(FM,{issue:m,children:a.jsx(qM,{issue:m,planningAgent:w,workAgent:v,specialists:y,cost:r[m.identifier.toLowerCase()],isSelected:s===m.identifier,onSelect:()=>i(s===m.identifier?null:m.identifier),onPlan:()=>o(m),onViewBeads:_=>l(_)})},m.id)};return e.length===0?a.jsx("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:a.jsx("div",{className:"text-center text-content-muted py-8 text-sm",children:"No issues"})}):p?a.jsx("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:p.map(m=>{if(m.type==="orphan")return f(m.children[0]);const g=m.feature,w=!c.has(g.identifier);return a.jsxs("div",{className:"space-y-1",children:[a.jsx(MM,{feature:g,childCount:m.children.length,isExpanded:w,onToggle:()=>h(g.identifier)}),w&&a.jsxs("div",{className:"ml-3 border-l-2 border-indigo-700/30 pl-1",children:[m.children.map(v=>a.jsx(AM,{issue:v,agents:t},v.id)),m.children.length===0&&a.jsx("div",{className:"text-xs text-content-muted py-2 pl-2",children:"No stories in this column"})]})]},`feature-${g.id}`)})}):a.jsx("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:e.map(f)})}function BM({status:e,children:t}){const{isOver:n,setNodeRef:r}=vR({id:e});return a.jsx("div",{ref:r,className:`flex-shrink-0 w-80 transition-all ${n?"scale-[1.02]":""}`,children:t})}function FM({issue:e,children:t}){const{attributes:n,listeners:r,setNodeRef:s,transform:i,isDragging:o}=fR({id:e.id,data:{issue:e}}),l=i?{transform:`translate3d(${i.x}px, ${i.y}px, 0)`}:void 0;return a.jsx("div",{ref:s,style:l,...r,...n,className:`${o?"opacity-30":"opacity-100"} cursor-grab active:cursor-grabbing`,children:t})}function zM({issue:e}){return a.jsxs("div",{className:"bg-surface-overlay rounded-lg p-3 border-l-4 border-l-blue-500 shadow-2xl rotate-2 scale-105 opacity-90",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-content-subtle text-sm",children:e.identifier})}),a.jsx("p",{className:"text-sm text-content mt-1 line-clamp-2",children:e.title})]})}function $M({isOpen:e,onClose:t,onConfirm:n,issue:r}){return!e||!r?null: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.jsx("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-md mx-4 p-6",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"p-2 bg-amber-900/50 rounded-lg",children:a.jsx(Wn,{className:"w-6 h-6 text-amber-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-lg font-semibold text-content mb-2",children:"Active Agent Warning"}),a.jsxs("p",{className:"text-content-body text-sm mb-4",children:[a.jsx("strong",{children:r.identifier})," has an active agent working on it. Moving this issue may disrupt the agent's work."]}),a.jsx("p",{className:"text-content-subtle text-xs mb-6",children:"Are you sure you want to proceed?"}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:t,className:"px-4 py-2 text-content-subtle hover:text-content transition-colors text-sm",children:"Cancel"}),a.jsx("button",{onClick:n,className:"px-4 py-2 bg-amber-600 hover:bg-amber-500 text-content rounded-lg transition-colors text-sm",children:"Move Anyway"})]})]})]})})]})}function HM({isOpen:e,onClose:t,onSync:n,issue:r}){const[s,i]=x.useState(!1),[o,l]=x.useState(!1);if(!e||!r)return null;const c=r.source==="github"?"GitHub":"Linear";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.jsx("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-md mx-4 p-6",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"p-2 bg-green-900/50 rounded-lg",children:a.jsx(Nl,{className:"w-6 h-6 text-green-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-lg font-semibold text-content mb-2",children:"Move to Done"}),a.jsxs("p",{className:"text-content-body text-sm mb-4",children:["You're moving ",a.jsx("strong",{children:r.identifier})," to Done."]}),a.jsxs("div",{className:"space-y-2 mb-4 p-3 bg-surface-overlay/50 rounded-lg",children:[a.jsxs("label",{className:"flex items-center gap-2 text-sm text-content-body cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:s,onChange:u=>i(u.target.checked),className:"rounded border-divider-strong bg-surface-overlay text-green-500 focus:ring-green-500"}),"Clean up workspace"]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm text-content-body cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:o,onChange:u=>l(u.target.checked),className:"rounded border-divider-strong bg-surface-overlay text-green-500 focus:ring-green-500"}),"Stop running agents"]})]}),a.jsxs("p",{className:"text-content-subtle text-xs mb-4",children:["Sync status change to ",c,"?"]}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:()=>n(!1,{cleanupWorkspace:s,stopAgents:o}),className:"px-4 py-2 text-content-subtle hover:text-content transition-colors text-sm",children:"Shadow Only"}),a.jsxs("button",{onClick:()=>n(!0,{cleanupWorkspace:s,stopAgents:o}),className:"px-4 py-2 bg-green-600 hover:bg-green-500 text-content rounded-lg transition-colors text-sm",children:["Sync to ",c]})]})]})]})})]})}function WM({isVisible:e,onUndo:t,onClose:n}){return e?a.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",children:a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg shadow-xl px-4 py-3 flex items-center gap-4",children:[a.jsx("span",{className:"text-sm text-content-body",children:"Issue moved"}),a.jsxs("button",{onClick:t,className:"flex items-center gap-1 text-sm text-blue-400 hover:text-blue-300 transition-colors",children:[a.jsx(bk,{className:"w-4 h-4"}),"Undo"]}),a.jsx("button",{onClick:n,className:"text-content-muted hover:text-content-subtle",children:a.jsx(mt,{className:"w-4 h-4"})})]})}):null}function UM({issue:e,onClose:t}){var i,o;const{data:n,isLoading:r,error:s}=he({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-surface-raised 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-divider",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ci,{className:"w-5 h-5 text-green-400"}),a.jsxs("h2",{className:"font-semibold text-content",children:["Tasks: ",e.identifier]})]}),a.jsx("button",{onClick:t,className:"p-1 text-content-subtle hover:text-content hover:bg-surface-overlay rounded transition-colors",children:a.jsx(mt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[r&&a.jsxs("div",{className:"flex items-center justify-center py-8 text-content-subtle",children:[a.jsx(je,{className:"w-5 h-5 animate-spin mr-2"}),"Loading tasks..."]}),s&&a.jsx("div",{className:"text-red-400 text-center py-8",children:"Failed to load tasks"}),n&&((i=n.tasks)==null?void 0:i.length)===0&&a.jsx("div",{className:"text-content-muted text-center py-8",children:"No tasks created yet"}),n&&((o=n.tasks)==null?void 0:o.length)>0&&a.jsx("div",{className:"space-y-2",children:n.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-surface-overlay/50"}`,children:[a.jsx("div",{className:`mt-0.5 ${l.status==="closed"?"text-green-400":l.status==="in_progress"?"text-blue-400":"text-content-subtle"}`,children:l.status==="closed"?a.jsx(mi,{className:"w-4 h-4"}):l.status==="in_progress"?a.jsx(je,{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-content",children:l.title}),a.jsxs("div",{className:"text-xs text-content-muted mt-1",children:[l.id," · ",l.status]})]})]},l.id))})]}),a.jsxs("div",{className:"px-4 py-3 border-t border-divider text-xs text-content-muted",children:[(n==null?void 0:n.count)||0," task",(n==null?void 0:n.count)!==1?"s":""," · Beads"]})]})]})}function qM({issue:e,planningAgent:t,workAgent:n,specialists:r=[],cost:s,isSelected:i,onSelect:o,onPlan:l,onViewBeads:c}){var U;const u=dn(),d=Tt[e.status]==="planning"?t:n,p=d&&d.status!=="dead"&&d.status!=="stopped",f=d,[m,g]=x.useState(!1),[w,v]=x.useState(!1),y=Tt[e.status]||"backlog",_=y==="done"||y==="canceled",b=!_&&(((U=e.labels)==null?void 0:U.some(I=>typeof I=="string"&&I.toLowerCase()==="review ready"))??!1),N={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"},k=we({mutationFn:async I=>{const q=await fetch(`/api/agents/${I}`,{method:"DELETE"});if(!q.ok)throw new Error("Failed to kill agent");return q.json()},onSuccess:()=>{u.invalidateQueries({queryKey:["agents"]})}}),[j,D]=x.useState(""),[F,P]=x.useState(!1),O=we({mutationFn:async({agentId:I,message:q})=>{const z=await fetch(`/api/agents/${I}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:q})});if(!z.ok)throw new Error("Failed to send message");return z.json()},onSuccess:()=>{D(""),P(!1)}}),T=I=>{I.stopPropagation(),f&&confirm(`Kill agent ${f.id}?`)&&k.mutate(f.id)},E=I=>{I.stopPropagation(),o()},R=I=>{I.stopPropagation(),P(!F)},L=I=>{I.preventDefault(),I.stopPropagation(),f&&j.trim()&&O.mutate({agentId:f.id,message:j.trim()})},$=we({mutationFn:async()=>{const I=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier})});if(!I.ok){const q=await I.json();throw new Error(q.error||"Failed to start agent")}return I.json()},onSuccess:()=>{u.invalidateQueries({queryKey:["agents"]}),u.invalidateQueries({queryKey:["issues"]})},onError:I=>{alert(`Failed to start agent: ${I.message}`)}}),K=I=>{I.stopPropagation(),confirm(`Start agent for ${e.identifier}?`)&&$.mutate()},A=I=>{I.stopPropagation(),l()},H=we({mutationFn:async I=>{const q=await fetch(`/api/issues/${e.identifier}/abort-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:I.deleteWorkspace})});if(!q.ok){const z=await q.json();throw new Error(z.error||"Failed to abort planning")}return q.json()},onSuccess:()=>{g(!1),v(!1),u.invalidateQueries({queryKey:["issues"]}),u.invalidateQueries({queryKey:["agents"]})}}),S=we({mutationFn:async I=>{const q=await fetch(`/api/issues/${e.identifier}/deep-wipe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:I.deleteWorkspace})});if(!q.ok){const z=await q.json();throw new Error(z.error||"Deep wipe failed")}return q.json()},onSuccess:I=>{g(!1),v(!1),u.invalidateQueries({queryKey:["issues"]}),u.invalidateQueries({queryKey:["agents"]}),console.log("Deep wipe completed:",I.cleanupLog)}}),Y=I=>{I.stopPropagation(),g(!0)},B=I=>{I.stopPropagation(),H.mutate({deleteWorkspace:w})},C=I=>{I.stopPropagation(),g(!1),v(!1)};return a.jsxs("div",{onClick:o,className:`bg-surface-overlay rounded-lg p-3 border-l-4 cursor-pointer transition-all ${N[e.priority]||"border-l-gray-500"} ${i?"ring-2 ring-blue-500 bg-gray-650":"hover:bg-gray-650"} ${p?"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 flex-wrap",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}),p&&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:I=>I.stopPropagation(),className:"text-sm font-medium text-content hover:text-blue-400 flex items-center gap-1",children:[e.source==="github"&&a.jsx("span",{title:"GitHub Issue",children:a.jsx(Uv,{className:"w-3 h-3 text-content-subtle"})}),a.jsx("span",{className:"text-content-subtle",children:e.identifier}),a.jsx(gs,{className:"w-3 h-3 opacity-50"})]}),(()=>{const I=[],q=(!!n||!!t)&&r.length>0||!!n&&!!t||r.length>1;n&&I.push({type:"work",name:"work"}),t&&I.push({type:"planning",name:"plan"});for(const z of r){const te=z.name.replace("-agent","");I.push({type:te,name:te})}return I.map((z,te)=>a.jsx(kM,{type:z.type,name:z.name,isConflict:q},te))})(),d&&d.model&&a.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium bg-surface-emphasis text-content-body",title:`Model: ${d.model}`,children:_M(d.model)}),d&&d.workspaceLocation&&a.jsxs("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded text-xs font-medium ${d.workspaceLocation==="remote"?"bg-cyan-900/50 text-cyan-400":"bg-surface-emphasis text-content-body"}`,title:d.workspaceLocation==="remote"?"Running on remote VM (exe.dev)":"Running locally",children:[d.workspaceLocation==="remote"?a.jsx(ym,{className:"w-3 h-3"}):a.jsx(bm,{className:"w-3 h-3"}),d.workspaceLocation]}),b&&a.jsxs("span",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-green-600 text-content animate-pulse",title:"Agent completed work - ready for human review",children:[a.jsx(OR,{className:"w-3 h-3"}),"Ready"]}),!_&&(f==null?void 0:f.hasPendingQuestion)&&a.jsxs("span",{onClick:I=>{I.stopPropagation(),f.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-content animate-pulse cursor-pointer hover:bg-amber-500",title:`Agent is waiting for user input - click to respond (${f.pendingQuestionCount||1} question${(f.pendingQuestionCount||1)>1?"s":""})`,children:[a.jsx(IR,{className:"w-3 h-3"}),"Input"]}),e.source==="rally"&&a.jsx(ox,{issue:e}),(()=>{const I=yM(e.labels);return I?a.jsx(wM,{level:I}):null})(),s&&s.totalCost>0&&a.jsxs("span",{className:`ml-auto px-1.5 py-0.5 rounded text-xs font-medium ${EM(s.totalCost)}`,title:`${(s.tokenCount/1e6).toFixed(2)}M tokens${s.model?` • ${s.model.replace("claude-","").replace(/-20[0-9]{6}$/,"")}`:""}${s.durationMinutes?` • ${Math.round(s.durationMinutes)}min`:""}`,children:[a.jsx(uo,{className:"w-3 h-3 inline -mt-0.5"}),NM(s.totalCost).slice(1)]})]}),a.jsx("p",{className:"text-sm text-content-body 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-content-subtle",children:[a.jsx(Sk,{className:"w-3 h-3"}),e.assignee.name.split(" ")[0]]}),(e.labels||[]).filter(I=>typeof I=="string"&&I.toLowerCase()!=="review ready").slice(0,2).map(I=>a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs bg-surface-emphasis text-content-body px-2 py-0.5 rounded",children:[a.jsx(yk,{className:"w-3 h-3"}),I]},I))]}),p&&a.jsxs("div",{className:`flex items-center gap-3 mt-3 pt-3 border-t ${(f==null?void 0:f.type)==="planning"?"border-purple-600/50":"border-divider-strong"}`,children:[a.jsxs("button",{onClick:(f==null?void 0:f.type)==="planning"?A:E,className:`flex items-center gap-1 text-xs transition-colors ${(f==null?void 0:f.type)==="planning"?"text-purple-400 hover:text-purple-300":i?"text-blue-400":"text-content-subtle hover:text-content"}`,children:[(f==null?void 0:f.type)==="planning"?a.jsx(wm,{className:"w-3.5 h-3.5"}):a.jsx(hh,{className:"w-3.5 h-3.5"}),(f==null?void 0:f.type)==="planning"?"Continue Planning":"Watch"]}),a.jsxs("button",{onClick:()=>c&&c(e),className:"flex items-center gap-1 text-xs text-green-400 hover:text-green-300 transition-colors",title:"View tasks for this issue",children:[a.jsx(ci,{className:"w-3.5 h-3.5"}),"Tasks"]}),a.jsxs("button",{onClick:R,className:`flex items-center gap-1 text-xs transition-colors ${F?"text-blue-400":"text-content-subtle hover:text-content"}`,children:[a.jsx(qR,{className:"w-3.5 h-3.5"}),"Tell"]}),a.jsxs("button",{onClick:T,disabled:k.isPending,className:"flex items-center gap-1 text-xs text-red-400 hover:text-red-300 transition-colors ml-auto",children:[k.isPending?a.jsx(je,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(mt,{className:"w-3.5 h-3.5"}),"Kill"]})]}),F&&f&&a.jsx("form",{onSubmit:L,className:"mt-2",onClick:I=>I.stopPropagation(),children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:j,onChange:I=>D(I.target.value),placeholder:"Type a message...",className:"flex-1 bg-surface-raised text-content text-sm px-3 py-1.5 rounded border border-divider-strong focus:border-blue-500 focus:outline-none",autoFocus:!0}),a.jsx("button",{type:"submit",disabled:!j.trim()||O.isPending,className:"px-3 py-1.5 bg-blue-600 text-content text-sm rounded hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:O.isPending?"...":"Send"})]})}),!p&&(Tt[e.status]==="backlog"||Tt[e.status]==="todo")&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong flex-wrap",children:[a.jsxs("button",{onClick:A,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[a.jsx(li,{className:"w-3.5 h-3.5"}),"Plan"]}),a.jsxs("button",{onClick:K,disabled:$.isPending,className:"flex items-center gap-1 text-xs text-content-muted hover:text-content-subtle transition-colors disabled:opacity-50",title:"Plan first recommended",children:[$.isPending?a.jsx(je,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(Sn,{className:"w-3.5 h-3.5"}),$.isPending?"Starting...":"Start Agent"]}),a.jsxs("button",{onClick:I=>{I.stopPropagation(),confirm(`Deep wipe ${e.identifier}? This will clean up any stale state:
483
- • Kill agents
484
- • Delete agent state
485
- • Delete workspace & branches`)&&S.mutate({deleteWorkspace:!0})},disabled:S.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:[S.isPending?a.jsx(je,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(_k,{className:"w-3.5 h-3.5"}),S.isPending?"Wiping...":"Reset"]})]}),!p&&Tt[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:A,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[a.jsx(li,{className:"w-3.5 h-3.5"}),"Resume Planning"]}),a.jsxs("button",{onClick:()=>c&&c(e),className:"flex items-center gap-1 text-xs text-green-400 hover:text-green-300 transition-colors",title:"View tasks created during planning",children:[a.jsx(ci,{className:"w-3.5 h-3.5"}),"Tasks"]}),a.jsxs("button",{onClick:K,className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors",children:[a.jsx(Sn,{className:"w-3.5 h-3.5"}),"Start Agent"]}),a.jsxs("button",{onClick:Y,disabled:H.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(mt,{className:"w-3.5 h-3.5"}),H.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-content-subtle mb-3 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:w,onChange:I=>v(I.target.checked),onClick:I=>I.stopPropagation(),className:"rounded border-divider-strong bg-surface-overlay 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:C,className:"px-2 py-1 text-xs text-content-subtle hover:text-content transition-colors",children:"Cancel"}),a.jsx("button",{onClick:B,disabled:H.isPending||S.isPending,className:"px-2 py-1 text-xs bg-orange-600 hover:bg-orange-500 text-content rounded transition-colors disabled:opacity-50",children:H.isPending?"Aborting...":"Abort"}),a.jsx("button",{onClick:I=>{I.stopPropagation(),confirm(`Deep wipe ${e.identifier}? This will:
486
- • Kill all agents
487
- • Delete all state
488
- • Reset to Backlog
489
- • Remove labels${w?`
490
- • Delete workspace`:""}`)&&S.mutate({deleteWorkspace:w})},disabled:H.isPending||S.isPending,className:"px-2 py-1 text-xs bg-red-700 hover:bg-red-600 text-content rounded transition-colors disabled:opacity-50",title:"Complete reset - kills agents, deletes state, resets Linear",children:S.isPending?"Wiping...":"🔥 Deep Wipe"})]})]}),!p&&Tt[e.status]==="in_progress"&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong flex-wrap",children:[a.jsxs("button",{onClick:A,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[a.jsx(li,{className:"w-3.5 h-3.5"}),"Re-plan"]}),a.jsxs("button",{onClick:()=>c&&c(e),className:"flex items-center gap-1 text-xs text-green-400 hover:text-green-300 transition-colors",title:"View tasks for this issue",children:[a.jsx(ci,{className:"w-3.5 h-3.5"}),"Tasks"]}),a.jsxs("button",{onClick:K,className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors",children:[a.jsx(Sn,{className:"w-3.5 h-3.5"}),"Resume Agent"]}),a.jsxs("button",{onClick:I=>{I.stopPropagation(),confirm(`Reset ${e.identifier}?
491
-
492
- This will:
493
- • Kill any running agents (local and remote)
494
- • Move the issue back to To Do in Linear
495
- • Keep the workspace for reference`)&&fetch(`/api/issues/${e.identifier}/reset`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(async()=>{await u.refetchQueries({queryKey:["issues"]}),await u.refetchQueries({queryKey:["agents"]})}).catch(q=>console.error("Reset failed:",q))},className:"flex items-center gap-1 text-xs text-orange-400 hover:text-orange-300 transition-colors",title:"Reset to To Do - kills agents, resets Linear status",children:[a.jsx(bk,{className:"w-3.5 h-3.5"}),"Reset"]})]}),!p&&(Tt[e.status]==="done"||Tt[e.status]==="in_review")&&a.jsx(KM,{issue:e})]})}function KM({issue:e}){const t=dn(),n=we({mutationFn:async()=>{const s=await fetch(`/api/issues/${e.identifier}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!s.ok){const i=await s.json();throw new Error(i.error||"Failed to reopen issue")}return s.json()},onSuccess:async()=>{await t.refetchQueries({queryKey:["issues"]})}}),r=s=>{s.stopPropagation(),confirm(`Reopen ${e.identifier} and start planning?`)&&n.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:r,disabled:n.isPending,className:"flex items-center gap-1 text-xs text-orange-400 hover:text-orange-300 transition-colors disabled:opacity-50",children:[n.isPending?a.jsx(je,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(fh,{className:"w-3.5 h-3.5"}),n.isPending?"Reopening...":"Reopen"]}),n.isError&&a.jsx("span",{className:"text-xs text-red-400",children:n.error.message})]})}const VM={sleeping:"😴",active:"🟢",uninitialized:"⚪",suspended:"⏸️"},YM={sleeping:"Sleeping",active:"Active",uninitialized:"Not Initialized",suspended:"Suspended"},QM={sleeping:"text-blue-400",active:"text-green-400",uninitialized:"text-content-muted",suspended:"text-yellow-400"};async function XM(e){const t=await fetch(`/api/specialists/${e}/wake`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to wake specialist")}}async function GM(e){const t=await fetch(`/api/specialists/${e}/reset`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reinitialize:!1})});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to reset specialist")}}async function JM(e){if(!(await fetch(`/api/agents/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to kill specialist")}async function ZM(e,t){const n=await fetch(`/api/agents/${e}/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})});if(!n.ok){const r=await n.json();throw new Error(r.error||"Failed to resume agent")}}async function eA(e){const t=await fetch(`/api/agents/${e}/activity?limit=20`);return t.ok?(await t.json()).activity||[]:[]}async function tA(e){const t=await fetch(`/api/specialists/${e}/cost`);return t.ok?t.json():{cost:0,inputTokens:0,outputTokens:0}}function nA(e,t){return he({queryKey:["specialist-cost",e],queryFn:()=>tA(e),enabled:t,refetchInterval:1e4})}async function rA(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 sA(e,t){const n=await fetch(`/api/specialists/${e}/queue/${t}`,{method:"DELETE"});if(!n.ok){const r=await n.json();throw new Error(r.error||"Failed to remove queue item")}}async function iA(e,t){const n=await fetch(`/api/specialists/${e}/queue/reorder`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({itemIds:t})});if(!n.ok){const r=await n.json();throw new Error(r.error||"Failed to reorder queue")}}function oA(e){return he({queryKey:["specialist-queue",e],queryFn:()=>rA(e),refetchInterval:5e3})}function aA(e,t){return he({queryKey:["activity",e],queryFn:()=>eA(e),enabled:t,refetchInterval:1e4})}function lA(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function cA(e){if(!e)return"Never";const t=new Date(e),r=new Date().getTime()-t.getTime(),s=Math.floor(r/6e4),i=Math.floor(s/60),o=Math.floor(i/24);return o>0?`${o}d ago`:i>0?`${i}h ago`:s>0?`${s}m ago`:"Just now"}function uA({specialist:e,issueInfo:t,onSelect:n,isSelected:r}){const s=dn(),{data:i}=nA(e.name,e.state!=="uninitialized"),{data:o}=oA(e.name),{data:l}=aA(e.tmuxSession,e.state!=="uninitialized"),[c,u]=x.useState(!1),[h,d]=x.useState(!1),p=we({mutationFn:()=>XM(e.name),onSuccess:()=>{s.invalidateQueries({queryKey:["specialists"]}),s.invalidateQueries({queryKey:["agents"]})},onError:T=>{alert(`Failed to wake ${e.displayName}: ${T.message}`)}}),f=we({mutationFn:()=>GM(e.name),onSuccess:()=>{s.invalidateQueries({queryKey:["specialists"]})},onError:T=>{alert(`Failed to reset ${e.displayName}: ${T.message}`)}}),m=we({mutationFn:()=>JM(e.tmuxSession),onSuccess:()=>{s.invalidateQueries({queryKey:["specialists"]}),s.invalidateQueries({queryKey:["agents"]})}}),g=we({mutationFn:T=>ZM(e.tmuxSession,T),onSuccess:()=>{s.invalidateQueries({queryKey:["specialists"]}),s.invalidateQueries({queryKey:["agents"]})},onError:T=>{alert(`Failed to resume ${e.displayName}: ${T.message}`)}}),w=we({mutationFn:T=>sA(e.name,T),onSuccess:()=>{s.invalidateQueries({queryKey:["specialist-queue",e.name]})},onError:T=>{alert(`Failed to remove queue item: ${T.message}`)}}),v=we({mutationFn:T=>iA(e.name,T),onSuccess:()=>{s.invalidateQueries({queryKey:["specialist-queue",e.name]})},onError:T=>{alert(`Failed to reorder queue: ${T.message}`)}}),y=T=>{T.stopPropagation(),p.mutate()},_=T=>{T.stopPropagation(),confirm(`Reset ${e.displayName}? This will clear the session file and context.`)&&f.mutate()},b=T=>{T.stopPropagation(),confirm(`Kill ${e.displayName}?`)&&m.mutate()},N=(T,E)=>{T.stopPropagation(),w.mutate(E)},k=(T,E)=>{if(T.stopPropagation(),!o||E===0)return;const R=[...o.items];[R[E-1],R[E]]=[R[E],R[E-1]],v.mutate(R.map(L=>L.id))},j=(T,E)=>{if(T.stopPropagation(),!o||E===o.items.length-1)return;const R=[...o.items];[R[E],R[E+1]]=[R[E+1],R[E]],v.mutate(R.map(L=>L.id))},D=T=>{T.stopPropagation(),u(!c)},F=T=>{T.stopPropagation(),d(!h)},P=T=>{T.stopPropagation(),g.mutate(void 0)},O={urgent:"text-red-400",high:"text-orange-400",normal:"text-blue-400",low:"text-content-subtle"};return a.jsxs("div",{onClick:n,className:`p-4 cursor-pointer transition-colors ${r?"bg-surface-overlay":"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(Hv,{className:"w-5 h-5 text-purple-400"}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-content flex items-center gap-2",children:[e.displayName,e.state==="active"?a.jsx(je,{className:"w-4 h-4 text-green-400 animate-spin"}):a.jsx("span",{className:`text-xs ${QM[e.state]}`,children:VM[e.state]}),o&&o.totalCount>0&&a.jsxs("button",{onClick:D,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,")",c?a.jsx(uk,{className:"w-3 h-3"}):a.jsx(Wv,{className:"w-3 h-3"})]})]}),a.jsx("div",{className:"text-sm text-content-subtle",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-content-muted",children:"Working on:"}),a.jsx("span",{className:"font-mono",children:e.currentIssue}),t&&a.jsxs("span",{className:"text-content-subtle truncate max-w-[200px]",title:t.title,children:["- ",t.title]})]}),e.sessionId&&!e.currentIssue&&a.jsxs("div",{className:"text-xs text-content-muted 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-content-subtle",children:YM[e.state]}),i&&i.cost>0&&a.jsxs("div",{className:"text-xs text-green-400 font-medium",title:"Total cost",children:["$",i.cost.toFixed(4)]}),e.contextTokens&&a.jsxs("div",{className:"text-xs text-content-muted",children:[lA(e.contextTokens)," tokens"]}),e.lastWake&&a.jsxs("div",{className:"text-xs text-content-muted",children:["Last wake: ",cA(e.lastWake)]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[e.state!=="uninitialized"&&l&&l.length>0&&a.jsx("button",{onClick:F,className:"p-2 text-content-subtle hover:text-blue-400 hover:bg-surface-emphasis rounded",title:`Show activity history (${l.length} entries)`,children:a.jsx(va,{className:"w-4 h-4"})}),e.state==="suspended"&&a.jsx("button",{onClick:P,disabled:g.isPending,className:"p-2 text-content-subtle hover:text-green-400 hover:bg-surface-emphasis rounded disabled:opacity-50",title:"Resume specialist",children:a.jsx(Sn,{className:"w-4 h-4"})}),(e.state==="sleeping"||e.state==="uninitialized")&&a.jsx("button",{onClick:y,disabled:p.isPending||e.state==="uninitialized",className:"p-2 text-content-subtle hover:text-green-400 hover:bg-surface-emphasis rounded disabled:opacity-50 disabled:cursor-not-allowed",title:e.state==="uninitialized"?"Specialist not initialized - needs session ID":"Wake specialist",children:a.jsx(XR,{className:"w-4 h-4"})}),e.state==="active"&&a.jsx("button",{onClick:b,disabled:m.isPending,className:"p-2 text-content-subtle hover:text-red-400 hover:bg-surface-emphasis rounded",title:"Kill specialist",children:a.jsx(wc,{className:"w-4 h-4"})}),(e.state==="sleeping"||e.state==="uninitialized")&&a.jsx("button",{onClick:_,disabled:f.isPending,className:"p-2 text-content-subtle hover:text-yellow-400 hover:bg-surface-emphasis rounded",title:"Reset specialist (clear session)",children:a.jsx(fh,{className:"w-4 h-4"})})]})]})]}),c&&o&&o.totalCount>0&&a.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-divider-strong",children:[a.jsxs("div",{className:"text-xs text-content-subtle font-medium mb-2",children:["Queued Tasks (",o.totalCount,")"]}),a.jsx("div",{className:"space-y-2",children:o.items.map((T,E)=>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-content-muted",children:[E+1,"."]}),a.jsx("span",{className:"text-content font-mono",children:T.payload.issueId||T.payload.message||T.id.substring(0,8)}),a.jsxs("span",{className:`${O[T.priority]} font-medium`,children:["[",T.priority,"]"]}),a.jsx("span",{className:"text-content-muted text-xs",children:T.source})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:R=>k(R,E),disabled:E===0||v.isPending,className:"p-1 text-content-subtle hover:text-blue-400 disabled:opacity-30 disabled:cursor-not-allowed",title:"Move up",children:a.jsx(QR,{className:"w-3 h-3"})}),a.jsx("button",{onClick:R=>j(R,E),disabled:E===o.items.length-1||v.isPending,className:"p-1 text-content-subtle hover:text-blue-400 disabled:opacity-30 disabled:cursor-not-allowed",title:"Move down",children:a.jsx(YR,{className:"w-3 h-3"})}),a.jsx("button",{onClick:R=>N(R,T.id),disabled:w.isPending,className:"p-1 text-content-subtle hover:text-red-400 disabled:opacity-50",title:"Remove from queue",children:a.jsx(_k,{className:"w-3 h-3"})})]})]},T.id))})]}),h&&l&&l.length>0&&a.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-divider-strong",children:[a.jsxs("div",{className:"text-xs text-content-subtle font-medium mb-2",children:["Recent Activity (",l.length,")"]}),a.jsx("div",{className:"space-y-1",children:l.slice().reverse().map((T,E)=>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-content-muted",children:new Date(T.ts).toLocaleTimeString()}),a.jsx("span",{className:"text-blue-400 font-mono",children:T.tool}),T.action&&a.jsx("span",{className:"text-content-subtle truncate",children:T.action.substring(0,50)})]},E))})]})]})}async function dA(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 hA(e){const t=await fetch(`/api/agents/${e}/cost`);if(!t.ok)throw new Error("Failed to fetch agent cost");return t.json()}function fA(e){return he({queryKey:["handoff-suggestion",e],queryFn:()=>dA(e),refetchInterval:3e4})}function pA(e){return he({queryKey:["agent-cost",e],queryFn:()=>hA(e),refetchInterval:6e4})}async function mA(e,t,n){const r=await fetch(`/api/agents/${e}/handoff`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toModel:t,reason:n})});if(!r.ok){const s=await r.json();throw new Error(s.error||"Failed to execute handoff")}}const gA={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 vA({agentId:e}){const{data:t,isLoading:n}=fA(e),r=dn(),s=we({mutationFn:({toModel:l,reason:c})=>mA(e,l,c),onSuccess:()=>{r.invalidateQueries({queryKey:["agents"]}),r.invalidateQueries({queryKey:["handoff-suggestion",e]}),alert("Handoff completed successfully")},onError:l=>{alert(`Handoff failed: ${l.message}`)}}),i=l=>{confirm(`Hand off ${e} to ${l}?`)&&s.mutate({toModel:l,reason:"Manual handoff from dashboard"})},o=()=>{t!=null&&t.suggestedModel&&confirm(`${t.reason}
496
-
497
- Proceed with handoff to ${t.suggestedModel}?`)&&s.mutate({toModel:t.suggestedModel,reason:t.reason})};return n?a.jsx("div",{className:"p-3 bg-surface-raised rounded border border-divider",children:a.jsx("div",{className:"text-sm text-content-subtle",children:"Loading handoff data..."})}):t?a.jsxs("div",{className:"p-3 bg-surface-raised rounded border border-divider space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-content-subtle",children:"Current Model:"}),a.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded border ${gA[t.currentModel]||"text-content-subtle bg-surface-overlay border-divider-strong"}`,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(to,{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-content-body mb-2",children:t.reason}),a.jsxs("button",{onClick:o,disabled:s.isPending,className:"flex items-center gap-2 px-3 py-1.5 text-xs font-medium text-content bg-orange-600 hover:bg-orange-500 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(xm,{className:"w-3 h-3"}),"Hand off to ",t.suggestedModel]})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-content-subtle mb-2",children:"Manual Handoff:"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>i("haiku"),disabled:s.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:()=>i("sonnet"),disabled:s.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:()=>i("opus"),disabled:s.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 xA={healthy:"bg-status-healthy",warning:"bg-status-warning",stuck:"bg-status-stuck",dead:"bg-status-dead",stopped:"bg-gray-500"},yA={active:"🟢",stale:"🟡",warning:"🟠",stuck:"🔴",suspended:"⏸️"},_A={active:"Active",stale:"Stale",warning:"Warning",stuck:"Stuck",suspended:"Suspended"},bA={active:"text-green-400",stale:"text-yellow-400",warning:"text-orange-400",stuck:"text-red-400",suspended:"text-blue-400"};async function wA(e){if(!(await fetch(`/api/agents/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to kill agent")}async function SA(e){const t=await fetch(`/api/agents/${e}/poke`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to poke agent")}}async function kA(e,t){const n=await fetch(`/api/agents/${e}/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})});if(!n.ok){const r=await n.json();throw new Error(r.error||"Failed to resume agent")}}async function CA(e){const t=await fetch(`/api/agents/${e}/activity?limit=20`);return t.ok?(await t.json()).activity||[]:[]}function NA(e,t){return he({queryKey:["activity",e],queryFn:()=>CA(e),enabled:t,refetchInterval:1e4})}function EA(e){const t=new Date(e),r=new Date().getTime()-t.getTime(),s=Math.floor(r/6e4),i=Math.floor(s/60);return i>0?`${i}h ${s%60}m`:`${s}m`}function jA(e){if(e===null)return"unknown";const t=Math.floor(e/1e3),n=Math.floor(t/60),r=Math.floor(n/60);return r>0?`${r}h ago`:n>0?`${n}m ago`:`${t}s ago`}function RA({agent:e,health:t,onSelect:n,isSelected:r}){const s=dn(),[i,o]=x.useState(!1),[l,c]=x.useState(!1),{data:u}=pA(e.id),{data:h}=NA(e.id,(t==null?void 0:t.isRunning)||(t==null?void 0:t.state)==="suspended"),d=we({mutationFn:()=>wA(e.id),onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]})}}),p=we({mutationFn:()=>SA(e.id),onSuccess:()=>{alert(`Poked ${e.id} successfully`)},onError:b=>{alert(`Failed to poke ${e.id}: ${b.message}`)}}),f=we({mutationFn:b=>kA(e.id,b),onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]})},onError:b=>{alert(`Failed to resume ${e.id}: ${b.message}`)}}),m=b=>{b.stopPropagation(),confirm(`Kill agent ${e.id}?`)&&d.mutate()},g=b=>{b.stopPropagation(),p.mutate()},w=b=>{b.stopPropagation(),f.mutate(void 0)},v=b=>{b.stopPropagation(),c(!l)},y=(t==null?void 0:t.state)==="warning"||(t==null?void 0:t.state)==="stuck",_=b=>{b.stopPropagation(),o(!i)};return a.jsxs("div",{onClick:n,className:`p-4 cursor-pointer transition-colors ${r?"bg-surface-overlay":"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 ${xA[e.status]}`}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-content flex items-center gap-2",children:[e.id,t&&a.jsx("span",{className:`text-xs ${bA[t.state]}`,title:`Cloister: ${_A[t.state]}`,children:yA[t.state]})]}),a.jsxs("div",{className:"text-sm text-content-subtle flex items-center gap-2",children:[e.runtime," / ",e.model,u&&u.cost>0&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-400",title:"Agent cost so far",children:[a.jsx(uo,{className:"w-3 h-3"}),"$",u.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-content-subtle",children:[a.jsx(xa,{className:"w-4 h-4"}),EA(e.startedAt)]}),t&&t.timeSinceActivity!==null&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-content-muted",children:[a.jsx(va,{className:"w-3 h-3"}),jA(t.timeSinceActivity)]}),e.consecutiveFailures>0&&a.jsxs("div",{className:"flex items-center gap-1 text-sm text-orange-400",children:[a.jsx(Wn,{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:v,className:"p-2 text-content-subtle hover:text-blue-400 hover:bg-surface-emphasis rounded",title:`Show activity history (${h.length} entries)`,children:a.jsx(va,{className:"w-4 h-4"})}),e.status!=="stopped"&&a.jsx("button",{onClick:_,className:`p-2 hover:bg-surface-emphasis rounded ${i?"text-blue-400":"text-content-subtle hover:text-blue-400"}`,title:"Model handoff controls",children:a.jsx($v,{className:"w-4 h-4"})}),(t==null?void 0:t.state)==="suspended"&&a.jsx("button",{onClick:w,disabled:f.isPending,className:"p-2 text-content-subtle hover:text-green-400 hover:bg-surface-emphasis rounded disabled:opacity-50",title:"Resume agent",children:a.jsx(Sn,{className:"w-4 h-4"})}),y&&a.jsx("button",{onClick:g,disabled:p.isPending,className:"p-2 text-content-subtle hover:text-yellow-400 hover:bg-surface-emphasis rounded",title:"Poke agent (send nudge message)",children:a.jsx(lk,{className:"w-4 h-4"})}),(t==null?void 0:t.state)!=="suspended"&&e.status!=="stopped"&&a.jsx("button",{onClick:m,disabled:d.isPending,className:"p-2 text-content-subtle hover:text-red-400 hover:bg-surface-emphasis rounded",title:"Kill agent",children:a.jsx(Zl,{className:"w-4 h-4"})})]})]})]}),i&&a.jsx("div",{className:"mt-3 pt-3 border-t border-divider",children:a.jsx(vA,{agentId:e.id})}),l&&h&&h.length>0&&a.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-divider-strong",children:[a.jsxs("div",{className:"text-xs text-content-subtle font-medium mb-2",children:["Recent Activity (",h.length,")"]}),a.jsx("div",{className:"space-y-1",children:h.slice().reverse().map((b,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-content-muted",children:new Date(b.ts).toLocaleTimeString()}),a.jsx("span",{className:"text-blue-400 font-mono",children:b.tool}),b.action&&a.jsx("span",{className:"text-content-subtle truncate",children:b.action.substring(0,50)})]},N))})]})]})}async function PA(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function TA(){const e=await fetch("/api/specialists");if(!e.ok)throw new Error("Failed to fetch specialists");const t=await e.json();return t.specialists??t}async function DA(){const e=await fetch("/api/cloister/agents/health");if(!e.ok)throw new Error("Failed to fetch Cloister health");return e.json()}async function MA(){const e=await fetch("/api/cloister/status");if(!e.ok)throw new Error("Failed to fetch Cloister status");return e.json()}async function AA(){const e=await fetch("/api/activity");return e.ok?e.json():[]}async function LA(){const e=await fetch("/api/issues");return e.ok?(await e.json()).issues||[]:[]}async function OA(){if(!(await fetch("/api/cloister/start",{method:"POST"})).ok)throw new Error("Failed to start Cloister")}async function IA(){if(!(await fetch("/api/cloister/stop",{method:"POST"})).ok)throw new Error("Failed to stop Cloister")}function BA(e){if(!e)return"Never";const t=new Date(e),r=new Date().getTime()-t.getTime(),s=Math.floor(r/1e3),i=Math.floor(s/60);return s<60?`${s}s ago`:i<60?`${i}m ago`:`${Math.floor(i/60)}h ago`}async function FA(){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 zA({selectedAgent:e,onSelectAgent:t}){const n=dn(),{data:r,isLoading:s,error:i}=he({queryKey:["agents"],queryFn:PA,refetchInterval:3e3}),{data:o,isLoading:l}=he({queryKey:["specialists"],queryFn:TA,refetchInterval:5e3}),{data:c}=he({queryKey:["cloister-health"],queryFn:DA,refetchInterval:5e3}),{data:u}=he({queryKey:["cloister-status"],queryFn:MA,refetchInterval:5e3}),{data:h}=he({queryKey:["activity"],queryFn:AA,refetchInterval:5e3}),{data:d}=he({queryKey:["issues"],queryFn:LA,refetchInterval:3e4}),p=we({mutationFn:OA,onSuccess:()=>{n.invalidateQueries({queryKey:["cloister-status"]})}}),f=we({mutationFn:IA,onSuccess:()=>{n.invalidateQueries({queryKey:["cloister-status"]})}}),m=we({mutationFn:FA,onSuccess:()=>{n.invalidateQueries({queryKey:["specialists"]}),n.invalidateQueries({queryKey:["agents"]})},onError:k=>{alert(`Failed to reset specialists: ${k.message}`)}}),g=()=>{confirm(`Reset ALL specialist agents?
498
-
499
- This will kill any running specialists and clear their session files.`)&&m.mutate()},w=k=>{if(!k||!d)return;const j=d.find(D=>D.identifier.toLowerCase()===k.toLowerCase());if(j)return{id:j.id,identifier:j.identifier,title:j.title}},v=(o==null?void 0:o.some(k=>k.isRunning))||!1,y=(u==null?void 0:u.running)||!1,_=(h||[]).slice(-5).reverse();if(s||l)return a.jsx("div",{className:"bg-surface-raised rounded-lg p-6",children:a.jsx("div",{className:"text-content-subtle",children:"Loading agents..."})});if(i)return a.jsx("div",{className:"bg-surface-raised rounded-lg p-6",children:a.jsxs("div",{className:"text-red-400",children:["Error: ",i.message]})});const b=(r==null?void 0:r.filter(k=>k.status!=="dead"))||[],N=(o==null?void 0:o.filter(k=>k.enabled))||[];return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[a.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[a.jsx(xa,{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 ${v?"bg-green-900/50 text-green-400":"bg-surface-overlay text-content-subtle"}`,children:v?"● Specialists Active":"○ Specialists Idle"}),y?a.jsxs("button",{onClick:()=>f.mutate(),disabled:f.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs text-red-400 hover:bg-surface-overlay rounded transition-colors disabled:opacity-50",title:"Stop patrol loop",children:[a.jsx(Zl,{className:"w-3 h-3"}),"Stop Patrol"]}):a.jsxs("button",{onClick:()=>p.mutate(),disabled:p.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs text-green-400 hover:bg-surface-overlay rounded transition-colors disabled:opacity-50",title:"Start patrol loop (health monitoring)",children:[a.jsx(Sn,{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-content-subtle",children:"Patrol Status:"})," ",a.jsx("span",{className:y?"text-green-400":"text-content-muted",children:y?"● Running":"○ Stopped"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-content-subtle",children:"Last Check:"})," ",a.jsx("span",{className:"text-content-body",children:BA((u==null?void 0:u.lastCheck)||null)})]}),(u==null?void 0:u.summary)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ri,{className:"w-4 h-4 text-green-400"}),a.jsxs("span",{className:"text-content-body",children:[u.summary.active," active"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[u.summary.stuck>0?a.jsx(to,{className:"w-4 h-4 text-red-400"}):a.jsx(to,{className:"w-4 h-4 text-content-muted"}),a.jsxs("span",{className:u.summary.stuck>0?"text-red-400":"text-content-subtle",children:[u.summary.stuck," stuck"]})]})]})]})})]}),_.length>0&&a.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[a.jsx("div",{className:"px-4 py-3 border-b border-divider",children:a.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[a.jsx(va,{className:"w-5 h-5 text-cyan-400"}),"Recent Activity"]})}),a.jsx("div",{className:"divide-y divide-gray-700",children:_.map(k=>a.jsxs("div",{className:"px-4 py-2 flex items-center gap-3 text-sm",children:[a.jsx("span",{className:"text-content-muted text-xs w-16",children:new Date(k.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),a.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs ${k.type==="spawn"?"bg-green-900/50 text-green-400":k.type==="complete"?"bg-blue-900/50 text-blue-400":k.type==="error"?"bg-red-900/50 text-red-400":k.type==="deacon"?"bg-purple-900/50 text-purple-400":"bg-surface-overlay text-content-body"}`,children:k.type}),a.jsxs("span",{className:"text-content-body truncate flex-1",children:[k.type==="deacon"?k.command:k.source,k.issueId&&k.type!=="deacon"&&a.jsxs("span",{className:"text-cyan-400 ml-1",children:["(",k.issueId,")"]})]})]},k.id))})]}),a.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[a.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[a.jsx(Hv,{className:"w-5 h-5 text-purple-400"}),"Specialist Agents (",N.length,")"]}),a.jsxs("button",{onClick:g,disabled:m.isPending,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-content-subtle hover:text-yellow-400 hover:bg-surface-overlay rounded transition-colors disabled:opacity-50",title:"Reset all specialists (kill & clear sessions)",children:[m.isPending?a.jsx(je,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(fh,{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-content-muted",children:"No specialist agents configured."}):N.map(k=>a.jsx(uA,{specialist:k,issueInfo:w(k.currentIssue),onSelect:()=>t(k.tmuxSession===e?null:k.tmuxSession),isSelected:k.tmuxSession===e},k.name))})]}),a.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[a.jsx("div",{className:"px-4 py-3 border-b border-divider",children:a.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[a.jsx(fk,{className:"w-5 h-5"}),"Issue Agents (",b.length,")"]})}),a.jsx("div",{className:"divide-y divide-gray-700",children:b.length===0?a.jsxs("div",{className:"p-8 text-center text-content-muted",children:["No agents running. Use"," ",a.jsx("code",{className:"bg-surface-overlay px-2 py-1 rounded",children:"/work-issue"})," to spawn one."]}):b.map(k=>{const j=c==null?void 0:c.agents.find(D=>D.agentId===k.id);return a.jsx(RA,{agent:k,health:j,onSelect:()=>t(k.id===e?null:k.id),isSelected:k.id===e},k.id)})})]})]})}async function $A(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 HA(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 WA({agentId:e}){const[t,n]=x.useState(""),r=x.useRef(null),{data:s,isLoading:i,refetch:o}=he({queryKey:["agent-output",e],queryFn:()=>$A(e),refetchInterval:2e3}),l=we({mutationFn:u=>HA(e,u),onSuccess:()=>{n(""),setTimeout(()=>o(),500)}});x.useEffect(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[s]);const c=u=>{u.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(no,{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(Gs,{className:"w-4 h-4"})})]}),a.jsx("pre",{ref:r,className:"flex-1 overflow-auto p-4 terminal-output text-gray-300 bg-gray-900",children:i?a.jsx("span",{className:"text-gray-500",children:"Loading..."}):s||a.jsx("span",{className:"text-gray-500",children:"No output yet"})}),a.jsx("form",{onSubmit:c,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:u=>n(u.target.value),placeholder:"Send message to agent...",className:"flex-1 bg-gray-700 border border-gray-600 rounded px-3 py-2 text-white placeholder-gray-400 focus:outline-none focus:border-blue-500"}),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(vk,{className:"w-4 h-4"}),"Send"]})]})})]})}async function UA(){const e=await fetch("/api/health/agents");if(!e.ok)throw new Error("Failed to fetch health");return e.json()}const j_={healthy:{icon:mi,color:"text-green-400",bg:"bg-green-900/30"},warning:{icon:Wn,color:"text-yellow-400",bg:"bg-yellow-900/30"},stuck:{icon:xa,color:"text-orange-400",bg:"bg-orange-900/30"},dead:{icon:wc,color:"text-red-400",bg:"bg-red-900/30"}};function qA(){const{data:e,isLoading:t,error:n}=he({queryKey:["health"],queryFn:UA,refetchInterval:5e3});if(t)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"text-content-subtle",children:"Loading health data..."})});if(n)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-red-400",children:["Error: ",n.message]})});if(!e||e.length===0)return a.jsxs("div",{className:"bg-surface-raised rounded-lg p-8 text-center",children:[a.jsx(va,{className:"w-12 h-12 text-gray-600 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-content-subtle",children:"No agents to monitor"}),a.jsx("p",{className:"text-sm text-content-muted mt-2",children:"Health data will appear here when agents are running"})]});const r=e.reduce((s,i)=>(s[i.status]=(s[i.status]||0)+1,s),{});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(s=>{const i=j_[s],o=i.icon;return a.jsx("div",{className:`${i.bg} rounded-lg p-4 border border-divider`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(o,{className:`w-8 h-8 ${i.color}`}),a.jsxs("div",{children:[a.jsx("div",{className:"text-2xl font-bold text-content",children:r[s]||0}),a.jsx("div",{className:"text-sm text-content-subtle capitalize",children:s})]})]})},s)})}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(s=>{const i=j_[s.status],o=i.icon;return a.jsxs("div",{className:`${i.bg} rounded-lg p-4 border border-divider`,children:[a.jsx("div",{className:"flex items-start justify-between",children:a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-content",children:s.agentId}),a.jsxs("div",{className:`flex items-center gap-1 text-sm ${i.color} mt-1`,children:[a.jsx(o,{className:"w-4 h-4"}),a.jsx("span",{className:"capitalize",children:s.status})]})]})}),s.reason&&a.jsx("div",{className:"mt-2 text-sm text-content-subtle italic",children:s.reason}),a.jsxs("div",{className:"mt-4 space-y-2 text-sm",children:[s.lastPing&&a.jsxs("div",{className:"flex justify-between text-content-subtle",children:[a.jsx("span",{children:"Last ping:"}),a.jsx("span",{children:new Date(s.lastPing).toLocaleTimeString()})]}),a.jsxs("div",{className:"flex justify-between text-content-subtle",children:[a.jsx("span",{children:"Failures:"}),a.jsx("span",{className:s.consecutiveFailures>0?"text-orange-400":"",children:s.consecutiveFailures})]}),a.jsxs("div",{className:"flex justify-between text-content-subtle",children:[a.jsx("span",{children:"Kill count:"}),a.jsx("span",{className:s.killCount>0?"text-red-400":"",children:s.killCount})]})]})]},s.agentId)})})]})}function KA(){const[e,t]=x.useState([]),[n,r]=x.useState(!0),[s,i]=x.useState(null),o=async()=>{try{r(!0);const u=await fetch("/api/skills");if(!u.ok)throw new Error("Failed to fetch skills");const h=await u.json();t(h),i(null)}catch(u){i(u instanceof Error?u.message:"Unknown error")}finally{r(!1)}};if(x.useEffect(()=>{o()},[]),n)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(Gs,{className:"w-6 h-6 text-content-subtle animate-spin"})});if(s)return a.jsxs("div",{className:"bg-red-900/20 border border-red-800 rounded-lg p-4 text-red-400",children:[a.jsx(to,{className:"w-5 h-5 inline mr-2"}),s]});const l=e.filter(u=>u.source==="panopticon"),c=e.filter(u=>u.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-content",children:"Skills"}),a.jsxs("button",{onClick:o,className:"flex items-center gap-2 px-3 py-1.5 text-sm text-content-subtle hover:text-content hover:bg-surface-overlay rounded-lg transition-colors",children:[a.jsx(Gs,{className:"w-4 h-4"}),"Refresh"]})]}),e.length===0?a.jsxs("div",{className:"bg-surface-raised rounded-lg p-8 text-center text-content-subtle",children:[a.jsx(_m,{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-surface-raised 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-content",children:["Panopticon (",l.length,")"]})]}),a.jsxs("div",{className:"space-y-2",children:[l.map(u=>a.jsx(R_,{skill:u},u.path)),l.length===0&&a.jsx("p",{className:"text-content-muted text-sm",children:"No Panopticon skills"})]})]}),a.jsxs("div",{className:"bg-surface-raised 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-content",children:["Claude (",c.length,")"]})]}),a.jsxs("div",{className:"space-y-2",children:[c.map(u=>a.jsx(R_,{skill:u},u.path)),c.length===0&&a.jsx("p",{className:"text-content-muted text-sm",children:"No Claude skills"})]})]})]}),a.jsxs("div",{className:"bg-surface-raised rounded-lg p-4",children:[a.jsx("h3",{className:"font-medium text-content mb-2",children:"Skill Locations"}),a.jsxs("div",{className:"text-sm text-content-subtle 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 R_({skill:e}){return a.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-3 hover:bg-surface-overlay 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(ck,{className:"w-4 h-4 text-content-subtle"}),a.jsx("span",{className:"font-medium text-content",children:e.name})]}),e.hasSkillMd?a.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-400",children:[a.jsx(Nl,{className:"w-3 h-3"}),"SKILL.md"]}):a.jsxs("span",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[a.jsx(to,{className:"w-3 h-3"}),"No SKILL.md"]})]}),e.description&&a.jsx("p",{className:"mt-2 text-sm text-content-subtle line-clamp-2",children:e.description}),a.jsx("p",{className:"mt-2 text-xs text-content-muted truncate",children:e.path})]})}function VA(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const YA=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QA=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,XA={};function P_(e,t){return(XA.jsx?QA:YA).test(e)}const GA=/[ \t\n\f\r]/g;function JA(e){return typeof e=="object"?e.type==="text"?T_(e.value):!1:T_(e)}function T_(e){return e.replace(GA,"")===""}class Ec{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ec.prototype.normal={};Ec.prototype.property={};Ec.prototype.space=void 0;function jC(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Ec(n,r,t)}function ag(e){return e.toLowerCase()}class En{constructor(t,n){this.attribute=n,this.property=t}}En.prototype.attribute="";En.prototype.booleanish=!1;En.prototype.boolean=!1;En.prototype.commaOrSpaceSeparated=!1;En.prototype.commaSeparated=!1;En.prototype.defined=!1;En.prototype.mustUseProperty=!1;En.prototype.number=!1;En.prototype.overloadedBoolean=!1;En.prototype.property="";En.prototype.spaceSeparated=!1;En.prototype.space=void 0;let ZA=0;const ge=po(),dt=po(),lg=po(),J=po(),Fe=po(),Xo=po(),On=po();function po(){return 2**++ZA}const cg=Object.freeze(Object.defineProperty({__proto__:null,boolean:ge,booleanish:dt,commaOrSpaceSeparated:On,commaSeparated:Xo,number:J,overloadedBoolean:lg,spaceSeparated:Fe},Symbol.toStringTag,{value:"Module"})),Df=Object.keys(cg);class ax extends En{constructor(t,n,r,s){let i=-1;if(super(t,n),D_(this,"space",s),typeof r=="number")for(;++i<Df.length;){const o=Df[i];D_(this,Df[i],(r&cg[o])===cg[o])}}}ax.prototype.defined=!0;function D_(e,t,n){n&&(e[t]=n)}function Ta(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new ax(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[ag(r)]=r,n[ag(i.attribute)]=r}return new Ec(t,n,e.space)}const RC=Ta({properties:{ariaActiveDescendant:null,ariaAtomic:dt,ariaAutoComplete:null,ariaBusy:dt,ariaChecked:dt,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:Fe,ariaCurrent:null,ariaDescribedBy:Fe,ariaDetails:null,ariaDisabled:dt,ariaDropEffect:Fe,ariaErrorMessage:null,ariaExpanded:dt,ariaFlowTo:Fe,ariaGrabbed:dt,ariaHasPopup:null,ariaHidden:dt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Fe,ariaLevel:J,ariaLive:null,ariaModal:dt,ariaMultiLine:dt,ariaMultiSelectable:dt,ariaOrientation:null,ariaOwns:Fe,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:dt,ariaReadOnly:dt,ariaRelevant:null,ariaRequired:dt,ariaRoleDescription:Fe,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:dt,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function PC(e,t){return t in e?e[t]:t}function TC(e,t){return PC(e,t.toLowerCase())}const eL=Ta({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Xo,acceptCharset:Fe,accessKey:Fe,action:null,allow:null,allowFullScreen:ge,allowPaymentRequest:ge,allowUserMedia:ge,alt:null,as:null,async:ge,autoCapitalize:null,autoComplete:Fe,autoFocus:ge,autoPlay:ge,blocking:Fe,capture:null,charSet:null,checked:ge,cite:null,className:Fe,cols:J,colSpan:null,content:null,contentEditable:dt,controls:ge,controlsList:Fe,coords:J|Xo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ge,defer:ge,dir:null,dirName:null,disabled:ge,download:lg,draggable:dt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ge,formTarget:null,headers:Fe,height:J,hidden:lg,high:J,href:null,hrefLang:null,htmlFor:Fe,httpEquiv:Fe,id:null,imageSizes:null,imageSrcSet:null,inert:ge,inputMode:null,integrity:null,is:null,isMap:ge,itemId:null,itemProp:Fe,itemRef:Fe,itemScope:ge,itemType:Fe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ge,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:ge,muted:ge,name:null,nonce:null,noModule:ge,noValidate:ge,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:ge,optimum:J,pattern:null,ping:Fe,placeholder:null,playsInline:ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ge,referrerPolicy:null,rel:Fe,required:ge,reversed:ge,rows:J,rowSpan:J,sandbox:Fe,scope:null,scoped:ge,seamless:ge,selected:ge,shadowRootClonable:ge,shadowRootDelegatesFocus:ge,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:dt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:ge,useMap:null,value:dt,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Fe,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ge,declare:ge,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:ge,noHref:ge,noShade:ge,noWrap:ge,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:dt,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ge,disableRemotePlayback:ge,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:TC}),tL=Ta({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:On,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:Fe,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:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,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:Xo,g2:Xo,glyphName:Xo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:On,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,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:J,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:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Fe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:On,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:On,rev:On,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:On,requiredFeatures:On,requiredFonts:On,requiredFormats:On,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:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:On,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:On,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:On,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:PC}),DC=Ta({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()}}),MC=Ta({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:TC}),AC=Ta({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),nL={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"},rL=/[A-Z]/g,M_=/-[a-z]/g,sL=/^data[-\w.:]+$/i;function iL(e,t){const n=ag(t);let r=t,s=En;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&sL.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(M_,aL);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!M_.test(i)){let o=i.replace(rL,oL);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=ax}return new s(r,t)}function oL(e){return"-"+e.toLowerCase()}function aL(e){return e.charAt(1).toUpperCase()}const lL=jC([RC,eL,DC,MC,AC],"html"),lx=jC([RC,tL,DC,MC,AC],"svg");function cL(e){return e.join(" ").trim()}var cx={},A_=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,uL=/\n/g,dL=/^\s*/,hL=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,fL=/^:\s*/,pL=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,mL=/^[;\s]*/,gL=/^\s+|\s+$/g,vL=`
500
- `,L_="/",O_="*",Pi="",xL="comment",yL="declaration";function _L(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(m){var g=m.match(uL);g&&(n+=g.length);var w=m.lastIndexOf(vL);r=~w?m.length-w:r+m.length}function i(){var m={line:n,column:r};return function(g){return g.position=new o(m),u(),g}}function o(m){this.start=m,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(m){var g=new Error(t.source+":"+n+":"+r+": "+m);if(g.reason=m,g.filename=t.source,g.line=n,g.column=r,g.source=e,!t.silent)throw g}function c(m){var g=m.exec(e);if(g){var w=g[0];return s(w),e=e.slice(w.length),g}}function u(){c(dL)}function h(m){var g;for(m=m||[];g=d();)g!==!1&&m.push(g);return m}function d(){var m=i();if(!(L_!=e.charAt(0)||O_!=e.charAt(1))){for(var g=2;Pi!=e.charAt(g)&&(O_!=e.charAt(g)||L_!=e.charAt(g+1));)++g;if(g+=2,Pi===e.charAt(g-1))return l("End of comment missing");var w=e.slice(2,g-2);return r+=2,s(w),e=e.slice(g),r+=2,m({type:xL,comment:w})}}function p(){var m=i(),g=c(hL);if(g){if(d(),!c(fL))return l("property missing ':'");var w=c(pL),v=m({type:yL,property:I_(g[0].replace(A_,Pi)),value:w?I_(w[0].replace(A_,Pi)):Pi});return c(mL),v}}function f(){var m=[];h(m);for(var g;g=p();)g!==!1&&(m.push(g),h(m));return m}return u(),f()}function I_(e){return e?e.replace(gL,Pi):Pi}var bL=_L,wL=Zu&&Zu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(cx,"__esModule",{value:!0});cx.default=kL;const SL=wL(bL);function kL(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,SL.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;s?t(o,l,i):l&&(n=n||{},n[o]=l)}),n}var wh={};Object.defineProperty(wh,"__esModule",{value:!0});wh.camelCase=void 0;var CL=/^--[a-zA-Z0-9_-]+$/,NL=/-([a-z])/g,EL=/^[^-]+$/,jL=/^-(webkit|moz|ms|o|khtml)-/,RL=/^-(ms)-/,PL=function(e){return!e||EL.test(e)||CL.test(e)},TL=function(e,t){return t.toUpperCase()},B_=function(e,t){return"".concat(t,"-")},DL=function(e,t){return t===void 0&&(t={}),PL(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(RL,B_):e=e.replace(jL,B_),e.replace(NL,TL))};wh.camelCase=DL;var ML=Zu&&Zu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},AL=ML(cx),LL=wh;function ug(e,t){var n={};return!e||typeof e!="string"||(0,AL.default)(e,function(r,s){r&&s&&(n[(0,LL.camelCase)(r,t)]=s)}),n}ug.default=ug;var OL=ug;const IL=wa(OL),LC=OC("end"),ux=OC("start");function OC(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function BL(e){const t=ux(e),n=LC(e);if(t&&n)return{start:t,end:n}}function jl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?F_(e.position):"start"in e||"end"in e?F_(e):"line"in e||"column"in e?dg(e):""}function dg(e){return z_(e&&e.line)+":"+z_(e&&e.column)}function F_(e){return dg(e&&e.start)+"-"+dg(e&&e.end)}function z_(e){return e&&typeof e=="number"?e:1}class Zt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=jl(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Zt.prototype.file="";Zt.prototype.name="";Zt.prototype.reason="";Zt.prototype.message="";Zt.prototype.stack="";Zt.prototype.column=void 0;Zt.prototype.line=void 0;Zt.prototype.ancestors=void 0;Zt.prototype.cause=void 0;Zt.prototype.fatal=void 0;Zt.prototype.place=void 0;Zt.prototype.ruleId=void 0;Zt.prototype.source=void 0;const dx={}.hasOwnProperty,FL=new Map,zL=/[A-Z]/g,$L=new Set(["table","tbody","thead","tfoot","tr"]),HL=new Set(["td","th"]),IC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function WL(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=GL(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=XL(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?lx:lL,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=BC(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function BC(e,t,n){if(t.type==="element")return UL(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return qL(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return VL(e,t,n);if(t.type==="mdxjsEsm")return KL(e,t);if(t.type==="root")return YL(e,t,n);if(t.type==="text")return QL(e,t)}function UL(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=lx,e.schema=s),e.ancestors.push(t);const i=zC(e,t.tagName,!1),o=JL(e,t);let l=fx(e,t);return $L.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!JA(c):!0})),FC(e,o,i,t),hx(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function qL(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}sc(e,t.position)}function KL(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);sc(e,t.position)}function VL(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=lx,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:zC(e,t.name,!0),o=ZL(e,t),l=fx(e,t);return FC(e,o,i,t),hx(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function YL(e,t,n){const r={};return hx(r,fx(e,t)),e.create(t,e.Fragment,r,n)}function QL(e,t){return t.value}function FC(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function hx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function XL(e,t,n){return r;function r(s,i,o,l){const u=Array.isArray(o.children)?n:t;return l?u(i,o,l):u(i,o)}}function GL(e,t){return n;function n(r,s,i,o){const l=Array.isArray(i.children),c=ux(r);return t(s,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function JL(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&dx.call(t.properties,s)){const i=eO(e,s,t.properties[s]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&HL.has(t.tagName)?r=l:n[o]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ZL(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else sc(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else sc(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function fx(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:FL;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=s.get(c)||0;o=c+"-"+u,s.set(c,u+1)}}const l=BC(e,i,o);l!==void 0&&n.push(l)}return n}function eO(e,t,n){const r=iL(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?VA(n):cL(n)),r.property==="style"){let s=typeof n=="object"?n:tO(e,String(n));return e.stylePropertyNameCase==="css"&&(s=nO(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?nL[r.property]||r.property:r.attribute,n]}}function tO(e,t){try{return IL(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Zt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=IC+"#cannot-parse-style-attribute",s}}function zC(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const l=P_(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=o}else r=P_(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return dx.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);sc(e)}function sc(e,t){const n=new Zt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=IC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function nO(e){const t={};let n;for(n in e)dx.call(e,n)&&(t[rO(n)]=e[n]);return t}function rO(e){let t=e.replace(zL,sO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function sO(e){return"-"+e.toLowerCase()}const Mf={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"]},iO={};function px(e,t){const n=iO,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return $C(e,r,s)}function $C(e,t,n){if(oO(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return $_(e.children,t,n)}return Array.isArray(e)?$_(e,t,n):""}function $_(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=$C(e[s],t,n);return r.join("")}function oO(e){return!!(e&&typeof e=="object")}const H_=document.createElement("i");function mx(e){const t="&"+e+";";H_.innerHTML=t;const n=H_.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function $n(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function tr(e,t){return e.length>0?($n(e,e.length,0,t),e):t}const W_={}.hasOwnProperty;function HC(e){const t={};let n=-1;for(;++n<e.length;)aO(t,e[n]);return t}function aO(e,t){let n;for(n in t){const s=(W_.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){W_.call(s,o)||(s[o]=[]);const l=i[o];lO(s[o],Array.isArray(l)?l:l?[l]:[])}}}function lO(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);$n(e,0,0,r)}function WC(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function wr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const an=bi(/[A-Za-z]/),Gt=bi(/[\dA-Za-z]/),cO=bi(/[#-'*+\--9=?A-Z^-~]/);function Bd(e){return e!==null&&(e<32||e===127)}const hg=bi(/\d/),uO=bi(/[\dA-Fa-f]/),dO=bi(/[!-/:-@[-`{-~]/);function de(e){return e!==null&&e<-2}function Ie(e){return e!==null&&(e<0||e===32)}function Ce(e){return e===-2||e===-1||e===32}const Sh=bi(new RegExp("\\p{P}|\\p{S}","u")),io=bi(/\s/);function bi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Da(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&Gt(e.charCodeAt(n+1))&&Gt(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Re(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Ce(c)?(e.enter(n),l(c)):t(c)}function l(c){return Ce(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const hO={tokenize:fO};function fO(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Re(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return de(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const pO={tokenize:mO},U_={tokenize:gO};function mO(e){const t=this,n=[];let r=0,s,i,o;return l;function l(_){if(r<n.length){const b=n[r];return t.containerState=b[1],e.attempt(b[0].continuation,c,u)(_)}return u(_)}function c(_){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&y();const b=t.events.length;let N=b,k;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){k=t.events[N][1].end;break}v(r);let j=b;for(;j<t.events.length;)t.events[j][1].end={...k},j++;return $n(t.events,N+1,0,t.events.slice(b)),t.events.length=j,u(_)}return l(_)}function u(_){if(r===n.length){if(!s)return p(_);if(s.currentConstruct&&s.currentConstruct.concrete)return m(_);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(U_,h,d)(_)}function h(_){return s&&y(),v(r),p(_)}function d(_){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(_)}function p(_){return t.containerState={},e.attempt(U_,f,m)(_)}function f(_){return r++,n.push([t.currentConstruct,t.containerState]),p(_)}function m(_){if(_===null){s&&y(),v(0),e.consume(_);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),g(_)}function g(_){if(_===null){w(e.exit("chunkFlow"),!0),v(0),e.consume(_);return}return de(_)?(e.consume(_),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(_),g)}function w(_,b){const N=t.sliceStream(_);if(b&&N.push(null),_.previous=i,i&&(i.next=_),i=_,s.defineSkip(_.start),s.write(N),t.parser.lazy[_.start.line]){let k=s.events.length;for(;k--;)if(s.events[k][1].start.offset<o&&(!s.events[k][1].end||s.events[k][1].end.offset>o))return;const j=t.events.length;let D=j,F,P;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(F){P=t.events[D][1].end;break}F=!0}for(v(r),k=j;k<t.events.length;)t.events[k][1].end={...P},k++;$n(t.events,D+1,0,t.events.slice(j)),t.events.length=k}}function v(_){let b=n.length;for(;b-- >_;){const N=n[b];t.containerState=N[1],N[0].exit.call(t,e)}n.length=_}function y(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function gO(e,t,n){return Re(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function _a(e){if(e===null||Ie(e)||io(e))return 1;if(Sh(e))return 2}function kh(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const fg={name:"attention",resolveAll:vO,tokenize:xO};function vO(e,t){let n=-1,r,s,i,o,l,c,u,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},p={...e[n][1].start};q_(d,-c),q_(p,c),o={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=tr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=tr(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=tr(u,kh(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=tr(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,u=tr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,$n(e,r-1,n-r+3,u),n=r+u.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function xO(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=_a(r);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),h=_a(c),d=!h||h===2&&s||n.includes(c),p=!s||s===2&&h||n.includes(r);return u._open=!!(i===42?d:d&&(s||!p)),u._close=!!(i===42?p:p&&(h||!d)),t(c)}}function q_(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const yO={name:"autolink",tokenize:_O};function _O(e,t,n){let r=0;return s;function s(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(f){return an(f)?(e.consume(f),o):f===64?n(f):u(f)}function o(f){return f===43||f===45||f===46||Gt(f)?(r=1,l(f)):u(f)}function l(f){return f===58?(e.consume(f),r=0,c):(f===43||f===45||f===46||Gt(f))&&r++<32?(e.consume(f),l):(r=0,u(f))}function c(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||Bd(f)?n(f):(e.consume(f),c)}function u(f){return f===64?(e.consume(f),h):cO(f)?(e.consume(f),u):n(f)}function h(f){return Gt(f)?d(f):n(f)}function d(f){return f===46?(e.consume(f),r=0,h):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||Gt(f))&&r++<63){const m=f===45?p:d;return e.consume(f),m}return n(f)}}const jc={partial:!0,tokenize:bO};function bO(e,t,n){return r;function r(i){return Ce(i)?Re(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||de(i)?t(i):n(i)}}const UC={continuation:{tokenize:SO},exit:kO,name:"blockQuote",tokenize:wO};function wO(e,t,n){const r=this;return s;function s(o){if(o===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Ce(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function SO(e,t,n){const r=this;return s;function s(o){return Ce(o)?Re(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(UC,t,n)(o)}}function kO(e){e.exit("blockQuote")}const qC={name:"characterEscape",tokenize:CO};function CO(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return dO(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const KC={name:"characterReference",tokenize:NO};function NO(e,t,n){const r=this;let s=0,i,o;return l;function l(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),c}function c(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=Gt,h(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=uO,h):(e.enter("characterReferenceValue"),i=7,o=hg,h(d))}function h(d){if(d===59&&s){const p=e.exit("characterReferenceValue");return o===Gt&&!mx(r.sliceSerialize(p))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&s++<i?(e.consume(d),h):n(d)}}const K_={partial:!0,tokenize:jO},V_={concrete:!0,name:"codeFenced",tokenize:EO};function EO(e,t,n){const r=this,s={partial:!0,tokenize:N};let i=0,o=0,l;return c;function c(k){return u(k)}function u(k){const j=r.events[r.events.length-1];return i=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,l=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(k)}function h(k){return k===l?(o++,e.consume(k),h):o<3?n(k):(e.exit("codeFencedFenceSequence"),Ce(k)?Re(e,d,"whitespace")(k):d(k))}function d(k){return k===null||de(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(K_,g,b)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||de(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):Ce(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Re(e,f,"whitespace")(k)):k===96&&k===l?n(k):(e.consume(k),p)}function f(k){return k===null||de(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||de(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===l?n(k):(e.consume(k),m)}function g(k){return e.attempt(s,b,w)(k)}function w(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),v}function v(k){return i>0&&Ce(k)?Re(e,y,"linePrefix",i+1)(k):y(k)}function y(k){return k===null||de(k)?e.check(K_,g,b)(k):(e.enter("codeFlowValue"),_(k))}function _(k){return k===null||de(k)?(e.exit("codeFlowValue"),y(k)):(e.consume(k),_)}function b(k){return e.exit("codeFenced"),t(k)}function N(k,j,D){let F=0;return P;function P(L){return k.enter("lineEnding"),k.consume(L),k.exit("lineEnding"),O}function O(L){return k.enter("codeFencedFence"),Ce(L)?Re(k,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):T(L)}function T(L){return L===l?(k.enter("codeFencedFenceSequence"),E(L)):D(L)}function E(L){return L===l?(F++,k.consume(L),E):F>=o?(k.exit("codeFencedFenceSequence"),Ce(L)?Re(k,R,"whitespace")(L):R(L)):D(L)}function R(L){return L===null||de(L)?(k.exit("codeFencedFence"),j(L)):D(L)}}}function jO(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Af={name:"codeIndented",tokenize:PO},RO={partial:!0,tokenize:TO};function PO(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),Re(e,i,"linePrefix",5)(u)}function i(u){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):de(u)?e.attempt(RO,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||de(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function TO(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):de(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):Re(e,i,"linePrefix",5)(o)}function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):de(o)?s(o):n(o)}}const DO={name:"codeText",previous:AO,resolve:MO,tokenize:LO};function MO(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function AO(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function LO(e,t,n){let r=0,s,i;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),l(d)}function l(d){return d===96?(e.consume(d),r++,l):(e.exit("codeTextSequence"),c(d))}function c(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),c):d===96?(i=e.enter("codeTextSequence"),s=0,h(d)):de(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||de(d)?(e.exit("codeTextData"),c(d)):(e.consume(d),u)}function h(d){return d===96?(e.consume(d),s++,h):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",u(d))}}class OO{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Ja(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ja(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ja(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ja(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ja(this.left,n.reverse())}}}function Ja(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function VC(e){const t={};let n=-1,r,s,i,o,l,c,u;const h=new OO(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,IO(h,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=h.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(h.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...h.get(s)[1].start},l=h.slice(s,n),l.unshift(r),h.splice(s,n-s+1,l))}}return $n(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!u}function IO(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let h,d,p=-1,f=n,m=0,g=0;const w=[g];for(;f;){for(;e.get(++s)[1]!==f;);i.push(s),f._tokenizer||(h=r.sliceStream(f),f.next||h.push(null),d&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(h),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(g=p+1,w.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):w.pop(),p=w.length;p--;){const v=l.slice(w[p],w[p+1]),y=i.pop();c.push([y,y+v.length-1]),e.splice(y,2,v)}for(c.reverse(),p=-1;++p<c.length;)u[m+c[p][0]]=m+c[p][1],m+=c[p][1]-c[p][0]-1;return u}const BO={resolve:zO,tokenize:$O},FO={partial:!0,tokenize:HO};function zO(e){return VC(e),e}function $O(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):de(l)?e.check(FO,o,i)(l):(e.consume(l),s)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function HO(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Re(e,i,"linePrefix")}function i(o){if(o===null||de(o))return n(o);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function YC(e,t,n,r,s,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let h=0;return d;function d(v){return v===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(v),e.exit(i),p):v===null||v===32||v===41||Bd(v)?n(v):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(v))}function p(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(v))}function f(v){return v===62?(e.exit("chunkString"),e.exit(l),p(v)):v===null||v===60||de(v)?n(v):(e.consume(v),v===92?m:f)}function m(v){return v===60||v===62||v===92?(e.consume(v),f):f(v)}function g(v){return!h&&(v===null||v===41||Ie(v))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(v)):h<u&&v===40?(e.consume(v),h++,g):v===41?(e.consume(v),h--,g):v===null||v===32||v===40||Bd(v)?n(v):(e.consume(v),v===92?w:g)}function w(v){return v===40||v===41||v===92?(e.consume(v),g):g(v)}}function QC(e,t,n,r,s,i){const o=this;let l=0,c;return u;function u(f){return e.enter(r),e.enter(s),e.consume(f),e.exit(s),e.enter(i),h}function h(f){return l>999||f===null||f===91||f===93&&!c||f===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(i),e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):de(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||de(f)||l++>999?(e.exit("chunkString"),h(f)):(e.consume(f),c||(c=!Ce(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(e.consume(f),l++,d):d(f)}}function XC(e,t,n,r,s,i){let o;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(s),e.consume(p),e.exit(s),o=p===40?41:p,c):n(p)}function c(p){return p===o?(e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===o?(e.exit(i),c(o)):p===null?n(p):de(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Re(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===o||p===null||de(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?d:h)}function d(p){return p===o||p===92?(e.consume(p),h):h(p)}}function Rl(e,t){let n;return r;function r(s){return de(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ce(s)?Re(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const WO={name:"definition",tokenize:qO},UO={partial:!0,tokenize:KO};function qO(e,t,n){const r=this;let s;return i;function i(f){return e.enter("definition"),o(f)}function o(f){return QC.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return s=wr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),c):n(f)}function c(f){return Ie(f)?Rl(e,u)(f):u(f)}function u(f){return YC(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function h(f){return e.attempt(UO,d,d)(f)}function d(f){return Ce(f)?Re(e,p,"whitespace")(f):p(f)}function p(f){return f===null||de(f)?(e.exit("definition"),r.parser.defined.push(s),t(f)):n(f)}}function KO(e,t,n){return r;function r(l){return Ie(l)?Rl(e,s)(l):n(l)}function s(l){return XC(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Ce(l)?Re(e,o,"whitespace")(l):o(l)}function o(l){return l===null||de(l)?t(l):n(l)}}const VO={name:"hardBreakEscape",tokenize:YO};function YO(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return de(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const QO={name:"headingAtx",resolve:XO,tokenize:GO};function XO(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},$n(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function GO(e,t,n){let r=0;return s;function s(h){return e.enter("atxHeading"),i(h)}function i(h){return e.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&r++<6?(e.consume(h),o):h===null||Ie(h)?(e.exit("atxHeadingSequence"),l(h)):n(h)}function l(h){return h===35?(e.enter("atxHeadingSequence"),c(h)):h===null||de(h)?(e.exit("atxHeading"),t(h)):Ce(h)?Re(e,l,"whitespace")(h):(e.enter("atxHeadingText"),u(h))}function c(h){return h===35?(e.consume(h),c):(e.exit("atxHeadingSequence"),l(h))}function u(h){return h===null||h===35||Ie(h)?(e.exit("atxHeadingText"),l(h)):(e.consume(h),u)}}const JO=["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"],Y_=["pre","script","style","textarea"],ZO={concrete:!0,name:"htmlFlow",resolveTo:nI,tokenize:rI},eI={partial:!0,tokenize:iI},tI={partial:!0,tokenize:sI};function nI(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 rI(e,t,n){const r=this;let s,i,o,l,c;return u;function u(C){return h(C)}function h(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),d}function d(C){return C===33?(e.consume(C),p):C===47?(e.consume(C),i=!0,g):C===63?(e.consume(C),s=3,r.interrupt?t:S):an(C)?(e.consume(C),o=String.fromCharCode(C),w):n(C)}function p(C){return C===45?(e.consume(C),s=2,f):C===91?(e.consume(C),s=5,l=0,m):an(C)?(e.consume(C),s=4,r.interrupt?t:S):n(C)}function f(C){return C===45?(e.consume(C),r.interrupt?t:S):n(C)}function m(C){const U="CDATA[";return C===U.charCodeAt(l++)?(e.consume(C),l===U.length?r.interrupt?t:T:m):n(C)}function g(C){return an(C)?(e.consume(C),o=String.fromCharCode(C),w):n(C)}function w(C){if(C===null||C===47||C===62||Ie(C)){const U=C===47,I=o.toLowerCase();return!U&&!i&&Y_.includes(I)?(s=1,r.interrupt?t(C):T(C)):JO.includes(o.toLowerCase())?(s=6,U?(e.consume(C),v):r.interrupt?t(C):T(C)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(C):i?y(C):_(C))}return C===45||Gt(C)?(e.consume(C),o+=String.fromCharCode(C),w):n(C)}function v(C){return C===62?(e.consume(C),r.interrupt?t:T):n(C)}function y(C){return Ce(C)?(e.consume(C),y):P(C)}function _(C){return C===47?(e.consume(C),P):C===58||C===95||an(C)?(e.consume(C),b):Ce(C)?(e.consume(C),_):P(C)}function b(C){return C===45||C===46||C===58||C===95||Gt(C)?(e.consume(C),b):N(C)}function N(C){return C===61?(e.consume(C),k):Ce(C)?(e.consume(C),N):_(C)}function k(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),c=C,j):Ce(C)?(e.consume(C),k):D(C)}function j(C){return C===c?(e.consume(C),c=null,F):C===null||de(C)?n(C):(e.consume(C),j)}function D(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Ie(C)?N(C):(e.consume(C),D)}function F(C){return C===47||C===62||Ce(C)?_(C):n(C)}function P(C){return C===62?(e.consume(C),O):n(C)}function O(C){return C===null||de(C)?T(C):Ce(C)?(e.consume(C),O):n(C)}function T(C){return C===45&&s===2?(e.consume(C),$):C===60&&s===1?(e.consume(C),K):C===62&&s===4?(e.consume(C),Y):C===63&&s===3?(e.consume(C),S):C===93&&s===5?(e.consume(C),H):de(C)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(eI,B,E)(C)):C===null||de(C)?(e.exit("htmlFlowData"),E(C)):(e.consume(C),T)}function E(C){return e.check(tI,R,B)(C)}function R(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),L}function L(C){return C===null||de(C)?E(C):(e.enter("htmlFlowData"),T(C))}function $(C){return C===45?(e.consume(C),S):T(C)}function K(C){return C===47?(e.consume(C),o="",A):T(C)}function A(C){if(C===62){const U=o.toLowerCase();return Y_.includes(U)?(e.consume(C),Y):T(C)}return an(C)&&o.length<8?(e.consume(C),o+=String.fromCharCode(C),A):T(C)}function H(C){return C===93?(e.consume(C),S):T(C)}function S(C){return C===62?(e.consume(C),Y):C===45&&s===2?(e.consume(C),S):T(C)}function Y(C){return C===null||de(C)?(e.exit("htmlFlowData"),B(C)):(e.consume(C),Y)}function B(C){return e.exit("htmlFlow"),t(C)}}function sI(e,t,n){const r=this;return s;function s(o){return de(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function iI(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(jc,t,n)}}const oI={name:"htmlText",tokenize:aI};function aI(e,t,n){const r=this;let s,i,o;return l;function l(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),c}function c(S){return S===33?(e.consume(S),u):S===47?(e.consume(S),N):S===63?(e.consume(S),_):an(S)?(e.consume(S),D):n(S)}function u(S){return S===45?(e.consume(S),h):S===91?(e.consume(S),i=0,m):an(S)?(e.consume(S),y):n(S)}function h(S){return S===45?(e.consume(S),f):n(S)}function d(S){return S===null?n(S):S===45?(e.consume(S),p):de(S)?(o=d,K(S)):(e.consume(S),d)}function p(S){return S===45?(e.consume(S),f):d(S)}function f(S){return S===62?$(S):S===45?p(S):d(S)}function m(S){const Y="CDATA[";return S===Y.charCodeAt(i++)?(e.consume(S),i===Y.length?g:m):n(S)}function g(S){return S===null?n(S):S===93?(e.consume(S),w):de(S)?(o=g,K(S)):(e.consume(S),g)}function w(S){return S===93?(e.consume(S),v):g(S)}function v(S){return S===62?$(S):S===93?(e.consume(S),v):g(S)}function y(S){return S===null||S===62?$(S):de(S)?(o=y,K(S)):(e.consume(S),y)}function _(S){return S===null?n(S):S===63?(e.consume(S),b):de(S)?(o=_,K(S)):(e.consume(S),_)}function b(S){return S===62?$(S):_(S)}function N(S){return an(S)?(e.consume(S),k):n(S)}function k(S){return S===45||Gt(S)?(e.consume(S),k):j(S)}function j(S){return de(S)?(o=j,K(S)):Ce(S)?(e.consume(S),j):$(S)}function D(S){return S===45||Gt(S)?(e.consume(S),D):S===47||S===62||Ie(S)?F(S):n(S)}function F(S){return S===47?(e.consume(S),$):S===58||S===95||an(S)?(e.consume(S),P):de(S)?(o=F,K(S)):Ce(S)?(e.consume(S),F):$(S)}function P(S){return S===45||S===46||S===58||S===95||Gt(S)?(e.consume(S),P):O(S)}function O(S){return S===61?(e.consume(S),T):de(S)?(o=O,K(S)):Ce(S)?(e.consume(S),O):F(S)}function T(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),s=S,E):de(S)?(o=T,K(S)):Ce(S)?(e.consume(S),T):(e.consume(S),R)}function E(S){return S===s?(e.consume(S),s=void 0,L):S===null?n(S):de(S)?(o=E,K(S)):(e.consume(S),E)}function R(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||Ie(S)?F(S):(e.consume(S),R)}function L(S){return S===47||S===62||Ie(S)?F(S):n(S)}function $(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):n(S)}function K(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),A}function A(S){return Ce(S)?Re(e,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):H(S)}function H(S){return e.enter("htmlTextData"),o(S)}}const gx={name:"labelEnd",resolveAll:dI,resolveTo:hI,tokenize:fI},lI={tokenize:pI},cI={tokenize:mI},uI={tokenize:gI};function dI(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&$n(e,0,e.length,n),e}function hI(e,t){let n=e.length,r=0,s,i,o,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},h={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=tr(l,e.slice(i+1,i+r+3)),l=tr(l,[["enter",h,t]]),l=tr(l,kh(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=tr(l,[["exit",h,t],e[o-2],e[o-1],["exit",u,t]]),l=tr(l,e.slice(o+1)),l=tr(l,[["exit",c,t]]),$n(e,i,e.length,l),e}function fI(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(p){return i?i._inactive?d(p):(o=r.parser.defined.includes(wr(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(lI,h,o?h:d)(p):p===91?e.attempt(cI,h,o?u:d)(p):o?h(p):d(p)}function u(p){return e.attempt(uI,h,d)(p)}function h(p){return t(p)}function d(p){return i._balanced=!0,n(p)}}function pI(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),s}function s(d){return Ie(d)?Rl(e,i)(d):i(d)}function i(d){return d===41?h(d):YC(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Ie(d)?Rl(e,c)(d):h(d)}function l(d){return n(d)}function c(d){return d===34||d===39||d===40?XC(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):h(d)}function u(d){return Ie(d)?Rl(e,h)(d):h(d)}function h(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function mI(e,t,n){const r=this;return s;function s(l){return QC.call(r,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(wr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function gI(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const vI={name:"labelStartImage",resolveAll:gx.resolveAll,tokenize:xI};function xI(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const yI={name:"labelStartLink",resolveAll:gx.resolveAll,tokenize:_I};function _I(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Lf={name:"lineEnding",tokenize:bI};function bI(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Re(e,t,"linePrefix")}}const Uu={name:"thematicBreak",tokenize:wI};function wI(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return s=u,l(u)}function l(u){return u===s?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||de(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Ce(u)?Re(e,l,"whitespace")(u):l(u))}}const xn={continuation:{tokenize:NI},exit:jI,name:"list",tokenize:CI},SI={partial:!0,tokenize:RI},kI={partial:!0,tokenize:EI};function CI(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(f){const m=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:hg(f)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Uu,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(f)}return n(f)}function c(f){return hg(f)&&++o<10?(e.consume(f),c):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(jc,r.interrupt?n:h,e.attempt(SI,p,d))}function h(f){return r.containerState.initialBlankLine=!0,i++,p(f)}function d(f){return Ce(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function NI(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(jc,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Re(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Ce(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(kI,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Re(e,e.attempt(xn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function EI(e,t,n){const r=this;return Re(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function jI(e){e.exit(this.containerState.type)}function RI(e,t,n){const r=this;return Re(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!Ce(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Q_={name:"setextUnderline",resolveTo:PI,tokenize:TI};function PI(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function TI(e,t,n){const r=this;let s;return i;function i(u){let h=r.events.length,d;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){d=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Ce(u)?Re(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||de(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const DI={tokenize:MI};function MI(e){const t=this,n=e.attempt(jc,r,e.attempt(this.parser.constructs.flowInitial,s,Re(e,e.attempt(this.parser.constructs.flow,s,e.attempt(BO,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const AI={resolveAll:JC()},LI=GC("string"),OI=GC("text");function GC(e){return{resolveAll:JC(e==="text"?II:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,l);return o;function o(h){return u(h)?i(h):l(h)}function l(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),c}function c(h){return u(h)?(n.exit("data"),i(h)):(n.consume(h),c)}function u(h){if(h===null)return!0;const d=s[h];let p=-1;if(d)for(;++p<d.length;){const f=d[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function JC(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function II(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,l=0,c;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const BI={42:xn,43:xn,45:xn,48:xn,49:xn,50:xn,51:xn,52:xn,53:xn,54:xn,55:xn,56:xn,57:xn,62:UC},FI={91:WO},zI={[-2]:Af,[-1]:Af,32:Af},$I={35:QO,42:Uu,45:[Q_,Uu],60:ZO,61:Q_,95:Uu,96:V_,126:V_},HI={38:KC,92:qC},WI={[-5]:Lf,[-4]:Lf,[-3]:Lf,33:vI,38:KC,42:fg,60:[yO,oI],91:yI,92:[VO,qC],93:gx,95:fg,96:DO},UI={null:[fg,AI]},qI={null:[42,95]},KI={null:[]},VI=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qI,contentInitial:FI,disable:KI,document:BI,flow:$I,flowInitial:zI,insideSpan:UI,string:HI,text:WI},Symbol.toStringTag,{value:"Module"}));function YI(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],l=[];const c={attempt:j(N),check:j(k),consume:y,enter:_,exit:b,interrupt:j(k,{interrupt:!0})},u={code:null,containerState:{},defineSkip:g,events:[],now:m,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:d};let h=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function d(O){return o=tr(o,O),w(),o[o.length-1]!==null?[]:(D(t,0),u.events=kh(i,u.events,u),u.events)}function p(O,T){return XI(f(O),T)}function f(O){return QI(o,O)}function m(){const{_bufferIndex:O,_index:T,line:E,column:R,offset:L}=r;return{_bufferIndex:O,_index:T,line:E,column:R,offset:L}}function g(O){s[O.line]=O.column,P()}function w(){let O;for(;r._index<o.length;){const T=o[r._index];if(typeof T=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<T.length;)v(T.charCodeAt(r._bufferIndex));else v(T)}}function v(O){h=h(O)}function y(O){de(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,P()):O!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=O}function _(O,T){const E=T||{};return E.type=O,E.start=m(),u.events.push(["enter",E,u]),l.push(E),E}function b(O){const T=l.pop();return T.end=m(),u.events.push(["exit",T,u]),T}function N(O,T){D(O,T.from)}function k(O,T){T.restore()}function j(O,T){return E;function E(R,L,$){let K,A,H,S;return Array.isArray(R)?B(R):"tokenize"in R?B([R]):Y(R);function Y(q){return z;function z(te){const se=te!==null&&q[te],ye=te!==null&&q.null,De=[...Array.isArray(se)?se:se?[se]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return B(De)(te)}}function B(q){return K=q,A=0,q.length===0?$:C(q[A])}function C(q){return z;function z(te){return S=F(),H=q,q.partial||(u.currentConstruct=q),q.name&&u.parser.constructs.disable.null.includes(q.name)?I():q.tokenize.call(T?Object.assign(Object.create(u),T):u,c,U,I)(te)}}function U(q){return O(H,S),L}function I(q){return S.restore(),++A<K.length?C(K[A]):$}}}function D(O,T){O.resolveAll&&!i.includes(O)&&i.push(O),O.resolve&&$n(u.events,T,u.events.length-T,O.resolve(u.events.slice(T),u)),O.resolveTo&&(u.events=O.resolveTo(u.events,u))}function F(){const O=m(),T=u.previous,E=u.currentConstruct,R=u.events.length,L=Array.from(l);return{from:R,restore:$};function $(){r=O,u.previous=T,u.currentConstruct=E,u.events.length=R,l=L,P()}}function P(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function QI(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function XI(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
501
- `;break}case-3:{o=`\r
502
- `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function GI(e){const r={constructs:HC([VI,...(e||{}).extensions||[]]),content:s(hO),defined:[],document:s(pO),flow:s(DI),lazy:{},string:s(LI),text:s(OI)};return r;function s(i){return o;function o(l){return YI(r,i,l)}}}function JI(e){for(;!VC(e););return e}const X_=/[\0\t\n\r]/g;function ZI(){let e=1,t="",n=!0,r;return s;function s(i,o,l){const c=[];let u,h,d,p,f;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(X_.lastIndex=d,u=X_.exec(i),p=u&&u.index!==void 0?u.index:i.length,f=i.charCodeAt(p),!u){t=i.slice(d);break}if(f===10&&d===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),d<p&&(c.push(i.slice(d,p)),e+=p-d),f){case 0:{c.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,c.push(-2);e++<h;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}d=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const e6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function t6(e){return e.replace(e6,n6)}function n6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return WC(n.slice(i?2:1),i?16:10)}return mx(n)||e}const ZC={}.hasOwnProperty;function r6(e,t,n){return typeof t!="string"&&(n=t,t=void 0),s6(n)(JI(GI(n).document().write(ZI()(e,t,!0))))}function s6(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ct),autolinkProtocol:F,autolinkEmail:F,atxHeading:i(fe),blockQuote:i(ye),characterEscape:F,characterReference:F,codeFenced:i(De),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(De,o),codeText:i($e,o),codeTextData:F,data:F,codeFlowValue:F,definition:i(_e),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(ne),hardBreakEscape:i(ke),hardBreakTrailing:i(ke),htmlFlow:i(Ze,o),htmlFlowData:F,htmlText:i(Ze,o),htmlTextData:F,image:i(et),label:o,link:i(Ct),listItem:i(en),listItemValue:p,listOrdered:i(tt,d),listUnordered:i(tt),paragraph:i(jn),reference:C,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(fe),strong:i(cr),thematicBreak:i(go)},exit:{atxHeading:c(),atxHeadingSequence:N,autolink:c(),autolinkEmail:se,autolinkProtocol:te,blockQuote:c(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:I,characterReferenceMarkerNumeric:I,characterReferenceValue:q,characterReference:z,codeFenced:c(w),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:P,codeIndented:c(v),codeText:c(L),codeTextData:P,data:P,definition:c(),definitionDestinationString:b,definitionLabelString:y,definitionTitleString:_,emphasis:c(),hardBreakEscape:c(T),hardBreakTrailing:c(T),htmlFlow:c(E),htmlFlowData:P,htmlText:c(R),htmlTextData:P,image:c(K),label:H,labelText:A,lineEnding:O,link:c($),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:U,resourceDestinationString:S,resourceTitleString:Y,resource:B,setextHeading:c(D),setextHeadingLineSequence:j,setextHeadingText:k,strong:c(),thematicBreak:c()}};e2(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let Z={type:"root",children:[]};const ue={stack:[Z],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:h,data:n},me=[];let Pe=-1;for(;++Pe<W.length;)if(W[Pe][1].type==="listOrdered"||W[Pe][1].type==="listUnordered")if(W[Pe][0]==="enter")me.push(Pe);else{const V=me.pop();Pe=s(W,V,Pe)}for(Pe=-1;++Pe<W.length;){const V=t[W[Pe][0]];ZC.call(V,W[Pe][1].type)&&V[W[Pe][1].type].call(Object.assign({sliceSerialize:W[Pe][2].sliceSerialize},ue),W[Pe][1])}if(ue.tokenStack.length>0){const V=ue.tokenStack[ue.tokenStack.length-1];(V[1]||G_).call(ue,void 0,V[0])}for(Z.position={start:Ps(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:Ps(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<t.transforms.length;)Z=t.transforms[Pe](Z)||Z;return Z}function s(W,Z,ue){let me=Z-1,Pe=-1,V=!1,ae,Be,It,mn;for(;++me<=ue;){const at=W[me];switch(at[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{at[0]==="enter"?Pe++:Pe--,mn=void 0;break}case"lineEndingBlank":{at[0]==="enter"&&(ae&&!mn&&!Pe&&!It&&(It=me),mn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:mn=void 0}if(!Pe&&at[0]==="enter"&&at[1].type==="listItemPrefix"||Pe===-1&&at[0]==="exit"&&(at[1].type==="listUnordered"||at[1].type==="listOrdered")){if(ae){let Rn=me;for(Be=void 0;Rn--;){const Nt=W[Rn];if(Nt[1].type==="lineEnding"||Nt[1].type==="lineEndingBlank"){if(Nt[0]==="exit")continue;Be&&(W[Be][1].type="lineEndingBlank",V=!0),Nt[1].type="lineEnding",Be=Rn}else if(!(Nt[1].type==="linePrefix"||Nt[1].type==="blockQuotePrefix"||Nt[1].type==="blockQuotePrefixWhitespace"||Nt[1].type==="blockQuoteMarker"||Nt[1].type==="listItemIndent"))break}It&&(!Be||It<Be)&&(ae._spread=!0),ae.end=Object.assign({},Be?W[Be][1].start:at[1].end),W.splice(Be||me,0,["exit",ae,at[2]]),me++,ue++}if(at[1].type==="listItemPrefix"){const Rn={type:"listItem",_spread:!1,start:Object.assign({},at[1].start),end:void 0};ae=Rn,W.splice(me,0,["enter",Rn,at[2]]),me++,ue++,It=void 0,mn=!0}}}return W[Z][1]._spread=V,ue}function i(W,Z){return ue;function ue(me){l.call(this,W(me),me),Z&&Z.call(this,me)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(W,Z,ue){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([Z,ue||void 0]),W.position={start:Ps(Z.start),end:void 0}}function c(W){return Z;function Z(ue){W&&W.call(this,ue),u.call(this,ue)}}function u(W,Z){const ue=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==W.type&&(Z?Z.call(this,W,me[0]):(me[1]||G_).call(this,W,me[0]));else throw new Error("Cannot close `"+W.type+"` ("+jl({start:W.start,end:W.end})+"): it’s not open");ue.position.end=Ps(W.end)}function h(){return px(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(W){if(this.data.expectingFirstListItemValue){const Z=this.stack[this.stack.length-2];Z.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function f(){const W=this.resume(),Z=this.stack[this.stack.length-1];Z.lang=W}function m(){const W=this.resume(),Z=this.stack[this.stack.length-1];Z.meta=W}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const W=this.resume(),Z=this.stack[this.stack.length-1];Z.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const W=this.resume(),Z=this.stack[this.stack.length-1];Z.value=W.replace(/(\r?\n|\r)$/g,"")}function y(W){const Z=this.resume(),ue=this.stack[this.stack.length-1];ue.label=Z,ue.identifier=wr(this.sliceSerialize(W)).toLowerCase()}function _(){const W=this.resume(),Z=this.stack[this.stack.length-1];Z.title=W}function b(){const W=this.resume(),Z=this.stack[this.stack.length-1];Z.url=W}function N(W){const Z=this.stack[this.stack.length-1];if(!Z.depth){const ue=this.sliceSerialize(W).length;Z.depth=ue}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function j(W){const Z=this.stack[this.stack.length-1];Z.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function F(W){const ue=this.stack[this.stack.length-1].children;let me=ue[ue.length-1];(!me||me.type!=="text")&&(me=ur(),me.position={start:Ps(W.start),end:void 0},ue.push(me)),this.stack.push(me)}function P(W){const Z=this.stack.pop();Z.value+=this.sliceSerialize(W),Z.position.end=Ps(W.end)}function O(W){const Z=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ue=Z.children[Z.children.length-1];ue.position.end=Ps(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Z.type)&&(F.call(this,W),P.call(this,W))}function T(){this.data.atHardBreak=!0}function E(){const W=this.resume(),Z=this.stack[this.stack.length-1];Z.value=W}function R(){const W=this.resume(),Z=this.stack[this.stack.length-1];Z.value=W}function L(){const W=this.resume(),Z=this.stack[this.stack.length-1];Z.value=W}function $(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=Z,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function K(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=Z,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function A(W){const Z=this.sliceSerialize(W),ue=this.stack[this.stack.length-2];ue.label=t6(Z),ue.identifier=wr(Z).toLowerCase()}function H(){const W=this.stack[this.stack.length-1],Z=this.resume(),ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,ue.type==="link"){const me=W.children;ue.children=me}else ue.alt=Z}function S(){const W=this.resume(),Z=this.stack[this.stack.length-1];Z.url=W}function Y(){const W=this.resume(),Z=this.stack[this.stack.length-1];Z.title=W}function B(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function U(W){const Z=this.resume(),ue=this.stack[this.stack.length-1];ue.label=Z,ue.identifier=wr(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function I(W){this.data.characterReferenceType=W.type}function q(W){const Z=this.sliceSerialize(W),ue=this.data.characterReferenceType;let me;ue?(me=WC(Z,ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=mx(Z);const Pe=this.stack[this.stack.length-1];Pe.value+=me}function z(W){const Z=this.stack.pop();Z.position.end=Ps(W.end)}function te(W){P.call(this,W);const Z=this.stack[this.stack.length-1];Z.url=this.sliceSerialize(W)}function se(W){P.call(this,W);const Z=this.stack[this.stack.length-1];Z.url="mailto:"+this.sliceSerialize(W)}function ye(){return{type:"blockquote",children:[]}}function De(){return{type:"code",lang:null,meta:null,value:""}}function $e(){return{type:"inlineCode",value:""}}function _e(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ne(){return{type:"emphasis",children:[]}}function fe(){return{type:"heading",depth:0,children:[]}}function ke(){return{type:"break"}}function Ze(){return{type:"html",value:""}}function et(){return{type:"image",title:null,url:"",alt:null}}function Ct(){return{type:"link",title:null,url:"",children:[]}}function tt(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function en(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function jn(){return{type:"paragraph",children:[]}}function cr(){return{type:"strong",children:[]}}function ur(){return{type:"text",value:""}}function go(){return{type:"thematicBreak"}}}function Ps(e){return{line:e.line,column:e.column,offset:e.offset}}function e2(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?e2(e,r):i6(e,r)}}function i6(e,t){let n;for(n in t)if(ZC.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function G_(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+jl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+jl({start:t.start,end:t.end})+") is still open")}function o6(e){const t=this;t.parser=n;function n(r){return r6(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function a6(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function l6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
503
- `}]}function c6(e,t){const n=t.value?t.value+`
504
- `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function u6(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function d6(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function h6(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Da(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function f6(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function p6(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function t2(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function m6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return t2(e,t);const s={src:Da(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function g6(e,t){const n={src:Da(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function v6(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function x6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return t2(e,t);const s={href:Da(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function y6(e,t){const n={href:Da(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function _6(e,t,n){const r=e.all(t),s=n?b6(n):n2(t),i={},o=[];if(typeof t.checked=="boolean"){const h=r[0];let d;h&&h.type==="element"&&h.tagName==="p"?d=h:(d={type:"element",tagName:"p",properties:{},children:[]},r.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:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const h=r[l];(s||l!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
505
- `}),h.type==="element"&&h.tagName==="p"&&!s?o.push(...h.children):o.push(h)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
506
- `});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function b6(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=n2(n[r])}return t}function n2(e){const t=e.spread;return t??e.children.length>1}function w6(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function S6(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function k6(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function C6(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function N6(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=ux(t.children[1]),c=LC(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function E6(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const d=t.children[c],p={},f=o?o[c]:void 0;f&&(p.align=f);let m={type:"element",tagName:i,properties:p,children:[]};d&&(m.children=e.all(d),e.patch(d,m),m=e.applyData(d,m)),u.push(m)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,h),e.applyData(t,h)}function j6(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const J_=9,Z_=32;function R6(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(eb(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(eb(t.slice(s),s>0,!1)),i.join("")}function eb(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===J_||i===Z_;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===J_||i===Z_;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function P6(e,t){const n={type:"text",value:R6(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function T6(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const D6={blockquote:a6,break:l6,code:c6,delete:u6,emphasis:d6,footnoteReference:h6,heading:f6,html:p6,imageReference:m6,image:g6,inlineCode:v6,linkReference:x6,link:y6,listItem:_6,list:w6,paragraph:S6,root:k6,strong:C6,table:N6,tableCell:j6,tableRow:E6,text:P6,thematicBreak:T6,toml:uu,yaml:uu,definition:uu,footnoteDefinition:uu};function uu(){}const r2=-1,Ch=0,Pl=1,Fd=2,vx=3,xx=4,yx=5,_x=6,s2=7,i2=8,tb=typeof self=="object"?self:globalThis,M6=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case Ch:case r2:return n(o,s);case Pl:{const l=n([],s);for(const c of o)l.push(r(c));return l}case Fd:{const l=n({},s);for(const[c,u]of o)l[r(c)]=r(u);return l}case vx:return n(new Date(o),s);case xx:{const{source:l,flags:c}=o;return n(new RegExp(l,c),s)}case yx:{const l=n(new Map,s);for(const[c,u]of o)l.set(r(c),r(u));return l}case _x:{const l=n(new Set,s);for(const c of o)l.add(r(c));return l}case s2:{const{name:l,message:c}=o;return n(new tb[l](c),s)}case i2:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new tb[i](o),s)};return r},nb=e=>M6(new Map,e)(0),wo="",{toString:A6}={},{keys:L6}=Object,Za=e=>{const t=typeof e;if(t!=="object"||!e)return[Ch,t];const n=A6.call(e).slice(8,-1);switch(n){case"Array":return[Pl,wo];case"Object":return[Fd,wo];case"Date":return[vx,wo];case"RegExp":return[xx,wo];case"Map":return[yx,wo];case"Set":return[_x,wo];case"DataView":return[Pl,n]}return n.includes("Array")?[Pl,n]:n.includes("Error")?[s2,n]:[Fd,n]},du=([e,t])=>e===Ch&&(t==="function"||t==="symbol"),O6=(e,t,n,r)=>{const s=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=Za(o);switch(l){case Ch:{let h=o;switch(c){case"bigint":l=i2,h=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);h=null;break;case"undefined":return s([r2],o)}return s([l,h],o)}case Pl:{if(c){let p=o;return c==="DataView"?p=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(o)),s([c,[...p]],o)}const h=[],d=s([l,h],o);for(const p of o)h.push(i(p));return d}case Fd:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const h=[],d=s([l,h],o);for(const p of L6(o))(e||!du(Za(o[p])))&&h.push([i(p),i(o[p])]);return d}case vx:return s([l,o.toISOString()],o);case xx:{const{source:h,flags:d}=o;return s([l,{source:h,flags:d}],o)}case yx:{const h=[],d=s([l,h],o);for(const[p,f]of o)(e||!(du(Za(p))||du(Za(f))))&&h.push([i(p),i(f)]);return d}case _x:{const h=[],d=s([l,h],o);for(const p of o)(e||!du(Za(p)))&&h.push(i(p));return d}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return i},rb=(e,{json:t,lossy:n}={})=>{const r=[];return O6(!(t||n),!!t,new Map,r)(e),r},zd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?nb(rb(e,t)):structuredClone(e):(e,t)=>nb(rb(e,t));function I6(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function B6(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function F6(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||I6,r=e.options.footnoteBackLabel||B6,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const h=e.all(u),d=String(u.identifier).toUpperCase(),p=Da(d.toLowerCase());let f=0;const m=[],g=e.footnoteCounts.get(d);for(;g!==void 0&&++f<=g;){m.length>0&&m.push({type:"text",value:" "});let y=typeof n=="string"?n:n(c,f);typeof y=="string"&&(y={type:"text",value:y}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,f),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const w=h[h.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const y=w.children[w.children.length-1];y&&y.type==="text"?y.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...m)}else h.push(...m);const v={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(h,!0)};e.patch(u,v),l.push(v)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...zd(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
507
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
508
- `}]}}const Nh=function(e){if(e==null)return W6;if(typeof e=="function")return Eh(e);if(typeof e=="object")return Array.isArray(e)?z6(e):$6(e);if(typeof e=="string")return H6(e);throw new Error("Expected function, string, or object as test")};function z6(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Nh(e[n]);return Eh(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function $6(e){const t=e;return Eh(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function H6(e){return Eh(t);function t(n){return n&&n.type===e}}function Eh(e){return t;function t(n,r,s){return!!(U6(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function W6(){return!0}function U6(e){return e!==null&&typeof e=="object"&&"type"in e}const o2=[],q6=!0,pg=!1,K6="skip";function a2(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=Nh(s),o=r?-1:1;l(e,void 0,[])();function l(c,u,h){const d=c&&typeof c=="object"?c:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=o2,m,g,w;if((!t||i(c,u,h[h.length-1]||void 0))&&(f=V6(n(c,h)),f[0]===pg))return f;if("children"in c&&c.children){const v=c;if(v.children&&f[0]!==K6)for(g=(r?v.children.length:-1)+o,w=h.concat(v);g>-1&&g<v.children.length;){const y=v.children[g];if(m=l(y,g,w)(),m[0]===pg)return m;g=typeof m[1]=="number"?m[1]:g+o}}return f}}}function V6(e){return Array.isArray(e)?e:typeof e=="number"?[q6,e]:e==null?o2:[e]}function bx(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),a2(e,i,l,s);function l(c,u){const h=u[u.length-1],d=h?h.children.indexOf(c):void 0;return o(c,d,h)}}const mg={}.hasOwnProperty,Y6={};function Q6(e,t){const n=t||Y6,r=new Map,s=new Map,i=new Map,o={...D6,...n.handlers},l={all:u,applyData:G6,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:X6,wrap:Z6};return bx(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const d=h.type==="definition"?r:s,p=String(h.identifier).toUpperCase();d.has(p)||d.set(p,h)}}),l;function c(h,d){const p=h.type,f=l.handlers[p];if(mg.call(l.handlers,p)&&f)return f(l,h,d);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in h){const{children:g,...w}=h,v=zd(w);return v.children=l.all(h),v}return zd(h)}return(l.options.unknownHandler||J6)(l,h,d)}function u(h){const d=[];if("children"in h){const p=h.children;let f=-1;for(;++f<p.length;){const m=l.one(p[f],h);if(m){if(f&&p[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=sb(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=sb(g.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function X6(e,t){e.position&&(t.position=BL(e))}function G6(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,zd(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function J6(e,t){const n=t.data||{},r="value"in t&&!(mg.call(n,"hProperties")||mg.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Z6(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
509
- `});++r<e.length;)r&&n.push({type:"text",value:`
510
- `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
511
- `}),n}function sb(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ib(e,t){const n=Q6(e,t),r=n.one(e,void 0),s=F6(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
512
- `},s),i}function eB(e,t){return e&&"run"in e?async function(n,r){const s=ib(n,{file:r,...t});await e.run(s,r)}:function(n,r){return ib(n,{file:r,...e||t})}}function ob(e){if(e)throw e}var qu=Object.prototype.hasOwnProperty,l2=Object.prototype.toString,ab=Object.defineProperty,lb=Object.getOwnPropertyDescriptor,cb=function(t){return typeof Array.isArray=="function"?Array.isArray(t):l2.call(t)==="[object Array]"},ub=function(t){if(!t||l2.call(t)!=="[object Object]")return!1;var n=qu.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&qu.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||qu.call(t,s)},db=function(t,n){ab&&n.name==="__proto__"?ab(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},hb=function(t,n){if(n==="__proto__")if(qu.call(t,n)){if(lb)return lb(t,n).value}else return;return t[n]},tB=function e(){var t,n,r,s,i,o,l=arguments[0],c=1,u=arguments.length,h=!1;for(typeof l=="boolean"&&(h=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=hb(l,n),s=hb(t,n),l!==s&&(h&&s&&(ub(s)||(i=cb(s)))?(i?(i=!1,o=r&&cb(r)?r:[]):o=r&&ub(r)?r:{},db(l,{name:n,newValue:e(h,o,s)})):typeof s<"u"&&db(l,{name:n,newValue:s}));return l};const Of=wa(tB);function gg(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 nB(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(c,...u){const h=e[++i];let d=-1;if(c){o(c);return}for(;++d<s.length;)(u[d]===null||u[d]===void 0)&&(u[d]=s[d]);s=u,h?rB(h,l)(...u):o(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function rB(e,t){let n;return r;function r(...o){const l=e.length>o.length;let c;l&&o.push(s);try{c=e.apply(this,o)}catch(u){const h=u;if(l&&n)throw h;return s(h)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(o,...l){n||(n=!0,t(o,...l))}function i(o){s(null,o)}}const Ar={basename:sB,dirname:iB,extname:oB,join:aB,sep:"/"};function sB(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Rc(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function iB(e){if(Rc(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function oB(e){Rc(e);let t=e.length,n=-1,r=0,s=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function aB(...e){let t=-1,n;for(;++t<e.length;)Rc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":lB(n)}function lB(e){Rc(e);const t=e.codePointAt(0)===47;let n=cB(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function cB(e,t){let n="",r=0,s=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function Rc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const uB={cwd:dB};function dB(){return"/"}function vg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function hB(e){if(typeof e=="string")e=new URL(e);else if(!vg(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 fB(e)}function fB(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const If=["history","path","basename","stem","extname","dirname"];class c2{constructor(t){let n;t?vg(t)?n={path:t}:typeof t=="string"||pB(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":uB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<If.length;){const i=If[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)If.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ar.basename(this.path):void 0}set basename(t){Ff(t,"basename"),Bf(t,"basename"),this.path=Ar.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ar.dirname(this.path):void 0}set dirname(t){fb(this.basename,"dirname"),this.path=Ar.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ar.extname(this.path):void 0}set extname(t){if(Bf(t,"extname"),fb(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=Ar.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){vg(t)&&(t=hB(t)),Ff(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ar.basename(this.path,this.extname):void 0}set stem(t){Ff(t,"stem"),Bf(t,"stem"),this.path=Ar.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Zt(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Bf(e,t){if(e&&e.includes(Ar.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ar.sep+"`")}function Ff(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function fb(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function pB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const mB=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},gB={}.hasOwnProperty;class wx extends mB{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=nB()}copy(){const t=new wx;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Of(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Hf("data",this.frozen),this.namespace[t]=n,this):gB.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Hf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=hu(t),r=this.parser||this.Parser;return zf("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),zf("process",this.parser||this.Parser),$f("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const l=hu(t),c=r.parse(l);r.run(c,l,function(h,d,p){if(h||!d||!p)return u(h);const f=d,m=r.stringify(f,p);yB(m)?p.value=m:p.result=m,u(h,p)});function u(h,d){h||!d?o(h):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),zf("processSync",this.parser||this.Parser),$f("processSync",this.compiler||this.Compiler),this.process(t,s),mb("processSync","process",n),r;function s(i,o){n=!0,ob(i),r=o}}run(t,n,r){pb(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,l){const c=hu(n);s.run(t,c,u);function u(h,d,p){const f=d||t;h?l(h):o?o(f):r(void 0,f,p)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),mb("runSync","run",r),s;function i(o,l){ob(o),s=l,r=!0}}stringify(t,n){this.freeze();const r=hu(n),s=this.compiler||this.Compiler;return $f("stringify",s),pb(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Hf("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[h,...d]=u;c(h,d)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(s.settings=Of(!0,s.settings,u.settings))}function l(u){let h=-1;if(u!=null)if(Array.isArray(u))for(;++h<u.length;){const d=u[h];i(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,h){let d=-1,p=-1;for(;++d<r.length;)if(r[d][0]===u){p=d;break}if(p===-1)r.push([u,...h]);else if(h.length>0){let[f,...m]=h;const g=r[p][1];gg(g)&&gg(f)&&(f=Of(!0,g,f)),r[p]=[u,f,...m]}}}}const vB=new wx().freeze();function zf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $f(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Hf(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 pb(e){if(!gg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function mb(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function hu(e){return xB(e)?e:new c2(e)}function xB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function yB(e){return typeof e=="string"||_B(e)}function _B(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const bB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",gb=[],vb={allowDangerousHtml:!0},wB=/^(https?|ircs?|mailto|xmpp)$/i,SB=[{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 xg(e){const t=kB(e),n=CB(e);return NB(t.runSync(t.parse(n),n),e)}function kB(e){const t=e.rehypePlugins||gb,n=e.remarkPlugins||gb,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...vb}:vb;return vB().use(o6).use(n).use(eB,r).use(t)}function CB(e){const t=e.children||"",n=new c2;return typeof t=="string"&&(n.value=t),n}function NB(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||EB;for(const h of SB)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+bB+h.id,void 0);return bx(e,u),WL(e,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(h,d,p){if(h.type==="raw"&&p&&typeof d=="number")return o?p.children.splice(d,1):p.children[d]={type:"text",value:h.value},d;if(h.type==="element"){let f;for(f in Mf)if(Object.hasOwn(Mf,f)&&Object.hasOwn(h.properties,f)){const m=h.properties[f],g=Mf[f];(g===null||g.includes(h.tagName))&&(h.properties[f]=c(String(m||""),f,h))}}if(h.type==="element"){let f=n?!n.includes(h.tagName):i?i.includes(h.tagName):!1;if(!f&&r&&typeof d=="number"&&(f=!r(h,d,p)),f&&p&&typeof d=="number")return l&&h.children?p.children.splice(d,1,...h.children):p.children.splice(d,1),d}}}function EB(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||wB.test(e.slice(0,t))?e:""}function Ku(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(r<0)return"just now";const s=Math.floor(r/1e3);if(s<60)return"just now";const i=Math.floor(s/60);if(i<60)return`${i}m ago`;const o=Math.floor(i/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function fu(e,t=30){return Date.now()-new Date(e).getTime()>t*60*1e3}function jB(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 el(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 pu(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function mu(e){return e.includes("opus-4-6")||e.includes("opus-4.6")?"Opus 4.6":e.includes("opus-4-5")||e.includes("opus-4.5")?"Opus 4.5":e.includes("opus-4-1")?"Opus 4.1":e.includes("opus-4")||e.includes("opus")?"Opus 4":e.includes("sonnet-4-5")||e.includes("sonnet-4.5")?"Sonnet 4.5":e.includes("sonnet-4")||e.includes("sonnet")?"Sonnet 4":e.includes("haiku-4-5")||e.includes("haiku-4.5")?"Haiku 4.5":e.includes("haiku-3")?"Haiku 3":e.includes("haiku")?"Haiku 4.5":e}async function RB(e){const t=await fetch(`/api/agents/${e}/output?lines=200`);if(!t.ok)throw new Error("Failed to fetch output");return(await t.json()).output||""}async function PB(e){try{const t=await fetch(`/api/mission-control/planning/${e}`);return t.ok&&(await t.json()).prd||null}catch{return null}}function TB({history:e}){const[t,n]=x.useState(!1),r=[...e].reverse();return a.jsxs("div",{className:"mt-2 border-t border-border/30 pt-1.5",children:[a.jsxs("button",{onClick:()=>n(!t),className:"flex items-center gap-1 text-[10px] text-content-muted hover:text-content-subtle",children:[a.jsx("span",{children:t?"▾":"▸"}),a.jsxs("span",{children:["History (",e.length,")"]})]}),t&&a.jsx("div",{className:"mt-1 space-y-0.5",children:r.map((s,i)=>a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[a.jsx("span",{className:"text-content-muted w-12 shrink-0",children:Ku(s.timestamp)}),a.jsx("span",{className:s.type==="review"?"text-blue-400":s.type==="test"?"text-purple-400":"text-green-400",children:s.type}),a.jsx("span",{className:s.status==="passed"?"text-green-400":s.status==="failed"||s.status==="blocked"?"text-red-400":["reviewing","testing","merging"].includes(s.status)?"text-yellow-400":"text-content-muted",children:s.status}),s.notes&&a.jsxs("span",{className:"text-content-muted truncate",title:s.notes,children:["— ",s.notes.slice(0,60),s.notes.length>60?"...":""]})]},i))})]})}function DB({agent:e,issueId:t,issueUrl:n,issue:r,onClose:s}){var Z,ue,me,Pe;const i=dn(),[o,l]=x.useState(""),[c,u]=x.useState(!1),[h,d]=x.useState("logs"),p=x.useRef(null),f=x.useRef(null),[m,g]=x.useState(!0),w=e?`tmux attach -t ${e.id}`:"",[v,y]=x.useState(!1),[_,b]=x.useState(!1),{data:N,refetch:k}=he({queryKey:["agent-output",e==null?void 0:e.id],queryFn:()=>RB(e.id),refetchInterval:(e==null?void 0:e.status)==="stopped"?!1:1e3,enabled:!!e}),[j,D]=x.useState(!1),[F,P]=x.useState(!1),[O,T]=x.useState(0),{data:E}=he({queryKey:["workspace",t],queryFn:async()=>{const V=await fetch(`/api/workspaces/${t}`);if(!V.ok)throw new Error("Failed to fetch workspace info");const ae=await V.json();if(ae.exists&&j&&D(!1),F&&ae.containers){const Be=Object.values(ae.containers),It=Be.every(Nt=>Nt.running),at=Date.now()-O>2e4,Rn=Be.some(Nt=>{var Mc;return(Mc=Nt.status)==null?void 0:Mc.startsWith("exited")});(It||at&&Rn)&&P(!1)}return ae},refetchInterval:j||F?2e3:5e3}),{data:R}=he({queryKey:["review-status",t],queryFn:async()=>{const V=await fetch(`/api/workspaces/${t}/review-status`);if(!V.ok)throw new Error("Failed to fetch review status");return V.json()},refetchInterval:3e3}),{data:L}=he({queryKey:["prd",t],queryFn:()=>PB(t),staleTime:6e4}),{data:$}=he({queryKey:["issueCosts",t],queryFn:async()=>{const V=await fetch(`/api/issues/${t}/costs`);if(!V.ok)throw new Error("Failed to fetch costs");return V.json()},refetchInterval:3e4,staleTime:1e4}),K=we({mutationFn:async()=>{var ae;const V=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:t,projectId:(ae=r==null?void 0:r.project)==null?void 0:ae.id})});if(!V.ok)throw new Error("Failed to start agent");return V.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["agents"]})},2e3)}}),A=we({mutationFn:async()=>{var ae;const V=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:t,projectId:(ae=r==null?void 0:r.project)==null?void 0:ae.id})});if(!V.ok)throw new Error("Failed to create workspace");return V.json()},onSuccess:()=>{D(!0),i.invalidateQueries({queryKey:["workspace",t]})}}),H=we({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to start containers")}return V.json()},onSuccess:()=>{P(!0),T(Date.now()),setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},5e3),setTimeout(()=>P(!1),9e4)}}),[S,Y]=x.useState(null);x.useEffect(()=>{const V=()=>Y(null);if(S)return document.addEventListener("click",V),()=>document.removeEventListener("click",V)},[S]);const B=we({mutationFn:async({containerName:V,action:ae})=>{const Be=await fetch(`/api/workspaces/${t}/containers/${V}/${ae}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Be.ok){const It=await Be.json();throw new Error(It.error||`Failed to ${ae} container`)}return Be.json()},onSuccess:()=>{Y(null),setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},2e3)}}),C=(V,ae,Be)=>{V.preventDefault(),Y({x:V.clientX,y:V.clientY,containerName:ae,isRunning:Be})},U=we({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/containerize`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to containerize workspace")}return V.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},3e3)}}),I=we({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/review`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to start review")}return V.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["review-status",t]})}}),q=we({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/merge`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to merge")}return V.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]}),i.invalidateQueries({queryKey:["issues"]}),i.invalidateQueries({queryKey:["review-status",t]}),s()}}),z=we({mutationFn:async()=>{const V=await fetch(`/api/issues/${t}/close`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Closed manually"})});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to close issue")}return V.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]}),i.invalidateQueries({queryKey:["issues"]}),s()}}),te=we({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/pending`,{method:"DELETE"});if(!V.ok)throw new Error("Failed to dismiss");return V.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]})}}),se=we({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/clean`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to clean workspace")}return V.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]})}}),ye=()=>{confirm(`Clean and recreate corrupted workspace for ${t}?
513
-
514
- This will:
515
- - Remove the corrupted workspace directory
516
- - Create a fresh workspace`)&&se.mutate()},De=()=>{H.mutate()},$e=()=>{U.mutate()},_e=()=>{const ae=(R==null?void 0:R.readyForMerge)||(R==null?void 0:R.reviewStatus)==="passed"||(R==null?void 0:R.testStatus)==="passed"?`Re-run review & test pipeline for ${t}?
517
-
518
- This will reset the current status and:
519
- - Run strict code review (review-agent)
520
- - Run tests (test-agent)
521
-
522
- MERGE button will appear when both pass.`:`Start review & test pipeline for ${t}?
523
-
524
- This will:
525
- - Run strict code review (review-agent)
526
- - Run tests (test-agent)
527
-
528
- MERGE button will appear when both pass.`;confirm(ae)&&I.mutate()},ne=()=>{confirm(`Merge ${t} to main?
529
-
530
- Review and tests have passed. This will:
531
- - Merge the feature branch to main
532
- - Run final verification tests
533
- - Clean up workspace`)&&q.mutate()},fe=()=>{confirm(`Close ${t} without merging? This will:
534
- - Close the issue (no merge)
535
- - Stop any running agent
536
- - Remove the workspace
537
- (Feature branch is preserved for history)`)&&z.mutate()},ke=we({mutationFn:async V=>{if(!e)throw new Error("No agent");if(!(await fetch(`/api/agents/${e.id}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:V})})).ok)throw new Error("Failed to send")},onSuccess:()=>{l(""),setTimeout(()=>k(),500)}}),Ze=we({mutationFn:async()=>{if(!e)throw new Error("No agent");if(!(await fetch(`/api/agents/${e.id}`,{method:"DELETE"})).ok)throw new Error("Failed to kill")},onSuccess:()=>{i.invalidateQueries({queryKey:["agents"]}),s()}}),et=x.useCallback(()=>{jB(w),u(!0),setTimeout(()=>u(!1),2e3)},[w]);x.useEffect(()=>{m&&f.current&&f.current.scrollIntoView({behavior:"auto"})},[N,m]);const Ct=x.useCallback(()=>{if(p.current){const{scrollTop:V,scrollHeight:ae,clientHeight:Be}=p.current,It=ae-V-Be<50;g(It)}},[]),tt=()=>{o.trim()&&ke.mutate(o.trim())},en=()=>{e&&confirm(`Kill agent ${e.id}?`)&&Ze.mutate()},jn=e?new Date(e.startedAt):null,cr=jn?Date.now()-jn.getTime():0,ur=Math.floor(cr/6e4),go=Math.floor(ur/60),W=go>0?`${go}h ${ur%60}m`:`${ur}m`;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex h-full bg-surface-raised border-l border-divider",children:[a.jsxs("div",{className:"w-64 border-r border-divider flex flex-col overflow-y-auto",children:[a.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[e?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-content-subtle",children:e.status==="stopped"?"Agent Stopped":"Agent Running"})]}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-content-muted"}),a.jsx("span",{className:"text-xs text-content-subtle",children:"No Agent"})]}),a.jsx("h2",{className:"font-mono text-sm text-content font-medium mt-1",children:t.toUpperCase()}),r&&a.jsx("p",{className:"text-xs text-content-subtle mt-1 line-clamp-2",title:r.title,children:r.title})]}),r&&a.jsx("div",{className:"px-3 py-2 border-b border-divider text-xs",children:a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[a.jsx("span",{className:"px-1.5 py-0.5 bg-surface-overlay text-content rounded text-[10px]",children:r.status}),r.priority>0&&a.jsx("span",{className:`text-[10px] ${r.priority===1?"text-red-400":r.priority===2?"text-orange-400":r.priority===3?"text-yellow-400":"text-blue-400"}`,children:r.priority===1?"Urgent":r.priority===2?"High":r.priority===3?"Medium":"Low"}),r.labels.slice(0,3).map(V=>a.jsx("span",{className:"px-1.5 py-0.5 bg-surface-overlay text-content-muted rounded text-[10px]",children:V},V))]})}),e&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted 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-content-subtle",children:"Model"}),a.jsx("span",{className:"text-content",children:mu(e.model)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Runtime"}),a.jsx("span",{className:"text-content",children:e.runtime})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Uptime"}),a.jsx("span",{className:"text-content",children:W})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Session"}),a.jsx("span",{className:"text-content font-mono text-[10px]",children:e.id})]})]})]}),(e==null?void 0:e.git)&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted 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-content",children:[a.jsx(pk,{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-content-subtle text-[10px] mt-1 truncate",title:e.git.latestCommit,children:e.git.latestCommit})]})]}),(e==null?void 0:e.workspace)&&a.jsx("div",{className:"px-3 py-2 border-b border-divider text-xs",children:a.jsxs("div",{className:"flex items-center gap-1.5 text-content-subtle",children:[a.jsx(_m,{className:"w-3 h-3"}),a.jsx("span",{className:"font-mono truncate text-[10px]",title:e.workspace,children:e.workspace})]})}),!e&&(E==null?void 0:E.exists)&&E.path&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Workspace"}),a.jsxs("div",{className:"flex items-center gap-1.5 text-content-subtle",children:[a.jsx(_m,{className:"w-3 h-3"}),a.jsx("span",{className:"font-mono truncate text-[10px]",title:E.path,children:E.path})]}),E.location&&a.jsxs("span",{className:`mt-1.5 inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${E.location==="remote"?"bg-cyan-900/50 text-cyan-400":"bg-surface-overlay text-content-subtle"}`,children:[E.location==="remote"?a.jsx(ym,{className:"w-3 h-3"}):a.jsx(bm,{className:"w-3 h-3"}),E.location]})]}),a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Links"}),a.jsxs("div",{className:"space-y-1.5",children:[n&&a.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(gs,{className:"w-3 h-3"}),a.jsx("span",{children:t.toUpperCase().startsWith("PAN-")?"GitHub Issue":"Linear Issue"})]}),L&&a.jsxs("button",{onClick:()=>y(!0),className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(li,{className:"w-3 h-3"}),a.jsx("span",{children:"PRD"})]}),a.jsxs("button",{onClick:()=>b(!0),className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(gk,{className:"w-3 h-3"}),a.jsx("span",{children:"Beads Tasks"})]})]})]}),$&&($.totalCost>0||(((Z=$.sessions)==null?void 0:Z.length)??0)>0)&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Cost"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Total"}),a.jsx("span",{className:"text-green-400 font-medium",children:el($.totalCost)})]}),$.totalTokens>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Tokens"}),a.jsx("span",{className:"text-content",children:pu($.totalTokens)})]}),Object.keys($.byModel).length>0&&a.jsx("div",{className:"border-t border-divider pt-1.5 mt-1.5",children:Object.entries($.byModel).sort(([,V],[,ae])=>ae.cost-V.cost).map(([V,ae])=>a.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[a.jsx("span",{className:"text-content-subtle truncate",title:V,children:mu(V)}),a.jsx("span",{className:"text-content-body",children:el(ae.cost)})]},V))})]})]}),(E==null?void 0:E.corrupted)&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[a.jsxs("div",{className:"flex items-center gap-2 text-yellow-500 mb-2",children:[a.jsx(Wn,{className:"w-4 h-4"}),a.jsx("span",{className:"text-xs font-medium",children:"Workspace Corrupted"}),E.location&&a.jsxs("span",{className:`flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${E.location==="remote"?"bg-cyan-900/50 text-cyan-400":"bg-surface-overlay text-content-subtle"}`,title:E.location==="remote"?"Running on remote VM (exe.dev)":"Running locally",children:[E.location==="remote"?a.jsx(ym,{className:"w-3 h-3"}):a.jsx(bm,{className:"w-3 h-3"}),E.location]})]}),a.jsx("p",{className:"text-xs text-content-subtle mb-2",children:E.message||"The workspace exists but is not a valid git worktree."}),a.jsx("button",{onClick:ye,disabled:se.isPending,className:"flex items-center gap-1 px-2 py-1 bg-yellow-600 hover:bg-yellow-500 disabled:bg-yellow-800 text-content text-xs rounded transition-colors w-full justify-center",children:se.isPending?a.jsxs(a.Fragment,{children:[a.jsx(je,{className:"w-3 h-3 animate-spin"}),"Cleaning..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Gs,{className:"w-3 h-3"}),"Clean & Recreate"]})}),se.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:se.error instanceof Error?se.error.message:"Failed to clean workspace"}),se.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..."})]}),(E==null?void 0:E.hasDocker)&&((E==null?void 0:E.frontendUrl)||(E==null?void 0:E.apiUrl))&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Services"}),a.jsxs("div",{className:"space-y-1.5",children:[E.frontendUrl&&a.jsxs("a",{href:E.frontendUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(b0,{className:"w-3 h-3"}),a.jsx("span",{children:"Frontend"})]}),E.apiUrl&&a.jsxs("a",{href:E.apiUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(b0,{className:"w-3 h-3"}),a.jsx("span",{children:"API"})]})]})]}),(E==null?void 0:E.hasDocker)&&E.containers&&Object.values(E.containers).some(V=>!V.running)&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-yellow-500",children:F?"Starting containers...":"Some containers stopped"}),a.jsx("button",{onClick:De,disabled:H.isPending||F,className:"flex items-center gap-1 px-2 py-1 bg-green-600 hover:bg-green-500 disabled:bg-green-800 text-content text-xs rounded transition-colors",children:H.isPending||F?a.jsxs(a.Fragment,{children:[a.jsx(je,{className:"w-3 h-3 animate-spin"}),"Starting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Start Containers"]})})]}),H.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:H.error instanceof Error?H.error.message:"Failed to start containers"})]}),(E==null?void 0:E.exists)&&!E.hasDocker&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider text-xs mb-2",children:"Containers"}),E.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-content-muted",children:"Git-only workspace"}),a.jsx("button",{onClick:$e,disabled:U.isPending,className:"flex items-center gap-1 px-2 py-1 bg-purple-600 hover:bg-purple-500 disabled:bg-purple-800 text-content text-xs rounded transition-colors",children:U.isPending?a.jsxs(a.Fragment,{children:[a.jsx(je,{className:"w-3 h-3 animate-spin"}),"Setting up..."]}):a.jsxs(a.Fragment,{children:[a.jsx(y0,{className:"w-3 h-3"}),"Containerize"]})})]}),U.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded",children:U.error instanceof Error?U.error.message:"Failed to containerize workspace"})]}):a.jsxs("div",{className:"text-xs text-content-subtle bg-surface-raised px-2 py-2 rounded",children:[a.jsx("span",{className:"text-content-muted",children:"No Docker support."})," This workspace doesn't have container infrastructure set up yet."]})]}),(E==null?void 0:E.containers)&&Object.keys(E.containers).length>0&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsxs("div",{className:"text-content-muted 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(E.containers).map(([V,ae])=>{var at,Rn;const Be=(H.isPending||F)&&!ae.running&&!((at=ae.status)!=null&&at.startsWith("exited")),It=B.isPending&&(S==null?void 0:S.containerName)===V,mn=((Rn=ae.status)==null?void 0:Rn.startsWith("exited"))&&!ae.running;return a.jsxs("span",{onContextMenu:Nt=>C(Nt,V,ae.running),className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] cursor-context-menu select-none ${ae.running?"bg-green-900/30 text-green-400 hover:bg-green-900/50":mn?"bg-red-900/30 text-red-400 hover:bg-red-900/50":Be||It?"bg-yellow-900/30 text-yellow-400 animate-pulse":"bg-surface-overlay text-content-muted hover:bg-surface-emphasis"}`,title:mn?`Container ${ae.status} — right-click for options`:"Right-click for start/stop/restart options",children:[Be||It?a.jsx(je,{className:"w-2.5 h-2.5 animate-spin"}):V==="postgres"||V==="redis"?a.jsx($R,{className:"w-2.5 h-2.5"}):a.jsx(y0,{className:"w-2.5 h-2.5"}),V,ae.running&&ae.uptime&&a.jsx("span",{className:"text-content-subtle ml-1",children:ae.uptime}),mn&&a.jsx("span",{className:"text-red-500 ml-1",children:ae.status}),(Be||It)&&a.jsx("span",{className:"text-yellow-500 ml-1",children:"..."})]},V)})})]}),e&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted 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-surface rounded font-mono text-[11px] text-content-body overflow-hidden",children:[a.jsx(no,{className:"w-3 h-3 shrink-0 text-blue-400"}),a.jsx("span",{className:"truncate",children:w})]}),a.jsx("button",{onClick:et,className:`p-1.5 rounded transition-colors ${c?"bg-green-900/30 text-green-400":"bg-surface-overlay hover:bg-surface-emphasis text-content-subtle hover:text-content"}`,title:"Copy to clipboard",children:c?a.jsx(Nl,{className:"w-3.5 h-3.5"}):a.jsx(zR,{className:"w-3.5 h-3.5"})})]})]}),a.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[a.jsx("div",{className:"text-xs text-content-muted uppercase tracking-wider mb-2",children:"Actions"}),((ue=E==null?void 0:E.pendingOperation)==null?void 0:ue.type)==="approve"&&E.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(je,{className:"w-3 h-3 animate-spin"}),a.jsx("span",{children:"Merging in progress... (survives tab switches)"})]}),((me=E==null?void 0:E.pendingOperation)==null?void 0:me.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:()=>te.mutate(),className:"text-content-subtle hover:text-content",title:"Dismiss",children:a.jsx(mt,{className:"w-3 h-3"})})]}),a.jsx("div",{className:"mt-1 text-content-subtle whitespace-pre-wrap",children:E.pendingOperation.error})]}),R&&(R.reviewStatus!=="pending"||R.testStatus!=="pending")&&a.jsxs("div",{className:`mb-2 p-2 rounded text-xs ${R.updatedAt&&fu(R.updatedAt)?"bg-amber-900/20 border border-amber-700/30":"bg-surface/50"}`,children:[R.updatedAt&&fu(R.updatedAt)&&a.jsxs("div",{className:"flex items-center gap-1 mb-1.5 text-amber-400 text-[10px]",children:[a.jsx(Wn,{className:"w-3 h-3"}),a.jsxs("span",{children:["Status may be stale (",Ku(R.updatedAt),")"]})]}),a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"text-content-subtle",children:"Review:"}),a.jsx("span",{className:R.reviewStatus==="passed"?"text-green-400":R.reviewStatus==="blocked"||R.reviewStatus==="failed"?"text-red-400":R.reviewStatus==="reviewing"?"text-yellow-400":"text-content-muted",children:R.reviewStatus==="passed"?"✓ Passed":R.reviewStatus==="blocked"?"✗ Blocked":R.reviewStatus==="failed"?"✗ Failed":R.reviewStatus==="reviewing"?"⟳ Reviewing...":"Pending"}),R.updatedAt&&R.reviewStatus!=="pending"&&!fu(R.updatedAt)&&a.jsx("span",{className:"text-content-muted text-[10px]",children:Ku(R.updatedAt)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-content-subtle",children:"Tests:"}),a.jsx("span",{className:R.testStatus==="passed"?"text-green-400":R.testStatus==="failed"?"text-red-400":R.testStatus==="testing"?"text-yellow-400":"text-content-muted",children:R.testStatus==="passed"?"✓ Passed":R.testStatus==="failed"?"✗ Failed":R.testStatus==="testing"?"⟳ Testing...":R.testStatus==="skipped"?"⊘ Skipped":"Pending"}),R.updatedAt&&R.testStatus!=="pending"&&!fu(R.updatedAt)&&a.jsx("span",{className:"text-content-muted text-[10px]",children:Ku(R.updatedAt)})]}),R.reviewNotes&&a.jsx("div",{className:"mt-1 text-content-subtle text-xs",children:R.reviewNotes}),R.testNotes&&a.jsx("div",{className:"mt-1 text-content-subtle text-xs",children:R.testNotes}),R.history&&R.history.length>0&&a.jsx(TB,{history:R.history})]}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[(R==null?void 0:R.readyForMerge)&&(R==null?void 0:R.mergeStatus)!=="merged"&&a.jsxs("button",{onClick:ne,disabled:q.isPending||(R==null?void 0:R.mergeStatus)==="merging",className:"flex items-center gap-1 px-2 py-1 text-xs bg-green-600 text-content rounded hover:bg-green-500 disabled:opacity-50 font-medium",children:[q.isPending||(R==null?void 0:R.mergeStatus)==="merging"?a.jsx(je,{className:"w-3 h-3 animate-spin"}):a.jsx(mi,{className:"w-3 h-3"}),(R==null?void 0:R.mergeStatus)==="merging"?"MERGING...":"MERGE"]}),(R==null?void 0:R.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(mi,{className:"w-3 h-3"}),"MERGED"]}),a.jsxs("button",{onClick:_e,disabled:I.isPending||(R==null?void 0:R.reviewStatus)==="reviewing"||(R==null?void 0:R.testStatus)==="testing",className:`flex items-center gap-1 px-2 py-1 text-xs rounded disabled:opacity-50 ${R!=null&&R.readyForMerge?"bg-surface-overlay/50 text-content-body hover:bg-surface-overlay":"bg-blue-900/30 text-blue-400 hover:bg-blue-900/50"}`,children:[I.isPending||(R==null?void 0:R.reviewStatus)==="reviewing"||(R==null?void 0:R.testStatus)==="testing"?a.jsx(je,{className:"w-3 h-3 animate-spin"}):a.jsx(Gs,{className:"w-3 h-3"}),R!=null&&R.readyForMerge?"Re-Review":"Review & Test"]}),e&&a.jsxs("button",{onClick:en,disabled:Ze.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(Zl,{className:"w-3 h-3"}),"Stop Agent"]}),a.jsxs("button",{onClick:fe,disabled:z.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:[z.isPending?a.jsx(je,{className:"w-3 h-3 animate-spin"}):a.jsx(wc,{className:"w-3 h-3"}),"Close (No Merge)"]}),!e&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>K.mutate(),disabled:K.isPending||K.isSuccess,className:"flex items-center gap-1 px-2 py-1 text-xs bg-blue-600 text-content rounded hover:bg-blue-500 disabled:opacity-50 font-medium",children:[K.isPending?a.jsx(je,{className:"w-3 h-3 animate-spin"}):K.isSuccess?a.jsx(Nl,{className:"w-3 h-3"}):a.jsx(Sn,{className:"w-3 h-3"}),K.isPending?"Starting...":K.isSuccess?"Started!":"Start Agent"]}),!(E!=null&&E.exists)&&a.jsxs("button",{onClick:()=>A.mutate(),disabled:A.isPending||A.isSuccess,className:"flex items-center gap-1 px-2 py-1 text-xs bg-surface-overlay text-content rounded hover:bg-surface-emphasis disabled:opacity-50 border border-divider-strong",children:[A.isPending||A.isSuccess?a.jsx(je,{className:"w-3 h-3 animate-spin"}):a.jsx(_0,{className:"w-3 h-3"}),A.isPending?"Creating...":A.isSuccess?"Setting up...":"Create Workspace"]})]})]}),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 start review"}),q.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:q.error instanceof Error?q.error.message:"Failed to merge"}),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 close"})]}),a.jsx("div",{className:"flex-1"})]}),a.jsx("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 overflow-hidden",children:e?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-divider",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>d("logs"),className:`px-2 py-1 text-xs rounded transition-colors ${h==="logs"?"bg-surface-overlay text-content":"text-content-subtle hover:text-content"}`,children:"Logs"}),a.jsx("button",{onClick:()=>d("status"),className:`px-2 py-1 text-xs rounded transition-colors ${h==="status"?"bg-surface-overlay text-content":"text-content-subtle hover:text-content"}`,children:"Status"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>k(),className:"p-1 text-content-subtle hover:text-content",title:"Refresh",children:a.jsx(Gs,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:s,className:"p-1 text-content-subtle hover:text-content",children:a.jsx(mt,{className:"w-3.5 h-3.5"})})]})]}),h==="logs"?a.jsxs(a.Fragment,{children:[a.jsxs("pre",{ref:p,onScroll:Ct,className:"flex-1 min-h-0 overflow-auto p-3 bg-surface text-content font-mono text-xs leading-relaxed m-0 whitespace-pre",children:[N||(e.status==="stopped"?"No saved output available.":"Connecting to agent..."),a.jsx("div",{ref:f})]}),e.status!=="stopped"&&a.jsx("div",{className:"p-2 border-t border-divider bg-surface-raised",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:o,onChange:V=>l(V.target.value),onKeyDown:V=>V.key==="Enter"&&tt(),placeholder:"Send message to agent...",className:"flex-1 px-3 py-2 bg-surface-overlay border border-divider-strong rounded text-sm text-content placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500"}),a.jsxs("button",{onClick:tt,disabled:!o.trim()||ke.isPending,className:"px-3 py-2 bg-blue-600 text-content rounded text-sm font-medium hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[a.jsx(vk,{className:"w-4 h-4"}),"Send"]})]})})]}):a.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 bg-surface",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Agent Summary"}),a.jsxs("div",{className:"text-xs text-content-body 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:"})," ",mu(e.model)]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Runtime:"})," ",e.runtime]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Started:"})," ",jn==null?void 0:jn.toLocaleString()]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Uptime:"})," ",W]})]})]}),e.workspace&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Workspace"}),a.jsx("div",{className:"text-xs text-content-body 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-content mb-2",children:"Git Status"}),a.jsxs("div",{className:"text-xs text-content-body 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-content mb-2",children:"Health"}),a.jsxs("div",{className:"text-xs text-content-body 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]})]})]})]})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-divider",children:[a.jsx("span",{className:"text-xs text-content-subtle",children:"Issue Details"}),a.jsx("button",{onClick:s,className:"p-1 text-content-subtle hover:text-content",children:a.jsx(mt,{className:"w-3.5 h-3.5"})})]}),a.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 bg-surface",children:[r&&a.jsx("h2",{className:"text-lg font-medium text-content mb-4",children:r.title}),r&&a.jsxs("div",{className:"space-y-3 mb-6",children:[r.assignee&&a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(Sk,{className:"w-4 h-4 text-content-subtle"}),a.jsx("span",{className:"text-content-body",children:r.assignee.name}),r.assignee.email&&a.jsx("span",{className:"text-content-muted text-xs",children:r.assignee.email})]}),r.labels.length>0&&a.jsxs("div",{className:"flex items-center gap-2 text-sm flex-wrap",children:[a.jsx(yk,{className:"w-4 h-4 text-content-subtle shrink-0"}),r.labels.map(V=>a.jsx("span",{className:"px-2 py-0.5 bg-surface-overlay text-content-body text-xs rounded",children:V},V))]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-content-subtle",children:[a.jsx(LR,{className:"w-4 h-4"}),a.jsxs("span",{children:["Updated ",new Date(r.updatedAt).toLocaleDateString()]})]})]}),(r==null?void 0:r.description)&&a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium text-content-subtle mb-2",children:"Description"}),a.jsx("div",{className:"text-sm text-content-body bg-surface-raised rounded p-3 max-h-64 overflow-y-auto prose prose-sm prose-invert prose-p:my-2 prose-headings:my-2 prose-ul:my-1 prose-li:my-0",children:a.jsx(xg,{children:r.description})})]}),$&&($.totalCost>0||(((Pe=$.sessions)==null?void 0:Pe.length)??0)>0)&&a.jsxs("div",{className:"mb-6",children:[a.jsxs("h3",{className:"text-sm font-medium text-content-subtle mb-2 flex items-center gap-2",children:[a.jsx(uo,{className:"w-4 h-4"}),"Cost Summary"]}),a.jsxs("div",{className:"bg-surface-raised rounded p-3 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Total Cost"}),a.jsx("span",{className:"text-xl font-semibold text-green-400",children:el($.totalCost)})]}),$.totalTokens>0&&a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("span",{className:"text-content-muted flex items-center gap-1",children:[a.jsx(fk,{className:"w-3 h-3"}),"Total Tokens"]}),a.jsx("span",{className:"text-content-body",children:pu($.totalTokens)})]}),Object.keys($.byModel).length>0&&a.jsxs("div",{className:"border-t border-divider pt-2",children:[a.jsx("p",{className:"text-xs text-content-muted uppercase tracking-wider mb-2",children:"By Model"}),a.jsx("div",{className:"space-y-1",children:Object.entries($.byModel).sort(([,V],[,ae])=>ae.cost-V.cost).map(([V,ae])=>a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{className:"text-content-subtle truncate",title:V,children:mu(V)}),a.jsxs("div",{className:"text-right",children:[a.jsx("span",{className:"text-content-body",children:el(ae.cost)}),a.jsxs("span",{className:"text-content-muted text-xs ml-1",children:["(",pu(ae.tokens),")"]})]})]},V))})]}),$.byStage&&Object.keys($.byStage).length>0&&a.jsxs("div",{className:"border-t border-divider pt-2",children:[a.jsx("p",{className:"text-xs text-content-muted uppercase tracking-wider mb-2",children:"By Stage"}),a.jsx("div",{className:"space-y-1",children:Object.entries($.byStage).sort(([,V],[,ae])=>ae.cost-V.cost).map(([V,ae])=>a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{className:"text-content-subtle truncate",title:V,children:V.charAt(0).toUpperCase()+V.slice(1)}),a.jsxs("div",{className:"text-right",children:[a.jsx("span",{className:"text-content-body",children:el(ae.cost)}),a.jsxs("span",{className:"text-content-muted text-xs ml-1",children:["(",pu(ae.tokens),")"]})]})]},V))})]})]})]}),a.jsxs("div",{className:"space-y-3 mt-6",children:[a.jsx("button",{onClick:()=>K.mutate(),disabled:K.isPending||K.isSuccess,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-blue-600 text-content rounded-lg hover:bg-blue-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:K.isPending?a.jsxs(a.Fragment,{children:[a.jsx(je,{className:"w-5 h-5 animate-spin"}),a.jsx("span",{className:"font-medium",children:"Starting..."})]}):K.isSuccess?a.jsxs(a.Fragment,{children:[a.jsx(Nl,{className:"w-5 h-5"}),a.jsx("span",{className:"font-medium",children:"Agent Started!"})]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-5 h-5"}),a.jsx("span",{className:"font-medium",children:E!=null&&E.exists?"Start Agent in Workspace":"Start Agent"})]})}),!(E!=null&&E.exists)&&a.jsx("button",{onClick:()=>A.mutate(),disabled:A.isPending||A.isSuccess,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-surface-overlay text-content rounded-lg hover:bg-surface-emphasis transition-colors border border-divider-strong disabled:opacity-50 disabled:cursor-not-allowed",children:A.isPending||A.isSuccess?a.jsxs(a.Fragment,{children:[a.jsx(je,{className:"w-5 h-5 animate-spin"}),a.jsx("span",{className:"font-medium",children:A.isPending?"Creating workspace...":"Setting up git worktree & skills..."})]}):a.jsxs(a.Fragment,{children:[a.jsx(_0,{className:"w-5 h-5"}),a.jsx("span",{className:"font-medium",children:"Create Workspace Only"})]})}),K.isError&&a.jsx("p",{className:"text-red-400 text-xs",children:"Failed to start agent. Check server logs."}),A.isError&&a.jsx("p",{className:"text-red-400 text-xs",children:"Failed to create workspace. Check server logs."})]}),a.jsxs("div",{className:"text-xs text-content-muted mt-3 space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Start Agent:"})," ",E!=null&&E.exists?"Starts autonomous agent in existing workspace":"Creates workspace + starts autonomous agent"]}),!(E!=null&&E.exists)&&a.jsxs("p",{children:[a.jsx("strong",{children:"Create Workspace:"})," Creates git worktree for manual work"]})]})]})]})})]}),S&&a.jsxs("div",{className:"fixed z-50 bg-surface-raised border border-divider-strong rounded shadow-lg py-1 min-w-[140px]",style:{left:S.x,top:S.y},onClick:V=>V.stopPropagation(),children:[a.jsx("div",{className:"px-3 py-1 text-xs text-content-subtle border-b border-divider mb-1",children:S.containerName}),S.isRunning?a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>B.mutate({containerName:S.containerName,action:"restart"}),disabled:B.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-content hover:bg-surface-overlay flex items-center gap-2 disabled:opacity-50",children:[a.jsx(Gs,{className:"w-3 h-3"}),"Restart"]}),a.jsxs("button",{onClick:()=>B.mutate({containerName:S.containerName,action:"stop"}),disabled:B.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-red-400 hover:bg-surface-overlay flex items-center gap-2 disabled:opacity-50",children:[a.jsx(Zl,{className:"w-3 h-3"}),"Stop"]})]}):a.jsxs("button",{onClick:()=>B.mutate({containerName:S.containerName,action:"start"}),disabled:B.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-green-400 hover:bg-surface-overlay flex items-center gap-2 disabled:opacity-50",children:[a.jsx(Sn,{className:"w-3 h-3"}),"Start"]}),B.isError&&a.jsx("div",{className:"px-3 py-1 text-xs text-red-400 border-t border-divider mt-1",children:B.error instanceof Error?B.error.message:"Action failed"})]}),_&&a.jsx(ix,{issueId:t,isOpen:_,onClose:()=>b(!1)}),v&&L&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50",onClick:()=>y(!1),children:a.jsxs("div",{className:"border border-divider rounded-lg shadow-xl w-[700px] max-h-[80vh] flex flex-col",style:{backgroundColor:"#1a1d23"},onClick:V=>V.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[a.jsxs("h2",{className:"text-sm font-medium text-content",children:["PRD — ",t.toUpperCase()]}),a.jsx("button",{onClick:()=>y(!1),className:"text-content-muted hover:text-content",children:a.jsx(mt,{size:18})})]}),a.jsx("div",{className:"overflow-y-auto px-4 py-3 text-xs prose prose-invert prose-sm max-w-none",children:a.jsx(xg,{children:L})})]})})]})}async function MB(){const e=await fetch("/api/activity");if(!e.ok)throw new Error("Failed to fetch activity");return e.json()}function AB({status:e}){switch(e){case"running":return a.jsx(je,{className:"w-4 h-4 text-blue-400 animate-spin"});case"completed":return a.jsx(mi,{className:"w-4 h-4 text-green-400"});case"failed":return a.jsx(wc,{className:"w-4 h-4 text-red-400"})}}function LB(e){return new Date(e).toLocaleTimeString()}function OB({onClose:e}){const{data:t,isLoading:n}=he({queryKey:["activity"],queryFn:MB,refetchInterval:2e3});return a.jsxs("div",{className:"flex flex-col h-full bg-surface-raised border-l border-divider",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(no,{className:"w-5 h-5 text-blue-400"}),a.jsx("h2",{className:"font-medium text-content",children:"Activity Log"})]}),a.jsx("button",{onClick:e,className:"text-content-subtle hover:text-content p-1",children:a.jsx(mt,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:n?a.jsx("div",{className:"flex items-center justify-center h-32 text-content-subtle",children:a.jsx(je,{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-content-muted",children:[a.jsx(no,{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(r=>a.jsxs("div",{className:"p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(AB,{status:r.status}),a.jsx("code",{className:"text-sm text-content font-mono flex-1 truncate",children:r.command}),a.jsx("span",{className:"text-xs text-content-muted",children:LB(r.timestamp)})]}),a.jsx("pre",{className:"bg-surface rounded p-2 text-xs text-content-body font-mono overflow-x-auto max-h-96 overflow-y-auto",children:r.output.length>0?r.output.join(`
538
- `):r.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 ${r.status==="running"?"bg-blue-900/50 text-blue-400":r.status==="completed"?"bg-green-900/50 text-green-400":"bg-red-900/50 text-red-400"}`,children:r.status})})]},r.id))})})]})}async function IB(){const e=await fetch("/api/convoys");if(!e.ok)throw new Error("Failed to fetch convoys");return(await e.json()).convoys}async function BB(e){const t=await fetch(`/api/convoys/${e}`);if(!t.ok)throw new Error("Failed to fetch convoy status");return t.json()}async function FB(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 zB(){return he({queryKey:["convoys"],queryFn:IB,refetchInterval:5e3})}function $B(e){return he({queryKey:["convoy",e],queryFn:()=>BB(e),enabled:!!e,refetchInterval:2e3})}function HB(e){return he({queryKey:["convoy-output",e],queryFn:()=>FB(e),enabled:!!e,refetchInterval:5e3})}function u2({status:e}){switch(e){case"running":return a.jsx(je,{className:"w-4 h-4 text-blue-400 animate-spin"});case"completed":return a.jsx(mi,{className:"w-4 h-4 text-green-400"});case"failed":return a.jsx(wc,{className:"w-4 h-4 text-red-400"});case"partial":return a.jsx(to,{className:"w-4 h-4 text-yellow-400"})}}function WB({status:e}){const t={pending:"bg-surface/50 text-content-subtle",running:"bg-blue-900/50 text-blue-400",completed:"bg-green-900/50 text-green-400",failed:"bg-red-900/50 text-red-400"};return a.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${t[e]||t.pending}`,children:e})}function yg(e){return new Date(e).toLocaleString()}function d2(e,t){const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),s=Math.floor((r-n)/1e3),i=Math.floor(s/3600),o=Math.floor(s%3600/60),l=s%60;return i>0?`${i}h ${o}m ${l}s`:o>0?`${o}m ${l}s`:`${l}s`}function UB({convoy:e}){const{data:t}=HB(e.id);return a.jsxs("div",{className:"border-t border-divider p-4 bg-surface/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-content-muted",children:"Template:"}),a.jsx("span",{className:"ml-2 text-content",children:e.template})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-content-muted",children:"Duration:"}),a.jsx("span",{className:"ml-2 text-content",children:d2(e.startedAt,e.completedAt)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-content-muted",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(gs,{className:"w-3 h-3"})]})]}),e.context.prUrl&&a.jsxs("div",{children:[a.jsx("span",{className:"text-content-muted",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(gs,{className:"w-3 h-3"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-medium text-content mb-2",children:"Agents"}),e.agents.map(n=>a.jsxs("div",{className:"bg-surface-raised 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(u2,{status:n.status}),a.jsx("span",{className:"font-medium text-content",children:n.role}),a.jsxs("span",{className:"text-xs text-content-muted",children:["(",n.subagent,")"]})]}),a.jsx(WB,{status:n.status})]}),n.startedAt&&a.jsxs("div",{className:"text-xs text-content-muted mb-1",children:["Started: ",yg(n.startedAt),n.completedAt&&` • Completed: ${yg(n.completedAt)}`]}),n.status==="running"&&a.jsxs("div",{className:"text-xs text-content-muted",children:["Tmux: ",a.jsx("code",{className:"text-content-subtle",children:n.tmuxSession})]}),n.status==="completed"&&t&&t[n.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-surface rounded p-2 text-content-body font-mono overflow-x-auto max-h-64 overflow-y-auto",children:[t[n.role].substring(0,1e3),t[n.role].length>1e3&&`
539
- ... (truncated)`]})]})})]},n.role))]})]})}function qB({onClose:e}){const{data:t,isLoading:n}=zB(),[r,s]=x.useState(null),{data:i}=$B(r||void 0),o=i||r&&(t==null?void 0:t.find(l=>l.id===r));return a.jsxs("div",{className:"flex flex-col h-full bg-surface-raised border-l border-divider",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ec,{className:"w-5 h-5 text-purple-400"}),a.jsx("h2",{className:"font-medium text-content",children:"Convoys"}),t&&t.length>0&&a.jsxs("span",{className:"text-xs text-content-muted",children:["(",t.length,")"]})]}),a.jsx("button",{onClick:e,className:"text-content-subtle hover:text-content p-1",children:a.jsx(mt,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:n?a.jsx("div",{className:"flex items-center justify-center h-32 text-content-subtle",children:a.jsx(je,{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-content-muted",children:[a.jsx(ec,{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:()=>s(r===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(u2,{status:l.status}),a.jsx("code",{className:"text-sm text-content font-mono flex-1 truncate",children:l.id}),a.jsx("span",{className:"text-xs text-content-muted",children:d2(l.startedAt,l.completedAt)})]}),a.jsxs("div",{className:"flex items-center gap-3 text-xs text-content-subtle mb-2",children:[a.jsx("span",{className:"text-purple-400",children:l.template}),a.jsx("span",{children:"•"}),a.jsxs("span",{children:[l.agents.filter(c=>c.status==="completed").length,"/",l.agents.length," agents"]}),a.jsx("span",{children:"•"}),a.jsx("span",{children:yg(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})})]}),r===l.id&&o&&a.jsx(UB,{convoy:o})]},l.id))})})]})}async function KB(){const e=await fetch("/api/cloister/status");if(!e.ok)throw new Error("Failed to fetch Cloister status");return e.json()}async function VB(){const e=await fetch("/api/cloister/config");if(!e.ok)throw new Error("Failed to fetch Cloister config");return e.json()}async function YB(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 QB(){if(!(await fetch("/api/cloister/start",{method:"POST"})).ok)throw new Error("Failed to start Cloister")}async function XB(){if(!(await fetch("/api/cloister/stop",{method:"POST"})).ok)throw new Error("Failed to stop Cloister")}async function GB(){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 JB(){const[e,t]=x.useState(!1),[n,r]=x.useState(!1),[s,i]=x.useState(!1),o=dn(),{data:l,refetch:c}=he({queryKey:["cloister-status"],queryFn:KB,refetchInterval:1e4}),{data:u}=he({queryKey:["cloister-config"],queryFn:VB}),h=we({mutationFn:YB,onSuccess:()=>{o.invalidateQueries({queryKey:["cloister-config"]})}}),d=async()=>{i(!0);try{l!=null&&l.running?await XB():await QB(),await c()}finally{i(!1)}},p=async()=>{await GB(),t(!1),c()},f=()=>{u&&h.mutate({startup:{auto_start:!u.startup.auto_start}})};if(!l)return null;const m=l.summary.warning>0||l.summary.stuck>0,g=l.agentsNeedingAttention.length;return a.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[a.jsx("div",{className:"flex items-center gap-1",title:l.running?"Cloister: Running":"Cloister: Stopped",children:l.running?a.jsx(lk,{className:"w-3.5 h-3.5 text-green-400"}):a.jsx(AR,{className:"w-3.5 h-3.5 text-content-muted"})}),l.running&&l.summary.total>0&&a.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[l.summary.active>0&&a.jsx("span",{className:"text-green-400",children:l.summary.active}),l.summary.warning>0&&a.jsx("span",{className:"text-orange-400",children:l.summary.warning}),l.summary.stuck>0&&a.jsx("span",{className:"text-red-400",children:l.summary.stuck})]}),m&&a.jsx("span",{title:`${g} agent${g!==1?"s":""} need attention`,children:a.jsx(Wn,{className:"w-3.5 h-3.5 text-orange-400"})}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:d,disabled:s,className:`px-2 py-0.5 rounded text-xs transition-colors ${s?"bg-surface-emphasis text-content-subtle cursor-wait":l.running?"bg-surface-overlay text-content-body hover:bg-surface-emphasis":"bg-blue-600 text-content hover:bg-blue-700"}`,children:s?(l.running,"..."):l.running?"Pause":"Start"}),e?a.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 bg-red-600/20 rounded border border-red-600/30",children:[a.jsx("span",{className:"text-xs text-red-300",children:"Kill all?"}),a.jsx("button",{onClick:p,className:"px-1.5 py-0.5 rounded text-xs bg-red-600 text-content hover:bg-red-700",children:"Yes"}),a.jsx("button",{onClick:()=>t(!1),className:"px-1.5 py-0.5 rounded text-xs bg-surface-overlay text-content-body hover:bg-surface-emphasis",children:"No"})]}):a.jsx("button",{onClick:()=>t(!0),className:"p-1 rounded text-xs bg-red-600/20 text-red-400 border border-red-600/30 hover:bg-red-600/30 transition-colors",title:"Emergency stop - kill all agents",children:a.jsx(BR,{className:"w-3.5 h-3.5"})}),a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>r(!n),className:`p-1 rounded text-xs transition-colors ${n?"bg-surface-emphasis text-content":"bg-surface-overlay text-content-body hover:bg-surface-emphasis"}`,title:"Cloister settings",children:a.jsx(xk,{className:"w-3.5 h-3.5"})}),n&&a.jsx("div",{className:"absolute right-0 top-full mt-2 w-56 bg-surface-raised border border-divider rounded-lg shadow-lg z-50",children:a.jsxs("div",{className:"p-3",children:[a.jsx("div",{className:"text-xs text-content-subtle font-medium mb-2",children:"Settings"}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer hover:bg-surface-overlay/50 rounded px-2 py-1.5 -mx-2",children:[a.jsx("input",{type:"checkbox",checked:(u==null?void 0:u.startup.auto_start)??!0,onChange:f,disabled:h.isPending,className:"w-4 h-4 rounded border-divider-strong bg-surface-overlay text-blue-500 focus:ring-blue-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-sm text-content-body",children:"Auto-start on dashboard launch"})]})]})})]})]})]})}function xb(e){const t=new Date(e),n=t.toLocaleString("default",{month:"short"}),r=t.getDate(),s=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0"),o=t.getSeconds().toString().padStart(2,"0");return`${n} ${r}, ${s}:${i}:${o}`}async function ZB(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 eF(){const e=await fetch("/api/handoffs/stats");if(!e.ok)throw new Error("Failed to fetch handoff stats");return e.json()}async function tF(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 nF(){const e=await fetch("/api/specialist-handoffs/stats");if(!e.ok)throw new Error("Failed to fetch specialist handoff stats");return e.json()}const yb={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"},rF={stuck_escalation:"Stuck Escalation",planning_complete:"Planning Complete",test_failure:"Test Failure",task_complete:"Task Complete",manual:"Manual"},sF={stuck_escalation:"text-red-400",planning_complete:"text-green-400",test_failure:"text-orange-400",task_complete:"text-blue-400",manual:"text-content-subtle"},_b={"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"},iF={queued:"text-yellow-400",processing:"text-blue-400",completed:"text-green-400",failed:"text-red-400"},oF={urgent:"text-red-400",high:"text-orange-400",normal:"text-blue-400",low:"text-content-subtle"};function aF(){var c,u,h,d,p;const{data:e,isLoading:t}=he({queryKey:["handoffs"],queryFn:()=>ZB(50),refetchInterval:1e4}),{data:n,isLoading:r}=he({queryKey:["handoff-stats"],queryFn:eF,refetchInterval:3e4}),{data:s,isLoading:i}=he({queryKey:["specialist-handoffs"],queryFn:()=>tF(50),refetchInterval:1e4}),{data:o,isLoading:l}=he({queryKey:["specialist-handoff-stats"],queryFn:nF,refetchInterval:3e4});return t||r||i||l?a.jsx("div",{className:"p-6",children:a.jsx("div",{className:"text-content-subtle",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-content mb-2",children:"Model Handoffs"}),a.jsx("p",{className:"text-content-subtle",children:"History of automatic and manual model handoffs across agents"})]}),n&&a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Total Handoffs"}),a.jsx("div",{className:"text-2xl font-bold text-content",children:n.totalHandoffs})]}),a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Success Rate"}),a.jsxs("div",{className:"text-2xl font-bold text-green-400",children:[(n.successRate*100).toFixed(0),"%"]})]}),a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Most Common Trigger"}),a.jsx("div",{className:"text-sm font-medium text-content",children:((c=Object.entries(n.byTrigger).sort((f,m)=>m[1]-f[1])[0])==null?void 0:c[0])||"N/A"}),a.jsxs("div",{className:"text-xs text-content-muted",children:[((u=Object.entries(n.byTrigger).sort((f,m)=>m[1]-f[1])[0])==null?void 0:u[1])||0," times"]})]}),a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Most Popular Target"}),a.jsx("div",{className:"text-sm font-medium text-content",children:((h=Object.entries(n.byModel.to).sort((f,m)=>m[1]-f[1])[0])==null?void 0:h[0])||"N/A"}),a.jsxs("div",{className:"text-xs text-content-muted",children:[((d=Object.entries(n.byModel.to).sort((f,m)=>m[1]-f[1])[0])==null?void 0:d[1])||0," handoffs"]})]})]}),a.jsxs("div",{className:"bg-surface-raised rounded-lg border border-divider overflow-hidden",children:[a.jsx("div",{className:"p-4 border-b border-divider",children:a.jsx("h3",{className:"text-lg font-semibold text-content",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-content-subtle",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((f,m)=>a.jsxs("tr",{className:"border-t border-divider hover:bg-gray-750",children:[a.jsx("td",{className:"px-4 py-3 text-content-subtle",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(xa,{className:"w-3 h-3"}),xb(f.timestamp)]})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"font-medium text-content",children:f.agentId}),a.jsx("div",{className:"text-xs text-content-muted",children:f.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 ${yb[f.from.model]||"text-content-subtle bg-surface-overlay"}`,children:f.from.model}),a.jsx(xm,{className:"w-3 h-3 text-content-muted"}),a.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${yb[f.to.model]||"text-content-subtle bg-surface-overlay"}`,children:f.to.model})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`text-xs ${sF[f.trigger]||"text-content-subtle"}`,children:rF[f.trigger]||f.trigger})}),a.jsx("td",{className:"px-4 py-3 text-content-body max-w-xs truncate",children:f.reason}),a.jsx("td",{className:"px-4 py-3 text-emerald-400",children:f.context.costAtHandoff!==void 0?`$${f.context.costAtHandoff.toFixed(4)}`:"-"}),a.jsx("td",{className:"px-4 py-3",children:f.success?a.jsx("span",{className:"text-green-400 text-xs",children:"✓ Success"}):a.jsx("span",{className:"text-red-400 text-xs",title:f.errorMessage,children:"✗ Failed"})})]},`${f.timestamp}-${m}`)):a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-content-muted",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-content mb-2",children:"Specialist Handoffs"}),a.jsx("p",{className:"text-content-subtle",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-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Today's Handoffs"}),a.jsx("div",{className:"text-2xl font-bold text-content",children:o.todayCount})]}),a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle 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-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle 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-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Most Active"}),a.jsx("div",{className:"text-sm font-medium text-content",children:((p=Object.entries(o.bySpecialist).map(([f,m])=>({name:f,total:m.sent+m.received})).sort((f,m)=>m.total-f.total)[0])==null?void 0:p.name)||"N/A"})]})]}),a.jsxs("div",{className:"bg-surface-raised rounded-lg border border-divider overflow-hidden mt-6",children:[a.jsx("div",{className:"p-4 border-b border-divider",children:a.jsx("h3",{className:"text-lg font-semibold text-content",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-content-subtle",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:s&&s.handoffs.length>0?s.handoffs.map(f=>{var m,g;return a.jsxs("tr",{className:"border-t border-divider hover:bg-gray-750",children:[a.jsx("td",{className:"px-4 py-3 text-content-subtle",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(xa,{className:"w-3 h-3"}),xb(f.timestamp)]})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"font-medium text-content",children:f.issueId}),((m=f.context)==null?void 0:m.branch)&&a.jsx("div",{className:"text-xs text-content-muted",children:f.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 ${_b[f.fromSpecialist]||"text-content-subtle bg-surface-overlay"}`,children:f.fromSpecialist}),a.jsx(xm,{className:"w-3 h-3 text-content-muted"}),a.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${_b[f.toSpecialist]||"text-content-subtle bg-surface-overlay"}`,children:f.toSpecialist})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`text-xs ${oF[f.priority]}`,children:f.priority})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:`text-xs ${iF[f.status]}`,children:f.status}),f.result&&a.jsxs("span",{className:"ml-2 text-xs text-content-muted",children:["(",f.result,")"]})]}),a.jsx("td",{className:"px-4 py-3 text-content-subtle text-xs",children:((g=f.context)==null?void 0:g.workspace)||"-"})]},f.id)}):a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-content-muted",children:"No specialist handoffs recorded yet"})})})]})})]})]})]})}function lF({request:e,isOpen:t,onConfirm:n,onDeny:r,onClose:s}){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-surface-raised border border-divider 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-divider",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Wn,{className:"w-5 h-5 text-orange-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Confirmation Required"})]}),a.jsx("button",{onClick:s,className:"text-content-subtle hover:text-content-body transition-colors",children:a.jsx(mt,{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-content-subtle mb-1",children:"Agent:"}),a.jsx("p",{className:"text-base text-content font-medium",children:e.agentId})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-content-subtle mb-1",children:"Action:"}),a.jsx("p",{className:"text-base text-content font-medium",children:e.action})]}),e.details&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-content-subtle mb-1",children:"Details:"}),a.jsx("p",{className:"text-sm text-content-body bg-surface/50 p-2 rounded border border-divider",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-divider bg-surface/30",children:[a.jsx("button",{onClick:r,className:"px-4 py-2 rounded text-sm bg-surface-overlay text-content-body hover:bg-surface-emphasis transition-colors",children:"Deny"}),a.jsx("button",{onClick:n,className:"px-4 py-2 rounded text-sm bg-orange-600 text-content hover:bg-orange-700 transition-colors font-medium",children:"Confirm"})]})]})})}async function cF(){const e=await fetch("/api/metrics/summary");if(!e.ok)throw new Error("Failed to fetch metrics summary");return e.json()}async function uF(){const e=await fetch("/api/handoffs/stats");if(!e.ok)throw new Error("Failed to fetch handoff stats");return e.json()}async function dF(){const e=await fetch("/api/specialist-handoffs/stats");if(!e.ok)throw new Error("Failed to fetch specialist handoff stats");return e.json()}function hF(){const{data:e}=he({queryKey:["metrics-summary"],queryFn:cF,refetchInterval:3e4}),{data:t}=he({queryKey:["handoff-stats"],queryFn:uF,refetchInterval:3e4}),{data:n}=he({queryKey:["specialist-handoff-stats"],queryFn:dF,refetchInterval:3e4});if(!e)return null;const r=t?Object.values(t.byTrigger).reduce((s,i)=>s+i,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-surface-raised border border-divider 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(uo,{className:"w-5 h-5 text-green-400"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Cost Today"})]})}),a.jsxs("div",{className:"text-2xl font-bold text-content",children:["$",e.today.totalCost.toFixed(2)]}),e.topSpenders.agents.length>0&&a.jsxs("div",{className:"mt-2 text-xs text-content-muted",children:["Top: ",e.topSpenders.agents[0].agentId," ($",e.topSpenders.agents[0].cost.toFixed(2),")"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider 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(ec,{className:"w-5 h-5 text-blue-400"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Agents"})]})}),a.jsxs("div",{className:"text-2xl font-bold text-content",children:[e.today.activeCount," / ",e.today.agentCount]}),a.jsxs("div",{className:"mt-2 text-xs text-content-muted",children:[e.today.activeCount," active, ",e.today.agentCount-e.today.activeCount," ","idle"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider 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(Wn,{className:"w-5 h-5 text-red-400"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Stuck Agents"})]})}),a.jsx("div",{className:"text-2xl font-bold text-content",children:e.today.stuckCount}),a.jsxs("div",{className:"mt-2 text-xs text-content-muted",children:[e.today.warningCount," warnings"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider 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(pk,{className:"w-5 h-5 text-cyan-400"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Specialist Handoffs"})]})}),a.jsx("div",{className:"text-2xl font-bold text-content",children:(n==null?void 0:n.todayCount)??0}),a.jsx("div",{className:"mt-2 text-xs text-content-muted",children:n?`${(n.successRate*100).toFixed(0)}% success rate`:"No data"})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider 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(qv,{className:"w-5 h-5 text-purple-400"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Cost Escalations"})]})}),a.jsx("div",{className:"text-2xl font-bold text-content",children:r}),a.jsx("div",{className:"mt-2 text-xs text-content-muted",children:t?`${(t.successRate*100).toFixed(0)}% success rate`:"No data"})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider 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(mk,{className:"w-5 h-5 text-orange-400"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Queue Depth"})]})}),a.jsx("div",{className:"text-2xl font-bold text-content",children:(n==null?void 0:n.queueDepth)??0}),a.jsx("div",{className:"mt-2 text-xs text-content-muted",children:(n==null?void 0:n.queueDepth)===0?"All clear":`${n==null?void 0:n.queueDepth} pending`})]})]})}async function fF(){const e=await fetch("/api/metrics/summary");if(!e.ok)throw new Error("Failed to fetch metrics summary");return e.json()}async function pF(){const e=await fetch("/api/metrics/costs");if(!e.ok)throw new Error("Failed to fetch cost metrics");return e.json()}function mF(){const{data:e}=he({queryKey:["metrics-summary"],queryFn:fF,refetchInterval:3e4}),{data:t}=he({queryKey:["metrics-costs"],queryFn:pF,refetchInterval:3e4});return a.jsxs("div",{className:"p-6 overflow-auto h-full",children:[a.jsx("h1",{className:"text-3xl font-bold text-content 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-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(uo,{className:"w-6 h-6 text-green-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Cost Today"})]}),a.jsxs("div",{className:"text-3xl font-bold text-content mb-2",children:["$",e.today.totalCost.toFixed(2)]}),a.jsx("div",{className:"text-sm text-content-subtle",children:"Daily total"})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(qv,{className:"w-6 h-6 text-blue-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Active Agents"})]}),a.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:e.today.activeCount}),a.jsxs("div",{className:"text-sm text-content-subtle",children:["of ",e.today.agentCount," total"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(Wn,{className:"w-6 h-6 text-red-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Stuck Agents"})]}),a.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:e.today.stuckCount}),a.jsxs("div",{className:"text-sm text-content-subtle",children:[e.today.warningCount," warnings"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx($v,{className:"w-6 h-6 text-purple-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Handoffs Today"})]}),a.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:"-"}),a.jsx("div",{className:"text-sm text-content-subtle",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-surface-raised border border-divider rounded-lg p-6",children:[a.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Top Agents by Cost"}),a.jsxs("div",{className:"space-y-3",children:[t.topAgents.slice(0,10).map((n,r)=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-surface/50 rounded",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"text-lg font-bold text-content-muted",children:["#",r+1]}),a.jsx("span",{className:"text-content font-mono text-sm",children:n.agentId})]}),a.jsxs("span",{className:"text-green-400 font-semibold",children:["$",n.cost.toFixed(2)]})]},n.agentId)),t.topAgents.length===0&&a.jsx("div",{className:"text-center text-content-muted py-8",children:"No cost data yet"})]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Top Issues by Cost"}),a.jsxs("div",{className:"space-y-3",children:[t.topIssues.slice(0,10).map((n,r)=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-surface/50 rounded",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"text-lg font-bold text-content-muted",children:["#",r+1]}),a.jsx("span",{className:"text-content font-mono text-sm",children:n.issueId})]}),a.jsxs("span",{className:"text-green-400 font-semibold",children:["$",n.cost.toFixed(2)]})]},n.issueId)),t.topIssues.length===0&&a.jsx("div",{className:"text-center text-content-muted py-8",children:"No cost data yet"})]})]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Historical Trends"}),a.jsxs("div",{className:"text-center text-content-muted 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"})]})]})]})}async function gF(){const e=await fetch("/api/costs/by-issue");if(!e.ok)throw new Error("Failed to fetch costs");return e.json()}function vF(){const[e,t]=x.useState(null),{data:n,isLoading:r}=he({queryKey:["costs-by-issue"],queryFn:gF,refetchInterval:1e4});if(r)return a.jsx("div",{className:"p-6 h-full flex items-center justify-center",children:a.jsx("div",{className:"text-content-subtle",children:"Loading costs..."})});if(!n)return a.jsx("div",{className:"p-6 h-full flex items-center justify-center",children:a.jsx("div",{className:"text-red-400",children:"Failed to load costs"})});const s=n.issues.reduce((c,u)=>c+u.totalCost,0),i=n.issues.filter(c=>c.budget),o=i.filter(c=>c.totalCost>(c.budget||0)),l=e?n.issues.find(c=>c.issueId===e):null;return a.jsxs("div",{className:"p-6 overflow-auto h-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h1",{className:"text-3xl font-bold text-content",children:"Cost Tracking"}),a.jsx("div",{className:"flex items-center gap-3",children:a.jsx("div",{className:`px-3 py-1 rounded text-sm ${n.status==="live"?"bg-green-900/30 text-green-400":n.status==="migrating"?"bg-yellow-900/30 text-yellow-400":"bg-red-900/30 text-red-400"}`,children:n.status==="live"?"● Live":n.status==="migrating"?"⟳ Migrating":"⚠ Stale"})})]}),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-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(uo,{className:"w-6 h-6 text-green-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Total Cost"})]}),a.jsxs("div",{className:"text-3xl font-bold text-content mb-2",children:["$",s.toFixed(2)]}),a.jsxs("div",{className:"text-sm text-content-subtle",children:[n.issues.length," issues tracked"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(qv,{className:"w-6 h-6 text-blue-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Event Count"})]}),a.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:n.eventCount.toLocaleString()}),a.jsx("div",{className:"text-sm text-content-subtle",children:"Total events logged"})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(Wn,{className:"w-6 h-6 text-yellow-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Budget Warnings"})]}),a.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:n.issues.filter(c=>c.budgetWarning).length}),a.jsxs("div",{className:"text-sm text-content-subtle",children:[i.length," with budgets"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(ZR,{className:"w-6 h-6 text-purple-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Over Budget"})]}),a.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:o.length}),a.jsx("div",{className:"text-sm text-content-subtle",children:"Exceeded limit"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Costs by Issue"}),a.jsx("div",{className:"space-y-2 max-h-[600px] overflow-auto",children:n.issues.map(c=>{const u=c.budget?c.totalCost/c.budget*100:0;return a.jsxs("div",{onClick:()=>t(c.issueId),className:`p-4 rounded-lg cursor-pointer transition-colors ${e===c.issueId?"bg-blue-900/30 border border-blue-500":"bg-surface/50 hover:bg-surface"}`,children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-content font-mono font-semibold",children:c.issueId}),c.budgetWarning&&a.jsx(Wn,{className:"w-4 h-4 text-yellow-400"})]}),a.jsxs("span",{className:"text-green-400 font-bold",children:["$",c.totalCost.toFixed(2)]})]}),c.budget&&a.jsxs("div",{className:"mb-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-content-subtle mb-1",children:[a.jsxs("span",{children:["Budget: $",c.budget.toFixed(2)]}),a.jsxs("span",{children:[u.toFixed(0),"%"]})]}),a.jsx("div",{className:"w-full bg-surface-overlay rounded-full h-2",children:a.jsx("div",{className:`h-2 rounded-full transition-all ${u>=100?"bg-red-500":u>=80?"bg-yellow-500":"bg-green-500"}`,style:{width:`${Math.min(u,100)}%`}})})]}),a.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-subtle",children:[a.jsxs("span",{children:[c.tokenCount.toLocaleString()," tokens"]}),a.jsxs("span",{children:[Object.keys(c.models).length," models"]})]})]},c.issueId)})})]}),a.jsx("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:l?a.jsxs(a.Fragment,{children:[a.jsxs("h3",{className:"text-xl font-semibold text-content mb-4",children:[l.issueId," Details"]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-content-subtle mb-3",children:"Token Usage"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[a.jsx("div",{className:"text-xs text-content-subtle",children:"Input"}),a.jsx("div",{className:"text-lg font-semibold text-content",children:l.inputTokens.toLocaleString()})]}),a.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[a.jsx("div",{className:"text-xs text-content-subtle",children:"Output"}),a.jsx("div",{className:"text-lg font-semibold text-content",children:l.outputTokens.toLocaleString()})]}),a.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[a.jsx("div",{className:"text-xs text-content-subtle",children:"Cache Read"}),a.jsx("div",{className:"text-lg font-semibold text-content",children:l.cacheReadTokens.toLocaleString()})]}),a.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[a.jsx("div",{className:"text-xs text-content-subtle",children:"Cache Write"}),a.jsx("div",{className:"text-lg font-semibold text-content",children:l.cacheWriteTokens.toLocaleString()})]})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-content-subtle mb-3",children:"By Model"}),a.jsx("div",{className:"space-y-2",children:Object.entries(l.models).map(([c,u])=>a.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-sm text-content font-mono",children:c}),a.jsxs("span",{className:"text-sm text-green-400 font-semibold",children:["$",u.cost.toFixed(4)]})]}),a.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-subtle",children:[a.jsxs("span",{children:[u.calls," calls"]}),a.jsxs("span",{children:[u.tokens.toLocaleString()," tokens"]})]})]},c))})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-content-subtle mb-3",children:"By Provider"}),a.jsx("div",{className:"space-y-2",children:Object.entries(l.providers).filter(([c,u])=>u>0).map(([c,u])=>a.jsx("div",{className:"bg-surface/50 rounded p-3",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-content capitalize",children:c}),a.jsxs("span",{className:"text-sm text-green-400 font-semibold",children:["$",u.toFixed(4)]})]})},c))})]})]}):a.jsx("div",{className:"h-full flex items-center justify-center text-content-muted",children:"Select an issue to view details"})})]})]})}const Sx={anthropic:{name:"Anthropic",models:[{id:"claude-opus-4-6",name:"Claude Opus 4.6",icon:"diamond",tier:"premium",capabilities:["reasoning","code","vision","agentic"],description:"Most capable, best for complex tasks"},{id:"claude-sonnet-4-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:"balanced",capabilities:["reasoning","code","agentic","large-context"],description:"Strong coding, 128K context"},{id:"kimi-k2.5",name:"Kimi K2.5",icon:"model_training",tier:"premium",capabilities:["reasoning","code","agentic","large-context"],description:"Best open-source coding model, 256K context"}]},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"}]}},kx={"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"]},xF={"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"},Fs={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 yF(){return Object.values(Sx).flatMap(e=>e.models)}function h2(e){const t=yF(),n=t.find(s=>s.id===e);if(n)return n;const r=e.toLowerCase();if(r.includes("opus")&&r.includes("4"))return t.find(s=>s.id==="claude-opus-4-6");if(r.includes("sonnet")&&r.includes("4"))return t.find(s=>s.id==="claude-sonnet-4-5");if(r.includes("haiku"))return t.find(s=>s.id==="claude-haiku-4-5");if(r.includes("claude")&&!r.includes("opus")&&!r.includes("haiku"))return t.find(s=>s.id==="claude-sonnet-4-5");if(r.includes("gpt-4o")||r==="gpt4o")return t.find(s=>s.id==="gpt-4o");if(r.includes("o1")&&!r.includes("o3"))return t.find(s=>s.id==="o1");if(r.includes("o3"))return t.find(s=>s.id==="o3-mini");if(r.includes("gemini")&&r.includes("flash"))return t.find(s=>s.id==="gemini-2.5-flash");if(r.includes("gemini"))return t.find(s=>s.id==="gemini-2.5-pro");if(r.includes("kimi")||r.includes("moonshot"))return r.includes("k2.5")||r.includes("2.5")?t.find(s=>s.id==="kimi-k2.5"):t.find(s=>s.id==="kimi-k2");if(r.includes("glm")||r.includes("zhipu")||r.includes("chatglm"))return r.includes("flash")?t.find(s=>s.id==="glm-4-flash"):r.includes("air")?t.find(s=>s.id==="glm-4-air"):r.includes("long")||r.includes("1m")?t.find(s=>s.id==="glm-4-long"):t.find(s=>s.id==="glm-4-plus")}function _F(e,t){const n=h2(e),r=kx[t]||["reasoning"];if(!n)return{score:0,matched:[],missing:r};const s=r.filter(o=>n.capabilities.includes(o)),i=r.filter(o=>!n.capabilities.includes(o));return{score:r.length>0?s.length/r.length:0,matched:s,missing:i}}function bF({workType:e,currentModel:t,isOverride:n,enabledProviders:r,onApply:s,onRemove:i,onClose:o}){const[l,c]=x.useState(t),u=xF[e]||e,h=kx[e]||["reasoning"],d=x.useMemo(()=>Object.entries(Sx).filter(([g])=>g==="anthropic"||r.includes(g)),[r]),p=x.useMemo(()=>{let g=null;for(const[w,v]of d)for(const y of v.models){const b=y.capabilities.filter(j=>h.includes(j)).length/h.length,N=y.tier==="balanced"?.1:0,k=b+N;(!g||k>g.score)&&(g={id:y.id,score:k})}return g==null?void 0:g.id},[d,h]),f=()=>{s(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-surface border border-divider rounded-xl shadow-2xl flex flex-col overflow-hidden",children:[a.jsx("div",{className:"p-6 border-b border-divider",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-content tracking-tight text-2xl font-bold",children:"Select Model"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-content-muted text-sm",children:"Task:"}),a.jsx("span",{className:"text-blue-400 font-medium",children:u})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("span",{className:"text-content-muted text-xs",children:"Needs:"}),h.map(g=>a.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded bg-blue-500/20 text-blue-300 font-medium",children:Fs[g].name},g))]})]}),a.jsx("button",{onClick:o,className:"text-content-muted hover:text-content 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(([g,w],v)=>a.jsxs("div",{className:"flex flex-col",children:[v>0&&a.jsx("div",{className:"h-px bg-divider mx-6 my-2"}),a.jsx("h3",{className:"text-content-muted text-xs font-bold uppercase tracking-widest px-6 pb-2 pt-5",children:w.name}),w.models.map(y=>{const _=l===y.id,b=y.id===p,N=y.capabilities.filter(j=>h.includes(j)),k=N.length/h.length;return a.jsxs("div",{onClick:()=>c(y.id),title:y.description,className:`group flex items-center gap-4 px-6 py-3.5 cursor-pointer transition-all border-l-2 ${_?"bg-blue-500/10 border-blue-400 shadow-[0_0_15px_rgba(59,130,246,0.1)]":b?"bg-blue-500/5 border-blue-400/50 hover:bg-blue-500/10":"border-transparent hover:bg-surface-overlay"}`,children:[a.jsx("div",{className:`flex items-center justify-center rounded-lg shrink-0 size-10 transition-colors ${_||b?"bg-blue-500/20":"bg-surface-emphasis group-hover:bg-divider"}`,children:a.jsx("span",{className:`material-symbols-outlined text-xl ${_||b?"text-blue-400":"text-content-muted"}`,children:y.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-content text-sm ${_?"font-bold":"font-medium"} truncate`,children:y.name}),b&&a.jsx("span",{className:"px-2 py-0.5 rounded-full bg-blue-500 text-[9px] text-content font-bold uppercase tracking-tight shrink-0",children:"Best Fit"}),y.tier==="premium"&&!b&&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"}),y.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:y.capabilities.map(j=>{const D=N.includes(j);return a.jsx("span",{title:Fs[j].description,className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${D?"bg-blue-500/20 text-blue-300":"bg-surface-emphasis text-content-subtle border border-divider"}`,children:Fs[j].name},j)})})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[k===1?a.jsx("span",{className:"text-emerald-400 text-xs font-bold",children:"100%"}):k>=.5?a.jsxs("span",{className:"text-amber-400 text-xs font-bold",children:[Math.round(k*100),"%"]}):a.jsxs("span",{className:"text-content-muted text-xs font-bold",children:[Math.round(k*100),"%"]}),_&&a.jsx("span",{className:"material-symbols-outlined text-blue-400",children:"check_circle"})]})]},y.id)})]},g))}),a.jsxs("div",{className:"p-5 border-t border-divider bg-surface flex justify-between items-center",children:[a.jsx("div",{children:n&&a.jsx("button",{onClick:()=>{i(),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-content-muted font-medium hover:text-content hover:bg-surface-overlay transition-all text-sm",children:"Cancel"}),a.jsx("button",{onClick:f,disabled:!m&&n,className:"px-6 py-2 rounded-lg bg-blue-500 text-content font-bold hover:bg-blue-400 active:scale-95 transition-all shadow-lg shadow-blue-500/20 disabled:opacity-50 disabled:cursor-not-allowed text-sm",children:"Apply Selection"})]})]})]}),a.jsx("style",{children:`
540
- .custom-scrollbar::-webkit-scrollbar {
541
- width: 4px;
542
- }
543
- .custom-scrollbar::-webkit-scrollbar-track {
544
- background: transparent;
545
- }
546
- .custom-scrollbar::-webkit-scrollbar-thumb {
547
- background: var(--color-overlay);
548
- border-radius: 10px;
549
- }
550
- .custom-scrollbar::-webkit-scrollbar-thumb:hover {
551
- background: #3b82f6;
552
- }
553
- `})]})}async function wF(){const e=await fetch("/api/settings");if(!e.ok)throw new Error("Failed to fetch settings");return e.json()}async function SF(e){const t=await fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.text();throw new Error(n||"Failed to save settings")}}async function kF(){const e=await fetch("/api/settings/optimal-defaults");if(!e.ok)throw new Error("Failed to fetch optimal defaults");return e.json()}async function bb(e,t,n){const r=await fetch("/api/settings/test-api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,apiKey:t,model:n})});if(!r.ok)throw new Error("Failed to test API key");return r.json()}const Wf=[{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-..."}],wb=[{id:"linear",name:"Linear",icon:"view_kanban",envVar:"LINEAR_API_KEY",placeholder:"lin_api_..."},{id:"github",name:"GitHub",icon:"code",envVar:"GITHUB_TOKEN",placeholder:"ghp_..."},{id:"gitlab",name:"GitLab",icon:"commit",envVar:"GITLAB_TOKEN",placeholder:"glpat-..."},{id:"rally",name:"Rally",icon:"flag",envVar:"RALLY_API_KEY",placeholder:"_abc123..."}],CF=[{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"},{id:"status-review",name:"Status Review",icon:"assessment",description:"AI status reviews (executive-facing)"}]},{name:"CLI Modes",icon:"terminal",agents:[{id:"cli:interactive",name:"Interactive",icon:"chat",description:"Conversation mode"},{id:"cli:quick-command",name:"Quick Command",icon:"bolt",description:"One-shot queries"}]}],Sb="claude-sonnet-4-5";function NF(e){const t=h2(e);return t?t.name:e.includes("claude")?e.includes("opus")?"Opus 4.6":e.includes("haiku")?"Haiku":"Sonnet 4.5":e.includes("gpt")?"GPT-4o":e.includes("gemini")?e.includes("flash")?"Gemini Flash":"Gemini Pro":e.includes("kimi")?e.includes("k2.5")||e.includes("2.5")?"Kimi K2.5":"Kimi K2":e.includes("glm")?"GLM-4":e}function EF(){var A,H;const e=dn(),{data:t,isLoading:n,error:r}=he({queryKey:["settings"],queryFn:wF}),[s,i]=x.useState(null),[o,l]=x.useState({}),[c,u]=x.useState({}),[h,d]=x.useState(null),[p,f]=x.useState(null),[m,g]=x.useState({}),[w,v]=x.useState(null),[y,_]=x.useState(null),[b,N]=x.useState({});x.useEffect(()=>{t&&!s&&i(t)},[t,s]);const k=we({mutationFn:SF,onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]}),e.invalidateQueries({queryKey:["tracker-status"]})}});if(n)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(je,{className:"w-8 h-8 text-blue-400 animate-spin"})});if(r||!s)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-red-400",children:["Error: ",(r==null?void 0:r.message)||"Failed to load settings"]})});const j=JSON.stringify(s)!==JSON.stringify(t),D=S=>{S!=="anthropic"&&i({...s,models:{...s.models,providers:{...s.models.providers,[S]:!s.models.providers[S]}}})},F=(S,Y)=>{S!=="anthropic"&&i({...s,api_keys:{...s.api_keys,[S]:Y||void 0}})},P=(S,Y)=>{i({...s,tracker_keys:{...s.tracker_keys,[S]:Y||void 0}})},O=(S,Y)=>{i({...s,models:{...s.models,overrides:{...s.models.overrides,[S]:Y}}})},T=S=>{const{[S]:Y,...B}=s.models.overrides;i({...s,models:{...s.models,overrides:B}})},E=()=>k.mutate(s),R=()=>i(t||null),L=async()=>{try{const S=await kF(),Y={models:{providers:{...(s==null?void 0:s.models.providers)||S.models.providers},overrides:{...S.models.overrides},gemini_thinking_level:S.models.gemini_thinking_level},api_keys:{...(s==null?void 0:s.api_keys)||{}},tracker_keys:{...(s==null?void 0:s.tracker_keys)||{}}};i(Y)}catch(S){console.error("Failed to fetch optimal defaults:",S),alert("Failed to load optimal defaults: "+S.message)}},$=async S=>{const Y=s==null?void 0:s.api_keys[S];if(Y){f(S),g({...m,[S]:null});try{const B=await bb(S,Y);g({...m,[S]:B})}catch{g({...m,[S]:{success:!1,error:"Test failed",response:null,latencyMs:0}})}finally{f(null)}}},K=async(S,Y)=>{const B=s==null?void 0:s.api_keys[S];if(!B)return;const C=`${S}:${Y}`;_(C),N({...b,[C]:null});try{const U=await bb(S,B,Y);N({...b,[C]:U})}catch{N({...b,[C]:{success:!1,error:"Test failed",response:null,latencyMs:0}})}finally{_(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-content text-4xl font-black tracking-tight",children:"Settings"})]}),a.jsx("p",{className:"text-content-muted text-base",children:"Configure AI model orchestration and agent permissions."})]})}),a.jsx("section",{className:"mb-10",children:a.jsx("div",{className:"bg-surface-raised border border-divider 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-surface p-8 flex flex-col justify-center items-center border-b lg:border-b-0 lg:border-r border-divider relative overflow-hidden",children:[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-surface-emphasis border border-divider-strong flex items-center justify-center shadow-sm",children:a.jsx("span",{className:"material-symbols-outlined text-content-subtle",children:"terminal"})}),a.jsx("div",{className:"flex-1 h-px bg-gradient-to-r from-divider-strong via-blue-500 to-divider-strong mx-2"}),a.jsx("div",{className:"size-12 rounded-lg bg-surface-emphasis border border-divider-strong flex items-center justify-center shadow-sm",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-divider via-blue-500 to-divider 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-content",children:"bolt"})})]}),a.jsxs("div",{className:"flex justify-between w-full px-2 text-[10px] uppercase tracking-widest font-bold text-content-muted",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-content text-xl font-bold",children:"Smart Model Selection"})]}),a.jsx("p",{className:"text-content-muted mb-6 leading-relaxed",children:"Panopticon automatically routes tasks to the optimal model based on capabilities, token budget, and latency requirements."}),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-content",children:"Capability Matching"}),a.jsx("p",{className:"text-xs text-content-muted",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-content",children:"Cost Optimization"}),a.jsx("p",{className:"text-xs text-content-muted",children:"Balance performance vs spend"})]})]})]})]})]})})}),a.jsxs("section",{className:"mb-12",children:[a.jsxs("h2",{className:"text-content text-2xl font-bold mb-6 flex items-center gap-3",children:["Provider Configuration",a.jsx("div",{className:"h-px flex-1 bg-divider-strong"})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:Wf.map(S=>{var U,I,q,z,te;const Y=S.id==="anthropic",B=Y||s.models.providers[S.id],C=s.api_keys[S.id]||"";return a.jsxs("div",{className:`bg-surface-raised border rounded-xl p-5 relative transition-colors shadow-sm ${Y?"border-blue-500/50 shadow-lg shadow-blue-500/5":"border-divider hover:border-divider-strong"}`,children:[Y&&a.jsx("div",{className:"absolute -top-3 right-4",children:a.jsx("span",{className:"bg-blue-500 text-content 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-surface-emphasis border border-divider flex items-center justify-center",children:a.jsx("span",{className:"material-symbols-outlined text-content-subtle",children:S.icon})}),a.jsx("span",{className:"font-bold text-content",children:S.name}),a.jsx("div",{className:"ml-auto",children:a.jsx("button",{onClick:()=>D(S.id),disabled:Y,className:`w-10 h-5 rounded-full relative transition-colors ${B?"bg-blue-500":"bg-surface-emphasis"} ${Y?"cursor-not-allowed":"cursor-pointer"}`,children:a.jsx("div",{className:`absolute top-0.5 size-4 bg-white rounded-full transition-all ${B?"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-content-muted mb-1 block",children:"API Key"}),C.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-surface-overlay px-1 rounded",children:C})]})]}),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:S.placeholder,onChange:se=>F(S.id,se.target.value),autoComplete:"off",className:"w-full bg-input-bg border border-divider-strong rounded-lg px-3 py-2 text-xs font-mono mt-2 focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-content-body"})]}):a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:o[S.id]?"text":"password",value:C,onChange:se=>F(S.id,se.target.value),disabled:Y,placeholder:S.placeholder,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"data-lpignore":"true","data-1p-ignore":"true","data-form-type":"other",className:`w-full bg-input-bg border border-divider-strong rounded-lg px-3 py-2 pr-16 text-xs font-mono focus:ring-1 focus:ring-blue-500 focus:border-blue-500 ${Y?"cursor-not-allowed text-content-muted":"text-content-body"}`}),!Y&&a.jsx("button",{onClick:()=>l({...o,[S.id]:!o[S.id]}),className:"absolute right-8 top-1/2 -translate-y-1/2 text-content-muted hover:text-content-body",children:a.jsx("span",{className:"material-symbols-outlined text-[16px]",children:o[S.id]?"visibility_off":"visibility"})})]})]}),!Y&&a.jsxs("div",{className:"flex flex-col gap-2",children:[C&&!C.startsWith("$")&&a.jsxs("button",{onClick:()=>v(S.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"]}),C&&!C.startsWith("$")&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>$(S.id),disabled:p===S.id,className:"flex items-center gap-1.5 px-3 py-1.5 bg-surface-emphasis hover:bg-divider-strong border border-divider-strong rounded-lg text-xs text-content-body transition-colors disabled:opacity-50",children:[p===S.id?a.jsx(je,{className:"w-3 h-3 animate-spin"}):a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"quiz"}),"Test 2+3"]}),m[S.id]&&a.jsxs("div",{className:`flex items-center gap-1 text-xs ${(U=m[S.id])!=null&&U.success?"text-green-400":"text-red-400"}`,children:[a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:(I=m[S.id])!=null&&I.success?"check_circle":"error"}),(q=m[S.id])!=null&&q.success?`${(z=m[S.id])==null?void 0:z.latencyMs}ms`:(te=m[S.id])==null?void 0:te.error]})]})]})]})]},S.id)})})]}),a.jsxs("section",{className:"mb-12",children:[a.jsxs("h2",{className:"text-content text-2xl font-bold mb-6 flex items-center gap-3",children:["Tracker API Keys",a.jsx("div",{className:"h-px flex-1 bg-divider-strong"})]}),a.jsxs("p",{className:"text-content-muted text-sm mb-6",children:["Configure API keys for your issue trackers. These override environment variables (",wb.map(S=>S.envVar).join(", "),")."]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:wb.map(S=>{var B;const Y=((B=s.tracker_keys)==null?void 0:B[S.id])||"";return a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-xl p-5 relative transition-colors shadow-sm hover:border-divider-strong",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[a.jsx("div",{className:"size-10 rounded-lg bg-surface-emphasis border border-divider flex items-center justify-center",children:a.jsx("span",{className:"material-symbols-outlined text-content-subtle",children:S.icon})}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-content",children:S.name}),a.jsx("p",{className:"text-[10px] text-content-muted font-mono",children:S.envVar})]})]}),a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"text-[10px] uppercase font-bold text-content-muted mb-1 block",children:"API Key / Token"}),Y.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-surface-overlay px-1 rounded",children:Y})]})]}),a.jsx("input",{type:"text",placeholder:S.placeholder,onChange:C=>P(S.id,C.target.value),autoComplete:"off",className:"w-full bg-input-bg border border-divider-strong rounded-lg px-3 py-2 text-xs font-mono mt-2 focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-content-body"})]}):a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:c[S.id]?"text":"password",value:Y,onChange:C=>P(S.id,C.target.value),placeholder:S.placeholder,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"data-lpignore":"true","data-1p-ignore":"true","data-form-type":"other",className:"w-full bg-input-bg border border-divider-strong rounded-lg px-3 py-2 pr-10 text-xs font-mono focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-content-body"}),a.jsx("button",{onClick:()=>u({...c,[S.id]:!c[S.id]}),className:"absolute right-2 top-1/2 -translate-y-1/2 text-content-muted hover:text-content-body",children:a.jsx("span",{className:"material-symbols-outlined text-[16px]",children:c[S.id]?"visibility_off":"visibility"})})]})]})})]},S.id)})})]}),a.jsxs("section",{className:"mb-12",children:[a.jsxs("h2",{className:"text-content text-2xl font-bold mb-6 flex items-center gap-3",children:["Model Assignments",a.jsx("div",{className:"h-px flex-1 bg-divider-strong"})]}),a.jsx("div",{className:"space-y-8",children:CF.map(S=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx("span",{className:"material-symbols-outlined text-content-muted text-lg",children:S.icon}),a.jsx("h3",{className:"text-content-body font-semibold text-sm uppercase tracking-wider",children:S.name}),a.jsx("div",{className:"h-px flex-1 bg-divider"})]}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:S.agents.map(Y=>{const B=s.models.overrides[Y.id]||Sb,C=NF(B),{score:U,matched:I,missing:q}=_F(B,Y.id),z=kx[Y.id]||[],te=U>=1,se=U>=.5&&U<1,ye=[`${Y.name}: ${Y.description}`,`Model: ${C}`,`Needs: ${z.map(De=>Fs[De].name).join(", ")}`,I.length>0?`✓ Has: ${I.map(De=>Fs[De].name).join(", ")}`:"",q.length>0?`✗ Missing: ${q.map(De=>Fs[De].name).join(", ")}`:""].filter(Boolean).join(`
554
- `);return a.jsxs("div",{onClick:()=>d(Y.id),title:ye,className:`p-3 border rounded-lg cursor-pointer transition-all group ${te?"bg-emerald-500/5 border-emerald-500/30 hover:border-emerald-500/50 hover:bg-emerald-500/10":se?"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 ${te?"text-emerald-400":se?"text-amber-400":"text-rose-400"}`,children:Y.icon}),a.jsxs("span",{className:`text-[9px] font-bold ${te?"text-emerald-400":se?"text-amber-400":"text-rose-400"}`,children:[Math.round(U*100),"%"]})]}),a.jsx("p",{className:"text-xs font-semibold text-content truncate",children:Y.name}),a.jsx("p",{className:"text-[10px] text-content-muted truncate mb-2",children:C}),a.jsx("div",{className:"flex gap-1 flex-wrap",children:z.slice(0,3).map(De=>{const $e=I.includes(De);return a.jsx("span",{title:`${Fs[De].name}: ${$e?"Model has this":"Model missing this"}`,className:`text-[8px] px-1 py-0.5 rounded ${$e?"bg-emerald-500/20 text-emerald-400":"bg-rose-500/20 text-rose-400"}`,children:Fs[De].name},De)})})]},Y.id)})})]},S.name))})]}),a.jsx("footer",{className:"fixed bottom-0 left-0 right-0 bg-surface backdrop-blur-md border-t border-divider-strong shadow-[0_-2px_10px_rgba(0,0,0,0.05)] px-6 py-4 z-40",children: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-content-muted text-sm",children:[k.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!"})]}),k.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:L,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:R,disabled:!j,className:"px-6 py-2 text-content-muted hover:text-content font-semibold text-sm transition-colors disabled:opacity-50",children:"Undo Changes"}),a.jsxs("button",{onClick:E,disabled:!j||k.isPending,className:"px-8 py-2 bg-blue-500 hover:bg-blue-400 text-content font-black rounded-lg transition-all shadow-lg shadow-blue-500/20 text-sm disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[k.isPending&&a.jsx(je,{className:"w-4 h-4 animate-spin"}),"Save Changes"]})]})]})}),h&&a.jsx(bF,{workType:h,currentModel:s.models.overrides[h]||Sb,isOverride:!!s.models.overrides[h],enabledProviders:Object.entries(s.models.providers).filter(([S,Y])=>Y).map(([S])=>S),onApply:S=>O(h,S),onRemove:()=>T(h),onClose:()=>d(null)}),w&&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-surface-raised border border-divider-strong 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-divider",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"material-symbols-outlined text-blue-400",children:(A=Wf.find(S=>S.id===w))==null?void 0:A.icon}),a.jsxs("h3",{className:"text-content text-lg font-bold",children:[(H=Wf.find(S=>S.id===w))==null?void 0:H.name," Models"]})]}),a.jsx("button",{onClick:()=>v(null),className:"text-content-muted hover:text-content transition-colors",children:a.jsx(mt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-4 overflow-y-auto max-h-[60vh]",children:(()=>{var B;const S=(s==null?void 0:s.api_keys[w])||"",Y=S.startsWith("$");return S?Y?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-content-muted text-sm mt-1",children:[a.jsx("code",{className:"font-mono bg-surface-overlay px-1 rounded",children:S})," is not set"]}),a.jsx("p",{className:"text-content-muted text-xs mt-2",children:"Set the environment variable or enter the key directly in Settings"})]}):a.jsx("div",{className:"space-y-3",children:(((B=Sx[w])==null?void 0:B.models)||[]).map(C=>{var z;const U=`${w}:${C.id}`,I=b[U],q=y===U;return a.jsx("div",{className:"bg-surface border border-divider rounded-lg p-4 hover:border-divider-strong 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-content-muted text-sm",children:C.icon}),a.jsx("h4",{className:"text-content font-semibold",children:C.name}),C.tier&&a.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${C.tier==="premium"?"bg-purple-500/20 text-purple-400":C.tier==="balanced"?"bg-blue-500/20 text-blue-400":"bg-emerald-500/20 text-emerald-400"}`,children:C.tier})]}),C.description&&a.jsx("p",{className:"text-xs text-content-muted mb-2",children:C.description}),a.jsx("div",{className:"flex flex-wrap gap-1",children:C.capabilities.map(te=>a.jsx("span",{className:"text-[9px] px-1.5 py-0.5 bg-surface-emphasis text-content-subtle rounded border border-divider",children:te},te))})]}),a.jsxs("div",{className:"flex flex-col items-end gap-2",children:[a.jsxs("button",{onClick:()=>K(w,C.id),disabled:q,className:"flex items-center gap-1.5 px-3 py-1.5 bg-emerald-500/10 hover:bg-emerald-500/20 border border-emerald-500/30 rounded-lg text-xs text-emerald-400 transition-colors disabled:opacity-50 whitespace-nowrap",children:[q?a.jsx(je,{className:"w-3 h-3 animate-spin"}):a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"play_arrow"}),"Test 2+3"]}),I&&a.jsxs("div",{className:`flex items-center gap-1 text-xs ${I.success?"text-green-400":"text-red-400"}`,children:[a.jsx("span",{className:"material-symbols-outlined text-[12px]",children:I.success?"check_circle":"error"}),I.success?`${I.latencyMs}ms`:((z=I.error)==null?void 0:z.slice(0,30))||"Failed"]})]})]})},C.id)})}):a.jsxs("div",{className:"text-center py-8",children:[a.jsx("span",{className:"material-symbols-outlined text-4xl text-content-muted mb-2",children:"key_off"}),a.jsx("p",{className:"text-content-muted",children:"Enter an API key to test models"})]})})()}),a.jsx("div",{className:"p-4 border-t border-divider bg-surface",children:a.jsx("p",{className:"text-xs text-content-muted text-center",children:'Test verifies API key and model availability by asking "What is 2+3?"'})})]})})]})}var kb=1,jF=.9,RF=.8,PF=.17,Uf=.1,qf=.999,TF=.9999,DF=.99,MF=/[\\\/_+.#"@\[\(\{&]/,AF=/[\\\/_+.#"@\[\(\{&]/g,LF=/[\s-]/,f2=/[\s-]/g;function _g(e,t,n,r,s,i,o){if(i===t.length)return s===e.length?kb:DF;var l=`${s},${i}`;if(o[l]!==void 0)return o[l];for(var c=r.charAt(i),u=n.indexOf(c,s),h=0,d,p,f,m;u>=0;)d=_g(e,t,n,r,u+1,i+1,o),d>h&&(u===s?d*=kb:MF.test(e.charAt(u-1))?(d*=RF,f=e.slice(s,u-1).match(AF),f&&s>0&&(d*=Math.pow(qf,f.length))):LF.test(e.charAt(u-1))?(d*=jF,m=e.slice(s,u-1).match(f2),m&&s>0&&(d*=Math.pow(qf,m.length))):(d*=PF,s>0&&(d*=Math.pow(qf,u-s))),e.charAt(u)!==t.charAt(i)&&(d*=TF)),(d<Uf&&n.charAt(u-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(u-1)!==r.charAt(i))&&(p=_g(e,t,n,r,u+1,i+2,o),p*Uf>d&&(d=p*Uf)),d>h&&(h=d),u=n.indexOf(c,u+1);return o[l]=h,h}function Cb(e){return e.toLowerCase().replace(f2," ")}function OF(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,_g(e,t,Cb(e),Cb(t),0,0,{})}function di(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Nb(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gi(...e){return t=>{let n=!1;const r=e.map(s=>{const i=Nb(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():Nb(e[s],null)}}}}function mo(...e){return x.useCallback(gi(...e),e)}function IF(e,t){const n=x.createContext(t),r=i=>{const{children:o,...l}=i,c=x.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:o})};r.displayName=e+"Provider";function s(i){const o=x.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,s]}function BF(e,t=[]){let n=[];function r(i,o){const l=x.createContext(o),c=n.length;n=[...n,o];const u=d=>{var v;const{scope:p,children:f,...m}=d,g=((v=p==null?void 0:p[e])==null?void 0:v[c])||l,w=x.useMemo(()=>m,Object.values(m));return a.jsx(g.Provider,{value:w,children:f})};u.displayName=i+"Provider";function h(d,p){var g;const f=((g=p==null?void 0:p[e])==null?void 0:g[c])||l,m=x.useContext(f);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[u,h]}const s=()=>{const i=n.map(o=>x.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return x.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,FF(s,...t)]}function FF(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const d=c(i)[`__scope${u}`];return{...l,...d}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var ic=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},zF=Og[" useId ".trim().toString()]||(()=>{}),$F=0;function cs(e){const[t,n]=x.useState(zF());return ic(()=>{n(r=>r??String($F++))},[e]),t?`radix-${t}`:""}var HF=Og[" useInsertionEffect ".trim().toString()]||ic;function WF({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=UF({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:s;{const h=x.useRef(e!==void 0);x.useEffect(()=>{const d=h.current;d!==l&&console.warn(`${r} 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,r])}const u=x.useCallback(h=>{var d;if(l){const p=qF(h)?h(e):h;p!==e&&((d=o.current)==null||d.call(o,p))}else i(h)},[l,e,i,o]);return[c,u]}function UF({defaultProp:e,onChange:t}){const[n,r]=x.useState(e),s=x.useRef(n),i=x.useRef(t);return HF(()=>{i.current=t},[t]),x.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function qF(e){return typeof e=="function"}function Pc(e){const t=KF(e),n=x.forwardRef((r,s)=>{const{children:i,...o}=r,l=x.Children.toArray(i),c=l.find(YF);if(c){const u=c.props.children,h=l.map(d=>d===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:x.isValidElement(u)?x.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}function KF(e){const t=x.forwardRef((n,r)=>{const{children:s,...i}=n;if(x.isValidElement(s)){const o=XF(s),l=QF(i,s.props);return s.type!==x.Fragment&&(l.ref=r?gi(r,o):o),x.cloneElement(s,l)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var VF=Symbol("radix.slottable");function YF(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===VF}function QF(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function XF(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var GF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],p2=GF.reduce((e,t)=>{const n=Pc(`Primitive.${t}`),r=x.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function JF(e,t){e&&sr.flushSync(()=>e.dispatchEvent(t))}function oc(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ZF(e,t=globalThis==null?void 0:globalThis.document){const n=oc(e);x.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var ez="DismissableLayer",bg="dismissableLayer.update",tz="dismissableLayer.pointerDownOutside",nz="dismissableLayer.focusOutside",Eb,m2=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),g2=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,u=x.useContext(m2),[h,d]=x.useState(null),p=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=x.useState({}),m=mo(t,j=>d(j)),g=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(w),y=h?g.indexOf(h):-1,_=u.layersWithOutsidePointerEventsDisabled.size>0,b=y>=v,N=iz(j=>{const D=j.target,F=[...u.branches].some(P=>P.contains(D));!b||F||(s==null||s(j),o==null||o(j),j.defaultPrevented||l==null||l())},p),k=oz(j=>{const D=j.target;[...u.branches].some(P=>P.contains(D))||(i==null||i(j),o==null||o(j),j.defaultPrevented||l==null||l())},p);return ZF(j=>{y===u.layers.size-1&&(r==null||r(j),!j.defaultPrevented&&l&&(j.preventDefault(),l()))},p),x.useEffect(()=>{if(h)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Eb=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(h)),u.layers.add(h),jb(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Eb)}},[h,p,n,u]),x.useEffect(()=>()=>{h&&(u.layers.delete(h),u.layersWithOutsidePointerEventsDisabled.delete(h),jb())},[h,u]),x.useEffect(()=>{const j=()=>f({});return document.addEventListener(bg,j),()=>document.removeEventListener(bg,j)},[]),a.jsx(p2.div,{...c,ref:m,style:{pointerEvents:_?b?"auto":"none":void 0,...e.style},onFocusCapture:di(e.onFocusCapture,k.onFocusCapture),onBlurCapture:di(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:di(e.onPointerDownCapture,N.onPointerDownCapture)})});g2.displayName=ez;var rz="DismissableLayerBranch",sz=x.forwardRef((e,t)=>{const n=x.useContext(m2),r=x.useRef(null),s=mo(t,r);return x.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),a.jsx(p2.div,{...e,ref:s})});sz.displayName=rz;function iz(e,t=globalThis==null?void 0:globalThis.document){const n=oc(e),r=x.useRef(!1),s=x.useRef(()=>{});return x.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){v2(tz,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function oz(e,t=globalThis==null?void 0:globalThis.document){const n=oc(e),r=x.useRef(!1);return x.useEffect(()=>{const s=i=>{i.target&&!r.current&&v2(nz,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function jb(){const e=new CustomEvent(bg);document.dispatchEvent(e)}function v2(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?JF(s,i):s.dispatchEvent(i)}var az=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lz=az.reduce((e,t)=>{const n=Pc(`Primitive.${t}`),r=x.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Kf="focusScope.autoFocusOnMount",Vf="focusScope.autoFocusOnUnmount",Rb={bubbles:!1,cancelable:!0},cz="FocusScope",x2=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[l,c]=x.useState(null),u=oc(s),h=oc(i),d=x.useRef(null),p=mo(t,g=>c(g)),f=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let g=function(_){if(f.paused||!l)return;const b=_.target;l.contains(b)?d.current=b:Ds(d.current,{select:!0})},w=function(_){if(f.paused||!l)return;const b=_.relatedTarget;b!==null&&(l.contains(b)||Ds(d.current,{select:!0}))},v=function(_){if(document.activeElement===document.body)for(const N of _)N.removedNodes.length>0&&Ds(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",w);const y=new MutationObserver(v);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",w),y.disconnect()}}},[r,l,f.paused]),x.useEffect(()=>{if(l){Tb.add(f);const g=document.activeElement;if(!l.contains(g)){const v=new CustomEvent(Kf,Rb);l.addEventListener(Kf,u),l.dispatchEvent(v),v.defaultPrevented||(uz(mz(y2(l)),{select:!0}),document.activeElement===g&&Ds(l))}return()=>{l.removeEventListener(Kf,u),setTimeout(()=>{const v=new CustomEvent(Vf,Rb);l.addEventListener(Vf,h),l.dispatchEvent(v),v.defaultPrevented||Ds(g??document.body,{select:!0}),l.removeEventListener(Vf,h),Tb.remove(f)},0)}}},[l,u,h,f]);const m=x.useCallback(g=>{if(!n&&!r||f.paused)return;const w=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(w&&v){const y=g.currentTarget,[_,b]=dz(y);_&&b?!g.shiftKey&&v===b?(g.preventDefault(),n&&Ds(_,{select:!0})):g.shiftKey&&v===_&&(g.preventDefault(),n&&Ds(b,{select:!0})):v===y&&g.preventDefault()}},[n,r,f.paused]);return a.jsx(lz.div,{tabIndex:-1,...o,ref:p,onKeyDown:m})});x2.displayName=cz;function uz(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ds(r,{select:t}),document.activeElement!==n)return}function dz(e){const t=y2(e),n=Pb(t,e),r=Pb(t.reverse(),e);return[n,r]}function y2(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Pb(e,t){for(const n of e)if(!hz(n,{upTo:t}))return n}function hz(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 fz(e){return e instanceof HTMLInputElement&&"select"in e}function Ds(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fz(e)&&t&&e.select()}}var Tb=pz();function pz(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Db(e,t),e.unshift(t)},remove(t){var n;e=Db(e,t),(n=e[0])==null||n.resume()}}}function Db(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function mz(e){return e.filter(t=>t.tagName!=="A")}var gz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vz=gz.reduce((e,t)=>{const n=Pc(`Primitive.${t}`),r=x.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),xz="Portal",_2=x.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[s,i]=x.useState(!1);ic(()=>i(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?p4.createPortal(a.jsx(vz.div,{...r,ref:t}),o):null});_2.displayName=xz;function yz(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var jh=e=>{const{present:t,children:n}=e,r=_z(t),s=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),i=mo(r.ref,bz(s));return typeof n=="function"||r.isPresent?x.cloneElement(s,{ref:i}):null};jh.displayName="Presence";function _z(e){const[t,n]=x.useState(),r=x.useRef(null),s=x.useRef(e),i=x.useRef("none"),o=e?"mounted":"unmounted",[l,c]=yz(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=gu(r.current);i.current=l==="mounted"?u:"none"},[l]),ic(()=>{const u=r.current,h=s.current;if(h!==e){const p=i.current,f=gu(u);e?c("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(h&&p!==f?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),ic(()=>{if(t){let u;const h=t.ownerDocument.defaultView??window,d=f=>{const g=gu(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&g&&(c("ANIMATION_END"),!s.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",u=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},p=f=>{f.target===t&&(i.current=gu(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{h.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:x.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function gu(e){return(e==null?void 0:e.animationName)||"none"}function bz(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var wz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Tc=wz.reduce((e,t)=>{const n=Pc(`Primitive.${t}`),r=x.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Yf=0;function Sz(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Mb()),document.body.insertAdjacentElement("beforeend",e[1]??Mb()),Yf++,()=>{Yf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Yf--}},[])}function Mb(){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 Fr=function(){return Fr=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Fr.apply(this,arguments)};function b2(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function kz(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Vu="right-scroll-bar-position",Yu="width-before-scroll-bar",Cz="with-scroll-bars-hidden",Nz="--removed-body-scroll-bar-size";function Qf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ez(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var jz=typeof window<"u"?x.useLayoutEffect:x.useEffect,Ab=new WeakMap;function Rz(e,t){var n=Ez(null,function(r){return e.forEach(function(s){return Qf(s,r)})});return jz(function(){var r=Ab.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(l){i.has(l)||Qf(l,null)}),i.forEach(function(l){s.has(l)||Qf(l,o)})}Ab.set(n,e)},[e]),n}function Pz(e){return e}function Tz(e,t){t===void 0&&(t=Pz);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var c=function(){var h=o;o=[],h.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(h){o.push(h),u()},filter:function(h){return o=o.filter(h),n}}}};return s}function Dz(e){e===void 0&&(e={});var t=Tz(null);return t.options=Fr({async:!0,ssr:!1},e),t}var w2=function(e){var t=e.sideCar,n=b2(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,Fr({},n))};w2.isSideCarExport=!0;function Mz(e,t){return e.useMedium(t),w2}var S2=Dz(),Xf=function(){},Rh=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:Xf,onWheelCapture:Xf,onTouchMoveCapture:Xf}),s=r[0],i=r[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,h=e.enabled,d=e.shards,p=e.sideCar,f=e.noRelative,m=e.noIsolation,g=e.inert,w=e.allowPinchZoom,v=e.as,y=v===void 0?"div":v,_=e.gapMode,b=b2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=p,k=Rz([n,t]),j=Fr(Fr({},b),s);return x.createElement(x.Fragment,null,h&&x.createElement(N,{sideCar:S2,removeScrollBar:u,shards:d,noRelative:f,noIsolation:m,inert:g,setCallbacks:i,allowPinchZoom:!!w,lockRef:n,gapMode:_}),o?x.cloneElement(x.Children.only(l),Fr(Fr({},j),{ref:k})):x.createElement(y,Fr({},j,{className:c,ref:k}),l))});Rh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Rh.classNames={fullWidth:Yu,zeroRight:Vu};var Az=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Lz(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Az();return t&&e.setAttribute("nonce",t),e}function Oz(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Iz(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Bz=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Lz())&&(Oz(t,n),Iz(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Fz=function(){var e=Bz();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},k2=function(){var e=Fz(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},zz={left:0,top:0,right:0,gap:0},Gf=function(e){return parseInt(e||"",10)||0},$z=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Gf(n),Gf(r),Gf(s)]},Hz=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return zz;var t=$z(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Wz=k2(),Go="data-scroll-locked",Uz=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
555
- .`.concat(Cz,` {
556
- overflow: hidden `).concat(r,`;
557
- padding-right: `).concat(l,"px ").concat(r,`;
558
- }
559
- body[`).concat(Go,`] {
560
- overflow: hidden `).concat(r,`;
561
- overscroll-behavior: contain;
562
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
563
- padding-left: `.concat(s,`px;
564
- padding-top: `).concat(i,`px;
565
- padding-right: `).concat(o,`px;
566
- margin-left:0;
567
- margin-top:0;
568
- margin-right: `).concat(l,"px ").concat(r,`;
569
- `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
570
- }
571
-
572
- .`).concat(Vu,` {
573
- right: `).concat(l,"px ").concat(r,`;
574
- }
575
-
576
- .`).concat(Yu,` {
577
- margin-right: `).concat(l,"px ").concat(r,`;
578
- }
579
-
580
- .`).concat(Vu," .").concat(Vu,` {
581
- right: 0 `).concat(r,`;
582
- }
583
-
584
- .`).concat(Yu," .").concat(Yu,` {
585
- margin-right: 0 `).concat(r,`;
586
- }
587
-
588
- body[`).concat(Go,`] {
589
- `).concat(Nz,": ").concat(l,`px;
590
- }
591
- `)},Lb=function(){var e=parseInt(document.body.getAttribute(Go)||"0",10);return isFinite(e)?e:0},qz=function(){x.useEffect(function(){return document.body.setAttribute(Go,(Lb()+1).toString()),function(){var e=Lb()-1;e<=0?document.body.removeAttribute(Go):document.body.setAttribute(Go,e.toString())}},[])},Kz=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;qz();var i=x.useMemo(function(){return Hz(s)},[s]);return x.createElement(Wz,{styles:Uz(i,!t,s,n?"":"!important")})},wg=!1;if(typeof window<"u")try{var vu=Object.defineProperty({},"passive",{get:function(){return wg=!0,!0}});window.addEventListener("test",vu,vu),window.removeEventListener("test",vu,vu)}catch{wg=!1}var So=wg?{passive:!1}:!1,Vz=function(e){return e.tagName==="TEXTAREA"},C2=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Vz(e)&&n[t]==="visible")},Yz=function(e){return C2(e,"overflowY")},Qz=function(e){return C2(e,"overflowX")},Ob=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=N2(e,r);if(s){var i=E2(e,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Xz=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Gz=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},N2=function(e,t){return e==="v"?Yz(t):Qz(t)},E2=function(e,t){return e==="v"?Xz(t):Gz(t)},Jz=function(e,t){return e==="h"&&t==="rtl"?-1:1},Zz=function(e,t,n,r,s){var i=Jz(e,window.getComputedStyle(t).direction),o=i*r,l=n.target,c=t.contains(l),u=!1,h=o>0,d=0,p=0;do{if(!l)break;var f=E2(e,l),m=f[0],g=f[1],w=f[2],v=g-w-i*m;(m||v)&&N2(e,l)&&(d+=v,p+=m);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(h&&Math.abs(d)<1||!h&&Math.abs(p)<1)&&(u=!0),u},xu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ib=function(e){return[e.deltaX,e.deltaY]},Bb=function(e){return e&&"current"in e?e.current:e},e$=function(e,t){return e[0]===t[0]&&e[1]===t[1]},t$=function(e){return`
592
- .block-interactivity-`.concat(e,` {pointer-events: none;}
593
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
594
- `)},n$=0,ko=[];function r$(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),s=x.useState(n$++)[0],i=x.useState(k2)[0],o=x.useRef(e);x.useEffect(function(){o.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=kz([e.lockRef.current],(e.shards||[]).map(Bb),!0).filter(Boolean);return g.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=x.useCallback(function(g,w){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var v=xu(g),y=n.current,_="deltaX"in g?g.deltaX:y[0]-v[0],b="deltaY"in g?g.deltaY:y[1]-v[1],N,k=g.target,j=Math.abs(_)>Math.abs(b)?"h":"v";if("touches"in g&&j==="h"&&k.type==="range")return!1;var D=window.getSelection(),F=D&&D.anchorNode,P=F?F===k||F.contains(k):!1;if(P)return!1;var O=Ob(j,k);if(!O)return!0;if(O?N=j:(N=j==="v"?"h":"v",O=Ob(j,k)),!O)return!1;if(!r.current&&"changedTouches"in g&&(_||b)&&(r.current=N),!N)return!0;var T=r.current||N;return Zz(T,w,g,T==="h"?_:b)},[]),c=x.useCallback(function(g){var w=g;if(!(!ko.length||ko[ko.length-1]!==i)){var v="deltaY"in w?Ib(w):xu(w),y=t.current.filter(function(N){return N.name===w.type&&(N.target===w.target||w.target===N.shadowParent)&&e$(N.delta,v)})[0];if(y&&y.should){w.cancelable&&w.preventDefault();return}if(!y){var _=(o.current.shards||[]).map(Bb).filter(Boolean).filter(function(N){return N.contains(w.target)}),b=_.length>0?l(w,_[0]):!o.current.noIsolation;b&&w.cancelable&&w.preventDefault()}}},[]),u=x.useCallback(function(g,w,v,y){var _={name:g,delta:w,target:v,should:y,shadowParent:s$(v)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(b){return b!==_})},1)},[]),h=x.useCallback(function(g){n.current=xu(g),r.current=void 0},[]),d=x.useCallback(function(g){u(g.type,Ib(g),g.target,l(g,e.lockRef.current))},[]),p=x.useCallback(function(g){u(g.type,xu(g),g.target,l(g,e.lockRef.current))},[]);x.useEffect(function(){return ko.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",c,So),document.addEventListener("touchmove",c,So),document.addEventListener("touchstart",h,So),function(){ko=ko.filter(function(g){return g!==i}),document.removeEventListener("wheel",c,So),document.removeEventListener("touchmove",c,So),document.removeEventListener("touchstart",h,So)}},[]);var f=e.removeScrollBar,m=e.inert;return x.createElement(x.Fragment,null,m?x.createElement(i,{styles:t$(s)}):null,f?x.createElement(Kz,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function s$(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const i$=Mz(S2,r$);var j2=x.forwardRef(function(e,t){return x.createElement(Rh,Fr({},e,{ref:t,sideCar:i$}))});j2.classNames=Rh.classNames;var o$=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Co=new WeakMap,yu=new WeakMap,_u={},Jf=0,R2=function(e){return e&&(e.host||R2(e.parentNode))},a$=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=R2(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},l$=function(e,t,n,r){var s=a$(t,Array.isArray(e)?e:[e]);_u[n]||(_u[n]=new WeakMap);var i=_u[n],o=[],l=new Set,c=new Set(s),u=function(d){!d||l.has(d)||(l.add(d),u(d.parentNode))};s.forEach(u);var h=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(p){if(l.has(p))h(p);else try{var f=p.getAttribute(r),m=f!==null&&f!=="false",g=(Co.get(p)||0)+1,w=(i.get(p)||0)+1;Co.set(p,g),i.set(p,w),o.push(p),g===1&&m&&yu.set(p,!0),w===1&&p.setAttribute(n,"true"),m||p.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",p,v)}})};return h(t),l.clear(),Jf++,function(){o.forEach(function(d){var p=Co.get(d)-1,f=i.get(d)-1;Co.set(d,p),i.set(d,f),p||(yu.has(d)||d.removeAttribute(r),yu.delete(d)),f||d.removeAttribute(n)}),Jf--,Jf||(Co=new WeakMap,Co=new WeakMap,yu=new WeakMap,_u={})}},c$=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=o$(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),l$(r,s,n,"aria-hidden")):function(){return null}},Ph="Dialog",[P2]=BF(Ph),[u$,Cr]=P2(Ph),T2=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,l=x.useRef(null),c=x.useRef(null),[u,h]=WF({prop:r,defaultProp:s??!1,onChange:i,caller:Ph});return a.jsx(u$,{scope:t,triggerRef:l,contentRef:c,contentId:cs(),titleId:cs(),descriptionId:cs(),open:u,onOpenChange:h,onOpenToggle:x.useCallback(()=>h(d=>!d),[h]),modal:o,children:n})};T2.displayName=Ph;var D2="DialogTrigger",d$=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Cr(D2,n),i=mo(t,s.triggerRef);return a.jsx(Tc.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Ex(s.open),...r,ref:i,onClick:di(e.onClick,s.onOpenToggle)})});d$.displayName=D2;var Cx="DialogPortal",[h$,M2]=P2(Cx,{forceMount:void 0}),A2=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=Cr(Cx,t);return a.jsx(h$,{scope:t,forceMount:n,children:x.Children.map(r,o=>a.jsx(jh,{present:n||i.open,children:a.jsx(_2,{asChild:!0,container:s,children:o})}))})};A2.displayName=Cx;var $d="DialogOverlay",L2=x.forwardRef((e,t)=>{const n=M2($d,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=Cr($d,e.__scopeDialog);return i.modal?a.jsx(jh,{present:r||i.open,children:a.jsx(p$,{...s,ref:t})}):null});L2.displayName=$d;var f$=Pc("DialogOverlay.RemoveScroll"),p$=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Cr($d,n);return a.jsx(j2,{as:f$,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(Tc.div,{"data-state":Ex(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),oo="DialogContent",O2=x.forwardRef((e,t)=>{const n=M2(oo,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=Cr(oo,e.__scopeDialog);return a.jsx(jh,{present:r||i.open,children:i.modal?a.jsx(m$,{...s,ref:t}):a.jsx(g$,{...s,ref:t})})});O2.displayName=oo;var m$=x.forwardRef((e,t)=>{const n=Cr(oo,e.__scopeDialog),r=x.useRef(null),s=mo(t,n.contentRef,r);return x.useEffect(()=>{const i=r.current;if(i)return c$(i)},[]),a.jsx(I2,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:di(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:di(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:di(e.onFocusOutside,i=>i.preventDefault())})}),g$=x.forwardRef((e,t)=>{const n=Cr(oo,e.__scopeDialog),r=x.useRef(!1),s=x.useRef(!1);return a.jsx(I2,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),I2=x.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,l=Cr(oo,n),c=x.useRef(null),u=mo(t,c);return Sz(),a.jsxs(a.Fragment,{children:[a.jsx(x2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(g2,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Ex(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(_$,{titleId:l.titleId}),a.jsx(w$,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Nx="DialogTitle",v$=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Cr(Nx,n);return a.jsx(Tc.h2,{id:s.titleId,...r,ref:t})});v$.displayName=Nx;var B2="DialogDescription",x$=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Cr(B2,n);return a.jsx(Tc.p,{id:s.descriptionId,...r,ref:t})});x$.displayName=B2;var F2="DialogClose",y$=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Cr(F2,n);return a.jsx(Tc.button,{type:"button",...r,ref:t,onClick:di(e.onClick,()=>s.onOpenChange(!1))})});y$.displayName=F2;function Ex(e){return e?"open":"closed"}var z2="DialogTitleWarning",[FU,$2]=IF(z2,{contentName:oo,titleName:Nx,docsSlug:"dialog"}),_$=({titleId:e})=>{const t=$2(z2),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
595
-
596
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
597
-
598
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},b$="DialogDescriptionWarning",w$=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$2(b$).contentName}}.`;return x.useEffect(()=>{var i;const s=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},S$=T2,k$=A2,C$=L2,N$=O2,E$=Symbol.for("react.lazy"),Hd=Og[" use ".trim().toString()];function j$(e){return typeof e=="object"&&e!==null&&"then"in e}function H2(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===E$&&"_payload"in e&&j$(e._payload)}function R$(e){const t=P$(e),n=x.forwardRef((r,s)=>{let{children:i,...o}=r;H2(i)&&typeof Hd=="function"&&(i=Hd(i._payload));const l=x.Children.toArray(i),c=l.find(D$);if(c){const u=c.props.children,h=l.map(d=>d===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:x.isValidElement(u)?x.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}function P$(e){const t=x.forwardRef((n,r)=>{let{children:s,...i}=n;if(H2(s)&&typeof Hd=="function"&&(s=Hd(s._payload)),x.isValidElement(s)){const o=A$(s),l=M$(i,s.props);return s.type!==x.Fragment&&(l.ref=r?gi(r,o):o),x.cloneElement(s,l)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var T$=Symbol("radix.slottable");function D$(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===T$}function M$(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function A$(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var L$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wi=L$.reduce((e,t)=>{const n=R$(`Primitive.${t}`),r=x.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),tl='[cmdk-group=""]',Zf='[cmdk-group-items=""]',O$='[cmdk-group-heading=""]',W2='[cmdk-item=""]',Fb=`${W2}:not([aria-disabled="true"])`,Sg="cmdk-item-select",No="data-value",I$=(e,t,n)=>OF(e,t,n),U2=x.createContext(void 0),Dc=()=>x.useContext(U2),q2=x.createContext(void 0),jx=()=>x.useContext(q2),K2=x.createContext(void 0),V2=x.forwardRef((e,t)=>{let n=Eo(()=>{var B,C;return{search:"",value:(C=(B=e.value)!=null?B:e.defaultValue)!=null?C:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Eo(()=>new Set),s=Eo(()=>new Map),i=Eo(()=>new Map),o=Eo(()=>new Set),l=Y2(e),{label:c,children:u,value:h,onValueChange:d,filter:p,shouldFilter:f,loop:m,disablePointerSelection:g=!1,vimBindings:w=!0,...v}=e,y=cs(),_=cs(),b=cs(),N=x.useRef(null),k=Y$();ao(()=>{if(h!==void 0){let B=h.trim();n.current.value=B,j.emit()}},[h]),ao(()=>{k(6,E)},[]);let j=x.useMemo(()=>({subscribe:B=>(o.current.add(B),()=>o.current.delete(B)),snapshot:()=>n.current,setState:(B,C,U)=>{var I,q,z,te;if(!Object.is(n.current[B],C)){if(n.current[B]=C,B==="search")T(),P(),k(1,O);else if(B==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let se=document.getElementById(b);se?se.focus():(I=document.getElementById(y))==null||I.focus()}if(k(7,()=>{var se;n.current.selectedItemId=(se=R())==null?void 0:se.id,j.emit()}),U||k(5,E),((q=l.current)==null?void 0:q.value)!==void 0){let se=C??"";(te=(z=l.current).onValueChange)==null||te.call(z,se);return}}j.emit()}},emit:()=>{o.current.forEach(B=>B())}}),[]),D=x.useMemo(()=>({value:(B,C,U)=>{var I;C!==((I=i.current.get(B))==null?void 0:I.value)&&(i.current.set(B,{value:C,keywords:U}),n.current.filtered.items.set(B,F(C,U)),k(2,()=>{P(),j.emit()}))},item:(B,C)=>(r.current.add(B),C&&(s.current.has(C)?s.current.get(C).add(B):s.current.set(C,new Set([B]))),k(3,()=>{T(),P(),n.current.value||O(),j.emit()}),()=>{i.current.delete(B),r.current.delete(B),n.current.filtered.items.delete(B);let U=R();k(4,()=>{T(),(U==null?void 0:U.getAttribute("id"))===B&&O(),j.emit()})}),group:B=>(s.current.has(B)||s.current.set(B,new Set),()=>{i.current.delete(B),s.current.delete(B)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:y,inputId:b,labelId:_,listInnerRef:N}),[]);function F(B,C){var U,I;let q=(I=(U=l.current)==null?void 0:U.filter)!=null?I:I$;return B?q(B,n.current.search,C):0}function P(){if(!n.current.search||l.current.shouldFilter===!1)return;let B=n.current.filtered.items,C=[];n.current.filtered.groups.forEach(I=>{let q=s.current.get(I),z=0;q.forEach(te=>{let se=B.get(te);z=Math.max(se,z)}),C.push([I,z])});let U=N.current;L().sort((I,q)=>{var z,te;let se=I.getAttribute("id"),ye=q.getAttribute("id");return((z=B.get(ye))!=null?z:0)-((te=B.get(se))!=null?te:0)}).forEach(I=>{let q=I.closest(Zf);q?q.appendChild(I.parentElement===q?I:I.closest(`${Zf} > *`)):U.appendChild(I.parentElement===U?I:I.closest(`${Zf} > *`))}),C.sort((I,q)=>q[1]-I[1]).forEach(I=>{var q;let z=(q=N.current)==null?void 0:q.querySelector(`${tl}[${No}="${encodeURIComponent(I[0])}"]`);z==null||z.parentElement.appendChild(z)})}function O(){let B=L().find(U=>U.getAttribute("aria-disabled")!=="true"),C=B==null?void 0:B.getAttribute(No);j.setState("value",C||void 0)}function T(){var B,C,U,I;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let q=0;for(let z of r.current){let te=(C=(B=i.current.get(z))==null?void 0:B.value)!=null?C:"",se=(I=(U=i.current.get(z))==null?void 0:U.keywords)!=null?I:[],ye=F(te,se);n.current.filtered.items.set(z,ye),ye>0&&q++}for(let[z,te]of s.current)for(let se of te)if(n.current.filtered.items.get(se)>0){n.current.filtered.groups.add(z);break}n.current.filtered.count=q}function E(){var B,C,U;let I=R();I&&(((B=I.parentElement)==null?void 0:B.firstChild)===I&&((U=(C=I.closest(tl))==null?void 0:C.querySelector(O$))==null||U.scrollIntoView({block:"nearest"})),I.scrollIntoView({block:"nearest"}))}function R(){var B;return(B=N.current)==null?void 0:B.querySelector(`${W2}[aria-selected="true"]`)}function L(){var B;return Array.from(((B=N.current)==null?void 0:B.querySelectorAll(Fb))||[])}function $(B){let C=L()[B];C&&j.setState("value",C.getAttribute(No))}function K(B){var C;let U=R(),I=L(),q=I.findIndex(te=>te===U),z=I[q+B];(C=l.current)!=null&&C.loop&&(z=q+B<0?I[I.length-1]:q+B===I.length?I[0]:I[q+B]),z&&j.setState("value",z.getAttribute(No))}function A(B){let C=R(),U=C==null?void 0:C.closest(tl),I;for(;U&&!I;)U=B>0?K$(U,tl):V$(U,tl),I=U==null?void 0:U.querySelector(Fb);I?j.setState("value",I.getAttribute(No)):K(B)}let H=()=>$(L().length-1),S=B=>{B.preventDefault(),B.metaKey?H():B.altKey?A(1):K(1)},Y=B=>{B.preventDefault(),B.metaKey?$(0):B.altKey?A(-1):K(-1)};return x.createElement(wi.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:B=>{var C;(C=v.onKeyDown)==null||C.call(v,B);let U=B.nativeEvent.isComposing||B.keyCode===229;if(!(B.defaultPrevented||U))switch(B.key){case"n":case"j":{w&&B.ctrlKey&&S(B);break}case"ArrowDown":{S(B);break}case"p":case"k":{w&&B.ctrlKey&&Y(B);break}case"ArrowUp":{Y(B);break}case"Home":{B.preventDefault(),$(0);break}case"End":{B.preventDefault(),H();break}case"Enter":{B.preventDefault();let I=R();if(I){let q=new Event(Sg);I.dispatchEvent(q)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:D.inputId,id:D.labelId,style:X$},c),Th(e,B=>x.createElement(q2.Provider,{value:j},x.createElement(U2.Provider,{value:D},B))))}),B$=x.forwardRef((e,t)=>{var n,r;let s=cs(),i=x.useRef(null),o=x.useContext(K2),l=Dc(),c=Y2(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;ao(()=>{if(!u)return l.item(s,o==null?void 0:o.id)},[u]);let h=Q2(s,i,[e.value,e.children,i],e.keywords),d=jx(),p=vi(k=>k.value&&k.value===h.current),f=vi(k=>u||l.filter()===!1?!0:k.search?k.filtered.items.get(s)>0:!0);x.useEffect(()=>{let k=i.current;if(!(!k||e.disabled))return k.addEventListener(Sg,m),()=>k.removeEventListener(Sg,m)},[f,e.onSelect,e.disabled]);function m(){var k,j;g(),(j=(k=c.current).onSelect)==null||j.call(k,h.current)}function g(){d.setState("value",h.current,!0)}if(!f)return null;let{disabled:w,value:v,onSelect:y,forceMount:_,keywords:b,...N}=e;return x.createElement(wi.div,{ref:gi(i,t),...N,id:s,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!p,"data-disabled":!!w,"data-selected":!!p,onPointerMove:w||l.getDisablePointerSelection()?void 0:g,onClick:w?void 0:m},e.children)}),F$=x.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...i}=e,o=cs(),l=x.useRef(null),c=x.useRef(null),u=cs(),h=Dc(),d=vi(f=>s||h.filter()===!1?!0:f.search?f.filtered.groups.has(o):!0);ao(()=>h.group(o),[]),Q2(o,l,[e.value,e.heading,c]);let p=x.useMemo(()=>({id:o,forceMount:s}),[s]);return x.createElement(wi.div,{ref:gi(l,t),...i,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},n&&x.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),Th(e,f=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},x.createElement(K2.Provider,{value:p},f))))}),z$=x.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=x.useRef(null),i=vi(o=>!o.search);return!n&&!i?null:x.createElement(wi.div,{ref:gi(s,t),...r,"cmdk-separator":"",role:"separator"})}),$$=x.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,i=jx(),o=vi(u=>u.search),l=vi(u=>u.selectedItemId),c=Dc();return x.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),x.createElement(wi.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?e.value:o,onChange:u=>{s||i.setState("search",u.target.value),n==null||n(u.target.value)}})}),H$=x.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,i=x.useRef(null),o=x.useRef(null),l=vi(u=>u.selectedItemId),c=Dc();return x.useEffect(()=>{if(o.current&&i.current){let u=o.current,h=i.current,d,p=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let f=u.offsetHeight;h.style.setProperty("--cmdk-list-height",f.toFixed(1)+"px")})});return p.observe(u),()=>{cancelAnimationFrame(d),p.unobserve(u)}}},[]),x.createElement(wi.div,{ref:gi(i,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},Th(e,u=>x.createElement("div",{ref:gi(o,c.listInnerRef),"cmdk-list-sizer":""},u)))}),W$=x.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:o,...l}=e;return x.createElement(S$,{open:n,onOpenChange:r},x.createElement(k$,{container:o},x.createElement(C$,{"cmdk-overlay":"",className:s}),x.createElement(N$,{"aria-label":e.label,"cmdk-dialog":"",className:i},x.createElement(V2,{ref:t,...l}))))}),U$=x.forwardRef((e,t)=>vi(n=>n.filtered.count===0)?x.createElement(wi.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),q$=x.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...i}=e;return x.createElement(wi.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Th(e,o=>x.createElement("div",{"aria-hidden":!0},o)))}),Tl=Object.assign(V2,{List:H$,Item:B$,Input:$$,Group:F$,Separator:z$,Dialog:W$,Empty:U$,Loading:q$});function K$(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function V$(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Y2(e){let t=x.useRef(e);return ao(()=>{t.current=e}),t}var ao=typeof window>"u"?x.useEffect:x.useLayoutEffect;function Eo(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function vi(e){let t=jx(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function Q2(e,t,n,r=[]){let s=x.useRef(),i=Dc();return ao(()=>{var o;let l=(()=>{var u;for(let h of n){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(u=h.current.textContent)==null?void 0:u.trim():s.current}})(),c=r.map(u=>u.trim());i.value(e,l,c),(o=t.current)==null||o.setAttribute(No,l),s.current=l}),s}var Y$=()=>{let[e,t]=x.useState(),n=Eo(()=>new Map);return ao(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function Q$(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Th({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(Q$(t),{ref:t.ref},n(t.props.children)):n(t)}var X$={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function G$(e,t,n={}){const{cycleFilter:r="current",includeCompletedFilter:s=!1,minQueryLength:i=2,maxResults:o=20,debounceMs:l=150}=n,c=dn(),[u,h]=x.useState(e);x.useEffect(()=>{const m=setTimeout(()=>{h(e)},l);return()=>clearTimeout(m)},[e,l]);const d=c.getQueryData(["issues",r,s]),p=x.useMemo(()=>{if(!u||u.trim().length<i)return[];if(!d||d.length===0)return[];const m=u.toLowerCase().trim(),g=[];for(const w of d){if(t.sources.size>0&&w.source&&!t.sources.has(w.source)||!t.includeCompleted&&(w.status==="Done"||w.status==="Completed"||w.status==="Closed"))continue;let v=0,y=null;const _=w.identifier.toLowerCase();_===m?(v=100,y="identifier"):_.startsWith(m)?(v=80,y="identifier"):_.includes(m)&&(v=60,y="identifier");const b=w.title.toLowerCase();if(b.includes(m)){const N=b.startsWith(m)?70:50;N>v&&(v=N,y="title")}t.deepSearch&&w.description&&w.description.toLowerCase().includes(m)&&20>v&&(v=20,y="description"),v>0&&y&&g.push({issue:w,score:v,matchType:y})}return g.sort((w,v)=>v.score!==w.score?v.score-w.score:w.issue.identifier.localeCompare(v.issue.identifier)),g.slice(0,o)},[u,d,t,i,o]),f=x.useMemo(()=>{const m={};for(const g of p){const w=g.issue.source||"unknown";m[w]||(m[w]=[]),m[w].push(g)}return m},[p]);return{results:p,groupedResults:f,isSearching:e!==u,hasResults:p.length>0,resultCount:p.length}}const J$={linear:"Linear",github:"GitHub",rally:"Rally",gitlab:"GitLab",jira:"Jira",unknown:"Unknown"},Z$={0:"text-content-muted",1:"text-red-500",2:"text-orange-500",3:"text-yellow-500",4:"text-blue-500"},e8={backlog:"bg-surface-emphasis",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 t8({groupedResults:e,onSelect:t,onExternalLink:n}){const r=Object.keys(e).sort();return a.jsx(a.Fragment,{children:r.map(s=>a.jsx(Tl.Group,{heading:J$[s]||s,children:e[s].map(i=>{const{issue:o,matchType:l}=i,c=Tt[o.status]||"backlog";return a.jsx(Tl.Item,{value:o.identifier,onSelect:()=>t(o.identifier),className:"px-4 py-3 cursor-pointer hover:bg-surface-overlay transition-colors border-b border-gray-750 last:border-b-0 aria-selected:bg-surface-overlay",children: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-content flex items-center gap-1",children:[o.source==="github"&&a.jsx(Uv,{className:"w-3 h-3 text-content-subtle"}),a.jsx("span",{className:"text-content-subtle",children:o.identifier})]}),a.jsx("span",{className:`px-2 py-0.5 rounded text-xs text-content ${e8[c]||"bg-surface-emphasis"}`,children:o.status}),a.jsx("span",{title:`Priority ${o.priority}`,children:a.jsx(dk,{className:`w-2 h-2 fill-current ${Z$[o.priority]||"text-content-muted"}`})}),l&&a.jsxs("span",{className:"text-xs text-content-muted",children:["(",l," match)"]})]}),a.jsx("p",{className:"text-sm text-content-body 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(u=>a.jsx("span",{className:"text-xs bg-surface-overlay text-content-subtle px-2 py-0.5 rounded",children:u},u)),o.labels.length>3&&a.jsxs("span",{className:"text-xs text-content-muted",children:["+",o.labels.length-3," more"]})]})]}),a.jsx("button",{onClick:u=>n(o.url,u),className:"p-1 text-content-subtle hover:text-blue-400 hover:bg-surface-emphasis rounded transition-colors shrink-0",title:"Open in tracker",children:a.jsx(gs,{className:"w-4 h-4"})})]})},o.id)})},s))})}function n8({isOpen:e,onClose:t,onSelectIssue:n,cycleFilter:r="current",includeCompletedFilter:s=!1}){const[i,o]=x.useState(""),[l,c]=x.useState({sources:new Set,includeCompleted:!1,deepSearch:!1}),{groupedResults:u,isSearching:h,hasResults:d,resultCount:p}=G$(i,l,{cycleFilter:r,includeCompletedFilter:s});x.useEffect(()=>{e||(o(""),c({sources:new Set,includeCompleted:!1,deepSearch:!1}))},[e]),x.useEffect(()=>{const w=v=>{v.key==="Escape"&&t()};if(e)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[e,t]);const f=w=>{c(v=>{const y=new Set(v.sources);return y.has(w)?y.delete(w):y.add(w),{...v,sources:y}})},m=w=>{n(w),t()},g=(w,v)=>{v.stopPropagation(),window.open(w,"_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-surface-raised rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[70vh] overflow-hidden flex flex-col border border-divider",children:a.jsxs(Tl,{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-divider",children:[a.jsx(GR,{className:"w-5 h-5 text-content-subtle shrink-0"}),a.jsx(Tl.Input,{value:i,onValueChange:o,placeholder:"Search issues...",className:"flex-1 bg-transparent text-content placeholder-gray-400 focus:outline-none text-base",autoFocus:!0}),a.jsx("button",{onClick:t,className:"p-1 text-content-subtle hover:text-content hover:bg-surface-overlay rounded transition-colors shrink-0",children:a.jsx(mt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-divider bg-gray-850 flex-wrap",children:[a.jsx("span",{className:"text-xs text-content-subtle",children:"Filters:"}),["linear","github","rally"].map(w=>a.jsxs("button",{onClick:()=>f(w),className:`px-2 py-1 text-xs rounded transition-colors ${l.sources.size===0||l.sources.has(w)?"bg-blue-600 text-content":"bg-surface-overlay text-content-subtle hover:text-content"}`,children:[w==="github"&&a.jsx(Uv,{className:"w-3 h-3 inline mr-1"}),w.charAt(0).toUpperCase()+w.slice(1)]},w)),a.jsx("div",{className:"w-px h-4 bg-surface-emphasis"}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:l.includeCompleted,onChange:w=>c(v=>({...v,includeCompleted:w.target.checked})),className:"w-3 h-3 rounded border-divider-strong bg-surface-overlay text-blue-600 focus:ring-blue-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-xs text-content-subtle",children:"Show completed"})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:l.deepSearch,onChange:w=>c(v=>({...v,deepSearch:w.target.checked})),className:"w-3 h-3 rounded border-divider-strong bg-surface-overlay text-blue-600 focus:ring-blue-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-xs text-content-subtle",children:"Deep search"})]})]}),a.jsxs(Tl.List,{className:"flex-1 overflow-y-auto",children:[i.length>0&&i.length<2&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-content-subtle",children:"Type at least 2 characters to search"}),i.length>=2&&h&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-content-subtle",children:"Searching..."}),i.length>=2&&!h&&!d&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-content-subtle",children:"No issues found"}),i.length>=2&&!h&&d&&a.jsx(t8,{groupedResults:u,onSelect:m,onExternalLink:g})]}),p>0&&a.jsxs("div",{className:"px-4 py-2 border-t border-divider bg-gray-850 text-xs text-content-subtle flex items-center justify-between",children:[a.jsxs("span",{children:[p," result",p!==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-surface-overlay rounded text-xs",children:"↑"}),a.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay 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-surface-overlay 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-surface-overlay rounded text-xs",children:"Esc"}),"close"]})]})]})]})})]}):null}const r8="_missionControl_1x340_4",s8="_layout_1x340_53",i8="_sidebar_1x340_60",o8="_resizeHandle_1x340_69",a8="_sidebarHeader_1x340_83",l8="_sidebarTitle_1x340_88",c8="_sidebarSubtitle_1x340_94",u8="_projectTree_1x340_100",d8="_projectNode_1x340_107",h8="_projectHeader_1x340_111",f8="_chevron_1x340_131",p8="_chevronOpen_1x340_137",m8="_projectName_1x340_141",g8="_featureCount_1x340_148",v8="_featureItem_1x340_155",x8="_featureItemSelected_1x340_174",y8="_featureStatus_1x340_178",_8="_featureLabel_1x340_187",b8="_featureId_sidebar_1x340_194",w8="_featureState_1x340_202",S8="_featureCost_1x340_212",k8="_emptyProject_1x340_218",C8="_content_1x340_226",N8="_contentEmpty_1x340_234",E8="_featureHeader_1x340_244",j8="_featureTitle_1x340_253",R8="_featureId_1x340_194",P8="_badgeBar_1x340_267",T8="_badge_1x340_267",D8="_badgeDisabled_1x340_294",M8="_activityContainer_1x340_305",A8="_agentSection_1x340_315",L8="_sectionHeader_1x340_321",O8="_sectionType_1x340_336",I8="_typePlanning_1x340_345",B8="_typeWork_1x340_350",F8="_typeReview_1x340_355",z8="_typeTest_1x340_360",$8="_typeMerge_1x340_365",H8="_sectionModel_1x340_372",W8="_sectionTime_1x340_378",U8="_sectionCost_1x340_384",q8="_costSummary_1x340_391",K8="_sectionStatus_1x340_399",V8="_statusRunning_1x340_406",Y8="_statusCompleted_1x340_411",Q8="_statusFailed_1x340_415",X8="_sectionContent_1x340_424",G8="_unreadDot_1x340_437",J8="_isolationOverlay_1x340_446",Z8="_isolationHeader_1x340_455",e9="_isolationClose_1x340_464",t9="_isolationContent_1x340_480",n9="_modalOverlay_1x340_492",r9="_modalContent_1x340_503",s9="_modalHeader_1x340_514",i9="_modalTitle_1x340_522",o9="_modalClose_1x340_528",a9="_modalBody_1x340_543",l9="_uploadZone_1x340_550",c9="_uploadZoneActive_1x340_561",u9="_uploadIcon_1x340_567",d9="_uploadText_1x340_571",h9="_uploadHint_1x340_576",f9="_syncButton_1x340_617",p9="_spinning_1x340_646",m9="_markdownContent_1x340_678",g9="_kbdHint_1x340_732",X={missionControl:r8,layout:s8,sidebar:i8,resizeHandle:o8,sidebarHeader:a8,sidebarTitle:l8,sidebarSubtitle:c8,projectTree:u8,projectNode:d8,projectHeader:h8,chevron:f8,chevronOpen:p8,projectName:m8,featureCount:g8,featureItem:v8,featureItemSelected:x8,featureStatus:y8,featureLabel:_8,featureId_sidebar:b8,featureState:w8,featureCost:S8,emptyProject:k8,content:C8,contentEmpty:N8,featureHeader:E8,featureTitle:j8,featureId:R8,badgeBar:P8,badge:T8,badgeDisabled:D8,activityContainer:M8,agentSection:A8,sectionHeader:L8,sectionType:O8,typePlanning:I8,typeWork:B8,typeReview:F8,typeTest:z8,typeMerge:$8,sectionModel:H8,sectionTime:W8,sectionCost:U8,costSummary:q8,sectionStatus:K8,statusRunning:V8,statusCompleted:Y8,statusFailed:Q8,sectionContent:X8,unreadDot:G8,isolationOverlay:J8,isolationHeader:Z8,isolationClose:e9,isolationContent:t9,modalOverlay:n9,modalContent:r9,modalHeader:s9,modalTitle:i9,modalClose:o9,modalBody:a9,uploadZone:l9,uploadZoneActive:c9,uploadIcon:u9,uploadText:d9,uploadHint:h9,syncButton:f9,spinning:p9,markdownContent:m9,kbdHint:g9};function v9({status:e,agentStatus:t,stateLabel:n,isRally:r}){if(r){const s=n==="Done"?"var(--mc-success)":n==="In Progress"?"var(--mc-warning)":"var(--mc-text-muted)";return a.jsx(mk,{size:14,style:{color:s}})}return e==="running"?a.jsx(je,{size:14,className:X.spinning,style:{color:"var(--mc-success)"}}):t==="suspended"||n==="In Progress"||n==="Suspended"?a.jsx(Wn,{size:14,style:{color:"var(--mc-warning)"}}):e==="has_state"?a.jsx(Ri,{size:14,style:{color:"var(--mc-text-muted)"}}):a.jsx(dk,{size:14,style:{color:"var(--mc-text-muted)"}})}function x9(e){return e<.01?"<$0.01":e<1?`$${e.toFixed(2)}`:`$${e.toFixed(2)}`}function y9({feature:e,isSelected:t,onSelect:n,title:r,cost:s}){const i=e.isRally&&e.childCount&&e.childCount>0?Math.round((e.completedCount||0)/e.childCount*100):null;return a.jsxs("button",{className:`${X.featureItem} ${t?X.featureItemSelected:""}`,onClick:n,children:[a.jsx("span",{className:X.featureStatus,children:e.isShadow?a.jsx(hh,{size:14,style:{color:"var(--mc-accent)"}}):a.jsx(v9,{status:e.status,agentStatus:e.agentStatus,stateLabel:e.stateLabel,isRally:e.isRally})}),a.jsx("span",{className:X.featureId_sidebar,children:e.issueId}),a.jsx("span",{className:X.featureLabel,children:r||e.issueId}),e.isRally&&e.childCount!=null&&e.childCount>0?a.jsxs("span",{className:X.featureState,title:`${e.completedCount||0}/${e.childCount} stories done${e.inProgressCount?`, ${e.inProgressCount} active`:""}`,children:[e.completedCount||0,"/",e.childCount,i!==null&&a.jsx("span",{style:{display:"inline-block",width:24,height:4,marginLeft:4,background:"var(--mc-border)",borderRadius:2,overflow:"hidden",verticalAlign:"middle"},children:a.jsx("span",{style:{display:"block",width:`${i}%`,height:"100%",background:i===100?"var(--mc-success)":"var(--mc-warning)",borderRadius:2}})})]}):a.jsx("span",{className:X.featureState,children:e.stateLabel}),s!==void 0&&s>0&&a.jsx("span",{className:X.featureCost,children:x9(s)})]})}function _9({name:e,features:t,selectedFeature:n,onSelectFeature:r,issueTitles:s,issueCosts:i}){const[o,l]=x.useState(t.length>0);return a.jsxs("div",{className:X.projectNode,children:[a.jsxs("button",{className:X.projectHeader,onClick:()=>l(!o),children:[a.jsx(Wv,{className:`${X.chevron} ${o?X.chevronOpen:""}`,size:14}),a.jsx("span",{className:X.projectName,children:e}),a.jsx("span",{className:X.featureCount,children:t.length})]}),o&&(t.length>0?t.map(c=>a.jsx(y9,{feature:c,isSelected:n===c.issueId,onSelect:()=>r(c.issueId),title:(s==null?void 0:s[c.issueId.toLowerCase()])||(s==null?void 0:s[c.issueId])||c.title,cost:(i==null?void 0:i[c.issueId.toLowerCase()])||(i==null?void 0:i[c.issueId])},c.issueId)):a.jsx("div",{className:X.emptyProject,children:"(no active features)"}))]})}const b9={planning:X.typePlanning,work:X.typeWork,review:X.typeReview,test:X.typeTest,merge:X.typeMerge},w9={running:X.statusRunning,completed:X.statusCompleted,failed:X.statusFailed};function S9(e){return e===null?"":e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function k9(e){if(!e)return"";try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function zb(e){return!e||e==="unknown"?"":e.replace("claude-opus-4-6","Opus 4.6").replace("claude-sonnet-4-5-20250929","Sonnet 4.5").replace("claude-haiku-4-5-20251001","Haiku 4.5").replace("claude-","").replace("specialist","")}function C9(e){return e<.01?"<$0.01":`$${e.toFixed(2)}`}function N9({section:e,isUnread:t,onClick:n,cost:r}){const s=x.useRef(null),i=x.useRef(!1);return x.useEffect(()=>{s.current&&(!i.current||e.status==="running")&&(requestAnimationFrame(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)}),i.current=!0)},[e.transcript,e.status]),a.jsxs("div",{className:X.agentSection,children:[a.jsxs("div",{className:X.sectionHeader,onClick:n,title:"Click to focus this section",children:[a.jsx("div",{className:`${X.sectionStatus} ${w9[e.status]||X.statusCompleted}`}),a.jsx("span",{className:`${X.sectionType} ${b9[e.type]||""}`,children:e.type}),zb(e.model)&&a.jsx("span",{className:X.sectionModel,children:zb(e.model)}),a.jsxs("span",{className:X.sectionTime,children:[k9(e.startedAt),e.duration!==null&&` (${S9(e.duration)})`]}),r!==void 0&&r>0&&a.jsx("span",{className:X.sectionCost,children:C9(r)}),t&&a.jsx("div",{className:X.unreadDot})]}),a.jsx("div",{ref:s,className:X.sectionContent,children:e.transcript||"(no output yet)"})]})}const E9={planning:X.typePlanning,work:X.typeWork,review:X.typeReview,test:X.typeTest,merge:X.typeMerge};function $b(e){return!e||e==="unknown"?"":e.replace("claude-opus-4-6","Opus 4.6").replace("claude-sonnet-4-5-20250929","Sonnet 4.5").replace("claude-haiku-4-5-20251001","Haiku 4.5").replace("claude-","").replace("specialist","")}function j9({section:e,onClose:t}){const n=x.useRef(null);return x.useEffect(()=>{e.status==="running"&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.transcript,e.status]),x.useEffect(()=>{history.pushState({isolation:!0},"");const r=()=>{t()};return window.addEventListener("popstate",r),()=>{window.removeEventListener("popstate",r)}},[t]),a.jsxs("div",{className:X.isolationOverlay,children:[a.jsxs("div",{className:X.isolationHeader,children:[a.jsxs("button",{className:X.isolationClose,onClick:t,children:[a.jsx("kbd",{className:X.kbdHint,children:"Esc"})," Close"]}),a.jsx("span",{className:`${X.sectionType} ${E9[e.type]||""}`,children:e.type}),$b(e.model)&&a.jsx("span",{className:X.sectionModel,children:$b(e.model)}),a.jsx("span",{className:X.sectionTime,children:e.sessionId})]}),a.jsx("div",{ref:n,className:X.isolationContent,children:e.transcript||"(no output)"})]})}async function R9(e){const t=await fetch(`/api/mission-control/activity/${e}`);if(!t.ok)throw new Error("Failed to fetch activity");return t.json()}function P9(e){return e==="Done"||e==="Completed"||e==="Closed"?"var(--mc-success)":e==="In Progress"||e==="Started"||e==="Active"?"var(--mc-warning)":e==="In Review"||e==="Review"||e==="QA"||e==="Testing"?"#ec4899":"var(--mc-text-muted)"}function Hb({feature:e,issues:t}){const n=t.filter(c=>c.source==="rally"&&c.parentRef===e.issueId),r=t.find(c=>c.source==="rally"&&c.identifier===e.issueId);if(n.length===0&&!r)return null;const s=e.completedCount||0,i=e.childCount||n.length,o=e.inProgressCount||0,l=i>0?Math.round(s/i*100):0;return a.jsxs("div",{style:{marginBottom:16},children:[a.jsxs("div",{style:{background:"var(--mc-bg-secondary)",border:"1px solid var(--mc-border)",borderLeft:"3px solid #6366f1",borderRadius:6,padding:"12px 16px",marginBottom:12},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[a.jsx("span",{style:{fontWeight:600,color:"var(--mc-text-primary)",fontSize:"var(--mc-font-size-sm)"},children:e.issueId}),(r==null?void 0:r.url)&&a.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--mc-text-muted)"},children:a.jsx(gs,{size:12})}),e.rawTrackerState&&a.jsxs("span",{style:{fontSize:11,padding:"1px 6px",borderRadius:3,background:"rgba(107,114,128,0.15)",color:"var(--mc-text-muted)"},children:["Rally: ",e.rawTrackerState]}),e.stateLabel&&e.stateLabel!==e.rawTrackerState&&a.jsxs("span",{style:{fontSize:11,padding:"1px 6px",borderRadius:3,background:e.stateLabel==="In Progress"?"rgba(168,85,247,0.15)":"rgba(34,197,94,0.15)",color:e.stateLabel==="In Progress"?"#a855f7":"#22c55e"},children:["Derived: ",e.stateLabel]})]}),i>0&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("div",{style:{flex:1,height:6,background:"var(--mc-border)",borderRadius:3,overflow:"hidden"},children:a.jsx("div",{style:{width:`${l}%`,height:"100%",background:l===100?"var(--mc-success)":"#6366f1",borderRadius:3,transition:"width 0.3s ease"}})}),a.jsxs("span",{style:{fontSize:11,color:"var(--mc-text-muted)",whiteSpace:"nowrap"},children:[s,"/",i," done",o>0?`, ${o} active`:""]})]})]}),n.length>0&&a.jsxs("div",{style:{background:"var(--mc-bg-secondary)",border:"1px solid var(--mc-border)",borderRadius:6,overflow:"hidden"},children:[a.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--mc-border)",fontSize:"var(--mc-font-size-xs)",fontWeight:600,color:"var(--mc-text-muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:["User Stories (",n.length,")"]}),n.map(c=>{var u;return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",borderBottom:"1px solid var(--mc-border)",fontSize:"var(--mc-font-size-sm)"},children:[a.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:P9(c.status),flexShrink:0}}),a.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",style:{color:"#6366f1",textDecoration:"none",fontFamily:"monospace",fontSize:11,flexShrink:0},children:c.identifier}),a.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--mc-text-primary)"},children:c.title}),((u=c.assignee)==null?void 0:u.name)&&a.jsx("span",{style:{fontSize:11,color:"var(--mc-text-muted)",flexShrink:0},children:c.assignee.name}),c.rawTrackerState&&a.jsx("span",{style:{fontSize:10,padding:"1px 5px",borderRadius:3,background:"rgba(107,114,128,0.12)",color:"var(--mc-text-muted)",flexShrink:0},children:c.rawTrackerState})]},c.id)})]})]})}function T9({issueId:e,issues:t=[],featureData:n}){const[r,s]=x.useState(null),[i,o]=x.useState(new Set),l=x.useRef([]),c=x.useRef(null),{data:u,isLoading:h}=he({queryKey:["mission-control-activity",e],queryFn:()=>R9(e),refetchInterval:5e3}),d=(u==null?void 0:u.sections)||[],p=(u==null?void 0:u.costByStage)||{},f=(u==null?void 0:u.totalCost)||0;x.useEffect(()=>{const y=d.map(b=>b.sessionId);y.filter(b=>!l.current.includes(b)).length>0&&l.current.length>0&&o(b=>new Set(b)),l.current=y},[d]);const m=y=>{s(y),o(_=>new Set([..._,y.sessionId]))},g=()=>{s(null)},w=x.useRef(null);if(x.useEffect(()=>{d.length>0&&c.current&&(w.current!==e&&(w.current=e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight)})}))},[e,d]),x.useEffect(()=>{const y=_=>{_.key==="Escape"&&r&&g()};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[r]),h&&d.length===0)return a.jsx("div",{className:X.activityContainer,children:a.jsx("div",{style:{color:"var(--mc-text-muted)",fontSize:"var(--mc-font-size-sm)"},children:"Loading activity..."})});if(d.length===0){const y=(n==null?void 0:n.isRally)===!0;return a.jsxs("div",{className:X.activityContainer,children:[y&&n&&a.jsx(Hb,{feature:n,issues:t}),a.jsx("div",{style:{color:"var(--mc-text-muted)",fontSize:"var(--mc-font-size-sm)"},children:"No agent activity yet for this feature."})]})}const v=(n==null?void 0:n.isRally)===!0;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{ref:c,className:X.activityContainer,children:[v&&n&&a.jsx(Hb,{feature:n,issues:t}),f>0&&a.jsxs("div",{className:X.costSummary,children:["Total: $",f<.01?"<0.01":f.toFixed(2)]}),d.map(y=>{var k;const b={work:"implementation",planning:"planning",review:"review",test:"test",merge:"merge"}[y.type]||y.type,N=(k=p[b])==null?void 0:k.cost;return a.jsx(N9,{section:y,isUnread:!i.has(y.sessionId)&&l.current.length>0,onClick:()=>m(y),cost:N},y.sessionId)})]}),r&&a.jsx(j9,{section:r,onClose:g})]})}function Wb(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function D9(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function M9(e,t,n){const s=Nh((n||{}).ignore||[]),i=A9(t);let o=-1;for(;++o<i.length;)a2(e,"text",l);function l(u,h){let d=-1,p;for(;++d<h.length;){const f=h[d],m=p?p.children:void 0;if(s(f,m?m.indexOf(f):void 0,p))return;p=f}if(p)return c(u,h)}function c(u,h){const d=h[h.length-1],p=i[o][0],f=i[o][1];let m=0;const w=d.children.indexOf(u);let v=!1,y=[];p.lastIndex=0;let _=p.exec(u.value);for(;_;){const b=_.index,N={index:_.index,input:_.input,stack:[...h,u]};let k=f(..._,N);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?p.lastIndex=b+1:(m!==b&&y.push({type:"text",value:u.value.slice(m,b)}),Array.isArray(k)?y.push(...k):k&&y.push(k),m=b+_[0].length,v=!0),!p.global)break;_=p.exec(u.value)}return v?(m<u.value.length&&y.push({type:"text",value:u.value.slice(m)}),d.children.splice(w,1,...y)):y=[u],w+y.length}}function A9(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([L9(s[0]),O9(s[1])])}return t}function L9(e){return typeof e=="string"?new RegExp(D9(e),"g"):e}function O9(e){return typeof e=="function"?e:function(){return e}}const ep="phrasing",tp=["autolink","link","image","label"];function I9(){return{transforms:[U9],enter:{literalAutolink:F9,literalAutolinkEmail:np,literalAutolinkHttp:np,literalAutolinkWww:np},exit:{literalAutolink:W9,literalAutolinkEmail:H9,literalAutolinkHttp:z9,literalAutolinkWww:$9}}}function B9(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ep,notInConstruct:tp},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ep,notInConstruct:tp},{character:":",before:"[ps]",after:"\\/",inConstruct:ep,notInConstruct:tp}]}}function F9(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function np(e){this.config.enter.autolinkProtocol.call(this,e)}function z9(e){this.config.exit.autolinkProtocol.call(this,e)}function $9(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function H9(e){this.config.exit.autolinkEmail.call(this,e)}function W9(e){this.exit(e)}function U9(e){M9(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,q9],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),K9]],{ignore:["link","linkReference"]})}function q9(e,t,n,r,s){let i="";if(!X2(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!V9(n)))return!1;const o=Y9(n+r);if(!o[0])return!1;const l={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function K9(e,t,n,r){return!X2(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function V9(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Y9(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=Wb(e,"(");let i=Wb(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function X2(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||io(n)||Sh(n))&&(!t||n!==47)}G2.peek=r7;function Q9(){this.buffer()}function X9(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function G9(){this.buffer()}function J9(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Z9(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function e7(e){this.exit(e)}function t7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function n7(e){this.exit(e)}function r7(){return"["}function G2(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),l(),o(),i+=s.move("]"),i}function s7(){return{enter:{gfmFootnoteCallString:Q9,gfmFootnoteCall:X9,gfmFootnoteDefinitionLabelString:G9,gfmFootnoteDefinition:J9},exit:{gfmFootnoteCallString:Z9,gfmFootnoteCall:e7,gfmFootnoteDefinitionLabelString:t7,gfmFootnoteDefinition:n7}}}function i7(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:G2},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const l=i.createTracker(o);let c=l.move("[^");const u=i.enter("footnoteDefinition"),h=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),h(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?`
599
- `:" ")+i.indentLines(i.containerFlow(r,l.current()),t?J2:o7))),u(),c}}function o7(e,t,n){return t===0?e:J2(e,t,n)}function J2(e,t,n){return(n?"":" ")+e}const a7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Z2.peek=h7;function l7(){return{canContainEols:["delete"],enter:{strikethrough:u7},exit:{strikethrough:d7}}}function c7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:a7}],handlers:{delete:Z2}}}function u7(e){this.enter({type:"delete",children:[]},e)}function d7(e){this.exit(e)}function Z2(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function h7(){return"~"}function f7(e){return e.length}function p7(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||f7,i=[],o=[],l=[],c=[];let u=0,h=-1;for(;++h<e.length;){const g=[],w=[];let v=-1;for(e[h].length>u&&(u=e[h].length);++v<e[h].length;){const y=m7(e[h][v]);if(n.alignDelimiters!==!1){const _=s(y);w[v]=_,(c[v]===void 0||_>c[v])&&(c[v]=_)}g.push(y)}o[h]=g,l[h]=w}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<u;)i[d]=Ub(r[d]);else{const g=Ub(r);for(;++d<u;)i[d]=g}d=-1;const p=[],f=[];for(;++d<u;){const g=i[d];let w="",v="";g===99?(w=":",v=":"):g===108?w=":":g===114&&(v=":");let y=n.alignDelimiters===!1?1:Math.max(1,c[d]-w.length-v.length);const _=w+"-".repeat(y)+v;n.alignDelimiters!==!1&&(y=w.length+y+v.length,y>c[d]&&(c[d]=y),f[d]=y),p[d]=_}o.splice(1,0,p),l.splice(1,0,f),h=-1;const m=[];for(;++h<o.length;){const g=o[h],w=l[h];d=-1;const v=[];for(;++d<u;){const y=g[d]||"";let _="",b="";if(n.alignDelimiters!==!1){const N=c[d]-(w[d]||0),k=i[d];k===114?_=" ".repeat(N):k===99?N%2?(_=" ".repeat(N/2+.5),b=" ".repeat(N/2-.5)):(_=" ".repeat(N/2),b=_):b=" ".repeat(N)}n.delimiterStart!==!1&&!d&&v.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&y==="")&&(n.delimiterStart!==!1||d)&&v.push(" "),n.alignDelimiters!==!1&&v.push(_),v.push(y),n.alignDelimiters!==!1&&v.push(b),n.padding!==!1&&v.push(" "),(n.delimiterEnd!==!1||d!==u-1)&&v.push("|")}m.push(n.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return m.join(`
600
- `)}function m7(e){return e==null?"":String(e)}function Ub(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function g7(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),v7);return s(),o}function v7(e,t,n){return">"+(n?"":" ")+e}function x7(e,t){return qb(e,t.inConstruct,!0)&&!qb(e,t.notInConstruct,!1)}function qb(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Kb(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
601
- `&&x7(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
602
- `}function y7(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+t.length,r=n.indexOf(t,s);return o}function _7(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function b7(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function w7(e,t,n,r){const s=b7(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(_7(e,n)){const d=n.enter("codeIndented"),p=n.indentLines(i,S7);return d(),p}const l=n.createTracker(r),c=s.repeat(Math.max(y7(i,s)+1,3)),u=n.enter("codeFenced");let h=l.move(c);if(e.lang){const d=n.enter(`codeFencedLang${o}`);h+=l.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...l.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${o}`);h+=l.move(" "),h+=l.move(n.safe(e.meta,{before:h,after:`
603
- `,encode:["`"],...l.current()})),d()}return h+=l.move(`
604
- `),i&&(h+=l.move(i+`
605
- `)),h+=l.move(c),u(),h}function S7(e,t,n){return(n?"":" ")+e}function Rx(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function k7(e,t,n,r){const s=Rx(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
606
- `,...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),o(),u}function C7(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ac(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Wd(e,t,n){const r=_a(e),s=_a(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}eN.peek=N7;function eN(e,t,n,r){const s=C7(n),i=n.enter("emphasis"),o=n.createTracker(r),l=o.move(s);let c=o.move(n.containerPhrasing(e,{after:s,before:l,...o.current()}));const u=c.charCodeAt(0),h=Wd(r.before.charCodeAt(r.before.length-1),u,s);h.inside&&(c=ac(u)+c.slice(1));const d=c.charCodeAt(c.length-1),p=Wd(r.after.charCodeAt(0),d,s);p.inside&&(c=c.slice(0,-1)+ac(d));const f=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:h.outside},l+c+f}function N7(e,t,n){return n.options.emphasis||"*"}function E7(e,t){let n=!1;return bx(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,pg}),!!((!e.depth||e.depth<3)&&px(e)&&(t.options.setext||n))}function j7(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(E7(e,n)){const h=n.enter("headingSetext"),d=n.enter("phrasing"),p=n.containerPhrasing(e,{...i.current(),before:`
607
- `,after:`
608
- `});return d(),h(),p+`
609
- `+(s===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
610
- `))+1))}const o="#".repeat(s),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
611
- `,...i.current()});return/^[\t ]/.test(u)&&(u=ac(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),l(),u}tN.peek=R7;function tN(e){return e.value||""}function R7(){return"<"}nN.peek=P7;function nN(e,t,n,r){const s=Rx(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),u+=c.move(")"),o(),u}function P7(){return"!"}rN.peek=T7;function rN(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=h,i(),s==="full"||!u||u!==d?c+=l.move(d+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function T7(){return"!"}sN.peek=D7;function sN(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],l=n.compilePattern(o);let c;if(o.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return s+r+s}function D7(){return"`"}function iN(e,t){const n=px(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}oN.peek=M7;function oN(e,t,n,r){const s=Rx(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,c;if(iN(e,n)){const h=n.stack;n.stack=[],l=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(e,{before:d,after:">",...o.current()})),d+=o.move(">"),l(),n.stack=h,d}l=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=o.move(" "+s),u+=o.move(n.safe(e.title,{before:u,after:s,...o.current()})),u+=o.move(s),c()),u+=o.move(")"),l(),u}function M7(e,t,n){return iN(e,n)?"<":"["}aN.peek=A7;function aN(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=h,i(),s==="full"||!u||u!==d?c+=l.move(d+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function A7(){return"["}function Px(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function L7(e){const t=Px(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function O7(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function lN(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function I7(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?O7(n):Px(n);const l=e.ordered?o==="."?")":".":L7(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),lN(n)===o&&h){let d=-1;for(;++d<e.children.length;){const p=e.children[d];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=l),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),u}function B7(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function F7(e,t,n,r){const s=B7(n);let i=n.bulletCurrent||Px(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(o-i.length)),l.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),h);return c(),u;function h(d,p,f){return p?(f?"":" ".repeat(o))+d:(f?i:i+" ".repeat(o-i.length))+d}}function z7(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const $7=Nh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function H7(e,t,n,r){return(e.children.some(function(o){return $7(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function W7(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}cN.peek=U7;function cN(e,t,n,r){const s=W7(n),i=n.enter("strong"),o=n.createTracker(r),l=o.move(s+s);let c=o.move(n.containerPhrasing(e,{after:s,before:l,...o.current()}));const u=c.charCodeAt(0),h=Wd(r.before.charCodeAt(r.before.length-1),u,s);h.inside&&(c=ac(u)+c.slice(1));const d=c.charCodeAt(c.length-1),p=Wd(r.after.charCodeAt(0),d,s);p.inside&&(c=c.slice(0,-1)+ac(d));const f=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:h.outside},l+c+f}function U7(e,t,n){return n.options.strong||"*"}function q7(e,t,n,r){return n.safe(e.value,r)}function K7(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function V7(e,t,n){const r=(lN(n)+(n.options.ruleSpaces?" ":"")).repeat(K7(n));return n.options.ruleSpaces?r.slice(0,-1):r}const uN={blockquote:g7,break:Kb,code:w7,definition:k7,emphasis:eN,hardBreak:Kb,heading:j7,html:tN,image:nN,imageReference:rN,inlineCode:sN,link:oN,linkReference:aN,list:I7,listItem:F7,paragraph:z7,root:H7,strong:cN,text:q7,thematicBreak:V7};function Y7(){return{enter:{table:Q7,tableData:Vb,tableHeader:Vb,tableRow:G7},exit:{codeText:J7,table:X7,tableData:rp,tableHeader:rp,tableRow:rp}}}function Q7(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function X7(e){this.exit(e),this.data.inTable=void 0}function G7(e){this.enter({type:"tableRow",children:[]},e)}function rp(e){this.exit(e)}function Vb(e){this.enter({type:"tableCell",children:[]},e)}function J7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Z7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Z7(e,t){return t==="|"?t:e}function eH(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
612
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:o,tableCell:c,tableRow:l}};function o(f,m,g,w){return u(h(f,g,w),f.align)}function l(f,m,g,w){const v=d(f,g,w),y=u([v]);return y.slice(0,y.indexOf(`
613
- `))}function c(f,m,g,w){const v=g.enter("tableCell"),y=g.enter("phrasing"),_=g.containerPhrasing(f,{...w,before:i,after:i});return y(),v(),_}function u(f,m){return p7(f,{align:m,alignDelimiters:r,padding:n,stringLength:s})}function h(f,m,g){const w=f.children;let v=-1;const y=[],_=m.enter("table");for(;++v<w.length;)y[v]=d(w[v],m,g);return _(),y}function d(f,m,g){const w=f.children;let v=-1;const y=[],_=m.enter("tableRow");for(;++v<w.length;)y[v]=c(w[v],f,m,g);return _(),y}function p(f,m,g){let w=uN.inlineCode(f,m,g);return g.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function tH(){return{exit:{taskListCheckValueChecked:Yb,taskListCheckValueUnchecked:Yb,paragraph:rH}}}function nH(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:sH}}}function Yb(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function rH(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let i=-1,o;for(;++i<s.length;){const l=s[i];if(l.type==="paragraph"){o=l;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function sH(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);i&&l.move(o);let c=uN.listItem(e,t,n,{...r,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(h){return h+o}}function iH(){return[I9(),s7(),l7(),Y7(),tH()]}function oH(e){return{extensions:[B9(),i7(e),c7(),eH(e),nH()]}}const aH={tokenize:fH,partial:!0},dN={tokenize:pH,partial:!0},hN={tokenize:mH,partial:!0},fN={tokenize:gH,partial:!0},lH={tokenize:vH,partial:!0},pN={name:"wwwAutolink",tokenize:dH,previous:gN},mN={name:"protocolAutolink",tokenize:hH,previous:vN},_s={name:"emailAutolink",tokenize:uH,previous:xN},Qr={};function cH(){return{text:Qr}}let ki=48;for(;ki<123;)Qr[ki]=_s,ki++,ki===58?ki=65:ki===91&&(ki=97);Qr[43]=_s;Qr[45]=_s;Qr[46]=_s;Qr[95]=_s;Qr[72]=[_s,mN];Qr[104]=[_s,mN];Qr[87]=[_s,pN];Qr[119]=[_s,pN];function uH(e,t,n){const r=this;let s,i;return o;function o(d){return!kg(d)||!xN.call(r,r.previous)||Tx(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(d))}function l(d){return kg(d)?(e.consume(d),l):d===64?(e.consume(d),c):n(d)}function c(d){return d===46?e.check(lH,h,u)(d):d===45||d===95||Gt(d)?(i=!0,e.consume(d),c):h(d)}function u(d){return e.consume(d),s=!0,c}function h(d){return i&&s&&an(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function dH(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!gN.call(r,r.previous)||Tx(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(aH,e.attempt(dN,e.attempt(hN,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function hH(e,t,n){const r=this;let s="",i=!1;return o;function o(d){return(d===72||d===104)&&vN.call(r,r.previous)&&!Tx(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(d),e.consume(d),l):n(d)}function l(d){if(an(d)&&s.length<5)return s+=String.fromCodePoint(d),e.consume(d),l;if(d===58){const p=s.toLowerCase();if(p==="http"||p==="https")return e.consume(d),c}return n(d)}function c(d){return d===47?(e.consume(d),i?u:(i=!0,c)):n(d)}function u(d){return d===null||Bd(d)||Ie(d)||io(d)||Sh(d)?n(d):e.attempt(dN,e.attempt(hN,h),n)(d)}function h(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function fH(e,t,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),s):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function pH(e,t,n){let r,s,i;return o;function o(u){return u===46||u===95?e.check(fN,c,l)(u):u===null||Ie(u)||io(u)||u!==45&&Sh(u)?c(u):(i=!0,e.consume(u),o)}function l(u){return u===95?r=!0:(s=r,r=void 0),e.consume(u),o}function c(u){return s||r||!i?n(u):t(u)}}function mH(e,t){let n=0,r=0;return s;function s(o){return o===40?(n++,e.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(fN,t,i)(o):o===null||Ie(o)||io(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function gH(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),i):l===93?(e.consume(l),s):l===60||l===null||Ie(l)||io(l)?t(l):n(l)}function s(l){return l===null||l===40||l===91||Ie(l)||io(l)?t(l):r(l)}function i(l){return an(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),r):an(l)?(e.consume(l),o):n(l)}}function vH(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return Gt(i)?n(i):t(i)}}function gN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ie(e)}function vN(e){return!an(e)}function xN(e){return!(e===47||kg(e))}function kg(e){return e===43||e===45||e===46||e===95||Gt(e)}function Tx(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const xH={tokenize:NH,partial:!0};function yH(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:SH,continuation:{tokenize:kH},exit:CH}},text:{91:{name:"gfmFootnoteCall",tokenize:wH},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:_H,resolveTo:bH}}}}function _H(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return n(c);const u=wr(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function bH(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function wH(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return l;function l(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),c}function c(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(d){if(i>999||d===93&&!o||d===null||d===91||Ie(d))return n(d);if(d===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return s.includes(wr(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return Ie(d)||(o=!0),i++,e.consume(d),d===92?h:u}function h(d){return d===91||d===92||d===93?(e.consume(d),i++,u):u(d)}}function SH(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,l;return c;function c(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(m)}function h(m){if(o>999||m===93&&!l||m===null||m===91||Ie(m))return n(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=wr(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return Ie(m)||(l=!0),o++,e.consume(m),m===92?d:h}function d(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}function p(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),s.includes(i)||s.push(i),Re(e,f,"gfmFootnoteDefinitionWhitespace")):n(m)}function f(m){return t(m)}}function kH(e,t,n){return e.check(jc,t,e.attempt(xH,t,n))}function CH(e){e.exit("gfmFootnoteDefinition")}function NH(e,t,n){const r=this;return Re(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function EH(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},d={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},p=[["enter",h,l],["enter",o[u][1],l],["exit",o[u][1],l],["enter",d,l]],f=l.parser.constructs.insideSpan.null;f&&$n(p,p.length,0,kh(f,o.slice(u+1,c),l)),$n(p,p.length,0,[["exit",d,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",h,l]]),$n(o,u-1,c-u+3,p),c=u+p.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,l,c){const u=this.previous,h=this.events;let d=0;return p;function p(m){return u===126&&h[h.length-1][1].type!=="characterEscape"?c(m):(o.enter("strikethroughSequenceTemporary"),f(m))}function f(m){const g=_a(u);if(m===126)return d>1?c(m):(o.consume(m),d++,f);if(d<2&&!n)return c(m);const w=o.exit("strikethroughSequenceTemporary"),v=_a(m);return w._open=!v||v===2&&!!g,w._close=!g||g===2&&!!v,l(m)}}}class jH{constructor(){this.map=[]}add(t,n,r){RH(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function RH(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function PH(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function TH(){return{flow:{null:{name:"table",tokenize:DH,resolveAll:MH}}}}function DH(e,t,n){const r=this;let s=0,i=0,o;return l;function l(P){let O=r.events.length-1;for(;O>-1;){const R=r.events[O][1].type;if(R==="lineEnding"||R==="linePrefix")O--;else break}const T=O>-1?r.events[O][1].type:null,E=T==="tableHead"||T==="tableRow"?k:c;return E===k&&r.parser.lazy[r.now().line]?n(P):E(P)}function c(P){return e.enter("tableHead"),e.enter("tableRow"),u(P)}function u(P){return P===124||(o=!0,i+=1),h(P)}function h(P){return P===null?n(P):de(P)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),f):n(P):Ce(P)?Re(e,h,"whitespace")(P):(i+=1,o&&(o=!1,s+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),o=!0,h):(e.enter("data"),d(P)))}function d(P){return P===null||P===124||Ie(P)?(e.exit("data"),h(P)):(e.consume(P),P===92?p:d)}function p(P){return P===92||P===124?(e.consume(P),d):d(P)}function f(P){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(P):(e.enter("tableDelimiterRow"),o=!1,Ce(P)?Re(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):m(P))}function m(P){return P===45||P===58?w(P):P===124?(o=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),g):N(P)}function g(P){return Ce(P)?Re(e,w,"whitespace")(P):w(P)}function w(P){return P===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),v):P===45?(i+=1,v(P)):P===null||de(P)?b(P):N(P)}function v(P){return P===45?(e.enter("tableDelimiterFiller"),y(P)):N(P)}function y(P){return P===45?(e.consume(P),y):P===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(P))}function _(P){return Ce(P)?Re(e,b,"whitespace")(P):b(P)}function b(P){return P===124?m(P):P===null||de(P)?!o||s!==i?N(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):N(P)}function N(P){return n(P)}function k(P){return e.enter("tableRow"),j(P)}function j(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),j):P===null||de(P)?(e.exit("tableRow"),t(P)):Ce(P)?Re(e,j,"whitespace")(P):(e.enter("data"),D(P))}function D(P){return P===null||P===124||Ie(P)?(e.exit("data"),j(P)):(e.consume(P),P===92?F:D)}function F(P){return P===92||P===124?(e.consume(P),D):D(P)}}function MH(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,u,h,d;const p=new jH;for(;++n<e.length;){const f=e[n],m=f[1];f[0]==="enter"?m.type==="tableHead"?(l=!1,c!==0&&(Qb(p,t,c,u,h),h=void 0,c=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,i=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,h={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",h,t]])),s=m.type==="tableDelimiterRow"?2:h?3:1):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],d=bu(p,t,i,s,void 0,d),i=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],d=bu(p,t,i,s,void 0,d)),i=o,o=[i[1],n,0,0])):m.type==="tableHead"?(l=!0,c=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],d=bu(p,t,i,s,n,d)):o[1]!==0&&(d=bu(p,t,o,s,n,d)),s=0):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&Qb(p,t,c,u,h),p.consume(t.events),n=-1;++n<t.events.length;){const f=t.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=PH(t.events,n))}return e}function bu(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},jo(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=jo(t.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=jo(t.events,n[2]),h=jo(t.events,n[3]),d={type:l,start:Object.assign({},u),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const p=t.events[n[2]],f=t.events[n[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,g=n[3]-n[2]-1;e.add(m,g,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return s!==void 0&&(i.end=Object.assign({},jo(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function Qb(e,t,n,r,s){const i=[],o=jo(t.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function jo(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const AH={name:"tasklistCheck",tokenize:OH};function LH(){return{text:{91:AH}}}function OH(e,t,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Ie(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return de(c)?t(c):Ce(c)?e.check({tokenize:IH},t,n)(c):n(c)}}function IH(e,t,n){return Re(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function BH(e){return HC([cH(),yH(),EH(e),TH(),LH()])}const FH={};function zH(e){const t=this,n=e||FH,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(BH(n)),i.push(iH()),o.push(oH(n))}function $H({title:e,content:t,onClose:n}){return x.useEffect(()=>{const r=s=>{s.key==="Escape"&&n()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[n]),a.jsx("div",{className:X.modalOverlay,onClick:n,children:a.jsxs("div",{className:X.modalContent,onClick:r=>r.stopPropagation(),children:[a.jsxs("div",{className:X.modalHeader,children:[a.jsx("h2",{className:X.modalTitle,children:e}),a.jsx("button",{className:X.modalClose,onClick:n,children:a.jsx(mt,{size:18})})]}),a.jsx("div",{className:X.modalBody,children:a.jsx("div",{className:X.markdownContent,children:a.jsx(xg,{remarkPlugins:[zH],children:t})})})]})})}function HH({issueId:e,onClose:t}){const[n,r]=x.useState(!1),[s,i]=x.useState("transcript"),[o,l]=x.useState(!1),[c,u]=x.useState(null),h=x.useRef(null),d=x.useCallback(async w=>{if(!w.name.endsWith(".md")&&!w.name.endsWith(".txt")){u("Only .md and .txt files are supported");return}l(!0),u(null);try{const v=await w.text(),y=await fetch(`/api/mission-control/planning/${e}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:s,filename:w.name,content:v})});if(!y.ok){const _=await y.json();throw new Error(_.error||"Upload failed")}u(`Uploaded ${w.name} as ${s}`),setTimeout(()=>t(),1500)}catch(v){u(`Error: ${v.message}`)}finally{l(!1)}},[e,s,t]),p=x.useCallback(w=>{w.preventDefault(),r(!1);const v=w.dataTransfer.files[0];v&&d(v)},[d]),f=x.useCallback(w=>{w.preventDefault(),r(!0)},[]),m=x.useCallback(()=>{r(!1)},[]),g=x.useCallback(w=>{var y;const v=(y=w.target.files)==null?void 0:y[0];v&&d(v)},[d]);return a.jsx("div",{className:X.modalOverlay,onClick:t,children:a.jsxs("div",{className:X.modalContent,onClick:w=>w.stopPropagation(),style:{maxWidth:500},children:[a.jsxs("div",{className:X.modalHeader,children:[a.jsx("h2",{className:X.modalTitle,children:"Upload Artifact"}),a.jsx("button",{className:X.modalClose,onClick:t,children:a.jsx(mt,{size:18})})]}),a.jsxs("div",{className:X.modalBody,children:[a.jsxs("div",{style:{display:"flex",gap:"var(--mc-space-2)",marginBottom:"var(--mc-space-4)"},children:[a.jsx("button",{className:X.badge,style:s==="transcript"?{borderColor:"var(--mc-accent)",color:"var(--mc-accent)"}:{},onClick:()=>i("transcript"),children:"Transcript"}),a.jsx("button",{className:X.badge,style:s==="note"?{borderColor:"var(--mc-accent)",color:"var(--mc-accent)"}:{},onClick:()=>i("note"),children:"Note"})]}),a.jsxs("div",{className:`${X.uploadZone} ${n?X.uploadZoneActive:""}`,onDrop:p,onDragOver:f,onDragLeave:m,onClick:()=>{var w;return(w=h.current)==null?void 0:w.click()},children:[a.jsx("div",{className:X.uploadIcon,children:o?a.jsx(li,{size:32,className:X.spinning}):a.jsx(wk,{size:32})}),a.jsx("p",{className:X.uploadText,children:o?"Uploading...":"Drop a file here or click to browse"}),a.jsx("p",{className:X.uploadHint,children:"Accepts .md and .txt files"})]}),a.jsx("input",{ref:h,type:"file",accept:".md,.txt",onChange:g,style:{display:"none"}}),c&&a.jsx("p",{style:{fontSize:"var(--mc-font-size-sm)",marginTop:"var(--mc-space-3)",color:c.startsWith("Error")?"var(--mc-error)":"var(--mc-success)"},children:c})]})]})})}async function WH(e){const t=await fetch(`/api/mission-control/planning/${e}`);if(!t.ok)throw new Error("Failed to fetch planning");return t.json()}function UH({issueId:e,source:t,onOpenBeads:n}){var w,v;const[r,s]=x.useState(null),[i,o]=x.useState(!1),[l,c]=x.useState(!1),[u,h]=x.useState(null),[d,p]=x.useState(!1),{data:f,refetch:m}=he({queryKey:["mission-control-planning",e],queryFn:()=>WH(e),refetchInterval:3e4}),g=async()=>{c(!0),h(null);try{const y=t?[t]:["github","linear","rally"];let _=0,b=null;for(const N of y)try{const k=await fetch(`/api/mission-control/planning/${e}/sync-discussions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tracker:N})});if(k.ok){const j=await k.json();_+=j.synced||0}else t&&(b=(await k.json().catch(()=>({error:"Sync failed"}))).error||`HTTP ${k.status}`)}catch{t&&(b="Network error")}b&&_===0?h({message:b,isError:!0}):_>0?h({message:`Synced ${_} — generating status...`,isError:!1}):h({message:"No new discussions",isError:!1}),p(!0);try{const N=await fetch(`/api/mission-control/planning/${e}/status-review`,{method:"POST"});if(N.ok){const k=await N.json(),j=k.cached;j?h({message:_>0?`Synced ${_} (status unchanged)`:"No changes detected",isError:!1}):_>0?h({message:`Synced ${_} + status updated`,isError:!1}):h({message:"Status updated",isError:!1}),s({title:`Status Review${j?" (cached)":""} — ${new Date(k.reviewedAt).toLocaleString()}`,content:k.statusReview})}else{const k=await N.json().catch(()=>({error:"Status review failed"}));_>0&&h({message:`Synced ${_} (status: ${k.error})`,isError:!1})}}catch(N){console.error("Status review generation failed:",N)}finally{p(!1)}m()}catch(y){console.error("Sync failed:",y),h({message:"Sync failed",isError:!0})}finally{c(!1),setTimeout(()=>h(null),6e3)}};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:X.badgeBar,children:[a.jsxs("button",{className:X.badge,onClick:n,title:"View beads tasks",children:[a.jsx(gk,{size:12}),"Tasks"]}),a.jsxs("button",{className:`${X.badge} ${f!=null&&f.state?"":X.badgeDisabled}`,onClick:()=>(f==null?void 0:f.state)&&s({title:"STATE.md",content:f.state}),title:f!=null&&f.state?"View STATE.md":"No STATE.md available",children:[a.jsx(li,{size:12}),"STATE"]}),a.jsxs("button",{className:`${X.badge} ${f!=null&&f.prd?"":X.badgeDisabled}`,onClick:()=>(f==null?void 0:f.prd)&&s({title:"PRD",content:f.prd}),title:f!=null&&f.prd?"View PRD":"No PRD available",children:[a.jsx(li,{size:12}),"PRD"]}),a.jsxs("button",{className:`${X.badge} ${!(f!=null&&f.statusReview)&&!d?X.badgeDisabled:""}`,onClick:async()=>{if(f!=null&&f.statusReview)s({title:`Status Review${f.statusReviewedAt?` (${new Date(f.statusReviewedAt).toLocaleString()})`:""}`,content:f.statusReview});else{p(!0);try{const y=await fetch(`/api/mission-control/planning/${e}/status-review`,{method:"POST"});if(y.ok){const _=await y.json();s({title:"Status Review",content:_.statusReview}),m()}}catch(y){console.error("Failed to generate status review:",y)}finally{p(!1)}}},title:f!=null&&f.statusReview?"View status review (click to refresh)":"Generate status review",children:[a.jsx(FR,{size:12,className:d?X.spinning:""}),d?"Reviewing...":"Status"]}),(f==null?void 0:f.inference)&&a.jsxs("button",{className:X.badge,onClick:()=>s({title:"INFERENCE.md",content:`*The Inference Document is a Shadow Engineering artifact. It analyzes how AI would approach this work — identifying gaps in requirements, risks, and potential implementation strategies — without making any changes. Use it to evaluate readiness before transitioning to AI-driven development.*
614
-
615
- ---
616
-
617
- ${f.inference}`}),title:"View Inference Document (Shadow Engineering)",children:[a.jsx(Hv,{size:12}),"Inference"]}),(((w=f==null?void 0:f.discussions)==null?void 0:w.length)??0)>0&&a.jsxs("button",{className:X.badge,onClick:()=>{const y=f.discussions.map(_=>`## ${_.filename}
618
-
619
- ${_.content}`).join(`
620
-
621
- ---
622
-
623
- `);s({title:"Discussions",content:y})},children:["Discussions (",f.discussions.length,")"]}),(((v=f==null?void 0:f.transcripts)==null?void 0:v.length)??0)>0&&a.jsxs("button",{className:X.badge,onClick:()=>{const y=f.transcripts.map(_=>`## ${_.filename}
624
-
625
- ${_.content}`).join(`
626
-
627
- ---
628
-
629
- `);s({title:"Transcripts",content:y})},children:["Transcripts (",f.transcripts.length,")"]}),a.jsxs("button",{className:X.badge,onClick:()=>o(!0),title:"Upload transcript or note",children:[a.jsx(wk,{size:12}),"Upload"]}),a.jsxs("button",{className:`${X.syncButton} `,onClick:g,disabled:l||d,title:"Sync discussions and generate AI status review",children:[a.jsx(Gs,{size:12,className:l||d?X.spinning:""}),d?"Reviewing...":l?"Syncing...":"Sync"]}),u&&a.jsx("span",{className:X.badge,style:{color:u.isError?"var(--mc-error, #ef4444)":"var(--mc-success, #22c55e)",fontSize:"0.7rem",opacity:.9},children:u.message})]}),r&&a.jsx($H,{title:r.title,content:r.content,onClose:()=>s(null)}),i&&a.jsx(HH,{issueId:e,onClose:()=>{o(!1),m()}})]})}async function qH(){const e=await fetch("/api/mission-control/projects");if(!e.ok)throw new Error("Failed to fetch projects");return e.json()}async function KH(){const e=await fetch("/api/costs/by-issue");if(!e.ok)throw new Error("Failed to fetch costs");return e.json()}function VH({issues:e=[]}){var _;const[t,n]=x.useState(null),[r,s]=x.useState(!1),[i,o]=x.useState(340),l=x.useRef(!1),c=x.useRef(0),u=x.useRef(0),{data:h=[],isLoading:d}=he({queryKey:["mission-control-projects"],queryFn:qH,refetchInterval:1e4}),{data:p}=he({queryKey:["costs-by-issue"],queryFn:KH,refetchInterval:15e3}),f={},m={};for(const b of e)f[b.identifier.toLowerCase()]=b.title,f[b.identifier]=b.title;for(const b of(p==null?void 0:p.issues)||[])m[b.issueId]=b.totalCost,m[b.issueId.toLowerCase()]=b.totalCost;const g=x.useCallback(b=>{n(b)},[]),w=x.useCallback(b=>{l.current=!0,c.current=b.clientX,u.current=i,document.body.style.cursor="col-resize",document.body.style.userSelect="none",b.preventDefault()},[i]);x.useEffect(()=>{const b=k=>{if(!l.current)return;const j=k.clientX-c.current,D=Math.max(240,Math.min(600,u.current+j));o(D)},N=()=>{l.current=!1,document.body.style.cursor="",document.body.style.userSelect=""};return document.addEventListener("mousemove",b),document.addEventListener("mouseup",N),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",N)}},[]);const v=t?h.flatMap(b=>b.features).find(b=>b.issueId===t):null,y=t?f[t.toLowerCase()]||f[t]||t:"";return a.jsxs("div",{className:X.missionControl,children:[a.jsxs("div",{className:X.layout,children:[a.jsxs("div",{className:X.sidebar,style:{width:i,minWidth:i},children:[a.jsxs("div",{className:X.sidebarHeader,children:[a.jsx("h2",{className:X.sidebarTitle,children:"Mission Control"}),a.jsx("p",{className:X.sidebarSubtitle,children:"Active features across projects"})]}),a.jsx("div",{className:X.projectTree,children:d&&h.length===0?a.jsx("div",{className:X.emptyProject,children:"Loading projects..."}):h.length===0?a.jsx("div",{className:X.emptyProject,children:"No projects configured"}):h.map(b=>a.jsx(_9,{name:b.name,features:b.features,selectedFeature:t,onSelectFeature:g,issueTitles:f,issueCosts:m},b.path))})]}),a.jsx("div",{className:X.resizeHandle,onMouseDown:w}),a.jsx("div",{className:X.content,children:t?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:X.featureHeader,children:[a.jsx("h1",{className:X.featureTitle,children:y}),a.jsx("span",{className:X.featureId,children:t}),(v==null?void 0:v.isShadow)&&a.jsx("span",{className:X.badge,style:{borderColor:"var(--mc-accent)",color:"var(--mc-accent)"},children:"Shadow"})]}),a.jsx(UH,{issueId:t,source:(_=e.find(b=>b.identifier===t))==null?void 0:_.source,onOpenBeads:()=>s(!0)}),a.jsx(T9,{issueId:t,issues:e,featureData:v})]}):a.jsx("div",{className:X.contentEmpty,children:a.jsxs("div",{style:{textAlign:"center"},children:[a.jsx(hk,{size:48,style:{marginBottom:"var(--mc-space-4)",opacity:.3}}),a.jsx("p",{children:"Select a feature to view activity"})]})})})]}),r&&t&&a.jsx(ix,{issueId:t,isOpen:r,onClose:()=>s(!1)})]})}const YH={},Xb=e=>{let t;const n=new Set,r=(h,d)=>{const p=typeof h=="function"?h(t):h;if(!Object.is(p,t)){const f=t;t=d??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(m=>m(t,f))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(YH?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,c);return c},QH=e=>e?Xb(e):Xb;var yN={exports:{}},_N={},bN={exports:{}},wN={};/**
630
- * @license React
631
- * use-sync-external-store-shim.production.js
632
- *
633
- * Copyright (c) Meta Platforms, Inc. and affiliates.
634
- *
635
- * This source code is licensed under the MIT license found in the
636
- * LICENSE file in the root directory of this source tree.
637
- */var ba=x;function XH(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var GH=typeof Object.is=="function"?Object.is:XH,JH=ba.useState,ZH=ba.useEffect,eW=ba.useLayoutEffect,tW=ba.useDebugValue;function nW(e,t){var n=t(),r=JH({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return eW(function(){s.value=n,s.getSnapshot=t,sp(s)&&i({inst:s})},[e,n,t]),ZH(function(){return sp(s)&&i({inst:s}),e(function(){sp(s)&&i({inst:s})})},[e]),tW(n),n}function sp(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!GH(e,n)}catch{return!0}}function rW(e,t){return t()}var sW=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?rW:nW;wN.useSyncExternalStore=ba.useSyncExternalStore!==void 0?ba.useSyncExternalStore:sW;bN.exports=wN;var iW=bN.exports;/**
638
- * @license React
639
- * use-sync-external-store-shim/with-selector.production.js
640
- *
641
- * Copyright (c) Meta Platforms, Inc. and affiliates.
642
- *
643
- * This source code is licensed under the MIT license found in the
644
- * LICENSE file in the root directory of this source tree.
645
- */var Dh=x,oW=iW;function aW(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var lW=typeof Object.is=="function"?Object.is:aW,cW=oW.useSyncExternalStore,uW=Dh.useRef,dW=Dh.useEffect,hW=Dh.useMemo,fW=Dh.useDebugValue;_N.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=uW(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=hW(function(){function c(f){if(!u){if(u=!0,h=f,f=r(f),s!==void 0&&o.hasValue){var m=o.value;if(s(m,f))return d=m}return d=f}if(m=d,lW(h,f))return m;var g=r(f);return s!==void 0&&s(m,g)?(h=f,m):(h=f,d=g)}var u=!1,h,d,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,s]);var l=cW(e,i[0],i[1]);return dW(function(){o.hasValue=!0,o.value=l},[l]),fW(l),l};yN.exports=_N;var pW=yN.exports;const mW=wa(pW),SN={},{useDebugValue:gW}=qe,{useSyncExternalStoreWithSelector:vW}=mW;let Gb=!1;const xW=e=>e;function yW(e,t=xW,n){(SN?"production":void 0)!=="production"&&n&&!Gb&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Gb=!0);const r=vW(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return gW(r),r}const Jb=e=>{(SN?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?QH(e):e,n=(r,s)=>yW(t,r,s);return Object.assign(n,t),n},_W=e=>e?Jb(e):Jb,bW=_W((e,t)=>({theme:"dark",toggleTheme:()=>{const n=t().theme==="dark"?"light":"dark";n==="light"?document.documentElement.classList.add("light"):document.documentElement.classList.remove("light"),localStorage.setItem("panopticon.ui.theme",n),e({theme:n})},initTheme:()=>{const n=localStorage.getItem("panopticon.ui.theme"),r=n==="light"||n==="dark"?n:null,s=r||"dark";r||localStorage.setItem("panopticon.ui.theme",s),s==="light"?document.documentElement.classList.add("light"):document.documentElement.classList.remove("light"),e({theme:s})}})),Kr=Object.create(null);Kr.open="0";Kr.close="1";Kr.ping="2";Kr.pong="3";Kr.message="4";Kr.upgrade="5";Kr.noop="6";const Qu=Object.create(null);Object.keys(Kr).forEach(e=>{Qu[Kr[e]]=e});const Cg={type:"error",data:"parser error"},kN=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",CN=typeof ArrayBuffer=="function",NN=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Dx=({type:e,data:t},n,r)=>kN&&t instanceof Blob?n?r(t):Zb(t,r):CN&&(t instanceof ArrayBuffer||NN(t))?n?r(t):Zb(new Blob([t]),r):r(Kr[e]+(t||"")),Zb=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function ew(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let ip;function wW(e,t){if(kN&&e.data instanceof Blob)return e.data.arrayBuffer().then(ew).then(t);if(CN&&(e.data instanceof ArrayBuffer||NN(e.data)))return t(ew(e.data));Dx(e,!1,n=>{ip||(ip=new TextEncoder),t(ip.encode(n))})}const tw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fl=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<tw.length;e++)fl[tw.charCodeAt(e)]=e;const SW=e=>{let t=e.length*.75,n=e.length,r,s=0,i,o,l,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),h=new Uint8Array(u);for(r=0;r<n;r+=4)i=fl[e.charCodeAt(r)],o=fl[e.charCodeAt(r+1)],l=fl[e.charCodeAt(r+2)],c=fl[e.charCodeAt(r+3)],h[s++]=i<<2|o>>4,h[s++]=(o&15)<<4|l>>2,h[s++]=(l&3)<<6|c&63;return u},kW=typeof ArrayBuffer=="function",Mx=(e,t)=>{if(typeof e!="string")return{type:"message",data:EN(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:CW(e.substring(1),t)}:Qu[n]?e.length>1?{type:Qu[n],data:e.substring(1)}:{type:Qu[n]}:Cg},CW=(e,t)=>{if(kW){const n=SW(e);return EN(n,t)}else return{base64:!0,data:e}},EN=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},jN="",NW=(e,t)=>{const n=e.length,r=new Array(n);let s=0;e.forEach((i,o)=>{Dx(i,!1,l=>{r[o]=l,++s===n&&t(r.join(jN))})})},EW=(e,t)=>{const n=e.split(jN),r=[];for(let s=0;s<n.length;s++){const i=Mx(n[s],t);if(r.push(i),i.type==="error")break}return r};function jW(){return new TransformStream({transform(e,t){wW(e,n=>{const r=n.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const i=new DataView(s.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{s=new Uint8Array(9);const i=new DataView(s.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(s[0]|=128),t.enqueue(s),t.enqueue(n)})}})}let op;function wu(e){return e.reduce((t,n)=>t+n.length,0)}function Su(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let s=0;s<t;s++)n[s]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function RW(e,t){op||(op=new TextDecoder);const n=[];let r=0,s=-1,i=!1;return new TransformStream({transform(o,l){for(n.push(o);;){if(r===0){if(wu(n)<1)break;const c=Su(n,1);i=(c[0]&128)===128,s=c[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(wu(n)<2)break;const c=Su(n,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(wu(n)<8)break;const c=Su(n,8),u=new DataView(c.buffer,c.byteOffset,c.length),h=u.getUint32(0);if(h>Math.pow(2,21)-1){l.enqueue(Cg);break}s=h*Math.pow(2,32)+u.getUint32(4),r=3}else{if(wu(n)<s)break;const c=Su(n,s);l.enqueue(Mx(i?c:op.decode(c),t)),r=0}if(s===0||s>e){l.enqueue(Cg);break}}}})}const RN=4;function gt(e){if(e)return PW(e)}function PW(e){for(var t in gt.prototype)e[t]=gt.prototype[t];return e}gt.prototype.on=gt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};gt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,s=0;s<n.length;s++)if(r=n[s],r===t||r.fn===t){n.splice(s,1);break}return n.length===0&&delete this._callbacks["$"+e],this};gt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,s=n.length;r<s;++r)n[r].apply(this,t)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};gt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Mh=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),nr=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),TW="arraybuffer";function PN(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const DW=nr.setTimeout,MW=nr.clearTimeout;function Ah(e,t){t.useNativeTimers?(e.setTimeoutFn=DW.bind(nr),e.clearTimeoutFn=MW.bind(nr)):(e.setTimeoutFn=nr.setTimeout.bind(nr),e.clearTimeoutFn=nr.clearTimeout.bind(nr))}const AW=1.33;function LW(e){return typeof e=="string"?OW(e):Math.ceil((e.byteLength||e.size)*AW)}function OW(e){let t=0,n=0;for(let r=0,s=e.length;r<s;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function TN(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function IW(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function BW(e){let t={},n=e.split("&");for(let r=0,s=n.length;r<s;r++){let i=n[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class FW extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class Ax extends gt{constructor(t){super(),this.writable=!1,Ah(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new FW(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=Mx(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=IW(t);return n.length?"?"+n:""}}class zW extends Ax{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};EW(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,NW(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=TN()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let DN=!1;try{DN=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const $W=DN;function HW(){}class WW extends zW{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(s,i)=>{this.onError("xhr post error",s,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Ur extends gt{constructor(t,n,r){super(),this.createRequest=t,Ah(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=PN(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=Ur.requestsCount++,Ur.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=HW,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Ur.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Ur.requestsCount=0;Ur.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",nw);else if(typeof addEventListener=="function"){const e="onpagehide"in nr?"pagehide":"unload";addEventListener(e,nw,!1)}}function nw(){for(let e in Ur.requests)Ur.requests.hasOwnProperty(e)&&Ur.requests[e].abort()}const UW=function(){const e=MN({xdomain:!1});return e&&e.responseType!==null}();class qW extends WW{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=UW&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Ur(MN,this.uri(),t)}}function MN(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||$W))return new XMLHttpRequest}catch{}if(!t)try{return new nr[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const AN=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class KW extends Ax{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=AN?{}:PN(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],s=n===t.length-1;Dx(r,this.supportsBinary,i=>{try{this.doWrite(r,i)}catch{}s&&Mh(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=TN()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const ap=nr.WebSocket||nr.MozWebSocket;class VW extends KW{createSocket(t,n,r){return AN?new ap(t,n,r):n?new ap(t,n):new ap(t)}doWrite(t,n){this.ws.send(n)}}class YW extends Ax{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=RW(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),s=jW();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();const i=()=>{r.read().then(({done:l,value:c})=>{l||(this.onPacket(c),i())}).catch(l=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],s=n===t.length-1;this._writer.write(r).then(()=>{s&&Mh(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const QW={websocket:VW,webtransport:YW,polling:qW},XW=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,GW=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ng(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let s=XW.exec(e||""),i={},o=14;for(;o--;)i[GW[o]]=s[o]||"";return n!=-1&&r!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=JW(i,i.path),i.queryKey=ZW(i,i.query),i}function JW(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function ZW(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,i){s&&(n[s]=i)}),n}const Eg=typeof addEventListener=="function"&&typeof removeEventListener=="function",Xu=[];Eg&&addEventListener("offline",()=>{Xu.forEach(e=>e())},!1);class hi extends gt{constructor(t,n){if(super(),this.binaryType=TW,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=Ng(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=Ng(n.host).host);Ah(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const s=r.prototype.name;this.transports.push(s),this._transportsByName[s]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=BW(this.opts.query)),Eg&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Xu.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=RN,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&hi.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",hi.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(n+=LW(s)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Mh(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,s){if(typeof n=="function"&&(s=n,n=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:t,data:n,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(hi.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Eg&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Xu.indexOf(this._offlineEventListener);r!==-1&&Xu.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}hi.protocol=RN;class eU extends hi{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;hi.priorWebsocketSuccess=!1;const s=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;hi.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const p=new Error("probe error");p.transport=n.name,this.emitReserved("upgradeError",p)}}))};function i(){r||(r=!0,h(),n.close(),n=null)}const o=d=>{const p=new Error("probe error: "+d);p.transport=n.name,i(),this.emitReserved("upgradeError",p)};function l(){o("transport closed")}function c(){o("socket closed")}function u(d){n&&d.name!==n.name&&i()}const h=()=>{n.removeListener("open",s),n.removeListener("error",o),n.removeListener("close",l),this.off("close",c),this.off("upgrading",u)};n.once("open",s),n.once("error",o),n.once("close",l),this.once("close",c),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let tU=class extends eU{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(s=>QW[s]).filter(s=>!!s)),super(t,r)}};function nU(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=Ng(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}const rU=typeof ArrayBuffer=="function",sU=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,LN=Object.prototype.toString,iU=typeof Blob=="function"||typeof Blob<"u"&&LN.call(Blob)==="[object BlobConstructor]",oU=typeof File=="function"||typeof File<"u"&&LN.call(File)==="[object FileConstructor]";function Lx(e){return rU&&(e instanceof ArrayBuffer||sU(e))||iU&&e instanceof Blob||oU&&e instanceof File}function Gu(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(Gu(e[n]))return!0;return!1}if(Lx(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Gu(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Gu(e[n]))return!0;return!1}function aU(e){const t=[],n=e.data,r=e;return r.data=jg(n,t),r.attachments=t.length,{packet:r,buffers:t}}function jg(e,t){if(!e)return e;if(Lx(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=jg(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=jg(e[r],t));return n}return e}function lU(e,t){return e.data=Rg(e.data,t),delete e.attachments,e}function Rg(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Rg(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Rg(e[n],t));return e}const ON=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],cU=5;var xe;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(xe||(xe={}));class uU{constructor(t){this.replacer=t}encode(t){return(t.type===xe.EVENT||t.type===xe.ACK)&&Gu(t)?this.encodeAsBinary({type:t.type===xe.EVENT?xe.BINARY_EVENT:xe.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===xe.BINARY_EVENT||t.type===xe.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=aU(t),r=this.encodeAsString(n.packet),s=n.buffers;return s.unshift(r),s}}class Ox extends gt{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===xe.BINARY_EVENT;r||n.type===xe.BINARY_ACK?(n.type=r?xe.EVENT:xe.ACK,this.reconstructor=new dU(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Lx(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(xe[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===xe.BINARY_EVENT||r.type===xe.BINARY_ACK){const i=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const o=t.substring(i,n);if(o!=Number(o)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(i,n)}else r.nsp="/";const s=t.charAt(n+1);if(s!==""&&Number(s)==s){const i=n+1;for(;++n;){const o=t.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===t.length)break}r.id=Number(t.substring(i,n+1))}if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(Ox.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case xe.CONNECT:return Ud(n);case xe.DISCONNECT:return n===void 0;case xe.CONNECT_ERROR:return typeof n=="string"||Ud(n);case xe.EVENT:case xe.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&ON.indexOf(n[0])===-1);case xe.ACK:case xe.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class dU{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=lU(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function hU(e){return typeof e=="string"}const fU=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function pU(e){return e===void 0||fU(e)}function Ud(e){return Object.prototype.toString.call(e)==="[object Object]"}function mU(e,t){switch(e){case xe.CONNECT:return t===void 0||Ud(t);case xe.DISCONNECT:return t===void 0;case xe.EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&ON.indexOf(t[0])===-1);case xe.ACK:return Array.isArray(t);case xe.CONNECT_ERROR:return typeof t=="string"||Ud(t);default:return!1}}function gU(e){return hU(e.nsp)&&pU(e.id)&&mU(e.type,e.data)}const vU=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ox,Encoder:uU,get PacketType(){return xe},isPacketValid:gU,protocol:cU},Symbol.toStringTag,{value:"Module"}));function xr(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const xU=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class IN extends gt{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[xr(t,"open",this.onopen.bind(this)),xr(t,"packet",this.onpacket.bind(this)),xr(t,"error",this.onerror.bind(this)),xr(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,s,i;if(xU.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const o={type:xe.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const h=this.ids++,d=n.pop();this._registerAckCallback(h,d),o.id=h}const l=(s=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||s===void 0?void 0:s.writable,c=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,n){var r;const s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},s),o=(...l)=>{this.io.clearTimeoutFn(i),n.apply(this,l)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((r,s)=>{const i=(o,l)=>o?s(o):r(l);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((s,...i)=>(this._queue[0],s!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(s)):(this._queue.shift(),n&&n(null,...i)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:xe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case xe.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case xe.EVENT:case xe.BINARY_EVENT:this.onevent(t);break;case xe.ACK:case xe.BINARY_ACK:this.onack(t);break;case xe.DISCONNECT:this.ondisconnect();break;case xe.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...s){r||(r=!0,n.packet({type:xe.ACK,id:t,data:s}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:xe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function Ma(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Ma.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Ma.prototype.reset=function(){this.attempts=0};Ma.prototype.setMin=function(e){this.ms=e};Ma.prototype.setMax=function(e){this.max=e};Ma.prototype.setJitter=function(e){this.jitter=e};class Pg extends gt{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Ah(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Ma({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const s=n.parser||vU;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new tU(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=xr(n,"open",function(){r.onopen(),t&&t()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},o=xr(n,"error",i);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{s(),i(new Error("timeout")),n.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(xr(t,"ping",this.onping.bind(this)),xr(t,"data",this.ondata.bind(this)),xr(t,"error",this.onerror.bind(this)),xr(t,"close",this.onclose.bind(this)),xr(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Mh(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new IN(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(s=>{s?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",s)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const nl={};function Ju(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=nU(e,t.path||"/socket.io"),r=n.source,s=n.id,i=n.path,o=nl[s]&&i in nl[s].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let c;return l?c=new Pg(r,t):(nl[s]||(nl[s]=new Pg(r,t)),c=nl[s]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Ju,{Manager:Pg,Socket:IN,io:Ju,connect:Ju});function yU(){const e=dn(),t=x.useRef(null);x.useEffect(()=>{const n=Ju({path:"/socket.io",transports:["websocket","polling"],reconnectionDelay:1e3,reconnectionDelayMax:1e4});t.current=n,n.on("connect",()=>{console.log("[socket.io] Connected for real-time issue updates")}),n.on("disconnect",i=>{console.log("[socket.io] Disconnected:",i)});const r=i=>{e.setQueriesData({queryKey:["issues"]},i)};n.on("issues:snapshot",r),n.on("issues:updated",r);const s=()=>{document.visibilityState==="visible"&&n.connected&&n.emit("issues:request-snapshot")};return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s),n.disconnect(),t.current=null}},[e])}const BN={"mission-control":"/",kanban:"/kanban",agents:"/agents",convoys:"/convoys",handoffs:"/handoffs",activity:"/activity",metrics:"/metrics",costs:"/costs",skills:"/skills",health:"/health",settings:"/settings"},_U=Object.fromEntries(Object.entries(BN).map(([e,t])=>[t,e]));function rw(){const e=window.location.pathname;return _U[e]||"mission-control"}const bU=400,wU=1200,SU=700;async function kU(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function CU(){const e=await fetch("/api/issues");if(!e.ok)throw new Error("Failed to fetch issues");return e.json()}async function NU(){const e=await fetch("/api/tracker-status");if(!e.ok)throw new Error("Failed to fetch tracker status");return e.json()}async function EU(){const e=await fetch("/api/confirmations");if(!e.ok)throw new Error("Failed to fetch confirmations");return e.json()}async function sw(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 jU(){const[e,t]=x.useState(rw),[n,r]=x.useState(null),[s,i]=x.useState(null),[o,l]=x.useState(SU),[c,u]=x.useState(!1),[h,d]=x.useState(!1),[p,f]=x.useState(null),[m,g]=x.useState(!1),[w,v]=x.useState(!1),y=x.useRef(null),{theme:_,toggleTheme:b,initTheme:N}=bW();yU();const{data:k}=he({queryKey:["tracker-status"],queryFn:NU,refetchInterval:6e4,retry:!1}),j=(k==null?void 0:k.configured.filter(C=>!C.hasKey))||[];x.useEffect(()=>{N()},[N]);const D=x.useCallback(C=>{t(C);const U=BN[C];window.location.pathname!==U&&window.history.pushState({tab:C},"",U)},[]);x.useEffect(()=>{const C=()=>{t(rw())};return window.addEventListener("popstate",C),()=>window.removeEventListener("popstate",C)},[]);const{data:F=[]}=he({queryKey:["agents"],queryFn:kU,refetchInterval:5e3}),{data:P=[]}=he({queryKey:["issues"],queryFn:CU}),{data:O=[]}=he({queryKey:["confirmations"],queryFn:EU,refetchInterval:2e3});x.useEffect(()=>{O.length>0&&!p&&f(O[0])},[O,p]);const T=s?F.find(C=>{var U;return((U=C.issueId)==null?void 0:U.toLowerCase())===s.toLowerCase()}):null,E=s?P.find(C=>C.identifier.toLowerCase()===s.toLowerCase()):null,R=x.useCallback(C=>{C.preventDefault(),u(!0)},[]),L=x.useCallback(C=>{if(!c||!y.current)return;const I=y.current.getBoundingClientRect().right-C.clientX;l(Math.min(wU,Math.max(bU,I)))},[c]),$=x.useCallback(()=>{u(!1)},[]);x.useEffect(()=>(c&&(document.addEventListener("mousemove",L),document.addEventListener("mouseup",$),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",$),document.body.style.cursor="",document.body.style.userSelect=""}),[c,L,$]);const K=x.useCallback(()=>{d(C=>!C)},[]),A=x.useCallback(async()=>{if(p)try{await sw(p.id,!0),f(null)}catch(C){console.error("Failed to confirm:",C)}},[p]),H=x.useCallback(async()=>{if(p)try{await sw(p.id,!1),f(null)}catch(C){console.error("Failed to deny:",C)}},[p]),S=x.useCallback(()=>{f(null)},[]);x.useEffect(()=>{const C=U=>{U.key==="/"&&!["INPUT","TEXTAREA"].includes(U.target.tagName)&&(U.preventDefault(),g(!0))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[]);const Y=x.useCallback(C=>{i(C),D("kanban")},[]),B=h?"calc(100% - 300px)":`${o}px`;return a.jsxs("div",{className:"h-screen bg-surface flex flex-col overflow-hidden transition-colors duration-150",children:[a.jsx("header",{className:"bg-surface-raised border-b border-divider px-4 py-2 shrink-0",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("button",{onClick:()=>D("mission-control"),className:"flex items-center gap-2 shrink-0 hover:opacity-80 transition-opacity",title:"Go to Mission Control",children:[a.jsx(hh,{className:"w-5 h-5 text-blue-400"}),a.jsx("h1",{className:"text-lg font-bold text-content whitespace-nowrap",children:"Panopticon"})]}),a.jsx(JB,{}),a.jsx("nav",{className:"flex gap-0.5 overflow-x-auto min-w-0 scrollbar-hide",children:[{id:"mission-control",label:"Mission Control",icon:hk},{id:"kanban",label:"Board",icon:WR},{id:"agents",label:"Agents",icon:ec},{id:"convoys",label:"Convoys",icon:ec},{id:"handoffs",label:"Handoffs",icon:$v},{id:"activity",label:"Activity",icon:no},{id:"metrics",label:"Metrics",icon:MR},{id:"costs",label:"Costs",icon:uo},{id:"skills",label:"Skills",icon:ck},{id:"health",label:"Health",icon:va},{id:"settings",label:"Settings",icon:xk}].map(({id:C,label:U,icon:I})=>a.jsxs("button",{onClick:()=>D(C),className:`flex items-center gap-1 px-2.5 py-1.5 rounded-md text-xs whitespace-nowrap transition-colors ${e===C?"bg-blue-600 text-white":"text-content-subtle hover:text-content hover:bg-surface-overlay"}`,children:[a.jsx(I,{className:"w-3.5 h-3.5"}),U]},C))}),a.jsx("button",{onClick:b,className:"ml-auto px-2.5 py-1.5 rounded-md text-xs whitespace-nowrap transition-colors text-content-subtle hover:text-content hover:bg-surface-overlay",title:`Switch to ${_==="dark"?"light":"dark"} mode`,children:_==="dark"?a.jsx(JR,{className:"w-3.5 h-3.5"}):a.jsx(VR,{className:"w-3.5 h-3.5"})})]})}),j.length>0&&!w&&a.jsxs("div",{className:"bg-amber-500/10 border-b border-amber-500/30 px-4 py-2 flex items-center gap-3 shrink-0",children:[a.jsx(Wn,{className:"w-4 h-4 text-amber-400 shrink-0"}),a.jsxs("p",{className:"text-amber-400 text-sm flex-1",children:[a.jsxs("span",{className:"font-semibold",children:["Missing API key",j.length>1?"s":"",":"]})," ",j.map(C=>a.jsxs("span",{children:[C.name," (",a.jsx("code",{className:"font-mono text-xs bg-amber-500/20 px-1 rounded",children:C.envVar}),")"]},C.type)).reduce((C,U,I)=>I===0?[U]:[...C,", ",U],[]),"."," ",a.jsx("button",{onClick:()=>D("settings"),className:"underline hover:text-amber-300 font-semibold",children:"Configure in Settings"})]}),a.jsx("button",{onClick:()=>v(!0),className:"text-amber-400/60 hover:text-amber-400 shrink-0",title:"Dismiss",children:a.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),a.jsxs("main",{ref:y,className:"flex-1 flex overflow-hidden",children:[e==="mission-control"&&a.jsx("div",{className:"w-full h-full",children:a.jsx(VH,{issues:P})}),e==="kanban"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`flex-1 overflow-auto p-6 ${s?"":"w-full"}`,children:[a.jsx(hF,{}),a.jsx(OM,{selectedIssue:s,onSelectIssue:i})]}),s&&E&&a.jsxs(a.Fragment,{children:[a.jsx("div",{onMouseDown:R,className:`w-1 hover:w-1.5 bg-surface-overlay hover:bg-blue-500 cursor-col-resize transition-colors shrink-0 ${c?"bg-blue-500":""}`}),a.jsxs("div",{style:{width:B},className:"relative shrink-0 h-full flex flex-col",children:[a.jsx("button",{onClick:K,className:"absolute top-2 left-2 z-10 p-1.5 bg-surface-overlay hover:bg-surface-emphasis rounded text-content-subtle hover:text-content",title:h?"Collapse panel":"Expand panel",children:h?a.jsx(KR,{className:"w-4 h-4"}):a.jsx(UR,{className:"w-4 h-4"})}),a.jsx(DB,{agent:T??void 0,issueId:s,issueUrl:E.url,issue:E,onClose:()=>i(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(zA,{selectedAgent:n,onSelectAgent:r}),n&&a.jsx(WA,{agentId:n})]})}),e==="skills"&&a.jsx("div",{className:"p-6 w-full overflow-auto",children:a.jsx(KA,{})}),e==="health"&&a.jsx("div",{className:"p-6 w-full overflow-auto",children:a.jsx(qA,{})}),e==="activity"&&a.jsx("div",{className:"w-full h-full",children:a.jsx(OB,{onClose:()=>D("kanban")})}),e==="convoys"&&a.jsx("div",{className:"w-full h-full",children:a.jsx(qB,{onClose:()=>D("kanban")})}),e==="metrics"&&a.jsx("div",{className:"w-full overflow-auto",children:a.jsx(mF,{})}),e==="costs"&&a.jsx("div",{className:"w-full overflow-auto",children:a.jsx(vF,{})}),e==="handoffs"&&a.jsx("div",{className:"w-full overflow-auto",children:a.jsx(aF,{})}),e==="settings"&&a.jsx("div",{className:"p-6 w-full overflow-auto",children:a.jsx(EF,{})})]}),a.jsx(lF,{request:p,isOpen:!!p,onConfirm:A,onDeny:H,onClose:S}),a.jsx(n8,{isOpen:m,onClose:()=>g(!1),onSelectIssue:Y,cycleFilter:"current",includeCompletedFilter:!1})]})}const RU=new B4({defaultOptions:{queries:{refetchInterval:6e4,staleTime:3e4,refetchIntervalInBackground:!1}}});lp.createRoot(document.getElementById("root")).render(a.jsx(qe.StrictMode,{children:a.jsx(F4,{client:RU,children:a.jsx(jU,{})})}));